@pixerate/editor 0.206.0 → 0.208.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 (73) hide show
  1. package/dist/animation-editor/index.cjs +60 -59
  2. package/dist/animation-editor/index.js +6 -5
  3. package/dist/{brushstrokeRender-7LXCU7PD.js → brushstrokeRender-C3UU6GVC.js} +5 -4
  4. package/dist/{brushstrokeRender-VO4ZTWVA.cjs → brushstrokeRender-EAJNE6WP.cjs} +12 -11
  5. package/dist/canvas/index.cjs +8 -8
  6. package/dist/canvas/index.js +1 -1
  7. package/dist/{chunk-2N2QPO3H.js → chunk-2PBZBRP5.js} +9 -7
  8. package/dist/{chunk-7NW46N7I.cjs → chunk-3EHPLDFQ.cjs} +54 -52
  9. package/dist/{chunk-H367YTXI.js → chunk-42TWUPNJ.js} +13 -387
  10. package/dist/chunk-474IQG74.cjs +384 -0
  11. package/dist/{chunk-MLC7HUHO.js → chunk-BGOCAUXH.js} +1 -1
  12. package/dist/chunk-DWYQPL2A.js +2010 -0
  13. package/dist/{chunk-YXKLVD56.js → chunk-F7YA3MMC.js} +2 -2
  14. package/dist/{chunk-ZZGPYNS2.js → chunk-G4E6RUPC.js} +1 -1
  15. package/dist/chunk-HVVR5PZW.js +384 -0
  16. package/dist/{chunk-FR2Q2LVF.cjs → chunk-I7G3RSUJ.cjs} +35 -35
  17. package/dist/chunk-K6PXS6DO.cjs +102 -0
  18. package/dist/{chunk-ZIDUPSP4.js → chunk-KFIOEOCQ.js} +24 -761
  19. package/dist/{chunk-V7GWZIZK.cjs → chunk-KWNMBMKG.cjs} +23 -21
  20. package/dist/chunk-L3G23N5Y.js +763 -0
  21. package/dist/{chunk-GHCXLQ47.js → chunk-NDMXB4PR.js} +2 -2
  22. package/dist/{chunk-CWM3CUUX.cjs → chunk-OLNIPTB3.cjs} +39 -413
  23. package/dist/{chunk-EBDCRTZI.cjs → chunk-PQ3H2AAN.cjs} +92 -90
  24. package/dist/{chunk-BRKVNXDZ.cjs → chunk-QAUIZPYI.cjs} +7 -7
  25. package/dist/{chunk-UYXL6ZWQ.cjs → chunk-QE7D7TZR.cjs} +494 -1231
  26. package/dist/chunk-QYLWG22N.cjs +763 -0
  27. package/dist/{chunk-YQ5C5BVK.cjs → chunk-ROVK6AXX.cjs} +60 -60
  28. package/dist/{chunk-HGTDMKNE.cjs → chunk-UOGKSVRQ.cjs} +126 -221
  29. package/dist/{chunk-EL5PAHNP.js → chunk-USQCKRZG.js} +6 -4
  30. package/dist/{chunk-36OKQDCF.js → chunk-WJ2RBZMM.js} +5 -3
  31. package/dist/chunk-X4LUGTQX.cjs +2010 -0
  32. package/dist/{chunk-NQMP3CWF.js → chunk-YBJXCQTR.js} +15 -110
  33. package/dist/chunk-ZIF4UJJ6.js +102 -0
  34. package/dist/{chunk-WTW7QRTS.cjs → chunk-ZMHPQ6HP.cjs} +1 -1
  35. package/dist/image-editor/controller.d.cts +28 -3
  36. package/dist/image-editor/controller.d.ts +28 -3
  37. package/dist/image-editor/index.cjs +2150 -3380
  38. package/dist/image-editor/index.js +675 -1905
  39. package/dist/image-editor/selection/index.d.cts +2 -0
  40. package/dist/image-editor/selection/index.d.ts +2 -0
  41. package/dist/image-editor/selection/refine-edits.d.cts +13 -4
  42. package/dist/image-editor/selection/refine-edits.d.ts +13 -4
  43. package/dist/image-editor/selection/segment/focus.d.cts +2 -0
  44. package/dist/image-editor/selection/segment/focus.d.ts +2 -0
  45. package/dist/image-editor/selection/segment/grabcut.d.cts +4 -2
  46. package/dist/image-editor/selection/segment/grabcut.d.ts +4 -2
  47. package/dist/image-editor/selection/segment/sky.d.cts +2 -0
  48. package/dist/image-editor/selection/segment/sky.d.ts +2 -0
  49. package/dist/image-editor/selection/segment/subject.d.cts +2 -1
  50. package/dist/image-editor/selection/segment/subject.d.ts +2 -1
  51. package/dist/image-editor/selection/segment/work.d.cts +5 -0
  52. package/dist/image-editor/selection/segment/work.d.ts +5 -0
  53. package/dist/image-editor/selection/select-and-mask.d.cts +136 -0
  54. package/dist/image-editor/selection/select-and-mask.d.ts +136 -0
  55. package/dist/image-editor/selection/worker.d.cts +126 -0
  56. package/dist/image-editor/selection/worker.d.ts +126 -0
  57. package/dist/image-editor/selection-worker.cjs +14 -0
  58. package/dist/image-editor/selection-worker.d.cts +12 -0
  59. package/dist/image-editor/selection-worker.d.ts +12 -0
  60. package/dist/image-editor/selection-worker.js +14 -0
  61. package/dist/image-editor/types.d.cts +8 -0
  62. package/dist/image-editor/types.d.ts +8 -0
  63. package/dist/paint/index.cjs +6 -5
  64. package/dist/paint/index.js +5 -4
  65. package/dist/paint-editor/index.cjs +394 -390
  66. package/dist/paint-editor/index.js +18 -14
  67. package/dist/raster/index.cjs +22 -18
  68. package/dist/raster/index.js +29 -25
  69. package/dist/vector/index.cjs +986 -985
  70. package/dist/vector/index.js +6 -5
  71. package/package.json +11 -1
  72. package/skills/pixerate-image-editor/SKILL.md +1 -1
  73. package/skills/pixerate-image-selection-masking/SKILL.md +4 -2
