@pixerate/editor-react 0.16.0 → 0.18.0

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 (46) hide show
  1. package/README.md +4 -2
  2. package/dist/canvas/index.cjs +1094 -143
  3. package/dist/canvas/index.cjs.map +1 -1
  4. package/dist/canvas/index.d.cts +277 -3
  5. package/dist/canvas/index.d.ts +277 -3
  6. package/dist/canvas/index.js +976 -0
  7. package/dist/canvas/index.js.map +1 -1
  8. package/dist/chunk-34HEZX7J.js +2144 -0
  9. package/dist/chunk-34HEZX7J.js.map +1 -0
  10. package/dist/chunk-I3E4KSA2.js +515 -0
  11. package/dist/chunk-I3E4KSA2.js.map +1 -0
  12. package/dist/{chunk-XTFR3IMK.js → chunk-ZU54BMDC.js} +473 -160
  13. package/dist/chunk-ZU54BMDC.js.map +1 -0
  14. package/dist/generation/index.cjs +290 -0
  15. package/dist/generation/index.cjs.map +1 -1
  16. package/dist/generation/index.d.cts +66 -2
  17. package/dist/generation/index.d.ts +66 -2
  18. package/dist/generation/index.js +7 -1
  19. package/dist/image-editor/index.cjs +490 -187
  20. package/dist/image-editor/index.cjs.map +1 -1
  21. package/dist/image-editor/index.d.cts +34 -2
  22. package/dist/image-editor/index.d.ts +34 -2
  23. package/dist/image-editor/index.js +5 -1
  24. package/dist/index.cjs +2792 -823
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +188 -7
  27. package/dist/index.d.ts +188 -7
  28. package/dist/index.js +600 -158
  29. package/dist/index.js.map +1 -1
  30. package/dist/spreadsheet/index.cjs +1099 -142
  31. package/dist/spreadsheet/index.cjs.map +1 -1
  32. package/dist/spreadsheet/index.d.cts +156 -8
  33. package/dist/spreadsheet/index.d.ts +156 -8
  34. package/dist/spreadsheet/index.js +15 -3
  35. package/dist/tokens/index.cjs +395 -0
  36. package/dist/tokens/index.cjs.map +1 -0
  37. package/dist/tokens/index.d.cts +54 -0
  38. package/dist/tokens/index.d.ts +54 -0
  39. package/dist/tokens/index.js +375 -0
  40. package/dist/tokens/index.js.map +1 -0
  41. package/package.json +10 -2
  42. package/dist/chunk-7SPRQZ6H.js +0 -216
  43. package/dist/chunk-7SPRQZ6H.js.map +0 -1
  44. package/dist/chunk-FYIPXHAE.js +0 -1169
  45. package/dist/chunk-FYIPXHAE.js.map +0 -1
  46. package/dist/chunk-XTFR3IMK.js.map +0 -1
@@ -20,149 +20,300 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/canvas/index.ts
21
21
  var canvas_exports = {};
