@pixerate/editor 0.231.1 → 0.233.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 (62) hide show
  1. package/dist/animation-editor/compile.d.cts +3 -0
  2. package/dist/animation-editor/compile.d.ts +3 -0
  3. package/dist/animation-editor/controller.d.cts +67 -2
  4. package/dist/animation-editor/controller.d.ts +67 -2
  5. package/dist/animation-editor/edit.d.cts +1 -1
  6. package/dist/animation-editor/edit.d.ts +1 -1
  7. package/dist/animation-editor/evaluate.d.cts +8 -1
  8. package/dist/animation-editor/evaluate.d.ts +8 -1
  9. package/dist/animation-editor/index.cjs +1202 -371
  10. package/dist/animation-editor/index.d.cts +3 -0
  11. package/dist/animation-editor/index.d.ts +3 -0
  12. package/dist/animation-editor/index.js +1032 -201
  13. package/dist/animation-editor/issues.d.cts +28 -0
  14. package/dist/animation-editor/issues.d.ts +28 -0
  15. package/dist/animation-editor/layer-edit.d.cts +55 -0
  16. package/dist/animation-editor/layer-edit.d.ts +55 -0
  17. package/dist/animation-editor/layer-tools.d.cts +11 -0
  18. package/dist/animation-editor/layer-tools.d.ts +11 -0
  19. package/dist/animation-editor/layers.d.cts +166 -0
  20. package/dist/animation-editor/layers.d.ts +166 -0
  21. package/dist/animation-editor/parse.d.cts +2 -0
  22. package/dist/animation-editor/parse.d.ts +2 -0
  23. package/dist/animation-editor/types.d.cts +44 -1
  24. package/dist/animation-editor/types.d.ts +44 -1
  25. package/dist/canvas/index.cjs +10 -10
  26. package/dist/canvas/index.js +4 -4
  27. package/dist/chunk-6RZVFYGJ.cjs +255 -0
  28. package/dist/{chunk-C73U5UI3.cjs → chunk-A7PQNIBX.cjs} +14 -14
  29. package/dist/{chunk-ERJA5CGT.cjs → chunk-DGWOGQJ5.cjs} +8 -1
  30. package/dist/{chunk-TYCJGFCF.js → chunk-EUKY4KFX.js} +8 -1
  31. package/dist/chunk-I277KJLQ.js +255 -0
  32. package/dist/{chunk-OPSK22DL.cjs → chunk-JAOSL334.cjs} +24 -7
  33. package/dist/{chunk-TCZ2J7PR.js → chunk-SIK3LT6M.js} +26 -9
  34. package/dist/{chunk-SBPGIZQN.js → chunk-TEFQISBY.js} +1 -1
  35. package/dist/{chunk-CSM5T6SE.js → chunk-WDDUPWVG.js} +1 -1
  36. package/dist/{chunk-5T3H7CGG.cjs → chunk-ZQIWBJGH.cjs} +7 -7
  37. package/dist/effects/conformance.d.cts +4 -1
  38. package/dist/effects/conformance.d.ts +4 -1
  39. package/dist/effects/errors.d.cts +6 -1
  40. package/dist/effects/errors.d.ts +6 -1
  41. package/dist/effects/fake-templates.d.cts +17 -0
  42. package/dist/effects/fake-templates.d.ts +17 -0
  43. package/dist/effects/fake.d.cts +6 -1
  44. package/dist/effects/fake.d.ts +6 -1
  45. package/dist/effects/index.cjs +322 -67
  46. package/dist/effects/index.d.cts +1 -0
  47. package/dist/effects/index.d.ts +1 -0
  48. package/dist/effects/index.js +258 -3
  49. package/dist/effects/templates.d.cts +56 -0
  50. package/dist/effects/templates.d.ts +56 -0
  51. package/dist/effects/types.d.cts +212 -0
  52. package/dist/effects/types.d.ts +212 -0
  53. package/dist/image-editor/index.cjs +16 -16
  54. package/dist/image-editor/index.js +4 -4
  55. package/dist/paint-editor/index.cjs +10 -10
  56. package/dist/paint-editor/index.js +5 -5
  57. package/dist/vector/index.cjs +6 -6
  58. package/dist/vector/index.js +1 -1
  59. package/dist/video-editor/index.cjs +339 -339
  60. package/dist/video-editor/index.js +5 -5
  61. package/package.json +1 -1
  62. package/skills/pixerate-animation-editor/SKILL.md +37 -0
@@ -275,6 +275,204 @@ export interface CameraMoveSample {
275
275
  /** Ms of the cut, when the move has one. */
276
276
  cut?: number;
277
277
  }
