@pixerate/editor 0.254.1 → 0.255.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 (71) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.js +1 -1
  3. package/dist/animation-editor/index.cjs +59 -59
  4. package/dist/animation-editor/index.js +3 -3
  5. package/dist/brushes/index.cjs +31 -29
  6. package/dist/brushes/index.d.cts +1 -1
  7. package/dist/brushes/index.d.ts +1 -1
  8. package/dist/brushes/index.js +27 -25
  9. package/dist/brushes/library.d.cts +17 -0
  10. package/dist/brushes/library.d.ts +17 -0
  11. package/dist/{brushstrokeRender-5PYSKZIJ.js → brushstrokeRender-HCOQUSWW.js} +53 -18
  12. package/dist/{brushstrokeRender-7FLLSQEC.cjs → brushstrokeRender-ZZOXI5O5.cjs} +55 -20
  13. package/dist/canvas/brushTypes.d.cts +22 -3
  14. package/dist/canvas/brushTypes.d.ts +22 -3
  15. package/dist/canvas/brushstroke.d.cts +34 -12
  16. package/dist/canvas/brushstroke.d.ts +34 -12
  17. package/dist/canvas/brushstrokeRender.d.cts +14 -8
  18. package/dist/canvas/brushstrokeRender.d.ts +14 -8
  19. package/dist/canvas/drawController.d.cts +11 -3
  20. package/dist/canvas/drawController.d.ts +11 -3
  21. package/dist/canvas/freehand.d.cts +6 -1
  22. package/dist/canvas/freehand.d.ts +6 -1
  23. package/dist/canvas/index.cjs +114 -102
  24. package/dist/canvas/index.js +16 -4
  25. package/dist/{chunk-XVIK73LS.js → chunk-5P4JEOIV.js} +4 -4
  26. package/dist/{chunk-JPEHXIB5.cjs → chunk-5YWWQ36H.cjs} +66 -21
  27. package/dist/{chunk-CHAWTXBE.cjs → chunk-6WCQ35GI.cjs} +4 -4
  28. package/dist/{chunk-GYMMNCFT.js → chunk-AF23QK5F.js} +56 -11
  29. package/dist/{chunk-JFHBXNR2.cjs → chunk-B7V34GIH.cjs} +86 -86
  30. package/dist/{chunk-QC3OXRE4.js → chunk-DMTEQ6SH.js} +1 -1
  31. package/dist/{chunk-TLOGFIIV.cjs → chunk-GCTUOTCW.cjs} +35 -35
  32. package/dist/{chunk-34KLWUH4.cjs → chunk-HIMGBZAM.cjs} +1133 -597
  33. package/dist/{chunk-7P6VF3FG.js → chunk-HYWRU5VX.js} +1 -1
  34. package/dist/{chunk-QPHNVZHO.js → chunk-JVRLGV3C.js} +1118 -582
  35. package/dist/{chunk-LFMKWGFL.cjs → chunk-LRNUZKWV.cjs} +22 -8
  36. package/dist/chunk-PGPFWC35.cjs +517 -0
  37. package/dist/{chunk-QLSGTCYT.cjs → chunk-TBAVCLEQ.cjs} +23 -23
  38. package/dist/{chunk-2ZJ4DT3M.js → chunk-VUKUTT2W.js} +1 -1
  39. package/dist/{chunk-5JNA6LLY.js → chunk-WYGSR3IJ.js} +22 -8
  40. package/dist/chunk-YHUMGBZD.js +517 -0
  41. package/dist/commands/builtins.d.cts +1 -1
  42. package/dist/commands/builtins.d.ts +1 -1
  43. package/dist/commands/index.cjs +2 -2
  44. package/dist/commands/index.js +1 -1
  45. package/dist/image-editor/brush-presets.d.cts +32 -0
  46. package/dist/image-editor/brush-presets.d.ts +32 -0
  47. package/dist/image-editor/controller.d.cts +15 -0
  48. package/dist/image-editor/controller.d.ts +15 -0
  49. package/dist/image-editor/index.cjs +848 -775
  50. package/dist/image-editor/index.d.cts +1 -0
  51. package/dist/image-editor/index.d.ts +1 -0
  52. package/dist/image-editor/index.js +81 -8
  53. package/dist/image-editor/types.d.cts +7 -0
  54. package/dist/image-editor/types.d.ts +7 -0
  55. package/dist/paint-editor/index.cjs +80 -80
  56. package/dist/paint-editor/index.js +13 -13
  57. package/dist/vector/brushstroke.d.cts +21 -5
  58. package/dist/vector/brushstroke.d.ts +21 -5
  59. package/dist/vector/controller.d.cts +14 -1
  60. package/dist/vector/controller.d.ts +14 -1
  61. package/dist/vector/index.cjs +1220 -1199
  62. package/dist/vector/index.js +34 -13
  63. package/dist/vector/types.d.cts +7 -0
  64. package/dist/vector/types.d.ts +7 -0
  65. package/package.json +1 -1
  66. package/skills/pixerate-brushes/SKILL.md +9 -3
  67. package/skills/pixerate-canvas/SKILL.md +10 -5
  68. package/skills/pixerate-image-editor/SKILL.md +2 -1
  69. package/skills/pixerate-vector/SKILL.md +1 -1
  70. package/dist/chunk-HS6QDWDF.cjs +0 -1029
  71. package/dist/chunk-MTKY6K3Q.js +0 -1029
