@humanspeak/svelte-motion
Version:
Framer Motion for Svelte 5. Declarative motion.<tag> components with AnimatePresence exit animations, gestures (hover, tap, drag, focus, in-view), variants, FLIP layout animations, shared-layout transitions, spring physics, and scroll-linked motion values
34 lines (33 loc) • 1.09 kB
TypeScript
import type { AnimationOptions } from 'motion';
/**
* Snapshot stored for a layoutId when an element unmounts.
*/
type LayoutIdEntry = {
rect: DOMRect;
transition?: AnimationOptions;
};
/**
* Registry that stores last-known rect + transition for each layoutId.
*
* - `snapshot(id, rect, transition)` — called when an element with a layoutId unmounts.
* - `consume(id)` — called by a newly mounted element. Returns and **deletes** the entry (one-shot).
*/
export type LayoutIdRegistry = {
snapshot(id: string, rect: DOMRect, transition?: AnimationOptions): void;
consume(id: string): LayoutIdEntry | undefined;
};
export declare const layoutIdRegistry: LayoutIdRegistry;
/**
* Get the global layoutId registry.
*
* @returns The singleton `LayoutIdRegistry` instance.
*
* @example
* ```ts
* const registry = getLayoutIdRegistry()
* registry.snapshot('hero', element.getBoundingClientRect())
* const entry = registry.consume('hero') // one-shot: returns and deletes
* ```
*/
export declare const getLayoutIdRegistry: () => LayoutIdRegistry;
export {};