import { Layout, TransformConfig } from './projection-core.js'; /** * During a projection, aside from the layout, many other CSS properties * might be distorted too, such as border radius, box shadow, etc. * A ProjectionComponent is responsible for handling such additional CSS properties * of an element for projection. */ export interface ProjectionComponent { /** * Measures the target properties of the given element. * @param element target element * @param layout current layout of the element * @returns the measured properties */ measureProperties(element: HTMLElement, layout: Layout): Properties; /** * Update the given element to cancel the distortion during projection. * @param element target element * @param measured measured properties before the projection, usually by `measureProperties` * @param distortion the distortion to cancel */ cancelDistortion(element: HTMLElement, measured: Properties, distortion: ProjectionDistortion): void; } /** * @see https://www.youtube.com/watch?v=5-JIu0u42Jc Inside Framer Motion's Layout Animations - Matt Perry * @see https://gist.github.com/TheNightmareX/f5bf72e81d2667f6036e91cf81270ef7 Layout Projection - Matt Perry */ export declare class ProjectionNode { element: HTMLElement; protected components: ProjectionComponent[]; static idNext: number; id: string; activated: boolean; parent?: ProjectionNode; children: Set; layout?: Layout; transform?: TransformConfig; protected identified: boolean; private readonly tags; constructor(element: HTMLElement, components?: ProjectionComponent[]); /** * Assign a ID to this projection node. The ID cannot be assigned again. * @throws Error if an ID has already been assigned. */ identifyAs(id: string): void; activate(): void; deactivate(): void; /** * Attach this node as a child of the given parent node. * One projection node can only have one parent. * @param parent another projection node */ attach(parent: ProjectionNode): void; /** * Detach this node from its current parent. * @throws Error if no parent. * * @remarks * A node must be detached from its parent on disposal, or memory * leak will occur. */ detach(): void; /** * Add an arbitrary string tag to this projection node. * @see `AnimationTag` for tags related to animations. */ addTag(tag: string): void; /** * Delete a tag from this projection node. * Do nothing if the tag does not exist. */ delTag(tag: string): void; /** * Returns whether this projection node has the given tag. */ hasTag(tag: string): boolean; /** * Traverse down the node tree starting from this node. * @param callback invoked on each node */ traverse(callback: (node: ProjectionNode) => void, options?: ProjectionNodeTraverseOptions): void; /** * Track the path from the root node to this node. * @returns an array of nodes, where the first element is the root node and * the last element is this node. */ track(): ProjectionNode[]; /** * Reset any transform applied to the element. */ reset(): void; measure(): void; measured(): this is MeasuredProjectionNode; project(destLayout: Layout): void; calculateTransform(destLayout: Layout): TransformConfig; calculateTransformedLayout(): Layout; [prop: PropertyKey]: unknown; } export type MeasuredProjectionNode = ProjectionNode & Required>; export interface ProjectionNodeTraverseOptions { /** * Whether to include the given node itself in the traversal. */ includeSelf?: boolean; /** * Whether to include deactivated nodes in the traversal. */ includeDeactivated?: boolean; } export interface ProjectionDistortion { scaleX: number; scaleY: number; } //# sourceMappingURL=projection.d.ts.map