@pixerate/editor-react 0.15.0 → 0.16.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/README.md +4 -0
- package/dist/canvas/index.cjs +219 -118
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +59 -3
- package/dist/canvas/index.d.ts +59 -3
- package/dist/canvas/index.js +103 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-7SPRQZ6H.js +216 -0
- package/dist/chunk-7SPRQZ6H.js.map +1 -0
- package/dist/{chunk-QVQYYHJ5.js → chunk-FYIPXHAE.js} +21 -13
- package/dist/chunk-FYIPXHAE.js.map +1 -0
- package/dist/{chunk-LPFZMZ3L.js → chunk-XTFR3IMK.js} +676 -322
- package/dist/chunk-XTFR3IMK.js.map +1 -0
- package/dist/chunk-XWFU2CSG.js +167 -0
- package/dist/chunk-XWFU2CSG.js.map +1 -0
- package/dist/generation/index.cjs +235 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +60 -0
- package/dist/generation/index.d.ts +60 -0
- package/dist/generation/index.js +13 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/image-editor/index.cjs +684 -336
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +60 -2
- package/dist/image-editor/index.d.ts +60 -2
- package/dist/image-editor/index.js +13 -3
- package/dist/index.cjs +1881 -648
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +143 -4
- package/dist/index.d.ts +143 -4
- package/dist/index.js +626 -73
- package/dist/index.js.map +1 -1
- package/dist/persistence/index.cjs +191 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +77 -0
- package/dist/persistence/index.d.ts +77 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/spreadsheet/index.cjs +17 -10
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +2 -0
- package/dist/spreadsheet/index.d.ts +2 -0
- package/dist/spreadsheet/index.js +1 -1
- package/package.json +18 -2
- package/dist/chunk-LPFZMZ3L.js.map +0 -1
- package/dist/chunk-QVQYYHJ5.js.map +0 -1
package/README.md
CHANGED
|
@@ -75,6 +75,8 @@ const editor = useEditor({ extensions: [Comments.configure({ author: me }), Trac
|
|
|
75
75
|
|
|
76
76
|
`ReviewToolbar` steps through insertions, deletions, formatting and block changes and shows the current one's author and description (e.g. "Ada: Changed Paragraph to Heading 2"); hide it with `showDescription={false}` or restyle it with `descriptionClassName`. `useComments(editorOrStore)` and `useTrackChanges(editor)` expose the same state for custom UIs (each change has `type` and `description`).
|
|
77
77
|
|
|
78
|
+
`FindReplaceBar` is a Word-style find bar for editors with the `FindReplace` extension (`useEditor({ richTextOptions: { findReplace: true } })`): it appears on Mod+F / Mod+H (or `editor.commands.openFindReplace()`), with find and replace fields, option toggles (match case, whole words, wildcards, regex, plus prefix/suffix/ignore punctuation/white space under "More options"), a "3 of 12" counter, previous/next, Replace and Replace all. Enter / Shift+Enter step, Enter in the replace field replaces, Mod+Enter replaces all, Escape closes. Pass `alwaysOpen` to keep it visible. `useFindReplace(editor)` exposes the state and commands for custom UIs.
|
|
79
|
+
|
|
78
80
|
`useEditor({ fileImport: true, richClipboard: true })` imports dropped/pasted `.md`, `.html`, `.txt`, `.rtf` and `.docx` files (plus any adapter you register, e.g. PDF or zipped exports) at the drop position and copies lossless slices between editors. `useFileImport(editor)` returns `{ openFilePicker, importFiles, accept, isImporting, error }` for an import button. `usePromptEditor({ fileImport: true })` imports dropped files as plain text.
|
|
79
81
|
|
|
80
82
|
`useAgentToolProvider(registry, provider)` registers an agent tool provider (see `ToolRegistry` in `@pixerate/editor/agent`) while the component is mounted. Memoize the provider:
|
|
@@ -92,6 +94,8 @@ useAgentToolProvider(registry, provider);
|
|
|
92
94
|
| `@pixerate/editor-react/spreadsheet` | `SpreadsheetEditor`, `useSpreadsheetEditor`, `useSpreadsheetTableInteractions`, `FormulaHints`, `SpreadsheetContextMenu`, `SpreadsheetGroupRow` (also re-exported from the root entry) |
|
|
93
95
|
| `@pixerate/editor-react/image-editor` | `ImageEditor`, `useImageEditor`: crop, rotate/flip, adjustments, annotations, depth masks, and `onInpaint` / `onRemoveBackground` AI hooks |
|
|
94
96
|
| `@pixerate/editor-react/commands` | `CommandPalette`, `useCommandPalette` (`hotkey: "Mod+K"`), `useCommandShortcuts`, `useRegisterCommands` over a `CommandRegistry` from `@pixerate/editor/commands` (also re-exported from the root entry) |
|
|
97
|
+
| `@pixerate/editor-react/persistence` | `useAutosave` (crash-recovery snapshots bound to a history / dirty flag, flushed on `pagehide`, with a recovery check on mount) and `<RecoveryPrompt>` (also re-exported from the root entry) |
|
|
98
|
+
| `@pixerate/editor-react/generation` | `GenerationSettings` (controls generated from a model's capabilities, reference slots by role, plan adjustments), `useGenerationPlan`, `JobProgress`, `useJobProgress` over `@pixerate/editor/generation` (also re-exported from the root entry) |
|
|
95
99
|
| `@pixerate/editor-react/canvas` | `useCanvasGraph`, `useCanvasLayout`, `useCanvasClipboard`, `useCanvasDocking`, `useCanvasShortcuts`, `useCanvasExplosion`, `useStreamingCanvas`, `AgentPresenceLayer`, plus the pure layout helpers from `@pixerate/editor/canvas` |
|
|
96
100
|
|
|
97
101
|
## Styling (Tailwind CSS required)
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -20,125 +20,148 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/canvas/index.ts
|
|
21
21
|
var canvas_exports = {};
|
|
22
22
|
__export(canvas_exports, {
|
|
23
|
+
AUTO_LAYOUT_DATA_KEY: () => import_canvas15.AUTO_LAYOUT_DATA_KEY,
|
|
23
24
|
AgentPresenceLayer: () => AgentPresenceLayer,
|
|
24
|
-
|
|
25
|
+
CHILD_LAYOUT_DATA_KEY: () => import_canvas15.CHILD_LAYOUT_DATA_KEY,
|
|
26
|
+
CONNECTION_LINE_TYPES: () => import_canvas12.CONNECTION_LINE_TYPES,
|
|
25
27
|
CanvasGuidesLayer: () => CanvasGuidesLayer,
|
|
26
|
-
CanvasScenesStore: () =>
|
|
27
|
-
DEFAULT_ARRANGE_SHORTCUTS: () =>
|
|
28
|
-
ManualClock: () =>
|
|
29
|
-
RESIZE_HANDLES: () =>
|
|
30
|
-
SHAPE_DATA_KEY: () =>
|
|
31
|
-
SHAPE_KINDS: () =>
|
|
32
|
-
SHAPE_NODE_TYPE: () =>
|
|
33
|
-
SHAPE_OPERATIONS: () =>
|
|
28
|
+
CanvasScenesStore: () => import_canvas12.CanvasScenesStore,
|
|
29
|
+
DEFAULT_ARRANGE_SHORTCUTS: () => import_canvas12.DEFAULT_ARRANGE_SHORTCUTS,
|
|
30
|
+
ManualClock: () => import_canvas14.ManualClock,
|
|
31
|
+
RESIZE_HANDLES: () => import_canvas11.RESIZE_HANDLES,
|
|
32
|
+
SHAPE_DATA_KEY: () => import_canvas13.SHAPE_DATA_KEY,
|
|
33
|
+
SHAPE_KINDS: () => import_canvas13.SHAPE_KINDS,
|
|
34
|
+
SHAPE_NODE_TYPE: () => import_canvas13.SHAPE_NODE_TYPE,
|
|
35
|
+
SHAPE_OPERATIONS: () => import_canvas13.SHAPE_OPERATIONS,
|
|
34
36
|
ShapeNode: () => ShapeNode,
|
|
35
|
-
alignNodes: () =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
37
|
+
alignNodes: () => import_canvas12.alignNodes,
|
|
38
|
+
applyConstraints: () => import_canvas15.applyConstraints,
|
|
39
|
+
applyNodeUpdates: () => import_canvas12.applyNodeUpdates,
|
|
40
|
+
applyShapeCombination: () => import_canvas13.applyShapeCombination,
|
|
41
|
+
blendLayout: () => import_canvas14.blendLayout,
|
|
42
|
+
boundsOf: () => import_canvas14.boundsOf,
|
|
43
|
+
calculateDagreReflowDisplacement: () => import_canvas14.calculateDagreReflowDisplacement,
|
|
44
|
+
calculateDirectionalDisplacement: () => import_canvas14.calculateDirectionalDisplacement,
|
|
45
|
+
canCombineShapeNodes: () => import_canvas13.canCombineShapeNodes,
|
|
46
|
+
canvasHeight: () => import_canvas14.canvasHeight,
|
|
47
|
+
centerNodes: () => import_canvas14.centerNodes,
|
|
48
|
+
centre: () => import_canvas14.centre,
|
|
49
|
+
clampLayoutSize: () => import_canvas15.clampLayoutSize,
|
|
50
|
+
combineShapeNodes: () => import_canvas13.combineShapeNodes,
|
|
51
|
+
computeNodesBoundingBox: () => import_canvas14.computeNodesBoundingBox,
|
|
52
|
+
computeSnapGuides: () => import_canvas12.computeSnapGuides,
|
|
53
|
+
connectedOnly: () => import_canvas14.connectedOnly,
|
|
54
|
+
createBezierTrajectory: () => import_canvas14.createBezierTrajectory,
|
|
55
|
+
createCanvasAutoLayoutController: () => import_canvas15.createCanvasAutoLayoutController,
|
|
56
|
+
createCanvasScenesStore: () => import_canvas12.createCanvasScenesStore,
|
|
57
|
+
createFanOutTrajectory: () => import_canvas14.createFanOutTrajectory,
|
|
58
|
+
createGuideIndex: () => import_canvas12.createGuideIndex,
|
|
59
|
+
createNodeGuideIndex: () => import_canvas12.createNodeGuideIndex,
|
|
60
|
+
cubicPointAt: () => import_canvas11.cubicPointAt,
|
|
61
|
+
cubicsToPathData: () => import_canvas11.cubicsToPathData,
|
|
62
|
+
defaultEasing: () => import_canvas14.defaultEasing,
|
|
63
|
+
distributeNodes: () => import_canvas12.distributeNodes,
|
|
64
|
+
dividePolygons: () => import_canvas13.dividePolygons,
|
|
65
|
+
ensureLayout: () => import_canvas14.ensureLayout,
|
|
66
|
+
estimateCanvasHeight: () => import_canvas14.estimateCanvasHeight,
|
|
67
|
+
estimateNodeSize: () => import_canvas14.estimateNodeSize,
|
|
68
|
+
findConnectorSnap: () => import_canvas12.findConnectorSnap,
|
|
69
|
+
fitCubicRun: () => import_canvas11.fitCubicRun,
|
|
70
|
+
fitCubics: () => import_canvas11.fitCubics,
|
|
71
|
+
fitFreehandPath: () => import_canvas11.fitFreehandPath,
|
|
72
|
+
fitPathData: () => import_canvas11.fitPathData,
|
|
73
|
+
fitViewportToNodes: () => import_canvas12.fitViewportToNodes,
|
|
74
|
+
fitViewportToRect: () => import_canvas12.fitViewportToRect,
|
|
75
|
+
flattenSvgPath: () => import_canvas13.flattenSvgPath,
|
|
76
|
+
flowSide: () => import_canvas14.flowSide,
|
|
77
|
+
getAbsolutePosition: () => import_canvas12.getAbsolutePosition,
|
|
78
|
+
getAutoLayout: () => import_canvas15.getAutoLayout,
|
|
79
|
+
getAutoLayoutGrid: () => import_canvas15.getAutoLayoutGrid,
|
|
80
|
+
getAutoLayoutInsertTarget: () => import_canvas15.getAutoLayoutInsertTarget,
|
|
81
|
+
getCenteredNodePosition: () => import_canvas14.getCenteredNodePosition,
|
|
82
|
+
getChildLayout: () => import_canvas15.getChildLayout,
|
|
83
|
+
getFlowChildren: () => import_canvas15.getFlowChildren,
|
|
84
|
+
getLayoutParent: () => import_canvas15.getLayoutParent,
|
|
85
|
+
getLayoutSizing: () => import_canvas15.getLayoutSizing,
|
|
86
|
+
getLayoutedNodes: () => import_canvas14.getLayoutedNodes,
|
|
87
|
+
getNodeRect: () => import_canvas12.getNodeRect,
|
|
88
|
+
getNodeShape: () => import_canvas13.getNodeShape,
|
|
89
|
+
getNodeSize: () => import_canvas12.getNodeSize,
|
|
90
|
+
getResizingNodeRect: () => import_canvas11.getResizingNodeRect,
|
|
91
|
+
getShapeRenderData: () => import_canvas13.getShapeRenderData,
|
|
92
|
+
getShapeSvg: () => import_canvas13.getShapeSvg,
|
|
93
|
+
handlePoint: () => import_canvas12.handlePoint,
|
|
94
|
+
inferResizeHandle: () => import_canvas11.inferResizeHandle,
|
|
95
|
+
intersectPolygons: () => import_canvas13.intersectPolygons,
|
|
96
|
+
invertNodeUpdates: () => import_canvas12.invertNodeUpdates,
|
|
97
|
+
isAutoLayoutFrame: () => import_canvas15.isAutoLayoutFrame,
|
|
98
|
+
isEventFromTextInput: () => import_canvas14.isEventFromTextInput,
|
|
99
|
+
isLocked: () => import_canvas12.isLocked,
|
|
100
|
+
isMeasureModifierHeld: () => import_canvas11.isMeasureModifierHeld,
|
|
101
|
+
isShapeDescription: () => import_canvas13.isShapeDescription,
|
|
102
|
+
isShapeNode: () => import_canvas13.isShapeNode,
|
|
103
|
+
isStraightCubic: () => import_canvas11.isStraightCubic,
|
|
104
|
+
isValidCanvasNode: () => import_canvas14.isValidCanvasNode,
|
|
105
|
+
isValidUrl: () => import_canvas14.isValidUrl,
|
|
106
|
+
layoutAll: () => import_canvas15.layoutAll,
|
|
107
|
+
layoutBounds: () => import_canvas14.layoutBounds,
|
|
108
|
+
layoutFrame: () => import_canvas15.layoutFrame,
|
|
109
|
+
layoutUp: () => import_canvas15.layoutUp,
|
|
110
|
+
layoutUpMany: () => import_canvas15.layoutUpMany,
|
|
111
|
+
linearPositionTrajectory: () => import_canvas14.linearPositionTrajectory,
|
|
112
|
+
linearTrajectory: () => import_canvas14.linearTrajectory,
|
|
113
|
+
lockNodes: () => import_canvas12.lockNodes,
|
|
114
|
+
makeSizingCoherent: () => import_canvas15.makeSizingCoherent,
|
|
115
|
+
matchArrangeShortcut: () => import_canvas12.matchArrangeShortcut,
|
|
116
|
+
matchSize: () => import_canvas12.matchSize,
|
|
117
|
+
measureBetween: () => import_canvas11.measureBetween,
|
|
118
|
+
measureLabel: () => import_canvas11.measureLabel,
|
|
119
|
+
measureSelection: () => import_canvas11.measureSelection,
|
|
120
|
+
measureToLine: () => import_canvas11.measureToLine,
|
|
121
|
+
mergeNodeUpdates: () => import_canvas15.mergeNodeUpdates,
|
|
122
|
+
moveLayoutChild: () => import_canvas15.moveLayoutChild,
|
|
123
|
+
multiPolygonArea: () => import_canvas13.multiPolygonArea,
|
|
124
|
+
multiPolygonBounds: () => import_canvas13.multiPolygonBounds,
|
|
125
|
+
nearestHandlePositions: () => import_canvas12.nearestHandlePositions,
|
|
126
|
+
oppositePosition: () => import_canvas12.oppositePosition,
|
|
127
|
+
overlaps: () => import_canvas14.overlaps,
|
|
128
|
+
parseCanvasClipboardData: () => import_canvas14.parseCanvasClipboardData,
|
|
129
|
+
parseCanvasScenes: () => import_canvas12.parseCanvasScenes,
|
|
130
|
+
parseSvgPath: () => import_canvas13.parseSvgPath,
|
|
131
|
+
placeBeside: () => import_canvas14.placeBeside,
|
|
132
|
+
pointInMultiPolygon: () => import_canvas13.pointInMultiPolygon,
|
|
133
|
+
pointInRings: () => import_canvas13.pointInRings,
|
|
134
|
+
polygonArea: () => import_canvas13.polygonArea,
|
|
135
|
+
polygonBoolean: () => import_canvas13.polygonBoolean,
|
|
136
|
+
polygonToSvgPath: () => import_canvas13.polygonToSvgPath,
|
|
137
|
+
positionToSide: () => import_canvas12.positionToSide,
|
|
138
|
+
readStyleSize: () => import_canvas12.readStyleSize,
|
|
139
|
+
realClock: () => import_canvas14.realClock,
|
|
140
|
+
relayoutUpdates: () => import_canvas15.relayoutUpdates,
|
|
141
|
+
remapPastedNodes: () => import_canvas14.remapPastedNodes,
|
|
142
|
+
reorderNodes: () => import_canvas12.reorderNodes,
|
|
143
|
+
repositionNodesTo: () => import_canvas14.repositionNodesTo,
|
|
144
|
+
resizeHandleAxes: () => import_canvas11.resizeHandleAxes,
|
|
145
|
+
resolvePadding: () => import_canvas15.resolvePadding,
|
|
146
|
+
revertShapeCombination: () => import_canvas13.revertShapeCombination,
|
|
147
|
+
ringSignedArea: () => import_canvas13.ringSignedArea,
|
|
148
|
+
runMultiNodeTransition: () => import_canvas14.runMultiNodeTransition,
|
|
149
|
+
serializeCanvasNodes: () => import_canvas14.serializeCanvasNodes,
|
|
150
|
+
shapeNodeToPolygon: () => import_canvas13.shapeNodeToPolygon,
|
|
151
|
+
shapeToPolygon: () => import_canvas13.shapeToPolygon,
|
|
152
|
+
sideToPosition: () => import_canvas12.sideToPosition,
|
|
153
|
+
simplifyRing: () => import_canvas13.simplifyRing,
|
|
154
|
+
snapNodeDrag: () => import_canvas12.snapNodeDrag,
|
|
155
|
+
snapNodeResize: () => import_canvas11.snapNodeResize,
|
|
156
|
+
snapResize: () => import_canvas11.snapResize,
|
|
157
|
+
snapToGrid: () => import_canvas11.snapToGrid,
|
|
158
|
+
subtractPolygons: () => import_canvas13.subtractPolygons,
|
|
159
|
+
toggleLockNodes: () => import_canvas12.toggleLockNodes,
|
|
160
|
+
unionPolygons: () => import_canvas13.unionPolygons,
|
|
161
|
+
unlockNodes: () => import_canvas12.unlockNodes,
|
|
140
162
|
useCanvasArrange: () => useCanvasArrange,
|
|
141
163
|
useCanvasArrangeShortcuts: () => useCanvasArrangeShortcuts,
|
|
164
|
+
useCanvasAutoLayout: () => useCanvasAutoLayout,
|
|
142
165
|
useCanvasClipboard: () => useCanvasClipboard,
|
|
143
166
|
useCanvasDocking: () => useCanvasDocking,
|
|
144
167
|
useCanvasExplosion: () => useCanvasExplosion,
|
|
@@ -148,8 +171,8 @@ __export(canvas_exports, {
|
|
|
148
171
|
useCanvasScenes: () => useCanvasScenes,
|
|
149
172
|
useCanvasShortcuts: () => useCanvasShortcuts,
|
|
150
173
|
useStreamingCanvas: () => useStreamingCanvas,
|
|
151
|
-
withStyleSize: () =>
|
|
152
|
-
xorPolygons: () =>
|
|
174
|
+
withStyleSize: () => import_canvas12.withStyleSize,
|
|
175
|
+
xorPolygons: () => import_canvas13.xorPolygons
|
|
153
176
|
});
|
|
154
177
|
module.exports = __toCommonJS(canvas_exports);
|
|
155
178
|
|
|
@@ -924,6 +947,9 @@ function useCanvasArrange(options) {
|
|
|
924
947
|
get rectOptions() {
|
|
925
948
|
return optionsRef.current.rectOptions;
|
|
926
949
|
},
|
|
950
|
+
get autoLayout() {
|
|
951
|
+
return optionsRef.current.autoLayout;
|
|
952
|
+
},
|
|
927
953
|
onGuidesChange: setGuides
|
|
928
954
|
}),
|
|
929
955
|
[]
|
|
@@ -1159,8 +1185,8 @@ function useCanvasMeasure(options) {
|
|
|
1159
1185
|
}
|
|
1160
1186
|
|
|
1161
1187
|
// src/canvas/index.ts
|
|
1162
|
-
var import_canvas10 = require("@pixerate/editor/canvas");
|
|
1163
1188
|
var import_canvas11 = require("@pixerate/editor/canvas");
|
|
1189
|
+
var import_canvas12 = require("@pixerate/editor/canvas");
|
|
1164
1190
|
|
|
1165
1191
|
// src/canvas/ShapeNode.tsx
|
|
1166
1192
|
var import_canvas9 = require("@pixerate/editor/canvas");
|
|
@@ -1208,11 +1234,65 @@ function ShapeNode({ data, width, height, selected, className = "", children })
|
|
|
1208
1234
|
}
|
|
1209
1235
|
|
|
1210
1236
|
// src/canvas/index.ts
|
|
1211
|
-
var import_canvas12 = require("@pixerate/editor/canvas");
|
|
1212
1237
|
var import_canvas13 = require("@pixerate/editor/canvas");
|
|
1238
|
+
var import_canvas14 = require("@pixerate/editor/canvas");
|
|
1239
|
+
var import_canvas15 = require("@pixerate/editor/canvas");
|
|
1240
|
+
|
|
1241
|
+
// src/canvas/useCanvasAutoLayout.ts
|
|
1242
|
+
var import_react11 = require("react");
|
|
1243
|
+
var import_canvas10 = require("@pixerate/editor/canvas");
|
|
1244
|
+
function useCanvasAutoLayout(options) {
|
|
1245
|
+
const [guides, setGuides] = (0, import_react11.useState)([]);
|
|
1246
|
+
const nodesRef = (0, import_react11.useRef)(options.nodes);
|
|
1247
|
+
nodesRef.current = options.nodes;
|
|
1248
|
+
const optionsRef = (0, import_react11.useRef)(options);
|
|
1249
|
+
optionsRef.current = options;
|
|
1250
|
+
const controller = (0, import_react11.useMemo)(
|
|
1251
|
+
() => (0, import_canvas10.createCanvasAutoLayoutController)({
|
|
1252
|
+
getNodes: () => nodesRef.current,
|
|
1253
|
+
setNodes: (next) => {
|
|
1254
|
+
nodesRef.current = next;
|
|
1255
|
+
optionsRef.current.setNodes(next);
|
|
1256
|
+
},
|
|
1257
|
+
get history() {
|
|
1258
|
+
return optionsRef.current.history;
|
|
1259
|
+
},
|
|
1260
|
+
get enabled() {
|
|
1261
|
+
return optionsRef.current.enabled;
|
|
1262
|
+
},
|
|
1263
|
+
get dragReorder() {
|
|
1264
|
+
return optionsRef.current.dragReorder;
|
|
1265
|
+
},
|
|
1266
|
+
get measure() {
|
|
1267
|
+
return optionsRef.current.measure;
|
|
1268
|
+
},
|
|
1269
|
+
get rectOptions() {
|
|
1270
|
+
return optionsRef.current.rectOptions;
|
|
1271
|
+
},
|
|
1272
|
+
onGuidesChange: setGuides
|
|
1273
|
+
}),
|
|
1274
|
+
[]
|
|
1275
|
+
);
|
|
1276
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
1277
|
+
if (controller.hasPending) controller.flush();
|
|
1278
|
+
}, [options.nodes, controller]);
|
|
1279
|
+
return (0, import_react11.useMemo)(
|
|
1280
|
+
() => ({
|
|
1281
|
+
...controller,
|
|
1282
|
+
/** Drop marker of the active reorder drag (flow coordinates). */
|
|
1283
|
+
guides,
|
|
1284
|
+
get hasPending() {
|
|
1285
|
+
return controller.hasPending;
|
|
1286
|
+
}
|
|
1287
|
+
}),
|
|
1288
|
+
[controller, guides]
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1213
1291
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1214
1292
|
0 && (module.exports = {
|
|
1293
|
+
AUTO_LAYOUT_DATA_KEY,
|
|
1215
1294
|
AgentPresenceLayer,
|
|
1295
|
+
CHILD_LAYOUT_DATA_KEY,
|
|
1216
1296
|
CONNECTION_LINE_TYPES,
|
|
1217
1297
|
CanvasGuidesLayer,
|
|
1218
1298
|
CanvasScenesStore,
|
|
@@ -1225,6 +1305,7 @@ var import_canvas13 = require("@pixerate/editor/canvas");
|
|
|
1225
1305
|
SHAPE_OPERATIONS,
|
|
1226
1306
|
ShapeNode,
|
|
1227
1307
|
alignNodes,
|
|
1308
|
+
applyConstraints,
|
|
1228
1309
|
applyNodeUpdates,
|
|
1229
1310
|
applyShapeCombination,
|
|
1230
1311
|
blendLayout,
|
|
@@ -1235,11 +1316,13 @@ var import_canvas13 = require("@pixerate/editor/canvas");
|
|
|
1235
1316
|
canvasHeight,
|
|
1236
1317
|
centerNodes,
|
|
1237
1318
|
centre,
|
|
1319
|
+
clampLayoutSize,
|
|
1238
1320
|
combineShapeNodes,
|
|
1239
1321
|
computeNodesBoundingBox,
|
|
1240
1322
|
computeSnapGuides,
|
|
1241
1323
|
connectedOnly,
|
|
1242
1324
|
createBezierTrajectory,
|
|
1325
|
+
createCanvasAutoLayoutController,
|
|
1243
1326
|
createCanvasScenesStore,
|
|
1244
1327
|
createFanOutTrajectory,
|
|
1245
1328
|
createGuideIndex,
|
|
@@ -1262,7 +1345,14 @@ var import_canvas13 = require("@pixerate/editor/canvas");
|
|
|
1262
1345
|
flattenSvgPath,
|
|
1263
1346
|
flowSide,
|
|
1264
1347
|
getAbsolutePosition,
|
|
1348
|
+
getAutoLayout,
|
|
1349
|
+
getAutoLayoutGrid,
|
|
1350
|
+
getAutoLayoutInsertTarget,
|
|
1265
1351
|
getCenteredNodePosition,
|
|
1352
|
+
getChildLayout,
|
|
1353
|
+
getFlowChildren,
|
|
1354
|
+
getLayoutParent,
|
|
1355
|
+
getLayoutSizing,
|
|
1266
1356
|
getLayoutedNodes,
|
|
1267
1357
|
getNodeRect,
|
|
1268
1358
|
getNodeShape,
|
|
@@ -1274,6 +1364,7 @@ var import_canvas13 = require("@pixerate/editor/canvas");
|
|
|
1274
1364
|
inferResizeHandle,
|
|
1275
1365
|
intersectPolygons,
|
|
1276
1366
|
invertNodeUpdates,
|
|
1367
|
+
isAutoLayoutFrame,
|
|
1277
1368
|
isEventFromTextInput,
|
|
1278
1369
|
isLocked,
|
|
1279
1370
|
isMeasureModifierHeld,
|
|
@@ -1282,16 +1373,23 @@ var import_canvas13 = require("@pixerate/editor/canvas");
|
|
|
1282
1373
|
isStraightCubic,
|
|
1283
1374
|
isValidCanvasNode,
|
|
1284
1375
|
isValidUrl,
|
|
1376
|
+
layoutAll,
|
|
1285
1377
|
layoutBounds,
|
|
1378
|
+
layoutFrame,
|
|
1379
|
+
layoutUp,
|
|
1380
|
+
layoutUpMany,
|
|
1286
1381
|
linearPositionTrajectory,
|
|
1287
1382
|
linearTrajectory,
|
|
1288
1383
|
lockNodes,
|
|
1384
|
+
makeSizingCoherent,
|
|
1289
1385
|
matchArrangeShortcut,
|
|
1290
1386
|
matchSize,
|
|
1291
1387
|
measureBetween,
|
|
1292
1388
|
measureLabel,
|
|
1293
1389
|
measureSelection,
|
|
1294
1390
|
measureToLine,
|
|
1391
|
+
mergeNodeUpdates,
|
|
1392
|
+
moveLayoutChild,
|
|
1295
1393
|
multiPolygonArea,
|
|
1296
1394
|
multiPolygonBounds,
|
|
1297
1395
|
nearestHandlePositions,
|
|
@@ -1309,10 +1407,12 @@ var import_canvas13 = require("@pixerate/editor/canvas");
|
|
|
1309
1407
|
positionToSide,
|
|
1310
1408
|
readStyleSize,
|
|
1311
1409
|
realClock,
|
|
1410
|
+
relayoutUpdates,
|
|
1312
1411
|
remapPastedNodes,
|
|
1313
1412
|
reorderNodes,
|
|
1314
1413
|
repositionNodesTo,
|
|
1315
1414
|
resizeHandleAxes,
|
|
1415
|
+
resolvePadding,
|
|
1316
1416
|
revertShapeCombination,
|
|
1317
1417
|
ringSignedArea,
|
|
1318
1418
|
runMultiNodeTransition,
|
|
@@ -1331,6 +1431,7 @@ var import_canvas13 = require("@pixerate/editor/canvas");
|
|
|
1331
1431
|
unlockNodes,
|
|
1332
1432
|
useCanvasArrange,
|
|
1333
1433
|
useCanvasArrangeShortcuts,
|
|
1434
|
+
useCanvasAutoLayout,
|
|
1334
1435
|
useCanvasClipboard,
|
|
1335
1436
|
useCanvasDocking,
|
|
1336
1437
|
useCanvasExplosion,
|