@@ -6,22 +6,14 @@ import {
6
6
  } from "../chunk-WZOGDKCQ.js";
7
7
  import {
8
8
  BRUSH_PATCH_PROPERTIES,
9
- BRUSH_PRESETS,
10
9
  BRUSH_SLIDERS,
11
10
  BRUSH_UNSET_PROPERTY,
12
- BrushLibraryError,
13
- PAINT_PROFILE,
14
11
  brushEngineControls,
15
- closest,
16
- createBrushLibrary,
17
12
  createBrushLibraryToolProvider,
18
13
  mergeBrushPatch,
19
- migrateBrushV1,
20
14
  multiColorSliders,
21
- normalizeBrushSpec,
22
- patchBrushValue,
23
- resolveBrush
24
- } from "../chunk-QPHNVZHO.js";
15
+ patchBrushValue
16
+ } from "../chunk-YHUMGBZD.js";
25
17
  import {
26
18
  toVideoFfmpeg
27
19
  } from "../chunk-MWUZCEFT.js";
@@ -32,7 +24,7 @@ import {
32
24
  resolveExternalAssets,
33
25
  serializeLayers,
34
26
  serializeLayersExternal
35
- } from "../chunk-QC3OXRE4.js";
27
+ } from "../chunk-DMTEQ6SH.js";
36
28
  import "../chunk-3CI7FRMK.js";
37
29
  import "../chunk-ZNA3IQZF.js";
