@pixerate/editor 0.271.0 → 0.272.1

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 (96) hide show
  1. package/dist/agent/index.cjs +34 -32
  2. package/dist/agent/index.js +10 -8
  3. package/dist/animation-editor/index.cjs +60 -60
  4. package/dist/animation-editor/index.js +4 -4
  5. package/dist/brushes/index.cjs +69 -66
  6. package/dist/brushes/index.js +6 -3
  7. package/dist/brushes/patch.d.cts +1 -1
  8. package/dist/brushes/patch.d.ts +1 -1
  9. package/dist/brushes/schema.d.cts +1 -0
  10. package/dist/brushes/schema.d.ts +1 -0
  11. package/dist/brushes/types.d.cts +8 -0
  12. package/dist/brushes/types.d.ts +8 -0
  13. package/dist/{brushstrokeRender-WR2N5HHY.cjs → brushstrokeRender-5YBCLFDQ.cjs} +15 -15
  14. package/dist/{brushstrokeRender-A727TTNQ.js → brushstrokeRender-DZGFU3J4.js} +3 -3
  15. package/dist/canvas/index.cjs +13 -13
  16. package/dist/canvas/index.js +1 -1
  17. package/dist/chart/contract.d.cts +95 -0
  18. package/dist/chart/contract.d.ts +95 -0
  19. package/dist/chart/controller.d.cts +4 -0
  20. package/dist/chart/controller.d.ts +4 -0
  21. package/dist/chart/index.cjs +492 -26
  22. package/dist/chart/index.d.cts +1 -0
  23. package/dist/chart/index.d.ts +1 -0
  24. package/dist/chart/index.js +476 -10
  25. package/dist/chart/tools.d.cts +3 -0
  26. package/dist/chart/tools.d.ts +3 -0
  27. package/dist/chart-maps/index.cjs +4 -64
  28. package/dist/chart-maps/index.js +3 -63
  29. package/dist/{chunk-YNFSH72F.js → chunk-2F3YDXCN.js} +1 -1
  30. package/dist/{chunk-QYXUE37Q.js → chunk-2XDNF73E.js} +1 -1
  31. package/dist/{chunk-3KNQ2W6X.cjs → chunk-3JKCREEU.cjs} +59 -53
  32. package/dist/{chunk-NMZQMPFZ.js → chunk-4LZQO5Y7.js} +2 -0
  33. package/dist/{chunk-B5W677L7.js → chunk-5HP2VSAS.js} +1 -1
  34. package/dist/chunk-5UGRMVNE.js +328 -0
  35. package/dist/{chunk-X4FTNFIA.js → chunk-7MGPW2OV.js} +1 -1
  36. package/dist/{chunk-BPJSI4NT.cjs → chunk-7W2EQQBP.cjs} +2 -2
  37. package/dist/{chunk-DGITFN73.cjs → chunk-BWJBZAUE.cjs} +8 -8
  38. package/dist/chunk-CHZYVNXZ.js +336 -0
  39. package/dist/{chunk-LETF75CA.js → chunk-CLB2I2FU.js} +1 -1
  40. package/dist/chunk-DRMZ5R3S.cjs +67 -0
  41. package/dist/{chunk-BAZMCFVL.js → chunk-DZVRH63Y.js} +1 -1
  42. package/dist/chunk-EI5GFTKG.js +67 -0
  43. package/dist/{chunk-U2ASNGO6.cjs → chunk-FXVCB6YG.cjs} +35 -35
  44. package/dist/{chunk-EU2ZZA6L.cjs → chunk-GHGBIAWQ.cjs} +126 -39
  45. package/dist/chunk-JV7DKLMX.js +1073 -0
  46. package/dist/{chunk-2WOGXEDX.cjs → chunk-M3RZOF3G.cjs} +1 -1
  47. package/dist/chunk-MFBUQC67.cjs +328 -0
  48. package/dist/{chunk-GSTSZPSR.js → chunk-N3SKPQEH.js} +225 -18
  49. package/dist/{chunk-J5VQYK7T.cjs → chunk-N5IMDAHM.cjs} +251 -44
  50. package/dist/{chunk-ININNHLM.js → chunk-NAHJV3O6.js} +11 -5
  51. package/dist/{chunk-IBXEQOGI.js → chunk-PYHB2EHE.js} +2 -324
  52. package/dist/chunk-QEUI6OGE.cjs +336 -0
  53. package/dist/{chunk-6ZSFRRJI.js → chunk-RSF6BT34.js} +1 -1
  54. package/dist/{chunk-JJ2H25JG.cjs → chunk-SNAFFCAX.cjs} +200 -174
  55. package/dist/chunk-T2HUQBRC.cjs +1073 -0
  56. package/dist/{chunk-M2ZVPU7L.cjs → chunk-TNLKFW7D.cjs} +23 -23
  57. package/dist/{chunk-KZI3YWKW.js → chunk-UXYCY3HP.js} +93 -6
  58. package/dist/{chunk-GSLOH2IN.cjs → chunk-VF6ODSYX.cjs} +2 -0
  59. package/dist/{chunk-NQUKTRKN.cjs → chunk-WZLNNGG3.cjs} +45 -45
  60. package/dist/{chunk-NRBGAEFI.cjs → chunk-Y3RUYOOW.cjs} +8 -330
  61. package/dist/{chunk-DDL3ZBHK.cjs → chunk-YJANF2BL.cjs} +86 -86
  62. package/dist/{chunk-TNHDCP4R.js → chunk-ZEI7ZEA4.js} +31 -5
  63. package/dist/commands/index.cjs +7 -323
  64. package/dist/commands/index.js +5 -321
  65. package/dist/extensions/index.cjs +4 -4
  66. package/dist/extensions/index.js +3 -3
  67. package/dist/image-editor/index.cjs +789 -789
  68. package/dist/image-editor/index.js +5 -5
  69. package/dist/index.cjs +9 -9
  70. package/dist/index.js +3 -3
  71. package/dist/paint/index.cjs +2 -2
  72. package/dist/paint/index.js +1 -1
  73. package/dist/paint/wet/world.d.cts +37 -1
  74. package/dist/paint/wet/world.d.ts +37 -1
  75. package/dist/paint-editor/brush-controls.d.cts +2 -0
  76. package/dist/paint-editor/brush-controls.d.ts +2 -0
  77. package/dist/paint-editor/brush-model.d.cts +14 -1
  78. package/dist/paint-editor/brush-model.d.ts +14 -1
  79. package/dist/paint-editor/index.cjs +343 -306
  80. package/dist/paint-editor/index.js +48 -11
  81. package/dist/paint-editor/ui.d.cts +1 -1
  82. package/dist/paint-editor/ui.d.ts +1 -1
  83. package/dist/paint-editor/wet.d.cts +8 -1
  84. package/dist/paint-editor/wet.d.ts +8 -1
  85. package/dist/persistence/index.cjs +24 -1042
  86. package/dist/persistence/index.js +22 -1040
  87. package/dist/tools/index.cjs +5 -3
  88. package/dist/tools/index.js +8 -6
  89. package/dist/vector/index.cjs +999 -999
  90. package/dist/vector/index.js +5 -5
  91. package/package.json +1 -1
  92. package/skills/pixerate-brushes/SKILL.md +1 -0
  93. package/skills/pixerate-paint-editor/SKILL.md +4 -11
  94. package/skills/pixerate-paint-editor/references/brush-facets.md +1 -0
  95. package/skills/pixerate-paint-editor/references/ghost.md +47 -0
  96. package/skills/pixerate-paint-watercolour/SKILL.md +1 -0
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkJJ2H25JGcjs = require('./chunk-JJ2H25JG.cjs');
8
+ var _chunkSNAFFCAXcjs = require('./chunk-SNAFFCAX.cjs');
9
9
 
