@pixerate/editor 0.26.1 → 0.28.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 +32 -3
- package/dist/agent/index.cjs +56 -6
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +6 -4
- package/dist/agent/index.d.ts +6 -4
- package/dist/agent/index.js +51 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/animation/index.cjs +62 -0
- package/dist/animation/index.cjs.map +1 -0
- package/dist/animation/index.d.cts +296 -0
- package/dist/animation/index.d.ts +296 -0
- package/dist/animation/index.js +62 -0
- package/dist/animation/index.js.map +1 -0
- package/dist/{builtins-Chj6zv_O.d.ts → builtins-haN82vjT.d.ts} +33 -3
- package/dist/{builtins-CdPcLwwF.d.cts → builtins-nMXh9sT3.d.cts} +33 -3
- package/dist/canvas/index.cjs +535 -737
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +74 -291
- package/dist/canvas/index.d.ts +74 -291
- package/dist/canvas/index.js +417 -619
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-X7HXL2SB.js → chunk-3RPOW4CS.js} +342 -16
- package/dist/chunk-3RPOW4CS.js.map +1 -0
- package/dist/{chunk-UBCFIABU.js → chunk-5H2OPMXZ.js} +183 -6
- package/dist/chunk-5H2OPMXZ.js.map +1 -0
- package/dist/chunk-A6PHCAGX.cjs +87 -0
- package/dist/chunk-A6PHCAGX.cjs.map +1 -0
- package/dist/{chunk-HRMEDT2L.js → chunk-D6AVOTSD.js} +6 -85
- package/dist/chunk-D6AVOTSD.js.map +1 -0
- package/dist/chunk-HXDMZQTD.cjs +497 -0
- package/dist/chunk-HXDMZQTD.cjs.map +1 -0
- package/dist/chunk-IB3ZHQAX.js +497 -0
- package/dist/chunk-IB3ZHQAX.js.map +1 -0
- package/dist/{chunk-4BVP64JJ.cjs → chunk-K2UYKJ6M.cjs} +24 -103
- package/dist/chunk-K2UYKJ6M.cjs.map +1 -0
- package/dist/{chunk-HDYMLS3X.cjs → chunk-MC2LQN5S.cjs} +196 -19
- package/dist/chunk-MC2LQN5S.cjs.map +1 -0
- package/dist/{chunk-XQFHLT53.js → chunk-MXZJ4PKN.js} +24 -10
- package/dist/chunk-MXZJ4PKN.js.map +1 -0
- package/dist/{chunk-LN2POBHT.cjs → chunk-OYEFRO3D.cjs} +28 -14
- package/dist/chunk-OYEFRO3D.cjs.map +1 -0
- package/dist/chunk-PWJARCI4.js +637 -0
- package/dist/chunk-PWJARCI4.js.map +1 -0
- package/dist/chunk-TGD52FEZ.js +87 -0
- package/dist/chunk-TGD52FEZ.js.map +1 -0
- package/dist/chunk-TTYCN6ZH.cjs +637 -0
- package/dist/chunk-TTYCN6ZH.cjs.map +1 -0
- package/dist/{chunk-NQF32I6Z.cjs → chunk-U7VGDSNY.cjs} +463 -137
- package/dist/chunk-U7VGDSNY.cjs.map +1 -0
- package/dist/commands/index.cjs +30 -410
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +17 -397
- package/dist/commands/index.js.map +1 -1
- package/dist/{controller-CxXGOEmy.d.ts → controller-w6eRTjF8.d.cts} +67 -2
- package/dist/{controller-CxXGOEmy.d.cts → controller-w6eRTjF8.d.ts} +67 -2
- package/dist/extensions/index.cjs +25 -7
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.js +32 -14
- package/dist/generation/index.cjs +3 -3
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.js +3 -3
- package/dist/{index-jcJwmBYt.d.cts → index-C6gaQRH0.d.cts} +53 -4
- package/dist/{index-B273Zllk.d.ts → index-DXAv_R08.d.ts} +53 -4
- package/dist/index.cjs +57 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +132 -94
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +23 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +76 -3
- package/dist/spreadsheet/index.d.ts +76 -3
- package/dist/spreadsheet/index.js +28 -8
- package/dist/tokens/index.cjs +4 -2
- package/dist/tokens/index.cjs.map +1 -1
- package/dist/tokens/index.js +6 -4
- package/package.json +6 -1
- package/dist/chunk-4BVP64JJ.cjs.map +0 -1
- package/dist/chunk-HDYMLS3X.cjs.map +0 -1
- package/dist/chunk-HRMEDT2L.js.map +0 -1
- package/dist/chunk-LN2POBHT.cjs.map +0 -1
- package/dist/chunk-NQF32I6Z.cjs.map +0 -1
- package/dist/chunk-UBCFIABU.js.map +0 -1
- package/dist/chunk-X7HXL2SB.js.map +0 -1
- package/dist/chunk-XQFHLT53.js.map +0 -1
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_ARRANGE_SHORTCUTS,
|
|
3
|
+
ShortcutMap
|
|
4
|
+
} from "./chunk-7DWMJCAT.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/builtins.ts
|
|
7
|
+
var DEFAULT_HISTORY_SHORTCUTS = [
|
|
8
|
+
{ command: "undo", chord: "Mod+Z" },
|
|
9
|
+
{ command: "redo", chord: "Mod+Shift+Z" },
|
|
10
|
+
{ command: "redo", chord: "Mod+Y", platforms: ["windows", "linux"] }
|
|
11
|
+
];
|
|
12
|
+
function createHistoryCommands(history, options = {}) {
|
|
13
|
+
const prefix = options.prefix ?? "history.";
|
|
14
|
+
const group = options.group ?? "Edit";
|
|
15
|
+
const shortcutsOf = (command) => DEFAULT_HISTORY_SHORTCUTS.filter((b) => b.command === command).map(({ command: _c, ...rest }) => rest);
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
id: `${prefix}undo`,
|
|
19
|
+
label: "Undo",
|
|
20
|
+
group,
|
|
21
|
+
keywords: ["revert", "back"],
|
|
22
|
+
description: "Reverts the last change.",
|
|
23
|
+
shortcut: shortcutsOf("undo"),
|
|
24
|
+
...options.scope ? { scope: options.scope } : {},
|
|
25
|
+
enabled: () => history.getState().canUndo ? true : "Nothing to undo.",
|
|
26
|
+
run: () => {
|
|
27
|
+
history.undo();
|
|
28
|
+
return { undone: true, state: history.getState() };
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: `${prefix}redo`,
|
|
33
|
+
label: "Redo",
|
|
34
|
+
group,
|
|
35
|
+
keywords: ["repeat", "forward"],
|
|
36
|
+
description: "Re-applies the last undone change.",
|
|
37
|
+
shortcut: shortcutsOf("redo"),
|
|
38
|
+
...options.scope ? { scope: options.scope } : {},
|
|
39
|
+
enabled: () => history.getState().canRedo ? true : "Nothing to redo.",
|
|
40
|
+
run: () => {
|
|
41
|
+
history.redo();
|
|
42
|
+
return { redone: true, state: history.getState() };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
var historyShortcutMap = null;
|
|
48
|
+
function matchHistoryShortcut(event, options = {}) {
|
|
49
|
+
historyShortcutMap ??= new ShortcutMap(DEFAULT_HISTORY_SHORTCUTS);
|
|
50
|
+
return historyShortcutMap.resolve(event, options)?.command ?? null;
|
|
51
|
+
}
|
|
52
|
+
var ARRANGE_LABELS = {
|
|
53
|
+
alignLeft: "Align Left",
|
|
54
|
+
alignCenter: "Align Horizontal Centers",
|
|
55
|
+
alignRight: "Align Right",
|
|
56
|
+
alignTop: "Align Top",
|
|
57
|
+
alignMiddle: "Align Vertical Centers",
|
|
58
|
+
alignBottom: "Align Bottom",
|
|
59
|
+
distributeHorizontal: "Distribute Horizontally",
|
|
60
|
+
distributeVertical: "Distribute Vertically",
|
|
61
|
+
lock: "Lock",
|
|
62
|
+
unlock: "Unlock",
|
|
63
|
+
bringForward: "Bring Forward",
|
|
64
|
+
sendBackward: "Send Backward",
|
|
65
|
+
bringToFront: "Bring to Front",
|
|
66
|
+
sendToBack: "Send to Back",
|
|
67
|
+
nextScene: "Next Scene",
|
|
68
|
+
previousScene: "Previous Scene"
|
|
69
|
+
};
|
|
70
|
+
var IDS_PARAMS = {
|
|
71
|
+
type: "object",
|
|
72
|
+
properties: {
|
|
73
|
+
ids: {
|
|
74
|
+
type: "array",
|
|
75
|
+
items: { type: "string" },
|
|
76
|
+
description: "Node ids to act on (default: the selection)."
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
function createArrangeCommands(controller, options = {}) {
|
|
81
|
+
const prefix = options.prefix ?? "canvas.";
|
|
82
|
+
const group = options.group ?? "Arrange";
|
|
83
|
+
const scope = options.scope === null ? void 0 : options.scope ?? "canvas";
|
|
84
|
+
const bindings = options.bindings ?? DEFAULT_ARRANGE_SHORTCUTS;
|
|
85
|
+
const count = (params) => params?.ids?.length ?? options.getSelectedIds?.().length;
|
|
86
|
+
const needs = (min, what) => (_, params) => {
|
|
87
|
+
const n = count(params);
|
|
88
|
+
if (n === void 0 || n >= min) return true;
|
|
89
|
+
return min === 1 ? `Select a ${what} first.` : `Select at least ${min} ${what}s.`;
|
|
90
|
+
};
|
|
91
|
+
const run = {
|
|
92
|
+
alignLeft: (ids) => controller.align("left", ids),
|
|
93
|
+
alignCenter: (ids) => controller.align("center", ids),
|
|
94
|
+
alignRight: (ids) => controller.align("right", ids),
|
|
95
|
+
alignTop: (ids) => controller.align("top", ids),
|
|
96
|
+
alignMiddle: (ids) => controller.align("middle", ids),
|
|
97
|
+
alignBottom: (ids) => controller.align("bottom", ids),
|
|
98
|
+
distributeHorizontal: (ids) => controller.distribute("horizontal", "gaps", ids),
|
|
99
|
+
distributeVertical: (ids) => controller.distribute("vertical", "gaps", ids),
|
|
100
|
+
lock: (ids) => controller.lock(ids),
|
|
101
|
+
unlock: (ids) => controller.unlock(ids),
|
|
102
|
+
bringForward: (ids) => controller.reorder("bringForward", ids),
|
|
103
|
+
sendBackward: (ids) => controller.reorder("sendBackward", ids),
|
|
104
|
+
bringToFront: (ids) => controller.reorder("bringToFront", ids),
|
|
105
|
+
sendToBack: (ids) => controller.reorder("sendToBack", ids),
|
|
106
|
+
nextScene: () => options.scenes?.next(),
|
|
107
|
+
previousScene: () => options.scenes?.previous()
|
|
108
|
+
};
|
|
109
|
+
const actions = Object.keys(ARRANGE_LABELS);
|
|
110
|
+
return actions.filter((action) => options.scenes || action !== "nextScene" && action !== "previousScene").map((action) => {
|
|
111
|
+
const isScene = action === "nextScene" || action === "previousScene";
|
|
112
|
+
const enabled = isScene ? void 0 : action.startsWith("align") ? needs(2, "node") : action.startsWith("distribute") ? needs(3, "node") : needs(1, "node");
|
|
113
|
+
return {
|
|
114
|
+
id: `${prefix}${action}`,
|
|
115
|
+
label: ARRANGE_LABELS[action],
|
|
116
|
+
group: isScene ? "Scenes" : group,
|
|
117
|
+
keywords: isScene ? ["scene", "slide", "page"] : action.startsWith("align") ? ["align"] : ["arrange", "layer", "order"],
|
|
118
|
+
...scope ? { scope } : {},
|
|
119
|
+
shortcut: bindings.filter((b) => b.action === action).map((b) => b.label),
|
|
120
|
+
...isScene ? {} : { params: IDS_PARAMS },
|
|
121
|
+
...enabled ? { enabled } : {},
|
|
122
|
+
run: (_ctx, params) => run[action](params?.ids)
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
var SHAPE_COMMANDS = [
|
|
127
|
+
{ op: "unite", label: "Unite Shapes", keywords: ["union", "merge", "boolean", "combine"] },
|
|
128
|
+
{ op: "intersect", label: "Intersect Shapes", keywords: ["intersection", "boolean", "combine"] },
|
|
129
|
+
{ op: "subtract", label: "Subtract Shapes", keywords: ["difference", "minus front", "boolean", "combine"] },
|
|
130
|
+
{ op: "exclude", label: "Exclude Shapes", keywords: ["xor", "boolean", "combine"] },
|
|
131
|
+
{ op: "divide", label: "Divide Shapes", keywords: ["split", "pathfinder", "boolean"] }
|
|
132
|
+
];
|
|
133
|
+
var JOIN_PARAM = { type: "string", enum: ["miter", "round", "bevel"], description: "Corner style (default miter)." };
|
|
134
|
+
function createShapeCommands(controller, options = {}) {
|
|
135
|
+
const prefix = options.prefix ?? "canvas.";
|
|
136
|
+
const group = options.group ?? "Shape";
|
|
137
|
+
const scope = options.scope === null ? void 0 : options.scope ?? "canvas";
|
|
138
|
+
const base = { group, ...scope ? { scope } : {} };
|
|
139
|
+
const combine = SHAPE_COMMANDS.map(
|
|
140
|
+
({ op, label, keywords }) => ({
|
|
141
|
+
...base,
|
|
142
|
+
id: `${prefix}${op}`,
|
|
143
|
+
label,
|
|
144
|
+
keywords: [...keywords],
|
|
145
|
+
description: `${label.split(" ")[0]}s the selected shapes into a new path (curves are kept).`,
|
|
146
|
+
params: IDS_PARAMS,
|
|
147
|
+
enabled: (_ctx, params) => controller.canCombineShapes(params?.ids) ? true : "Select at least two unlocked shapes.",
|
|
148
|
+
run: (_ctx, params) => controller.combineShapes(op, params?.ids)
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
return [
|
|
152
|
+
...combine,
|
|
153
|
+
{
|
|
154
|
+
...base,
|
|
155
|
+
id: `${prefix}offsetPath`,
|
|
156
|
+
label: "Offset Path\u2026",
|
|
157
|
+
keywords: ["inset", "outset", "grow", "shrink", "expand", "contract"],
|
|
158
|
+
description: "Grows (positive distance) or shrinks (negative) the selected shapes.",
|
|
159
|
+
params: {
|
|
160
|
+
type: "object",
|
|
161
|
+
properties: {
|
|
162
|
+
distance: { type: "number", description: `Offset in canvas units (default ${options.defaultOffset ?? 10}).` },
|
|
163
|
+
join: JOIN_PARAM,
|
|
164
|
+
miterLimit: { type: "number", description: "Miter limit (default 4)." },
|
|
165
|
+
ids: IDS_PARAMS.properties.ids
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
enabled: (_ctx, params) => controller.canOffsetShapes(params?.ids) ? true : "Select an unlocked shape.",
|
|
169
|
+
run: (_ctx, params) => controller.offsetShapes(params?.distance ?? options.defaultOffset ?? 10, params?.ids, {
|
|
170
|
+
...params?.join ? { join: params.join } : {},
|
|
171
|
+
...params?.miterLimit !== void 0 ? { miterLimit: params.miterLimit } : {}
|
|
172
|
+
})
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
...base,
|
|
176
|
+
id: `${prefix}outlineStroke`,
|
|
177
|
+
label: "Outline Stroke",
|
|
178
|
+
keywords: ["expand stroke", "stroke to path", "convert stroke"],
|
|
179
|
+
description: "Converts the strokes of the selected shapes to filled shapes.",
|
|
180
|
+
params: {
|
|
181
|
+
type: "object",
|
|
182
|
+
properties: {
|
|
183
|
+
join: JOIN_PARAM,
|
|
184
|
+
cap: { type: "string", enum: ["butt", "round", "square"], description: "Line cap (default butt)." },
|
|
185
|
+
miterLimit: { type: "number", description: "Miter limit (default 4)." },
|
|
186
|
+
ids: IDS_PARAMS.properties.ids
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
enabled: (_ctx, params) => controller.canOutlineStroke(params?.ids) ? true : "Select an unlocked shape with a stroke.",
|
|
190
|
+
run: (_ctx, params) => controller.outlineStroke(params?.ids, {
|
|
191
|
+
...params?.join ? { join: params.join } : {},
|
|
192
|
+
...params?.cap ? { cap: params.cap } : {},
|
|
193
|
+
...params?.miterLimit !== void 0 ? { miterLimit: params.miterLimit } : {}
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
function hasVariantCommands(controller) {
|
|
199
|
+
return typeof controller.addVariant === "function" && typeof controller.removeVariant === "function";
|
|
200
|
+
}
|
|
201
|
+
var SET_ID_PARAM = { type: "string", description: "Component set (or one of its variants) to act on (default: the selection\u2019s set)." };
|
|
202
|
+
var VARIANT_ID_PARAM = { type: "string", description: "Variant to act on (default: the first selected variant)." };
|
|
203
|
+
var VARIANT_VALUES_PARAM = {
|
|
204
|
+
type: "object",
|
|
205
|
+
description: 'Variant property \u2192 value, e.g. { "Size": "Medium" }. New property names are added to every variant.',
|
|
206
|
+
additionalProperties: { type: "string" }
|
|
207
|
+
};
|
|
208
|
+
function variantCommands(controller, prefix, base) {
|
|
209
|
+
return [
|
|
210
|
+
{
|
|
211
|
+
...base,
|
|
212
|
+
id: `${prefix}addVariant`,
|
|
213
|
+
label: "Add Variant",
|
|
214
|
+
keywords: ["variant", "new variant", "duplicate variant", "component set"],
|
|
215
|
+
description: "Adds a variant to a component set by duplicating one (default: the selected or default variant) with new property values.",
|
|
216
|
+
params: {
|
|
217
|
+
type: "object",
|
|
218
|
+
properties: {
|
|
219
|
+
setId: SET_ID_PARAM,
|
|
220
|
+
from: { type: "string", description: "Variant to duplicate (default: the selected variant, else the default one)." },
|
|
221
|
+
variant: VARIANT_VALUES_PARAM,
|
|
222
|
+
x: { type: "number", description: "X in the set\u2019s space (default: next to the source)." },
|
|
223
|
+
y: { type: "number", description: "Y in the set\u2019s space." }
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
enabled: (_ctx, params) => controller.canAddVariant(params?.setId, {
|
|
227
|
+
...params?.from !== void 0 ? { from: params.from } : {},
|
|
228
|
+
...params?.variant ? { variant: params.variant } : {}
|
|
229
|
+
}),
|
|
230
|
+
run: (_ctx, params) => outcome(
|
|
231
|
+
controller.addVariant(params?.setId, {
|
|
232
|
+
...params?.from !== void 0 ? { from: params.from } : {},
|
|
233
|
+
...params?.variant ? { variant: params.variant } : {},
|
|
234
|
+
...params?.x !== void 0 || params?.y !== void 0 ? { position: { x: params?.x ?? 0, y: params?.y ?? 0 } } : {}
|
|
235
|
+
})
|
|
236
|
+
)
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
...base,
|
|
240
|
+
id: `${prefix}removeVariant`,
|
|
241
|
+
label: "Remove Variant",
|
|
242
|
+
keywords: ["delete variant", "variant"],
|
|
243
|
+
description: "Removes a variant; its instances switch to the closest remaining variant, keeping overrides.",
|
|
244
|
+
params: { type: "object", properties: { id: VARIANT_ID_PARAM } },
|
|
245
|
+
enabled: (_ctx, params) => controller.canRemoveVariant(params?.id),
|
|
246
|
+
run: (_ctx, params) => outcome(controller.removeVariant(params?.id))
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
...base,
|
|
250
|
+
id: `${prefix}setVariantProperties`,
|
|
251
|
+
label: "Edit Variant Properties\u2026",
|
|
252
|
+
keywords: ["rename variant", "variant values", "variant"],
|
|
253
|
+
description: "Sets a variant\u2019s property values (refusing a combination another variant has).",
|
|
254
|
+
params: { type: "object", properties: { values: VARIANT_VALUES_PARAM, id: VARIANT_ID_PARAM }, required: ["values"] },
|
|
255
|
+
enabled: (_ctx, params) => controller.canSetVariantProperties(params?.values, params?.id),
|
|
256
|
+
run: (_ctx, params) => outcome(controller.setVariantProperties(params.values, params?.id))
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
...base,
|
|
260
|
+
id: `${prefix}renameVariantProperty`,
|
|
261
|
+
label: "Rename Variant Property\u2026",
|
|
262
|
+
keywords: ["rename property", "variant property"],
|
|
263
|
+
description: "Renames a variant property across a component set.",
|
|
264
|
+
params: {
|
|
265
|
+
type: "object",
|
|
266
|
+
properties: { name: { type: "string" }, newName: { type: "string" }, setId: SET_ID_PARAM },
|
|
267
|
+
required: ["name", "newName"]
|
|
268
|
+
},
|
|
269
|
+
enabled: (_ctx, params) => controller.canRenameVariantProperty(params?.name, params?.newName, params?.setId),
|
|
270
|
+
run: (_ctx, params) => outcome(controller.renameVariantProperty(params.name, params.newName, params?.setId))
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
...base,
|
|
274
|
+
id: `${prefix}renameVariantValue`,
|
|
275
|
+
label: "Rename Variant Value\u2026",
|
|
276
|
+
keywords: ["rename value", "variant value"],
|
|
277
|
+
description: "Renames a value of a variant property across a component set.",
|
|
278
|
+
params: {
|
|
279
|
+
type: "object",
|
|
280
|
+
properties: { property: { type: "string" }, value: { type: "string" }, newValue: { type: "string" }, setId: SET_ID_PARAM },
|
|
281
|
+
required: ["property", "value", "newValue"]
|
|
282
|
+
},
|
|
283
|
+
enabled: (_ctx, params) => controller.canRenameVariantValue(params?.property, params?.value, params?.newValue, params?.setId),
|
|
284
|
+
run: (_ctx, params) => outcome(controller.renameVariantValue(params.property, params.value, params.newValue, params?.setId))
|
|
285
|
+
}
|
|
286
|
+
];
|
|
287
|
+
}
|
|
288
|
+
var outcome = (result) => {
|
|
289
|
+
if (!result.ok) throw new Error(result.reason);
|
|
290
|
+
return { ids: result.ids };
|
|
291
|
+
};
|
|
292
|
+
var ID_PARAM = { type: "string", description: "Instance (or layer inside one) to act on (default: the first selected node)." };
|
|
293
|
+
function createComponentCommands(controller, options = {}) {
|
|
294
|
+
const prefix = options.prefix ?? "canvas.";
|
|
295
|
+
const group = options.group ?? "Components";
|
|
296
|
+
const scope = options.scope === null ? void 0 : options.scope ?? "canvas";
|
|
297
|
+
const base = { group, ...scope ? { scope } : {} };
|
|
298
|
+
const idParams = { type: "object", properties: { id: ID_PARAM } };
|
|
299
|
+
return [
|
|
300
|
+
{
|
|
301
|
+
...base,
|
|
302
|
+
id: `${prefix}createComponent`,
|
|
303
|
+
label: "Create Component",
|
|
304
|
+
keywords: ["component", "symbol", "main component", "reusable"],
|
|
305
|
+
description: "Turns the selected frame into a main component, or wraps the selection in one.",
|
|
306
|
+
params: IDS_PARAMS,
|
|
307
|
+
shortcut: "Mod+Alt+K",
|
|
308
|
+
enabled: (_ctx, params) => controller.canCreateComponent(params?.ids),
|
|
309
|
+
run: (_ctx, params) => outcome(controller.createComponent(params?.ids))
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
...base,
|
|
313
|
+
id: `${prefix}combineAsVariants`,
|
|
314
|
+
label: "Combine as Variants",
|
|
315
|
+
keywords: ["component set", "variant", "variants"],
|
|
316
|
+
description: "Wraps the selected components in a component set.",
|
|
317
|
+
params: IDS_PARAMS,
|
|
318
|
+
enabled: (_ctx, params) => controller.canCombineAsVariants(params?.ids),
|
|
319
|
+
run: (_ctx, params) => outcome(controller.combineAsVariants(params?.ids))
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
...base,
|
|
323
|
+
id: `${prefix}createInstance`,
|
|
324
|
+
label: "Create Instance",
|
|
325
|
+
keywords: ["instance", "insert component", "use component"],
|
|
326
|
+
description: "Places an instance of a component (or a component set\u2019s default variant).",
|
|
327
|
+
params: {
|
|
328
|
+
type: "object",
|
|
329
|
+
properties: {
|
|
330
|
+
componentId: { type: "string", description: "Component or component set id." },
|
|
331
|
+
parentId: { type: "string", description: "Frame to place it in (default: the canvas)." },
|
|
332
|
+
x: { type: "number", description: "X in the parent\u2019s space (default: next to the main)." },
|
|
333
|
+
y: { type: "number", description: "Y in the parent\u2019s space." },
|
|
334
|
+
properties: { type: "object", description: "Variant and component property values.", additionalProperties: true }
|
|
335
|
+
},
|
|
336
|
+
required: ["componentId"]
|
|
337
|
+
},
|
|
338
|
+
enabled: (_ctx, params) => params?.componentId === void 0 ? true : controller.canCreateInstance(params.componentId, params.parentId),
|
|
339
|
+
run: (_ctx, params) => outcome(
|
|
340
|
+
controller.createInstance(params.componentId, {
|
|
341
|
+
...params.parentId !== void 0 ? { parentId: params.parentId } : {},
|
|
342
|
+
...params.x !== void 0 || params.y !== void 0 ? { position: { x: params.x ?? 0, y: params.y ?? 0 } } : {},
|
|
343
|
+
...params.properties ? { properties: params.properties } : {}
|
|
344
|
+
})
|
|
345
|
+
)
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
...base,
|
|
349
|
+
id: `${prefix}detachInstance`,
|
|
350
|
+
label: "Detach Instance",
|
|
351
|
+
keywords: ["unlink", "break instance"],
|
|
352
|
+
description: "Turns the selected instances into plain frames that keep their look.",
|
|
353
|
+
params: IDS_PARAMS,
|
|
354
|
+
shortcut: "Mod+Alt+B",
|
|
355
|
+
enabled: (_ctx, params) => controller.canDetachInstance(params?.ids),
|
|
356
|
+
run: (_ctx, params) => outcome(controller.detachInstance(params?.ids))
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
...base,
|
|
360
|
+
id: `${prefix}resetOverrides`,
|
|
361
|
+
label: "Reset All Changes",
|
|
362
|
+
keywords: ["reset instance", "reset overrides", "revert"],
|
|
363
|
+
description: "Resets the overrides of an instance (or of a layer, or one override group) to its main.",
|
|
364
|
+
params: {
|
|
365
|
+
type: "object",
|
|
366
|
+
properties: {
|
|
367
|
+
id: ID_PARAM,
|
|
368
|
+
group: { type: "string", description: 'One override group to reset, e.g. "data.label" or "shape.fill" (default: all).' }
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
enabled: (_ctx, params) => controller.canResetOverrides(params?.id),
|
|
372
|
+
run: (_ctx, params) => outcome(controller.resetOverrides(params?.id, params?.group))
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
...base,
|
|
376
|
+
id: `${prefix}pushOverrides`,
|
|
377
|
+
label: "Push Changes to Main Component",
|
|
378
|
+
keywords: ["push overrides", "update main component"],
|
|
379
|
+
description: "Copies the instance\u2019s overrides to its main component and every other instance.",
|
|
380
|
+
params: idParams,
|
|
381
|
+
enabled: (_ctx, params) => controller.canPushOverrides(params?.id),
|
|
382
|
+
run: (_ctx, params) => outcome(controller.pushOverrides(params?.id))
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
...base,
|
|
386
|
+
id: `${prefix}goToMainComponent`,
|
|
387
|
+
label: "Go to Main Component",
|
|
388
|
+
keywords: ["main component", "find main", "reveal"],
|
|
389
|
+
description: "Selects the main component of the selected instance.",
|
|
390
|
+
params: idParams,
|
|
391
|
+
enabled: (_ctx, params) => controller.canGoToMainComponent(params?.id),
|
|
392
|
+
run: (_ctx, params) => {
|
|
393
|
+
const main = controller.goToMainComponent(params?.id);
|
|
394
|
+
if (!main) throw new Error("The main component was not found.");
|
|
395
|
+
return { id: main };
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
...base,
|
|
400
|
+
id: `${prefix}swapInstance`,
|
|
401
|
+
label: "Swap Instance\u2026",
|
|
402
|
+
keywords: ["replace instance", "swap component"],
|
|
403
|
+
description: "Makes the selected instances show another component, keeping matching overrides.",
|
|
404
|
+
params: {
|
|
405
|
+
type: "object",
|
|
406
|
+
properties: {
|
|
407
|
+
componentId: { type: "string", description: "Component or component set to swap to." },
|
|
408
|
+
ids: IDS_PARAMS.properties.ids
|
|
409
|
+
},
|
|
410
|
+
required: ["componentId"]
|
|
411
|
+
},
|
|
412
|
+
enabled: (_ctx, params) => controller.canSwapInstance(params?.componentId, params?.ids),
|
|
413
|
+
run: (_ctx, params) => outcome(controller.swapInstance(params.componentId, params?.ids))
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
...base,
|
|
417
|
+
id: `${prefix}setInstanceProperties`,
|
|
418
|
+
label: "Set Instance Properties\u2026",
|
|
419
|
+
keywords: ["variant", "switch variant", "component property", "toggle"],
|
|
420
|
+
description: "Sets variant properties (switching variants) and component property values of the selected instances.",
|
|
421
|
+
params: {
|
|
422
|
+
type: "object",
|
|
423
|
+
properties: {
|
|
424
|
+
properties: { type: "object", description: "Property name \u2192 value (variant value, boolean, text or component id).", additionalProperties: true },
|
|
425
|
+
ids: IDS_PARAMS.properties.ids
|
|
426
|
+
},
|
|
427
|
+
required: ["properties"]
|
|
428
|
+
},
|
|
429
|
+
enabled: (_ctx, params) => controller.canSetInstanceProperties(params?.ids),
|
|
430
|
+
run: (_ctx, params) => outcome(controller.setInstanceProperties(params.properties, params?.ids))
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
...base,
|
|
434
|
+
id: `${prefix}restoreMainComponent`,
|
|
435
|
+
label: "Restore Main Component",
|
|
436
|
+
keywords: ["missing main", "recover component"],
|
|
437
|
+
description: "Turns an instance whose main was deleted back into the main component.",
|
|
438
|
+
params: idParams,
|
|
439
|
+
enabled: (_ctx, params) => controller.canRestoreMainComponent(params?.id),
|
|
440
|
+
run: (_ctx, params) => outcome(controller.restoreMainComponent(params?.id))
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
...base,
|
|
444
|
+
id: `${prefix}listComponents`,
|
|
445
|
+
label: "List Components",
|
|
446
|
+
keywords: ["components", "variants", "assets"],
|
|
447
|
+
description: "Lists the components and component sets (with their variant options).",
|
|
448
|
+
readOnly: true,
|
|
449
|
+
run: () => controller.list()
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
...base,
|
|
453
|
+
id: `${prefix}inspectInstance`,
|
|
454
|
+
label: "Inspect Instance",
|
|
455
|
+
keywords: ["instance", "overrides", "properties"],
|
|
456
|
+
description: "Describes an instance: its main, variant, property values and overrides.",
|
|
457
|
+
params: idParams,
|
|
458
|
+
readOnly: true,
|
|
459
|
+
enabled: (_ctx, params) => controller.inspect(params?.id) ? true : "Select an instance.",
|
|
460
|
+
run: (_ctx, params) => controller.inspect(params?.id) ?? null
|
|
461
|
+
},
|
|
462
|
+
...hasVariantCommands(controller) ? variantCommands(controller, prefix, base) : []
|
|
463
|
+
];
|
|
464
|
+
}
|
|
465
|
+
function createSpreadsheetCommands(controller, options = {}) {
|
|
466
|
+
const prefix = options.prefix ?? "spreadsheet.";
|
|
467
|
+
const scope = options.scope === null ? void 0 : options.scope ?? "spreadsheet";
|
|
468
|
+
const hasRange = () => controller.selectedRange ? true : "Select a range first.";
|
|
469
|
+
const base = { group: "Table", ...scope ? { scope } : {} };
|
|
470
|
+
return [
|
|
471
|
+
{ ...base, id: `${prefix}toggleFilters`, label: "Toggle Filters", keywords: ["filter"], run: () => controller.toggleFilters() },
|
|
472
|
+
{
|
|
473
|
+
...base,
|
|
474
|
+
id: `${prefix}clearFilters`,
|
|
475
|
+
label: "Clear Filters",
|
|
476
|
+
keywords: ["filter", "reset"],
|
|
477
|
+
enabled: () => controller.getFilterState().rules.length > 0 ? true : "No filters to clear.",
|
|
478
|
+
run: () => controller.clearFilters()
|
|
479
|
+
},
|
|
480
|
+
{ ...base, id: `${prefix}unhideAll`, label: "Unhide All Rows and Columns", keywords: ["show", "hidden"], run: () => controller.unhideAll() },
|
|
481
|
+
{ ...base, id: `${prefix}mergeCells`, label: "Merge Cells", keywords: ["combine"], enabled: hasRange, run: () => controller.mergeCells() },
|
|
482
|
+
{ ...base, id: `${prefix}unmergeCells`, label: "Unmerge Cells", keywords: ["split"], enabled: hasRange, run: () => controller.unmergeCells() },
|
|
483
|
+
{ ...base, id: `${prefix}transposeRange`, label: "Transpose Range", keywords: ["rotate", "swap rows columns"], enabled: hasRange, run: () => controller.transposeRange() }
|
|
484
|
+
];
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export {
|
|
488
|
+
DEFAULT_HISTORY_SHORTCUTS,
|
|
489
|
+
createHistoryCommands,
|
|
490
|
+
matchHistoryShortcut,
|
|
491
|
+
createArrangeCommands,
|
|
492
|
+
createShapeCommands,
|
|
493
|
+
hasVariantCommands,
|
|
494
|
+
createComponentCommands,
|
|
495
|
+
createSpreadsheetCommands
|
|
496
|
+
};
|
|
497
|
+
//# sourceMappingURL=chunk-IB3ZHQAX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/builtins.ts"],"sourcesContent":["import type { HistoryState } from '../history/types.js';\nimport type { CanvasArrangeAction } from '../canvas/arrangeShortcuts.js';\nimport type { AlignEdge, DistributeAxis, DistributeMode, ZOrderOperation } from '../canvas/arrange.js';\nimport { DEFAULT_ARRANGE_SHORTCUTS } from '../canvas/arrangeShortcuts.js';\nimport type { CommandParamsSchema, CommandSpec } from './registry.js';\nimport { ShortcutMap, type ShortcutBinding } from './shortcuts.js';\nimport type { KeyboardEventLike, Platform } from './chords.js';\n\n// ---------------------------------------------------------------------------\n// History\n// ---------------------------------------------------------------------------\n\n/** Minimal history surface (`HistoryManager` satisfies it). */\nexport interface HistoryCommandTarget {\n\tundo(): boolean | void;\n\tredo(): boolean | void;\n\tgetState(): Pick<HistoryState, 'canUndo' | 'canRedo'> & Partial<Pick<HistoryState, 'undoName' | 'redoName'>>;\n}\n\n/** Default history bindings: `Mod+Z` undo; `Mod+Shift+Z` redo, plus `Mod+Y` off macOS. */\nexport const DEFAULT_HISTORY_SHORTCUTS: readonly ShortcutBinding[] = [\n\t{ command: 'undo', chord: 'Mod+Z' },\n\t{ command: 'redo', chord: 'Mod+Shift+Z' },\n\t{ command: 'redo', chord: 'Mod+Y', platforms: ['windows', 'linux'] }\n];\n\nexport interface HistoryCommandOptions {\n\t/** Id prefix (default `history.`). */\n\tprefix?: string;\n\tgroup?: string;\n\tscope?: string;\n}\n\n/** `history.undo` / `history.redo` commands for a `HistoryManager` (disabled with a reason when empty). */\nexport function createHistoryCommands(history: HistoryCommandTarget, options: HistoryCommandOptions = {}): CommandSpec[] {\n\tconst prefix = options.prefix ?? 'history.';\n\tconst group = options.group ?? 'Edit';\n\tconst shortcutsOf = (command: 'undo' | 'redo') =>\n\t\tDEFAULT_HISTORY_SHORTCUTS.filter((b) => b.command === command).map(({ command: _c, ...rest }) => rest);\n\treturn [\n\t\t{\n\t\t\tid: `${prefix}undo`,\n\t\t\tlabel: 'Undo',\n\t\t\tgroup,\n\t\t\tkeywords: ['revert', 'back'],\n\t\t\tdescription: 'Reverts the last change.',\n\t\t\tshortcut: shortcutsOf('undo'),\n\t\t\t...(options.scope ? { scope: options.scope } : {}),\n\t\t\tenabled: () => (history.getState().canUndo ? true : 'Nothing to undo.'),\n\t\t\trun: () => {\n\t\t\t\thistory.undo();\n\t\t\t\treturn { undone: true, state: history.getState() };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tid: `${prefix}redo`,\n\t\t\tlabel: 'Redo',\n\t\t\tgroup,\n\t\t\tkeywords: ['repeat', 'forward'],\n\t\t\tdescription: 'Re-applies the last undone change.',\n\t\t\tshortcut: shortcutsOf('redo'),\n\t\t\t...(options.scope ? { scope: options.scope } : {}),\n\t\t\tenabled: () => (history.getState().canRedo ? true : 'Nothing to redo.'),\n\t\t\trun: () => {\n\t\t\t\thistory.redo();\n\t\t\t\treturn { redone: true, state: history.getState() };\n\t\t\t}\n\t\t}\n\t];\n}\n\nlet historyShortcutMap: ShortcutMap | null = null;\n\n/**\n * Resolves a keydown event to `undo` / `redo` with the default history bindings\n * (`Mod` is ⌘ on macOS and Ctrl elsewhere). Events from text inputs and\n * contenteditable elements are ignored unless `allowInEditable`.\n */\nexport function matchHistoryShortcut(\n\tevent: KeyboardEventLike,\n\toptions: { platform?: Platform; allowInEditable?: boolean } = {}\n): 'undo' | 'redo' | null {\n\thistoryShortcutMap ??= new ShortcutMap(DEFAULT_HISTORY_SHORTCUTS);\n\treturn (historyShortcutMap.resolve(event, options)?.command as 'undo' | 'redo' | undefined) ?? null;\n}\n\n// ---------------------------------------------------------------------------\n// Canvas arrange\n// ---------------------------------------------------------------------------\n\n/** Minimal arrange controller surface (`createCanvasArrangeController` satisfies it). */\nexport interface ArrangeCommandTarget {\n\talign(edge: AlignEdge, ids?: Iterable<string>): unknown;\n\tdistribute(axis: DistributeAxis, mode?: DistributeMode, ids?: Iterable<string>): unknown;\n\treorder(operation: ZOrderOperation, ids?: Iterable<string>): unknown;\n\tlock(ids?: Iterable<string>): unknown;\n\tunlock(ids?: Iterable<string>): unknown;\n}\n\nexport interface ArrangeCommandOptions {\n\t/** Id prefix (default `canvas.`). */\n\tprefix?: string;\n\tgroup?: string;\n\t/** Scope of the commands and their shortcuts (default `canvas`). Pass `null` for global. */\n\tscope?: string | null;\n\t/** Current selection, used for enablement (\"Select at least two nodes\"). */\n\tgetSelectedIds?: () => string[];\n\t/** Scene navigation (`nextScene` / `previousScene`); those commands are only added when given. */\n\tscenes?: { next(): unknown; previous(): unknown };\n\t/** Use these bindings instead of `DEFAULT_ARRANGE_SHORTCUTS`. */\n\tbindings?: readonly { action: CanvasArrangeAction; label: string }[];\n}\n\nconst ARRANGE_LABELS: Record<CanvasArrangeAction, string> = {\n\talignLeft: 'Align Left',\n\talignCenter: 'Align Horizontal Centers',\n\talignRight: 'Align Right',\n\talignTop: 'Align Top',\n\talignMiddle: 'Align Vertical Centers',\n\talignBottom: 'Align Bottom',\n\tdistributeHorizontal: 'Distribute Horizontally',\n\tdistributeVertical: 'Distribute Vertically',\n\tlock: 'Lock',\n\tunlock: 'Unlock',\n\tbringForward: 'Bring Forward',\n\tsendBackward: 'Send Backward',\n\tbringToFront: 'Bring to Front',\n\tsendToBack: 'Send to Back',\n\tnextScene: 'Next Scene',\n\tpreviousScene: 'Previous Scene'\n};\n\nconst IDS_PARAMS: CommandParamsSchema = {\n\ttype: 'object',\n\tproperties: {\n\t\tids: {\n\t\t\ttype: 'array',\n\t\t\titems: { type: 'string' },\n\t\t\tdescription: 'Node ids to act on (default: the selection).'\n\t\t}\n\t}\n};\n\n/**\n * Commands for the canvas arrange actions (`canvas.alignLeft`, `canvas.bringToFront`, …)\n * with the default arrange shortcuts. Each accepts `{ ids? }`; enablement checks the\n * named ids, or the selection when none are named.\n */\nexport function createArrangeCommands(controller: ArrangeCommandTarget, options: ArrangeCommandOptions = {}): CommandSpec[] {\n\tconst prefix = options.prefix ?? 'canvas.';\n\tconst group = options.group ?? 'Arrange';\n\tconst scope = options.scope === null ? undefined : options.scope ?? 'canvas';\n\tconst bindings = options.bindings ?? DEFAULT_ARRANGE_SHORTCUTS;\n\tconst count = (params?: { ids?: string[] }) => params?.ids?.length ?? options.getSelectedIds?.().length;\n\tconst needs = (min: number, what: string) => (_: unknown, params?: { ids?: string[] }) => {\n\t\tconst n = count(params);\n\t\tif (n === undefined || n >= min) return true;\n\t\treturn min === 1 ? `Select a ${what} first.` : `Select at least ${min} ${what}s.`;\n\t};\n\n\tconst run: Record<CanvasArrangeAction, (ids?: string[]) => unknown> = {\n\t\talignLeft: (ids) => controller.align('left', ids),\n\t\talignCenter: (ids) => controller.align('center', ids),\n\t\talignRight: (ids) => controller.align('right', ids),\n\t\talignTop: (ids) => controller.align('top', ids),\n\t\talignMiddle: (ids) => controller.align('middle', ids),\n\t\talignBottom: (ids) => controller.align('bottom', ids),\n\t\tdistributeHorizontal: (ids) => controller.distribute('horizontal', 'gaps', ids),\n\t\tdistributeVertical: (ids) => controller.distribute('vertical', 'gaps', ids),\n\t\tlock: (ids) => controller.lock(ids),\n\t\tunlock: (ids) => controller.unlock(ids),\n\t\tbringForward: (ids) => controller.reorder('bringForward', ids),\n\t\tsendBackward: (ids) => controller.reorder('sendBackward', ids),\n\t\tbringToFront: (ids) => controller.reorder('bringToFront', ids),\n\t\tsendToBack: (ids) => controller.reorder('sendToBack', ids),\n\t\tnextScene: () => options.scenes?.next(),\n\t\tpreviousScene: () => options.scenes?.previous()\n\t};\n\n\tconst actions = Object.keys(ARRANGE_LABELS) as CanvasArrangeAction[];\n\treturn actions\n\t\t.filter((action) => options.scenes || (action !== 'nextScene' && action !== 'previousScene'))\n\t\t.map((action): CommandSpec => {\n\t\t\tconst isScene = action === 'nextScene' || action === 'previousScene';\n\t\t\tconst enabled = isScene\n\t\t\t\t? undefined\n\t\t\t\t: action.startsWith('align')\n\t\t\t\t\t? needs(2, 'node')\n\t\t\t\t\t: action.startsWith('distribute')\n\t\t\t\t\t\t? needs(3, 'node')\n\t\t\t\t\t\t: needs(1, 'node');\n\t\t\treturn {\n\t\t\t\tid: `${prefix}${action}`,\n\t\t\t\tlabel: ARRANGE_LABELS[action],\n\t\t\t\tgroup: isScene ? 'Scenes' : group,\n\t\t\t\tkeywords: isScene ? ['scene', 'slide', 'page'] : action.startsWith('align') ? ['align'] : ['arrange', 'layer', 'order'],\n\t\t\t\t...(scope ? { scope } : {}),\n\t\t\t\tshortcut: bindings.filter((b) => b.action === action).map((b) => b.label),\n\t\t\t\t...(isScene ? {} : { params: IDS_PARAMS }),\n\t\t\t\t...(enabled ? { enabled } : {}),\n\t\t\t\trun: (_ctx: unknown, params: { ids?: string[] }) => run[action](params?.ids)\n\t\t\t};\n\t\t});\n}\n\n// ---------------------------------------------------------------------------\n// Canvas shape operations\n// ---------------------------------------------------------------------------\n\n/** Shape operations surface of the arrange controller (`createCanvasArrangeController` satisfies it). */\nexport interface ShapeCommandTarget {\n\tcombineShapes(operation: 'unite' | 'intersect' | 'subtract' | 'exclude' | 'divide', ids?: Iterable<string>): unknown;\n\tcanCombineShapes(ids?: Iterable<string>): boolean;\n\toffsetShapes(distance: number, ids?: Iterable<string>, options?: { join?: 'miter' | 'round' | 'bevel'; miterLimit?: number }): unknown;\n\tcanOffsetShapes(ids?: Iterable<string>): boolean;\n\toutlineStroke(\n\t\tids?: Iterable<string>,\n\t\toptions?: { join?: 'miter' | 'round' | 'bevel'; cap?: 'butt' | 'round' | 'square'; miterLimit?: number }\n\t): unknown;\n\tcanOutlineStroke(ids?: Iterable<string>): boolean;\n}\n\nexport interface ShapeCommandOptions {\n\t/** Id prefix (default `canvas.`). */\n\tprefix?: string;\n\tgroup?: string;\n\t/** Scope (default `canvas`). Pass `null` for global. */\n\tscope?: string | null;\n\t/** Offset distance used when `canvas.offsetPath` is run without one (default 10). */\n\tdefaultOffset?: number;\n}\n\nconst SHAPE_COMMANDS = [\n\t{ op: 'unite', label: 'Unite Shapes', keywords: ['union', 'merge', 'boolean', 'combine'] },\n\t{ op: 'intersect', label: 'Intersect Shapes', keywords: ['intersection', 'boolean', 'combine'] },\n\t{ op: 'subtract', label: 'Subtract Shapes', keywords: ['difference', 'minus front', 'boolean', 'combine'] },\n\t{ op: 'exclude', label: 'Exclude Shapes', keywords: ['xor', 'boolean', 'combine'] },\n\t{ op: 'divide', label: 'Divide Shapes', keywords: ['split', 'pathfinder', 'boolean'] }\n] as const;\n\nconst JOIN_PARAM = { type: 'string', enum: ['miter', 'round', 'bevel'], description: 'Corner style (default miter).' } as const;\n\n/**\n * Palette / context-menu / agent commands for the shape operations: `canvas.unite`,\n * `canvas.intersect`, `canvas.subtract`, `canvas.exclude`, `canvas.divide`,\n * `canvas.offsetPath` (`{ distance, join?, miterLimit?, ids? }`) and `canvas.outlineStroke`\n * (`{ join?, cap?, miterLimit?, ids? }`). Each is one undoable step when the controller has a\n * history; enablement explains why a command cannot run.\n */\nexport function createShapeCommands(controller: ShapeCommandTarget, options: ShapeCommandOptions = {}): CommandSpec[] {\n\tconst prefix = options.prefix ?? 'canvas.';\n\tconst group = options.group ?? 'Shape';\n\tconst scope = options.scope === null ? undefined : options.scope ?? 'canvas';\n\tconst base = { group, ...(scope ? { scope } : {}) };\n\tconst combine = SHAPE_COMMANDS.map(\n\t\t({ op, label, keywords }): CommandSpec => ({\n\t\t\t...base,\n\t\t\tid: `${prefix}${op}`,\n\t\t\tlabel,\n\t\t\tkeywords: [...keywords],\n\t\t\tdescription: `${label.split(' ')[0]}s the selected shapes into a new path (curves are kept).`,\n\t\t\tparams: IDS_PARAMS,\n\t\t\tenabled: (_ctx: unknown, params?: { ids?: string[] }) =>\n\t\t\t\tcontroller.canCombineShapes(params?.ids) ? true : 'Select at least two unlocked shapes.',\n\t\t\trun: (_ctx: unknown, params: { ids?: string[] }) => controller.combineShapes(op, params?.ids)\n\t\t})\n\t);\n\treturn [\n\t\t...combine,\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}offsetPath`,\n\t\t\tlabel: 'Offset Path…',\n\t\t\tkeywords: ['inset', 'outset', 'grow', 'shrink', 'expand', 'contract'],\n\t\t\tdescription: 'Grows (positive distance) or shrinks (negative) the selected shapes.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tdistance: { type: 'number', description: `Offset in canvas units (default ${options.defaultOffset ?? 10}).` },\n\t\t\t\t\tjoin: JOIN_PARAM,\n\t\t\t\t\tmiterLimit: { type: 'number', description: 'Miter limit (default 4).' },\n\t\t\t\t\tids: IDS_PARAMS.properties!.ids\n\t\t\t\t}\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { ids?: string[] }) =>\n\t\t\t\tcontroller.canOffsetShapes(params?.ids) ? true : 'Select an unlocked shape.',\n\t\t\trun: (_ctx: unknown, params: { distance?: number; join?: 'miter' | 'round' | 'bevel'; miterLimit?: number; ids?: string[] }) =>\n\t\t\t\tcontroller.offsetShapes(params?.distance ?? options.defaultOffset ?? 10, params?.ids, {\n\t\t\t\t\t...(params?.join ? { join: params.join } : {}),\n\t\t\t\t\t...(params?.miterLimit !== undefined ? { miterLimit: params.miterLimit } : {})\n\t\t\t\t})\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}outlineStroke`,\n\t\t\tlabel: 'Outline Stroke',\n\t\t\tkeywords: ['expand stroke', 'stroke to path', 'convert stroke'],\n\t\t\tdescription: 'Converts the strokes of the selected shapes to filled shapes.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tjoin: JOIN_PARAM,\n\t\t\t\t\tcap: { type: 'string', enum: ['butt', 'round', 'square'], description: 'Line cap (default butt).' },\n\t\t\t\t\tmiterLimit: { type: 'number', description: 'Miter limit (default 4).' },\n\t\t\t\t\tids: IDS_PARAMS.properties!.ids\n\t\t\t\t}\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { ids?: string[] }) =>\n\t\t\t\tcontroller.canOutlineStroke(params?.ids) ? true : 'Select an unlocked shape with a stroke.',\n\t\t\trun: (\n\t\t\t\t_ctx: unknown,\n\t\t\t\tparams: { join?: 'miter' | 'round' | 'bevel'; cap?: 'butt' | 'round' | 'square'; miterLimit?: number; ids?: string[] }\n\t\t\t) =>\n\t\t\t\tcontroller.outlineStroke(params?.ids, {\n\t\t\t\t\t...(params?.join ? { join: params.join } : {}),\n\t\t\t\t\t...(params?.cap ? { cap: params.cap } : {}),\n\t\t\t\t\t...(params?.miterLimit !== undefined ? { miterLimit: params.miterLimit } : {})\n\t\t\t\t})\n\t\t}\n\t];\n}\n\n// ---------------------------------------------------------------------------\n// Canvas components and instances\n// ---------------------------------------------------------------------------\n\ntype ComponentActionResult = { ok: true; ids: string[] } | { ok: false; reason: string };\n\n/** Components surface of the components controller (`createCanvasComponentsController` satisfies it). */\nexport interface ComponentCommandTarget {\n\tcreateComponent(ids?: Iterable<string>): ComponentActionResult;\n\tcanCreateComponent(ids?: Iterable<string>): true | string;\n\tcombineAsVariants(ids?: Iterable<string>): ComponentActionResult;\n\tcanCombineAsVariants(ids?: Iterable<string>): true | string;\n\tcreateInstance(componentId: string, options?: { parentId?: string; position?: { x: number; y: number }; properties?: Record<string, boolean | string> }): ComponentActionResult;\n\tcanCreateInstance(componentId?: string, parentId?: string): true | string;\n\tdetachInstance(ids?: Iterable<string>): ComponentActionResult;\n\tcanDetachInstance(ids?: Iterable<string>): true | string;\n\tresetOverrides(id?: string, group?: string): ComponentActionResult;\n\tcanResetOverrides(id?: string): true | string;\n\tpushOverrides(id?: string): ComponentActionResult;\n\tcanPushOverrides(id?: string): true | string;\n\tswapInstance(componentId: string, ids?: Iterable<string>): ComponentActionResult;\n\tcanSwapInstance(componentId?: string, ids?: Iterable<string>): true | string;\n\tsetInstanceProperties(properties: Record<string, unknown>, ids?: Iterable<string>): ComponentActionResult;\n\tcanSetInstanceProperties(ids?: Iterable<string>): true | string;\n\trestoreMainComponent(id?: string): ComponentActionResult;\n\tcanRestoreMainComponent(id?: string): true | string;\n\tgoToMainComponent(id?: string): string | undefined;\n\tcanGoToMainComponent(id?: string): true | string;\n\tlist(): unknown;\n\tinspect(id?: string): unknown;\n\t// Variant editing (optional so older targets keep type-checking; the controller has them all).\n\taddVariant?(\n\t\tsetId?: string,\n\t\toptions?: { from?: string; variant?: Record<string, string>; position?: { x: number; y: number }; defaultValue?: string }\n\t): ComponentActionResult;\n\tcanAddVariant?(setId?: string, options?: { from?: string; variant?: Record<string, string> }): true | string;\n\tremoveVariant?(variantId?: string): ComponentActionResult;\n\tcanRemoveVariant?(variantId?: string): true | string;\n\tsetVariantProperties?(values: Record<string, string>, variantId?: string, options?: { defaultValue?: string }): ComponentActionResult;\n\tcanSetVariantProperties?(values?: Record<string, string>, variantId?: string): true | string;\n\trenameVariantProperty?(name: string, newName: string, setId?: string): ComponentActionResult;\n\tcanRenameVariantProperty?(name?: string, newName?: string, setId?: string): true | string;\n\trenameVariantValue?(property: string, value: string, newValue: string, setId?: string): ComponentActionResult;\n\tcanRenameVariantValue?(property?: string, value?: string, newValue?: string, setId?: string): true | string;\n}\n\n/** The variant-editing part of a `ComponentCommandTarget` (present on the components controller). */\ntype VariantCommandTarget = Required<\n\tPick<\n\t\tComponentCommandTarget,\n\t\t| 'addVariant'\n\t\t| 'canAddVariant'\n\t\t| 'removeVariant'\n\t\t| 'canRemoveVariant'\n\t\t| 'setVariantProperties'\n\t\t| 'canSetVariantProperties'\n\t\t| 'renameVariantProperty'\n\t\t| 'canRenameVariantProperty'\n\t\t| 'renameVariantValue'\n\t\t| 'canRenameVariantValue'\n\t>\n>;\n\n/** Whether a command target can edit variants. */\nexport function hasVariantCommands(controller: ComponentCommandTarget): controller is ComponentCommandTarget & VariantCommandTarget {\n\treturn typeof controller.addVariant === 'function' && typeof controller.removeVariant === 'function';\n}\n\nconst SET_ID_PARAM = { type: 'string', description: 'Component set (or one of its variants) to act on (default: the selection’s set).' } as const;\nconst VARIANT_ID_PARAM = { type: 'string', description: 'Variant to act on (default: the first selected variant).' } as const;\nconst VARIANT_VALUES_PARAM = {\n\ttype: 'object',\n\tdescription: 'Variant property → value, e.g. { \"Size\": \"Medium\" }. New property names are added to every variant.',\n\tadditionalProperties: { type: 'string' }\n} as const;\n\nfunction variantCommands(controller: ComponentCommandTarget & VariantCommandTarget, prefix: string, base: Partial<CommandSpec>): CommandSpec[] {\n\treturn [\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}addVariant`,\n\t\t\tlabel: 'Add Variant',\n\t\t\tkeywords: ['variant', 'new variant', 'duplicate variant', 'component set'],\n\t\t\tdescription: 'Adds a variant to a component set by duplicating one (default: the selected or default variant) with new property values.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tsetId: SET_ID_PARAM,\n\t\t\t\t\tfrom: { type: 'string', description: 'Variant to duplicate (default: the selected variant, else the default one).' },\n\t\t\t\t\tvariant: VARIANT_VALUES_PARAM,\n\t\t\t\t\tx: { type: 'number', description: 'X in the set’s space (default: next to the source).' },\n\t\t\t\t\ty: { type: 'number', description: 'Y in the set’s space.' }\n\t\t\t\t}\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { setId?: string; from?: string; variant?: Record<string, string> }) =>\n\t\t\t\tcontroller.canAddVariant(params?.setId, {\n\t\t\t\t\t...(params?.from !== undefined ? { from: params.from } : {}),\n\t\t\t\t\t...(params?.variant ? { variant: params.variant } : {})\n\t\t\t\t}),\n\t\t\trun: (_ctx: unknown, params?: { setId?: string; from?: string; variant?: Record<string, string>; x?: number; y?: number }) =>\n\t\t\t\toutcome(\n\t\t\t\t\tcontroller.addVariant(params?.setId, {\n\t\t\t\t\t\t...(params?.from !== undefined ? { from: params.from } : {}),\n\t\t\t\t\t\t...(params?.variant ? { variant: params.variant } : {}),\n\t\t\t\t\t\t...(params?.x !== undefined || params?.y !== undefined ? { position: { x: params?.x ?? 0, y: params?.y ?? 0 } } : {})\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t} as CommandSpec,\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}removeVariant`,\n\t\t\tlabel: 'Remove Variant',\n\t\t\tkeywords: ['delete variant', 'variant'],\n\t\t\tdescription: 'Removes a variant; its instances switch to the closest remaining variant, keeping overrides.',\n\t\t\tparams: { type: 'object', properties: { id: VARIANT_ID_PARAM } },\n\t\t\tenabled: (_ctx: unknown, params?: { id?: string }) => controller.canRemoveVariant(params?.id),\n\t\t\trun: (_ctx: unknown, params?: { id?: string }) => outcome(controller.removeVariant(params?.id))\n\t\t} as CommandSpec,\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}setVariantProperties`,\n\t\t\tlabel: 'Edit Variant Properties…',\n\t\t\tkeywords: ['rename variant', 'variant values', 'variant'],\n\t\t\tdescription: 'Sets a variant’s property values (refusing a combination another variant has).',\n\t\t\tparams: { type: 'object', properties: { values: VARIANT_VALUES_PARAM, id: VARIANT_ID_PARAM }, required: ['values'] },\n\t\t\tenabled: (_ctx: unknown, params?: { values?: Record<string, string>; id?: string }) => controller.canSetVariantProperties(params?.values, params?.id),\n\t\t\trun: (_ctx: unknown, params: { values: Record<string, string>; id?: string }) => outcome(controller.setVariantProperties(params.values, params?.id))\n\t\t} as CommandSpec,\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}renameVariantProperty`,\n\t\t\tlabel: 'Rename Variant Property…',\n\t\t\tkeywords: ['rename property', 'variant property'],\n\t\t\tdescription: 'Renames a variant property across a component set.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { name: { type: 'string' }, newName: { type: 'string' }, setId: SET_ID_PARAM },\n\t\t\t\trequired: ['name', 'newName']\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { name?: string; newName?: string; setId?: string }) =>\n\t\t\t\tcontroller.canRenameVariantProperty(params?.name, params?.newName, params?.setId),\n\t\t\trun: (_ctx: unknown, params: { name: string; newName: string; setId?: string }) =>\n\t\t\t\toutcome(controller.renameVariantProperty(params.name, params.newName, params?.setId))\n\t\t} as CommandSpec,\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}renameVariantValue`,\n\t\t\tlabel: 'Rename Variant Value…',\n\t\t\tkeywords: ['rename value', 'variant value'],\n\t\t\tdescription: 'Renames a value of a variant property across a component set.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { property: { type: 'string' }, value: { type: 'string' }, newValue: { type: 'string' }, setId: SET_ID_PARAM },\n\t\t\t\trequired: ['property', 'value', 'newValue']\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { property?: string; value?: string; newValue?: string; setId?: string }) =>\n\t\t\t\tcontroller.canRenameVariantValue(params?.property, params?.value, params?.newValue, params?.setId),\n\t\t\trun: (_ctx: unknown, params: { property: string; value: string; newValue: string; setId?: string }) =>\n\t\t\t\toutcome(controller.renameVariantValue(params.property, params.value, params.newValue, params?.setId))\n\t\t} as CommandSpec\n\t];\n}\n\nexport interface ComponentCommandOptions {\n\t/** Id prefix (default `canvas.`). */\n\tprefix?: string;\n\tgroup?: string;\n\t/** Scope (default `canvas`). Pass `null` for global. */\n\tscope?: string | null;\n}\n\nconst outcome = (result: ComponentActionResult) => {\n\tif (!result.ok) throw new Error(result.reason);\n\treturn { ids: result.ids };\n};\n\nconst ID_PARAM = { type: 'string', description: 'Instance (or layer inside one) to act on (default: the first selected node).' } as const;\n\n/**\n * Palette / context-menu / agent commands for components and instances:\n * `canvas.createComponent`, `canvas.combineAsVariants`, `canvas.createInstance`\n * (`{ componentId, parentId?, x?, y?, properties? }`), `canvas.detachInstance`,\n * `canvas.resetOverrides` (`{ id?, group? }`), `canvas.pushOverrides`, `canvas.goToMainComponent`,\n * `canvas.swapInstance` (`{ componentId, ids? }`), `canvas.setInstanceProperties`\n * (`{ properties, ids? }`: variant and component property values), `canvas.restoreMainComponent`,\n * the variant editors `canvas.addVariant` (`{ setId?, from?, variant?, x?, y? }`),\n * `canvas.removeVariant` (`{ id? }`), `canvas.setVariantProperties` (`{ values, id? }`),\n * `canvas.renameVariantProperty` (`{ name, newName, setId? }`) and `canvas.renameVariantValue`\n * (`{ property, value, newValue, setId? }`) when the target has them, and the read-only `canvas.listComponents` / `canvas.inspectInstance`. Each action is one\n * undoable step when the controller has a history; enablement explains why it cannot run.\n */\nexport function createComponentCommands(controller: ComponentCommandTarget, options: ComponentCommandOptions = {}): CommandSpec[] {\n\tconst prefix = options.prefix ?? 'canvas.';\n\tconst group = options.group ?? 'Components';\n\tconst scope = options.scope === null ? undefined : options.scope ?? 'canvas';\n\tconst base = { group, ...(scope ? { scope } : {}) };\n\tconst idParams: CommandParamsSchema = { type: 'object', properties: { id: ID_PARAM } };\n\treturn [\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}createComponent`,\n\t\t\tlabel: 'Create Component',\n\t\t\tkeywords: ['component', 'symbol', 'main component', 'reusable'],\n\t\t\tdescription: 'Turns the selected frame into a main component, or wraps the selection in one.',\n\t\t\tparams: IDS_PARAMS,\n\t\t\tshortcut: 'Mod+Alt+K',\n\t\t\tenabled: (_ctx: unknown, params?: { ids?: string[] }) => controller.canCreateComponent(params?.ids),\n\t\t\trun: (_ctx: unknown, params: { ids?: string[] }) => outcome(controller.createComponent(params?.ids))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}combineAsVariants`,\n\t\t\tlabel: 'Combine as Variants',\n\t\t\tkeywords: ['component set', 'variant', 'variants'],\n\t\t\tdescription: 'Wraps the selected components in a component set.',\n\t\t\tparams: IDS_PARAMS,\n\t\t\tenabled: (_ctx: unknown, params?: { ids?: string[] }) => controller.canCombineAsVariants(params?.ids),\n\t\t\trun: (_ctx: unknown, params: { ids?: string[] }) => outcome(controller.combineAsVariants(params?.ids))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}createInstance`,\n\t\t\tlabel: 'Create Instance',\n\t\t\tkeywords: ['instance', 'insert component', 'use component'],\n\t\t\tdescription: 'Places an instance of a component (or a component set’s default variant).',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tcomponentId: { type: 'string', description: 'Component or component set id.' },\n\t\t\t\t\tparentId: { type: 'string', description: 'Frame to place it in (default: the canvas).' },\n\t\t\t\t\tx: { type: 'number', description: 'X in the parent’s space (default: next to the main).' },\n\t\t\t\t\ty: { type: 'number', description: 'Y in the parent’s space.' },\n\t\t\t\t\tproperties: { type: 'object', description: 'Variant and component property values.', additionalProperties: true }\n\t\t\t\t},\n\t\t\t\trequired: ['componentId']\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { componentId?: string; parentId?: string }) =>\n\t\t\t\tparams?.componentId === undefined ? true : controller.canCreateInstance(params.componentId, params.parentId),\n\t\t\trun: (_ctx: unknown, params: { componentId: string; parentId?: string; x?: number; y?: number; properties?: Record<string, boolean | string> }) =>\n\t\t\t\toutcome(\n\t\t\t\t\tcontroller.createInstance(params.componentId, {\n\t\t\t\t\t\t...(params.parentId !== undefined ? { parentId: params.parentId } : {}),\n\t\t\t\t\t\t...(params.x !== undefined || params.y !== undefined ? { position: { x: params.x ?? 0, y: params.y ?? 0 } } : {}),\n\t\t\t\t\t\t...(params.properties ? { properties: params.properties } : {})\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}detachInstance`,\n\t\t\tlabel: 'Detach Instance',\n\t\t\tkeywords: ['unlink', 'break instance'],\n\t\t\tdescription: 'Turns the selected instances into plain frames that keep their look.',\n\t\t\tparams: IDS_PARAMS,\n\t\t\tshortcut: 'Mod+Alt+B',\n\t\t\tenabled: (_ctx: unknown, params?: { ids?: string[] }) => controller.canDetachInstance(params?.ids),\n\t\t\trun: (_ctx: unknown, params: { ids?: string[] }) => outcome(controller.detachInstance(params?.ids))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}resetOverrides`,\n\t\t\tlabel: 'Reset All Changes',\n\t\t\tkeywords: ['reset instance', 'reset overrides', 'revert'],\n\t\t\tdescription: 'Resets the overrides of an instance (or of a layer, or one override group) to its main.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tid: ID_PARAM,\n\t\t\t\t\tgroup: { type: 'string', description: 'One override group to reset, e.g. \"data.label\" or \"shape.fill\" (default: all).' }\n\t\t\t\t}\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { id?: string }) => controller.canResetOverrides(params?.id),\n\t\t\trun: (_ctx: unknown, params: { id?: string; group?: string }) => outcome(controller.resetOverrides(params?.id, params?.group))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}pushOverrides`,\n\t\t\tlabel: 'Push Changes to Main Component',\n\t\t\tkeywords: ['push overrides', 'update main component'],\n\t\t\tdescription: 'Copies the instance’s overrides to its main component and every other instance.',\n\t\t\tparams: idParams,\n\t\t\tenabled: (_ctx: unknown, params?: { id?: string }) => controller.canPushOverrides(params?.id),\n\t\t\trun: (_ctx: unknown, params: { id?: string }) => outcome(controller.pushOverrides(params?.id))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}goToMainComponent`,\n\t\t\tlabel: 'Go to Main Component',\n\t\t\tkeywords: ['main component', 'find main', 'reveal'],\n\t\t\tdescription: 'Selects the main component of the selected instance.',\n\t\t\tparams: idParams,\n\t\t\tenabled: (_ctx: unknown, params?: { id?: string }) => controller.canGoToMainComponent(params?.id),\n\t\t\trun: (_ctx: unknown, params: { id?: string }) => {\n\t\t\t\tconst main = controller.goToMainComponent(params?.id);\n\t\t\t\tif (!main) throw new Error('The main component was not found.');\n\t\t\t\treturn { id: main };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}swapInstance`,\n\t\t\tlabel: 'Swap Instance…',\n\t\t\tkeywords: ['replace instance', 'swap component'],\n\t\t\tdescription: 'Makes the selected instances show another component, keeping matching overrides.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tcomponentId: { type: 'string', description: 'Component or component set to swap to.' },\n\t\t\t\t\tids: IDS_PARAMS.properties!.ids\n\t\t\t\t},\n\t\t\t\trequired: ['componentId']\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { componentId?: string; ids?: string[] }) => controller.canSwapInstance(params?.componentId, params?.ids),\n\t\t\trun: (_ctx: unknown, params: { componentId: string; ids?: string[] }) => outcome(controller.swapInstance(params.componentId, params?.ids))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}setInstanceProperties`,\n\t\t\tlabel: 'Set Instance Properties…',\n\t\t\tkeywords: ['variant', 'switch variant', 'component property', 'toggle'],\n\t\t\tdescription: 'Sets variant properties (switching variants) and component property values of the selected instances.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tproperties: { type: 'object', description: 'Property name → value (variant value, boolean, text or component id).', additionalProperties: true },\n\t\t\t\t\tids: IDS_PARAMS.properties!.ids\n\t\t\t\t},\n\t\t\t\trequired: ['properties']\n\t\t\t},\n\t\t\tenabled: (_ctx: unknown, params?: { ids?: string[] }) => controller.canSetInstanceProperties(params?.ids),\n\t\t\trun: (_ctx: unknown, params: { properties: Record<string, unknown>; ids?: string[] }) =>\n\t\t\t\toutcome(controller.setInstanceProperties(params.properties, params?.ids))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}restoreMainComponent`,\n\t\t\tlabel: 'Restore Main Component',\n\t\t\tkeywords: ['missing main', 'recover component'],\n\t\t\tdescription: 'Turns an instance whose main was deleted back into the main component.',\n\t\t\tparams: idParams,\n\t\t\tenabled: (_ctx: unknown, params?: { id?: string }) => controller.canRestoreMainComponent(params?.id),\n\t\t\trun: (_ctx: unknown, params: { id?: string }) => outcome(controller.restoreMainComponent(params?.id))\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}listComponents`,\n\t\t\tlabel: 'List Components',\n\t\t\tkeywords: ['components', 'variants', 'assets'],\n\t\t\tdescription: 'Lists the components and component sets (with their variant options).',\n\t\t\treadOnly: true,\n\t\t\trun: () => controller.list()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}inspectInstance`,\n\t\t\tlabel: 'Inspect Instance',\n\t\t\tkeywords: ['instance', 'overrides', 'properties'],\n\t\t\tdescription: 'Describes an instance: its main, variant, property values and overrides.',\n\t\t\tparams: idParams,\n\t\t\treadOnly: true,\n\t\t\tenabled: (_ctx: unknown, params?: { id?: string }) => (controller.inspect(params?.id) ? true : 'Select an instance.'),\n\t\t\trun: (_ctx: unknown, params: { id?: string }) => controller.inspect(params?.id) ?? null\n\t\t},\n\t\t...(hasVariantCommands(controller) ? variantCommands(controller, prefix, base) : [])\n\t];\n}\n\n// ---------------------------------------------------------------------------\n// Spreadsheet table actions\n// ---------------------------------------------------------------------------\n\n/** Spreadsheet controller surface used by `createSpreadsheetCommands`. */\nexport interface SpreadsheetCommandTarget {\n\tselectedRange: unknown;\n\tgetFilterState(): { enabled: boolean; rules: readonly unknown[] };\n\ttoggleFilters(): void;\n\tclearFilters(): void;\n\tunhideAll(): void;\n\tmergeCells(): boolean;\n\tunmergeCells(): boolean;\n\ttransposeRange(): boolean;\n}\n\nexport interface SpreadsheetCommandOptions {\n\t/** Id prefix (default `spreadsheet.`). */\n\tprefix?: string;\n\t/** Scope (default `spreadsheet`). Pass `null` for global. */\n\tscope?: string | null;\n}\n\n/** Palette / agent commands for common spreadsheet table actions (no default shortcuts). */\nexport function createSpreadsheetCommands(\n\tcontroller: SpreadsheetCommandTarget,\n\toptions: SpreadsheetCommandOptions = {}\n): CommandSpec[] {\n\tconst prefix = options.prefix ?? 'spreadsheet.';\n\tconst scope = options.scope === null ? undefined : options.scope ?? 'spreadsheet';\n\tconst hasRange = () => (controller.selectedRange ? true : 'Select a range first.');\n\tconst base = { group: 'Table', ...(scope ? { scope } : {}) };\n\treturn [\n\t\t{ ...base, id: `${prefix}toggleFilters`, label: 'Toggle Filters', keywords: ['filter'], run: () => controller.toggleFilters() },\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}clearFilters`,\n\t\t\tlabel: 'Clear Filters',\n\t\t\tkeywords: ['filter', 'reset'],\n\t\t\tenabled: () => (controller.getFilterState().rules.length > 0 ? true : 'No filters to clear.'),\n\t\t\trun: () => controller.clearFilters()\n\t\t},\n\t\t{ ...base, id: `${prefix}unhideAll`, label: 'Unhide All Rows and Columns', keywords: ['show', 'hidden'], run: () => controller.unhideAll() },\n\t\t{ ...base, id: `${prefix}mergeCells`, label: 'Merge Cells', keywords: ['combine'], enabled: hasRange, run: () => controller.mergeCells() },\n\t\t{ ...base, id: `${prefix}unmergeCells`, label: 'Unmerge Cells', keywords: ['split'], enabled: hasRange, run: () => controller.unmergeCells() },\n\t\t{ ...base, id: `${prefix}transposeRange`, label: 'Transpose Range', keywords: ['rotate', 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