22
22
  __export(canvas_exports, {
23
- AUTO_LAYOUT_DATA_KEY: () => import_canvas15.AUTO_LAYOUT_DATA_KEY,
23
+ ANIMATABLE_PROPERTIES: () => import_canvas24.ANIMATABLE_PROPERTIES,
24
+ ANIMATION_DATA_KEY: () => import_canvas24.ANIMATION_DATA_KEY,
25
+ ANIMATION_EASING_LABELS: () => import_canvas24.ANIMATION_EASING_LABELS,
26
+ ANIMATION_EASING_PRESETS: () => import_canvas24.ANIMATION_EASING_PRESETS,
27
+ ANIMATION_TIME_EPSILON: () => import_canvas24.ANIMATION_TIME_EPSILON,
28
+ AUTO_LAYOUT_DATA_KEY: () => import_canvas22.AUTO_LAYOUT_DATA_KEY,
24
29
  AgentPresenceLayer: () => AgentPresenceLayer,
25
- CHILD_LAYOUT_DATA_KEY: () => import_canvas15.CHILD_LAYOUT_DATA_KEY,
26
- CONNECTION_LINE_TYPES: () => import_canvas12.CONNECTION_LINE_TYPES,
30
+ AnimationEditError: () => import_canvas24.AnimationEditError,
31
+ AnimationPlayer: () => import_canvas24.AnimationPlayer,
32
+ AnimationTimeline: () => AnimationTimeline,
33
+ CANVAS_COMPONENT_DRAG_TYPE: () => import_canvas25.CANVAS_COMPONENT_DRAG_TYPE,
34
+ CANVAS_TOKEN_PROPERTIES: () => import_canvas23.CANVAS_TOKEN_PROPERTIES,
35
+ CHILD_LAYOUT_DATA_KEY: () => import_canvas22.CHILD_LAYOUT_DATA_KEY,
36
+ CONNECTION_LINE_TYPES: () => import_canvas18.CONNECTION_LINE_TYPES,
37
+ CSS_ANIMATION_PROPERTIES: () => import_canvas24.CSS_ANIMATION_PROPERTIES,
38
+ CUBIC_BEZIER_PRESETS: () => import_canvas24.CUBIC_BEZIER_PRESETS,
39
+ CanvasComponentsPanel: () => CanvasComponentsPanel,
27
40
  CanvasGuidesLayer: () => CanvasGuidesLayer,
28
- CanvasScenesStore: () => import_canvas12.CanvasScenesStore,
29
- DEFAULT_ARRANGE_SHORTCUTS: () => import_canvas12.DEFAULT_ARRANGE_SHORTCUTS,
30
- ManualClock: () => import_canvas14.ManualClock,
31
- RESIZE_HANDLES: () => import_canvas11.RESIZE_HANDLES,
32
- SHAPE_DATA_KEY: () => import_canvas13.SHAPE_DATA_KEY,
33
- SHAPE_KINDS: () => import_canvas13.SHAPE_KINDS,
34
- SHAPE_NODE_TYPE: () => import_canvas13.SHAPE_NODE_TYPE,
35
- SHAPE_OPERATIONS: () => import_canvas13.SHAPE_OPERATIONS,
41
+ CanvasInstanceInspector: () => CanvasInstanceInspector,
42
+ CanvasScenesStore: () => import_canvas18.CanvasScenesStore,
43
+ DEFAULT_ARRANGE_SHORTCUTS: () => import_canvas18.DEFAULT_ARRANGE_SHORTCUTS,
44
+ MAX_KEYFRAME_REFS: () => import_canvas24.MAX_KEYFRAME_REFS,
45
+ ManualClock: () => import_canvas21.ManualClock,
46
+ RESIZE_HANDLES: () => import_canvas17.RESIZE_HANDLES,
47
+ SHAPE_DATA_KEY: () => import_canvas19.SHAPE_DATA_KEY,
48
+ SHAPE_KINDS: () => import_canvas19.SHAPE_KINDS,
49
+ SHAPE_NODE_TYPE: () => import_canvas19.SHAPE_NODE_TYPE,
50
+ SHAPE_OPERATIONS: () => import_canvas19.SHAPE_OPERATIONS,
36
51
  ShapeNode: () => ShapeNode,
37
- alignNodes: () => import_canvas12.alignNodes,
38
- applyConstraints: () => import_canvas15.applyConstraints,
39
- applyNodeUpdates: () => import_canvas12.applyNodeUpdates,
40
- applyShapeCombination: () => import_canvas13.applyShapeCombination,
41
- blendLayout: () => import_canvas14.blendLayout,
42
- boundsOf: () => import_canvas14.boundsOf,
43
- calculateDagreReflowDisplacement: () => import_canvas14.calculateDagreReflowDisplacement,
44
- calculateDirectionalDisplacement: () => import_canvas14.calculateDirectionalDisplacement,
45
- canCombineShapeNodes: () => import_canvas13.canCombineShapeNodes,
46
- canvasHeight: () => import_canvas14.canvasHeight,
47
- centerNodes: () => import_canvas14.centerNodes,
48
- centre: () => import_canvas14.centre,
49
- clampLayoutSize: () => import_canvas15.clampLayoutSize,
50
- combineShapeNodes: () => import_canvas13.combineShapeNodes,
51
- computeNodesBoundingBox: () => import_canvas14.computeNodesBoundingBox,
52
- computeSnapGuides: () => import_canvas12.computeSnapGuides,
53
- connectedOnly: () => import_canvas14.connectedOnly,
54
- createBezierTrajectory: () => import_canvas14.createBezierTrajectory,
55
- createCanvasAutoLayoutController: () => import_canvas15.createCanvasAutoLayoutController,
56
- createCanvasScenesStore: () => import_canvas12.createCanvasScenesStore,
57
- createFanOutTrajectory: () => import_canvas14.createFanOutTrajectory,
58
- createGuideIndex: () => import_canvas12.createGuideIndex,
59
- createNodeGuideIndex: () => import_canvas12.createNodeGuideIndex,
60
- cubicPointAt: () => import_canvas11.cubicPointAt,
61
- cubicsToPathData: () => import_canvas11.cubicsToPathData,
62
- defaultEasing: () => import_canvas14.defaultEasing,
63
- distributeNodes: () => import_canvas12.distributeNodes,
64
- dividePolygons: () => import_canvas13.dividePolygons,
65
- ensureLayout: () => import_canvas14.ensureLayout,
66
- estimateCanvasHeight: () => import_canvas14.estimateCanvasHeight,
67
- estimateNodeSize: () => import_canvas14.estimateNodeSize,
68
- findConnectorSnap: () => import_canvas12.findConnectorSnap,
69
- fitCubicRun: () => import_canvas11.fitCubicRun,
70
- fitCubics: () => import_canvas11.fitCubics,
71
- fitFreehandPath: () => import_canvas11.fitFreehandPath,
72
- fitPathData: () => import_canvas11.fitPathData,
73
- fitViewportToNodes: () => import_canvas12.fitViewportToNodes,
74
- fitViewportToRect: () => import_canvas12.fitViewportToRect,
75
- flattenSvgPath: () => import_canvas13.flattenSvgPath,
76
- flowSide: () => import_canvas14.flowSide,
77
- getAbsolutePosition: () => import_canvas12.getAbsolutePosition,
78
- getAutoLayout: () => import_canvas15.getAutoLayout,
79
- getAutoLayoutGrid: () => import_canvas15.getAutoLayoutGrid,
80
- getAutoLayoutInsertTarget: () => import_canvas15.getAutoLayoutInsertTarget,
81
- getCenteredNodePosition: () => import_canvas14.getCenteredNodePosition,
82
- getChildLayout: () => import_canvas15.getChildLayout,
83
- getFlowChildren: () => import_canvas15.getFlowChildren,
84
- getLayoutParent: () => import_canvas15.getLayoutParent,
85
- getLayoutSizing: () => import_canvas15.getLayoutSizing,
86
- getLayoutedNodes: () => import_canvas14.getLayoutedNodes,
87
- getNodeRect: () => import_canvas12.getNodeRect,
88
- getNodeShape: () => import_canvas13.getNodeShape,
89
- getNodeSize: () => import_canvas12.getNodeSize,
90
- getResizingNodeRect: () => import_canvas11.getResizingNodeRect,
91
- getShapeRenderData: () => import_canvas13.getShapeRenderData,
92
- getShapeSvg: () => import_canvas13.getShapeSvg,
93
- handlePoint: () => import_canvas12.handlePoint,
94
- inferResizeHandle: () => import_canvas11.inferResizeHandle,
95
- intersectPolygons: () => import_canvas13.intersectPolygons,
96
- invertNodeUpdates: () => import_canvas12.invertNodeUpdates,
97
- isAutoLayoutFrame: () => import_canvas15.isAutoLayoutFrame,
98
- isEventFromTextInput: () => import_canvas14.isEventFromTextInput,
99
- isLocked: () => import_canvas12.isLocked,
100
- isMeasureModifierHeld: () => import_canvas11.isMeasureModifierHeld,
101
- isShapeDescription: () => import_canvas13.isShapeDescription,
102
- isShapeNode: () => import_canvas13.isShapeNode,
103
- isStraightCubic: () => import_canvas11.isStraightCubic,
104
- isValidCanvasNode: () => import_canvas14.isValidCanvasNode,
105
- isValidUrl: () => import_canvas14.isValidUrl,
106
- layoutAll: () => import_canvas15.layoutAll,
107
- layoutBounds: () => import_canvas14.layoutBounds,
108
- layoutFrame: () => import_canvas15.layoutFrame,
109
- layoutUp: () => import_canvas15.layoutUp,
110
- layoutUpMany: () => import_canvas15.layoutUpMany,
111
- linearPositionTrajectory: () => import_canvas14.linearPositionTrajectory,
112
- linearTrajectory: () => import_canvas14.linearTrajectory,
113
- lockNodes: () => import_canvas12.lockNodes,
114
- makeSizingCoherent: () => import_canvas15.makeSizingCoherent,
115
- matchArrangeShortcut: () => import_canvas12.matchArrangeShortcut,
116
- matchSize: () => import_canvas12.matchSize,
117
- measureBetween: () => import_canvas11.measureBetween,
118
- measureLabel: () => import_canvas11.measureLabel,
119
- measureSelection: () => import_canvas11.measureSelection,
120
- measureToLine: () => import_canvas11.measureToLine,
121
- mergeNodeUpdates: () => import_canvas15.mergeNodeUpdates,
122
- moveLayoutChild: () => import_canvas15.moveLayoutChild,
123
- multiPolygonArea: () => import_canvas13.multiPolygonArea,
124
- multiPolygonBounds: () => import_canvas13.multiPolygonBounds,
125
- nearestHandlePositions: () => import_canvas12.nearestHandlePositions,
126
- oppositePosition: () => import_canvas12.oppositePosition,
127
- overlaps: () => import_canvas14.overlaps,
128
- parseCanvasClipboardData: () => import_canvas14.parseCanvasClipboardData,
129
- parseCanvasScenes: () => import_canvas12.parseCanvasScenes,
130
- parseSvgPath: () => import_canvas13.parseSvgPath,
131
- placeBeside: () => import_canvas14.placeBeside,
132
- pointInMultiPolygon: () => import_canvas13.pointInMultiPolygon,
133
- pointInRings: () => import_canvas13.pointInRings,
134
- polygonArea: () => import_canvas13.polygonArea,
135
- polygonBoolean: () => import_canvas13.polygonBoolean,
136
- polygonToSvgPath: () => import_canvas13.polygonToSvgPath,
137
- positionToSide: () => import_canvas12.positionToSide,
138
- readStyleSize: () => import_canvas12.readStyleSize,
139
- realClock: () => import_canvas14.realClock,
140
- relayoutUpdates: () => import_canvas15.relayoutUpdates,
141
- remapPastedNodes: () => import_canvas14.remapPastedNodes,
142
- reorderNodes: () => import_canvas12.reorderNodes,
143
- repositionNodesTo: () => import_canvas14.repositionNodesTo,
144
- resizeHandleAxes: () => import_canvas11.resizeHandleAxes,
145
- resolvePadding: () => import_canvas15.resolvePadding,
146
- revertShapeCombination: () => import_canvas13.revertShapeCombination,
147
- ringSignedArea: () => import_canvas13.ringSignedArea,
148
- runMultiNodeTransition: () => import_canvas14.runMultiNodeTransition,
149
- serializeCanvasNodes: () => import_canvas14.serializeCanvasNodes,
150
- shapeNodeToPolygon: () => import_canvas13.shapeNodeToPolygon,
151
- shapeToPolygon: () => import_canvas13.shapeToPolygon,
152
- sideToPosition: () => import_canvas12.sideToPosition,
153
- simplifyRing: () => import_canvas13.simplifyRing,
154
- snapNodeDrag: () => import_canvas12.snapNodeDrag,
155
- snapNodeResize: () => import_canvas11.snapNodeResize,
156
- snapResize: () => import_canvas11.snapResize,
157
- snapToGrid: () => import_canvas11.snapToGrid,
158
- subtractPolygons: () => import_canvas13.subtractPolygons,
159
- toggleLockNodes: () => import_canvas12.toggleLockNodes,
160
- unionPolygons: () => import_canvas13.unionPolygons,
161
- unlockNodes: () => import_canvas12.unlockNodes,
52
+ TOKEN_BINDINGS_DATA_KEY: () => import_canvas23.TOKEN_BINDINGS_DATA_KEY,
53
+ TOKEN_MODES_DATA_KEY: () => import_canvas23.TOKEN_MODES_DATA_KEY,
54
+ TokenBindingPicker: () => TokenBindingPicker,
55
+ TokenModeSwitcher: () => TokenModeSwitcher,
56
+ addKeyframesAtTime: () => import_canvas24.addKeyframesAtTime,
57
+ alignNodes: () => import_canvas18.alignNodes,
58
+ animateNode: () => import_canvas24.animateNode,
59
+ applyAnimation: () => import_canvas24.applyAnimation,
60
+ applyAnimationOverrides: () => import_canvas24.applyAnimationOverrides,
61
+ applyConstraints: () => import_canvas22.applyConstraints,
62
+ applyNodeUpdates: () => import_canvas18.applyNodeUpdates,
63
+ applyShapeCombination: () => import_canvas19.applyShapeCombination,
64
+ applyShapeReplacement: () => import_canvas20.applyShapeReplacement,
65
+ bezierPathArea: () => import_canvas20.bezierPathArea,
66
+ bezierPathBounds: () => import_canvas20.bezierPathBounds,
67
+ bezierPathLength: () => import_canvas20.bezierPathLength,
68
+ bezierPathPointAtLength: () => import_canvas20.bezierPathPointAtLength,
69
+ bezierPathSignedArea: () => import_canvas20.bezierPathSignedArea,
70
+ bezierPathToSvg: () => import_canvas20.bezierPathToSvg,
71
+ bindCanvasComponentProperty: () => import_canvas25.bindCanvasComponentProperty,
72
+ bindCanvasToken: () => import_canvas23.bindCanvasToken,
73
+ blendLayout: () => import_canvas21.blendLayout,
74
+ boundsOf: () => import_canvas21.boundsOf,
75
+ calculateDagreReflowDisplacement: () => import_canvas21.calculateDagreReflowDisplacement,
76
+ calculateDirectionalDisplacement: () => import_canvas21.calculateDirectionalDisplacement,
77
+ canCombineShapeNodes: () => import_canvas19.canCombineShapeNodes,
78
+ canOffsetShapeNodes: () => import_canvas20.canOffsetShapeNodes,
79
+ canOutlineShapeNodeStrokes: () => import_canvas20.canOutlineShapeNodeStrokes,
80
+ canvasHeight: () => import_canvas21.canvasHeight,
81
+ centerNodes: () => import_canvas21.centerNodes,
82
+ centre: () => import_canvas21.centre,
83
+ clampAnimationValue: () => import_canvas24.clampAnimationValue,
84
+ clampLayoutSize: () => import_canvas22.clampLayoutSize,
85
+ combineCanvasComponentsAsVariants: () => import_canvas25.combineCanvasComponentsAsVariants,
86
+ combineShapeNodes: () => import_canvas19.combineShapeNodes,
87
+ computeNodesBoundingBox: () => import_canvas21.computeNodesBoundingBox,
88
+ computeSnapGuides: () => import_canvas18.computeSnapGuides,
89
+ connectedOnly: () => import_canvas21.connectedOnly,
90
+ copyKeyframes: () => import_canvas24.copyKeyframes,
91
+ countPathSegments: () => import_canvas20.countPathSegments,
92
+ createAnimationPlayer: () => import_canvas24.createAnimationPlayer,
93
+ createBezierTrajectory: () => import_canvas21.createBezierTrajectory,
94
+ createCanvasAnimationController: () => import_canvas24.createCanvasAnimationController,
95
+ createCanvasAutoLayoutController: () => import_canvas22.createCanvasAutoLayoutController,
96
+ createCanvasComponent: () => import_canvas25.createCanvasComponent,
97
+ createCanvasComponentsController: () => import_canvas25.createCanvasComponentsController,
98
+ createCanvasInstance: () => import_canvas25.createCanvasInstance,
99
+ createCanvasScenesStore: () => import_canvas18.createCanvasScenesStore,
100
+ createFanOutTrajectory: () => import_canvas21.createFanOutTrajectory,
101
+ createGuideIndex: () => import_canvas18.createGuideIndex,
102
+ createNodeGuideIndex: () => import_canvas18.createNodeGuideIndex,
103
+ cubicBezierAt: () => import_canvas24.cubicBezierAt,
104
+ cubicPointAt: () => import_canvas17.cubicPointAt,
105
+ cubicsToPathData: () => import_canvas17.cubicsToPathData,
106
+ dashContours: () => import_canvas20.dashContours,
107
+ defaultEasing: () => import_canvas21.defaultEasing,
108
+ deleteKeyframes: () => import_canvas24.deleteKeyframes,
109
+ detachCanvasInstance: () => import_canvas25.detachCanvasInstance,
110
+ detachTokenBindings: () => import_canvas23.detachTokenBindings,
111
+ distanceToBezierPath: () => import_canvas20.distanceToBezierPath,
112
+ distributeNodes: () => import_canvas18.distributeNodes,
113
+ dividePaths: () => import_canvas20.dividePaths,
114
+ dividePolygons: () => import_canvas19.dividePolygons,
115
+ easingFromInfluence: () => import_canvas24.easingFromInfluence,
116
+ easingLabel: () => import_canvas24.easingLabel,
117
+ easingToCss: () => import_canvas24.easingToCss,
118
+ ensureLayout: () => import_canvas21.ensureLayout,
119
+ estimateCanvasHeight: () => import_canvas21.estimateCanvasHeight,
120
+ estimateNodeSize: () => import_canvas21.estimateNodeSize,
121
+ evaluateAnimation: () => import_canvas24.evaluateAnimation,
122
+ evaluateEasing: () => import_canvas24.evaluateEasing,
123
+ evaluateTrack: () => import_canvas24.evaluateTrack,
124
+ excludePaths: () => import_canvas20.excludePaths,
125
+ exportCssAnimation: () => import_canvas24.exportCssAnimation,
126
+ findConnectorSnap: () => import_canvas18.findConnectorSnap,
127
+ fitCubicRun: () => import_canvas17.fitCubicRun,
128
+ fitCubics: () => import_canvas17.fitCubics,
129
+ fitFreehandPath: () => import_canvas17.fitFreehandPath,
130
+ fitPathData: () => import_canvas17.fitPathData,
131
+ fitViewportToNodes: () => import_canvas18.fitViewportToNodes,
132
+ fitViewportToRect: () => import_canvas18.fitViewportToRect,
133
+ flattenSvgPath: () => import_canvas19.flattenSvgPath,
134
+ flowSide: () => import_canvas21.flowSide,
135
+ formatAnimationTime: () => import_canvas24.formatAnimationTime,
136
+ formatOklab: () => import_canvas24.formatOklab,
137
+ getAbsolutePosition: () => import_canvas18.getAbsolutePosition,
138
+ getAnimatableProperty: () => import_canvas24.getAnimatableProperty,
139
+ getAnimatedProperties: () => import_canvas24.getAnimatedProperties,
140
+ getAnimatedValue: () => import_canvas24.getAnimatedValue,
141
+ getAnimationDuration: () => import_canvas24.getAnimationDuration,
142
+ getAnimationTrack: () => import_canvas24.getAnimationTrack,
143
+ getAutoLayout: () => import_canvas22.getAutoLayout,
144
+ getAutoLayoutGrid: () => import_canvas22.getAutoLayoutGrid,
145
+ getAutoLayoutInsertTarget: () => import_canvas22.getAutoLayoutInsertTarget,
146
+ getBindableTokenProperties: () => import_canvas23.getBindableTokenProperties,
147
+ getCanvasComponentDragId: () => import_canvas25.getCanvasComponentDragId,
148
+ getCanvasTokenProperty: () => import_canvas23.getCanvasTokenProperty,
149
+ getCenteredNodePosition: () => import_canvas21.getCenteredNodePosition,
150
+ getChildLayout: () => import_canvas22.getChildLayout,
151
+ getComponentSourceId: () => import_canvas25.getComponentSourceId,
152
+ getCssPropertyAnimations: () => import_canvas24.getCssPropertyAnimations,
153
+ getEffectiveTokenModes: () => import_canvas23.getEffectiveTokenModes,
154
+ getFlowChildren: () => import_canvas22.getFlowChildren,
155
+ getInstanceData: () => import_canvas25.getInstanceData,
156
+ getInstanceStatus: () => import_canvas25.getInstanceStatus,
157
+ getKeyframeTimes: () => import_canvas24.getKeyframeTimes,
158
+ getLayoutParent: () => import_canvas22.getLayoutParent,
159
+ getLayoutSizing: () => import_canvas22.getLayoutSizing,
160
+ getLayoutedNodes: () => import_canvas21.getLayoutedNodes,
161
+ getNodeAnimation: () => import_canvas24.getNodeAnimation,
162
+ getNodeOverrides: () => import_canvas25.getNodeOverrides,
163
+ getNodeRect: () => import_canvas18.getNodeRect,
164
+ getNodeShape: () => import_canvas19.getNodeShape,
165
+ getNodeSize: () => import_canvas18.getNodeSize,
166
+ getNodeTokenBindings: () => import_canvas23.getNodeTokenBindings,
167
+ getNodeTokenModes: () => import_canvas23.getNodeTokenModes,
168
+ getResizingNodeRect: () => import_canvas17.getResizingNodeRect,
169
+ getShapeRenderData: () => import_canvas19.getShapeRenderData,
170
+ getShapeSvg: () => import_canvas19.getShapeSvg,
171
+ getTimelineRows: () => import_canvas24.getTimelineRows,
172
+ getTimelineTicks: () => import_canvas24.getTimelineTicks,
173
+ getTokenPropertyScope: () => import_canvas23.getTokenPropertyScope,
174
+ getTokensForProperty: () => import_canvas23.getTokensForProperty,
175
+ handlePoint: () => import_canvas18.handlePoint,
176
+ hasVisibleStroke: () => import_canvas20.hasVisibleStroke,
177
+ inferResizeHandle: () => import_canvas17.inferResizeHandle,
178
+ inspectCanvasInstance: () => import_canvas25.inspectCanvasInstance,
179
+ inspectNodeTokens: () => import_canvas23.inspectNodeTokens,
180
+ interpolateAnimationValue: () => import_canvas24.interpolateAnimationValue,
181
+ intersectPaths: () => import_canvas20.intersectPaths,
182
+ intersectPolygons: () => import_canvas19.intersectPolygons,
183
+ invertNodeUpdates: () => import_canvas18.invertNodeUpdates,
184
+ isAnimationEasing: () => import_canvas24.isAnimationEasing,
185
+ isAnimationKeyframe: () => import_canvas24.isAnimationKeyframe,
186
+ isAutoLayoutFrame: () => import_canvas22.isAutoLayoutFrame,
187
+ isCanvasComponent: () => import_canvas25.isCanvasComponent,
188
+ isCanvasComponentSet: () => import_canvas25.isCanvasComponentSet,
189
+ isCanvasInstance: () => import_canvas25.isCanvasInstance,
190
+ isCssExportExact: () => import_canvas24.isCssExportExact,
191
+ isEventFromTextInput: () => import_canvas21.isEventFromTextInput,
192
+ isKeyframeSelected: () => import_canvas24.isKeyframeSelected,
193
+ isLocked: () => import_canvas18.isLocked,
194
+ isMeasureModifierHeld: () => import_canvas17.isMeasureModifierHeld,
195
+ isNodeAnimated: () => import_canvas24.isNodeAnimated,
196
+ isShapeDescription: () => import_canvas19.isShapeDescription,
197
+ isShapeNode: () => import_canvas19.isShapeNode,
198
+ isStraightCubic: () => import_canvas17.isStraightCubic,
199
+ isValidCanvasNode: () => import_canvas21.isValidCanvasNode,
200
+ isValidUrl: () => import_canvas21.isValidUrl,
201
+ layoutAll: () => import_canvas22.layoutAll,
202
+ layoutBounds: () => import_canvas21.layoutBounds,
203
+ layoutFrame: () => import_canvas22.layoutFrame,
204
+ layoutUp: () => import_canvas22.layoutUp,
205
+ layoutUpMany: () => import_canvas22.layoutUpMany,
206
+ linearPositionTrajectory: () => import_canvas21.linearPositionTrajectory,
207
+ linearTrajectory: () => import_canvas21.linearTrajectory,
208
+ listCanvasComponents: () => import_canvas25.listCanvasComponents,
209
+ lockNodes: () => import_canvas18.lockNodes,
210
+ makeSizingCoherent: () => import_canvas22.makeSizingCoherent,
211
+ matchArrangeShortcut: () => import_canvas18.matchArrangeShortcut,
212
+ matchSize: () => import_canvas18.matchSize,
213
+ measureBetween: () => import_canvas17.measureBetween,
214
+ measureLabel: () => import_canvas17.measureLabel,
215
+ measureSelection: () => import_canvas17.measureSelection,
216
+ measureToLine: () => import_canvas17.measureToLine,
217
+ mergeNodeUpdates: () => import_canvas22.mergeNodeUpdates,
218
+ mixColorsOklab: () => import_canvas24.mixColorsOklab,
219
+ moveKeyframes: () => import_canvas24.moveKeyframes,
220
+ moveLayoutChild: () => import_canvas22.moveLayoutChild,
221
+ multiPolygonArea: () => import_canvas19.multiPolygonArea,
222
+ multiPolygonBounds: () => import_canvas19.multiPolygonBounds,
223
+ nearestHandlePositions: () => import_canvas18.nearestHandlePositions,
224
+ normalizeBezierPath: () => import_canvas20.normalizeBezierPath,
225
+ normalizeKeyframes: () => import_canvas24.normalizeKeyframes,
226
+ offsetPath: () => import_canvas20.offsetPath,
227
+ offsetShapeNodes: () => import_canvas20.offsetShapeNodes,
228
+ oklabToRgb: () => import_canvas24.oklabToRgb,
229
+ oppositePosition: () => import_canvas18.oppositePosition,
230
+ outlineShapeNodeStrokes: () => import_canvas20.outlineShapeNodeStrokes,
231
+ outlineStroke: () => import_canvas20.outlineStroke,
232
+ overlaps: () => import_canvas21.overlaps,
233
+ parseCanvasClipboardData: () => import_canvas21.parseCanvasClipboardData,
234
+ parseCanvasScenes: () => import_canvas18.parseCanvasScenes,
235
+ parseCssEasing: () => import_canvas24.parseCssEasing,
236
+ parseKeyframeClipboard: () => import_canvas24.parseKeyframeClipboard,
237
+ parseOklab: () => import_canvas24.parseOklab,
238
+ parseSvgPath: () => import_canvas19.parseSvgPath,
239
+ pasteKeyframes: () => import_canvas24.pasteKeyframes,
240
+ pathBoolean: () => import_canvas20.pathBoolean,
241
+ placeBeside: () => import_canvas21.placeBeside,
242
+ playWebAnimations: () => import_canvas24.playWebAnimations,
243
+ pointInBezierPath: () => import_canvas20.pointInBezierPath,
244
+ pointInMultiPolygon: () => import_canvas19.pointInMultiPolygon,
245
+ pointInRings: () => import_canvas19.pointInRings,
246
+ polygonArea: () => import_canvas19.polygonArea,
247
+ polygonBoolean: () => import_canvas19.polygonBoolean,
248
+ polygonToSvgPath: () => import_canvas19.polygonToSvgPath,
249
+ positionToSide: () => import_canvas18.positionToSide,
250
+ pruneCanvasTokenModes: () => import_canvas23.pruneCanvasTokenModes,
251
+ pushCanvasInstanceOverrides: () => import_canvas25.pushCanvasInstanceOverrides,
252
+ readAnimatableValue: () => import_canvas24.readAnimatableValue,
253
+ readNodeStyleProperty: () => import_canvas23.readNodeStyleProperty,
254
+ readStyleSize: () => import_canvas18.readStyleSize,
255
+ realClock: () => import_canvas21.realClock,
256
+ recordAnimationChanges: () => import_canvas24.recordAnimationChanges,
257
+ relayoutUpdates: () => import_canvas22.relayoutUpdates,
258
+ remapPastedNodes: () => import_canvas21.remapPastedNodes,
259
+ removeTrack: () => import_canvas24.removeTrack,
260
+ reorderNodes: () => import_canvas18.reorderNodes,
261
+ repositionNodesTo: () => import_canvas21.repositionNodesTo,
262
+ resetCanvasInstanceOverrides: () => import_canvas25.resetCanvasInstanceOverrides,
263
+ resizeHandleAxes: () => import_canvas17.resizeHandleAxes,
264
+ resolveCanvasTokens: () => import_canvas23.resolveCanvasTokens,
265
+ resolveEasing: () => import_canvas24.resolveEasing,
266
+ resolvePadding: () => import_canvas22.resolvePadding,
267
+ restoreCanvasMainComponent: () => import_canvas25.restoreCanvasMainComponent,
268
+ revertShapeCombination: () => import_canvas19.revertShapeCombination,
269
+ rgbToOklab: () => import_canvas24.rgbToOklab,
270
+ ringSignedArea: () => import_canvas19.ringSignedArea,
271
+ runMultiNodeTransition: () => import_canvas21.runMultiNodeTransition,
272
+ sampleAnimationFrames: () => import_canvas24.sampleAnimationFrames,
273
+ scaleKeyframes: () => import_canvas24.scaleKeyframes,
274
+ serializeCanvasNodes: () => import_canvas21.serializeCanvasNodes,
275
+ setCanvasComponentProperty: () => import_canvas25.setCanvasComponentProperty,
276
+ setCanvasInstanceProperties: () => import_canvas25.setCanvasInstanceProperties,
277
+ setCanvasTokenMode: () => import_canvas23.setCanvasTokenMode,
278
+ setKeyframe: () => import_canvas24.setKeyframe,
279
+ setKeyframeEasing: () => import_canvas24.setKeyframeEasing,
280
+ setMotionPath: () => import_canvas24.setMotionPath,
281
+ setTrackEnabled: () => import_canvas24.setTrackEnabled,
282
+ shapeNodeToBezierPath: () => import_canvas20.shapeNodeToBezierPath,
283
+ shapeNodeToPolygon: () => import_canvas19.shapeNodeToPolygon,
284
+ shapeToBezierPath: () => import_canvas20.shapeToBezierPath,
285
+ shapeToPolygon: () => import_canvas19.shapeToPolygon,
286
+ sideToPosition: () => import_canvas18.sideToPosition,
287
+ simplifyRing: () => import_canvas19.simplifyRing,
288
+ snapKeyframeDelta: () => import_canvas24.snapKeyframeDelta,
289
+ snapNodeDrag: () => import_canvas18.snapNodeDrag,
290
+ snapNodeResize: () => import_canvas17.snapNodeResize,
291
+ snapResize: () => import_canvas17.snapResize,
292
+ snapTimeToFrame: () => import_canvas24.snapTimeToFrame,
293
+ snapToGrid: () => import_canvas17.snapToGrid,
294
+ springAt: () => import_canvas24.springAt,
295
+ strokeOutlineRings: () => import_canvas20.strokeOutlineRings,
296
+ subtractPaths: () => import_canvas20.subtractPaths,
297
+ subtractPolygons: () => import_canvas19.subtractPolygons,
298
+ swapCanvasInstance: () => import_canvas25.swapCanvasInstance,
299
+ syncAllCanvasInstances: () => import_canvas25.syncAllCanvasInstances,
300
+ syncCanvasComponents: () => import_canvas25.syncCanvasComponents,
301
+ syncCanvasInstance: () => import_canvas25.syncCanvasInstance,
302
+ timeToX: () => import_canvas24.timeToX,
303
+ toBezierPath: () => import_canvas20.toBezierPath,
304
+ toWebAnimations: () => import_canvas24.toWebAnimations,
305
+ toggleLockNodes: () => import_canvas18.toggleLockNodes,
306
+ transformBezierPath: () => import_canvas20.transformBezierPath,
307
+ unionPolygons: () => import_canvas19.unionPolygons,
308
+ unitePaths: () => import_canvas20.unitePaths,
309
+ unlockNodes: () => import_canvas18.unlockNodes,
310
+ updateKeyframe: () => import_canvas24.updateKeyframe,
311
+ useCanvasAnimation: () => useCanvasAnimation,
162
312
  useCanvasArrange: () => useCanvasArrange,
163
313
  useCanvasArrangeShortcuts: () => useCanvasArrangeShortcuts,
164
314
  useCanvasAutoLayout: () => useCanvasAutoLayout,
165
315
  useCanvasClipboard: () => useCanvasClipboard,
316
+ useCanvasComponents: () => useCanvasComponents,
166
317
  useCanvasDocking: () => useCanvasDocking,
167
318
  useCanvasExplosion: () => useCanvasExplosion,
168
319
  useCanvasGraph: () => useCanvasGraph,
@@ -170,9 +321,15 @@ __export(canvas_exports, {
170
321
  useCanvasMeasure: () => useCanvasMeasure,
171
322
  useCanvasScenes: () => useCanvasScenes,
172
323
  useCanvasShortcuts: () => useCanvasShortcuts,
324
+ useCanvasTokens: () => useCanvasTokens,
173
325
  useStreamingCanvas: () => useStreamingCanvas,
174
- withStyleSize: () => import_canvas12.withStyleSize,
175
- xorPolygons: () => import_canvas13.xorPolygons
326
+ withNodeAnimation: () => import_canvas24.withNodeAnimation,
327
+ withStyleSize: () => import_canvas18.withStyleSize,
328
+ wouldCreateComponentCycle: () => import_canvas25.wouldCreateComponentCycle,
329
+ wrapAnimationTime: () => import_canvas24.wrapAnimationTime,
330
+ writeNodeStyleProperty: () => import_canvas23.writeNodeStyleProperty,
331
+ xToTime: () => import_canvas24.xToTime,
332
+ xorPolygons: () => import_canvas19.xorPolygons
176
333
  });
177
334
  module.exports = __toCommonJS(canvas_exports);
178
335
 
@@ -1185,8 +1342,8 @@ function useCanvasMeasure(options) {
1185
1342
  }
1186
1343
 
1187
1344
  // src/canvas/index.ts
1188
- var import_canvas11 = require("@pixerate/editor/canvas");
1189
- var import_canvas12 = require("@pixerate/editor/canvas");
1345
+ var import_canvas17 = require("@pixerate/editor/canvas");
1346
+ var import_canvas18 = require("@pixerate/editor/canvas");
1190
1347
 
1191
1348
  // src/canvas/ShapeNode.tsx
1192
1349
  var import_canvas9 = require("@pixerate/editor/canvas");
@@ -1234,9 +1391,10 @@ function ShapeNode({ data, width, height, selected, className = "", children })
1234
1391
  }
1235
1392
 
1236
1393
  // src/canvas/index.ts
1237
- var import_canvas13 = require("@pixerate/editor/canvas");
1238
- var import_canvas14 = require("@pixerate/editor/canvas");
1239
- var import_canvas15 = require("@pixerate/editor/canvas");
1394
+ var import_canvas19 = require("@pixerate/editor/canvas");
1395
+ var import_canvas20 = require("@pixerate/editor/canvas");
1396
+ var import_canvas21 = require("@pixerate/editor/canvas");
1397
+ var import_canvas22 = require("@pixerate/editor/canvas");
1240
1398
 
1241
1399
  // src/canvas/useCanvasAutoLayout.ts
1242
1400
  var import_react11 = require("react");
@@ -1288,15 +1446,666 @@ function useCanvasAutoLayout(options) {
1288
1446
  [controller, guides]
1289
1447
  );
1290
1448
  }
