@pixerate/editor 0.154.0 → 0.156.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 (86) hide show
  1. package/dist/animation-editor/index.cjs +60 -61
  2. package/dist/animation-editor/index.js +5 -6
  3. package/dist/{brushstrokeRender-YAZVQUXY.cjs → brushstrokeRender-5WANQIG4.cjs} +10 -10
  4. package/dist/{brushstrokeRender-EUDQTDYS.js → brushstrokeRender-Q4LI22QV.js} +3 -3
  5. package/dist/canvas/index.cjs +23 -24
  6. package/dist/canvas/index.js +3 -4
  7. package/dist/chart/index.cjs +2 -3
  8. package/dist/chart/index.js +1 -2
  9. package/dist/{chunk-AGZ47XY2.js → chunk-2N2QPO3H.js} +6 -2
  10. package/dist/{chunk-NMXPOKF3.js → chunk-45XXVHVG.js} +1 -1
  11. package/dist/{chunk-FLOGD3QB.js → chunk-6UPGM3JB.js} +2 -2
  12. package/dist/{chunk-6FUAHCVI.cjs → chunk-7NW46N7I.cjs} +16 -16
  13. package/dist/{chunk-ORDXMBD4.js → chunk-A5UCR2TO.js} +10 -3
  14. package/dist/{chunk-PI45JMP7.cjs → chunk-CD7PLU77.cjs} +81 -81
  15. package/dist/{chunk-LRRCMRSL.cjs → chunk-EBDCRTZI.cjs} +20 -16
  16. package/dist/{chunk-OLCYQLFE.js → chunk-EL5PAHNP.js} +1 -1
  17. package/dist/{chunk-PUC43JPT.cjs → chunk-EYVVIZJ3.cjs} +1 -1
  18. package/dist/{chunk-BXMIBMVG.cjs → chunk-JGKCC5OF.cjs} +65 -58
  19. package/dist/chunk-M4MIZPQI.cjs +393 -0
  20. package/dist/{chunk-LIXLD433.cjs → chunk-MHEXLG3M.cjs} +35 -35
  21. package/dist/chunk-NHLYK3AX.js +393 -0
  22. package/dist/{chunk-RHXW4TA5.cjs → chunk-QMI5HZWA.cjs} +7 -7
  23. package/dist/{chunk-XFDQEAOS.cjs → chunk-RQCMSEM5.cjs} +2 -2
  24. package/dist/{chunk-BCY22GBH.js → chunk-SDHZG5TF.js} +1 -1
  25. package/dist/{chunk-HVX35M2I.cjs → chunk-WI7QJA7A.cjs} +2 -2
  26. package/dist/{chunk-UILRJQFD.js → chunk-WNAAWLZ5.js} +1 -1
  27. package/dist/{chunk-4J4MC3F5.js → chunk-YXOW456B.js} +1 -1
  28. package/dist/{chunk-Y64YPIFT.js → chunk-ZQWLWDZI.js} +1 -1
  29. package/dist/diagram/index.cjs +2 -3
  30. package/dist/diagram/index.js +1 -2
  31. package/dist/image-editor/controller.d.cts +8 -0
  32. package/dist/image-editor/controller.d.ts +8 -0
  33. package/dist/image-editor/editorDocument.d.cts +16 -0
  34. package/dist/image-editor/editorDocument.d.ts +16 -0
  35. package/dist/image-editor/index.cjs +787 -737
  36. package/dist/image-editor/index.d.cts +1 -0
  37. package/dist/image-editor/index.d.ts +1 -0
  38. package/dist/image-editor/index.js +56 -6
  39. package/dist/index.cjs +4 -5
  40. package/dist/index.js +2 -3
  41. package/dist/paint/grain.d.cts +7 -0
  42. package/dist/paint/grain.d.ts +7 -0
  43. package/dist/paint/index.cjs +3 -3
  44. package/dist/paint/index.js +2 -2
  45. package/dist/paint-editor/controller.d.cts +38 -0
  46. package/dist/paint-editor/controller.d.ts +38 -0
  47. package/dist/paint-editor/document.d.cts +8 -0
  48. package/dist/paint-editor/document.d.ts +8 -0
  49. package/dist/paint-editor/editorDocument.d.cts +17 -0
  50. package/dist/paint-editor/editorDocument.d.ts +17 -0
  51. package/dist/paint-editor/index.cjs +476 -273
  52. package/dist/paint-editor/index.d.cts +1 -0
  53. package/dist/paint-editor/index.d.ts +1 -0
  54. package/dist/paint-editor/index.js +216 -13
  55. package/dist/paint-editor/paper.d.cts +8 -0
  56. package/dist/paint-editor/paper.d.ts +8 -0
  57. package/dist/paint-editor/stencils.d.cts +2 -0
  58. package/dist/paint-editor/stencils.d.ts +2 -0
  59. package/dist/paint-editor/wet.d.cts +1 -0
  60. package/dist/paint-editor/wet.d.ts +1 -0
  61. package/dist/parameters/index.cjs +2 -3
  62. package/dist/parameters/index.js +1 -2
  63. package/dist/persistence/assets.d.cts +51 -0
  64. package/dist/persistence/assets.d.ts +51 -0
  65. package/dist/persistence/editorDocument.d.cts +12 -0
  66. package/dist/persistence/editorDocument.d.ts +12 -0
  67. package/dist/persistence/index.cjs +32 -8
  68. package/dist/persistence/index.d.cts +1 -0
  69. package/dist/persistence/index.d.ts +1 -0
  70. package/dist/persistence/index.js +34 -10
  71. package/dist/spreadsheet/index.cjs +3 -4
  72. package/dist/spreadsheet/index.js +2 -3
  73. package/dist/tokens/index.cjs +3 -4
  74. package/dist/tokens/index.js +2 -3
  75. package/dist/vector/index.cjs +952 -953
  76. package/dist/vector/index.js +5 -6
  77. package/dist/video-editor/index.cjs +2 -3
  78. package/dist/video-editor/index.js +1 -2
  79. package/package.json +1 -1
  80. package/skills/pixerate-image-editor/SKILL.md +16 -24
  81. package/skills/pixerate-image-editor/references/smart-objects.md +28 -0
  82. package/skills/pixerate-paint-editor/SKILL.md +26 -6
  83. package/dist/chunk-5H2C3QSF.cjs +0 -134
  84. package/dist/chunk-GNV54DLO.js +0 -134
  85. package/dist/chunk-L5OWG2NA.cjs +0 -135
  86. package/dist/chunk-WHKNYFM2.js +0 -135
