@pixerate/editor 0.254.1 → 0.256.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 (81) 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/collaboration-tools.d.cts +19 -0
  56. package/dist/paint-editor/collaboration-tools.d.ts +19 -0
  57. package/dist/paint-editor/collaboration.d.cts +180 -0
  58. package/dist/paint-editor/collaboration.d.ts +180 -0
  59. package/dist/paint-editor/controller.d.cts +54 -0
  60. package/dist/paint-editor/controller.d.ts +54 -0
  61. package/dist/paint-editor/index.cjs +816 -283
  62. package/dist/paint-editor/index.d.cts +2 -0
  63. package/dist/paint-editor/index.d.ts +2 -0
  64. package/dist/paint-editor/index.js +567 -34
  65. package/dist/vector/brushstroke.d.cts +21 -5
  66. package/dist/vector/brushstroke.d.ts +21 -5
  67. package/dist/vector/controller.d.cts +14 -1
  68. package/dist/vector/controller.d.ts +14 -1
  69. package/dist/vector/index.cjs +1220 -1199
  70. package/dist/vector/index.js +34 -13
  71. package/dist/vector/types.d.cts +7 -0
  72. package/dist/vector/types.d.ts +7 -0
  73. package/package.json +1 -1
  74. package/skills/pixerate-brushes/SKILL.md +9 -3
  75. package/skills/pixerate-canvas/SKILL.md +10 -5
  76. package/skills/pixerate-image-editor/SKILL.md +2 -1
  77. package/skills/pixerate-paint-editor/SKILL.md +31 -46
  78. package/skills/pixerate-paint-editor/references/painting-alongside.md +19 -0
  79. package/skills/pixerate-vector/SKILL.md +1 -1
  80. package/dist/chunk-HS6QDWDF.cjs +0 -1029
  81. package/dist/chunk-MTKY6K3Q.js +0 -1029
@@ -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`,