@pixerate/editor 0.154.0 → 0.155.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 (58) hide show
  1. package/dist/animation-editor/index.cjs +2 -3
  2. package/dist/animation-editor/index.js +1 -2
  3. package/dist/canvas/index.cjs +15 -16
  4. package/dist/canvas/index.js +2 -3
  5. package/dist/chart/index.cjs +2 -3
  6. package/dist/chart/index.js +1 -2
  7. package/dist/chunk-M4MIZPQI.cjs +393 -0
  8. package/dist/chunk-NHLYK3AX.js +393 -0
  9. package/dist/{chunk-XFDQEAOS.cjs → chunk-RQCMSEM5.cjs} +2 -2
  10. package/dist/{chunk-BCY22GBH.js → chunk-SDHZG5TF.js} +1 -1
  11. package/dist/{chunk-HVX35M2I.cjs → chunk-WI7QJA7A.cjs} +2 -2
  12. package/dist/{chunk-4J4MC3F5.js → chunk-YXOW456B.js} +1 -1
  13. package/dist/diagram/index.cjs +2 -3
  14. package/dist/diagram/index.js +1 -2
  15. package/dist/image-editor/controller.d.cts +8 -0
  16. package/dist/image-editor/controller.d.ts +8 -0
  17. package/dist/image-editor/editorDocument.d.cts +16 -0
  18. package/dist/image-editor/editorDocument.d.ts +16 -0
  19. package/dist/image-editor/index.cjs +102 -52
  20. package/dist/image-editor/index.d.cts +1 -0
  21. package/dist/image-editor/index.d.ts +1 -0
  22. package/dist/image-editor/index.js +51 -1
  23. package/dist/index.cjs +4 -5
  24. package/dist/index.js +2 -3
  25. package/dist/paint-editor/controller.d.cts +8 -0
  26. package/dist/paint-editor/controller.d.ts +8 -0
  27. package/dist/paint-editor/editorDocument.d.cts +17 -0
  28. package/dist/paint-editor/editorDocument.d.ts +17 -0
  29. package/dist/paint-editor/index.cjs +74 -18
  30. package/dist/paint-editor/index.d.cts +1 -0
  31. package/dist/paint-editor/index.d.ts +1 -0
  32. package/dist/paint-editor/index.js +58 -2
  33. package/dist/parameters/index.cjs +2 -3
  34. package/dist/parameters/index.js +1 -2
  35. package/dist/persistence/assets.d.cts +51 -0
  36. package/dist/persistence/assets.d.ts +51 -0
  37. package/dist/persistence/editorDocument.d.cts +12 -0
  38. package/dist/persistence/editorDocument.d.ts +12 -0
  39. package/dist/persistence/index.cjs +32 -8
  40. package/dist/persistence/index.d.cts +1 -0
  41. package/dist/persistence/index.d.ts +1 -0
  42. package/dist/persistence/index.js +34 -10
  43. package/dist/spreadsheet/index.cjs +3 -4
  44. package/dist/spreadsheet/index.js +2 -3
  45. package/dist/tokens/index.cjs +3 -4
  46. package/dist/tokens/index.js +2 -3
  47. package/dist/vector/index.cjs +2 -3
  48. package/dist/vector/index.js +1 -2
  49. package/dist/video-editor/index.cjs +2 -3
  50. package/dist/video-editor/index.js +1 -2
  51. package/package.json +1 -1
  52. package/skills/pixerate-image-editor/SKILL.md +16 -24
  53. package/skills/pixerate-image-editor/references/smart-objects.md +28 -0
  54. package/skills/pixerate-paint-editor/SKILL.md +17 -5
  55. package/dist/chunk-5H2C3QSF.cjs +0 -134
  56. package/dist/chunk-GNV54DLO.js +0 -134
  57. package/dist/chunk-L5OWG2NA.cjs +0 -135
  58. package/dist/chunk-WHKNYFM2.js +0 -135
@@ -224,6 +224,11 @@ require('../chunk-XFM3OCHU.cjs');
224
224
  require('../chunk-NIBFDFYW.cjs');
225
225
  require('../chunk-ALNIFK5G.cjs');
226
226
  require('../chunk-UWEQ55MY.cjs');
227
+
228
+
229
+
230
+ var _chunkM4MIZPQIcjs = require('../chunk-M4MIZPQI.cjs');
231
+ require('../chunk-2BSBFBOA.cjs');
227
232
  require('../chunk-LEUZ4FRC.cjs');
228
233
  require('../chunk-A6QWKBJP.cjs');
229
234
 
@@ -3384,7 +3389,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
3384
3389
  __init103() {this.effects = new (0, _chunkRUZQMYXHcjs.EffectsSlot)()}
3385
3390
  __init104() {this.effectsRenderer = new PaintEffectsRenderer()}
3386
3391
  __init105() {this.paperEffectNodeCache = null}
