@pixerate/editor 0.252.0 → 0.254.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/animation-editor/index.cjs +53 -53
  2. package/dist/animation-editor/index.js +2 -2
  3. package/dist/brushes/index.cjs +229 -2014
  4. package/dist/brushes/index.d.cts +5 -1
  5. package/dist/brushes/index.d.ts +5 -1
  6. package/dist/brushes/index.js +236 -2021
  7. package/dist/brushes/patch.d.cts +23 -0
  8. package/dist/brushes/patch.d.ts +23 -0
  9. package/dist/brushes/ui.d.cts +105 -0
  10. package/dist/brushes/ui.d.ts +105 -0
  11. package/dist/canvas/index.cjs +7 -7
  12. package/dist/canvas/index.js +1 -1
  13. package/dist/{chunk-QKXO6JPP.cjs → chunk-2OQGPEHH.cjs} +14 -14
  14. package/dist/chunk-34KLWUH4.cjs +2284 -0
  15. package/dist/{chunk-Z3BRH4JK.cjs → chunk-557BDWKO.cjs} +6 -6
  16. package/dist/{chunk-ZBCT5MEA.cjs → chunk-CBVNCWJM.cjs} +7 -7
  17. package/dist/{chunk-226QDRO3.js → chunk-DHQPRKXF.js} +1 -1
  18. package/dist/{chunk-ABL7IWFZ.js → chunk-GBEF2D4P.js} +1 -1
  19. package/dist/{chunk-ISIO63Q5.cjs → chunk-L2JTLW6B.cjs} +150 -25
  20. package/dist/{chunk-JA57JIT5.js → chunk-MV7CYFMJ.js} +133 -8
  21. package/dist/{chunk-5E2Q7ZHI.js → chunk-MWUZCEFT.js} +1 -1
  22. package/dist/chunk-QPHNVZHO.js +2284 -0
  23. package/dist/effects/conformance.d.cts +1 -0
  24. package/dist/effects/conformance.d.ts +1 -0
  25. package/dist/effects/fake.d.cts +7 -1
  26. package/dist/effects/fake.d.ts +7 -1
  27. package/dist/effects/helpers.d.cts +36 -4
  28. package/dist/effects/helpers.d.ts +36 -4
  29. package/dist/effects/index.cjs +331 -102
  30. package/dist/effects/index.js +238 -9
  31. package/dist/effects/types.d.cts +84 -5
  32. package/dist/effects/types.d.ts +84 -5
  33. package/dist/image-editor/index.cjs +15 -15
  34. package/dist/image-editor/index.js +1 -1
  35. package/dist/paint-editor/brush-controls.d.cts +57 -0
  36. package/dist/paint-editor/brush-controls.d.ts +57 -0
  37. package/dist/paint-editor/brush-library-tools.d.cts +15 -0
  38. package/dist/paint-editor/brush-library-tools.d.ts +15 -0
  39. package/dist/paint-editor/brush-library.d.cts +29 -0
  40. package/dist/paint-editor/brush-library.d.ts +29 -0
  41. package/dist/paint-editor/controller.d.cts +76 -17
  42. package/dist/paint-editor/controller.d.ts +76 -17
  43. package/dist/paint-editor/index.cjs +543 -858
  44. package/dist/paint-editor/index.d.cts +1 -0
  45. package/dist/paint-editor/index.d.ts +1 -0
  46. package/dist/paint-editor/index.js +329 -644
  47. package/dist/paint-editor/serialize.d.cts +7 -4
  48. package/dist/paint-editor/serialize.d.ts +7 -4
  49. package/dist/paint-editor/sticker-tools.d.cts +1 -1
  50. package/dist/paint-editor/sticker-tools.d.ts +1 -1
  51. package/dist/paint-editor/strokes.d.cts +10 -1
  52. package/dist/paint-editor/strokes.d.ts +10 -1
  53. package/dist/paint-editor/tools.d.cts +1 -1
  54. package/dist/paint-editor/tools.d.ts +1 -1
  55. package/dist/paint-editor/ui.d.cts +3 -51
  56. package/dist/paint-editor/ui.d.ts +3 -51
  57. package/dist/paint-editor/wet-tools.d.cts +1 -1
  58. package/dist/paint-editor/wet-tools.d.ts +1 -1
  59. package/dist/vector/index.cjs +6 -6
  60. package/dist/vector/index.js +1 -1
  61. package/dist/video-editor/index.cjs +344 -344
  62. package/dist/video-editor/index.js +4 -4
  63. package/package.json +1 -1
  64. package/skills/pixerate-brushes/SKILL.md +5 -3
  65. package/skills/pixerate-paint-editor/SKILL.md +26 -24
  66. package/skills/pixerate-paint-editor/references/brush-facets.md +30 -0
  67. package/skills/pixerate-paint-editor/references/gradient-paint.md +1 -1
  68. package/skills/pixerate-paint-editor/references/light-paint.md +2 -2
  69. package/skills/pixerate-paint-editor/references/oils.md +1 -1
  70. package/skills/pixerate-paint-editor/references/particle-brushes.md +8 -5
  71. package/skills/pixerate-paint-oil-impasto/SKILL.md +1 -1
  72. package/skills/pixerate-stickers/SKILL.md +1 -1
  73. package/skills/pixerate-video-editor/SKILL.md +1 -1
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Facet patches: a partial brush laid over another (`mergeBrushPatch`), the schema of one for
3
+ * tools (`BRUSH_PATCH_PROPERTIES`), and the leaf paths two brushes differ in (`changedBrushPaths`).
4
+ * The library tools and the paint editor's `set_brush` / `paint_stroke` share them, so a patch
5
+ * means the same everywhere.
6
+ */
7
+ import type { JsonSchema } from '../tools/schema.cjs';
8
+ import type { Brush } from './types.cjs';
9
+ /** A brush's facets, any of them, as a patch takes them (the tip's `shape` may be left out). */
10
+ export type BrushPatch = {
11
+ [K in Exclude<keyof Brush, 'id'>]?: K extends 'tip' ? Partial<Brush['tip']> : Brush[K];
12
+ };
13
+ /** The schema of every facet except `id` and `name`, as tool arguments (a patch may leave out `tip.shape`). */
14
+ export declare const BRUSH_PATCH_PROPERTIES: Readonly<Record<string, JsonSchema>>;
15
+ /** The facets a patch can remove (`unset`), back to the engine's defaults. */
16
+ export declare const UNSETTABLE_BRUSH_FACETS: readonly ["description", "tags", "medium", "variety", "marks", "dynamics", "behaviour", "light", "motion", "colour"];
17
+ export type UnsettableBrushFacet = (typeof UNSETTABLE_BRUSH_FACETS)[number];
18
+ /** The `unset` argument of tools that take a patch. */
19
+ export declare const BRUSH_UNSET_PROPERTY: JsonSchema;
20
+ /** `base` with `patch` laid over it: objects merge, everything else (lists included) is replaced. Marks of another kind replace the marks. */
21
+ export declare function mergeBrushPatch<T extends Record<string, unknown>>(base: T, patch: Record<string, unknown>, path?: string): T;
22
+ /** Leaf paths whose values differ between two brushes (dot paths; lists compare whole). */
23
+ export declare function changedBrushPaths(a: unknown, b: unknown, path?: string): string[];
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Facet patches: a partial brush laid over another (`mergeBrushPatch`), the schema of one for
3
+ * tools (`BRUSH_PATCH_PROPERTIES`), and the leaf paths two brushes differ in (`changedBrushPaths`).
4
+ * The library tools and the paint editor's `set_brush` / `paint_stroke` share them, so a patch
5
+ * means the same everywhere.
6
+ */
7
+ import type { JsonSchema } from '../tools/schema.js';
8
+ import type { Brush } from './types.js';
9
+ /** A brush's facets, any of them, as a patch takes them (the tip's `shape` may be left out). */
10
+ export type BrushPatch = {
11
+ [K in Exclude<keyof Brush, 'id'>]?: K extends 'tip' ? Partial<Brush['tip']> : Brush[K];
12
+ };
13
+ /** The schema of every facet except `id` and `name`, as tool arguments (a patch may leave out `tip.shape`). */
14
+ export declare const BRUSH_PATCH_PROPERTIES: Readonly<Record<string, JsonSchema>>;
15
+ /** The facets a patch can remove (`unset`), back to the engine's defaults. */
16
+ export declare const UNSETTABLE_BRUSH_FACETS: readonly ["description", "tags", "medium", "variety", "marks", "dynamics", "behaviour", "light", "motion", "colour"];
17
+ export type UnsettableBrushFacet = (typeof UNSETTABLE_BRUSH_FACETS)[number];
18
+ /** The `unset` argument of tools that take a patch. */
19
+ export declare const BRUSH_UNSET_PROPERTY: JsonSchema;
20
+ /** `base` with `patch` laid over it: objects merge, everything else (lists included) is replaced. Marks of another kind replace the marks. */
21
+ export declare function mergeBrushPatch<T extends Record<string, unknown>>(base: T, patch: Record<string, unknown>, path?: string): T;
22
+ /** Leaf paths whose values differ between two brushes (dot paths; lists compare whole). */
23
+ export declare function changedBrushPaths(a: unknown, b: unknown, path?: string): string[];
@@ -0,0 +1,105 @@
1
+ /**
2
+ * The brush editor as data, for the React and Svelte `BrushEditor` and `BrushLibraryBrowser`:
3
+ * `brushEditorSections` lists a brush's facets as ordered sections of controls (Medium, Shape,
4
+ * Marks, Feel, Behaviour, Light, Motion, Colour), each control a facet path with its value,
5
+ * range and label, leaving out what the host profile can't render. `setBrushEditorValue` applies
6
+ * one control's change; `brushLibraryGroups` groups a library by medium and variety, tools apart.
7
+ *
8
+ * Sliders reuse the paint editor's tables (`BRUSH_SLIDERS`, `brushEngineControls`), mapped from
9
+ * engine paths to facet paths through `BRUSH_FIELDS`, so the panels and the editor agree.
10
+ */
11
+ import type { BrushLibraryEntry } from './library.cjs';
12
+ import { type BrushHostProfile } from './profiles.cjs';
13
+ import { type Brush } from './types.cjs';
14
+ export type BrushEditorSectionId = 'medium' | 'shape' | 'marks' | 'feel' | 'behaviour' | 'light' | 'motion' | 'colour';
15
+ interface ControlBase {
16
+ /** Facet path the control sets (`tip.size`, `behaviour.exchange.pickup`…). */
17
+ path: string;
18
+ label: string;
19
+ /** Accessible name (stable across hosts, for tests and assistive tech). */
20
+ ariaLabel: string;
21
+ /** Set when the host paints without this setting (its profile ignores it). */
22
+ note?: string;
23
+ }
24
+ export type BrushEditorControl = (ControlBase & {
25
+ kind: 'slider';
26
+ min: number;
27
+ max: number;
28
+ step: number;
29
+ value: number;
30
+ }) | (ControlBase & {
31
+ kind: 'choice';
32
+ options: ReadonlyArray<{
33
+ value: string;
34
+ label: string;
35
+ }>;
36
+ value: string;
37
+ }) | (ControlBase & {
38
+ kind: 'toggle';
39
+ value: boolean;
40
+ }) | (ControlBase & {
41
+ kind: 'text';
42
+ value: string;
43
+ placeholder?: string;
44
+ })
45
+ /** A solid colour (#rrggbb), or `null` when there is none (or the default is a gradient or effect). */
46
+ | (ControlBase & {
47
+ kind: 'colour';
48
+ value: string | null;
49
+ }) | (ControlBase & {
50
+ kind: 'palette';
51
+ value: string[];
52
+ max: number;
53
+ })
54
+ /** Stamp refs (`editor:star`…): `options` are the editor's stamps; hosts may offer more refs. */
55
+ | (ControlBase & {
56
+ kind: 'stamps';
57
+ value: string[];
58
+ max: number;
59
+ options: ReadonlyArray<{
60
+ value: string;
61
+ label: string;
62
+ }>;
63
+ });
64
+ export interface BrushEditorSection {
65
+ id: BrushEditorSectionId;
66
+ title: string;
67
+ controls: BrushEditorControl[];
68
+ }
69
+ /**
70
+ * Sections of controls for a brush, in order, as the host `profile` (default the paint editor)
71
+ * can render them: sections and controls it refuses are left out, ones it paints without carry
72
+ * a note. Values are the brush's own, else the defaults of the engine it resolves to.
73
+ */
74
+ export declare function brushEditorSections(brush: Brush, profile?: BrushHostProfile): BrushEditorSection[];
75
+ /**
76
+ * The brush with one control's value set (`undefined` removes it), normalised. Changing the kind,
77
+ * the marks or the tip shape starts that facet afresh. Returns the brush and what was clamped or
78
+ * dropped; an invalid change returns the brush unchanged with the reason.
79
+ */
80
+ export declare function setBrushEditorValue(brush: Brush, path: string, value: unknown): {
81
+ brush: Brush;
82
+ problems: string[];
83
+ };
84
+ export interface BrushLibraryGroup {
85
+ /** `tools`, or a medium (`paint`, `ink`, `dry`, `spray`), or `other`. */
86
+ id: string;
87
+ title: string;
88
+ /** Brushes by variety (`''`: no variety), in library order. */
89
+ varieties: Array<{
90
+ variety: string;
91
+ title: string;
92
+ entries: BrushLibraryEntry[];
93
+ }>;
94
+ }
95
+ /**
96
+ * A library grouped for a browser: marks by medium, then variety; tools as their own group.
97
+ * `text` keeps brushes whose id, name, variety or tags start with each word; `profile` keeps only
98
+ * what that host renders.
99
+ */
100
+ export declare function brushLibraryGroups(entries: readonly BrushLibraryEntry[], filter?: {
101
+ text?: string;
102
+ profile?: BrushHostProfile;
103
+ source?: 'builtin' | 'user';
104
+ }): BrushLibraryGroup[];
105
+ export {};
@@ -0,0 +1,105 @@
1
+ /**
2
+ * The brush editor as data, for the React and Svelte `BrushEditor` and `BrushLibraryBrowser`:
3
+ * `brushEditorSections` lists a brush's facets as ordered sections of controls (Medium, Shape,
4
+ * Marks, Feel, Behaviour, Light, Motion, Colour), each control a facet path with its value,
5
+ * range and label, leaving out what the host profile can't render. `setBrushEditorValue` applies
6
+ * one control's change; `brushLibraryGroups` groups a library by medium and variety, tools apart.
7
+ *
8
+ * Sliders reuse the paint editor's tables (`BRUSH_SLIDERS`, `brushEngineControls`), mapped from
9
+ * engine paths to facet paths through `BRUSH_FIELDS`, so the panels and the editor agree.
10
+ */
11
+ import type { BrushLibraryEntry } from './library.js';
12
+ import { type BrushHostProfile } from './profiles.js';
13
+ import { type Brush } from './types.js';
14
+ export type BrushEditorSectionId = 'medium' | 'shape' | 'marks' | 'feel' | 'behaviour' | 'light' | 'motion' | 'colour';
15
+ interface ControlBase {
16
+ /** Facet path the control sets (`tip.size`, `behaviour.exchange.pickup`…). */
17
+ path: string;
18
+ label: string;
19
+ /** Accessible name (stable across hosts, for tests and assistive tech). */
20
+ ariaLabel: string;
21
+ /** Set when the host paints without this setting (its profile ignores it). */
22
+ note?: string;
23
+ }
24
+ export type BrushEditorControl = (ControlBase & {
25
+ kind: 'slider';
26
+ min: number;
27
+ max: number;
28
+ step: number;
29
+ value: number;
30
+ }) | (ControlBase & {
31
+ kind: 'choice';
32
+ options: ReadonlyArray<{
33
+ value: string;
34
+ label: string;
35
+ }>;
36
+ value: string;
37
+ }) | (ControlBase & {
38
+ kind: 'toggle';
39
+ value: boolean;
40
+ }) | (ControlBase & {
41
+ kind: 'text';
42
+ value: string;
43
+ placeholder?: string;
44
+ })
45
+ /** A solid colour (#rrggbb), or `null` when there is none (or the default is a gradient or effect). */
46
+ | (ControlBase & {
47
+ kind: 'colour';
48
+ value: string | null;
49
+ }) | (ControlBase & {
50
+ kind: 'palette';
51
+ value: string[];
52
+ max: number;
53
+ })
54
+ /** Stamp refs (`editor:star`…): `options` are the editor's stamps; hosts may offer more refs. */
55
+ | (ControlBase & {
56
+ kind: 'stamps';
57
+ value: string[];
58
+ max: number;
59
+ options: ReadonlyArray<{
60
+ value: string;
61
+ label: string;
62
+ }>;
63
+ });
64
+ export interface BrushEditorSection {
65
+ id: BrushEditorSectionId;
66
+ title: string;
67
+ controls: BrushEditorControl[];
68
+ }
69
+ /**
70
+ * Sections of controls for a brush, in order, as the host `profile` (default the paint editor)
71
+ * can render them: sections and controls it refuses are left out, ones it paints without carry
72
+ * a note. Values are the brush's own, else the defaults of the engine it resolves to.
73
+ */
74
+ export declare function brushEditorSections(brush: Brush, profile?: BrushHostProfile): BrushEditorSection[];
75
+ /**
76
+ * The brush with one control's value set (`undefined` removes it), normalised. Changing the kind,
77
+ * the marks or the tip shape starts that facet afresh. Returns the brush and what was clamped or
78
+ * dropped; an invalid change returns the brush unchanged with the reason.
79
+ */
80
+ export declare function setBrushEditorValue(brush: Brush, path: string, value: unknown): {
81
+ brush: Brush;
82
+ problems: string[];
83
+ };
84
+ export interface BrushLibraryGroup {
85
+ /** `tools`, or a medium (`paint`, `ink`, `dry`, `spray`), or `other`. */
86
+ id: string;
87
+ title: string;
88
+ /** Brushes by variety (`''`: no variety), in library order. */
89
+ varieties: Array<{
90
+ variety: string;
91
+ title: string;
92
+ entries: BrushLibraryEntry[];
93
+ }>;
94
+ }
95
+ /**
96
+ * A library grouped for a browser: marks by medium, then variety; tools as their own group.
97
+ * `text` keeps brushes whose id, name, variety or tags start with each word; `profile` keeps only
98
+ * what that host renders.
99
+ */
100
+ export declare function brushLibraryGroups(entries: readonly BrushLibraryEntry[], filter?: {
101
+ text?: string;
102
+ profile?: BrushHostProfile;
103
+ source?: 'builtin' | 'user';
104
+ }): BrushLibraryGroup[];
105
+ export {};
@@ -223,7 +223,7 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
223
223
 