10
10
 
11
11
  var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
@@ -1361,12 +1361,12 @@ var unit = (x, y) => {
1361
1361
  return l > 1e-12 && Number.isFinite(l) ? [x / l, y / l] : null;
1362
1362
  };
1363
1363
  function cubicOf(sp, i) {
1364
- const s = _chunkJJ2H25JGcjs.subpathSegment.call(void 0, sp, i);
1364
+ const s = _chunkSNAFFCAXcjs.subpathSegment.call(void 0, sp, i);
1365
1365
  if (s.length === 4) return s;
1366
1366
  const [a, b] = s;
1367
1367
  return [a, [a[0] + (b[0] - a[0]) / 3, a[1] + (b[1] - a[1]) / 3], [a[0] + 2 * (b[0] - a[0]) / 3, a[1] + 2 * (b[1] - a[1]) / 3], b];
1368
1368
  }
1369
- var isLine = (sp, i) => _chunkJJ2H25JGcjs.subpathSegment.call(void 0, sp, i).length === 2;
1369
+ var isLine = (sp, i) => _chunkSNAFFCAXcjs.subpathSegment.call(void 0, sp, i).length === 2;
1370
1370
  function startTangent(c) {
1371
1371
  for (let k = 1; k < 4; k++) {
1372
1372
  const u = unit(c[k][0] - c[0][0], c[k][1] - c[0][1]);
@@ -1386,10 +1386,10 @@ function sample(c, n, out, withStart) {
1386
1386
  }
1387
1387
  var onAnchor = (a, h) => !h || Math.abs(h.x - a.x) < EPS && Math.abs(h.y - a.y) < EPS;
1388
1388
  function tidy(a, keepType = true) {
1389
- const next = _chunkJJ2H25JGcjs.cloneAnchor.call(void 0, a);
1389
+ const next = _chunkSNAFFCAXcjs.cloneAnchor.call(void 0, a);
1390
1390
  if (onAnchor(next, next.in)) delete next.in;
1391
1391
  if (onAnchor(next, next.out)) delete next.out;
1392
- const shown = _chunkJJ2H25JGcjs.inferAnchorType.call(void 0, next);
1392
+ const shown = _chunkSNAFFCAXcjs.inferAnchorType.call(void 0, next);
1393
1393
  const type = keepType && a.type ? a.type === "symmetric" && shown !== "symmetric" ? shown === "corner" ? "corner" : "smooth" : a.type === "smooth" && shown === "corner" ? "corner" : a.type : shown;
1394
1394
  if (type === "corner") delete next.type;
1395
1395
  else next.type = type;
@@ -1433,7 +1433,7 @@ function fitAcross(pts, N, t0, t1) {
1433
1433
  return goldenMin(fit, 0, 1);
1434
1434
  }
1435
1435
  function removeAnchorKeepingShape(sp, index) {
1436
- const anchors = sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor);
1436
+ const anchors = sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor);
1437
1437
  const n = anchors.length;
1438
1438
  if (index < 0 || index >= n) return { anchors, closed: sp.closed };
1439
1439
  if ((sp.closed || index > 0 && index < n - 1) && n >= 3) {
@@ -1467,12 +1467,12 @@ function removeAnchorKeepingShape(sp, index) {
1467
1467
  }
1468
1468
  function removeAnchorsKeepingShape(sp, indices) {
1469
1469
  const order = [...new Set(indices)].filter((i) => i >= 0 && i < sp.anchors.length).sort((a, b) => b - a);
1470
- return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor), closed: sp.closed });
1470
+ return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor), closed: sp.closed });
1471
1471
  }
