/** * `useLayout` animates an element between layout positions using FLIP * (First, Last, Invert, Play). Vue parity for the React `useLayout` hook. * * const { ref } = useLayout({ duration: 300 }) *
{{ items }}
* * The composable captures the bound element's bounding rect on every * mount / update tick. When the position or size changes, it inverts the * delta with a transform (so the element paints at its old location) * and animates the transform back to identity. * * Per-frame state is driven by the vanilla `play()` from `@kinem/core`, * not Vue reactivity. */ import { type EasingFn, type LayoutGroup, type PlayOpts, type SpringOpts } from "@kinem/core"; import { type ShallowRef } from "vue"; export interface UseLayoutOpts { /** Tween duration in ms. Default 300. Ignored when `spring` is set. */ readonly duration?: number; readonly easing?: EasingFn; /** * Use spring physics instead of a fixed-duration tween. The spring's * settling time becomes the animation duration, and `duration` / * `easing` are ignored. */ readonly spring?: SpringOpts; readonly backend?: PlayOpts["backend"]; /** * Whether to animate scale as well as position. Default true. Set to * false if only positional FLIP is desired (useful for elements whose * size shouldn't visually stretch during re-layout). */ readonly animateScale?: boolean; /** * Shared-element layout id. When set, the composable consumes any * rect captured under this id from `layoutGroup` on mount and uses it * as the FLIP "previous" rect. On unmount the composable captures its * current rect under the same id. */ readonly layoutId?: string; /** * Registry to use for shared-element captures. Defaults to the * process-wide `defaultLayoutGroup`. */ readonly layoutGroup?: LayoutGroup; } export interface UseLayoutResult { readonly ref: ShallowRef; } export declare function useLayout(opts?: UseLayoutOpts): UseLayoutResult; //# sourceMappingURL=useLayout.d.ts.map