224
224
 
225
225
 
226
- var _chunkISIO63Q5cjs = require('../chunk-ISIO63Q5.cjs');
226
+ var _chunkL2JTLW6Bcjs = require('../chunk-L2JTLW6B.cjs');
227
227
  require('../chunk-WOFXZ3XU.cjs');
228
228
 
229
229
 
@@ -11428,14 +11428,14 @@ function canvasEffectErrorReason(effect, error) {
11428
11428
  }
11429
11429
  var CANVAS_EFFECT_MISSING_PATTERN = "repeating-linear-gradient(45deg, rgba(128,128,128,0.28) 0 2px, transparent 2px 8px)";
11430
11430
  function createCanvasEffectsController(options) {
11431
- const slot = new (0, _chunkISIO63Q5cjs.EffectsSlot)();
11431
+ const slot = new (0, _chunkL2JTLW6Bcjs.EffectsSlot)();
11432
11432
  if (options.effects) slot.set(options.effects);
11433
11433
  const describe = async (effect, place2) => {
11434
11434
  const d = await slot.require().describe(effect);
11435
11435
  const allowed = CANVAS_EFFECT_PLACES[place2];
11436
11436
  if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
11437
11437
  const where = place2 === "transition" ? "a scene transition" : place2 === "fill" ? "a fill" : "an overlay";
11438
- throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be ${where}, which takes ${allowed.join(" or ")} effects; search_effects with use "${allowed[0]}" lists ones that fit.`, d.id);
11438
+ throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be ${where}, which takes ${allowed.join(" or ")} effects; search_effects with use "${allowed[0]}" lists ones that fit.`, d.id);
11439
11439
  }