1472
1472
  function bendSegment(sp, segment, t, p) {
1473
- const anchors = sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor);
1473
+ const anchors = sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor);
1474
1474
  const n = anchors.length;
1475
- if (segment < 0 || segment >= _chunkJJ2H25JGcjs.subpathSegmentCount.call(void 0, sp) || !Number.isFinite(t) || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return { anchors, closed: sp.closed };
1475
+ if (segment < 0 || segment >= _chunkSNAFFCAXcjs.subpathSegmentCount.call(void 0, sp) || !Number.isFinite(t) || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return { anchors, closed: sp.closed };
1476
1476
  const tc = Math.min(0.95, Math.max(0.05, t));
1477
1477
  const ia = segment;
1478
1478
  const ib = (segment + 1) % n;
@@ -1483,16 +1483,16 @@ function bendSegment(sp, segment, t, p) {
1483
1483
  const oy = (p.y - (a.y + (b.y - a.y) * tc)) / k;
1484
1484
  const c1 = { x: a.x + (b.x - a.x) / 3 + ox, y: a.y + (b.y - a.y) / 3 + oy };
1485
1485
  const c2 = { x: b.x + (a.x - b.x) / 3 + ox, y: b.y + (a.y - b.y) / 3 + oy };
1486
- anchors[ia] = _chunkJJ2H25JGcjs.moveAnchorHandle.call(void 0, a, "out", c1);
1487
- anchors[ib] = _chunkJJ2H25JGcjs.moveAnchorHandle.call(void 0, b, "in", c2);
1486
+ anchors[ia] = _chunkSNAFFCAXcjs.moveAnchorHandle.call(void 0, a, "out", c1);
1487
+ anchors[ib] = _chunkSNAFFCAXcjs.moveAnchorHandle.call(void 0, b, "in", c2);
1488
1488
  return { anchors, closed: sp.closed };
1489
1489
  }
1490
1490
  function subpathPointAt(sp, segment, t) {
1491
- const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0, _chunkJJ2H25JGcjs.subpathSegment.call(void 0, sp, segment), t);
1491
+ const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0, _chunkSNAFFCAXcjs.subpathSegment.call(void 0, sp, segment), t);
1492
1492
  return { x, y };
1493
1493
  }