@@ -1,11 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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; var _class2; var _class3;
2
2
 
3
3
 
4
+ var _chunkOLNIPTB3cjs = require('./chunk-OLNIPTB3.cjs');
4
5
 
5
6
 
6
7
 
7
8
 
8
- var _chunkCWM3CUUXcjs = require('./chunk-CWM3CUUX.cjs');
9
+
10
+ var _chunk474IQG74cjs = require('./chunk-474IQG74.cjs');
9
11
 
10
12
  // src/paint/pigment-tools.ts
11
13
  var HEX = /^#?([0-9a-f]{6})$/i;
@@ -62,8 +64,8 @@ function createPigmentTools() {
62
64
  const rgbs = items.map((item, i) => parseHex(item.color, i));
63
65
  const total = items.reduce((sum, item) => sum + item.weight, 0);
64
66
  if (!(total > 0)) throw new Error("Every weight is 0; give at least one colour a weight above 0.");
65
- const pigments = rgbs.map((rgb2, i) => _chunkCWM3CUUXcjs.createPigment.call(void 0, rgb2, { strength: items[i].strength }));
66
- const mixed = _chunkCWM3CUUXcjs.mixPigments.call(void 0, pigments, items.map((item) => item.weight));
67
+ const pigments = rgbs.map((rgb2, i) => _chunkOLNIPTB3cjs.createPigment.call(void 0, rgb2, { strength: items[i].strength }));
68
+ const mixed = _chunkOLNIPTB3cjs.mixPigments.call(void 0, pigments, items.map((item) => item.weight));
67
69
  const lerp = [0, 1, 2].map((c) => rgbs.reduce((sum, rgb2, i) => sum + rgb2[c] * items[i].weight, 0) / total);
68
70
  const rgb = args.model === "rgb";
69
71
  return {
@@ -1034,7 +1036,7 @@ var WetWorld = (_class = class {
1034
1036
  params: normalizeWetParams(_nullishCoalesce(options.params, () => ( {})), DEFAULT_WET_PARAMS),
1035
1037
  flow: _nullishCoalesce(options.flow, () => ( null)),
1036
1038
  flowStrength: options.flow ? _nullishCoalesce(options.flowStrength, () => ( 1)) : 0,
1037
- base: _nullishCoalesce(options.base, () => ( new (0, _chunkCWM3CUUXcjs.TiledSurface)(4, /* @__PURE__ */ new Map(), 0))),
1039
+ base: _nullishCoalesce(options.base, () => ( new (0, _chunk474IQG74cjs.TiledSurface)(4, /* @__PURE__ */ new Map(), 0))),
1038
1040
  shaded: /* @__PURE__ */ new Map(),
1039
1041
  urgent: /* @__PURE__ */ new Set(),
1040
1042
  stamp: 1,
@@ -1189,7 +1191,7 @@ var WetWorld = (_class = class {
1189
1191
  }
1190
1192
  tileKeyOf(key) {
1191
1193
  const [tx, ty] = this.tileXY(key);
1192
- return _chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty);
1194
+ return _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
1193
1195
  }
1194
1196
  fillPaper(key) {
1195
1197
  this.gpuDirtySlot(this.slotOf(key), 0, SLOT_SIDE - 1);
@@ -1519,7 +1521,7 @@ var WetWorld = (_class = class {
1519
1521
  const { tilesX, perLane } = this.layout;
1520
1522
  for (let ty = y0 >> 8; ty <= y1 - 1 >> 8; ty++)
1521
1523
  for (let tx = x0 >> 8; tx <= x1 - 1 >> 8; tx++) {
1522
- lane.urgent.add(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty));
1524
+ lane.urgent.add(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty));
1523
1525
  const slot = this.slotOf(lane.index * perLane + ty * tilesX + tx);
1524
1526
  if (slot >= 0) this.gpuDirtySlot(slot, Math.max(1, y0 - ty * WET_TILE + 1), Math.min(WET_TILE, y1 - ty * WET_TILE));
1525
1527
  }
@@ -1701,7 +1703,7 @@ var WetWorld = (_class = class {
1701
1703
  if (!(this.f32[c + P_RHO * PLANE] >= DRY_EPS)) return;
1702
1704
  const a = Math.min(1, Math.max(0, amount * w));
1703
1705
  if (!(a > 0)) return;
1704
- const key = _chunkCWM3CUUXcjs.tileKey.call(void 0, x >> 8, y >> 8);
1706
+ const key = _chunk474IQG74cjs.tileKey.call(void 0, x >> 8, y >> 8);
1705
1707
  let tile = tiles.get(key);
1706
1708
  if (!tile) return;
1707
1709
  if (!written.has(key)) {
@@ -1709,7 +1711,7 @@ var WetWorld = (_class = class {
1709
1711
  tiles.set(key, tile);
1710
1712
  written.add(key);
1711
1713
  }
1712
- const i = ((y & 255) * _chunkCWM3CUUXcjs.TILE + (x & 255)) * 4;
1714
+ const i = ((y & 255) * _chunk474IQG74cjs.TILE + (x & 255)) * 4;
1713
1715
  if (tile.data[i + 3] === 0) return;
1714
1716
  pixelPigment(tile.data, i, paper, pig);
1715
1717
  if (!(pig[0] > 0 || pig[1] > 0 || pig[2] > 0)) return;
@@ -1723,11 +1725,11 @@ var WetWorld = (_class = class {
1723
1725
  );
1724
1726
  if (written.size) {
1725
1727
  for (const key of written) {
1726
- const t = _chunkCWM3CUUXcjs.finishTile.call(void 0, tiles.get(key).data, 4, 0);
1728
+ const t = _chunk474IQG74cjs.finishTile.call(void 0, tiles.get(key).data, 4, 0);
1727
1729
  if (t) tiles.set(key, t);
1728
1730
  else tiles.delete(key);
1729
1731
  }
1730
- this.setBase(id, new (0, _chunkCWM3CUUXcjs.TiledSurface)(4, tiles, 0));
1732
+ this.setBase(id, new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0));
1731
1733
  }
1732
1734
  }
1733
1735
  /**
@@ -1787,15 +1789,15 @@ var WetWorld = (_class = class {
1787
1789
  bakeKey(key, all) {
1788
1790
  const lane = this.lanes[this.laneIndexOf(key)];
1789
1791
  const [tx, ty] = this.tileXY(key);
1790
- const tk = _chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty);
1792
+ const tk = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
1791
1793
  const src = _nullishCoalesce(_optionalChain([lane, 'access', _19 => _19.base, 'access', _20 => _20.tiles, 'access', _21 => _21.get, 'call', _22 => _22(tk), 'optionalAccess', _23 => _23.data]), () => ( null));
1792
1794
  const out = this.shadeSlot(key, src, all ? "bake-all" : "bake");
1793
1795
  if (!out) return false;
1794
1796
  const tiles = new Map(lane.base.tiles);
1795
- const t = _chunkCWM3CUUXcjs.finishTile.call(void 0, out, 4, 0);
1797
+ const t = _chunk474IQG74cjs.finishTile.call(void 0, out, 4, 0);
1796
1798
  if (t) tiles.set(tk, t);
1797
1799
  else tiles.delete(tk);
1798
- this.setBase(lane.id, new (0, _chunkCWM3CUUXcjs.TiledSurface)(4, tiles, 0));
1800
+ this.setBase(lane.id, new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0));
1799
1801
  return true;
1800
1802
  }
1801
1803
  /**
@@ -1807,7 +1809,7 @@ var WetWorld = (_class = class {
1807
1809
  const [tx, ty] = this.tileXY(key);
1808
1810
  const b = this.slotBase(this.slotOf(key));
1809
1811
  const cur = b + this.parity * SET_PLANES * PLANE;
1810
- const out = src ? new Uint8ClampedArray(src) : new Uint8ClampedArray(_chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE * 4);
1812
+ const out = src ? new Uint8ClampedArray(src) : new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4);
1811
1813
  const w = Math.min(WET_TILE, this.width - tx * WET_TILE);
1812
1814
  const h = Math.min(WET_TILE, this.height - ty * WET_TILE);
1813
1815
  const changed = shadeTile(
@@ -1836,11 +1838,11 @@ var WetWorld = (_class = class {
1836
1838
  const tk = this.tileKeyOf(key);
1837
1839
  const out = this.shadeSlot(key, _nullishCoalesce(_optionalChain([lane, 'access', _24 => _24.base, 'access', _25 => _25.tiles, 'access', _26 => _26.get, 'call', _27 => _27(tk), 'optionalAccess', _28 => _28.data]), () => ( null)), "bake-all");
1838
1840
  if (!out) continue;
1839
- const t = _chunkCWM3CUUXcjs.finishTile.call(void 0, out, 4, 0);
1841
+ const t = _chunk474IQG74cjs.finishTile.call(void 0, out, 4, 0);
1840
1842
  if (t) tiles.set(tk, t);
1841
1843
  else tiles.delete(tk);
1842
1844
  }
1843
- return new (0, _chunkCWM3CUUXcjs.TiledSurface)(4, tiles, 0);
1845
+ return new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0);
1844
1846
  }
1845
1847
  // --- Reading -------------------------------------------------------------------
1846
1848
  /**
@@ -1949,7 +1951,7 @@ var WetWorld = (_class = class {
1949
1951
  const tk = this.tileKeyOf(key);
1950
1952
  const src = _nullishCoalesce(_optionalChain([lane, 'access', _41 => _41.base, 'access', _42 => _42.tiles, 'access', _43 => _43.get, 'call', _44 => _44(tk), 'optionalAccess', _45 => _45.data]), () => ( null));
1951
1953
  const out = this.shadeSlot(key, src, "display");
1952
- const tile = out ? _chunkCWM3CUUXcjs.finishTile.call(void 0, out, 4, 0) : _nullishCoalesce(lane.base.tiles.get(tk), () => ( null));
1954
+ const tile = out ? _chunk474IQG74cjs.finishTile.call(void 0, out, 4, 0) : _nullishCoalesce(lane.base.tiles.get(tk), () => ( null));
1953
1955
  lane.shaded.set(tk, { stamp: lane.stamp, tile: _nullishCoalesce(tile, () => ( { data: new Uint8ClampedArray(0), uniform: 0 })) });
1954
1956
  lane.shadedVersion++;
1955
1957
  lane.urgent.delete(tk);
@@ -1966,7 +1968,7 @@ var WetWorld = (_class = class {
1966
1968
  if (tile.data.length === 0) tiles.delete(tk);
1967
1969
  else tiles.set(tk, tile);
1968
1970
  }
1969
- lane.display = new (0, _chunkCWM3CUUXcjs.TiledSurface)(4, tiles, 0);
1971
+ lane.display = new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0);
1970
1972
  lane.displayKey = displayKey;
1971
1973
  return { surface: lane.display, changed, pending: stale.length - done };
1972
1974
  }
@@ -1981,7 +1983,7 @@ var WetWorld = (_class = class {
1981
1983
  const slot = this.slotOf(lane.index * perLane + ty * tilesX + tx);
1982
1984
  if (slot < 0) return null;
1983
1985
  const cur = this.slotBase(slot) + this.parity * SET_PLANES * PLANE;
1984
- const out = new Uint8ClampedArray(_chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE * 4);
1986
+ const out = new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4);
1985
1987
  let any = false;
1986
1988
  for (let y = 0; y < WET_TILE; y++) {
1987
1989
  for (let x = 0; x < WET_TILE; x++) {
@@ -1990,7 +1992,7 @@ var WetWorld = (_class = class {
1990
1992
  const sw = this.f32[cur + P_SW * PLANE + c];
1991
1993
  const a = Math.min(1, rho * 2.5) * 0.7 + Math.min(1, sw * 4) * 0.2;
1992
1994
  if (a <= 4e-3) continue;
1993
- const i = (y * _chunkCWM3CUUXcjs.TILE + x) * 4;
1995
+ const i = (y * _chunk474IQG74cjs.TILE + x) * 4;
1994
1996
  out[i] = 40;
1995
1997
  out[i + 1] = 120;
1996
1998
  out[i + 2] = 255;
@@ -2167,7 +2169,7 @@ var WetWorld = (_class = class {
2167
2169
  const changed = [];
2168
2170
  stale.forEach((key, i) => {
2169
2171
  const tk = this.tileKeyOf(key);
2170
- const tile = _chunkCWM3CUUXcjs.finishTile.call(void 0, new Uint8ClampedArray(tiles[i]), 4, 0);
2172
+ const tile = _chunk474IQG74cjs.finishTile.call(void 0, new Uint8ClampedArray(tiles[i]), 4, 0);
2171
2173
  lane.shaded.set(tk, { stamp: lane.stamp, tile: _nullishCoalesce(tile, () => ( { data: new Uint8ClampedArray(0), uniform: 0 })) });
2172
2174
  lane.urgent.delete(tk);
2173
2175
  const [tx, ty] = this.tileXY(key);