11440
11440
  return d;
11441
11441
  };
@@ -11466,7 +11466,7 @@ function createCanvasEffectsController(options) {
11466
11466
  else if (k in d.controls.properties) base[k] = d.defaults[k];
11467
11467
  else throw new Error(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
11468
11468
  }
11469
- return { ...base, ..._chunkISIO63Q5cjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
11469
+ return { ...base, ..._chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
11470
11470
  };
11471
11471
  return {
11472
11472
  /** The provider slot. */
@@ -11500,7 +11500,7 @@ function createCanvasEffectsController(options) {
11500
11500
  const mode = _nullishCoalesce(opts.mode, () => ( "fill"));
11501
11501
  const d = await describe(effect, mode);
11502
11502
  if (opts.opacity !== void 0 && !(opts.opacity >= 0 && opts.opacity <= 1)) throw new Error("opacity must be from 0 to 1.");
11503
- const next = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, opts.values), mode, ...opts.opacity !== void 0 && opts.opacity !== 1 ? { opacity: opts.opacity } : {} };
11503
+ const next = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, opts.values), mode, ...opts.opacity !== void 0 && opts.opacity !== 1 ? { opacity: opts.opacity } : {} };
11504
11504
  commit(`Add effect ${d.name}`, withEffect(nodeId, next));