1494
1494
  function curvatureMoveAnchor(sp, index, q) {
1495
- const anchors = sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor);
1495
+ const anchors = sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor);
1496
1496
  const a = sp.anchors[index];
1497
1497
  if (!a) return { anchors, closed: sp.closed };
1498
1498
  const own = [
@@ -1538,7 +1538,7 @@ function curvatureMoveAnchor(sp, index, q) {
1538
1538
  function cutSubpathAt(sp, at) {
1539
1539
  const n = sp.anchors.length;
1540
1540
  const cuts = [...new Set(at)].filter((i) => Number.isInteger(i) && i >= 0 && i < n && (sp.closed || i > 0 && i < n - 1)).sort((a, b) => a - b);
1541
- if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor), closed: sp.closed }];
1541
+ if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor), closed: sp.closed }];
1542
1542
  const first = cuts[0];
1543
1543
  const run = sp.closed ? Array.from({ length: n + 1 }, (_, i) => sp.anchors[(first + i) % n]) : sp.anchors;
1544
1544
  const cutSet = new Set(sp.closed ? [...cuts.map((c) => (c - first + n) % n), n] : cuts);
@@ -1546,7 +1546,7 @@ function cutSubpathAt(sp, at) {
1546
1546
  let cur = [];
1547
1547
  run.forEach((a, i) => {
1548
1548
  if (!cutSet.has(i)) {
1549
- cur.push(_chunkJJ2H25JGcjs.cloneAnchor.call(void 0, a));
1549
+ cur.push(_chunkSNAFFCAXcjs.cloneAnchor.call(void 0, a));
1550
1550
  return;
1551
1551
  }
1552
1552
  if (cur.length) {
@@ -1561,10 +1561,10 @@ function cutSubpathAt(sp, at) {
1561
1561
  }
1562
1562
  function splitSubpathAt(sp, segment, t, endTolerance = 1e-6) {
1563
1563
  const n = sp.anchors.length;
1564
- if (segment < 0 || segment >= _chunkJJ2H25JGcjs.subpathSegmentCount.call(void 0, sp)) return [{ anchors: sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor), closed: sp.closed }];
1564
+ if (segment < 0 || segment >= _chunkSNAFFCAXcjs.subpathSegmentCount.call(void 0, sp)) return [{ anchors: sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor), closed: sp.closed }];
1565
1565
  if (t <= endTolerance) return cutSubpathAt(sp, [segment]);
1566
1566
  if (t >= 1 - endTolerance) return cutSubpathAt(sp, [(segment + 1) % n]);
1567
- const { subpath, index } = _chunkJJ2H25JGcjs.insertAnchor.call(void 0, sp, segment, t);
1567
+ const { subpath, index } = _chunkSNAFFCAXcjs.insertAnchor.call(void 0, sp, segment, t);
1568
1568
  return cutSubpathAt(subpath, [index]);
1569
1569
  }
1570
1570
  var endOf = (sp, last) => sp.anchors[last ? sp.anchors.length - 1 : 0];
@@ -1587,7 +1587,7 @@ function joinSubpaths(subpaths, tolerance) {
1587
1587
  const closed = [];
1588
1588
  let open = [];
1589
1589
  for (const sp of subpaths) {
1590
- const copy = { anchors: sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor), closed: sp.closed };
1590
+ const copy = { anchors: sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor), closed: sp.closed };
1591
1591
  if (sp.closed || sp.anchors.length < 2) {
1592
1592
  if (sp.anchors.length) closed.push(copy);
1593
1593
  } else open.push(copy);
@@ -1642,7 +1642,7 @@ function smoothSubpath(sp, amount = 1, only) {
1642
1642
  const t = Math.min(1, Math.max(0, amount));
1643
1643
  const orig = sp.anchors;
1644
1644
  const n = orig.length;
1645
- const anchors = orig.map(_chunkJJ2H25JGcjs.cloneAnchor);
1645
+ const anchors = orig.map(_chunkSNAFFCAXcjs.cloneAnchor);
1646
1646
  if (n < 3 || t === 0) return { anchors, closed: sp.closed };
1647
1647
  for (let i = 0; i < n; i++) {
1648
1648
  if (!sp.closed && (i === 0 || i === n - 1)) continue;
@@ -1671,8 +1671,8 @@ function smoothSubpath(sp, amount = 1, only) {
1671
1671
  }
1672
1672
  function segsOf(sp) {
1673
1673
  const out = [];
1674
- for (let i = 0; i < _chunkJJ2H25JGcjs.subpathSegmentCount.call(void 0, sp); i++) {
1675
- const s = _chunkJJ2H25JGcjs.subpathSegment.call(void 0, sp, i);
1674
+ for (let i = 0; i < _chunkSNAFFCAXcjs.subpathSegmentCount.call(void 0, sp); i++) {
1675
+ const s = _chunkSNAFFCAXcjs.subpathSegment.call(void 0, sp, i);
1676
1676
  out.push(s.length === 2 ? { c: s, line: true } : { c: s, line: false });
1677
1677
  }
1678
1678
  return out;
@@ -1729,7 +1729,7 @@ function removeRedundantPoints(sp, tolerance) {
1729
1729
  const tol = Math.max(tolerance, 1e-9);
1730
1730
  const types = new Map(sp.anchors.filter((a) => a.type).map((a) => [`${a.x},${a.y}`, a.type]));
1731
1731
  const segs = segsOf(sp).filter((s) => !isZeroSeg(s));
1732
- if (!segs.length) return { anchors: sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor), closed: sp.closed };
1732
+ if (!segs.length) return { anchors: sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor), closed: sp.closed };
1733
1733
  const minSegs = sp.closed ? 2 : 1;
1734
1734
  let changed = true;
1735
1735
  while (changed && segs.length > minSegs) {
@@ -1747,7 +1747,7 @@ function removeRedundantPoints(sp, tolerance) {
1747
1747
  break;
1748
1748
  }
1749
1749
  }
1750
- return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(_chunkJJ2H25JGcjs.cloneAnchor), closed: sp.closed }));
1750
+ return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(_chunkSNAFFCAXcjs.cloneAnchor), closed: sp.closed }));
1751
1751
  }
