@pixerate/editor 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +30 -0
  2. package/THIRD_PARTY_NOTICES.md +11 -0
  3. package/dist/agent/index.cjs +174 -11
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +18 -4
  6. package/dist/agent/index.d.ts +18 -4
  7. package/dist/agent/index.js +167 -4
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
  10. package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
  11. package/dist/builtins-CdPcLwwF.d.cts +176 -0
  12. package/dist/builtins-Chj6zv_O.d.ts +176 -0
  13. package/dist/canvas/index.cjs +3917 -19
  14. package/dist/canvas/index.cjs.map +1 -1
  15. package/dist/canvas/index.d.cts +1232 -7
  16. package/dist/canvas/index.d.ts +1232 -7
  17. package/dist/canvas/index.js +3916 -18
  18. package/dist/canvas/index.js.map +1 -1
  19. package/dist/chunk-3CC7OPUQ.cjs +831 -0
  20. package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
  21. package/dist/{chunk-7WISYZFO.cjs → chunk-66IMF6OD.cjs} +174 -67
  22. package/dist/chunk-66IMF6OD.cjs.map +1 -0
  23. package/dist/{chunk-AL6JMGWW.cjs → chunk-CS6NZWWA.cjs} +24 -24
  24. package/dist/{chunk-AL6JMGWW.cjs.map → chunk-CS6NZWWA.cjs.map} +1 -1
  25. package/dist/{chunk-C7P22VIP.cjs → chunk-EWCOFSCQ.cjs} +17 -6
  26. package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
  27. package/dist/chunk-HDYMLS3X.cjs +409 -0
  28. package/dist/chunk-HDYMLS3X.cjs.map +1 -0
  29. package/dist/{chunk-V3CHHWOE.cjs → chunk-HNDSPZ5T.cjs} +4 -4
  30. package/dist/{chunk-V3CHHWOE.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
  31. package/dist/{chunk-X4N4WUKB.cjs → chunk-IFHKKVXH.cjs} +150 -38
  32. package/dist/chunk-IFHKKVXH.cjs.map +1 -0
  33. package/dist/chunk-KRGXUQ2Y.js +1696 -0
  34. package/dist/chunk-KRGXUQ2Y.js.map +1 -0
  35. package/dist/{chunk-PO6A6QQH.cjs → chunk-LN2POBHT.cjs} +742 -970
  36. package/dist/chunk-LN2POBHT.cjs.map +1 -0
  37. package/dist/chunk-MR2764X2.js +831 -0
  38. package/dist/chunk-MR2764X2.js.map +1 -0
  39. package/dist/{chunk-WSQKHXW7.cjs → chunk-NQF32I6Z.cjs} +1209 -457
  40. package/dist/chunk-NQF32I6Z.cjs.map +1 -0
  41. package/dist/{chunk-NAXVVS5I.js → chunk-QJSOZFCZ.js} +2 -2
  42. package/dist/{chunk-UAKDG62Z.js → chunk-SWE3NPOU.js} +116 -4
  43. package/dist/chunk-SWE3NPOU.js.map +1 -0
  44. package/dist/chunk-TXXNBDQX.cjs +1696 -0
  45. package/dist/chunk-TXXNBDQX.cjs.map +1 -0
  46. package/dist/chunk-UBCFIABU.js +409 -0
  47. package/dist/chunk-UBCFIABU.js.map +1 -0
  48. package/dist/{chunk-ECCCYKGL.js → chunk-UKI64KUD.js} +147 -40
  49. package/dist/chunk-UKI64KUD.js.map +1 -0
  50. package/dist/{chunk-QGYDWPRM.js → chunk-WON34HKM.js} +2 -2
  51. package/dist/{chunk-RR7F5GUM.js → chunk-X7HXL2SB.js} +941 -189
  52. package/dist/chunk-X7HXL2SB.js.map +1 -0
  53. package/dist/{chunk-IXHSYOVY.js → chunk-XQFHLT53.js} +638 -866
  54. package/dist/chunk-XQFHLT53.js.map +1 -0
  55. package/dist/{chunk-FH6F67DN.js → chunk-ZRNHGAQT.js} +17 -6
  56. package/dist/{chunk-FH6F67DN.js.map → chunk-ZRNHGAQT.js.map} +1 -1
  57. package/dist/commands/index.cjs +352 -4
  58. package/dist/commands/index.cjs.map +1 -1
  59. package/dist/commands/index.d.cts +37 -108
  60. package/dist/commands/index.d.ts +37 -108
  61. package/dist/commands/index.js +351 -3
  62. package/dist/commands/index.js.map +1 -1
  63. package/dist/compare/index.cjs +3 -3
  64. package/dist/compare/index.js +2 -2
  65. package/dist/{controller-BIJiNoVs.d.cts → controller-CxXGOEmy.d.cts} +209 -13
  66. package/dist/{controller-BIJiNoVs.d.ts → controller-CxXGOEmy.d.ts} +209 -13
  67. package/dist/export/index.cjs +36 -0
  68. package/dist/export/index.cjs.map +1 -0
  69. package/dist/export/index.d.cts +243 -0
  70. package/dist/export/index.d.ts +243 -0
  71. package/dist/export/index.js +36 -0
  72. package/dist/export/index.js.map +1 -0
  73. package/dist/extensions/index.cjs +54 -6
  74. package/dist/extensions/index.cjs.map +1 -1
  75. package/dist/extensions/index.d.cts +7 -2
  76. package/dist/extensions/index.d.ts +7 -2
  77. package/dist/extensions/index.js +59 -11
  78. package/dist/{index-7a6bHTLy.d.ts → index-B273Zllk.d.ts} +211 -207
  79. package/dist/{index-Csd5qI8u.d.cts → index-jcJwmBYt.d.cts} +211 -207
  80. package/dist/index.cjs +146 -32
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.cts +50 -14
  83. package/dist/index.d.ts +50 -14
  84. package/dist/index.js +138 -24
  85. package/dist/index.js.map +1 -1
  86. package/dist/registry-CED5C0lA.d.cts +204 -0
  87. package/dist/registry-CED5C0lA.d.ts +204 -0
  88. package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
  89. package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
  90. package/dist/serializers/index.cjs +6 -4
  91. package/dist/serializers/index.cjs.map +1 -1
  92. package/dist/serializers/index.d.cts +15 -4
  93. package/dist/serializers/index.d.ts +15 -4
  94. package/dist/serializers/index.js +5 -3
  95. package/dist/spreadsheet/index.cjs +33 -3
  96. package/dist/spreadsheet/index.cjs.map +1 -1
  97. package/dist/spreadsheet/index.d.cts +106 -3
  98. package/dist/spreadsheet/index.d.ts +106 -3
  99. package/dist/spreadsheet/index.js +32 -2
  100. package/package.json +10 -1
  101. package/dist/chunk-7WISYZFO.cjs.map +0 -1
  102. package/dist/chunk-C7P22VIP.cjs.map +0 -1
  103. package/dist/chunk-ECCCYKGL.js.map +0 -1
  104. package/dist/chunk-IXHSYOVY.js.map +0 -1
  105. package/dist/chunk-PO6A6QQH.cjs.map +0 -1
  106. package/dist/chunk-RR7F5GUM.js.map +0 -1
  107. package/dist/chunk-UAKDG62Z.js.map +0 -1
  108. package/dist/chunk-WSQKHXW7.cjs.map +0 -1
  109. package/dist/chunk-X4N4WUKB.cjs.map +0 -1
  110. package/dist/types-DX4Mh4SL.d.cts +0 -217
  111. package/dist/types-DX4Mh4SL.d.ts +0 -217
  112. /package/dist/{chunk-NAXVVS5I.js.map → chunk-QJSOZFCZ.js.map} +0 -0
  113. /package/dist/{chunk-QGYDWPRM.js.map → chunk-WON34HKM.js.map} +0 -0
@@ -1,9 +1,7 @@
1
- import { R as Rect, C as CanvasNode, X as XYPosition, b as CanvasEdge, I as IncrementalLayoutOptions, S as Side, c as CanvasLayoutOptions, P as PlaceBesideOptions, T as TrajectoryFunction, F as FanOutTrajectoryOptions, N as NodeTransition, a as CanvasNodeStyle, d as ReflowDisplacementOptions, D as DirectionalDisplacementOptions, e as CanvasClipboardPayload, f as Position, g as Point } from '../types-DX4Mh4SL.js';
2
- export { h as CanvasDockingCallbacks, i as CollapseNodeOptions, j as DisplacementDirection, k as DockStrategy, E as ExplodeNodeOptions, l as ExplosionSnapshot, G as GraphDifferences, m as TrajectoryPoint } from '../types-DX4Mh4SL.js';
3
- import { b as CanvasNodeUpdate, N as NodeRectOptions, A as AlignEdge, c as AlignNodesOptions, D as DistributeAxis, a as DistributeMode, d as DistributeNodesOptions, S as SizeDimension, M as MatchSizeOptions, Z as ZOrderOperation, C as CanvasArrangeAction } from '../arrangeShortcuts-sLlD2rSX.js';
4
- export { e as ArrangeShortcutBinding, f as DEFAULT_ARRANGE_SHORTCUTS, L as LOCKED_DATA_KEY, g as LOCKED_PREVIOUS_FLAGS_KEY, h as alignNodes, i as applyNodeUpdates, j as createNodeLookup, k as distributeNodes, l as getAbsolutePosition, m as getNodeRect, n as getNodeSize, o as invertNodeUpdates, p as isLocked, q as lockNodes, r as matchArrangeShortcut, s as matchSize, t as readStyleSize, u as reorderNodes, v as toggleLockNodes, w as unlockNodes, x as withStyleSize } from '../arrangeShortcuts-sLlD2rSX.js';
5
- import { C as Command } from '../types-GT5a5YAX.js';
6
- import { r as TokenType, o as TokenScope, f as TokenLiteral, c as TokenVariable, e as TokenResolution, d as TokenModeContext, T as TokenState } from '../model-C1zApQM8.js';
1
+ import { R as Rect, b as CanvasNode, X as XYPosition, c as CanvasEdge, I as IncrementalLayoutOptions, S as Side, d as CanvasLayoutOptions, P as PlaceBesideOptions, T as TrajectoryFunction, F as FanOutTrajectoryOptions, N as NodeTransition, e as CanvasNodeStyle, f as ReflowDisplacementOptions, g as DirectionalDisplacementOptions, h as CanvasClipboardPayload, i as CanvasNodeUpdate, j as NodeRectOptions, k as Position, l as Point, A as AlignEdge, m as AlignNodesOptions, D as DistributeAxis, a as DistributeMode, n as DistributeNodesOptions, o as SizeDimension, M as MatchSizeOptions, Z as ZOrderOperation, C as CanvasArrangeAction } from '../arrange-BICutYPk.js';
2
+ export { p as ArrangeShortcutBinding, q as CanvasDockingCallbacks, r as CollapseNodeOptions, s as DEFAULT_ARRANGE_SHORTCUTS, t as DisplacementDirection, u as DockStrategy, E as ExplodeNodeOptions, v as ExplosionSnapshot, G as GraphDifferences, L as LOCKED_DATA_KEY, w as LOCKED_PREVIOUS_FLAGS_KEY, x as TrajectoryPoint, y as alignNodes, z as applyNodeUpdates, B as createNodeLookup, H as distributeNodes, J as getAbsolutePosition, K as getNodeRect, O as getNodeSize, Q as invertNodeUpdates, U as isLocked, V as lockNodes, W as matchArrangeShortcut, Y as matchSize, _ as readStyleSize, $ as reorderNodes, a0 as toggleLockNodes, a1 as unlockNodes, a2 as withStyleSize } from '../arrange-BICutYPk.js';
3
+ import { C as Command, M as MergedExecutionOptions } from '../types-GT5a5YAX.js';
4
+ import { r as TokenType, o as TokenScope, f as TokenLiteral, d as TokenModeContext, c as TokenVariable, e as TokenResolution, T as TokenState } from '../model-C1zApQM8.js';
7
5
 
8
6
  declare const DEFAULT_NODE_WIDTH = 200;
9
7
  declare const DEFAULT_NODE_HEIGHT = 60;
@@ -2230,6 +2228,8 @@ interface CanvasTokenProperty {
2230
2228
  /** Returns the node with the value written, or the same node when nothing changes. */
2231
2229
  write(node: CanvasNode, value: TokenLiteral): CanvasNode;
2232
2230
  }
2231
+ /** The top-level `name: value` declarations of a style string (names as written, in order). */
2232
+ declare function parseNodeStyleDeclarations(style: string): [string, string][];
2233
2233
  /** A style property (camelCase name) from a style string or object. */
2234
2234
  declare function readNodeStyleProperty(style: CanvasNodeStyle | undefined | null, prop: string): string | number | undefined;
2235
2235
  /**
@@ -2300,4 +2300,1229 @@ declare function detachTokenBindings<TNode extends CanvasNode>(nodes: readonly T
2300
2300
  */
2301
2301
  declare function pruneCanvasTokenModes<TNode extends CanvasNode>(nodes: readonly TNode[], state: TokenState): TNode[];
2302
2302
 
2303
- export { AUTO_LAYOUT_DATA_KEY, type AffineMatrix, AlignEdge, AlignNodesOptions, type ArrangeHistoryTarget, type AutoLayout, type AutoLayoutAlignContent, type AutoLayoutAlignCross, type AutoLayoutAlignMain, type AutoLayoutCellAlign, type AutoLayoutChild, type AutoLayoutConstraints, type AutoLayoutGrid, type AutoLayoutGridArea, type AutoLayoutGridCell, type AutoLayoutGridGeometry, type AutoLayoutGridTrack, type AutoLayoutHorizontalConstraint, type AutoLayoutInsertTarget, type AutoLayoutMeasure, type AutoLayoutMode, type AutoLayoutOptions, type AutoLayoutPadding, type AutoLayoutSize, type AutoLayoutSizing, type AutoLayoutSizingPair, type AutoLayoutVerticalConstraint, type BezierCommand, type BezierContour, type BezierPath, type BezierPathInput, type BezierPathToSvgOptions, type BezierSegment, CANVAS_TOKEN_PROPERTIES, CHILD_LAYOUT_DATA_KEY, CONNECTION_LINE_TYPES, CanvasArrangeAction, type CanvasArrangeController, type CanvasArrangeControllerOptions, type CanvasAutoLayoutController, type CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, type CanvasConnectionLineType, CanvasEdge, type CanvasHeightOptions, CanvasLayoutOptions, CanvasNode, CanvasNodeStyle, CanvasNodeUpdate, type CanvasScene, type CanvasScenesOptions, type CanvasScenesState, CanvasScenesStore, type CanvasTokenBindingInfo, type CanvasTokenOptions, type CanvasTokenProperty, type CanvasViewport, type Clock, type CombineShapeNodesOptions, type CombineShapeNodesRefusal, type CombineShapeNodesResult, type ConnectorSnap, type ConnectorSnapOptions, type ConnectorSnapTarget, type CubicSegment, DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, type DashedPath, DirectionalDisplacementOptions, DistributeAxis, DistributeMode, DistributeNodesOptions, type DividePathsResult, type EllipseShape, FanOutTrajectoryOptions, type FitCubicsOptions, type FitPathDataOptions, type FitViewportOptions, type FlattenOptions, type GuideIndex, type GuideLine, IncrementalLayoutOptions, ManualClock, MatchSizeOptions, type MeasureGuide, type MeasureSelectionOptions, type MeasureSelectionResult, type MultiNodeTransitionOptions, type MultiPolygon, NodeRectOptions, NodeTransition, type OffsetPathOptions, type OffsetShapeNodesOptions, type OutlineShapeStrokesOptions, type OutlineStrokeOptions, type PathBooleanOperation, type PathBooleanResult, type PathCommand, type PathOperand, type PathOperandInput, PathOpsError, type PathOpsOptions, type PathOpsReport, type PathPiece, type PathPointAtLength, type PathShape, PlaceBesideOptions, Point, type PolygonBooleanOperation, type PolygonBooleanOptions, type PolygonFillRule, type PolygonInput, type PolygonOperand, type PolygonPiece, type PolygonRing, type PolygonToPathOptions, type PolygonWithHoles, Position, type PositionChangeLike, RESIZE_HANDLES, Rect, type RectShape, ReflowDisplacementOptions, type RegularPolygonShape, type ResizeHandle, SHAPE_DATA_KEY, SHAPE_KINDS, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, type SerializedCanvasScenes, type ShapeDescription, type ShapeKind, type ShapeNodePolygonOptions, type ShapeOperation, type ShapePaint, type ShapePathEditOperation, type ShapePathEditRefusal, type ShapePathEditResult, type ShapeRenderData, type ShapeSize, Side, SizeDimension, type SnapGuidesOptions, type SnapNodeDragOptions, type SnapNodeDragResult, type SnapNodeResizeOptions, type SnapNodeResizeResult, type SnapResizeOptions, type SnapResizeResult, type SnapResult, type StarShape, StreamingLayoutManager, type StreamingLayoutManagerOptions, type StrokeCap, type StrokeJoin, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, TrajectoryFunction, XYPosition, ZOrderOperation, applyConstraints, applyShapeCombination, applyShapeReplacement, arcToCubics, bezierPathArea, bezierPathBounds, bezierPathLength, bezierPathPointAtLength, bezierPathSignedArea, bezierPathToSvg, bindCanvasToken, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampLayoutSize, closeContour, collectDescendantIds, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, contourSignedArea, contoursToPath, countPathSegments, createBezierTrajectory, createCanvasArrangeController, createCanvasAutoLayoutController, createCanvasScenesStore, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicPointAt, cubicsToPathData, dashContours, defaultEasing, detachTokenBindings, distanceToBezierPath, dividePaths, dividePolygons, ensureLayout, estimateCanvasHeight, estimateNodeSize, excludePaths, findConnectorSnap, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, formatNumber, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getEffectiveTokenModes, getFlowChildren, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNodeShape, getNodeTokenBindings, getNodeTokenModes, getResizingNodeRect, getShapeRenderData, getShapeSvg, getTokenPropertyScope, getTokensForProperty, handlePoint, hasVisibleStroke, inferResizeHandle, inspectNodeTokens, intersectPaths, intersectPolygons, isAutoLayoutFrame, isEventFromTextInput, isMeasureModifierHeld, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasEdge, isValidCanvasNode, isValidCanvasScene, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, makeSizingCoherent, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, moveLayoutChild, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, normalizeBezierPath, offsetPath, offsetShapeNodes, oppositePosition, outlineShapeNodeStrokes, outlineStroke, overlaps, pageHidden, parseCanvasClipboardData, parseCanvasScenes, parseSvgPath, pathBoolean, pathToContours, placeBeside, pointInBezierPath, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, pruneCanvasTokenModes, readNodeStyleProperty, realClock, relayoutUpdates, remapPastedNodes, repositionNodesTo, resizeHandleAxes, resolveCanvasTokens, resolvePadding, revertShapeCombination, ringSignedArea, runMultiNodeTransition, segmentBounds, segmentCurvature, segmentDerivative, segmentExtrema, segmentLength, segmentNearest, segmentParamAtLength, segmentPoint, segmentTangent, serializeCanvasNodes, setCanvasTokenMode, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, shapeToPolygon, sideToPosition, simplifyRing, snapNodeDrag, snapNodeResize, snapResize, snapToGrid, splitSegment, strokeOutlineRings, subSegment, subtractPaths, subtractPolygons, toBezierPath, transformBezierPath, trimSegments, unionPolygons, unitePaths, windingNumber, withStyleOpacity, writeNodeStyleProperty, xorPolygons };
2303
+ /**
2304
+ * Keyframe easing: the curve a segment follows from one keyframe to the next.
2305
+ *
2306
+ * - `hold` keeps the first keyframe's value until the next one (a step).
2307
+ * - `linear` and the CSS presets (`ease`, `ease-in`, `ease-out`, `ease-in-out`) are
2308
+ * CSS-compatible `cubic-bezier()` curves; `{ type: 'cubic-bezier', x1, y1, x2, y2 }` is any
2309
+ * such curve (x1 / y1 is the leaving keyframe's out handle, x2 / y2 the next one's in handle).
2310
+ * - `spring` is a damped spring settling on the next value (it may overshoot).
2311
+ */
2312
+ /** Named easing presets. */
2313
+ type AnimationEasingPreset = 'linear' | 'hold' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease-in-back' | 'ease-out-back' | 'spring';
2314
+ interface CubicBezierEasing {
2315
+ type: 'cubic-bezier';
2316
+ x1: number;
2317
+ y1: number;
2318
+ x2: number;
2319
+ y2: number;
2320
+ }
2321
+ interface SpringEasing {
2322
+ type: 'spring';
2323
+ /** Spring stiffness (default 170). */
2324
+ stiffness?: number;
2325
+ /** Damping (default 26). */
2326
+ damping?: number;
2327
+ /** Mass (default 1). */
2328
+ mass?: number;
2329
+ /** Initial velocity in units of the segment's value change per second (default 0). */
2330
+ velocity?: number;
2331
+ }
2332
+ type AnimationEasing = AnimationEasingPreset | CubicBezierEasing | SpringEasing;
2333
+ /** Preset names, in picker order. */
2334
+ declare const ANIMATION_EASING_PRESETS: readonly AnimationEasingPreset[];
2335
+ /** Picker labels for the presets. */
2336
+ declare const ANIMATION_EASING_LABELS: Readonly<Record<AnimationEasingPreset, string>>;
2337
+ /** The CSS control points of the bezier presets (CSS Easing Functions Level 1 values for the CSS keywords). */
2338
+ declare const CUBIC_BEZIER_PRESETS: Readonly<Record<string, readonly [number, number, number, number]>>;
2339
+ /**
2340
+ * Solves a CSS `cubic-bezier(x1, y1, x2, y2)` for y at progress x (Newton steps with a
2341
+ * bisection fallback). x1 / x2 are clamped to 0–1 as CSS requires.
2342
+ */
2343
+ declare function cubicBezierAt(x1: number, y1: number, x2: number, y2: number, x: number): number;
2344
+ /**
2345
+ * Normalised position of a damped spring released from 0 towards 1, `seconds` after release.
2346
+ * Closed form for under-, critically and over-damped springs.
2347
+ */
2348
+ declare function springAt(spring: Omit<SpringEasing, 'type'>, seconds: number): number;
2349
+ /** Resolves an easing to a cubic-bezier, spring or hold descriptor (unknown input → linear). */
2350
+ declare function resolveEasing(easing: AnimationEasing | string | undefined | null): CubicBezierEasing | Required<SpringEasing> | 'hold';
2351
+ /**
2352
+ * Eased progress for linear progress `u` (0–1) through a segment lasting `durationMs`
2353
+ * (springs depend on real time; other curves ignore it). `hold` returns 0 until `u` reaches 1.
2354
+ */
2355
+ declare function evaluateEasing(easing: AnimationEasing | string | undefined | null, u: number, durationMs?: number): number;
2356
+ /**
2357
+ * The easing filmcraft (and Premiere) derive from temporal "influence" handles: flat handles of
2358
+ * the given influences (0.01–1, default 1/3) on the leaving and arriving keyframe.
2359
+ */
2360
+ declare function easingFromInfluence(outInfluence?: number, inInfluence?: number): CubicBezierEasing;
2361
+ /**
2362
+ * Parses a CSS easing (`linear`, `ease…`, `cubic-bezier(…)`, `steps(1, end)` / `step-end` →
2363
+ * hold) or a preset name. Returns `null` for anything else.
2364
+ */
2365
+ declare function parseCssEasing(text: string): AnimationEasing | null;
2366
+ /** Whether a value is a usable easing (preset name, CSS easing string or descriptor). */
2367
+ declare function isAnimationEasing(value: unknown): value is AnimationEasing;
2368
+ /**
2369
+ * The CSS `animation-timing-function` for an easing: a keyword or `cubic-bezier()`,
2370
+ * `steps(1, end)` for hold, and a sampled `linear(…)` for springs over `durationMs`.
2371
+ */
2372
+ declare function easingToCss(easing: AnimationEasing | string | undefined | null, durationMs?: number, samples?: number): string;
2373
+ /** Short label for an easing (a preset's label, or `Custom` / `Spring`). */
2374
+ declare function easingLabel(easing: AnimationEasing | undefined | null): string;
2375
+
2376
+ /**
2377
+ * Colour interpolation in OKLab (Björn Ottosson's perceptual space, as CSS Color 4 uses for
2378
+ * `color-mix(in oklab, …)`), with premultiplied alpha so a fade to `transparent` does not
2379
+ * darken through black.
2380
+ */
2381
+ interface OklabColor {
2382
+ /** Lightness, 0–1. */
2383
+ l: number;
2384
+ a: number;
2385
+ b: number;
2386
+ /** Alpha, 0–1. */
2387
+ alpha: number;
2388
+ }
2389
+ /** sRGB channels (0–1) to OKLab. */
2390
+ declare function rgbToOklab(r: number, g: number, b: number, alpha?: number): OklabColor;
2391
+ /** OKLab to sRGB channels (0–1, clamped into gamut). */
2392
+ declare function oklabToRgb(color: OklabColor): {
2393
+ r: number;
2394
+ g: number;
2395
+ b: number;
2396
+ a: number;
2397
+ };
2398
+ /** Parses a CSS colour (hex, `rgb()` / `rgba()`, `transparent`, `black`, `white`) to OKLab, or `null`. */
2399
+ declare function parseOklab(input: unknown): OklabColor | null;
2400
+ /** Formats OKLab as `#rrggbb` (or `#rrggbbaa` when translucent). */
2401
+ declare function formatOklab(color: OklabColor): string;
2402
+ /**
2403
+ * Mixes two colours at `t` (0 = `from`, 1 = `to`) in OKLab with premultiplied alpha.
2404
+ * Returns `null` when either is not a readable colour.
2405
+ */
2406
+ declare function mixColorsOklab(from: unknown, to: unknown, t: number): string | null;
2407
+
2408
+ /**
2409
+ * Keyframe animation for canvas nodes.
2410
+ *
2411
+ * A node's animation lives in `node.data.animation`, so it is copied, pasted, duplicated and
2412
+ * serialised with the node (component instances copy it too). Each animatable property has a
2413
+ * track of keyframes `{ time (ms), value, easing }`; the easing governs the segment *leaving*
2414
+ * the keyframe (filmcraft / After Effects convention).
2415
+ */
2416
+ /** Data key holding a node's animation. */
2417
+ declare const ANIMATION_DATA_KEY = "animation";
2418
+ /** Keyframe times closer than this (ms) are the same time. */
2419
+ declare const ANIMATION_TIME_EPSILON = 0.000001;
2420
+ /** A keyframe value: a number, or a CSS colour for colour properties. */
2421
+ type AnimationValue = number | string;
2422
+ interface AnimationKeyframe {
2423
+ /** Time in milliseconds from the start of the timeline. */
2424
+ time: number;
2425
+ value: AnimationValue;
2426
+ /** Easing of the segment from this keyframe to the next (default `linear`). */
2427
+ easing?: AnimationEasing;
2428
+ }
2429
+ interface AnimationTrack {
2430
+ keyframes: AnimationKeyframe[];
2431
+ /** Disabled tracks keep their keyframes but do not animate (default `true`). */
2432
+ enabled?: boolean;
2433
+ }
2434
+ /** A path a node's centre follows, driven by the `motionPath` track (progress 0–1). */
2435
+ interface AnimationMotionPath {
2436
+ /** SVG path data in flow coordinates (the parent's when the node has a `parentId`). */
2437
+ d: string;
2438
+ /** Rotate the node along the path's tangent (default `false`). */
2439
+ autoRotate?: boolean;
2440
+ }
2441
+ interface NodeAnimation {
2442
+ /** Property key → track. */
2443
+ tracks: Record<string, AnimationTrack>;
2444
+ motionPath?: AnimationMotionPath;
2445
+ }
2446
+ type AnimationValueType = 'number' | 'color';
2447
+ /** A node property keyframes can drive. */
2448
+ interface AnimatableProperty {
2449
+ key: string;
2450
+ label: string;
2451
+ type: AnimationValueType;
2452
+ /** Values are clamped into `[min, max]` when written. */
2453
+ min?: number;
2454
+ max?: number;
2455
+ /** Unit for display (`px`, `°`, …). */
2456
+ unit?: string;
2457
+ /** The node's current (static) value, or `undefined` when it has none. */
2458
+ read(node: CanvasNode): AnimationValue | undefined;
2459
+ /** Returns the node with `value` written (a new object; the input is never mutated). */
2460
+ write(node: CanvasNode, value: AnimationValue): CanvasNode;
2461
+ }
2462
+ /**
2463
+ * The built-in animatable properties, in the order they are applied (`motionPath` comes after
2464
+ * `x` / `y` / `rotation` so it wins over them).
2465
+ *
2466
+ * Rotation and scale use the CSS individual transform properties (`style.rotate`,
2467
+ * `style.scale`), which compose with the `transform` xyflow positions nodes with.
2468
+ */
2469
+ declare const ANIMATABLE_PROPERTIES: readonly AnimatableProperty[];
2470
+ interface AnimationPropertyOptions {
2471
+ /** Animatable properties (default {@link ANIMATABLE_PROPERTIES}); add your own to extend. */
2472
+ properties?: readonly AnimatableProperty[];
2473
+ }
2474
+ declare function getAnimatableProperty(key: string, options?: AnimationPropertyOptions): AnimatableProperty | undefined;
2475
+ /** Clamps a value into a property's range (numbers) or returns it unchanged. */
2476
+ declare function clampAnimationValue(property: AnimatableProperty | undefined, value: AnimationValue): AnimationValue;
2477
+ /** Whether `value` is a well-formed keyframe. */
2478
+ declare function isAnimationKeyframe(value: unknown): value is AnimationKeyframe;
2479
+ /**
2480
+ * Keyframes sorted by time, invalid entries dropped and duplicate times merged (the *later*
2481
+ * entry in the array wins, so appending a keyframe replaces one at the same time). Cached per
2482
+ * array (revalidated by element identity), so evaluating every frame does not re-sort; treat
2483
+ * keyframe objects as immutable.
2484
+ */
2485
+ declare function normalizeKeyframes(keyframes: readonly AnimationKeyframe[] | undefined | null): AnimationKeyframe[];
2486
+ /** The node's animation (tracks with at least one valid keyframe), or `null`. */
2487
+ declare function getNodeAnimation(node: CanvasNode | undefined | null): NodeAnimation | null;
2488
+ /** The track for `property` on a node, if it has keyframes. */
2489
+ declare function getAnimationTrack(node: CanvasNode | undefined | null, property: string): AnimationTrack | undefined;
2490
+ /** Whether the node has any (enabled or disabled) keyframes. */
2491
+ declare function isNodeAnimated(node: CanvasNode | undefined | null): boolean;
2492
+ /** Property keys of the node's tracks (in registry order, unknown keys last). */
2493
+ declare function getAnimatedProperties(node: CanvasNode | undefined | null, options?: AnimationPropertyOptions): string[];
2494
+ /**
2495
+ * Returns the node with its animation replaced (`null` or no tracks removes the key). Empty
2496
+ * tracks are dropped.
2497
+ */
2498
+ declare function withNodeAnimation<TNode extends CanvasNode>(node: TNode, animation: NodeAnimation | null): TNode;
2499
+
2500
+ /** How time past the end of the timeline maps back into it. */
2501
+ type AnimationLoopMode = 'none' | 'loop' | 'ping-pong';
2502
+ /** Nodes, or a document holding them. */
2503
+ type AnimationDocument = readonly CanvasNode[] | {
2504
+ readonly nodes: readonly CanvasNode[];
2505
+ };
2506
+ /** Evaluated values: node id → property key → value. */
2507
+ type AnimationOverrides = Record<string, Record<string, AnimationValue>>;
2508
+ /**
2509
+ * Interpolates between two keyframe values: numbers linearly, colours in OKLab (premultiplied
2510
+ * alpha). Mismatched or unreadable values hold `from` until `t` reaches 1.
2511
+ */
2512
+ declare function interpolateAnimationValue(from: AnimationValue, to: AnimationValue, t: number, type?: AnimationValueType): AnimationValue;
2513
+ /**
2514
+ * A track's value at `time`. Before the first keyframe it holds the first value, after the
2515
+ * last the last value. Keyframes may be unsorted or share times (see `normalizeKeyframes`).
2516
+ * Returns `undefined` for a track without valid keyframes.
2517
+ */
2518
+ declare function evaluateTrack(track: AnimationTrack | readonly AnimationKeyframe[] | undefined | null, time: number, type?: AnimationValueType): AnimationValue | undefined;
2519
+ /** The last keyframe time over the enabled tracks of the nodes (0 when nothing is animated). */
2520
+ declare function getAnimationDuration(doc: AnimationDocument): number;
2521
+ /**
2522
+ * Maps a running time onto the timeline `[0, duration]`: clamped (`none`), wrapped (`loop`)
2523
+ * or bounced (`ping-pong`).
2524
+ */
2525
+ declare function wrapAnimationTime(time: number, duration: number, loop?: AnimationLoopMode): number;
2526
+ interface EvaluateAnimationOptions extends AnimationPropertyOptions {
2527
+ /** Only evaluate these nodes. */
2528
+ ids?: Iterable<string>;
2529
+ }
2530
+ /**
2531
+ * Evaluates every enabled track at `time`: node id → property → value. The nodes are not
2532
+ * touched; apply the result with `applyAnimationOverrides` (or use `applyAnimation`).
2533
+ */
2534
+ declare function evaluateAnimation(doc: AnimationDocument, time: number, options?: EvaluateAnimationOptions): AnimationOverrides;
2535
+ /**
2536
+ * Writes evaluated values into copies of the nodes (in the registry's order). Nodes without
2537
+ * overrides keep their identity, and the input array is returned when nothing changes.
2538
+ */
2539
+ declare function applyAnimationOverrides<TNode extends CanvasNode>(nodes: readonly TNode[], overrides: AnimationOverrides, options?: AnimationPropertyOptions): TNode[];
2540
+ /**
2541
+ * The nodes as they look at `time`: `applyAnimationOverrides(nodes, evaluateAnimation(nodes, time))`.
2542
+ * Run it after `resolveCanvasTokens` so animated values win over token values while playing.
2543
+ */
2544
+ declare function applyAnimation<TNode extends CanvasNode>(nodes: readonly TNode[], time: number, options?: EvaluateAnimationOptions): TNode[];
2545
+
2546
+ /** Identifies one keyframe: node, property and time. */
2547
+ interface KeyframeRef {
2548
+ nodeId: string;
2549
+ property: string;
2550
+ time: number;
2551
+ }
2552
+ type AnimationEditErrorCode = 'unknown_node' | 'unknown_property' | 'unknown_keyframe' | 'duplicate_keyframe' | 'invalid_time' | 'invalid_value' | 'invalid_easing' | 'invalid_factor' | 'too_many_keyframes' | 'no_movement_range';
2553
+ /** Thrown by the editing functions for invalid requests; nothing is changed when it is thrown. */
2554
+ declare class AnimationEditError extends Error {
2555
+ readonly code: AnimationEditErrorCode;
2556
+ constructor(code: AnimationEditErrorCode, message: string);
2557
+ }
2558
+ /** Most keyframes one move / scale / delete may name (as filmcraft's `effects.moveKeyframes`). */
2559
+ declare const MAX_KEYFRAME_REFS = 4096;
2560
+ /** Snaps a time to the nearest frame at `fps`. */
2561
+ declare function snapTimeToFrame(time: number, fps: number): number;
2562
+ /** Static value of a property, for keying (sizes fall back to the measured size). */
2563
+ declare function readAnimatableValue(node: CanvasNode, property: AnimatableProperty): AnimationValue | undefined;
2564
+ /** The value a property shows at `time`: its track's value when animated, else its static value. */
2565
+ declare function getAnimatedValue(node: CanvasNode, propertyKey: string, time: number, options?: AnimationPropertyOptions): AnimationValue | undefined;
2566
+ interface SetKeyframeOptions extends AnimationPropertyOptions {
2567
+ /** Easing of the segment leaving the keyframe (default: kept, or the previous keyframe's). */
2568
+ easing?: AnimationEasing | string;
2569
+ }
2570
+ /** Adds a keyframe, or replaces the value (and easing, when given) of the one at `time`. */
2571
+ declare function setKeyframe<TNode extends CanvasNode>(nodes: readonly TNode[], nodeId: string, property: string, time: number, value: AnimationValue, options?: SetKeyframeOptions): TNode[];
2572
+ /**
2573
+ * Keys the given properties of the nodes at `time` with the values they show there (the
2574
+ * "add keyframe at playhead" action). Without `properties`, keys every animated property, or
2575
+ * `x` and `y` for nodes that have none. Returns the new nodes and the keyed refs.
2576
+ */
2577
+ declare function addKeyframesAtTime<TNode extends CanvasNode>(nodes: readonly TNode[], ids: Iterable<string>, time: number, options?: AnimationPropertyOptions & {
2578
+ properties?: readonly AnimatableProperty[];
2579
+ keys?: readonly string[];
2580
+ }): {
2581
+ nodes: TNode[];
2582
+ refs: KeyframeRef[];
2583
+ };
2584
+ interface KeyframePatch {
2585
+ time?: number;
2586
+ value?: AnimationValue;
2587
+ easing?: AnimationEasing | string | null;
2588
+ }
2589
+ /** Changes one keyframe's time, value or easing (`easing: null` resets it to linear). */
2590
+ declare function updateKeyframe<TNode extends CanvasNode>(nodes: readonly TNode[], ref: KeyframeRef, patch: KeyframePatch, options?: AnimationPropertyOptions): TNode[];
2591
+ /** Sets the easing of the segments leaving the keyframes. */
2592
+ declare function setKeyframeEasing<TNode extends CanvasNode>(nodes: readonly TNode[], refs: readonly KeyframeRef[], easing: AnimationEasing | string | null, options?: AnimationPropertyOptions): TNode[];
2593
+ /**
2594
+ * Deletes keyframes. When a track loses its last keyframe the node keeps that keyframe's
2595
+ * value as its static value, so it does not jump (filmcraft `remove_keyframe_at`).
2596
+ */
2597
+ declare function deleteKeyframes<TNode extends CanvasNode>(nodes: readonly TNode[], refs: readonly KeyframeRef[], options?: AnimationPropertyOptions): TNode[];
2598
+ /** Turns a track on or off (disabled tracks keep their keyframes but do not animate). */
2599
+ declare function setTrackEnabled<TNode extends CanvasNode>(nodes: readonly TNode[], nodeId: string, property: string, enabled: boolean): TNode[];
2600
+ /**
2601
+ * Removes a track. With `keepValueAt`, the node keeps the value the track had at that time
2602
+ * (filmcraft's stopwatch toggle).
2603
+ */
2604
+ declare function removeTrack<TNode extends CanvasNode>(nodes: readonly TNode[], nodeId: string, property: string, options?: AnimationPropertyOptions & {
2605
+ keepValueAt?: number;
2606
+ }): TNode[];
2607
+ /** Sets (or with `null` removes) the path the `motionPath` track moves the node along. */
2608
+ declare function setMotionPath<TNode extends CanvasNode>(nodes: readonly TNode[], nodeId: string, motionPath: {
2609
+ d: string;
2610
+ autoRotate?: boolean;
2611
+ } | null): TNode[];
2612
+ interface KeyframeRangeOptions {
2613
+ /** Earliest allowed time (default 0). */
2614
+ min?: number;
2615
+ /** Latest allowed time (default unbounded). */
2616
+ max?: number;
2617
+ }
2618
+ interface MoveKeyframesResult<TNode extends CanvasNode = CanvasNode> {
2619
+ nodes: TNode[];
2620
+ /** The delta applied (the request clamped so the whole group stays in range). */
2621
+ delta: number;
2622
+ /** The moved keyframes at their new times, in request order. */
2623
+ refs: KeyframeRef[];
2624
+ }
2625
+ /**
2626
+ * Moves keyframes (across nodes and properties) by one common `delta`, so their relative timing
2627
+ * is kept. The delta is clamped so every key stays inside `[min, max]`; a clamped-to-zero move
2628
+ * returns the input nodes. Moved keys replace unselected keys at their destination, but never
2629
+ * each other: all originals are removed before any is re-inserted. Invalid or duplicate
2630
+ * references throw without changing anything.
2631
+ */
2632
+ declare function moveKeyframes<TNode extends CanvasNode>(nodes: readonly TNode[], refs: readonly KeyframeRef[], delta: number, options?: KeyframeRangeOptions): MoveKeyframesResult<TNode>;
2633
+ interface ScaleKeyframesOptions extends KeyframeRangeOptions {
2634
+ /** Time that stays fixed (default: the earliest selected keyframe). */
2635
+ pivot?: number;
2636
+ }
2637
+ /**
2638
+ * Scales the spacing of keyframes in time around `pivot` (factor 2 = twice as slow). The factor
2639
+ * is reduced so every key stays inside `[min, max]`. Returns the factor applied.
2640
+ */
2641
+ declare function scaleKeyframes<TNode extends CanvasNode>(nodes: readonly TNode[], refs: readonly KeyframeRef[], factor: number, options?: ScaleKeyframesOptions): {
2642
+ nodes: TNode[];
2643
+ factor: number;
2644
+ refs: KeyframeRef[];
2645
+ };
2646
+ /** Keyframe times on the nodes (all when `ids` is omitted), sorted and unique, minus `exclude`. */
2647
+ declare function getKeyframeTimes(nodes: readonly CanvasNode[], options?: {
2648
+ ids?: Iterable<string>;
2649
+ exclude?: readonly KeyframeRef[];
2650
+ }): number[];
2651
+ interface KeyframeSnap {
2652
+ /** The delta after snapping. */
2653
+ delta: number;
2654
+ /** The time snapped to, or `null` when nothing was within the threshold. */
2655
+ target: number | null;
2656
+ }
2657
+ /**
2658
+ * Snaps a group move: the selected key (at `times + delta`) nearest to any target pulls the
2659
+ * whole group onto it when within `threshold` ms (convert the timeline's screen threshold,
2660
+ * e.g. 8px, with its scale). The group's spacing is kept.
2661
+ */
2662
+ declare function snapKeyframeDelta(times: readonly number[], delta: number, targets: readonly number[], threshold: number): KeyframeSnap;
2663
+ /** Clipboard payload for keyframes; times are offsets from the earliest copied keyframe. */
2664
+ interface AnimationKeyframeClipboard {
2665
+ type: 'pixerate/keyframes';
2666
+ version: 1;
2667
+ keyframes: {
2668
+ nodeId: string;
2669
+ property: string;
2670
+ offset: number;
2671
+ value: AnimationValue;
2672
+ easing?: AnimationEasing;
2673
+ }[];
2674
+ }
2675
+ /** Copies keyframes into a clipboard payload. */
2676
+ declare function copyKeyframes(nodes: readonly CanvasNode[], refs: readonly KeyframeRef[]): AnimationKeyframeClipboard;
2677
+ /** Reads a keyframe clipboard payload (object or JSON text), or `null`. */
2678
+ declare function parseKeyframeClipboard(input: unknown): AnimationKeyframeClipboard | null;
2679
+ /**
2680
+ * Pastes keyframes with their first key at `time`, replacing keys at the same times. Targets:
2681
+ * `nodeIds` (every target gets a single-node clip; several source nodes map onto the targets
2682
+ * in order), or the original nodes when omitted. Keys for missing nodes or unknown properties
2683
+ * are skipped. Returns the pasted refs.
2684
+ */
2685
+ declare function pasteKeyframes<TNode extends CanvasNode>(nodes: readonly TNode[], clipboard: AnimationKeyframeClipboard, time: number, options?: AnimationPropertyOptions & {
2686
+ nodeIds?: readonly string[];
2687
+ }): {
2688
+ nodes: TNode[];
2689
+ refs: KeyframeRef[];
2690
+ };
2691
+ interface RecordAnimationOptions extends AnimationPropertyOptions {
2692
+ /**
2693
+ * Record mode: changing a property that is not animated yet keys it too (otherwise only
2694
+ * properties that already have keyframes are keyed and other changes are static edits).
2695
+ */
2696
+ recording?: boolean;
2697
+ }
2698
+ /**
2699
+ * Turns edits made on the *displayed* (evaluated) nodes into edits of the stored nodes.
2700
+ *
2701
+ * - `base`: the stored nodes; `before`: what was displayed (`applyAnimation(base, time)`);
2702
+ * `after`: the displayed nodes after the edit (e.g. React Flow changes applied to `before`).
2703
+ * - A changed property with an enabled track is keyed at `time` and keeps its stored value.
2704
+ * - In record mode a changed property without a track gets one: a key at 0 with the previous
2705
+ * value (when `time` > 0) and a key at `time`, so it animates from where it was. The stored
2706
+ * value stays the previous one.
2707
+ * - Everything else (other fields, unanimated properties outside record mode) passes through.
2708
+ *
2709
+ * Unchanged nodes keep their stored identity; returns the new stored nodes and the keyed refs.
2710
+ */
2711
+ declare function recordAnimationChanges<TNode extends CanvasNode>(base: readonly TNode[], before: readonly TNode[], after: readonly TNode[], time: number, options?: RecordAnimationOptions): {
2712
+ nodes: TNode[];
2713
+ keyed: KeyframeRef[];
2714
+ };
2715
+ interface AnimateNodeOptions extends AnimationPropertyOptions {
2716
+ /** Values at the end (property → value). */
2717
+ to: Record<string, AnimationValue>;
2718
+ /** Values at the start (default: what the node shows at `delay`). */
2719
+ from?: Record<string, AnimationValue>;
2720
+ /** Duration in ms (default 1000). */
2721
+ duration?: number;
2722
+ /** Start time in ms (default 0). */
2723
+ delay?: number;
2724
+ easing?: AnimationEasing | string;
2725
+ }
2726
+ /**
2727
+ * Animates a node from `from` (or its current values) to `to` over `duration` ms starting at
2728
+ * `delay`: two keyframes per property, replacing keys at those times.
2729
+ */
2730
+ declare function animateNode<TNode extends CanvasNode>(nodes: readonly TNode[], nodeId: string, options: AnimateNodeOptions): {
2731
+ nodes: TNode[];
2732
+ refs: KeyframeRef[];
2733
+ };
2734
+
2735
+ interface AnimationPlayerState {
2736
+ /** Playhead time in ms, inside `[0, duration]`. */
2737
+ time: number;
2738
+ playing: boolean;
2739
+ /** True between `scrub` and `endScrub`. */
2740
+ scrubbing: boolean;
2741
+ loop: AnimationLoopMode;
2742
+ /** Speed multiplier (negative plays backwards). */
2743
+ playbackRate: number;
2744
+ duration: number;
2745
+ }
2746
+ interface AnimationPlayerOptions {
2747
+ /** Time source (default `realClock`: requestAnimationFrame). Pass a `ManualClock` in tests or for rendering. */
2748
+ clock?: Clock;
2749
+ /** Timeline length in ms, or a getter (e.g. the last keyframe time). Default 1000. */
2750
+ duration?: number | (() => number);
2751
+ loop?: AnimationLoopMode;
2752
+ playbackRate?: number;
2753
+ /** Initial playhead time (default 0). */
2754
+ time?: number;
2755
+ /** Called whenever the playhead moves (playback, seek, scrub). */
2756
+ onTime?: (time: number) => void;
2757
+ /** Called when non-looping playback reaches the end (or the start, playing backwards). */
2758
+ onEnd?: () => void;
2759
+ }
2760
+ /**
2761
+ * Plays a timeline on an injectable `Clock`: play / pause / seek / scrub with looping,
2762
+ * ping-pong and playback rate. It only asks the clock for frames while playing, so a
2763
+ * `ManualClock` steps it deterministically and the real clock's requestAnimationFrame is the
2764
+ * only place wall time enters.
2765
+ *
2766
+ * `getState()` returns a cached snapshot replaced on change (usable with `useSyncExternalStore`).
2767
+ */
2768
+ declare class AnimationPlayer {
2769
+ private readonly clock;
2770
+ private durationSource;
2771
+ private onTime?;
2772
+ private onEnd?;
2773
+ private time;
2774
+ private playing;
2775
+ private scrubbing;
2776
+ private resumeAfterScrub;
2777
+ private loop;
2778
+ private rate;
2779
+ /** Unwrapped time at `anchorAt` (keeps the ping-pong direction across frames). */
2780
+ private anchorRaw;
2781
+ private anchorAt;
2782
+ private generation;
2783
+ private cached;
2784
+ private listeners;
2785
+ constructor(options?: AnimationPlayerOptions);
2786
+ /** Current timeline length (ms). */
2787
+ get duration(): number;
2788
+ get currentTime(): number;
2789
+ get isPlaying(): boolean;
2790
+ getState(): AnimationPlayerState;
2791
+ subscribe(listener: (state: AnimationPlayerState) => void): () => void;
2792
+ /** Replaces the callbacks (hooks keep them current without recreating the player). */
2793
+ setCallbacks(callbacks: {
2794
+ onTime?: (time: number) => void;
2795
+ onEnd?: () => void;
2796
+ }): void;
2797
+ setDuration(duration: number | (() => number)): void;
2798
+ setLoop(loop: AnimationLoopMode): void;
2799
+ setPlaybackRate(rate: number): void;
2800
+ /** Starts playing from the playhead (from the start again when a one-shot play had ended). */
2801
+ play(): void;
2802
+ pause(): void;
2803
+ toggle(): void;
2804
+ /** Pauses and returns to the start. */
2805
+ stop(): void;
2806
+ /** Moves the playhead (clamped to the timeline); playback continues from there. */
2807
+ seek(time: number): void;
2808
+ /** Seeks while dragging the playhead: playback pauses until `endScrub`. */
2809
+ scrub(time: number): void;
2810
+ /** Ends a scrub, resuming playback if it was playing when the scrub began. */
2811
+ endScrub(): void;
2812
+ /** Stops scheduling frames and drops listeners. */
2813
+ destroy(): void;
2814
+ private clamp;
2815
+ private reanchor;
2816
+ private rawNow;
2817
+ private schedule;
2818
+ /** Advances the playhead to the clock's time; `notify` emits the change. */
2819
+ private tick;
2820
+ private snapshot;
2821
+ private emit;
2822
+ }
2823
+ declare function createAnimationPlayer(options?: AnimationPlayerOptions): AnimationPlayer;
2824
+
2825
+ interface SampleAnimationOptions extends EvaluateAnimationOptions {
2826
+ /** Frames per second (default 30). */
2827
+ fps?: number;
2828
+ /** Length in ms (default: the last keyframe time). */
2829
+ duration?: number;
2830
+ /** First time sampled (default 0). */
2831
+ start?: number;
2832
+ /** Refuses to produce more frames than this (default 100 000). */
2833
+ maxFrames?: number;
2834
+ }
2835
+ interface AnimationFrame {
2836
+ index: number;
2837
+ /** Time in ms. */
2838
+ time: number;
2839
+ overrides: AnimationOverrides;
2840
+ }
2841
+ /**
2842
+ * Samples the animation at a fixed frame rate from `start` through `start + duration`
2843
+ * (both included), e.g. to render video frames. Apply a frame with `applyAnimationOverrides`.
2844
+ */
2845
+ declare function sampleAnimationFrames(doc: AnimationDocument, options?: SampleAnimationOptions): AnimationFrame[];
2846
+ /** CSS property each animatable property maps to (camelCase for the Web Animations API). */
2847
+ declare const CSS_ANIMATION_PROPERTIES: Readonly<Record<string, {
2848
+ css: string;
2849
+ camel: string;
2850
+ }>>;
2851
+ interface AnimationStop {
2852
+ /** 0–1 */
2853
+ offset: number;
2854
+ value: string;
2855
+ /** Timing function of the segment starting here. */
2856
+ easing?: string;
2857
+ }
2858
+ interface CssPropertyAnimation {
2859
+ /** CSS property, e.g. `translate`. */
2860
+ property: string;
2861
+ /** camelCase name for `element.animate`. */
2862
+ camel: string;
2863
+ /** Animatable properties driving it, e.g. `['x', 'y']`. */
2864
+ sources: string[];
2865
+ stops: AnimationStop[];
2866
+ /** False when the stops are sampled (colours mixed in OKLab, x / y with different timing, motion paths). */
2867
+ exact: boolean;
2868
+ }
2869
+ interface CssExportOptions {
2870
+ /** Timeline length in ms (default: the document's last keyframe time). */
2871
+ duration?: number;
2872
+ loop?: AnimationLoopMode;
2873
+ playbackRate?: number;
2874
+ /** Sampling rate for tracks CSS cannot express exactly (default 30 per second). */
2875
+ sampleFps?: number;
2876
+ /** Map properties to other CSS properties (e.g. `{ fill: { css: 'fill', camel: 'fill' } }` for SVG). */
2877
+ cssProperties?: Record<string, {
2878
+ css: string;
2879
+ camel: string;
2880
+ }>;
2881
+ }
2882
+ /**
2883
+ * The node's enabled tracks as per-CSS-property keyframe stops: rotation / scale use the
2884
+ * individual transform properties, x / y become `translate` relative to the node's position.
2885
+ * Tracks CSS cannot reproduce exactly are sampled (`exact: false`).
2886
+ */
2887
+ declare function getCssPropertyAnimations(nodes: readonly CanvasNode[], nodeId: string, options?: CssExportOptions): CssPropertyAnimation[];
2888
+ type PlaybackDirectionLike = 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
2889
+ interface CssAnimationExport {
2890
+ /** `@keyframes` blocks plus a rule applying them to `selector`. */
2891
+ css: string;
2892
+ /** Value for the `animation` property (comma-separated, one per CSS property). */
2893
+ animation: string;
2894
+ animations: {
2895
+ name: string;
2896
+ property: string;
2897
+ exact: boolean;
2898
+ }[];
2899
+ /** Whether every property is reproduced exactly. */
2900
+ exact: boolean;
2901
+ }
2902
+ /**
2903
+ * Exports a node's animation as CSS `@keyframes` (one per CSS property, so different tracks
2904
+ * keep their own easing) and an `animation` declaration for `selector`.
2905
+ */
2906
+ declare function exportCssAnimation(nodes: readonly CanvasNode[], nodeId: string, options?: CssExportOptions & {
2907
+ name?: string;
2908
+ selector?: string;
2909
+ }): CssAnimationExport;
2910
+ /** One `element.animate(keyframes, options)` call. */
2911
+ interface WebAnimationSpec {
2912
+ property: string;
2913
+ keyframes: {
2914
+ offset: number;
2915
+ easing?: string;
2916
+ [property: string]: string | number | undefined;
2917
+ }[];
2918
+ options: {
2919
+ duration: number;
2920
+ iterations: number;
2921
+ direction: PlaybackDirectionLike;
2922
+ fill: 'both';
2923
+ easing: 'linear';
2924
+ };
2925
+ exact: boolean;
2926
+ }
2927
+ /** The node's animation as Web Animations API keyframes (one animation per CSS property). */
2928
+ declare function toWebAnimations(nodes: readonly CanvasNode[], nodeId: string, options?: CssExportOptions): WebAnimationSpec[];
2929
+ /** Plays Web Animations specs on an element (anything with `animate`), returning the animations. */
2930
+ declare function playWebAnimations<TAnimation>(element: {
2931
+ animate(keyframes: any, options: any): TAnimation;
2932
+ }, specs: readonly WebAnimationSpec[]): TAnimation[];
2933
+ /** Whether every enabled track of the node can be exported without sampling. */
2934
+ declare function isCssExportExact(nodes: readonly CanvasNode[], nodeId: string): boolean;
2935
+
2936
+ /**
2937
+ * View-model helpers for timeline UIs (React and Svelte render the same rows).
2938
+ */
2939
+ interface TimelineKeyframe {
2940
+ ref: KeyframeRef;
2941
+ /** Time shown (includes the preview offset of a keyframe drag). */
2942
+ time: number;
2943
+ value: AnimationValue;
2944
+ easing?: AnimationEasing;
2945
+ selected: boolean;
2946
+ }
2947
+ interface TimelineRow {
2948
+ /** `nodeId:property`. */
2949
+ id: string;
2950
+ nodeId: string;
2951
+ nodeLabel: string;
2952
+ property: string;
2953
+ label: string;
2954
+ enabled: boolean;
2955
+ keyframes: TimelineKeyframe[];
2956
+ }
2957
+ interface TimelineRowsOptions extends AnimationPropertyOptions {
2958
+ /** Selected keyframes. */
2959
+ selection?: readonly KeyframeRef[];
2960
+ /** Preview offset for the selected keyframes while they are dragged. */
2961
+ dragDelta?: number;
2962
+ /** Row label for a node (default: `data.label`, then the id). */
2963
+ labelOf?: (node: CanvasNode) => string;
2964
+ }
2965
+ /** Whether `ref` is in `selection` (same node, property and time). */
2966
+ declare function isKeyframeSelected(selection: readonly KeyframeRef[], ref: KeyframeRef): boolean;
2967
+ /** One row per animated property of each node in `ids` (in `ids` order). */
2968
+ declare function getTimelineRows(nodes: readonly CanvasNode[], ids: Iterable<string>, options?: TimelineRowsOptions): TimelineRow[];
2969
+ /** x position (px) of `time` on a lane `width` px wide showing `[0, duration]`. */
2970
+ declare function timeToX(time: number, duration: number, width: number): number;
2971
+ /** Time at x (px) on a lane `width` px wide, clamped to `[0, duration]`. */
2972
+ declare function xToTime(x: number, duration: number, width: number): number;
2973
+ /** `1.25s` style label. */
2974
+ declare function formatAnimationTime(ms: number): string;
2975
+ /** Ruler ticks at a round step leaving at least `minSpacing` px between labels. */
2976
+ declare function getTimelineTicks(duration: number, width: number, minSpacing?: number): {
2977
+ time: number;
2978
+ x: number;
2979
+ label: string;
2980
+ }[];
2981
+
2982
+ /** History surface (`HistoryManager` satisfies it). */
2983
+ interface AnimationHistoryTarget {
2984
+ execute(command: Command): void;
2985
+ executeMerged?(command: Command, options?: MergedExecutionOptions): void;
2986
+ }
2987
+ interface KeyframeDragState {
2988
+ refs: KeyframeRef[];
2989
+ /** Offset previewed (after clamping and snapping). */
2990
+ delta: number;
2991
+ /** Time snapped to, for a snap guide. */
2992
+ target: number | null;
2993
+ }
2994
+ interface CanvasAnimationState extends AnimationPlayerState {
2995
+ /** Record mode: changing an unanimated property at the playhead keys it. */
2996
+ recording: boolean;
2997
+ /** Frame rate used for frame snapping and export (default 30). */
2998
+ fps: number;
2999
+ selection: readonly KeyframeRef[];
3000
+ drag: KeyframeDragState | null;
3001
+ /** Whether the duration follows the last keyframe (`setDuration(null)`). */
3002
+ autoDuration: boolean;
3003
+ }
3004
+ interface CanvasAnimationControllerOptions<TNode extends CanvasNode = CanvasNode> {
3005
+ getNodes: () => TNode[];
3006
+ setNodes: (nodes: TNode[]) => void;
3007
+ /** When set, keyframe edits are undoable steps (recording merges a drag into one step). */
3008
+ history?: AnimationHistoryTarget;
3009
+ /** Ids acted on without explicit ids (default: nodes with `selected: true`). */
3010
+ getSelectedIds?: () => string[];
3011
+ /** Time source for playback (default `realClock`). */
3012
+ clock?: Clock;
3013
+ /** Fixed timeline length in ms; omitted = the last keyframe time, at least `minDuration`. */
3014
+ duration?: number;
3015
+ /** Shortest automatic duration (default 1000 ms). */
3016
+ minDuration?: number;
3017
+ loop?: AnimationLoopMode;
3018
+ playbackRate?: number;
3019
+ fps?: number;
3020
+ recording?: boolean;
3021
+ properties?: readonly AnimatableProperty[];
3022
+ /** Called when the playhead moves. */
3023
+ onTime?: (time: number) => void;
3024
+ onChange?: (state: CanvasAnimationState) => void;
3025
+ }
3026
+ /**
3027
+ * Framework-agnostic animation controller shared by the React hook and the Svelte rune:
3028
+ * playback (on an injected clock), record mode, keyframe editing with undo, multi-keyframe
3029
+ * drag with snapping, copy / paste and export.
3030
+ *
3031
+ * Render `display()` (the nodes evaluated at the playhead) and route edits made on the
3032
+ * displayed nodes through `applyDisplayChanges`, so animated properties are keyed instead of
3033
+ * being overwritten by the next frame.
3034
+ */
3035
+ declare function createCanvasAnimationController<TNode extends CanvasNode = CanvasNode>(options: CanvasAnimationControllerOptions<TNode>): {
3036
+ player: AnimationPlayer;
3037
+ getState: () => CanvasAnimationState;
3038
+ subscribe(listener: (state: CanvasAnimationState) => void): () => void;
3039
+ /** Re-reads node-derived state (the automatic duration) and notifies when it changed. */
3040
+ refresh(): void;
3041
+ readonly time: number;
3042
+ readonly playing: boolean;
3043
+ readonly duration: number;
3044
+ play: () => void;
3045
+ pause: () => void;
3046
+ toggle: () => void;
3047
+ stop: () => void;
3048
+ seek: (time: number) => void;
3049
+ scrub: (time: number) => void;
3050
+ endScrub: () => void;
3051
+ setLoop: (loop: AnimationLoopMode) => void;
3052
+ setPlaybackRate: (rate: number) => void;
3053
+ /** Fixed duration in ms, or `null` to follow the last keyframe. */
3054
+ setDuration(ms: number | null): void;
3055
+ setFps(value: number): void;
3056
+ setRecording(on: boolean): void;
3057
+ toggleRecording(): void;
3058
+ /** Seeks to the next keyframe (of the selected nodes, or all) after the playhead. */
3059
+ nextKeyframe(ids?: Iterable<string>): number | null;
3060
+ previousKeyframe(ids?: Iterable<string>): number | null;
3061
+ /** The nodes evaluated at the playhead (same array when nothing is animated). */
3062
+ display: (nodes?: readonly TNode[]) => TNode[];
3063
+ /**
3064
+ * Applies edits made on the displayed nodes: animated properties (and, in record mode,
3065
+ * any property) are keyed at the playhead; other changes go to the stored nodes.
3066
+ * Keying is one undo step per node set, merged while a drag continues.
3067
+ */
3068
+ applyDisplayChanges(next: TNode[]): KeyframeRef[];
3069
+ /** Keys the nodes (default: selected) at the playhead; see `addKeyframesAtTime`. */
3070
+ addKeyframe(ids?: Iterable<string>, keys?: readonly string[], time?: number): KeyframeRef[];
3071
+ setKeyframe(nodeId: string, property: string, value: AnimationValue, time?: number, easing?: AnimationEasing | string): void;
3072
+ updateKeyframe(ref: KeyframeRef, patch: KeyframePatch): void;
3073
+ deleteKeyframes(refs?: readonly KeyframeRef[]): boolean;
3074
+ setEasing(easing: AnimationEasing | string | null, refs?: readonly KeyframeRef[]): boolean;
3075
+ setTrackEnabled(nodeId: string, property: string, enabled: boolean): void;
3076
+ removeTrack(nodeId: string, property: string): void;
3077
+ setMotionPath(nodeId: string, motionPath: {
3078
+ d: string;
3079
+ autoRotate?: boolean;
3080
+ } | null): void;
3081
+ /** Animates a node to `to` (from its current values) over `duration`; see `animateNode`. */
3082
+ animateNode(nodeId: string, opts: Omit<AnimateNodeOptions, "properties">): KeyframeRef[];
3083
+ /** Moves keyframes (default: selected) by `delta` ms as one step; returns the delta applied. */
3084
+ moveKeyframes(delta: number, refs?: readonly KeyframeRef[]): number;
3085
+ /** Scales keyframe spacing (default: selected) around `pivot`; returns the factor applied. */
3086
+ scaleKeyframes(factor: number, refs?: readonly KeyframeRef[], pivot?: number): number;
3087
+ copyKeyframes(refs?: readonly KeyframeRef[]): AnimationKeyframeClipboard | null;
3088
+ /** Pastes at the playhead onto the selected nodes (or the copied ones). */
3089
+ pasteKeyframes(data?: AnimationKeyframeClipboard | null, nodeIds?: readonly string[], time?: number): KeyframeRef[];
3090
+ readonly clipboard: AnimationKeyframeClipboard | null;
3091
+ readonly selection: readonly KeyframeRef[];
3092
+ selectKeyframes(refs: readonly KeyframeRef[], mode?: "replace" | "add" | "toggle"): void;
3093
+ clearSelection(): void;
3094
+ /** Starts dragging keyframes (default: the selection; refs not selected become the selection). */
3095
+ beginKeyframeDrag(refs?: readonly KeyframeRef[]): void;
3096
+ /**
3097
+ * Previews the drag at `delta` ms. With `snap` (default on) the group snaps to other
3098
+ * keyframes, the playhead, 0 and the end within `thresholdMs`, else to whole frames.
3099
+ */
3100
+ updateKeyframeDrag(delta: number, opts?: {
3101
+ snap?: boolean;
3102
+ thresholdMs?: number;
3103
+ }): KeyframeDragState | null;
3104
+ /** Commits the drag as one undo step. */
3105
+ endKeyframeDrag(): number;
3106
+ /** Cancels the drag preview (Escape); nothing is edited. */
3107
+ cancelKeyframeDrag(): void;
3108
+ /** Timeline rows for `ids` (default: selected nodes), including the drag preview. */
3109
+ timelineRows(ids?: Iterable<string>, opts?: Omit<TimelineRowsOptions, "selection" | "dragDelta">): TimelineRow[];
3110
+ sampleFrames(opts?: SampleAnimationOptions): AnimationFrame[];
3111
+ exportCss(nodeId: string, opts?: CssExportOptions & {
3112
+ name?: string;
3113
+ selector?: string;
3114
+ }): CssAnimationExport;
3115
+ toWebAnimations(nodeId: string, opts?: CssExportOptions): WebAnimationSpec[];
3116
+ destroy(): void;
3117
+ };
3118
+ type CanvasAnimationController<TNode extends CanvasNode = CanvasNode> = ReturnType<typeof createCanvasAnimationController<TNode>>;
3119
+
3120
+ /**
3121
+ * Figma-style components and instances on the canvas.
3122
+ *
3123
+ * - A **main component** is a node with `data.component` (a frame whose children, via
3124
+ * `parentId`, are its layers). A **component set** (`data.componentSet`) holds variants:
3125
+ * components with `data.component.variant` (`{ Size: 'Small', Style: 'Primary' }`).
3126
+ * - An **instance** is a node with `data.instance = { componentId, properties }`. Its layers are
3127
+ * real nodes copied from the main; every copy records the main layer it mirrors in
3128
+ * `data.componentSource` and the property groups changed locally in
3129
+ * `data.componentOverrides` (`data.label`, `style.backgroundColor`, `shape.fill`,
3130
+ * `layout.gap`, `token.fill`, `hidden`, …).
3131
+ * - When a main changes, its instances are rebuilt from it, keeping layer ids and re-applying
3132
+ * overrides (matched by source, then by layer name path, so switching variants keeps
3133
+ * compatible overrides). Component properties (boolean → visibility, text → a `data` field,
3134
+ * instance swap → a nested instance's main) are applied through `data.componentPropertyRefs`
3135
+ * on the main's layers.
3136
+ * - Instances never gain or lose layers: deleting a layer inside an instance hides it, and
3137
+ * nodes added inside one move out next to it. Geometry of layers inside an instance follows
3138
+ * the main (and constraints / auto layout); only the instance itself resizes.
3139
+ * - An instance whose main was deleted keeps its layers ("missing main") and can restore it.
3140
+ *
3141
+ * Everything lives in `data`, so components and instances survive JSON, copy / paste and
3142
+ * duplication; `syncCanvasComponents(before, after)` relinks what a paste brought in.
3143
+ */
3144
+ /** Data key of a main component's definition. */
3145
+ declare const COMPONENT_DATA_KEY = "component";
3146
+ /** Data key of a component set's definition (its variants are its child components). */
3147
+ declare const COMPONENT_SET_DATA_KEY = "componentSet";
3148
+ /** Data key of an instance's link to its main (`componentId`) and its property values. */
3149
+ declare const INSTANCE_DATA_KEY = "instance";
3150
+ /** Data key of the main-component layer an instance layer mirrors. */
3151
+ declare const COMPONENT_SOURCE_DATA_KEY = "componentSource";
3152
+ /** Data key of the override groups of an instance layer. */
3153
+ declare const COMPONENT_OVERRIDES_DATA_KEY = "componentOverrides";
3154
+ /** Data key of a main layer's component property bindings (field → property name). */
3155
+ declare const COMPONENT_PROPERTY_REFS_DATA_KEY = "componentPropertyRefs";
3156
+ type CanvasComponentPropertyType = 'boolean' | 'text' | 'instanceSwap';
3157
+ type CanvasComponentPropertyDef = {
3158
+ type: 'boolean';
3159
+ default: boolean;
3160
+ description?: string;
3161
+ } | {
3162
+ type: 'text';
3163
+ default: string;
3164
+ description?: string;
3165
+ } | {
3166
+ type: 'instanceSwap';
3167
+ default: string;
3168
+ preferred?: string[];
3169
+ description?: string;
3170
+ };
3171
+ type CanvasComponentPropertyValue = boolean | string;
3172
+ interface CanvasComponentData {
3173
+ description?: string;
3174
+ /** Component properties (on a lone component; variants share their set's). */
3175
+ properties?: Record<string, CanvasComponentPropertyDef>;
3176
+ /** Variant property values of a component inside a set. */
3177
+ variant?: Record<string, string>;
3178
+ }
3179
+ interface CanvasComponentSetData {
3180
+ description?: string;
3181
+ /** Component properties shared by every variant. */
3182
+ properties?: Record<string, CanvasComponentPropertyDef>;
3183
+ }
3184
+ interface CanvasInstanceData {
3185
+ componentId: string;
3186
+ properties?: Record<string, CanvasComponentPropertyValue>;
3187
+ }
3188
+ /**
3189
+ * A field a component property drives on a main layer: `visible` (boolean), `component` (instance
3190
+ * swap, on a nested instance) or a `data.<key>` field (text, e.g. `data.label`).
3191
+ */
3192
+ type CanvasComponentPropertyField = 'visible' | 'component' | `data.${string}`;
3193
+ type CanvasComponentErrorCode = 'not-found' | 'invalid' | 'cycle' | 'inside-instance' | 'nested-instance' | 'missing-main' | 'no-overrides' | 'unknown-property' | 'type-mismatch';
3194
+ type CanvasComponentResult<TNode extends CanvasNode = CanvasNode> = {
3195
+ ok: true;
3196
+ nodes: TNode[];
3197
+ ids: string[];
3198
+ } | {
3199
+ ok: false;
3200
+ nodes: TNode[];
3201
+ code: CanvasComponentErrorCode;
3202
+ reason: string;
3203
+ };
3204
+ interface CanvasComponentSyncOptions {
3205
+ /** Ids for new layer copies (default `<instanceId>:<sourceId>`, made unique). */
3206
+ idGenerator?: (instanceId: string, sourceId: string) => string;
3207
+ /** Node types whose overrides all survive variant switches (default `['text']`). */
3208
+ textTypes?: readonly string[];
3209
+ /** Re-run auto layout inside rebuilt instances (default `true`). */
3210
+ layout?: boolean | AutoLayoutOptions;
3211
+ /**
3212
+ * Resolves token bindings after a sync when `state` is given (bindings inside instances
3213
+ * resolve in the instance's own modes). Bindings are always compared, never values.
3214
+ */
3215
+ tokens?: CanvasTokenOptions & {
3216
+ state?: TokenState;
3217
+ };
3218
+ }
3219
+ interface CreateCanvasComponentOptions extends CanvasComponentSyncOptions {
3220
+ /** Id of the wrapping frame (when the selection is wrapped). */
3221
+ id?: string;
3222
+ /** Node type of the wrapping frame (default `group`). */
3223
+ frameType?: string;
3224
+ /** Node types that become a component themselves instead of being wrapped (default `['group', 'frame']`). */
3225
+ frameTypes?: readonly string[];
3226
+ /** Name (`data.label`) of a wrapping frame. */
3227
+ name?: string;
3228
+ }
3229
+ interface CreateCanvasInstanceOptions extends CanvasComponentSyncOptions {
3230
+ id?: string;
3231
+ /** Frame to place the instance in (must not be inside its own main or an instance). */
3232
+ parentId?: string;
3233
+ /** Position in the parent's space (default: right of the main, or 0,0 in a parent). */
3234
+ position?: XYPosition;
3235
+ /** Property values (variant properties pick the variant). */
3236
+ properties?: Record<string, CanvasComponentPropertyValue>;
3237
+ }
3238
+ type Value = CanvasComponentPropertyValue;
3239
+ /** Whether `node` is a main component. */
3240
+ declare function isCanvasComponent(node: CanvasNode | undefined | null): boolean;
3241
+ /** Whether `node` is a component set. */
3242
+ declare function isCanvasComponentSet(node: CanvasNode | undefined | null): boolean;
3243
+ /** Whether `node` is an instance (top-level or nested). */
3244
+ declare function isCanvasInstance(node: CanvasNode | undefined | null): boolean;
3245
+ /** The instance data of `node`, if it is an instance. */
3246
+ declare function getInstanceData(node: CanvasNode | undefined | null): CanvasInstanceData | undefined;
3247
+ /** The component definition of `node`, if it is a main component. */
3248
+ declare function getComponentData(node: CanvasNode | undefined | null): CanvasComponentData | undefined;
3249
+ /** The main-component layer an instance layer mirrors. */
3250
+ declare function getComponentSourceId(node: CanvasNode | undefined | null): string | undefined;
3251
+ /** The override groups of an instance layer. */
3252
+ declare function getNodeOverrides(node: CanvasNode | undefined | null): readonly string[];
3253
+ /** Component property bindings of a main layer (field → property name). */
3254
+ declare function getComponentPropertyRefs(node: CanvasNode | undefined | null): Readonly<Record<string, string>>;
3255
+ /** A layer's display name: `data.name`, then `data.label`, then `data.text`, then its type. */
3256
+ declare function getLayerName(node: CanvasNode | undefined | null): string;
3257
+ /** Reads one override group (`hidden`, `size`, `position`, `style.<prop>`, `data.<key>`, …) of a node. */
3258
+ declare function readOverrideGroup(node: CanvasNode, group: string): unknown;
3259
+ /** Returns `node` with one override group set to `value` (the same node when nothing changes). */
3260
+ declare function writeOverrideGroup<T extends CanvasNode>(node: T, group: string, value: unknown): T;
3261
+ /** Override groups whose values differ between two nodes. */
3262
+ declare function diffOverrideGroups(a: CanvasNode, b: CanvasNode): string[];
3263
+ /** The variant property values of a component: `data.component.variant`, else parsed from its name. */
3264
+ declare function getVariantValues(node: CanvasNode | undefined | null): Record<string, string>;
3265
+ /** Parses a variant name `Size=Large, State=Hover` into its pairs. */
3266
+ declare function parseVariantName(name: string): Record<string, string>;
3267
+ /** Formats variant pairs as a name, in `order` (other properties after, sorted). */
3268
+ declare function formatVariantName(pairs: Readonly<Record<string, string>>, order?: readonly string[]): string;
3269
+ /** Whether an instance of `componentId` placed in `parentId` would contain itself. */
3270
+ declare function wouldCreateComponentCycle(nodes: readonly CanvasNode[], componentId: string, parentId: string | undefined): boolean;
3271
+ /** The component a node belongs to (itself, or its nearest component ancestor). */
3272
+ declare function getOwningComponent(nodes: readonly CanvasNode[], id: string): string | undefined;
3273
+ /** The innermost instance containing `id` (`id` itself when it is an instance). */
3274
+ declare function getOwningInstance(nodes: readonly CanvasNode[], id: string): string | undefined;
3275
+ /** The outermost instance containing `id`. */
3276
+ declare function getRootInstance(nodes: readonly CanvasNode[], id: string): string | undefined;
3277
+ /** Whether `id` is a layer inside an instance (not a top-level instance itself). */
3278
+ declare function isInsideInstance(nodes: readonly CanvasNode[], id: string): boolean;
3279
+ /** Top-level and nested instances of `componentId`. */
3280
+ declare function getComponentInstances(nodes: readonly CanvasNode[], componentId: string): string[];
3281
+ /** `linked`, or `missing-main` when the instance's main component is gone. */
3282
+ declare function getInstanceStatus(nodes: readonly CanvasNode[], id: string): 'linked' | 'missing-main' | undefined;
3283
+ /** The variant set of a component (its parent set), if any. */
3284
+ declare function getVariantSet(nodes: readonly CanvasNode[], componentId: string): string | undefined;
3285
+ /** Variant properties of a set with their values, in first-seen order. */
3286
+ declare function getVariantOptions(nodes: readonly CanvasNode[], setId: string): {
3287
+ name: string;
3288
+ values: string[];
3289
+ }[];
3290
+ /** The variant of `setId` matching `wanted` (all values, or else the most). */
3291
+ declare function findVariant(nodes: readonly CanvasNode[], setId: string, wanted: Readonly<Record<string, string>>): string | undefined;
3292
+ /** A set's default variant: the one in its top-left corner. */
3293
+ declare function getDefaultVariant(nodes: readonly CanvasNode[], setId: string): string | undefined;
3294
+ /** Variant combinations shared by two or more variants of a set (conflicts to resolve). */
3295
+ declare function getVariantConflicts(nodes: readonly CanvasNode[], setId: string): string[][];
3296
+ /** Component property definitions of a component (its set's for variants). */
3297
+ declare function getComponentPropertyDefs(nodes: readonly CanvasNode[], componentId: string): Record<string, CanvasComponentPropertyDef>;
3298
+ /** An instance's property values, with defaults for those it doesn't set. */
3299
+ declare function getInstanceProperties(nodes: readonly CanvasNode[], id: string): Record<string, Value>;
3300
+ interface CanvasComponentInfo {
3301
+ id: string;
3302
+ name: string;
3303
+ setId?: string;
3304
+ variant?: Record<string, string>;
3305
+ /** Instances linked to it (top-level and nested). */
3306
+ instanceCount: number;
3307
+ }
3308
+ interface CanvasComponentSetInfo {
3309
+ id: string;
3310
+ name: string;
3311
+ variants: CanvasComponentInfo[];
3312
+ options: {
3313
+ name: string;
3314
+ values: string[];
3315
+ }[];
3316
+ defaultVariantId?: string;
3317
+ }
3318
+ /** Components (lone ones and variants) and component sets, in document order. */
3319
+ declare function listCanvasComponents(nodes: readonly CanvasNode[]): {
3320
+ components: CanvasComponentInfo[];
3321
+ sets: CanvasComponentSetInfo[];
3322
+ };
3323
+ interface CanvasInstancePropertyInfo {
3324
+ name: string;
3325
+ type: CanvasComponentPropertyType;
3326
+ value: Value;
3327
+ default: Value;
3328
+ /** Instance swap: preferred components (all components when empty). */
3329
+ preferred?: string[];
3330
+ }
3331
+ interface CanvasInstanceInfo {
3332
+ /** The instance (the node itself, or the instance owning the inspected layer). */
3333
+ id: string;
3334
+ /** The outermost instance (where reset / push / detach act). */
3335
+ rootId: string;
3336
+ nested: boolean;
3337
+ componentId: string;
3338
+ componentName?: string;
3339
+ status: 'linked' | 'missing-main';
3340
+ setId?: string;
3341
+ variant: Record<string, string>;
3342
+ variantOptions: {
3343
+ name: string;
3344
+ values: string[];
3345
+ }[];
3346
+ properties: CanvasInstancePropertyInfo[];
3347
+ /** Layers of the instance with overrides (the instance itself included). */
3348
+ overrides: {
3349
+ id: string;
3350
+ name: string;
3351
+ groups: string[];
3352
+ }[];
3353
+ }
3354
+ /** Everything an instance inspector shows, for an instance or a layer inside one. */
3355
+ declare function inspectCanvasInstance(nodes: readonly CanvasNode[], id: string): CanvasInstanceInfo | undefined;
3356
+ /**
3357
+ * Rebuilds one instance from its main (keeping ids, overrides and property values).
3358
+ */
3359
+ declare function syncCanvasInstance<TNode extends CanvasNode>(nodes: readonly TNode[], instanceId: string, options?: CanvasComponentSyncOptions): TNode[];
3360
+ /**
3361
+ * Rebuilds every instance from its main, inner components first (e.g. after loading a
3362
+ * document whose instances were saved without their layers).
3363
+ */
3364
+ declare function syncAllCanvasInstances<TNode extends CanvasNode>(nodes: readonly TNode[], options?: CanvasComponentSyncOptions): TNode[];
3365
+ /**
3366
+ * Keeps components and instances consistent after an edit from `before` to `after`:
3367
+ *
3368
+ * 1. Layers deleted from inside an instance come back hidden; nodes added inside an instance
3369
+ * move out next to it; pasted / duplicated copies of instance layers stop mirroring the main,
3370
+ * and a copied nested instance becomes an instance of its own main.
3371
+ * 2. Edits to instance layers are recorded as overrides (a value equal to the main's clears
3372
+ * the override; values from the same variable or from a component property are not
3373
+ * overrides; layer geometry inside an instance is not overridable, the instance's size is).
3374
+ * 3. Instances of components whose layers changed are rebuilt (nested components first),
3375
+ * as are instances whose main, properties or overrides were switched or reset.
3376
+ *
3377
+ * Returns `after` unchanged when there is nothing to do, so it can run on every change.
3378
+ */
3379
+ declare function syncCanvasComponents<TNode extends CanvasNode>(before: readonly TNode[], after: readonly TNode[], options?: CanvasComponentSyncOptions): TNode[];
3380
+ /**
3381
+ * Create Component: a single frame-like node (one with children, a frame / group type or auto
3382
+ * layout) becomes a component; anything else is wrapped in a new component frame. Refuses
3383
+ * layers inside an instance and layers that don't share a parent.
3384
+ */
3385
+ declare function createCanvasComponent<TNode extends CanvasNode>(nodes: readonly TNode[], ids: Iterable<string>, options?: CreateCanvasComponentOptions): CanvasComponentResult<TNode>;
3386
+ /**
3387
+ * Combine as Variants: wraps sibling components in a component set. Each variant takes its
3388
+ * `data.component.variant`, else the `Prop=Value` pairs of its name, else `Property 1=…`.
3389
+ */
3390
+ declare function combineCanvasComponentsAsVariants<TNode extends CanvasNode>(nodes: readonly TNode[], ids: Iterable<string>, options?: CanvasComponentSyncOptions & {
3391
+ id?: string;
3392
+ name?: string;
3393
+ frameType?: string;
3394
+ padding?: number;
3395
+ }): CanvasComponentResult<TNode>;
3396
+ /**
3397
+ * Create Instance of a component (or of a set's default variant). Refuses placing it inside
3398
+ * its own main (directly or through nested instances) or inside another instance.
3399
+ */
3400
+ declare function createCanvasInstance<TNode extends CanvasNode>(nodes: readonly TNode[], componentId: string, options?: CreateCanvasInstanceOptions): CanvasComponentResult<TNode>;
3401
+ /**
3402
+ * Detach Instance: the instance becomes a plain frame with the same look; its layers stop
3403
+ * mirroring the main, and instances nested in it become instances of their own mains. Nested
3404
+ * instances can't be detached on their own.
3405
+ */
3406
+ declare function detachCanvasInstance<TNode extends CanvasNode>(nodes: readonly TNode[], ids: Iterable<string>, options?: CanvasComponentSyncOptions): CanvasComponentResult<TNode>;
3407
+ /**
3408
+ * Reset overrides: `group` resets one override group of layer `id`; without it, an instance
3409
+ * resets every override in it (its own size stays) and its property values, a layer resets all of
3410
+ * its own.
3411
+ */
3412
+ declare function resetCanvasInstanceOverrides<TNode extends CanvasNode>(nodes: readonly TNode[], id: string, group?: string, options?: CanvasComponentSyncOptions): CanvasComponentResult<TNode>;
3413
+ /**
3414
+ * Push overrides to main: copies every overridden value of the (outermost) instance to the
3415
+ * main layers it mirrors (geometry, swaps and property values stay with the instance), clears
3416
+ * those overrides and updates every other instance.
3417
+ */
3418
+ declare function pushCanvasInstanceOverrides<TNode extends CanvasNode>(nodes: readonly TNode[], id: string, options?: CanvasComponentSyncOptions): CanvasComponentResult<TNode>;
3419
+ /** Swaps instances to another component (or a set's default variant), keeping same-named property values. */
3420
+ declare function swapCanvasInstance<TNode extends CanvasNode>(nodes: readonly TNode[], ids: Iterable<string>, componentId: string, options?: CanvasComponentSyncOptions & {
3421
+ keepTextOverridesOnly?: boolean;
3422
+ }): CanvasComponentResult<TNode>;
3423
+ /**
3424
+ * Sets instance property values: variant properties switch to the matching variant of the set
3425
+ * (keeping compatible overrides), others must be defined on the component with the right type
3426
+ * (boolean, text, or a component id for instance swap).
3427
+ */
3428
+ declare function setCanvasInstanceProperties<TNode extends CanvasNode>(nodes: readonly TNode[], ids: Iterable<string>, properties: Readonly<Record<string, unknown>>, options?: CanvasComponentSyncOptions): CanvasComponentResult<TNode>;
3429
+ /**
3430
+ * Adds, edits (`def`) or deletes (`null`) a component property on a component (variants share
3431
+ * their set's). `newName` renames it, carrying layer bindings and instance values along.
3432
+ */
3433
+ declare function setCanvasComponentProperty<TNode extends CanvasNode>(nodes: readonly TNode[], componentId: string, name: string, def: CanvasComponentPropertyDef | null, options?: CanvasComponentSyncOptions & {
3434
+ newName?: string;
3435
+ }): CanvasComponentResult<TNode>;
3436
+ /**
3437
+ * Binds a field of a main-component layer to a component property (`null` unbinds): `visible`
3438
+ * takes a boolean property, `data.<key>` a text property, `component` (on a nested instance) an
3439
+ * instance swap property.
3440
+ */
3441
+ declare function bindCanvasComponentProperty<TNode extends CanvasNode>(nodes: readonly TNode[], layerId: string, field: CanvasComponentPropertyField, name: string | null, options?: CanvasComponentSyncOptions): CanvasComponentResult<TNode>;
3442
+ /**
3443
+ * Restore Main Component of an instance whose main was deleted: the instance becomes the main
3444
+ * again, with its old id, and its layers take the ids their copies mirror, so every other
3445
+ * instance re-links. Its property values become the property defaults.
3446
+ */
3447
+ declare function restoreCanvasMainComponent<TNode extends CanvasNode>(nodes: readonly TNode[], id: string, options?: CanvasComponentSyncOptions): CanvasComponentResult<TNode>;
3448
+
3449
+ interface CanvasComponentsControllerOptions<TNode extends CanvasNode = CanvasNode> extends CanvasComponentSyncOptions {
3450
+ getNodes: () => TNode[];
3451
+ setNodes: (nodes: TNode[]) => void;
3452
+ /** When set, every component action is one undoable step. */
3453
+ history?: ArrangeHistoryTarget;
3454
+ /** The selection (default: nodes with `selected`). */
3455
+ getSelectedIds?: () => string[];
3456
+ /** Called by `goToMainComponent` with the main (e.g. to pan the viewport to it). */
3457
+ onReveal?: (node: TNode) => void;
3458
+ }
3459
+ /**
3460
+ * Framework-agnostic components controller shared by the React hook and the Svelte rune. Its
3461
+ * actions (create component / instance, combine as variants, detach, reset, push, swap, set
3462
+ * properties, restore main) are one undoable step each with a `history`; `sync()` keeps
3463
+ * instances following their mains after any other edit (call it after the nodes change).
3464
+ * Each `can…` check returns `true` or the reason the action can't run.
3465
+ */
3466
+ declare function createCanvasComponentsController<TNode extends CanvasNode = CanvasNode>(options: CanvasComponentsControllerOptions<TNode>): {
3467
+ sync: () => TNode[];
3468
+ /** Rebuilds every instance from its main (e.g. after loading), not recorded in history. */
3469
+ syncAll(): TNode[];
3470
+ /** Create Component from `ids` (default: the selection). */
3471
+ createComponent(ids?: Iterable<string>, createOptions?: Omit<CreateCanvasComponentOptions, keyof CanvasComponentSyncOptions>): CanvasComponentResult<TNode>;
3472
+ canCreateComponent: (ids?: Iterable<string>) => string | true;
3473
+ /** Combine as Variants: wraps the selected components in a component set. */
3474
+ combineAsVariants(ids?: Iterable<string>, combineOptions?: {
3475
+ id?: string;
3476
+ name?: string;
3477
+ padding?: number;
3478
+ }): CanvasComponentResult<TNode>;
3479
+ canCombineAsVariants: (ids?: Iterable<string>) => string | true;
3480
+ /** Create Instance of a component or component set. */
3481
+ createInstance(componentId: string, createOptions?: Omit<CreateCanvasInstanceOptions, keyof CanvasComponentSyncOptions>): CanvasComponentResult<TNode>;
3482
+ canCreateInstance(componentId?: string, parentId?: string): true | string;
3483
+ /** Detach Instance (default: the selected instances). */
3484
+ detachInstance(ids?: Iterable<string>): CanvasComponentResult<TNode>;
3485
+ canDetachInstance(ids?: Iterable<string>): true | string;
3486
+ /** Reset overrides of an instance or layer (default: the first selected); `group` resets one. */
3487
+ resetOverrides(id?: string, group?: string): CanvasComponentResult<TNode>;
3488
+ canResetOverrides(id?: string): true | string;
3489
+ /** Push the (outermost) instance's overrides to its main component. */
3490
+ pushOverrides(id?: string): CanvasComponentResult<TNode>;
3491
+ canPushOverrides(id?: string): true | string;
3492
+ /** Swap the selected instances to another component (or a set's default variant). */
3493
+ swapInstance(componentId: string, ids?: Iterable<string>, swapOptions?: {
3494
+ keepTextOverridesOnly?: boolean;
3495
+ }): CanvasComponentResult<TNode>;
3496
+ canSwapInstance(componentId?: string, ids?: Iterable<string>): true | string;
3497
+ /** Set variant / component property values on the selected instances (one step). */
3498
+ setInstanceProperties(properties: Record<string, unknown>, ids?: Iterable<string>): CanvasComponentResult<TNode>;
3499
+ canSetInstanceProperties(ids?: Iterable<string>): true | string;
3500
+ /** Restore Main Component from an instance whose main was deleted. */
3501
+ restoreMainComponent(id?: string): CanvasComponentResult<TNode>;
3502
+ canRestoreMainComponent(id?: string): true | string;
3503
+ /** Adds, edits or (with `null`) deletes a component property. */
3504
+ setComponentProperty(componentId: string, name: string, def: CanvasComponentPropertyDef | null, propertyOptions?: {
3505
+ newName?: string;
3506
+ }): CanvasComponentResult<TNode>;
3507
+ /** Binds (or with `null` unbinds) a main layer's field to a component property. */
3508
+ bindComponentProperty(layerId: string, field: CanvasComponentPropertyField, name: string | null): CanvasComponentResult<TNode>;
3509
+ /** Selects the main component of an instance (or of the instance a layer is in). */
3510
+ goToMainComponent(id?: string): string | undefined;
3511
+ canGoToMainComponent(id?: string): true | string;
3512
+ /** Components and component sets, for a components panel. */
3513
+ list: () => {
3514
+ components: CanvasComponentInfo[];
3515
+ sets: CanvasComponentSetInfo[];
3516
+ };
3517
+ /** The instance inspector's view of an instance or a layer inside one (default: the selection). */
3518
+ inspect: (id?: string) => CanvasInstanceInfo | undefined;
3519
+ /** The outermost instance containing `id`. */
3520
+ rootInstanceOf: (id: string) => string | undefined;
3521
+ };
3522
+ type CanvasComponentsController<TNode extends CanvasNode = CanvasNode> = ReturnType<typeof createCanvasComponentsController<TNode>>;
3523
+ /** Drag data type for dragging a component from a components panel onto a canvas. */
3524
+ declare const CANVAS_COMPONENT_DRAG_TYPE = "application/x-pixerate-component";
3525
+ /** Reads the component id a components panel put on a drag (or `undefined`). */
3526
+ declare function getCanvasComponentDragId(dataTransfer: Pick<DataTransfer, 'getData'> | null | undefined): string | undefined;
3527
+
3528
+ export { ANIMATABLE_PROPERTIES, ANIMATION_DATA_KEY, ANIMATION_EASING_LABELS, ANIMATION_EASING_PRESETS, ANIMATION_TIME_EPSILON, AUTO_LAYOUT_DATA_KEY, type AffineMatrix, AlignEdge, AlignNodesOptions, type AnimatableProperty, type AnimateNodeOptions, type AnimationDocument, type AnimationEasing, type AnimationEasingPreset, AnimationEditError, type AnimationEditErrorCode, type AnimationFrame, type AnimationHistoryTarget, type AnimationKeyframe, type AnimationKeyframeClipboard, type AnimationLoopMode, type AnimationMotionPath, type AnimationOverrides, AnimationPlayer, type AnimationPlayerOptions, type AnimationPlayerState, type AnimationPropertyOptions, type AnimationStop, type AnimationTrack, type AnimationValue, type AnimationValueType, type ArrangeHistoryTarget, type AutoLayout, type AutoLayoutAlignContent, type AutoLayoutAlignCross, type AutoLayoutAlignMain, type AutoLayoutCellAlign, type AutoLayoutChild, type AutoLayoutConstraints, type AutoLayoutGrid, type AutoLayoutGridArea, type AutoLayoutGridCell, type AutoLayoutGridGeometry, type AutoLayoutGridTrack, type AutoLayoutHorizontalConstraint, type AutoLayoutInsertTarget, type AutoLayoutMeasure, type AutoLayoutMode, type AutoLayoutOptions, type AutoLayoutPadding, type AutoLayoutSize, type AutoLayoutSizing, type AutoLayoutSizingPair, type AutoLayoutVerticalConstraint, type BezierCommand, type BezierContour, type BezierPath, type BezierPathInput, type BezierPathToSvgOptions, type BezierSegment, CANVAS_COMPONENT_DRAG_TYPE, CANVAS_TOKEN_PROPERTIES, CHILD_LAYOUT_DATA_KEY, COMPONENT_DATA_KEY, COMPONENT_OVERRIDES_DATA_KEY, COMPONENT_PROPERTY_REFS_DATA_KEY, COMPONENT_SET_DATA_KEY, COMPONENT_SOURCE_DATA_KEY, CONNECTION_LINE_TYPES, CSS_ANIMATION_PROPERTIES, CUBIC_BEZIER_PRESETS, type CanvasAnimationController, type CanvasAnimationControllerOptions, type CanvasAnimationState, CanvasArrangeAction, type CanvasArrangeController, type CanvasArrangeControllerOptions, type CanvasAutoLayoutController, type CanvasAutoLayoutControllerOptions, CanvasClipboardPayload, type CanvasComponentData, type CanvasComponentErrorCode, type CanvasComponentInfo, type CanvasComponentPropertyDef, type CanvasComponentPropertyField, type CanvasComponentPropertyType, type CanvasComponentPropertyValue, type CanvasComponentResult, type CanvasComponentSetData, type CanvasComponentSetInfo, type CanvasComponentSyncOptions, type CanvasComponentsController, type CanvasComponentsControllerOptions, type CanvasConnectionLineType, CanvasEdge, type CanvasHeightOptions, type CanvasInstanceData, type CanvasInstanceInfo, type CanvasInstancePropertyInfo, CanvasLayoutOptions, CanvasNode, CanvasNodeStyle, CanvasNodeUpdate, type CanvasScene, type CanvasScenesOptions, type CanvasScenesState, CanvasScenesStore, type CanvasTokenBindingInfo, type CanvasTokenOptions, type CanvasTokenProperty, type CanvasViewport, type Clock, type CombineShapeNodesOptions, type CombineShapeNodesRefusal, type CombineShapeNodesResult, type ConnectorSnap, type ConnectorSnapOptions, type ConnectorSnapTarget, type CreateCanvasComponentOptions, type CreateCanvasInstanceOptions, type CssAnimationExport, type CssExportOptions, type CssPropertyAnimation, type CubicBezierEasing, type CubicSegment, DEFAULT_NODE_HEIGHT, DEFAULT_NODE_WIDTH, DEFAULT_PLACEMENT_GAP, type DashedPath, DirectionalDisplacementOptions, DistributeAxis, DistributeMode, DistributeNodesOptions, type DividePathsResult, type EllipseShape, type EvaluateAnimationOptions, FanOutTrajectoryOptions, type FitCubicsOptions, type FitPathDataOptions, type FitViewportOptions, type FlattenOptions, type GuideIndex, type GuideLine, INSTANCE_DATA_KEY, IncrementalLayoutOptions, type KeyframeDragState, type KeyframePatch, type KeyframeRangeOptions, type KeyframeRef, type KeyframeSnap, MAX_KEYFRAME_REFS, ManualClock, MatchSizeOptions, type MeasureGuide, type MeasureSelectionOptions, type MeasureSelectionResult, type MoveKeyframesResult, type MultiNodeTransitionOptions, type MultiPolygon, type NodeAnimation, NodeRectOptions, NodeTransition, type OffsetPathOptions, type OffsetShapeNodesOptions, type OklabColor, type OutlineShapeStrokesOptions, type OutlineStrokeOptions, type PathBooleanOperation, type PathBooleanResult, type PathCommand, type PathOperand, type PathOperandInput, PathOpsError, type PathOpsOptions, type PathOpsReport, type PathPiece, type PathPointAtLength, type PathShape, PlaceBesideOptions, Point, type PolygonBooleanOperation, type PolygonBooleanOptions, type PolygonFillRule, type PolygonInput, type PolygonOperand, type PolygonPiece, type PolygonRing, type PolygonToPathOptions, type PolygonWithHoles, Position, type PositionChangeLike, RESIZE_HANDLES, type RecordAnimationOptions, Rect, type RectShape, ReflowDisplacementOptions, type RegularPolygonShape, type ResizeHandle, SHAPE_DATA_KEY, SHAPE_KINDS, SHAPE_NODE_TYPE, SHAPE_OPERATIONS, type SampleAnimationOptions, type ScaleKeyframesOptions, type SerializedCanvasScenes, type SetKeyframeOptions, type ShapeDescription, type ShapeKind, type ShapeNodePolygonOptions, type ShapeOperation, type ShapePaint, type ShapePathEditOperation, type ShapePathEditRefusal, type ShapePathEditResult, type ShapeRenderData, type ShapeSize, Side, SizeDimension, type SnapGuidesOptions, type SnapNodeDragOptions, type SnapNodeDragResult, type SnapNodeResizeOptions, type SnapNodeResizeResult, type SnapResizeOptions, type SnapResizeResult, type SnapResult, type SpringEasing, type StarShape, StreamingLayoutManager, type StreamingLayoutManagerOptions, type StrokeCap, type StrokeJoin, TOKEN_BINDINGS_DATA_KEY, TOKEN_MODES_DATA_KEY, type TimelineKeyframe, type TimelineRow, type TimelineRowsOptions, TrajectoryFunction, type WebAnimationSpec, XYPosition, ZOrderOperation, addKeyframesAtTime, animateNode, applyAnimation, applyAnimationOverrides, applyConstraints, applyShapeCombination, applyShapeReplacement, arcToCubics, bezierPathArea, bezierPathBounds, bezierPathLength, bezierPathPointAtLength, bezierPathSignedArea, bezierPathToSvg, bindCanvasComponentProperty, bindCanvasToken, blendLayout, boundsOf, calculateDagreReflowDisplacement, calculateDirectionalDisplacement, canCombineShapeNodes, canOffsetShapeNodes, canOutlineShapeNodeStrokes, canvasHeight, centerNodes, centre, clampAnimationValue, clampLayoutSize, closeContour, collectDescendantIds, combineCanvasComponentsAsVariants, combineShapeNodes, computeNodesBoundingBox, computeSnapGuides, connectedOnly, contourSignedArea, contoursToPath, copyKeyframes, countPathSegments, createAnimationPlayer, createBezierTrajectory, createCanvasAnimationController, createCanvasArrangeController, createCanvasAutoLayoutController, createCanvasComponent, createCanvasComponentsController, createCanvasInstance, createCanvasScenesStore, createFanOutTrajectory, createGuideIndex, createNodeGuideIndex, cubicBezierAt, cubicPointAt, cubicsToPathData, dashContours, defaultEasing, deleteKeyframes, detachCanvasInstance, detachTokenBindings, diffOverrideGroups, distanceToBezierPath, dividePaths, dividePolygons, easingFromInfluence, easingLabel, easingToCss, ensureLayout, estimateCanvasHeight, estimateNodeSize, evaluateAnimation, evaluateEasing, evaluateTrack, excludePaths, exportCssAnimation, findConnectorSnap, findVariant, fitCubicRun, fitCubics, fitFreehandPath, fitPathData, fitViewportToNodes, fitViewportToRect, flattenSvgPath, flowSide, formatAnimationTime, formatNumber, formatOklab, formatVariantName, getAnimatableProperty, getAnimatedProperties, getAnimatedValue, getAnimationDuration, getAnimationTrack, getAutoLayout, getAutoLayoutGrid, getAutoLayoutInsertTarget, getBindableTokenProperties, getCanvasComponentDragId, getCanvasTokenProperty, getCenteredNodePosition, getChildLayout, getComponentData, getComponentInstances, getComponentPropertyDefs, getComponentPropertyRefs, getComponentSourceId, getCssPropertyAnimations, getDefaultVariant, getEffectiveTokenModes, getFlowChildren, getInstanceData, getInstanceProperties, getInstanceStatus, getKeyframeTimes, getLayerName, getLayoutParent, getLayoutSizing, getLayoutedNodes, getNodeAnimation, getNodeOverrides, getNodeShape, getNodeTokenBindings, getNodeTokenModes, getOwningComponent, getOwningInstance, getResizingNodeRect, getRootInstance, getShapeRenderData, getShapeSvg, getTimelineRows, getTimelineTicks, getTokenPropertyScope, getTokensForProperty, getVariantConflicts, getVariantOptions, getVariantSet, getVariantValues, handlePoint, hasVisibleStroke, inferResizeHandle, inspectCanvasInstance, inspectNodeTokens, interpolateAnimationValue, intersectPaths, intersectPolygons, isAnimationEasing, isAnimationKeyframe, isAutoLayoutFrame, isCanvasComponent, isCanvasComponentSet, isCanvasInstance, isCssExportExact, isEventFromTextInput, isInsideInstance, isKeyframeSelected, isMeasureModifierHeld, isNodeAnimated, isShapeDescription, isShapeNode, isStraightCubic, isValidCanvasEdge, isValidCanvasNode, isValidCanvasScene, isValidUrl, layoutAll, layoutBounds, layoutFrame, layoutUp, layoutUpMany, linearPositionTrajectory, linearTrajectory, listCanvasComponents, makeSizingCoherent, measureBetween, measureLabel, measureSelection, measureToLine, mergeNodeUpdates, mixColorsOklab, moveKeyframes, moveLayoutChild, multiPolygonArea, multiPolygonBounds, nearestHandlePositions, normalizeBezierPath, normalizeKeyframes, offsetPath, offsetShapeNodes, oklabToRgb, oppositePosition, outlineShapeNodeStrokes, outlineStroke, overlaps, pageHidden, parseCanvasClipboardData, parseCanvasScenes, parseCssEasing, parseKeyframeClipboard, parseNodeStyleDeclarations, parseOklab, parseSvgPath, parseVariantName, pasteKeyframes, pathBoolean, pathToContours, placeBeside, playWebAnimations, pointInBezierPath, pointInMultiPolygon, pointInRings, polygonArea, polygonBoolean, polygonToSvgPath, positionToSide, pruneCanvasTokenModes, pushCanvasInstanceOverrides, readAnimatableValue, readNodeStyleProperty, readOverrideGroup, realClock, recordAnimationChanges, relayoutUpdates, remapPastedNodes, removeTrack, repositionNodesTo, resetCanvasInstanceOverrides, resizeHandleAxes, resolveCanvasTokens, resolveEasing, resolvePadding, restoreCanvasMainComponent, revertShapeCombination, rgbToOklab, ringSignedArea, runMultiNodeTransition, sampleAnimationFrames, scaleKeyframes, segmentBounds, segmentCurvature, segmentDerivative, segmentExtrema, segmentLength, segmentNearest, segmentParamAtLength, segmentPoint, segmentTangent, serializeCanvasNodes, setCanvasComponentProperty, setCanvasInstanceProperties, setCanvasTokenMode, setKeyframe, setKeyframeEasing, setMotionPath, setTrackEnabled, shapeNodeToBezierPath, shapeNodeToPolygon, shapeToBezierPath, shapeToPolygon, sideToPosition, simplifyRing, snapKeyframeDelta, snapNodeDrag, snapNodeResize, snapResize, snapTimeToFrame, snapToGrid, splitSegment, springAt, strokeOutlineRings, subSegment, subtractPaths, subtractPolygons, swapCanvasInstance, syncAllCanvasInstances, syncCanvasComponents, syncCanvasInstance, timeToX, toBezierPath, toWebAnimations, transformBezierPath, trimSegments, unionPolygons, unitePaths, updateKeyframe, windingNumber, withNodeAnimation, withStyleOpacity, wouldCreateComponentCycle, wrapAnimationTime, writeNodeStyleProperty, writeOverrideGroup, xToTime, xorPolygons };