UNPKG

@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

38 lines (37 loc) 1.63 kB
/** * Identifier for a `<LayoutGroup>` subtree. Descendants prefix their * `layoutId` lookups with this so two `<LayoutGroup>`s containing the * same `layoutId` values don't cross-animate. * * `undefined` means "no enclosing LayoutGroup" — the descendant uses * `layoutId` verbatim against the global registry, preserving the * existing un-grouped behaviour. */ export type LayoutGroupContext = string | undefined; /** * Publish a LayoutGroup id for descendants. Called by `<LayoutGroup>` * after computing its own (possibly inherited and chained) id. */ export declare const setLayoutGroupContext: (id: LayoutGroupContext) => void; /** * Read the nearest LayoutGroup id, or `undefined` if not inside one. * * `_MotionContainer.svelte` reads this to prefix `layoutId` when * snapshotting and consuming against the registry, so shared-layout * animations stay scoped to the surrounding group. */ export declare const getLayoutGroupContext: () => LayoutGroupContext; /** * Combine a parent group's id with a descendant LayoutGroup's own id * to produce the effective scope id. Mirrors framer-motion's chaining * (`"parent-id"` + `"-"` + `"own-id"`). * * Either side can be `undefined`; the result is the other one, or * `undefined` if both are absent. */ export declare const chainLayoutGroupId: (parent: LayoutGroupContext, own: string | undefined) => LayoutGroupContext; /** * Apply a LayoutGroup scope to a raw `layoutId` for registry lookups. * Returns the un-prefixed id when no group is in scope. */ export declare const scopeLayoutId: (groupId: LayoutGroupContext, layoutId: string) => string;