@pixerate/editor 0.270.0 → 0.272.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 (77) hide show
  1. package/dist/animation-editor/index.cjs +62 -62
  2. package/dist/animation-editor/index.js +5 -5
  3. package/dist/brushes/index.cjs +69 -66
  4. package/dist/brushes/index.js +6 -3
  5. package/dist/brushes/patch.d.cts +1 -1
  6. package/dist/brushes/patch.d.ts +1 -1
  7. package/dist/brushes/schema.d.cts +1 -0
  8. package/dist/brushes/schema.d.ts +1 -0
  9. package/dist/brushes/types.d.cts +8 -0
  10. package/dist/brushes/types.d.ts +8 -0
  11. package/dist/{brushstrokeRender-WR2N5HHY.cjs → brushstrokeRender-5YBCLFDQ.cjs} +15 -15
  12. package/dist/{brushstrokeRender-A727TTNQ.js → brushstrokeRender-DZGFU3J4.js} +3 -3
  13. package/dist/canvas/index.cjs +15 -15
  14. package/dist/canvas/index.js +2 -2
  15. package/dist/{chunk-THBJHPUL.js → chunk-2F3YDXCN.js} +1 -1
  16. package/dist/{chunk-4CPOKP27.js → chunk-2XDNF73E.js} +1 -1
  17. package/dist/{chunk-3KNQ2W6X.cjs → chunk-3JKCREEU.cjs} +59 -53
  18. package/dist/{chunk-4YSPQGZW.js → chunk-5HP2VSAS.js} +1 -1
  19. package/dist/{chunk-BPJSI4NT.cjs → chunk-7W2EQQBP.cjs} +2 -2
  20. package/dist/{chunk-LETF75CA.js → chunk-CLB2I2FU.js} +1 -1
  21. package/dist/{chunk-BAZMCFVL.js → chunk-DZVRH63Y.js} +1 -1
  22. package/dist/{chunk-PY4GWSE2.cjs → chunk-EBFPMSJO.cjs} +27 -5
  23. package/dist/{chunk-VBRHE4AM.cjs → chunk-FXVCB6YG.cjs} +35 -35
  24. package/dist/{chunk-EU2ZZA6L.cjs → chunk-GHGBIAWQ.cjs} +126 -39
  25. package/dist/{chunk-CBVNCWJM.cjs → chunk-LBDC5434.cjs} +2 -2
  26. package/dist/{chunk-2WOGXEDX.cjs → chunk-M3RZOF3G.cjs} +1 -1
  27. package/dist/{chunk-GSTSZPSR.js → chunk-N3SKPQEH.js} +225 -18
  28. package/dist/{chunk-J5VQYK7T.cjs → chunk-N5IMDAHM.cjs} +251 -44
  29. package/dist/{chunk-ININNHLM.js → chunk-NAHJV3O6.js} +11 -5
  30. package/dist/{chunk-MWUZCEFT.js → chunk-S2XPXA47.js} +1 -1
  31. package/dist/{chunk-56RHCIJV.cjs → chunk-SNAFFCAX.cjs} +296 -203
  32. package/dist/{chunk-EHLOCVWB.js → chunk-T2URHAJX.js} +27 -5
  33. package/dist/{chunk-BENSE3VX.cjs → chunk-TNLKFW7D.cjs} +23 -23
  34. package/dist/{chunk-KZI3YWKW.js → chunk-UXYCY3HP.js} +93 -6
  35. package/dist/{chunk-4NMPUJUK.cjs → chunk-YJANF2BL.cjs} +86 -86
  36. package/dist/{chunk-FUDP5QBB.js → chunk-ZEI7ZEA4.js} +101 -8
  37. package/dist/effects/index.cjs +5 -2
  38. package/dist/effects/index.js +4 -1
  39. package/dist/effects/pool.d.cts +9 -0
  40. package/dist/effects/pool.d.ts +9 -0
  41. package/dist/effects/types.d.cts +2 -0
  42. package/dist/effects/types.d.ts +2 -0
  43. package/dist/image-editor/index.cjs +791 -791
  44. package/dist/image-editor/index.js +6 -6
  45. package/dist/paint/index.cjs +2 -2
  46. package/dist/paint/index.js +1 -1
  47. package/dist/paint/wet/world.d.cts +37 -1
  48. package/dist/paint/wet/world.d.ts +37 -1
  49. package/dist/paint-editor/brush-controls.d.cts +2 -0
  50. package/dist/paint-editor/brush-controls.d.ts +2 -0
  51. package/dist/paint-editor/brush-model.d.cts +14 -1
  52. package/dist/paint-editor/brush-model.d.ts +14 -1
  53. package/dist/paint-editor/controller.d.cts +75 -4
  54. package/dist/paint-editor/controller.d.ts +75 -4
  55. package/dist/paint-editor/effect-paint.d.cts +33 -8
  56. package/dist/paint-editor/effect-paint.d.ts +33 -8
  57. package/dist/paint-editor/effects.d.cts +4 -0
  58. package/dist/paint-editor/effects.d.ts +4 -0
  59. package/dist/paint-editor/index.cjs +814 -483
  60. package/dist/paint-editor/index.js +408 -77
  61. package/dist/paint-editor/stroke.d.cts +13 -5
  62. package/dist/paint-editor/stroke.d.ts +13 -5
  63. package/dist/paint-editor/ui.d.cts +1 -1
  64. package/dist/paint-editor/ui.d.ts +1 -1
  65. package/dist/paint-editor/wet.d.cts +8 -1
  66. package/dist/paint-editor/wet.d.ts +8 -1
  67. package/dist/vector/index.cjs +999 -999
  68. package/dist/vector/index.js +5 -5
  69. package/dist/video-editor/index.cjs +317 -317
  70. package/dist/video-editor/index.js +2 -2
  71. package/package.json +1 -1
  72. package/skills/pixerate-brushes/SKILL.md +1 -0
  73. package/skills/pixerate-paint-editor/SKILL.md +6 -13
  74. package/skills/pixerate-paint-editor/references/brush-facets.md +1 -0
  75. package/skills/pixerate-paint-editor/references/effect-paint.md +28 -6
  76. package/skills/pixerate-paint-editor/references/ghost.md +47 -0
  77. package/skills/pixerate-paint-watercolour/SKILL.md +1 -0
