/** * Animation type names (primary names plus v2.x legacy aliases) */ export type AnimationType = "fade" | "fade-up" | "fade-down" | "fade-left" | "fade-right" | "fade-up-right" | "fade-up-left" | "fade-down-right" | "fade-down-left" | "zoom-in" | "zoom-in-up" | "zoom-in-down" | "zoom-in-left" | "zoom-in-right" | "zoom-out" | "zoom-out-up" | "zoom-out-down" | "zoom-out-left" | "zoom-out-right" | "slide-up" | "slide-down" | "slide-left" | "slide-right" | "flip-left" | "flip-right" | "flip-up" | "flip-down" | "slide-rotate" | "bounce-in" | "fade-in" | "fade-in-up" | "fade-in-down" | "fade-in-left" | "fade-in-right" | "flip" | "flip-x"; /** * Options for the framework-neutral `animate` core and the Svelte action. */ export type AnimateOptions = { /** * - Animation type to apply */ animation?: AnimationType | undefined; /** * - Animation duration in milliseconds */ duration?: number | undefined; /** * - Repeat animation on every scroll */ repeat?: boolean | undefined; /** * - Show a visual trigger indicator for debugging */ debug?: boolean | undefined; /** * - Debug indicator color */ sentinelColor?: string | undefined; /** * - Unique debug indicator identifier */ sentinelId?: string | undefined; /** * - Label to show on the debug indicator */ debugLabel?: string | undefined; /** * - Viewport offset in pixels (positive = trigger earlier). This is separate from calculateRootMargin's percentage helper. */ offset?: number | undefined; /** * - CSS timing function */ easing?: string | undefined; /** * - Animation delay in milliseconds */ delay?: number | undefined; /** * - IntersectionObserver threshold */ threshold?: number | number[] | undefined; /** * - IntersectionObserver root margin override */ rootMargin?: string | undefined; /** * - Element to observe instead of the animated element */ observerTarget?: HTMLElement | undefined; /** * - Callback when animation triggers */ onVisible?: ((element: HTMLElement) => void) | undefined; /** * - Callback when a repeating animation exits */ onHidden?: ((element: HTMLElement) => void) | undefined; }; /** * Deterministic lifecycle handle returned by `animate` and the Svelte action. * `update` receives the complete new option set (replacement semantics). */ export type AnimateHandle = { /** * - Replace the active options */ update: (newOptions?: AnimateOptions) => void; /** * - Release observers, listeners, and DOM state */ destroy: () => void; }; /** * Options for `useIntersection` / `useIntersectionOnce` only (not `animate`). * Composable defaults: threshold 0.5, rootMargin '-10% 0px -10% 0px', root null. * Differ from AnimateOptions (threshold 0, offset-derived rootMargin). */ export type IntersectionOptions = { /** * - IntersectionObserver threshold */ threshold?: number | number[] | undefined; /** * - margin around root */ rootMargin?: string | undefined; /** * - root element for observation */ root?: Element | null | undefined; }; /** * Return type for useIntersection and useIntersectionOnce composables */ export type UseIntersectionReturn = { /** * - Reference to the DOM element being observed */ element: HTMLElement | null; /** * - Whether the element is currently visible in viewport */ isVisible: boolean; };