import type { MotionNameSpace } from "./utils.js"; import type { MotionState } from "../../state/motion-state.js"; import type { Snippet } from "svelte"; import { Context } from "../../vendor/runed/index.js"; export interface LayoutMotionScope { states: Set; register: (state: MotionState) => void; unregister: (state: MotionState) => void; } export declare const LayoutMotionScopeContext: Context; /** * Symbol to indicate that the update should not be run * This is useful for cases where you want to update the layout * but not run the update function */ export declare const STOP_UPDATE: unique symbol; export type LayoutMotionNamespace = MotionNameSpace & { /** * Expose update that runs beforeUpdate on registered states in parent-first order */ update: () => void; } & { update: { /** * Allows you to pass a function that will be called to run the update * e.g * * ```ts * const layout = createLayoutMotion(motion); * const fn = layout.update.with(() => deleteAll()); * // called in an event handler or something * fn(); * ``` * * instead of * * ```ts * const layout = createLayoutMotion(motion); * const fn = () => { * deleteAll(); * layout.update(); * } * // called in an event handler or something * fn(); * ``` */ with: (fn: (...args: A) => R) => (...args: A) => R; }; }; /** * Create a layout motion namespace * The reason this exists is because svelte doesn't have a lifecycle hook * that gets the snapshot of a component before DOM mutations are made/committed * https://github.com/sveltejs/svelte/issues/16648#issuecomment-3201964832 * so we have to allow a user to trigger a beforeUpdate manually after they make * a state change that's affect the layout of the component they want animated * * @param base - The base motion namespace to create a layout motion namespace from */ export declare function createLayoutMotion(base?: MotionNameSpace): LayoutMotionNamespace; interface LayoutMotionProps { children: Snippet; scope: LayoutMotionScope; } declare const LayoutMotion: import("svelte").Component; type LayoutMotion = ReturnType; export default LayoutMotion;