@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
36 lines (35 loc) • 1.65 kB
TypeScript
import { type AnimationOptions } from 'motion';
/**
* Build a reset record for whileTap on pointerup.
*
* For each key present in `whileTap`, this returns the value from `animate`
* if provided, otherwise from `initial`. Keys not present in `whileTap` are
* omitted to avoid unintended style changes.
*
* @param initial Initial keyframe record.
* @param animateDef Animate keyframe record.
* @param whileTap While-tap keyframe record.
* @return Minimal record to restore post-tap values.
*/
export declare const buildTapResetRecord: (initial: Record<string, unknown>, animateDef: Record<string, unknown>, whileTap: Record<string, unknown>) => Record<string, unknown>;
/**
* Attach whileTap interactions to an element.
*
* Uses motion-dom's `press()` for pointer and Enter-key handling (with
* primary-pointer filtering, drag interop, and global release listeners).
* Space-key support is added manually since `press()` only handles Enter.
*
* @param el Element to attach listeners to.
* @param whileTap While-tap keyframe record.
* @param initial Initial keyframe record.
* @param animateDef Animate keyframe record.
* @param callbacks Optional lifecycle callbacks.
* @return Cleanup function to remove listeners.
*/
export declare const attachWhileTap: (el: HTMLElement, whileTap: Record<string, unknown> | undefined, initial?: Record<string, unknown>, animateDef?: Record<string, unknown>, callbacks?: {
onTapStart?: () => void;
onTap?: () => void;
onTapCancel?: () => void;
hoverDef?: Record<string, unknown> | undefined;
hoverFallbackTransition?: AnimationOptions | undefined;
}) => (() => void);