278
+ /** A box in a sequence's stage units (pixels of `EffectSequence.stage`). */
279
+ export interface EffectRect {
280
+ x: number;
281
+ y: number;
282
+ width: number;
283
+ height: number;
284
+ }
285
+ /**
286
+ * Something a layer shows or applies its effect to: a picture or SVG (a URL, a `data:` URL or
287
+ * `<svg>` markup), a video by URL, words, or `{ slot }`: a subject the host fills in by name.
288
+ */
289
+ export type EffectSubject = {
290
+ image: string;
291
+ } | {
292
+ video: string;
293
+ } | {
294
+ svg: string;
295
+ } | {
296
+ text: string;
297
+ font?: string;
298
+ weight?: number | string;
299
+ } | {
300
+ slot: string;
301
+ };
302
+ /** The kinds of subject, as `EffectSubject` keys. */
303
+ export declare const EFFECT_SUBJECT_KINDS: readonly ["image", "video", "svg", "text", "slot"];
304
+ export type EffectSubjectKind = (typeof EFFECT_SUBJECT_KINDS)[number];
305
+ /**
306
+ * Where a layer sits in a shot's stack: `background` under the shot's own content, `subject`
307
+ * with it, `overlay` above everything.
308
+ */
309
+ export type EffectLayerRole = 'background' | 'subject' | 'overlay';
310
+ export declare const EFFECT_LAYER_ROLES: readonly EffectLayerRole[];
311
+ /** When a layer starts or stops: ms after its shot starts, or `{ shots: n }` for when the n-th shot after its own begins. */
312
+ export type EffectLayerTime = number | {
313
+ shots: number;
314
+ };
315
+ /**
316
+ * One layer of a shot (the shape of Flair's `SceneLayer`): a catalog effect, optionally applied
317
+ * to a subject, or a bare subject (no `effect`), placed on the stage for a stretch of time.
318
+ * The subject feeds the effect's `source` input, else its first image input.
319
+ */
320
+ export interface EffectLayer {
321
+ /** A name unique in the sequence. */
322
+ id?: string;
323
+ /** The effect's id (a generator, filter, overlay or title). Absent for a bare subject. */
324
+ effect?: string;
325
+ /** A preset of the effect's, by name; its values are written out in `values` too. */
326
+ preset?: string;
327
+ /** Control values over the effect's defaults. */
328
+ values?: Record<string, EffectValue>;
329
+ subject?: EffectSubject;
330
+ /** Default `subject` when placed with `rect`, else `background`. */
331
+ role?: EffectLayerRole;
332
+ /** Where it sits, in stage units; it moves with the camera. Absent: it fills the screen. */
333
+ rect?: EffectRect;
334
+ /** When it starts (default 0: as its shot starts). */
335
+ from?: EffectLayerTime;
336
+ /** When it stops (default `{ shots: 1 }`: as the next shot starts). */
337
+ until?: EffectLayerTime;
338
+ /** 0–1 (default 1). */
339
+ opacity?: number;
340
+ /** Ms it fades in and out over (default 0: it cuts). */
341
+ fade?: number;
342
+ }
343
+ /**
344
+ * A transition into a shot (the shape of Flair's `ShotTransition`): an effect with the use
345
+ * `transition` blends the outgoing shot's last frame (`from`) into the incoming shot (`to`) as
346
+ * `progress` runs 0 → 1 over `ms`.
347
+ */
348
+ export interface EffectShotTransition {
349
+ effect: string;
350
+ /** Length (ms), default `EFFECT_TRANSITION_MS`. */
351
+ ms?: number;
352
+ preset?: string;
353
+ values?: Record<string, EffectValue>;
354
+ }
355
+ /** How long a shot transition takes when it does not say (ms). */
356
+ export declare const EFFECT_TRANSITION_MS = 800;
357
+ /** One shot of a sequence. */
358
+ export interface EffectSequenceShot {
359
+ /** Ms the shot holds after its lead-in (the longer of its camera move and its transition). */
360
+ hold: number;
361
+ /** Words shown large over the shot. */
362
+ title?: string;
363
+ /** Words shown small at the foot of the shot. */
364
+ caption?: string;
365
+ camera?: {
366
+ /** What the camera frames, in stage units (default the whole stage). */
367
+ framing?: EffectRect;
368
+ /** A `transition` camera move into this framing. */
369
+ in?: CameraMoveSpec;
370
+ /** A `hold` camera move while the shot holds. */
371
+ during?: CameraMoveSpec;
372
+ };
373
+ /** Bottom to top. */
374
+ layers: EffectLayer[];
375
+ /** How the shot before gives way to this one; absent on the first shot. */
376
+ transition?: EffectShotTransition;
377
+ }
378
+ /**
379
+ * A sequence of shots built from catalog effects: what a template fills to. Renderer-neutral;
380
+ * editors load it into their own documents (an animation's shots, a video's clips).
381
+ */
382
+ export interface EffectSequence {
383
+ name: string;
384
+ title?: string;
385
+ /** Stage size in pixels; rects and framings are in these units. */
386
+ stage: CameraStage;
387
+ shots: EffectSequenceShot[];
388
+ }
389
+ /** One template of a provider's catalog. */
390
+ export interface EffectTemplateSummary {
391
+ /** Stable id. */
392
+ id: string;
393
+ name: string;
394
+ description: string;
395
+ tags?: readonly string[];
396
+ /** How many shots it fills to. */
397
+ shots: number;
398
+ /** Length with its defaults (ms), when the provider knows it. */
399
+ durationMs?: number;
400
+ }
401
+ /** The kinds of template slot: a subject (`image`, `video`, `svg`), `text`, `color` or `number`. */
402
+ export declare const EFFECT_TEMPLATE_SLOT_TYPES: readonly ["image", "video", "svg", "text", "color", "number"];
403
+ export type EffectTemplateSlotType = (typeof EFFECT_TEMPLATE_SLOT_TYPES)[number];
404
+ interface EffectTemplateSlotBase {
405
+ /** Letters, digits, `-` and `_`, starting with a letter. */
406
+ name: string;
407
+ /** What a form shows for it. */
408
+ label: string;
409
+ /** A sentence on what it is for. */
410
+ description?: string;
411
+ }
412
+ /**
413
+ * A slot for a picture, SVG or video. Its default (which may be large) is not described, only
414
+ * whether there is one; with none, an unfilled slot is left for the host (`openSlots`).
415
+ */
416
+ export interface EffectTemplateSubjectSlot extends EffectTemplateSlotBase {
417
+ type: 'image' | 'video' | 'svg';
418
+ hasDefault: boolean;
419
+ }
420
+ export interface EffectTemplateTextSlot extends EffectTemplateSlotBase {
421
+ type: 'text';
422
+ default: string;
423
+ /** The most characters it takes. */
424
+ maxLength?: number;
425
+ }
426
+ /** A colour, `#RRGGBB`. */
427
+ export interface EffectTemplateColorSlot extends EffectTemplateSlotBase {
428
+ type: 'color';
429
+ default: string;
430
+ }
431
+ export interface EffectTemplateNumberSlot extends EffectTemplateSlotBase {
432
+ type: 'number';
433
+ default: number;
434
+ min?: number;
435
+ max?: number;
436
+ /** Whole numbers only. */
437
+ integer?: boolean;
438
+ }
439
+ /** A slot of a template, shaped for a form (Flair's `describeTemplateSlots`). */
440
+ export type EffectTemplateSlot = EffectTemplateSubjectSlot | EffectTemplateTextSlot | EffectTemplateColorSlot | EffectTemplateNumberSlot;
441
+ /** A template with its slots, in the order a form shows them. */
442
+ export interface EffectTemplateDescription extends EffectTemplateSummary {
443
+ slots: readonly EffectTemplateSlot[];
444
+ }
445
+ /**
446
+ * What fills a slot: words, a colour or a number; for a subject slot a URL or markup, a subject
447
+ * object, or `{ slot: name }` to leave it for the host.
448
+ */
449
+ export type EffectTemplateValue = string | number | EffectSubject;
450
+ export type EffectTemplateValues = Readonly<Record<string, EffectTemplateValue>>;
451
+ export interface EffectTemplateSearchOptions {
452
+ /** Only templates matching every word (in name, id, tags or description). */
453
+ query?: string;
454
+ /** Only templates carrying every one of these tags. */
455
+ tags?: readonly string[];
456
+ /** Most results to return. */
457
+ limit?: number;
458
+ }
459
+ export interface EffectTemplateOptions {
460
+ /** The sequence's name: lowercase words and dashes (default the template's id). */
461
+ name?: string;
462
+ }
463
+ /** What `instantiateTemplate` gives. Values that do not fit are refused all at once, never in part. */
464
+ export type EffectTemplateResult = {
465
+ ok: true;
466
+ sequence: EffectSequence;
467
+ /** Subject slots left for the host to fill (no value and no default, or `{ slot }`). */
468
+ openSlots: readonly string[];
469
+ /** What the provider left out or changed, in sentences (empty when nothing was). */
470
+ notes: readonly string[];
471
+ } | {
472
+ ok: false;
473
+ /** Each a sentence naming the slot and what it takes. */
474
+ errors: readonly string[];
475
+ };
278
476
  /** What a provider can do, so editors can degrade cleanly. */
