@pixerate/editor 0.269.2 → 0.271.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 (74) hide show
  1. package/README.md +5 -2
  2. package/dist/agent/index.cjs +30 -30
  3. package/dist/agent/index.js +3 -3
  4. package/dist/animation-editor/index.cjs +62 -62
  5. package/dist/animation-editor/index.js +4 -4
  6. package/dist/canvas/editorDocument.d.cts +3 -1
  7. package/dist/canvas/editorDocument.d.ts +3 -1
  8. package/dist/canvas/index.cjs +53 -27
  9. package/dist/canvas/index.js +34 -8
  10. package/dist/chart/index.cjs +21 -21
  11. package/dist/chart/index.js +2 -2
  12. package/dist/{chunk-GBEF2D4P.js → chunk-23YL2EAB.js} +1 -1
  13. package/dist/{chunk-QGVTOCNB.js → chunk-6ZSFRRJI.js} +1 -1
  14. package/dist/{chunk-4YSPQGZW.js → chunk-B5W677L7.js} +1 -1
  15. package/dist/{chunk-4NMPUJUK.cjs → chunk-DDL3ZBHK.cjs} +86 -86
  16. package/dist/{chunk-T4JPGBW3.cjs → chunk-DGITFN73.cjs} +8 -8
  17. package/dist/{chunk-PY4GWSE2.cjs → chunk-EBFPMSJO.cjs} +27 -5
  18. package/dist/{chunk-NS62CQ2B.js → chunk-GAZPHCTV.js} +23 -2
  19. package/dist/{chunk-YYBW6DF2.cjs → chunk-GSLOH2IN.cjs} +2 -2
  20. package/dist/{chunk-56RHCIJV.cjs → chunk-JJ2H25JG.cjs} +237 -170
  21. package/dist/{chunk-CBVNCWJM.cjs → chunk-LBDC5434.cjs} +2 -2
  22. package/dist/{chunk-BENSE3VX.cjs → chunk-M2ZVPU7L.cjs} +23 -23
  23. package/dist/{chunk-MQ6MGIQM.js → chunk-NMZQMPFZ.js} +1 -1
  24. package/dist/{chunk-AI4F33IV.cjs → chunk-NQUKTRKN.cjs} +45 -45
  25. package/dist/{chunk-4CPOKP27.js → chunk-QYXUE37Q.js} +1 -1
  26. package/dist/{chunk-MWUZCEFT.js → chunk-S2XPXA47.js} +1 -1
  27. package/dist/{chunk-EHLOCVWB.js → chunk-T2URHAJX.js} +27 -5
  28. package/dist/{chunk-FUDP5QBB.js → chunk-TNHDCP4R.js} +70 -3
  29. package/dist/{chunk-VBRHE4AM.cjs → chunk-U2ASNGO6.cjs} +35 -35
  30. package/dist/{chunk-WKPXOGZZ.cjs → chunk-WPLGZBNE.cjs} +23 -2
  31. package/dist/{chunk-N3UMQVKX.js → chunk-X4FTNFIA.js} +1 -1
  32. package/dist/{chunk-2OQGPEHH.cjs → chunk-XUDMRMXQ.cjs} +2 -2
  33. package/dist/{chunk-THBJHPUL.js → chunk-YNFSH72F.js} +1 -1
  34. package/dist/diagram/index.cjs +2 -2
  35. package/dist/diagram/index.js +1 -1
  36. package/dist/effects/index.cjs +8 -5
  37. package/dist/effects/index.js +6 -3
  38. package/dist/effects/pool.d.cts +9 -0
  39. package/dist/effects/pool.d.ts +9 -0
  40. package/dist/effects/types.d.cts +2 -0
  41. package/dist/effects/types.d.ts +2 -0
  42. package/dist/extensions/index.cjs +5 -5
  43. package/dist/extensions/index.js +4 -4
  44. package/dist/gradient/index.cjs +2 -2
  45. package/dist/gradient/index.js +1 -1
  46. package/dist/history/HistoryManager.d.cts +9 -0
  47. package/dist/history/HistoryManager.d.ts +9 -0
  48. package/dist/history/index.cjs +2 -2
  49. package/dist/history/index.js +1 -1
  50. package/dist/history/types.d.cts +5 -2
  51. package/dist/history/types.d.ts +5 -2
  52. package/dist/image-editor/index.cjs +784 -784
  53. package/dist/image-editor/index.js +4 -4
  54. package/dist/index.cjs +10 -10
  55. package/dist/index.js +4 -4
  56. package/dist/paint-editor/controller.d.cts +75 -4
  57. package/dist/paint-editor/controller.d.ts +75 -4
  58. package/dist/paint-editor/effect-paint.d.cts +33 -8
  59. package/dist/paint-editor/effect-paint.d.ts +33 -8
  60. package/dist/paint-editor/effects.d.cts +4 -0
  61. package/dist/paint-editor/effects.d.ts +4 -0
  62. package/dist/paint-editor/index.cjs +692 -398
  63. package/dist/paint-editor/index.js +362 -68
  64. package/dist/paint-editor/stroke.d.cts +13 -5
  65. package/dist/paint-editor/stroke.d.ts +13 -5
  66. package/dist/parameters/index.cjs +2 -2
  67. package/dist/parameters/index.js +1 -1
  68. package/dist/vector/index.cjs +998 -998
  69. package/dist/vector/index.js +4 -4
  70. package/dist/video-editor/index.cjs +321 -321
  71. package/dist/video-editor/index.js +4 -4
  72. package/package.json +1 -1
  73. package/skills/pixerate-paint-editor/SKILL.md +2 -2
  74. package/skills/pixerate-paint-editor/references/effect-paint.md +28 -6
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkYYBW6DF2cjs = require('./chunk-YYBW6DF2.cjs');
8
+ var _chunkGSLOH2INcjs = require('./chunk-GSLOH2IN.cjs');
9
9
 
