@pixerate/editor 0.253.0 → 0.254.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/animation-editor/index.cjs +53 -53
- package/dist/animation-editor/index.js +2 -2
- package/dist/canvas/index.cjs +7 -7
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-QKXO6JPP.cjs → chunk-2OQGPEHH.cjs} +14 -14
- package/dist/{chunk-Z3BRH4JK.cjs → chunk-557BDWKO.cjs} +6 -6
- package/dist/{chunk-ZBCT5MEA.cjs → chunk-CBVNCWJM.cjs} +7 -7
- package/dist/{chunk-226QDRO3.js → chunk-DHQPRKXF.js} +1 -1
- package/dist/{chunk-ABL7IWFZ.js → chunk-GBEF2D4P.js} +1 -1
- package/dist/{chunk-ISIO63Q5.cjs → chunk-L2JTLW6B.cjs} +150 -25
- package/dist/{chunk-JA57JIT5.js → chunk-MV7CYFMJ.js} +133 -8
- package/dist/{chunk-5E2Q7ZHI.js → chunk-MWUZCEFT.js} +1 -1
- package/dist/effects/conformance.d.cts +1 -0
- package/dist/effects/conformance.d.ts +1 -0
- package/dist/effects/fake.d.cts +7 -1
- package/dist/effects/fake.d.ts +7 -1
- package/dist/effects/helpers.d.cts +36 -4
- package/dist/effects/helpers.d.ts +36 -4
- package/dist/effects/index.cjs +331 -102
- package/dist/effects/index.js +238 -9
- package/dist/effects/types.d.cts +84 -5
- package/dist/effects/types.d.ts +84 -5
- package/dist/image-editor/index.cjs +15 -15
- 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 +344 -344
- package/dist/video-editor/index.js +4 -4
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ var _chunkDGWOGQJ5cjs = require('../chunk-DGWOGQJ5.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk557BDWKOcjs = require('../chunk-557BDWKO.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -71,7 +71,7 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
var
|
|
74
|
+
var _chunkL2JTLW6Bcjs = require('../chunk-L2JTLW6B.cjs');
|
|
75
75
|
require('../chunk-WOFXZ3XU.cjs');
|
|
76
76
|
require('../chunk-PXDIAYB6.cjs');
|
|
77
77
|
require('../chunk-FQPUF2W2.cjs');
|
|
@@ -506,11 +506,11 @@ function shotLayersShapeProblems(shot, name) {
|
|
|
506
506
|
if (layer.effect === void 0 && layer.subject === void 0) problems.push(`${where} needs an "effect", a "subject" or both.`);
|
|
507
507
|
if (layer.effect !== void 0 && (typeof layer.effect !== "string" || !layer.effect)) problems.push(`${where}: "effect" must be an effect id.`);
|
|
508
508
|
if (layer.subject !== void 0) {
|
|
509
|
-
const kind =
|
|
509
|
+
const kind = _chunk557BDWKOcjs.effectSubjectKind.call(void 0, layer.subject);
|
|
510
510
|
if (kind === "video") problems.push(`${where}: an animation layer cannot play a video; use { "image" }, { "svg" }, { "text" } or { "slot" } (the video editor plays video).`);
|
|
511
511
|
else if (!kind || !String(layer.subject[kind]).trim()) problems.push(`${where}: "subject" must be { "image": url }, { "svg": markup }, { "text": words } or { "slot": name }.`);
|
|
512
512
|
}
|
|
513
|
-
if (layer.role !== void 0 && !
|
|
513
|
+
if (layer.role !== void 0 && !_chunkL2JTLW6Bcjs.EFFECT_LAYER_ROLES.includes(layer.role)) problems.push(`${where}: "role" must be one of ${_chunkL2JTLW6Bcjs.EFFECT_LAYER_ROLES.join(", ")}.`);
|
|
514
514
|
if (layer.rect !== void 0) {
|
|
515
515
|
const r = layer.rect;
|
|
516
516
|
if (!isObject(r) || !["x", "y", "width", "height"].every((k) => isNum(r[k])) || !(r.width > 0 && r.height > 0)) problems.push(`${where}: "rect" must be { x, y, width, height } in artwork units, width and height > 0.`);
|
|
@@ -1131,9 +1131,9 @@ function compileMotionScene(scene) {
|
|
|
1131
1131
|
const start = t;
|
|
1132
1132
|
let cursor = start;
|
|
1133
1133
|
const f = motionShotTimeScale(shot);
|
|
1134
|
-
const moveIn = shot.camera ?
|
|
1135
|
-
const transitionMs = index > 0 && shot.transition ? (_nullishCoalesce(shot.transition.ms, () => (
|
|
1136
|
-
const moveDuring = shot.camera ?
|
|
1134
|
+
const moveIn = shot.camera ? _chunkL2JTLW6Bcjs.cameraMoveParts.call(void 0, shot.camera.in) : void 0;
|
|
1135
|
+
const transitionMs = index > 0 && shot.transition ? (_nullishCoalesce(shot.transition.ms, () => ( _chunkL2JTLW6Bcjs.EFFECT_TRANSITION_MS))) * f : 0;
|
|
1136
|
+
const moveDuring = shot.camera ? _chunkL2JTLW6Bcjs.cameraMoveParts.call(void 0, shot.camera.during) : void 0;
|
|
1137
1137
|
let playsIn = false;
|
|
1138
1138
|
if (shot.camera) {
|
|
1139
1139
|
const framed = motionCameraFramed(shot.camera);
|
|
@@ -1502,7 +1502,7 @@ function motionShotAt(timeline, time) {
|
|
|
1502
1502
|
// src/animation-editor/camera.ts
|
|
1503
1503
|
var windowCache = /* @__PURE__ */ new WeakMap();
|
|
1504
1504
|
function motionShotCameraMove(shot, role) {
|
|
1505
|
-
return
|
|
1505
|
+
return _chunkL2JTLW6Bcjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'optionalAccess', _55 => _55.camera, 'optionalAccess', _56 => _56[role === "transition" ? "in" : "during"]]));
|
|
1506
1506
|
}
|
|
1507
1507
|
var motionCameraStage = (scene) => ({ width: scene.artwork.width, height: scene.artwork.height });
|
|
1508
1508
|
var effectsPlayCamera = (provider) => !!provider && provider.capabilities.supportsCamera === true && typeof provider.cameraView === "function";
|
|
@@ -1524,7 +1524,7 @@ function motionCameraWindows(scene, provider) {
|
|
|
1524
1524
|
const track = timeline.tracks.get(motionTrackKey("", "camera"));
|
|
1525
1525
|
const boxView = (t) => {
|
|
1526
1526
|
const b = trackValue(track, t);
|
|
1527
|
-
return
|
|
1527
|
+
return _chunkL2JTLW6Bcjs.cameraViewOfBox.call(void 0, Array.isArray(b) ? { x: b[0], y: b[1], width: b[2], height: b[3] } : full, stage);
|
|
1528
1528
|
};
|
|
1529
1529
|
const view = (move, values, from, to, u, ms2) => {
|
|
1530
1530
|
try {
|
|
@@ -1540,7 +1540,7 @@ function motionCameraWindows(scene, provider) {
|
|
|
1540
1540
|
const eases = timing.commandsStart > timing.start && !!_optionalChain([track, 'optionalAccess', _57 => _57.some, 'call', _58 => _58((seg) => seg.shot === timing.id)]);
|
|
1541
1541
|
const framed = !!_optionalChain([track, 'optionalAccess', _59 => _59.some, 'call', _60 => _60((seg) => seg.shot === timing.id)]);
|
|
1542
1542
|
if (timing.cameraIn && timing.commandsStart > timing.start) {
|
|
1543
|
-
const spec =
|
|
1543
|
+
const spec = _chunkL2JTLW6Bcjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'access', _61 => _61.camera, 'optionalAccess', _62 => _62.in]));
|
|
1544
1544
|
const from = _nullishCoalesce(carry, () => ( boxView(timing.start)));
|
|
1545
1545
|
const to = boxView(timing.commandsStart);
|
|
1546
1546
|
if (view(spec.move, spec.values, from, to, 0, timing.commandsStart - timing.start)) {
|
|
@@ -1552,7 +1552,7 @@ function motionCameraWindows(scene, provider) {
|
|
|
1552
1552
|
carry = null;
|
|
1553
1553
|
} else if (framed) carry = null;
|
|
1554
1554
|
if (timing.cameraDuring && timing.end > timing.commandsEnd) {
|
|
1555
|
-
const spec =
|
|
1555
|
+
const spec = _chunkL2JTLW6Bcjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'access', _63 => _63.camera, 'optionalAccess', _64 => _64.during]));
|
|
1556
1556
|
const from = _nullishCoalesce(carry, () => ( boxView(timing.commandsEnd)));
|
|
1557
1557
|
const ms2 = timing.end - timing.commandsEnd;
|
|
1558
1558
|
const last = view(spec.move, spec.values, from, from, 1, ms2);
|
|
@@ -1569,8 +1569,8 @@ var lerp = (a, b, t) => a + (b - a) * t;
|
|
|
1569
1569
|
var smooth = (t) => t * t * (3 - 2 * t);
|
|
1570
1570
|
function easeViews(from, to, u, stage) {
|
|
1571
1571
|
const k = smooth(Math.min(1, Math.max(0, u)));
|
|
1572
|
-
const a =
|
|
1573
|
-
const b =
|
|
1572
|
+
const a = _chunkL2JTLW6Bcjs.cameraBoxOfView.call(void 0, from, stage);
|
|
1573
|
+
const b = _chunkL2JTLW6Bcjs.cameraBoxOfView.call(void 0, to, stage);
|
|
1574
1574
|
const zoom = from.zoom * Math.pow(to.zoom / from.zoom, k);
|
|
1575
1575
|
const cx = lerp(a.x + a.width / 2, b.x + b.width / 2, k);
|
|
1576
1576
|
const cy = lerp(a.y + a.height / 2, b.y + b.height / 2, k);
|
|
@@ -1602,7 +1602,7 @@ function motionCameraViewAt(scene, time, provider) {
|
|
|
1602
1602
|
return retaken ? null : before.after;
|
|
1603
1603
|
}
|
|
1604
1604
|
function motionCameraBox(view, scene) {
|
|
1605
|
-
return
|
|
1605
|
+
return _chunkL2JTLW6Bcjs.cameraBoxOfView.call(void 0, view, motionCameraStage(scene));
|
|
1606
1606
|
}
|
|
1607
1607
|
function motionCameraTransform(view, width) {
|
|
1608
1608
|
if (!view || !view.tilt && !view.turn) return "";
|
|
@@ -1643,7 +1643,7 @@ async function checkMotionCameraMoves(scene, provider) {
|
|
|
1643
1643
|
const spec = shot.camera[field];
|
|
1644
1644
|
if (spec === void 0) continue;
|
|
1645
1645
|
try {
|
|
1646
|
-
await
|
|
1646
|
+
await _chunkL2JTLW6Bcjs.resolveCameraMoveSpec.call(void 0, provider, spec, role);
|
|
1647
1647
|
} catch (error) {
|
|
1648
1648
|
const code = error.code === "invalid_values" || /preset/.test(error.message) ? "camera-move-values" : "camera-move-unknown";
|
|
1649
1649
|
issues.push(_chunkDGWOGQJ5cjs.motionIssue.call(void 0, code, error.message, { shot: shot.id }));
|
|
@@ -1671,7 +1671,7 @@ function motionLayerSpans(scene) {
|
|
|
1671
1671
|
(_nullishCoalesce(shot.layers, () => ( []))).forEach((layer, index) => {
|
|
1672
1672
|
const start = at(shotIndex2, layer.from, shots[shotIndex2].start);
|
|
1673
1673
|
const end = Math.max(start, at(shotIndex2, _nullishCoalesce(layer.until, () => ( { shots: 1 })), total));
|
|
1674
|
-
out.push({ layer, shot: shot.id, shotIndex: shotIndex2, index, role:
|
|
1674
|
+
out.push({ layer, shot: shot.id, shotIndex: shotIndex2, index, role: _chunk557BDWKOcjs.effectLayerRole.call(void 0, layer), start, end });
|
|
1675
1675
|
});
|
|
1676
1676
|
});
|
|
1677
1677
|
spanCache.set(scene, out);
|
|
@@ -1766,7 +1766,7 @@ var MotionLayersEngine = (_class = class {
|
|
|
1766
1766
|
__init6() {this.generation = 0}
|
|
1767
1767
|
|
|
1768
1768
|
constructor(options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);
|
|
1769
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
1769
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkL2JTLW6Bcjs.EffectsSlot)()));
|
|
1770
1770
|
this.host = _nullishCoalesce(options.host, () => ( null));
|
|
1771
1771
|
this.frameSvg = options.frameSvg;
|
|
1772
1772
|
this.options = { scale: _nullishCoalesce(options.scale, () => ( 1)), maxSize: _nullishCoalesce(options.maxSize, () => ( 1280)), fps: _nullishCoalesce(options.fps, () => ( 30)), maxEntries: _nullishCoalesce(options.maxEntries, () => ( 160)) };
|
|
@@ -1886,8 +1886,8 @@ var MotionLayersEngine = (_class = class {
|
|
|
1886
1886
|
const effect = layer.effect;
|
|
1887
1887
|
this.request(key, { layer: layer.id }, async () => {
|
|
1888
1888
|
const d = await this.describe(effect);
|
|
1889
|
-
const values =
|
|
1890
|
-
const input =
|
|
1889
|
+
const values = _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, layer.values);
|
|
1890
|
+
const input = _chunk557BDWKOcjs.effectLayerInput.call(void 0, d);
|
|
1891
1891
|
const inputs = layer.subject && input ? { [input]: await this.subjectPixels(layer.subject, size) } : void 0;
|
|
1892
1892
|
const pixels = await this.pool.render(provider, effect, size, { time, values, ...inputs ? { inputs } : {} });
|
|
1893
1893
|
return host.encode(pixels);
|
|
@@ -1908,7 +1908,7 @@ var MotionLayersEngine = (_class = class {
|
|
|
1908
1908
|
const fromKey = `from:${sceneId(scene)}:${active.shot}:${size.width}x${size.height}`;
|
|
1909
1909
|
this.request(key, { transition: active.shot }, async () => {
|
|
1910
1910
|
const d = await this.describe(t.effect);
|
|
1911
|
-
const values =
|
|
1911
|
+
const values = _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, t.values);
|
|
1912
1912
|
frameSvg(scene, Math.max(0, active.start - 1e-3));
|
|
1913
1913
|
frameSvg(scene, at);
|
|
1914
1914
|
await this.idleExcept(key);
|
|
@@ -3325,7 +3325,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3325
3325
|
if (w) return `${w.move}@${w.shot}`;
|
|
3326
3326
|
const seg = camera.find((x) => t >= x.start - 1e-6 && t < Math.max(x.end, x.start + 1e-3));
|
|
3327
3327
|
const shot = seg ? scene.shots.find((x) => x.id === seg.shot) : void 0;
|
|
3328
|
-
const move = _optionalChain([
|
|
3328
|
+
const move = _optionalChain([_chunkL2JTLW6Bcjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'optionalAccess', _155 => _155.camera, 'optionalAccess', _156 => _156.in])), 'optionalAccess', _157 => _157.move]);
|
|
3329
3329
|
return move && shot ? `${move}@${shot.id}` : void 0;
|
|
3330
3330
|
};
|
|
3331
3331
|
const unplayed = scene.shots.filter((x) => x.camera && (x.camera.in !== void 0 || x.camera.during !== void 0) && !windows.some((w) => w.shot === x.id));
|
|
@@ -4429,7 +4429,7 @@ var kindHint = (d) => {
|
|
|
4429
4429
|
function withPreset(d, preset2, values) {
|
|
4430
4430
|
if (preset2 === void 0) return values;
|
|
4431
4431
|
const p = d.presets.find((x) => x.name === preset2);
|
|
4432
|
-
if (!p) throw new (0,
|
|
4432
|
+
if (!p) throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" has no preset "${preset2}"; ${d.presets.length ? `its presets are ${d.presets.map((x) => `"${x.name}"`).join(", ")}` : "it has no presets"}.`, d.id);
|
|
4433
4433
|
return { ...p.values, ..._nullishCoalesce(values, () => ( {})) };
|
|
4434
4434
|
}
|
|
4435
4435
|
async function resolveMotionShotLayer(provider, layer) {
|
|
@@ -4439,27 +4439,27 @@ async function resolveMotionShotLayer(provider, layer) {
|
|
|
4439
4439
|
const { provider: _p, name: _n, ...rest } = layer;
|
|
4440
4440
|
return rest;
|
|
4441
4441
|
}
|
|
4442
|
-
if (!provider) throw new (0,
|
|
4442
|
+
if (!provider) throw new (0, _chunkL2JTLW6Bcjs.NoEffectsProviderError)();
|
|
4443
4443
|
const d = await provider.describe(layer.effect);
|
|
4444
|
-
if (!
|
|
4445
|
-
const input =
|
|
4446
|
-
if (layer.subject && !input) throw new (0,
|
|
4447
|
-
if (!layer.subject && input && _optionalChain([d, 'access', _198 => _198.inputs, 'access', _199 => _199.find, 'call', _200 => _200((i) => i.name === input), 'optionalAccess', _201 => _201.required])) throw new (0,
|
|
4444
|
+
if (!_chunk557BDWKOcjs.effectLayerOffered.call(void 0, d)) throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) cannot be a layer; ${kindHint(d)}. A layer's effect is a generator, filter, overlay or title (search_effects with use "generator", "filter", "overlay" or "title").`, d.id);
|
|
4445
|
+
const input = _chunk557BDWKOcjs.effectLayerInput.call(void 0, d);
|
|
4446
|
+
if (layer.subject && !input) throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) draws its own picture and takes no subject; leave "subject" out, or pick a filter to change the subject.`, d.id);
|
|
4447
|
+
if (!layer.subject && input && _optionalChain([d, 'access', _198 => _198.inputs, 'access', _199 => _199.find, 'call', _200 => _200((i) => i.name === input), 'optionalAccess', _201 => _201.required])) throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) changes a picture; give a "subject": { "image": url }, { "svg": markup }, { "text": words } or { "slot": name }.`, d.id);
|
|
4448
4448
|
const values = withPreset(d, layer.preset, layer.values);
|
|
4449
|
-
|
|
4449
|
+
_chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, values);
|
|
4450
4450
|
const out = { ...layer, provider: provider.id, name: d.name };
|
|
4451
4451
|
if (values && Object.keys(values).length) out.values = values;
|
|
4452
4452
|
else delete out.values;
|
|
4453
4453
|
return out;
|
|
4454
4454
|
}
|
|
4455
4455
|
async function resolveMotionShotTransition(provider, transition) {
|
|
4456
|
-
if (!provider) throw new (0,
|
|
4456
|
+
if (!provider) throw new (0, _chunkL2JTLW6Bcjs.NoEffectsProviderError)();
|
|
4457
4457
|
const d = await provider.describe(transition.effect);
|
|
4458
|
-
if (!d.uses.includes("transition") || d.kind === "camera") throw new (0,
|
|
4458
|
+
if (!d.uses.includes("transition") || d.kind === "camera") throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is not a transition (${kindHint(d)}); search_effects with use "transition" lists them.`, d.id);
|
|
4459
4459
|
if (transition.ms !== void 0 && !(transition.ms > 0 && transition.ms <= 6e4)) throw new Error(`A transition's "ms" is from 1 to 60000; got ${transition.ms}.`);
|
|
4460
4460
|
const values = withPreset(d, transition.preset, transition.values);
|
|
4461
|
-
|
|
4462
|
-
const out = { ...transition, ms: _nullishCoalesce(transition.ms, () => (
|
|
4461
|
+
_chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, values);
|
|
4462
|
+
const out = { ...transition, ms: _nullishCoalesce(transition.ms, () => ( _chunkL2JTLW6Bcjs.EFFECT_TRANSITION_MS)), provider: provider.id, name: d.name };
|
|
4463
4463
|
if (values && Object.keys(values).length) out.values = values;
|
|
4464
4464
|
else delete out.values;
|
|
4465
4465
|
return out;
|
|
@@ -4654,7 +4654,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4654
4654
|
|
|
4655
4655
|
|
|
4656
4656
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
4657
|
-
__init9() {this.effects = new (0,
|
|
4657
|
+
__init9() {this.effects = new (0, _chunkL2JTLW6Bcjs.EffectsSlot)()}
|
|
4658
4658
|
/** Renders shot layer and transition pictures for frames (see `MotionLayersEngine`). */
|
|
4659
4659
|
|
|
4660
4660
|
|
|
@@ -4848,7 +4848,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4848
4848
|
try {
|
|
4849
4849
|
plan = await work();
|
|
4850
4850
|
} catch (error) {
|
|
4851
|
-
if (
|
|
4851
|
+
if (_chunkL2JTLW6Bcjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
4852
4852
|
throw error;
|
|
4853
4853
|
}
|
|
4854
4854
|
const r = this.apply({ op: "replace_scene", scene: plan.scene }, plan.label, { merge });
|
|
@@ -4859,11 +4859,11 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4859
4859
|
}
|
|
4860
4860
|
async describeFor(effect, kinds) {
|
|
4861
4861
|
const provider = this.effects.require();
|
|
4862
|
-
if (!provider.applyVectorEffect) throw new (0,
|
|
4862
|
+
if (!provider.applyVectorEffect) throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`${provider.name} has no vector or motion effects.`);
|
|
4863
4863
|
const d = await provider.describe(effect);
|
|
4864
4864
|
if (!kinds.includes(d.kind)) {
|
|
4865
4865
|
const hint = d.kind === "motion" ? "apply it to nodes with apply_effect" : d.kind === "vector" ? "add it with add_vector_effect" : "it draws pixels, which scenes cannot hold";
|
|
4866
|
-
throw new (0,
|
|
4866
|
+
throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.kind} effect: ${hint}.`, d.id);
|
|
4867
4867
|
}
|
|
4868
4868
|
return d;
|
|
4869
4869
|
}
|
|
@@ -4884,7 +4884,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4884
4884
|
return this.effectEdit(async () => {
|
|
4885
4885
|
this.knownNodes(targets);
|
|
4886
4886
|
const d = await this.describeFor(effect, ["motion"]);
|
|
4887
|
-
const values =
|
|
4887
|
+
const values = _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, options.values);
|
|
4888
4888
|
const instance = _nullishCoalesce(options.instance, () => ( nextMotionEffectInstance(this.scene)));
|
|
4889
4889
|
const motion = await this.effects.require().applyVectorEffect(d.id, { svg: motionArtworkSvg(this.scene.artwork), nodeIds: [...targets] }, values);
|
|
4890
4890
|
const source = { instance, effect: d.id, provider: this.effects.require().id, name: d.name, values };
|
|
@@ -4909,7 +4909,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4909
4909
|
let given = options.values;
|
|
4910
4910
|
let place = options.box;
|
|
4911
4911
|
if (options.path) {
|
|
4912
|
-
const controls =
|
|
4912
|
+
const controls = _chunkL2JTLW6Bcjs.pathControlsOf.call(void 0, d);
|
|
4913
4913
|
if (!controls.length) throw new Error(`"${d.id}" does not draw along a path. Find one that does with search_effects accepts ["path"] (kind vector).`);
|
|
4914
4914
|
const control = _nullishCoalesce(options.control, () => ( (controls.length === 1 ? controls[0] : void 0)));
|
|
4915
4915
|
if (!control) throw new Error(`"${d.id}" has several path controls (${controls.join(", ")}); pass control.`);
|
|
@@ -4929,7 +4929,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4929
4929
|
}
|
|
4930
4930
|
given = { ..._nullishCoalesce(given, () => ( {})), [control]: value };
|
|
4931
4931
|
}
|
|
4932
|
-
const values =
|
|
4932
|
+
const values = _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, given);
|
|
4933
4933
|
const instance = _nullishCoalesce(options.instance, () => ( nextMotionEffectInstance(this.scene)));
|
|
4934
4934
|
const motion = await this.effects.require().applyVectorEffect(d.id, motionArtworkSvg(this.scene.artwork), values);
|
|
4935
4935
|
const source = { instance, effect: d.id, provider: this.effects.require().id, name: d.name, values };
|
|
@@ -4953,7 +4953,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4953
4953
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
4954
4954
|
else throw new Error(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
4955
4955
|
}
|
|
4956
|
-
const merged = { ...base, ...
|
|
4956
|
+
const merged = { ...base, ..._chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
4957
4957
|
const { scene: bare, place } = withoutMotionEffect(this.scene, instance);
|
|
4958
4958
|
const provider = this.effects.require();
|
|
4959
4959
|
const source = { instance, effect: d.id, provider: provider.id, name: d.name, values: merged };
|
|
@@ -5008,12 +5008,12 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5008
5008
|
if (!found) return this.refuse(`There is no shot "${shot}"; the shots are ${this.scene.shots.map((s) => `"${s.id}"`).join(", ") || "none yet"}.`);
|
|
5009
5009
|
let resolved;
|
|
5010
5010
|
try {
|
|
5011
|
-
resolved = await
|
|
5011
|
+
resolved = await _chunkL2JTLW6Bcjs.resolveCameraMoveSpec.call(void 0, this.effects.require(), spec, role);
|
|
5012
5012
|
} catch (error) {
|
|
5013
|
-
if (
|
|
5013
|
+
if (_chunkL2JTLW6Bcjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5014
5014
|
throw error;
|
|
5015
5015
|
}
|
|
5016
|
-
const field =
|
|
5016
|
+
const field = _chunkL2JTLW6Bcjs.cameraMoveField.call(void 0, role);
|
|
5017
5017
|
const current = this.scene.shots.find((s) => s.id === shot);
|
|
5018
5018
|
if (!current) return this.refuse(`Shot "${shot}" was removed while the move was checked.`);
|
|
5019
5019
|
const parts = role === "transition" && resolved.spec.ms === void 0 ? { ...resolved.spec, ms: resolved.description.camera.durationMs } : resolved.spec;
|
|
@@ -5027,7 +5027,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5027
5027
|
clearShotCameraMove(shot, role) {
|
|
5028
5028
|
const found = this.scene.shots.find((s) => s.id === shot);
|
|
5029
5029
|
if (!found) return this.refuse(`There is no shot "${shot}"; the shots are ${this.scene.shots.map((s) => `"${s.id}"`).join(", ") || "none yet"}.`);
|
|
5030
|
-
const field =
|
|
5030
|
+
const field = _chunkL2JTLW6Bcjs.cameraMoveField.call(void 0, role);
|
|
5031
5031
|
if (_optionalChain([found, 'access', _232 => _232.camera, 'optionalAccess', _233 => _233[field]]) === void 0) return this.refuse(`Shot "${shot}" has no camera "${field}" move to clear${_optionalChain([found, 'access', _234 => _234.camera, 'optionalAccess', _235 => _235[field === "in" ? "during" : "in"]]) !== void 0 ? `; it has a "${field === "in" ? "during" : "in"}" move (role ${role === "hold" ? "transition" : "hold"})` : ""}.`);
|
|
5032
5032
|
const rest = { ...found.camera };
|
|
5033
5033
|
delete rest[field];
|
|
@@ -5169,7 +5169,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5169
5169
|
try {
|
|
5170
5170
|
plan = await work();
|
|
5171
5171
|
} catch (error) {
|
|
5172
|
-
if (
|
|
5172
|
+
if (_chunkL2JTLW6Bcjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5173
5173
|
throw error;
|
|
5174
5174
|
}
|
|
5175
5175
|
const id = this.scene.shots[plan.shot].id;
|
|
@@ -5251,7 +5251,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5251
5251
|
const { provider: _p, name: _n, ...given } = transition;
|
|
5252
5252
|
resolved = await resolveMotionShotTransition(this.effects.provider, given);
|
|
5253
5253
|
} catch (error) {
|
|
5254
|
-
if (
|
|
5254
|
+
if (_chunkL2JTLW6Bcjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5255
5255
|
throw error;
|
|
5256
5256
|
}
|
|
5257
5257
|
if (!this.scene.shots.some((s) => s.id === shot)) return this.refuse(`Shot "${shot}" was removed while the transition was checked.`);
|
|
@@ -5283,9 +5283,9 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5283
5283
|
const mode = _nullishCoalesce(options.mode, () => ( "replace"));
|
|
5284
5284
|
let filled;
|
|
5285
5285
|
try {
|
|
5286
|
-
filled = await
|
|
5286
|
+
filled = await _chunk557BDWKOcjs.fillEffectTemplate.call(void 0, this.effects.provider, template, values, options.name ? { name: options.name } : {});
|
|
5287
5287
|
} catch (error) {
|
|
5288
|
-
if (
|
|
5288
|
+
if (_chunkL2JTLW6Bcjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5289
5289
|
throw error;
|
|
5290
5290
|
}
|
|
5291
5291
|
const provider = this.effects.provider.id;
|
|
@@ -6985,7 +6985,7 @@ function animationCameraMoveTools(controller, ctx) {
|
|
|
6985
6985
|
shot: { type: "string", minLength: 1, description: "A shot id from get_animation." },
|
|
6986
6986
|
role: ROLE,
|
|
6987
6987
|
move: { type: "string", minLength: 1, description: "A camera move id of that role from list_camera_moves." },
|
|
6988
|
-
ms: { type: "number", minimum: 0, maximum:
|
|
6988
|
+
ms: { type: "number", minimum: 0, maximum: _chunkL2JTLW6Bcjs.CAMERA_MOVE_MAX_MS, description: `How long a transition takes, ms (0\u2013${_chunkL2JTLW6Bcjs.CAMERA_MOVE_MAX_MS}; default the move's durationMs). Not for a hold, which plays across the shot's hold.` },
|
|
6989
6989
|
preset: { type: "string", minLength: 1, description: "A preset of the move by name, from describe_effect; its values are written out on the shot." },
|
|
6990
6990
|
values: ctx.valuesSchema("Control values over the move's defaults (and the preset's), from describe_effect")
|
|
6991
6991
|
},
|
|
@@ -7058,7 +7058,7 @@ var fields = (ctx) => ({
|
|
|
7058
7058
|
preset: { type: "string", minLength: 1, description: "A preset of the effect by name, from describe_effect; its values are written out on the layer." },
|
|
7059
7059
|
values: ctx.valuesSchema("Control values over the effect's defaults (and the preset's), from describe_effect"),
|
|
7060
7060
|
subject: SUBJECT,
|
|
7061
|
-
role: { type: "string", enum: [...
|
|
7061
|
+
role: { type: "string", enum: [..._chunkL2JTLW6Bcjs.EFFECT_LAYER_ROLES], description: "background: under the artwork; subject: over the artwork; overlay: over everything. Default subject with a rect, else background." },
|
|
7062
7062
|
rect: RECT,
|
|
7063
7063
|
from: TIME("starts", "0: as its shot starts"),
|
|
7064
7064
|
until: TIME("stops", '{ "shots": 1 }: as the next shot starts'),
|
|
@@ -7148,7 +7148,7 @@ function animationShotLayerTools(controller, ctx) {
|
|
|
7148
7148
|
properties: {
|
|
7149
7149
|
shot: { ...SHOT2, description: "A shot id from get_animation (not the first shot)." },
|
|
7150
7150
|
effect: { ...ctx.effectIdSchema(["transition"]), description: "A transition effect id from search_effects (use transition)." },
|
|
7151
|
-
ms: { type: "number", exclusiveMinimum: 0, maximum: 6e4, description: `How long it takes, ms (default ${
|
|
7151
|
+
ms: { type: "number", exclusiveMinimum: 0, maximum: 6e4, description: `How long it takes, ms (default ${_chunkL2JTLW6Bcjs.EFFECT_TRANSITION_MS}).` },
|
|
7152
7152
|
preset: { type: "string", minLength: 1, description: "A preset of the transition by name, from describe_effect." },
|
|
7153
7153
|
values: ctx.valuesSchema("Control values over the transition's defaults (and the preset's)")
|
|
7154
7154
|
},
|
|
@@ -7184,7 +7184,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
7184
7184
|
if (!r.ok) throw new Error(r.error);
|
|
7185
7185
|
return { target, effect: info(r.effect), effects: controller.appliedEffects().filter((e) => e.targets.includes(target)).map(info), ...r.notes.length ? { notes: r.notes } : {} };
|
|
7186
7186
|
};
|
|
7187
|
-
return withAnimationPlayback(
|
|
7187
|
+
return withAnimationPlayback(_chunkL2JTLW6Bcjs.createEffectToolProvider.call(void 0, {
|
|
7188
7188
|
id: _nullishCoalesce(options.id, () => ( "animation-effects")),
|
|
7189
7189
|
namespace: options.namespace,
|
|
7190
7190
|
title: "Animation effects",
|
|
@@ -7219,7 +7219,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
7219
7219
|
extraTools: (ctx) => [
|
|
7220
7220
|
...animationCameraMoveTools(controller, ctx),
|
|
7221
7221
|
...animationShotLayerTools(controller, ctx),
|
|
7222
|
-
...
|
|
7222
|
+
..._chunk557BDWKOcjs.effectTemplateTools.call(void 0,
|
|
7223
7223
|
{
|
|
7224
7224
|
provider: () => controller.effectsProvider,
|
|
7225
7225
|
fillDetails: "mode replace (default) makes a new scene from the template's shots, the size of its stage; mode append adds its shots after the current ones, scaled to the artwork. Each shot keeps its framing and camera moves, its layers and its transition; its title and caption become overlay word layers. Returns { template, mode, shots (new shot ids), layers (new layer ids), openSlots, notes }. Check the result with render_animation_frame.",
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
effectSubjectKind,
|
|
17
17
|
effectTemplateTools,
|
|
18
18
|
fillEffectTemplate
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-DHQPRKXF.js";
|
|
20
20
|
import {
|
|
21
21
|
IDENTITY_MATRIX,
|
|
22
22
|
applyMatrix,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
pathControlsOf,
|
|
72
72
|
resolveCameraMoveSpec,
|
|
73
73
|
resolveEffectValues
|
|
74
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-MV7CYFMJ.js";
|
|
75
75
|
import "../chunk-V2ZCJRDM.js";
|
|
76
76
|
import "../chunk-TXFWZ5ZJ.js";
|
|
77
77
|
import "../chunk-GCVFEPJG.js";
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -223,7 +223,7 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
|
223
223
|
|
|
224
224
|
|
|
225
225
|
|
|
226
|
-
var
|
|
226
|
+
var _chunkL2JTLW6Bcjs = require('../chunk-L2JTLW6B.cjs');
|
|
227
227
|
require('../chunk-WOFXZ3XU.cjs');
|
|
228
228
|
|
|
229
229
|
|
|
@@ -11428,14 +11428,14 @@ function canvasEffectErrorReason(effect, error) {
|
|
|
11428
11428
|
}
|
|
11429
11429
|
var CANVAS_EFFECT_MISSING_PATTERN = "repeating-linear-gradient(45deg, rgba(128,128,128,0.28) 0 2px, transparent 2px 8px)";
|
|
11430
11430
|
function createCanvasEffectsController(options) {
|
|
11431
|
-
const slot = new (0,
|
|
11431
|
+
const slot = new (0, _chunkL2JTLW6Bcjs.EffectsSlot)();
|
|
11432
11432
|
if (options.effects) slot.set(options.effects);
|
|
11433
11433
|
const describe = async (effect, place2) => {
|
|
11434
11434
|
const d = await slot.require().describe(effect);
|
|
11435
11435
|
const allowed = CANVAS_EFFECT_PLACES[place2];
|
|
11436
11436
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
11437
11437
|
const where = place2 === "transition" ? "a scene transition" : place2 === "fill" ? "a fill" : "an overlay";
|
|
11438
|
-
throw new (0,
|
|
11438
|
+
throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be ${where}, which takes ${allowed.join(" or ")} effects; search_effects with use "${allowed[0]}" lists ones that fit.`, d.id);
|
|
11439
11439
|
}
|
|
11440
11440
|
return d;
|
|
11441
11441
|
};
|
|
@@ -11466,7 +11466,7 @@ function createCanvasEffectsController(options) {
|
|
|
11466
11466
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
11467
11467
|
else throw new Error(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
11468
11468
|
}
|
|
11469
|
-
return { ...base, ...
|
|
11469
|
+
return { ...base, ..._chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
11470
11470
|
};
|
|
11471
11471
|
return {
|
|
11472
11472
|
/** The provider slot. */
|
|
@@ -11500,7 +11500,7 @@ function createCanvasEffectsController(options) {
|
|
|
11500
11500
|
const mode = _nullishCoalesce(opts.mode, () => ( "fill"));
|
|
11501
11501
|
const d = await describe(effect, mode);
|
|
11502
11502
|
if (opts.opacity !== void 0 && !(opts.opacity >= 0 && opts.opacity <= 1)) throw new Error("opacity must be from 0 to 1.");
|
|
11503
|
-
const next = { effect: d.id, provider: slot.require().id, name: d.name, values:
|
|
11503
|
+
const next = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, opts.values), mode, ...opts.opacity !== void 0 && opts.opacity !== 1 ? { opacity: opts.opacity } : {} };
|
|
11504
11504
|
commit(`Add effect ${d.name}`, withEffect(nodeId, next));
|
|
11505
11505
|
return next;
|
|
11506
11506
|
},
|
|
@@ -11557,7 +11557,7 @@ function createCanvasEffectsController(options) {
|
|
|
11557
11557
|
const d = await describe(effect, "transition");
|
|
11558
11558
|
const duration = _nullishCoalesce(_nullishCoalesce(opts.duration, () => ( d.duration)), () => ( 600));
|
|
11559
11559
|
if (!(duration > 0)) throw new Error("duration must be a number of ms above 0.");
|
|
11560
|
-
const transition = { effect: d.id, provider: slot.require().id, name: d.name, values:
|
|
11560
|
+
const transition = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, opts.values), duration };
|
|
11561
11561
|
scenes2.update(sceneId, { transition });
|
|
11562
11562
|
return transition;
|
|
11563
11563
|
}
|
|
@@ -11701,7 +11701,7 @@ function createCanvasEffectsToolProvider(controller, options = {}) {
|
|
|
11701
11701
|
const once = (instance) => {
|
|
11702
11702
|
if (instance !== "effect") throw new Error('A shape node has one effect, "effect".');
|
|
11703
11703
|
};
|
|
11704
|
-
return
|
|
11704
|
+
return _chunkL2JTLW6Bcjs.createEffectToolProvider.call(void 0, {
|
|
11705
11705
|
id: _nullishCoalesce(options.id, () => ( "canvas-effects")),
|
|
11706
11706
|
namespace: options.namespace,
|
|
11707
11707
|
title: "Canvas effects",
|
package/dist/canvas/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkL2JTLW6Bcjs = require('./chunk-L2JTLW6B.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkWKPXOGZZcjs = require('./chunk-WKPXOGZZ.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(..._chunkL2JTLW6Bcjs.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(..._chunkL2JTLW6Bcjs.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(..._chunkL2JTLW6Bcjs.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, _chunkL2JTLW6Bcjs.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, _chunkL2JTLW6Bcjs.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, _chunkL2JTLW6Bcjs.EffectControlError)(effectId, problems);
|
|
187
187
|
}
|
|
188
188
|
if (description.kind === "motion") {
|
|
189
|
-
throw new (0,
|
|
189
|
+
throw new (0, _chunkL2JTLW6Bcjs.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, _chunkL2JTLW6Bcjs.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 = _chunkL2JTLW6Bcjs.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 = _chunkL2JTLW6Bcjs.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 = _chunkL2JTLW6Bcjs.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, _chunkL2JTLW6Bcjs.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, _chunkL2JTLW6Bcjs.EffectDisposedError)(effectId);
|
|
734
734
|
const effectiveValues = _nullishCoalesce(req.values, () => ( valuesAtTime(req.time, baseValues, tracks)));
|
|
735
735
|
const pixels = await renderer.render({
|
|
736
736
|
...req,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkL2JTLW6Bcjs = require('./chunk-L2JTLW6B.cjs');
|
|
8
8
|
|
|
9
9
|
// src/effects/templates.ts
|
|
10
10
|
var SLOT_NAME = /^[A-Za-z][\w-]*$/;
|
|
@@ -133,7 +133,7 @@ function searchTemplateSummaries(catalog, options = {}) {
|
|
|
133
133
|
const words = (_nullishCoalesce(options.query, () => ( ""))).toLowerCase().split(/\s+/).filter(Boolean);
|
|
134
134
|
const scored = [];
|
|
135
135
|
for (const t of catalog) {
|
|
136
|
-
if (!
|
|
136
|
+
if (!_chunkL2JTLW6Bcjs.hasEffectTags.call(void 0, t, options.tags)) continue;
|
|
137
137
|
let score = 0;
|
|
138
138
|
const name = t.name.toLowerCase();
|
|
139
139
|
const rest = [t.id, ..._nullishCoalesce(t.tags, () => ( [])), t.description].join(" ").toLowerCase();
|
|
@@ -200,7 +200,7 @@ function checkEffectSequence(sequence, catalog) {
|
|
|
200
200
|
const p = effectSubjectProblem(layer.subject);
|
|
201
201
|
if (p) problems.push(`${where}: ${p}.`);
|
|
202
202
|
}
|
|
203
|
-
if (layer.role !== void 0 && !
|
|
203
|
+
if (layer.role !== void 0 && !_chunkL2JTLW6Bcjs.EFFECT_LAYER_ROLES.includes(layer.role)) problems.push(`${where}: role is one of ${_chunkL2JTLW6Bcjs.EFFECT_LAYER_ROLES.join(", ")}.`);
|
|
204
204
|
if (layer.rect !== void 0 && !isRect(layer.rect)) problems.push(`${where}: rect must be { x, y, width, height } with width and height > 0.`);
|
|
205
205
|
for (const k of ["from", "until"]) if (layer[k] !== void 0 && !isLayerTime(layer[k])) problems.push(`${where}: ${k} is ms \u2265 0 or { shots: n } with n \u2265 1.`);
|
|
206
206
|
if (layer.opacity !== void 0 && !(typeof layer.opacity === "number" && layer.opacity >= 0 && layer.opacity <= 1)) problems.push(`${where}: opacity is 0\u20131.`);
|
|
@@ -235,8 +235,8 @@ function effectSequenceSlots(sequence) {
|
|
|
235
235
|
return [...out];
|
|
236
236
|
}
|
|
237
237
|
async function fillEffectTemplate(provider, id, values = {}, options = {}) {
|
|
238
|
-
if (!provider) throw new (0,
|
|
239
|
-
if (!provider.capabilities.supportsTemplates || !provider.describeTemplate || !provider.instantiateTemplate) throw new (0,
|
|
238
|
+
if (!provider) throw new (0, _chunkL2JTLW6Bcjs.NoEffectsProviderError)();
|
|
239
|
+
if (!provider.capabilities.supportsTemplates || !provider.describeTemplate || !provider.instantiateTemplate) throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`${provider.name} has no sequence templates (capabilities.supportsTemplates is not set).`);
|
|
240
240
|
const template = await provider.describeTemplate(id);
|
|
241
241
|
const errors = checkTemplateValues(template.slots, values);
|
|
242
242
|
if (errors.length) throw new Error(`${errors.join(" ")} describe_template lists what each slot takes.`);
|
|
@@ -256,7 +256,7 @@ function effectSequenceTiming(sequence) {
|
|
|
256
256
|
const leadIns = [];
|
|
257
257
|
let t = 0;
|
|
258
258
|
sequence.shots.forEach((shot, i) => {
|
|
259
|
-
const transition = i > 0 && shot.transition ? _nullishCoalesce(shot.transition.ms, () => (
|
|
259
|
+
const transition = i > 0 && shot.transition ? _nullishCoalesce(shot.transition.ms, () => ( _chunkL2JTLW6Bcjs.EFFECT_TRANSITION_MS)) : 0;
|
|
260
260
|
const move = typeof _optionalChain([shot, 'access', _4 => _4.camera, 'optionalAccess', _5 => _5.in]) === "object" && i > 0 ? _nullishCoalesce(shot.camera.in.ms, () => ( 0)) : 0;
|
|
261
261
|
const lead = Math.max(transition, move);
|
|
262
262
|
starts.push(t);
|