3387
- constructor(options = {}) {;_class10.prototype.__init72.call(this);_class10.prototype.__init73.call(this);_class10.prototype.__init74.call(this);_class10.prototype.__init75.call(this);_class10.prototype.__init76.call(this);_class10.prototype.__init77.call(this);_class10.prototype.__init78.call(this);_class10.prototype.__init79.call(this);_class10.prototype.__init80.call(this);_class10.prototype.__init81.call(this);_class10.prototype.__init82.call(this);_class10.prototype.__init83.call(this);_class10.prototype.__init84.call(this);_class10.prototype.__init85.call(this);_class10.prototype.__init86.call(this);_class10.prototype.__init87.call(this);_class10.prototype.__init88.call(this);_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);_class10.prototype.__init91.call(this);_class10.prototype.__init92.call(this);_class10.prototype.__init93.call(this);_class10.prototype.__init94.call(this);_class10.prototype.__init95.call(this);_class10.prototype.__init96.call(this);_class10.prototype.__init97.call(this);_class10.prototype.__init98.call(this);_class10.prototype.__init99.call(this);_class10.prototype.__init100.call(this);_class10.prototype.__init101.call(this);_class10.prototype.__init102.call(this);_class10.prototype.__init103.call(this);_class10.prototype.__init104.call(this);_class10.prototype.__init105.call(this);_class10.prototype.__init106.call(this);_class10.prototype.__init107.call(this);_class10.prototype.__init108.call(this);
3392
+ constructor(options = {}) {;_class10.prototype.__init72.call(this);_class10.prototype.__init73.call(this);_class10.prototype.__init74.call(this);_class10.prototype.__init75.call(this);_class10.prototype.__init76.call(this);_class10.prototype.__init77.call(this);_class10.prototype.__init78.call(this);_class10.prototype.__init79.call(this);_class10.prototype.__init80.call(this);_class10.prototype.__init81.call(this);_class10.prototype.__init82.call(this);_class10.prototype.__init83.call(this);_class10.prototype.__init84.call(this);_class10.prototype.__init85.call(this);_class10.prototype.__init86.call(this);_class10.prototype.__init87.call(this);_class10.prototype.__init88.call(this);_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);_class10.prototype.__init91.call(this);_class10.prototype.__init92.call(this);_class10.prototype.__init93.call(this);_class10.prototype.__init94.call(this);_class10.prototype.__init95.call(this);_class10.prototype.__init96.call(this);_class10.prototype.__init97.call(this);_class10.prototype.__init98.call(this);_class10.prototype.__init99.call(this);_class10.prototype.__init100.call(this);_class10.prototype.__init101.call(this);_class10.prototype.__init102.call(this);_class10.prototype.__init103.call(this);_class10.prototype.__init104.call(this);_class10.prototype.__init105.call(this);_class10.prototype.__init106.call(this);_class10.prototype.__init107.call(this);_class10.prototype.__init108.call(this);_class10.prototype.__init109.call(this);
3388
3393
  this.historyLimit = Math.max(1, _nullishCoalesce(options.historyLimit, () => ( 200)));
3389
3394
  this.doc = createPaintDocument({ width: options.width, height: options.height, dpi: options.dpi, paper: this.resolvePaper(options.paper) });
3390
3395
  this.userBrushes = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunkBXMIBMVGcjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
@@ -3481,6 +3486,20 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
3481
3486
  return d;
3482
3487
  }
3483
3488
  // --- History -------------------------------------------------------------------
3489
+ __init106() {this.docRevision = 0}
3490
+ /**
3491
+ * Bumped on every change to the painting (a committed or amended step, undo, redo, opening a
3492
+ * document), not on wet-paint frames or view changes. `createPaintEditorDocument` uses it.
3493
+ */
3494
+ get documentRevision() {
3495
+ return this.docRevision;
3496
+ }
3497
+ /** Why the document cannot be replaced or stepped through right now, or `null`. */
3498
+ busyReason() {
3499
+ if (this.session) return "A stroke is in progress; end or cancel it first.";
3500
+ if (this.wet.busy) return "Wet paint is mid-step; wait a moment (wetIdle()) first.";
3501
+ return null;
3502
+ }
3484
3503
  requireIdle(what) {
3485
3504
  if (this.session) throw new PaintEditorError(`A stroke is in progress; end or cancel it before ${what}.`);
3486
3505
  }
@@ -3494,6 +3513,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
3494
3513
  if (this.undoStack.length > this.historyLimit) this.undoStack.shift();
3495
3514
  this.redoStack = [];
3496
3515
  this.doc = next;
3516
+ this.docRevision++;
3497
3517
  this.trimWetHistory();
3498
3518
  this.emit();
3499
3519
  }
@@ -3510,6 +3530,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
3510
3530
  last.after = next;
3511
3531
  this.redoStack = [];
3512
3532
  this.doc = next;
3533
+ this.docRevision++;
3513
3534
  this.emit();
3514
3535
  }
3515
3536
  /** Keeps the wet snapshots in history within the wet undo memory, dropping the oldest. */
@@ -3548,7 +3569,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
3548
3569
  return wetIds;
3549
3570
  }
3550
3571
  /** Records a wet event (for replays) in the document being built. */
3551
- __init106() {this.pendingWetEvents = []}
3572
+ __init107() {this.pendingWetEvents = []}
3552
3573
  logWet(e) {
3553
3574
  this.pendingWetEvents.push({ clock: _nullishCoalesce(_optionalChain([this, 'access', _171 => _171.wet, 'access', _172 => _172.world, 'optionalAccess', _173 => _173.clock]), () => ( 0)), at: this.doc.strokes.length, ...e });
3554
3575
  }
@@ -3572,6 +3593,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
3572
3593
  this.redoStack.push(e);
3573
3594
  const paper = this.doc.paper;
3574
3595
  this.doc = e.before;