1449
+
1450
+ // src/canvas/useCanvasTokens.ts
1451
+ var import_react12 = require("react");
1452
+ var import_canvas11 = require("@pixerate/editor/canvas");
1453
+ function useCanvasTokens(options) {
1454
+ const { store, nodes, setNodes, modes, properties } = options;
1455
+ const state = (0, import_react12.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
1456
+ const latest = (0, import_react12.useRef)({ nodes, setNodes, modes, properties });
1457
+ latest.current = { nodes, setNodes, modes, properties };
1458
+ const opts = () => ({ modes: latest.current.modes, properties: latest.current.properties });
1459
+ (0, import_react12.useEffect)(
1460
+ () => store.subscribe((event) => {
1461
+ if (event.deletedVariableIds.length === 0) return;
1462
+ latest.current.setNodes((prev) => (0, import_canvas11.detachTokenBindings)(prev, event.previous, event.deletedVariableIds, opts()));
1463
+ }),
1464
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1465
+ [store]
1466
+ );
1467
+ const modesKey = JSON.stringify(modes ?? {});
1468
+ (0, import_react12.useEffect)(() => {
1469
+ const next = (0, import_canvas11.resolveCanvasTokens)(nodes, state, opts());
1470
+ if (next !== nodes) setNodes(next);
1471
+ }, [nodes, state, modesKey, properties]);
1472
+ const bind = (0, import_react12.useCallback)(
1473
+ (ids, propertyKey, variableId) => {
1474
+ const next = (0, import_canvas11.bindCanvasToken)(latest.current.nodes, ids, propertyKey, variableId, store.getState(), opts());
1475
+ if (next !== latest.current.nodes) latest.current.setNodes(next);
1476
+ },
1477
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1478
+ [store]
1479
+ );
1480
+ const setMode = (0, import_react12.useCallback)(
1481
+ (ids, collectionId, modeId) => {
1482
+ const next = (0, import_canvas11.setCanvasTokenMode)(latest.current.nodes, ids, collectionId, modeId, store.getState(), opts());
1483
+ if (next !== latest.current.nodes) latest.current.setNodes(next);
1484
+ },
1485
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1486
+ [store]
1487
+ );
1488
+ const modesOf = (0, import_react12.useCallback)(
1489
+ (nodeId) => {
1490
+ const node = latest.current.nodes.find((n) => n.id === nodeId);
1491
+ return node ? (0, import_canvas11.getEffectiveTokenModes)(node, latest.current.nodes, store.getState(), opts()) : {};
1492
+ },
1493
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1494
+ [store]
1495
+ );
1496
+ return { state, bind, setMode, modesOf };
1497
+ }
1498
+
1499
+ // src/canvas/TokenBindingPicker.tsx
1500
+ var import_canvas12 = require("@pixerate/editor/canvas");
1501
+ var import_tokens = require("@pixerate/editor/tokens");
1502
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1503
+ function TokenBindingPicker({
1504
+ state,
1505
+ nodes,
1506
+ selectedIds,
1507
+ onChange,
1508
+ options = {},
1509
+ properties,
1510
+ onError,
1511
+ className = ""
1512
+ }) {
1513
+ const selected = nodes.filter((n) => selectedIds.includes(n.id));
1514
+ const first = selected[0];
1515
+ if (!first) return null;
1516
+ let rows = (0, import_canvas12.getBindableTokenProperties)(first, options);
1517
+ if (properties) rows = properties.map((key) => rows.find((p) => p.key === key)).filter((p) => !!p);
1518
+ const modes = (0, import_canvas12.getEffectiveTokenModes)(first, nodes, state, options);
1519
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-token-binding-picker": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
1520
+ rows.map((property) => {
1521
+ const ids = new Set(selected.map((n) => (0, import_canvas12.getNodeTokenBindings)(n)[property.key] ?? ""));
1522
+ const value = ids.size === 1 ? [...ids][0] : "__mixed";
1523
+ const candidates = (0, import_canvas12.getTokensForProperty)(state, property, first);
1524
+ const resolved = value && value !== "__mixed" ? (0, import_tokens.resolveToken)(state, value, modes) : null;
1525
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-2", "data-token-property": property.key, children: [
1526
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "w-28 shrink-0 text-muted-foreground", children: property.label }),
1527
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1528
+ "select",
1529
+ {
1530
+ "aria-label": `${property.label} variable`,
1531
+ className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
1532
+ value,
1533
+ onChange: (e) => {
1534
+ const id = e.currentTarget.value || null;
1535
+ try {
1536
+ onChange((0, import_canvas12.bindCanvasToken)(nodes, selectedIds, property.key, id, state, options));
1537
+ } catch (error) {
1538
+ onError?.(error);
1539
+ }
1540
+ },
1541
+ children: [
1542
+ value === "__mixed" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "__mixed", children: "Mixed" }) : null,
1543
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: "None" }),
1544
+ candidates.map((v) => {
1545
+ const collection = state.collections.find((c) => c.id === v.collectionId);
1546
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("option", { value: v.id, children: [
1547
+ v.name,
1548
+ collection && state.collections.length > 1 ? ` (${collection.name})` : ""
1549
+ ] }, v.id);
1550
+ })
1551
+ ]
1552
+ }
1553
+ ),
1554
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "w-16 shrink-0 truncate text-right text-muted-foreground", "data-token-resolved": "", children: resolved?.ok ? property.type === "color" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1555
+ "span",
1556
+ {
1557
+ className: "inline-block h-3 w-3 rounded border border-border align-middle",
1558
+ style: { background: String(resolved.value) },
1559
+ title: String(resolved.value)
1560
+ }
1561
+ ) : String(resolved.value) : resolved ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { title: resolved.message, children: "\u26A0" }) : null })
1562
+ ] }, property.key);
1563
+ }),
1564
+ state.collections.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-muted-foreground", children: "No variables yet." }) : null
1565
+ ] });
1566
+ }
1567
+ function TokenModeSwitcher({
1568
+ state,
1569
+ nodes,
1570
+ nodeIds,
1571
+ onChange,
1572
+ options = {},
1573
+ showSingleMode = false,
1574
+ className = ""
1575
+ }) {
1576
+ const first = nodes.find((n) => nodeIds.includes(n.id));
1577
+ if (!first) return null;
1578
+ const own = (0, import_canvas12.getNodeTokenModes)(first);
1579
+ const parent = first.parentId ? nodes.find((n) => n.id === first.parentId) : void 0;
1580
+ const inherited = parent ? (0, import_canvas12.getEffectiveTokenModes)(parent, nodes, state, options) : { ...options.modes };
1581
+ const collections = state.collections.filter((c) => showSingleMode || c.modes.length > 1);
1582
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-token-mode-switcher": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: collections.map((collection) => {
1583
+ const auto = (0, import_tokens.getCurrentMode)(collection, inherited);
1584
+ const explicit = collection.modes.some((m) => m.id === own[collection.id]) ? own[collection.id] : "";
1585
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-2", "data-token-collection": collection.id, children: [
1586
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "w-28 shrink-0 truncate text-muted-foreground", children: collection.name }),
1587
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1588
+ "select",
1589
+ {
1590
+ "aria-label": `${collection.name} mode`,
1591
+ className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
1592
+ value: explicit,
1593
+ onChange: (e) => onChange((0, import_canvas12.setCanvasTokenMode)(nodes, nodeIds, collection.id, e.currentTarget.value || null, state, options)),
1594
+ children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("option", { value: "", children: [
1596
+ "Auto (",
1597
+ auto.name,
1598
+ ")"
1599
+ ] }),
1600
+ collection.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: m.id, children: m.name }, m.id))
1601
+ ]
1602
+ }
1603
+ )
1604
+ ] }, collection.id);
1605
+ }) });
1606
+ }
1607
+
1608
+ // src/canvas/index.ts
1609
+ var import_canvas23 = require("@pixerate/editor/canvas");
1610
+
1611
+ // src/canvas/useCanvasAnimation.ts
1612
+ var import_react13 = require("react");
1613
+ var import_canvas13 = require("@pixerate/editor/canvas");
1614
+ function useCanvasAnimation(options) {
1615
+ const nodesRef = (0, import_react13.useRef)(options.nodes);
1616
+ nodesRef.current = options.nodes;
1617
+ const optionsRef = (0, import_react13.useRef)(options);
1618
+ optionsRef.current = options;
1619
+ const controller = (0, import_react13.useMemo)(
1620
+ () => (0, import_canvas13.createCanvasAnimationController)({
1621
+ getNodes: () => nodesRef.current,
1622
+ setNodes: (next) => {
1623
+ nodesRef.current = next;
1624
+ optionsRef.current.setNodes(next);
1625
+ },
1626
+ get history() {
1627
+ return optionsRef.current.history;
1628
+ },
1629
+ get getSelectedIds() {
1630
+ return optionsRef.current.getSelectedIds;
1631
+ },
1632
+ get properties() {
1633
+ return optionsRef.current.properties;
1634
+ },
1635
+ clock: options.clock,
1636
+ duration: options.duration,
1637
+ minDuration: options.minDuration,
1638
+ loop: options.loop,
1639
+ playbackRate: options.playbackRate,
1640
+ fps: options.fps,
1641
+ recording: options.recording,
1642
+ onTime: (time) => optionsRef.current.onTime?.(time)
1643
+ }),
1644
+ []
1645
+ );
1646
+ (0, import_react13.useEffect)(() => () => controller.destroy(), [controller]);
1647
+ (0, import_react13.useEffect)(() => {
1648
+ if (options.loop !== void 0) controller.setLoop(options.loop);
1649
+ }, [controller, options.loop]);
1650
+ (0, import_react13.useEffect)(() => {
1651
+ if (options.playbackRate !== void 0) controller.setPlaybackRate(options.playbackRate);
1652
+ }, [controller, options.playbackRate]);
1653
+ (0, import_react13.useEffect)(() => {
1654
+ if (options.recording !== void 0) controller.setRecording(options.recording);
1655
+ }, [controller, options.recording]);
1656
+ const state = (0, import_react13.useSyncExternalStore)(
1657
+ (listener) => controller.subscribe(listener),
1658
+ () => controller.getState(),
1659
+ () => controller.getState()
1660
+ );
1661
+ (0, import_react13.useEffect)(() => {
1662
+ controller.refresh();
1663
+ }, [controller, options.nodes]);
1664
+ const displayNodes = (0, import_react13.useMemo)(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
1665
+ return (0, import_react13.useMemo)(
1666
+ () => ({
1667
+ ...controller,
1668
+ state,
1669
+ time: state.time,
1670
+ playing: state.playing,
1671
+ recording: state.recording,
1672
+ duration: state.duration,
1673
+ selection: state.selection,
1674
+ drag: state.drag,
1675
+ /** The nodes evaluated at the playhead; render these. */
1676
+ displayNodes,
1677
+ get clipboard() {
1678
+ return controller.clipboard;
1679
+ }
1680
+ }),
1681
+ [controller, state, displayNodes]
1682
+ );
1683
+ }
1684
+
1685
+ // src/canvas/AnimationTimeline.tsx
1686
+ var import_react14 = require("react");
1687
+ var import_canvas14 = require("@pixerate/editor/canvas");
1688
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1689
+ var LOOP_LABELS = { none: "Once", loop: "Loop", "ping-pong": "Ping-pong" };
1690
+ var easingValue = (easing) => typeof easing === "string" ? easing : easing ? "custom" : "linear";
1691
+ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8, labelOf, className = "" }) {
1692
+ const { state } = animation;
1693
+ const duration = state.duration;
1694
+ const rows = animation.timelineRows(nodeIds ?? void 0, labelOf ? { labelOf } : {});
1695
+ const ticks = (0, import_canvas14.getTimelineTicks)(duration, width);
1696
+ const selectedEasing = (() => {
1697
+ const first = state.selection[0];
1698
+ if (!first) return "";
1699
+ for (const row of rows) for (const k of row.keyframes) if (k.selected && k.ref.property === first.property && k.ref.nodeId === first.nodeId) return easingValue(k.easing);
1700
+ return "";
1701
+ })();
1702
+ const dragRef = (0, import_react14.useRef)(null);
1703
+ (0, import_react14.useEffect)(() => {
1704
+ const onKey = (event) => {
1705
+ if (event.key === "Escape" && dragRef.current) {
1706
+ dragRef.current = null;
1707
+ animation.cancelKeyframeDrag();
1708
+ }
1709
+ };
1710
+ window.addEventListener("keydown", onKey);
1711
+ return () => window.removeEventListener("keydown", onKey);
1712
+ }, [animation]);
1713
+ const onRulerDown = (event) => {
1714
+ const lane = event.currentTarget;
1715
+ const left = lane.getBoundingClientRect().left;
1716
+ animation.scrub((0, import_canvas14.xToTime)(event.clientX - left, duration, width));
1717
+ const move = (e) => animation.scrub((0, import_canvas14.xToTime)(e.clientX - left, duration, width));
1718
+ const up = () => {
1719
+ window.removeEventListener("pointermove", move);
1720
+ window.removeEventListener("pointerup", up);
1721
+ animation.endScrub();
1722
+ };
1723
+ window.addEventListener("pointermove", move);
1724
+ window.addEventListener("pointerup", up);
1725
+ };
1726
+ const onKeyDown = (ref) => (event) => {
1727
+ event.stopPropagation();
1728
+ event.preventDefault();
1729
+ if (event.shiftKey || event.metaKey || event.ctrlKey) {
1730
+ animation.selectKeyframes([ref], "toggle");
1731
+ return;
1732
+ }
1733
+ animation.beginKeyframeDrag([ref]);
1734
+ dragRef.current = { startX: event.clientX };
1735
+ const msPerPx = width > 0 ? duration / width : 0;
1736
+ const move = (e) => {
1737
+ if (!dragRef.current) return;
1738
+ animation.updateKeyframeDrag((e.clientX - dragRef.current.startX) * msPerPx, { snap: !e.altKey, thresholdMs: snapThreshold * msPerPx });
1739
+ };
1740
+ const up = () => {
1741
+ window.removeEventListener("pointermove", move);
1742
+ window.removeEventListener("pointerup", up);
1743
+ if (!dragRef.current) return;
1744
+ dragRef.current = null;
1745
+ animation.endKeyframeDrag();
1746
+ };
1747
+ window.addEventListener("pointermove", move);
1748
+ window.addEventListener("pointerup", up);
1749
+ };
1750
+ const onTimelineKey = (event) => {
1751
+ if ((event.key === "Delete" || event.key === "Backspace") && state.selection.length > 0) {
1752
+ event.preventDefault();
1753
+ animation.deleteKeyframes();
1754
+ }
1755
+ };
1756
+ const btn = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-50";
1757
+ const playheadX = (0, import_canvas14.timeToX)(state.time, duration, width);
1758
+ const labelWidth = 120;
1759
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-animation-timeline": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, tabIndex: 0, onKeyDown: onTimelineKey, children: [
1760
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "toolbar", "aria-label": "Animation", children: [
1761
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn, "data-action": "toggle-play", "aria-label": state.playing ? "Pause" : "Play", onClick: () => animation.toggle(), children: state.playing ? "\u275A\u275A" : "\u25B6" }),
1762
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1763
+ "button",
1764
+ {
1765
+ type: "button",
1766
+ className: `${btn} ${state.recording ? "text-red-500" : ""}`,
1767
+ "data-action": "record",
1768
+ "aria-pressed": state.recording,
1769
+ "aria-label": "Record keyframes",
1770
+ onClick: () => animation.toggleRecording(),
1771
+ children: "\u25CF Rec"
1772
+ }
1773
+ ),
1774
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn, "data-action": "add-keyframe", onClick: () => animation.addKeyframe(), children: "\u25C6 Key" }),
1775
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { "data-time": "", className: "tabular-nums text-muted-foreground", children: [
1776
+ (0, import_canvas14.formatAnimationTime)(state.time),
1777
+ " / ",
1778
+ (0, import_canvas14.formatAnimationTime)(duration)
1779
+ ] }),
1780
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1781
+ "select",
1782
+ {
1783
+ "aria-label": "Easing",
1784
+ "data-easing-picker": "",
1785
+ className: "rounded border border-border bg-background px-1 py-0.5",
1786
+ value: selectedEasing,
1787
+ disabled: state.selection.length === 0,
1788
+ onChange: (e) => e.target.value && e.target.value !== "custom" && animation.setEasing(e.target.value),
1789
+ children: [
1790
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "Easing\u2026" }),
1791
+ import_canvas14.ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: preset, children: import_canvas14.ANIMATION_EASING_LABELS[preset] }, preset)),
1792
+ selectedEasing === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "custom", children: "Custom" }) : null
1793
+ ]
1794
+ }
1795
+ ),
1796
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1797
+ "select",
1798
+ {
1799
+ "aria-label": "Loop",
1800
+ "data-loop-picker": "",
1801
+ className: "rounded border border-border bg-background px-1 py-0.5",
1802
+ value: state.loop,
1803
+ onChange: (e) => animation.setLoop(e.target.value),
1804
+ children: Object.keys(LOOP_LABELS).map((mode) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: mode, children: LOOP_LABELS[mode] }, mode))
1805
+ }
1806
+ )
1807
+ ] }),
1808
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex", children: [
1809
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { width: labelWidth }, className: "shrink-0" }),
1810
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1811
+ "div",
1812
+ {
1813
+ "data-timeline-ruler": "",
1814
+ className: "relative h-5 cursor-ew-resize border-b border-border",
1815
+ style: { width },
1816
+ onPointerDown: onRulerDown,
1817
+ children: [
1818
+ ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "absolute top-0 -translate-x-1/2 text-[10px] text-muted-foreground", style: { left: tick.x }, children: tick.label }, tick.time)),
1819
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-playhead": "", className: "absolute top-0 h-5 w-px bg-red-500", style: { left: playheadX } })
1820
+ ]
1821
+ }
1822
+ )
1823
+ ] }),
1824
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-muted-foreground", "data-timeline-empty": "", children: "Select an animated node, or press \u25C6 Key to add a keyframe." }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center", "data-track": row.id, children: [
1825
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex shrink-0 items-center gap-1 truncate pr-2", style: { width: labelWidth }, title: `${row.nodeLabel} \xB7 ${row.label}`, children: [
1826
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1827
+ "input",
1828
+ {
1829
+ type: "checkbox",
1830
+ "aria-label": `Enable ${row.label}`,
1831
+ checked: row.enabled,
1832
+ onChange: (e) => animation.setTrackEnabled(row.nodeId, row.property, e.target.checked)
1833
+ }
1834
+ ),
1835
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "truncate", children: [
1836
+ rows.filter((r) => r.nodeId === row.nodeId).length < rows.length ? `${row.nodeLabel} \xB7 ` : "",
1837
+ row.label
1838
+ ] })
1839
+ ] }),
1840
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-lane": "", className: `relative h-5 rounded bg-muted/40 ${row.enabled ? "" : "opacity-50"}`, style: { width }, children: [
1841
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "pointer-events-none absolute top-0 h-5 w-px bg-red-500/60", style: { left: playheadX } }),
1842
+ state.drag?.target != null ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: (0, import_canvas14.timeToX)(state.drag.target, duration, width) } }) : null,
1843
+ row.keyframes.map((k) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1844
+ "button",
1845
+ {
1846
+ type: "button",
1847
+ "data-keyframe": k.ref.time,
1848
+ "aria-pressed": k.selected,
1849
+ "aria-label": `${row.label} keyframe at ${(0, import_canvas14.formatAnimationTime)(k.ref.time)}`,
1850
+ title: `${(0, import_canvas14.formatAnimationTime)(k.time)} \xB7 ${String(k.value)}`,
1851
+ className: `absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rotate-45 border ${k.selected ? "border-sky-300 bg-sky-500" : "border-foreground/60 bg-background"} ${k.easing === "hold" ? "rounded-none" : "rounded-[1px]"}`,
1852
+ style: { left: (0, import_canvas14.timeToX)(k.time, duration, width) },
1853
+ onPointerDown: onKeyDown(k.ref)
1854
+ },
1855
+ k.ref.time
1856
+ ))
1857
+ ] })
1858
+ ] }, row.id))
1859
+ ] });
1860
+ }
1861
+
1862
+ // src/canvas/index.ts
1863
+ var import_canvas24 = require("@pixerate/editor/canvas");
1864
+
1865
+ // src/canvas/useCanvasComponents.ts
1866
+ var import_react15 = require("react");
1867
+ var import_canvas15 = require("@pixerate/editor/canvas");
1868
+ function useCanvasComponents(options) {
1869
+ const nodesRef = (0, import_react15.useRef)(options.nodes);
1870
+ nodesRef.current = options.nodes;
1871
+ const optionsRef = (0, import_react15.useRef)(options);
1872
+ optionsRef.current = options;
1873
+ const controller = (0, import_react15.useMemo)(
1874
+ () => (0, import_canvas15.createCanvasComponentsController)({
1875
+ getNodes: () => nodesRef.current,
1876
+ setNodes: (next) => {
1877
+ nodesRef.current = next;
1878
+ optionsRef.current.setNodes(next);
1879
+ },
1880
+ get history() {
1881
+ return optionsRef.current.history;
1882
+ },
1883
+ get getSelectedIds() {
1884
+ return optionsRef.current.getSelectedIds;
1885
+ },
1886
+ onReveal: (node) => optionsRef.current.onReveal?.(node),
1887
+ get idGenerator() {
1888
+ return optionsRef.current.idGenerator;
1889
+ },
1890
+ get textTypes() {
1891
+ return optionsRef.current.textTypes;
1892
+ },
1893
+ get layout() {
1894
+ return optionsRef.current.layout;
1895
+ },
1896
+ get tokens() {
1897
+ return optionsRef.current.tokens;
1898
+ }
1899
+ }),
1900
+ []
1901
+ );
1902
+ (0, import_react15.useLayoutEffect)(() => {
1903
+ if (optionsRef.current.autoSync !== false) controller.sync();
1904
+ }, [options.nodes, controller]);
1905
+ return controller;
1906
+ }
1907
+
1908
+ // src/canvas/CanvasComponentsPanel.tsx
1909
+ var import_react16 = require("react");
1910
+ var import_canvas16 = require("@pixerate/editor/canvas");
1911
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1912
+ function CanvasComponentsPanel({
1913
+ nodes,
1914
+ onInsert,
1915
+ search = true,
1916
+ className = ""
1917
+ }) {
1918
+ const [query, setQuery] = (0, import_react16.useState)("");
1919
+ const { components, sets } = (0, import_canvas16.listCanvasComponents)(nodes);
1920
+ const q = query.trim().toLowerCase();
1921
+ const match = (name) => !q || name.toLowerCase().includes(q);
1922
+ const lone = components.filter((c) => !c.setId && match(c.name));
1923
+ const shownSets = sets.filter((s) => match(s.name) || s.variants.some((v) => match(v.name)));
1924
+ const item = (id, name, count, extra = {}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1925
+ "button",
1926
+ {
1927
+ type: "button",
1928
+ draggable: true,
1929
+ "data-component-id": id,
1930
+ ...extra,
1931
+ className: "flex w-full items-center justify-between gap-2 rounded px-2 py-1 text-left text-xs hover:bg-muted",
1932
+ title: `Insert an instance of ${name}`,
1933
+ onClick: () => onInsert(id),
1934
+ onDragStart: (e) => {
1935
+ e.dataTransfer.setData(import_canvas16.CANVAS_COMPONENT_DRAG_TYPE, id);
1936
+ e.dataTransfer.setData("text/plain", name);
1937
+ e.dataTransfer.effectAllowed = "copy";
1938
+ },
1939
+ children: [
1940
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "truncate", children: [
1941
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": true, className: "mr-1 text-muted-foreground", children: "\u25C7" }),
1942
+ name
1943
+ ] }),
1944
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[10px] text-muted-foreground", "data-instance-count": "", children: count })
1945
+ ]
1946
+ },
1947
+ id
1948
+ );
1949
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-components-panel": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
1950
+ search ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1951
+ "input",
1952
+ {
1953
+ type: "search",
1954
+ "aria-label": "Search components",
1955
+ placeholder: "Search components",
1956
+ className: "rounded border border-border bg-background px-2 py-1 text-xs",
1957
+ onInput: (e) => setQuery(e.target.value)
1958
+ }
1959
+ ) : null,
1960
+ shownSets.map((set) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-component-set": set.id, className: "flex flex-col", children: [
1961
+ item(set.id, set.name, set.variants.reduce((sum, v) => sum + v.instanceCount, 0), { "data-kind": "set" }),
1962
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ml-3 flex flex-col border-l border-border pl-1", children: set.variants.map((v) => item(v.id, v.name, v.instanceCount, { "data-kind": "variant" })) })
1963
+ ] }, set.id)),
1964
+ lone.map((c) => item(c.id, c.name, c.instanceCount, { "data-kind": "component" })),
1965
+ components.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-muted-foreground", children: "No components yet. Select a frame and choose Create Component." }) : null
1966
+ ] });
1967
+ }
1968
+ function CanvasInstanceInspector({
1969
+ nodes,
1970
+ nodeId,
1971
+ components,
1972
+ onError,
1973
+ className = ""
1974
+ }) {
1975
+ const info = nodeId ? (0, import_canvas16.inspectCanvasInstance)(nodes, nodeId) : void 0;
1976
+ if (!info) return null;
1977
+ const report = (result) => {
1978
+ if (result && !result.ok && result.reason) onError?.(result.reason);
1979
+ };
1980
+ const setProp = (name, value) => report(components.setInstanceProperties({ [name]: value }, [info.id]));
1981
+ const allComponents = (0, import_canvas16.listCanvasComponents)(nodes).components;
1982
+ const linked = info.status === "linked";
1983
+ const btn = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-40";
1984
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-instance-inspector": "", "data-instance-id": info.id, className: `flex flex-col gap-2 text-xs text-foreground ${className}`, children: [
1985
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1986
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate font-medium", "data-instance-main": "", children: linked ? info.componentName : "Main component missing" }),
1987
+ info.nested ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground", children: "Nested" }) : null
1988
+ ] }),
1989
+ info.variantOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2", "data-variant-property": option.name, children: [
1990
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: option.name }),
1991
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1992
+ "select",
1993
+ {
1994
+ "aria-label": `${option.name} variant`,
1995
+ className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
1996
+ value: info.variant[option.name] ?? "",
1997
+ onChange: (e) => setProp(option.name, e.currentTarget.value),
1998
+ children: option.values.map((v) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: v, children: v }, v))
1999
+ }
2000
+ )
2001
+ ] }, option.name)),
2002
+ info.properties.map((p) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2", "data-component-property": p.name, children: [
2003
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: p.name }),
2004
+ p.type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", "aria-label": p.name, checked: p.value === true, onChange: (e) => setProp(p.name, e.currentTarget.checked) }) : p.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2005
+ "input",
2006
+ {
2007
+ type: "text",
2008
+ "aria-label": p.name,
2009
+ defaultValue: String(p.value),
2010
+ className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
2011
+ onBlur: (e) => {
2012
+ if (e.currentTarget.value !== p.value) setProp(p.name, e.currentTarget.value);
2013
+ },
2014
+ onKeyDown: (e) => {
2015
+ if (e.key === "Enter") e.currentTarget.blur();
2016
+ }
2017
+ },
2018
+ String(p.value)
2019
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2020
+ "select",
2021
+ {
2022
+ "aria-label": p.name,
2023
+ className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
2024
+ value: String(p.value),
2025
+ onChange: (e) => setProp(p.name, e.currentTarget.value),
2026
+ children: allComponents.filter((c) => !p.preferred?.length || p.preferred.includes(c.id) || c.id === p.value).map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: c.id, children: c.name }, c.id))
2027
+ }
2028
+ )
2029
+ ] }, p.name)),
2030
+ info.overrides.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-1", "data-instance-overrides": "", children: [
2031
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground", children: "Overrides" }),
2032
+ info.overrides.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-override-layer": o.id, children: [
2033
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-1 truncate", children: o.name }),
2034
+ o.groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
2035
+ "button",
2036
+ {
2037
+ type: "button",
2038
+ className: "rounded bg-muted px-1 text-[10px]",
2039
+ "data-override-group": g,
2040
+ title: `Reset ${g}`,
2041
+ onClick: () => report(components.resetOverrides(o.id, g)),
2042
+ children: [
2043
+ g,
2044
+ " \xD7"
2045
+ ]
2046
+ },
2047
+ g
2048
+ ))
2049
+ ] }, o.id))
2050
+ ] }) : null,
2051
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2052
+ linked ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
2053
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "data-action": "reset", onClick: () => report(components.resetOverrides(info.id)), children: "Reset all" }),
2054
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "data-action": "go-to-main", onClick: () => components.goToMainComponent(info.id), children: "Go to main" }),
2055
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2056
+ "button",
2057
+ {
2058
+ type: "button",
2059
+ className: btn,
2060
+ "data-action": "push",
2061
+ disabled: info.overrides.length === 0,
2062
+ onClick: () => report(components.pushOverrides(info.rootId)),
2063
+ children: "Push changes"
2064
+ }
2065
+ )
2066
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "data-action": "restore", onClick: () => report(components.restoreMainComponent(info.rootId)), children: "Restore main component" }),
2067
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2068
+ "button",
2069
+ {
2070
+ type: "button",
2071
+ className: btn,
2072
+ "data-action": "detach",
2073
+ disabled: info.nested,
2074
+ title: info.nested ? "Detach the outer instance first" : void 0,
2075
+ onClick: () => report(components.detachInstance([info.id])),
2076
+ children: "Detach"
2077
+ }
2078
+ )
2079
+ ] })
2080
+ ] });
2081
+ }
2082
+
2083
+ // src/canvas/index.ts
2084
+ var import_canvas25 = require("@pixerate/editor/canvas");
1291
2085
  // Annotate the CommonJS export names for ESM import in node:
1292
2086
  0 && (module.exports = {
2087
+ ANIMATABLE_PROPERTIES,
2088
+ ANIMATION_DATA_KEY,
2089
+ ANIMATION_EASING_LABELS,
2090
+ ANIMATION_EASING_PRESETS,
2091
+ ANIMATION_TIME_EPSILON,
1293
2092
  AUTO_LAYOUT_DATA_KEY,
1294
2093
  AgentPresenceLayer,
2094
+ AnimationEditError,
2095
+ AnimationPlayer,
2096
+ AnimationTimeline,
2097
+ CANVAS_COMPONENT_DRAG_TYPE,
2098
+ CANVAS_TOKEN_PROPERTIES,
1295
2099
  CHILD_LAYOUT_DATA_KEY,
1296
2100
  CONNECTION_LINE_TYPES,
2101
+ CSS_ANIMATION_PROPERTIES,
2102
+ CUBIC_BEZIER_PRESETS,
2103
+ CanvasComponentsPanel,
1297
2104
  CanvasGuidesLayer,
2105
+ CanvasInstanceInspector,
1298
2106
  CanvasScenesStore,
1299
2107
  DEFAULT_ARRANGE_SHORTCUTS,
2108
+ MAX_KEYFRAME_REFS,
1300
2109
  ManualClock,
1301
2110
  RESIZE_HANDLES,
1302
2111
  SHAPE_DATA_KEY,
@@ -1304,37 +2113,80 @@ function useCanvasAutoLayout(options) {
1304
2113
  SHAPE_NODE_TYPE,
1305
2114
  SHAPE_OPERATIONS,
1306
2115
  ShapeNode,
2116
+ TOKEN_BINDINGS_DATA_KEY,
2117
+ TOKEN_MODES_DATA_KEY,
2118
+ TokenBindingPicker,
2119
+ TokenModeSwitcher,
2120
+ addKeyframesAtTime,
1307
2121
  alignNodes,
2122
+ animateNode,
2123
+ applyAnimation,
2124
+ applyAnimationOverrides,
1308
2125
  applyConstraints,
1309
2126
  applyNodeUpdates,
1310
2127
  applyShapeCombination,
2128
+ applyShapeReplacement,
2129
+ bezierPathArea,
2130
+ bezierPathBounds,
2131
+ bezierPathLength,
2132
+ bezierPathPointAtLength,
2133
+ bezierPathSignedArea,
2134
+ bezierPathToSvg,
2135
+ bindCanvasComponentProperty,
2136
+ bindCanvasToken,
1311
2137
  blendLayout,
1312
2138
  boundsOf,
1313
2139
  calculateDagreReflowDisplacement,
1314
2140
  calculateDirectionalDisplacement,
1315
2141
  canCombineShapeNodes,
2142
+ canOffsetShapeNodes,
2143
+ canOutlineShapeNodeStrokes,
1316
2144
  canvasHeight,
1317
2145
  centerNodes,
1318
2146
  centre,
2147
+ clampAnimationValue,
1319
2148
  clampLayoutSize,
2149
+ combineCanvasComponentsAsVariants,
1320
2150
  combineShapeNodes,
1321
2151
  computeNodesBoundingBox,
1322
2152
  computeSnapGuides,
1323
2153
  connectedOnly,
2154
+ copyKeyframes,
2155
+ countPathSegments,
2156
+ createAnimationPlayer,
1324
2157
  createBezierTrajectory,
2158
+ createCanvasAnimationController,
1325
2159
  createCanvasAutoLayoutController,
2160
+ createCanvasComponent,
2161
+ createCanvasComponentsController,
2162
+ createCanvasInstance,
1326
2163
  createCanvasScenesStore,
1327
2164
  createFanOutTrajectory,
1328
2165
  createGuideIndex,
1329
2166
  createNodeGuideIndex,
2167
+ cubicBezierAt,
1330
2168
  cubicPointAt,
1331
2169
  cubicsToPathData,
2170
+ dashContours,
1332
2171
  defaultEasing,
2172
+ deleteKeyframes,
2173
+ detachCanvasInstance,
2174
+ detachTokenBindings,
2175
+ distanceToBezierPath,
1333
2176
  distributeNodes,
2177
+ dividePaths,
1334
2178
  dividePolygons,
2179
+ easingFromInfluence,
2180
+ easingLabel,
2181
+ easingToCss,
1335
2182
  ensureLayout,
1336
2183
  estimateCanvasHeight,
1337
2184
  estimateNodeSize,
2185
+ evaluateAnimation,
2186
+ evaluateEasing,
2187
+ evaluateTrack,
2188
+ excludePaths,
2189
+ exportCssAnimation,
1338
2190
  findConnectorSnap,
1339
2191
  fitCubicRun,
1340
2192
  fitCubics,
@@ -1344,30 +2196,67 @@ function useCanvasAutoLayout(options) {
1344
2196
  fitViewportToRect,
1345
2197
  flattenSvgPath,
1346
2198
  flowSide,
2199
+ formatAnimationTime,
2200
+ formatOklab,
1347
2201
  getAbsolutePosition,
2202
+ getAnimatableProperty,
2203
+ getAnimatedProperties,
2204
+ getAnimatedValue,
2205
+ getAnimationDuration,
2206
+ getAnimationTrack,
1348
2207
  getAutoLayout,
1349
2208
  getAutoLayoutGrid,
1350
2209
  getAutoLayoutInsertTarget,
2210
+ getBindableTokenProperties,
2211
+ getCanvasComponentDragId,
2212
+ getCanvasTokenProperty,
1351
2213
  getCenteredNodePosition,
1352
2214
  getChildLayout,
2215
+ getComponentSourceId,
2216
+ getCssPropertyAnimations,
2217
+ getEffectiveTokenModes,
1353
2218
  getFlowChildren,
2219
+ getInstanceData,
2220
+ getInstanceStatus,
2221
+ getKeyframeTimes,
1354
2222
  getLayoutParent,
1355
2223
  getLayoutSizing,
1356
2224
  getLayoutedNodes,
2225
+ getNodeAnimation,
2226
+ getNodeOverrides,
1357
2227
  getNodeRect,
1358
2228
  getNodeShape,
1359
2229
  getNodeSize,
2230
+ getNodeTokenBindings,
2231
+ getNodeTokenModes,
1360
2232
  getResizingNodeRect,
1361
2233
  getShapeRenderData,
1362
2234
  getShapeSvg,
2235
+ getTimelineRows,
2236
+ getTimelineTicks,
2237
+ getTokenPropertyScope,
2238
+ getTokensForProperty,
1363
2239
  handlePoint,
2240
+ hasVisibleStroke,
1364
2241
  inferResizeHandle,
2242
+ inspectCanvasInstance,
2243
+ inspectNodeTokens,
2244
+ interpolateAnimationValue,
2245
+ intersectPaths,
1365
2246
  intersectPolygons,
1366
2247
  invertNodeUpdates,
2248
+ isAnimationEasing,
2249
+ isAnimationKeyframe,
1367
2250
  isAutoLayoutFrame,
2251
+ isCanvasComponent,
2252
+ isCanvasComponentSet,
2253
+ isCanvasInstance,
2254
+ isCssExportExact,
1368
2255
  isEventFromTextInput,
2256
+ isKeyframeSelected,
1369
2257
  isLocked,
1370
2258
  isMeasureModifierHeld,
2259
+ isNodeAnimated,
1371
2260
  isShapeDescription,
1372
2261
  isShapeNode,
1373
2262
  isStraightCubic,
@@ -1380,6 +2269,7 @@ function useCanvasAutoLayout(options) {
1380
2269
  layoutUpMany,
1381
2270
  linearPositionTrajectory,
1382
2271
  linearTrajectory,
2272
+ listCanvasComponents,
1383
2273
  lockNodes,
1384
2274
  makeSizingCoherent,
1385
2275
  matchArrangeShortcut,
@@ -1389,50 +2279,105 @@ function useCanvasAutoLayout(options) {
1389
2279
  measureSelection,
1390
2280
  measureToLine,
1391
2281
  mergeNodeUpdates,
2282
+ mixColorsOklab,
2283
+ moveKeyframes,
1392
2284
  moveLayoutChild,
1393
2285
  multiPolygonArea,
1394
2286
  multiPolygonBounds,
1395
2287
  nearestHandlePositions,
2288
+ normalizeBezierPath,
2289
+ normalizeKeyframes,
2290
+ offsetPath,
2291
+ offsetShapeNodes,
2292
+ oklabToRgb,
1396
2293
  oppositePosition,
2294
+ outlineShapeNodeStrokes,
2295
+ outlineStroke,
1397
2296
  overlaps,
1398
2297
  parseCanvasClipboardData,
1399
2298
  parseCanvasScenes,
2299
+ parseCssEasing,
2300
+ parseKeyframeClipboard,
2301
+ parseOklab,
1400
2302
  parseSvgPath,
2303
+ pasteKeyframes,
2304
+ pathBoolean,
1401
2305
  placeBeside,
2306
+ playWebAnimations,
2307
+ pointInBezierPath,
1402
2308
  pointInMultiPolygon,
1403
2309
  pointInRings,
1404
2310
  polygonArea,
1405
2311
  polygonBoolean,
1406
2312
  polygonToSvgPath,
1407
2313
  positionToSide,
2314
+ pruneCanvasTokenModes,
2315
+ pushCanvasInstanceOverrides,
2316
+ readAnimatableValue,
2317
+ readNodeStyleProperty,
1408
2318
  readStyleSize,
1409
2319
  realClock,
2320
+ recordAnimationChanges,
1410
2321
  relayoutUpdates,
1411
2322
  remapPastedNodes,
2323
+ removeTrack,
1412
2324
  reorderNodes,
1413
2325
  repositionNodesTo,
2326
+ resetCanvasInstanceOverrides,
1414
2327
  resizeHandleAxes,
2328
+ resolveCanvasTokens,
2329
+ resolveEasing,
1415
2330
  resolvePadding,
2331
+ restoreCanvasMainComponent,
1416
2332
  revertShapeCombination,
2333
+ rgbToOklab,
1417
2334
  ringSignedArea,
1418
2335
  runMultiNodeTransition,
2336
+ sampleAnimationFrames,
2337
+ scaleKeyframes,
1419
2338
  serializeCanvasNodes,
2339
+ setCanvasComponentProperty,
2340
+ setCanvasInstanceProperties,
2341
+ setCanvasTokenMode,
2342
+ setKeyframe,
2343
+ setKeyframeEasing,
2344
+ setMotionPath,
2345
+ setTrackEnabled,
2346
+ shapeNodeToBezierPath,
1420
2347
  shapeNodeToPolygon,
2348
+ shapeToBezierPath,
1421
2349
  shapeToPolygon,
1422
2350
  sideToPosition,
1423
2351
  simplifyRing,
2352
+ snapKeyframeDelta,
1424
2353
  snapNodeDrag,
1425
2354
  snapNodeResize,
1426
2355
  snapResize,
2356
+ snapTimeToFrame,
1427
2357
  snapToGrid,
2358
+ springAt,
2359
+ strokeOutlineRings,
2360
+ subtractPaths,
1428
2361
  subtractPolygons,
2362
+ swapCanvasInstance,
2363
+ syncAllCanvasInstances,
2364
+ syncCanvasComponents,
2365
+ syncCanvasInstance,
2366
+ timeToX,
2367
+ toBezierPath,
2368
+ toWebAnimations,
1429
2369
  toggleLockNodes,
2370
+ transformBezierPath,
1430
2371
  unionPolygons,
2372
+ unitePaths,
1431
2373
  unlockNodes,
2374
+ updateKeyframe,
2375
+ useCanvasAnimation,
1432
2376
  useCanvasArrange,
1433
2377
  useCanvasArrangeShortcuts,
1434
2378
  useCanvasAutoLayout,
1435
2379
  useCanvasClipboard,
2380
+ useCanvasComponents,
1436
2381
  useCanvasDocking,
1437
2382
  useCanvasExplosion,
1438
2383
  useCanvasGraph,
@@ -1440,8 +2385,14 @@ function useCanvasAutoLayout(options) {
1440
2385
  useCanvasMeasure,
1441
2386
  useCanvasScenes,
1442
2387
  useCanvasShortcuts,
2388
+ useCanvasTokens,
1443
2389
  useStreamingCanvas,
2390
+ withNodeAnimation,
1444
2391
  withStyleSize,
2392
+ wouldCreateComponentCycle,
2393
+ wrapAnimationTime,
2394
+ writeNodeStyleProperty,
2395
+ xToTime,
1445
2396
  xorPolygons
1446
2397
  });
1447
2398
  //# sourceMappingURL=index.cjs.map