@pixerate/editor 0.227.0 → 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/animation-editor/index.cjs +9 -9
- package/dist/animation-editor/index.js +1 -1
- package/dist/canvas/drawController.d.cts +6 -0
- package/dist/canvas/drawController.d.ts +6 -0
- package/dist/canvas/effects.d.cts +18 -0
- package/dist/canvas/effects.d.ts +18 -0
- package/dist/canvas/gestures.d.cts +87 -0
- package/dist/canvas/gestures.d.ts +87 -0
- package/dist/canvas/index.cjs +56 -9
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +50 -3
- package/dist/{chunk-ABQ2VGUB.cjs → chunk-5MQOBTNP.cjs} +13 -2
- package/dist/{chunk-53GOGBTM.cjs → chunk-CHAWTXBE.cjs} +243 -39
- package/dist/{chunk-C6CMQXMI.cjs → chunk-IGPEBXUD.cjs} +7 -7
- package/dist/{chunk-4PA6YS6W.cjs → chunk-K5GXW5TR.cjs} +14 -14
- package/dist/{chunk-7KZ2HKKC.js → chunk-LPFQHVCO.js} +244 -1
- package/dist/{chunk-56RFHF7O.js → chunk-LPTFDCJO.js} +1 -1
- package/dist/{chunk-4MDWEX44.js → chunk-PB6JV62G.js} +1 -1
- package/dist/{chunk-4EFNS2HV.cjs → chunk-T7QSEKDY.cjs} +248 -5
- package/dist/{chunk-7DZ55AIE.js → chunk-UGYUGZE2.js} +13 -2
- 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/dist/effects/index.cjs +44 -44
- package/dist/effects/index.js +2 -2
- package/dist/image-editor/index.cjs +13 -13
- package/dist/image-editor/index.js +1 -1
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.js +2 -2
- package/dist/vector/index.cjs +6 -6
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +309 -309
- package/dist/video-editor/index.js +3 -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
|
];
|
|
@@ -7,7 +7,7 @@ var _chunkPY4GWSE2cjs = require('./chunk-PY4GWSE2.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk5MQOBTNPcjs = require('./chunk-5MQOBTNP.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkWOFXZ3XUcjs = require('./chunk-WOFXZ3XU.cjs');
|
|
@@ -1307,12 +1307,12 @@ function videoEffectLayerKey(layer, width, height) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
function mixEffectPixels(a, b, k) {
|
|
1309
1309
|
if (k >= 1) return b;
|
|
1310
|
-
const out =
|
|
1310
|
+
const out = _chunk5MQOBTNPcjs.createEffectPixels.call(void 0, a.width, a.height);
|
|
1311
1311
|
for (let i = 0; i < out.data.length; i++) out.data[i] = a.data[i] + (b.data[i] - a.data[i]) * k;
|
|
1312
1312
|
return out;
|
|
1313
1313
|
}
|
|
1314
1314
|
function overEffectPixels(base, top, opacity = 1) {
|
|
1315
|
-
const out =
|
|
1315
|
+
const out = _chunk5MQOBTNPcjs.createEffectPixels.call(void 0, base.width, base.height);
|
|
1316
1316
|
const o = out.data;
|
|
1317
1317
|
const b = base.data;
|
|
1318
1318
|
const t = top.data;
|
|
@@ -1357,7 +1357,7 @@ var VideoEffectsEngine = (_class2 = class {
|
|
|
1357
1357
|
__init10() {this.generation = 0}
|
|
1358
1358
|
|
|
1359
1359
|
constructor(options = {}) {;_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);
|
|
1360
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
1360
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunk5MQOBTNPcjs.EffectsSlot)()));
|
|
1361
1361
|
this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 120));
|
|
1362
1362
|
this.toImage = _nullishCoalesce(options.toImage, () => ( defaultToImage));
|
|
1363
1363
|
this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
|
|
@@ -1499,7 +1499,7 @@ function checkVideoEffectPlace(d, place) {
|
|
|
1499
1499
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
1500
1500
|
const where = place === "clip" ? "on a clip" : place === "transition" ? "as a transition" : "as an effect clip";
|
|
1501
1501
|
const instead = d.uses.includes("transition") ? "set_video_effect_transition" : d.uses.some((u) => VIDEO_EFFECT_PLACES.generator.includes(u)) ? "add_video_effect_clip" : d.uses.some((u) => u === "filter") ? "apply_effect" : null;
|
|
1502
|
-
throw new (0,
|
|
1502
|
+
throw new (0, _chunk5MQOBTNPcjs.EffectUnsupportedError)(
|
|
1503
1503
|
`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be used ${where}, which takes ${allowed.join(" or ")} effects${instead ? `; use ${instead} instead` : ""}. search_effects with use "${allowed[0]}" lists ones that fit.`,
|
|
1504
1504
|
d.id
|
|
1505
1505
|
);
|
|
@@ -1520,12 +1520,12 @@ function checkVideoEffectValues(d, values, options = {}) {
|
|
|
1520
1520
|
else if (type !== "number" && type !== "integer") errors.push({ path: `/${k}`, message: "only number controls can be keyframed." });
|
|
1521
1521
|
else for (const [i, key] of v.keys.entries()) for (const e of _chunkWOFXZ3XUcjs.validateJsonSchema.call(void 0, key.v, schema)) errors.push({ path: `/${k}/keys/${i}/v`, message: e.message });
|
|
1522
1522
|
}
|
|
1523
|
-
for (const e of
|
|
1523
|
+
for (const e of _chunk5MQOBTNPcjs.effectValueErrors.call(void 0, d, plain)) {
|
|
1524
1524
|
const name = e.path.split("/")[1];
|
|
1525
1525
|
const about = name && _optionalChain([d, 'access', _46 => _46.controls, 'access', _47 => _47.properties, 'access', _48 => _48[name], 'optionalAccess', _49 => _49.description]);
|
|
1526
1526
|
errors.push(about ? { path: e.path, message: `${e.message} (${about})` } : e);
|
|
1527
1527
|
}
|
|
1528
|
-
if (errors.length) throw new (0,
|
|
1528
|
+
if (errors.length) throw new (0, _chunk5MQOBTNPcjs.EffectControlError)(d.id, errors);
|
|
1529
1529
|
return { ..._nullishCoalesce(options.base, () => ( d.defaults)), ..._nullishCoalesce(values, () => ( {})) };
|
|
1530
1530
|
}
|
|
1531
1531
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5MQOBTNPcjs = require('./chunk-5MQOBTNP.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkFJ2MSI43cjs = require('./chunk-FJ2MSI43.cjs');
|
|
@@ -26,7 +26,7 @@ function documentErrors(doc, description) {
|
|
|
26
26
|
const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
27
27
|
if (doc.values !== void 0) {
|
|
28
28
|
if (!isRecord(doc.values)) errors.push({ path: "/values", message: "must be an object of control values" });
|
|
29
|
-
else errors.push(...
|
|
29
|
+
else errors.push(..._chunk5MQOBTNPcjs.effectValueErrors.call(void 0, description, doc.values).map((e) => ({ ...e, path: `/values${e.path}` })));
|
|
30
30
|
}
|
|
31
31
|
if (doc.tracks !== void 0) {
|
|
32
32
|
if (!isRecord(doc.tracks)) errors.push({ path: "/tracks", message: "must be an object of keyframe lists" });
|
|
@@ -39,7 +39,7 @@ function documentErrors(doc, description) {
|
|
|
39
39
|
kfs.forEach((kf, i) => {
|
|
40
40
|
if (!isRecord(kf)) return errors.push({ path: `${at}/${i}`, message: "must be a keyframe object" });
|
|
41
41
|
if (typeof kf.time !== "number" || !Number.isFinite(kf.time) || kf.time < 0) errors.push({ path: `${at}/${i}/time`, message: "must be a finite number of ms >= 0" });
|
|
42
|
-
errors.push(...
|
|
42
|
+
errors.push(..._chunk5MQOBTNPcjs.effectValueErrors.call(void 0, description, { [control]: kf.value }).map((e) => ({ ...e, path: `${at}/${i}/value` })));
|
|
43
43
|
if (kf.easing !== void 0 && !_chunkDWJJI6RTcjs.isAnimationEasing.call(void 0, kf.easing)) errors.push({ path: `${at}/${i}/easing`, message: "is not a valid easing" });
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -49,7 +49,7 @@ function documentErrors(doc, description) {
|
|
|
49
49
|
else
|
|
50
50
|
doc.presets.forEach((p, i) => {
|
|
51
51
|
if (!isRecord(p) || typeof p.name !== "string" || !p.name) return errors.push({ path: `/presets/${i}`, message: "must have a name" });
|
|
52
|
-
errors.push(...
|
|
52
|
+
errors.push(..._chunk5MQOBTNPcjs.effectValueErrors.call(void 0, description, p.values).map((e) => ({ ...e, path: `/presets/${i}/values${e.path}` })));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
if (doc.duration !== void 0 && (typeof doc.duration !== "number" || !Number.isFinite(doc.duration) || !(doc.duration > 0))) {
|
|
@@ -170,7 +170,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
170
170
|
if (isDocumentSource(source)) {
|
|
171
171
|
const doc = source.document;
|
|
172
172
|
if (doc.version !== 1 || !doc.effectId) {
|
|
173
|
-
throw new (0,
|
|
173
|
+
throw new (0, _chunk5MQOBTNPcjs.EffectUnsupportedError)("Invalid effect authoring document: version 1 required");
|
|
174
174
|
}
|
|
175
175
|
effectId = doc.effectId;
|
|
176
176
|
initialDoc = doc;
|
|
@@ -178,15 +178,15 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
178
178
|
effectId = source.effectId;
|
|
179
179
|
requestedPreset = source.preset;
|
|
180
180
|
} else {
|
|
181
|
-
throw new (0,
|
|
181
|
+
throw new (0, _chunk5MQOBTNPcjs.EffectUnsupportedError)("Invalid effect authoring source");
|
|
182
182
|
}
|
|
183
183
|
const description = await provider.describe(effectId);
|
|
184
184
|
if (initialDoc) {
|
|
185
185
|
const problems = documentErrors(initialDoc, description);
|
|
186
|
-
if (problems.length) throw new (0,
|
|
186
|
+
if (problems.length) throw new (0, _chunk5MQOBTNPcjs.EffectControlError)(effectId, problems);
|
|
187
187
|
}
|
|
188
188
|
if (description.kind === "motion") {
|
|
189
|
-
throw new (0,
|
|
189
|
+
throw new (0, _chunk5MQOBTNPcjs.EffectUnsupportedError)("Motion effects cannot be authored as pixel effects", effectId);
|
|
190
190
|
}
|
|
191
191
|
let disposed = false;
|
|
192
192
|
let playing = false;
|
|
@@ -207,7 +207,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
207
207
|
const found = description.presets.find((p) => p.name === requestedPreset);
|
|
208
208
|
if (!found) {
|
|
209
209
|
const validNames = description.presets.map((p) => `"${p.name}"`).join(", ");
|
|
210
|
-
throw new (0,
|
|
210
|
+
throw new (0, _chunk5MQOBTNPcjs.EffectUnsupportedError)(
|
|
211
211
|
`Unknown preset "${requestedPreset}" for effect "${effectId}". Valid presets are: ${validNames || "none"}`,
|
|
212
212
|
effectId
|
|
213
213
|
);
|
|
@@ -321,7 +321,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
321
321
|
if (!validNames.includes(name)) {
|
|
322
322
|
return { ok: false, message: `there is no control "${name}"; the controls are ${validNames.join(", ")}` };
|
|
323
323
|
}
|
|
324
|
-
const errors =
|
|
324
|
+
const errors = _chunk5MQOBTNPcjs.effectValueErrors.call(void 0, description, { [name]: value });
|
|
325
325
|
if (errors.length > 0) {
|
|
326
326
|
return { ok: false, message: valueErrorMessage(errors) };
|
|
327
327
|
}
|
|
@@ -391,7 +391,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
391
391
|
if (!validNames.includes(k)) {
|
|
392
392
|
return { ok: false, message: `there is no control "${k}"; the controls are ${validNames.join(", ")}` };
|
|
393
393
|
}
|
|
394
|
-
const errors =
|
|
394
|
+
const errors = _chunk5MQOBTNPcjs.effectValueErrors.call(void 0, description, { [k]: v });
|
|
395
395
|
if (errors.length > 0) {
|
|
396
396
|
return { ok: false, message: valueErrorMessage(errors) };
|
|
397
397
|
}
|
|
@@ -528,7 +528,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
528
528
|
return { ok: false, message: `invalid easing: ${String(easing)}` };
|
|
529
529
|
}
|
|
530
530
|
const targetValue = value !== void 0 ? value : valuesAtTime(time, baseValues, tracks)[name];
|
|
531
|
-
const errors =
|
|
531
|
+
const errors = _chunk5MQOBTNPcjs.effectValueErrors.call(void 0, description, { [name]: targetValue });
|
|
532
532
|
if (errors.length > 0) {
|
|
533
533
|
return { ok: false, message: valueErrorMessage(errors) };
|
|
534
534
|
}
|
|
@@ -705,7 +705,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
705
705
|
},
|
|
706
706
|
async createPreview(opts) {
|
|
707
707
|
if (disposed) {
|
|
708
|
-
throw new (0,
|
|
708
|
+
throw new (0, _chunk5MQOBTNPcjs.EffectDisposedError)(effectId);
|
|
709
709
|
}
|
|
710
710
|
let renderer;
|
|
711
711
|
try {
|
|
@@ -730,7 +730,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
730
730
|
height: renderer.height,
|
|
731
731
|
depth: renderer.depth,
|
|
732
732
|
render: async (req) => {
|
|
733
|
-
if (disposed) throw new (0,
|
|
733
|
+
if (disposed) throw new (0, _chunk5MQOBTNPcjs.EffectDisposedError)(effectId);
|
|
734
734
|
const effectiveValues = _nullishCoalesce(req.values, () => ( valuesAtTime(req.time, baseValues, tracks)));
|
|
735
735
|
const pixels = await renderer.render({
|
|
736
736
|
...req,
|