3596
+ this.docRevision++;
3575
3597
  if (e.wet) {
3576
3598
  if (paper !== this.doc.paper) this.wet.paperChanged();
3577
3599
  this.wet.restore(e.wet.lost ? null : e.wet.before);
@@ -3589,6 +3611,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
3589
3611
  this.undoStack.push(e);
3590
3612
  const paper = this.doc.paper;
3591
3613
  this.doc = e.after;
3614
+ this.docRevision++;
3592
3615
  if (e.wet) {
3593
3616
  this.wet.restore(e.wet.lost ? null : e.wet.after);
3594
3617
  if (paper !== this.doc.paper) this.wet.paperChanged();
@@ -5220,6 +5243,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
5220
5243
  this.undoStack = [];
5221
5244
  this.redoStack = [];
5222
5245
  this.doc = this.readThick(loaded.state, loaded.extensions, loaded.problems);
5246
+ this.docRevision++;
5223
5247
  delete this.extensions.layerChannels;
5224
5248
  delete this.extensions.lighting;
5225
5249
  delete this.extensions.stickers;
@@ -5601,8 +5625,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
5601
5625
  this.commitStickers("Stickers", l, stickers.map((s) => ({ ...s })));
5602
5626
  }
5603
5627
  // --- Stencils --------------------------------------------------------------------
5604
- __init107() {this.stencilCache = null}
5605
- __init108() {this.nextStencilId = 1}
5628
+ __init108() {this.stencilCache = null}
5629
+ __init109() {this.nextStencilId = 1}
5606
5630
  /** The mask stencils' coverage over the canvas (cached), or `null` when none masks. */
5607
5631
  stencilSelection(stencils = this.guides.stencils) {
5608
5632
  const { width, height } = this.doc.canvas;
@@ -7810,7 +7834,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
7810
7834
  add({
7811
7835
  name: "save_document",
7812
7836
  title: "Save the document",
7813
- description: "Returns the document as JSON (format pixerate-paint, version 1): canvas, paper, layers with PNG data URLs, and the recorded strokes unless strokes is false. Changes nothing.",
7837
+ description: "Deprecated (kept for one minor version): use get_paint_document, which returns the painting with images as asset references, or save_paint_document to store it. Returns the document as JSON (format pixerate-paint, version 1): canvas, paper, layers with PNG data URLs, and the recorded strokes unless strokes is false. Changes nothing.",
7814
7838
  inputSchema: { type: "object", properties: { strokes: { type: "boolean", description: "Include the recorded strokes (default true)." } }, additionalProperties: false },
7815
7839
  annotations: { title: "Save the document", ...READ6 },
7816
7840
  handler: ({ strokes }) => c.toJSON({ strokes })
@@ -7818,7 +7842,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
7818
7842
  add({
7819
7843
  name: "open_document",
7820
7844
  title: "Open a document",
7821
- description: "Opens a saved paint document (as save_document returns), replacing the painting and clearing the undo history. Returns the canvas, the layers and anything that could not be read.",
7845
+ description: "Deprecated (kept for one minor version): use load_paint_document or open_saved_paint_document. Opens a saved paint document (as save_document returns), replacing the painting and clearing the undo history. Returns the canvas, the layers and anything that could not be read.",
7822
7846
  inputSchema: { type: "object", properties: { document: { type: "object", description: "The saved document JSON." } }, required: ["document"], additionalProperties: false },
7823
7847
  annotations: { title: "Open a document", ...DESTRUCTIVE3 },
7824
7848
  handler: ({ document }) => {
@@ -7851,20 +7875,20 @@ var PAINT_TOOLS = [
7851
7875
  { id: "rotate", label: "Rotate view", key: "r" }
7852
7876
  ];
7853
7877
  var PaintGesture = (_class11 = class {
7854
- constructor(controller, box) {;_class11.prototype.__init109.call(this);_class11.prototype.__init110.call(this);_class11.prototype.__init111.call(this);_class11.prototype.__init112.call(this);_class11.prototype.__init113.call(this);_class11.prototype.__init114.call(this);
7878
+ constructor(controller, box) {;_class11.prototype.__init110.call(this);_class11.prototype.__init111.call(this);_class11.prototype.__init112.call(this);_class11.prototype.__init113.call(this);_class11.prototype.__init114.call(this);_class11.prototype.__init115.call(this);
7855
7879
  this.controller = controller;
7856
7880
  this.box = box;
7857
7881
  }
7858
7882
 
7859
7883
 
7860
- __init109() {this.tool = "brush"}
7884
+ __init110() {this.tool = "brush"}
7861
7885
  /** The last refusal (a hidden or locked layer), for the editor to show. */
7862
- __init110() {this.error = null}
7886
+ __init111() {this.error = null}
7863
7887
  /** The predicted tail of the current stroke in document pixels (draw it as a thin preview). */
7864
- __init111() {this.predicted = []}
7865
- __init112() {this.mode = null}
7866
- __init113() {this.penAt = null}
7867
- __init114() {this.penDown = false}
7888
+ __init112() {this.predicted = []}
7889
+ __init113() {this.mode = null}
7890
+ __init114() {this.penAt = null}
7891
+ __init115() {this.penDown = false}
7868
7892
  doc(e) {
7869
7893
  const b = this.box();
7870
7894
  const s = this.controller.getState();
@@ -8011,13 +8035,13 @@ function handlePaintShortcut(controller, gesture, e) {
8011
8035
  return false;
8012
8036
  }
8013
8037
  var PaintCanvasPresenter = (_class12 = class {
8014
- constructor(controller) {;_class12.prototype.__init115.call(this);_class12.prototype.__init116.call(this);_class12.prototype.__init117.call(this);
8038
+ constructor(controller) {;_class12.prototype.__init116.call(this);_class12.prototype.__init117.call(this);_class12.prototype.__init118.call(this);
8015
8039
  this.controller = controller;
8016
8040
  }
8017
8041
 
8018
- __init115() {this.uploaded = /* @__PURE__ */ new Map()}
8019
- __init116() {this.scratch = null}
8020
- __init117() {this.size = ""}
8042
+ __init116() {this.uploaded = /* @__PURE__ */ new Map()}
8043
+ __init117() {this.scratch = null}
8044
+ __init118() {this.size = ""}
8021
8045
  /** Draws what changed into `ctx` (a canvas the size of the document); returns the tiles drawn. */
8022
8046
  render(ctx) {
8023
8047
  const { width, height } = this.controller.document.canvas;
@@ -8561,6 +8585,38 @@ function createPaintEffectsToolProvider(controller, options = {}) {
8561
8585
  }), { director: false, surface: options.playbackSurface });
8562
8586
  }
8563
8587
 
8588
+ // src/paint-editor/editorDocument.ts
8589
+ function createPaintEditorDocument(controller, options = {}) {
8590
+ return _chunkM4MIZPQIcjs.defineEditorDocument.call(void 0, {
8591
+ kind: "paint",
8592
+ recordsLoads: false,
8593
+ assets: _nullishCoalesce(options.assets, () => ( _chunkM4MIZPQIcjs.createEditorAssetRegistry.call(void 0, ))),
8594
+ get: () => controller.toJSON({ strokes: _nullishCoalesce(options.strokes, () => ( true)) }),
8595
+ load: (document) => {
8596
+ const problems = controller.loadJSON(document);
8597
+ return { problems: problems.map((message) => ({ section: "painting", message })) };
8598
+ },
8599
+ subscribe: (listener) => {
8600
+ let revision = controller.documentRevision;
8601
+ return controller.subscribe(() => {
8602
+ if (controller.documentRevision === revision) return;
8603
+ revision = controller.documentRevision;
8604
+ listener();
8605
+ });
8606
+ },
8607
+ history: {
8608
+ undo: () => controller.undo() !== null,
8609
+ redo: () => controller.redo() !== null,
8610
+ getState: () => {
8611
+ const s = controller.getState();
8612
+ return { canUndo: s.canUndo, canRedo: s.canRedo, ...s.undoLabel ? { undoName: s.undoLabel } : {}, ...s.redoLabel ? { redoName: s.redoLabel } : {} };
8613
+ }
8614
+ },
8615
+ readOnly: () => _nullishCoalesce(controller.busyReason(), () => ( false))
8616
+ });
8617
+ }
8618
+
8619
+
8564
8620
 
8565
8621
 
8566
8622
 
@@ -8864,4 +8920,4 @@ function createPaintEffectsToolProvider(controller, options = {}) {
8864
8920
 
8865
8921
 
8866
8922
 
8867
- exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkCWM3CUUXcjs.BLEND_MODES; exports.BRUSH_ID = _chunkBXMIBMVGcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkBXMIBMVGcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkBXMIBMVGcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunkBXMIBMVGcjs.BristleStroke; exports.DEFAULT_BEHAVIOR = _chunkBXMIBMVGcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkBXMIBMVGcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkBXMIBMVGcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkBXMIBMVGcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkGNK7SESQcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkBXMIBMVGcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkBXMIBMVGcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkLRRCMRSLcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkLRRCMRSLcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkBXMIBMVGcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkBXMIBMVGcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunkBXMIBMVGcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkBXMIBMVGcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkGNK7SESQcjs.DEFAULT_WET_PARAMS; exports.DryStroke = _chunkBXMIBMVGcjs.DryStroke; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkLRRCMRSLcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkLRRCMRSLcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunkUKCJ43YLcjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkBXMIBMVGcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkBXMIBMVGcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkLRRCMRSLcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkBXMIBMVGcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkCWM3CUUXcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkBXMIBMVGcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkBXMIBMVGcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkLRRCMRSLcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkLRRCMRSLcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkLRRCMRSLcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkLRRCMRSLcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkLRRCMRSLcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkLRRCMRSLcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkBXMIBMVGcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkBXMIBMVGcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkBXMIBMVGcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkBXMIBMVGcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkLRRCMRSLcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkLRRCMRSLcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkLRRCMRSLcjs.PaperGrain; exports.ParticleStroke = _chunkBXMIBMVGcjs.ParticleStroke; exports.PenDabWalker = _chunkBXMIBMVGcjs.PenDabWalker; exports.PenSmoother = _chunkBXMIBMVGcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkBXMIBMVGcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerSpray = _chunkBXMIBMVGcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunkLRRCMRSLcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkGNK7SESQcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkBXMIBMVGcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkGNK7SESQcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkBXMIBMVGcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkLRRCMRSLcjs.addPaintGradientStop; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkBXMIBMVGcjs.brushTakesPaint; exports.brushToJSON = _chunkBXMIBMVGcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkBXMIBMVGcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = _chunkBXMIBMVGcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectLayersToJSON = effectLayersToJSON; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkLRRCMRSLcjs.grainCatch; exports.grainHeights = _chunkLRRCMRSLcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunkLRRCMRSLcjs.hash2; exports.hexToPaintRgb = _chunkLRRCMRSLcjs.hexToPaintRgb; exports.hexToRgb8 = _chunkBXMIBMVGcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunkUKCJ43YLcjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkCWM3CUUXcjs.isBlendMode; exports.isGradientPaint = _chunkLRRCMRSLcjs.isGradientPaint; exports.isPainterlyBlendMode = _chunkCWM3CUUXcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkBXMIBMVGcjs.isWetBrush; exports.isWetCapable = _chunkBXMIBMVGcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunkLRRCMRSLcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkBXMIBMVGcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunkBXMIBMVGcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkBXMIBMVGcjs.normalizeBehavior; exports.normalizeBristle = _chunkBXMIBMVGcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkBXMIBMVGcjs.normalizeDynamics; exports.normalizeFlow = _chunkGNK7SESQcjs.normalizeFlow; exports.normalizeHexColor = _chunkLRRCMRSLcjs.normalizeHexColor; exports.normalizeImpasto = _chunkBXMIBMVGcjs.normalizeImpasto; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkBXMIBMVGcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkBXMIBMVGcjs.normalizePaintBrush; exports.normalizePaper = _chunkBXMIBMVGcjs.normalizePaper; exports.normalizeParticle = _chunkBXMIBMVGcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkBXMIBMVGcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunkBXMIBMVGcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkBXMIBMVGcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkGNK7SESQcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunkLRRCMRSLcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintSourceColor = _chunkLRRCMRSLcjs.paintSourceColor; exports.paintSourceCss = _chunkLRRCMRSLcjs.paintSourceCss; exports.paintToMultiColor = _chunkBXMIBMVGcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkBXMIBMVGcjs.paperPreset; exports.parseBrushLibrary = _chunkBXMIBMVGcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkLRRCMRSLcjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkBXMIBMVGcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunkLRRCMRSLcjs.rand01; exports.randSigned = _chunkLRRCMRSLcjs.randSigned; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkLRRCMRSLcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkLRRCMRSLcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkBXMIBMVGcjs.renderPaper; exports.renderStickers = _chunkBXMIBMVGcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkLRRCMRSLcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkLRRCMRSLcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkLRRCMRSLcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunkLRRCMRSLcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkLRRCMRSLcjs.solidPaint; exports.stampCoverage = _chunkBXMIBMVGcjs.stampCoverage; exports.standardBlendMode = _chunkCWM3CUUXcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerRect = _chunkBXMIBMVGcjs.stickerRect; exports.stickerSurface = _chunkBXMIBMVGcjs.stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunkBXMIBMVGcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkBXMIBMVGcjs.toStrokePoint; exports.toggleStamp = toggleStamp; exports.updatePaintGradientStop = _chunkLRRCMRSLcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkBXMIBMVGcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkGNK7SESQcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunkUKCJ43YLcjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;
8923
+ exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkCWM3CUUXcjs.BLEND_MODES; exports.BRUSH_ID = _chunkBXMIBMVGcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkBXMIBMVGcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkBXMIBMVGcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunkBXMIBMVGcjs.BristleStroke; exports.DEFAULT_BEHAVIOR = _chunkBXMIBMVGcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkBXMIBMVGcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkBXMIBMVGcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkBXMIBMVGcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkGNK7SESQcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkBXMIBMVGcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkBXMIBMVGcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkLRRCMRSLcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkLRRCMRSLcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkBXMIBMVGcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkBXMIBMVGcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunkBXMIBMVGcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkBXMIBMVGcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkGNK7SESQcjs.DEFAULT_WET_PARAMS; exports.DryStroke = _chunkBXMIBMVGcjs.DryStroke; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkLRRCMRSLcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkLRRCMRSLcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunkUKCJ43YLcjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkBXMIBMVGcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkBXMIBMVGcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkLRRCMRSLcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkBXMIBMVGcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkCWM3CUUXcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkBXMIBMVGcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkBXMIBMVGcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkLRRCMRSLcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkLRRCMRSLcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkLRRCMRSLcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkLRRCMRSLcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkLRRCMRSLcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkLRRCMRSLcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkLRRCMRSLcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkBXMIBMVGcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkBXMIBMVGcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkBXMIBMVGcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkBXMIBMVGcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkLRRCMRSLcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkLRRCMRSLcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkLRRCMRSLcjs.PaperGrain; exports.ParticleStroke = _chunkBXMIBMVGcjs.ParticleStroke; exports.PenDabWalker = _chunkBXMIBMVGcjs.PenDabWalker; exports.PenSmoother = _chunkBXMIBMVGcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkBXMIBMVGcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerSpray = _chunkBXMIBMVGcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunkLRRCMRSLcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkGNK7SESQcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkBXMIBMVGcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkGNK7SESQcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkBXMIBMVGcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkLRRCMRSLcjs.addPaintGradientStop; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkBXMIBMVGcjs.brushTakesPaint; exports.brushToJSON = _chunkBXMIBMVGcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkBXMIBMVGcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = _chunkBXMIBMVGcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectLayersToJSON = effectLayersToJSON; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkLRRCMRSLcjs.grainCatch; exports.grainHeights = _chunkLRRCMRSLcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunkLRRCMRSLcjs.hash2; exports.hexToPaintRgb = _chunkLRRCMRSLcjs.hexToPaintRgb; exports.hexToRgb8 = _chunkBXMIBMVGcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunkUKCJ43YLcjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkCWM3CUUXcjs.isBlendMode; exports.isGradientPaint = _chunkLRRCMRSLcjs.isGradientPaint; exports.isPainterlyBlendMode = _chunkCWM3CUUXcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkBXMIBMVGcjs.isWetBrush; exports.isWetCapable = _chunkBXMIBMVGcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunkLRRCMRSLcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkBXMIBMVGcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunkBXMIBMVGcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkBXMIBMVGcjs.normalizeBehavior; exports.normalizeBristle = _chunkBXMIBMVGcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkBXMIBMVGcjs.normalizeDynamics; exports.normalizeFlow = _chunkGNK7SESQcjs.normalizeFlow; exports.normalizeHexColor = _chunkLRRCMRSLcjs.normalizeHexColor; exports.normalizeImpasto = _chunkBXMIBMVGcjs.normalizeImpasto; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkBXMIBMVGcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkBXMIBMVGcjs.normalizePaintBrush; exports.normalizePaper = _chunkBXMIBMVGcjs.normalizePaper; exports.normalizeParticle = _chunkBXMIBMVGcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkBXMIBMVGcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunkBXMIBMVGcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkBXMIBMVGcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkGNK7SESQcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunkLRRCMRSLcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintSourceColor = _chunkLRRCMRSLcjs.paintSourceColor; exports.paintSourceCss = _chunkLRRCMRSLcjs.paintSourceCss; exports.paintToMultiColor = _chunkBXMIBMVGcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkBXMIBMVGcjs.paperPreset; exports.parseBrushLibrary = _chunkBXMIBMVGcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkLRRCMRSLcjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkBXMIBMVGcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunkLRRCMRSLcjs.rand01; exports.randSigned = _chunkLRRCMRSLcjs.randSigned; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkLRRCMRSLcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkLRRCMRSLcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkBXMIBMVGcjs.renderPaper; exports.renderStickers = _chunkBXMIBMVGcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkLRRCMRSLcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkLRRCMRSLcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkLRRCMRSLcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunkLRRCMRSLcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkLRRCMRSLcjs.solidPaint; exports.stampCoverage = _chunkBXMIBMVGcjs.stampCoverage; exports.standardBlendMode = _chunkCWM3CUUXcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerRect = _chunkBXMIBMVGcjs.stickerRect; exports.stickerSurface = _chunkBXMIBMVGcjs.stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunkBXMIBMVGcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkBXMIBMVGcjs.toStrokePoint; exports.toggleStamp = toggleStamp; exports.updatePaintGradientStop = _chunkLRRCMRSLcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkBXMIBMVGcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkGNK7SESQcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunkUKCJ43YLcjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;
@@ -46,3 +46,4 @@ export { wetSupport, type WetSupport } from '../paint/wet/wasm.cjs';
46
46
  export type { WetBackendInfo } from '../paint/wet/world.cjs';
47
47
  export * from '../paint/gradient-paint.cjs';
48
48
  export * from './playback.cjs';
49
+ export * from './editorDocument.cjs';
@@ -46,3 +46,4 @@ export { wetSupport, type WetSupport } from '../paint/wet/wasm.js';
46
46
  export type { WetBackendInfo } from '../paint/wet/world.js';
47
47
  export * from '../paint/gradient-paint.js';
48
48
  export * from './playback.js';
49
+ export * from './editorDocument.js';
@@ -224,6 +224,11 @@ import "../chunk-QGHEDC7B.js";
224
224
  import "../chunk-SIFAIGB3.js";
225
225
  import "../chunk-CIQIM2IP.js";
226
226
  import "../chunk-VDGBHYC7.js";
227
+ import {
228
+ createEditorAssetRegistry,
229
+ defineEditorDocument
230
+ } from "../chunk-NHLYK3AX.js";
231
+ import "../chunk-HF5QZS7Z.js";
227
232
  import "../chunk-KY3FYKP3.js";
228
233
  import "../chunk-2WPNAGHI.js";
229
234
  import {
@@ -3481,6 +3486,20 @@ var PaintEditorController = class _PaintEditorController {
3481
3486
  return d;
3482
3487
  }
3483
3488
  // --- History -------------------------------------------------------------------
3489
+ docRevision = 0;
3490
+ /**
3491
+ * Bumped on every change to the painting (a committed or amended step, undo, redo, opening a
3492
+ * document), not on wet-paint frames or view changes. `createPaintEditorDocument` uses it.
3493
+ */
3494
+ get documentRevision() {
3495
+ return this.docRevision;
3496
+ }
3497
+ /** Why the document cannot be replaced or stepped through right now, or `null`. */
3498
+ busyReason() {
3499
+ if (this.session) return "A stroke is in progress; end or cancel it first.";
3500
+ if (this.wet.busy) return "Wet paint is mid-step; wait a moment (wetIdle()) first.";
3501
+ return null;
3502
+ }
3484
3503
  requireIdle(what) {
3485
3504
  if (this.session) throw new PaintEditorError(`A stroke is in progress; end or cancel it before ${what}.`);
3486
3505
  }
@@ -3494,6 +3513,7 @@ var PaintEditorController = class _PaintEditorController {
3494
3513
  if (this.undoStack.length > this.historyLimit) this.undoStack.shift();
3495
3514
  this.redoStack = [];
3496
3515
  this.doc = next;
3516
+ this.docRevision++;
3497
3517
  this.trimWetHistory();
3498
3518
  this.emit();
3499
3519
  }
@@ -3510,6 +3530,7 @@ var PaintEditorController = class _PaintEditorController {
3510
3530
  last.after = next;
3511
3531
  this.redoStack = [];
3512
3532
  this.doc = next;
3533
+ this.docRevision++;
3513
3534
  this.emit();
3514
3535
  }
3515
3536
  /** Keeps the wet snapshots in history within the wet undo memory, dropping the oldest. */
@@ -3572,6 +3593,7 @@ var PaintEditorController = class _PaintEditorController {
3572
3593
  this.redoStack.push(e);
3573
3594
  const paper = this.doc.paper;
3574
3595
  this.doc = e.before;
3596
+ this.docRevision++;
3575
3597
  if (e.wet) {
3576
3598
  if (paper !== this.doc.paper) this.wet.paperChanged();
3577
3599
  this.wet.restore(e.wet.lost ? null : e.wet.before);
@@ -3589,6 +3611,7 @@ var PaintEditorController = class _PaintEditorController {
3589
3611
  this.undoStack.push(e);
3590
3612
  const paper = this.doc.paper;
3591
3613
  this.doc = e.after;
3614
+ this.docRevision++;
3592
3615
  if (e.wet) {
3593
3616
  this.wet.restore(e.wet.lost ? null : e.wet.after);
3594
3617
  if (paper !== this.doc.paper) this.wet.paperChanged();
@@ -5220,6 +5243,7 @@ var PaintEditorController = class _PaintEditorController {
5220
5243
  this.undoStack = [];
5221
5244
  this.redoStack = [];
5222
5245
  this.doc = this.readThick(loaded.state, loaded.extensions, loaded.problems);
5246
+ this.docRevision++;
5223
5247
  delete this.extensions.layerChannels;
5224
5248
  delete this.extensions.lighting;
5225
5249
  delete this.extensions.stickers;
@@ -7810,7 +7834,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
7810
7834
  add({
7811
7835
  name: "save_document",
7812
7836
  title: "Save the document",
7813
- description: "Returns the document as JSON (format pixerate-paint, version 1): canvas, paper, layers with PNG data URLs, and the recorded strokes unless strokes is false. Changes nothing.",
7837
+ description: "Deprecated (kept for one minor version): use get_paint_document, which returns the painting with images as asset references, or save_paint_document to store it. Returns the document as JSON (format pixerate-paint, version 1): canvas, paper, layers with PNG data URLs, and the recorded strokes unless strokes is false. Changes nothing.",
7814
7838
  inputSchema: { type: "object", properties: { strokes: { type: "boolean", description: "Include the recorded strokes (default true)." } }, additionalProperties: false },
7815
7839
  annotations: { title: "Save the document", ...READ6 },
7816
7840
  handler: ({ strokes }) => c.toJSON({ strokes })
@@ -7818,7 +7842,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
7818
7842
  add({
7819
7843
  name: "open_document",
7820
7844
  title: "Open a document",
7821
- description: "Opens a saved paint document (as save_document returns), replacing the painting and clearing the undo history. Returns the canvas, the layers and anything that could not be read.",
7845
+ description: "Deprecated (kept for one minor version): use load_paint_document or open_saved_paint_document. Opens a saved paint document (as save_document returns), replacing the painting and clearing the undo history. Returns the canvas, the layers and anything that could not be read.",
7822
7846
  inputSchema: { type: "object", properties: { document: { type: "object", description: "The saved document JSON." } }, required: ["document"], additionalProperties: false },
7823
7847
  annotations: { title: "Open a document", ...DESTRUCTIVE3 },
7824
7848
  handler: ({ document }) => {
@@ -8560,6 +8584,37 @@ function createPaintEffectsToolProvider(controller, options = {}) {
8560
8584
  ]
8561
8585
  }), { director: false, surface: options.playbackSurface });
8562
8586
  }
8587
+
8588
+ // src/paint-editor/editorDocument.ts
8589
+ function createPaintEditorDocument(controller, options = {}) {
8590
+ return defineEditorDocument({
8591
+ kind: "paint",
8592
+ recordsLoads: false,
8593
+ assets: options.assets ?? createEditorAssetRegistry(),
8594
+ get: () => controller.toJSON({ strokes: options.strokes ?? true }),
8595
+ load: (document) => {
8596
+ const problems = controller.loadJSON(document);
8597
+ return { problems: problems.map((message) => ({ section: "painting", message })) };
8598
+ },
8599
+ subscribe: (listener) => {
8600
+ let revision = controller.documentRevision;
8601
+ return controller.subscribe(() => {
8602
+ if (controller.documentRevision === revision) return;
8603
+ revision = controller.documentRevision;
8604
+ listener();
8605
+ });
8606
+ },
8607
+ history: {
8608
+ undo: () => controller.undo() !== null,
8609
+ redo: () => controller.redo() !== null,
8610
+ getState: () => {
8611
+ const s = controller.getState();
8612
+ return { canUndo: s.canUndo, canRedo: s.canRedo, ...s.undoLabel ? { undoName: s.undoLabel } : {}, ...s.redoLabel ? { redoName: s.redoLabel } : {} };
8613
+ }
8614
+ },
8615
+ readOnly: () => controller.busyReason() ?? false
8616
+ });
8617
+ }
8563
8618
  export {
8564
8619
  BLEND_MENU_GROUPS,
8565
8620
  BLEND_MODES,
@@ -8699,6 +8754,7 @@ export {
8699
8754
  contactSheet,
8700
8755
  createPaintCompositor,
8701
8756
  createPaintDocument,
8757
+ createPaintEditorDocument,
8702
8758
  createPaintEditorToolProvider,
8703
8759
  createPaintEffectsToolProvider,
8704
8760
  createPaintLayer,
@@ -1,7 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
- var _chunk5H2C3QSFcjs = require('../chunk-5H2C3QSF.cjs');
4
- require('../chunk-L5OWG2NA.cjs');
3
+ var _chunkM4MIZPQIcjs = require('../chunk-M4MIZPQI.cjs');
5
4
  require('../chunk-2BSBFBOA.cjs');
6
5
 
7
6
 
@@ -1328,7 +1327,7 @@ function mapRange(value, from, to, options) {
1328
1327
  // src/parameters/editorDocument.ts
1329
1328
  var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
1330
1329
  function createParametersEditorDocument(controller) {
1331
- return _chunk5H2C3QSFcjs.defineEditorDocument.call(void 0, {
1330
+ return _chunkM4MIZPQIcjs.defineEditorDocument.call(void 0, {
1332
1331
  kind: "parameters",
1333
1332
  get: () => controller.toJSON(),
1334
1333
  load: (document, { history }) => {
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  defineEditorDocument
3
- } from "../chunk-GNV54DLO.js";
4
- import "../chunk-WHKNYFM2.js";
3
+ } from "../chunk-NHLYK3AX.js";
5
4
  import "../chunk-HF5QZS7Z.js";
6
5
  import {
7
6
  HistoryManager
@@ -0,0 +1,51 @@
1
+ import type { StorageAdapter } from "./storage.cjs";
2
+ /** Prefix of an asset reference in a document (`pixerate-asset:<length>-<hash>`). */
3
+ export declare const EDITOR_ASSET_PREFIX = "pixerate-asset:";
4
+ /**
5
+ * Inline binary data kept out of an editor document: PNG data URLs and long base64 strings
6
+ * (layer pixels, masks, thick-paint channels, patterns…) are replaced by short, content-addressed
7
+ * references, and the bytes live here. `put` and `get` are synchronous, so an `EditorDocument`
8
+ * can stay synchronous; `persistEditorAssets` / `preloadEditorAssets` move the bytes to and from
9
+ * storage around a save or an open.
10
+ */
11
+ export interface EditorAssetRegistry {
12
+ /** Stores `data` (once per content) and returns its reference. */
13
+ put(data: string): string;
14
+ /** The data for `ref`, or `undefined` when it is not loaded. */
15
+ get(ref: string): string | undefined;
16
+ has(ref: string): boolean;
17
+ /** Puts data read back from storage under its reference. */
18
+ set(ref: string, data: string): void;
19
+ readonly size: number;
20
+ }
21
+ /** Whether a string is inline binary data worth keeping out of the document. */
22
+ export declare function isInlineAsset(value: string): boolean;
23
+ export declare function createEditorAssetRegistry(): EditorAssetRegistry;
24
+ /** A deep copy of `value` with every inline asset string replaced by its reference. */
25
+ export declare function externalizeAssets<T>(value: T, registry: EditorAssetRegistry): T;
26
+ /** Every asset reference in a document (or its JSON text). */
27
+ export declare function collectAssetRefs(value: unknown): string[];
28
+ /**
29
+ * A deep copy of `value` with every asset reference replaced by its data. Throws an error naming the references that are not loaded (and changes nothing).
30
+ */
31
+ export declare function internalizeAssets<T>(value: T, registry: EditorAssetRegistry): T;
32
+ export interface EditorAssetStorageOptions {
33
+ /** Key prefix of stored assets (default `pixerate.assets:`); one shared pool, as assets are content-addressed. */
34
+ prefix?: string;
35
+ }
36
+ /**
37
+ * Writes the assets `document` (or its JSON text) refers to into `storage`, skipping those
38
+ * this storage already has. Call before writing the document, so it never points at missing data.
39
+ */
40
+ export declare function persistEditorAssets(storage: StorageAdapter, registry: EditorAssetRegistry, document: unknown, options?: EditorAssetStorageOptions): Promise<void>;
41
+ /**
42
+ * Reads the assets `document` (or its JSON text) refers to from `storage` into the registry.
43
+ * Returns the references that could not be found.
44
+ */
45
+ export declare function preloadEditorAssets(storage: StorageAdapter, registry: EditorAssetRegistry, document: unknown, options?: EditorAssetStorageOptions): Promise<string[]>;
46
+ /**
47
+ * `storage` with assets handled: every `set` first writes the assets the value refers to, and
48
+ * every `get` reads them into the registry before returning. Wrap the storage an autosave or a
49
+ * document store uses for an editor whose document has `assets`.
50
+ */
51
+ export declare function withEditorAssets(storage: StorageAdapter, registry: EditorAssetRegistry, options?: EditorAssetStorageOptions): StorageAdapter;
@@ -0,0 +1,51 @@
1
+ import type { StorageAdapter } from "./storage.js";
2
+ /** Prefix of an asset reference in a document (`pixerate-asset:<length>-<hash>`). */
3
+ export declare const EDITOR_ASSET_PREFIX = "pixerate-asset:";
4
+ /**
5
+ * Inline binary data kept out of an editor document: PNG data URLs and long base64 strings
6
+ * (layer pixels, masks, thick-paint channels, patterns…) are replaced by short, content-addressed
7
+ * references, and the bytes live here. `put` and `get` are synchronous, so an `EditorDocument`
8
+ * can stay synchronous; `persistEditorAssets` / `preloadEditorAssets` move the bytes to and from
9
+ * storage around a save or an open.
10
+ */
11
+ export interface EditorAssetRegistry {
12
+ /** Stores `data` (once per content) and returns its reference. */
13
+ put(data: string): string;
14
+ /** The data for `ref`, or `undefined` when it is not loaded. */
15
+ get(ref: string): string | undefined;
16
+ has(ref: string): boolean;
17
+ /** Puts data read back from storage under its reference. */
18
+ set(ref: string, data: string): void;
19
+ readonly size: number;
20
+ }
21
+ /** Whether a string is inline binary data worth keeping out of the document. */
22
+ export declare function isInlineAsset(value: string): boolean;
23
+ export declare function createEditorAssetRegistry(): EditorAssetRegistry;
24
+ /** A deep copy of `value` with every inline asset string replaced by its reference. */
25
+ export declare function externalizeAssets<T>(value: T, registry: EditorAssetRegistry): T;
26
+ /** Every asset reference in a document (or its JSON text). */
27
+ export declare function collectAssetRefs(value: unknown): string[];
28
+ /**
29
+ * A deep copy of `value` with every asset reference replaced by its data. Throws an error naming the references that are not loaded (and changes nothing).
30
+ */
31
+ export declare function internalizeAssets<T>(value: T, registry: EditorAssetRegistry): T;
32
+ export interface EditorAssetStorageOptions {
33
+ /** Key prefix of stored assets (default `pixerate.assets:`); one shared pool, as assets are content-addressed. */
34
+ prefix?: string;
35
+ }
36
+ /**
37
+ * Writes the assets `document` (or its JSON text) refers to into `storage`, skipping those
38
+ * this storage already has. Call before writing the document, so it never points at missing data.
39
+ */
40
+ export declare function persistEditorAssets(storage: StorageAdapter, registry: EditorAssetRegistry, document: unknown, options?: EditorAssetStorageOptions): Promise<void>;
41
+ /**
42
+ * Reads the assets `document` (or its JSON text) refers to from `storage` into the registry.
43
+ * Returns the references that could not be found.
44
+ */
45
+ export declare function preloadEditorAssets(storage: StorageAdapter, registry: EditorAssetRegistry, document: unknown, options?: EditorAssetStorageOptions): Promise<string[]>;
46
+ /**
47
+ * `storage` with assets handled: every `set` first writes the assets the value refers to, and
48
+ * every `get` reads them into the registry before returning. Wrap the storage an autosave or a
49
+ * document store uses for an editor whose document has `assets`.
50
+ */
51
+ export declare function withEditorAssets(storage: StorageAdapter, registry: EditorAssetRegistry, options?: EditorAssetStorageOptions): StorageAdapter;
@@ -1,3 +1,4 @@
1
+ import { type EditorAssetRegistry } from "./assets.cjs";
1
2
  import { type LoadReport, type SectionProblem } from "./migrate.cjs";
2
3
  /**
3
4
  * Undo / redo of an editor. Satisfies `HistoryCommandTarget`, so
@@ -53,6 +54,12 @@ export interface EditorDocument<T = unknown> {
53
54
  readOnly(): string | false;
54
55
  /** Stops listening to the editor; `subscribe` or `revision` reconnects (React StrictMode remounts). */
55
56
  destroy(): void;
57
+ /**
58
+ * Where the document's binary data lives (image and paint editors): `getDocument()` holds
59
+ * references instead of pixels. Autosave and the document store save and read the assets
60
+ * with the document (see `withEditorAssets`).
61
+ */
62
+ readonly assets?: EditorAssetRegistry;
56
63
  }
57
64
  /** Thrown by `loadDocument` / `parseEditorDocument` when the input does not fit; nothing changed. */
58
65
  export declare class EditorDocumentLoadError extends Error {
@@ -112,6 +119,11 @@ export interface EditorDocumentSpec<T> {
112
119
  readOnly?: () => string | false;
113
120
  /** `migrations[v]` turns a version `v` document into version `v + 1`. */
114
121
  migrations?: Record<number, (document: unknown) => unknown>;
122
+ /**
123
+ * Keeps inline binary data (PNG data URLs, long base64) out of the document: `get` results
124
+ * are externalized into it, and `load` receives the data back in place of the references.
125
+ */
126
+ assets?: EditorAssetRegistry;
115
127
  }
116
128
  /**
117
129
  * Builds an `EditorDocument` from an editor's own methods: counts revisions,
@@ -1,3 +1,4 @@
1
+ import { type EditorAssetRegistry } from "./assets.js";
1
2
  import { type LoadReport, type SectionProblem } from "./migrate.js";
2
3
  /**
3
4
  * Undo / redo of an editor. Satisfies `HistoryCommandTarget`, so
@@ -53,6 +54,12 @@ export interface EditorDocument<T = unknown> {
53
54
  readOnly(): string | false;
54
55
  /** Stops listening to the editor; `subscribe` or `revision` reconnects (React StrictMode remounts). */
55
56
  destroy(): void;
57
+ /**
58
+ * Where the document's binary data lives (image and paint editors): `getDocument()` holds
59
+ * references instead of pixels. Autosave and the document store save and read the assets
60
+ * with the document (see `withEditorAssets`).
61
+ */
62
+ readonly assets?: EditorAssetRegistry;
56
63
  }
57
64
  /** Thrown by `loadDocument` / `parseEditorDocument` when the input does not fit; nothing changed. */
58
65
  export declare class EditorDocumentLoadError extends Error {
@@ -112,6 +119,11 @@ export interface EditorDocumentSpec<T> {
112
119
  readOnly?: () => string | false;
113
120
  /** `migrations[v]` turns a version `v` document into version `v + 1`. */
114
121
  migrations?: Record<number, (document: unknown) => unknown>;
122
+ /**
123
+ * Keeps inline binary data (PNG data URLs, long base64) out of the document: `get` results
124
+ * are externalized into it, and `load` receives the data back in place of the references.
125
+ */
126
+ assets?: EditorAssetRegistry;
115
127
  }
116
128
  /**
117
129
  * Builds an `EditorDocument` from an editor's own methods: counts revisions,