@pixerate/editor 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +30 -0
  2. package/THIRD_PARTY_NOTICES.md +11 -0
  3. package/dist/agent/index.cjs +174 -11
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +18 -4
  6. package/dist/agent/index.d.ts +18 -4
  7. package/dist/agent/index.js +167 -4
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
  10. package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
  11. package/dist/builtins-CdPcLwwF.d.cts +176 -0
  12. package/dist/builtins-Chj6zv_O.d.ts +176 -0
  13. package/dist/canvas/index.cjs +3917 -19
  14. package/dist/canvas/index.cjs.map +1 -1
  15. package/dist/canvas/index.d.cts +1232 -7
  16. package/dist/canvas/index.d.ts +1232 -7
  17. package/dist/canvas/index.js +3916 -18
  18. package/dist/canvas/index.js.map +1 -1
  19. package/dist/chunk-3CC7OPUQ.cjs +831 -0
  20. package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
  21. package/dist/{chunk-7WISYZFO.cjs → chunk-66IMF6OD.cjs} +174 -67
  22. package/dist/chunk-66IMF6OD.cjs.map +1 -0
  23. package/dist/{chunk-AL6JMGWW.cjs → chunk-CS6NZWWA.cjs} +24 -24
  24. package/dist/{chunk-AL6JMGWW.cjs.map → chunk-CS6NZWWA.cjs.map} +1 -1
  25. package/dist/{chunk-C7P22VIP.cjs → chunk-EWCOFSCQ.cjs} +17 -6
  26. package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
  27. package/dist/chunk-HDYMLS3X.cjs +409 -0
  28. package/dist/chunk-HDYMLS3X.cjs.map +1 -0
  29. package/dist/{chunk-V3CHHWOE.cjs → chunk-HNDSPZ5T.cjs} +4 -4
  30. package/dist/{chunk-V3CHHWOE.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
  31. package/dist/{chunk-X4N4WUKB.cjs → chunk-IFHKKVXH.cjs} +150 -38
  32. package/dist/chunk-IFHKKVXH.cjs.map +1 -0
  33. package/dist/chunk-KRGXUQ2Y.js +1696 -0
  34. package/dist/chunk-KRGXUQ2Y.js.map +1 -0
  35. package/dist/{chunk-PO6A6QQH.cjs → chunk-LN2POBHT.cjs} +742 -970
  36. package/dist/chunk-LN2POBHT.cjs.map +1 -0
  37. package/dist/chunk-MR2764X2.js +831 -0
  38. package/dist/chunk-MR2764X2.js.map +1 -0
  39. package/dist/{chunk-WSQKHXW7.cjs → chunk-NQF32I6Z.cjs} +1209 -457
  40. package/dist/chunk-NQF32I6Z.cjs.map +1 -0
  41. package/dist/{chunk-NAXVVS5I.js → chunk-QJSOZFCZ.js} +2 -2
  42. package/dist/{chunk-UAKDG62Z.js → chunk-SWE3NPOU.js} +116 -4
  43. package/dist/chunk-SWE3NPOU.js.map +1 -0
  44. package/dist/chunk-TXXNBDQX.cjs +1696 -0
  45. package/dist/chunk-TXXNBDQX.cjs.map +1 -0
  46. package/dist/chunk-UBCFIABU.js +409 -0
  47. package/dist/chunk-UBCFIABU.js.map +1 -0
  48. package/dist/{chunk-ECCCYKGL.js → chunk-UKI64KUD.js} +147 -40
  49. package/dist/chunk-UKI64KUD.js.map +1 -0
  50. package/dist/{chunk-QGYDWPRM.js → chunk-WON34HKM.js} +2 -2
  51. package/dist/{chunk-RR7F5GUM.js → chunk-X7HXL2SB.js} +941 -189
  52. package/dist/chunk-X7HXL2SB.js.map +1 -0
  53. package/dist/{chunk-IXHSYOVY.js → chunk-XQFHLT53.js} +638 -866
  54. package/dist/chunk-XQFHLT53.js.map +1 -0
  55. package/dist/{chunk-FH6F67DN.js → chunk-ZRNHGAQT.js} +17 -6
  56. package/dist/{chunk-FH6F67DN.js.map → chunk-ZRNHGAQT.js.map} +1 -1
  57. package/dist/commands/index.cjs +352 -4
  58. package/dist/commands/index.cjs.map +1 -1
  59. package/dist/commands/index.d.cts +37 -108
  60. package/dist/commands/index.d.ts +37 -108
  61. package/dist/commands/index.js +351 -3
  62. package/dist/commands/index.js.map +1 -1
  63. package/dist/compare/index.cjs +3 -3
  64. package/dist/compare/index.js +2 -2
  65. package/dist/{controller-BIJiNoVs.d.cts → controller-CxXGOEmy.d.cts} +209 -13
  66. package/dist/{controller-BIJiNoVs.d.ts → controller-CxXGOEmy.d.ts} +209 -13
  67. package/dist/export/index.cjs +36 -0
  68. package/dist/export/index.cjs.map +1 -0
  69. package/dist/export/index.d.cts +243 -0
  70. package/dist/export/index.d.ts +243 -0
  71. package/dist/export/index.js +36 -0
  72. package/dist/export/index.js.map +1 -0
  73. package/dist/extensions/index.cjs +54 -6
  74. package/dist/extensions/index.cjs.map +1 -1
  75. package/dist/extensions/index.d.cts +7 -2
  76. package/dist/extensions/index.d.ts +7 -2
  77. package/dist/extensions/index.js +59 -11
  78. package/dist/{index-7a6bHTLy.d.ts → index-B273Zllk.d.ts} +211 -207
  79. package/dist/{index-Csd5qI8u.d.cts → index-jcJwmBYt.d.cts} +211 -207
  80. package/dist/index.cjs +146 -32
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.cts +50 -14
  83. package/dist/index.d.ts +50 -14
  84. package/dist/index.js +138 -24
  85. package/dist/index.js.map +1 -1
  86. package/dist/registry-CED5C0lA.d.cts +204 -0
  87. package/dist/registry-CED5C0lA.d.ts +204 -0
  88. package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
  89. package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
  90. package/dist/serializers/index.cjs +6 -4
  91. package/dist/serializers/index.cjs.map +1 -1
  92. package/dist/serializers/index.d.cts +15 -4
  93. package/dist/serializers/index.d.ts +15 -4
  94. package/dist/serializers/index.js +5 -3
  95. package/dist/spreadsheet/index.cjs +33 -3
  96. package/dist/spreadsheet/index.cjs.map +1 -1
  97. package/dist/spreadsheet/index.d.cts +106 -3
  98. package/dist/spreadsheet/index.d.ts +106 -3
  99. package/dist/spreadsheet/index.js +32 -2
  100. package/package.json +10 -1
  101. package/dist/chunk-7WISYZFO.cjs.map +0 -1
  102. package/dist/chunk-C7P22VIP.cjs.map +0 -1
  103. package/dist/chunk-ECCCYKGL.js.map +0 -1
  104. package/dist/chunk-IXHSYOVY.js.map +0 -1
  105. package/dist/chunk-PO6A6QQH.cjs.map +0 -1
  106. package/dist/chunk-RR7F5GUM.js.map +0 -1
  107. package/dist/chunk-UAKDG62Z.js.map +0 -1
  108. package/dist/chunk-WSQKHXW7.cjs.map +0 -1
  109. package/dist/chunk-X4N4WUKB.cjs.map +0 -1
  110. package/dist/types-DX4Mh4SL.d.cts +0 -217
  111. package/dist/types-DX4Mh4SL.d.ts +0 -217
  112. /package/dist/{chunk-NAXVVS5I.js.map → chunk-QJSOZFCZ.js.map} +0 -0
  113. /package/dist/{chunk-QGYDWPRM.js.map → chunk-WON34HKM.js.map} +0 -0
@@ -1,4 +1,245 @@
1
- import { R as Rect, X as XYPosition, C as CanvasNode, a as CanvasNodeStyle } from './types-DX4Mh4SL.js';
1
+ /**
2
+ * Generic coordinate and boundary primitives.
3
+ */
4
+ interface XYPosition {
5
+ x: number;
6
+ y: number;
7
+ }
8
+ type Point = readonly [number, number];
9
+ interface Rect {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ }
15
+ type Position = 'top' | 'right' | 'bottom' | 'left';
16
+ type Side = 'right' | 'below' | 'left' | 'above';
17
+ /**
18
+ * Node style: a CSS string (SvelteFlow) or a style object (React Flow / xyflow).
19
+ */
20
+ type CanvasNodeStyle = string | Record<string, any>;
21
+ /**
22
+ * Generic canvas node structure compatible across SvelteFlow and ReactFlow.
23
+ */
24
+ interface CanvasNode<TData extends Record<string, any> = Record<string, any>, TType extends string | undefined = string | undefined> {
25
+ id: string;
26
+ position: XYPosition;
27
+ data: TData;
28
+ type?: TType;
29
+ selected?: boolean;
30
+ draggable?: boolean;
31
+ selectable?: boolean;
32
+ deletable?: boolean;
33
+ parentId?: string;
34
+ width?: number;
35
+ height?: number;
36
+ measured?: {
37
+ width?: number;
38
+ height?: number;
39
+ };
40
+ style?: CanvasNodeStyle;
41
+ className?: string;
42
+ class?: string;
43
+ [key: string]: any;
44
+ }
45
+ /**
46
+ * Generic canvas edge structure.
47
+ */
48
+ interface CanvasEdge<TData extends Record<string, any> = Record<string, any>, TType extends string | undefined = string | undefined> {
49
+ id: string;
50
+ source: string;
51
+ target: string;
52
+ sourceHandle?: string | null;
53
+ targetHandle?: string | null;
54
+ data?: TData;
55
+ type?: TType;
56
+ label?: string;
57
+ selected?: boolean;
58
+ animated?: boolean;
59
+ style?: string;
60
+ [key: string]: any;
61
+ }
62
+ /**
63
+ * Differences computed between two graph states.
64
+ */
65
+ interface GraphDifferences<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
66
+ changedNodes: TNode[];
67
+ changedEdges: TEdge[];
68
+ removedNodes: TNode[];
69
+ removedEdges: TEdge[];
70
+ }
71
+ /**
72
+ * Standard serialized clipboard payload for nodes and optional edges.
73
+ */
74
+ interface CanvasClipboardPayload<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
75
+ version?: number;
76
+ nodes: TNode[];
77
+ edges?: TEdge[];
78
+ }
79
+ /**
80
+ * Options for Dagre graph layout.
81
+ */
82
+ interface CanvasLayoutOptions {
83
+ direction?: 'LR' | 'TB' | 'RL' | 'BT';
84
+ ranksep?: number;
85
+ nodesep?: number;
86
+ defaultNodeWidth?: number;
87
+ defaultNodeHeight?: number;
88
+ }
89
+ /**
90
+ * Incremental layout options.
91
+ */
92
+ interface IncrementalLayoutOptions extends CanvasLayoutOptions {
93
+ /**
94
+ * Stored known coordinates for nodes, e.g. from user manual layout or persistence.
95
+ */
96
+ storedPositions?: Record<string, XYPosition>;
97
+ }
98
+ /**
99
+ * Options for directional collision-aware placement.
100
+ */
101
+ interface PlaceBesideOptions {
102
+ gap?: number;
103
+ ignore?: string[];
104
+ stepIncrement?: number;
105
+ maxAttempts?: number;
106
+ }
107
+ /**
108
+ * Parametric point returned by a trajectory evaluation.
109
+ */
110
+ interface TrajectoryPoint {
111
+ position: XYPosition;
112
+ scale?: number;
113
+ opacity?: number;
114
+ }
115
+ /**
116
+ * Trajectory evaluation function determining path, scale, and opacity over time t in [0, 1].
117
+ */
118
+ type TrajectoryFunction = (origin: XYPosition, target: XYPosition, progress: number, index: number, total: number) => TrajectoryPoint;
119
+ /**
120
+ * Options for fan-out trajectory generator.
121
+ */
122
+ interface FanOutTrajectoryOptions {
123
+ curvature?: number;
124
+ spreadAngle?: number;
125
+ startScale?: number;
126
+ endScale?: number;
127
+ startOpacity?: number;
128
+ endOpacity?: number;
129
+ }
130
+ /**
131
+ * Single node animation transition definition.
132
+ */
133
+ interface NodeTransition<TNode extends CanvasNode = CanvasNode> {
134
+ node: TNode;
135
+ from: XYPosition;
136
+ to: XYPosition;
137
+ trajectory?: TrajectoryFunction;
138
+ delay?: number;
139
+ duration?: number;
140
+ easing?: (t: number) => number;
141
+ index?: number;
142
+ total?: number;
143
+ }
144
+ /**
145
+ * Displacement axis / direction.
146
+ */
147
+ type DisplacementDirection = 'right' | 'left' | 'down' | 'up' | 'vertical';
148
+ /**
149
+ * Options for directional displacement calculation.
150
+ */
151
+ interface DirectionalDisplacementOptions {
152
+ direction?: DisplacementDirection;
153
+ gap?: number;
154
+ spreadSiblingLanes?: boolean;
155
+ siblingTolerance?: number;
156
+ minY?: number;
157
+ }
158
+ /**
159
+ * Options for Dagre reflow displacement calculation.
160
+ */
161
+ interface ReflowDisplacementOptions extends CanvasLayoutOptions {
162
+ anchorNodeId: string;
163
+ }
164
+ /**
165
+ * Snapshot of canvas graph state prior to node explosion, enabling exact reversibility.
166
+ */
167
+ interface ExplosionSnapshot<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
168
+ parentId: string;
169
+ childNodeIds: string[];
170
+ childEdgeIds: string[];
171
+ displacedNodes: {
172
+ id: string;
173
+ originalPosition: XYPosition;
174
+ }[];
175
+ timestamp: number;
176
+ }
177
+ /**
178
+ * Options for exploding a node.
179
+ */
180
+ interface ExplodeNodeOptions<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
181
+ childNodes: TNode[];
182
+ childEdges?: TEdge[];
183
+ connectParentToChildren?: boolean | 'first' | 'all';
184
+ connectChildrenToDownstream?: boolean;
185
+ displacementStrategy?: 'directional' | 'dagre' | 'none';
186
+ directionalOptions?: DirectionalDisplacementOptions;
187
+ reflowOptions?: Partial<ReflowDisplacementOptions>;
188
+ trajectory?: TrajectoryFunction;
189
+ duration?: number;
190
+ staggerDelay?: number;
191
+ easing?: (t: number) => number;
192
+ onComplete?: () => void;
193
+ }
194
+ /**
195
+ * Options for collapsing an exploded node.
196
+ */
197
+ interface CollapseNodeOptions {
198
+ duration?: number;
199
+ staggerDelay?: number;
200
+ easing?: (t: number) => number;
201
+ trajectory?: TrajectoryFunction;
202
+ onComplete?: () => void;
203
+ }
204
+ /**
205
+ * Strategy used to resolve the primary dock target when multiple targets intersect a dragged node.
206
+ */
207
+ type DockStrategy = 'center-point' | 'max-overlap' | 'pointer' | 'first';
208
+ /**
209
+ * Docking and intersection callbacks.
210
+ */
211
+ interface CanvasDockingCallbacks<TNode extends CanvasNode = CanvasNode> {
212
+ onDockHover?: (dockTarget: TNode, draggedNode: TNode) => void;
213
+ onDockLeave?: (dockTarget: TNode, draggedNode: TNode) => void;
214
+ onDockDrop?: (dockTarget: TNode, draggedNode: TNode) => void;
215
+ }
216
+
217
+ /**
218
+ * Canvas arrangement actions that have keyboard shortcuts.
219
+ */
220
+ type CanvasArrangeAction = 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignTop' | 'alignMiddle' | 'alignBottom' | 'distributeHorizontal' | 'distributeVertical' | 'lock' | 'unlock' | 'bringForward' | 'sendBackward' | 'bringToFront' | 'sendToBack' | 'nextScene' | 'previousScene';
221
+ interface ArrangeShortcutBinding {
222
+ action: CanvasArrangeAction;
223
+ /** `KeyboardEvent.code` (layout- and Option-independent, e.g. `KeyA`, `BracketRight`). */
224
+ code: string;
225
+ mod?: boolean;
226
+ alt?: boolean;
227
+ shift?: boolean;
228
+ /** Human readable label, e.g. for menus. `Mod` is ⌘ on macOS and Ctrl elsewhere. */
229
+ label: string;
230
+ }
231
+ /**
232
+ * Default bindings. Align/distribute follow Figma (Option/Alt + letter), layer order follows
233
+ * the common `Mod+]` / `Mod+[` convention, lock follows Keynote/Freeform (`Mod+L`,
234
+ * `Mod+Alt+L` to unlock) and scenes step with PageDown / PageUp.
235
+ */
236
+ declare const DEFAULT_ARRANGE_SHORTCUTS: readonly ArrangeShortcutBinding[];
237
+ /**
238
+ * Resolves a keydown event to an arrange action, or `null`. Events from text inputs,
239
+ * textareas, selects, contenteditable and ProseMirror are ignored (see `isEventFromTextInput`).
240
+ * `Mod` is ⌘ or Ctrl. Built on the command system's `ShortcutMap` (matching `event.code`).
241
+ */
242
+ declare function matchArrangeShortcut(event: KeyboardEvent, bindings?: readonly ArrangeShortcutBinding[]): CanvasArrangeAction | null;
2
243
 