38
30
  import {
@@ -88,11 +80,13 @@ import {
88
80
  realPresenceClock,
89
81
  tweenPresenceCursor
90
82
  } from "../chunk-IVSWRVB4.js";
91
- import "../chunk-GYMMNCFT.js";
83
+ import "../chunk-AF23QK5F.js";
92
84
  import {
93
85
  BRUSH_ID,
86
+ BRUSH_PRESETS,
94
87
  BRUSH_ROTATIONS,
95
88
  BUILTIN_BRUSHES,
89
+ BrushLibraryError,
96
90
  DEFAULT_BEHAVIOR,
97
91
  DEFAULT_BRISTLE,
98
92
  DEFAULT_BRUSH_ID,
@@ -111,6 +105,7 @@ import {
111
105
  MULTI_COLOR_MODES,
112
106
  PAINT_BRUSH_CATEGORIES,
113
107
  PAINT_BRUSH_ENGINES,
108
+ PAINT_PROFILE,
114
109
  PARTICLE_KINDS,
115
110
  PARTICLE_RENDERS,
116
111
  RIBBON_PAIRS,
@@ -118,11 +113,15 @@ import {
118
113
  WET_TOOLS,
119
114
  brushTakesPaint,
120
115
  brushToJSON,
116
+ closest,
117
+ createBrushLibrary,
121
118
  isWetBrush,
122
119
  isWetCapable,
120
+ migrateBrushV1,
123
121
  multiColorToPaint,
124
122
  normalizeBehavior,
125
123
  normalizeBristle,
124
+ normalizeBrushSpec,
126
125
  normalizeDynamics,
127
126
  normalizeImpasto,
128
127
  normalizeLight,
@@ -133,8 +132,9 @@ import {
133
132
  normalizeWetBrush,
134
133
  paintToMultiColor,
135
134
  parseBrushLibrary,
135
+ resolveBrush,
136
136
  usesPaintExchange
137
- } from "../chunk-MTKY6K3Q.js";
137
+ } from "../chunk-JVRLGV3C.js";
138
138
  import {
139
139
  STAMP_KINDS,
140
140
  StickersSlot,
@@ -1,13 +1,29 @@
1
1
  import { type PaintBrush } from '../paint-editor/brushes.cjs';
2
+ import type { Brush } from '../brushes/types.cjs';
2
3
  import type { VectorBrushstroke, VectorBrushstrokePaper, VectorPathNode, VectorStrokeLayer } from './types.cjs';
3
4
  /** Image pixels per document unit brushstrokes are rendered at. */
4
5
  export declare const VECTOR_BRUSHSTROKE_SCALE = 2;
5
- /** The brushes a brushstroke can use: the library's dry dab-engine brushes. */
6
- export declare function vectorBrushstrokeBrushes(): PaintBrush[];
7
- /** A brush from the library by id, or null. */
6
+ /**
7
+ * The brushes a brushstroke can use, as the engine paints them: the presets `VECTOR_PROFILE`
8
+ * admits (dry dab-engine brushes), then the saved brushes given (facet brushes, e.g. a brush
9
+ * library's) it admits.
10
+ */
11
+ export declare function vectorBrushstrokeBrushes(user?: readonly Brush[]): PaintBrush[];
12
+ /** A preset by id, or null. */
8
13
  export declare function vectorBrushstrokeBrush(id: string): PaintBrush | null;
9
- /** Reads brushstroke settings from untrusted data; null when the brush is unknown. */
10
- export declare function sanitizeVectorBrushstroke(value: unknown): VectorBrushstroke | null;
14
+ /** The engine brush a brushstroke paints with: its embedded saved brush, else the preset; null when neither renders. */
15
+ export declare function vectorBrushstrokeBrushOf(brush: Pick<VectorBrushstroke, 'brushId' | 'spec'>): PaintBrush | null;
16
+ /**
17
+ * Why a brush id can't paint a brushstroke (with the ids that can), or null when it can.
18
+ * `user` are the saved brushes on offer.
19
+ */
20
+ export declare function vectorBrushstrokeBrushError(id: string, user?: readonly Brush[]): string | null;
21
+ /**
22
+ * Reads brushstroke settings from untrusted data; null when the brush is unknown. A saved brush is
23
+ * taken from `value.spec` (a stored layer) or from `user` (the brush library's saved brushes) and
24
+ * kept in `spec`.
25
+ */
26
+ export declare function sanitizeVectorBrushstroke(value: unknown, user?: readonly Brush[]): VectorBrushstroke | null;
11
27
  /** The largest brushstroke seed. */
12
28
  export declare const VECTOR_BRUSHSTROKE_MAX_SEED = 2147483647;
13
29
  /** Reads paper settings from untrusted data; null when there are none (the default paper). */
@@ -1,13 +1,29 @@
1
1
  import { type PaintBrush } from '../paint-editor/brushes.js';
2
+ import type { Brush } from '../brushes/types.js';
2
3
  import type { VectorBrushstroke, VectorBrushstrokePaper, VectorPathNode, VectorStrokeLayer } from './types.js';
3
4
  /** Image pixels per document unit brushstrokes are rendered at. */
4
5
  export declare const VECTOR_BRUSHSTROKE_SCALE = 2;
5
- /** The brushes a brushstroke can use: the library's dry dab-engine brushes. */
6
- export declare function vectorBrushstrokeBrushes(): PaintBrush[];
7
- /** A brush from the library by id, or null. */
6
+ /**
7
+ * The brushes a brushstroke can use, as the engine paints them: the presets `VECTOR_PROFILE`
8
+ * admits (dry dab-engine brushes), then the saved brushes given (facet brushes, e.g. a brush
9
+ * library's) it admits.
10
+ */
11
+ export declare function vectorBrushstrokeBrushes(user?: readonly Brush[]): PaintBrush[];
12
+ /** A preset by id, or null. */
8
13
  export declare function vectorBrushstrokeBrush(id: string): PaintBrush | null;
9
- /** Reads brushstroke settings from untrusted data; null when the brush is unknown. */
10
- export declare function sanitizeVectorBrushstroke(value: unknown): VectorBrushstroke | null;
14
+ /** The engine brush a brushstroke paints with: its embedded saved brush, else the preset; null when neither renders. */
15
+ export declare function vectorBrushstrokeBrushOf(brush: Pick<VectorBrushstroke, 'brushId' | 'spec'>): PaintBrush | null;
16
+ /**
17
+ * Why a brush id can't paint a brushstroke (with the ids that can), or null when it can.
18
+ * `user` are the saved brushes on offer.
19
+ */
20
+ export declare function vectorBrushstrokeBrushError(id: string, user?: readonly Brush[]): string | null;
21
+ /**
22
+ * Reads brushstroke settings from untrusted data; null when the brush is unknown. A saved brush is
23
+ * taken from `value.spec` (a stored layer) or from `user` (the brush library's saved brushes) and
24
+ * kept in `spec`.
25
+ */
26
+ export declare function sanitizeVectorBrushstroke(value: unknown, user?: readonly Brush[]): VectorBrushstroke | null;
11
27
  /** The largest brushstroke seed. */
12
28
  export declare const VECTOR_BRUSHSTROKE_MAX_SEED = 2147483647;
13
29
  /** Reads paper settings from untrusted data; null when there are none (the default paper). */
@@ -1,3 +1,5 @@
1
+ import { type BrushLibrary } from '../brushes/library.cjs';
2
+ import type { PaintBrush } from '../paint-editor/brushes.cjs';
1
3
  import { type VectorStylizeOptions, type VectorStylizeStyle } from './stylize.cjs';
2
4
  import { type VectorDistortBrushMode } from './distortBrush.cjs';
3
5
  import { HistoryManager } from '../history/HistoryManager.cjs';
@@ -97,6 +99,11 @@ export declare const DEFAULT_VECTOR_PATH_EDIT: Readonly<VectorPathEditOptions>;
97
99
  export declare const VECTOR_PENCIL_STRING_PX = 100;
98
100
  export interface VectorEditorOptions {
99
101
  document?: VectorDocument;
102
+ /**
103
+ * The brush library whose saved brushes brushstrokes may use besides the presets (the vector
104
+ * profile decides which). Share one with the paint editor so a brush saved there paints here.
105
+ */
106
+ brushLibrary?: Pick<BrushLibrary, 'list' | 'subscribe'>;
100
107
  /** History to record into, e.g. one shared with the rest of the app (default: a new one). */
101
108
  history?: HistoryManager;
102
109
  /** Starting tool (default `select`). */
@@ -790,6 +797,12 @@ export declare class VectorEditorController {
790
797
  * Stops listening to the history and drops all listeners. A later `subscribe` reconnects, so a
791
798
  * controller torn down by React StrictMode's double effect keeps working when it is reused.
792
799
  */
800
+ /** The saved brushes of the brush library as last read (empty without one). */
801
+ private brushes;
802
+ /** The brushes a brushstroke can use: the presets, then the brush library's saved brushes the vector profile admits. */
803
+ listBrushstrokeBrushes(): PaintBrush[];
804
+ /** Resolves once the brush library has been read (its saved brushes can be used from then on). */
805
+ whenBrushesLoaded(): Promise<void>;
793
806
  destroy(): void;
794
807
  /** The current snapshot (stable until the next change). */
795
808
  getState: () => VectorEditorState;
@@ -1102,7 +1115,7 @@ export declare class VectorEditorController {
1102
1115
  }): VectorActionResult;
1103
1116
  /**
1104
1117
  * Adds a brushstroke to the selected (or given) paths: a stroke layer that paints the path with
1105
- * brush `brushId` from the paint editor's library (`vectorBrushstrokeBrushes`), `size` document
1118
+ * brush `brushId` (a preset, or a saved brush of the brush library: `listBrushstrokeBrushes`), `size` document
1106
1119
  * units across (default the brush's own), an optional `pressure` profile along the length, in
1107
1120
  * `color` (default the top stroke's paint, else black) at `opacity`. At the top of the stroke
1108
1121
  * stack or at `index`. A `seed` gives it the brush's character (jitter and the grain of `paper`,
@@ -1,3 +1,5 @@
1
+ import { type BrushLibrary } from '../brushes/library.js';
2
+ import type { PaintBrush } from '../paint-editor/brushes.js';
1
3
  import { type VectorStylizeOptions, type VectorStylizeStyle } from './stylize.js';
2
4
  import { type VectorDistortBrushMode } from './distortBrush.js';
3
5
  import { HistoryManager } from '../history/HistoryManager.js';
@@ -97,6 +99,11 @@ export declare const DEFAULT_VECTOR_PATH_EDIT: Readonly<VectorPathEditOptions>;
97
99
  export declare const VECTOR_PENCIL_STRING_PX = 100;
98
100
  export interface VectorEditorOptions {
99
101
  document?: VectorDocument;
102
+ /**
103
+ * The brush library whose saved brushes brushstrokes may use besides the presets (the vector
104
+ * profile decides which). Share one with the paint editor so a brush saved there paints here.
105
+ */
106
+ brushLibrary?: Pick<BrushLibrary, 'list' | 'subscribe'>;
100
107
  /** History to record into, e.g. one shared with the rest of the app (default: a new one). */
101
108
  history?: HistoryManager;
102
109
  /** Starting tool (default `select`). */
@@ -790,6 +797,12 @@ export declare class VectorEditorController {
790
797
  * Stops listening to the history and drops all listeners. A later `subscribe` reconnects, so a
791
798
  * controller torn down by React StrictMode's double effect keeps working when it is reused.
792
799
  */
800
+ /** The saved brushes of the brush library as last read (empty without one). */
801
+ private brushes;
802
+ /** The brushes a brushstroke can use: the presets, then the brush library's saved brushes the vector profile admits. */
803
+ listBrushstrokeBrushes(): PaintBrush[];
804
+ /** Resolves once the brush library has been read (its saved brushes can be used from then on). */
805
+ whenBrushesLoaded(): Promise<void>;
793
806
  destroy(): void;
794
807
  /** The current snapshot (stable until the next change). */
795
808
  getState: () => VectorEditorState;
@@ -1102,7 +1115,7 @@ export declare class VectorEditorController {
1102
1115
  }): VectorActionResult;
1103
1116
  /**
1104
1117
  * Adds a brushstroke to the selected (or given) paths: a stroke layer that paints the path with
1105
- * brush `brushId` from the paint editor's library (`vectorBrushstrokeBrushes`), `size` document
1118
+ * brush `brushId` (a preset, or a saved brush of the brush library: `listBrushstrokeBrushes`), `size` document
1106
1119
  * units across (default the brush's own), an optional `pressure` profile along the length, in
1107
1120
  * `color` (default the top stroke's paint, else black) at `opacity`. At the top of the stroke
1108
1121
  * stack or at `index`. A `seed` gives it the brush's character (jitter and the grain of `paper`,