@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
@@ -194,6 +194,29 @@ export interface PaintLayerInfo {
194
194
  /** How many live layer effects (glows, shadows, strokes…) it has, when any (`getLayerEffects`). */
195
195
  effects?: number;
196
196
  }
197
+ /** One change to the paint history, for hosts and change feeds (`onCommit`). */
198
+ export interface PaintCommitEvent {
199
+ /** `execute`: a new undo step. `merge`: folded into the last one (a slider drag). */
200
+ kind: 'execute' | 'merge' | 'undo' | 'redo';
201
+ /** The step's name. */
202
+ label: string;
203
+ /** Who made the step: `user`, or `agent:<id>` (see `withOrigin`). */
204
+ origin: string;
205
+ }
206
+ /** Paint a preview produced (`previewPaint`), in document coordinates, straight RGBA. */
207
+ export interface PaintPreview {
208
+ /** Where the new paint sits, or `null` when nothing was painted. */
209
+ bounds: RasterRect | null;
210
+ /** The new paint alone: `bounds.width × bounds.height` pixels (empty when nothing was painted). */
211
+ pixels: Uint8ClampedArray;
212
+ /** The whole picture as it would look with the new paint, inside `bounds` (with the paper; empty when nothing was painted). */
213
+ composite: Uint8ClampedArray;
214
+ }
215
+ /** Where `previewPaint` puts its layer: above a layer (default the active one), or at the bottom of the stack. */
216
+ export interface PaintPreviewPlacement {
217
+ aboveId?: string;
218
+ bottom?: boolean;
219
+ }
197
220
  export interface PaintStrokeInit {
198
221
  /** Default the active layer. */
199
222
  layerId?: string;
@@ -337,6 +360,13 @@ export declare class PaintEditorController {
337
360
  private stickerPreview;
338
361
  private readonly encodeImage;
339
362
  private listeners;
363
+ private commitListeners;
364
+ /** Origins set by `withOrigin`, innermost last. */
365
+ private origins;
366
+ /** `group` in progress: commits fold into one step, recorded when it ends. */
367
+ private grouping;
368
+ /** `previewPaint` in progress: nothing is emitted or recorded. */
369
+ private previewing;
340
370
  private version;
341
371
  private cached;
342
372
  private session;
@@ -393,6 +423,30 @@ export declare class PaintEditorController {
393
423
  private paperEffectNodeCache;
394
424
  constructor(options?: PaintEditorOptions);
395
425
  subscribe(listener: () => void): () => void;
426
+ /** Hears each undo step recorded, merged, undone or redone, with who made it. Returns an unsubscribe function. */
427
+ onCommit(listener: (event: PaintCommitEvent) => void): () => void;
428
+ private notifyCommit;
429
+ /** The origin steps are recorded with now: the innermost `withOrigin`, else `user`. */
430
+ getOrigin(): string;
431
+ /**
432
+ * Records the steps `fn` makes as made by `origin` (`agent:<id>` for an agent). When `fn` returns
433
+ * a promise, the origin holds until it settles. Satisfies `createOriginMiddleware`'s history target,
434
+ * so agent tool calls are recorded as the calling agent's.
435
+ */
436
+ withOrigin<T>(origin: string, fn: () => T): T;
437
+ /**
438
+ * Runs `fn` as one undo step named `label`: every change it makes (strokes, fills, new layers) is
439
+ * undone together. Wet paint can't be grouped. Nested groups join the outer one. If `fn` throws,
440
+ * its changes are put back and nothing is recorded.
441
+ */
442
+ group<T>(label: string, fn: () => T): T;
443
+ /**
444
+ * What `fn` would paint, without changing anything: it runs on a new empty layer (above the
445
+ * active layer, another one, or at the bottom), and the layer's pixels and the picture with them
446
+ * come back while the document, history and listeners stay as they were. `fn` gets that layer's id and must paint on it with dry brushes (strokes, replays and
447
+ * fills); wet paint can't be previewed. For ghost paint an agent suggests (`createPaintProposals`).
448
+ */
449
+ previewPaint(fn: (layerId: string) => void, placement?: PaintPreviewPlacement): PaintPreview;
396
450
  private emit;
397
451
  /** A snapshot of the editor (the same object until something changes). */
398
452
  getState(): PaintEditorState;
@@ -194,6 +194,29 @@ export interface PaintLayerInfo {
194
194
  /** How many live layer effects (glows, shadows, strokes…) it has, when any (`getLayerEffects`). */
195
195
  effects?: number;
196
196
  }
197
+ /** One change to the paint history, for hosts and change feeds (`onCommit`). */
198
+ export interface PaintCommitEvent {
199
+ /** `execute`: a new undo step. `merge`: folded into the last one (a slider drag). */
200
+ kind: 'execute' | 'merge' | 'undo' | 'redo';
201
+ /** The step's name. */
202
+ label: string;
203
+ /** Who made the step: `user`, or `agent:<id>` (see `withOrigin`). */
204
+ origin: string;
205
+ }
206
+ /** Paint a preview produced (`previewPaint`), in document coordinates, straight RGBA. */
207
+ export interface PaintPreview {
208
+ /** Where the new paint sits, or `null` when nothing was painted. */
209
+ bounds: RasterRect | null;
210
+ /** The new paint alone: `bounds.width × bounds.height` pixels (empty when nothing was painted). */
211
+ pixels: Uint8ClampedArray;
212
+ /** The whole picture as it would look with the new paint, inside `bounds` (with the paper; empty when nothing was painted). */
213
+ composite: Uint8ClampedArray;
214
+ }
215
+ /** Where `previewPaint` puts its layer: above a layer (default the active one), or at the bottom of the stack. */
216
+ export interface PaintPreviewPlacement {
217
+ aboveId?: string;
218
+ bottom?: boolean;
219
+ }
197
220
  export interface PaintStrokeInit {
198
221
  /** Default the active layer. */
199
222
  layerId?: string;
@@ -337,6 +360,13 @@ export declare class PaintEditorController {
337
360
  private stickerPreview;
338
361
  private readonly encodeImage;
339
362
  private listeners;
363
+ private commitListeners;
364
+ /** Origins set by `withOrigin`, innermost last. */
365
+ private origins;
366
+ /** `group` in progress: commits fold into one step, recorded when it ends. */
367
+ private grouping;
368
+ /** `previewPaint` in progress: nothing is emitted or recorded. */
369
+ private previewing;
340
370
  private version;
341
371
  private cached;
342
372
  private session;
@@ -393,6 +423,30 @@ export declare class PaintEditorController {
393
423
  private paperEffectNodeCache;
394
424
  constructor(options?: PaintEditorOptions);
395
425
  subscribe(listener: () => void): () => void;
426
+ /** Hears each undo step recorded, merged, undone or redone, with who made it. Returns an unsubscribe function. */
427
+ onCommit(listener: (event: PaintCommitEvent) => void): () => void;
428
+ private notifyCommit;
429
+ /** The origin steps are recorded with now: the innermost `withOrigin`, else `user`. */
430
+ getOrigin(): string;
431
+ /**
432
+ * Records the steps `fn` makes as made by `origin` (`agent:<id>` for an agent). When `fn` returns
433
+ * a promise, the origin holds until it settles. Satisfies `createOriginMiddleware`'s history target,
434
+ * so agent tool calls are recorded as the calling agent's.
435
+ */
436
+ withOrigin<T>(origin: string, fn: () => T): T;
437
+ /**
438
+ * Runs `fn` as one undo step named `label`: every change it makes (strokes, fills, new layers) is
439
+ * undone together. Wet paint can't be grouped. Nested groups join the outer one. If `fn` throws,
440
+ * its changes are put back and nothing is recorded.
441
+ */
442
+ group<T>(label: string, fn: () => T): T;
443
+ /**
444
+ * What `fn` would paint, without changing anything: it runs on a new empty layer (above the
445
+ * active layer, another one, or at the bottom), and the layer's pixels and the picture with them
446
+ * come back while the document, history and listeners stay as they were. `fn` gets that layer's id and must paint on it with dry brushes (strokes, replays and
447
+ * fills); wet paint can't be previewed. For ghost paint an agent suggests (`createPaintProposals`).
448
+ */
449
+ previewPaint(fn: (layerId: string) => void, placement?: PaintPreviewPlacement): PaintPreview;
396
450
  private emit;
397
451
  /** A snapshot of the editor (the same object until something changes). */
398
452
  getState(): PaintEditorState;