@pixerate/editor 0.172.0 → 0.174.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +9 -9
- package/dist/animation-editor/index.js +1 -1
- package/dist/canvas/index.cjs +7 -7
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-CYKWYP6D.cjs → chunk-6DUEV36F.cjs} +14 -14
- package/dist/{chunk-7KWJEYIK.js → chunk-6G2NLMVK.js} +36 -4
- package/dist/{chunk-RUZQMYXH.cjs → chunk-A3A5TI6R.cjs} +43 -11
- package/dist/chunk-NZ3CTY7K.js +260 -0
- package/dist/{chunk-YN4AYYBJ.js → chunk-OZSA5YEJ.js} +1 -1
- package/dist/chunk-VCL7CB56.cjs +260 -0
- package/dist/{chunk-HCC2LBCW.js → chunk-WMVEYSOA.js} +1 -1
- package/dist/{chunk-3OSXHLIT.cjs → chunk-Z64NRDEH.cjs} +7 -7
- package/dist/commands/format.d.cts +43 -0
- package/dist/commands/format.d.ts +43 -0
- package/dist/commands/index.cjs +7 -1
- package/dist/commands/index.d.cts +1 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +6 -0
- package/dist/effects/helpers.d.cts +11 -2
- package/dist/effects/helpers.d.ts +11 -2
- package/dist/effects/index.cjs +40 -34
- package/dist/effects/index.js +8 -2
- package/dist/effects/types.d.cts +2 -0
- package/dist/effects/types.d.ts +2 -0
- package/dist/image-editor/index.cjs +13 -13
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.js +2 -2
- package/dist/vector/index.cjs +6 -6
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +309 -309
- package/dist/video-editor/index.js +3 -3
- package/package.json +4 -1
package/dist/commands/index.cjs
CHANGED
|
@@ -30,6 +30,10 @@ var _chunk4EFNS2HVcjs = require('../chunk-4EFNS2HV.cjs');
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
var _chunk5EMS4BZGcjs = require('../chunk-5EMS4BZG.cjs');
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunkVCL7CB56cjs = require('../chunk-VCL7CB56.cjs');
|
|
33
37
|
require('../chunk-SWTUM32H.cjs');
|
|
34
38
|
|
|
35
39
|
|
|
@@ -1021,4 +1025,6 @@ function createCanvasAnimationCommands(controller, options = {}) {
|
|
|
1021
1025
|
|
|
1022
1026
|
|
|
1023
1027
|
|
|
1024
|
-
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
exports.CommandRegistry = CommandRegistry; exports.CommandRegistryError = CommandRegistryError; exports.DEFAULT_HISTORY_SHORTCUTS = _chunkGLQQ2VILcjs.DEFAULT_HISTORY_SHORTCUTS; exports.DEFAULT_RECENT_LIMIT = DEFAULT_RECENT_LIMIT; exports.PLATFORMS = _chunk4EFNS2HVcjs.PLATFORMS; exports.ShortcutMap = _chunk4EFNS2HVcjs.ShortcutMap; exports.chordToString = _chunk4EFNS2HVcjs.chordToString; exports.codeFromKey = _chunk4EFNS2HVcjs.codeFromKey; exports.codeToKeyText = _chunk4EFNS2HVcjs.codeToKeyText; exports.createArrangeCommands = _chunkGLQQ2VILcjs.createArrangeCommands; exports.createCanvasAnimationCommands = createCanvasAnimationCommands; exports.createCommandPaletteController = createCommandPaletteController; exports.createCommandRegistry = createCommandRegistry; exports.createCommandToolProvider = createCommandToolProvider; exports.createComponentCommands = _chunkGLQQ2VILcjs.createComponentCommands; exports.createDrawCommands = _chunkGLQQ2VILcjs.createDrawCommands; exports.createFormatCommands = _chunkVCL7CB56cjs.createFormatCommands; exports.createHistoryCommands = _chunkGLQQ2VILcjs.createHistoryCommands; exports.createShapeCommands = _chunkGLQQ2VILcjs.createShapeCommands; exports.createSpreadsheetCommands = _chunkGLQQ2VILcjs.createSpreadsheetCommands; exports.defineCommand = defineCommand; exports.detectPlatform = _chunk4EFNS2HVcjs.detectPlatform; exports.effectiveChord = _chunk4EFNS2HVcjs.effectiveChord; exports.effectiveChordKey = _chunk4EFNS2HVcjs.effectiveChordKey; exports.eventCode = _chunk4EFNS2HVcjs.eventCode; exports.exactBonus = exactBonus; exports.formatCommandsFor = _chunkVCL7CB56cjs.formatCommandsFor; exports.formatShortcut = _chunk4EFNS2HVcjs.formatShortcut; exports.fuzzyMatch = fuzzyMatch; exports.fuzzyScore = fuzzyScore; exports.hasVariantCommands = _chunkGLQQ2VILcjs.hasVariantCommands; exports.isEditableEventTarget = _chunk4EFNS2HVcjs.isEditableEventTarget; exports.keyToCode = _chunk4EFNS2HVcjs.keyToCode; exports.matchHistoryShortcut = _chunkGLQQ2VILcjs.matchHistoryShortcut; exports.matchPaletteHotkey = matchPaletteHotkey; exports.normalizeChord = _chunk4EFNS2HVcjs.normalizeChord; exports.parseChord = _chunk4EFNS2HVcjs.parseChord; exports.pushRecent = pushRecent; exports.rankCommands = rankCommands; exports.shortcutCode = _chunk4EFNS2HVcjs.shortcutCode; exports.toShortcutBindings = _chunk4EFNS2HVcjs.toShortcutBindings;
|
package/dist/commands/index.d.ts
CHANGED
package/dist/commands/index.js
CHANGED
|
@@ -30,6 +30,10 @@ import {
|
|
|
30
30
|
import {
|
|
31
31
|
derivePlaybackSteps
|
|
32
32
|
} from "../chunk-WL4IN36A.js";
|
|
33
|
+
import {
|
|
34
|
+
createFormatCommands,
|
|
35
|
+
formatCommandsFor
|
|
36
|
+
} from "../chunk-NZ3CTY7K.js";
|
|
33
37
|
import "../chunk-O2ANJFUF.js";
|
|
34
38
|
import {
|
|
35
39
|
validateJsonSchema
|
|
@@ -998,6 +1002,7 @@ export {
|
|
|
998
1002
|
createCommandToolProvider,
|
|
999
1003
|
createComponentCommands,
|
|
1000
1004
|
createDrawCommands,
|
|
1005
|
+
createFormatCommands,
|
|
1001
1006
|
createHistoryCommands,
|
|
1002
1007
|
createShapeCommands,
|
|
1003
1008
|
createSpreadsheetCommands,
|
|
@@ -1007,6 +1012,7 @@ export {
|
|
|
1007
1012
|
effectiveChordKey,
|
|
1008
1013
|
eventCode,
|
|
1009
1014
|
exactBonus,
|
|
1015
|
+
formatCommandsFor,
|
|
1010
1016
|
formatShortcut,
|
|
1011
1017
|
fuzzyMatch,
|
|
1012
1018
|
fuzzyScore,
|
|
@@ -12,9 +12,18 @@ export declare function effectValueErrors(description: Pick<EffectDescription, '
|
|
|
12
12
|
* it before saving values.
|
|
13
13
|
*/
|
|
14
14
|
export declare function resolveEffectValues(description: Pick<EffectDescription, 'id' | 'controls' | 'defaults'>, values?: EffectValues): Record<string, EffectValues[string]>;
|
|
15
|
+
/** A tag as tags are compared: trimmed, lower case, spaces and underscores as single hyphens (`"Game Boy"` → `game-boy`). */
|
|
16
|
+
export declare function normaliseEffectTag(tag: string): string;
|
|
17
|
+
/** True when the effect carries every one of `tags` (compared with `normaliseEffectTag`). */
|
|
18
|
+
export declare function hasEffectTags(e: Pick<EffectSummary, 'tags'>, tags: readonly string[] | undefined): boolean;
|
|
19
|
+
/** The tags of `effects` with how many carry each, the most used first (ties alphabetical). */
|
|
20
|
+
export declare function countEffectTags(effects: readonly Pick<EffectSummary, 'tags'>[]): {
|
|
21
|
+
tag: string;
|
|
22
|
+
count: number;
|
|
23
|
+
}[];
|
|
15
24
|
/**
|
|
16
|
-
* Filters a catalog and ranks it against `query` (every word
|
|
17
|
-
* category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
25
|
+
* Filters a catalog (kind, category, use and every tag) and ranks it against `query` (every word
|
|
26
|
+
* must appear in the id, name, category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
18
27
|
* Providers can implement `list` and `search` with it.
|
|
19
28
|
*/
|
|
20
29
|
export declare function searchEffectSummaries<T extends EffectSummary>(catalog: readonly T[], query?: string, options?: EffectSearchOptions): T[];
|
|
@@ -12,9 +12,18 @@ export declare function effectValueErrors(description: Pick<EffectDescription, '
|
|
|
12
12
|
* it before saving values.
|
|
13
13
|
*/
|
|
14
14
|
export declare function resolveEffectValues(description: Pick<EffectDescription, 'id' | 'controls' | 'defaults'>, values?: EffectValues): Record<string, EffectValues[string]>;
|
|
15
|
+
/** A tag as tags are compared: trimmed, lower case, spaces and underscores as single hyphens (`"Game Boy"` → `game-boy`). */
|
|
16
|
+
export declare function normaliseEffectTag(tag: string): string;
|
|
17
|
+
/** True when the effect carries every one of `tags` (compared with `normaliseEffectTag`). */
|
|
18
|
+
export declare function hasEffectTags(e: Pick<EffectSummary, 'tags'>, tags: readonly string[] | undefined): boolean;
|
|
19
|
+
/** The tags of `effects` with how many carry each, the most used first (ties alphabetical). */
|
|
20
|
+
export declare function countEffectTags(effects: readonly Pick<EffectSummary, 'tags'>[]): {
|
|
21
|
+
tag: string;
|
|
22
|
+
count: number;
|
|
23
|
+
}[];
|
|
15
24
|
/**
|
|
16
|
-
* Filters a catalog and ranks it against `query` (every word
|
|
17
|
-
* category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
25
|
+
* Filters a catalog (kind, category, use and every tag) and ranks it against `query` (every word
|
|
26
|
+
* must appear in the id, name, category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
18
27
|
* Providers can implement `list` and `search` with it.
|
|
19
28
|
*/
|
|
20
29
|
export declare function searchEffectSummaries<T extends EffectSummary>(catalog: readonly T[], query?: string, options?: EffectSearchOptions): T[];
|
package/dist/effects/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkFKUKJ3XAcjs = require('../chunk-FKUKJ3XA.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk6DUEV36Fcjs = require('../chunk-6DUEV36F.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
@@ -29,7 +29,10 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _chunkA3A5TI6Rcjs = require('../chunk-A3A5TI6R.cjs');
|
|
33
36
|
require('../chunk-WOFXZ3XU.cjs');
|
|
34
37
|
require('../chunk-FJ2MSI43.cjs');
|
|
35
38
|
|
|
@@ -37,7 +40,7 @@ require('../chunk-FJ2MSI43.cjs');
|
|
|
37
40
|
var _chunkDWJJI6RTcjs = require('../chunk-DWJJI6RT.cjs');
|
|
38
41
|
|
|
39
42
|
// src/effects/conformance.ts
|
|
40
|
-
var codeOf = (e) =>
|
|
43
|
+
var codeOf = (e) => _chunkA3A5TI6Rcjs.isEffectError.call(void 0, e) ? e.code : e instanceof Error ? `untyped ${e.name}: ${e.message}` : String(e);
|
|
41
44
|
async function rejectsWith(code, run) {
|
|
42
45
|
try {
|
|
43
46
|
await run();
|
|
@@ -51,10 +54,10 @@ function checkSummary(e, issues) {
|
|
|
51
54
|
const at = (message) => issues.push({ effectId: e.id, message });
|
|
52
55
|
if (!e.id || typeof e.id !== "string") at("summary has no id");
|
|
53
56
|
if (!e.name) at("summary has no name");
|
|
54
|
-
if (!
|
|
57
|
+
if (!_chunkA3A5TI6Rcjs.EFFECT_KINDS.includes(e.kind)) at(`kind "${e.kind}" is not one of ${_chunkA3A5TI6Rcjs.EFFECT_KINDS.join(", ")}`);
|
|
55
58
|
if (!e.category) at("summary has no category");
|
|
56
59
|
if (!Array.isArray(e.uses) || !e.uses.length) at("summary has no uses");
|
|
57
|
-
for (const u of _nullishCoalesce(e.uses, () => ( []))) if (!
|
|
60
|
+
for (const u of _nullishCoalesce(e.uses, () => ( []))) if (!_chunkA3A5TI6Rcjs.EFFECT_USES.includes(u)) at(`use "${u}" is not one of ${_chunkA3A5TI6Rcjs.EFFECT_USES.join(", ")}`);
|
|
58
61
|
if (typeof e.transparent !== "boolean") at("transparent is not a boolean");
|
|
59
62
|
if (typeof e.loop !== "boolean") at("loop is not a boolean");
|
|
60
63
|
if (e.duration !== void 0 && !(e.duration > 0)) at("duration must be a positive number of ms when present");
|
|
@@ -70,8 +73,8 @@ function checkDescription(id, d, issues) {
|
|
|
70
73
|
if (!(name in (_nullishCoalesce(d.defaults, () => ( {}))))) at(`control "${name}" has no default`);
|
|
71
74
|
}
|
|
72
75
|
for (const name of Object.keys(_nullishCoalesce(d.defaults, () => ( {})))) if (!(name in (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _3 => _3.properties]), () => ( {}))))) at(`default "${name}" is not a control`);
|
|
73
|
-
for (const e of
|
|
74
|
-
for (const p of _nullishCoalesce(d.presets, () => ( []))) for (const e of
|
|
76
|
+
for (const e of _chunkA3A5TI6Rcjs.effectValueErrors.call(void 0, d, d.defaults)) at(`default ${e.path}: ${e.message}`);
|
|
77
|
+
for (const p of _nullishCoalesce(d.presets, () => ( []))) for (const e of _chunkA3A5TI6Rcjs.effectValueErrors.call(void 0, d, p.values)) at(`preset "${p.name}" ${e.path}: ${e.message}`);
|
|
75
78
|
for (const input2 of _nullishCoalesce(d.inputs, () => ( []))) {
|
|
76
79
|
if (!input2.name || !input2.description) at("every input needs a name and a description");
|
|
77
80
|
if (input2.kind !== "image" && input2.kind !== "audio") at(`input "${input2.name}" has kind "${input2.kind}"`);
|
|
@@ -82,7 +85,7 @@ function checkDescription(id, d, issues) {
|
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
function grey(size) {
|
|
85
|
-
const p =
|
|
88
|
+
const p = _chunkA3A5TI6Rcjs.createEffectPixels.call(void 0, size, size);
|
|
86
89
|
p.data.fill(128);
|
|
87
90
|
return p;
|
|
88
91
|
}
|
|
@@ -98,7 +101,7 @@ async function checkRender(provider, d, size, issues) {
|
|
|
98
101
|
}
|
|
99
102
|
try {
|
|
100
103
|
const out = await renderer.render({ time: 0, inputs });
|
|
101
|
-
if (!
|
|
104
|
+
if (!_chunkA3A5TI6Rcjs.isEffectPixels.call(void 0, out)) at("render did not return EffectPixels");
|
|
102
105
|
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}`);
|
|
103
106
|
} catch (e) {
|
|
104
107
|
at(`render failed: ${codeOf(e)}`);
|
|
@@ -389,15 +392,15 @@ var smooth = (t) => t * t * (3 - 2 * t);
|
|
|
389
392
|
var clamp01 = (v) => v < 0 ? 0 : v > 1 ? 1 : v;
|
|
390
393
|
function input(request, name, id, width, height) {
|
|
391
394
|
const src = _optionalChain([request, 'access', _12 => _12.inputs, 'optionalAccess', _13 => _13[name]]);
|
|
392
|
-
if (!src) throw new (0,
|
|
393
|
-
if (!
|
|
395
|
+
if (!src) throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`Effect "${id}" needs an input named "${name}".`, id);
|
|
396
|
+
if (!_chunkA3A5TI6Rcjs.isEffectPixels.call(void 0, src)) throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`The fake provider only takes EffectPixels inputs ("${name}").`, id);
|
|
394
397
|
if (src.width !== width || src.height !== height) {
|
|
395
|
-
throw new (0,
|
|
398
|
+
throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`Input "${name}" is ${src.width}\xD7${src.height}; the renderer is ${width}\xD7${height}.`, id);
|
|
396
399
|
}
|
|
397
400
|
return src;
|
|
398
401
|
}
|
|
399
402
|
function renderPixels(d, v, request, width, height) {
|
|
400
|
-
const out =
|
|
403
|
+
const out = _chunkA3A5TI6Rcjs.createEffectPixels.call(void 0, width, height);
|
|
401
404
|
const o = out.data;
|
|
402
405
|
switch (d.id) {
|
|
403
406
|
case "fake.invert": {
|
|
@@ -463,23 +466,23 @@ function renderPixels(d, v, request, width, height) {
|
|
|
463
466
|
break;
|
|
464
467
|
}
|
|
465
468
|
default:
|
|
466
|
-
throw new (0,
|
|
469
|
+
throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`"${d.id}" is a ${d.kind} effect; use applyVectorEffect.`, d.id);
|
|
467
470
|
}
|
|
468
471
|
return out;
|
|
469
472
|
}
|
|
470
473
|
function toFloat(p) {
|
|
471
474
|
const f = new Float32Array(p.data.length);
|
|
472
475
|
for (let i = 0; i < f.length; i += 4) {
|
|
473
|
-
f[i] =
|
|
474
|
-
f[i + 1] =
|
|
475
|
-
f[i + 2] =
|
|
476
|
+
f[i] = _chunkA3A5TI6Rcjs.srgbToLinear.call(void 0, p.data[i] / 255);
|
|
477
|
+
f[i + 1] = _chunkA3A5TI6Rcjs.srgbToLinear.call(void 0, p.data[i + 1] / 255);
|
|
478
|
+
f[i + 2] = _chunkA3A5TI6Rcjs.srgbToLinear.call(void 0, p.data[i + 2] / 255);
|
|
476
479
|
f[i + 3] = p.data[i + 3] / 255;
|
|
477
480
|
}
|
|
478
|
-
return
|
|
481
|
+
return _chunkA3A5TI6Rcjs.encodeEffectFloat.call(void 0, { ...p, float: f });
|
|
479
482
|
}
|
|
480
483
|
function maskResult(out, mask, source, id) {
|
|
481
|
-
if (!
|
|
482
|
-
throw new (0,
|
|
484
|
+
if (!_chunkA3A5TI6Rcjs.isEffectPixels.call(void 0, mask) || mask.width !== out.width || mask.height !== out.height) {
|
|
485
|
+
throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)("The mask must be EffectPixels the size of the renderer.", id);
|
|
483
486
|
}
|
|
484
487
|
const o = out.data;
|
|
485
488
|
for (let i = 0; i < o.length; i += 4) {
|
|
@@ -503,7 +506,7 @@ function createFakeEffectProvider(options = {}) {
|
|
|
503
506
|
const byId = new Map(DESCRIPTIONS.map((d) => [d.id, d]));
|
|
504
507
|
const get = (id) => {
|
|
505
508
|
const d = byId.get(id);
|
|
506
|
-
if (!d) throw new (0,
|
|
509
|
+
if (!d) throw new (0, _chunkA3A5TI6Rcjs.UnknownEffectError)(id, "the fake provider");
|
|
507
510
|
return d;
|
|
508
511
|
};
|
|
509
512
|
const summaries = DESCRIPTIONS.map(summaryOf);
|
|
@@ -512,16 +515,16 @@ function createFakeEffectProvider(options = {}) {
|
|
|
512
515
|
name: "Fake effects",
|
|
513
516
|
version: "1",
|
|
514
517
|
capabilities,
|
|
515
|
-
list: (o) =>
|
|
516
|
-
search: (q, o) =>
|
|
518
|
+
list: (o) => _chunkA3A5TI6Rcjs.searchEffectSummaries.call(void 0, summaries, "", o),
|
|
519
|
+
search: (q, o) => _chunkA3A5TI6Rcjs.searchEffectSummaries.call(void 0, summaries, q, o),
|
|
517
520
|
describe: (id) => structuredClone(get(id)),
|
|
518
521
|
createRenderer(id, ro) {
|
|
519
522
|
const d = get(id);
|
|
520
|
-
if (d.kind !== "shader") throw new (0,
|
|
523
|
+
if (d.kind !== "shader") throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`"${id}" is a ${d.kind} effect; use applyVectorEffect.`, id);
|
|
521
524
|
const { width, height } = ro;
|
|
522
525
|
const depth = _nullishCoalesce(ro.depth, () => ( 8));
|
|
523
526
|
if (!(width > 0 && height > 0) || width > capabilities.maxSize || height > capabilities.maxSize) {
|
|
524
|
-
throw new (0,
|
|
527
|
+
throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`Renderer size ${width}\xD7${height} is outside 1\u2013${capabilities.maxSize}.`, id);
|
|
525
528
|
}
|
|
526
529
|
let disposed = false;
|
|
527
530
|
return {
|
|
@@ -530,15 +533,15 @@ function createFakeEffectProvider(options = {}) {
|
|
|
530
533
|
height,
|
|
531
534
|
depth,
|
|
532
535
|
async render(request) {
|
|
533
|
-
if (disposed) throw new (0,
|
|
536
|
+
if (disposed) throw new (0, _chunkA3A5TI6Rcjs.EffectDisposedError)(id);
|
|
534
537
|
if (!Number.isFinite(request.time) || request.time < 0) {
|
|
535
|
-
throw new (0,
|
|
538
|
+
throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`time must be a finite number of ms \u2265 0, got ${request.time}.`, id);
|
|
536
539
|
}
|
|
537
|
-
const values =
|
|
540
|
+
const values = _chunkA3A5TI6Rcjs.resolveEffectValues.call(void 0, d, request.values);
|
|
538
541
|
_optionalChain([options, 'access', _14 => _14.onRender, 'optionalCall', _15 => _15(id, request)]);
|
|
539
542
|
const out = renderPixels(d, values, request, width, height);
|
|
540
543
|
if (request.mask) {
|
|
541
|
-
if (!capabilities.supportsMask) throw new (0,
|
|
544
|
+
if (!capabilities.supportsMask) throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)("This provider does not take masks.", id);
|
|
542
545
|
const source = d.uses.includes("filter") ? _optionalChain([request, 'access', _16 => _16.inputs, 'optionalAccess', _17 => _17.source]) : void 0;
|
|
543
546
|
maskResult(out, request.mask, source, id);
|
|
544
547
|
}
|
|
@@ -551,8 +554,8 @@ function createFakeEffectProvider(options = {}) {
|
|
|
551
554
|
},
|
|
552
555
|
applyVectorEffect(id, target, values) {
|
|
553
556
|
const d = get(id);
|
|
554
|
-
if (d.kind !== "motion" && d.kind !== "vector") throw new (0,
|
|
555
|
-
const v =
|
|
557
|
+
if (d.kind !== "motion" && d.kind !== "vector") throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(`"${id}" is a ${d.kind} effect, not a vector one.`, id);
|
|
558
|
+
const v = _chunkA3A5TI6Rcjs.resolveEffectValues.call(void 0, d, values);
|
|
556
559
|
if (d.kind === "vector") {
|
|
557
560
|
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 };
|
|
558
561
|
}
|
|
@@ -568,7 +571,7 @@ function createFakeEffectProvider(options = {}) {
|
|
|
568
571
|
};
|
|
569
572
|
},
|
|
570
573
|
...supportsAuthoring ? {
|
|
571
|
-
openAuthoring: (from) =>
|
|
574
|
+
openAuthoring: (from) => _chunk6DUEV36Fcjs.createEffectAuthoringSession.call(void 0, from, { provider })
|
|
572
575
|
} : {}
|
|
573
576
|
};
|
|
574
577
|
return provider;
|
|
@@ -634,7 +637,7 @@ function effectFontFamilies(description, values = {}) {
|
|
|
634
637
|
}
|
|
635
638
|
var effectFieldValue = (field, value) => value === void 0 || value === null || typeof value === "object" && !Array.isArray(value) ? field.default : value;
|
|
636
639
|
function effectSamplePicture(width, height, variant = 0) {
|
|
637
|
-
const p =
|
|
640
|
+
const p = _chunkA3A5TI6Rcjs.createEffectPixels.call(void 0, width, height);
|
|
638
641
|
for (let y = 0, i = 0; y < height; y++) {
|
|
639
642
|
for (let x = 0; x < width; x++, i += 4) {
|
|
640
643
|
const u = x / Math.max(1, width - 1);
|
|
@@ -1113,4 +1116,7 @@ function createEffectAuthoringToolProvider(host, options) {
|
|
|
1113
1116
|
|
|
1114
1117
|
|
|
1115
1118
|
|
|
1116
|
-
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
exports.EFFECT_ERROR_CODES = _chunkA3A5TI6Rcjs.EFFECT_ERROR_CODES; exports.EFFECT_KINDS = _chunkA3A5TI6Rcjs.EFFECT_KINDS; exports.EFFECT_USES = _chunkA3A5TI6Rcjs.EFFECT_USES; exports.EFFECT_USE_LABELS = EFFECT_USE_LABELS; exports.EffectControlError = _chunkA3A5TI6Rcjs.EffectControlError; exports.EffectDisposedError = _chunkA3A5TI6Rcjs.EffectDisposedError; exports.EffectError = _chunkA3A5TI6Rcjs.EffectError; exports.EffectRendererPool = _chunkPY4GWSE2cjs.EffectRendererPool; exports.EffectUnsupportedError = _chunkA3A5TI6Rcjs.EffectUnsupportedError; exports.EffectsSlot = _chunkA3A5TI6Rcjs.EffectsSlot; exports.NoEffectsProviderError = _chunkA3A5TI6Rcjs.NoEffectsProviderError; exports.UnknownEffectError = _chunkA3A5TI6Rcjs.UnknownEffectError; exports.applyEffectMask = _chunkA3A5TI6Rcjs.applyEffectMask; exports.checkEffectProvider = checkEffectProvider; exports.countEffectTags = _chunkA3A5TI6Rcjs.countEffectTags; exports.createEffectAuthoringSession = _chunk6DUEV36Fcjs.createEffectAuthoringSession; exports.createEffectAuthoringToolProvider = createEffectAuthoringToolProvider; exports.createEffectPixels = _chunkA3A5TI6Rcjs.createEffectPixels; exports.createEffectToolProvider = _chunkA3A5TI6Rcjs.createEffectToolProvider; exports.createFakeEffectProvider = createFakeEffectProvider; exports.effectControlField = effectControlField; exports.effectFieldValue = effectFieldValue; exports.effectFontFamilies = effectFontFamilies; exports.effectParameterFields = effectParameterFields; exports.effectSampleInputs = effectSampleInputs; exports.effectSamplePicture = effectSamplePicture; exports.effectValueErrors = _chunkA3A5TI6Rcjs.effectValueErrors; exports.encodeEffectFloat = _chunkA3A5TI6Rcjs.encodeEffectFloat; exports.groupEffectsByCategory = groupEffectsByCategory; exports.hasEffectTags = _chunkA3A5TI6Rcjs.hasEffectTags; exports.isEffectError = _chunkA3A5TI6Rcjs.isEffectError; exports.isEffectFontControl = isEffectFontControl; exports.isEffectPixels = _chunkA3A5TI6Rcjs.isEffectPixels; exports.linearToSrgb = _chunkA3A5TI6Rcjs.linearToSrgb; exports.normaliseEffectTag = _chunkA3A5TI6Rcjs.normaliseEffectTag; exports.renderEffectThumbnail = renderEffectThumbnail; exports.resolveEffectValues = _chunkA3A5TI6Rcjs.resolveEffectValues; exports.searchEffectSummaries = _chunkA3A5TI6Rcjs.searchEffectSummaries; exports.srgbToLinear = _chunkA3A5TI6Rcjs.srgbToLinear;
|
package/dist/effects/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../chunk-CJE5MOIS.js";
|
|
4
4
|
import {
|
|
5
5
|
createEffectAuthoringSession
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-WMVEYSOA.js";
|
|
7
7
|
import {
|
|
8
8
|
EffectRendererPool
|
|
9
9
|
} from "../chunk-EHLOCVWB.js";
|
|
@@ -19,17 +19,20 @@ import {
|
|
|
19
19
|
NoEffectsProviderError,
|
|
20
20
|
UnknownEffectError,
|
|
21
21
|
applyEffectMask,
|
|
22
|
+
countEffectTags,
|
|
22
23
|
createEffectPixels,
|
|
23
24
|
createEffectToolProvider,
|
|
24
25
|
effectValueErrors,
|
|
25
26
|
encodeEffectFloat,
|
|
27
|
+
hasEffectTags,
|
|
26
28
|
isEffectError,
|
|
27
29
|
isEffectPixels,
|
|
28
30
|
linearToSrgb,
|
|
31
|
+
normaliseEffectTag,
|
|
29
32
|
resolveEffectValues,
|
|
30
33
|
searchEffectSummaries,
|
|
31
34
|
srgbToLinear
|
|
32
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-6G2NLMVK.js";
|
|
33
36
|
import "../chunk-V2ZCJRDM.js";
|
|
34
37
|
import "../chunk-RNSANXPT.js";
|
|
35
38
|
import {
|
|
@@ -1091,6 +1094,7 @@ export {
|
|
|
1091
1094
|
UnknownEffectError,
|
|
1092
1095
|
applyEffectMask,
|
|
1093
1096
|
checkEffectProvider,
|
|
1097
|
+
countEffectTags,
|
|
1094
1098
|
createEffectAuthoringSession,
|
|
1095
1099
|
createEffectAuthoringToolProvider,
|
|
1096
1100
|
createEffectPixels,
|
|
@@ -1105,10 +1109,12 @@ export {
|
|
|
1105
1109
|
effectValueErrors,
|
|
1106
1110
|
encodeEffectFloat,
|
|
1107
1111
|
groupEffectsByCategory,
|
|
1112
|
+
hasEffectTags,
|
|
1108
1113
|
isEffectError,
|
|
1109
1114
|
isEffectFontControl,
|
|
1110
1115
|
isEffectPixels,
|
|
1111
1116
|
linearToSrgb,
|
|
1117
|
+
normaliseEffectTag,
|
|
1112
1118
|
renderEffectThumbnail,
|
|
1113
1119
|
resolveEffectValues,
|
|
1114
1120
|
searchEffectSummaries,
|
package/dist/effects/types.d.cts
CHANGED
|
@@ -47,6 +47,8 @@ export interface EffectSearchOptions {
|
|
|
47
47
|
kind?: EffectKind;
|
|
48
48
|
category?: string;
|
|
49
49
|
use?: EffectUse;
|
|
50
|
+
/** Only effects carrying every one of these tags (in any case, spaces as hyphens: see `normaliseEffectTag`). */
|
|
51
|
+
tags?: readonly string[];
|
|
50
52
|
/** Most results to return. */
|
|
51
53
|
limit?: number;
|
|
52
54
|
}
|
package/dist/effects/types.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface EffectSearchOptions {
|
|
|
47
47
|
kind?: EffectKind;
|
|
48
48
|
category?: string;
|
|
49
49
|
use?: EffectUse;
|
|
50
|
+
/** Only effects carrying every one of these tags (in any case, spaces as hyphens: see `normaliseEffectTag`). */
|
|
51
|
+
tags?: readonly string[];
|
|
50
52
|
/** Most results to return. */
|
|
51
53
|
limit?: number;
|
|
52
54
|
}
|
|
@@ -636,7 +636,7 @@ require('../chunk-NM3G4VQT.cjs');
|
|
|
636
636
|
|
|
637
637
|
|
|
638
638
|
|
|
639
|
-
var
|
|
639
|
+
var _chunkA3A5TI6Rcjs = require('../chunk-A3A5TI6R.cjs');
|
|
640
640
|
require('../chunk-WOFXZ3XU.cjs');
|
|
641
641
|
|
|
642
642
|
|
|
@@ -3309,7 +3309,7 @@ function checkImageEffectPlace(d, place) {
|
|
|
3309
3309
|
const allowed = IMAGE_EFFECT_PLACES[place];
|
|
3310
3310
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
3311
3311
|
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" : "";
|
|
3312
|
-
throw new (0,
|
|
3312
|
+
throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(
|
|
3313
3313
|
`"${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}.`,
|
|
3314
3314
|
d.id
|
|
3315
3315
|
);
|
|
@@ -3333,9 +3333,9 @@ function effectPixelsToSurface(p, depth) {
|
|
|
3333
3333
|
const d = new Uint16Array(f.length);
|
|
3334
3334
|
const code = (v) => v > 0 ? v < 1 ? Math.round(v * 65535) : 65535 : 0;
|
|
3335
3335
|
for (let i = 0; i < f.length; i += 4) {
|
|
3336
|
-
d[i] = code(
|
|
3337
|
-
d[i + 1] = code(
|
|
3338
|
-
d[i + 2] = code(
|
|
3336
|
+
d[i] = code(_chunkA3A5TI6Rcjs.linearToSrgb.call(void 0, f[i]));
|
|
3337
|
+
d[i + 1] = code(_chunkA3A5TI6Rcjs.linearToSrgb.call(void 0, f[i + 1]));
|
|
3338
|
+
d[i + 2] = code(_chunkA3A5TI6Rcjs.linearToSrgb.call(void 0, f[i + 2]));
|
|
3339
3339
|
d[i + 3] = code(f[i + 3]);
|
|
3340
3340
|
}
|
|
3341
3341
|
return _chunkCWM3CUUXcjs.surfaceFromDeepPixels.call(void 0, { width: p.width, height: p.height, data: d }, 4);
|
|
@@ -3352,7 +3352,7 @@ var ImageEffectsEngine = (_class7 = class {
|
|
|
3352
3352
|
__init40() {this.generation = 0}
|
|
3353
3353
|
|
|
3354
3354
|
constructor(options = {}) {;_class7.prototype.__init35.call(this);_class7.prototype.__init36.call(this);_class7.prototype.__init37.call(this);_class7.prototype.__init38.call(this);_class7.prototype.__init39.call(this);_class7.prototype.__init40.call(this);
|
|
3355
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
3355
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkA3A5TI6Rcjs.EffectsSlot)()));
|
|
3356
3356
|
this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 24));
|
|
3357
3357
|
this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
|
|
3358
3358
|
this.detach = this.slot.subscribe(() => {
|
|
@@ -3412,7 +3412,7 @@ var ImageEffectsEngine = (_class7 = class {
|
|
|
3412
3412
|
const provider = this.slot.require();
|
|
3413
3413
|
const depth = _nullishCoalesce(size.depth, () => ( 8));
|
|
3414
3414
|
const out = await this.render(provider, effect, size.width, size.height, depth, { time: _nullishCoalesce(size.time, () => ( 0)), values });
|
|
3415
|
-
return out.width === size.width && out.height === size.height ? out :
|
|
3415
|
+
return out.width === size.width && out.height === size.height ? out : _chunkA3A5TI6Rcjs.createEffectPixels.call(void 0, size.width, size.height);
|
|
3416
3416
|
}
|
|
3417
3417
|
/** Why the result for `key` failed, if it did. */
|
|
3418
3418
|
failure(key) {
|
|
@@ -4625,7 +4625,7 @@ var ImageEditorController = (_class10 = class {
|
|
|
4625
4625
|
/** For `compositePixels` and mask evaluation (the renderer keeps its own for the viewport). */
|
|
4626
4626
|
__init73() {this.compositor = new (0, _chunkOVYQAYGHcjs.LayerCompositor)()}
|
|
4627
4627
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
4628
|
-
__init74() {this.effects = new (0,
|
|
4628
|
+
__init74() {this.effects = new (0, _chunkA3A5TI6Rcjs.EffectsSlot)()}
|
|
4629
4629
|
/** Renders provider effects: effect smart filter results and effect layers. */
|
|
4630
4630
|
__init75() {this.effectsEngine = new ImageEffectsEngine({ slot: this.effects })}
|
|
4631
4631
|
__init76() {this.effectRefresh = "none"}
|
|
@@ -4851,7 +4851,7 @@ var ImageEditorController = (_class10 = class {
|
|
|
4851
4851
|
*/
|
|
4852
4852
|
async applyEffectFilter(layerId, effect, options = {}) {
|
|
4853
4853
|
const d = await this.describeEffect(effect, "filter");
|
|
4854
|
-
const values =
|
|
4854
|
+
const values = _chunkA3A5TI6Rcjs.resolveEffectValues.call(void 0, d, options.values);
|
|
4855
4855
|
const found = _chunkHGTDMKNEcjs.findLayer.call(void 0, this.state.layers, layerId);
|
|
4856
4856
|
if (!found) throw new (0, _chunkOVYQAYGHcjs.LayerOperationError)(`There is no layer "${layerId}"; call list_layers for the layer ids.`);
|
|
4857
4857
|
let layers = this.state.layers;
|
|
@@ -4889,7 +4889,7 @@ var ImageEditorController = (_class10 = class {
|
|
|
4889
4889
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
4890
4890
|
else throw new (0, _chunkOVYQAYGHcjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
4891
4891
|
}
|
|
4892
|
-
update.values = { ...base, ...
|
|
4892
|
+
update.values = { ...base, ..._chunkA3A5TI6Rcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
4893
4893
|
}
|
|
4894
4894
|
for (const k of ["enabled", "blend", "opacity"]) if (changes[k] !== void 0) update[k] = changes[k];
|
|
4895
4895
|
let res = _chunkOVYQAYGHcjs.updateSmartFilter.call(void 0, this.state.layers, layerId, filterId, update, this.canvasSize);
|
|
@@ -4904,7 +4904,7 @@ var ImageEditorController = (_class10 = class {
|
|
|
4904
4904
|
*/
|
|
4905
4905
|
async addEffectLayer(effect, options = {}) {
|
|
4906
4906
|
const d = await this.describeEffect(effect, "layer");
|
|
4907
|
-
const values =
|
|
4907
|
+
const values = _chunkA3A5TI6Rcjs.resolveEffectValues.call(void 0, d, options.values);
|
|
4908
4908
|
const { width, height } = this.naturalSize;
|
|
4909
4909
|
const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time: options.time });
|
|
4910
4910
|
const blend = _chunkOVYQAYGHcjs.parseBlend.call(void 0, options.blend);
|
|
@@ -4947,7 +4947,7 @@ var ImageEditorController = (_class10 = class {
|
|
|
4947
4947
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
4948
4948
|
else throw new (0, _chunkOVYQAYGHcjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
4949
4949
|
}
|
|
4950
|
-
const values = { ...base, ...
|
|
4950
|
+
const values = { ...base, ..._chunkA3A5TI6Rcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
4951
4951
|
const time = _nullishCoalesce(_nullishCoalesce(changes.time, () => ( g.time)), () => ( 0));
|
|
4952
4952
|
const { width, height } = this.naturalSize;
|
|
4953
4953
|
const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time });
|
|
@@ -15546,7 +15546,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
|
|
|
15546
15546
|
return { target, effect: _nullishCoalesce(effects.find((e) => e.id === instance), () => ( effects[effects.length - 1])), effects, ...extra };
|
|
15547
15547
|
};
|
|
15548
15548
|
const plainValues = (v) => v;
|
|
15549
|
-
return withImagePlayback(
|
|
15549
|
+
return withImagePlayback(_chunkA3A5TI6Rcjs.createEffectToolProvider.call(void 0, {
|
|
15550
15550
|
id: _nullishCoalesce(options.id, () => ( "image-effects")),
|
|
15551
15551
|
namespace: options.namespace,
|
|
15552
15552
|
title: "Image effects",
|