1752
1752
 
1753
1753
 
@@ -775,6 +775,51 @@ var BRUSH_PRESETS = [
775
775
  marks: { kind: "scatter", density: 0.7, size: 0.04 },
776
776
  dynamics: { smoothing: 0.2, pressureSize: false, pressureOpacity: true },
777
777
  colour: { palette: ["#ef4444", "#f97316", "#facc15", "#22c55e", "#3b82f6", "#a855f7", "#111827", "#f8fafc"] }
778
+ },
779
+ // --- Ghost paint: wet paint whose colour vanishes, leaving only what it smeared ---
780
+ {
781
+ id: "ghost-wash",
782
+ name: "Ghost wash",
783
+ kind: "mark",
784
+ medium: "paint",
785
+ variety: "watercolor",
786
+ tip: { shape: "round", size: 32, hardness: 0.55, spacing: 0.12 },
787
+ dynamics: { smoothing: 0.25, pressureOpacity: true, minSize: 0.35 },
788
+ behaviour: { surface: "wet", wet: { water: 0.65, rewet: 0.2 } },
789
+ ghost: {}
790
+ },
791
+ {
792
+ id: "ghost-gouache",
793
+ name: "Ghost gouache",
794
+ kind: "mark",
795
+ medium: "paint",
796
+ variety: "gouache",
797
+ tip: { shape: "round", size: 26, hardness: 0.7 },
798
+ dynamics: { smoothing: 0.25, minSize: 0.5 },
799
+ behaviour: { surface: "wet", wet: { water: 0.35, pigment: 0.85, body: 1, rewet: 0.3 } },
800
+ ghost: { linger: 5, smear: 0.4 }
801
+ },
802
+ {
803
+ id: "ghost-oil",
804
+ name: "Ghost oil",
805
+ kind: "mark",
806
+ medium: "paint",
807
+ variety: "oil",
808
+ tip: { shape: "round", size: 24, hardness: 0.75, spacing: 0.08 },
809
+ dynamics: { smoothing: 0.25, minSize: 0.5 },
810
+ behaviour: { surface: "wet", wet: { water: 0.4, pigment: 0.9, body: 1, load: 0.97 } },
811
+ ghost: { linger: 10, smear: 0.5 }
812
+ },
813
+ {
814
+ id: "invisible-ink",
815
+ name: "Invisible ink",
816
+ kind: "mark",
817
+ medium: "paint",
818
+ variety: "watercolor",
819
+ tip: { shape: "round", size: 24, hardness: 0.65 },
820
+ dynamics: { smoothing: 0.3, minSize: 0.4 },
821
+ behaviour: { surface: "wet", wet: { water: 0.45, pigment: 0, rewet: 0.35 } },
822
+ ghost: { smear: 0.65 }
778
823
  }
