@pixerate/editor-react 0.193.0 → 0.195.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.
- package/dist/canvas/AnimatedEdge.d.cts +57 -0
- package/dist/canvas/AnimatedEdge.d.ts +57 -0
- package/dist/canvas/index.cjs +727 -591
- package/dist/canvas/index.d.cts +2 -0
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/index.js +308 -169
- package/package.json +4 -4
package/dist/canvas/index.cjs
CHANGED
|
@@ -31,24 +31,27 @@ 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: () =>
|
|
35
|
-
ANIMATION_DATA_KEY: () =>
|
|
36
|
-
ANIMATION_EASING_LABELS: () =>
|
|
37
|
-
ANIMATION_EASING_PRESETS: () =>
|
|
38
|
-
ANIMATION_TIME_EPSILON: () =>
|
|
39
|
-
AUTO_LAYOUT_DATA_KEY: () =>
|
|
34
|
+
ANIMATABLE_PROPERTIES: () => import_canvas40.ANIMATABLE_PROPERTIES,
|
|
35
|
+
ANIMATION_DATA_KEY: () => import_canvas40.ANIMATION_DATA_KEY,
|
|
36
|
+
ANIMATION_EASING_LABELS: () => import_canvas40.ANIMATION_EASING_LABELS,
|
|
37
|
+
ANIMATION_EASING_PRESETS: () => import_canvas40.ANIMATION_EASING_PRESETS,
|
|
38
|
+
ANIMATION_TIME_EPSILON: () => import_canvas40.ANIMATION_TIME_EPSILON,
|
|
39
|
+
AUTO_LAYOUT_DATA_KEY: () => import_canvas38.AUTO_LAYOUT_DATA_KEY,
|
|
40
40
|
AgentPresenceLayer: () => AgentPresenceLayer,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
AnimatedEdge: () => AnimatedEdge,
|
|
42
|
+
AnimationEditError: () => import_canvas40.AnimationEditError,
|
|
43
|
+
AnimationPlayer: () => import_canvas40.AnimationPlayer,
|
|
43
44
|
AnimationTimeline: () => AnimationTimeline,
|
|
44
|
-
CANVAS_COMPONENT_DRAG_TYPE: () =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
CANVAS_COMPONENT_DRAG_TYPE: () => import_canvas41.CANVAS_COMPONENT_DRAG_TYPE,
|
|
46
|
+
CANVAS_EDGE_ANIMATION_KINDS: () => import_canvas34.CANVAS_EDGE_ANIMATION_KINDS,
|
|
47
|
+
CANVAS_EDGE_ANIMATION_SCHEMA: () => import_canvas34.CANVAS_EDGE_ANIMATION_SCHEMA,
|
|
48
|
+
CANVAS_GRADIENT_PRESETS: () => import_canvas41.CANVAS_GRADIENT_PRESETS,
|
|
49
|
+
CANVAS_PROPOSAL_CLASS: () => import_canvas42.CANVAS_PROPOSAL_CLASS,
|
|
50
|
+
CANVAS_TOKEN_PROPERTIES: () => import_canvas39.CANVAS_TOKEN_PROPERTIES,
|
|
51
|
+
CHILD_LAYOUT_DATA_KEY: () => import_canvas38.CHILD_LAYOUT_DATA_KEY,
|
|
52
|
+
CONNECTION_LINE_TYPES: () => import_canvas33.CONNECTION_LINE_TYPES,
|
|
53
|
+
CSS_ANIMATION_PROPERTIES: () => import_canvas40.CSS_ANIMATION_PROPERTIES,
|
|
54
|
+
CUBIC_BEZIER_PRESETS: () => import_canvas40.CUBIC_BEZIER_PRESETS,
|
|
52
55
|
CanvasComponentsPanel: () => CanvasComponentsPanel,
|
|
53
56
|
CanvasDrawLayer: () => CanvasDrawLayer,
|
|
54
57
|
CanvasEffectsPanel: () => CanvasEffectsPanel,
|
|
@@ -56,323 +59,333 @@ __export(canvas_exports, {
|
|
|
56
59
|
CanvasGuidesLayer: () => CanvasGuidesLayer,
|
|
57
60
|
CanvasInstanceInspector: () => CanvasInstanceInspector,
|
|
58
61
|
CanvasNodeEffectLayer: () => CanvasNodeEffectLayer,
|
|
59
|
-
CanvasScenesStore: () =>
|
|
60
|
-
DEFAULT_ARRANGE_SHORTCUTS: () =>
|
|
62
|
+
CanvasScenesStore: () => import_canvas33.CanvasScenesStore,
|
|
63
|
+
DEFAULT_ARRANGE_SHORTCUTS: () => import_canvas33.DEFAULT_ARRANGE_SHORTCUTS,
|
|
61
64
|
DiagramPresenceLayer: () => DiagramPresenceLayer,
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
EdgeAnimation: () => EdgeAnimation,
|
|
66
|
+
MAX_KEYFRAME_REFS: () => import_canvas40.MAX_KEYFRAME_REFS,
|
|
67
|
+
ManualClock: () => import_canvas37.ManualClock,
|
|
64
68
|
MermaidDiagramGroup: () => MermaidDiagramGroup,
|
|
65
69
|
MermaidDiagramNode: () => MermaidDiagramNode,
|
|
66
70
|
MermaidFamilyScene: () => MermaidFamilyScene,
|
|
67
71
|
MermaidThumbnail: () => MermaidThumbnail,
|
|
68
72
|
PresenceLayer: () => PresenceLayer,
|
|
69
|
-
RESIZE_HANDLES: () =>
|
|
70
|
-
SHAPE_DATA_KEY: () =>
|
|
71
|
-
SHAPE_KINDS: () =>
|
|
72
|
-
SHAPE_NODE_TYPE: () =>
|
|
73
|
-
SHAPE_OPERATIONS: () =>
|
|
73
|
+
RESIZE_HANDLES: () => import_canvas32.RESIZE_HANDLES,
|
|
74
|
+
SHAPE_DATA_KEY: () => import_canvas35.SHAPE_DATA_KEY,
|
|
75
|
+
SHAPE_KINDS: () => import_canvas35.SHAPE_KINDS,
|
|
76
|
+
SHAPE_NODE_TYPE: () => import_canvas35.SHAPE_NODE_TYPE,
|
|
77
|
+
SHAPE_OPERATIONS: () => import_canvas35.SHAPE_OPERATIONS,
|
|
74
78
|
ShapeNode: () => ShapeNode,
|
|
75
79
|
ShapeNodeZoomContext: () => ShapeNodeZoomContext,
|
|
76
80
|
ShapeNodeZoomProvider: () => ShapeNodeZoomProvider,
|
|
77
|
-
TOKEN_BINDINGS_DATA_KEY: () =>
|
|
78
|
-
TOKEN_MODES_DATA_KEY: () =>
|
|
81
|
+
TOKEN_BINDINGS_DATA_KEY: () => import_canvas39.TOKEN_BINDINGS_DATA_KEY,
|
|
82
|
+
TOKEN_MODES_DATA_KEY: () => import_canvas39.TOKEN_MODES_DATA_KEY,
|
|
79
83
|
TokenBindingPicker: () => TokenBindingPicker,
|
|
80
84
|
TokenModeSwitcher: () => TokenModeSwitcher,
|
|
81
|
-
addCanvasVariant: () =>
|
|
82
|
-
addKeyframesAtTime: () =>
|
|
83
|
-
alignNodes: () =>
|
|
84
|
-
angleToSvgLinearCoords: () =>
|
|
85
|
-
animateNode: () =>
|
|
86
|
-
applyAnimation: () =>
|
|
87
|
-
applyAnimationOverrides: () =>
|
|
88
|
-
applyConstraints: () =>
|
|
89
|
-
applyNodeUpdates: () =>
|
|
90
|
-
applyShapeCombination: () =>
|
|
91
|
-
applyShapeReplacement: () =>
|
|
92
|
-
bezierPathArea: () =>
|
|
93
|
-
bezierPathBounds: () =>
|
|
94
|
-
bezierPathLength: () =>
|
|
95
|
-
bezierPathPointAtLength: () =>
|
|
96
|
-
bezierPathSignedArea: () =>
|
|
97
|
-
bezierPathToSvg: () =>
|
|
98
|
-
bindCanvasComponentProperty: () =>
|
|
99
|
-
bindCanvasToken: () =>
|
|
100
|
-
blendLayout: () =>
|
|
101
|
-
boundsOf: () =>
|
|
102
|
-
brushstrokeScaleBucket: () =>
|
|
103
|
-
brushstrokeSeed: () =>
|
|
104
|
-
calculateDagreReflowDisplacement: () =>
|
|
105
|
-
calculateDirectionalDisplacement: () =>
|
|
106
|
-
calculateReflowDisplacement: () =>
|
|
107
|
-
canCombineShapeNodes: () =>
|
|
108
|
-
canOffsetShapeNodes: () =>
|
|
109
|
-
canOutlineShapeNodeStrokes: () =>
|
|
110
|
-
canvasExplosionToolTarget: () =>
|
|
111
|
-
canvasHeight: () =>
|
|
112
|
-
centerNodes: () =>
|
|
113
|
-
centre: () =>
|
|
114
|
-
clampAnimationValue: () =>
|
|
115
|
-
clampLayoutSize: () =>
|
|
116
|
-
combineCanvasComponentsAsVariants: () =>
|
|
117
|
-
combineShapeNodes: () =>
|
|
118
|
-
computeCanvasExplosionLayout: () =>
|
|
119
|
-
computeNodesBoundingBox: () =>
|
|
120
|
-
computeSnapGuides: () =>
|
|
121
|
-
connectedOnly: () =>
|
|
122
|
-
copyKeyframes: () =>
|
|
123
|
-
countPathSegments: () =>
|
|
124
|
-
createAnimationPlayer: () =>
|
|
125
|
-
createBezierTrajectory: () =>
|
|
126
|
-
createCanvasAnimationController: () =>
|
|
127
|
-
createCanvasAutoLayoutController: () =>
|
|
128
|
-
createCanvasChangeFeed: () =>
|
|
129
|
-
createCanvasComponent: () =>
|
|
130
|
-
createCanvasComponentsController: () =>
|
|
131
|
-
createCanvasDrawController: () =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
85
|
+
addCanvasVariant: () => import_canvas41.addCanvasVariant,
|
|
86
|
+
addKeyframesAtTime: () => import_canvas40.addKeyframesAtTime,
|
|
87
|
+
alignNodes: () => import_canvas33.alignNodes,
|
|
88
|
+
angleToSvgLinearCoords: () => import_canvas41.angleToSvgLinearCoords,
|
|
89
|
+
animateNode: () => import_canvas40.animateNode,
|
|
90
|
+
applyAnimation: () => import_canvas40.applyAnimation,
|
|
91
|
+
applyAnimationOverrides: () => import_canvas40.applyAnimationOverrides,
|
|
92
|
+
applyConstraints: () => import_canvas38.applyConstraints,
|
|
93
|
+
applyNodeUpdates: () => import_canvas33.applyNodeUpdates,
|
|
94
|
+
applyShapeCombination: () => import_canvas35.applyShapeCombination,
|
|
95
|
+
applyShapeReplacement: () => import_canvas36.applyShapeReplacement,
|
|
96
|
+
bezierPathArea: () => import_canvas36.bezierPathArea,
|
|
97
|
+
bezierPathBounds: () => import_canvas36.bezierPathBounds,
|
|
98
|
+
bezierPathLength: () => import_canvas36.bezierPathLength,
|
|
99
|
+
bezierPathPointAtLength: () => import_canvas36.bezierPathPointAtLength,
|
|
100
|
+
bezierPathSignedArea: () => import_canvas36.bezierPathSignedArea,
|
|
101
|
+
bezierPathToSvg: () => import_canvas36.bezierPathToSvg,
|
|
102
|
+
bindCanvasComponentProperty: () => import_canvas41.bindCanvasComponentProperty,
|
|
103
|
+
bindCanvasToken: () => import_canvas39.bindCanvasToken,
|
|
104
|
+
blendLayout: () => import_canvas37.blendLayout,
|
|
105
|
+
boundsOf: () => import_canvas37.boundsOf,
|
|
106
|
+
brushstrokeScaleBucket: () => import_canvas41.brushstrokeScaleBucket,
|
|
107
|
+
brushstrokeSeed: () => import_canvas41.brushstrokeSeed,
|
|
108
|
+
calculateDagreReflowDisplacement: () => import_canvas37.calculateDagreReflowDisplacement,
|
|
109
|
+
calculateDirectionalDisplacement: () => import_canvas37.calculateDirectionalDisplacement,
|
|
110
|
+
calculateReflowDisplacement: () => import_canvas37.calculateReflowDisplacement,
|
|
111
|
+
canCombineShapeNodes: () => import_canvas35.canCombineShapeNodes,
|
|
112
|
+
canOffsetShapeNodes: () => import_canvas36.canOffsetShapeNodes,
|
|
113
|
+
canOutlineShapeNodeStrokes: () => import_canvas36.canOutlineShapeNodeStrokes,
|
|
114
|
+
canvasExplosionToolTarget: () => import_canvas31.canvasExplosionToolTarget,
|
|
115
|
+
canvasHeight: () => import_canvas37.canvasHeight,
|
|
116
|
+
centerNodes: () => import_canvas37.centerNodes,
|
|
117
|
+
centre: () => import_canvas37.centre,
|
|
118
|
+
clampAnimationValue: () => import_canvas40.clampAnimationValue,
|
|
119
|
+
clampLayoutSize: () => import_canvas38.clampLayoutSize,
|
|
120
|
+
combineCanvasComponentsAsVariants: () => import_canvas41.combineCanvasComponentsAsVariants,
|
|
121
|
+
combineShapeNodes: () => import_canvas35.combineShapeNodes,
|
|
122
|
+
computeCanvasExplosionLayout: () => import_canvas31.computeCanvasExplosionLayout,
|
|
123
|
+
computeNodesBoundingBox: () => import_canvas37.computeNodesBoundingBox,
|
|
124
|
+
computeSnapGuides: () => import_canvas33.computeSnapGuides,
|
|
125
|
+
connectedOnly: () => import_canvas37.connectedOnly,
|
|
126
|
+
copyKeyframes: () => import_canvas40.copyKeyframes,
|
|
127
|
+
countPathSegments: () => import_canvas36.countPathSegments,
|
|
128
|
+
createAnimationPlayer: () => import_canvas40.createAnimationPlayer,
|
|
129
|
+
createBezierTrajectory: () => import_canvas37.createBezierTrajectory,
|
|
130
|
+
createCanvasAnimationController: () => import_canvas40.createCanvasAnimationController,
|
|
131
|
+
createCanvasAutoLayoutController: () => import_canvas38.createCanvasAutoLayoutController,
|
|
132
|
+
createCanvasChangeFeed: () => import_canvas42.createCanvasChangeFeed,
|
|
133
|
+
createCanvasComponent: () => import_canvas41.createCanvasComponent,
|
|
134
|
+
createCanvasComponentsController: () => import_canvas41.createCanvasComponentsController,
|
|
135
|
+
createCanvasDrawController: () => import_canvas41.createCanvasDrawController,
|
|
136
|
+
createCanvasEdgeAnimationToolProvider: () => import_canvas34.createCanvasEdgeAnimationToolProvider,
|
|
137
|
+
createCanvasExplosionStateController: () => import_canvas31.createCanvasExplosionStateController,
|
|
138
|
+
createCanvasExplosionToolProvider: () => import_canvas31.createCanvasExplosionToolProvider,
|
|
139
|
+
createCanvasInstance: () => import_canvas41.createCanvasInstance,
|
|
140
|
+
createCanvasProposalToolProvider: () => import_canvas42.createCanvasProposalToolProvider,
|
|
141
|
+
createCanvasProposals: () => import_canvas42.createCanvasProposals,
|
|
142
|
+
createCanvasScenesStore: () => import_canvas33.createCanvasScenesStore,
|
|
143
|
+
createDefaultStrokeStyle: () => import_canvas41.createDefaultStrokeStyle,
|
|
144
|
+
createFanOutTrajectory: () => import_canvas37.createFanOutTrajectory,
|
|
145
|
+
createGuideIndex: () => import_canvas33.createGuideIndex,
|
|
146
|
+
createNodeGuideIndex: () => import_canvas33.createNodeGuideIndex,
|
|
147
|
+
cubicBezierAt: () => import_canvas40.cubicBezierAt,
|
|
148
|
+
cubicPointAt: () => import_canvas32.cubicPointAt,
|
|
149
|
+
cubicsToPathData: () => import_canvas32.cubicsToPathData,
|
|
150
|
+
dashContours: () => import_canvas36.dashContours,
|
|
151
|
+
defaultEasing: () => import_canvas37.defaultEasing,
|
|
152
|
+
deleteKeyframes: () => import_canvas40.deleteKeyframes,
|
|
153
|
+
detachCanvasInstance: () => import_canvas41.detachCanvasInstance,
|
|
154
|
+
detachTokenBindings: () => import_canvas39.detachTokenBindings,
|
|
155
|
+
distanceToBezierPath: () => import_canvas36.distanceToBezierPath,
|
|
156
|
+
distributeNodes: () => import_canvas33.distributeNodes,
|
|
157
|
+
dividePaths: () => import_canvas36.dividePaths,
|
|
158
|
+
dividePolygons: () => import_canvas35.dividePolygons,
|
|
159
|
+
easingFromInfluence: () => import_canvas40.easingFromInfluence,
|
|
160
|
+
easingLabel: () => import_canvas40.easingLabel,
|
|
161
|
+
easingToCss: () => import_canvas40.easingToCss,
|
|
162
|
+
ensureLayout: () => import_canvas37.ensureLayout,
|
|
163
|
+
estimateCanvasHeight: () => import_canvas37.estimateCanvasHeight,
|
|
164
|
+
estimateNodeSize: () => import_canvas37.estimateNodeSize,
|
|
165
|
+
evaluateAnimation: () => import_canvas40.evaluateAnimation,
|
|
166
|
+
evaluateEasing: () => import_canvas40.evaluateEasing,
|
|
167
|
+
evaluateTrack: () => import_canvas40.evaluateTrack,
|
|
168
|
+
excludePaths: () => import_canvas36.excludePaths,
|
|
169
|
+
explosionEdgeId: () => import_canvas31.explosionEdgeId,
|
|
170
|
+
exportCssAnimation: () => import_canvas40.exportCssAnimation,
|
|
171
|
+
findConnectorSnap: () => import_canvas33.findConnectorSnap,
|
|
172
|
+
findStrokesAtPoint: () => import_canvas41.findStrokesAtPoint,
|
|
173
|
+
fitCubicRun: () => import_canvas32.fitCubicRun,
|
|
174
|
+
fitCubics: () => import_canvas32.fitCubics,
|
|
175
|
+
fitFreehandPath: () => import_canvas32.fitFreehandPath,
|
|
176
|
+
fitPathData: () => import_canvas32.fitPathData,
|
|
177
|
+
fitViewportToNodes: () => import_canvas33.fitViewportToNodes,
|
|
178
|
+
fitViewportToRect: () => import_canvas33.fitViewportToRect,
|
|
179
|
+
flattenSvgPath: () => import_canvas35.flattenSvgPath,
|
|
180
|
+
flowSide: () => import_canvas37.flowSide,
|
|
181
|
+
formatAnimationTime: () => import_canvas40.formatAnimationTime,
|
|
182
|
+
formatOklab: () => import_canvas40.formatOklab,
|
|
183
|
+
freehandBrushstroke: () => import_canvas41.freehandBrushstroke,
|
|
184
|
+
getAbsolutePosition: () => import_canvas33.getAbsolutePosition,
|
|
185
|
+
getAnimatableProperty: () => import_canvas40.getAnimatableProperty,
|
|
186
|
+
getAnimatedProperties: () => import_canvas40.getAnimatedProperties,
|
|
187
|
+
getAnimatedValue: () => import_canvas40.getAnimatedValue,
|
|
188
|
+
getAnimationDuration: () => import_canvas40.getAnimationDuration,
|
|
189
|
+
getAnimationTrack: () => import_canvas40.getAnimationTrack,
|
|
190
|
+
getAutoLayout: () => import_canvas38.getAutoLayout,
|
|
191
|
+
getAutoLayoutGrid: () => import_canvas38.getAutoLayoutGrid,
|
|
192
|
+
getAutoLayoutInsertTarget: () => import_canvas38.getAutoLayoutInsertTarget,
|
|
193
|
+
getBindableTokenProperties: () => import_canvas39.getBindableTokenProperties,
|
|
194
|
+
getBrushedShapeSvg: () => import_canvas41.getBrushedShapeSvg,
|
|
195
|
+
getCanvasComponentDragId: () => import_canvas41.getCanvasComponentDragId,
|
|
196
|
+
getCanvasEdgeAnimation: () => import_canvas34.getCanvasEdgeAnimation,
|
|
197
|
+
getCanvasEdgeAnimationRender: () => import_canvas34.getCanvasEdgeAnimationRender,
|
|
198
|
+
getCanvasEdgePath: () => import_canvas34.getCanvasEdgePath,
|
|
199
|
+
getCanvasTokenProperty: () => import_canvas39.getCanvasTokenProperty,
|
|
200
|
+
getCenteredNodePosition: () => import_canvas37.getCenteredNodePosition,
|
|
201
|
+
getChildLayout: () => import_canvas38.getChildLayout,
|
|
202
|
+
getComponentSourceId: () => import_canvas41.getComponentSourceId,
|
|
203
|
+
getCssPropertyAnimations: () => import_canvas40.getCssPropertyAnimations,
|
|
204
|
+
getEffectiveTokenModes: () => import_canvas39.getEffectiveTokenModes,
|
|
205
|
+
getFlowChildren: () => import_canvas38.getFlowChildren,
|
|
206
|
+
getInstanceData: () => import_canvas41.getInstanceData,
|
|
207
|
+
getInstanceStatus: () => import_canvas41.getInstanceStatus,
|
|
208
|
+
getKeyframeTimes: () => import_canvas40.getKeyframeTimes,
|
|
209
|
+
getLayoutParent: () => import_canvas38.getLayoutParent,
|
|
210
|
+
getLayoutSizing: () => import_canvas38.getLayoutSizing,
|
|
211
|
+
getLayoutedNodes: () => import_canvas37.getLayoutedNodes,
|
|
212
|
+
getNextVariantValues: () => import_canvas41.getNextVariantValues,
|
|
213
|
+
getNodeAnimation: () => import_canvas40.getNodeAnimation,
|
|
214
|
+
getNodeOverrides: () => import_canvas41.getNodeOverrides,
|
|
215
|
+
getNodeRect: () => import_canvas33.getNodeRect,
|
|
216
|
+
getNodeShape: () => import_canvas35.getNodeShape,
|
|
217
|
+
getNodeSize: () => import_canvas33.getNodeSize,
|
|
218
|
+
getNodeTokenBindings: () => import_canvas39.getNodeTokenBindings,
|
|
219
|
+
getNodeTokenModes: () => import_canvas39.getNodeTokenModes,
|
|
220
|
+
getResizingNodeRect: () => import_canvas32.getResizingNodeRect,
|
|
221
|
+
getShapeRenderData: () => import_canvas35.getShapeRenderData,
|
|
222
|
+
getShapeSvg: () => import_canvas35.getShapeSvg,
|
|
223
|
+
getTimelineRows: () => import_canvas40.getTimelineRows,
|
|
224
|
+
getTimelineTicks: () => import_canvas40.getTimelineTicks,
|
|
225
|
+
getTokenPropertyScope: () => import_canvas39.getTokenPropertyScope,
|
|
226
|
+
getTokensForProperty: () => import_canvas39.getTokensForProperty,
|
|
227
|
+
gradientToSvgDef: () => import_canvas41.gradientToSvgDef,
|
|
228
|
+
handlePoint: () => import_canvas33.handlePoint,
|
|
229
|
+
hasVisibleStroke: () => import_canvas36.hasVisibleStroke,
|
|
230
|
+
inferResizeHandle: () => import_canvas32.inferResizeHandle,
|
|
231
|
+
inspectCanvasInstance: () => import_canvas41.inspectCanvasInstance,
|
|
232
|
+
inspectNodeTokens: () => import_canvas39.inspectNodeTokens,
|
|
233
|
+
interpolateAnimationValue: () => import_canvas40.interpolateAnimationValue,
|
|
234
|
+
intersectPaths: () => import_canvas36.intersectPaths,
|
|
235
|
+
intersectPolygons: () => import_canvas35.intersectPolygons,
|
|
236
|
+
invertNodeUpdates: () => import_canvas33.invertNodeUpdates,
|
|
237
|
+
isAnimationEasing: () => import_canvas40.isAnimationEasing,
|
|
238
|
+
isAnimationKeyframe: () => import_canvas40.isAnimationKeyframe,
|
|
239
|
+
isAutoLayoutFrame: () => import_canvas38.isAutoLayoutFrame,
|
|
240
|
+
isBrushedShape: () => import_canvas41.isBrushedShape,
|
|
241
|
+
isCanvasComponent: () => import_canvas41.isCanvasComponent,
|
|
242
|
+
isCanvasComponentSet: () => import_canvas41.isCanvasComponentSet,
|
|
243
|
+
isCanvasGradient: () => import_canvas41.isCanvasGradient,
|
|
244
|
+
isCanvasInstance: () => import_canvas41.isCanvasInstance,
|
|
245
|
+
isCssExportExact: () => import_canvas40.isCssExportExact,
|
|
246
|
+
isEventFromTextInput: () => import_canvas37.isEventFromTextInput,
|
|
247
|
+
isKeyframeSelected: () => import_canvas40.isKeyframeSelected,
|
|
248
|
+
isLocked: () => import_canvas33.isLocked,
|
|
249
|
+
isMeasureModifierHeld: () => import_canvas32.isMeasureModifierHeld,
|
|
250
|
+
isNodeAnimated: () => import_canvas40.isNodeAnimated,
|
|
251
|
+
isShapeDescription: () => import_canvas35.isShapeDescription,
|
|
252
|
+
isShapeNode: () => import_canvas35.isShapeNode,
|
|
253
|
+
isStraightCubic: () => import_canvas32.isStraightCubic,
|
|
254
|
+
isValidCanvasNode: () => import_canvas37.isValidCanvasNode,
|
|
255
|
+
isValidUrl: () => import_canvas37.isValidUrl,
|
|
256
|
+
layoutAll: () => import_canvas38.layoutAll,
|
|
257
|
+
layoutBounds: () => import_canvas37.layoutBounds,
|
|
258
|
+
layoutFrame: () => import_canvas38.layoutFrame,
|
|
259
|
+
layoutUp: () => import_canvas38.layoutUp,
|
|
260
|
+
layoutUpMany: () => import_canvas38.layoutUpMany,
|
|
261
|
+
linearPositionTrajectory: () => import_canvas37.linearPositionTrajectory,
|
|
262
|
+
linearTrajectory: () => import_canvas37.linearTrajectory,
|
|
263
|
+
listCanvasBrushes: () => import_canvas41.listCanvasBrushes,
|
|
264
|
+
listCanvasComponents: () => import_canvas41.listCanvasComponents,
|
|
265
|
+
loadCanvasBrushstrokeRenderer: () => import_canvas41.loadCanvasBrushstrokeRenderer,
|
|
266
|
+
lockNodes: () => import_canvas33.lockNodes,
|
|
267
|
+
makeSizingCoherent: () => import_canvas38.makeSizingCoherent,
|
|
268
|
+
matchArrangeShortcut: () => import_canvas33.matchArrangeShortcut,
|
|
269
|
+
matchSize: () => import_canvas33.matchSize,
|
|
270
|
+
measureBetween: () => import_canvas32.measureBetween,
|
|
271
|
+
measureLabel: () => import_canvas32.measureLabel,
|
|
272
|
+
measureSelection: () => import_canvas32.measureSelection,
|
|
273
|
+
measureSvgPath: () => import_canvas34.measureSvgPath,
|
|
274
|
+
measureToLine: () => import_canvas32.measureToLine,
|
|
275
|
+
mergeNodeUpdates: () => import_canvas38.mergeNodeUpdates,
|
|
267
276
|
mermaidNodeStyle: () => mermaidNodeStyle,
|
|
268
|
-
mixColorsOklab: () =>
|
|
269
|
-
moveKeyframes: () =>
|
|
270
|
-
moveLayoutChild: () =>
|
|
271
|
-
multiPolygonArea: () =>
|
|
272
|
-
multiPolygonBounds: () =>
|
|
273
|
-
nearestHandlePositions: () =>
|
|
274
|
-
nodeSizeOf: () =>
|
|
275
|
-
normalizeBezierPath: () =>
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
277
|
+
mixColorsOklab: () => import_canvas40.mixColorsOklab,
|
|
278
|
+
moveKeyframes: () => import_canvas40.moveKeyframes,
|
|
279
|
+
moveLayoutChild: () => import_canvas38.moveLayoutChild,
|
|
280
|
+
multiPolygonArea: () => import_canvas35.multiPolygonArea,
|
|
281
|
+
multiPolygonBounds: () => import_canvas35.multiPolygonBounds,
|
|
282
|
+
nearestHandlePositions: () => import_canvas33.nearestHandlePositions,
|
|
283
|
+
nodeSizeOf: () => import_canvas37.nodeSizeOf,
|
|
284
|
+
normalizeBezierPath: () => import_canvas36.normalizeBezierPath,
|
|
285
|
+
normalizeCanvasEdgeAnimation: () => import_canvas34.normalizeCanvasEdgeAnimation,
|
|
286
|
+
normalizeKeyframes: () => import_canvas40.normalizeKeyframes,
|
|
287
|
+
offsetPath: () => import_canvas36.offsetPath,
|
|
288
|
+
offsetShapeNodes: () => import_canvas36.offsetShapeNodes,
|
|
289
|
+
oklabToRgb: () => import_canvas40.oklabToRgb,
|
|
290
|
+
oppositePosition: () => import_canvas33.oppositePosition,
|
|
291
|
+
outlineShapeNodeStrokes: () => import_canvas36.outlineShapeNodeStrokes,
|
|
292
|
+
outlineStroke: () => import_canvas36.outlineStroke,
|
|
293
|
+
overlaps: () => import_canvas37.overlaps,
|
|
294
|
+
parseCanvasClipboardData: () => import_canvas37.parseCanvasClipboardData,
|
|
295
|
+
parseCanvasScenes: () => import_canvas33.parseCanvasScenes,
|
|
296
|
+
parseCssEasing: () => import_canvas40.parseCssEasing,
|
|
297
|
+
parseCssGradient: () => import_canvas41.parseCssGradient,
|
|
298
|
+
parseKeyframeClipboard: () => import_canvas40.parseKeyframeClipboard,
|
|
299
|
+
parseOklab: () => import_canvas40.parseOklab,
|
|
300
|
+
parseSvgPath: () => import_canvas35.parseSvgPath,
|
|
301
|
+
pasteKeyframes: () => import_canvas40.pasteKeyframes,
|
|
302
|
+
pathBoolean: () => import_canvas36.pathBoolean,
|
|
303
|
+
pathDataToPolyline: () => import_canvas41.pathDataToPolyline,
|
|
304
|
+
placeBeside: () => import_canvas37.placeBeside,
|
|
305
|
+
playWebAnimations: () => import_canvas40.playWebAnimations,
|
|
306
|
+
pointInBezierPath: () => import_canvas36.pointInBezierPath,
|
|
307
|
+
pointInMultiPolygon: () => import_canvas35.pointInMultiPolygon,
|
|
308
|
+
pointInRings: () => import_canvas35.pointInRings,
|
|
309
|
+
pointerPenSample: () => import_canvas41.pointerPenSample,
|
|
310
|
+
polygonArea: () => import_canvas35.polygonArea,
|
|
311
|
+
polygonBoolean: () => import_canvas35.polygonBoolean,
|
|
312
|
+
polygonToSvgPath: () => import_canvas35.polygonToSvgPath,
|
|
313
|
+
positionToSide: () => import_canvas33.positionToSide,
|
|
314
|
+
profileAlongPolyline: () => import_canvas41.profileAlongPolyline,
|
|
315
|
+
pruneCanvasTokenModes: () => import_canvas39.pruneCanvasTokenModes,
|
|
316
|
+
pushCanvasInstanceOverrides: () => import_canvas41.pushCanvasInstanceOverrides,
|
|
317
|
+
readAnimatableValue: () => import_canvas40.readAnimatableValue,
|
|
318
|
+
readNodeStyleProperty: () => import_canvas39.readNodeStyleProperty,
|
|
319
|
+
readStyleSize: () => import_canvas33.readStyleSize,
|
|
320
|
+
realClock: () => import_canvas37.realClock,
|
|
321
|
+
recordAnimationChanges: () => import_canvas40.recordAnimationChanges,
|
|
322
|
+
relayoutUpdates: () => import_canvas38.relayoutUpdates,
|
|
323
|
+
remapPastedNodes: () => import_canvas37.remapPastedNodes,
|
|
324
|
+
removeCanvasVariant: () => import_canvas41.removeCanvasVariant,
|
|
325
|
+
removeTrack: () => import_canvas40.removeTrack,
|
|
326
|
+
renameCanvasVariantProperty: () => import_canvas41.renameCanvasVariantProperty,
|
|
327
|
+
renameCanvasVariantValue: () => import_canvas41.renameCanvasVariantValue,
|
|
328
|
+
renderCanvasBrushSwatch: () => import_canvas41.renderCanvasBrushSwatch,
|
|
329
|
+
renderShapeBrushstroke: () => import_canvas41.renderShapeBrushstroke,
|
|
330
|
+
reorderNodes: () => import_canvas33.reorderNodes,
|
|
331
|
+
repositionNodesTo: () => import_canvas37.repositionNodesTo,
|
|
332
|
+
resetCanvasInstanceOverrides: () => import_canvas41.resetCanvasInstanceOverrides,
|
|
333
|
+
resizeHandleAxes: () => import_canvas32.resizeHandleAxes,
|
|
334
|
+
resolveCanvasEdgeAnimation: () => import_canvas34.resolveCanvasEdgeAnimation,
|
|
335
|
+
resolveCanvasGradient: () => import_canvas41.resolveCanvasGradient,
|
|
336
|
+
resolveCanvasTokens: () => import_canvas39.resolveCanvasTokens,
|
|
337
|
+
resolveEasing: () => import_canvas40.resolveEasing,
|
|
338
|
+
resolvePadding: () => import_canvas38.resolvePadding,
|
|
339
|
+
restoreCanvasMainComponent: () => import_canvas41.restoreCanvasMainComponent,
|
|
340
|
+
revertShapeCombination: () => import_canvas35.revertShapeCombination,
|
|
341
|
+
rgbToOklab: () => import_canvas40.rgbToOklab,
|
|
342
|
+
ringSignedArea: () => import_canvas35.ringSignedArea,
|
|
343
|
+
runMultiNodeTransition: () => import_canvas37.runMultiNodeTransition,
|
|
344
|
+
sampleAnimationFrames: () => import_canvas40.sampleAnimationFrames,
|
|
345
|
+
sampleCanvasEdgeAnimation: () => import_canvas34.sampleCanvasEdgeAnimation,
|
|
346
|
+
scaleKeyframes: () => import_canvas40.scaleKeyframes,
|
|
347
|
+
serializeCanvasNodes: () => import_canvas37.serializeCanvasNodes,
|
|
348
|
+
setCanvasComponentProperty: () => import_canvas41.setCanvasComponentProperty,
|
|
349
|
+
setCanvasEdgeAnimation: () => import_canvas34.setCanvasEdgeAnimation,
|
|
350
|
+
setCanvasInstanceProperties: () => import_canvas41.setCanvasInstanceProperties,
|
|
351
|
+
setCanvasTokenMode: () => import_canvas39.setCanvasTokenMode,
|
|
352
|
+
setCanvasVariantProperties: () => import_canvas41.setCanvasVariantProperties,
|
|
353
|
+
setKeyframe: () => import_canvas40.setKeyframe,
|
|
354
|
+
setKeyframeEasing: () => import_canvas40.setKeyframeEasing,
|
|
355
|
+
setMotionPath: () => import_canvas40.setMotionPath,
|
|
356
|
+
setTrackEnabled: () => import_canvas40.setTrackEnabled,
|
|
357
|
+
shapeNodeToBezierPath: () => import_canvas36.shapeNodeToBezierPath,
|
|
358
|
+
shapeNodeToPolygon: () => import_canvas35.shapeNodeToPolygon,
|
|
359
|
+
shapeToBezierPath: () => import_canvas36.shapeToBezierPath,
|
|
360
|
+
shapeToPolygon: () => import_canvas35.shapeToPolygon,
|
|
361
|
+
sideToPosition: () => import_canvas33.sideToPosition,
|
|
362
|
+
simplifyRing: () => import_canvas35.simplifyRing,
|
|
363
|
+
snapKeyframeDelta: () => import_canvas40.snapKeyframeDelta,
|
|
364
|
+
snapNodeDrag: () => import_canvas33.snapNodeDrag,
|
|
365
|
+
snapNodeResize: () => import_canvas32.snapNodeResize,
|
|
366
|
+
snapResize: () => import_canvas32.snapResize,
|
|
367
|
+
snapTimeToFrame: () => import_canvas40.snapTimeToFrame,
|
|
368
|
+
snapToGrid: () => import_canvas32.snapToGrid,
|
|
369
|
+
springAt: () => import_canvas40.springAt,
|
|
370
|
+
streamlinePoints: () => import_canvas41.streamlinePoints,
|
|
371
|
+
strokeOutlineRings: () => import_canvas36.strokeOutlineRings,
|
|
372
|
+
strokePointsToPathData: () => import_canvas41.strokePointsToPathData,
|
|
373
|
+
strokeToShapeNode: () => import_canvas41.strokeToShapeNode,
|
|
374
|
+
subtractPaths: () => import_canvas36.subtractPaths,
|
|
375
|
+
subtractPolygons: () => import_canvas35.subtractPolygons,
|
|
376
|
+
swapCanvasInstance: () => import_canvas41.swapCanvasInstance,
|
|
377
|
+
syncAllCanvasInstances: () => import_canvas41.syncAllCanvasInstances,
|
|
378
|
+
syncCanvasComponents: () => import_canvas41.syncCanvasComponents,
|
|
379
|
+
syncCanvasInstance: () => import_canvas41.syncCanvasInstance,
|
|
380
|
+
timeToX: () => import_canvas40.timeToX,
|
|
381
|
+
toBezierPath: () => import_canvas36.toBezierPath,
|
|
382
|
+
toWebAnimations: () => import_canvas40.toWebAnimations,
|
|
383
|
+
toggleLockNodes: () => import_canvas33.toggleLockNodes,
|
|
384
|
+
transformBezierPath: () => import_canvas36.transformBezierPath,
|
|
385
|
+
unionPolygons: () => import_canvas35.unionPolygons,
|
|
386
|
+
unitePaths: () => import_canvas36.unitePaths,
|
|
387
|
+
unlockNodes: () => import_canvas33.unlockNodes,
|
|
388
|
+
updateKeyframe: () => import_canvas40.updateKeyframe,
|
|
376
389
|
useCanvasAnimation: () => useCanvasAnimation,
|
|
377
390
|
useCanvasArrange: () => useCanvasArrange,
|
|
378
391
|
useCanvasArrangeShortcuts: () => useCanvasArrangeShortcuts,
|
|
@@ -402,18 +415,19 @@ __export(canvas_exports, {
|
|
|
402
415
|
useDiagramState: () => useDiagramState,
|
|
403
416
|
useMermaidDiagram: () => useMermaidDiagram,
|
|
404
417
|
useMermaidStream: () => useMermaidStream,
|
|
418
|
+
usePrefersReducedMotion: () => usePrefersReducedMotion,
|
|
405
419
|
usePresenceState: () => usePresenceState,
|
|
406
420
|
useShapeBrushstroke: () => useShapeBrushstroke,
|
|
407
421
|
useStreamingCanvas: () => useStreamingCanvas,
|
|
408
|
-
validateCanvasBrush: () =>
|
|
409
|
-
validateCanvasBrushPaint: () =>
|
|
410
|
-
withNodeAnimation: () =>
|
|
411
|
-
withStyleSize: () =>
|
|
412
|
-
wouldCreateComponentCycle: () =>
|
|
413
|
-
wrapAnimationTime: () =>
|
|
414
|
-
writeNodeStyleProperty: () =>
|
|
415
|
-
xToTime: () =>
|
|
416
|
-
xorPolygons: () =>
|
|
422
|
+
validateCanvasBrush: () => import_canvas41.validateCanvasBrush,
|
|
423
|
+
validateCanvasBrushPaint: () => import_canvas41.validateCanvasBrushPaint,
|
|
424
|
+
withNodeAnimation: () => import_canvas40.withNodeAnimation,
|
|
425
|
+
withStyleSize: () => import_canvas33.withStyleSize,
|
|
426
|
+
wouldCreateComponentCycle: () => import_canvas41.wouldCreateComponentCycle,
|
|
427
|
+
wrapAnimationTime: () => import_canvas40.wrapAnimationTime,
|
|
428
|
+
writeNodeStyleProperty: () => import_canvas39.writeNodeStyleProperty,
|
|
429
|
+
xToTime: () => import_canvas40.xToTime,
|
|
430
|
+
xorPolygons: () => import_canvas35.xorPolygons
|
|
417
431
|
});
|
|
418
432
|
module.exports = __toCommonJS(canvas_exports);
|
|
419
433
|
|
|
@@ -1360,7 +1374,7 @@ function useCanvasExplosionState(options = {}) {
|
|
|
1360
1374
|
}
|
|
1361
1375
|
|
|
1362
1376
|
// src/canvas/index.ts
|
|
1363
|
-
var
|
|
1377
|
+
var import_canvas31 = require("@pixerate/editor/canvas");
|
|
1364
1378
|
|
|
1365
1379
|
// src/canvas/useCanvasArrange.ts
|
|
1366
1380
|
var import_react13 = require("react");
|
|
@@ -1927,8 +1941,8 @@ function useCanvasMeasure(options) {
|
|
|
1927
1941
|
}
|
|
1928
1942
|
|
|
1929
1943
|
// src/canvas/index.ts
|
|
1930
|
-
var import_canvas31 = require("@pixerate/editor/canvas");
|
|
1931
1944
|
var import_canvas32 = require("@pixerate/editor/canvas");
|
|
1945
|
+
var import_canvas33 = require("@pixerate/editor/canvas");
|
|
1932
1946
|
|
|
1933
1947
|
// src/canvas/ShapeNode.tsx
|
|
1934
1948
|
var import_canvas17 = require("@pixerate/editor/canvas");
|
|
@@ -3983,23 +3997,131 @@ function ShapeNode({ id, data, width, height, selected, className = "", children
|
|
|
3983
3997
|
);
|
|
3984
3998
|
}
|
|
3985
3999
|
|
|
4000
|
+
// src/canvas/AnimatedEdge.tsx
|
|
4001
|
+
var import_react31 = require("react");
|
|
4002
|
+
var import_canvas18 = require("@pixerate/editor/canvas");
|
|
4003
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
4004
|
+
var REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
|
|
4005
|
+
function usePrefersReducedMotion() {
|
|
4006
|
+
const [reduced, setReduced] = (0, import_react31.useState)(() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(REDUCED_MOTION).matches);
|
|
4007
|
+
(0, import_react31.useEffect)(() => {
|
|
4008
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
4009
|
+
const query = window.matchMedia(REDUCED_MOTION);
|
|
4010
|
+
const update = () => setReduced(query.matches);
|
|
4011
|
+
update();
|
|
4012
|
+
query.addEventListener?.("change", update);
|
|
4013
|
+
return () => query.removeEventListener?.("change", update);
|
|
4014
|
+
}, []);
|
|
4015
|
+
return reduced;
|
|
4016
|
+
}
|
|
4017
|
+
function EdgeAnimation({ animation, path, id, stroke, reducedMotion }) {
|
|
4018
|
+
const prefersReduced = usePrefersReducedMotion();
|
|
4019
|
+
const render = (0, import_react31.useMemo)(() => {
|
|
4020
|
+
if (!animation) return null;
|
|
4021
|
+
try {
|
|
4022
|
+
return (0, import_canvas18.getCanvasEdgeAnimationRender)(animation, { path, id, stroke, reducedMotion: reducedMotion ?? prefersReduced });
|
|
4023
|
+
} catch {
|
|
4024
|
+
return null;
|
|
4025
|
+
}
|
|
4026
|
+
}, [animation, path, id, stroke, reducedMotion, prefersReduced]);
|
|
4027
|
+
if (!render) return null;
|
|
4028
|
+
const pathId = `pixerate-edge-path-${id.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
4029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { className: "pixerate-edge-animation", "data-edge-animation": render.kind, "data-moving": render.moving ? "true" : "false", style: { pointerEvents: "none" }, children: [
|
|
4030
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("defs", { children: [
|
|
4031
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { id: pathId, d: path }),
|
|
4032
|
+
render.glowFilter && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4033
|
+
"filter",
|
|
4034
|
+
{
|
|
4035
|
+
id: render.glowFilter.id,
|
|
4036
|
+
filterUnits: "userSpaceOnUse",
|
|
4037
|
+
x: render.glowFilter.x,
|
|
4038
|
+
y: render.glowFilter.y,
|
|
4039
|
+
width: render.glowFilter.width,
|
|
4040
|
+
height: render.glowFilter.height,
|
|
4041
|
+
children: [
|
|
4042
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("feGaussianBlur", { stdDeviation: render.glowFilter.stdDeviation, result: "blur" }),
|
|
4043
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("feMerge", { children: [
|
|
4044
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("feMergeNode", { in: "blur" }),
|
|
4045
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("feMergeNode", { in: "SourceGraphic" })
|
|
4046
|
+
] })
|
|
4047
|
+
]
|
|
4048
|
+
}
|
|
4049
|
+
)
|
|
4050
|
+
] }),
|
|
4051
|
+
render.elements.map(
|
|
4052
|
+
(el) => el.type === "dot" ? render.moving ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { r: el.r, fill: el.fill, filter: el.filter, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4053
|
+
"animateMotion",
|
|
4054
|
+
{
|
|
4055
|
+
dur: `${el.motion.dur}s`,
|
|
4056
|
+
begin: `${el.motion.begin}s`,
|
|
4057
|
+
repeatCount: "indefinite",
|
|
4058
|
+
keyPoints: el.motion.keyPoints,
|
|
4059
|
+
keyTimes: el.motion.keyTimes,
|
|
4060
|
+
calcMode: "linear",
|
|
4061
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("mpath", { href: `#${pathId}` })
|
|
4062
|
+
}
|
|
4063
|
+
) }, el.key) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: el.at.x, cy: el.at.y, r: el.r, fill: el.fill, filter: el.filter }, el.key) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4064
|
+
"path",
|
|
4065
|
+
{
|
|
4066
|
+
d: path,
|
|
4067
|
+
fill: "none",
|
|
4068
|
+
stroke: el.stroke,
|
|
4069
|
+
strokeWidth: el.strokeWidth,
|
|
4070
|
+
strokeLinecap: el.strokeLinecap,
|
|
4071
|
+
strokeDasharray: el.strokeDasharray,
|
|
4072
|
+
strokeDashoffset: el.strokeDashoffset,
|
|
4073
|
+
strokeOpacity: el.opacity,
|
|
4074
|
+
filter: el.filter,
|
|
4075
|
+
children: render.moving && el.animate.map((a) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("animate", { attributeName: a.attributeName, values: a.values, dur: `${a.dur}s`, begin: `${a.begin}s`, repeatCount: "indefinite" }, a.attributeName))
|
|
4076
|
+
},
|
|
4077
|
+
el.key
|
|
4078
|
+
)
|
|
4079
|
+
)
|
|
4080
|
+
] });
|
|
4081
|
+
}
|
|
4082
|
+
function AnimatedEdge(props) {
|
|
4083
|
+
const { id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, label, labelStyle, style, markerStart, markerEnd, interactionWidth = 20, reducedMotion } = props;
|
|
4084
|
+
const { path, labelX, labelY } = (0, import_canvas18.getCanvasEdgePath)({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, type: data?.pathType });
|
|
4085
|
+
const animation = (0, import_canvas18.getCanvasEdgeAnimation)({ data });
|
|
4086
|
+
const stroke = typeof style?.stroke === "string" ? style.stroke : void 0;
|
|
4087
|
+
const trackOpacity = animation ? (0, import_canvas18.resolveCanvasEdgeAnimation)(animation).trackOpacity : 1;
|
|
4088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
4089
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4090
|
+
"path",
|
|
4091
|
+
{
|
|
4092
|
+
id,
|
|
4093
|
+
d: path,
|
|
4094
|
+
fill: "none",
|
|
4095
|
+
className: "react-flow__edge-path",
|
|
4096
|
+
style: { ...style, ...trackOpacity !== 1 ? { strokeOpacity: trackOpacity } : {} },
|
|
4097
|
+
markerStart,
|
|
4098
|
+
markerEnd
|
|
4099
|
+
}
|
|
4100
|
+
),
|
|
4101
|
+
interactionWidth > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" }),
|
|
4102
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EdgeAnimation, { animation, path, id, stroke: stroke ?? "var(--xy-edge-stroke, #b1b1b7)", reducedMotion }),
|
|
4103
|
+
label !== void 0 && label !== null && label !== "" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: labelX, y: labelY, textAnchor: "middle", dominantBaseline: "central", className: "react-flow__edge-text", style: labelStyle, children: label })
|
|
4104
|
+
] });
|
|
4105
|
+
}
|
|
4106
|
+
|
|
3986
4107
|
// src/canvas/index.ts
|
|
3987
|
-
var import_canvas33 = require("@pixerate/editor/canvas");
|
|
3988
4108
|
var import_canvas34 = require("@pixerate/editor/canvas");
|
|
3989
4109
|
var import_canvas35 = require("@pixerate/editor/canvas");
|
|
3990
4110
|
var import_canvas36 = require("@pixerate/editor/canvas");
|
|
4111
|
+
var import_canvas37 = require("@pixerate/editor/canvas");
|
|
4112
|
+
var import_canvas38 = require("@pixerate/editor/canvas");
|
|
3991
4113
|
|
|
3992
4114
|
// src/canvas/useCanvasAutoLayout.ts
|
|
3993
|
-
var
|
|
3994
|
-
var
|
|
4115
|
+
var import_react32 = require("react");
|
|
4116
|
+
var import_canvas19 = require("@pixerate/editor/canvas");
|
|
3995
4117
|
function useCanvasAutoLayout(options) {
|
|
3996
|
-
const [guides, setGuides] = (0,
|
|
3997
|
-
const nodesRef = (0,
|
|
4118
|
+
const [guides, setGuides] = (0, import_react32.useState)([]);
|
|
4119
|
+
const nodesRef = (0, import_react32.useRef)(options.nodes);
|
|
3998
4120
|
nodesRef.current = options.nodes;
|
|
3999
|
-
const optionsRef = (0,
|
|
4121
|
+
const optionsRef = (0, import_react32.useRef)(options);
|
|
4000
4122
|
optionsRef.current = options;
|
|
4001
|
-
const controller = (0,
|
|
4002
|
-
() => (0,
|
|
4123
|
+
const controller = (0, import_react32.useMemo)(
|
|
4124
|
+
() => (0, import_canvas19.createCanvasAutoLayoutController)({
|
|
4003
4125
|
getNodes: () => nodesRef.current,
|
|
4004
4126
|
setNodes: (next) => {
|
|
4005
4127
|
nodesRef.current = next;
|
|
@@ -4024,10 +4146,10 @@ function useCanvasAutoLayout(options) {
|
|
|
4024
4146
|
}),
|
|
4025
4147
|
[]
|
|
4026
4148
|
);
|
|
4027
|
-
(0,
|
|
4149
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
4028
4150
|
if (controller.hasPending) controller.flush();
|
|
4029
4151
|
}, [options.nodes, controller]);
|
|
4030
|
-
return (0,
|
|
4152
|
+
return (0, import_react32.useMemo)(
|
|
4031
4153
|
() => ({
|
|
4032
4154
|
...controller,
|
|
4033
4155
|
/** Drop marker of the active reorder drag (flow coordinates). */
|
|
@@ -4041,47 +4163,47 @@ function useCanvasAutoLayout(options) {
|
|
|
4041
4163
|
}
|
|
4042
4164
|
|
|
4043
4165
|
// src/canvas/useCanvasTokens.ts
|
|
4044
|
-
var
|
|
4045
|
-
var
|
|
4166
|
+
var import_react33 = require("react");
|
|
4167
|
+
var import_canvas20 = require("@pixerate/editor/canvas");
|
|
4046
4168
|
function useCanvasTokens(options) {
|
|
4047
4169
|
const { store, nodes, setNodes, modes, properties } = options;
|
|
4048
|
-
const state = (0,
|
|
4049
|
-
const latest = (0,
|
|
4170
|
+
const state = (0, import_react33.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
|
|
4171
|
+
const latest = (0, import_react33.useRef)({ nodes, setNodes, modes, properties });
|
|
4050
4172
|
latest.current = { nodes, setNodes, modes, properties };
|
|
4051
4173
|
const opts = () => ({ modes: latest.current.modes, properties: latest.current.properties });
|
|
4052
|
-
(0,
|
|
4174
|
+
(0, import_react33.useEffect)(
|
|
4053
4175
|
() => store.subscribe((event) => {
|
|
4054
4176
|
if (event.deletedVariableIds.length === 0) return;
|
|
4055
|
-
latest.current.setNodes((prev) => (0,
|
|
4177
|
+
latest.current.setNodes((prev) => (0, import_canvas20.detachTokenBindings)(prev, event.previous, event.deletedVariableIds, opts()));
|
|
4056
4178
|
}),
|
|
4057
4179
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4058
4180
|
[store]
|
|
4059
4181
|
);
|
|
4060
4182
|
const modesKey = JSON.stringify(modes ?? {});
|
|
4061
|
-
(0,
|
|
4062
|
-
const next = (0,
|
|
4183
|
+
(0, import_react33.useEffect)(() => {
|
|
4184
|
+
const next = (0, import_canvas20.resolveCanvasTokens)(nodes, state, opts());
|
|
4063
4185
|
if (next !== nodes) setNodes(next);
|
|
4064
4186
|
}, [nodes, state, modesKey, properties]);
|
|
4065
|
-
const bind = (0,
|
|
4187
|
+
const bind = (0, import_react33.useCallback)(
|
|
4066
4188
|
(ids, propertyKey, variableId) => {
|
|
4067
|
-
const next = (0,
|
|
4189
|
+
const next = (0, import_canvas20.bindCanvasToken)(latest.current.nodes, ids, propertyKey, variableId, store.getState(), opts());
|
|
4068
4190
|
if (next !== latest.current.nodes) latest.current.setNodes(next);
|
|
4069
4191
|
},
|
|
4070
4192
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4071
4193
|
[store]
|
|
4072
4194
|
);
|
|
4073
|
-
const setMode = (0,
|
|
4195
|
+
const setMode = (0, import_react33.useCallback)(
|
|
4074
4196
|
(ids, collectionId, modeId) => {
|
|
4075
|
-
const next = (0,
|
|
4197
|
+
const next = (0, import_canvas20.setCanvasTokenMode)(latest.current.nodes, ids, collectionId, modeId, store.getState(), opts());
|
|
4076
4198
|
if (next !== latest.current.nodes) latest.current.setNodes(next);
|
|
4077
4199
|
},
|
|
4078
4200
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4079
4201
|
[store]
|
|
4080
4202
|
);
|
|
4081
|
-
const modesOf = (0,
|
|
4203
|
+
const modesOf = (0, import_react33.useCallback)(
|
|
4082
4204
|
(nodeId) => {
|
|
4083
4205
|
const node = latest.current.nodes.find((n) => n.id === nodeId);
|
|
4084
|
-
return node ? (0,
|
|
4206
|
+
return node ? (0, import_canvas20.getEffectiveTokenModes)(node, latest.current.nodes, store.getState(), opts()) : {};
|
|
4085
4207
|
},
|
|
4086
4208
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4087
4209
|
[store]
|
|
@@ -4090,9 +4212,9 @@ function useCanvasTokens(options) {
|
|
|
4090
4212
|
}
|
|
4091
4213
|
|
|
4092
4214
|
// src/canvas/TokenBindingPicker.tsx
|
|
4093
|
-
var
|
|
4215
|
+
var import_canvas21 = require("@pixerate/editor/canvas");
|
|
4094
4216
|
var import_tokens = require("@pixerate/editor/tokens");
|
|
4095
|
-
var
|
|
4217
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
4096
4218
|
function TokenBindingPicker({
|
|
4097
4219
|
state,
|
|
4098
4220
|
nodes,
|
|
@@ -4106,18 +4228,18 @@ function TokenBindingPicker({
|
|
|
4106
4228
|
const selected = nodes.filter((n) => selectedIds.includes(n.id));
|
|
4107
4229
|
const first = selected[0];
|
|
4108
4230
|
if (!first) return null;
|
|
4109
|
-
let rows = (0,
|
|
4231
|
+
let rows = (0, import_canvas21.getBindableTokenProperties)(first, options);
|
|
4110
4232
|
if (properties) rows = properties.map((key) => rows.find((p) => p.key === key)).filter((p) => !!p);
|
|
4111
|
-
const modes = (0,
|
|
4112
|
-
return /* @__PURE__ */ (0,
|
|
4233
|
+
const modes = (0, import_canvas21.getEffectiveTokenModes)(first, nodes, state, options);
|
|
4234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-token-binding-picker": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
|
|
4113
4235
|
rows.map((property) => {
|
|
4114
|
-
const ids = new Set(selected.map((n) => (0,
|
|
4236
|
+
const ids = new Set(selected.map((n) => (0, import_canvas21.getNodeTokenBindings)(n)[property.key] ?? ""));
|
|
4115
4237
|
const value = ids.size === 1 ? [...ids][0] : "__mixed";
|
|
4116
|
-
const candidates = (0,
|
|
4238
|
+
const candidates = (0, import_canvas21.getTokensForProperty)(state, property, first);
|
|
4117
4239
|
const resolved = value && value !== "__mixed" ? (0, import_tokens.resolveToken)(state, value, modes) : null;
|
|
4118
|
-
return /* @__PURE__ */ (0,
|
|
4119
|
-
/* @__PURE__ */ (0,
|
|
4120
|
-
/* @__PURE__ */ (0,
|
|
4240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", "data-token-property": property.key, children: [
|
|
4241
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-28 shrink-0 text-muted-foreground", children: property.label }),
|
|
4242
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
4121
4243
|
"select",
|
|
4122
4244
|
{
|
|
4123
4245
|
"aria-label": `${property.label} variable`,
|
|
@@ -4126,17 +4248,17 @@ function TokenBindingPicker({
|
|
|
4126
4248
|
onChange: (e) => {
|
|
4127
4249
|
const id = e.currentTarget.value || null;
|
|
4128
4250
|
try {
|
|
4129
|
-
onChange((0,
|
|
4251
|
+
onChange((0, import_canvas21.bindCanvasToken)(nodes, selectedIds, property.key, id, state, options));
|
|
4130
4252
|
} catch (error) {
|
|
4131
4253
|
onError?.(error);
|
|
4132
4254
|
}
|
|
4133
4255
|
},
|
|
4134
4256
|
children: [
|
|
4135
|
-
value === "__mixed" ? /* @__PURE__ */ (0,
|
|
4136
|
-
/* @__PURE__ */ (0,
|
|
4257
|
+
value === "__mixed" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "__mixed", children: "Mixed" }) : null,
|
|
4258
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "None" }),
|
|
4137
4259
|
candidates.map((v) => {
|
|
4138
4260
|
const collection = state.collections.find((c) => c.id === v.collectionId);
|
|
4139
|
-
return /* @__PURE__ */ (0,
|
|
4261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: v.id, children: [
|
|
4140
4262
|
v.name,
|
|
4141
4263
|
collection && state.collections.length > 1 ? ` (${collection.name})` : ""
|
|
4142
4264
|
] }, v.id);
|
|
@@ -4144,17 +4266,17 @@ function TokenBindingPicker({
|
|
|
4144
4266
|
]
|
|
4145
4267
|
}
|
|
4146
4268
|
),
|
|
4147
|
-
/* @__PURE__ */ (0,
|
|
4269
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16 shrink-0 truncate text-right text-muted-foreground", "data-token-resolved": "", children: resolved?.ok ? property.type === "color" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4148
4270
|
"span",
|
|
4149
4271
|
{
|
|
4150
4272
|
className: "inline-block h-3 w-3 rounded border border-border align-middle",
|
|
4151
4273
|
style: { background: String(resolved.value) },
|
|
4152
4274
|
title: String(resolved.value)
|
|
4153
4275
|
}
|
|
4154
|
-
) : String(resolved.value) : resolved ? /* @__PURE__ */ (0,
|
|
4276
|
+
) : String(resolved.value) : resolved ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { title: resolved.message, children: "\u26A0" }) : null })
|
|
4155
4277
|
] }, property.key);
|
|
4156
4278
|
}),
|
|
4157
|
-
state.collections.length === 0 ? /* @__PURE__ */ (0,
|
|
4279
|
+
state.collections.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-muted-foreground", children: "No variables yet." }) : null
|
|
4158
4280
|
] });
|
|
4159
4281
|
}
|
|
4160
4282
|
function TokenModeSwitcher({
|
|
@@ -4168,29 +4290,29 @@ function TokenModeSwitcher({
|
|
|
4168
4290
|
}) {
|
|
4169
4291
|
const first = nodes.find((n) => nodeIds.includes(n.id));
|
|
4170
4292
|
if (!first) return null;
|
|
4171
|
-
const own = (0,
|
|
4293
|
+
const own = (0, import_canvas21.getNodeTokenModes)(first);
|
|
4172
4294
|
const parent = first.parentId ? nodes.find((n) => n.id === first.parentId) : void 0;
|
|
4173
|
-
const inherited = parent ? (0,
|
|
4295
|
+
const inherited = parent ? (0, import_canvas21.getEffectiveTokenModes)(parent, nodes, state, options) : { ...options.modes };
|
|
4174
4296
|
const collections = state.collections.filter((c) => showSingleMode || c.modes.length > 1);
|
|
4175
|
-
return /* @__PURE__ */ (0,
|
|
4297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { "data-token-mode-switcher": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: collections.map((collection) => {
|
|
4176
4298
|
const auto = (0, import_tokens.getCurrentMode)(collection, inherited);
|
|
4177
4299
|
const explicit = collection.modes.some((m) => m.id === own[collection.id]) ? own[collection.id] : "";
|
|
4178
|
-
return /* @__PURE__ */ (0,
|
|
4179
|
-
/* @__PURE__ */ (0,
|
|
4180
|
-
/* @__PURE__ */ (0,
|
|
4300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", "data-token-collection": collection.id, children: [
|
|
4301
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-28 shrink-0 truncate text-muted-foreground", children: collection.name }),
|
|
4302
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
4181
4303
|
"select",
|
|
4182
4304
|
{
|
|
4183
4305
|
"aria-label": `${collection.name} mode`,
|
|
4184
4306
|
className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
|
|
4185
4307
|
value: explicit,
|
|
4186
|
-
onChange: (e) => onChange((0,
|
|
4308
|
+
onChange: (e) => onChange((0, import_canvas21.setCanvasTokenMode)(nodes, nodeIds, collection.id, e.currentTarget.value || null, state, options)),
|
|
4187
4309
|
children: [
|
|
4188
|
-
/* @__PURE__ */ (0,
|
|
4310
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: "", children: [
|
|
4189
4311
|
"Auto (",
|
|
4190
4312
|
auto.name,
|
|
4191
4313
|
")"
|
|
4192
4314
|
] }),
|
|
4193
|
-
collection.modes.map((m) => /* @__PURE__ */ (0,
|
|
4315
|
+
collection.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: m.id, children: m.name }, m.id))
|
|
4194
4316
|
]
|
|
4195
4317
|
}
|
|
4196
4318
|
)
|
|
@@ -4199,18 +4321,18 @@ function TokenModeSwitcher({
|
|
|
4199
4321
|
}
|
|
4200
4322
|
|
|
4201
4323
|
// src/canvas/index.ts
|
|
4202
|
-
var
|
|
4324
|
+
var import_canvas39 = require("@pixerate/editor/canvas");
|
|
4203
4325
|
|
|
4204
4326
|
// src/canvas/useCanvasAnimation.ts
|
|
4205
|
-
var
|
|
4206
|
-
var
|
|
4327
|
+
var import_react34 = require("react");
|
|
4328
|
+
var import_canvas22 = require("@pixerate/editor/canvas");
|
|
4207
4329
|
function useCanvasAnimation(options) {
|
|
4208
|
-
const nodesRef = (0,
|
|
4330
|
+
const nodesRef = (0, import_react34.useRef)(options.nodes);
|
|
4209
4331
|
nodesRef.current = options.nodes;
|
|
4210
|
-
const optionsRef = (0,
|
|
4332
|
+
const optionsRef = (0, import_react34.useRef)(options);
|
|
4211
4333
|
optionsRef.current = options;
|
|
4212
|
-
const controller = (0,
|
|
4213
|
-
() => (0,
|
|
4334
|
+
const controller = (0, import_react34.useMemo)(
|
|
4335
|
+
() => (0, import_canvas22.createCanvasAnimationController)({
|
|
4214
4336
|
getNodes: () => nodesRef.current,
|
|
4215
4337
|
setNodes: (next) => {
|
|
4216
4338
|
nodesRef.current = next;
|
|
@@ -4236,26 +4358,26 @@ function useCanvasAnimation(options) {
|
|
|
4236
4358
|
}),
|
|
4237
4359
|
[]
|
|
4238
4360
|
);
|
|
4239
|
-
(0,
|
|
4240
|
-
(0,
|
|
4361
|
+
(0, import_react34.useEffect)(() => () => controller.destroy(), [controller]);
|
|
4362
|
+
(0, import_react34.useEffect)(() => {
|
|
4241
4363
|
if (options.loop !== void 0) controller.setLoop(options.loop);
|
|
4242
4364
|
}, [controller, options.loop]);
|
|
4243
|
-
(0,
|
|
4365
|
+
(0, import_react34.useEffect)(() => {
|
|
4244
4366
|
if (options.playbackRate !== void 0) controller.setPlaybackRate(options.playbackRate);
|
|
4245
4367
|
}, [controller, options.playbackRate]);
|
|
4246
|
-
(0,
|
|
4368
|
+
(0, import_react34.useEffect)(() => {
|
|
4247
4369
|
if (options.recording !== void 0) controller.setRecording(options.recording);
|
|
4248
4370
|
}, [controller, options.recording]);
|
|
4249
|
-
const state = (0,
|
|
4371
|
+
const state = (0, import_react34.useSyncExternalStore)(
|
|
4250
4372
|
(listener) => controller.subscribe(listener),
|
|
4251
4373
|
() => controller.getState(),
|
|
4252
4374
|
() => controller.getState()
|
|
4253
4375
|
);
|
|
4254
|
-
(0,
|
|
4376
|
+
(0, import_react34.useEffect)(() => {
|
|
4255
4377
|
controller.refresh();
|
|
4256
4378
|
}, [controller, options.nodes]);
|
|
4257
|
-
const displayNodes = (0,
|
|
4258
|
-
return (0,
|
|
4379
|
+
const displayNodes = (0, import_react34.useMemo)(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
|
|
4380
|
+
return (0, import_react34.useMemo)(
|
|
4259
4381
|
() => ({
|
|
4260
4382
|
...controller,
|
|
4261
4383
|
state,
|
|
@@ -4276,24 +4398,24 @@ function useCanvasAnimation(options) {
|
|
|
4276
4398
|
}
|
|
4277
4399
|
|
|
4278
4400
|
// src/canvas/AnimationTimeline.tsx
|
|
4279
|
-
var
|
|
4280
|
-
var
|
|
4281
|
-
var
|
|
4401
|
+
var import_react35 = require("react");
|
|
4402
|
+
var import_canvas23 = require("@pixerate/editor/canvas");
|
|
4403
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4282
4404
|
var LOOP_LABELS = { none: "Once", loop: "Loop", "ping-pong": "Ping-pong" };
|
|
4283
4405
|
var easingValue = (easing) => typeof easing === "string" ? easing : easing ? "custom" : "linear";
|
|
4284
4406
|
function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8, labelOf, className = "" }) {
|
|
4285
4407
|
const { state } = animation;
|
|
4286
4408
|
const duration = state.duration;
|
|
4287
4409
|
const rows = animation.timelineRows(nodeIds ?? void 0, labelOf ? { labelOf } : {});
|
|
4288
|
-
const ticks = (0,
|
|
4410
|
+
const ticks = (0, import_canvas23.getTimelineTicks)(duration, width);
|
|
4289
4411
|
const selectedEasing = (() => {
|
|
4290
4412
|
const first = state.selection[0];
|
|
4291
4413
|
if (!first) return "";
|
|
4292
4414
|
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);
|
|
4293
4415
|
return "";
|
|
4294
4416
|
})();
|
|
4295
|
-
const dragRef = (0,
|
|
4296
|
-
(0,
|
|
4417
|
+
const dragRef = (0, import_react35.useRef)(null);
|
|
4418
|
+
(0, import_react35.useEffect)(() => {
|
|
4297
4419
|
const onKey = (event) => {
|
|
4298
4420
|
if (event.key === "Escape" && dragRef.current) {
|
|
4299
4421
|
dragRef.current = null;
|
|
@@ -4306,8 +4428,8 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4306
4428
|
const onRulerDown = (event) => {
|
|
4307
4429
|
const lane = event.currentTarget;
|
|
4308
4430
|
const left = lane.getBoundingClientRect().left;
|
|
4309
|
-
animation.scrub((0,
|
|
4310
|
-
const move = (e) => animation.scrub((0,
|
|
4431
|
+
animation.scrub((0, import_canvas23.xToTime)(event.clientX - left, duration, width));
|
|
4432
|
+
const move = (e) => animation.scrub((0, import_canvas23.xToTime)(e.clientX - left, duration, width));
|
|
4311
4433
|
const up = () => {
|
|
4312
4434
|
window.removeEventListener("pointermove", move);
|
|
4313
4435
|
window.removeEventListener("pointerup", up);
|
|
@@ -4347,12 +4469,12 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4347
4469
|
}
|
|
4348
4470
|
};
|
|
4349
4471
|
const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-50";
|
|
4350
|
-
const playheadX = (0,
|
|
4472
|
+
const playheadX = (0, import_canvas23.timeToX)(state.time, duration, width);
|
|
4351
4473
|
const labelWidth = 120;
|
|
4352
|
-
return /* @__PURE__ */ (0,
|
|
4353
|
-
/* @__PURE__ */ (0,
|
|
4354
|
-
/* @__PURE__ */ (0,
|
|
4355
|
-
/* @__PURE__ */ (0,
|
|
4474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { "data-animation-timeline": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, tabIndex: 0, onKeyDown: onTimelineKey, children: [
|
|
4475
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "toolbar", "aria-label": "Animation", children: [
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2, "data-action": "toggle-play", "aria-label": state.playing ? "Pause" : "Play", onClick: () => animation.toggle(), children: state.playing ? "\u275A\u275A" : "\u25B6" }),
|
|
4477
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4356
4478
|
"button",
|
|
4357
4479
|
{
|
|
4358
4480
|
type: "button",
|
|
@@ -4364,13 +4486,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4364
4486
|
children: "\u25CF Rec"
|
|
4365
4487
|
}
|
|
4366
4488
|
),
|
|
4367
|
-
/* @__PURE__ */ (0,
|
|
4368
|
-
/* @__PURE__ */ (0,
|
|
4369
|
-
(0,
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2, "data-action": "add-keyframe", onClick: () => animation.addKeyframe(), children: "\u25C6 Key" }),
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { "data-time": "", className: "tabular-nums text-muted-foreground", children: [
|
|
4491
|
+
(0, import_canvas23.formatAnimationTime)(state.time),
|
|
4370
4492
|
" / ",
|
|
4371
|
-
(0,
|
|
4493
|
+
(0, import_canvas23.formatAnimationTime)(duration)
|
|
4372
4494
|
] }),
|
|
4373
|
-
/* @__PURE__ */ (0,
|
|
4495
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4374
4496
|
"select",
|
|
4375
4497
|
{
|
|
4376
4498
|
"aria-label": "Easing",
|
|
@@ -4380,13 +4502,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4380
4502
|
disabled: state.selection.length === 0,
|
|
4381
4503
|
onChange: (e) => e.target.value && e.target.value !== "custom" && animation.setEasing(e.target.value),
|
|
4382
4504
|
children: [
|
|
4383
|
-
/* @__PURE__ */ (0,
|
|
4384
|
-
|
|
4385
|
-
selectedEasing === "custom" ? /* @__PURE__ */ (0,
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Easing\u2026" }),
|
|
4506
|
+
import_canvas23.ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: preset, children: import_canvas23.ANIMATION_EASING_LABELS[preset] }, preset)),
|
|
4507
|
+
selectedEasing === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "custom", children: "Custom" }) : null
|
|
4386
4508
|
]
|
|
4387
4509
|
}
|
|
4388
4510
|
),
|
|
4389
|
-
/* @__PURE__ */ (0,
|
|
4511
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4390
4512
|
"select",
|
|
4391
4513
|
{
|
|
4392
4514
|
"aria-label": "Loop",
|
|
@@ -4394,13 +4516,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4394
4516
|
className: "rounded border border-border bg-background px-1 py-0.5",
|
|
4395
4517
|
value: state.loop,
|
|
4396
4518
|
onChange: (e) => animation.setLoop(e.target.value),
|
|
4397
|
-
children: Object.keys(LOOP_LABELS).map((mode) => /* @__PURE__ */ (0,
|
|
4519
|
+
children: Object.keys(LOOP_LABELS).map((mode) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: mode, children: LOOP_LABELS[mode] }, mode))
|
|
4398
4520
|
}
|
|
4399
4521
|
)
|
|
4400
4522
|
] }),
|
|
4401
|
-
/* @__PURE__ */ (0,
|
|
4402
|
-
/* @__PURE__ */ (0,
|
|
4403
|
-
/* @__PURE__ */ (0,
|
|
4523
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex", children: [
|
|
4524
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { width: labelWidth }, className: "shrink-0" }),
|
|
4525
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4404
4526
|
"div",
|
|
4405
4527
|
{
|
|
4406
4528
|
"data-timeline-ruler": "",
|
|
@@ -4408,15 +4530,15 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4408
4530
|
style: { width },
|
|
4409
4531
|
onPointerDown: onRulerDown,
|
|
4410
4532
|
children: [
|
|
4411
|
-
ticks.map((tick) => /* @__PURE__ */ (0,
|
|
4412
|
-
/* @__PURE__ */ (0,
|
|
4533
|
+
ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "absolute top-0 -translate-x-1/2 text-[10px] text-muted-foreground", style: { left: tick.x }, children: tick.label }, tick.time)),
|
|
4534
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { "data-playhead": "", className: "absolute top-0 h-5 w-px bg-red-500", style: { left: playheadX } })
|
|
4413
4535
|
]
|
|
4414
4536
|
}
|
|
4415
4537
|
)
|
|
4416
4538
|
] }),
|
|
4417
|
-
rows.length === 0 ? /* @__PURE__ */ (0,
|
|
4418
|
-
/* @__PURE__ */ (0,
|
|
4419
|
-
/* @__PURE__ */ (0,
|
|
4539
|
+
rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-muted-foreground", "data-timeline-empty": "", children: "Select an animated node, or press \u25C6 Key to add a keyframe." }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center", "data-track": row.id, children: [
|
|
4540
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex shrink-0 items-center gap-1 truncate pr-2", style: { width: labelWidth }, title: `${row.nodeLabel} \xB7 ${row.label}`, children: [
|
|
4541
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4420
4542
|
"input",
|
|
4421
4543
|
{
|
|
4422
4544
|
type: "checkbox",
|
|
@@ -4425,24 +4547,24 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4425
4547
|
onChange: (e) => animation.setTrackEnabled(row.nodeId, row.property, e.target.checked)
|
|
4426
4548
|
}
|
|
4427
4549
|
),
|
|
4428
|
-
/* @__PURE__ */ (0,
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "truncate", children: [
|
|
4429
4551
|
rows.filter((r) => r.nodeId === row.nodeId).length < rows.length ? `${row.nodeLabel} \xB7 ` : "",
|
|
4430
4552
|
row.label
|
|
4431
4553
|
] })
|
|
4432
4554
|
] }),
|
|
4433
|
-
/* @__PURE__ */ (0,
|
|
4434
|
-
/* @__PURE__ */ (0,
|
|
4435
|
-
state.drag?.target != null ? /* @__PURE__ */ (0,
|
|
4436
|
-
row.keyframes.map((k) => /* @__PURE__ */ (0,
|
|
4555
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { "data-lane": "", className: `relative h-5 rounded bg-muted/40 ${row.enabled ? "" : "opacity-50"}`, style: { width }, children: [
|
|
4556
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "pointer-events-none absolute top-0 h-5 w-px bg-red-500/60", style: { left: playheadX } }),
|
|
4557
|
+
state.drag?.target != null ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: (0, import_canvas23.timeToX)(state.drag.target, duration, width) } }) : null,
|
|
4558
|
+
row.keyframes.map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4437
4559
|
"button",
|
|
4438
4560
|
{
|
|
4439
4561
|
type: "button",
|
|
4440
4562
|
"data-keyframe": k.ref.time,
|
|
4441
4563
|
"aria-pressed": k.selected,
|
|
4442
|
-
"aria-label": `${row.label} keyframe at ${(0,
|
|
4443
|
-
title: `${(0,
|
|
4564
|
+
"aria-label": `${row.label} keyframe at ${(0, import_canvas23.formatAnimationTime)(k.ref.time)}`,
|
|
4565
|
+
title: `${(0, import_canvas23.formatAnimationTime)(k.time)} \xB7 ${String(k.value)}`,
|
|
4444
4566
|
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]"}`,
|
|
4445
|
-
style: { left: (0,
|
|
4567
|
+
style: { left: (0, import_canvas23.timeToX)(k.time, duration, width) },
|
|
4446
4568
|
onPointerDown: onKeyDown(k.ref)
|
|
4447
4569
|
},
|
|
4448
4570
|
k.ref.time
|
|
@@ -4453,18 +4575,18 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
|
|
|
4453
4575
|
}
|
|
4454
4576
|
|
|
4455
4577
|
// src/canvas/index.ts
|
|
4456
|
-
var
|
|
4578
|
+
var import_canvas40 = require("@pixerate/editor/canvas");
|
|
4457
4579
|
|
|
4458
4580
|
// src/canvas/useCanvasComponents.ts
|
|
4459
|
-
var
|
|
4460
|
-
var
|
|
4581
|
+
var import_react36 = require("react");
|
|
4582
|
+
var import_canvas24 = require("@pixerate/editor/canvas");
|
|
4461
4583
|
function useCanvasComponents(options) {
|
|
4462
|
-
const nodesRef = (0,
|
|
4584
|
+
const nodesRef = (0, import_react36.useRef)(options.nodes);
|
|
4463
4585
|
nodesRef.current = options.nodes;
|
|
4464
|
-
const optionsRef = (0,
|
|
4586
|
+
const optionsRef = (0, import_react36.useRef)(options);
|
|
4465
4587
|
optionsRef.current = options;
|
|
4466
|
-
const controller = (0,
|
|
4467
|
-
() => (0,
|
|
4588
|
+
const controller = (0, import_react36.useMemo)(
|
|
4589
|
+
() => (0, import_canvas24.createCanvasComponentsController)({
|
|
4468
4590
|
getNodes: () => nodesRef.current,
|
|
4469
4591
|
setNodes: (next) => {
|
|
4470
4592
|
nodesRef.current = next;
|
|
@@ -4492,18 +4614,18 @@ function useCanvasComponents(options) {
|
|
|
4492
4614
|
}),
|
|
4493
4615
|
[]
|
|
4494
4616
|
);
|
|
4495
|
-
(0,
|
|
4617
|
+
(0, import_react36.useLayoutEffect)(() => {
|
|
4496
4618
|
if (optionsRef.current.autoSync !== false) controller.sync();
|
|
4497
4619
|
}, [options.nodes, controller]);
|
|
4498
4620
|
return controller;
|
|
4499
4621
|
}
|
|
4500
4622
|
|
|
4501
4623
|
// src/canvas/CanvasComponentsPanel.tsx
|
|
4502
|
-
var
|
|
4503
|
-
var
|
|
4504
|
-
var
|
|
4624
|
+
var import_react37 = require("react");
|
|
4625
|
+
var import_canvas25 = require("@pixerate/editor/canvas");
|
|
4626
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4505
4627
|
function InlineField({ value, label, onCommit }) {
|
|
4506
|
-
return /* @__PURE__ */ (0,
|
|
4628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4507
4629
|
"input",
|
|
4508
4630
|
{
|
|
4509
4631
|
type: "text",
|
|
@@ -4534,11 +4656,11 @@ function CanvasComponentsPanel({
|
|
|
4534
4656
|
search = true,
|
|
4535
4657
|
className = ""
|
|
4536
4658
|
}) {
|
|
4537
|
-
const [query, setQuery] = (0,
|
|
4538
|
-
const [propsOpen, setPropsOpen] = (0,
|
|
4539
|
-
const [menuFor, setMenuFor] = (0,
|
|
4540
|
-
const [editing, setEditing] = (0,
|
|
4541
|
-
const { components: all, sets } = (0,
|
|
4659
|
+
const [query, setQuery] = (0, import_react37.useState)("");
|
|
4660
|
+
const [propsOpen, setPropsOpen] = (0, import_react37.useState)(null);
|
|
4661
|
+
const [menuFor, setMenuFor] = (0, import_react37.useState)(null);
|
|
4662
|
+
const [editing, setEditing] = (0, import_react37.useState)(null);
|
|
4663
|
+
const { components: all, sets } = (0, import_canvas25.listCanvasComponents)(nodes);
|
|
4542
4664
|
const q = query.trim().toLowerCase();
|
|
4543
4665
|
const match = (name) => !q || name.toLowerCase().includes(q);
|
|
4544
4666
|
const lone = all.filter((c) => !c.setId && match(c.name));
|
|
@@ -4549,7 +4671,7 @@ function CanvasComponentsPanel({
|
|
|
4549
4671
|
};
|
|
4550
4672
|
const small = "shrink-0 rounded px-1 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40";
|
|
4551
4673
|
const menuItem = "rounded px-2 py-0.5 text-left hover:bg-muted disabled:opacity-40";
|
|
4552
|
-
const item = (id, name, count, extra = {}, onContextMenu) => /* @__PURE__ */ (0,
|
|
4674
|
+
const item = (id, name, count, extra = {}, onContextMenu) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
4553
4675
|
"button",
|
|
4554
4676
|
{
|
|
4555
4677
|
type: "button",
|
|
@@ -4561,22 +4683,22 @@ function CanvasComponentsPanel({
|
|
|
4561
4683
|
onClick: () => onInsert(id),
|
|
4562
4684
|
onContextMenu,
|
|
4563
4685
|
onDragStart: (e) => {
|
|
4564
|
-
e.dataTransfer.setData(
|
|
4686
|
+
e.dataTransfer.setData(import_canvas25.CANVAS_COMPONENT_DRAG_TYPE, id);
|
|
4565
4687
|
e.dataTransfer.setData("text/plain", name);
|
|
4566
4688
|
e.dataTransfer.effectAllowed = "copy";
|
|
4567
4689
|
},
|
|
4568
4690
|
children: [
|
|
4569
|
-
/* @__PURE__ */ (0,
|
|
4570
|
-
/* @__PURE__ */ (0,
|
|
4691
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "truncate", children: [
|
|
4692
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "aria-hidden": true, className: "mr-1 text-muted-foreground", children: "\u25C7" }),
|
|
4571
4693
|
name
|
|
4572
4694
|
] }),
|
|
4573
|
-
/* @__PURE__ */ (0,
|
|
4695
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[10px] text-muted-foreground", "data-instance-count": "", children: count })
|
|
4574
4696
|
]
|
|
4575
4697
|
},
|
|
4576
4698
|
id
|
|
4577
4699
|
);
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
4579
|
-
search ? /* @__PURE__ */ (0,
|
|
4700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-components-panel": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
|
|
4701
|
+
search ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4580
4702
|
"input",
|
|
4581
4703
|
{
|
|
4582
4704
|
type: "search",
|
|
@@ -4586,11 +4708,11 @@ function CanvasComponentsPanel({
|
|
|
4586
4708
|
onInput: (e) => setQuery(e.target.value)
|
|
4587
4709
|
}
|
|
4588
4710
|
) : null,
|
|
4589
|
-
shownSets.map((set) => /* @__PURE__ */ (0,
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4711
|
+
shownSets.map((set) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-component-set": set.id, className: "flex flex-col", children: [
|
|
4712
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4591
4713
|
item(set.id, set.name, set.variants.reduce((sum, v) => sum + v.instanceCount, 0), { "data-kind": "set" }),
|
|
4592
|
-
components ? /* @__PURE__ */ (0,
|
|
4593
|
-
/* @__PURE__ */ (0,
|
|
4714
|
+
components ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
4715
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4594
4716
|
"button",
|
|
4595
4717
|
{
|
|
4596
4718
|
type: "button",
|
|
@@ -4602,7 +4724,7 @@ function CanvasComponentsPanel({
|
|
|
4602
4724
|
children: "+\xA0Variant"
|
|
4603
4725
|
}
|
|
4604
4726
|
),
|
|
4605
|
-
/* @__PURE__ */ (0,
|
|
4727
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4606
4728
|
"button",
|
|
4607
4729
|
{
|
|
4608
4730
|
type: "button",
|
|
@@ -4617,8 +4739,8 @@ function CanvasComponentsPanel({
|
|
|
4617
4739
|
)
|
|
4618
4740
|
] }) : null
|
|
4619
4741
|
] }),
|
|
4620
|
-
components && propsOpen === set.id ? /* @__PURE__ */ (0,
|
|
4621
|
-
/* @__PURE__ */ (0,
|
|
4742
|
+
components && propsOpen === set.id ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { "data-variant-properties": set.id, className: "ml-3 flex flex-col gap-1 border-l border-border py-1 pl-2", children: set.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-variant-option": option.name, className: "flex flex-col gap-0.5", children: [
|
|
4743
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4622
4744
|
InlineField,
|
|
4623
4745
|
{
|
|
4624
4746
|
value: option.name,
|
|
@@ -4626,7 +4748,7 @@ function CanvasComponentsPanel({
|
|
|
4626
4748
|
onCommit: (next) => report(components.renameVariantProperty(option.name, next, set.id))
|
|
4627
4749
|
}
|
|
4628
4750
|
),
|
|
4629
|
-
/* @__PURE__ */ (0,
|
|
4751
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ml-2 flex flex-wrap gap-1", children: option.values.map((value) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4630
4752
|
InlineField,
|
|
4631
4753
|
{
|
|
4632
4754
|
value,
|
|
@@ -4636,8 +4758,8 @@ function CanvasComponentsPanel({
|
|
|
4636
4758
|
value
|
|
4637
4759
|
)) })
|
|
4638
4760
|
] }, option.name)) }) : null,
|
|
4639
|
-
/* @__PURE__ */ (0,
|
|
4640
|
-
/* @__PURE__ */ (0,
|
|
4761
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ml-3 flex flex-col border-l border-border pl-1", children: set.variants.map((v) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-variant-row": v.id, className: "flex flex-col", children: [
|
|
4762
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4641
4763
|
item(
|
|
4642
4764
|
v.id,
|
|
4643
4765
|
v.name,
|
|
@@ -4648,7 +4770,7 @@ function CanvasComponentsPanel({
|
|
|
4648
4770
|
setMenuFor(v.id);
|
|
4649
4771
|
} : void 0
|
|
4650
4772
|
),
|
|
4651
|
-
components ? /* @__PURE__ */ (0,
|
|
4773
|
+
components ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4652
4774
|
"button",
|
|
4653
4775
|
{
|
|
4654
4776
|
type: "button",
|
|
@@ -4662,8 +4784,8 @@ function CanvasComponentsPanel({
|
|
|
4662
4784
|
}
|
|
4663
4785
|
) : null
|
|
4664
4786
|
] }),
|
|
4665
|
-
components && menuFor === v.id ? /* @__PURE__ */ (0,
|
|
4666
|
-
/* @__PURE__ */ (0,
|
|
4787
|
+
components && menuFor === v.id ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { role: "menu", "data-variant-menu": v.id, className: "ml-2 flex flex-col rounded border border-border bg-background p-1 shadow", children: [
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4667
4789
|
"button",
|
|
4668
4790
|
{
|
|
4669
4791
|
type: "button",
|
|
@@ -4677,7 +4799,7 @@ function CanvasComponentsPanel({
|
|
|
4677
4799
|
children: "Edit values\u2026"
|
|
4678
4800
|
}
|
|
4679
4801
|
),
|
|
4680
|
-
/* @__PURE__ */ (0,
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4681
4803
|
"button",
|
|
4682
4804
|
{
|
|
4683
4805
|
type: "button",
|
|
@@ -4691,7 +4813,7 @@ function CanvasComponentsPanel({
|
|
|
4691
4813
|
children: "Duplicate"
|
|
4692
4814
|
}
|
|
4693
4815
|
),
|
|
4694
|
-
/* @__PURE__ */ (0,
|
|
4816
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4695
4817
|
"button",
|
|
4696
4818
|
{
|
|
4697
4819
|
type: "button",
|
|
@@ -4708,7 +4830,7 @@ function CanvasComponentsPanel({
|
|
|
4708
4830
|
}
|
|
4709
4831
|
)
|
|
4710
4832
|
] }) : null,
|
|
4711
|
-
components && editing === v.id ? /* @__PURE__ */ (0,
|
|
4833
|
+
components && editing === v.id ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
4712
4834
|
"form",
|
|
4713
4835
|
{
|
|
4714
4836
|
"data-variant-editor": v.id,
|
|
@@ -4722,9 +4844,9 @@ function CanvasComponentsPanel({
|
|
|
4722
4844
|
if (report(components.setVariantProperties(values, v.id))) setEditing(null);
|
|
4723
4845
|
},
|
|
4724
4846
|
children: [
|
|
4725
|
-
set.options.map((option) => /* @__PURE__ */ (0,
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
4727
|
-
/* @__PURE__ */ (0,
|
|
4847
|
+
set.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4848
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-16 shrink-0 truncate text-muted-foreground", children: option.name }),
|
|
4849
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4728
4850
|
"input",
|
|
4729
4851
|
{
|
|
4730
4852
|
type: "text",
|
|
@@ -4735,9 +4857,9 @@ function CanvasComponentsPanel({
|
|
|
4735
4857
|
}
|
|
4736
4858
|
)
|
|
4737
4859
|
] }, option.name)),
|
|
4738
|
-
/* @__PURE__ */ (0,
|
|
4739
|
-
/* @__PURE__ */ (0,
|
|
4740
|
-
/* @__PURE__ */ (0,
|
|
4860
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
|
|
4861
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "submit", className: "rounded border border-border px-2 py-0.5 hover:bg-muted", "data-action": "save-variant", children: "Save" }),
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "rounded px-2 py-0.5 hover:bg-muted", "data-action": "cancel-variant", onClick: () => setEditing(null), children: "Cancel" })
|
|
4741
4863
|
] })
|
|
4742
4864
|
]
|
|
4743
4865
|
}
|
|
@@ -4745,7 +4867,7 @@ function CanvasComponentsPanel({
|
|
|
4745
4867
|
] }, v.id)) })
|
|
4746
4868
|
] }, set.id)),
|
|
4747
4869
|
lone.map((c) => item(c.id, c.name, c.instanceCount, { "data-kind": "component" })),
|
|
4748
|
-
all.length === 0 ? /* @__PURE__ */ (0,
|
|
4870
|
+
all.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-muted-foreground", children: "No components yet. Select a frame and choose Create Component." }) : null
|
|
4749
4871
|
] });
|
|
4750
4872
|
}
|
|
4751
4873
|
function CanvasInstanceInspector({
|
|
@@ -4755,36 +4877,36 @@ function CanvasInstanceInspector({
|
|
|
4755
4877
|
onError,
|
|
4756
4878
|
className = ""
|
|
4757
4879
|
}) {
|
|
4758
|
-
const info = nodeId ? (0,
|
|
4880
|
+
const info = nodeId ? (0, import_canvas25.inspectCanvasInstance)(nodes, nodeId) : void 0;
|
|
4759
4881
|
if (!info) return null;
|
|
4760
4882
|
const report = (result) => {
|
|
4761
4883
|
if (result && !result.ok && result.reason) onError?.(result.reason);
|
|
4762
4884
|
};
|
|
4763
4885
|
const setProp = (name, value) => report(components.setInstanceProperties({ [name]: value }, [info.id]));
|
|
4764
|
-
const allComponents = (0,
|
|
4886
|
+
const allComponents = (0, import_canvas25.listCanvasComponents)(nodes).components;
|
|
4765
4887
|
const linked = info.status === "linked";
|
|
4766
4888
|
const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-40";
|
|
4767
|
-
return /* @__PURE__ */ (0,
|
|
4768
|
-
/* @__PURE__ */ (0,
|
|
4769
|
-
/* @__PURE__ */ (0,
|
|
4770
|
-
info.nested ? /* @__PURE__ */ (0,
|
|
4889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-instance-inspector": "", "data-instance-id": info.id, className: `flex flex-col gap-2 text-xs text-foreground ${className}`, children: [
|
|
4890
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate font-medium", "data-instance-main": "", children: linked ? info.componentName : "Main component missing" }),
|
|
4892
|
+
info.nested ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Nested" }) : null
|
|
4771
4893
|
] }),
|
|
4772
|
-
info.variantOptions.map((option) => /* @__PURE__ */ (0,
|
|
4773
|
-
/* @__PURE__ */ (0,
|
|
4774
|
-
/* @__PURE__ */ (0,
|
|
4894
|
+
info.variantOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2", "data-variant-property": option.name, children: [
|
|
4895
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: option.name }),
|
|
4896
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4775
4897
|
"select",
|
|
4776
4898
|
{
|
|
4777
4899
|
"aria-label": `${option.name} variant`,
|
|
4778
4900
|
className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
|
|
4779
4901
|
value: info.variant[option.name] ?? "",
|
|
4780
4902
|
onChange: (e) => setProp(option.name, e.currentTarget.value),
|
|
4781
|
-
children: option.values.map((v) => /* @__PURE__ */ (0,
|
|
4903
|
+
children: option.values.map((v) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: v, children: v }, v))
|
|
4782
4904
|
}
|
|
4783
4905
|
)
|
|
4784
4906
|
] }, option.name)),
|
|
4785
|
-
info.properties.map((p) => /* @__PURE__ */ (0,
|
|
4786
|
-
/* @__PURE__ */ (0,
|
|
4787
|
-
p.type === "boolean" ? /* @__PURE__ */ (0,
|
|
4907
|
+
info.properties.map((p) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2", "data-component-property": p.name, children: [
|
|
4908
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: p.name }),
|
|
4909
|
+
p.type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", "aria-label": p.name, checked: p.value === true, onChange: (e) => setProp(p.name, e.currentTarget.checked) }) : p.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4788
4910
|
"input",
|
|
4789
4911
|
{
|
|
4790
4912
|
type: "text",
|
|
@@ -4799,22 +4921,22 @@ function CanvasInstanceInspector({
|
|
|
4799
4921
|
}
|
|
4800
4922
|
},
|
|
4801
4923
|
String(p.value)
|
|
4802
|
-
) : /* @__PURE__ */ (0,
|
|
4924
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4803
4925
|
"select",
|
|
4804
4926
|
{
|
|
4805
4927
|
"aria-label": p.name,
|
|
4806
4928
|
className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
|
|
4807
4929
|
value: String(p.value),
|
|
4808
4930
|
onChange: (e) => setProp(p.name, e.currentTarget.value),
|
|
4809
|
-
children: allComponents.filter((c) => !p.preferred?.length || p.preferred.includes(c.id) || c.id === p.value).map((c) => /* @__PURE__ */ (0,
|
|
4931
|
+
children: allComponents.filter((c) => !p.preferred?.length || p.preferred.includes(c.id) || c.id === p.value).map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: c.id, children: c.name }, c.id))
|
|
4810
4932
|
}
|
|
4811
4933
|
)
|
|
4812
4934
|
] }, p.name)),
|
|
4813
|
-
info.overrides.length ? /* @__PURE__ */ (0,
|
|
4814
|
-
/* @__PURE__ */ (0,
|
|
4815
|
-
info.overrides.map((o) => /* @__PURE__ */ (0,
|
|
4816
|
-
/* @__PURE__ */ (0,
|
|
4817
|
-
o.groups.map((g) => /* @__PURE__ */ (0,
|
|
4935
|
+
info.overrides.length ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1", "data-instance-overrides": "", children: [
|
|
4936
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Overrides" }),
|
|
4937
|
+
info.overrides.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-override-layer": o.id, children: [
|
|
4938
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "mr-1 truncate", children: o.name }),
|
|
4939
|
+
o.groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
4818
4940
|
"button",
|
|
4819
4941
|
{
|
|
4820
4942
|
type: "button",
|
|
@@ -4831,11 +4953,11 @@ function CanvasInstanceInspector({
|
|
|
4831
4953
|
))
|
|
4832
4954
|
] }, o.id))
|
|
4833
4955
|
] }) : null,
|
|
4834
|
-
/* @__PURE__ */ (0,
|
|
4835
|
-
linked ? /* @__PURE__ */ (0,
|
|
4836
|
-
/* @__PURE__ */ (0,
|
|
4837
|
-
/* @__PURE__ */ (0,
|
|
4838
|
-
/* @__PURE__ */ (0,
|
|
4956
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4957
|
+
linked ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
4958
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn2, "data-action": "reset", onClick: () => report(components.resetOverrides(info.id)), children: "Reset all" }),
|
|
4959
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn2, "data-action": "go-to-main", onClick: () => components.goToMainComponent(info.id), children: "Go to main" }),
|
|
4960
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4839
4961
|
"button",
|
|
4840
4962
|
{
|
|
4841
4963
|
type: "button",
|
|
@@ -4846,8 +4968,8 @@ function CanvasInstanceInspector({
|
|
|
4846
4968
|
children: "Push changes"
|
|
4847
4969
|
}
|
|
4848
4970
|
)
|
|
4849
|
-
] }) : /* @__PURE__ */ (0,
|
|
4850
|
-
/* @__PURE__ */ (0,
|
|
4971
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn2, "data-action": "restore", onClick: () => report(components.restoreMainComponent(info.rootId)), children: "Restore main component" }),
|
|
4972
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4851
4973
|
"button",
|
|
4852
4974
|
{
|
|
4853
4975
|
type: "button",
|
|
@@ -4864,12 +4986,12 @@ function CanvasInstanceInspector({
|
|
|
4864
4986
|
}
|
|
4865
4987
|
|
|
4866
4988
|
// src/canvas/index.ts
|
|
4867
|
-
var
|
|
4989
|
+
var import_canvas41 = require("@pixerate/editor/canvas");
|
|
4868
4990
|
|
|
4869
4991
|
// src/canvas/MermaidFamilyScene.tsx
|
|
4870
|
-
var
|
|
4871
|
-
var
|
|
4872
|
-
var
|
|
4992
|
+
var import_react38 = require("react");
|
|
4993
|
+
var import_canvas26 = require("@pixerate/editor/canvas");
|
|
4994
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4873
4995
|
function MermaidFamilyScene({
|
|
4874
4996
|
scene,
|
|
4875
4997
|
padding = 16,
|
|
@@ -4882,7 +5004,7 @@ function MermaidFamilyScene({
|
|
|
4882
5004
|
style,
|
|
4883
5005
|
title
|
|
4884
5006
|
}) {
|
|
4885
|
-
const uid = (0,
|
|
5007
|
+
const uid = (0, import_react38.useId)().replace(/:/g, "");
|
|
4886
5008
|
const marker = (kind) => kind ? `url(#${uid}-${kind})` : void 0;
|
|
4887
5009
|
const x = scene.x - padding;
|
|
4888
5010
|
const y = scene.y - padding;
|
|
@@ -4900,7 +5022,7 @@ function MermaidFamilyScene({
|
|
|
4900
5022
|
cursor: "pointer"
|
|
4901
5023
|
} : { pointerEvents: "none" };
|
|
4902
5024
|
const stroke = (mark) => mark.selected ? { stroke: selectionColor, strokeWidth: Math.max(2, mark.strokeWidth ?? 0) } : { stroke: mark.stroke, strokeWidth: mark.strokeWidth };
|
|
4903
|
-
return /* @__PURE__ */ (0,
|
|
5025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
4904
5026
|
"svg",
|
|
4905
5027
|
{
|
|
4906
5028
|
className: `pixerate-diagram-scene ${className}`.trim(),
|
|
@@ -4913,15 +5035,15 @@ function MermaidFamilyScene({
|
|
|
4913
5035
|
style: { display: "block", maxWidth: "100%", height: "auto", overflow: "visible", ...style },
|
|
4914
5036
|
onClick: interactive ? (event) => onSelect?.(null, event) : void 0,
|
|
4915
5037
|
children: [
|
|
4916
|
-
/* @__PURE__ */ (0,
|
|
4917
|
-
/* @__PURE__ */ (0,
|
|
4918
|
-
/* @__PURE__ */ (0,
|
|
5038
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("defs", { children: [
|
|
5039
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("marker", { id: `${uid}-arrowclosed`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M0,0 L10,5 L0,10 Z", style: { fill: markerColor } }) }),
|
|
5040
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("marker", { id: `${uid}-arrow`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M0,0 L10,5 L0,10", style: { fill: "none", stroke: markerColor, strokeWidth: 1.5 } }) })
|
|
4919
5041
|
] }),
|
|
4920
5042
|
scene.marks.map((mark) => {
|
|
4921
5043
|
const common = { "data-role": mark.role, "data-target": mark.target, "data-selected": mark.selected ? "" : void 0, opacity: mark.opacity, ...handlers(mark) };
|
|
4922
5044
|
switch (mark.kind) {
|
|
4923
5045
|
case "rect":
|
|
4924
|
-
return /* @__PURE__ */ (0,
|
|
5046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4925
5047
|
"rect",
|
|
4926
5048
|
{
|
|
4927
5049
|
...common,
|
|
@@ -4936,9 +5058,9 @@ function MermaidFamilyScene({
|
|
|
4936
5058
|
mark.key
|
|
4937
5059
|
);
|
|
4938
5060
|
case "circle":
|
|
4939
|
-
return /* @__PURE__ */ (0,
|
|
5061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, ...stroke(mark) } }, mark.key);
|
|
4940
5062
|
case "line":
|
|
4941
|
-
return /* @__PURE__ */ (0,
|
|
5063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4942
5064
|
"line",
|
|
4943
5065
|
{
|
|
4944
5066
|
...common,
|
|
@@ -4954,7 +5076,7 @@ function MermaidFamilyScene({
|
|
|
4954
5076
|
mark.key
|
|
4955
5077
|
);
|
|
4956
5078
|
case "path":
|
|
4957
|
-
return /* @__PURE__ */ (0,
|
|
5079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4958
5080
|
"path",
|
|
4959
5081
|
{
|
|
4960
5082
|
...common,
|
|
@@ -4968,14 +5090,14 @@ function MermaidFamilyScene({
|
|
|
4968
5090
|
mark.key
|
|
4969
5091
|
);
|
|
4970
5092
|
case "text":
|
|
4971
|
-
return /* @__PURE__ */ (0,
|
|
5093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4972
5094
|
"text",
|
|
4973
5095
|
{
|
|
4974
5096
|
...common,
|
|
4975
5097
|
x: mark.x,
|
|
4976
5098
|
y: mark.y,
|
|
4977
5099
|
textAnchor: mark.anchor,
|
|
4978
|
-
dominantBaseline: (0,
|
|
5100
|
+
dominantBaseline: (0, import_canvas26.diagramTextBaseline)(mark.baseline),
|
|
4979
5101
|
transform: mark.rotate ? `rotate(${mark.rotate} ${mark.x} ${mark.y})` : void 0,
|
|
4980
5102
|
style: {
|
|
4981
5103
|
fill: mark.selected ? selectionColor : mark.fill,
|
|
@@ -4996,14 +5118,14 @@ function MermaidFamilyScene({
|
|
|
4996
5118
|
}
|
|
4997
5119
|
|
|
4998
5120
|
// src/canvas/useMermaidDiagram.ts
|
|
4999
|
-
var
|
|
5121
|
+
var import_react39 = require("react");
|
|
5000
5122
|
var import_diagram = require("@pixerate/editor/diagram");
|
|
5001
|
-
var
|
|
5123
|
+
var import_canvas27 = require("@pixerate/editor/canvas");
|
|
5002
5124
|
function useDiagramState(controller) {
|
|
5003
|
-
return (0,
|
|
5125
|
+
return (0, import_react39.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
|
|
5004
5126
|
}
|
|
5005
5127
|
function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
|
|
5006
|
-
const own = (0,
|
|
5128
|
+
const own = (0, import_react39.useRef)(null);
|
|
5007
5129
|
let controller;
|
|
5008
5130
|
if (controllerOrOptions instanceof import_diagram.DiagramController) controller = controllerOrOptions;
|
|
5009
5131
|
else {
|
|
@@ -5013,26 +5135,26 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
|
|
|
5013
5135
|
const layoutOptions = (controllerOrOptions instanceof import_diagram.DiagramController ? void 0 : controllerOrOptions.layoutOptions) ?? view.layoutOptions;
|
|
5014
5136
|
const sceneTheme = (controllerOrOptions instanceof import_diagram.DiagramController ? void 0 : controllerOrOptions.sceneTheme) ?? view.sceneTheme;
|
|
5015
5137
|
const state = useDiagramState(controller);
|
|
5016
|
-
const editorDocument = (0,
|
|
5017
|
-
(0,
|
|
5018
|
-
const canvas = (0,
|
|
5019
|
-
() => (0,
|
|
5138
|
+
const editorDocument = (0, import_react39.useMemo)(() => (0, import_diagram.createDiagramEditorDocument)(controller), [controller]);
|
|
5139
|
+
(0, import_react39.useEffect)(() => () => editorDocument.destroy(), [editorDocument]);
|
|
5140
|
+
const canvas = (0, import_react39.useMemo)(
|
|
5141
|
+
() => (0, import_canvas27.mermaidToCanvas)(state.document, { ...layoutOptions, editable: state.editable }),
|
|
5020
5142
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5021
5143
|
[state.document, state.editable]
|
|
5022
5144
|
);
|
|
5023
|
-
const scene = (0,
|
|
5024
|
-
() => state.document.tier === "editable" ? (0,
|
|
5145
|
+
const scene = (0, import_react39.useMemo)(
|
|
5146
|
+
() => state.document.tier === "editable" ? (0, import_canvas27.familySceneFromLayout)(state.document.family, state.document.graph, canvas.layout, { theme: { ...import_canvas27.CSS_VARIABLE_DIAGRAM_SCENE_THEME, ...sceneTheme }, selection: state.selection }) : null,
|
|
5025
5147
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5026
5148
|
[state.document, canvas.layout, state.selection]
|
|
5027
5149
|
);
|
|
5028
|
-
const layoutRef = (0,
|
|
5150
|
+
const layoutRef = (0, import_react39.useRef)(canvas.layout);
|
|
5029
5151
|
layoutRef.current = canvas.layout;
|
|
5030
|
-
const actions = (0,
|
|
5152
|
+
const actions = (0, import_react39.useMemo)(
|
|
5031
5153
|
() => ({
|
|
5032
5154
|
apply: (ops, label) => controller.apply(ops, label),
|
|
5033
5155
|
load: (source, options) => controller.load(source, options),
|
|
5034
5156
|
moveNodes: (moved, all = moved) => {
|
|
5035
|
-
const op = (0,
|
|
5157
|
+
const op = (0, import_canvas27.mermaidMovesFromCanvas)(layoutRef.current, moved, all, { stored: controller.getDocument().meta.layout ?? {} });
|
|
5036
5158
|
return op ? controller.apply(op, "Move") : null;
|
|
5037
5159
|
},
|
|
5038
5160
|
connect: (source, target, label) => controller.apply({ type: "addEdge", edge: { source, target, ...label ? { label } : {} } }, "Connect"),
|
|
@@ -5051,7 +5173,7 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
|
|
|
5051
5173
|
"Rename"
|
|
5052
5174
|
),
|
|
5053
5175
|
renameTarget: (target, label) => {
|
|
5054
|
-
const op = (0,
|
|
5176
|
+
const op = (0, import_canvas27.diagramRenameOp)(controller.getDocument(), target, label);
|
|
5055
5177
|
return op ? controller.apply(op, "Rename") : null;
|
|
5056
5178
|
},
|
|
5057
5179
|
select: (ids) => controller.select(ids),
|
|
@@ -5064,13 +5186,13 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
|
|
|
5064
5186
|
}
|
|
5065
5187
|
function useMermaidStream(source, options = {}) {
|
|
5066
5188
|
const { complete = false, duration = 300, ...layoutOptions } = options;
|
|
5067
|
-
const stream = (0,
|
|
5068
|
-
if (!stream.current) stream.current = new
|
|
5069
|
-
const result = (0,
|
|
5070
|
-
const [shown, setShown] = (0,
|
|
5071
|
-
const shownRef = (0,
|
|
5189
|
+
const stream = (0, import_react39.useRef)(null);
|
|
5190
|
+
if (!stream.current) stream.current = new import_canvas27.DiagramStream(layoutOptions);
|
|
5191
|
+
const result = (0, import_react39.useMemo)(() => stream.current.update(source, complete), [source, complete]);
|
|
5192
|
+
const [shown, setShown] = (0, import_react39.useState)({ layout: result.layout, settled: true });
|
|
5193
|
+
const shownRef = (0, import_react39.useRef)(shown.layout);
|
|
5072
5194
|
shownRef.current = shown.layout;
|
|
5073
|
-
(0,
|
|
5195
|
+
(0, import_react39.useEffect)(() => {
|
|
5074
5196
|
const target = result.layout;
|
|
5075
5197
|
if (!target) return setShown({ layout: null, settled: true });
|
|
5076
5198
|
const from = shownRef.current;
|
|
@@ -5080,14 +5202,14 @@ function useMermaidStream(source, options = {}) {
|
|
|
5080
5202
|
const start = performance.now();
|
|
5081
5203
|
const step = () => {
|
|
5082
5204
|
const t = Math.min(1, (performance.now() - start) / duration);
|
|
5083
|
-
setShown({ layout: (0,
|
|
5205
|
+
setShown({ layout: (0, import_canvas27.blendDiagramLayout)(from, target, (0, import_canvas27.easeDiagramTween)(t)), settled: t >= 1 });
|
|
5084
5206
|
if (t < 1) frame = requestAnimationFrame(step);
|
|
5085
5207
|
};
|
|
5086
5208
|
frame = requestAnimationFrame(step);
|
|
5087
5209
|
return () => cancelAnimationFrame(frame);
|
|
5088
5210
|
}, [result.layout, duration]);
|
|
5089
5211
|
const doc = result.document.tier === "editable" ? result.document : null;
|
|
5090
|
-
const canvas = (0,
|
|
5212
|
+
const canvas = (0, import_react39.useMemo)(() => {
|
|
5091
5213
|
if (!doc || !shown.layout) return { nodes: [], edges: [] };
|
|
5092
5214
|
const placed = new Set(Object.keys(shown.layout.positions));
|
|
5093
5215
|
const graph = {
|
|
@@ -5096,24 +5218,24 @@ function useMermaidStream(source, options = {}) {
|
|
|
5096
5218
|
groups: doc.graph.groups.filter((g) => placed.has(g.id)),
|
|
5097
5219
|
edges: doc.graph.edges.filter((e) => placed.has(e.source) && placed.has(e.target))
|
|
5098
5220
|
};
|
|
5099
|
-
return (0,
|
|
5221
|
+
return (0, import_canvas27.mermaidToCanvas)({ ...doc, graph }, { layout: shown.layout });
|
|
5100
5222
|
}, [doc, shown.layout]);
|
|
5101
5223
|
return { document: doc, ...canvas, layout: shown.layout, settled: shown.settled };
|
|
5102
5224
|
}
|
|
5103
5225
|
|
|
5104
5226
|
// src/canvas/MermaidDiagramNode.tsx
|
|
5105
|
-
var
|
|
5106
|
-
var
|
|
5227
|
+
var import_canvas28 = require("@pixerate/editor/canvas");
|
|
5228
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5107
5229
|
function mermaidNodeStyle(styles = {}, selected = false) {
|
|
5108
|
-
const paint = (0,
|
|
5230
|
+
const paint = (0, import_canvas28.mermaidNodePaint)(styles, selected);
|
|
5109
5231
|
const { color, "stroke-width": strokeWidth, "stroke-dasharray": strokeDasharray, ...vars } = paint;
|
|
5110
5232
|
return { ...vars, color, strokeWidth, strokeDasharray };
|
|
5111
5233
|
}
|
|
5112
5234
|
function MermaidDiagramNode({ data, width = 160, height = 56, selected, className = "", children }) {
|
|
5113
5235
|
const node = data.node;
|
|
5114
5236
|
if (!node) return null;
|
|
5115
|
-
const members = (0,
|
|
5116
|
-
return /* @__PURE__ */ (0,
|
|
5237
|
+
const members = (0, import_canvas28.mermaidNodeMembers)(node.data);
|
|
5238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
5117
5239
|
"div",
|
|
5118
5240
|
{
|
|
5119
5241
|
className: `pixerate-diagram-node ${className}`.trim(),
|
|
@@ -5121,14 +5243,14 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
|
|
|
5121
5243
|
"data-selected": selected ? "true" : void 0,
|
|
5122
5244
|
style: { position: "relative", width: "100%", height: "100%", ...mermaidNodeStyle(data.resolvedStyles, selected) },
|
|
5123
5245
|
children: [
|
|
5124
|
-
/* @__PURE__ */ (0,
|
|
5125
|
-
/* @__PURE__ */ (0,
|
|
5246
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_canvas28.mermaidShapePaths)(node.shape, width, height).map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: path.d, style: { ...import_canvas28.MERMAID_SHAPE_PAINT[path.paint], vectorEffect: "non-scaling-stroke" } }, i)) }),
|
|
5247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
5126
5248
|
"div",
|
|
5127
5249
|
{
|
|
5128
5250
|
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" },
|
|
5129
5251
|
children: [
|
|
5130
|
-
(0,
|
|
5131
|
-
members.length > 0 && /* @__PURE__ */ (0,
|
|
5252
|
+
(0, import_canvas28.mermaidLabelLines)(node.label).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { fontWeight: members.length ? 600 : void 0 }, children: line }, i)),
|
|
5253
|
+
members.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)("div", { children: m }, i)) })
|
|
5132
5254
|
]
|
|
5133
5255
|
}
|
|
5134
5256
|
),
|
|
@@ -5140,7 +5262,7 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
|
|
|
5140
5262
|
function MermaidDiagramGroup({ data, selected, className = "", children }) {
|
|
5141
5263
|
const group = data.group;
|
|
5142
5264
|
if (!group) return null;
|
|
5143
|
-
return /* @__PURE__ */ (0,
|
|
5265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
5144
5266
|
"div",
|
|
5145
5267
|
{
|
|
5146
5268
|
className: `pixerate-diagram-group ${className}`.trim(),
|
|
@@ -5155,7 +5277,7 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
|
|
|
5155
5277
|
color: data.resolvedStyles?.color ?? "var(--muted-foreground, #475569)"
|
|
5156
5278
|
},
|
|
5157
5279
|
children: [
|
|
5158
|
-
/* @__PURE__ */ (0,
|
|
5280
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { padding: "6px 10px", fontSize: 12, fontWeight: 600 }, children: (0, import_canvas28.mermaidLabelLines)(group.label).join(" ") }),
|
|
5159
5281
|
children
|
|
5160
5282
|
]
|
|
5161
5283
|
}
|
|
@@ -5163,29 +5285,29 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
|
|
|
5163
5285
|
}
|
|
5164
5286
|
|
|
5165
5287
|
// src/canvas/MermaidThumbnail.tsx
|
|
5166
|
-
var
|
|
5288
|
+
var import_react40 = require("react");
|
|
5167
5289
|
var import_diagram2 = require("@pixerate/editor/diagram");
|
|
5168
|
-
var
|
|
5169
|
-
var
|
|
5290
|
+
var import_canvas29 = require("@pixerate/editor/canvas");
|
|
5291
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5170
5292
|
function MermaidThumbnail({ source, className = "", fallback = null, ...options }) {
|
|
5171
|
-
const doc = (0,
|
|
5293
|
+
const doc = (0, import_react40.useMemo)(() => typeof source === "string" ? (0, import_diagram2.parseMermaid)(source) : source, [source]);
|
|
5172
5294
|
const key = JSON.stringify(options);
|
|
5173
|
-
const drawn = (0,
|
|
5174
|
-
() => doc.tier === "editable" && doc.graph.nodes.length ? (0,
|
|
5295
|
+
const drawn = (0, import_react40.useMemo)(
|
|
5296
|
+
() => doc.tier === "editable" && doc.graph.nodes.length ? (0, import_canvas29.mermaidThumbnailSvg)(doc, options) : null,
|
|
5175
5297
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5176
5298
|
[doc, key]
|
|
5177
5299
|
);
|
|
5178
|
-
if (!drawn) return /* @__PURE__ */ (0,
|
|
5179
|
-
return /* @__PURE__ */ (0,
|
|
5300
|
+
if (!drawn) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: fallback });
|
|
5301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: `pixerate-diagram-thumbnail ${className}`.trim(), style: { display: "inline-block", lineHeight: 0 }, dangerouslySetInnerHTML: { __html: drawn.svg } });
|
|
5180
5302
|
}
|
|
5181
5303
|
|
|
5182
5304
|
// src/canvas/useDiagramDirector.ts
|
|
5183
|
-
var
|
|
5305
|
+
var import_react41 = require("react");
|
|
5184
5306
|
var import_diagram3 = require("@pixerate/editor/diagram");
|
|
5185
5307
|
function useDiagramDirector(controller, options) {
|
|
5186
|
-
const placement = (0,
|
|
5308
|
+
const placement = (0, import_react41.useRef)(options.placement);
|
|
5187
5309
|
placement.current = options.placement;
|
|
5188
|
-
const ref = (0,
|
|
5310
|
+
const ref = (0, import_react41.useRef)(null);
|
|
5189
5311
|
if (!ref.current) {
|
|
5190
5312
|
const presence = new import_diagram3.PresenceStore();
|
|
5191
5313
|
ref.current = {
|
|
@@ -5196,31 +5318,31 @@ function useDiagramDirector(controller, options) {
|
|
|
5196
5318
|
return ref.current;
|
|
5197
5319
|
}
|
|
5198
5320
|
function usePresenceState(presence) {
|
|
5199
|
-
return (0,
|
|
5321
|
+
return (0, import_react41.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
|
|
5200
5322
|
}
|
|
5201
5323
|
|
|
5202
5324
|
// src/canvas/DiagramPresenceLayer.tsx
|
|
5203
|
-
var
|
|
5325
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5204
5326
|
function DiagramPresenceLayer({ presence, viewport, className = "" }) {
|
|
5205
5327
|
const { actors } = usePresenceState(presence);
|
|
5206
5328
|
if (!actors.length) return null;
|
|
5207
|
-
return /* @__PURE__ */ (0,
|
|
5208
|
-
/* @__PURE__ */ (0,
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `pixerate-diagram-presence ${className}`.trim(), "aria-hidden": "true", style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 }, children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${a.x * viewport.zoom + viewport.x}px, ${a.y * viewport.zoom + viewport.y}px)` }, children: [
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { position: "absolute", left: 14, top: 16, whiteSpace: "nowrap", borderRadius: 4, padding: "1px 6px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.message ?? a.name })
|
|
5210
5332
|
] }, a.id)) });
|
|
5211
5333
|
}
|
|
5212
5334
|
|
|
5213
5335
|
// src/canvas/useCanvasProposals.ts
|
|
5214
|
-
var
|
|
5215
|
-
var
|
|
5336
|
+
var import_react42 = require("react");
|
|
5337
|
+
var import_canvas30 = require("@pixerate/editor/canvas");
|
|
5216
5338
|
function useCanvasProposals(options) {
|
|
5217
|
-
const latest = (0,
|
|
5339
|
+
const latest = (0, import_react42.useRef)(options);
|
|
5218
5340
|
latest.current = options;
|
|
5219
|
-
const live = (0,
|
|
5341
|
+
const live = (0, import_react42.useRef)({ nodes: options.nodes, edges: options.edges });
|
|
5220
5342
|
live.current = { nodes: options.nodes, edges: options.edges };
|
|
5221
|
-
const storeRef = (0,
|
|
5343
|
+
const storeRef = (0, import_react42.useRef)(null);
|
|
5222
5344
|
if (storeRef.current === null) {
|
|
5223
|
-
storeRef.current = (0,
|
|
5345
|
+
storeRef.current = (0, import_canvas30.createCanvasProposals)({
|
|
5224
5346
|
getNodes: () => live.current.nodes,
|
|
5225
5347
|
getEdges: () => live.current.edges,
|
|
5226
5348
|
setNodes: (nodes) => {
|
|
@@ -5241,9 +5363,9 @@ function useCanvasProposals(options) {
|
|
|
5241
5363
|
});
|
|
5242
5364
|
}
|
|
5243
5365
|
const store = storeRef.current;
|
|
5244
|
-
const state = (0,
|
|
5245
|
-
const view = (0,
|
|
5246
|
-
return (0,
|
|
5366
|
+
const state = (0, import_react42.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
|
|
5367
|
+
const view = (0, import_react42.useMemo)(() => store.withGhosts(options.nodes, options.edges), [store, state, options.nodes, options.edges]);
|
|
5368
|
+
return (0, import_react42.useMemo)(
|
|
5247
5369
|
() => ({
|
|
5248
5370
|
store,
|
|
5249
5371
|
proposals: state.proposals,
|
|
@@ -5257,19 +5379,19 @@ function useCanvasProposals(options) {
|
|
|
5257
5379
|
);
|
|
5258
5380
|
}
|
|
5259
5381
|
function useCanvasChangeFeed(options) {
|
|
5260
|
-
const latest = (0,
|
|
5382
|
+
const latest = (0, import_react42.useRef)(options);
|
|
5261
5383
|
latest.current = options;
|
|
5262
|
-
const [last, setLast] = (0,
|
|
5263
|
-
const feed = (0,
|
|
5264
|
-
() => (0,
|
|
5384
|
+
const [last, setLast] = (0, import_react42.useState)(null);
|
|
5385
|
+
const feed = (0, import_react42.useMemo)(
|
|
5386
|
+
() => (0, import_canvas30.createCanvasChangeFeed)({
|
|
5265
5387
|
getNodes: () => latest.current.nodes,
|
|
5266
5388
|
getEdges: () => latest.current.edges,
|
|
5267
5389
|
ignoreNodeKeys: options.ignoreNodeKeys
|
|
5268
5390
|
}),
|
|
5269
5391
|
[]
|
|
5270
5392
|
);
|
|
5271
|
-
(0,
|
|
5272
|
-
(0,
|
|
5393
|
+
(0, import_react42.useEffect)(() => options.history?.onCommit(feed.noteCommit), [feed, options.history]);
|
|
5394
|
+
(0, import_react42.useEffect)(() => {
|
|
5273
5395
|
const change = feed.check();
|
|
5274
5396
|
if (!change) return;
|
|
5275
5397
|
setLast(change);
|
|
@@ -5279,7 +5401,7 @@ function useCanvasChangeFeed(options) {
|
|
|
5279
5401
|
}
|
|
5280
5402
|
|
|
5281
5403
|
// src/canvas/index.ts
|
|
5282
|
-
var
|
|
5404
|
+
var import_canvas42 = require("@pixerate/editor/canvas");
|
|
5283
5405
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5284
5406
|
0 && (module.exports = {
|
|
5285
5407
|
ANIMATABLE_PROPERTIES,
|
|
@@ -5289,10 +5411,13 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5289
5411
|
ANIMATION_TIME_EPSILON,
|
|
5290
5412
|
AUTO_LAYOUT_DATA_KEY,
|
|
5291
5413
|
AgentPresenceLayer,
|
|
5414
|
+
AnimatedEdge,
|
|
5292
5415
|
AnimationEditError,
|
|
5293
5416
|
AnimationPlayer,
|
|
5294
5417
|
AnimationTimeline,
|
|
5295
5418
|
CANVAS_COMPONENT_DRAG_TYPE,
|
|
5419
|
+
CANVAS_EDGE_ANIMATION_KINDS,
|
|
5420
|
+
CANVAS_EDGE_ANIMATION_SCHEMA,
|
|
5296
5421
|
CANVAS_GRADIENT_PRESETS,
|
|
5297
5422
|
CANVAS_PROPOSAL_CLASS,
|
|
5298
5423
|
CANVAS_TOKEN_PROPERTIES,
|
|
@@ -5310,6 +5435,7 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5310
5435
|
CanvasScenesStore,
|
|
5311
5436
|
DEFAULT_ARRANGE_SHORTCUTS,
|
|
5312
5437
|
DiagramPresenceLayer,
|
|
5438
|
+
EdgeAnimation,
|
|
5313
5439
|
MAX_KEYFRAME_REFS,
|
|
5314
5440
|
ManualClock,
|
|
5315
5441
|
MermaidDiagramGroup,
|
|
@@ -5380,6 +5506,7 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5380
5506
|
createCanvasComponent,
|
|
5381
5507
|
createCanvasComponentsController,
|
|
5382
5508
|
createCanvasDrawController,
|
|
5509
|
+
createCanvasEdgeAnimationToolProvider,
|
|
5383
5510
|
createCanvasExplosionStateController,
|
|
5384
5511
|
createCanvasExplosionToolProvider,
|
|
5385
5512
|
createCanvasInstance,
|
|
@@ -5439,6 +5566,9 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5439
5566
|
getBindableTokenProperties,
|
|
5440
5567
|
getBrushedShapeSvg,
|
|
5441
5568
|
getCanvasComponentDragId,
|
|
5569
|
+
getCanvasEdgeAnimation,
|
|
5570
|
+
getCanvasEdgeAnimationRender,
|
|
5571
|
+
getCanvasEdgePath,
|
|
5442
5572
|
getCanvasTokenProperty,
|
|
5443
5573
|
getCenteredNodePosition,
|
|
5444
5574
|
getChildLayout,
|
|
@@ -5513,6 +5643,7 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5513
5643
|
measureBetween,
|
|
5514
5644
|
measureLabel,
|
|
5515
5645
|
measureSelection,
|
|
5646
|
+
measureSvgPath,
|
|
5516
5647
|
measureToLine,
|
|
5517
5648
|
mergeNodeUpdates,
|
|
5518
5649
|
mermaidNodeStyle,
|
|
@@ -5524,6 +5655,7 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5524
5655
|
nearestHandlePositions,
|
|
5525
5656
|
nodeSizeOf,
|
|
5526
5657
|
normalizeBezierPath,
|
|
5658
|
+
normalizeCanvasEdgeAnimation,
|
|
5527
5659
|
normalizeKeyframes,
|
|
5528
5660
|
offsetPath,
|
|
5529
5661
|
offsetShapeNodes,
|
|
@@ -5572,6 +5704,7 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5572
5704
|
repositionNodesTo,
|
|
5573
5705
|
resetCanvasInstanceOverrides,
|
|
5574
5706
|
resizeHandleAxes,
|
|
5707
|
+
resolveCanvasEdgeAnimation,
|
|
5575
5708
|
resolveCanvasGradient,
|
|
5576
5709
|
resolveCanvasTokens,
|
|
5577
5710
|
resolveEasing,
|
|
@@ -5582,9 +5715,11 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5582
5715
|
ringSignedArea,
|
|
5583
5716
|
runMultiNodeTransition,
|
|
5584
5717
|
sampleAnimationFrames,
|
|
5718
|
+
sampleCanvasEdgeAnimation,
|
|
5585
5719
|
scaleKeyframes,
|
|
5586
5720
|
serializeCanvasNodes,
|
|
5587
5721
|
setCanvasComponentProperty,
|
|
5722
|
+
setCanvasEdgeAnimation,
|
|
5588
5723
|
setCanvasInstanceProperties,
|
|
5589
5724
|
setCanvasTokenMode,
|
|
5590
5725
|
setCanvasVariantProperties,
|
|
@@ -5653,6 +5788,7 @@ var import_canvas40 = require("@pixerate/editor/canvas");
|
|
|
5653
5788
|
useDiagramState,
|
|
5654
5789
|
useMermaidDiagram,
|
|
5655
5790
|
useMermaidStream,
|
|
5791
|
+
usePrefersReducedMotion,
|
|
5656
5792
|
usePresenceState,
|
|
5657
5793
|
useShapeBrushstroke,
|
|
5658
5794
|
useStreamingCanvas,
|