@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
48 lines (47 loc) • 1.85 kB
TypeScript
import type { Writable } from 'svelte/store';
/**
* Provide a writable store for the current variant key so children can
* react to changes over time (true inheritance like Framer Motion).
*
* @param store Writable store holding the current variant name.
*/
export declare const setVariantContext: (store: Writable<string | undefined>) => void;
/**
* Read the parent's variant store (if any). Children subscribe to this store
* to inherit and react to parent `animate` changes.
*
* @returns The parent variant store, or `undefined` if none exists.
*/
export declare const getVariantContext: () => Writable<string | undefined> | undefined;
/**
* Set initial={false} in context so children inherit it.
*
* @param value Whether the parent has `initial={false}`.
*/
export declare const setInitialFalseContext: (value: boolean) => void;
/**
* Check if parent has initial={false}.
*
* @returns `true` if a parent set `initial={false}`, otherwise `false`.
*/
export declare const getInitialFalseContext: () => boolean;
/**
* Provide a writable store carrying the current motion component's
* `custom` value so descendant motion components without their own
* `custom` prop can inherit it — and re-resolve their variants when the
* parent's `custom` changes.
*
* Mirrors framer-motion's variant-tree custom propagation. A store
* (rather than a snapshot) lets descendants react to changes the parent
* makes after mount.
*
* @param store Writable store holding the current component's effective `custom`.
*/
export declare const setCustomContext: (store: Writable<unknown>) => void;
/**
* Read the nearest ancestor's `custom` store (if any).
*
* @returns The ancestor's writable store, or `undefined` when no motion
* ancestor has set one.
*/
export declare const getCustomContext: () => Writable<unknown> | undefined;