@pixerate/editor 0.227.1 → 0.228.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +3 -3
- package/dist/agent/index.js +2 -2
- package/dist/canvas/drawController.d.cts +6 -0
- package/dist/canvas/drawController.d.ts +6 -0
- package/dist/canvas/gestures.d.cts +87 -0
- package/dist/canvas/gestures.d.ts +87 -0
- package/dist/canvas/index.cjs +30 -2
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +30 -2
- package/dist/{chunk-53GOGBTM.cjs → chunk-CHAWTXBE.cjs} +243 -39
- package/dist/{chunk-7KZ2HKKC.js → chunk-LPFQHVCO.js} +244 -1
- package/dist/{chunk-4EFNS2HV.cjs → chunk-T7QSEKDY.cjs} +248 -5
- package/dist/{chunk-ZPJEH456.js → chunk-XVIK73LS.js} +206 -2
- package/dist/commands/agentTools.d.cts +14 -0
- package/dist/commands/agentTools.d.ts +14 -0
- package/dist/commands/builtins.d.cts +11 -1
- package/dist/commands/builtins.d.ts +11 -1
- package/dist/commands/index.cjs +23 -9
- package/dist/commands/index.js +17 -3
- package/package.json +1 -1
- package/skills/pixerate-agent-tools/SKILL.md +5 -0
- package/skills/pixerate-canvas/SKILL.md +41 -2
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkT7QSEKDYcjs = require('./chunk-T7QSEKDY.cjs');
|
|
5
14
|
|
|
6
15
|
// src/commands/builtins.ts
|
|
7
16
|
var DEFAULT_HISTORY_SHORTCUTS = [
|
|
@@ -46,7 +55,7 @@ function createHistoryCommands(history, options = {}) {
|
|
|
46
55
|
}
|
|
47
56
|
var historyShortcutMap = null;
|
|
48
57
|
function matchHistoryShortcut(event, options = {}) {
|
|
49
|
-
historyShortcutMap ??= new (0,
|
|
58
|
+
historyShortcutMap ??= new (0, _chunkT7QSEKDYcjs.ShortcutMap)(DEFAULT_HISTORY_SHORTCUTS);
|
|
50
59
|
return _nullishCoalesce(_optionalChain([historyShortcutMap, 'access', _2 => _2.resolve, 'call', _3 => _3(event, options), 'optionalAccess', _4 => _4.command]), () => ( null));
|
|
51
60
|
}
|
|
52
61
|
var ARRANGE_LABELS = {
|
|
@@ -81,7 +90,7 @@ function createArrangeCommands(controller, options = {}) {
|
|
|
81
90
|
const prefix = _nullishCoalesce(options.prefix, () => ( "canvas."));
|
|
82
91
|
const group = _nullishCoalesce(options.group, () => ( "Arrange"));
|
|
83
92
|
const scope = options.scope === null ? void 0 : _nullishCoalesce(options.scope, () => ( "canvas"));
|
|
84
|
-
const bindings = _nullishCoalesce(options.bindings, () => (
|
|
93
|
+
const bindings = _nullishCoalesce(options.bindings, () => ( _chunkT7QSEKDYcjs.DEFAULT_ARRANGE_SHORTCUTS));
|
|
85
94
|
const count = (params) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _5 => _5.ids, 'optionalAccess', _6 => _6.length]), () => ( _optionalChain([options, 'access', _7 => _7.getSelectedIds, 'optionalCall', _8 => _8(), 'access', _9 => _9.length])));
|
|
86
95
|
const needs = (min, what) => (_, params) => {
|
|
87
96
|
const n = count(params);
|
|
@@ -370,7 +379,202 @@ function createDrawCommands(target, options = {}) {
|
|
|
370
379
|
params: { type: "object", additionalProperties: false, properties: {} },
|
|
371
380
|
readOnly: true,
|
|
372
381
|
run: async () => ({ brushes: await target.listBrushes() })
|
|
382
|
+
},
|
|
383
|
+
...createGestureCommands(target, base, prefix, options)
|
|
384
|
+
];
|
|
385
|
+
}
|
|
386
|
+
var GESTURE_RECT_PARAM = {
|
|
387
|
+
type: "object",
|
|
388
|
+
additionalProperties: false,
|
|
389
|
+
required: ["x", "y", "width", "height"],
|
|
390
|
+
description: "A box in canvas units (top left x, y and its size), e.g. a node's bounds from get_editor_state or a stroke's `bounds`.",
|
|
391
|
+
properties: {
|
|
392
|
+
x: { type: "number", description: "Left edge, canvas units." },
|
|
393
|
+
y: { type: "number", description: "Top edge, canvas units." },
|
|
394
|
+
width: { type: "number", minimum: 0, description: "Width, canvas units." },
|
|
395
|
+
height: { type: "number", minimum: 0, description: "Height, canvas units." }
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
var GESTURE_NODE_PARAM = {
|
|
399
|
+
type: "object",
|
|
400
|
+
additionalProperties: false,
|
|
401
|
+
required: ["nodeId"],
|
|
402
|
+
description: "A node on the canvas by id; its current box is used, so you need not read its position first.",
|
|
403
|
+
properties: { nodeId: { type: "string", minLength: 1, description: "The node id (from get_editor_state or a result)." } }
|
|
404
|
+
};
|
|
405
|
+
var GESTURE_POINT_PARAM = {
|
|
406
|
+
type: "array",
|
|
407
|
+
minItems: 2,
|
|
408
|
+
maxItems: 2,
|
|
409
|
+
items: { type: "number" },
|
|
410
|
+
description: "A point as [x, y] in canvas units."
|
|
411
|
+
};
|
|
412
|
+
var gestureBox = (what) => ({ description: what, oneOf: [GESTURE_RECT_PARAM, GESTURE_NODE_PARAM] });
|
|
413
|
+
var gestureEnd = (what) => ({ description: what, oneOf: [GESTURE_RECT_PARAM, GESTURE_NODE_PARAM, GESTURE_POINT_PARAM] });
|
|
414
|
+
var gestureBoxes = (what) => ({
|
|
415
|
+
type: "array",
|
|
416
|
+
minItems: 1,
|
|
417
|
+
maxItems: 100,
|
|
418
|
+
items: { oneOf: [GESTURE_RECT_PARAM, GESTURE_NODE_PARAM] },
|
|
419
|
+
description: `${what} Each is a box { x, y, width, height } or a node { nodeId }; the gesture spans the box around all of them.`
|
|
420
|
+
});
|
|
421
|
+
var GESTURE_STYLE_PARAMS = {
|
|
422
|
+
tool: { type: "string", enum: ["pen", "highlighter"], description: "Pen (default: blue, width 3) or highlighter (yellow, width 24, opacity 0.35); sets the defaults below." },
|
|
423
|
+
color: { type: "string", description: "Stroke colour, any CSS colour (default from the tool)." },
|
|
424
|
+
width: { type: "number", exclusiveMinimum: 0, maximum: 2500, description: "Stroke width in canvas units (default from the tool; with a brush, the preset's own size)." },
|
|
425
|
+
opacity: { type: "number", minimum: 0, maximum: 1, description: "Stroke opacity 0..1 (default from the tool)." },
|
|
426
|
+
brush: {
|
|
427
|
+
description: 'Paint the mark with a dry paint brush: a preset id such as "ink-pen", "marker", "pencil-hb" or "brush-pen" (all ids: canvas.listBrushes), or tip settings. Brushed marks get an uneven hand pressure. Omit for a plain vector stroke.',
|
|
428
|
+
oneOf: [{ type: "string", minLength: 1 }, BRUSH_SETTINGS_PARAM]
|
|
429
|
+
},
|
|
430
|
+
seed: { type: "integer", minimum: 0, maximum: 4294967295, description: "Seed for the hand-drawn wobble (default: derived from the other params, so the same request draws the same mark). Change it for a different take." }
|
|
431
|
+
};
|
|
432
|
+
function createGestureCommands(target, base, prefix, options) {
|
|
433
|
+
const box = (value, name) => {
|
|
434
|
+
if (Array.isArray(value)) throw new Error(`${name} must be a box { x, y, width, height } or a node { nodeId }, not a point.`);
|
|
435
|
+
if ("nodeId" in value) {
|
|
436
|
+
if (!target.nodeBounds) throw new Error(`This canvas cannot look up nodes: pass ${name} as a box { x, y, width, height } (a node's bounds from get_editor_state).`);
|
|
437
|
+
const rect = target.nodeBounds(value.nodeId);
|
|
438
|
+
if (!rect) throw new Error(`Unknown node "${value.nodeId}" in ${name}: use an id from get_editor_state.`);
|
|
439
|
+
return rect;
|
|
373
440
|
}
|
|
441
|
+
return value;
|
|
442
|
+
};
|
|
443
|
+
const end = (value, name) => Array.isArray(value) ? [value[0], value[1]] : box(value, name);
|
|
444
|
+
const boxes = (values, name) => _chunkT7QSEKDYcjs.gestureUnion.call(void 0, values.map((v, i) => box(v, `${name}[${i}]`)));
|
|
445
|
+
const gesture = (spec) => {
|
|
446
|
+
const seedOf = (params) => _nullishCoalesce(params.seed, () => ( _chunkT7QSEKDYcjs.gestureSeed.call(void 0, { gesture: spec.name, ...params })));
|
|
447
|
+
const generate = (params) => {
|
|
448
|
+
const seed = seedOf(params);
|
|
449
|
+
return { seed, stroke: spec.make(params, seed) };
|
|
450
|
+
};
|
|
451
|
+
return {
|
|
452
|
+
...base,
|
|
453
|
+
id: `${prefix}${spec.name}`,
|
|
454
|
+
label: spec.label,
|
|
455
|
+
keywords: ["annotate", "mark up", "hand-drawn", ...spec.keywords],
|
|
456
|
+
description: `${spec.description} Drawn as one hand-drawn pen or highlighter stroke node (one undo step), with a seeded wobble. Returns the new node \`id\`, its \`bounds\`, the stored \`brush\` (when brushed) and the \`seed\` used.`,
|
|
457
|
+
params: {
|
|
458
|
+
type: "object",
|
|
459
|
+
additionalProperties: false,
|
|
460
|
+
required: spec.required,
|
|
461
|
+
properties: { ...spec.properties, ...GESTURE_STYLE_PARAMS }
|
|
462
|
+
},
|
|
463
|
+
enabled: () => _optionalChain([options, 'access', _31 => _31.readOnlyReason, 'optionalCall', _32 => _32()]) || true,
|
|
464
|
+
plan: (_ctx, params) => {
|
|
465
|
+
try {
|
|
466
|
+
return planFreehandPlayback(generate(params).stroke.points);
|
|
467
|
+
} catch (e) {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
run: async (_ctx, params) => {
|
|
472
|
+
const { seed, stroke } = generate(params);
|
|
473
|
+
const result = await target.drawStroke({
|
|
474
|
+
points: stroke.points,
|
|
475
|
+
...params.tool ? { tool: params.tool } : {},
|
|
476
|
+
style: {
|
|
477
|
+
...params.color !== void 0 ? { color: params.color } : {},
|
|
478
|
+
...params.width !== void 0 ? { width: params.width } : {},
|
|
479
|
+
...params.width !== void 0 && params.brush !== void 0 ? { brushSize: params.width } : {},
|
|
480
|
+
...params.opacity !== void 0 ? { opacity: params.opacity } : {},
|
|
481
|
+
...params.brush !== void 0 ? { brush: params.brush } : {}
|
|
482
|
+
},
|
|
483
|
+
...params.brush !== void 0 ? { pressure: stroke.pressure } : {}
|
|
484
|
+
});
|
|
485
|
+
return { ...result, seed };
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
return [
|
|
490
|
+
gesture({
|
|
491
|
+
name: "circle",
|
|
492
|
+
label: "Circle Around",
|
|
493
|
+
keywords: ["circle", "ring", "loop", "highlight", "pick", "ellipse"],
|
|
494
|
+
description: "Circles boxes or nodes with a loose, slightly open ellipse that never cuts into them: the way to point out a pick or the thing you are talking about.",
|
|
495
|
+
required: ["around"],
|
|
496
|
+
properties: {
|
|
497
|
+
around: gestureBoxes("What to circle."),
|
|
498
|
+
padding: { type: "number", minimum: 0, maximum: 500, description: "Space between them and the loop, canvas units (default 8)." }
|
|
499
|
+
},
|
|
500
|
+
make: (p, seed) => _chunkT7QSEKDYcjs.circleGesture.call(void 0, boxes(p.around, "around"), seed, { ...p.padding !== void 0 ? { padding: p.padding } : {} })
|
|
501
|
+
}),
|
|
502
|
+
gesture({
|
|
503
|
+
name: "underline",
|
|
504
|
+
label: "Underline",
|
|
505
|
+
keywords: ["underline", "emphasis", "line under", "squiggle"],
|
|
506
|
+
description: "Underlines a box or node with a stroke just below its bottom edge, a little longer or shorter than it: for stressing a line of text or a value.",
|
|
507
|
+
required: ["under"],
|
|
508
|
+
properties: {
|
|
509
|
+
under: gestureBox("What to underline: a box { x, y, width, height } or a node { nodeId }."),
|
|
510
|
+
offset: { type: "number", minimum: 0, maximum: 200, description: "Gap below the bottom edge, canvas units (default 4)." },
|
|
511
|
+
wave: { type: "boolean", description: "A wavy (squiggly) underline instead of a straight one (default false)." }
|
|
512
|
+
},
|
|
513
|
+
make: (p, seed) => _chunkT7QSEKDYcjs.underlineGesture.call(void 0, box(p.under, "under"), seed, { ...p.offset !== void 0 ? { offset: p.offset } : {}, ...p.wave ? { wave: true } : {} })
|
|
514
|
+
}),
|
|
515
|
+
gesture({
|
|
516
|
+
name: "arrow",
|
|
517
|
+
label: "Arrow",
|
|
518
|
+
keywords: ["arrow", "point", "connect", "from", "to", "pointer"],
|
|
519
|
+
description: "Draws a curved arrow with a hand-drawn head from one thing to another: a box or node is reached at its nearest edge, a point exactly. For linking a swatch to where it is used, or pointing from a note to its subject.",
|
|
520
|
+
required: ["from", "to"],
|
|
521
|
+
properties: {
|
|
522
|
+
from: gestureEnd("Where the arrow starts: a box, a node { nodeId } or a point [x, y]."),
|
|
523
|
+
to: gestureEnd("Where the arrow points: a box, a node { nodeId } or a point [x, y]."),
|
|
524
|
+
curve: { type: "number", minimum: -1, maximum: 1, description: "Bend of the shaft \u22121..1: how far its middle bulges, as a fraction of half its length; positive bends to the left of travel, 0 is straight (default: a gentle seeded bend, about 0.1)." },
|
|
525
|
+
gap: { type: "number", minimum: 0, maximum: 200, description: "Space between a box end and the arrow, canvas units (default 6)." }
|
|
526
|
+
},
|
|
527
|
+
make: (p, seed) => _chunkT7QSEKDYcjs.arrowGesture.call(void 0, end(p.from, "from"), end(p.to, "to"), seed, { ...p.curve !== void 0 ? { curve: p.curve } : {}, ...p.gap !== void 0 ? { gap: p.gap } : {} })
|
|
528
|
+
}),
|
|
529
|
+
gesture({
|
|
530
|
+
name: "bracket",
|
|
531
|
+
label: "Bracket",
|
|
532
|
+
keywords: ["bracket", "brace", "group", "curly", "span"],
|
|
533
|
+
description: "Brackets boxes or nodes on one side with a curly or square bracket spanning them end to end: for grouping a set of items or a range of lines, usually with a note beside it.",
|
|
534
|
+
required: ["around", "side"],
|
|
535
|
+
properties: {
|
|
536
|
+
around: gestureBoxes("What to bracket."),
|
|
537
|
+
side: { type: "string", enum: ["left", "right", "top", "bottom"], description: "Which side the bracket goes on." },
|
|
538
|
+
shape: { type: "string", enum: ["curly", "square"], description: "Curly brace (default) or square bracket." },
|
|
539
|
+
padding: { type: "number", minimum: 0, maximum: 500, description: "Gap between them and the bracket, canvas units (default 8)." },
|
|
540
|
+
depth: { type: "number", exclusiveMinimum: 0, maximum: 500, description: "How far the bracket reaches out, canvas units (default: from the span, 6..20)." }
|
|
541
|
+
},
|
|
542
|
+
make: (p, seed) => _chunkT7QSEKDYcjs.bracketGesture.call(void 0, boxes(p.around, "around"), p.side, seed, {
|
|
543
|
+
...p.shape ? { shape: p.shape } : {},
|
|
544
|
+
...p.padding !== void 0 ? { padding: p.padding } : {},
|
|
545
|
+
...p.depth !== void 0 ? { depth: p.depth } : {}
|
|
546
|
+
})
|
|
547
|
+
}),
|
|
548
|
+
gesture({
|
|
549
|
+
name: "strike",
|
|
550
|
+
label: "Strike Through",
|
|
551
|
+
keywords: ["strike", "strikethrough", "cross out", "line through", "delete"],
|
|
552
|
+
description: "Strikes a line through the middle of a box or node, a little past both ends: for text or a value to drop. It only marks it; nothing is deleted.",
|
|
553
|
+
required: ["over"],
|
|
554
|
+
properties: { over: gestureBox("What to strike through: a box { x, y, width, height } or a node { nodeId }.") },
|
|
555
|
+
make: (p, seed) => _chunkT7QSEKDYcjs.strikeGesture.call(void 0, box(p.over, "over"), seed)
|
|
556
|
+
}),
|
|
557
|
+
gesture({
|
|
558
|
+
name: "cross",
|
|
559
|
+
label: "Cross Out",
|
|
560
|
+
keywords: ["cross", "x", "reject", "no", "wrong", "cross out"],
|
|
561
|
+
description: "Crosses out a box or node with an X from corner to corner: for a rejected option. It only marks it; nothing is deleted. One stroke, so the pen runs back over part of the first diagonal before drawing the second.",
|
|
562
|
+
required: ["over"],
|
|
563
|
+
properties: { over: gestureBox("What to cross out: a box { x, y, width, height } or a node { nodeId }.") },
|
|
564
|
+
make: (p, seed) => _chunkT7QSEKDYcjs.crossGesture.call(void 0, box(p.over, "over"), seed)
|
|
565
|
+
}),
|
|
566
|
+
gesture({
|
|
567
|
+
name: "check",
|
|
568
|
+
label: "Check Mark",
|
|
569
|
+
keywords: ["check", "tick", "approve", "yes", "done", "ok"],
|
|
570
|
+
description: "Draws a tick mark in the middle of a box or node, or centred on a point: for an approved option or a done item.",
|
|
571
|
+
required: ["at"],
|
|
572
|
+
properties: {
|
|
573
|
+
at: gestureEnd("Where the tick goes: a box, a node { nodeId } (its centre) or a point [x, y]."),
|
|
574
|
+
size: { type: "number", exclusiveMinimum: 0, maximum: 2e3, description: "Height of the tick, canvas units (default: 60% of the box's smaller side, 12..48; 20 at a point)." }
|
|
575
|
+
},
|
|
576
|
+
make: (p, seed) => _chunkT7QSEKDYcjs.checkGesture.call(void 0, end(p.at, "at"), seed, { ...p.size !== void 0 ? { size: p.size } : {} })
|
|
577
|
+
})
|
|
374
578
|
];
|
|
375
579
|
}
|
|
376
580
|
function hasVariantCommands(controller) {
|
|
@@ -401,15 +605,15 @@ function variantCommands(controller, prefix, base) {
|
|
|
401
605
|
y: { type: "number", description: "Y in the set\u2019s space." }
|
|
402
606
|
}
|
|
403
607
|
},
|
|
404
|
-
enabled: (_ctx, params) => controller.canAddVariant(_optionalChain([params, 'optionalAccess',
|
|
405
|
-
..._optionalChain([params, 'optionalAccess',
|
|
406
|
-
..._optionalChain([params, 'optionalAccess',
|
|
608
|
+
enabled: (_ctx, params) => controller.canAddVariant(_optionalChain([params, 'optionalAccess', _33 => _33.setId]), {
|
|
609
|
+
..._optionalChain([params, 'optionalAccess', _34 => _34.from]) !== void 0 ? { from: params.from } : {},
|
|
610
|
+
..._optionalChain([params, 'optionalAccess', _35 => _35.variant]) ? { variant: params.variant } : {}
|
|
407
611
|
}),
|
|
408
612
|
run: (_ctx, params) => outcome(
|
|
409
|
-
controller.addVariant(_optionalChain([params, 'optionalAccess',
|
|
410
|
-
..._optionalChain([params, 'optionalAccess',
|
|
411
|
-
..._optionalChain([params, 'optionalAccess',
|
|
412
|
-
..._optionalChain([params, 'optionalAccess',
|
|
613
|
+
controller.addVariant(_optionalChain([params, 'optionalAccess', _36 => _36.setId]), {
|
|
614
|
+
..._optionalChain([params, 'optionalAccess', _37 => _37.from]) !== void 0 ? { from: params.from } : {},
|
|
615
|
+
..._optionalChain([params, 'optionalAccess', _38 => _38.variant]) ? { variant: params.variant } : {},
|
|
616
|
+
..._optionalChain([params, 'optionalAccess', _39 => _39.x]) !== void 0 || _optionalChain([params, 'optionalAccess', _40 => _40.y]) !== void 0 ? { position: { x: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _41 => _41.x]), () => ( 0)), y: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _42 => _42.y]), () => ( 0)) } } : {}
|
|
413
617
|
})
|
|
414
618
|
)
|
|
415
619
|
},
|
|
@@ -420,8 +624,8 @@ function variantCommands(controller, prefix, base) {
|
|
|
420
624
|
keywords: ["delete variant", "variant"],
|
|
421
625
|
description: "Removes a variant; its instances switch to the closest remaining variant, keeping overrides.",
|
|
422
626
|
params: { type: "object", properties: { id: VARIANT_ID_PARAM } },
|
|
423
|
-
enabled: (_ctx, params) => controller.canRemoveVariant(_optionalChain([params, 'optionalAccess',
|
|
424
|
-
run: (_ctx, params) => outcome(controller.removeVariant(_optionalChain([params, 'optionalAccess',
|
|
627
|
+
enabled: (_ctx, params) => controller.canRemoveVariant(_optionalChain([params, 'optionalAccess', _43 => _43.id])),
|
|
628
|
+
run: (_ctx, params) => outcome(controller.removeVariant(_optionalChain([params, 'optionalAccess', _44 => _44.id])))
|
|
425
629
|
},
|
|
426
630
|
{
|
|
427
631
|
...base,
|
|
@@ -430,8 +634,8 @@ function variantCommands(controller, prefix, base) {
|
|
|
430
634
|
keywords: ["rename variant", "variant values", "variant"],
|
|
431
635
|
description: "Sets a variant\u2019s property values (refusing a combination another variant has).",
|
|
432
636
|
params: { type: "object", properties: { values: VARIANT_VALUES_PARAM, id: VARIANT_ID_PARAM }, required: ["values"] },
|
|
433
|
-
enabled: (_ctx, params) => controller.canSetVariantProperties(_optionalChain([params, 'optionalAccess',
|
|
434
|
-
run: (_ctx, params) => outcome(controller.setVariantProperties(params.values, _optionalChain([params, 'optionalAccess',
|
|
637
|
+
enabled: (_ctx, params) => controller.canSetVariantProperties(_optionalChain([params, 'optionalAccess', _45 => _45.values]), _optionalChain([params, 'optionalAccess', _46 => _46.id])),
|
|
638
|
+
run: (_ctx, params) => outcome(controller.setVariantProperties(params.values, _optionalChain([params, 'optionalAccess', _47 => _47.id])))
|
|
435
639
|
},
|
|
436
640
|
{
|
|
437
641
|
...base,
|
|
@@ -444,8 +648,8 @@ function variantCommands(controller, prefix, base) {
|
|
|
444
648
|
properties: { name: { type: "string" }, newName: { type: "string" }, setId: SET_ID_PARAM },
|
|
445
649
|
required: ["name", "newName"]
|
|
446
650
|
},
|
|
447
|
-
enabled: (_ctx, params) => controller.canRenameVariantProperty(_optionalChain([params, 'optionalAccess',
|
|
448
|
-
run: (_ctx, params) => outcome(controller.renameVariantProperty(params.name, params.newName, _optionalChain([params, 'optionalAccess',
|
|
651
|
+
enabled: (_ctx, params) => controller.canRenameVariantProperty(_optionalChain([params, 'optionalAccess', _48 => _48.name]), _optionalChain([params, 'optionalAccess', _49 => _49.newName]), _optionalChain([params, 'optionalAccess', _50 => _50.setId])),
|
|
652
|
+
run: (_ctx, params) => outcome(controller.renameVariantProperty(params.name, params.newName, _optionalChain([params, 'optionalAccess', _51 => _51.setId])))
|
|
449
653
|
},
|
|
450
654
|
{
|
|
451
655
|
...base,
|
|
@@ -458,8 +662,8 @@ function variantCommands(controller, prefix, base) {
|
|
|
458
662
|
properties: { property: { type: "string" }, value: { type: "string" }, newValue: { type: "string" }, setId: SET_ID_PARAM },
|
|
459
663
|
required: ["property", "value", "newValue"]
|
|
460
664
|
},
|
|
461
|
-
enabled: (_ctx, params) => controller.canRenameVariantValue(_optionalChain([params, 'optionalAccess',
|
|
462
|
-
run: (_ctx, params) => outcome(controller.renameVariantValue(params.property, params.value, params.newValue, _optionalChain([params, 'optionalAccess',
|
|
665
|
+
enabled: (_ctx, params) => controller.canRenameVariantValue(_optionalChain([params, 'optionalAccess', _52 => _52.property]), _optionalChain([params, 'optionalAccess', _53 => _53.value]), _optionalChain([params, 'optionalAccess', _54 => _54.newValue]), _optionalChain([params, 'optionalAccess', _55 => _55.setId])),
|
|
666
|
+
run: (_ctx, params) => outcome(controller.renameVariantValue(params.property, params.value, params.newValue, _optionalChain([params, 'optionalAccess', _56 => _56.setId])))
|
|
463
667
|
}
|
|
464
668
|
];
|
|
465
669
|
}
|
|
@@ -483,8 +687,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
483
687
|
description: "Turns the selected frame into a main component, or wraps the selection in one.",
|
|
484
688
|
params: IDS_PARAMS,
|
|
485
689
|
shortcut: "Mod+Alt+K",
|
|
486
|
-
enabled: (_ctx, params) => controller.canCreateComponent(_optionalChain([params, 'optionalAccess',
|
|
487
|
-
run: (_ctx, params) => outcome(controller.createComponent(_optionalChain([params, 'optionalAccess',
|
|
690
|
+
enabled: (_ctx, params) => controller.canCreateComponent(_optionalChain([params, 'optionalAccess', _57 => _57.ids])),
|
|
691
|
+
run: (_ctx, params) => outcome(controller.createComponent(_optionalChain([params, 'optionalAccess', _58 => _58.ids])))
|
|
488
692
|
},
|
|
489
693
|
{
|
|
490
694
|
...base,
|
|
@@ -493,8 +697,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
493
697
|
keywords: ["component set", "variant", "variants"],
|
|
494
698
|
description: "Wraps the selected components in a component set.",
|
|
495
699
|
params: IDS_PARAMS,
|
|
496
|
-
enabled: (_ctx, params) => controller.canCombineAsVariants(_optionalChain([params, 'optionalAccess',
|
|
497
|
-
run: (_ctx, params) => outcome(controller.combineAsVariants(_optionalChain([params, 'optionalAccess',
|
|
700
|
+
enabled: (_ctx, params) => controller.canCombineAsVariants(_optionalChain([params, 'optionalAccess', _59 => _59.ids])),
|
|
701
|
+
run: (_ctx, params) => outcome(controller.combineAsVariants(_optionalChain([params, 'optionalAccess', _60 => _60.ids])))
|
|
498
702
|
},
|
|
499
703
|
{
|
|
500
704
|
...base,
|
|
@@ -513,7 +717,7 @@ function createComponentCommands(controller, options = {}) {
|
|
|
513
717
|
},
|
|
514
718
|
required: ["componentId"]
|
|
515
719
|
},
|
|
516
|
-
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess',
|
|
720
|
+
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _61 => _61.componentId]) === void 0 ? true : controller.canCreateInstance(params.componentId, params.parentId),
|
|
517
721
|
run: (_ctx, params) => outcome(
|
|
518
722
|
controller.createInstance(params.componentId, {
|
|
519
723
|
...params.parentId !== void 0 ? { parentId: params.parentId } : {},
|
|
@@ -530,8 +734,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
530
734
|
description: "Turns the selected instances into plain frames that keep their look.",
|
|
531
735
|
params: IDS_PARAMS,
|
|
532
736
|
shortcut: "Mod+Alt+B",
|
|
533
|
-
enabled: (_ctx, params) => controller.canDetachInstance(_optionalChain([params, 'optionalAccess',
|
|
534
|
-
run: (_ctx, params) => outcome(controller.detachInstance(_optionalChain([params, 'optionalAccess',
|
|
737
|
+
enabled: (_ctx, params) => controller.canDetachInstance(_optionalChain([params, 'optionalAccess', _62 => _62.ids])),
|
|
738
|
+
run: (_ctx, params) => outcome(controller.detachInstance(_optionalChain([params, 'optionalAccess', _63 => _63.ids])))
|
|
535
739
|
},
|
|
536
740
|
{
|
|
537
741
|
...base,
|
|
@@ -546,8 +750,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
546
750
|
group: { type: "string", description: 'One override group to reset, e.g. "data.label" or "shape.fill" (default: all).' }
|
|
547
751
|
}
|
|
548
752
|
},
|
|
549
|
-
enabled: (_ctx, params) => controller.canResetOverrides(_optionalChain([params, 'optionalAccess',
|
|
550
|
-
run: (_ctx, params) => outcome(controller.resetOverrides(_optionalChain([params, 'optionalAccess',
|
|
753
|
+
enabled: (_ctx, params) => controller.canResetOverrides(_optionalChain([params, 'optionalAccess', _64 => _64.id])),
|
|
754
|
+
run: (_ctx, params) => outcome(controller.resetOverrides(_optionalChain([params, 'optionalAccess', _65 => _65.id]), _optionalChain([params, 'optionalAccess', _66 => _66.group])))
|
|
551
755
|
},
|
|
552
756
|
{
|
|
553
757
|
...base,
|
|
@@ -556,8 +760,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
556
760
|
keywords: ["push overrides", "update main component"],
|
|
557
761
|
description: "Copies the instance\u2019s overrides to its main component and every other instance.",
|
|
558
762
|
params: idParams,
|
|
559
|
-
enabled: (_ctx, params) => controller.canPushOverrides(_optionalChain([params, 'optionalAccess',
|
|
560
|
-
run: (_ctx, params) => outcome(controller.pushOverrides(_optionalChain([params, 'optionalAccess',
|
|
763
|
+
enabled: (_ctx, params) => controller.canPushOverrides(_optionalChain([params, 'optionalAccess', _67 => _67.id])),
|
|
764
|
+
run: (_ctx, params) => outcome(controller.pushOverrides(_optionalChain([params, 'optionalAccess', _68 => _68.id])))
|
|
561
765
|
},
|
|
562
766
|
{
|
|
563
767
|
...base,
|
|
@@ -566,9 +770,9 @@ function createComponentCommands(controller, options = {}) {
|
|
|
566
770
|
keywords: ["main component", "find main", "reveal"],
|
|
567
771
|
description: "Selects the main component of the selected instance.",
|
|
568
772
|
params: idParams,
|
|
569
|
-
enabled: (_ctx, params) => controller.canGoToMainComponent(_optionalChain([params, 'optionalAccess',
|
|
773
|
+
enabled: (_ctx, params) => controller.canGoToMainComponent(_optionalChain([params, 'optionalAccess', _69 => _69.id])),
|
|
570
774
|
run: (_ctx, params) => {
|
|
571
|
-
const main = controller.goToMainComponent(_optionalChain([params, 'optionalAccess',
|
|
775
|
+
const main = controller.goToMainComponent(_optionalChain([params, 'optionalAccess', _70 => _70.id]));
|
|
572
776
|
if (!main) throw new Error("The main component was not found.");
|
|
573
777
|
return { id: main };
|
|
574
778
|
}
|
|
@@ -587,8 +791,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
587
791
|
},
|
|
588
792
|
required: ["componentId"]
|
|
589
793
|
},
|
|
590
|
-
enabled: (_ctx, params) => controller.canSwapInstance(_optionalChain([params, 'optionalAccess',
|
|
591
|
-
run: (_ctx, params) => outcome(controller.swapInstance(params.componentId, _optionalChain([params, 'optionalAccess',
|
|
794
|
+
enabled: (_ctx, params) => controller.canSwapInstance(_optionalChain([params, 'optionalAccess', _71 => _71.componentId]), _optionalChain([params, 'optionalAccess', _72 => _72.ids])),
|
|
795
|
+
run: (_ctx, params) => outcome(controller.swapInstance(params.componentId, _optionalChain([params, 'optionalAccess', _73 => _73.ids])))
|
|
592
796
|
},
|
|
593
797
|
{
|
|
594
798
|
...base,
|
|
@@ -604,8 +808,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
604
808
|
},
|
|
605
809
|
required: ["properties"]
|
|
606
810
|
},
|
|
607
|
-
enabled: (_ctx, params) => controller.canSetInstanceProperties(_optionalChain([params, 'optionalAccess',
|
|
608
|
-
run: (_ctx, params) => outcome(controller.setInstanceProperties(params.properties, _optionalChain([params, 'optionalAccess',
|
|
811
|
+
enabled: (_ctx, params) => controller.canSetInstanceProperties(_optionalChain([params, 'optionalAccess', _74 => _74.ids])),
|
|
812
|
+
run: (_ctx, params) => outcome(controller.setInstanceProperties(params.properties, _optionalChain([params, 'optionalAccess', _75 => _75.ids])))
|
|
609
813
|
},
|
|
610
814
|
{
|
|
611
815
|
...base,
|
|
@@ -614,8 +818,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
614
818
|
keywords: ["missing main", "recover component"],
|
|
615
819
|
description: "Turns an instance whose main was deleted back into the main component.",
|
|
616
820
|
params: idParams,
|
|
617
|
-
enabled: (_ctx, params) => controller.canRestoreMainComponent(_optionalChain([params, 'optionalAccess',
|
|
618
|
-
run: (_ctx, params) => outcome(controller.restoreMainComponent(_optionalChain([params, 'optionalAccess',
|
|
821
|
+
enabled: (_ctx, params) => controller.canRestoreMainComponent(_optionalChain([params, 'optionalAccess', _76 => _76.id])),
|
|
822
|
+
run: (_ctx, params) => outcome(controller.restoreMainComponent(_optionalChain([params, 'optionalAccess', _77 => _77.id])))
|
|
619
823
|
},
|
|
620
824
|
{
|
|
621
825
|
...base,
|
|
@@ -634,8 +838,8 @@ function createComponentCommands(controller, options = {}) {
|
|
|
634
838
|
description: "Describes an instance: its main, variant, property values and overrides.",
|
|
635
839
|
params: idParams,
|
|
636
840
|
readOnly: true,
|
|
637
|
-
enabled: (_ctx, params) => controller.inspect(_optionalChain([params, 'optionalAccess',
|
|
638
|
-
run: (_ctx, params) => _nullishCoalesce(controller.inspect(_optionalChain([params, 'optionalAccess',
|
|
841
|
+
enabled: (_ctx, params) => controller.inspect(_optionalChain([params, 'optionalAccess', _78 => _78.id])) ? true : "Select an instance.",
|
|
842
|
+
run: (_ctx, params) => _nullishCoalesce(controller.inspect(_optionalChain([params, 'optionalAccess', _79 => _79.id])), () => ( null))
|
|
639
843
|
},
|
|
640
844
|
...hasVariantCommands(controller) ? variantCommands(controller, prefix, base) : []
|
|
641
845
|
];
|