UNPKG

filepond

Version:

FilePond, where files go to stretch their bits.

87 lines (86 loc) • 2.84 kB
import type { Snippet } from 'svelte'; import type { Bounds, Rect, SpringOptions } from '../../../types/index.js'; import type { Vector } from '../../../utils/vector.js'; export { default as SpringElement } from './index.svelte'; export interface SpringElementOptions { /** Defaults to `undefined` */ id?: string; /** Defaults to `'div'` */ tag?: string; /** Defaults to `'div'`` */ subtag?: string; /** Part to assign to root element */ part?: string; /** Defaults to `{}` */ attrs?: { [key: string]: string | boolean | number | undefined; }; /** Defaults to `{}` */ subattrs?: { [key: string]: string | boolean | number | undefined; }; /** Defaults to `{}` */ dataset?: { [key: string]: string | boolean | number | undefined; }; /** Defaults to `{}` */ styles?: { [key: string]: string | number; }; /** Class to use on outer element */ class?: string; /** Class to use on inner element */ subclass?: string; /** Element translation */ translation?: Vector; /** Element translation origin */ translationFrom?: Vector; /** Element origin scalar */ scaleFrom?: number; /** Element scalar */ scale?: number; /** Element origin opacity */ opacityFrom?: number; /** Element opacity */ opacity?: number; /** Set to `true` if can't be interacted with */ inert?: boolean | null; /** Set to false to virtualize children */ shouldRenderChildren?: boolean; reduceMotion?: boolean; springOptions?: SpringOptions; scaleSpringOptions?: SpringOptions; opacitySpringOptions?: SpringOptions; translationSpringOptions?: SpringOptions; /** Called when root element created */ onroot?: (root: HTMLElement) => void; /** Called on root element measure */ onmeasure?: (bounds: Bounds) => void; /** Called on root element sync measure */ onmeasuresync?: (bounds: Bounds) => void; /** Called on element measure */ onelementmeasure?: (rect: Rect) => void; /** Called when computed element absolute rect */ onmeasureabsoluterect?: (rect: Rect) => void; /** Called when spring animation ends */ onspringcomplete?: (state: { opacity: number; scale: number; }) => void; /** Called when children render state changes */ onchangerendercontent?: (shouldRenderContent: boolean) => void; /** Called before rendering content */ shouldRenderContent?: (rect: Rect) => boolean; /** Called before passing data to content */ beforeRenderChildren?: (state: { visualRect: Rect; }) => { visualRect: Rect; } | undefined; /** Spring element children */ children: Snippet<[ { visualRect: Rect | null; } | undefined ]>; }