279
477
  export interface EffectProviderCapabilities {
280
478
  /** Renders off the main thread. */
@@ -293,6 +491,8 @@ export interface EffectProviderCapabilities {
293
491
  supportsAuthoring?: boolean;
294
492
  /** Lists `camera` effects and implements `cameraView` (and maybe `sampleCameraMove`). */
295
493
  supportsCamera?: boolean;
494
+ /** Implements `listTemplates`, `describeTemplate` and `instantiateTemplate`. */
495
+ supportsTemplates?: boolean;
296
496
  }
297
497
  export type MaybePromise<T> = T | Promise<T>;
298
498
  /**
@@ -342,4 +542,16 @@ export interface EffectProvider {
342
542
  * `sampleEffectCameraMove` falls back to `cameraView` per frame. Errors as for `cameraView`.
343
543
  */
344
544
  sampleCameraMove?(id: string, request: CameraMoveSampleRequest): MaybePromise<CameraMoveSample>;
545
+ /** Sequence templates, best match first. Present when `capabilities.supportsTemplates`. */
546
+ listTemplates?(options?: EffectTemplateSearchOptions): MaybePromise<readonly EffectTemplateSummary[]>;
547
+ /** A template with its slots. Unknown ids throw `UnknownTemplateError`. */
548
+ describeTemplate?(id: string): MaybePromise<EffectTemplateDescription>;
549
+ /**
550
+ * Fills a template's slots and returns the sequence. Slots left out take their defaults.
551
+ * Values that do not fit (an unknown slot, a wrong type, out of range) give `{ ok: false,
552
+ * errors }`, each error a sentence. Unknown ids throw `UnknownTemplateError`. Every effect
553
+ * the sequence names is in the provider's `list()`.
554
+ */
555
+ instantiateTemplate?(id: string, values?: EffectTemplateValues, options?: EffectTemplateOptions): MaybePromise<EffectTemplateResult>;
345
556
  }