11505
11505
  return next;
11506
11506
  },
@@ -11557,7 +11557,7 @@ function createCanvasEffectsController(options) {
11557
11557
  const d = await describe(effect, "transition");
11558
11558
  const duration = _nullishCoalesce(_nullishCoalesce(opts.duration, () => ( d.duration)), () => ( 600));
11559
11559
  if (!(duration > 0)) throw new Error("duration must be a number of ms above 0.");
11560
- const transition = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, opts.values), duration };
11560
+ const transition = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkL2JTLW6Bcjs.resolveEffectValues.call(void 0, d, opts.values), duration };
11561
11561
  scenes2.update(sceneId, { transition });
11562
11562
  return transition;
11563
11563
  }
@@ -11701,7 +11701,7 @@ function createCanvasEffectsToolProvider(controller, options = {}) {
11701
11701
  const once = (instance) => {
11702
11702
  if (instance !== "effect") throw new Error('A shape node has one effect, "effect".');
11703
11703
  };
11704
- return _chunkISIO63Q5cjs.createEffectToolProvider.call(void 0, {
11704
+ return _chunkL2JTLW6Bcjs.createEffectToolProvider.call(void 0, {
11705
11705
  id: _nullishCoalesce(options.id, () => ( "canvas-effects")),
11706
11706
  namespace: options.namespace,
11707
11707
  title: "Canvas effects",
@@ -223,7 +223,7 @@ import {
223
223
  EffectsSlot,
224
224
  createEffectToolProvider,
225
225
  resolveEffectValues
226
- } from "../chunk-JA57JIT5.js";
226
+ } from "../chunk-MV7CYFMJ.js";
227
227
  import "../chunk-V2ZCJRDM.js";
228
228
  import {
229
229
  brushstrokeScaleBucket
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkISIO63Q5cjs = require('./chunk-ISIO63Q5.cjs');
6
+ var _chunkL2JTLW6Bcjs = require('./chunk-L2JTLW6B.cjs');
7
7
 
8
8
 
9
9
  var _chunkWKPXOGZZcjs = require('./chunk-WKPXOGZZ.cjs');
@@ -26,7 +26,7 @@ function documentErrors(doc, description) {
26
26
  const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
27
27
  if (doc.values !== void 0) {
28
28
  if (!isRecord(doc.values)) errors.push({ path: "/values", message: "must be an object of control values" });
29
- else errors.push(..._chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, doc.values).map((e) => ({ ...e, path: `/values${e.path}` })));
29
+ else errors.push(..._chunkL2JTLW6Bcjs.effectValueErrors.call(void 0, description, doc.values).map((e) => ({ ...e, path: `/values${e.path}` })));
30
30
  }
31
31
  if (doc.tracks !== void 0) {
32
32
  if (!isRecord(doc.tracks)) errors.push({ path: "/tracks", message: "must be an object of keyframe lists" });
@@ -39,7 +39,7 @@ function documentErrors(doc, description) {
39
39
  kfs.forEach((kf, i) => {
40
40
  if (!isRecord(kf)) return errors.push({ path: `${at}/${i}`, message: "must be a keyframe object" });
41
41
  if (typeof kf.time !== "number" || !Number.isFinite(kf.time) || kf.time < 0) errors.push({ path: `${at}/${i}/time`, message: "must be a finite number of ms >= 0" });
42
- errors.push(..._chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [control]: kf.value }).map((e) => ({ ...e, path: `${at}/${i}/value` })));
42
+ errors.push(..._chunkL2JTLW6Bcjs.effectValueErrors.call(void 0, description, { [control]: kf.value }).map((e) => ({ ...e, path: `${at}/${i}/value` })));
43
43
  if (kf.easing !== void 0 && !_chunkDWJJI6RTcjs.isAnimationEasing.call(void 0, kf.easing)) errors.push({ path: `${at}/${i}/easing`, message: "is not a valid easing" });
44
44
  });
45
45
  }
@@ -49,7 +49,7 @@ function documentErrors(doc, description) {
49
49
  else
50
50
  doc.presets.forEach((p, i) => {
51
51
  if (!isRecord(p) || typeof p.name !== "string" || !p.name) return errors.push({ path: `/presets/${i}`, message: "must have a name" });
52
- errors.push(..._chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, p.values).map((e) => ({ ...e, path: `/presets/${i}/values${e.path}` })));
52
+ errors.push(..._chunkL2JTLW6Bcjs.effectValueErrors.call(void 0, description, p.values).map((e) => ({ ...e, path: `/presets/${i}/values${e.path}` })));
53
53
  });
54
54
  }
55
55
  if (doc.duration !== void 0 && (typeof doc.duration !== "number" || !Number.isFinite(doc.duration) || !(doc.duration > 0))) {
@@ -170,7 +170,7 @@ async function createEffectAuthoringSession(source, options) {
170
170
  if (isDocumentSource(source)) {
171
171
  const doc = source.document;
172
172
  if (doc.version !== 1 || !doc.effectId) {
173
- throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)("Invalid effect authoring document: version 1 required");
173
+ throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)("Invalid effect authoring document: version 1 required");
174
174
  }
175
175
  effectId = doc.effectId;
176
176
  initialDoc = doc;
@@ -178,15 +178,15 @@ async function createEffectAuthoringSession(source, options) {
178
178
  effectId = source.effectId;
179
179
  requestedPreset = source.preset;
180
180
  } else {
181
- throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)("Invalid effect authoring source");
181
+ throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)("Invalid effect authoring source");
182
182
  }
183
183
  const description = await provider.describe(effectId);
184
184
  if (initialDoc) {
185
185
  const problems = documentErrors(initialDoc, description);
186
- if (problems.length) throw new (0, _chunkISIO63Q5cjs.EffectControlError)(effectId, problems);
186
+ if (problems.length) throw new (0, _chunkL2JTLW6Bcjs.EffectControlError)(effectId, problems);
187
187
  }
188
188
  if (description.kind === "motion") {
189
- throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)("Motion effects cannot be authored as pixel effects", effectId);
189
+ throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)("Motion effects cannot be authored as pixel effects", effectId);
190
190
  }
