UNPKG

framer-motion

Version:

An open source and production-ready motion library for React on the web

38 lines (37 loc) • 1.42 kB
/// <reference types="react" /> import { VisualElement } from "../../render/types"; /** * Handlers for batching sync layout lifecycles. We batches these processes to cut * down on layout thrashing */ export interface SyncLayoutLifecycles { measureLayout: (child: VisualElement) => void; layoutReady: (child: VisualElement) => void; parent?: VisualElement; } /** * The exposed API for children to add themselves to the batcher and to flush it. */ export interface SyncLayoutBatcher { add: (child: VisualElement) => void; flush: (handler?: SyncLayoutLifecycles) => void; } /** * Extra API methods available to children if they're a descendant of AnimateSharedLayout */ export interface SharedLayoutSyncMethods extends SyncLayoutBatcher { syncUpdate: (force?: boolean) => void; forceUpdate: () => void; register: (child: VisualElement) => void; remove: (child: VisualElement) => void; } /** * Create a batcher to process VisualElements */ export declare function createBatcher(): SyncLayoutBatcher; export declare function isSharedLayout(context: SyncLayoutBatcher | SharedLayoutSyncMethods): context is SharedLayoutSyncMethods; export declare const SharedLayoutContext: import("react").Context<SyncLayoutBatcher | SharedLayoutSyncMethods>; /** * @internal */ export declare const FramerTreeLayoutContext: import("react").Context<SyncLayoutBatcher | SharedLayoutSyncMethods>;