@@ -191,6 +191,23 @@ export interface FillLayerOptions {
191
191
  pressure?: number;
192
192
  blend?: BlendMode;
193
193
  }
194
+ /** Pixels to add on each side of the canvas (whole numbers, 0 or more; missing = 0). */
195
+ export interface PaintCanvasExtension {
196
+ left?: number;
197
+ top?: number;
198
+ right?: number;
199
+ bottom?: number;
200
+ }
201
+ export interface PaintCanvasExtended {
202
+ canvas: PaintCanvas;
203
+ /** The new canvas in the previous document's pixels: x −left, y −top and the new size. */
204
+ rect: RasterRect;
205
+ /** The document's origin after the change (see `PaintDocumentState.origin`). */
206
+ origin: {
207
+ x: number;
208
+ y: number;
209
+ };
210
+ }
194
211
  export interface ReplayOptions extends StrokeVariation {
195
212
  /** Recorded stroke ids (see `getStrokes`). */
196
213
  strokeIds: readonly string[];
@@ -288,6 +305,14 @@ export declare class PaintEditorController {
288
305
  * The viewport passes it to `compositeTiles` as `dirty`.
289
306
  */
290
307
  takeDirty(): RasterRect[] | 'all';
308
+ private docRevision;
309
+ /**
310
+ * Bumped on every change to the painting (a committed or amended step, undo, redo, opening a
311
+ * document), not on wet-paint frames or view changes. `createPaintEditorDocument` uses it.
312
+ */
313
+ get documentRevision(): number;
314
+ /** Why the document cannot be replaced or stepped through right now, or `null`. */
315
+ busyReason(): string | null;
291
316
  private requireIdle;
292
317
  private commit;
293
318
  /**
@@ -315,6 +340,7 @@ export declare class PaintEditorController {
315
340
  private withWetEvents;
316
341
  undo(): string | null;
317
342
  redo(): string | null;
343
+ private restoreGuides;
318
344
  /** Labels of the undo steps, oldest first. */
319
345
  historyLabels(): {
320
346
  undo: string[];
@@ -327,6 +353,18 @@ export declare class PaintEditorController {
327
353
  }): PaintDocumentState;
328
354
  /** Changes the canvas size (keeping the pixels where they are, anchored top-left) or resolution. */
329
355
  setCanvas(update: Partial<PaintCanvas>): PaintCanvas;
356
+ /**
357
+ * Grows the canvas by `left`, `top`, `right` and `bottom` pixels without moving anything
358
+ * relative to anything else: the layers (with their masks, relief and stickers), the paper grain,
359
+ * the effect paper, guides, stencils, the tracing image and the recorded strokes and events all
360
+ * move by (left, top) in document pixels, `document.origin` moves by (−left, −top), and the view
361
+ * pans so the picture stays still on screen.
362
+ *
363
+ * Wet paint dries first (the wet simulation is canvas-sized), as with `setCanvas`; one undo step
364
+ * (undo brings back the old size, origin and guides, and the wet paint). Returns the new canvas,
365
+ * where it sits in the previous document's pixels, and the origin.
366
+ */
367
+ extendCanvas(by: PaintCanvasExtension): PaintCanvasExtended;
330
368
  /** Changes the paper: a library preset (`preset`), and / or any of its settings (one undo step). */
331
369
  setPaper(update: Partial<PaperSettings> & {
332
370
  preset?: string;
@@ -49,6 +49,14 @@ export interface PaintDocumentState {
49
49
  effectLayers?: Readonly<Record<string, PaintEffectSource>>;
50
50
  /** Effect paper: a provider generator drawn over the paper, under the paint. */
51
51
  paperEffect?: PaintPaperEffect;
52
+ /**
53
+ * Where this document's (0, 0) is in the coordinates of the canvas it grew from (missing = 0, 0).
54
+ * `extendCanvas({ left: 100 })` moves it to x −100; a host maps its own coordinates with it.
55
+ */
56
+ origin?: {
57
+ x: number;
58
+ y: number;
59
+ };
52
60
  }
53
61
  /** A change a replay repeats besides strokes, recorded with how many strokes came before it. */
54
62
  export interface PaintEvent {
@@ -49,6 +49,14 @@ export interface PaintDocumentState {
49
49
  effectLayers?: Readonly<Record<string, PaintEffectSource>>;
50
50
  /** Effect paper: a provider generator drawn over the paper, under the paint. */
51
51
  paperEffect?: PaintPaperEffect;
52
+ /**
53
+ * Where this document's (0, 0) is in the coordinates of the canvas it grew from (missing = 0, 0).
54
+ * `extendCanvas({ left: 100 })` moves it to x −100; a host maps its own coordinates with it.
55
+ */
56
+ origin?: {
57
+ x: number;
58
+ y: number;
59
+ };
52
60
  }
53
61
  /** A change a replay repeats besides strokes, recorded with how many strokes came before it. */
54
62
  export interface PaintEvent {
@@ -0,0 +1,17 @@
1
+ import { type EditorAssetRegistry } from '../persistence/assets.cjs';
2
+ import { type EditorDocument } from '../persistence/editorDocument.cjs';
3
+ import type { PaintEditorController } from './controller.cjs';
4
+ import type { SerializedPaintDocument } from './serialize.cjs';
5
+ export interface PaintEditorDocumentOptions {
6
+ /** Where layer, thick-paint, mixing-pad and guide images are kept (default: a registry of its own). */
7
+ assets?: EditorAssetRegistry;
8
+ /** Include the recorded strokes (default `true`), so the painting can be replayed and repainted at a higher resolution. */
9
+ strokes?: boolean;
10
+ }
11
+ /**
12
+ * The save / load / undo contract for a `PaintEditorController` (kind `paint`, document: the
13
+ * saved painting from `toJSON()` with every image as an asset reference kept in `assets`). Wet
14
+ * paint is saved dry. Opening a document clears the history (`recordsLoads: false`), and the
15
+ * document is read-only while a stroke or a wet-paint step is in progress.
16
+ */
17
+ export declare function createPaintEditorDocument(controller: PaintEditorController, options?: PaintEditorDocumentOptions): EditorDocument<SerializedPaintDocument>;
@@ -0,0 +1,17 @@
1
+ import { type EditorAssetRegistry } from '../persistence/assets.js';
2
+ import { type EditorDocument } from '../persistence/editorDocument.js';
3
+ import type { PaintEditorController } from './controller.js';
4
+ import type { SerializedPaintDocument } from './serialize.js';
5
+ export interface PaintEditorDocumentOptions {
6
+ /** Where layer, thick-paint, mixing-pad and guide images are kept (default: a registry of its own). */
7
+ assets?: EditorAssetRegistry;
8
+ /** Include the recorded strokes (default `true`), so the painting can be replayed and repainted at a higher resolution. */
9
+ strokes?: boolean;
10
+ }
11
+ /**
12
+ * The save / load / undo contract for a `PaintEditorController` (kind `paint`, document: the
13
+ * saved painting from `toJSON()` with every image as an asset reference kept in `assets`). Wet
14
+ * paint is saved dry. Opening a document clears the history (`recordsLoads: false`), and the
15
+ * document is read-only while a stroke or a wet-paint step is in progress.
16
+ */
17
+ export declare function createPaintEditorDocument(controller: PaintEditorController, options?: PaintEditorDocumentOptions): EditorDocument<SerializedPaintDocument>;