191
191
  let disposed = false;
192
192
  let playing = false;
@@ -207,7 +207,7 @@ async function createEffectAuthoringSession(source, options) {
207
207
  const found = description.presets.find((p) => p.name === requestedPreset);
208
208
  if (!found) {
209
209
  const validNames = description.presets.map((p) => `"${p.name}"`).join(", ");
210
- throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(
210
+ throw new (0, _chunkL2JTLW6Bcjs.EffectUnsupportedError)(
211
211
  `Unknown preset "${requestedPreset}" for effect "${effectId}". Valid presets are: ${validNames || "none"}`,
212
212
  effectId
213
213
  );
@@ -321,7 +321,7 @@ async function createEffectAuthoringSession(source, options) {
321
321
  if (!validNames.includes(name)) {
322
322
  return { ok: false, message: `there is no control "${name}"; the controls are ${validNames.join(", ")}` };
323
323
  }
324
- const errors = _chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [name]: value });
324
+ const errors = _chunkL2JTLW6Bcjs.effectValueErrors.call(void 0, description, { [name]: value });
325
325
  if (errors.length > 0) {
326
326
  return { ok: false, message: valueErrorMessage(errors) };
327
327
  }
@@ -391,7 +391,7 @@ async function createEffectAuthoringSession(source, options) {
391
391
  if (!validNames.includes(k)) {
392
392
  return { ok: false, message: `there is no control "${k}"; the controls are ${validNames.join(", ")}` };
393
393
  }
394
- const errors = _chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [k]: v });
394
+ const errors = _chunkL2JTLW6Bcjs.effectValueErrors.call(void 0, description, { [k]: v });
395
395
  if (errors.length > 0) {
396
396
  return { ok: false, message: valueErrorMessage(errors) };
397
397
  }
@@ -528,7 +528,7 @@ async function createEffectAuthoringSession(source, options) {
528
528
  return { ok: false, message: `invalid easing: ${String(easing)}` };
529
529
  }
530
530
  const targetValue = value !== void 0 ? value : valuesAtTime(time, baseValues, tracks)[name];
531
- const errors = _chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [name]: targetValue });
531
+ const errors = _chunkL2JTLW6Bcjs.effectValueErrors.call(void 0, description, { [name]: targetValue });
532
532
  if (errors.length > 0) {
533
533
  return { ok: false, message: valueErrorMessage(errors) };
534
534
  }
@@ -705,7 +705,7 @@ async function createEffectAuthoringSession(source, options) {
705
705
  },
706
706
  async createPreview(opts) {
707
707
  if (disposed) {
708
- throw new (0, _chunkISIO63Q5cjs.EffectDisposedError)(effectId);
708
+ throw new (0, _chunkL2JTLW6Bcjs.EffectDisposedError)(effectId);
709
709
  }
710
710
  let renderer;
711
711
  try {
@@ -730,7 +730,7 @@ async function createEffectAuthoringSession(source, options) {
730
730
  height: renderer.height,
731
731
  depth: renderer.depth,
732
732
  render: async (req) => {
733
- if (disposed) throw new (0, _chunkISIO63Q5cjs.EffectDisposedError)(effectId);
733
+ if (disposed) throw new (0, _chunkL2JTLW6Bcjs.EffectDisposedError)(effectId);
734
734
  const effectiveValues = _nullishCoalesce(req.values, () => ( valuesAtTime(req.time, baseValues, tracks)));
735
735
  const pixels = await renderer.render({
736
736
  ...req,