@pixerate/editor 0.241.0 → 0.242.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/controller.d.cts +10 -0
- package/dist/animation-editor/controller.d.ts +10 -0
- package/dist/animation-editor/effects.d.cts +1 -1
- package/dist/animation-editor/effects.d.ts +1 -1
- package/dist/animation-editor/index.cjs +137 -88
- package/dist/animation-editor/index.js +60 -11
- package/dist/canvas/index.cjs +7 -7
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-A7PQNIBX.cjs → chunk-7V7QMFTI.cjs} +14 -14
- package/dist/{chunk-JAOSL334.cjs → chunk-GHCSC2WP.cjs} +38 -16
- package/dist/{chunk-JWCKJNDR.cjs → chunk-K5DS2JTA.cjs} +6 -6
- package/dist/{chunk-WDDUPWVG.js → chunk-L3JFOTBQ.js} +1 -1
- package/dist/{chunk-SIK3LT6M.js → chunk-OFH6Q67U.js} +28 -6
- package/dist/{chunk-G3RUKJ5C.js → chunk-RXZL4NG5.js} +1 -1
- package/dist/{chunk-TEFQISBY.js → chunk-X3ZINLIP.js} +1 -1
- package/dist/{chunk-ZQIWBJGH.cjs → chunk-XNZFVYC2.cjs} +7 -7
- package/dist/effects/fake.d.cts +4 -0
- package/dist/effects/fake.d.ts +4 -0
- package/dist/effects/helpers.d.cts +6 -0
- package/dist/effects/helpers.d.ts +6 -0
- package/dist/effects/index.cjs +222 -94
- package/dist/effects/index.js +131 -3
- package/dist/effects/types.d.cts +31 -0
- package/dist/effects/types.d.ts +31 -0
- 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/controller.d.cts +49 -1
- package/dist/video-editor/controller.d.ts +49 -1
- package/dist/video-editor/effect-path.d.cts +66 -0
- package/dist/video-editor/effect-path.d.ts +66 -0
- package/dist/video-editor/index.cjs +616 -427
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +193 -4
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +1 -1
- package/skills/pixerate-video-editor/SKILL.md +9 -2
package/dist/effects/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunk4XSBOGMKcjs = require('../chunk-4XSBOGMK.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk7V7QMFTIcjs = require('../chunk-7V7QMFTI.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -28,7 +28,7 @@ var _chunkA7PQNIBXcjs = require('../chunk-A7PQNIBX.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkK5DS2JTAcjs = require('../chunk-K5DS2JTA.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
@@ -75,7 +75,10 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var _chunkGHCSC2WPcjs = require('../chunk-GHCSC2WP.cjs');
|
|
79
82
|
require('../chunk-WOFXZ3XU.cjs');
|
|
80
83
|
require('../chunk-FJ2MSI43.cjs');
|
|
81
84
|
|
|
@@ -83,7 +86,7 @@ require('../chunk-FJ2MSI43.cjs');
|
|
|
83
86
|
var _chunkDWJJI6RTcjs = require('../chunk-DWJJI6RT.cjs');
|
|
84
87
|
|
|
85
88
|
// src/effects/conformance.ts
|
|
86
|
-
var codeOf = (e) =>
|
|
89
|
+
var codeOf = (e) => _chunkGHCSC2WPcjs.isEffectError.call(void 0, e) ? e.code : e instanceof Error ? `untyped ${e.name}: ${e.message}` : String(e);
|
|
87
90
|
async function rejectsWith(code, run) {
|
|
88
91
|
try {
|
|
89
92
|
await run();
|
|
@@ -97,26 +100,27 @@ function checkSummary(e, issues) {
|
|
|
97
100
|
const at = (message) => issues.push({ effectId: e.id, message });
|
|
98
101
|
if (!e.id || typeof e.id !== "string") at("summary has no id");
|
|
99
102
|
if (!e.name) at("summary has no name");
|
|
100
|
-
if (!
|
|
103
|
+
if (!_chunkGHCSC2WPcjs.EFFECT_KINDS.includes(e.kind)) at(`kind "${e.kind}" is not one of ${_chunkGHCSC2WPcjs.EFFECT_KINDS.join(", ")}`);
|
|
101
104
|
if (!e.category) at("summary has no category");
|
|
102
105
|
if (!Array.isArray(e.uses) || !e.uses.length) at("summary has no uses");
|
|
103
|
-
for (const u of _nullishCoalesce(e.uses, () => ( []))) if (!
|
|
106
|
+
for (const u of _nullishCoalesce(e.uses, () => ( []))) if (!_chunkGHCSC2WPcjs.EFFECT_USES.includes(u)) at(`use "${u}" is not one of ${_chunkGHCSC2WPcjs.EFFECT_USES.join(", ")}`);
|
|
104
107
|
if (typeof e.transparent !== "boolean") at("transparent is not a boolean");
|
|
105
108
|
if (typeof e.loop !== "boolean") at("loop is not a boolean");
|
|
106
109
|
if (e.duration !== void 0 && !(e.duration > 0)) at("duration must be a positive number of ms when present");
|
|
107
110
|
if (e.backgroundOpacity !== void 0 && (typeof e.backgroundOpacity !== "string" || !e.backgroundOpacity)) at("backgroundOpacity must name a control when present");
|
|
111
|
+
for (const a of _nullishCoalesce(e.accepts, () => ( []))) if (!_chunkGHCSC2WPcjs.EFFECT_ACCEPTS.includes(a)) at(`accepts "${a}" is not one of ${_chunkGHCSC2WPcjs.EFFECT_ACCEPTS.join(", ")}`);
|
|
108
112
|
if (e.kind === "camera") {
|
|
109
|
-
if (_optionalChain([e, 'access',
|
|
113
|
+
if (_optionalChain([e, 'access', _2 => _2.uses, 'optionalAccess', _3 => _3.length]) !== 1 || e.uses[0] !== "camera") at('a camera effect must have exactly the use "camera"');
|
|
110
114
|
const m = e.camera;
|
|
111
115
|
if (!m) at("a camera effect needs camera: { role, durationMs }");
|
|
112
116
|
else {
|
|
113
|
-
if (!
|
|
117
|
+
if (!_chunkGHCSC2WPcjs.CAMERA_MOVE_ROLES.includes(m.role)) at(`camera.role "${m.role}" is not one of ${_chunkGHCSC2WPcjs.CAMERA_MOVE_ROLES.join(", ")}`);
|
|
114
118
|
if (!(Number.isFinite(m.durationMs) && m.durationMs >= 0)) at("camera.durationMs must be a number of ms \u2265 0");
|
|
115
119
|
if (m.cut !== void 0 && !(m.cut >= 0 && m.cut <= 1)) at("camera.cut must be 0\u20131 when present");
|
|
116
120
|
if (e.duration !== void 0 && e.duration !== m.durationMs) at(`duration ${e.duration} differs from camera.durationMs ${m.durationMs}`);
|
|
117
121
|
}
|
|
118
122
|
} else {
|
|
119
|
-
if (_optionalChain([e, 'access',
|
|
123
|
+
if (_optionalChain([e, 'access', _4 => _4.uses, 'optionalAccess', _5 => _5.includes, 'call', _6 => _6("camera")])) at('only camera effects may have the use "camera"');
|
|
120
124
|
if (e.camera !== void 0) at("only camera effects may have camera");
|
|
121
125
|
}
|
|
122
126
|
}
|
|
@@ -125,19 +129,22 @@ function checkDescription(id, d, issues) {
|
|
|
125
129
|
if (d.id !== id) at(`describe("${id}") returned id "${d.id}"`);
|
|
126
130
|
const c = d.controls;
|
|
127
131
|
if (!c || c.type !== "object") at("controls is not an object schema");
|
|
128
|
-
if (_optionalChain([c, 'optionalAccess',
|
|
129
|
-
for (const [name, schema] of Object.entries(_nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
132
|
+
if (_optionalChain([c, 'optionalAccess', _7 => _7.additionalProperties]) !== false) at("controls must set additionalProperties: false");
|
|
133
|
+
for (const [name, schema] of Object.entries(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _8 => _8.properties]), () => ( {})))) {
|
|
130
134
|
if (!schema.description || !String(schema.description).trim()) at(`control "${name}" has no description`);
|
|
131
135
|
if (!(name in (_nullishCoalesce(d.defaults, () => ( {}))))) at(`control "${name}" has no default`);
|
|
132
136
|
}
|
|
133
|
-
for (const name of Object.keys(_nullishCoalesce(d.defaults, () => ( {})))) if (!(name in (_nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
137
|
+
for (const name of Object.keys(_nullishCoalesce(d.defaults, () => ( {})))) if (!(name in (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _9 => _9.properties]), () => ( {}))))) at(`default "${name}" is not a control`);
|
|
134
138
|
if (d.backgroundOpacity !== void 0) {
|
|
135
|
-
const control = _optionalChain([c, 'optionalAccess',
|
|
139
|
+
const control = _optionalChain([c, 'optionalAccess', _10 => _10.properties, 'optionalAccess', _11 => _11[d.backgroundOpacity]]);
|
|
136
140
|
if (!control) at(`backgroundOpacity "${d.backgroundOpacity}" is not a control`);
|
|
137
141
|
else if (control.type !== "number" || control.minimum !== 0 || control.maximum !== 1) at(`backgroundOpacity "${d.backgroundOpacity}" must be a number control from 0 to 1`);
|
|
138
142
|
}
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
const paths = _chunkGHCSC2WPcjs.pathControlsOf.call(void 0, d);
|
|
144
|
+
if (paths.length && !_optionalChain([d, 'access', _12 => _12.accepts, 'optionalAccess', _13 => _13.includes, 'call', _14 => _14("path")])) at(`controls ${paths.map((p) => `"${p}"`).join(", ")} take a path, but accepts does not list "path"`);
|
|
145
|
+
if (!paths.length && _optionalChain([d, 'access', _15 => _15.accepts, 'optionalAccess', _16 => _16.includes, 'call', _17 => _17("path")])) at('accepts lists "path", but no control has format "svg-path"');
|
|
146
|
+
for (const e of _chunkGHCSC2WPcjs.effectValueErrors.call(void 0, d, d.defaults)) at(`default ${e.path}: ${e.message}`);
|
|
147
|
+
for (const p of _nullishCoalesce(d.presets, () => ( []))) for (const e of _chunkGHCSC2WPcjs.effectValueErrors.call(void 0, d, p.values)) at(`preset "${p.name}" ${e.path}: ${e.message}`);
|
|
141
148
|
for (const input2 of _nullishCoalesce(d.inputs, () => ( []))) {
|
|
142
149
|
if (!input2.name || !input2.description) at("every input needs a name and a description");
|
|
143
150
|
if (input2.kind !== "image" && input2.kind !== "audio") at(`input "${input2.name}" has kind "${input2.kind}"`);
|
|
@@ -148,7 +155,7 @@ function checkDescription(id, d, issues) {
|
|
|
148
155
|
}
|
|
149
156
|
}
|
|
150
157
|
function grey(size) {
|
|
151
|
-
const p =
|
|
158
|
+
const p = _chunkGHCSC2WPcjs.createEffectPixels.call(void 0, size, size);
|
|
152
159
|
p.data.fill(128);
|
|
153
160
|
return p;
|
|
154
161
|
}
|
|
@@ -165,7 +172,7 @@ async function checkRender(provider, d, size, issues) {
|
|
|
165
172
|
}
|
|
166
173
|
try {
|
|
167
174
|
const out = await renderer.render({ time: 0, inputs });
|
|
168
|
-
if (!
|
|
175
|
+
if (!_chunkGHCSC2WPcjs.isEffectPixels.call(void 0, out)) at("render did not return EffectPixels");
|
|
169
176
|
else if (out.width !== size || out.height !== size || out.data.length !== size * size * 4) at(`render returned ${out.width}\xD7${out.height}, not ${size}\xD7${size}`);
|
|
170
177
|
} catch (e) {
|
|
171
178
|
at(`render failed: ${codeOf(e)}`);
|
|
@@ -195,10 +202,10 @@ async function checkCamera(provider, d, issues) {
|
|
|
195
202
|
at("cameraView must be synchronous; it returned a Promise");
|
|
196
203
|
return;
|
|
197
204
|
}
|
|
198
|
-
if (!
|
|
205
|
+
if (!_chunkGHCSC2WPcjs.isCameraView.call(void 0, view)) at(`cameraView at u ${u} is not a CameraView (zoom > 0, finite scrollX and scrollY): ${JSON.stringify(view)}`);
|
|
199
206
|
else views.push(view);
|
|
200
207
|
const again = provider.cameraView(d.id, ctx(u));
|
|
201
|
-
if (
|
|
208
|
+
if (_chunkGHCSC2WPcjs.isCameraView.call(void 0, view) && !sameView(view, again)) at(`cameraView is not pure: two calls at u ${u} gave different views`);
|
|
202
209
|
} catch (e) {
|
|
203
210
|
at(`cameraView at u ${u} failed: ${codeOf(e)}`);
|
|
204
211
|
}
|
|
@@ -208,10 +215,10 @@ async function checkCamera(provider, d, issues) {
|
|
|
208
215
|
if (provider.sampleCameraMove && views.length === 5) {
|
|
209
216
|
try {
|
|
210
217
|
const sample = await provider.sampleCameraMove(d.id, { from: WIDE, to, ms, stage: STAGE, fps: 10 });
|
|
211
|
-
const keys = _optionalChain([sample, 'optionalAccess',
|
|
218
|
+
const keys = _optionalChain([sample, 'optionalAccess', _18 => _18.keys]);
|
|
212
219
|
if (!Array.isArray(keys) || keys.length < 2) at("sampleCameraMove returned fewer than two keys");
|
|
213
220
|
else {
|
|
214
|
-
if (keys.some((k, i) => !
|
|
221
|
+
if (keys.some((k, i) => !_chunkGHCSC2WPcjs.isCameraView.call(void 0, k.view) || !Number.isFinite(k.t) || i > 0 && k.t < keys[i - 1].t)) at("sampleCameraMove keys must be CameraViews in time order");
|
|
215
222
|
if (keys[0].t !== 0 || keys[keys.length - 1].t !== ms) at(`sampleCameraMove keys must run from 0 to ${ms} ms, got ${keys[0].t} to ${keys[keys.length - 1].t}`);
|
|
216
223
|
else if (!near(keys[0].view, views[0]) || !near(keys[keys.length - 1].view, views[4])) at("sampleCameraMove disagrees with cameraView at the start or end of the move");
|
|
217
224
|
if (camera.cut !== void 0 && sample.cut === void 0) at("sampleCameraMove gave no cut for a move that cuts");
|
|
@@ -223,18 +230,18 @@ async function checkCamera(provider, d, issues) {
|
|
|
223
230
|
}
|
|
224
231
|
var wrongValue = (slot) => slot.type === "number" ? "not a number" : slot.type === "text" ? 42 : slot.type === "color" ? "blue" : 42;
|
|
225
232
|
function checkSlot(templateId, slot, issues) {
|
|
226
|
-
const at = (message) => issues.push({ templateId, message: `slot ${JSON.stringify(_optionalChain([slot, 'optionalAccess',
|
|
233
|
+
const at = (message) => issues.push({ templateId, message: `slot ${JSON.stringify(_optionalChain([slot, 'optionalAccess', _19 => _19.name]))}: ${message}` });
|
|
227
234
|
if (!slot || typeof slot.name !== "string" || !/^[A-Za-z][\w-]*$/.test(slot.name)) return at('needs a name of letters, digits, "-" and "_", starting with a letter');
|
|
228
|
-
if (!
|
|
235
|
+
if (!_chunkGHCSC2WPcjs.EFFECT_TEMPLATE_SLOT_TYPES.includes(slot.type)) return at(`type "${slot.type}" is not one of ${_chunkGHCSC2WPcjs.EFFECT_TEMPLATE_SLOT_TYPES.join(", ")}`);
|
|
229
236
|
if (typeof slot.label !== "string" || !slot.label) at("needs a label");
|
|
230
|
-
if (
|
|
237
|
+
if (_chunkK5DS2JTAcjs.isSubjectTemplateSlot.call(void 0, slot)) {
|
|
231
238
|
if (typeof slot.hasDefault !== "boolean") at("a subject slot needs hasDefault (a boolean)");
|
|
232
239
|
if ("default" in slot) at("a subject slot describes hasDefault, not its default");
|
|
233
240
|
return;
|
|
234
241
|
}
|
|
235
242
|
const fallback = slot.default;
|
|
236
243
|
if (fallback === void 0) return at("needs a default");
|
|
237
|
-
const problem =
|
|
244
|
+
const problem = _chunkK5DS2JTAcjs.templateValueProblem.call(void 0, slot, fallback);
|
|
238
245
|
if (problem) at(`its default does not fit: ${problem}`);
|
|
239
246
|
if (slot.type === "number" && slot.min !== void 0 && slot.max !== void 0 && slot.min > slot.max) at("min is above max");
|
|
240
247
|
}
|
|
@@ -268,8 +275,8 @@ async function checkTemplates(provider, list, issues) {
|
|
|
268
275
|
slots = d.slots;
|
|
269
276
|
const names = /* @__PURE__ */ new Set();
|
|
270
277
|
for (const slot of slots) {
|
|
271
|
-
if (names.has(_optionalChain([slot, 'optionalAccess',
|
|
272
|
-
names.add(_optionalChain([slot, 'optionalAccess',
|
|
278
|
+
if (names.has(_optionalChain([slot, 'optionalAccess', _20 => _20.name]))) at(`slot "${slot.name}" is declared twice`);
|
|
279
|
+
names.add(_optionalChain([slot, 'optionalAccess', _21 => _21.name]));
|
|
273
280
|
checkSlot(id, slot, issues);
|
|
274
281
|
}
|
|
275
282
|
} catch (e) {
|
|
@@ -280,11 +287,11 @@ async function checkTemplates(provider, list, issues) {
|
|
|
280
287
|
const result = await provider.instantiateTemplate(id);
|
|
281
288
|
if (!result.ok) at(`instantiateTemplate with the defaults failed: ${result.errors.join(" ")}`);
|
|
282
289
|
else {
|
|
283
|
-
for (const p of
|
|
284
|
-
if (_optionalChain([result, 'access',
|
|
290
|
+
for (const p of _chunkK5DS2JTAcjs.checkEffectSequence.call(void 0, result.sequence, list)) at(`with the defaults, ${p}`);
|
|
291
|
+
if (_optionalChain([result, 'access', _22 => _22.sequence, 'optionalAccess', _23 => _23.shots, 'optionalAccess', _24 => _24.length]) !== summary.shots) at(`listTemplates says ${summary.shots} shots; the sequence has ${_optionalChain([result, 'access', _25 => _25.sequence, 'optionalAccess', _26 => _26.shots, 'optionalAccess', _27 => _27.length])}`);
|
|
285
292
|
if (!Array.isArray(result.openSlots) || !Array.isArray(result.notes)) at("instantiateTemplate needs openSlots and notes lists");
|
|
286
293
|
else {
|
|
287
|
-
const open = Array.isArray(_optionalChain([result, 'access',
|
|
294
|
+
const open = Array.isArray(_optionalChain([result, 'access', _28 => _28.sequence, 'optionalAccess', _29 => _29.shots])) ? _chunkK5DS2JTAcjs.effectSequenceSlots.call(void 0, result.sequence) : [];
|
|
288
295
|
if (open.some((s) => !result.openSlots.includes(s))) at(`openSlots ${JSON.stringify(result.openSlots)} misses slots the sequence leaves open (${open.join(", ")})`);
|
|
289
296
|
}
|
|
290
297
|
}
|
|
@@ -308,20 +315,20 @@ async function checkEffectProvider(provider, options = {}) {
|
|
|
308
315
|
if (!provider.id) top("provider has no id");
|
|
309
316
|
const caps = provider.capabilities;
|
|
310
317
|
for (const k of ["supportsWorker", "supportsFloat", "supportsMask", "supportsHostImages", "supportsVector"]) {
|
|
311
|
-
if (typeof _optionalChain([caps, 'optionalAccess',
|
|
318
|
+
if (typeof _optionalChain([caps, 'optionalAccess', _30 => _30[k]]) !== "boolean") top(`capabilities.${k} is not a boolean`);
|
|
312
319
|
}
|
|
313
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
314
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
315
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
316
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
317
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
320
|
+
if (_optionalChain([caps, 'optionalAccess', _31 => _31.supportsAuthoring]) !== void 0 && typeof caps.supportsAuthoring !== "boolean") top("capabilities.supportsAuthoring is not a boolean");
|
|
321
|
+
if (_optionalChain([caps, 'optionalAccess', _32 => _32.supportsVector]) && typeof provider.applyVectorEffect !== "function") top("supportsVector is set but applyVectorEffect is missing");
|
|
322
|
+
if (_optionalChain([caps, 'optionalAccess', _33 => _33.supportsAuthoring]) && typeof provider.openAuthoring !== "function") top("supportsAuthoring is set but openAuthoring is missing");
|
|
323
|
+
if (_optionalChain([caps, 'optionalAccess', _34 => _34.supportsCamera]) !== void 0 && typeof caps.supportsCamera !== "boolean") top("capabilities.supportsCamera is not a boolean");
|
|
324
|
+
if (_optionalChain([caps, 'optionalAccess', _35 => _35.supportsCamera]) && typeof provider.cameraView !== "function") top("supportsCamera is set but cameraView is missing");
|
|
318
325
|
if (provider.sampleCameraMove && typeof provider.cameraView !== "function") top("sampleCameraMove is present but cameraView is missing");
|
|
319
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
326
|
+
if (_optionalChain([caps, 'optionalAccess', _36 => _36.supportsTemplates]) !== void 0 && typeof caps.supportsTemplates !== "boolean") top("capabilities.supportsTemplates is not a boolean");
|
|
320
327
|
const templateMethods = ["listTemplates", "describeTemplate", "instantiateTemplate"];
|
|
321
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
328
|
+
if (_optionalChain([caps, 'optionalAccess', _37 => _37.supportsTemplates])) {
|
|
322
329
|
for (const m of templateMethods) if (typeof provider[m] !== "function") top(`supportsTemplates is set but ${m} is missing`);
|
|
323
330
|
}
|
|
324
|
-
if (!_optionalChain([caps, 'optionalAccess',
|
|
331
|
+
if (!_optionalChain([caps, 'optionalAccess', _38 => _38.supportsTemplates]) && templateMethods.some((m) => typeof provider[m] === "function")) top("template methods are present but capabilities.supportsTemplates is not set");
|
|
325
332
|
const list = await provider.list();
|
|
326
333
|
const ids = /* @__PURE__ */ new Set();
|
|
327
334
|
for (const e of list) {
|
|
@@ -329,10 +336,10 @@ async function checkEffectProvider(provider, options = {}) {
|
|
|
329
336
|
ids.add(e.id);
|
|
330
337
|
checkSummary(e, issues);
|
|
331
338
|
}
|
|
332
|
-
if (!_optionalChain([caps, 'optionalAccess',
|
|
339
|
+
if (!_optionalChain([caps, 'optionalAccess', _39 => _39.supportsCamera]) && list.some((e) => e.kind === "camera")) top("the catalog lists camera effects but capabilities.supportsCamera is not set");
|
|
333
340
|
const all = await provider.search("");
|
|
334
341
|
if (all.length !== list.length) top(`search("") returned ${all.length} effects, list() ${list.length}`);
|
|
335
|
-
const firstUse = _optionalChain([list, 'access',
|
|
342
|
+
const firstUse = _optionalChain([list, 'access', _40 => _40[0], 'optionalAccess', _41 => _41.uses, 'access', _42 => _42[0]]);
|
|
336
343
|
if (firstUse) {
|
|
337
344
|
const filtered = await provider.search("", { use: firstUse });
|
|
338
345
|
if (filtered.some((e) => !e.uses.includes(firstUse))) top(`search("", { use: "${firstUse}" }) returned effects without that use`);
|
|
@@ -341,7 +348,7 @@ async function checkEffectProvider(provider, options = {}) {
|
|
|
341
348
|
if (unknown) top(`describe of an unknown id ${unknown}`);
|
|
342
349
|
const unknownRenderer = await rejectsWith("unknown_effect", () => provider.createRenderer("__no_such_effect__", { width: 4, height: 4 }));
|
|
343
350
|
if (unknownRenderer) top(`createRenderer of an unknown id ${unknownRenderer}`);
|
|
344
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
351
|
+
if (_optionalChain([caps, 'optionalAccess', _43 => _43.supportsCamera]) && provider.cameraView) {
|
|
345
352
|
const probe = { from: WIDE, to: CLOSE, u: 0.5, ms: 1e3, stage: STAGE };
|
|
346
353
|
const unknownCamera = await rejectsWith("unknown_effect", () => provider.cameraView("__no_such_effect__", probe));
|
|
347
354
|
if (unknownCamera) top(`cameraView of an unknown id ${unknownCamera}`);
|
|
@@ -373,7 +380,7 @@ async function checkEffectProvider(provider, options = {}) {
|
|
|
373
380
|
if (bad) issues.push({ effectId: id, message: `applyVectorEffect with an unknown control ${bad}` });
|
|
374
381
|
}
|
|
375
382
|
}
|
|
376
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
383
|
+
if (_optionalChain([caps, 'optionalAccess', _44 => _44.supportsAuthoring]) && options.authoring !== false && typeof provider.openAuthoring === "function") {
|
|
377
384
|
const targetEffect = (await Promise.all((_nullishCoalesce(options.ids, () => ( [...ids]))).map((id) => provider.describe(id)))).find(
|
|
378
385
|
(d) => d.kind !== "motion" && d.kind !== "vector" && d.kind !== "camera"
|
|
379
386
|
);
|
|
@@ -424,7 +431,7 @@ async function checkEffectProvider(provider, options = {}) {
|
|
|
424
431
|
}
|
|
425
432
|
}
|
|
426
433
|
}
|
|
427
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
434
|
+
if (_optionalChain([caps, 'optionalAccess', _45 => _45.supportsTemplates]) && options.templates !== false && templateMethods.every((m) => typeof provider[m] === "function")) await checkTemplates(provider, list, issues);
|
|
428
435
|
return issues;
|
|
429
436
|
}
|
|
430
437
|
|
|
@@ -502,7 +509,7 @@ function fill(t, values) {
|
|
|
502
509
|
const slots = new Map(t.slots.map((s) => [s.name, s]));
|
|
503
510
|
const valueOf = (name) => {
|
|
504
511
|
const s = slots.get(name);
|
|
505
|
-
return _nullishCoalesce(values[name], () => ( (
|
|
512
|
+
return _nullishCoalesce(values[name], () => ( (_chunkK5DS2JTAcjs.isSubjectTemplateSlot.call(void 0, s) ? s.subjectDefault : s.default)));
|
|
506
513
|
};
|
|
507
514
|
const walk = (v, key) => {
|
|
508
515
|
if (typeof v === "string") {
|
|
@@ -525,20 +532,20 @@ function fakeTemplateMethods() {
|
|
|
525
532
|
const byId = new Map(TEMPLATES.map((t) => [t.summary.id, t]));
|
|
526
533
|
const get = (id) => {
|
|
527
534
|
const t = byId.get(id);
|
|
528
|
-
if (!t) throw new (0,
|
|
535
|
+
if (!t) throw new (0, _chunkGHCSC2WPcjs.UnknownTemplateError)(id, "the fake provider");
|
|
529
536
|
return t;
|
|
530
537
|
};
|
|
531
538
|
return {
|
|
532
|
-
listTemplates: (options) =>
|
|
539
|
+
listTemplates: (options) => _chunkK5DS2JTAcjs.searchTemplateSummaries.call(void 0, TEMPLATES.map((t) => t.summary), options).map((s) => structuredClone(s)),
|
|
533
540
|
describeTemplate: (id) => structuredClone(describeOf(get(id))),
|
|
534
541
|
instantiateTemplate(id, values = {}, options = {}) {
|
|
535
542
|
const t = get(id);
|
|
536
|
-
const errors =
|
|
537
|
-
if (options.name !== void 0 && (typeof options.name !== "string" || !
|
|
543
|
+
const errors = _chunkK5DS2JTAcjs.checkTemplateValues.call(void 0, describeOf(t).slots, values);
|
|
544
|
+
if (options.name !== void 0 && (typeof options.name !== "string" || !_chunkK5DS2JTAcjs.EFFECT_SEQUENCE_NAME.test(options.name))) errors.push(`The sequence name is lowercase words and dashes (like "${t.summary.id.replace(/^fake\./, "")}").`);
|
|
538
545
|
if (errors.length) return { ok: false, errors };
|
|
539
546
|
const sequence = fill(t, values);
|
|
540
547
|
if (options.name) sequence.name = options.name;
|
|
541
|
-
return { ok: true, sequence, openSlots:
|
|
548
|
+
return { ok: true, sequence, openSlots: _chunkK5DS2JTAcjs.effectSequenceSlots.call(void 0, sequence), notes: [] };
|
|
542
549
|
}
|
|
543
550
|
};
|
|
544
551
|
}
|
|
@@ -547,6 +554,13 @@ function fakeTemplateMethods() {
|
|
|
547
554
|
var HEX = "^#[0-9a-fA-F]{6}$";
|
|
548
555
|
var colour = (description) => ({ type: "string", pattern: HEX, description });
|
|
549
556
|
var amount = (description) => ({ type: "number", minimum: 0, maximum: 1, description });
|
|
557
|
+
var pathControl = (what) => ({
|
|
558
|
+
description: `${what}: SVG path data (fitted into the frame, contain, 8% margin), or points [x0, y0, x1, y1, \u2026] in frame pixels from the top left (used as given), or "" for none.`,
|
|
559
|
+
anyOf: [
|
|
560
|
+
{ type: "string", format: "svg-path", description: 'SVG path data, or "" for no path.' },
|
|
561
|
+
{ type: "array", items: { type: "number", description: "x or y, frame pixels." }, description: "Points x0, y0, x1, y1, \u2026 in frame pixels." }
|
|
562
|
+
]
|
|
563
|
+
});
|
|
550
564
|
var DESCRIPTIONS = [
|
|
551
565
|
{
|
|
552
566
|
id: "fake.invert",
|
|
@@ -711,8 +725,77 @@ var DESCRIPTIONS = [
|
|
|
711
725
|
defaults: { color: "#f43f5e", ms: 500 },
|
|
712
726
|
presets: [],
|
|
713
727
|
inputs: []
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
id: "fake.trail",
|
|
731
|
+
name: "Trail",
|
|
732
|
+
kind: "shader",
|
|
733
|
+
category: "path",
|
|
734
|
+
uses: ["overlay"],
|
|
735
|
+
description: "A line drawn along its path control over transparency; with no path, a line across the middle.",
|
|
736
|
+
tags: ["path", "line"],
|
|
737
|
+
transparent: true,
|
|
738
|
+
loop: false,
|
|
739
|
+
accepts: ["path"],
|
|
740
|
+
controls: {
|
|
741
|
+
type: "object",
|
|
742
|
+
additionalProperties: false,
|
|
743
|
+
properties: {
|
|
744
|
+
path: pathControl("Where the line runs"),
|
|
745
|
+
color: colour("Line colour as #rrggbb. Default #22d3ee."),
|
|
746
|
+
width: { type: "number", minimum: 1, maximum: 64, description: "Line width in pixels. Default 6." }
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
defaults: { path: "", color: "#22d3ee", width: 6 },
|
|
750
|
+
presets: [],
|
|
751
|
+
inputs: []
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
id: "fake.route",
|
|
755
|
+
name: "Route",
|
|
756
|
+
kind: "vector",
|
|
757
|
+
category: "path",
|
|
758
|
+
uses: ["title"],
|
|
759
|
+
description: "A vector line along its path control, its picture fitted to the path (viewBox = the path bounds); with no path, a short wave.",
|
|
760
|
+
tags: ["path", "route"],
|
|
761
|
+
transparent: true,
|
|
762
|
+
loop: false,
|
|
763
|
+
duration: 400,
|
|
764
|
+
accepts: ["path"],
|
|
765
|
+
controls: {
|
|
766
|
+
type: "object",
|
|
767
|
+
additionalProperties: false,
|
|
768
|
+
properties: {
|
|
769
|
+
path: pathControl("The route"),
|
|
770
|
+
color: colour("Line colour as #rrggbb. Default #f59e0b.")
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
defaults: { path: "", color: "#f59e0b" },
|
|
774
|
+
presets: [],
|
|
775
|
+
inputs: []
|
|
714
776
|
}
|
|
715
777
|
];
|
|
778
|
+
function pathNumbers(d) {
|
|
779
|
+
return [...d.matchAll(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi)].map((m) => Number(m[0]));
|
|
780
|
+
}
|
|
781
|
+
function framePoints(value, width, height, fallback) {
|
|
782
|
+
if (Array.isArray(value)) return value.length >= 4 ? value : fallback;
|
|
783
|
+
if (typeof value !== "string" || !value.trim()) return fallback;
|
|
784
|
+
const n = pathNumbers(value);
|
|
785
|
+
if (n.length < 4) return fallback;
|
|
786
|
+
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
787
|
+
for (let i = 0; i + 1 < n.length; i += 2) {
|
|
788
|
+
x0 = Math.min(x0, n[i]);
|
|
789
|
+
x1 = Math.max(x1, n[i]);
|
|
790
|
+
y0 = Math.min(y0, n[i + 1]);
|
|
791
|
+
y1 = Math.max(y1, n[i + 1]);
|
|
792
|
+
}
|
|
793
|
+
const m = 0.08;
|
|
794
|
+
const k = Math.min(width * (1 - 2 * m) / Math.max(1e-9, x1 - x0), height * (1 - 2 * m) / Math.max(1e-9, y1 - y0));
|
|
795
|
+
const ox = (width - (x1 - x0) * k) / 2 - x0 * k;
|
|
796
|
+
const oy = (height - (y1 - y0) * k) / 2 - y0 * k;
|
|
797
|
+
return n.map((v, i) => i % 2 ? v * k + oy : v * k + ox);
|
|
798
|
+
}
|
|
716
799
|
var CAMERA_DESCRIPTIONS = [
|
|
717
800
|
{
|
|
718
801
|
id: "fake.glide",
|
|
@@ -783,16 +866,16 @@ var hexToRgb = (hex) => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16));
|
|
|
783
866
|
var smooth = (t) => t * t * (3 - 2 * t);
|
|
784
867
|
var clamp01 = (v) => v < 0 ? 0 : v > 1 ? 1 : v;
|
|
785
868
|
function input(request, name, id, width, height) {
|
|
786
|
-
const src = _optionalChain([request, 'access',
|
|
787
|
-
if (!src) throw new (0,
|
|
788
|
-
if (!
|
|
869
|
+
const src = _optionalChain([request, 'access', _46 => _46.inputs, 'optionalAccess', _47 => _47[name]]);
|
|
870
|
+
if (!src) throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`Effect "${id}" needs an input named "${name}".`, id);
|
|
871
|
+
if (!_chunkGHCSC2WPcjs.isEffectPixels.call(void 0, src)) throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`The fake provider only takes EffectPixels inputs ("${name}").`, id);
|
|
789
872
|
if (src.width !== width || src.height !== height) {
|
|
790
|
-
throw new (0,
|
|
873
|
+
throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`Input "${name}" is ${src.width}\xD7${src.height}; the renderer is ${width}\xD7${height}.`, id);
|
|
791
874
|
}
|
|
792
875
|
return src;
|
|
793
876
|
}
|
|
794
877
|
function renderPixels(d, v, request, width, height) {
|
|
795
|
-
const out =
|
|
878
|
+
const out = _chunkGHCSC2WPcjs.createEffectPixels.call(void 0, width, height);
|
|
796
879
|
const o = out.data;
|
|
797
880
|
switch (d.id) {
|
|
798
881
|
case "fake.invert": {
|
|
@@ -831,6 +914,29 @@ function renderPixels(d, v, request, width, height) {
|
|
|
831
914
|
}
|
|
832
915
|
break;
|
|
833
916
|
}
|
|
917
|
+
case "fake.trail": {
|
|
918
|
+
const rgb = hexToRgb(v.color);
|
|
919
|
+
const pts = framePoints(v.path, width, height, [0, height / 2, width, height / 2]);
|
|
920
|
+
const r = v.width / 2;
|
|
921
|
+
for (let i = 0; i + 3 < pts.length; i += 2) {
|
|
922
|
+
const [ax, ay, bx, by] = [pts[i], pts[i + 1], pts[i + 2], pts[i + 3]];
|
|
923
|
+
const steps = Math.max(1, Math.ceil(Math.hypot(bx - ax, by - ay)));
|
|
924
|
+
for (let s = 0; s <= steps; s++) {
|
|
925
|
+
const cx = ax + (bx - ax) * s / steps;
|
|
926
|
+
const cy = ay + (by - ay) * s / steps;
|
|
927
|
+
for (let y = Math.max(0, Math.floor(cy - r)); y <= Math.min(height - 1, Math.ceil(cy + r)); y++)
|
|
928
|
+
for (let x = Math.max(0, Math.floor(cx - r)); x <= Math.min(width - 1, Math.ceil(cx + r)); x++) {
|
|
929
|
+
if ((x + 0.5 - cx) ** 2 + (y + 0.5 - cy) ** 2 > r * r) continue;
|
|
930
|
+
const i4 = (y * width + x) * 4;
|
|
931
|
+
o[i4] = rgb[0];
|
|
932
|
+
o[i4 + 1] = rgb[1];
|
|
933
|
+
o[i4 + 2] = rgb[2];
|
|
934
|
+
o[i4 + 3] = 255;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
break;
|
|
939
|
+
}
|
|
834
940
|
case "fake.bar": {
|
|
835
941
|
const rgb = hexToRgb(v.color);
|
|
836
942
|
const slide = v.slide;
|
|
@@ -858,7 +964,7 @@ function renderPixels(d, v, request, width, height) {
|
|
|
858
964
|
break;
|
|
859
965
|
}
|
|
860
966
|
default:
|
|
861
|
-
throw new (0,
|
|
967
|
+
throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`"${d.id}" is a ${d.kind} effect; use applyVectorEffect.`, d.id);
|
|
862
968
|
}
|
|
863
969
|
return out;
|
|
864
970
|
}
|
|
@@ -888,22 +994,22 @@ function cameraViewOf(d, ctx, v) {
|
|
|
888
994
|
case "fake.drift":
|
|
889
995
|
return viewAt(x0, y0, from.zoom * lerp(1, v.scale, smooth(u)), ctx);
|
|
890
996
|
default:
|
|
891
|
-
throw new (0,
|
|
997
|
+
throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`"${d.id}" is a ${d.kind} effect, not a camera move.`, d.id);
|
|
892
998
|
}
|
|
893
999
|
}
|
|
894
1000
|
function toFloat(p) {
|
|
895
1001
|
const f = new Float32Array(p.data.length);
|
|
896
1002
|
for (let i = 0; i < f.length; i += 4) {
|
|
897
|
-
f[i] =
|
|
898
|
-
f[i + 1] =
|
|
899
|
-
f[i + 2] =
|
|
1003
|
+
f[i] = _chunkGHCSC2WPcjs.srgbToLinear.call(void 0, p.data[i] / 255);
|
|
1004
|
+
f[i + 1] = _chunkGHCSC2WPcjs.srgbToLinear.call(void 0, p.data[i + 1] / 255);
|
|
1005
|
+
f[i + 2] = _chunkGHCSC2WPcjs.srgbToLinear.call(void 0, p.data[i + 2] / 255);
|
|
900
1006
|
f[i + 3] = p.data[i + 3] / 255;
|
|
901
1007
|
}
|
|
902
|
-
return
|
|
1008
|
+
return _chunkGHCSC2WPcjs.encodeEffectFloat.call(void 0, { ...p, float: f });
|
|
903
1009
|
}
|
|
904
1010
|
function maskResult(out, mask, source, id) {
|
|
905
|
-
if (!
|
|
906
|
-
throw new (0,
|
|
1011
|
+
if (!_chunkGHCSC2WPcjs.isEffectPixels.call(void 0, mask) || mask.width !== out.width || mask.height !== out.height) {
|
|
1012
|
+
throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)("The mask must be EffectPixels the size of the renderer.", id);
|
|
907
1013
|
}
|
|
908
1014
|
const o = out.data;
|
|
909
1015
|
for (let i = 0; i < o.length; i += 4) {
|
|
@@ -930,32 +1036,32 @@ function createFakeEffectProvider(options = {}) {
|
|
|
930
1036
|
const byId = new Map(all.map((d) => [d.id, d]));
|
|
931
1037
|
const get = (id) => {
|
|
932
1038
|
const d = byId.get(id);
|
|
933
|
-
if (!d) throw new (0,
|
|
1039
|
+
if (!d) throw new (0, _chunkGHCSC2WPcjs.UnknownEffectError)(id, "the fake provider");
|
|
934
1040
|
return d;
|
|
935
1041
|
};
|
|
936
1042
|
const summaries = all.map(summaryOf);
|
|
937
1043
|
const camera = (id, ctx, values) => {
|
|
938
1044
|
const d = get(id);
|
|
939
|
-
if (d.kind !== "camera") throw new (0,
|
|
940
|
-
if (!(ctx.u >= 0 && ctx.u <= 1)) throw new (0,
|
|
941
|
-
return cameraViewOf(d, ctx,
|
|
1045
|
+
if (d.kind !== "camera") throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`"${id}" is a ${d.kind} effect, not a camera move.`, id);
|
|
1046
|
+
if (!(ctx.u >= 0 && ctx.u <= 1)) throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`u must be 0\u20131 through the move, got ${ctx.u}.`, id);
|
|
1047
|
+
return cameraViewOf(d, ctx, _chunkGHCSC2WPcjs.resolveEffectValues.call(void 0, d, values));
|
|
942
1048
|
};
|
|
943
1049
|
const provider = {
|
|
944
1050
|
id: "fake",
|
|
945
1051
|
name: "Fake effects",
|
|
946
1052
|
version: "1",
|
|
947
1053
|
capabilities,
|
|
948
|
-
list: (o) =>
|
|
949
|
-
search: (q, o) =>
|
|
1054
|
+
list: (o) => _chunkGHCSC2WPcjs.searchEffectSummaries.call(void 0, summaries, "", o),
|
|
1055
|
+
search: (q, o) => _chunkGHCSC2WPcjs.searchEffectSummaries.call(void 0, summaries, q, o),
|
|
950
1056
|
describe: (id) => structuredClone(get(id)),
|
|
951
1057
|
createRenderer(id, ro) {
|
|
952
1058
|
const d = get(id);
|
|
953
|
-
if (d.kind === "camera") throw new (0,
|
|
954
|
-
if (d.kind !== "shader") throw new (0,
|
|
1059
|
+
if (d.kind === "camera") throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`"${id}" is a camera move: it moves a scene's camera and draws no pixels. Use cameraView.`, id);
|
|
1060
|
+
if (d.kind !== "shader") throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`"${id}" is a ${d.kind} effect; use applyVectorEffect.`, id);
|
|
955
1061
|
const { width, height } = ro;
|
|
956
1062
|
const depth = _nullishCoalesce(ro.depth, () => ( 8));
|
|
957
1063
|
if (!(width > 0 && height > 0) || width > capabilities.maxSize || height > capabilities.maxSize) {
|
|
958
|
-
throw new (0,
|
|
1064
|
+
throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`Renderer size ${width}\xD7${height} is outside 1\u2013${capabilities.maxSize}.`, id);
|
|
959
1065
|
}
|
|
960
1066
|
let disposed = false;
|
|
961
1067
|
return {
|
|
@@ -964,16 +1070,16 @@ function createFakeEffectProvider(options = {}) {
|
|
|
964
1070
|
height,
|
|
965
1071
|
depth,
|
|
966
1072
|
async render(request) {
|
|
967
|
-
if (disposed) throw new (0,
|
|
1073
|
+
if (disposed) throw new (0, _chunkGHCSC2WPcjs.EffectDisposedError)(id);
|
|
968
1074
|
if (!Number.isFinite(request.time) || request.time < 0) {
|
|
969
|
-
throw new (0,
|
|
1075
|
+
throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`time must be a finite number of ms \u2265 0, got ${request.time}.`, id);
|
|
970
1076
|
}
|
|
971
|
-
const values =
|
|
972
|
-
_optionalChain([options, 'access',
|
|
1077
|
+
const values = _chunkGHCSC2WPcjs.resolveEffectValues.call(void 0, d, request.values);
|
|
1078
|
+
_optionalChain([options, 'access', _48 => _48.onRender, 'optionalCall', _49 => _49(id, request)]);
|
|
973
1079
|
const out = renderPixels(d, values, request, width, height);
|
|
974
1080
|
if (request.mask) {
|
|
975
|
-
if (!capabilities.supportsMask) throw new (0,
|
|
976
|
-
const source = d.uses.includes("filter") ? _optionalChain([request, 'access',
|
|
1081
|
+
if (!capabilities.supportsMask) throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)("This provider does not take masks.", id);
|
|
1082
|
+
const source = d.uses.includes("filter") ? _optionalChain([request, 'access', _50 => _50.inputs, 'optionalAccess', _51 => _51.source]) : void 0;
|
|
977
1083
|
maskResult(out, request.mask, source, id);
|
|
978
1084
|
}
|
|
979
1085
|
return depth > 8 && capabilities.supportsFloat ? toFloat(out) : out;
|
|
@@ -983,10 +1089,29 @@ function createFakeEffectProvider(options = {}) {
|
|
|
983
1089
|
}
|
|
984
1090
|
};
|
|
985
1091
|
},
|
|
1092
|
+
pathFromText(text, opts) {
|
|
1093
|
+
if (typeof text !== "string" || !text.trim()) throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)("There are no words to write; pass some text.");
|
|
1094
|
+
if (_optionalChain([opts, 'optionalAccess', _52 => _52.font]) !== void 0 && opts.font !== "zig") throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`The fake provider has no font "${opts.font}"; its only font is "zig".`);
|
|
1095
|
+
return [...text].map((_, i) => `M${i * 10} 10 L${i * 10 + 3} 0 L${i * 10 + 6} 10`).join(" ");
|
|
1096
|
+
},
|
|
986
1097
|
applyVectorEffect(id, target, values) {
|
|
987
1098
|
const d = get(id);
|
|
988
|
-
if (d.kind !== "motion" && d.kind !== "vector") throw new (0,
|
|
989
|
-
const v =
|
|
1099
|
+
if (d.kind !== "motion" && d.kind !== "vector") throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(`"${id}" is a ${d.kind} effect, not a vector one.`, id);
|
|
1100
|
+
const v = _chunkGHCSC2WPcjs.resolveEffectValues.call(void 0, d, values);
|
|
1101
|
+
if (d.id === "fake.route") {
|
|
1102
|
+
const pts = Array.isArray(v.path) && v.path.length >= 4 ? v.path : typeof v.path === "string" && pathNumbers(v.path).length >= 4 ? pathNumbers(v.path) : [0, 20, 25, 0, 50, 20, 75, 40, 100, 20];
|
|
1103
|
+
const xs = pts.filter((_, i) => i % 2 === 0);
|
|
1104
|
+
const ys = pts.filter((_, i) => i % 2 === 1);
|
|
1105
|
+
const [x0, y0] = [Math.min(...xs), Math.min(...ys)];
|
|
1106
|
+
const [w, h] = [Math.max(1, Math.max(...xs) - x0), Math.max(1, Math.max(...ys) - y0)];
|
|
1107
|
+
const dpath = "M" + pts.map((p) => +p.toFixed(3)).join(" ").replace(/^(\S+ \S+) /, "$1 L");
|
|
1108
|
+
return {
|
|
1109
|
+
svg: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${x0} ${y0} ${w} ${h}" width="${w}" height="${h}"><path id="route" d="${dpath}" fill="none" stroke="${v.color}" stroke-width="2"/></svg>`,
|
|
1110
|
+
animate: [{ id: "route", ms: 400, attrs: { opacity: [0, 1] } }],
|
|
1111
|
+
duration: 400,
|
|
1112
|
+
loop: false
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
990
1115
|
if (d.kind === "vector") {
|
|
991
1116
|
return { svg: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100"><circle id="badge" cx="50" cy="50" r="40" fill="${v.color}"/></svg>`, animate: [{ id: "badge", ms: v.ms, attrs: { opacity: [0, 1] } }], duration: v.ms, loop: false };
|
|
992
1117
|
}
|
|
@@ -1006,12 +1131,12 @@ function createFakeEffectProvider(options = {}) {
|
|
|
1006
1131
|
sampleCameraMove: (id, request) => {
|
|
1007
1132
|
const d = get(id);
|
|
1008
1133
|
const { from, to, ms, stage, fps, values } = request;
|
|
1009
|
-
return
|
|
1134
|
+
return _chunkGHCSC2WPcjs.sampleCameraViews.call(void 0, (u) => camera(id, { from, to, u, ms, stage }, values), { ms, fps, cut: _optionalChain([d, 'access', _53 => _53.camera, 'optionalAccess', _54 => _54.cut]) });
|
|
1010
1135
|
}
|
|
1011
1136
|
} : {},
|
|
1012
1137
|
...options.templates ? fakeTemplateMethods() : {},
|
|
1013
1138
|
...supportsAuthoring ? {
|
|
1014
|
-
openAuthoring: (from) =>
|
|
1139
|
+
openAuthoring: (from) => _chunk7V7QMFTIcjs.createEffectAuthoringSession.call(void 0, from, { provider })
|
|
1015
1140
|
} : {}
|
|
1016
1141
|
};
|
|
1017
1142
|
return provider;
|
|
@@ -1047,7 +1172,7 @@ function jsonTypeOf(value) {
|
|
|
1047
1172
|
function effectControlField(name, schema, fallback, options = {}) {
|
|
1048
1173
|
const base = { id: name, ...schema.title ? { label: schema.title } : {}, ...schema.description ? { description: schema.description } : {} };
|
|
1049
1174
|
const def = _nullishCoalesce(schema.default, () => ( fallback));
|
|
1050
|
-
const type = _nullishCoalesce(typeOf(schema), () => ( typeOf(_nullishCoalesce(_optionalChain([schema, 'access',
|
|
1175
|
+
const type = _nullishCoalesce(typeOf(schema), () => ( typeOf(_nullishCoalesce(_optionalChain([schema, 'access', _55 => _55.anyOf, 'optionalAccess', _56 => _56.find, 'call', _57 => _57((s) => typeOf(s) === jsonTypeOf(def))]), () => ( {})))));
|
|
1051
1176
|
if (Array.isArray(schema.enum) && schema.enum.length) {
|
|
1052
1177
|
const options2 = schema.enum.filter((v) => typeof v === "string" || typeof v === "number");
|
|
1053
1178
|
return { ...base, type: "choice", options: options2, default: typeof def === "string" || typeof def === "number" ? def : options2[0], control: options2.length <= 4 ? "segmented" : "select" };
|
|
@@ -1061,7 +1186,7 @@ function effectControlField(name, schema, fallback, options = {}) {
|
|
|
1061
1186
|
if (isEffectFontControl(schema)) {
|
|
1062
1187
|
const fonts = _nullishCoalesce(options.fonts, () => ( _chunk4XSBOGMKcjs.SYSTEM_FONT_CATALOG));
|
|
1063
1188
|
const opts = fonts.map((f) => ({ value: f.family, label: f.family, description: f.category }));
|
|
1064
|
-
const current = typeof def === "string" && def ? def : _nullishCoalesce(_optionalChain([opts, 'access',
|
|
1189
|
+
const current = typeof def === "string" && def ? def : _nullishCoalesce(_optionalChain([opts, 'access', _58 => _58[0], 'optionalAccess', _59 => _59.value]), () => ( "sans-serif"));
|
|
1065
1190
|
if (!opts.some((o) => o.value.toLowerCase() === current.toLowerCase())) opts.unshift({ value: current, label: current, description: "current" });
|
|
1066
1191
|
return { ...base, type: "choice", options: opts, default: opts.find((o) => o.value.toLowerCase() === current.toLowerCase()).value, control: "select" };
|
|
1067
1192
|
}
|
|
@@ -1070,7 +1195,7 @@ function effectControlField(name, schema, fallback, options = {}) {
|
|
|
1070
1195
|
return { ...base, type: "text", default: typeof def === "string" ? def : "", ...schema.maxLength ? { maxLength: schema.maxLength } : {} };
|
|
1071
1196
|
}
|
|
1072
1197
|
if (type === "array" && Array.isArray(def) && def.length >= 2 && def.length <= 4 && def.every((n) => typeof n === "number")) {
|
|
1073
|
-
const items = _nullishCoalesce(_nullishCoalesce(schema.items, () => ( _optionalChain([schema, 'access',
|
|
1198
|
+
const items = _nullishCoalesce(_nullishCoalesce(schema.items, () => ( _optionalChain([schema, 'access', _60 => _60.anyOf, 'optionalAccess', _61 => _61.find, 'call', _62 => _62((s) => typeOf(s) === "array"), 'optionalAccess', _63 => _63.items]))), () => ( {}));
|
|
1074
1199
|
return { ...base, type: "vector", size: def.length, default: [...def], ...items.minimum !== void 0 ? { min: items.minimum } : {}, ...items.maximum !== void 0 ? { max: items.maximum } : {} };
|
|
1075
1200
|
}
|
|
1076
1201
|
return null;
|
|
@@ -1092,7 +1217,7 @@ var effectFieldValue = (field, value) => {
|
|
|
1092
1217
|
return value === void 0 || value === null || typeof value === "object" && !Array.isArray(value) ? field.default : value;
|
|
1093
1218
|
};
|
|
1094
1219
|
function effectSamplePicture(width, height, variant = 0) {
|
|
1095
|
-
const p =
|
|
1220
|
+
const p = _chunkGHCSC2WPcjs.createEffectPixels.call(void 0, width, height);
|
|
1096
1221
|
for (let y = 0, i = 0; y < height; y++) {
|
|
1097
1222
|
for (let x = 0; x < width; x++, i += 4) {
|
|
1098
1223
|
const u = x / Math.max(1, width - 1);
|
|
@@ -1183,11 +1308,11 @@ var EASING_SCHEMA = {
|
|
|
1183
1308
|
};
|
|
1184
1309
|
var NO_SESSION = "No effect authoring session is currently open. Open an effect using EffectProvider.openAuthoring() or in an authoring editor before calling effect authoring tools.";
|
|
1185
1310
|
function createEffectAuthoringToolProvider(host, options) {
|
|
1186
|
-
const id = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1187
|
-
const namespace = _optionalChain([options, 'optionalAccess',
|
|
1188
|
-
const title = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1189
|
-
const description = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1190
|
-
const skill = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1311
|
+
const id = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _64 => _64.id]), () => ( "effect-authoring"));
|
|
1312
|
+
const namespace = _optionalChain([options, 'optionalAccess', _65 => _65.namespace]);
|
|
1313
|
+
const title = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _66 => _66.title]), () => ( "Effect authoring"));
|
|
1314
|
+
const description = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _67 => _67.description]), () => ( "Author shaders and procedural effects, inspect parameters, adjust values, and manage keyframe animations."));
|
|
1315
|
+
const skill = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _68 => _68.skill]), () => ( "pixerate-effect-authoring"));
|
|
1191
1316
|
const requireSession = () => {
|
|
1192
1317
|
const s = host.session();
|
|
1193
1318
|
if (!s) throw new Error(NO_SESSION);
|
|
@@ -1208,7 +1333,7 @@ function createEffectAuthoringToolProvider(host, options) {
|
|
|
1208
1333
|
sourceLanguage: state.sourceLanguage,
|
|
1209
1334
|
controls: effectParameterFields(state.description),
|
|
1210
1335
|
values: state.values,
|
|
1211
|
-
presets: _nullishCoalesce(_optionalChain([state, 'access',
|
|
1336
|
+
presets: _nullishCoalesce(_optionalChain([state, 'access', _69 => _69.description, 'access', _70 => _70.presets, 'optionalAccess', _71 => _71.map, 'call', _72 => _72((p) => p.name)]), () => ( [])),
|
|
1212
1337
|
tracks: Object.entries(state.tracks).map(([control, track]) => ({
|
|
1213
1338
|
control,
|
|
1214
1339
|
keyframes: track.length
|
|
@@ -1515,7 +1640,7 @@ function createEffectAuthoringToolProvider(host, options) {
|
|
|
1515
1640
|
const tools = [
|
|
1516
1641
|
describeTool,
|
|
1517
1642
|
getSourceTool,
|
|
1518
|
-
..._optionalChain([session, 'optionalAccess',
|
|
1643
|
+
..._optionalChain([session, 'optionalAccess', _73 => _73.setSource]) ? [setSourceTool] : [],
|
|
1519
1644
|
setValuesTool,
|
|
1520
1645
|
resetValuesTool,
|
|
1521
1646
|
applyPresetTool,
|
|
@@ -1615,4 +1740,7 @@ function createEffectAuthoringToolProvider(host, options) {
|
|
|
1615
1740
|
|
|
1616
1741
|
|
|
1617
1742
|
|
|
1618
|
-
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
exports.CAMERA_MOVE_MAX_MS = _chunkGHCSC2WPcjs.CAMERA_MOVE_MAX_MS; exports.CAMERA_MOVE_ROLES = _chunkGHCSC2WPcjs.CAMERA_MOVE_ROLES; exports.EFFECT_ACCEPTS = _chunkGHCSC2WPcjs.EFFECT_ACCEPTS; exports.EFFECT_ERROR_CODES = _chunkGHCSC2WPcjs.EFFECT_ERROR_CODES; exports.EFFECT_KINDS = _chunkGHCSC2WPcjs.EFFECT_KINDS; exports.EFFECT_LAYER_ROLES = _chunkGHCSC2WPcjs.EFFECT_LAYER_ROLES; exports.EFFECT_LAYER_USES = _chunkK5DS2JTAcjs.EFFECT_LAYER_USES; exports.EFFECT_PATH_FORMAT = _chunkGHCSC2WPcjs.EFFECT_PATH_FORMAT; exports.EFFECT_SEQUENCE_NAME = _chunkK5DS2JTAcjs.EFFECT_SEQUENCE_NAME; exports.EFFECT_SUBJECT_KINDS = _chunkGHCSC2WPcjs.EFFECT_SUBJECT_KINDS; exports.EFFECT_TEMPLATE_SLOT_TYPES = _chunkGHCSC2WPcjs.EFFECT_TEMPLATE_SLOT_TYPES; exports.EFFECT_TRANSITION_MS = _chunkGHCSC2WPcjs.EFFECT_TRANSITION_MS; exports.EFFECT_USES = _chunkGHCSC2WPcjs.EFFECT_USES; exports.EFFECT_USE_LABELS = EFFECT_USE_LABELS; exports.EffectControlError = _chunkGHCSC2WPcjs.EffectControlError; exports.EffectDisposedError = _chunkGHCSC2WPcjs.EffectDisposedError; exports.EffectError = _chunkGHCSC2WPcjs.EffectError; exports.EffectRendererPool = _chunkPY4GWSE2cjs.EffectRendererPool; exports.EffectUnsupportedError = _chunkGHCSC2WPcjs.EffectUnsupportedError; exports.EffectsSlot = _chunkGHCSC2WPcjs.EffectsSlot; exports.NoEffectsProviderError = _chunkGHCSC2WPcjs.NoEffectsProviderError; exports.UnknownEffectError = _chunkGHCSC2WPcjs.UnknownEffectError; exports.UnknownTemplateError = _chunkGHCSC2WPcjs.UnknownTemplateError; exports.applyEffectMask = _chunkGHCSC2WPcjs.applyEffectMask; exports.cameraBoxOfView = _chunkGHCSC2WPcjs.cameraBoxOfView; exports.cameraMoveField = _chunkGHCSC2WPcjs.cameraMoveField; exports.cameraMoveIdList = _chunkGHCSC2WPcjs.cameraMoveIdList; exports.cameraMoveParts = _chunkGHCSC2WPcjs.cameraMoveParts; exports.cameraMovesFor = _chunkGHCSC2WPcjs.cameraMovesFor; exports.cameraViewOfBox = _chunkGHCSC2WPcjs.cameraViewOfBox; exports.checkEffectProvider = checkEffectProvider; exports.checkEffectSequence = _chunkK5DS2JTAcjs.checkEffectSequence; exports.checkTemplateValues = _chunkK5DS2JTAcjs.checkTemplateValues; exports.countEffectTags = _chunkGHCSC2WPcjs.countEffectTags; exports.createEffectAuthoringSession = _chunk7V7QMFTIcjs.createEffectAuthoringSession; exports.createEffectAuthoringToolProvider = createEffectAuthoringToolProvider; exports.createEffectPixels = _chunkGHCSC2WPcjs.createEffectPixels; exports.createEffectToolProvider = _chunkGHCSC2WPcjs.createEffectToolProvider; exports.createFakeEffectProvider = createFakeEffectProvider; exports.effectControlField = effectControlField; exports.effectFieldValue = effectFieldValue; exports.effectFontFamilies = effectFontFamilies; exports.effectLayerInput = _chunkK5DS2JTAcjs.effectLayerInput; exports.effectLayerOffered = _chunkK5DS2JTAcjs.effectLayerOffered; exports.effectLayerRole = _chunkK5DS2JTAcjs.effectLayerRole; exports.effectLayerSpan = _chunkK5DS2JTAcjs.effectLayerSpan; exports.effectOffered = _chunkGHCSC2WPcjs.effectOffered; exports.effectParameterFields = effectParameterFields; exports.effectSampleInputs = effectSampleInputs; exports.effectSamplePicture = effectSamplePicture; exports.effectSequenceEffects = _chunkK5DS2JTAcjs.effectSequenceEffects; exports.effectSequenceSlots = _chunkK5DS2JTAcjs.effectSequenceSlots; exports.effectSequenceTiming = _chunkK5DS2JTAcjs.effectSequenceTiming; exports.effectSubjectKind = _chunkK5DS2JTAcjs.effectSubjectKind; exports.effectSubjectProblem = _chunkK5DS2JTAcjs.effectSubjectProblem; exports.effectTemplateTools = _chunkK5DS2JTAcjs.effectTemplateTools; exports.effectValueErrors = _chunkGHCSC2WPcjs.effectValueErrors; exports.encodeEffectFloat = _chunkGHCSC2WPcjs.encodeEffectFloat; exports.fillEffectTemplate = _chunkK5DS2JTAcjs.fillEffectTemplate; exports.groupEffectsByCategory = groupEffectsByCategory; exports.hasEffectTags = _chunkGHCSC2WPcjs.hasEffectTags; exports.isCameraView = _chunkGHCSC2WPcjs.isCameraView; exports.isEffectError = _chunkGHCSC2WPcjs.isEffectError; exports.isEffectFontControl = isEffectFontControl; exports.isEffectPixels = _chunkGHCSC2WPcjs.isEffectPixels; exports.isSubjectTemplateSlot = _chunkK5DS2JTAcjs.isSubjectTemplateSlot; exports.linearToSrgb = _chunkGHCSC2WPcjs.linearToSrgb; exports.normaliseEffectTag = _chunkGHCSC2WPcjs.normaliseEffectTag; exports.pathControlsOf = _chunkGHCSC2WPcjs.pathControlsOf; exports.renderEffectThumbnail = renderEffectThumbnail; exports.resolveCameraMoveSpec = _chunkGHCSC2WPcjs.resolveCameraMoveSpec; exports.resolveEffectValues = _chunkGHCSC2WPcjs.resolveEffectValues; exports.sampleCameraViews = _chunkGHCSC2WPcjs.sampleCameraViews; exports.sampleEffectCameraMove = _chunkGHCSC2WPcjs.sampleEffectCameraMove; exports.searchEffectSummaries = _chunkGHCSC2WPcjs.searchEffectSummaries; exports.searchTemplateSummaries = _chunkK5DS2JTAcjs.searchTemplateSummaries; exports.srgbToLinear = _chunkGHCSC2WPcjs.srgbToLinear; exports.templateDefaultValues = _chunkK5DS2JTAcjs.templateDefaultValues; exports.templateSlotSchema = _chunkK5DS2JTAcjs.templateSlotSchema; exports.templateSlotSummary = _chunkK5DS2JTAcjs.templateSlotSummary; exports.templateSlotTakes = _chunkK5DS2JTAcjs.templateSlotTakes; exports.templateValueProblem = _chunkK5DS2JTAcjs.templateValueProblem; exports.templateValuesSchema = _chunkK5DS2JTAcjs.templateValuesSchema;
|