779
824
  ];
780
825
 
@@ -897,6 +942,13 @@ var DEFAULT_LIGHT = { amount: 0, pressure: false };
897
942
  function normalizeLight(raw = {}, base = DEFAULT_LIGHT) {
898
943
  return { amount: unit2(raw.amount, base.amount), pressure: typeof raw.pressure === "boolean" ? raw.pressure : base.pressure };
899
944
  }
945
+ var DEFAULT_GHOST = { linger: 4, smear: 0.3 };
946
+ function normalizeGhost(raw = {}, base = DEFAULT_GHOST) {
947
+ return {
948
+ linger: range(raw.linger, 0.5, 60, base.linger),
949
+ smear: unit2(raw.smear, base.smear)
950
+ };
951
+ }
900
952
  function normalizeImpasto(raw = {}, base = DEFAULT_IMPASTO) {
901
953
  return {
902
954
  tool: IMPASTO_TOOLS.includes(raw.tool) ? raw.tool : base.tool,
@@ -1085,6 +1137,10 @@ function normalizePaintBrush(raw = {}, base) {
1085
1137
  paint = mc.mode === "off" ? paintToMultiColor(paint) ? null : paint : multiColorToPaint(mc, behavior.mixing);
1086
1138
  }
1087
1139
  behavior = { ...behavior, multicolor: paintToMultiColor(paint) ?? { ...DEFAULT_MULTI_COLOR, colors: [] } };
1140
+ const wet = normalizeWetBrush(raw.wet ?? {}, b.wet ?? DEFAULT_WET_BRUSH);
1141
+ const wantsLight = typeof raw.light?.amount === "number" && raw.light.amount > 0;
1142
+ const ghost = engine === "wet" && wet.tool === "paint" && (raw.ghost !== void 0 ? raw.ghost !== null : !wantsLight && Boolean(b.ghost)) ? normalizeGhost(raw.ghost ?? {}, b.ghost ?? DEFAULT_GHOST) : void 0;
1143
+ if (ghost) behavior = { ...behavior, pickup: 0, dirty: false };
1088
1144
  return {
1089
1145
  id,
1090
1146
  name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim().slice(0, 80) : b.name,
@@ -1100,12 +1156,13 @@ function normalizePaintBrush(raw = {}, base) {
1100
1156
  behavior,
1101
1157
  blender: normalizeBlender(raw.blender ?? {}, b.blender),
1102
1158
  smudge: normalizeSmudge(raw.smudge ?? {}, b.smudge),
1103
- wet: normalizeWetBrush(raw.wet ?? {}, b.wet ?? DEFAULT_WET_BRUSH),
1159
+ wet,
1104
1160
  impasto: normalizeImpasto(raw.impasto ?? {}, b.impasto ?? DEFAULT_IMPASTO),
1105
1161
  particle: normalizeParticle(raw.particle ?? {}, b.particle ?? DEFAULT_PARTICLE),
1106
1162
  bristle: normalizeBristle(raw.bristle ?? {}, b.bristle ?? DEFAULT_BRISTLE),
1107
1163
  sticker: normalizeStickerSettings(raw.sticker ?? {}, b.sticker ?? DEFAULT_STICKER),
1108
- light: normalizeLight(raw.light ?? {}, b.light ?? DEFAULT_LIGHT),
1164
+ light: ghost && !wantsLight ? { ...DEFAULT_LIGHT } : normalizeLight(raw.light ?? {}, b.light ?? DEFAULT_LIGHT),
1165
+ ...ghost ? { ghost } : {},
1109
1166
  stamp: readStamp(raw.stamp, b.stamp ?? null),
1110
1167
  spray: readSpray(raw.spray, b.spray ?? null),
1111
1168
  ...withTipGrain(readTipGrain(raw.tipGrain, b.tipGrain ?? null)),
@@ -1194,6 +1251,7 @@ var BRUSH_FIELDS = [
1194
1251
  f("behaviour.strength", "wet.strength", ["wet"]),
1195
1252
  // Surfaces.
1196
1253
  ...each("behaviour.wet", "wet", ["medium", "water", "pigment", "body", "rewet", "load", "thinner"], ["wet"]),
1254
+ ...each("ghost", "ghost", ["linger", "smear"], ["wet"]),
1197
1255
  f("behaviour.thick.applicator", "impasto.tool", ["impasto"]),
1198
1256
  ...each("behaviour.thick", "impasto", ["thickness", "gloss", "metallic", "load", "thinner", "drag", "rim", "clarity"], ["impasto"]),
1199
1257
  // Marks.
@@ -1289,6 +1347,7 @@ function resolveBrush(brush, options = {}) {
1289
1347
  setPath(input, "wet.tool", brush.kind === "tool" ? WET_TOOL_OF[brush.tool] : "paint");
1290
1348
  const medium = resolveWetMedium(brush);
1291
1349
  if (medium) setPath(input, "wet.medium", medium);
1350
+ if (brush.kind !== "tool" && brush.ghost) input.ghost = { ...input.ghost ?? {} };
1292
1351
  }
1293
1352
  if (engine === "blender" || engine === "smudge") input.loadsColor = false;
1294
1353
  const paint = brush.colour?.default;
@@ -1354,7 +1413,7 @@ function skeleton(b) {
1354
1413
  }
1355
1414
  switch (b.engine) {
1356
1415
  case "wet":
1357
- return { ...brush, medium: "paint", variety: b.wet.medium, behaviour: { surface: "wet" } };
1416
+ return { ...brush, medium: "paint", variety: b.wet.medium, behaviour: { surface: "wet" }, ...b.ghost ? { ghost: {} } : {} };
1358
1417
  case "impasto":
1359
1418
  return { ...brush, medium: "paint", behaviour: { surface: "thick" } };
1360
1419
  case "mixer":
@@ -1371,7 +1430,7 @@ function skeleton(b) {
1371
1430
  }
1372
1431
  }
1373
1432
  }
1374
- var ORDER = ["id", "name", "description", "tags", "kind", "medium", "variety", "tool", "tip", "marks", "dynamics", "behaviour", "light", "motion", "colour"];
1433
+ var ORDER = ["id", "name", "description", "tags", "kind", "medium", "variety", "tool", "tip", "marks", "dynamics", "behaviour", "light", "ghost", "motion", "colour"];
1375
1434
  function migrateBrushV1(raw) {
1376
1435
  const b = normalizePaintBrush(raw);
1377
1436
  const brush = skeleton(b);
@@ -1586,6 +1645,10 @@ var LIGHT = object("Light the brush gives off with its colour (glow and spill).
1586
1645
  }),
1587
1646
  glow: bool("Suggest a glow layer effect for the layer (glow stays a layer effect).")
1588
1647
  });
1648
+ var GHOST = object('Ghost paint: wet paint that flows and mixes visibly while wet, then fades away without leaving its colour, keeping only the smear it made in the paint it touched (needs behaviour.surface "wet").', {
1649
+ linger: num(0.5, 60, "Seconds of simulated time before the ghost paint has fully faded (default 4)."),
1650
+ smear: unit3("How much the ghost paint drags and lifts the paint it passes through: 0 none .. 1 full (default 0.3).")
1651
+ });
1589
1652
  var MOTION = object("Animation after painting.", {
1590
1653
  live: bool("Effect paint keeps playing on stroke layers (default false)."),
1591
1654
  fps: int(1, 60, "Suggested playback rate in frames per second."),
@@ -1649,6 +1712,7 @@ var BRUSH_JSON_SCHEMA = object(
1649
1712
  dynamics: DYNAMICS,
1650
1713
  behaviour: BEHAVIOUR,
1651
1714
  light: LIGHT,
1715
+ ghost: GHOST,
1652
1716
  motion: MOTION,
1653
1717
  colour: COLOUR
1654
1718
  },
@@ -1661,6 +1725,7 @@ var BRUSH_FACET_SCHEMAS = {
1661
1725
  dynamics: DYNAMICS,
1662
1726
  behaviour: BEHAVIOUR,
1663
1727
  light: LIGHT,
1728
+ ghost: GHOST,
1664
1729
  motion: MOTION,
1665
1730
  colour: COLOUR,
1666
1731
  paint: PAINT
@@ -1906,8 +1971,8 @@ function normalizeBrushSpec(raw, problems = []) {
1906
1971
  const out = readObject(rest, BRUSH_JSON_SCHEMA, "brush", problems);
1907
1972
  const brush = { id: raw.id, name, ...out, kind, ...tool ? { tool } : {}, tip: out.tip ?? { shape: "round" } };
1908
1973
  const ordered = () => {
1909
- const { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, motion, colour } = brush;
1910
- const all = { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, motion, colour };
1974
+ const { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, ghost, motion, colour } = brush;
1975
+ const all = { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, ghost, motion, colour };
1911
1976
  return Object.fromEntries(Object.entries(all).filter(([, v]) => v !== void 0));
1912
1977
  };
1913
1978
  if (!out.tip) problems.push("tip is missing; a round tip is used.");
@@ -2032,6 +2097,21 @@ function normalizeBrushSpec(raw, problems = []) {
2032
2097
  delete b.exchange;
2033
2098
  }
2034
2099
  }
2100
+ if (brush.ghost) {
2101
+ if (kind === "tool" || brush.behaviour?.surface !== "wet") {
2102
+ drop("ghost", "it needs a mark brush with behaviour.surface wet");
2103
+ delete brush.ghost;
2104
+ } else {
2105
+ if (brush.light) {
2106
+ drop("light", "ghost paint uses the wet light channel as its tracer");
2107
+ delete brush.light;
2108
+ }
2109
+ if (brush.behaviour?.exchange) {
2110
+ drop("behaviour.exchange", "ghost paint does not pick paint up");
2111
+ delete brush.behaviour.exchange;
2112
+ }
2113
+ }
2114
+ }
2035
2115
  return ordered();
2036
2116
  }
2037
2117
 
@@ -2130,6 +2210,7 @@ function checkBrush(brush, profile) {
2130
2210
  feature(profile.exchange, !ex?.reservoir && (nonZero(ex?.pickup) || !!ex?.dirty), "behaviour.exchange", "picking paint up", "Remove behaviour.exchange.");
2131
2211
  feature(profile.grain, nonZero(brush.behaviour?.grain), "behaviour.grain", "paper grain", "Set behaviour.grain to 0.");
2132
2212
  feature(profile.light, nonZero(brush.light?.amount), "light", "light paint (glow and spill)", "Remove light (or set light.amount to 0).");
2213
+ feature(profile.surfaces.includes("wet") && profile.light === "full" ? "full" : "none", !!brush.ghost, "ghost", "ghost paint", "Remove ghost.");
2133
2214
  const m = brush.motion;
2134
2215
  feature(profile.motion, !!m && (!!m.live || nonZero(m.waveSpeed) || m.fps !== void 0), "motion", "animation", "Remove motion.");
2135
2216
  const d = brush.dynamics ?? {};
@@ -2180,6 +2261,10 @@ function degrade(brush, profile, options = {}) {
2180
2261
  delete b.behaviour.surface;
2181
2262
  delete b.behaviour.wet;
2182
2263
  delete b.behaviour.thick;
2264
+ delete b.ghost;
2265
+ break;
2266
+ case "ghost":
2267
+ delete b.ghost;
2183
2268
  break;
2184
2269
  case "behaviour.exchange.reservoir":
2185
2270
  delete b.behaviour.exchange.reservoir;
@@ -2576,6 +2661,8 @@ export {
2576
2661
  DEFAULT_IMPASTO,
2577
2662
  DEFAULT_LIGHT,
2578
2663
  normalizeLight,
2664
+ DEFAULT_GHOST,
2665
+ normalizeGhost,
2579
2666
  normalizeImpasto,
2580
2667
  MULTI_COLOR_MODES,
2581
2668
  DEFAULT_MULTI_COLOR,
@@ -816,6 +816,7 @@ var fail = (message, issues) => ({ ok: false, message, ...issues ? { issues } :
816
816
  var ChartController = (_class = class {
817
817
 
818
818
 
819
+
819
820
  __init() {this.selection = null}
820
821
  __init2() {this.issues = []}
821
822
  __init3() {this.gestureKey = null}
@@ -832,6 +833,7 @@ var ChartController = (_class = class {
832
833
 
833
834
  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
835
  this.history = _nullishCoalesce(options.history, () => ( new (0, _chunkWPLGZBNEcjs.HistoryManager)()));
836
+ this.measureText = options.measureText;
835
837
  this.onChange = options.onChange;
836
838
  this.raceTicker = _nullishCoalesce(options.raceTicker, () => ( defaultRaceTicker));
837
839
  const { spec, issues } = _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {})));