@pixerate/editor-react 0.107.0 → 0.109.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.
@@ -31,23 +31,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/canvas/index.ts
32
32
  var canvas_exports = {};
33
33
  __export(canvas_exports, {
34
- ANIMATABLE_PROPERTIES: () => import_canvas35.ANIMATABLE_PROPERTIES,
35
- ANIMATION_DATA_KEY: () => import_canvas35.ANIMATION_DATA_KEY,
36
- ANIMATION_EASING_LABELS: () => import_canvas35.ANIMATION_EASING_LABELS,
37
- ANIMATION_EASING_PRESETS: () => import_canvas35.ANIMATION_EASING_PRESETS,
38
- ANIMATION_TIME_EPSILON: () => import_canvas35.ANIMATION_TIME_EPSILON,
39
- AUTO_LAYOUT_DATA_KEY: () => import_canvas33.AUTO_LAYOUT_DATA_KEY,
34
+ ANIMATABLE_PROPERTIES: () => import_canvas37.ANIMATABLE_PROPERTIES,
35
+ ANIMATION_DATA_KEY: () => import_canvas37.ANIMATION_DATA_KEY,
36
+ ANIMATION_EASING_LABELS: () => import_canvas37.ANIMATION_EASING_LABELS,
37
+ ANIMATION_EASING_PRESETS: () => import_canvas37.ANIMATION_EASING_PRESETS,
38
+ ANIMATION_TIME_EPSILON: () => import_canvas37.ANIMATION_TIME_EPSILON,
39
+ AUTO_LAYOUT_DATA_KEY: () => import_canvas35.AUTO_LAYOUT_DATA_KEY,
40
40
  AgentPresenceLayer: () => AgentPresenceLayer,
41
- AnimationEditError: () => import_canvas35.AnimationEditError,
42
- AnimationPlayer: () => import_canvas35.AnimationPlayer,
41
+ AnimationEditError: () => import_canvas37.AnimationEditError,
42
+ AnimationPlayer: () => import_canvas37.AnimationPlayer,
43
43
  AnimationTimeline: () => AnimationTimeline,
44
- CANVAS_COMPONENT_DRAG_TYPE: () => import_canvas36.CANVAS_COMPONENT_DRAG_TYPE,
45
- CANVAS_GRADIENT_PRESETS: () => import_canvas36.CANVAS_GRADIENT_PRESETS,
46
- CANVAS_TOKEN_PROPERTIES: () => import_canvas34.CANVAS_TOKEN_PROPERTIES,
47
- CHILD_LAYOUT_DATA_KEY: () => import_canvas33.CHILD_LAYOUT_DATA_KEY,
48
- CONNECTION_LINE_TYPES: () => import_canvas29.CONNECTION_LINE_TYPES,
49
- CSS_ANIMATION_PROPERTIES: () => import_canvas35.CSS_ANIMATION_PROPERTIES,
50
- CUBIC_BEZIER_PRESETS: () => import_canvas35.CUBIC_BEZIER_PRESETS,
44
+ CANVAS_COMPONENT_DRAG_TYPE: () => import_canvas38.CANVAS_COMPONENT_DRAG_TYPE,
45
+ CANVAS_GRADIENT_PRESETS: () => import_canvas38.CANVAS_GRADIENT_PRESETS,
46
+ CANVAS_TOKEN_PROPERTIES: () => import_canvas36.CANVAS_TOKEN_PROPERTIES,
47
+ CHILD_LAYOUT_DATA_KEY: () => import_canvas35.CHILD_LAYOUT_DATA_KEY,
48
+ CONNECTION_LINE_TYPES: () => import_canvas31.CONNECTION_LINE_TYPES,
49
+ CSS_ANIMATION_PROPERTIES: () => import_canvas37.CSS_ANIMATION_PROPERTIES,
50
+ CUBIC_BEZIER_PRESETS: () => import_canvas37.CUBIC_BEZIER_PRESETS,
51
51
  CanvasComponentsPanel: () => CanvasComponentsPanel,
52
52
  CanvasDrawLayer: () => CanvasDrawLayer,
53
53
  CanvasEffectsPanel: () => CanvasEffectsPanel,
@@ -55,313 +55,320 @@ __export(canvas_exports, {
55
55
  CanvasGuidesLayer: () => CanvasGuidesLayer,
56
56
  CanvasInstanceInspector: () => CanvasInstanceInspector,
57
57
  CanvasNodeEffectLayer: () => CanvasNodeEffectLayer,
58
- CanvasScenesStore: () => import_canvas29.CanvasScenesStore,
59
- DEFAULT_ARRANGE_SHORTCUTS: () => import_canvas29.DEFAULT_ARRANGE_SHORTCUTS,
58
+ CanvasScenesStore: () => import_canvas31.CanvasScenesStore,
59
+ DEFAULT_ARRANGE_SHORTCUTS: () => import_canvas31.DEFAULT_ARRANGE_SHORTCUTS,
60
60
  DiagramPresenceLayer: () => DiagramPresenceLayer,
61
- MAX_KEYFRAME_REFS: () => import_canvas35.MAX_KEYFRAME_REFS,
62
- ManualClock: () => import_canvas32.ManualClock,
61
+ MAX_KEYFRAME_REFS: () => import_canvas37.MAX_KEYFRAME_REFS,
62
+ ManualClock: () => import_canvas34.ManualClock,
63
63
  MermaidDiagramGroup: () => MermaidDiagramGroup,
64
64
  MermaidDiagramNode: () => MermaidDiagramNode,
65
65
  MermaidFamilyScene: () => MermaidFamilyScene,
66
66
  MermaidThumbnail: () => MermaidThumbnail,
67
67
  PresenceLayer: () => PresenceLayer,
68
- RESIZE_HANDLES: () => import_canvas28.RESIZE_HANDLES,
69
- SHAPE_DATA_KEY: () => import_canvas30.SHAPE_DATA_KEY,
70
- SHAPE_KINDS: () => import_canvas30.SHAPE_KINDS,
71
- SHAPE_NODE_TYPE: () => import_canvas30.SHAPE_NODE_TYPE,
72
- SHAPE_OPERATIONS: () => import_canvas30.SHAPE_OPERATIONS,
68
+ RESIZE_HANDLES: () => import_canvas30.RESIZE_HANDLES,
69
+ SHAPE_DATA_KEY: () => import_canvas32.SHAPE_DATA_KEY,
70
+ SHAPE_KINDS: () => import_canvas32.SHAPE_KINDS,
71
+ SHAPE_NODE_TYPE: () => import_canvas32.SHAPE_NODE_TYPE,
72
+ SHAPE_OPERATIONS: () => import_canvas32.SHAPE_OPERATIONS,
73
73
  ShapeNode: () => ShapeNode,
74
74
  ShapeNodeZoomContext: () => ShapeNodeZoomContext,
75
75
  ShapeNodeZoomProvider: () => ShapeNodeZoomProvider,
76
- TOKEN_BINDINGS_DATA_KEY: () => import_canvas34.TOKEN_BINDINGS_DATA_KEY,
77
- TOKEN_MODES_DATA_KEY: () => import_canvas34.TOKEN_MODES_DATA_KEY,
76
+ TOKEN_BINDINGS_DATA_KEY: () => import_canvas36.TOKEN_BINDINGS_DATA_KEY,
77
+ TOKEN_MODES_DATA_KEY: () => import_canvas36.TOKEN_MODES_DATA_KEY,
78
78
  TokenBindingPicker: () => TokenBindingPicker,
79
79
  TokenModeSwitcher: () => TokenModeSwitcher,
80
- addCanvasVariant: () => import_canvas36.addCanvasVariant,
81
- addKeyframesAtTime: () => import_canvas35.addKeyframesAtTime,
82
- alignNodes: () => import_canvas29.alignNodes,
83
- angleToSvgLinearCoords: () => import_canvas36.angleToSvgLinearCoords,
84
- animateNode: () => import_canvas35.animateNode,
85
- applyAnimation: () => import_canvas35.applyAnimation,
86
- applyAnimationOverrides: () => import_canvas35.applyAnimationOverrides,
87
- applyConstraints: () => import_canvas33.applyConstraints,
88
- applyNodeUpdates: () => import_canvas29.applyNodeUpdates,
89
- applyShapeCombination: () => import_canvas30.applyShapeCombination,
90
- applyShapeReplacement: () => import_canvas31.applyShapeReplacement,
91
- bezierPathArea: () => import_canvas31.bezierPathArea,
92
- bezierPathBounds: () => import_canvas31.bezierPathBounds,
93
- bezierPathLength: () => import_canvas31.bezierPathLength,
94
- bezierPathPointAtLength: () => import_canvas31.bezierPathPointAtLength,
95
- bezierPathSignedArea: () => import_canvas31.bezierPathSignedArea,
96
- bezierPathToSvg: () => import_canvas31.bezierPathToSvg,
97
- bindCanvasComponentProperty: () => import_canvas36.bindCanvasComponentProperty,
98
- bindCanvasToken: () => import_canvas34.bindCanvasToken,
99
- blendLayout: () => import_canvas32.blendLayout,
100
- boundsOf: () => import_canvas32.boundsOf,
101
- brushstrokeScaleBucket: () => import_canvas36.brushstrokeScaleBucket,
102
- brushstrokeSeed: () => import_canvas36.brushstrokeSeed,
103
- calculateDagreReflowDisplacement: () => import_canvas32.calculateDagreReflowDisplacement,
104
- calculateDirectionalDisplacement: () => import_canvas32.calculateDirectionalDisplacement,
105
- canCombineShapeNodes: () => import_canvas30.canCombineShapeNodes,
106
- canOffsetShapeNodes: () => import_canvas31.canOffsetShapeNodes,
107
- canOutlineShapeNodeStrokes: () => import_canvas31.canOutlineShapeNodeStrokes,
108
- canvasHeight: () => import_canvas32.canvasHeight,
109
- centerNodes: () => import_canvas32.centerNodes,
110
- centre: () => import_canvas32.centre,
111
- clampAnimationValue: () => import_canvas35.clampAnimationValue,
112
- clampLayoutSize: () => import_canvas33.clampLayoutSize,
113
- combineCanvasComponentsAsVariants: () => import_canvas36.combineCanvasComponentsAsVariants,
114
- combineShapeNodes: () => import_canvas30.combineShapeNodes,
115
- computeNodesBoundingBox: () => import_canvas32.computeNodesBoundingBox,
116
- computeSnapGuides: () => import_canvas29.computeSnapGuides,
117
- connectedOnly: () => import_canvas32.connectedOnly,
118
- copyKeyframes: () => import_canvas35.copyKeyframes,
119
- countPathSegments: () => import_canvas31.countPathSegments,
120
- createAnimationPlayer: () => import_canvas35.createAnimationPlayer,
121
- createBezierTrajectory: () => import_canvas32.createBezierTrajectory,
122
- createCanvasAnimationController: () => import_canvas35.createCanvasAnimationController,
123
- createCanvasAutoLayoutController: () => import_canvas33.createCanvasAutoLayoutController,
124
- createCanvasComponent: () => import_canvas36.createCanvasComponent,
125
- createCanvasComponentsController: () => import_canvas36.createCanvasComponentsController,
126
- createCanvasDrawController: () => import_canvas36.createCanvasDrawController,
127
- createCanvasInstance: () => import_canvas36.createCanvasInstance,
128
- createCanvasScenesStore: () => import_canvas29.createCanvasScenesStore,
129
- createDefaultStrokeStyle: () => import_canvas36.createDefaultStrokeStyle,
130
- createFanOutTrajectory: () => import_canvas32.createFanOutTrajectory,
131
- createGuideIndex: () => import_canvas29.createGuideIndex,
132
- createNodeGuideIndex: () => import_canvas29.createNodeGuideIndex,
133
- cubicBezierAt: () => import_canvas35.cubicBezierAt,
134
- cubicPointAt: () => import_canvas28.cubicPointAt,
135
- cubicsToPathData: () => import_canvas28.cubicsToPathData,
136
- dashContours: () => import_canvas31.dashContours,
137
- defaultEasing: () => import_canvas32.defaultEasing,
138
- deleteKeyframes: () => import_canvas35.deleteKeyframes,
139
- detachCanvasInstance: () => import_canvas36.detachCanvasInstance,
140
- detachTokenBindings: () => import_canvas34.detachTokenBindings,
141
- distanceToBezierPath: () => import_canvas31.distanceToBezierPath,
142
- distributeNodes: () => import_canvas29.distributeNodes,
143
- dividePaths: () => import_canvas31.dividePaths,
144
- dividePolygons: () => import_canvas30.dividePolygons,
145
- easingFromInfluence: () => import_canvas35.easingFromInfluence,
146
- easingLabel: () => import_canvas35.easingLabel,
147
- easingToCss: () => import_canvas35.easingToCss,
148
- ensureLayout: () => import_canvas32.ensureLayout,
149
- estimateCanvasHeight: () => import_canvas32.estimateCanvasHeight,
150
- estimateNodeSize: () => import_canvas32.estimateNodeSize,
151
- evaluateAnimation: () => import_canvas35.evaluateAnimation,
152
- evaluateEasing: () => import_canvas35.evaluateEasing,
153
- evaluateTrack: () => import_canvas35.evaluateTrack,
154
- excludePaths: () => import_canvas31.excludePaths,
155
- exportCssAnimation: () => import_canvas35.exportCssAnimation,
156
- findConnectorSnap: () => import_canvas29.findConnectorSnap,
157
- findStrokesAtPoint: () => import_canvas36.findStrokesAtPoint,
158
- fitCubicRun: () => import_canvas28.fitCubicRun,
159
- fitCubics: () => import_canvas28.fitCubics,
160
- fitFreehandPath: () => import_canvas28.fitFreehandPath,
161
- fitPathData: () => import_canvas28.fitPathData,
162
- fitViewportToNodes: () => import_canvas29.fitViewportToNodes,
163
- fitViewportToRect: () => import_canvas29.fitViewportToRect,
164
- flattenSvgPath: () => import_canvas30.flattenSvgPath,
165
- flowSide: () => import_canvas32.flowSide,
166
- formatAnimationTime: () => import_canvas35.formatAnimationTime,
167
- formatOklab: () => import_canvas35.formatOklab,
168
- freehandBrushstroke: () => import_canvas36.freehandBrushstroke,
169
- getAbsolutePosition: () => import_canvas29.getAbsolutePosition,
170
- getAnimatableProperty: () => import_canvas35.getAnimatableProperty,
171
- getAnimatedProperties: () => import_canvas35.getAnimatedProperties,
172
- getAnimatedValue: () => import_canvas35.getAnimatedValue,
173
- getAnimationDuration: () => import_canvas35.getAnimationDuration,
174
- getAnimationTrack: () => import_canvas35.getAnimationTrack,
175
- getAutoLayout: () => import_canvas33.getAutoLayout,
176
- getAutoLayoutGrid: () => import_canvas33.getAutoLayoutGrid,
177
- getAutoLayoutInsertTarget: () => import_canvas33.getAutoLayoutInsertTarget,
178
- getBindableTokenProperties: () => import_canvas34.getBindableTokenProperties,
179
- getBrushedShapeSvg: () => import_canvas36.getBrushedShapeSvg,
180
- getCanvasComponentDragId: () => import_canvas36.getCanvasComponentDragId,
181
- getCanvasTokenProperty: () => import_canvas34.getCanvasTokenProperty,
182
- getCenteredNodePosition: () => import_canvas32.getCenteredNodePosition,
183
- getChildLayout: () => import_canvas33.getChildLayout,
184
- getComponentSourceId: () => import_canvas36.getComponentSourceId,
185
- getCssPropertyAnimations: () => import_canvas35.getCssPropertyAnimations,
186
- getEffectiveTokenModes: () => import_canvas34.getEffectiveTokenModes,
187
- getFlowChildren: () => import_canvas33.getFlowChildren,
188
- getInstanceData: () => import_canvas36.getInstanceData,
189
- getInstanceStatus: () => import_canvas36.getInstanceStatus,
190
- getKeyframeTimes: () => import_canvas35.getKeyframeTimes,
191
- getLayoutParent: () => import_canvas33.getLayoutParent,
192
- getLayoutSizing: () => import_canvas33.getLayoutSizing,
193
- getLayoutedNodes: () => import_canvas32.getLayoutedNodes,
194
- getNextVariantValues: () => import_canvas36.getNextVariantValues,
195
- getNodeAnimation: () => import_canvas35.getNodeAnimation,
196
- getNodeOverrides: () => import_canvas36.getNodeOverrides,
197
- getNodeRect: () => import_canvas29.getNodeRect,
198
- getNodeShape: () => import_canvas30.getNodeShape,
199
- getNodeSize: () => import_canvas29.getNodeSize,
200
- getNodeTokenBindings: () => import_canvas34.getNodeTokenBindings,
201
- getNodeTokenModes: () => import_canvas34.getNodeTokenModes,
202
- getResizingNodeRect: () => import_canvas28.getResizingNodeRect,
203
- getShapeRenderData: () => import_canvas30.getShapeRenderData,
204
- getShapeSvg: () => import_canvas30.getShapeSvg,
205
- getTimelineRows: () => import_canvas35.getTimelineRows,
206
- getTimelineTicks: () => import_canvas35.getTimelineTicks,
207
- getTokenPropertyScope: () => import_canvas34.getTokenPropertyScope,
208
- getTokensForProperty: () => import_canvas34.getTokensForProperty,
209
- gradientToSvgDef: () => import_canvas36.gradientToSvgDef,
210
- handlePoint: () => import_canvas29.handlePoint,
211
- hasVisibleStroke: () => import_canvas31.hasVisibleStroke,
212
- inferResizeHandle: () => import_canvas28.inferResizeHandle,
213
- inspectCanvasInstance: () => import_canvas36.inspectCanvasInstance,
214
- inspectNodeTokens: () => import_canvas34.inspectNodeTokens,
215
- interpolateAnimationValue: () => import_canvas35.interpolateAnimationValue,
216
- intersectPaths: () => import_canvas31.intersectPaths,
217
- intersectPolygons: () => import_canvas30.intersectPolygons,
218
- invertNodeUpdates: () => import_canvas29.invertNodeUpdates,
219
- isAnimationEasing: () => import_canvas35.isAnimationEasing,
220
- isAnimationKeyframe: () => import_canvas35.isAnimationKeyframe,
221
- isAutoLayoutFrame: () => import_canvas33.isAutoLayoutFrame,
222
- isBrushedShape: () => import_canvas36.isBrushedShape,
223
- isCanvasComponent: () => import_canvas36.isCanvasComponent,
224
- isCanvasComponentSet: () => import_canvas36.isCanvasComponentSet,
225
- isCanvasGradient: () => import_canvas36.isCanvasGradient,
226
- isCanvasInstance: () => import_canvas36.isCanvasInstance,
227
- isCssExportExact: () => import_canvas35.isCssExportExact,
228
- isEventFromTextInput: () => import_canvas32.isEventFromTextInput,
229
- isKeyframeSelected: () => import_canvas35.isKeyframeSelected,
230
- isLocked: () => import_canvas29.isLocked,
231
- isMeasureModifierHeld: () => import_canvas28.isMeasureModifierHeld,
232
- isNodeAnimated: () => import_canvas35.isNodeAnimated,
233
- isShapeDescription: () => import_canvas30.isShapeDescription,
234
- isShapeNode: () => import_canvas30.isShapeNode,
235
- isStraightCubic: () => import_canvas28.isStraightCubic,
236
- isValidCanvasNode: () => import_canvas32.isValidCanvasNode,
237
- isValidUrl: () => import_canvas32.isValidUrl,
238
- layoutAll: () => import_canvas33.layoutAll,
239
- layoutBounds: () => import_canvas32.layoutBounds,
240
- layoutFrame: () => import_canvas33.layoutFrame,
241
- layoutUp: () => import_canvas33.layoutUp,
242
- layoutUpMany: () => import_canvas33.layoutUpMany,
243
- linearPositionTrajectory: () => import_canvas32.linearPositionTrajectory,
244
- linearTrajectory: () => import_canvas32.linearTrajectory,
245
- listCanvasBrushes: () => import_canvas36.listCanvasBrushes,
246
- listCanvasComponents: () => import_canvas36.listCanvasComponents,
247
- loadCanvasBrushstrokeRenderer: () => import_canvas36.loadCanvasBrushstrokeRenderer,
248
- lockNodes: () => import_canvas29.lockNodes,
249
- makeSizingCoherent: () => import_canvas33.makeSizingCoherent,
250
- matchArrangeShortcut: () => import_canvas29.matchArrangeShortcut,
251
- matchSize: () => import_canvas29.matchSize,
252
- measureBetween: () => import_canvas28.measureBetween,
253
- measureLabel: () => import_canvas28.measureLabel,
254
- measureSelection: () => import_canvas28.measureSelection,
255
- measureToLine: () => import_canvas28.measureToLine,
256
- mergeNodeUpdates: () => import_canvas33.mergeNodeUpdates,
80
+ addCanvasVariant: () => import_canvas38.addCanvasVariant,
81
+ addKeyframesAtTime: () => import_canvas37.addKeyframesAtTime,
82
+ alignNodes: () => import_canvas31.alignNodes,
83
+ angleToSvgLinearCoords: () => import_canvas38.angleToSvgLinearCoords,
84
+ animateNode: () => import_canvas37.animateNode,
85
+ applyAnimation: () => import_canvas37.applyAnimation,
86
+ applyAnimationOverrides: () => import_canvas37.applyAnimationOverrides,
87
+ applyConstraints: () => import_canvas35.applyConstraints,
88
+ applyNodeUpdates: () => import_canvas31.applyNodeUpdates,
89
+ applyShapeCombination: () => import_canvas32.applyShapeCombination,
90
+ applyShapeReplacement: () => import_canvas33.applyShapeReplacement,
91
+ bezierPathArea: () => import_canvas33.bezierPathArea,
92
+ bezierPathBounds: () => import_canvas33.bezierPathBounds,
93
+ bezierPathLength: () => import_canvas33.bezierPathLength,
94
+ bezierPathPointAtLength: () => import_canvas33.bezierPathPointAtLength,
95
+ bezierPathSignedArea: () => import_canvas33.bezierPathSignedArea,
96
+ bezierPathToSvg: () => import_canvas33.bezierPathToSvg,
97
+ bindCanvasComponentProperty: () => import_canvas38.bindCanvasComponentProperty,
98
+ bindCanvasToken: () => import_canvas36.bindCanvasToken,
99
+ blendLayout: () => import_canvas34.blendLayout,
100
+ boundsOf: () => import_canvas34.boundsOf,
101
+ brushstrokeScaleBucket: () => import_canvas38.brushstrokeScaleBucket,
102
+ brushstrokeSeed: () => import_canvas38.brushstrokeSeed,
103
+ calculateDagreReflowDisplacement: () => import_canvas34.calculateDagreReflowDisplacement,
104
+ calculateDirectionalDisplacement: () => import_canvas34.calculateDirectionalDisplacement,
105
+ calculateReflowDisplacement: () => import_canvas34.calculateReflowDisplacement,
106
+ canCombineShapeNodes: () => import_canvas32.canCombineShapeNodes,
107
+ canOffsetShapeNodes: () => import_canvas33.canOffsetShapeNodes,
108
+ canOutlineShapeNodeStrokes: () => import_canvas33.canOutlineShapeNodeStrokes,
109
+ canvasExplosionToolTarget: () => import_canvas29.canvasExplosionToolTarget,
110
+ canvasHeight: () => import_canvas34.canvasHeight,
111
+ centerNodes: () => import_canvas34.centerNodes,
112
+ centre: () => import_canvas34.centre,
113
+ clampAnimationValue: () => import_canvas37.clampAnimationValue,
114
+ clampLayoutSize: () => import_canvas35.clampLayoutSize,
115
+ combineCanvasComponentsAsVariants: () => import_canvas38.combineCanvasComponentsAsVariants,
116
+ combineShapeNodes: () => import_canvas32.combineShapeNodes,
117
+ computeCanvasExplosionLayout: () => import_canvas29.computeCanvasExplosionLayout,
118
+ computeNodesBoundingBox: () => import_canvas34.computeNodesBoundingBox,
119
+ computeSnapGuides: () => import_canvas31.computeSnapGuides,
120
+ connectedOnly: () => import_canvas34.connectedOnly,
121
+ copyKeyframes: () => import_canvas37.copyKeyframes,
122
+ countPathSegments: () => import_canvas33.countPathSegments,
123
+ createAnimationPlayer: () => import_canvas37.createAnimationPlayer,
124
+ createBezierTrajectory: () => import_canvas34.createBezierTrajectory,
125
+ createCanvasAnimationController: () => import_canvas37.createCanvasAnimationController,
126
+ createCanvasAutoLayoutController: () => import_canvas35.createCanvasAutoLayoutController,
127
+ createCanvasComponent: () => import_canvas38.createCanvasComponent,
128
+ createCanvasComponentsController: () => import_canvas38.createCanvasComponentsController,
129
+ createCanvasDrawController: () => import_canvas38.createCanvasDrawController,
130
+ createCanvasExplosionStateController: () => import_canvas29.createCanvasExplosionStateController,
131
+ createCanvasExplosionToolProvider: () => import_canvas29.createCanvasExplosionToolProvider,
132
+ createCanvasInstance: () => import_canvas38.createCanvasInstance,
133
+ createCanvasScenesStore: () => import_canvas31.createCanvasScenesStore,
134
+ createDefaultStrokeStyle: () => import_canvas38.createDefaultStrokeStyle,
135
+ createFanOutTrajectory: () => import_canvas34.createFanOutTrajectory,
136
+ createGuideIndex: () => import_canvas31.createGuideIndex,
137
+ createNodeGuideIndex: () => import_canvas31.createNodeGuideIndex,
138
+ cubicBezierAt: () => import_canvas37.cubicBezierAt,
139
+ cubicPointAt: () => import_canvas30.cubicPointAt,
140
+ cubicsToPathData: () => import_canvas30.cubicsToPathData,
141
+ dashContours: () => import_canvas33.dashContours,
142
+ defaultEasing: () => import_canvas34.defaultEasing,
143
+ deleteKeyframes: () => import_canvas37.deleteKeyframes,
144
+ detachCanvasInstance: () => import_canvas38.detachCanvasInstance,
145
+ detachTokenBindings: () => import_canvas36.detachTokenBindings,
146
+ distanceToBezierPath: () => import_canvas33.distanceToBezierPath,
147
+ distributeNodes: () => import_canvas31.distributeNodes,
148
+ dividePaths: () => import_canvas33.dividePaths,
149
+ dividePolygons: () => import_canvas32.dividePolygons,
150
+ easingFromInfluence: () => import_canvas37.easingFromInfluence,
151
+ easingLabel: () => import_canvas37.easingLabel,
152
+ easingToCss: () => import_canvas37.easingToCss,
153
+ ensureLayout: () => import_canvas34.ensureLayout,
154
+ estimateCanvasHeight: () => import_canvas34.estimateCanvasHeight,
155
+ estimateNodeSize: () => import_canvas34.estimateNodeSize,
156
+ evaluateAnimation: () => import_canvas37.evaluateAnimation,
157
+ evaluateEasing: () => import_canvas37.evaluateEasing,
158
+ evaluateTrack: () => import_canvas37.evaluateTrack,
159
+ excludePaths: () => import_canvas33.excludePaths,
160
+ explosionEdgeId: () => import_canvas29.explosionEdgeId,
161
+ exportCssAnimation: () => import_canvas37.exportCssAnimation,
162
+ findConnectorSnap: () => import_canvas31.findConnectorSnap,
163
+ findStrokesAtPoint: () => import_canvas38.findStrokesAtPoint,
164
+ fitCubicRun: () => import_canvas30.fitCubicRun,
165
+ fitCubics: () => import_canvas30.fitCubics,
166
+ fitFreehandPath: () => import_canvas30.fitFreehandPath,
167
+ fitPathData: () => import_canvas30.fitPathData,
168
+ fitViewportToNodes: () => import_canvas31.fitViewportToNodes,
169
+ fitViewportToRect: () => import_canvas31.fitViewportToRect,
170
+ flattenSvgPath: () => import_canvas32.flattenSvgPath,
171
+ flowSide: () => import_canvas34.flowSide,
172
+ formatAnimationTime: () => import_canvas37.formatAnimationTime,
173
+ formatOklab: () => import_canvas37.formatOklab,
174
+ freehandBrushstroke: () => import_canvas38.freehandBrushstroke,
175
+ getAbsolutePosition: () => import_canvas31.getAbsolutePosition,
176
+ getAnimatableProperty: () => import_canvas37.getAnimatableProperty,
177
+ getAnimatedProperties: () => import_canvas37.getAnimatedProperties,
178
+ getAnimatedValue: () => import_canvas37.getAnimatedValue,
179
+ getAnimationDuration: () => import_canvas37.getAnimationDuration,
180
+ getAnimationTrack: () => import_canvas37.getAnimationTrack,
181
+ getAutoLayout: () => import_canvas35.getAutoLayout,
182
+ getAutoLayoutGrid: () => import_canvas35.getAutoLayoutGrid,
183
+ getAutoLayoutInsertTarget: () => import_canvas35.getAutoLayoutInsertTarget,
184
+ getBindableTokenProperties: () => import_canvas36.getBindableTokenProperties,
185
+ getBrushedShapeSvg: () => import_canvas38.getBrushedShapeSvg,
186
+ getCanvasComponentDragId: () => import_canvas38.getCanvasComponentDragId,
187
+ getCanvasTokenProperty: () => import_canvas36.getCanvasTokenProperty,
188
+ getCenteredNodePosition: () => import_canvas34.getCenteredNodePosition,
189
+ getChildLayout: () => import_canvas35.getChildLayout,
190
+ getComponentSourceId: () => import_canvas38.getComponentSourceId,
191
+ getCssPropertyAnimations: () => import_canvas37.getCssPropertyAnimations,
192
+ getEffectiveTokenModes: () => import_canvas36.getEffectiveTokenModes,
193
+ getFlowChildren: () => import_canvas35.getFlowChildren,
194
+ getInstanceData: () => import_canvas38.getInstanceData,
195
+ getInstanceStatus: () => import_canvas38.getInstanceStatus,
196
+ getKeyframeTimes: () => import_canvas37.getKeyframeTimes,
197
+ getLayoutParent: () => import_canvas35.getLayoutParent,
198
+ getLayoutSizing: () => import_canvas35.getLayoutSizing,
199
+ getLayoutedNodes: () => import_canvas34.getLayoutedNodes,
200
+ getNextVariantValues: () => import_canvas38.getNextVariantValues,
201
+ getNodeAnimation: () => import_canvas37.getNodeAnimation,
202
+ getNodeOverrides: () => import_canvas38.getNodeOverrides,
203
+ getNodeRect: () => import_canvas31.getNodeRect,
204
+ getNodeShape: () => import_canvas32.getNodeShape,
205
+ getNodeSize: () => import_canvas31.getNodeSize,
206
+ getNodeTokenBindings: () => import_canvas36.getNodeTokenBindings,
207
+ getNodeTokenModes: () => import_canvas36.getNodeTokenModes,
208
+ getResizingNodeRect: () => import_canvas30.getResizingNodeRect,
209
+ getShapeRenderData: () => import_canvas32.getShapeRenderData,
210
+ getShapeSvg: () => import_canvas32.getShapeSvg,
211
+ getTimelineRows: () => import_canvas37.getTimelineRows,
212
+ getTimelineTicks: () => import_canvas37.getTimelineTicks,
213
+ getTokenPropertyScope: () => import_canvas36.getTokenPropertyScope,
214
+ getTokensForProperty: () => import_canvas36.getTokensForProperty,
215
+ gradientToSvgDef: () => import_canvas38.gradientToSvgDef,
216
+ handlePoint: () => import_canvas31.handlePoint,
217
+ hasVisibleStroke: () => import_canvas33.hasVisibleStroke,
218
+ inferResizeHandle: () => import_canvas30.inferResizeHandle,
219
+ inspectCanvasInstance: () => import_canvas38.inspectCanvasInstance,
220
+ inspectNodeTokens: () => import_canvas36.inspectNodeTokens,
221
+ interpolateAnimationValue: () => import_canvas37.interpolateAnimationValue,
222
+ intersectPaths: () => import_canvas33.intersectPaths,
223
+ intersectPolygons: () => import_canvas32.intersectPolygons,
224
+ invertNodeUpdates: () => import_canvas31.invertNodeUpdates,
225
+ isAnimationEasing: () => import_canvas37.isAnimationEasing,
226
+ isAnimationKeyframe: () => import_canvas37.isAnimationKeyframe,
227
+ isAutoLayoutFrame: () => import_canvas35.isAutoLayoutFrame,
228
+ isBrushedShape: () => import_canvas38.isBrushedShape,
229
+ isCanvasComponent: () => import_canvas38.isCanvasComponent,
230
+ isCanvasComponentSet: () => import_canvas38.isCanvasComponentSet,
231
+ isCanvasGradient: () => import_canvas38.isCanvasGradient,
232
+ isCanvasInstance: () => import_canvas38.isCanvasInstance,
233
+ isCssExportExact: () => import_canvas37.isCssExportExact,
234
+ isEventFromTextInput: () => import_canvas34.isEventFromTextInput,
235
+ isKeyframeSelected: () => import_canvas37.isKeyframeSelected,
236
+ isLocked: () => import_canvas31.isLocked,
237
+ isMeasureModifierHeld: () => import_canvas30.isMeasureModifierHeld,
238
+ isNodeAnimated: () => import_canvas37.isNodeAnimated,
239
+ isShapeDescription: () => import_canvas32.isShapeDescription,
240
+ isShapeNode: () => import_canvas32.isShapeNode,
241
+ isStraightCubic: () => import_canvas30.isStraightCubic,
242
+ isValidCanvasNode: () => import_canvas34.isValidCanvasNode,
243
+ isValidUrl: () => import_canvas34.isValidUrl,
244
+ layoutAll: () => import_canvas35.layoutAll,
245
+ layoutBounds: () => import_canvas34.layoutBounds,
246
+ layoutFrame: () => import_canvas35.layoutFrame,
247
+ layoutUp: () => import_canvas35.layoutUp,
248
+ layoutUpMany: () => import_canvas35.layoutUpMany,
249
+ linearPositionTrajectory: () => import_canvas34.linearPositionTrajectory,
250
+ linearTrajectory: () => import_canvas34.linearTrajectory,
251
+ listCanvasBrushes: () => import_canvas38.listCanvasBrushes,
252
+ listCanvasComponents: () => import_canvas38.listCanvasComponents,
253
+ loadCanvasBrushstrokeRenderer: () => import_canvas38.loadCanvasBrushstrokeRenderer,
254
+ lockNodes: () => import_canvas31.lockNodes,
255
+ makeSizingCoherent: () => import_canvas35.makeSizingCoherent,
256
+ matchArrangeShortcut: () => import_canvas31.matchArrangeShortcut,
257
+ matchSize: () => import_canvas31.matchSize,
258
+ measureBetween: () => import_canvas30.measureBetween,
259
+ measureLabel: () => import_canvas30.measureLabel,
260
+ measureSelection: () => import_canvas30.measureSelection,
261
+ measureToLine: () => import_canvas30.measureToLine,
262
+ mergeNodeUpdates: () => import_canvas35.mergeNodeUpdates,
257
263
  mermaidNodeStyle: () => mermaidNodeStyle,
258
- mixColorsOklab: () => import_canvas35.mixColorsOklab,
259
- moveKeyframes: () => import_canvas35.moveKeyframes,
260
- moveLayoutChild: () => import_canvas33.moveLayoutChild,
261
- multiPolygonArea: () => import_canvas30.multiPolygonArea,
262
- multiPolygonBounds: () => import_canvas30.multiPolygonBounds,
263
- nearestHandlePositions: () => import_canvas29.nearestHandlePositions,
264
- normalizeBezierPath: () => import_canvas31.normalizeBezierPath,
265
- normalizeKeyframes: () => import_canvas35.normalizeKeyframes,
266
- offsetPath: () => import_canvas31.offsetPath,
267
- offsetShapeNodes: () => import_canvas31.offsetShapeNodes,
268
- oklabToRgb: () => import_canvas35.oklabToRgb,
269
- oppositePosition: () => import_canvas29.oppositePosition,
270
- outlineShapeNodeStrokes: () => import_canvas31.outlineShapeNodeStrokes,
271
- outlineStroke: () => import_canvas31.outlineStroke,
272
- overlaps: () => import_canvas32.overlaps,
273
- parseCanvasClipboardData: () => import_canvas32.parseCanvasClipboardData,
274
- parseCanvasScenes: () => import_canvas29.parseCanvasScenes,
275
- parseCssEasing: () => import_canvas35.parseCssEasing,
276
- parseCssGradient: () => import_canvas36.parseCssGradient,
277
- parseKeyframeClipboard: () => import_canvas35.parseKeyframeClipboard,
278
- parseOklab: () => import_canvas35.parseOklab,
279
- parseSvgPath: () => import_canvas30.parseSvgPath,
280
- pasteKeyframes: () => import_canvas35.pasteKeyframes,
281
- pathBoolean: () => import_canvas31.pathBoolean,
282
- pathDataToPolyline: () => import_canvas36.pathDataToPolyline,
283
- placeBeside: () => import_canvas32.placeBeside,
284
- playWebAnimations: () => import_canvas35.playWebAnimations,
285
- pointInBezierPath: () => import_canvas31.pointInBezierPath,
286
- pointInMultiPolygon: () => import_canvas30.pointInMultiPolygon,
287
- pointInRings: () => import_canvas30.pointInRings,
288
- pointerPenSample: () => import_canvas36.pointerPenSample,
289
- polygonArea: () => import_canvas30.polygonArea,
290
- polygonBoolean: () => import_canvas30.polygonBoolean,
291
- polygonToSvgPath: () => import_canvas30.polygonToSvgPath,
292
- positionToSide: () => import_canvas29.positionToSide,
293
- profileAlongPolyline: () => import_canvas36.profileAlongPolyline,
294
- pruneCanvasTokenModes: () => import_canvas34.pruneCanvasTokenModes,
295
- pushCanvasInstanceOverrides: () => import_canvas36.pushCanvasInstanceOverrides,
296
- readAnimatableValue: () => import_canvas35.readAnimatableValue,
297
- readNodeStyleProperty: () => import_canvas34.readNodeStyleProperty,
298
- readStyleSize: () => import_canvas29.readStyleSize,
299
- realClock: () => import_canvas32.realClock,
300
- recordAnimationChanges: () => import_canvas35.recordAnimationChanges,
301
- relayoutUpdates: () => import_canvas33.relayoutUpdates,
302
- remapPastedNodes: () => import_canvas32.remapPastedNodes,
303
- removeCanvasVariant: () => import_canvas36.removeCanvasVariant,
304
- removeTrack: () => import_canvas35.removeTrack,
305
- renameCanvasVariantProperty: () => import_canvas36.renameCanvasVariantProperty,
306
- renameCanvasVariantValue: () => import_canvas36.renameCanvasVariantValue,
307
- renderCanvasBrushSwatch: () => import_canvas36.renderCanvasBrushSwatch,
308
- renderShapeBrushstroke: () => import_canvas36.renderShapeBrushstroke,
309
- reorderNodes: () => import_canvas29.reorderNodes,
310
- repositionNodesTo: () => import_canvas32.repositionNodesTo,
311
- resetCanvasInstanceOverrides: () => import_canvas36.resetCanvasInstanceOverrides,
312
- resizeHandleAxes: () => import_canvas28.resizeHandleAxes,
313
- resolveCanvasGradient: () => import_canvas36.resolveCanvasGradient,
314
- resolveCanvasTokens: () => import_canvas34.resolveCanvasTokens,
315
- resolveEasing: () => import_canvas35.resolveEasing,
316
- resolvePadding: () => import_canvas33.resolvePadding,
317
- restoreCanvasMainComponent: () => import_canvas36.restoreCanvasMainComponent,
318
- revertShapeCombination: () => import_canvas30.revertShapeCombination,
319
- rgbToOklab: () => import_canvas35.rgbToOklab,
320
- ringSignedArea: () => import_canvas30.ringSignedArea,
321
- runMultiNodeTransition: () => import_canvas32.runMultiNodeTransition,
322
- sampleAnimationFrames: () => import_canvas35.sampleAnimationFrames,
323
- scaleKeyframes: () => import_canvas35.scaleKeyframes,
324
- serializeCanvasNodes: () => import_canvas32.serializeCanvasNodes,
325
- setCanvasComponentProperty: () => import_canvas36.setCanvasComponentProperty,
326
- setCanvasInstanceProperties: () => import_canvas36.setCanvasInstanceProperties,
327
- setCanvasTokenMode: () => import_canvas34.setCanvasTokenMode,
328
- setCanvasVariantProperties: () => import_canvas36.setCanvasVariantProperties,
329
- setKeyframe: () => import_canvas35.setKeyframe,
330
- setKeyframeEasing: () => import_canvas35.setKeyframeEasing,
331
- setMotionPath: () => import_canvas35.setMotionPath,
332
- setTrackEnabled: () => import_canvas35.setTrackEnabled,
333
- shapeNodeToBezierPath: () => import_canvas31.shapeNodeToBezierPath,
334
- shapeNodeToPolygon: () => import_canvas30.shapeNodeToPolygon,
335
- shapeToBezierPath: () => import_canvas31.shapeToBezierPath,
336
- shapeToPolygon: () => import_canvas30.shapeToPolygon,
337
- sideToPosition: () => import_canvas29.sideToPosition,
338
- simplifyRing: () => import_canvas30.simplifyRing,
339
- snapKeyframeDelta: () => import_canvas35.snapKeyframeDelta,
340
- snapNodeDrag: () => import_canvas29.snapNodeDrag,
341
- snapNodeResize: () => import_canvas28.snapNodeResize,
342
- snapResize: () => import_canvas28.snapResize,
343
- snapTimeToFrame: () => import_canvas35.snapTimeToFrame,
344
- snapToGrid: () => import_canvas28.snapToGrid,
345
- springAt: () => import_canvas35.springAt,
346
- streamlinePoints: () => import_canvas36.streamlinePoints,
347
- strokeOutlineRings: () => import_canvas31.strokeOutlineRings,
348
- strokePointsToPathData: () => import_canvas36.strokePointsToPathData,
349
- strokeToShapeNode: () => import_canvas36.strokeToShapeNode,
350
- subtractPaths: () => import_canvas31.subtractPaths,
351
- subtractPolygons: () => import_canvas30.subtractPolygons,
352
- swapCanvasInstance: () => import_canvas36.swapCanvasInstance,
353
- syncAllCanvasInstances: () => import_canvas36.syncAllCanvasInstances,
354
- syncCanvasComponents: () => import_canvas36.syncCanvasComponents,
355
- syncCanvasInstance: () => import_canvas36.syncCanvasInstance,
356
- timeToX: () => import_canvas35.timeToX,
357
- toBezierPath: () => import_canvas31.toBezierPath,
358
- toWebAnimations: () => import_canvas35.toWebAnimations,
359
- toggleLockNodes: () => import_canvas29.toggleLockNodes,
360
- transformBezierPath: () => import_canvas31.transformBezierPath,
361
- unionPolygons: () => import_canvas30.unionPolygons,
362
- unitePaths: () => import_canvas31.unitePaths,
363
- unlockNodes: () => import_canvas29.unlockNodes,
364
- updateKeyframe: () => import_canvas35.updateKeyframe,
264
+ mixColorsOklab: () => import_canvas37.mixColorsOklab,
265
+ moveKeyframes: () => import_canvas37.moveKeyframes,
266
+ moveLayoutChild: () => import_canvas35.moveLayoutChild,
267
+ multiPolygonArea: () => import_canvas32.multiPolygonArea,
268
+ multiPolygonBounds: () => import_canvas32.multiPolygonBounds,
269
+ nearestHandlePositions: () => import_canvas31.nearestHandlePositions,
270
+ nodeSizeOf: () => import_canvas34.nodeSizeOf,
271
+ normalizeBezierPath: () => import_canvas33.normalizeBezierPath,
272
+ normalizeKeyframes: () => import_canvas37.normalizeKeyframes,
273
+ offsetPath: () => import_canvas33.offsetPath,
274
+ offsetShapeNodes: () => import_canvas33.offsetShapeNodes,
275
+ oklabToRgb: () => import_canvas37.oklabToRgb,
276
+ oppositePosition: () => import_canvas31.oppositePosition,
277
+ outlineShapeNodeStrokes: () => import_canvas33.outlineShapeNodeStrokes,
278
+ outlineStroke: () => import_canvas33.outlineStroke,
279
+ overlaps: () => import_canvas34.overlaps,
280
+ parseCanvasClipboardData: () => import_canvas34.parseCanvasClipboardData,
281
+ parseCanvasScenes: () => import_canvas31.parseCanvasScenes,
282
+ parseCssEasing: () => import_canvas37.parseCssEasing,
283
+ parseCssGradient: () => import_canvas38.parseCssGradient,
284
+ parseKeyframeClipboard: () => import_canvas37.parseKeyframeClipboard,
285
+ parseOklab: () => import_canvas37.parseOklab,
286
+ parseSvgPath: () => import_canvas32.parseSvgPath,
287
+ pasteKeyframes: () => import_canvas37.pasteKeyframes,
288
+ pathBoolean: () => import_canvas33.pathBoolean,
289
+ pathDataToPolyline: () => import_canvas38.pathDataToPolyline,
290
+ placeBeside: () => import_canvas34.placeBeside,
291
+ playWebAnimations: () => import_canvas37.playWebAnimations,
292
+ pointInBezierPath: () => import_canvas33.pointInBezierPath,
293
+ pointInMultiPolygon: () => import_canvas32.pointInMultiPolygon,
294
+ pointInRings: () => import_canvas32.pointInRings,
295
+ pointerPenSample: () => import_canvas38.pointerPenSample,
296
+ polygonArea: () => import_canvas32.polygonArea,
297
+ polygonBoolean: () => import_canvas32.polygonBoolean,
298
+ polygonToSvgPath: () => import_canvas32.polygonToSvgPath,
299
+ positionToSide: () => import_canvas31.positionToSide,
300
+ profileAlongPolyline: () => import_canvas38.profileAlongPolyline,
301
+ pruneCanvasTokenModes: () => import_canvas36.pruneCanvasTokenModes,
302
+ pushCanvasInstanceOverrides: () => import_canvas38.pushCanvasInstanceOverrides,
303
+ readAnimatableValue: () => import_canvas37.readAnimatableValue,
304
+ readNodeStyleProperty: () => import_canvas36.readNodeStyleProperty,
305
+ readStyleSize: () => import_canvas31.readStyleSize,
306
+ realClock: () => import_canvas34.realClock,
307
+ recordAnimationChanges: () => import_canvas37.recordAnimationChanges,
308
+ relayoutUpdates: () => import_canvas35.relayoutUpdates,
309
+ remapPastedNodes: () => import_canvas34.remapPastedNodes,
310
+ removeCanvasVariant: () => import_canvas38.removeCanvasVariant,
311
+ removeTrack: () => import_canvas37.removeTrack,
312
+ renameCanvasVariantProperty: () => import_canvas38.renameCanvasVariantProperty,
313
+ renameCanvasVariantValue: () => import_canvas38.renameCanvasVariantValue,
314
+ renderCanvasBrushSwatch: () => import_canvas38.renderCanvasBrushSwatch,
315
+ renderShapeBrushstroke: () => import_canvas38.renderShapeBrushstroke,
316
+ reorderNodes: () => import_canvas31.reorderNodes,
317
+ repositionNodesTo: () => import_canvas34.repositionNodesTo,
318
+ resetCanvasInstanceOverrides: () => import_canvas38.resetCanvasInstanceOverrides,
319
+ resizeHandleAxes: () => import_canvas30.resizeHandleAxes,
320
+ resolveCanvasGradient: () => import_canvas38.resolveCanvasGradient,
321
+ resolveCanvasTokens: () => import_canvas36.resolveCanvasTokens,
322
+ resolveEasing: () => import_canvas37.resolveEasing,
323
+ resolvePadding: () => import_canvas35.resolvePadding,
324
+ restoreCanvasMainComponent: () => import_canvas38.restoreCanvasMainComponent,
325
+ revertShapeCombination: () => import_canvas32.revertShapeCombination,
326
+ rgbToOklab: () => import_canvas37.rgbToOklab,
327
+ ringSignedArea: () => import_canvas32.ringSignedArea,
328
+ runMultiNodeTransition: () => import_canvas34.runMultiNodeTransition,
329
+ sampleAnimationFrames: () => import_canvas37.sampleAnimationFrames,
330
+ scaleKeyframes: () => import_canvas37.scaleKeyframes,
331
+ serializeCanvasNodes: () => import_canvas34.serializeCanvasNodes,
332
+ setCanvasComponentProperty: () => import_canvas38.setCanvasComponentProperty,
333
+ setCanvasInstanceProperties: () => import_canvas38.setCanvasInstanceProperties,
334
+ setCanvasTokenMode: () => import_canvas36.setCanvasTokenMode,
335
+ setCanvasVariantProperties: () => import_canvas38.setCanvasVariantProperties,
336
+ setKeyframe: () => import_canvas37.setKeyframe,
337
+ setKeyframeEasing: () => import_canvas37.setKeyframeEasing,
338
+ setMotionPath: () => import_canvas37.setMotionPath,
339
+ setTrackEnabled: () => import_canvas37.setTrackEnabled,
340
+ shapeNodeToBezierPath: () => import_canvas33.shapeNodeToBezierPath,
341
+ shapeNodeToPolygon: () => import_canvas32.shapeNodeToPolygon,
342
+ shapeToBezierPath: () => import_canvas33.shapeToBezierPath,
343
+ shapeToPolygon: () => import_canvas32.shapeToPolygon,
344
+ sideToPosition: () => import_canvas31.sideToPosition,
345
+ simplifyRing: () => import_canvas32.simplifyRing,
346
+ snapKeyframeDelta: () => import_canvas37.snapKeyframeDelta,
347
+ snapNodeDrag: () => import_canvas31.snapNodeDrag,
348
+ snapNodeResize: () => import_canvas30.snapNodeResize,
349
+ snapResize: () => import_canvas30.snapResize,
350
+ snapTimeToFrame: () => import_canvas37.snapTimeToFrame,
351
+ snapToGrid: () => import_canvas30.snapToGrid,
352
+ springAt: () => import_canvas37.springAt,
353
+ streamlinePoints: () => import_canvas38.streamlinePoints,
354
+ strokeOutlineRings: () => import_canvas33.strokeOutlineRings,
355
+ strokePointsToPathData: () => import_canvas38.strokePointsToPathData,
356
+ strokeToShapeNode: () => import_canvas38.strokeToShapeNode,
357
+ subtractPaths: () => import_canvas33.subtractPaths,
358
+ subtractPolygons: () => import_canvas32.subtractPolygons,
359
+ swapCanvasInstance: () => import_canvas38.swapCanvasInstance,
360
+ syncAllCanvasInstances: () => import_canvas38.syncAllCanvasInstances,
361
+ syncCanvasComponents: () => import_canvas38.syncCanvasComponents,
362
+ syncCanvasInstance: () => import_canvas38.syncCanvasInstance,
363
+ timeToX: () => import_canvas37.timeToX,
364
+ toBezierPath: () => import_canvas33.toBezierPath,
365
+ toWebAnimations: () => import_canvas37.toWebAnimations,
366
+ toggleLockNodes: () => import_canvas31.toggleLockNodes,
367
+ transformBezierPath: () => import_canvas33.transformBezierPath,
368
+ unionPolygons: () => import_canvas32.unionPolygons,
369
+ unitePaths: () => import_canvas33.unitePaths,
370
+ unlockNodes: () => import_canvas31.unlockNodes,
371
+ updateKeyframe: () => import_canvas37.updateKeyframe,
365
372
  useCanvasAnimation: () => useCanvasAnimation,
366
373
  useCanvasArrange: () => useCanvasArrange,
367
374
  useCanvasArrangeShortcuts: () => useCanvasArrangeShortcuts,
@@ -377,6 +384,7 @@ __export(canvas_exports, {
377
384
  useCanvasEffectsProviderContext: () => useCanvasEffectsProviderContext,
378
385
  useCanvasEffectsTools: () => useCanvasEffectsTools,
379
386
  useCanvasExplosion: () => useCanvasExplosion,
387
+ useCanvasExplosionState: () => useCanvasExplosionState,
380
388
  useCanvasGraph: () => useCanvasGraph,
381
389
  useCanvasLayout: () => useCanvasLayout,
382
390
  useCanvasMeasure: () => useCanvasMeasure,
@@ -391,15 +399,15 @@ __export(canvas_exports, {
391
399
  usePresenceState: () => usePresenceState,
392
400
  useShapeBrushstroke: () => useShapeBrushstroke,
393
401
  useStreamingCanvas: () => useStreamingCanvas,
394
- validateCanvasBrush: () => import_canvas36.validateCanvasBrush,
395
- validateCanvasBrushPaint: () => import_canvas36.validateCanvasBrushPaint,
396
- withNodeAnimation: () => import_canvas35.withNodeAnimation,
397
- withStyleSize: () => import_canvas29.withStyleSize,
398
- wouldCreateComponentCycle: () => import_canvas36.wouldCreateComponentCycle,
399
- wrapAnimationTime: () => import_canvas35.wrapAnimationTime,
400
- writeNodeStyleProperty: () => import_canvas34.writeNodeStyleProperty,
401
- xToTime: () => import_canvas35.xToTime,
402
- xorPolygons: () => import_canvas30.xorPolygons
402
+ validateCanvasBrush: () => import_canvas38.validateCanvasBrush,
403
+ validateCanvasBrushPaint: () => import_canvas38.validateCanvasBrushPaint,
404
+ withNodeAnimation: () => import_canvas37.withNodeAnimation,
405
+ withStyleSize: () => import_canvas31.withStyleSize,
406
+ wouldCreateComponentCycle: () => import_canvas38.wouldCreateComponentCycle,
407
+ wrapAnimationTime: () => import_canvas37.wrapAnimationTime,
408
+ writeNodeStyleProperty: () => import_canvas36.writeNodeStyleProperty,
409
+ xToTime: () => import_canvas37.xToTime,
410
+ xorPolygons: () => import_canvas32.xorPolygons
403
411
  });
404
412
  module.exports = __toCommonJS(canvas_exports);
405
413
 
@@ -1161,75 +1169,89 @@ function mergeById(base, updated) {
1161
1169
  const byId = new Map(updated.map((n) => [n.id, n]));
1162
1170
  return base.map((n) => byId.get(n.id) ?? n);
1163
1171
  }
1164
- function useCanvasExplosion(target) {
1172
+ function useCanvasExplosion(target, hookOptions = {}) {
1165
1173
  const snapshotsRef = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
1174
+ const cancelRef = (0, import_react11.useRef)(null);
1175
+ const [explodedNodeIds, setExplodedNodeIds] = (0, import_react11.useState)([]);
1176
+ const optionsRef = (0, import_react11.useRef)(hookOptions);
1177
+ optionsRef.current = hookOptions;
1178
+ (0, import_react11.useEffect)(() => () => cancelRef.current?.(), []);
1179
+ const run = (transitions, base, duration, onComplete) => {
1180
+ cancelRef.current?.();
1181
+ cancelRef.current = (0, import_canvas6.runMultiNodeTransition)(transitions, {
1182
+ styleFormat: "object",
1183
+ defaultDuration: duration,
1184
+ onUpdate: (updated) => target.setNodes(mergeById(base, updated)),
1185
+ onComplete: () => {
1186
+ cancelRef.current = null;
1187
+ onComplete();
1188
+ }
1189
+ });
1190
+ };
1166
1191
  const explodeNode = (0, import_react11.useCallback)(
1167
1192
  (parentNodeId, options) => {
1168
1193
  const { nodes, edges, setNodes, setEdges } = target;
1194
+ if (snapshotsRef.current.has(parentNodeId)) return false;
1169
1195
  const parent = nodes.find((n) => n.id === parentNodeId);
1170
- if (!parent || options.childNodes.length === 0) return;
1171
- const originPos = { ...parent.position };
1172
- const displacedMap = options.displacementStrategy === "directional" ? (0, import_canvas6.calculateDirectionalDisplacement)({
1196
+ if (!parent || options.childNodes.length === 0) return false;
1197
+ const {
1198
+ connectParentToChildren = "all",
1199
+ displacementStrategy = "directional",
1200
+ duration = 500,
1201
+ staggerDelay = 20,
1202
+ easing
1203
+ } = options;
1204
+ const layout = (0, import_canvas6.computeCanvasExplosionLayout)({
1173
1205
  existingNodes: nodes,
1206
+ existingEdges: edges,
1174
1207
  originNode: parent,
1175
1208
  childNodes: options.childNodes,
1176
- options: options.directionalOptions
1177
- }) : /* @__PURE__ */ new Map();
1178
- const snapshot = {
1209
+ childEdges: options.childEdges,
1210
+ strategy: displacementStrategy,
1211
+ options: options.directionalOptions,
1212
+ reflowOptions: options.reflowOptions,
1213
+ connectParentToChildren,
1214
+ createEdge: target.createEdge,
1215
+ getNodesBounds: optionsRef.current.getNodesBounds
1216
+ });
1217
+ snapshotsRef.current.set(parentNodeId, {
1179
1218
  parentId: parentNodeId,
1180
- childNodeIds: options.childNodes.map((c) => c.id),
1181
- childEdgeIds: (options.childEdges ?? []).map((e) => e.id),
1182
- displacedNodes: Array.from(displacedMap.entries()).map(([id]) => {
1183
- const node = nodes.find((n) => n.id === id);
1184
- return { id, originalPosition: { ...node.position } };
1185
- }),
1219
+ childNodeIds: layout.childNodes.map((c) => c.id),
1220
+ childEdgeIds: layout.childEdges.map((e) => e.id),
1221
+ displacedNodes: [...layout.originalPositions].map(([id, originalPosition]) => ({ id, originalPosition })),
1186
1222
  timestamp: Date.now()
1187
- };
1188
- snapshotsRef.current.set(parentNodeId, snapshot);
1189
- const initialChildren = options.childNodes.map((child) => ({
1190
- ...child,
1191
- position: { ...originPos }
1192
- }));
1223
+ });
1224
+ const originPos = { ...parent.position };
1225
+ const initialChildren = layout.childNodes.map((child) => ({ ...child, position: { ...originPos } }));
1193
1226
  const mergedNodes = [...nodes, ...initialChildren];
1194
1227
  setNodes(mergedNodes);
1195
- if (options.childEdges && options.childEdges.length > 0) {
1196
- setEdges((prev) => [...prev, ...options.childEdges]);
1197
- }
1198
- const trajectory = options.trajectory ?? (0, import_canvas6.createFanOutTrajectory)();
1228
+ if (layout.childEdges.length > 0) setEdges((prev) => [...prev, ...layout.childEdges]);
1229
+ const trajectory = options.trajectory ?? (0, import_canvas6.createFanOutTrajectory)({ curvature: 0.35 });
1230
+ const stagger = duration === 0 ? 0 : staggerDelay;
1199
1231
  const transitions = [];
1200
- options.childNodes.forEach((child, index) => {
1201
- const liveChild = mergedNodes.find((n) => n.id === child.id);
1202
- if (liveChild) {
1203
- transitions.push({
1204
- node: liveChild,
1205
- from: originPos,
1206
- to: child.position,
1207
- trajectory,
1208
- index,
1209
- total: options.childNodes.length,
1210
- duration: options.duration ?? 400,
1211
- easing: options.easing
1212
- });
1213
- }
1232
+ layout.childNodes.forEach((child, index) => {
1233
+ transitions.push({
1234
+ node: initialChildren[index],
1235
+ from: originPos,
1236
+ to: child.position,
1237
+ trajectory,
1238
+ delay: index * stagger,
1239
+ index,
1240
+ total: layout.childNodes.length,
1241
+ duration,
1242
+ easing
1243
+ });
1214
1244
  });
1215
- displacedMap.forEach((targetPos, nodeId) => {
1245
+ layout.displacedPositions.forEach((to, nodeId) => {
1216
1246
  const node = mergedNodes.find((n) => n.id === nodeId);
1217
- if (node) {
1218
- transitions.push({
1219
- node,
1220
- from: { ...node.position },
1221
- to: targetPos,
1222
- trajectory: import_canvas6.linearPositionTrajectory,
1223
- duration: options.duration ?? 400,
1224
- easing: options.easing
1225
- });
1226
- }
1247
+ if (node) transitions.push({ node, from: { ...node.position }, to, trajectory: import_canvas6.linearPositionTrajectory, duration, easing });
1227
1248
  });
1228
- (0, import_canvas6.runMultiNodeTransition)(transitions, {
1229
- styleFormat: "object",
1230
- onUpdate: (updated) => setNodes(mergeById(mergedNodes, updated)),
1231
- onComplete: () => options.onComplete?.()
1249
+ run(transitions, mergedNodes, duration, () => {
1250
+ setExplodedNodeIds((prev) => prev.includes(parentNodeId) ? prev : [...prev, parentNodeId]);
1251
+ optionsRef.current.onSave?.();
1252
+ options.onComplete?.();
1232
1253
  });
1254
+ return true;
1233
1255
  },
1234
1256
  [target]
1235
1257
  );
@@ -1237,69 +1259,114 @@ function useCanvasExplosion(target) {
1237
1259
  (parentNodeId, options = {}) => {
1238
1260
  const { nodes, setNodes, setEdges } = target;
1239
1261
  const snapshot = snapshotsRef.current.get(parentNodeId);
1240
- if (!snapshot) return;
1262
+ if (!snapshot) return false;
1241
1263
  const parent = nodes.find((n) => n.id === parentNodeId);
1242
1264
  const originPos = parent ? { ...parent.position } : { x: 0, y: 0 };
1243
1265
  const childIdSet = new Set(snapshot.childNodeIds);
1244
1266
  const edgeIdSet = new Set(snapshot.childEdgeIds);
1245
- const transitions = [];
1246
- nodes.forEach((node) => {
1247
- if (childIdSet.has(node.id)) {
1248
- transitions.push({
1249
- node,
1250
- from: { ...node.position },
1251
- to: originPos,
1252
- duration: options.duration ?? 300,
1253
- easing: options.easing,
1254
- trajectory: options.trajectory
1255
- });
1256
- }
1257
- });
1267
+ const { duration = 400, staggerDelay = 15, easing } = options;
1268
+ const trajectory = options.trajectory ?? (0, import_canvas6.createFanOutTrajectory)({ curvature: 0.2, startScale: 1, endScale: 0, startOpacity: 1, endOpacity: 0 });
1269
+ const stagger = duration === 0 ? 0 : staggerDelay;
1270
+ const children = nodes.filter((n) => childIdSet.has(n.id));
1271
+ const transitions = children.map((node, i) => ({
1272
+ node,
1273
+ from: { ...node.position },
1274
+ to: originPos,
1275
+ trajectory,
1276
+ delay: (children.length - 1 - i) * stagger,
1277
+ index: i,
1278
+ total: children.length,
1279
+ duration,
1280
+ easing
1281
+ }));
1258
1282
  snapshot.displacedNodes.forEach((disp) => {
1259
1283
  const node = nodes.find((n) => n.id === disp.id);
1260
1284
  if (node) {
1261
- transitions.push({
1262
- node,
1263
- from: { ...node.position },
1264
- to: disp.originalPosition,
1265
- duration: options.duration ?? 300,
1266
- easing: options.easing,
1267
- trajectory: import_canvas6.linearPositionTrajectory
1268
- });
1285
+ transitions.push({ node, from: { ...node.position }, to: disp.originalPosition, trajectory: import_canvas6.linearPositionTrajectory, duration, easing });
1269
1286
  }
1270
1287
  });
1271
- (0, import_canvas6.runMultiNodeTransition)(transitions, {
1272
- styleFormat: "object",
1273
- onUpdate: (updated) => setNodes(mergeById(nodes, updated)),
1274
- onComplete: () => {
1275
- setNodes((prev) => prev.filter((n) => !childIdSet.has(n.id)));
1276
- setEdges((prev) => prev.filter((e) => !edgeIdSet.has(e.id)));
1277
- snapshotsRef.current.delete(parentNodeId);
1278
- options.onComplete?.();
1279
- }
1288
+ run(transitions, nodes, duration, () => {
1289
+ const restore = new Map(snapshot.displacedNodes.map((d) => [d.id, d.originalPosition]));
1290
+ setNodes(
1291
+ (prev) => prev.filter((n) => !childIdSet.has(n.id)).map((n) => restore.has(n.id) ? { ...n, position: { ...restore.get(n.id) } } : n)
1292
+ );
1293
+ setEdges((prev) => prev.filter((e) => !edgeIdSet.has(e.id)));
1294
+ snapshotsRef.current.delete(parentNodeId);
1295
+ setExplodedNodeIds((prev) => prev.filter((id) => id !== parentNodeId));
1296
+ optionsRef.current.onSave?.();
1297
+ options.onComplete?.();
1280
1298
  });
1299
+ return true;
1281
1300
  },
1282
1301
  [target]
1283
1302
  );
1303
+ const toggleExplode = (0, import_react11.useCallback)(
1304
+ (parentNodeId, explodeOptions, collapseOptions) => snapshotsRef.current.has(parentNodeId) ? collapseNode(parentNodeId, collapseOptions) : explodeNode(parentNodeId, explodeOptions),
1305
+ [explodeNode, collapseNode]
1306
+ );
1284
1307
  return {
1308
+ /** Ids of nodes whose explosion animation has finished (and not yet collapsed). */
1309
+ explodedNodeIds,
1285
1310
  explodeNode,
1286
1311
  collapseNode,
1287
- isExploded: (parentNodeId) => snapshotsRef.current.has(parentNodeId),
1312
+ toggleExplode,
1313
+ /** True once the node's explosion has finished, until a collapse finishes. */
1314
+ isExploded: (parentNodeId) => explodedNodeIds.includes(parentNodeId),
1288
1315
  getSnapshot: (parentNodeId) => snapshotsRef.current.get(parentNodeId)
1289
1316
  };
1290
1317
  }
1291
1318
 
1292
- // src/canvas/useCanvasArrange.ts
1319
+ // src/canvas/useCanvasExplosionState.ts
1293
1320
  var import_react12 = require("react");
1294
1321
  var import_canvas7 = require("@pixerate/editor/canvas");
1322
+ function useCanvasExplosionState(options = {}) {
1323
+ const optionsRef = (0, import_react12.useRef)(options);
1324
+ optionsRef.current = options;
1325
+ const controllerRef = (0, import_react12.useRef)(null);
1326
+ if (controllerRef.current === null) {
1327
+ controllerRef.current = (0, import_canvas7.createCanvasExplosionStateController)({
1328
+ collapseDurationMs: options.collapseDurationMs,
1329
+ initialActiveId: options.initialActiveId,
1330
+ onExplode: (id) => optionsRef.current.onExplode?.(id),
1331
+ onCollapse: (id) => optionsRef.current.onCollapse?.(id)
1332
+ });
1333
+ }
1334
+ const controller = controllerRef.current;
1335
+ (0, import_react12.useEffect)(() => () => controller.finishCollapse(), [controller]);
1336
+ const snapshot = (0, import_react12.useSyncExternalStore)(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
1337
+ return (0, import_react12.useMemo)(
1338
+ () => ({
1339
+ controller,
1340
+ activeId: snapshot.activeId,
1341
+ collapsingId: snapshot.collapsingId,
1342
+ isExplodingOrCollapsing: snapshot.activeId !== null || snapshot.collapsingId !== null,
1343
+ isExploded: (nodeId) => snapshot.activeId === nodeId,
1344
+ isCollapsing: (nodeId) => snapshot.collapsingId === nodeId,
1345
+ shouldRenderChildren: (nodeId) => snapshot.activeId === nodeId || snapshot.collapsingId === nodeId,
1346
+ explode: (nodeId) => controller.explode(nodeId),
1347
+ collapse: (nodeId) => controller.collapse(nodeId),
1348
+ toggle: (nodeId) => controller.toggle(nodeId),
1349
+ finishCollapse: () => controller.finishCollapse(),
1350
+ destroy: () => controller.destroy()
1351
+ }),
1352
+ [controller, snapshot]
1353
+ );
1354
+ }
1355
+
1356
+ // src/canvas/index.ts
1357
+ var import_canvas29 = require("@pixerate/editor/canvas");
1358
+
1359
+ // src/canvas/useCanvasArrange.ts
1360
+ var import_react13 = require("react");
1361
+ var import_canvas8 = require("@pixerate/editor/canvas");
1295
1362
  function useCanvasArrange(options) {
1296
- const [guides, setGuides] = (0, import_react12.useState)([]);
1297
- const nodesRef = (0, import_react12.useRef)(options.nodes);
1363
+ const [guides, setGuides] = (0, import_react13.useState)([]);
1364
+ const nodesRef = (0, import_react13.useRef)(options.nodes);
1298
1365
  nodesRef.current = options.nodes;
1299
- const optionsRef = (0, import_react12.useRef)(options);
1366
+ const optionsRef = (0, import_react13.useRef)(options);
1300
1367
  optionsRef.current = options;
1301
- const controller = (0, import_react12.useMemo)(
1302
- () => (0, import_canvas7.createCanvasArrangeController)({
1368
+ const controller = (0, import_react13.useMemo)(
1369
+ () => (0, import_canvas8.createCanvasArrangeController)({
1303
1370
  getNodes: () => nodesRef.current,
1304
1371
  setNodes: (next) => {
1305
1372
  nodesRef.current = next;
@@ -1326,19 +1393,19 @@ function useCanvasArrange(options) {
1326
1393
  }),
1327
1394
  []
1328
1395
  );
1329
- return (0, import_react12.useMemo)(() => ({ ...controller, guides }), [controller, guides]);
1396
+ return (0, import_react13.useMemo)(() => ({ ...controller, guides }), [controller, guides]);
1330
1397
  }
1331
1398
  function useCanvasArrangeShortcuts(options) {
1332
- const optionsRef = (0, import_react12.useRef)(options);
1399
+ const optionsRef = (0, import_react13.useRef)(options);
1333
1400
  optionsRef.current = options;
1334
1401
  const { targetElement, enabled = true } = options;
1335
- (0, import_react12.useEffect)(() => {
1402
+ (0, import_react13.useEffect)(() => {
1336
1403
  if (!enabled) return;
1337
1404
  const target = targetElement ?? (typeof window !== "undefined" ? window : null);
1338
1405
  if (!target) return;
1339
1406
  function handleKeyDown(event) {
1340
1407
  const { arrange, scenes, bindings } = optionsRef.current;
1341
- const action = (0, import_canvas7.matchArrangeShortcut)(event, bindings);
1408
+ const action = (0, import_canvas8.matchArrangeShortcut)(event, bindings);
1342
1409
  if (!action) return;
1343
1410
  let handled = false;
1344
1411
  if (action === "nextScene" || action === "previousScene") {
@@ -1357,27 +1424,27 @@ function useCanvasArrangeShortcuts(options) {
1357
1424
  }
1358
1425
 
1359
1426
  // src/canvas/useCanvasScenes.ts
1360
- var import_react13 = require("react");
1361
- var import_canvas8 = require("@pixerate/editor/canvas");
1427
+ var import_react14 = require("react");
1428
+ var import_canvas9 = require("@pixerate/editor/canvas");
1362
1429
  function useCanvasScenes(options = {}) {
1363
- const optionsRef = (0, import_react13.useRef)(options);
1430
+ const optionsRef = (0, import_react14.useRef)(options);
1364
1431
  optionsRef.current = options;
1365
- const storeRef = (0, import_react13.useRef)(null);
1366
- if (!storeRef.current) storeRef.current = options.store ?? new import_canvas8.CanvasScenesStore(options);
1432
+ const storeRef = (0, import_react14.useRef)(null);
1433
+ if (!storeRef.current) storeRef.current = options.store ?? new import_canvas9.CanvasScenesStore(options);
1367
1434
  const store = storeRef.current;
1368
- const state = (0, import_react13.useSyncExternalStore)(
1435
+ const state = (0, import_react14.useSyncExternalStore)(
1369
1436
  (listener) => store.subscribe(listener),
1370
1437
  () => store.getState(),
1371
1438
  () => store.getState()
1372
1439
  );
1373
- const actions = (0, import_react13.useMemo)(() => {
1440
+ const actions = (0, import_react14.useMemo)(() => {
1374
1441
  const show = (scene) => {
1375
1442
  if (!scene) return scene;
1376
1443
  const o = optionsRef.current;
1377
1444
  const provider = o.transitions?.provider;
1378
1445
  const element = o.transitions?.element();
1379
1446
  if (scene.transition && provider && element) {
1380
- void (0, import_canvas8.transitionCanvasView)({ provider, transition: scene.transition, element, jump: () => o.setViewport?.(scene.viewport, { duration: 0 }) });
1447
+ void (0, import_canvas9.transitionCanvasView)({ provider, transition: scene.transition, element, jump: () => o.setViewport?.(scene.viewport, { duration: 0 }) });
1381
1448
  } else o.setViewport?.(scene.viewport, { duration: o.duration ?? 300 });
1382
1449
  return scene;
1383
1450
  };
@@ -1391,7 +1458,7 @@ function useCanvasScenes(options = {}) {
1391
1458
  },
1392
1459
  /** Saves a scene framing the given nodes in a container of `size`. */
1393
1460
  captureNodes(nodes, ids, size, name, fit) {
1394
- const viewport = (0, import_canvas8.fitViewportToNodes)(nodes, size, ids, fit);
1461
+ const viewport = (0, import_canvas9.fitViewportToNodes)(nodes, size, ids, fit);
1395
1462
  return viewport ? store.add({ viewport, name, nodeIds: ids }) : void 0;
1396
1463
  },
1397
1464
  /** Replaces a scene's viewport with the live one. */
@@ -1423,15 +1490,15 @@ function useCanvasScenes(options = {}) {
1423
1490
  }
1424
1491
 
1425
1492
  // src/canvas/useCanvasCapture.ts
1426
- var import_react14 = require("react");
1427
- var import_canvas9 = require("@pixerate/editor/canvas");
1493
+ var import_react15 = require("react");
1494
+ var import_canvas10 = require("@pixerate/editor/canvas");
1428
1495
  var import_tools3 = require("@pixerate/editor/tools");
1429
1496
  function useCanvasCapture(options) {
1430
- const optionsRef = (0, import_react14.useRef)(options);
1497
+ const optionsRef = (0, import_react15.useRef)(options);
1431
1498
  optionsRef.current = options;
1432
- return (0, import_react14.useMemo)(() => {
1499
+ return (0, import_react15.useMemo)(() => {
1433
1500
  const latest = () => optionsRef.current;
1434
- return (0, import_canvas9.createCanvasCaptureToolProvider)({
1501
+ return (0, import_canvas10.createCanvasCaptureToolProvider)({
1435
1502
  ...options,
1436
1503
  element: () => {
1437
1504
  const el = latest().element;
@@ -1441,25 +1508,25 @@ function useCanvasCapture(options) {
1441
1508
  },
1442
1509
  getViewport: () => latest().getViewport(),
1443
1510
  getNodes: () => latest().getNodes(),
1444
- getNodeRect: (node, nodes) => (latest().getNodeRect ?? import_canvas9.canvasNodeCaptureRect)(node, nodes),
1511
+ getNodeRect: (node, nodes) => (latest().getNodeRect ?? import_canvas10.canvasNodeCaptureRect)(node, nodes),
1445
1512
  rasterize: (element, raster) => (latest().rasterize ?? import_tools3.rasterizeElement)(element, raster)
1446
1513
  });
1447
1514
  }, [options.id, options.namespace]);
1448
1515
  }
1449
1516
 
1450
1517
  // src/canvas/useCanvasEditorDocument.ts
1451
- var import_react15 = require("react");
1452
- var import_canvas10 = require("@pixerate/editor/canvas");
1518
+ var import_react16 = require("react");
1519
+ var import_canvas11 = require("@pixerate/editor/canvas");
1453
1520
  var contentKey = (nodes, edges) => JSON.stringify([
1454
1521
  nodes.map(({ selected: _s, dragging: _d, measured: _m, resizing: _r, ...rest }) => rest),
1455
1522
  edges.map(({ selected: _s, ...rest }) => rest)
1456
1523
  ]);
1457
1524
  function useCanvasEditorDocument(options) {
1458
- const latest = (0, import_react15.useRef)(options);
1525
+ const latest = (0, import_react16.useRef)(options);
1459
1526
  latest.current = options;
1460
- const listeners = (0, import_react15.useRef)(/* @__PURE__ */ new Set());
1461
- const doc = (0, import_react15.useMemo)(
1462
- () => (0, import_canvas10.createCanvasEditorDocument)({
1527
+ const listeners = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
1528
+ const doc = (0, import_react16.useMemo)(
1529
+ () => (0, import_canvas11.createCanvasEditorDocument)({
1463
1530
  getNodes: () => latest.current.nodes,
1464
1531
  setNodes: (nodes) => latest.current.setNodes(nodes),
1465
1532
  getEdges: () => latest.current.edges,
@@ -1475,9 +1542,9 @@ function useCanvasEditorDocument(options) {
1475
1542
  // eslint-disable-next-line react-hooks/exhaustive-deps
1476
1543
  [options.history, options.scenes]
1477
1544
  );
1478
- (0, import_react15.useEffect)(() => () => doc.destroy(), [doc]);
1479
- const lastKey = (0, import_react15.useRef)(null);
1480
- (0, import_react15.useEffect)(() => {
1545
+ (0, import_react16.useEffect)(() => () => doc.destroy(), [doc]);
1546
+ const lastKey = (0, import_react16.useRef)(null);
1547
+ (0, import_react16.useEffect)(() => {
1481
1548
  if (options.nodes.some((n) => n.dragging)) return;
1482
1549
  const key = contentKey(options.nodes, options.edges);
1483
1550
  if (lastKey.current !== null && key !== lastKey.current) listeners.current.forEach((listener) => listener());
@@ -1570,17 +1637,17 @@ function CanvasGuidesLayer({
1570
1637
  }
1571
1638
 
1572
1639
  // src/canvas/useCanvasDraw.ts
1573
- var import_react16 = require("react");
1574
- var import_canvas11 = require("@pixerate/editor/canvas");
1640
+ var import_react17 = require("react");
1641
+ var import_canvas12 = require("@pixerate/editor/canvas");
1575
1642
  function useCanvasDraw(options) {
1576
- const nodesRef = (0, import_react16.useRef)(options.nodes);
1643
+ const nodesRef = (0, import_react17.useRef)(options.nodes);
1577
1644
  nodesRef.current = options.nodes;
1578
- const optionsRef = (0, import_react16.useRef)(options);
1645
+ const optionsRef = (0, import_react17.useRef)(options);
1579
1646
  optionsRef.current = options;
1580
- const [tool, setToolState] = (0, import_react16.useState)(options.initialTool ?? "select");
1581
- const [activeStroke, setActiveStroke] = (0, import_react16.useState)(null);
1582
- const controller = (0, import_react16.useMemo)(
1583
- () => (0, import_canvas11.createCanvasDrawController)({
1647
+ const [tool, setToolState] = (0, import_react17.useState)(options.initialTool ?? "select");
1648
+ const [activeStroke, setActiveStroke] = (0, import_react17.useState)(null);
1649
+ const controller = (0, import_react17.useMemo)(
1650
+ () => (0, import_canvas12.createCanvasDrawController)({
1584
1651
  getNodes: () => nodesRef.current,
1585
1652
  setNodes: (next) => {
1586
1653
  nodesRef.current = next;
@@ -1601,13 +1668,13 @@ function useCanvasDraw(options) {
1601
1668
  }),
1602
1669
  []
1603
1670
  );
1604
- const [style, setStyleState] = (0, import_react16.useState)(controller.style);
1605
- (0, import_react16.useEffect)(() => {
1671
+ const [style, setStyleState] = (0, import_react17.useState)(controller.style);
1672
+ (0, import_react17.useEffect)(() => {
1606
1673
  if (options.initialTool && options.initialTool !== controller.tool) {
1607
1674
  controller.setTool(options.initialTool);
1608
1675
  }
1609
1676
  }, [options.initialTool, controller]);
1610
- return (0, import_react16.useMemo)(
1677
+ return (0, import_react17.useMemo)(
1611
1678
  () => ({
1612
1679
  tool,
1613
1680
  style,
@@ -1628,8 +1695,8 @@ function useCanvasDraw(options) {
1628
1695
  }
1629
1696
 
1630
1697
  // src/canvas/CanvasDrawLayer.tsx
1631
- var import_react17 = require("react");
1632
- var import_canvas12 = require("@pixerate/editor/canvas");
1698
+ var import_react18 = require("react");
1699
+ var import_canvas13 = require("@pixerate/editor/canvas");
1633
1700
  var import_jsx_runtime5 = require("react/jsx-runtime");
1634
1701
  var DEFAULT_VIEWPORT2 = { x: 0, y: 0, zoom: 1 };
1635
1702
  function CanvasDrawLayer({
@@ -1640,10 +1707,10 @@ function CanvasDrawLayer({
1640
1707
  cursor,
1641
1708
  eraserRadius = 12
1642
1709
  }) {
1643
- const svgRef = (0, import_react17.useRef)(null);
1644
- const [spaceHeld, setSpaceHeld] = (0, import_react17.useState)(false);
1645
- const [eraserPos, setEraserPos] = (0, import_react17.useState)(null);
1646
- (0, import_react17.useEffect)(() => {
1710
+ const svgRef = (0, import_react18.useRef)(null);
1711
+ const [spaceHeld, setSpaceHeld] = (0, import_react18.useState)(false);
1712
+ const [eraserPos, setEraserPos] = (0, import_react18.useState)(null);
1713
+ (0, import_react18.useEffect)(() => {
1647
1714
  function onKeyDown(e) {
1648
1715
  if (e.code === "Space" && !e.repeat) {
1649
1716
  const tag = e.target?.tagName;
@@ -1665,7 +1732,7 @@ function CanvasDrawLayer({
1665
1732
  window.removeEventListener("keyup", onKeyUp);
1666
1733
  };
1667
1734
  }, []);
1668
- const clientToFlow = (0, import_react17.useCallback)(
1735
+ const clientToFlow = (0, import_react18.useCallback)(
1669
1736
  (clientX, clientY) => {
1670
1737
  if (!svgRef.current) return [0, 0];
1671
1738
  const rect = svgRef.current.getBoundingClientRect();
@@ -1685,7 +1752,7 @@ function CanvasDrawLayer({
1685
1752
  e.stopPropagation();
1686
1753
  e.target.setPointerCapture?.(e.pointerId);
1687
1754
  const flowPt = clientToFlow(e.clientX, e.clientY);
1688
- draw.startStroke(flowPt, (0, import_canvas12.pointerPenSample)(e));
1755
+ draw.startStroke(flowPt, (0, import_canvas13.pointerPenSample)(e));
1689
1756
  if (draw.tool === "eraser") {
1690
1757
  setEraserPos([e.clientX, e.clientY]);
1691
1758
  }
@@ -1700,7 +1767,7 @@ function CanvasDrawLayer({
1700
1767
  e.stopPropagation();
1701
1768
  const events = draw.style.brush !== void 0 ? e.nativeEvent.getCoalescedEvents?.() ?? [] : [];
1702
1769
  for (const ev of events.length ? events : [e.nativeEvent]) {
1703
- draw.continueStroke(clientToFlow(ev.clientX, ev.clientY), (0, import_canvas12.pointerPenSample)(ev));
1770
+ draw.continueStroke(clientToFlow(ev.clientX, ev.clientY), (0, import_canvas13.pointerPenSample)(ev));
1704
1771
  }
1705
1772
  }
1706
1773
  };
@@ -1718,9 +1785,9 @@ function CanvasDrawLayer({
1718
1785
  setEraserPos(null);
1719
1786
  };
1720
1787
  const resolvedCursor = cursor ? cursor : spaceHeld ? "grab" : draw.tool === "eraser" ? "crosshair" : draw.tool === "pen" || draw.tool === "highlighter" ? "crosshair" : "default";
1721
- const strokePath = draw.activeStroke ? (0, import_canvas12.strokePointsToPathData)(draw.activeStroke.points) : null;
1722
- const activeGradient = draw.activeStroke ? (0, import_canvas12.resolveCanvasGradient)(draw.activeStroke.style.gradient ?? draw.activeStroke.style.color) : null;
1723
- const resolvedGradientDef = activeGradient ? (0, import_canvas12.gradientToSvgDef)(activeGradient, "active-draw-stroke-gradient") : null;
1788
+ const strokePath = draw.activeStroke ? (0, import_canvas13.strokePointsToPathData)(draw.activeStroke.points) : null;
1789
+ const activeGradient = draw.activeStroke ? (0, import_canvas13.resolveCanvasGradient)(draw.activeStroke.style.gradient ?? draw.activeStroke.style.color) : null;
1790
+ const resolvedGradientDef = activeGradient ? (0, import_canvas13.gradientToSvgDef)(activeGradient, "active-draw-stroke-gradient") : null;
1724
1791
  const strokePaint = resolvedGradientDef ? `url(#${resolvedGradientDef.id})` : draw.activeStroke ? draw.activeStroke.style.color : "currentColor";
1725
1792
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1726
1793
  "svg",
@@ -1780,20 +1847,20 @@ function CanvasDrawLayer({
1780
1847
  }
1781
1848
 
1782
1849
  // src/canvas/useCanvasMeasure.ts
1783
- var import_react18 = require("react");
1784
- var import_canvas13 = require("@pixerate/editor/canvas");
1850
+ var import_react19 = require("react");
1851
+ var import_canvas14 = require("@pixerate/editor/canvas");
1785
1852
  var EMPTY = { guides: [], target: null, selection: null };
1786
1853
  function useCanvasMeasure(options) {
1787
1854
  const { nodes, enabled = true, requireModifier = true, targetElement, rectOptions } = options;
1788
- const [hoveredId, setHoveredId] = (0, import_react18.useState)(null);
1789
- const [modifier, setModifier] = (0, import_react18.useState)(false);
1790
- const optionsRef = (0, import_react18.useRef)(options);
1855
+ const [hoveredId, setHoveredId] = (0, import_react19.useState)(null);
1856
+ const [modifier, setModifier] = (0, import_react19.useState)(false);
1857
+ const optionsRef = (0, import_react19.useRef)(options);
1791
1858
  optionsRef.current = options;
1792
- (0, import_react18.useEffect)(() => {
1859
+ (0, import_react19.useEffect)(() => {
1793
1860
  if (!enabled) return;
1794
1861
  const target = targetElement ?? (typeof window !== "undefined" ? window : null);
1795
1862
  if (!target) return;
1796
- const onKey = (event) => setModifier((0, import_canvas13.isMeasureModifierHeld)(event));
1863
+ const onKey = (event) => setModifier((0, import_canvas14.isMeasureModifierHeld)(event));
1797
1864
  const onBlur = () => setModifier(false);
1798
1865
  target.addEventListener("keydown", onKey);
1799
1866
  target.addEventListener("keyup", onKey);
@@ -1806,16 +1873,16 @@ function useCanvasMeasure(options) {
1806
1873
  };
1807
1874
  }, [enabled, targetElement]);
1808
1875
  const active = enabled && (!requireModifier || modifier);
1809
- const result = (0, import_react18.useMemo)(() => {
1876
+ const result = (0, import_react19.useMemo)(() => {
1810
1877
  if (!active) return EMPTY;
1811
1878
  const ids = optionsRef.current.getSelectedIds?.() ?? nodes.filter((n) => n.selected).map((n) => n.id);
1812
- return (0, import_canvas13.measureSelection)(nodes, ids, hoveredId, rectOptions);
1879
+ return (0, import_canvas14.measureSelection)(nodes, ids, hoveredId, rectOptions);
1813
1880
  }, [active, nodes, hoveredId, rectOptions]);
1814
- const onNodeMouseEnter = (0, import_react18.useCallback)((event, node) => {
1881
+ const onNodeMouseEnter = (0, import_react19.useCallback)((event, node) => {
1815
1882
  setHoveredId(node.id);
1816
1883
  if (event && typeof event.altKey === "boolean") setModifier(event.altKey);
1817
1884
  }, []);
1818
- const onNodeMouseLeave = (0, import_react18.useCallback)((_event, node) => {
1885
+ const onNodeMouseLeave = (0, import_react19.useCallback)((_event, node) => {
1819
1886
  setHoveredId((current) => current === node.id ? null : current);
1820
1887
  }, []);
1821
1888
  return {
@@ -1835,39 +1902,39 @@ function useCanvasMeasure(options) {
1835
1902
  }
1836
1903
 
1837
1904
  // src/canvas/index.ts
1838
- var import_canvas28 = require("@pixerate/editor/canvas");
1839
- var import_canvas29 = require("@pixerate/editor/canvas");
1905
+ var import_canvas30 = require("@pixerate/editor/canvas");
1906
+ var import_canvas31 = require("@pixerate/editor/canvas");
1840
1907
 
1841
1908
  // src/canvas/ShapeNode.tsx
1842
- var import_canvas16 = require("@pixerate/editor/canvas");
1909
+ var import_canvas17 = require("@pixerate/editor/canvas");
1843
1910
 
1844
1911
  // src/canvas/useShapeBrushstroke.tsx
1845
- var import_react19 = require("react");
1846
- var import_canvas14 = require("@pixerate/editor/canvas");
1912
+ var import_react20 = require("react");
1913
+ var import_canvas15 = require("@pixerate/editor/canvas");
1847
1914
  var import_jsx_runtime6 = require("react/jsx-runtime");
1848
- var ShapeNodeZoomContext = (0, import_react19.createContext)(1);
1915
+ var ShapeNodeZoomContext = (0, import_react20.createContext)(1);
1849
1916
  function ShapeNodeZoomProvider({ zoom, children }) {
1850
- const bucket = (0, import_canvas14.brushstrokeScaleBucket)(zoom);
1917
+ const bucket = (0, import_canvas15.brushstrokeScaleBucket)(zoom);
1851
1918
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ShapeNodeZoomContext.Provider, { value: bucket, children });
1852
1919
  }
1853
1920
  function useShapeBrushstroke(shape, width, height, position) {
1854
- const zoom = (0, import_react19.useContext)(ShapeNodeZoomContext);
1855
- const brushed = (0, import_canvas14.isBrushedShape)(shape) ? shape : null;
1921
+ const zoom = (0, import_react20.useContext)(ShapeNodeZoomContext);
1922
+ const brushed = (0, import_canvas15.isBrushedShape)(shape) ? shape : null;
1856
1923
  const vb = brushed?.viewBox;
1857
1924
  const nodeScale = vb && width && height && vb[2] > 0 && vb[3] > 0 ? Math.max(width / vb[2], height / vb[3]) : 1;
1858
1925
  const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
1859
- const scale = (0, import_canvas14.brushstrokeScaleBucket)(zoom * nodeScale, dpr);
1926
+ const scale = (0, import_canvas15.brushstrokeScaleBucket)(zoom * nodeScale, dpr);
1860
1927
  const unit = vb && width && vb[2] > 0 ? width / vb[2] : 1;
1861
1928
  const ox = Math.round((position?.x ?? 0) - (vb?.[0] ?? 0) * unit);
1862
1929
  const oy = Math.round((position?.y ?? 0) - (vb?.[1] ?? 0) * unit);
1863
- const [image, setImage] = (0, import_react19.useState)(null);
1864
- (0, import_react19.useEffect)(() => {
1930
+ const [image, setImage] = (0, import_react20.useState)(null);
1931
+ (0, import_react20.useEffect)(() => {
1865
1932
  if (!brushed) {
1866
1933
  setImage(null);
1867
1934
  return;
1868
1935
  }
1869
1936
  let live = true;
1870
- (0, import_canvas14.renderShapeBrushstroke)(brushed, { scale, origin: { x: ox, y: oy }, unit }).then(
1937
+ (0, import_canvas15.renderShapeBrushstroke)(brushed, { scale, origin: { x: ox, y: oy }, unit }).then(
1871
1938
  (img) => live && setImage(img),
1872
1939
  (error) => {
1873
1940
  if (!live) return;
@@ -1882,12 +1949,12 @@ function useShapeBrushstroke(shape, width, height, position) {
1882
1949
  return image;
1883
1950
  }
1884
1951
  function useCanvasBrushes(options = {}) {
1885
- const [state, setState] = (0, import_react19.useState)({ brushes: [], loading: true, error: null });
1952
+ const [state, setState] = (0, import_react20.useState)({ brushes: [], loading: true, error: null });
1886
1953
  const swatches = options.swatches ? JSON.stringify(options.swatches) : "";
1887
- (0, import_react19.useEffect)(() => {
1954
+ (0, import_react20.useEffect)(() => {
1888
1955
  let live = true;
1889
1956
  const opts = swatches ? JSON.parse(swatches) : null;
1890
- (0, import_canvas14.listCanvasBrushes)().then(async (list) => opts ? Promise.all(list.map(async (b) => ({ ...b, swatch: await (0, import_canvas14.renderCanvasBrushSwatch)(b.id, opts) }))) : list).then(
1957
+ (0, import_canvas15.listCanvasBrushes)().then(async (list) => opts ? Promise.all(list.map(async (b) => ({ ...b, swatch: await (0, import_canvas15.renderCanvasBrushSwatch)(b.id, opts) }))) : list).then(
1891
1958
  (brushes) => live && setState({ brushes, loading: false, error: null }),
1892
1959
  (error) => live && setState({ brushes: [], loading: false, error: error instanceof Error ? error.message : String(error) })
1893
1960
  );
@@ -1895,19 +1962,19 @@ function useCanvasBrushes(options = {}) {
1895
1962
  live = false;
1896
1963
  };
1897
1964
  }, [swatches]);
1898
- return (0, import_react19.useMemo)(() => state, [state]);
1965
+ return (0, import_react20.useMemo)(() => state, [state]);
1899
1966
  }
1900
1967
 
1901
1968
  // src/canvas/CanvasEffects.tsx
1902
- var import_react28 = require("react");
1903
- var import_canvas15 = require("@pixerate/editor/canvas");
1969
+ var import_react29 = require("react");
1970
+ var import_canvas16 = require("@pixerate/editor/canvas");
1904
1971
 
1905
1972
  // src/effects/useEffects.ts
1906
- var import_react20 = require("react");
1973
+ var import_react21 = require("react");
1907
1974
  function useEffectDescription(provider, effect) {
1908
- const [state, setState] = (0, import_react20.useState)({ key: "", description: null, error: null });
1975
+ const [state, setState] = (0, import_react21.useState)({ key: "", description: null, error: null });
1909
1976
  const key = provider && effect ? `${provider.id}:${effect}` : "";
1910
- (0, import_react20.useEffect)(() => {
1977
+ (0, import_react21.useEffect)(() => {
1911
1978
  if (!provider || !effect) return;
1912
1979
  let live = true;
1913
1980
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1922,13 +1989,13 @@ function useEffectDescription(provider, effect) {
1922
1989
  }
1923
1990
 
1924
1991
  // src/effects/EffectThumbnail.tsx
1925
- var import_react21 = require("react");
1992
+ var import_react22 = require("react");
1926
1993
  var import_effects = require("@pixerate/editor/effects");
1927
1994
  var import_jsx_runtime7 = require("react/jsx-runtime");
1928
1995
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1929
- const ref = (0, import_react21.useRef)(null);
1930
- const [failed, setFailed] = (0, import_react21.useState)(effect.kind === "motion");
1931
- (0, import_react21.useEffect)(() => {
1996
+ const ref = (0, import_react22.useRef)(null);
1997
+ const [failed, setFailed] = (0, import_react22.useState)(effect.kind === "motion");
1998
+ (0, import_react22.useEffect)(() => {
1932
1999
  if (effect.kind === "motion") return;
1933
2000
  let live = true;
1934
2001
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1955,16 +2022,16 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1955
2022
  }
1956
2023
 
1957
2024
  // src/effects/EffectsBrowser.tsx
1958
- var import_react22 = require("react");
2025
+ var import_react23 = require("react");
1959
2026
  var import_effects2 = require("@pixerate/editor/effects");
1960
2027
  var import_jsx_runtime8 = require("react/jsx-runtime");
1961
2028
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1962
- const [all, setAll] = (0, import_react22.useState)([]);
1963
- const [query, setQuery] = (0, import_react22.useState)("");
1964
- const [category, setCategory] = (0, import_react22.useState)("");
1965
- const [use, setUse] = (0, import_react22.useState)("");
1966
- const [error, setError] = (0, import_react22.useState)(null);
1967
- (0, import_react22.useEffect)(() => {
2029
+ const [all, setAll] = (0, import_react23.useState)([]);
2030
+ const [query, setQuery] = (0, import_react23.useState)("");
2031
+ const [category, setCategory] = (0, import_react23.useState)("");
2032
+ const [use, setUse] = (0, import_react23.useState)("");
2033
+ const [error, setError] = (0, import_react23.useState)(null);
2034
+ (0, import_react23.useEffect)(() => {
1968
2035
  if (!provider) return setAll([]);
1969
2036
  let live = true;
1970
2037
  Promise.resolve().then(() => provider.list()).then(
@@ -1975,8 +2042,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1975
2042
  live = false;
1976
2043
  };
1977
2044
  }, [provider]);
1978
- const [found, setFound] = (0, import_react22.useState)([]);
1979
- (0, import_react22.useEffect)(() => {
2045
+ const [found, setFound] = (0, import_react23.useState)([]);
2046
+ (0, import_react23.useEffect)(() => {
1980
2047
  if (!provider) return setFound([]);
1981
2048
  let live = true;
1982
2049
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1985,7 +2052,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1985
2052
  };
1986
2053
  }, [provider, query, category, use]);
1987
2054
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (uses ? e.kind !== "motion" || uses.includes("motion") : e.kind !== "motion") && (!uses || e.uses.some((u) => uses.includes(u)));
1988
- const categories = (0, import_react22.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2055
+ const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1989
2056
  const shown = found.filter(allowed);
1990
2057
  if (!provider)
1991
2058
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -2033,12 +2100,12 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2033
2100
  }
2034
2101
 
2035
2102
  // src/effects/EffectParameters.tsx
2036
- var import_react27 = __toESM(require("react"), 1);
2103
+ var import_react28 = __toESM(require("react"), 1);
2037
2104
  var import_effects3 = require("@pixerate/editor/effects");
2038
2105
  var import_parameters2 = require("@pixerate/editor/parameters");
2039
2106
 
2040
2107
  // src/parameters/fields.tsx
2041
- var import_react26 = require("react");
2108
+ var import_react27 = require("react");
2042
2109
  var import_parameters = require("@pixerate/editor/parameters");
2043
2110
 
2044
2111
  // src/color/index.ts
@@ -2051,7 +2118,7 @@ __export(color_exports, {
2051
2118
  });
2052
2119
 
2053
2120
  // src/color/ColorPicker.tsx
2054
- var import_react23 = require("react");
2121
+ var import_react24 = require("react");
2055
2122
  var import_color = require("@pixerate/editor/color");
2056
2123
  var import_jsx_runtime9 = require("react/jsx-runtime");
2057
2124
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
@@ -2091,24 +2158,24 @@ var ColorPicker = ({
2091
2158
  id,
2092
2159
  "aria-label": ariaLabel = "Color picker"
2093
2160
  }) => {
2094
- const generatedId = (0, import_react23.useId)();
2161
+ const generatedId = (0, import_react24.useId)();
2095
2162
  const pickerId = id || generatedId;
2096
- const [pickerState, setPickerState] = (0, import_react23.useState)(
2163
+ const [pickerState, setPickerState] = (0, import_react24.useState)(
2097
2164
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2098
2165
  );
2099
- const stateRef = (0, import_react23.useRef)(pickerState);
2166
+ const stateRef = (0, import_react24.useRef)(pickerState);
2100
2167
  stateRef.current = pickerState;
2101
- (0, import_react23.useEffect)(() => {
2168
+ (0, import_react24.useEffect)(() => {
2102
2169
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2103
2170
  if (next) {
2104
2171
  setPickerState(next);
2105
2172
  }
2106
2173
  }, [value]);
2107
- const [internalRecent, setInternalRecent] = (0, import_react23.useState)(
2174
+ const [internalRecent, setInternalRecent] = (0, import_react24.useState)(
2108
2175
  () => controlledRecent ? [] : readLocalRecents()
2109
2176
  );
2110
2177
  const activeRecent = controlledRecent ?? internalRecent;
2111
- const recordRecent = (0, import_react23.useCallback)(
2178
+ const recordRecent = (0, import_react24.useCallback)(
2112
2179
  (color) => {
2113
2180
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2114
2181
  if (!controlledRecent) {
@@ -2119,11 +2186,11 @@ var ColorPicker = ({
2119
2186
  },
2120
2187
  [activeRecent, controlledRecent, onRecentChange]
2121
2188
  );
2122
- const [textDraft, setTextDraft] = (0, import_react23.useState)(value);
2123
- const [isInvalid, setIsInvalid] = (0, import_react23.useState)(false);
2124
- const [isClipped, setIsClipped] = (0, import_react23.useState)(false);
2125
- const isTypingRef = (0, import_react23.useRef)(false);
2126
- (0, import_react23.useEffect)(() => {
2189
+ const [textDraft, setTextDraft] = (0, import_react24.useState)(value);
2190
+ const [isInvalid, setIsInvalid] = (0, import_react24.useState)(false);
2191
+ const [isClipped, setIsClipped] = (0, import_react24.useState)(false);
2192
+ const isTypingRef = (0, import_react24.useRef)(false);
2193
+ (0, import_react24.useEffect)(() => {
2127
2194
  if (!isTypingRef.current) {
2128
2195
  setTextDraft(value);
2129
2196
  setIsInvalid(false);
@@ -2131,11 +2198,11 @@ var ColorPicker = ({
2131
2198
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2132
2199
  }
2133
2200
  }, [value]);
2134
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react23.useState)(false);
2135
- (0, import_react23.useEffect)(() => {
2201
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react24.useState)(false);
2202
+ (0, import_react24.useEffect)(() => {
2136
2203
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2137
2204
  }, []);
2138
- const emitColorChange = (0, import_react23.useCallback)(
2205
+ const emitColorChange = (0, import_react24.useCallback)(
2139
2206
  (nextState) => {
2140
2207
  setPickerState(nextState);
2141
2208
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2143,10 +2210,10 @@ var ColorPicker = ({
2143
2210
  },
2144
2211
  [alpha, onChange]
2145
2212
  );
2146
- const latest = (0, import_react23.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2213
+ const latest = (0, import_react24.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2147
2214
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2148
- const endDragRef = (0, import_react23.useRef)(null);
2149
- (0, import_react23.useEffect)(() => () => endDragRef.current?.(), []);
2215
+ const endDragRef = (0, import_react24.useRef)(null);
2216
+ (0, import_react24.useEffect)(() => () => endDragRef.current?.(), []);
2150
2217
  const startDrag = (e, next) => {
2151
2218
  if (disabled) return;
2152
2219
  e.preventDefault();
@@ -2248,7 +2315,7 @@ var ColorPicker = ({
2248
2315
  } catch {
2249
2316
  }
2250
2317
  };
2251
- const contrastResult = (0, import_react23.useMemo)(() => {
2318
+ const contrastResult = (0, import_react24.useMemo)(() => {
2252
2319
  if (!contrastAgainst) return null;
2253
2320
  const fg = (0, import_color.parseColor)(value);
2254
2321
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -2675,7 +2742,7 @@ var ColorPicker = ({
2675
2742
  };
2676
2743
 
2677
2744
  // src/color/DualColorPicker.tsx
2678
- var import_react24 = require("react");
2745
+ var import_react25 = require("react");
2679
2746
  var import_color2 = require("@pixerate/editor/color");
2680
2747
  var import_jsx_runtime10 = require("react/jsx-runtime");
2681
2748
  function DualColorPicker({
@@ -2692,8 +2759,8 @@ function DualColorPicker({
2692
2759
  disabled = false,
2693
2760
  className = ""
2694
2761
  }) {
2695
- const sameId = (0, import_react24.useId)();
2696
- const [internalScheme, setInternalScheme] = (0, import_react24.useState)("light");
2762
+ const sameId = (0, import_react25.useId)();
2763
+ const [internalScheme, setInternalScheme] = (0, import_react25.useState)("light");
2697
2764
  const activeScheme = controlledScheme ?? internalScheme;
2698
2765
  const handleSchemeSelect = (nextScheme) => {
2699
2766
  if (onSchemeChange) {
@@ -2704,7 +2771,7 @@ function DualColorPicker({
2704
2771
  };
2705
2772
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2706
2773
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2707
- const [sameInBoth, setSameInBoth] = (0, import_react24.useState)(isSame);
2774
+ const [sameInBoth, setSameInBoth] = (0, import_react25.useState)(isSame);
2708
2775
  const handleSameToggle = (e) => {
2709
2776
  const nextSame = e.target.checked;
2710
2777
  setSameInBoth(nextSame);
@@ -3013,7 +3080,7 @@ function DualColorPicker({
3013
3080
  }
3014
3081
 
3015
3082
  // src/color/useColorScheme.ts
3016
- var import_react25 = require("react");
3083
+ var import_react26 = require("react");
3017
3084
  var import_color3 = require("@pixerate/editor/color");
3018
3085
  function getSnapshot(attribute) {
3019
3086
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3038,7 +3105,7 @@ function getServerSnapshot() {
3038
3105
  function useColorScheme(options) {
3039
3106
  const override = options?.override;
3040
3107
  const attribute = options?.attribute;
3041
- const subscribe = (0, import_react25.useMemo)(() => {
3108
+ const subscribe = (0, import_react26.useMemo)(() => {
3042
3109
  return (callback) => {
3043
3110
  if (typeof window === "undefined" || typeof document === "undefined") {
3044
3111
  return () => {
@@ -3064,7 +3131,7 @@ function useColorScheme(options) {
3064
3131
  };
3065
3132
  };
3066
3133
  }, [attribute]);
3067
- const detected = (0, import_react25.useSyncExternalStore)(
3134
+ const detected = (0, import_react26.useSyncExternalStore)(
3068
3135
  subscribe,
3069
3136
  () => getSnapshot(attribute),
3070
3137
  getServerSnapshot
@@ -3144,7 +3211,7 @@ function ParameterNumberInput({
3144
3211
  }
3145
3212
  function ParameterSlider(props) {
3146
3213
  const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
3147
- const dragging = (0, import_react26.useRef)(false);
3214
+ const dragging = (0, import_react27.useRef)(false);
3148
3215
  const end = () => {
3149
3216
  if (!dragging.current) return;
3150
3217
  dragging.current = false;
@@ -3237,17 +3304,17 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
3237
3304
  );
3238
3305
  }
3239
3306
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
3240
- const [open, setOpen] = (0, import_react26.useState)(false);
3241
- const containerRef = (0, import_react26.useRef)(null);
3242
- const buttonRef = (0, import_react26.useRef)(null);
3243
- const popoverRef = (0, import_react26.useRef)(null);
3307
+ const [open, setOpen] = (0, import_react27.useState)(false);
3308
+ const containerRef = (0, import_react27.useRef)(null);
3309
+ const buttonRef = (0, import_react27.useRef)(null);
3310
+ const popoverRef = (0, import_react27.useRef)(null);
3244
3311
  const alpha = !!field.alpha;
3245
3312
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3246
3313
  const rgb = hex.slice(0, 7);
3247
3314
  const shown = alpha ? hex : rgb;
3248
3315
  const off = disabled || field.readOnly;
3249
3316
  const name = (0, import_parameters.parameterLabel)(field);
3250
- (0, import_react26.useEffect)(() => {
3317
+ (0, import_react27.useEffect)(() => {
3251
3318
  if (!open) return;
3252
3319
  const onPointerDown = (e) => {
3253
3320
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3458,10 +3525,10 @@ function EffectParameters({
3458
3525
  disabled = false,
3459
3526
  className = ""
3460
3527
  }) {
3461
- const fields = (0, import_react27.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3462
- const idBase = (0, import_react27.useId)();
3463
- const gesture = import_react27.default.useRef(null);
3464
- const count = import_react27.default.useRef(0);
3528
+ const fields = (0, import_react28.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3529
+ const idBase = (0, import_react28.useId)();
3530
+ const gesture = import_react28.default.useRef(null);
3531
+ const count = import_react28.default.useRef(0);
3465
3532
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3466
3533
  (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3467
3534
  "select",
@@ -3519,27 +3586,27 @@ function EffectParameters({
3519
3586
 
3520
3587
  // src/canvas/CanvasEffects.tsx
3521
3588
  var import_jsx_runtime13 = require("react/jsx-runtime");
3522
- var ProviderContext = (0, import_react28.createContext)(null);
3589
+ var ProviderContext = (0, import_react29.createContext)(null);
3523
3590
  function CanvasEffectsProvider({ provider, children }) {
3524
3591
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ProviderContext.Provider, { value: provider ?? null, children });
3525
3592
  }
3526
- var useCanvasEffectsProviderContext = () => (0, import_react28.useContext)(ProviderContext);
3593
+ var useCanvasEffectsProviderContext = () => (0, import_react29.useContext)(ProviderContext);
3527
3594
  function CanvasNodeEffectLayer({ effect, width, height, clipPath, clipTransform }) {
3528
3595
  const provider = useCanvasEffectsProviderContext();
3529
- const ref = (0, import_react28.useRef)(null);
3530
- const [failed, setFailed] = (0, import_react28.useState)(false);
3596
+ const ref = (0, import_react29.useRef)(null);
3597
+ const [failed, setFailed] = (0, import_react29.useState)(false);
3531
3598
  const dpr = typeof window !== "undefined" ? Math.min(2, window.devicePixelRatio || 1) : 1;
3532
3599
  const pw = Math.max(1, Math.round(width * dpr));
3533
3600
  const ph = Math.max(1, Math.round(height * dpr));
3534
3601
  const key = JSON.stringify(effect);
3535
- (0, import_react28.useEffect)(() => {
3602
+ (0, import_react29.useEffect)(() => {
3536
3603
  const canvas2 = ref.current;
3537
3604
  if (!provider || !canvas2) return;
3538
3605
  setFailed(false);
3539
- const run = (0, import_canvas15.runCanvasNodeEffect)({ provider, effect, target: canvas2, onError: () => setFailed(true) });
3606
+ const run = (0, import_canvas16.runCanvasNodeEffect)({ provider, effect, target: canvas2, onError: () => setFailed(true) });
3540
3607
  return () => run.stop();
3541
3608
  }, [provider, key, pw, ph]);
3542
- const clipId = (0, import_react28.useMemo)(() => `pixerate-effect-clip-${Math.random().toString(36).slice(2)}`, []);
3609
+ const clipId = (0, import_react29.useMemo)(() => `pixerate-effect-clip-${Math.random().toString(36).slice(2)}`, []);
3543
3610
  if (!provider || failed || !(width > 0 && height > 0)) return null;
3544
3611
  const style = { position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none", opacity: effect.opacity ?? 1 };
3545
3612
  const canvas = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("canvas", { ref, width: pw, height: ph, style: { width: "100%", height: "100%", display: "block" }, "data-canvas-effect": effect.effect });
@@ -3550,10 +3617,10 @@ function CanvasNodeEffectLayer({ effect, width, height, clipPath, clipTransform
3550
3617
  ] });
3551
3618
  }
3552
3619
  function useCanvasEffects(options) {
3553
- const opts = (0, import_react28.useRef)(options);
3620
+ const opts = (0, import_react29.useRef)(options);
3554
3621
  opts.current = options;
3555
- const controller = (0, import_react28.useMemo)(
3556
- () => (0, import_canvas15.createCanvasEffectsController)({
3622
+ const controller = (0, import_react29.useMemo)(
3623
+ () => (0, import_canvas16.createCanvasEffectsController)({
3557
3624
  getNodes: () => opts.current.getNodes(),
3558
3625
  setNodes: (n) => opts.current.setNodes(n),
3559
3626
  history: { execute: (c) => opts.current.history ? opts.current.history.execute(c) : c.execute() },
@@ -3563,7 +3630,7 @@ function useCanvasEffects(options) {
3563
3630
  }),
3564
3631
  []
3565
3632
  );
3566
- (0, import_react28.useEffect)(() => {
3633
+ (0, import_react29.useEffect)(() => {
3567
3634
  if (!options.effects) return;
3568
3635
  return controller.useEffects(options.effects);
3569
3636
  }, [controller, options.effects]);
@@ -3571,15 +3638,15 @@ function useCanvasEffects(options) {
3571
3638
  }
3572
3639
  function useCanvasEffectsTools(registry, controller, options = {}) {
3573
3640
  const { id, namespace, readOnly, subscribe } = options;
3574
- (0, import_react28.useEffect)(() => {
3641
+ (0, import_react29.useEffect)(() => {
3575
3642
  if (!registry) return;
3576
- return registry.register((0, import_canvas15.createCanvasEffectsToolProvider)(controller, { id, namespace, readOnly, subscribe }));
3643
+ return registry.register((0, import_canvas16.createCanvasEffectsToolProvider)(controller, { id, namespace, readOnly, subscribe }));
3577
3644
  }, [registry, controller, id, namespace, readOnly, subscribe]);
3578
3645
  }
3579
3646
  var btn = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3580
3647
  function Controls({ controller, nodeId, effect }) {
3581
3648
  const { description, error } = useEffectDescription(controller.effectsProvider, effect.effect);
3582
- const [message, setMessage] = (0, import_react28.useState)(null);
3649
+ const [message, setMessage] = (0, import_react29.useState)(null);
3583
3650
  const run = (work) => void work.then(() => setMessage(null), (e) => setMessage(e instanceof Error ? e.message : String(e)));
3584
3651
  if (error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3585
3652
  if (!description) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
@@ -3598,16 +3665,16 @@ function Controls({ controller, nodeId, effect }) {
3598
3665
  ] });
3599
3666
  }
3600
3667
  function CanvasEffectsPanel({ controller, nodeId, shape, sceneId, className = "" }) {
3601
- const [, setTick] = (0, import_react28.useState)(0);
3602
- (0, import_react28.useEffect)(() => controller.effects.subscribe(() => setTick((n) => n + 1)), [controller]);
3668
+ const [, setTick] = (0, import_react29.useState)(0);
3669
+ (0, import_react29.useEffect)(() => controller.effects.subscribe(() => setTick((n) => n + 1)), [controller]);
3603
3670
  const provider = controller.effectsProvider;
3604
- const [browse, setBrowse] = (0, import_react28.useState)(null);
3605
- const [message, setMessage] = (0, import_react28.useState)(null);
3671
+ const [browse, setBrowse] = (0, import_react29.useState)(null);
3672
+ const [message, setMessage] = (0, import_react29.useState)(null);
3606
3673
  const run = (work) => {
3607
3674
  setMessage(null);
3608
3675
  Promise.resolve().then(work).then(() => setTick((n) => n + 1), (e) => setMessage(e instanceof Error ? e.message : String(e)));
3609
3676
  };
3610
- const effect = (0, import_canvas15.isShapeDescription)(shape) ? shape.effect : void 0;
3677
+ const effect = (0, import_canvas16.isShapeDescription)(shape) ? shape.effect : void 0;
3611
3678
  const transition = sceneId ? controller.sceneTransition(sceneId) : void 0;
3612
3679
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Canvas effects", "data-canvas-effects": "", children: [
3613
3680
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
@@ -3659,9 +3726,9 @@ function CanvasEffectsPanel({ controller, nodeId, shape, sceneId, className = ""
3659
3726
  var import_jsx_runtime14 = require("react/jsx-runtime");
3660
3727
  function ShapeNode({ id, data, width, height, selected, className = "", children, positionAbsoluteX, positionAbsoluteY }) {
3661
3728
  const shape = data?.shape;
3662
- const brushImage = useShapeBrushstroke((0, import_canvas16.isShapeDescription)(shape) ? shape : null, width, height, { x: positionAbsoluteX ?? 0, y: positionAbsoluteY ?? 0 });
3663
- if (!(0, import_canvas16.isShapeDescription)(shape)) return null;
3664
- const render = (0, import_canvas16.getShapeRenderData)(shape, { width, height }, { id: id || data?.id });
3729
+ const brushImage = useShapeBrushstroke((0, import_canvas17.isShapeDescription)(shape) ? shape : null, width, height, { x: positionAbsoluteX ?? 0, y: positionAbsoluteY ?? 0 });
3730
+ if (!(0, import_canvas17.isShapeDescription)(shape)) return null;
3731
+ const render = (0, import_canvas17.getShapeRenderData)(shape, { width, height }, { id: id || data?.id });
3665
3732
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3666
3733
  "div",
3667
3734
  {
@@ -3724,22 +3791,22 @@ function ShapeNode({ id, data, width, height, selected, className = "", children
3724
3791
  }
3725
3792
 
3726
3793
  // src/canvas/index.ts
3727
- var import_canvas30 = require("@pixerate/editor/canvas");
3728
- var import_canvas31 = require("@pixerate/editor/canvas");
3729
3794
  var import_canvas32 = require("@pixerate/editor/canvas");
3730
3795
  var import_canvas33 = require("@pixerate/editor/canvas");
3796
+ var import_canvas34 = require("@pixerate/editor/canvas");
3797
+ var import_canvas35 = require("@pixerate/editor/canvas");
3731
3798
 
3732
3799
  // src/canvas/useCanvasAutoLayout.ts
3733
- var import_react29 = require("react");
3734
- var import_canvas17 = require("@pixerate/editor/canvas");
3800
+ var import_react30 = require("react");
3801
+ var import_canvas18 = require("@pixerate/editor/canvas");
3735
3802
  function useCanvasAutoLayout(options) {
3736
- const [guides, setGuides] = (0, import_react29.useState)([]);
3737
- const nodesRef = (0, import_react29.useRef)(options.nodes);
3803
+ const [guides, setGuides] = (0, import_react30.useState)([]);
3804
+ const nodesRef = (0, import_react30.useRef)(options.nodes);
3738
3805
  nodesRef.current = options.nodes;
3739
- const optionsRef = (0, import_react29.useRef)(options);
3806
+ const optionsRef = (0, import_react30.useRef)(options);
3740
3807
  optionsRef.current = options;
3741
- const controller = (0, import_react29.useMemo)(
3742
- () => (0, import_canvas17.createCanvasAutoLayoutController)({
3808
+ const controller = (0, import_react30.useMemo)(
3809
+ () => (0, import_canvas18.createCanvasAutoLayoutController)({
3743
3810
  getNodes: () => nodesRef.current,
3744
3811
  setNodes: (next) => {
3745
3812
  nodesRef.current = next;
@@ -3764,10 +3831,10 @@ function useCanvasAutoLayout(options) {
3764
3831
  }),
3765
3832
  []
3766
3833
  );
3767
- (0, import_react29.useLayoutEffect)(() => {
3834
+ (0, import_react30.useLayoutEffect)(() => {
3768
3835
  if (controller.hasPending) controller.flush();
3769
3836
  }, [options.nodes, controller]);
3770
- return (0, import_react29.useMemo)(
3837
+ return (0, import_react30.useMemo)(
3771
3838
  () => ({
3772
3839
  ...controller,
3773
3840
  /** Drop marker of the active reorder drag (flow coordinates). */
@@ -3781,47 +3848,47 @@ function useCanvasAutoLayout(options) {
3781
3848
  }
3782
3849
 
3783
3850
  // src/canvas/useCanvasTokens.ts
3784
- var import_react30 = require("react");
3785
- var import_canvas18 = require("@pixerate/editor/canvas");
3851
+ var import_react31 = require("react");
3852
+ var import_canvas19 = require("@pixerate/editor/canvas");
3786
3853
  function useCanvasTokens(options) {
3787
3854
  const { store, nodes, setNodes, modes, properties } = options;
3788
- const state = (0, import_react30.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
3789
- const latest = (0, import_react30.useRef)({ nodes, setNodes, modes, properties });
3855
+ const state = (0, import_react31.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
3856
+ const latest = (0, import_react31.useRef)({ nodes, setNodes, modes, properties });
3790
3857
  latest.current = { nodes, setNodes, modes, properties };
3791
3858
  const opts = () => ({ modes: latest.current.modes, properties: latest.current.properties });
3792
- (0, import_react30.useEffect)(
3859
+ (0, import_react31.useEffect)(
3793
3860
  () => store.subscribe((event) => {
3794
3861
  if (event.deletedVariableIds.length === 0) return;
3795
- latest.current.setNodes((prev) => (0, import_canvas18.detachTokenBindings)(prev, event.previous, event.deletedVariableIds, opts()));
3862
+ latest.current.setNodes((prev) => (0, import_canvas19.detachTokenBindings)(prev, event.previous, event.deletedVariableIds, opts()));
3796
3863
  }),
3797
3864
  // eslint-disable-next-line react-hooks/exhaustive-deps
3798
3865
  [store]
3799
3866
  );
3800
3867
  const modesKey = JSON.stringify(modes ?? {});
3801
- (0, import_react30.useEffect)(() => {
3802
- const next = (0, import_canvas18.resolveCanvasTokens)(nodes, state, opts());
3868
+ (0, import_react31.useEffect)(() => {
3869
+ const next = (0, import_canvas19.resolveCanvasTokens)(nodes, state, opts());
3803
3870
  if (next !== nodes) setNodes(next);
3804
3871
  }, [nodes, state, modesKey, properties]);
3805
- const bind = (0, import_react30.useCallback)(
3872
+ const bind = (0, import_react31.useCallback)(
3806
3873
  (ids, propertyKey, variableId) => {
3807
- const next = (0, import_canvas18.bindCanvasToken)(latest.current.nodes, ids, propertyKey, variableId, store.getState(), opts());
3874
+ const next = (0, import_canvas19.bindCanvasToken)(latest.current.nodes, ids, propertyKey, variableId, store.getState(), opts());
3808
3875
  if (next !== latest.current.nodes) latest.current.setNodes(next);
3809
3876
  },
3810
3877
  // eslint-disable-next-line react-hooks/exhaustive-deps
3811
3878
  [store]
3812
3879
  );
3813
- const setMode = (0, import_react30.useCallback)(
3880
+ const setMode = (0, import_react31.useCallback)(
3814
3881
  (ids, collectionId, modeId) => {
3815
- const next = (0, import_canvas18.setCanvasTokenMode)(latest.current.nodes, ids, collectionId, modeId, store.getState(), opts());
3882
+ const next = (0, import_canvas19.setCanvasTokenMode)(latest.current.nodes, ids, collectionId, modeId, store.getState(), opts());
3816
3883
  if (next !== latest.current.nodes) latest.current.setNodes(next);
3817
3884
  },
3818
3885
  // eslint-disable-next-line react-hooks/exhaustive-deps
3819
3886
  [store]
3820
3887
  );
3821
- const modesOf = (0, import_react30.useCallback)(
3888
+ const modesOf = (0, import_react31.useCallback)(
3822
3889
  (nodeId) => {
3823
3890
  const node = latest.current.nodes.find((n) => n.id === nodeId);
3824
- return node ? (0, import_canvas18.getEffectiveTokenModes)(node, latest.current.nodes, store.getState(), opts()) : {};
3891
+ return node ? (0, import_canvas19.getEffectiveTokenModes)(node, latest.current.nodes, store.getState(), opts()) : {};
3825
3892
  },
3826
3893
  // eslint-disable-next-line react-hooks/exhaustive-deps
3827
3894
  [store]
@@ -3830,7 +3897,7 @@ function useCanvasTokens(options) {
3830
3897
  }
3831
3898
 
3832
3899
  // src/canvas/TokenBindingPicker.tsx
3833
- var import_canvas19 = require("@pixerate/editor/canvas");
3900
+ var import_canvas20 = require("@pixerate/editor/canvas");
3834
3901
  var import_tokens = require("@pixerate/editor/tokens");
3835
3902
  var import_jsx_runtime15 = require("react/jsx-runtime");
3836
3903
  function TokenBindingPicker({
@@ -3846,14 +3913,14 @@ function TokenBindingPicker({
3846
3913
  const selected = nodes.filter((n) => selectedIds.includes(n.id));
3847
3914
  const first = selected[0];
3848
3915
  if (!first) return null;
3849
- let rows = (0, import_canvas19.getBindableTokenProperties)(first, options);
3916
+ let rows = (0, import_canvas20.getBindableTokenProperties)(first, options);
3850
3917
  if (properties) rows = properties.map((key) => rows.find((p) => p.key === key)).filter((p) => !!p);
3851
- const modes = (0, import_canvas19.getEffectiveTokenModes)(first, nodes, state, options);
3918
+ const modes = (0, import_canvas20.getEffectiveTokenModes)(first, nodes, state, options);
3852
3919
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-token-binding-picker": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
3853
3920
  rows.map((property) => {
3854
- const ids = new Set(selected.map((n) => (0, import_canvas19.getNodeTokenBindings)(n)[property.key] ?? ""));
3921
+ const ids = new Set(selected.map((n) => (0, import_canvas20.getNodeTokenBindings)(n)[property.key] ?? ""));
3855
3922
  const value = ids.size === 1 ? [...ids][0] : "__mixed";
3856
- const candidates = (0, import_canvas19.getTokensForProperty)(state, property, first);
3923
+ const candidates = (0, import_canvas20.getTokensForProperty)(state, property, first);
3857
3924
  const resolved = value && value !== "__mixed" ? (0, import_tokens.resolveToken)(state, value, modes) : null;
3858
3925
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", "data-token-property": property.key, children: [
3859
3926
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-28 shrink-0 text-muted-foreground", children: property.label }),
@@ -3866,7 +3933,7 @@ function TokenBindingPicker({
3866
3933
  onChange: (e) => {
3867
3934
  const id = e.currentTarget.value || null;
3868
3935
  try {
3869
- onChange((0, import_canvas19.bindCanvasToken)(nodes, selectedIds, property.key, id, state, options));
3936
+ onChange((0, import_canvas20.bindCanvasToken)(nodes, selectedIds, property.key, id, state, options));
3870
3937
  } catch (error) {
3871
3938
  onError?.(error);
3872
3939
  }
@@ -3908,9 +3975,9 @@ function TokenModeSwitcher({
3908
3975
  }) {
3909
3976
  const first = nodes.find((n) => nodeIds.includes(n.id));
3910
3977
  if (!first) return null;
3911
- const own = (0, import_canvas19.getNodeTokenModes)(first);
3978
+ const own = (0, import_canvas20.getNodeTokenModes)(first);
3912
3979
  const parent = first.parentId ? nodes.find((n) => n.id === first.parentId) : void 0;
3913
- const inherited = parent ? (0, import_canvas19.getEffectiveTokenModes)(parent, nodes, state, options) : { ...options.modes };
3980
+ const inherited = parent ? (0, import_canvas20.getEffectiveTokenModes)(parent, nodes, state, options) : { ...options.modes };
3914
3981
  const collections = state.collections.filter((c) => showSingleMode || c.modes.length > 1);
3915
3982
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { "data-token-mode-switcher": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: collections.map((collection) => {
3916
3983
  const auto = (0, import_tokens.getCurrentMode)(collection, inherited);
@@ -3923,7 +3990,7 @@ function TokenModeSwitcher({
3923
3990
  "aria-label": `${collection.name} mode`,
3924
3991
  className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
3925
3992
  value: explicit,
3926
- onChange: (e) => onChange((0, import_canvas19.setCanvasTokenMode)(nodes, nodeIds, collection.id, e.currentTarget.value || null, state, options)),
3993
+ onChange: (e) => onChange((0, import_canvas20.setCanvasTokenMode)(nodes, nodeIds, collection.id, e.currentTarget.value || null, state, options)),
3927
3994
  children: [
3928
3995
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: "", children: [
3929
3996
  "Auto (",
@@ -3939,18 +4006,18 @@ function TokenModeSwitcher({
3939
4006
  }
3940
4007
 
3941
4008
  // src/canvas/index.ts
3942
- var import_canvas34 = require("@pixerate/editor/canvas");
4009
+ var import_canvas36 = require("@pixerate/editor/canvas");
3943
4010
 
3944
4011
  // src/canvas/useCanvasAnimation.ts
3945
- var import_react31 = require("react");
3946
- var import_canvas20 = require("@pixerate/editor/canvas");
4012
+ var import_react32 = require("react");
4013
+ var import_canvas21 = require("@pixerate/editor/canvas");
3947
4014
  function useCanvasAnimation(options) {
3948
- const nodesRef = (0, import_react31.useRef)(options.nodes);
4015
+ const nodesRef = (0, import_react32.useRef)(options.nodes);
3949
4016
  nodesRef.current = options.nodes;
3950
- const optionsRef = (0, import_react31.useRef)(options);
4017
+ const optionsRef = (0, import_react32.useRef)(options);
3951
4018
  optionsRef.current = options;
3952
- const controller = (0, import_react31.useMemo)(
3953
- () => (0, import_canvas20.createCanvasAnimationController)({
4019
+ const controller = (0, import_react32.useMemo)(
4020
+ () => (0, import_canvas21.createCanvasAnimationController)({
3954
4021
  getNodes: () => nodesRef.current,
3955
4022
  setNodes: (next) => {
3956
4023
  nodesRef.current = next;
@@ -3976,26 +4043,26 @@ function useCanvasAnimation(options) {
3976
4043
  }),
3977
4044
  []
3978
4045
  );
3979
- (0, import_react31.useEffect)(() => () => controller.destroy(), [controller]);
3980
- (0, import_react31.useEffect)(() => {
4046
+ (0, import_react32.useEffect)(() => () => controller.destroy(), [controller]);
4047
+ (0, import_react32.useEffect)(() => {
3981
4048
  if (options.loop !== void 0) controller.setLoop(options.loop);
3982
4049
  }, [controller, options.loop]);
3983
- (0, import_react31.useEffect)(() => {
4050
+ (0, import_react32.useEffect)(() => {
3984
4051
  if (options.playbackRate !== void 0) controller.setPlaybackRate(options.playbackRate);
3985
4052
  }, [controller, options.playbackRate]);
3986
- (0, import_react31.useEffect)(() => {
4053
+ (0, import_react32.useEffect)(() => {
3987
4054
  if (options.recording !== void 0) controller.setRecording(options.recording);
3988
4055
  }, [controller, options.recording]);
3989
- const state = (0, import_react31.useSyncExternalStore)(
4056
+ const state = (0, import_react32.useSyncExternalStore)(
3990
4057
  (listener) => controller.subscribe(listener),
3991
4058
  () => controller.getState(),
3992
4059
  () => controller.getState()
3993
4060
  );
3994
- (0, import_react31.useEffect)(() => {
4061
+ (0, import_react32.useEffect)(() => {
3995
4062
  controller.refresh();
3996
4063
  }, [controller, options.nodes]);
3997
- const displayNodes = (0, import_react31.useMemo)(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
3998
- return (0, import_react31.useMemo)(
4064
+ const displayNodes = (0, import_react32.useMemo)(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
4065
+ return (0, import_react32.useMemo)(
3999
4066
  () => ({
4000
4067
  ...controller,
4001
4068
  state,
@@ -4016,8 +4083,8 @@ function useCanvasAnimation(options) {
4016
4083
  }
4017
4084
 
4018
4085
  // src/canvas/AnimationTimeline.tsx
4019
- var import_react32 = require("react");
4020
- var import_canvas21 = require("@pixerate/editor/canvas");
4086
+ var import_react33 = require("react");
4087
+ var import_canvas22 = require("@pixerate/editor/canvas");
4021
4088
  var import_jsx_runtime16 = require("react/jsx-runtime");
4022
4089
  var LOOP_LABELS = { none: "Once", loop: "Loop", "ping-pong": "Ping-pong" };
4023
4090
  var easingValue = (easing) => typeof easing === "string" ? easing : easing ? "custom" : "linear";
@@ -4025,15 +4092,15 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
4025
4092
  const { state } = animation;
4026
4093
  const duration = state.duration;
4027
4094
  const rows = animation.timelineRows(nodeIds ?? void 0, labelOf ? { labelOf } : {});
4028
- const ticks = (0, import_canvas21.getTimelineTicks)(duration, width);
4095
+ const ticks = (0, import_canvas22.getTimelineTicks)(duration, width);
4029
4096
  const selectedEasing = (() => {
4030
4097
  const first = state.selection[0];
4031
4098
  if (!first) return "";
4032
4099
  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);
4033
4100
  return "";
4034
4101
  })();
4035
- const dragRef = (0, import_react32.useRef)(null);
4036
- (0, import_react32.useEffect)(() => {
4102
+ const dragRef = (0, import_react33.useRef)(null);
4103
+ (0, import_react33.useEffect)(() => {
4037
4104
  const onKey = (event) => {
4038
4105
  if (event.key === "Escape" && dragRef.current) {
4039
4106
  dragRef.current = null;
@@ -4046,8 +4113,8 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
4046
4113
  const onRulerDown = (event) => {
4047
4114
  const lane = event.currentTarget;
4048
4115
  const left = lane.getBoundingClientRect().left;
4049
- animation.scrub((0, import_canvas21.xToTime)(event.clientX - left, duration, width));
4050
- const move = (e) => animation.scrub((0, import_canvas21.xToTime)(e.clientX - left, duration, width));
4116
+ animation.scrub((0, import_canvas22.xToTime)(event.clientX - left, duration, width));
4117
+ const move = (e) => animation.scrub((0, import_canvas22.xToTime)(e.clientX - left, duration, width));
4051
4118
  const up = () => {
4052
4119
  window.removeEventListener("pointermove", move);
4053
4120
  window.removeEventListener("pointerup", up);
@@ -4087,7 +4154,7 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
4087
4154
  }
4088
4155
  };
4089
4156
  const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-50";
4090
- const playheadX = (0, import_canvas21.timeToX)(state.time, duration, width);
4157
+ const playheadX = (0, import_canvas22.timeToX)(state.time, duration, width);
4091
4158
  const labelWidth = 120;
4092
4159
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-animation-timeline": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, tabIndex: 0, onKeyDown: onTimelineKey, children: [
4093
4160
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "toolbar", "aria-label": "Animation", children: [
@@ -4106,9 +4173,9 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
4106
4173
  ),
4107
4174
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2, "data-action": "add-keyframe", onClick: () => animation.addKeyframe(), children: "\u25C6 Key" }),
4108
4175
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { "data-time": "", className: "tabular-nums text-muted-foreground", children: [
4109
- (0, import_canvas21.formatAnimationTime)(state.time),
4176
+ (0, import_canvas22.formatAnimationTime)(state.time),
4110
4177
  " / ",
4111
- (0, import_canvas21.formatAnimationTime)(duration)
4178
+ (0, import_canvas22.formatAnimationTime)(duration)
4112
4179
  ] }),
4113
4180
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4114
4181
  "select",
@@ -4121,7 +4188,7 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
4121
4188
  onChange: (e) => e.target.value && e.target.value !== "custom" && animation.setEasing(e.target.value),
4122
4189
  children: [
4123
4190
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Easing\u2026" }),
4124
- import_canvas21.ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: preset, children: import_canvas21.ANIMATION_EASING_LABELS[preset] }, preset)),
4191
+ import_canvas22.ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: preset, children: import_canvas22.ANIMATION_EASING_LABELS[preset] }, preset)),
4125
4192
  selectedEasing === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "custom", children: "Custom" }) : null
4126
4193
  ]
4127
4194
  }
@@ -4172,17 +4239,17 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
4172
4239
  ] }),
4173
4240
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-lane": "", className: `relative h-5 rounded bg-muted/40 ${row.enabled ? "" : "opacity-50"}`, style: { width }, children: [
4174
4241
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "pointer-events-none absolute top-0 h-5 w-px bg-red-500/60", style: { left: playheadX } }),
4175
- state.drag?.target != null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: (0, import_canvas21.timeToX)(state.drag.target, duration, width) } }) : null,
4242
+ state.drag?.target != null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: (0, import_canvas22.timeToX)(state.drag.target, duration, width) } }) : null,
4176
4243
  row.keyframes.map((k) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4177
4244
  "button",
4178
4245
  {
4179
4246
  type: "button",
4180
4247
  "data-keyframe": k.ref.time,
4181
4248
  "aria-pressed": k.selected,
4182
- "aria-label": `${row.label} keyframe at ${(0, import_canvas21.formatAnimationTime)(k.ref.time)}`,
4183
- title: `${(0, import_canvas21.formatAnimationTime)(k.time)} \xB7 ${String(k.value)}`,
4249
+ "aria-label": `${row.label} keyframe at ${(0, import_canvas22.formatAnimationTime)(k.ref.time)}`,
4250
+ title: `${(0, import_canvas22.formatAnimationTime)(k.time)} \xB7 ${String(k.value)}`,
4184
4251
  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]"}`,
4185
- style: { left: (0, import_canvas21.timeToX)(k.time, duration, width) },
4252
+ style: { left: (0, import_canvas22.timeToX)(k.time, duration, width) },
4186
4253
  onPointerDown: onKeyDown(k.ref)
4187
4254
  },
4188
4255
  k.ref.time
@@ -4193,18 +4260,18 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
4193
4260
  }
4194
4261
 
4195
4262
  // src/canvas/index.ts
4196
- var import_canvas35 = require("@pixerate/editor/canvas");
4263
+ var import_canvas37 = require("@pixerate/editor/canvas");
4197
4264
 
4198
4265
  // src/canvas/useCanvasComponents.ts
4199
- var import_react33 = require("react");
4200
- var import_canvas22 = require("@pixerate/editor/canvas");
4266
+ var import_react34 = require("react");
4267
+ var import_canvas23 = require("@pixerate/editor/canvas");
4201
4268
  function useCanvasComponents(options) {
4202
- const nodesRef = (0, import_react33.useRef)(options.nodes);
4269
+ const nodesRef = (0, import_react34.useRef)(options.nodes);
4203
4270
  nodesRef.current = options.nodes;
4204
- const optionsRef = (0, import_react33.useRef)(options);
4271
+ const optionsRef = (0, import_react34.useRef)(options);
4205
4272
  optionsRef.current = options;
4206
- const controller = (0, import_react33.useMemo)(
4207
- () => (0, import_canvas22.createCanvasComponentsController)({
4273
+ const controller = (0, import_react34.useMemo)(
4274
+ () => (0, import_canvas23.createCanvasComponentsController)({
4208
4275
  getNodes: () => nodesRef.current,
4209
4276
  setNodes: (next) => {
4210
4277
  nodesRef.current = next;
@@ -4232,15 +4299,15 @@ function useCanvasComponents(options) {
4232
4299
  }),
4233
4300
  []
4234
4301
  );
4235
- (0, import_react33.useLayoutEffect)(() => {
4302
+ (0, import_react34.useLayoutEffect)(() => {
4236
4303
  if (optionsRef.current.autoSync !== false) controller.sync();
4237
4304
  }, [options.nodes, controller]);
4238
4305
  return controller;
4239
4306
  }
4240
4307
 
4241
4308
  // src/canvas/CanvasComponentsPanel.tsx
4242
- var import_react34 = require("react");
4243
- var import_canvas23 = require("@pixerate/editor/canvas");
4309
+ var import_react35 = require("react");
4310
+ var import_canvas24 = require("@pixerate/editor/canvas");
4244
4311
  var import_jsx_runtime17 = require("react/jsx-runtime");
4245
4312
  function InlineField({ value, label, onCommit }) {
4246
4313
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -4274,11 +4341,11 @@ function CanvasComponentsPanel({
4274
4341
  search = true,
4275
4342
  className = ""
4276
4343
  }) {
4277
- const [query, setQuery] = (0, import_react34.useState)("");
4278
- const [propsOpen, setPropsOpen] = (0, import_react34.useState)(null);
4279
- const [menuFor, setMenuFor] = (0, import_react34.useState)(null);
4280
- const [editing, setEditing] = (0, import_react34.useState)(null);
4281
- const { components: all, sets } = (0, import_canvas23.listCanvasComponents)(nodes);
4344
+ const [query, setQuery] = (0, import_react35.useState)("");
4345
+ const [propsOpen, setPropsOpen] = (0, import_react35.useState)(null);
4346
+ const [menuFor, setMenuFor] = (0, import_react35.useState)(null);
4347
+ const [editing, setEditing] = (0, import_react35.useState)(null);
4348
+ const { components: all, sets } = (0, import_canvas24.listCanvasComponents)(nodes);
4282
4349
  const q = query.trim().toLowerCase();
4283
4350
  const match = (name) => !q || name.toLowerCase().includes(q);
4284
4351
  const lone = all.filter((c) => !c.setId && match(c.name));
@@ -4301,7 +4368,7 @@ function CanvasComponentsPanel({
4301
4368
  onClick: () => onInsert(id),
4302
4369
  onContextMenu,
4303
4370
  onDragStart: (e) => {
4304
- e.dataTransfer.setData(import_canvas23.CANVAS_COMPONENT_DRAG_TYPE, id);
4371
+ e.dataTransfer.setData(import_canvas24.CANVAS_COMPONENT_DRAG_TYPE, id);
4305
4372
  e.dataTransfer.setData("text/plain", name);
4306
4373
  e.dataTransfer.effectAllowed = "copy";
4307
4374
  },
@@ -4495,13 +4562,13 @@ function CanvasInstanceInspector({
4495
4562
  onError,
4496
4563
  className = ""
4497
4564
  }) {
4498
- const info = nodeId ? (0, import_canvas23.inspectCanvasInstance)(nodes, nodeId) : void 0;
4565
+ const info = nodeId ? (0, import_canvas24.inspectCanvasInstance)(nodes, nodeId) : void 0;
4499
4566
  if (!info) return null;
4500
4567
  const report = (result) => {
4501
4568
  if (result && !result.ok && result.reason) onError?.(result.reason);
4502
4569
  };
4503
4570
  const setProp = (name, value) => report(components.setInstanceProperties({ [name]: value }, [info.id]));
4504
- const allComponents = (0, import_canvas23.listCanvasComponents)(nodes).components;
4571
+ const allComponents = (0, import_canvas24.listCanvasComponents)(nodes).components;
4505
4572
  const linked = info.status === "linked";
4506
4573
  const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-40";
4507
4574
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-instance-inspector": "", "data-instance-id": info.id, className: `flex flex-col gap-2 text-xs text-foreground ${className}`, children: [
@@ -4604,11 +4671,11 @@ function CanvasInstanceInspector({
4604
4671
  }
4605
4672
 
4606
4673
  // src/canvas/index.ts
4607
- var import_canvas36 = require("@pixerate/editor/canvas");
4674
+ var import_canvas38 = require("@pixerate/editor/canvas");
4608
4675
 
4609
4676
  // src/canvas/MermaidFamilyScene.tsx
4610
- var import_react35 = require("react");
4611
- var import_canvas24 = require("@pixerate/editor/canvas");
4677
+ var import_react36 = require("react");
4678
+ var import_canvas25 = require("@pixerate/editor/canvas");
4612
4679
  var import_jsx_runtime18 = require("react/jsx-runtime");
4613
4680
  function MermaidFamilyScene({
4614
4681
  scene,
@@ -4622,7 +4689,7 @@ function MermaidFamilyScene({
4622
4689
  style,
4623
4690
  title
4624
4691
  }) {
4625
- const uid = (0, import_react35.useId)().replace(/:/g, "");
4692
+ const uid = (0, import_react36.useId)().replace(/:/g, "");
4626
4693
  const marker = (kind) => kind ? `url(#${uid}-${kind})` : void 0;
4627
4694
  const x = scene.x - padding;
4628
4695
  const y = scene.y - padding;
@@ -4715,7 +4782,7 @@ function MermaidFamilyScene({
4715
4782
  x: mark.x,
4716
4783
  y: mark.y,
4717
4784
  textAnchor: mark.anchor,
4718
- dominantBaseline: (0, import_canvas24.diagramTextBaseline)(mark.baseline),
4785
+ dominantBaseline: (0, import_canvas25.diagramTextBaseline)(mark.baseline),
4719
4786
  transform: mark.rotate ? `rotate(${mark.rotate} ${mark.x} ${mark.y})` : void 0,
4720
4787
  style: {
4721
4788
  fill: mark.selected ? selectionColor : mark.fill,
@@ -4736,14 +4803,14 @@ function MermaidFamilyScene({
4736
4803
  }
4737
4804
 
4738
4805
  // src/canvas/useMermaidDiagram.ts
4739
- var import_react36 = require("react");
4806
+ var import_react37 = require("react");
4740
4807
  var import_diagram = require("@pixerate/editor/diagram");
4741
- var import_canvas25 = require("@pixerate/editor/canvas");
4808
+ var import_canvas26 = require("@pixerate/editor/canvas");
4742
4809
  function useDiagramState(controller) {
4743
- return (0, import_react36.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
4810
+ return (0, import_react37.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
4744
4811
  }
4745
4812
  function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
4746
- const own = (0, import_react36.useRef)(null);
4813
+ const own = (0, import_react37.useRef)(null);
4747
4814
  let controller;
4748
4815
  if (controllerOrOptions instanceof import_diagram.DiagramController) controller = controllerOrOptions;
4749
4816
  else {
@@ -4753,26 +4820,26 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
4753
4820
  const layoutOptions = (controllerOrOptions instanceof import_diagram.DiagramController ? void 0 : controllerOrOptions.layoutOptions) ?? view.layoutOptions;
4754
4821
  const sceneTheme = (controllerOrOptions instanceof import_diagram.DiagramController ? void 0 : controllerOrOptions.sceneTheme) ?? view.sceneTheme;
4755
4822
  const state = useDiagramState(controller);
4756
- const editorDocument = (0, import_react36.useMemo)(() => (0, import_diagram.createDiagramEditorDocument)(controller), [controller]);
4757
- (0, import_react36.useEffect)(() => () => editorDocument.destroy(), [editorDocument]);
4758
- const canvas = (0, import_react36.useMemo)(
4759
- () => (0, import_canvas25.mermaidToCanvas)(state.document, { ...layoutOptions, editable: state.editable }),
4823
+ const editorDocument = (0, import_react37.useMemo)(() => (0, import_diagram.createDiagramEditorDocument)(controller), [controller]);
4824
+ (0, import_react37.useEffect)(() => () => editorDocument.destroy(), [editorDocument]);
4825
+ const canvas = (0, import_react37.useMemo)(
4826
+ () => (0, import_canvas26.mermaidToCanvas)(state.document, { ...layoutOptions, editable: state.editable }),
4760
4827
  // eslint-disable-next-line react-hooks/exhaustive-deps
4761
4828
  [state.document, state.editable]
4762
4829
  );
4763
- const scene = (0, import_react36.useMemo)(
4764
- () => state.document.tier === "editable" ? (0, import_canvas25.familySceneFromLayout)(state.document.family, state.document.graph, canvas.layout, { theme: { ...import_canvas25.CSS_VARIABLE_DIAGRAM_SCENE_THEME, ...sceneTheme }, selection: state.selection }) : null,
4830
+ const scene = (0, import_react37.useMemo)(
4831
+ () => state.document.tier === "editable" ? (0, import_canvas26.familySceneFromLayout)(state.document.family, state.document.graph, canvas.layout, { theme: { ...import_canvas26.CSS_VARIABLE_DIAGRAM_SCENE_THEME, ...sceneTheme }, selection: state.selection }) : null,
4765
4832
  // eslint-disable-next-line react-hooks/exhaustive-deps
4766
4833
  [state.document, canvas.layout, state.selection]
4767
4834
  );
4768
- const layoutRef = (0, import_react36.useRef)(canvas.layout);
4835
+ const layoutRef = (0, import_react37.useRef)(canvas.layout);
4769
4836
  layoutRef.current = canvas.layout;
4770
- const actions = (0, import_react36.useMemo)(
4837
+ const actions = (0, import_react37.useMemo)(
4771
4838
  () => ({
4772
4839
  apply: (ops, label) => controller.apply(ops, label),
4773
4840
  load: (source, options) => controller.load(source, options),
4774
4841
  moveNodes: (moved, all = moved) => {
4775
- const op = (0, import_canvas25.mermaidMovesFromCanvas)(layoutRef.current, moved, all, { stored: controller.getDocument().meta.layout ?? {} });
4842
+ const op = (0, import_canvas26.mermaidMovesFromCanvas)(layoutRef.current, moved, all, { stored: controller.getDocument().meta.layout ?? {} });
4776
4843
  return op ? controller.apply(op, "Move") : null;
4777
4844
  },
4778
4845
  connect: (source, target, label) => controller.apply({ type: "addEdge", edge: { source, target, ...label ? { label } : {} } }, "Connect"),
@@ -4791,7 +4858,7 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
4791
4858
  "Rename"
4792
4859
  ),
4793
4860
  renameTarget: (target, label) => {
4794
- const op = (0, import_canvas25.diagramRenameOp)(controller.getDocument(), target, label);
4861
+ const op = (0, import_canvas26.diagramRenameOp)(controller.getDocument(), target, label);
4795
4862
  return op ? controller.apply(op, "Rename") : null;
4796
4863
  },
4797
4864
  select: (ids) => controller.select(ids),
@@ -4804,13 +4871,13 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
4804
4871
  }
4805
4872
  function useMermaidStream(source, options = {}) {
4806
4873
  const { complete = false, duration = 300, ...layoutOptions } = options;
4807
- const stream = (0, import_react36.useRef)(null);
4808
- if (!stream.current) stream.current = new import_canvas25.DiagramStream(layoutOptions);
4809
- const result = (0, import_react36.useMemo)(() => stream.current.update(source, complete), [source, complete]);
4810
- const [shown, setShown] = (0, import_react36.useState)({ layout: result.layout, settled: true });
4811
- const shownRef = (0, import_react36.useRef)(shown.layout);
4874
+ const stream = (0, import_react37.useRef)(null);
4875
+ if (!stream.current) stream.current = new import_canvas26.DiagramStream(layoutOptions);
4876
+ const result = (0, import_react37.useMemo)(() => stream.current.update(source, complete), [source, complete]);
4877
+ const [shown, setShown] = (0, import_react37.useState)({ layout: result.layout, settled: true });
4878
+ const shownRef = (0, import_react37.useRef)(shown.layout);
4812
4879
  shownRef.current = shown.layout;
4813
- (0, import_react36.useEffect)(() => {
4880
+ (0, import_react37.useEffect)(() => {
4814
4881
  const target = result.layout;
4815
4882
  if (!target) return setShown({ layout: null, settled: true });
4816
4883
  const from = shownRef.current;
@@ -4820,14 +4887,14 @@ function useMermaidStream(source, options = {}) {
4820
4887
  const start = performance.now();
4821
4888
  const step = () => {
4822
4889
  const t = Math.min(1, (performance.now() - start) / duration);
4823
- setShown({ layout: (0, import_canvas25.blendDiagramLayout)(from, target, (0, import_canvas25.easeDiagramTween)(t)), settled: t >= 1 });
4890
+ setShown({ layout: (0, import_canvas26.blendDiagramLayout)(from, target, (0, import_canvas26.easeDiagramTween)(t)), settled: t >= 1 });
4824
4891
  if (t < 1) frame = requestAnimationFrame(step);
4825
4892
  };
4826
4893
  frame = requestAnimationFrame(step);
4827
4894
  return () => cancelAnimationFrame(frame);
4828
4895
  }, [result.layout, duration]);
4829
4896
  const doc = result.document.tier === "editable" ? result.document : null;
4830
- const canvas = (0, import_react36.useMemo)(() => {
4897
+ const canvas = (0, import_react37.useMemo)(() => {
4831
4898
  if (!doc || !shown.layout) return { nodes: [], edges: [] };
4832
4899
  const placed = new Set(Object.keys(shown.layout.positions));
4833
4900
  const graph = {
@@ -4836,23 +4903,23 @@ function useMermaidStream(source, options = {}) {
4836
4903
  groups: doc.graph.groups.filter((g) => placed.has(g.id)),
4837
4904
  edges: doc.graph.edges.filter((e) => placed.has(e.source) && placed.has(e.target))
4838
4905
  };
4839
- return (0, import_canvas25.mermaidToCanvas)({ ...doc, graph }, { layout: shown.layout });
4906
+ return (0, import_canvas26.mermaidToCanvas)({ ...doc, graph }, { layout: shown.layout });
4840
4907
  }, [doc, shown.layout]);
4841
4908
  return { document: doc, ...canvas, layout: shown.layout, settled: shown.settled };
4842
4909
  }
4843
4910
 
4844
4911
  // src/canvas/MermaidDiagramNode.tsx
4845
- var import_canvas26 = require("@pixerate/editor/canvas");
4912
+ var import_canvas27 = require("@pixerate/editor/canvas");
4846
4913
  var import_jsx_runtime19 = require("react/jsx-runtime");
4847
4914
  function mermaidNodeStyle(styles = {}, selected = false) {
4848
- const paint = (0, import_canvas26.mermaidNodePaint)(styles, selected);
4915
+ const paint = (0, import_canvas27.mermaidNodePaint)(styles, selected);
4849
4916
  const { color, "stroke-width": strokeWidth, "stroke-dasharray": strokeDasharray, ...vars } = paint;
4850
4917
  return { ...vars, color, strokeWidth, strokeDasharray };
4851
4918
  }
4852
4919
  function MermaidDiagramNode({ data, width = 160, height = 56, selected, className = "", children }) {
4853
4920
  const node = data.node;
4854
4921
  if (!node) return null;
4855
- const members = (0, import_canvas26.mermaidNodeMembers)(node.data);
4922
+ const members = (0, import_canvas27.mermaidNodeMembers)(node.data);
4856
4923
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4857
4924
  "div",
4858
4925
  {
@@ -4861,13 +4928,13 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
4861
4928
  "data-selected": selected ? "true" : void 0,
4862
4929
  style: { position: "relative", width: "100%", height: "100%", ...mermaidNodeStyle(data.resolvedStyles, selected) },
4863
4930
  children: [
4864
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", width: "100%", height: "100%", style: { position: "absolute", inset: 0, overflow: "visible" }, "aria-hidden": "true", children: (0, import_canvas26.mermaidShapePaths)(node.shape, width, height).map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: path.d, style: { ...import_canvas26.MERMAID_SHAPE_PAINT[path.paint], vectorEffect: "non-scaling-stroke" } }, i)) }),
4931
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", width: "100%", height: "100%", style: { position: "absolute", inset: 0, overflow: "visible" }, "aria-hidden": "true", children: (0, import_canvas27.mermaidShapePaths)(node.shape, width, height).map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: path.d, style: { ...import_canvas27.MERMAID_SHAPE_PAINT[path.paint], vectorEffect: "non-scaling-stroke" } }, i)) }),
4865
4932
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4866
4933
  "div",
4867
4934
  {
4868
4935
  style: { position: "relative", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: members.length ? "flex-start" : "center", height: "100%", padding: "6px 10px", boxSizing: "border-box", fontSize: 13, lineHeight: 1.3, textAlign: "center", pointerEvents: "none" },
4869
4936
  children: [
4870
- (0, import_canvas26.mermaidLabelLines)(node.label).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { fontWeight: members.length ? 600 : void 0 }, children: line }, i)),
4937
+ (0, import_canvas27.mermaidLabelLines)(node.label).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { fontWeight: members.length ? 600 : void 0 }, children: line }, i)),
4871
4938
  members.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { alignSelf: "stretch", marginTop: 4, paddingTop: 4, borderTop: "1px solid var(--pixerate-diagram-node-border)", textAlign: "left", fontSize: 12 }, children: members.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: m }, i)) })
4872
4939
  ]
4873
4940
  }
@@ -4895,7 +4962,7 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
4895
4962
  color: data.resolvedStyles?.color ?? "var(--muted-foreground, #475569)"
4896
4963
  },
4897
4964
  children: [
4898
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { padding: "6px 10px", fontSize: 12, fontWeight: 600 }, children: (0, import_canvas26.mermaidLabelLines)(group.label).join(" ") }),
4965
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { padding: "6px 10px", fontSize: 12, fontWeight: 600 }, children: (0, import_canvas27.mermaidLabelLines)(group.label).join(" ") }),
4899
4966
  children
4900
4967
  ]
4901
4968
  }
@@ -4903,15 +4970,15 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
4903
4970
  }
4904
4971
 
4905
4972
  // src/canvas/MermaidThumbnail.tsx
4906
- var import_react37 = require("react");
4973
+ var import_react38 = require("react");
4907
4974
  var import_diagram2 = require("@pixerate/editor/diagram");
4908
- var import_canvas27 = require("@pixerate/editor/canvas");
4975
+ var import_canvas28 = require("@pixerate/editor/canvas");
4909
4976
  var import_jsx_runtime20 = require("react/jsx-runtime");
4910
4977
  function MermaidThumbnail({ source, className = "", fallback = null, ...options }) {
4911
- const doc = (0, import_react37.useMemo)(() => typeof source === "string" ? (0, import_diagram2.parseMermaid)(source) : source, [source]);
4978
+ const doc = (0, import_react38.useMemo)(() => typeof source === "string" ? (0, import_diagram2.parseMermaid)(source) : source, [source]);
4912
4979
  const key = JSON.stringify(options);
4913
- const drawn = (0, import_react37.useMemo)(
4914
- () => doc.tier === "editable" && doc.graph.nodes.length ? (0, import_canvas27.mermaidThumbnailSvg)(doc, options) : null,
4980
+ const drawn = (0, import_react38.useMemo)(
4981
+ () => doc.tier === "editable" && doc.graph.nodes.length ? (0, import_canvas28.mermaidThumbnailSvg)(doc, options) : null,
4915
4982
  // eslint-disable-next-line react-hooks/exhaustive-deps
4916
4983
  [doc, key]
4917
4984
  );
@@ -4920,12 +4987,12 @@ function MermaidThumbnail({ source, className = "", fallback = null, ...options
4920
4987
  }
4921
4988
 
4922
4989
  // src/canvas/useDiagramDirector.ts
4923
- var import_react38 = require("react");
4990
+ var import_react39 = require("react");
4924
4991
  var import_diagram3 = require("@pixerate/editor/diagram");
4925
4992
  function useDiagramDirector(controller, options) {
4926
- const placement = (0, import_react38.useRef)(options.placement);
4993
+ const placement = (0, import_react39.useRef)(options.placement);
4927
4994
  placement.current = options.placement;
4928
- const ref = (0, import_react38.useRef)(null);
4995
+ const ref = (0, import_react39.useRef)(null);
4929
4996
  if (!ref.current) {
4930
4997
  const presence = new import_diagram3.PresenceStore();
4931
4998
  ref.current = {
@@ -4936,7 +5003,7 @@ function useDiagramDirector(controller, options) {
4936
5003
  return ref.current;
4937
5004
  }
4938
5005
  function usePresenceState(presence) {
4939
- return (0, import_react38.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
5006
+ return (0, import_react39.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
4940
5007
  }
4941
5008
 
4942
5009
  // src/canvas/DiagramPresenceLayer.tsx
@@ -5022,9 +5089,11 @@ function DiagramPresenceLayer({ presence, viewport, className = "" }) {
5022
5089
  brushstrokeSeed,
5023
5090
  calculateDagreReflowDisplacement,
5024
5091
  calculateDirectionalDisplacement,
5092
+ calculateReflowDisplacement,
5025
5093
  canCombineShapeNodes,
5026
5094
  canOffsetShapeNodes,
5027
5095
  canOutlineShapeNodeStrokes,
5096
+ canvasExplosionToolTarget,
5028
5097
  canvasHeight,
5029
5098
  centerNodes,
5030
5099
  centre,
@@ -5032,6 +5101,7 @@ function DiagramPresenceLayer({ presence, viewport, className = "" }) {
5032
5101
  clampLayoutSize,
5033
5102
  combineCanvasComponentsAsVariants,
5034
5103
  combineShapeNodes,
5104
+ computeCanvasExplosionLayout,
5035
5105
  computeNodesBoundingBox,
5036
5106
  computeSnapGuides,
5037
5107
  connectedOnly,
@@ -5044,6 +5114,8 @@ function DiagramPresenceLayer({ presence, viewport, className = "" }) {
5044
5114
  createCanvasComponent,
5045
5115
  createCanvasComponentsController,
5046
5116
  createCanvasDrawController,
5117
+ createCanvasExplosionStateController,
5118
+ createCanvasExplosionToolProvider,
5047
5119
  createCanvasInstance,
5048
5120
  createCanvasScenesStore,
5049
5121
  createDefaultStrokeStyle,
@@ -5072,6 +5144,7 @@ function DiagramPresenceLayer({ presence, viewport, className = "" }) {
5072
5144
  evaluateEasing,
5073
5145
  evaluateTrack,
5074
5146
  excludePaths,
5147
+ explosionEdgeId,
5075
5148
  exportCssAnimation,
5076
5149
  findConnectorSnap,
5077
5150
  findStrokesAtPoint,
@@ -5181,6 +5254,7 @@ function DiagramPresenceLayer({ presence, viewport, className = "" }) {
5181
5254
  multiPolygonArea,
5182
5255
  multiPolygonBounds,
5183
5256
  nearestHandlePositions,
5257
+ nodeSizeOf,
5184
5258
  normalizeBezierPath,
5185
5259
  normalizeKeyframes,
5186
5260
  offsetPath,
@@ -5297,6 +5371,7 @@ function DiagramPresenceLayer({ presence, viewport, className = "" }) {
5297
5371
  useCanvasEffectsProviderContext,
5298
5372
  useCanvasEffectsTools,
5299
5373
  useCanvasExplosion,
5374
+ useCanvasExplosionState,
5300
5375
  useCanvasGraph,
5301
5376
  useCanvasLayout,
5302
5377
  useCanvasMeasure,