557
+ export {};
@@ -275,6 +275,204 @@ export interface CameraMoveSample {
275
275
  /** Ms of the cut, when the move has one. */
276
276
  cut?: number;
277
277
  }
278
+ /** A box in a sequence's stage units (pixels of `EffectSequence.stage`). */
279
+ export interface EffectRect {
280
+ x: number;
281
+ y: number;
282
+ width: number;
283
+ height: number;
284
+ }
285
+ /**
286
+ * Something a layer shows or applies its effect to: a picture or SVG (a URL, a `data:` URL or
287
+ * `<svg>` markup), a video by URL, words, or `{ slot }`: a subject the host fills in by name.
288
+ */
289
+ export type EffectSubject = {
290
+ image: string;
291
+ } | {
292
+ video: string;
293
+ } | {
294
+ svg: string;
295
+ } | {
296
+ text: string;
297
+ font?: string;
298
+ weight?: number | string;
299
+ } | {
300
+ slot: string;
301
+ };
302
+ /** The kinds of subject, as `EffectSubject` keys. */
303
+ export declare const EFFECT_SUBJECT_KINDS: readonly ["image", "video", "svg", "text", "slot"];
304
+ export type EffectSubjectKind = (typeof EFFECT_SUBJECT_KINDS)[number];
305
+ /**
306
+ * Where a layer sits in a shot's stack: `background` under the shot's own content, `subject`
307
+ * with it, `overlay` above everything.
308
+ */
309
+ export type EffectLayerRole = 'background' | 'subject' | 'overlay';
310
+ export declare const EFFECT_LAYER_ROLES: readonly EffectLayerRole[];
311
+ /** When a layer starts or stops: ms after its shot starts, or `{ shots: n }` for when the n-th shot after its own begins. */
312
+ export type EffectLayerTime = number | {
313
+ shots: number;
314
+ };
315
+ /**
316
+ * One layer of a shot (the shape of Flair's `SceneLayer`): a catalog effect, optionally applied
317
+ * to a subject, or a bare subject (no `effect`), placed on the stage for a stretch of time.
318
+ * The subject feeds the effect's `source` input, else its first image input.
319
+ */
320
+ export interface EffectLayer {
321
+ /** A name unique in the sequence. */
322
+ id?: string;
323
+ /** The effect's id (a generator, filter, overlay or title). Absent for a bare subject. */
324
+ effect?: string;
325
+ /** A preset of the effect's, by name; its values are written out in `values` too. */
326
+ preset?: string;
327
+ /** Control values over the effect's defaults. */
328
+ values?: Record<string, EffectValue>;
329
+ subject?: EffectSubject;
330
+ /** Default `subject` when placed with `rect`, else `background`. */
331
+ role?: EffectLayerRole;
332
+ /** Where it sits, in stage units; it moves with the camera. Absent: it fills the screen. */
333
+ rect?: EffectRect;
334
+ /** When it starts (default 0: as its shot starts). */
335
+ from?: EffectLayerTime;
336
+ /** When it stops (default `{ shots: 1 }`: as the next shot starts). */
337
+ until?: EffectLayerTime;
338
+ /** 0–1 (default 1). */
339
+ opacity?: number;
340
+ /** Ms it fades in and out over (default 0: it cuts). */
341
+ fade?: number;
342
+ }
343
+ /**
344
+ * A transition into a shot (the shape of Flair's `ShotTransition`): an effect with the use
345
+ * `transition` blends the outgoing shot's last frame (`from`) into the incoming shot (`to`) as
346
+ * `progress` runs 0 → 1 over `ms`.
347
+ */
348
+ export interface EffectShotTransition {
349
+ effect: string;
350
+ /** Length (ms), default `EFFECT_TRANSITION_MS`. */
351
+ ms?: number;
352
+ preset?: string;
353
+ values?: Record<string, EffectValue>;
354
+ }
355
+ /** How long a shot transition takes when it does not say (ms). */
356
+ export declare const EFFECT_TRANSITION_MS = 800;
357
+ /** One shot of a sequence. */
358
+ export interface EffectSequenceShot {
359
+ /** Ms the shot holds after its lead-in (the longer of its camera move and its transition). */
360
+ hold: number;
361
+ /** Words shown large over the shot. */
362
+ title?: string;
363
+ /** Words shown small at the foot of the shot. */
364
+ caption?: string;
365
+ camera?: {
366
+ /** What the camera frames, in stage units (default the whole stage). */
367
+ framing?: EffectRect;
368
+ /** A `transition` camera move into this framing. */
369
+ in?: CameraMoveSpec;
370
+ /** A `hold` camera move while the shot holds. */
371
+ during?: CameraMoveSpec;
372
+ };
373
+ /** Bottom to top. */
374
+ layers: EffectLayer[];
375
+ /** How the shot before gives way to this one; absent on the first shot. */
376
+ transition?: EffectShotTransition;
377
+ }
378
+ /**
379
+ * A sequence of shots built from catalog effects: what a template fills to. Renderer-neutral;
380
+ * editors load it into their own documents (an animation's shots, a video's clips).
381
+ */
382
+ export interface EffectSequence {
383
+ name: string;
384
+ title?: string;
385
+ /** Stage size in pixels; rects and framings are in these units. */
386
+ stage: CameraStage;
387
+ shots: EffectSequenceShot[];
388
+ }
389
+ /** One template of a provider's catalog. */
390
+ export interface EffectTemplateSummary {
391
+ /** Stable id. */
392
+ id: string;
393
+ name: string;
394
+ description: string;
395
+ tags?: readonly string[];
396
+ /** How many shots it fills to. */
397
+ shots: number;
398
+ /** Length with its defaults (ms), when the provider knows it. */
399
+ durationMs?: number;
400
+ }
401
+ /** The kinds of template slot: a subject (`image`, `video`, `svg`), `text`, `color` or `number`. */
402
+ export declare const EFFECT_TEMPLATE_SLOT_TYPES: readonly ["image", "video", "svg", "text", "color", "number"];
403
+ export type EffectTemplateSlotType = (typeof EFFECT_TEMPLATE_SLOT_TYPES)[number];
404
+ interface EffectTemplateSlotBase {
405
+ /** Letters, digits, `-` and `_`, starting with a letter. */
406
+ name: string;
407
+ /** What a form shows for it. */
408
+ label: string;
409
+ /** A sentence on what it is for. */
410
+ description?: string;
411
+ }
412
+ /**
413
+ * A slot for a picture, SVG or video. Its default (which may be large) is not described, only
414
+ * whether there is one; with none, an unfilled slot is left for the host (`openSlots`).
415
+ */
416
+ export interface EffectTemplateSubjectSlot extends EffectTemplateSlotBase {
417
+ type: 'image' | 'video' | 'svg';
418
+ hasDefault: boolean;
419
+ }
420
+ export interface EffectTemplateTextSlot extends EffectTemplateSlotBase {
421
+ type: 'text';
422
+ default: string;
423
+ /** The most characters it takes. */
424
+ maxLength?: number;
425
+ }
426
+ /** A colour, `#RRGGBB`. */
427
+ export interface EffectTemplateColorSlot extends EffectTemplateSlotBase {
428
+ type: 'color';
429
+ default: string;
430
+ }
431
+ export interface EffectTemplateNumberSlot extends EffectTemplateSlotBase {
432
+ type: 'number';
433
+ default: number;
434
+ min?: number;
435
+ max?: number;
436
+ /** Whole numbers only. */
437
+ integer?: boolean;
438
+ }
439
+ /** A slot of a template, shaped for a form (Flair's `describeTemplateSlots`). */
440
+ export type EffectTemplateSlot = EffectTemplateSubjectSlot | EffectTemplateTextSlot | EffectTemplateColorSlot | EffectTemplateNumberSlot;
441
+ /** A template with its slots, in the order a form shows them. */
442
+ export interface EffectTemplateDescription extends EffectTemplateSummary {
443
+ slots: readonly EffectTemplateSlot[];
444
+ }
445
+ /**
446
+ * What fills a slot: words, a colour or a number; for a subject slot a URL or markup, a subject
447
+ * object, or `{ slot: name }` to leave it for the host.
448
+ */
449
+ export type EffectTemplateValue = string | number | EffectSubject;
450
+ export type EffectTemplateValues = Readonly<Record<string, EffectTemplateValue>>;
451
+ export interface EffectTemplateSearchOptions {
452
+ /** Only templates matching every word (in name, id, tags or description). */
453
+ query?: string;
454
+ /** Only templates carrying every one of these tags. */
455
+ tags?: readonly string[];
456
+ /** Most results to return. */
457
+ limit?: number;
458
+ }
459
+ export interface EffectTemplateOptions {
460
+ /** The sequence's name: lowercase words and dashes (default the template's id). */
461
+ name?: string;
462
+ }
463
+ /** What `instantiateTemplate` gives. Values that do not fit are refused all at once, never in part. */
464
+ export type EffectTemplateResult = {
465
+ ok: true;
466
+ sequence: EffectSequence;
467
+ /** Subject slots left for the host to fill (no value and no default, or `{ slot }`). */
468
+ openSlots: readonly string[];
469
+ /** What the provider left out or changed, in sentences (empty when nothing was). */
470
+ notes: readonly string[];
471
+ } | {
472
+ ok: false;
473
+ /** Each a sentence naming the slot and what it takes. */
474
+ errors: readonly string[];
475
+ };
278
476
  /** What a provider can do, so editors can degrade cleanly. */
