@pixerate/editor 0.232.0 → 0.234.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/compile.d.cts +3 -0
- package/dist/animation-editor/compile.d.ts +3 -0
- package/dist/animation-editor/controller.d.cts +67 -2
- package/dist/animation-editor/controller.d.ts +67 -2
- package/dist/animation-editor/edit.d.cts +1 -1
- package/dist/animation-editor/edit.d.ts +1 -1
- package/dist/animation-editor/evaluate.d.cts +8 -1
- package/dist/animation-editor/evaluate.d.ts +8 -1
- package/dist/animation-editor/index.cjs +1202 -371
- package/dist/animation-editor/index.d.cts +3 -0
- package/dist/animation-editor/index.d.ts +3 -0
- package/dist/animation-editor/index.js +1032 -201
- package/dist/animation-editor/issues.d.cts +28 -0
- package/dist/animation-editor/issues.d.ts +28 -0
- package/dist/animation-editor/layer-edit.d.cts +55 -0
- package/dist/animation-editor/layer-edit.d.ts +55 -0
- package/dist/animation-editor/layer-tools.d.cts +11 -0
- package/dist/animation-editor/layer-tools.d.ts +11 -0
- package/dist/animation-editor/layers.d.cts +166 -0
- package/dist/animation-editor/layers.d.ts +166 -0
- package/dist/animation-editor/parse.d.cts +2 -0
- package/dist/animation-editor/parse.d.ts +2 -0
- package/dist/animation-editor/types.d.cts +44 -1
- package/dist/animation-editor/types.d.ts +44 -1
- package/dist/canvas/editorDocument.d.cts +49 -4
- package/dist/canvas/editorDocument.d.ts +49 -4
- package/dist/canvas/index.cjs +57 -30
- package/dist/canvas/index.js +44 -17
- package/dist/chunk-6RZVFYGJ.cjs +255 -0
- package/dist/{chunk-RG4O6K2A.cjs → chunk-A7PQNIBX.cjs} +14 -14
- package/dist/{chunk-ERJA5CGT.cjs → chunk-DGWOGQJ5.cjs} +8 -1
- package/dist/{chunk-TYCJGFCF.js → chunk-EUKY4KFX.js} +8 -1
- package/dist/chunk-I277KJLQ.js +255 -0
- package/dist/{chunk-2K5TELHV.cjs → chunk-JAOSL334.cjs} +10 -10
- package/dist/{chunk-MUSZYMBX.js → chunk-TEFQISBY.js} +1 -1
- package/dist/{chunk-6QLTUGMO.js → chunk-WDDUPWVG.js} +1 -1
- package/dist/{chunk-A653N65Q.cjs → chunk-ZQIWBJGH.cjs} +7 -7
- package/dist/effects/index.cjs +114 -322
- package/dist/effects/index.js +23 -231
- package/dist/image-editor/index.cjs +16 -16
- package/dist/image-editor/index.js +4 -4
- package/dist/paint-editor/index.cjs +10 -10
- package/dist/paint-editor/index.js +5 -5
- package/dist/vector/index.cjs +6 -6
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +339 -339
- package/dist/video-editor/index.js +5 -5
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +10 -0
- package/skills/pixerate-animation-motion-graphics/SKILL.md +4 -0
- package/skills/pixerate-canvas/SKILL.md +2 -2
- package/skills/pixerate-video-editor/SKILL.md +11 -0
- package/skills/pixerate-video-montage/SKILL.md +2 -0
- package/dist/{chunk-PQYDJ2AV.js → chunk-SIK3LT6M.js} +16 -16
package/dist/effects/index.js
CHANGED
|
@@ -3,7 +3,28 @@ import {
|
|
|
3
3
|
} from "../chunk-N4ZXW3WB.js";
|
|
4
4
|
import {
|
|
5
5
|
createEffectAuthoringSession
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-TEFQISBY.js";
|
|
7
|
+
import {
|
|
8
|
+
EFFECT_LAYER_USES,
|
|
9
|
+
EFFECT_SEQUENCE_NAME,
|
|
10
|
+
checkEffectSequence,
|
|
11
|
+
checkTemplateValues,
|
|
12
|
+
effectLayerInput,
|
|
13
|
+
effectLayerOffered,
|
|
14
|
+
effectLayerRole,
|
|
15
|
+
effectSequenceEffects,
|
|
16
|
+
effectSequenceSlots,
|
|
17
|
+
effectSubjectKind,
|
|
18
|
+
effectSubjectProblem,
|
|
19
|
+
isSubjectTemplateSlot,
|
|
20
|
+
searchTemplateSummaries,
|
|
21
|
+
templateDefaultValues,
|
|
22
|
+
templateSlotSchema,
|
|
23
|
+
templateSlotSummary,
|
|
24
|
+
templateSlotTakes,
|
|
25
|
+
templateValueProblem,
|
|
26
|
+
templateValuesSchema
|
|
27
|
+
} from "../chunk-I277KJLQ.js";
|
|
7
28
|
import {
|
|
8
29
|
EffectRendererPool
|
|
9
30
|
} from "../chunk-EHLOCVWB.js";
|
|
@@ -50,242 +71,13 @@ import {
|
|
|
50
71
|
sampleEffectCameraMove,
|
|
51
72
|
searchEffectSummaries,
|
|
52
73
|
srgbToLinear
|
|
53
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-SIK3LT6M.js";
|
|
54
75
|
import "../chunk-V2ZCJRDM.js";
|
|
55
76
|
import "../chunk-RNSANXPT.js";
|
|
56
77
|
import {
|
|
57
78
|
ANIMATION_EASING_PRESETS
|
|
58
79
|
} from "../chunk-5UJHB3BW.js";
|
|
59
80
|
|
|
60
|
-
// src/effects/templates.ts
|
|
61
|
-
var SLOT_NAME = /^[A-Za-z][\w-]*$/;
|
|
62
|
-
var COLOR = /^#[0-9a-fA-F]{6}$/;
|
|
63
|
-
var EFFECT_SEQUENCE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
64
|
-
var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
65
|
-
var isSubjectTemplateSlot = (slot) => slot.type === "image" || slot.type === "video" || slot.type === "svg";
|
|
66
|
-
function effectSubjectKind(subject) {
|
|
67
|
-
if (!isObject(subject)) return void 0;
|
|
68
|
-
for (const k of ["slot", "image", "video", "svg", "text"]) if (typeof subject[k] === "string") return k;
|
|
69
|
-
return void 0;
|
|
70
|
-
}
|
|
71
|
-
var typeName = (value) => value === null ? "null" : Array.isArray(value) ? "a list" : typeof value === "object" ? "an object" : typeof value === "string" ? `the words ${JSON.stringify(value.length > 40 ? `${value.slice(0, 40)}\u2026` : value)}` : `${typeof value === "number" ? "the number" : "the value"} ${String(value)}`;
|
|
72
|
-
function range(slot) {
|
|
73
|
-
const whole = slot.integer ? "whole number" : "number";
|
|
74
|
-
if (slot.min !== void 0 && slot.max !== void 0) return `a ${whole} from ${slot.min} to ${slot.max}`;
|
|
75
|
-
if (slot.min !== void 0) return `a ${whole} of at least ${slot.min}`;
|
|
76
|
-
if (slot.max !== void 0) return `a ${whole} of at most ${slot.max}`;
|
|
77
|
-
return `a ${whole}`;
|
|
78
|
-
}
|
|
79
|
-
function templateSlotTakes(slot) {
|
|
80
|
-
switch (slot.type) {
|
|
81
|
-
case "text":
|
|
82
|
-
return `words${slot.maxLength !== void 0 ? ` (up to ${slot.maxLength} characters)` : ""}`;
|
|
83
|
-
case "color":
|
|
84
|
-
return `a colour written #RRGGBB, like "${slot.default}"`;
|
|
85
|
-
case "number":
|
|
86
|
-
return range(slot);
|
|
87
|
-
case "video":
|
|
88
|
-
return "a video URL";
|
|
89
|
-
case "svg":
|
|
90
|
-
return "SVG markup or an SVG URL";
|
|
91
|
-
default:
|
|
92
|
-
return "a picture: a URL, a data: URL or <svg> markup";
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function templateValueProblem(slot, value) {
|
|
96
|
-
const no = (extra = "") => `Slot "${slot.name}" takes ${templateSlotTakes(slot)}${extra}, not ${typeName(value)}.`;
|
|
97
|
-
switch (slot.type) {
|
|
98
|
-
case "text":
|
|
99
|
-
if (typeof value !== "string") return no();
|
|
100
|
-
if (slot.maxLength !== void 0 && value.length > slot.maxLength) return `Slot "${slot.name}" takes up to ${slot.maxLength} characters; the value has ${value.length}. Shorten it.`;
|
|
101
|
-
return void 0;
|
|
102
|
-
case "color":
|
|
103
|
-
return typeof value === "string" && COLOR.test(value) ? void 0 : no();
|
|
104
|
-
case "number":
|
|
105
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return no();
|
|
106
|
-
if (slot.integer && !Number.isInteger(value)) return `Slot "${slot.name}" takes ${range(slot)}; ${value} is not whole.`;
|
|
107
|
-
if (slot.min !== void 0 && value < slot.min || slot.max !== void 0 && value > slot.max) return `Slot "${slot.name}" takes ${range(slot)}; ${value} is out of range.`;
|
|
108
|
-
return void 0;
|
|
109
|
-
default: {
|
|
110
|
-
const host = ` (or { "slot": "${slot.name}" } to leave it for the host)`;
|
|
111
|
-
if (typeof value === "string") return value.trim() ? void 0 : no(host);
|
|
112
|
-
const kind = effectSubjectKind(value);
|
|
113
|
-
if (!kind) return no(host);
|
|
114
|
-
if (kind === "slot") return SLOT_NAME.test(value.slot) ? void 0 : `Slot "${slot.name}" left for the host is { "slot": name }, the name letters, digits, "-" and "_", starting with a letter.`;
|
|
115
|
-
const fits = kind === slot.type || slot.type === "image" && kind === "svg";
|
|
116
|
-
if (!fits) return `Slot "${slot.name}" takes { "${slot.type}": \u2026 }${slot.type === "image" ? ' or { "svg": \u2026 }' : ""}, not { "${kind}": \u2026 }.`;
|
|
117
|
-
return value[kind].trim() ? void 0 : `Slot "${slot.name}"'s "${kind}" is a non-empty string.`;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
var slotList = (slots) => slots.length ? `the slots are ${slots.map((s) => `${s.name} (${s.type})`).join(", ")}` : "the template has no slots";
|
|
122
|
-
function checkTemplateValues(slots, values) {
|
|
123
|
-
if (values === void 0) return [];
|
|
124
|
-
if (!isObject(values)) return [`Values are an object of slot names to values; ${slotList(slots)}.`];
|
|
125
|
-
const byName = new Map(slots.map((s) => [s.name, s]));
|
|
126
|
-
const errors = [];
|
|
127
|
-
for (const [name, value] of Object.entries(values)) {
|
|
128
|
-
const slot = byName.get(name);
|
|
129
|
-
if (!slot) errors.push(`There is no slot "${name}"; ${slotList(slots)}.`);
|
|
130
|
-
else if (value !== void 0) {
|
|
131
|
-
const problem = templateValueProblem(slot, value);
|
|
132
|
-
if (problem) errors.push(problem);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return errors;
|
|
136
|
-
}
|
|
137
|
-
function templateSlotSchema(slot) {
|
|
138
|
-
const about = `${slot.label}${slot.description ? `: ${slot.description}` : ""}.`;
|
|
139
|
-
switch (slot.type) {
|
|
140
|
-
case "text":
|
|
141
|
-
return { type: "string", ...slot.maxLength !== void 0 ? { maxLength: slot.maxLength } : {}, description: `${about} Words${slot.maxLength !== void 0 ? `, up to ${slot.maxLength} characters` : ""}. Default ${JSON.stringify(slot.default)}.` };
|
|
142
|
-
case "color":
|
|
143
|
-
return { type: "string", pattern: COLOR.source, description: `${about} A colour as #RRGGBB. Default ${slot.default}.` };
|
|
144
|
-
case "number":
|
|
145
|
-
return {
|
|
146
|
-
type: slot.integer ? "integer" : "number",
|
|
147
|
-
...slot.min !== void 0 ? { minimum: slot.min } : {},
|
|
148
|
-
...slot.max !== void 0 ? { maximum: slot.max } : {},
|
|
149
|
-
description: `${about} ${range(slot).replace(/^a /, "A ")}. Default ${slot.default}.`
|
|
150
|
-
};
|
|
151
|
-
default: {
|
|
152
|
-
const key = slot.type;
|
|
153
|
-
const object2 = (k, what) => ({ type: "object", properties: { [k]: { type: "string", description: what } }, required: [k], additionalProperties: false, description: `{ "${k}": \u2026 }` });
|
|
154
|
-
return {
|
|
155
|
-
anyOf: [
|
|
156
|
-
{ type: "string", minLength: 1, description: key === "video" ? "A video URL." : key === "svg" ? "SVG markup or an SVG URL." : "A picture URL, a data: URL or <svg> markup." },
|
|
157
|
-
object2(key, key === "video" ? "A video URL." : key === "svg" ? "SVG markup or an SVG URL." : "A picture URL or a data: URL."),
|
|
158
|
-
...key === "image" ? [object2("svg", "SVG markup.")] : [],
|
|
159
|
-
object2("slot", "A slot name, to leave the subject for the host to fill.")
|
|
160
|
-
],
|
|
161
|
-
description: `${about} ${templateSlotTakes(slot).replace(/^a /, "A ")}. ${slot.hasDefault ? "Default: a placeholder picture." : "No default: left out, the host fills it."}`
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function templateValuesSchema(slots) {
|
|
167
|
-
return {
|
|
168
|
-
type: "object",
|
|
169
|
-
properties: Object.fromEntries(slots.map((s) => [s.name, templateSlotSchema(s)])),
|
|
170
|
-
additionalProperties: false,
|
|
171
|
-
description: `Slot values by name; slots left out take their defaults. ${slots.length ? `Slots: ${slots.map((s) => s.name).join(", ")}.` : "This template has no slots."}`
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function templateDefaultValues(slots) {
|
|
175
|
-
const out = {};
|
|
176
|
-
for (const s of slots) if (!isSubjectTemplateSlot(s)) out[s.name] = s.default;
|
|
177
|
-
return out;
|
|
178
|
-
}
|
|
179
|
-
function templateSlotSummary(slot) {
|
|
180
|
-
const fallback = isSubjectTemplateSlot(slot) ? slot.hasDefault ? "a placeholder by default" : "the host fills it when none is given" : `default ${JSON.stringify(slot.default)}`;
|
|
181
|
-
return `${slot.name} (${slot.type}): ${slot.label}; takes ${templateSlotTakes(slot)}; ${fallback}.`;
|
|
182
|
-
}
|
|
183
|
-
function searchTemplateSummaries(catalog, options = {}) {
|
|
184
|
-
const words = (options.query ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
185
|
-
const scored = [];
|
|
186
|
-
for (const t of catalog) {
|
|
187
|
-
if (!hasEffectTags(t, options.tags)) continue;
|
|
188
|
-
let score = 0;
|
|
189
|
-
const name = t.name.toLowerCase();
|
|
190
|
-
const rest = [t.id, ...t.tags ?? [], t.description].join(" ").toLowerCase();
|
|
191
|
-
if (!words.every((w) => name.includes(w) || rest.includes(w))) continue;
|
|
192
|
-
for (const w of words) score += name.includes(w) ? 2 : 1;
|
|
193
|
-
scored.push({ t, score });
|
|
194
|
-
}
|
|
195
|
-
scored.sort((a, b) => b.score - a.score);
|
|
196
|
-
const out = scored.map((s) => s.t);
|
|
197
|
-
return options.limit !== void 0 ? out.slice(0, Math.max(0, options.limit)) : out;
|
|
198
|
-
}
|
|
199
|
-
var effectLayerRole = (layer) => layer.role ?? (layer.rect ? "subject" : "background");
|
|
200
|
-
function effectLayerInput(description) {
|
|
201
|
-
const images = description.inputs.filter((i) => i.kind === "image");
|
|
202
|
-
return (images.find((i) => i.name === "source") ?? images.find((i) => i.name !== "from" && i.name !== "to"))?.name;
|
|
203
|
-
}
|
|
204
|
-
var EFFECT_LAYER_USES = ["generator", "filter", "overlay", "title"];
|
|
205
|
-
var effectLayerOffered = (e) => (e.kind === "shader" || e.kind === "vector") && e.uses.some((u) => EFFECT_LAYER_USES.includes(u));
|
|
206
|
-
var isRect = (r) => isObject(r) && ["x", "y", "width", "height"].every((k) => Number.isFinite(r[k])) && r.width > 0 && r.height > 0;
|
|
207
|
-
var isLayerTime = (t) => typeof t === "number" && Number.isFinite(t) && t >= 0 || isObject(t) && Number.isInteger(t.shots) && t.shots >= 1;
|
|
208
|
-
function effectSubjectProblem(subject) {
|
|
209
|
-
const kind = effectSubjectKind(subject);
|
|
210
|
-
if (!kind) return `a subject is one of { image }, { video }, { svg }, { text } or { slot }, not ${typeName(subject)}`;
|
|
211
|
-
if (!subject[kind].trim()) return `a subject's "${kind}" is a non-empty string`;
|
|
212
|
-
return void 0;
|
|
213
|
-
}
|
|
214
|
-
function checkEffectSequence(sequence, catalog) {
|
|
215
|
-
const problems = [];
|
|
216
|
-
if (!isObject(sequence)) return ["A sequence is an object with name, stage and shots."];
|
|
217
|
-
if (typeof sequence.name !== "string" || !sequence.name) problems.push("The sequence needs a name.");
|
|
218
|
-
const stage = sequence.stage;
|
|
219
|
-
if (!isObject(stage) || !(Number(stage.width) > 0) || !(Number(stage.height) > 0)) problems.push("The sequence needs a stage { width, height } in pixels, both > 0.");
|
|
220
|
-
if (!Array.isArray(sequence.shots) || !sequence.shots.length) return [...problems, "The sequence needs at least one shot."];
|
|
221
|
-
const byId = catalog ? new Map(catalog.map((e) => [e.id, e])) : void 0;
|
|
222
|
-
const ids = /* @__PURE__ */ new Set();
|
|
223
|
-
sequence.shots.forEach((shot, i) => {
|
|
224
|
-
const at = `shot ${i + 1}`;
|
|
225
|
-
if (!isObject(shot)) return void problems.push(`${at} is not an object.`);
|
|
226
|
-
if (!(Number.isFinite(shot.hold) && shot.hold >= 0)) problems.push(`${at}: hold must be ms \u2265 0.`);
|
|
227
|
-
for (const k of ["title", "caption"]) if (shot[k] !== void 0 && typeof shot[k] !== "string") problems.push(`${at}: ${k} must be words.`);
|
|
228
|
-
if (shot.camera !== void 0) {
|
|
229
|
-
const camera = shot.camera;
|
|
230
|
-
if (!isObject(camera)) problems.push(`${at}: camera must be an object.`);
|
|
231
|
-
else if (camera.framing !== void 0 && !isRect(camera.framing)) problems.push(`${at}: camera.framing must be { x, y, width, height } with width and height > 0.`);
|
|
232
|
-
}
|
|
233
|
-
if (!Array.isArray(shot.layers)) problems.push(`${at}: layers must be a list (it may be empty).`);
|
|
234
|
-
else
|
|
235
|
-
shot.layers.forEach((layer, j) => {
|
|
236
|
-
const where = `${at}, layer ${j + 1}`;
|
|
237
|
-
if (!isObject(layer)) return void problems.push(`${where} is not an object.`);
|
|
238
|
-
if (layer.id !== void 0) {
|
|
239
|
-
if (typeof layer.id !== "string" || !layer.id) problems.push(`${where}: id must be a non-empty string.`);
|
|
240
|
-
else if (ids.has(layer.id)) problems.push(`${where}: id "${layer.id}" is used twice.`);
|
|
241
|
-
else ids.add(layer.id);
|
|
242
|
-
}
|
|
243
|
-
if (layer.effect === void 0 && layer.subject === void 0) problems.push(`${where} has neither an effect nor a subject.`);
|
|
244
|
-
if (layer.effect !== void 0 && (typeof layer.effect !== "string" || !layer.effect)) problems.push(`${where}: effect must be an effect id.`);
|
|
245
|
-
else if (typeof layer.effect === "string" && byId) {
|
|
246
|
-
const e = byId.get(layer.effect);
|
|
247
|
-
if (!e) problems.push(`${where}: the provider has no effect "${layer.effect}".`);
|
|
248
|
-
else if (!effectLayerOffered(e)) problems.push(`${where}: "${layer.effect}" (${e.kind}, ${e.uses.join("/")}) cannot be a layer; a layer's effect is a generator, filter, overlay or title.`);
|
|
249
|
-
}
|
|
250
|
-
if (layer.subject !== void 0) {
|
|
251
|
-
const p = effectSubjectProblem(layer.subject);
|
|
252
|
-
if (p) problems.push(`${where}: ${p}.`);
|
|
253
|
-
}
|
|
254
|
-
if (layer.role !== void 0 && !EFFECT_LAYER_ROLES.includes(layer.role)) problems.push(`${where}: role is one of ${EFFECT_LAYER_ROLES.join(", ")}.`);
|
|
255
|
-
if (layer.rect !== void 0 && !isRect(layer.rect)) problems.push(`${where}: rect must be { x, y, width, height } with width and height > 0.`);
|
|
256
|
-
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.`);
|
|
257
|
-
if (layer.opacity !== void 0 && !(typeof layer.opacity === "number" && layer.opacity >= 0 && layer.opacity <= 1)) problems.push(`${where}: opacity is 0\u20131.`);
|
|
258
|
-
if (layer.fade !== void 0 && !(typeof layer.fade === "number" && layer.fade >= 0)) problems.push(`${where}: fade is ms \u2265 0.`);
|
|
259
|
-
if (layer.values !== void 0 && !isObject(layer.values)) problems.push(`${where}: values must be an object of control values.`);
|
|
260
|
-
});
|
|
261
|
-
if (shot.transition !== void 0) {
|
|
262
|
-
const t = shot.transition;
|
|
263
|
-
if (i === 0) problems.push(`${at} has a transition, but there is no shot before it.`);
|
|
264
|
-
if (!isObject(t) || typeof t.effect !== "string" || !t.effect) problems.push(`${at}: transition needs an effect id.`);
|
|
265
|
-
else {
|
|
266
|
-
if (t.ms !== void 0 && !(typeof t.ms === "number" && t.ms > 0)) problems.push(`${at}: transition ms must be > 0.`);
|
|
267
|
-
const e = byId?.get(t.effect);
|
|
268
|
-
if (byId && !e) problems.push(`${at}: the provider has no transition "${t.effect}".`);
|
|
269
|
-
else if (e && !e.uses.includes("transition")) problems.push(`${at}: "${t.effect}" is not a transition (its uses are ${e.uses.join(", ")}).`);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
return problems;
|
|
274
|
-
}
|
|
275
|
-
function effectSequenceEffects(sequence) {
|
|
276
|
-
const out = /* @__PURE__ */ new Set();
|
|
277
|
-
for (const shot of sequence.shots) {
|
|
278
|
-
for (const l of shot.layers) if (l.effect) out.add(l.effect);
|
|
279
|
-
if (shot.transition) out.add(shot.transition.effect);
|
|
280
|
-
}
|
|
281
|
-
return [...out];
|
|
282
|
-
}
|
|
283
|
-
function effectSequenceSlots(sequence) {
|
|
284
|
-
const out = /* @__PURE__ */ new Set();
|
|
285
|
-
for (const shot of sequence.shots) for (const l of shot.layers) if (l.subject && "slot" in l.subject) out.add(l.subject.slot);
|
|
286
|
-
return [...out];
|
|
287
|
-
}
|
|
288
|
-
|
|
289
81
|
// src/effects/conformance.ts
|
|
290
82
|
var codeOf = (e) => isEffectError(e) ? e.code : e instanceof Error ? `untyped ${e.name}: ${e.message}` : String(e);
|
|
291
83
|
async function rejectsWith(code, run) {
|
|
@@ -460,9 +460,6 @@ var _chunkA2IS7EHEcjs = require('../chunk-A2IS7EHE.cjs');
|
|
|
460
460
|
var _chunkSS53NNZOcjs = require('../chunk-SS53NNZO.cjs');
|
|
461
461
|
|
|
462
462
|
|
|
463
|
-
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
464
|
-
|
|
465
|
-
|
|
466
463
|
var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
|
|
467
464
|
|
|
468
465
|
|
|
@@ -739,12 +736,15 @@ var _chunkGF2RBSDMcjs = require('../chunk-GF2RBSDM.cjs');
|
|
|
739
736
|
require('../chunk-NM3G4VQT.cjs');
|
|
740
737
|
|
|
741
738
|
|
|
739
|
+
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
740
|
+
|
|
741
|
+
|
|
742
742
|
|
|
743
743
|
|
|
744
744
|
|
|
745
745
|
|
|
746
746
|
|
|
747
|
-
var
|
|
747
|
+
var _chunkJAOSL334cjs = require('../chunk-JAOSL334.cjs');
|
|
748
748
|
require('../chunk-WOFXZ3XU.cjs');
|
|
749
749
|
|
|
750
750
|
|
|
@@ -4832,7 +4832,7 @@ function checkImageEffectPlace(d, place) {
|
|
|
4832
4832
|
const allowed = IMAGE_EFFECT_PLACES[place];
|
|
4833
4833
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
4834
4834
|
const instead = place === "filter" && d.uses.some((u) => IMAGE_EFFECT_PLACES.layer.includes(u)) ? "; add it as an effect layer with add_effect_layer instead" : place === "layer" && d.uses.includes("filter") ? "; apply it to a layer as a smart filter with apply_effect instead" : "";
|
|
4835
|
-
throw new (0,
|
|
4835
|
+
throw new (0, _chunkJAOSL334cjs.EffectUnsupportedError)(
|
|
4836
4836
|
`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect, and ${place === "filter" ? "a smart filter takes filter effects" : "an effect layer takes generator, overlay or title effects"}${instead}.`,
|
|
4837
4837
|
d.id
|
|
4838
4838
|
);
|
|
@@ -4856,9 +4856,9 @@ function effectPixelsToSurface(p, depth) {
|
|
|
4856
4856
|
const d = new Uint16Array(f.length);
|
|
4857
4857
|
const code = (v) => v > 0 ? v < 1 ? Math.round(v * 65535) : 65535 : 0;
|
|
4858
4858
|
for (let i = 0; i < f.length; i += 4) {
|
|
4859
|
-
d[i] = code(
|
|
4860
|
-
d[i + 1] = code(
|
|
4861
|
-
d[i + 2] = code(
|
|
4859
|
+
d[i] = code(_chunkJAOSL334cjs.linearToSrgb.call(void 0, f[i]));
|
|
4860
|
+
d[i + 1] = code(_chunkJAOSL334cjs.linearToSrgb.call(void 0, f[i + 1]));
|
|
4861
|
+
d[i + 2] = code(_chunkJAOSL334cjs.linearToSrgb.call(void 0, f[i + 2]));
|
|
4862
4862
|
d[i + 3] = code(f[i + 3]);
|
|
4863
4863
|
}
|
|
4864
4864
|
return _chunkOLNIPTB3cjs.surfaceFromDeepPixels.call(void 0, { width: p.width, height: p.height, data: d }, 4);
|
|
@@ -4875,7 +4875,7 @@ var ImageEffectsEngine = (_class9 = class {
|
|
|
4875
4875
|
__init49() {this.generation = 0}
|
|
4876
4876
|
|
|
4877
4877
|
constructor(options = {}) {;_class9.prototype.__init44.call(this);_class9.prototype.__init45.call(this);_class9.prototype.__init46.call(this);_class9.prototype.__init47.call(this);_class9.prototype.__init48.call(this);_class9.prototype.__init49.call(this);
|
|
4878
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
4878
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkJAOSL334cjs.EffectsSlot)()));
|
|
4879
4879
|
this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 24));
|
|
4880
4880
|
this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
|
|
4881
4881
|
this.detach = this.slot.subscribe(() => {
|
|
@@ -4935,7 +4935,7 @@ var ImageEffectsEngine = (_class9 = class {
|
|
|
4935
4935
|
const provider = this.slot.require();
|
|
4936
4936
|
const depth = _nullishCoalesce(size.depth, () => ( 8));
|
|
4937
4937
|
const out = await this.render(provider, effect, size.width, size.height, depth, { time: _nullishCoalesce(size.time, () => ( 0)), values });
|
|
4938
|
-
return out.width === size.width && out.height === size.height ? out :
|
|
4938
|
+
return out.width === size.width && out.height === size.height ? out : _chunkJAOSL334cjs.createEffectPixels.call(void 0, size.width, size.height);
|
|
4939
4939
|
}
|
|
4940
4940
|
/** Why the result for `key` failed, if it did. */
|
|
4941
4941
|
failure(key2) {
|
|
@@ -6197,7 +6197,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6197
6197
|
__init84() {this.selectionWorker = null}
|
|
6198
6198
|
__init85() {this.documentOpener = null}
|
|
6199
6199
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
6200
|
-
__init86() {this.effects = new (0,
|
|
6200
|
+
__init86() {this.effects = new (0, _chunkJAOSL334cjs.EffectsSlot)()}
|
|
6201
6201
|
/** Renders provider effects: effect smart filter results and effect layers. */
|
|
6202
6202
|
__init87() {this.effectsEngine = new ImageEffectsEngine({ slot: this.effects })}
|
|
6203
6203
|
__init88() {this.effectRefresh = "none"}
|
|
@@ -6533,7 +6533,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6533
6533
|
*/
|
|
6534
6534
|
async applyEffectFilter(layerId, effect, options = {}) {
|
|
6535
6535
|
const d = await this.describeEffect(effect, "filter");
|
|
6536
|
-
const values =
|
|
6536
|
+
const values = _chunkJAOSL334cjs.resolveEffectValues.call(void 0, d, options.values);
|
|
6537
6537
|
const found = _chunkHB4ICNNAcjs.findLayer.call(void 0, this.state.layers, layerId);
|
|
6538
6538
|
if (!found) throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`There is no layer "${layerId}"; call list_layers for the layer ids.`);
|
|
6539
6539
|
let layers = this.state.layers;
|
|
@@ -6575,7 +6575,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6575
6575
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
6576
6576
|
else throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
6577
6577
|
}
|
|
6578
|
-
update.values = { ...base, ...
|
|
6578
|
+
update.values = { ...base, ..._chunkJAOSL334cjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
6579
6579
|
}
|
|
6580
6580
|
for (const k of ["enabled", "blend", "opacity", "preserveTransparency"]) if (changes[k] !== void 0) update[k] = changes[k];
|
|
6581
6581
|
let res = _chunk5VQXSS2Scjs.updateSmartFilter.call(void 0, this.state.layers, layerId, filterId, update, this.canvasSize);
|
|
@@ -6602,7 +6602,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6602
6602
|
const id = options.id && !ids.has(options.id) ? options.id : _chunk5VQXSS2Scjs.newLayerId.call(void 0, );
|
|
6603
6603
|
const placed = _chunk5VQXSS2Scjs.placeLayer.call(void 0, this.state.layers, { type: "pixel", id, name: "", visible: true, opacity: 1, blend: "normal", surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } }, this.newLayerPlacement(options));
|
|
6604
6604
|
if (options.clipped) requireClipBase(placed, id);
|
|
6605
|
-
const values =
|
|
6605
|
+
const values = _chunkJAOSL334cjs.resolveEffectValues.call(void 0, d, withBackgroundOpacity(d, options.values, hasLayersBelow(placed, id)));
|
|
6606
6606
|
const { width, height } = this.naturalSize;
|
|
6607
6607
|
const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time });
|
|
6608
6608
|
const layer = {
|
|
@@ -6647,7 +6647,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6647
6647
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
6648
6648
|
else throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
6649
6649
|
}
|
|
6650
|
-
const values = { ...base, ...
|
|
6650
|
+
const values = { ...base, ..._chunkJAOSL334cjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
6651
6651
|
const time = changes.time === void 0 ? _nullishCoalesce(g.time, () => ( 0)) : checkEffectTime(changes.time);
|
|
6652
6652
|
const animate = changes.animate === void 0 ? g.animate : changes.animate === null ? void 0 : checkEffectAnimation(changes.animate);
|
|
6653
6653
|
const { width, height } = this.naturalSize;
|
|
@@ -21925,7 +21925,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
|
|
|
21925
21925
|
return { target, effect: _nullishCoalesce(effects.find((e) => e.id === instance), () => ( effects[effects.length - 1])), effects, ...extra };
|
|
21926
21926
|
};
|
|
21927
21927
|
const plainValues = (v) => v;
|
|
21928
|
-
return withImagePlayback(
|
|
21928
|
+
return withImagePlayback(_chunkJAOSL334cjs.createEffectToolProvider.call(void 0, {
|
|
21929
21929
|
id: _nullishCoalesce(options.id, () => ( "image-effects")),
|
|
21930
21930
|
namespace: options.namespace,
|
|
21931
21931
|
title: "Image effects",
|
|
@@ -458,9 +458,6 @@ import {
|
|
|
458
458
|
shiftCoverage,
|
|
459
459
|
smoothCoverage
|
|
460
460
|
} from "../chunk-ZNA3IQZF.js";
|
|
461
|
-
import {
|
|
462
|
-
EffectRendererPool
|
|
463
|
-
} from "../chunk-EHLOCVWB.js";
|
|
464
461
|
import {
|
|
465
462
|
createCaptureTool
|
|
466
463
|
} from "../chunk-5ED73EC6.js";
|
|
@@ -737,6 +734,9 @@ import {
|
|
|
737
734
|
segmentNearest
|
|
738
735
|
} from "../chunk-WEIK3UYB.js";
|
|
739
736
|
import "../chunk-PWBZH3FK.js";
|
|
737
|
+
import {
|
|
738
|
+
EffectRendererPool
|
|
739
|
+
} from "../chunk-EHLOCVWB.js";
|
|
740
740
|
import {
|
|
741
741
|
EffectUnsupportedError,
|
|
742
742
|
EffectsSlot,
|
|
@@ -744,7 +744,7 @@ import {
|
|
|
744
744
|
createEffectToolProvider,
|
|
745
745
|
linearToSrgb,
|
|
746
746
|
resolveEffectValues
|
|
747
|
-
} from "../chunk-
|
|
747
|
+
} from "../chunk-SIK3LT6M.js";
|
|
748
748
|
import "../chunk-V2ZCJRDM.js";
|
|
749
749
|
import {
|
|
750
750
|
BrushstrokeCache,
|
|
@@ -1,6 +1,6 @@
|
|
|
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; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZQIWBJGHcjs = require('../chunk-ZQIWBJGH.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -12,9 +12,6 @@ require('../chunk-A2IS7EHE.cjs');
|
|
|
12
12
|
require('../chunk-SS53NNZO.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
16
|
-
|
|
17
|
-
|
|
18
15
|
|
|
19
16
|
|
|
20
17
|
|
|
@@ -134,10 +131,13 @@ require('../chunk-GF2RBSDM.cjs');
|
|
|
134
131
|
require('../chunk-NM3G4VQT.cjs');
|
|
135
132
|
|
|
136
133
|
|
|
134
|
+
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
135
|
+
|
|
136
|
+
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
var
|
|
140
|
+
var _chunkJAOSL334cjs = require('../chunk-JAOSL334.cjs');
|
|
141
141
|
require('../chunk-WOFXZ3XU.cjs');
|
|
142
142
|
|
|
143
143
|
|
|
@@ -3213,7 +3213,7 @@ function timeLapseVideo(frameCount, width, height, fps, holdMs, name = "Time-lap
|
|
|
3213
3213
|
}
|
|
3214
3214
|
const video = { version: 1, name, width: w, height: h, fps, background: "#000000", assets, tracks: [{ id: "v1", kind: "video", clips }] };
|
|
3215
3215
|
const durationMs = frameCount ? clips[clips.length - 1].start + clips[clips.length - 1].duration : 0;
|
|
3216
|
-
return { video, ffmpeg:
|
|
3216
|
+
return { video, ffmpeg: _chunkZQIWBJGHcjs.toVideoFfmpeg.call(void 0, video, { output: "timelapse.mp4" }), durationMs };
|
|
3217
3217
|
}
|
|
3218
3218
|
async function buildTimeLapse(source, target, options = {}) {
|
|
3219
3219
|
const maxSide = Math.max(32, Math.min(4096, Math.round(_nullishCoalesce(options.maxSide, () => ( 720)))));
|
|
@@ -3296,7 +3296,7 @@ function checkPaintEffectPlace(d, place) {
|
|
|
3296
3296
|
else if (d.uses.includes("filter") && place !== "light") instead = "; run it on a layer's dried paint with apply_effect instead";
|
|
3297
3297
|
else if (place === "light" && d.uses.some((u) => PAINT_EFFECT_PLACES.layer.includes(u))) instead = "; add it as an effect layer (add_effect_layer) or fill a layer with it (fill_layer_with_effect) instead";
|
|
3298
3298
|
else if (place === "paper" && d.uses.some((u) => u === "overlay" || u === "title")) instead = "; add it as an effect layer with add_effect_layer instead";
|
|
3299
|
-
throw new (0,
|
|
3299
|
+
throw new (0, _chunkJAOSL334cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.uses.join(" / ") || d.kind} effect, and ${PLACE_WORDS[place]}${instead}.`, d.id);
|
|
3300
3300
|
}
|
|
3301
3301
|
var PAPER_EFFECT_BLENDS = ["multiply", "normal", "overlay", "soft-light", "screen", "color"];
|
|
3302
3302
|
var paperVersion = 1;
|
|
@@ -3479,7 +3479,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3479
3479
|
/** Set while an operation that changes wet paint runs: the simulation before it (for undo). */
|
|
3480
3480
|
__init106() {this.wetOp = null}
|
|
3481
3481
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
3482
|
-
__init107() {this.effects = new (0,
|
|
3482
|
+
__init107() {this.effects = new (0, _chunkJAOSL334cjs.EffectsSlot)()}
|
|
3483
3483
|
__init108() {this.effectsRenderer = new PaintEffectsRenderer()}
|
|
3484
3484
|
__init109() {this.paperEffectNodeCache = null}
|
|
3485
3485
|
constructor(options = {}) {;_class10.prototype.__init72.call(this);_class10.prototype.__init73.call(this);_class10.prototype.__init74.call(this);_class10.prototype.__init75.call(this);_class10.prototype.__init76.call(this);_class10.prototype.__init77.call(this);_class10.prototype.__init78.call(this);_class10.prototype.__init79.call(this);_class10.prototype.__init80.call(this);_class10.prototype.__init81.call(this);_class10.prototype.__init82.call(this);_class10.prototype.__init83.call(this);_class10.prototype.__init84.call(this);_class10.prototype.__init85.call(this);_class10.prototype.__init86.call(this);_class10.prototype.__init87.call(this);_class10.prototype.__init88.call(this);_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);_class10.prototype.__init91.call(this);_class10.prototype.__init92.call(this);_class10.prototype.__init93.call(this);_class10.prototype.__init94.call(this);_class10.prototype.__init95.call(this);_class10.prototype.__init96.call(this);_class10.prototype.__init97.call(this);_class10.prototype.__init98.call(this);_class10.prototype.__init99.call(this);_class10.prototype.__init100.call(this);_class10.prototype.__init101.call(this);_class10.prototype.__init102.call(this);_class10.prototype.__init103.call(this);_class10.prototype.__init104.call(this);_class10.prototype.__init105.call(this);_class10.prototype.__init106.call(this);_class10.prototype.__init107.call(this);_class10.prototype.__init108.call(this);_class10.prototype.__init109.call(this);_class10.prototype.__init110.call(this);_class10.prototype.__init111.call(this);_class10.prototype.__init112.call(this);_class10.prototype.__init113.call(this);
|
|
@@ -4154,7 +4154,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4154
4154
|
if (v === null) merged[k] = d.defaults[k];
|
|
4155
4155
|
else given[k] = v;
|
|
4156
4156
|
}
|
|
4157
|
-
return { ...merged, ...
|
|
4157
|
+
return { ...merged, ..._chunkJAOSL334cjs.resolveEffectValues.call(void 0, { ...d, defaults: merged }, given) };
|
|
4158
4158
|
}
|
|
4159
4159
|
/** Renders a generator, overlay or title effect at the canvas size. */
|
|
4160
4160
|
renderEffectCanvas(d, values, time = 0) {
|
|
@@ -8917,7 +8917,7 @@ function createPaintEffectsToolProvider(controller, options = {}) {
|
|
|
8917
8917
|
if (changes.enabled !== void 0) throw new Error("enabled does not apply here: hide an effect layer with update_layer visible false, or remove the effect paper.");
|
|
8918
8918
|
};
|
|
8919
8919
|
const values = (v) => v;
|
|
8920
|
-
return withPaintPlayback(
|
|
8920
|
+
return withPaintPlayback(_chunkJAOSL334cjs.createEffectToolProvider.call(void 0, {
|
|
8921
8921
|
id: _nullishCoalesce(options.id, () => ( "paint-effects")),
|
|
8922
8922
|
namespace: options.namespace,
|
|
8923
8923
|
title: "Paint effects",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toVideoFfmpeg
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WDDUPWVG.js";
|
|
4
4
|
import {
|
|
5
5
|
deserializeLayers,
|
|
6
6
|
exportPsd,
|
|
@@ -10,9 +10,6 @@ import {
|
|
|
10
10
|
} from "../chunk-JVNGCS26.js";
|
|
11
11
|
import "../chunk-3CI7FRMK.js";
|
|
12
12
|
import "../chunk-ZNA3IQZF.js";
|
|
13
|
-
import {
|
|
14
|
-
EffectRendererPool
|
|
15
|
-
} from "../chunk-EHLOCVWB.js";
|
|
16
13
|
import {
|
|
17
14
|
RasterCompositor,
|
|
18
15
|
findLayer,
|
|
@@ -132,12 +129,15 @@ import {
|
|
|
132
129
|
import "../chunk-M6DNZNVY.js";
|
|
133
130
|
import "../chunk-WEIK3UYB.js";
|
|
134
131
|
import "../chunk-PWBZH3FK.js";
|
|
132
|
+
import {
|
|
133
|
+
EffectRendererPool
|
|
134
|
+
} from "../chunk-EHLOCVWB.js";
|
|
135
135
|
import {
|
|
136
136
|
EffectUnsupportedError,
|
|
137
137
|
EffectsSlot,
|
|
138
138
|
createEffectToolProvider,
|
|
139
139
|
resolveEffectValues
|
|
140
|
-
} from "../chunk-
|
|
140
|
+
} from "../chunk-SIK3LT6M.js";
|
|
141
141
|
import "../chunk-V2ZCJRDM.js";
|
|
142
142
|
import {
|
|
143
143
|
CoverageMap,
|
package/dist/vector/index.cjs
CHANGED
|
@@ -558,7 +558,7 @@ var _chunkNM3G4VQTcjs = require('../chunk-NM3G4VQT.cjs');
|
|
|
558
558
|
|
|
559
559
|
|
|
560
560
|
|
|
561
|
-
var
|
|
561
|
+
var _chunkJAOSL334cjs = require('../chunk-JAOSL334.cjs');
|
|
562
562
|
require('../chunk-WOFXZ3XU.cjs');
|
|
563
563
|
|
|
564
564
|
|
|
@@ -7328,7 +7328,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
|
|
|
7328
7328
|
}
|
|
7329
7329
|
// --- Provider effects ---
|
|
7330
7330
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
7331
|
-
__init59() {this.effects = new (0,
|
|
7331
|
+
__init59() {this.effects = new (0, _chunkJAOSL334cjs.EffectsSlot)()}
|
|
7332
7332
|
/** The registered effects provider, or `null`. */
|
|
7333
7333
|
get effectsProvider() {
|
|
7334
7334
|
return this.effects.provider;
|
|
@@ -7352,10 +7352,10 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
|
|
|
7352
7352
|
/** The effect's picture as group children, scaled into `box` (an affine fit). */
|
|
7353
7353
|
async vectorEffectPicture(effect, values) {
|
|
7354
7354
|
const provider = this.effects.require();
|
|
7355
|
-
if (!provider.applyVectorEffect) throw new (0,
|
|
7355
|
+
if (!provider.applyVectorEffect) throw new (0, _chunkJAOSL334cjs.EffectUnsupportedError)(`${provider.name} has no vector effects.`);
|
|
7356
7356
|
const d = await provider.describe(effect);
|
|
7357
|
-
if (d.kind !== "vector") throw new (0,
|
|
7358
|
-
const resolved =
|
|
7357
|
+
if (d.kind !== "vector") throw new (0, _chunkJAOSL334cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.kind} effect; the vector editor adds vector effects, which bring their own picture${d.kind === "motion" ? " (apply motion in the animation editor)" : ""}.`, d.id);
|
|
7358
|
+
const resolved = _chunkJAOSL334cjs.resolveEffectValues.call(void 0, d, values);
|
|
7359
7359
|
const motion = await provider.applyVectorEffect(d.id, this.toSvg(), resolved);
|
|
7360
7360
|
const parsed = _chunkBQE3Y6ZOcjs.parseVectorSvg.call(void 0, motion.svg);
|
|
7361
7361
|
if (!parsed.nodes.length) throw new Error(`"${d.name}" drew no shapes the editor can read.`);
|
|
@@ -18172,7 +18172,7 @@ function createVectorEffectsToolProvider(controller, options = {}) {
|
|
|
18172
18172
|
const effects = _optionalChain([g, 'optionalAccess', _765 => _765.providerEffect]) ? [info(g)] : [];
|
|
18173
18173
|
return { target: id, effect: _nullishCoalesce(removed, () => ( effects[0])), effects };
|
|
18174
18174
|
};
|
|
18175
|
-
return
|
|
18175
|
+
return _chunkJAOSL334cjs.createEffectToolProvider.call(void 0, {
|
|
18176
18176
|
id: _nullishCoalesce(options.id, () => ( "vector-effects")),
|
|
18177
18177
|
namespace: options.namespace,
|
|
18178
18178
|
title: "Vector effects",
|
package/dist/vector/index.js
CHANGED