@@ -25,18 +25,19 @@ export interface PaintEffectPaint {
25
25
  /** Which moment of an animated effect, in ms. */
26
26
  time: number;
27
27
  /**
28
- * How the effect lies on the paint: fixed to the canvas (missing, the default), or along each
29
- * stroke (`by: 'stroke'`): the effect is rendered as a strip `length` px long and 256 px across,
30
- * and each pixel takes the colour at (distance along the stroke, position across the tip).
28
+ * How the effect lies on the paint: fixed to the canvas (missing, the default), bent along each
29
+ * stroke (`by: 'stroke'`: rendered as a strip `length` px long and 256 px across), or along the
30
+ * stroke via the effect's own path control (`by: 'path'`: the stroke's centreline in canvas
31
+ * pixels is passed to its `format: 'svg-path'` control).
31
32
  */
32
- map?: PaintEffectStrokeMap;
33
+ map?: PaintEffectMap;
33
34
  /**
34
35
  * Live: on a stroke layer the stroke keeps playing the effect (each frame drawn at the editor's
35
36
  * effect time); elsewhere it bakes the frame at `time` like any effect paint.
36
37
  */
37
38
  live?: boolean;
38
39
  }
39
- /** Effect paint laid along the stroke. */
40
+ /** Effect paint laid along the stroke as a bent strip. */
40
41
  export interface PaintEffectStrokeMap {
41
42
  by: 'stroke';
42
43
  /** Strip length: px of stroke per repeat of the effect, 16..4096. */
@@ -44,10 +45,34 @@ export interface PaintEffectStrokeMap {
44
45
  /** Past the strip's end: start again, run back (mirror), or hold the last colour (clamp). */
45
46
  repeat: 'repeat' | 'mirror' | 'clamp';
46
47
  }
48
+ /** Effect paint whose own path control (`format: 'svg-path'`) receives each stroke's centreline in canvas pixels. */
49
+ export interface PaintEffectPathMap {
50
+ by: 'path';
51
+ }
52
+ export type PaintEffectMap = PaintEffectStrokeMap | PaintEffectPathMap;
47
53
  /** How tall a stroke-mapped effect strip is rendered (the position across the tip maps onto it). */
48
54
  export declare const EFFECT_STRIP_HEIGHT = 256;
49
55
  export declare const EFFECT_MAP_REPEATS: readonly ["repeat", "mirror", "clamp"];
50
- /** The size an effect paint renders at: the canvas, or its strip. */
56
+ /** Maximum number of centreline points passed to a path effect control; longer strokes are resampled to this count. */
57
+ export declare const MAX_EFFECT_PATH_POINTS = 256;
58
+ /**
59
+ * The stroke's centreline as `[x0, y0, x1, y1, …]` in canvas pixels for a path control
60
+ * (`format: 'svg-path'`). Consecutive duplicate points are collapsed, single-point taps are doubled
61
+ * so path renderers receive a valid segment, and strokes longer than `maxPoints` are evenly
62
+ * resampled by arc length rather than refused.
63
+ */
64
+ export declare function strokePathPoints(points: readonly {
65
+ x: number;
66
+ y: number;
67
+ }[], maxPoints?: number): number[];
68
+ /** Which control of `values` holds a path when the effect description is not at hand. */
69
+ export declare function inferEffectPathControl(values: Record<string, EffectValue>): string;
70
+ /** A copy of a path-mapped effect paint with the stroke's centreline written into its path control. */
71
+ export declare function withStrokePath(paint: PaintEffectPaint, points: readonly {
72
+ x: number;
73
+ y: number;
74
+ }[], control?: string): PaintEffectPaint;
75
+ /** The size an effect paint renders at: the canvas, or its strip when bent along the stroke. */
51
76
  export declare function effectPaintSize(p: PaintEffectPaint, canvas: {
52
77
  width: number;
53
78
  height: number;
@@ -55,8 +80,8 @@ export declare function effectPaintSize(p: PaintEffectPaint, canvas: {
55
80
  width: number;
56
81
  height: number;
57
82
  };
58
- /** A stroke map checked and rounded; throws a sentence naming the bad field. */
59
- export declare function readEffectStrokeMap(raw: unknown): PaintEffectStrokeMap | undefined;
83
+ /** A stroke or path map checked and rounded; throws a sentence naming the bad field. */
84
+ export declare function readEffectStrokeMap(raw: unknown): PaintEffectMap | undefined;
60
85
  /**
61
86
  * Straight-alpha RGBA an effect paint was rendered to: canvas-sized, or (with `map`) the strip
62
87
  * laid along each stroke.
@@ -25,18 +25,19 @@ export interface PaintEffectPaint {
25
25
  /** Which moment of an animated effect, in ms. */
26
26
  time: number;
27
27
  /**
28
- * How the effect lies on the paint: fixed to the canvas (missing, the default), or along each
29
- * stroke (`by: 'stroke'`): the effect is rendered as a strip `length` px long and 256 px across,
30
- * and each pixel takes the colour at (distance along the stroke, position across the tip).
28
+ * How the effect lies on the paint: fixed to the canvas (missing, the default), bent along each
29
+ * stroke (`by: 'stroke'`: rendered as a strip `length` px long and 256 px across), or along the
30
+ * stroke via the effect's own path control (`by: 'path'`: the stroke's centreline in canvas
31
+ * pixels is passed to its `format: 'svg-path'` control).
31
32
  */
32
- map?: PaintEffectStrokeMap;
33
+ map?: PaintEffectMap;
33
34
  /**
34
35
  * Live: on a stroke layer the stroke keeps playing the effect (each frame drawn at the editor's
35
36
  * effect time); elsewhere it bakes the frame at `time` like any effect paint.
36
37
  */
37
38
  live?: boolean;
38
39
  }
39
- /** Effect paint laid along the stroke. */
40
+ /** Effect paint laid along the stroke as a bent strip. */
40
41
  export interface PaintEffectStrokeMap {
41
42
  by: 'stroke';
42
43
  /** Strip length: px of stroke per repeat of the effect, 16..4096. */
@@ -44,10 +45,34 @@ export interface PaintEffectStrokeMap {
44
45
  /** Past the strip's end: start again, run back (mirror), or hold the last colour (clamp). */
45
46
  repeat: 'repeat' | 'mirror' | 'clamp';
46
47
  }
48
+ /** Effect paint whose own path control (`format: 'svg-path'`) receives each stroke's centreline in canvas pixels. */
49
+ export interface PaintEffectPathMap {
50
+ by: 'path';
51
+ }
52
+ export type PaintEffectMap = PaintEffectStrokeMap | PaintEffectPathMap;
47
53
  /** How tall a stroke-mapped effect strip is rendered (the position across the tip maps onto it). */
48
54
  export declare const EFFECT_STRIP_HEIGHT = 256;
49
55
  export declare const EFFECT_MAP_REPEATS: readonly ["repeat", "mirror", "clamp"];
50
- /** The size an effect paint renders at: the canvas, or its strip. */
56
+ /** Maximum number of centreline points passed to a path effect control; longer strokes are resampled to this count. */
57
+ export declare const MAX_EFFECT_PATH_POINTS = 256;
58
+ /**
59
+ * The stroke's centreline as `[x0, y0, x1, y1, …]` in canvas pixels for a path control
60
+ * (`format: 'svg-path'`). Consecutive duplicate points are collapsed, single-point taps are doubled
61
+ * so path renderers receive a valid segment, and strokes longer than `maxPoints` are evenly
62
+ * resampled by arc length rather than refused.
63
+ */
64
+ export declare function strokePathPoints(points: readonly {
65
+ x: number;
66
+ y: number;
67
+ }[], maxPoints?: number): number[];
68
+ /** Which control of `values` holds a path when the effect description is not at hand. */
69
+ export declare function inferEffectPathControl(values: Record<string, EffectValue>): string;
70
+ /** A copy of a path-mapped effect paint with the stroke's centreline written into its path control. */
71
+ export declare function withStrokePath(paint: PaintEffectPaint, points: readonly {
72
+ x: number;
73
+ y: number;
74
+ }[], control?: string): PaintEffectPaint;
75
+ /** The size an effect paint renders at: the canvas, or its strip when bent along the stroke. */
51
76
  export declare function effectPaintSize(p: PaintEffectPaint, canvas: {
52
77
  width: number;
53
78
  height: number;
@@ -55,8 +80,8 @@ export declare function effectPaintSize(p: PaintEffectPaint, canvas: {
55
80
  width: number;
56
81
  height: number;
57
82
  };
58
- /** A stroke map checked and rounded; throws a sentence naming the bad field. */
59
- export declare function readEffectStrokeMap(raw: unknown): PaintEffectStrokeMap | undefined;
83
+ /** A stroke or path map checked and rounded; throws a sentence naming the bad field. */
84
+ export declare function readEffectStrokeMap(raw: unknown): PaintEffectMap | undefined;
60
85
  /**
61
86
  * Straight-alpha RGBA an effect paint was rendered to: canvas-sized, or (with `map`) the strip
62
87
  * laid along each stroke.
@@ -80,6 +80,10 @@ export declare class PaintEffectsRenderer {
80
80
  width: number;
81
81
  height: number;
82
82
  }, request: EffectRenderRequest): Promise<EffectPixels>;
83
+ renderSync(provider: EffectProvider, id: string, size: {
84
+ width: number;
85
+ height: number;
86
+ }, request: EffectRenderRequest): EffectPixels | null;
83
87
  dispose(): void;
84
88
  }
85
89
  /** A saved effect source, or `null` when it is not one. */
@@ -80,6 +80,10 @@ export declare class PaintEffectsRenderer {
80
80
  width: number;
81
81
  height: number;
82
82
  }, request: EffectRenderRequest): Promise<EffectPixels>;
83
+ renderSync(provider: EffectProvider, id: string, size: {
84
+ width: number;
85
+ height: number;
86
+ }, request: EffectRenderRequest): EffectPixels | null;
83
87
  dispose(): void;
84
88
  }
85
89
  /** A saved effect source, or `null` when it is not one. */