279
477
  export interface EffectProviderCapabilities {
280
478
  /** Renders off the main thread. */
@@ -293,6 +491,8 @@ export interface EffectProviderCapabilities {
293
491
  supportsAuthoring?: boolean;
294
492
  /** Lists `camera` effects and implements `cameraView` (and maybe `sampleCameraMove`). */
295
493
  supportsCamera?: boolean;
494
+ /** Implements `listTemplates`, `describeTemplate` and `instantiateTemplate`. */
495
+ supportsTemplates?: boolean;
296
496
  }
297
497
  export type MaybePromise<T> = T | Promise<T>;
298
498
  /**
@@ -342,4 +542,16 @@ export interface EffectProvider {
342
542
  * `sampleEffectCameraMove` falls back to `cameraView` per frame. Errors as for `cameraView`.
343
543
  */
344
544
  sampleCameraMove?(id: string, request: CameraMoveSampleRequest): MaybePromise<CameraMoveSample>;
545
+ /** Sequence templates, best match first. Present when `capabilities.supportsTemplates`. */
546
+ listTemplates?(options?: EffectTemplateSearchOptions): MaybePromise<readonly EffectTemplateSummary[]>;
547
+ /** A template with its slots. Unknown ids throw `UnknownTemplateError`. */
548
+ describeTemplate?(id: string): MaybePromise<EffectTemplateDescription>;
549
+ /**
550
+ * Fills a template's slots and returns the sequence. Slots left out take their defaults.
551
+ * Values that do not fit (an unknown slot, a wrong type, out of range) give `{ ok: false,
552
+ * errors }`, each error a sentence. Unknown ids throw `UnknownTemplateError`. Every effect
553
+ * the sequence names is in the provider's `list()`.
554
+ */
555
+ instantiateTemplate?(id: string, values?: EffectTemplateValues, options?: EffectTemplateOptions): MaybePromise<EffectTemplateResult>;
345
556
  }