3
244
  /**
4
245
  * Edge (or centre line) used by `alignNodes`.
@@ -154,31 +395,4 @@ declare function applyNodeUpdates<TNode extends CanvasNode>(nodes: TNode[], upda
154
395
  */
155
396
  declare function invertNodeUpdates(nodes: CanvasNode[], updates: CanvasNodeUpdate[]): CanvasNodeUpdate[];
156
397
 
157
- /**
158
- * Canvas arrangement actions that have keyboard shortcuts.
159
- */
160
- type CanvasArrangeAction = 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignTop' | 'alignMiddle' | 'alignBottom' | 'distributeHorizontal' | 'distributeVertical' | 'lock' | 'unlock' | 'bringForward' | 'sendBackward' | 'bringToFront' | 'sendToBack' | 'nextScene' | 'previousScene';
161
- interface ArrangeShortcutBinding {
162
- action: CanvasArrangeAction;
163
- /** `KeyboardEvent.code` (layout- and Option-independent, e.g. `KeyA`, `BracketRight`). */
164
- code: string;
165
- mod?: boolean;
166
- alt?: boolean;
167
- shift?: boolean;
168
- /** Human readable label, e.g. for menus. `Mod` is ⌘ on macOS and Ctrl elsewhere. */
169
- label: string;
170
- }
171
- /**
172
- * Default bindings. Align/distribute follow Figma (Option/Alt + letter), layer order follows
173
- * the common `Mod+]` / `Mod+[` convention, lock follows Keynote/Freeform (`Mod+L`,
174
- * `Mod+Alt+L` to unlock) and scenes step with PageDown / PageUp.
175
- */
176
- declare const DEFAULT_ARRANGE_SHORTCUTS: readonly ArrangeShortcutBinding[];
177
- /**
178
- * Resolves a keydown event to an arrange action, or `null`. Events from text inputs,
179
- * textareas, selects, contenteditable and ProseMirror are ignored (see `isEventFromTextInput`).
180
- * `Mod` is ⌘ or Ctrl. Built on the command system's `ShortcutMap` (matching `event.code`).
181
- */
182
- declare function matchArrangeShortcut(event: KeyboardEvent, bindings?: readonly ArrangeShortcutBinding[]): CanvasArrangeAction | null;
183
-
184
- export { type AlignEdge as A, type CanvasArrangeAction as C, type DistributeAxis as D, LOCKED_DATA_KEY as L, type MatchSizeOptions as M, type NodeRectOptions as N, type SizeDimension as S, type ZOrderOperation as Z, type DistributeMode as a, type CanvasNodeUpdate as b, type AlignNodesOptions as c, type DistributeNodesOptions as d, type ArrangeShortcutBinding as e, DEFAULT_ARRANGE_SHORTCUTS as f, LOCKED_PREVIOUS_FLAGS_KEY as g, alignNodes as h, applyNodeUpdates as i, createNodeLookup as j, distributeNodes as k, getAbsolutePosition as l, getNodeRect as m, getNodeSize as n, invertNodeUpdates as o, isLocked as p, lockNodes as q, matchArrangeShortcut as r, matchSize as s, readStyleSize as t, reorderNodes as u, toggleLockNodes as v, unlockNodes as w, withStyleSize as x };
398
+ export { reorderNodes as $, type AlignEdge as A, createNodeLookup as B, type CanvasArrangeAction as C, type DistributeAxis as D, type ExplodeNodeOptions as E, type FanOutTrajectoryOptions as F, type GraphDifferences as G, distributeNodes as H, type IncrementalLayoutOptions as I, getAbsolutePosition as J, getNodeRect as K, LOCKED_DATA_KEY as L, type MatchSizeOptions as M, type NodeTransition as N, getNodeSize as O, type PlaceBesideOptions as P, invertNodeUpdates as Q, type Rect as R, type Side as S, type TrajectoryFunction as T, isLocked as U, lockNodes as V, matchArrangeShortcut as W, type XYPosition as X, matchSize as Y, type ZOrderOperation as Z, readStyleSize as _, type DistributeMode as a, toggleLockNodes as a0, unlockNodes as a1, withStyleSize as a2, type CanvasNode as b, type CanvasEdge as c, type CanvasLayoutOptions as d, type CanvasNodeStyle as e, type ReflowDisplacementOptions as f, type DirectionalDisplacementOptions as g, type CanvasClipboardPayload as h, type CanvasNodeUpdate as i, type NodeRectOptions as j, type Position as k, type Point as l, type AlignNodesOptions as m, type DistributeNodesOptions as n, type SizeDimension as o, type ArrangeShortcutBinding as p, type CanvasDockingCallbacks as q, type CollapseNodeOptions as r, DEFAULT_ARRANGE_SHORTCUTS as s, type DisplacementDirection as t, type DockStrategy as u, type ExplosionSnapshot as v, LOCKED_PREVIOUS_FLAGS_KEY as w, type TrajectoryPoint as x, alignNodes as y, applyNodeUpdates as z };
@@ -0,0 +1,176 @@
1
+ import { H as HistoryState } from './types-GT5a5YAX.cjs';
2
+ import { C as CanvasArrangeAction, A as AlignEdge, D as DistributeAxis, a as DistributeMode, Z as ZOrderOperation } from './arrange-BICutYPk.cjs';
3
+ import { S as ShortcutBinding, C as CommandSpec, K as KeyboardEventLike, P as Platform } from './registry-D0GADKc7.cjs';
4
+
5
+ /** Minimal history surface (`HistoryManager` satisfies it). */
6
+ interface HistoryCommandTarget {
7
+ undo(): boolean | void;
8
+ redo(): boolean | void;
9
+ getState(): Pick<HistoryState, 'canUndo' | 'canRedo'> & Partial<Pick<HistoryState, 'undoName' | 'redoName'>>;
10
+ }
11
+ /** Default history bindings: `Mod+Z` undo; `Mod+Shift+Z` redo, plus `Mod+Y` off macOS. */
12
+ declare const DEFAULT_HISTORY_SHORTCUTS: readonly ShortcutBinding[];
13
+ interface HistoryCommandOptions {
14
+ /** Id prefix (default `history.`). */
15
+ prefix?: string;
16
+ group?: string;
17
+ scope?: string;
18
+ }
19
+ /** `history.undo` / `history.redo` commands for a `HistoryManager` (disabled with a reason when empty). */
20
+ declare function createHistoryCommands(history: HistoryCommandTarget, options?: HistoryCommandOptions): CommandSpec[];
21
+ /**
22
+ * Resolves a keydown event to `undo` / `redo` with the default history bindings
23
+ * (`Mod` is ⌘ on macOS and Ctrl elsewhere). Events from text inputs and
24
+ * contenteditable elements are ignored unless `allowInEditable`.
25
+ */
26
+ declare function matchHistoryShortcut(event: KeyboardEventLike, options?: {
27
+ platform?: Platform;
28
+ allowInEditable?: boolean;
29
+ }): 'undo' | 'redo' | null;
30
+ /** Minimal arrange controller surface (`createCanvasArrangeController` satisfies it). */
31
+ interface ArrangeCommandTarget {
32
+ align(edge: AlignEdge, ids?: Iterable<string>): unknown;
33
+ distribute(axis: DistributeAxis, mode?: DistributeMode, ids?: Iterable<string>): unknown;
34
+ reorder(operation: ZOrderOperation, ids?: Iterable<string>): unknown;
35
+ lock(ids?: Iterable<string>): unknown;
36
+ unlock(ids?: Iterable<string>): unknown;
37
+ }
38
+ interface ArrangeCommandOptions {
39
+ /** Id prefix (default `canvas.`). */
40
+ prefix?: string;
41
+ group?: string;
42
+ /** Scope of the commands and their shortcuts (default `canvas`). Pass `null` for global. */
43
+ scope?: string | null;
44
+ /** Current selection, used for enablement ("Select at least two nodes"). */
45
+ getSelectedIds?: () => string[];
46
+ /** Scene navigation (`nextScene` / `previousScene`); those commands are only added when given. */
47
+ scenes?: {
48
+ next(): unknown;
49
+ previous(): unknown;
50
+ };
51
+ /** Use these bindings instead of `DEFAULT_ARRANGE_SHORTCUTS`. */
52
+ bindings?: readonly {
53
+ action: CanvasArrangeAction;
54
+ label: string;
55
+ }[];
56
+ }
57
+ /**
58
+ * Commands for the canvas arrange actions (`canvas.alignLeft`, `canvas.bringToFront`, …)
59
+ * with the default arrange shortcuts. Each accepts `{ ids? }`; enablement checks the
60
+ * named ids, or the selection when none are named.
61
+ */
62
+ declare function createArrangeCommands(controller: ArrangeCommandTarget, options?: ArrangeCommandOptions): CommandSpec[];
63
+ /** Shape operations surface of the arrange controller (`createCanvasArrangeController` satisfies it). */
64
+ interface ShapeCommandTarget {
65
+ combineShapes(operation: 'unite' | 'intersect' | 'subtract' | 'exclude' | 'divide', ids?: Iterable<string>): unknown;
66
+ canCombineShapes(ids?: Iterable<string>): boolean;
67
+ offsetShapes(distance: number, ids?: Iterable<string>, options?: {
68
+ join?: 'miter' | 'round' | 'bevel';
69
+ miterLimit?: number;
70
+ }): unknown;
71
+ canOffsetShapes(ids?: Iterable<string>): boolean;
72
+ outlineStroke(ids?: Iterable<string>, options?: {
73
+ join?: 'miter' | 'round' | 'bevel';
74
+ cap?: 'butt' | 'round' | 'square';
75
+ miterLimit?: number;
76
+ }): unknown;
77
+ canOutlineStroke(ids?: Iterable<string>): boolean;
78
+ }
79
+ interface ShapeCommandOptions {
80
+ /** Id prefix (default `canvas.`). */
81
+ prefix?: string;
82
+ group?: string;
83
+ /** Scope (default `canvas`). Pass `null` for global. */
84
+ scope?: string | null;
85
+ /** Offset distance used when `canvas.offsetPath` is run without one (default 10). */
86
+ defaultOffset?: number;
87
+ }
88
+ /**
89
+ * Palette / context-menu / agent commands for the shape operations: `canvas.unite`,
90
+ * `canvas.intersect`, `canvas.subtract`, `canvas.exclude`, `canvas.divide`,
91
+ * `canvas.offsetPath` (`{ distance, join?, miterLimit?, ids? }`) and `canvas.outlineStroke`
92
+ * (`{ join?, cap?, miterLimit?, ids? }`). Each is one undoable step when the controller has a
93
+ * history; enablement explains why a command cannot run.
94
+ */
95
+ declare function createShapeCommands(controller: ShapeCommandTarget, options?: ShapeCommandOptions): CommandSpec[];
96
+ type ComponentActionResult = {
97
+ ok: true;
98
+ ids: string[];
99
+ } | {
100
+ ok: false;
101
+ reason: string;
102
+ };
103
+ /** Components surface of the components controller (`createCanvasComponentsController` satisfies it). */
104
+ interface ComponentCommandTarget {
105
+ createComponent(ids?: Iterable<string>): ComponentActionResult;
106
+ canCreateComponent(ids?: Iterable<string>): true | string;
107
+ combineAsVariants(ids?: Iterable<string>): ComponentActionResult;
108
+ canCombineAsVariants(ids?: Iterable<string>): true | string;
109
+ createInstance(componentId: string, options?: {
110
+ parentId?: string;
111
+ position?: {
112
+ x: number;
113
+ y: number;
114
+ };
115
+ properties?: Record<string, boolean | string>;
116
+ }): ComponentActionResult;
117
+ canCreateInstance(componentId?: string, parentId?: string): true | string;
118
+ detachInstance(ids?: Iterable<string>): ComponentActionResult;
119
+ canDetachInstance(ids?: Iterable<string>): true | string;
120
+ resetOverrides(id?: string, group?: string): ComponentActionResult;
121
+ canResetOverrides(id?: string): true | string;
122
+ pushOverrides(id?: string): ComponentActionResult;
123
+ canPushOverrides(id?: string): true | string;
124
+ swapInstance(componentId: string, ids?: Iterable<string>): ComponentActionResult;
125
+ canSwapInstance(componentId?: string, ids?: Iterable<string>): true | string;
126
+ setInstanceProperties(properties: Record<string, unknown>, ids?: Iterable<string>): ComponentActionResult;
127
+ canSetInstanceProperties(ids?: Iterable<string>): true | string;
128
+ restoreMainComponent(id?: string): ComponentActionResult;
129
+ canRestoreMainComponent(id?: string): true | string;
130
+ goToMainComponent(id?: string): string | undefined;
131
+ canGoToMainComponent(id?: string): true | string;
132
+ list(): unknown;
133
+ inspect(id?: string): unknown;
134
+ }
135
+ interface ComponentCommandOptions {
136
+ /** Id prefix (default `canvas.`). */
137
+ prefix?: string;
138
+ group?: string;
139
+ /** Scope (default `canvas`). Pass `null` for global. */
140
+ scope?: string | null;
141
+ }
142
+ /**
143
+ * Palette / context-menu / agent commands for components and instances:
144
+ * `canvas.createComponent`, `canvas.combineAsVariants`, `canvas.createInstance`
145
+ * (`{ componentId, parentId?, x?, y?, properties? }`), `canvas.detachInstance`,
146
+ * `canvas.resetOverrides` (`{ id?, group? }`), `canvas.pushOverrides`, `canvas.goToMainComponent`,
147
+ * `canvas.swapInstance` (`{ componentId, ids? }`), `canvas.setInstanceProperties`
148
+ * (`{ properties, ids? }`: variant and component property values), `canvas.restoreMainComponent`
149
+ * and the read-only `canvas.listComponents` / `canvas.inspectInstance`. Each action is one
150
+ * undoable step when the controller has a history; enablement explains why it cannot run.
151
+ */
152
+ declare function createComponentCommands(controller: ComponentCommandTarget, options?: ComponentCommandOptions): CommandSpec[];
153
+ /** Spreadsheet controller surface used by `createSpreadsheetCommands`. */
154
+ interface SpreadsheetCommandTarget {
155
+ selectedRange: unknown;
156
+ getFilterState(): {
157
+ enabled: boolean;
158
+ rules: readonly unknown[];
159
+ };
160
+ toggleFilters(): void;
161
+ clearFilters(): void;
162
+ unhideAll(): void;
163
+ mergeCells(): boolean;
164
+ unmergeCells(): boolean;
165
+ transposeRange(): boolean;
166
+ }
167
+ interface SpreadsheetCommandOptions {
168
+ /** Id prefix (default `spreadsheet.`). */
169
+ prefix?: string;
170
+ /** Scope (default `spreadsheet`). Pass `null` for global. */
171
+ scope?: string | null;
172
+ }
173
+ /** Palette / agent commands for common spreadsheet table actions (no default shortcuts). */
174
+ declare function createSpreadsheetCommands(controller: SpreadsheetCommandTarget, options?: SpreadsheetCommandOptions): CommandSpec[];
175
+
176
+ export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, matchHistoryShortcut as m };
@@ -0,0 +1,176 @@
1
+ import { H as HistoryState } from './types-GT5a5YAX.js';
2
+ import { C as CanvasArrangeAction, A as AlignEdge, D as DistributeAxis, a as DistributeMode, Z as ZOrderOperation } from './arrange-BICutYPk.js';
3
+ import { S as ShortcutBinding, C as CommandSpec, K as KeyboardEventLike, P as Platform } from './registry-DhVUZioj.js';
4
+
5
+ /** Minimal history surface (`HistoryManager` satisfies it). */
6
+ interface HistoryCommandTarget {
7
+ undo(): boolean | void;
8
+ redo(): boolean | void;
9
+ getState(): Pick<HistoryState, 'canUndo' | 'canRedo'> & Partial<Pick<HistoryState, 'undoName' | 'redoName'>>;
10
+ }
11
+ /** Default history bindings: `Mod+Z` undo; `Mod+Shift+Z` redo, plus `Mod+Y` off macOS. */
12
+ declare const DEFAULT_HISTORY_SHORTCUTS: readonly ShortcutBinding[];
13
+ interface HistoryCommandOptions {
14
+ /** Id prefix (default `history.`). */
15
+ prefix?: string;
16
+ group?: string;
17
+ scope?: string;
18
+ }
19
+ /** `history.undo` / `history.redo` commands for a `HistoryManager` (disabled with a reason when empty). */
20
+ declare function createHistoryCommands(history: HistoryCommandTarget, options?: HistoryCommandOptions): CommandSpec[];
21
+ /**
22
+ * Resolves a keydown event to `undo` / `redo` with the default history bindings
23
+ * (`Mod` is ⌘ on macOS and Ctrl elsewhere). Events from text inputs and
24
+ * contenteditable elements are ignored unless `allowInEditable`.
25
+ */
26
+ declare function matchHistoryShortcut(event: KeyboardEventLike, options?: {
27
+ platform?: Platform;
28
+ allowInEditable?: boolean;
29
+ }): 'undo' | 'redo' | null;
30
+ /** Minimal arrange controller surface (`createCanvasArrangeController` satisfies it). */
31
+ interface ArrangeCommandTarget {
32
+ align(edge: AlignEdge, ids?: Iterable<string>): unknown;
33
+ distribute(axis: DistributeAxis, mode?: DistributeMode, ids?: Iterable<string>): unknown;
34
+ reorder(operation: ZOrderOperation, ids?: Iterable<string>): unknown;
35
+ lock(ids?: Iterable<string>): unknown;
36
+ unlock(ids?: Iterable<string>): unknown;
37
+ }
38
+ interface ArrangeCommandOptions {
39
+ /** Id prefix (default `canvas.`). */
40
+ prefix?: string;
41
+ group?: string;
42
+ /** Scope of the commands and their shortcuts (default `canvas`). Pass `null` for global. */
43
+ scope?: string | null;
44
+ /** Current selection, used for enablement ("Select at least two nodes"). */
45
+ getSelectedIds?: () => string[];
46
+ /** Scene navigation (`nextScene` / `previousScene`); those commands are only added when given. */
47
+ scenes?: {
48
+ next(): unknown;
49
+ previous(): unknown;
50
+ };
51
+ /** Use these bindings instead of `DEFAULT_ARRANGE_SHORTCUTS`. */
52
+ bindings?: readonly {
53
+ action: CanvasArrangeAction;
54
+ label: string;
55
+ }[];
56
+ }
57
+ /**
58
+ * Commands for the canvas arrange actions (`canvas.alignLeft`, `canvas.bringToFront`, …)
59
+ * with the default arrange shortcuts. Each accepts `{ ids? }`; enablement checks the
60
+ * named ids, or the selection when none are named.
61
+ */
62
+ declare function createArrangeCommands(controller: ArrangeCommandTarget, options?: ArrangeCommandOptions): CommandSpec[];
63
+ /** Shape operations surface of the arrange controller (`createCanvasArrangeController` satisfies it). */
64
+ interface ShapeCommandTarget {
65
+ combineShapes(operation: 'unite' | 'intersect' | 'subtract' | 'exclude' | 'divide', ids?: Iterable<string>): unknown;
66
+ canCombineShapes(ids?: Iterable<string>): boolean;
67
+ offsetShapes(distance: number, ids?: Iterable<string>, options?: {
68
+ join?: 'miter' | 'round' | 'bevel';
69
+ miterLimit?: number;
70
+ }): unknown;
71
+ canOffsetShapes(ids?: Iterable<string>): boolean;
72
+ outlineStroke(ids?: Iterable<string>, options?: {
73
+ join?: 'miter' | 'round' | 'bevel';
74
+ cap?: 'butt' | 'round' | 'square';
75
+ miterLimit?: number;
76
+ }): unknown;
77
+ canOutlineStroke(ids?: Iterable<string>): boolean;
78
+ }
79
+ interface ShapeCommandOptions {
80
+ /** Id prefix (default `canvas.`). */
81
+ prefix?: string;
82
+ group?: string;
83
+ /** Scope (default `canvas`). Pass `null` for global. */
84
+ scope?: string | null;
85
+ /** Offset distance used when `canvas.offsetPath` is run without one (default 10). */
86
+ defaultOffset?: number;
87
+ }
88
+ /**
89
+ * Palette / context-menu / agent commands for the shape operations: `canvas.unite`,
90
+ * `canvas.intersect`, `canvas.subtract`, `canvas.exclude`, `canvas.divide`,
91
+ * `canvas.offsetPath` (`{ distance, join?, miterLimit?, ids? }`) and `canvas.outlineStroke`
92
+ * (`{ join?, cap?, miterLimit?, ids? }`). Each is one undoable step when the controller has a
93
+ * history; enablement explains why a command cannot run.
94
+ */
95
+ declare function createShapeCommands(controller: ShapeCommandTarget, options?: ShapeCommandOptions): CommandSpec[];
96
+ type ComponentActionResult = {
97
+ ok: true;
98
+ ids: string[];
99
+ } | {
100
+ ok: false;
101
+ reason: string;
102
+ };
103
+ /** Components surface of the components controller (`createCanvasComponentsController` satisfies it). */
104
+ interface ComponentCommandTarget {
105
+ createComponent(ids?: Iterable<string>): ComponentActionResult;
106
+ canCreateComponent(ids?: Iterable<string>): true | string;
107
+ combineAsVariants(ids?: Iterable<string>): ComponentActionResult;
108
+ canCombineAsVariants(ids?: Iterable<string>): true | string;
109
+ createInstance(componentId: string, options?: {
110
+ parentId?: string;
111
+ position?: {
112
+ x: number;
113
+ y: number;
114
+ };
115
+ properties?: Record<string, boolean | string>;
116
+ }): ComponentActionResult;
117
+ canCreateInstance(componentId?: string, parentId?: string): true | string;
118
+ detachInstance(ids?: Iterable<string>): ComponentActionResult;
119
+ canDetachInstance(ids?: Iterable<string>): true | string;
120
+ resetOverrides(id?: string, group?: string): ComponentActionResult;
121
+ canResetOverrides(id?: string): true | string;
122
+ pushOverrides(id?: string): ComponentActionResult;
123
+ canPushOverrides(id?: string): true | string;
124
+ swapInstance(componentId: string, ids?: Iterable<string>): ComponentActionResult;
125
+ canSwapInstance(componentId?: string, ids?: Iterable<string>): true | string;
126
+ setInstanceProperties(properties: Record<string, unknown>, ids?: Iterable<string>): ComponentActionResult;
127
+ canSetInstanceProperties(ids?: Iterable<string>): true | string;
128
+ restoreMainComponent(id?: string): ComponentActionResult;
129
+ canRestoreMainComponent(id?: string): true | string;
130
+ goToMainComponent(id?: string): string | undefined;
131
+ canGoToMainComponent(id?: string): true | string;
132
+ list(): unknown;
133
+ inspect(id?: string): unknown;
134
+ }
135
+ interface ComponentCommandOptions {
136
+ /** Id prefix (default `canvas.`). */
137
+ prefix?: string;
138
+ group?: string;
139
+ /** Scope (default `canvas`). Pass `null` for global. */
140
+ scope?: string | null;
141
+ }
142
+ /**
143
+ * Palette / context-menu / agent commands for components and instances:
144
+ * `canvas.createComponent`, `canvas.combineAsVariants`, `canvas.createInstance`
145
+ * (`{ componentId, parentId?, x?, y?, properties? }`), `canvas.detachInstance`,
146
+ * `canvas.resetOverrides` (`{ id?, group? }`), `canvas.pushOverrides`, `canvas.goToMainComponent`,
147
+ * `canvas.swapInstance` (`{ componentId, ids? }`), `canvas.setInstanceProperties`
148
+ * (`{ properties, ids? }`: variant and component property values), `canvas.restoreMainComponent`
149
+ * and the read-only `canvas.listComponents` / `canvas.inspectInstance`. Each action is one
150
+ * undoable step when the controller has a history; enablement explains why it cannot run.
151
+ */
152
+ declare function createComponentCommands(controller: ComponentCommandTarget, options?: ComponentCommandOptions): CommandSpec[];
153
+ /** Spreadsheet controller surface used by `createSpreadsheetCommands`. */
154
+ interface SpreadsheetCommandTarget {
155
+ selectedRange: unknown;
156
+ getFilterState(): {
157
+ enabled: boolean;
158
+ rules: readonly unknown[];
159
+ };
160
+ toggleFilters(): void;
161
+ clearFilters(): void;
162
+ unhideAll(): void;
163
+ mergeCells(): boolean;
164
+ unmergeCells(): boolean;
165
+ transposeRange(): boolean;
166
+ }
167
+ interface SpreadsheetCommandOptions {
168
+ /** Id prefix (default `spreadsheet.`). */
169
+ prefix?: string;
170
+ /** Scope (default `spreadsheet`). Pass `null` for global. */
171
+ scope?: string | null;
172
+ }
173
+ /** Palette / agent commands for common spreadsheet table actions (no default shortcuts). */
174
+ declare function createSpreadsheetCommands(controller: SpreadsheetCommandTarget, options?: SpreadsheetCommandOptions): CommandSpec[];
175
+
176
+ export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, matchHistoryShortcut as m };