10
10
 
11
11
  var _chunkMDLEGVENcjs = require('./chunk-MDLEGVEN.cjs');
@@ -1457,7 +1457,7 @@ var ChartNodeView = (_class = class {
1457
1457
  this.dom.contentEditable = "false";
1458
1458
  this.syncAttributes();
1459
1459
  this.key = specKey(this.node.attrs.spec);
1460
- this.controller = new (0, _chunkYYBW6DF2cjs.ChartController)({ spec: this.node.attrs.spec });
1460
+ this.controller = new (0, _chunkGSLOH2INcjs.ChartController)({ spec: this.node.attrs.spec });
1461
1461
  this.unsubscribe = this.controller.subscribe((state) => {
1462
1462
  if (!state.gesture) this.writeBack();
1463
1463
  });
@@ -1717,9 +1717,9 @@ function staticChartSvg(node, options) {
1717
1717
  const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
1718
1718
  const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
1719
1719
  const scene = _chunkMDLEGVENcjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
1720
- return _chunkYYBW6DF2cjs.chartSceneToDomSpec.call(void 0, scene, {
1720
+ return _chunkGSLOH2INcjs.chartSceneToDomSpec.call(void 0, scene, {
1721
1721
  ariaLabel: spec.title || "Chart",
1722
- description: _chunkYYBW6DF2cjs.describeChart.call(void 0, spec),
1722
+ description: _chunkGSLOH2INcjs.describeChart.call(void 0, spec),
1723
1723
  attrs: { style: "max-width: 100%; height: auto; display: block" }
1724
1724
  });
1725
1725
  }
@@ -1787,7 +1787,7 @@ var Chart = _core.Node.create({
1787
1787
  const code = element.querySelector("code");
1788
1788
  const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _47 => _47.getAttribute, 'call', _48 => _48("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
1789
1789
  if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
1790
- const result = _chunkYYBW6DF2cjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
1790
+ const result = _chunkGSLOH2INcjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
1791
1791
  return result.family ? { spec: result.spec } : false;
1792
1792
  }
1793
1793
  }
@@ -1811,7 +1811,7 @@ var Chart = _core.Node.create({
1811
1811
  return {
1812
1812
  markdown: {
1813
1813
  serialize(state, node) {
1814
- const text = _chunkYYBW6DF2cjs.chartToMermaid.call(void 0, node.attrs.spec);
1814
+ const text = _chunkGSLOH2INcjs.chartToMermaid.call(void 0, node.attrs.spec);
1815
1815
  const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
1816
1816
  state.write(`${fence}mermaid
1817
1817
  `);
@@ -1951,14 +1951,14 @@ var Sparkline = _core.Node.create({
1951
1951
  return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
1952
1952
  },
1953
1953
  renderHTML({ node, HTMLAttributes }) {
1954
- const scene = _chunkYYBW6DF2cjs.layoutSparkline.call(void 0, node.attrs.values, {
1954
+ const scene = _chunkGSLOH2INcjs.layoutSparkline.call(void 0, node.attrs.values, {
1955
1955
  kind: node.attrs.kind,
1956
1956
  width: node.attrs.width,
1957
1957
  height: node.attrs.height,
1958
1958
  color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
1959
1959
  negativeColor: this.options.negativeColor
1960
1960
  });
1961
- const svg = _chunkYYBW6DF2cjs.chartSceneToDomSpec.call(void 0, scene, {
1961
+ const svg = _chunkGSLOH2INcjs.chartSceneToDomSpec.call(void 0, scene, {
1962
1962
  ariaLabel: sparklineLabel(node),
1963
1963
  attrs: { style: "display: inline-block; vertical-align: middle" }
1964
1964
  });
@@ -9,6 +9,19 @@ var EffectRendererPool = (_class = class {
9
9
  get size() {
10
10
  return this.entries.size;
11
11
  }
12
+ /**
13
+ * Renders `request` on the caller's stack when this size's renderer is warm, idle and has
14
+ * `renderSync`; otherwise `null`, and nothing is rendered (an asynchronous provider never pays for it).
15
+ */
16
+ renderSync(provider, id, size, request) {
17
+ const depth = _nullishCoalesce(size.depth, () => ( 8));
18
+ const key = `${provider.id}:${id}@${size.width}x${size.height}x${depth}`;
19
+ const entry = this.entries.get(key);
20
+ if (!_optionalChain([entry, 'optionalAccess', _ => _.resolved, 'optionalAccess', _2 => _2.renderSync]) || entry.busy > 0) return null;
21
+ this.entries.delete(key);
22
+ this.entries.set(key, entry);
23
+ return entry.resolved.renderSync(request);
24
+ }
12
25
  /** Renders `request` with the provider's renderer for this effect, size and depth (made on first use). */
13
26
  render(provider, id, size, request) {
14
27
  const depth = _nullishCoalesce(size.depth, () => ( 8));
@@ -19,15 +32,24 @@ var EffectRendererPool = (_class = class {
19
32
  this.entries.set(key, entry);
20
33
  } else {
21
34
  const renderer = Promise.resolve().then(() => provider.createRenderer(id, { width: size.width, height: size.height, depth }));
22
- renderer.catch(() => {
23
- if (_optionalChain([this, 'access', _ => _.entries, 'access', _2 => _2.get, 'call', _3 => _3(key), 'optionalAccess', _4 => _4.renderer]) === renderer) this.entries.delete(key);
24
- });
25
- entry = { renderer, queue: Promise.resolve() };
35
+ const created = { renderer, busy: 0, queue: Promise.resolve() };
36
+ renderer.then(
37
+ (r) => {
38
+ created.resolved = r;
39
+ },
40
+ () => {
41
+ if (_optionalChain([this, 'access', _3 => _3.entries, 'access', _4 => _4.get, 'call', _5 => _5(key), 'optionalAccess', _6 => _6.renderer]) === renderer) this.entries.delete(key);
42
+ }
43
+ );
44
+ entry = created;
26
45
  this.entries.set(key, entry);
27
46
  this.evict();
28
47
  }
29
48
  const e = entry;
30
- const next = e.queue.then(() => e.renderer).then((r) => r.render(request));
49
+ e.busy++;
50
+ const next = e.queue.then(() => e.renderer).then((r) => r.render(request)).finally(() => {
51
+ e.busy--;
52
+ });
31
53
  e.queue = next.catch(() => void 0);
32
54
  return next;
33
55
  }
@@ -468,7 +468,8 @@ var HistoryManager = class {
468
468
  index,
469
469
  current: index === u - 1,
470
470
  undone: false,
471
- origin: e.origin
471
+ origin: e.origin,
472
+ ...e.tag !== void 0 ? { tag: e.tag } : {}
472
473
  }));
473
474
  for (let i = this.redoStack.length - 1; i >= 0; i--) {
474
475
  const e = this.redoStack[i];
@@ -478,7 +479,8 @@ var HistoryManager = class {
478
479
  index: entries.length,
479
480
  current: false,
480
481
  undone: true,
481
- origin: e.origin
482
+ origin: e.origin,
483
+ ...e.tag !== void 0 ? { tag: e.tag } : {}
482
484
  });
483
485
  }
484
486
  this.cachedEntries = entries;
@@ -513,6 +515,25 @@ var HistoryManager = class {
513
515
  }
514
516
  return n;
515
517
  }
518
+ /**
519
+ * Removes the steps `match` picks from the undo and redo stacks without running them, e.g.
520
+ * steps whose changes no longer apply because remote content replaced what they change. The
521
+ * other steps keep their order, a gesture merging into a removed step ends, and a mark whose
522
+ * step was removed is no longer valid. `match` gets each step as `getEntries` lists it (with
523
+ * its `tag`). Does nothing while a step is being applied or a batch is open. Returns how many
524
+ * steps were removed.
525
+ */
526
+ dropSteps(match) {
527
+ if (this.isApplying || this.batchDepth > 0) return 0;
528
+ const ids = new Set(this.getEntries().filter((e) => match(e)).map((e) => e.id));
529
+ if (ids.size === 0) return 0;
530
+ this.undoStack = this.undoStack.filter((e) => !ids.has(e.id));
531
+ this.redoStack = this.redoStack.filter((e) => !ids.has(e.id));
532
+ if (this.gestureEntryId !== null && ids.has(this.gestureEntryId)) this.resetGesture();
533
+ this.notify();
534
+ this.emit("drop");
535
+ return ids.size;
536
+ }
516
537
  /**
517
538
  * Clears both undo and redo stacks.
518
539
  */
@@ -54,7 +54,7 @@ var _chunkP6WYDBTHcjs = require('./chunk-P6WYDBTH.cjs');
54
54
  var _chunkN3KJFGXTcjs = require('./chunk-N3KJFGXT.cjs');
55
55
 
56
56
 
57
- var _chunkWKPXOGZZcjs = require('./chunk-WKPXOGZZ.cjs');
57
+ var _chunkWPLGZBNEcjs = require('./chunk-WPLGZBNE.cjs');
58
58
 
59
59
  // src/chart/mermaid.ts
60
60
  var CHART_MERMAID_META_PREFIX = "%% @pixerate ";
@@ -831,7 +831,7 @@ var ChartController = (_class = class {
831
831
 
832
832
 
833
833
  constructor(options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this);_class.prototype.__init12.call(this);
834
- this.history = _nullishCoalesce(options.history, () => ( new (0, _chunkWKPXOGZZcjs.HistoryManager)()));
834
+ this.history = _nullishCoalesce(options.history, () => ( new (0, _chunkWPLGZBNEcjs.HistoryManager)()));
835
835
  this.onChange = options.onChange;
836
836
  this.raceTicker = _nullishCoalesce(options.raceTicker, () => ( defaultRaceTicker));
837
837
  const { spec, issues } = _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {})));