import { AnimationContext, LayoutRect, MorphControllerInterface, MorphTransitionConfig } from './types'; /** * Controls FLIP-based morph transitions between layout states. * * @example * ```typescript * const controller = createMorphController(); * * // Capture first state * const first = controller.snapshotFirst(elements); * * // Apply layout changes... * * // Capture last state * const last = controller.snapshotLast(elements); * * // Create and play animation * const context = controller.createAnimation(first, last, elements); * await controller.play(context); * ``` */ export declare class MorphController implements MorphControllerInterface { private _activeContext; private _animationFrameId; private _destroyed; constructor(config?: Partial); private _config; /** * Current configuration. */ get config(): MorphTransitionConfig; /** * Whether a transition is currently running. */ get isTransitioning(): boolean; /** * Updates the controller configuration. */ configure(config: Partial): void; /** * Captures the "First" state of elements (before layout change). * * @param elements - Map of element IDs to elements * @returns Map of element IDs to their layout rects */ snapshotFirst(elements: Map): Map; /** * Captures the "Last" state of elements (after layout change). * * @param elements - Map of element IDs to elements * @returns Map of element IDs to their layout rects */ snapshotLast(elements: Map): Map; /** * Creates an animation context from first and last states. * * @param first - First (before) layout rects * @param last - Last (after) layout rects * @param elements - Map of element IDs to elements * @returns Animation context */ createAnimation(first: Map, last: Map, elements: Map): AnimationContext; /** * Plays an animation context. * * @param context - The animation context to play * @returns Promise that resolves when animation completes */ play(context: AnimationContext): Promise; /** * Cancels the current animation. */ cancel(): void; /** * Cleans up all resources. */ destroy(): void; /** * Collects elements from the DOM based on snapshot IDs. */ private _collectElements; /** * Cleans up element styles after animation. */ private _cleanupAnimation; /** * Asserts that the controller has not been destroyed. */ private _assertNotDestroyed; } /** * Creates a new MorphController instance. * * @param config - Optional configuration overrides * @returns A new MorphController instance */ export declare function createMorphController(config?: Partial): MorphControllerInterface; /** * Creates a FLIP animation helper for a single element. * * @param element - Element to animate * @param config - Animation configuration * @returns FLIP animation controller */ export declare function createElementFLIP(element: HTMLElement, config?: Partial): { first: () => LayoutRect; last: () => LayoutRect; invert: (first: LayoutRect, last: LayoutRect) => void; play: () => Promise; }; /** * Performs a quick FLIP animation for layout changes. * * @param elements - Elements to animate * @param layoutChange - Function that performs the layout change * @param config - Animation configuration */ export declare function performFLIP(elements: HTMLElement[], layoutChange: () => void | Promise, config?: Partial): Promise;