557
+ export {};
@@ -460,9 +460,6 @@ var _chunkA2IS7EHEcjs = require('../chunk-A2IS7EHE.cjs');
460
460
  var _chunkSS53NNZOcjs = require('../chunk-SS53NNZO.cjs');
461
461
 
462
462
 
463
- var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
464
-
465
-
466
463
  var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
467
464
 
468
465
 
@@ -739,12 +736,15 @@ var _chunkGF2RBSDMcjs = require('../chunk-GF2RBSDM.cjs');
739
736
  require('../chunk-NM3G4VQT.cjs');
740
737
 
741
738
 
739
+ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
740
+
741
+
742
742
 
743
743
 
744
744
 
745
745
 
746
746
 
747
- var _chunkOPSK22DLcjs = require('../chunk-OPSK22DL.cjs');
747
+ var _chunkJAOSL334cjs = require('../chunk-JAOSL334.cjs');
748
748
  require('../chunk-WOFXZ3XU.cjs');
749
749
 
750
750
 
@@ -4832,7 +4832,7 @@ function checkImageEffectPlace(d, place) {
4832
4832
  const allowed = IMAGE_EFFECT_PLACES[place];
4833
4833
  if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
4834
4834
  const instead = place === "filter" && d.uses.some((u) => IMAGE_EFFECT_PLACES.layer.includes(u)) ? "; add it as an effect layer with add_effect_layer instead" : place === "layer" && d.uses.includes("filter") ? "; apply it to a layer as a smart filter with apply_effect instead" : "";
4835
- throw new (0, _chunkOPSK22DLcjs.EffectUnsupportedError)(
4835
+ throw new (0, _chunkJAOSL334cjs.EffectUnsupportedError)(
4836
4836
  `"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect, and ${place === "filter" ? "a smart filter takes filter effects" : "an effect layer takes generator, overlay or title effects"}${instead}.`,
4837
4837
  d.id
4838
4838
  );
@@ -4856,9 +4856,9 @@ function effectPixelsToSurface(p, depth) {
4856
4856
  const d = new Uint16Array(f.length);
4857
4857
  const code = (v) => v > 0 ? v < 1 ? Math.round(v * 65535) : 65535 : 0;
4858
4858
  for (let i = 0; i < f.length; i += 4) {
4859
- d[i] = code(_chunkOPSK22DLcjs.linearToSrgb.call(void 0, f[i]));
4860
- d[i + 1] = code(_chunkOPSK22DLcjs.linearToSrgb.call(void 0, f[i + 1]));
4861
- d[i + 2] = code(_chunkOPSK22DLcjs.linearToSrgb.call(void 0, f[i + 2]));
4859
+ d[i] = code(_chunkJAOSL334cjs.linearToSrgb.call(void 0, f[i]));
4860
+ d[i + 1] = code(_chunkJAOSL334cjs.linearToSrgb.call(void 0, f[i + 1]));
4861
+ d[i + 2] = code(_chunkJAOSL334cjs.linearToSrgb.call(void 0, f[i + 2]));
4862
4862
  d[i + 3] = code(f[i + 3]);
4863
4863
  }
4864
4864
  return _chunkOLNIPTB3cjs.surfaceFromDeepPixels.call(void 0, { width: p.width, height: p.height, data: d }, 4);
@@ -4875,7 +4875,7 @@ var ImageEffectsEngine = (_class9 = class {
4875
4875
  __init49() {this.generation = 0}
4876
4876
 
4877
4877
  constructor(options = {}) {;_class9.prototype.__init44.call(this);_class9.prototype.__init45.call(this);_class9.prototype.__init46.call(this);_class9.prototype.__init47.call(this);_class9.prototype.__init48.call(this);_class9.prototype.__init49.call(this);
4878
- this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkOPSK22DLcjs.EffectsSlot)()));
4878
+ this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkJAOSL334cjs.EffectsSlot)()));
4879
4879
  this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 24));
4880
4880
  this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
4881
4881
  this.detach = this.slot.subscribe(() => {
@@ -4935,7 +4935,7 @@ var ImageEffectsEngine = (_class9 = class {
4935
4935
  const provider = this.slot.require();
4936
4936
  const depth = _nullishCoalesce(size.depth, () => ( 8));
4937
4937
  const out = await this.render(provider, effect, size.width, size.height, depth, { time: _nullishCoalesce(size.time, () => ( 0)), values });
4938
- return out.width === size.width && out.height === size.height ? out : _chunkOPSK22DLcjs.createEffectPixels.call(void 0, size.width, size.height);
4938
+ return out.width === size.width && out.height === size.height ? out : _chunkJAOSL334cjs.createEffectPixels.call(void 0, size.width, size.height);
4939
4939
  }
4940
4940
  /** Why the result for `key` failed, if it did. */
4941
4941
  failure(key2) {
@@ -6197,7 +6197,7 @@ var ImageEditorController = (_class12 = class {
6197
6197
  __init84() {this.selectionWorker = null}
6198
6198
  __init85() {this.documentOpener = null}
6199
6199
  /** The effects provider slot (see `setEffectsProvider`). */
6200
- __init86() {this.effects = new (0, _chunkOPSK22DLcjs.EffectsSlot)()}
6200
+ __init86() {this.effects = new (0, _chunkJAOSL334cjs.EffectsSlot)()}
6201
6201
  /** Renders provider effects: effect smart filter results and effect layers. */
6202
6202
  __init87() {this.effectsEngine = new ImageEffectsEngine({ slot: this.effects })}
6203
6203
  __init88() {this.effectRefresh = "none"}
@@ -6533,7 +6533,7 @@ var ImageEditorController = (_class12 = class {
6533
6533
  */
6534
6534
  async applyEffectFilter(layerId, effect, options = {}) {
6535
6535
  const d = await this.describeEffect(effect, "filter");
6536
- const values = _chunkOPSK22DLcjs.resolveEffectValues.call(void 0, d, options.values);
6536
+ const values = _chunkJAOSL334cjs.resolveEffectValues.call(void 0, d, options.values);
6537
6537
  const found = _chunkHB4ICNNAcjs.findLayer.call(void 0, this.state.layers, layerId);
6538
6538
  if (!found) throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`There is no layer "${layerId}"; call list_layers for the layer ids.`);
6539
6539
  let layers = this.state.layers;
@@ -6575,7 +6575,7 @@ var ImageEditorController = (_class12 = class {
6575
6575
  else if (k in d.controls.properties) base[k] = d.defaults[k];
6576
6576
  else throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
6577
6577
  }
6578
- update.values = { ...base, ..._chunkOPSK22DLcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
6578
+ update.values = { ...base, ..._chunkJAOSL334cjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
6579
6579
  }
6580
6580
  for (const k of ["enabled", "blend", "opacity", "preserveTransparency"]) if (changes[k] !== void 0) update[k] = changes[k];
6581
6581
  let res = _chunk5VQXSS2Scjs.updateSmartFilter.call(void 0, this.state.layers, layerId, filterId, update, this.canvasSize);
@@ -6602,7 +6602,7 @@ var ImageEditorController = (_class12 = class {
6602
6602
  const id = options.id && !ids.has(options.id) ? options.id : _chunk5VQXSS2Scjs.newLayerId.call(void 0, );
6603
6603
  const placed = _chunk5VQXSS2Scjs.placeLayer.call(void 0, this.state.layers, { type: "pixel", id, name: "", visible: true, opacity: 1, blend: "normal", surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } }, this.newLayerPlacement(options));
6604
6604
  if (options.clipped) requireClipBase(placed, id);
6605
- const values = _chunkOPSK22DLcjs.resolveEffectValues.call(void 0, d, withBackgroundOpacity(d, options.values, hasLayersBelow(placed, id)));
6605
+ const values = _chunkJAOSL334cjs.resolveEffectValues.call(void 0, d, withBackgroundOpacity(d, options.values, hasLayersBelow(placed, id)));
6606
6606
  const { width, height } = this.naturalSize;
6607
6607
  const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time });
6608
6608
  const layer = {
@@ -6647,7 +6647,7 @@ var ImageEditorController = (_class12 = class {
6647
6647
  else if (k in d.controls.properties) base[k] = d.defaults[k];
6648
6648
  else throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
6649
6649
  }
6650
- const values = { ...base, ..._chunkOPSK22DLcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
6650
+ const values = { ...base, ..._chunkJAOSL334cjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
6651
6651
  const time = changes.time === void 0 ? _nullishCoalesce(g.time, () => ( 0)) : checkEffectTime(changes.time);
6652
6652
  const animate = changes.animate === void 0 ? g.animate : changes.animate === null ? void 0 : checkEffectAnimation(changes.animate);
6653
6653
  const { width, height } = this.naturalSize;
@@ -21925,7 +21925,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
21925
21925
  return { target, effect: _nullishCoalesce(effects.find((e) => e.id === instance), () => ( effects[effects.length - 1])), effects, ...extra };
21926
21926
  };
21927
21927
  const plainValues = (v) => v;
21928
- return withImagePlayback(_chunkOPSK22DLcjs.createEffectToolProvider.call(void 0, {
21928
+ return withImagePlayback(_chunkJAOSL334cjs.createEffectToolProvider.call(void 0, {
21929
21929
  id: _nullishCoalesce(options.id, () => ( "image-effects")),
21930
21930
  namespace: options.namespace,
21931
21931
  title: "Image effects",
@@ -458,9 +458,6 @@ import {
458
458
  shiftCoverage,
459
459
  smoothCoverage
460
460
  } from "../chunk-ZNA3IQZF.js";
461
- import {
462
- EffectRendererPool
463
- } from "../chunk-EHLOCVWB.js";
464
461
  import {
465
462
  createCaptureTool
466
463
  } from "../chunk-5ED73EC6.js";
@@ -737,6 +734,9 @@ import {
737
734
  segmentNearest
738
735
  } from "../chunk-WEIK3UYB.js";
739
736
  import "../chunk-PWBZH3FK.js";
737
+ import {
738
+ EffectRendererPool
739
+ } from "../chunk-EHLOCVWB.js";
740
740
  import {
741
741
  EffectUnsupportedError,
742
742
  EffectsSlot,
@@ -744,7 +744,7 @@ import {
744
744
  createEffectToolProvider,
745
745
  linearToSrgb,
746
746
  resolveEffectValues
747
- } from "../chunk-TCZ2J7PR.js";
747
+ } from "../chunk-SIK3LT6M.js";
748
748
  import "../chunk-V2ZCJRDM.js";
749
749
  import {
750
750
  BrushstrokeCache,