@pixerate/editor 0.118.0 → 0.119.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/THIRD_PARTY_NOTICES.md +1 -0
  2. package/dist/animation-editor/index.cjs +54 -54
  3. package/dist/animation-editor/index.d.cts +3 -3
  4. package/dist/animation-editor/index.d.ts +3 -3
  5. package/dist/animation-editor/index.js +2 -2
  6. package/dist/{chunk-2J3LS7JZ.cjs → chunk-4S2AXNQF.cjs} +221 -186
  7. package/dist/chunk-4S2AXNQF.cjs.map +1 -0
  8. package/dist/{chunk-7LNZAWSJ.js → chunk-CSHEI3YT.js} +625 -451
  9. package/dist/chunk-CSHEI3YT.js.map +1 -0
  10. package/dist/{chunk-M7O4BJRH.cjs → chunk-KGNUFO4T.cjs} +36 -36
  11. package/dist/{chunk-M7O4BJRH.cjs.map → chunk-KGNUFO4T.cjs.map} +1 -1
  12. package/dist/{chunk-R2JE6SA7.js → chunk-KZLQY4CD.js} +42 -7
  13. package/dist/chunk-KZLQY4CD.js.map +1 -0
  14. package/dist/{chunk-L2T6EJ5S.cjs → chunk-L3PXFMOF.cjs} +38 -25
  15. package/dist/chunk-L3PXFMOF.cjs.map +1 -0
  16. package/dist/{chunk-FODKPD44.cjs → chunk-LI3KTY7K.cjs} +724 -550
  17. package/dist/chunk-LI3KTY7K.cjs.map +1 -0
  18. package/dist/{chunk-IVSNUXW7.js → chunk-T7IZDNSL.js} +37 -24
  19. package/dist/chunk-T7IZDNSL.js.map +1 -0
  20. package/dist/{chunk-T2P5TIZ6.js → chunk-TDQDMBUR.js} +2 -2
  21. package/dist/{chunk-BYAWOAST.cjs → chunk-TS5IEUW6.cjs} +26 -25
  22. package/dist/chunk-TS5IEUW6.cjs.map +1 -0
  23. package/dist/{chunk-VD2UDVF7.js → chunk-UMVW2Q66.js} +21 -5
  24. package/dist/chunk-UMVW2Q66.js.map +1 -0
  25. package/dist/{chunk-EBSYZRSW.cjs → chunk-WMRIG4XQ.cjs} +21 -5
  26. package/dist/chunk-WMRIG4XQ.cjs.map +1 -0
  27. package/dist/{chunk-JHXMNOMF.js → chunk-YHW26LS2.js} +14 -13
  28. package/dist/chunk-YHW26LS2.js.map +1 -0
  29. package/dist/{export-DMOuzgZZ.d.cts → export-B_jO2PrH.d.cts} +18 -4
  30. package/dist/{export-Dul1SbPv.d.ts → export-Ds8Ccw0K.d.ts} +18 -4
  31. package/dist/{flow-4-OC-UkQ.d.cts → flow-A2Dj-69w.d.cts} +21 -9
  32. package/dist/{flow-Cb7lkPm8.d.ts → flow-C95atNoQ.d.ts} +21 -9
  33. package/dist/image-editor/index.cjs +1104 -979
  34. package/dist/image-editor/index.cjs.map +1 -1
  35. package/dist/image-editor/index.d.cts +5 -5
  36. package/dist/image-editor/index.d.ts +5 -5
  37. package/dist/image-editor/index.js +157 -32
  38. package/dist/image-editor/index.js.map +1 -1
  39. package/dist/paint/index.cjs +5 -3
  40. package/dist/paint/index.cjs.map +1 -1
  41. package/dist/paint/index.d.cts +2 -2
  42. package/dist/paint/index.d.ts +2 -2
  43. package/dist/paint/index.js +4 -2
  44. package/dist/paint-editor/index.cjs +147 -147
  45. package/dist/paint-editor/index.d.cts +4 -4
  46. package/dist/paint-editor/index.d.ts +4 -4
  47. package/dist/paint-editor/index.js +4 -4
  48. package/dist/raster/index.cjs +2 -2
  49. package/dist/raster/index.js +1 -1
  50. package/dist/{svg-DlEuhwoX.d.ts → svg-CTxrB5xO.d.ts} +5 -1
  51. package/dist/{svg-CVdFc80-.d.cts → svg-hK0WQc7-.d.cts} +5 -1
  52. package/dist/{types-Tfly4Aya.d.cts → types-Dq-8qgoo.d.cts} +45 -3
  53. package/dist/{types-CDLGhAZp.d.ts → types-TrSSh_RB.d.ts} +45 -3
  54. package/dist/vector/index.cjs +1312 -1009
  55. package/dist/vector/index.cjs.map +1 -1
  56. package/dist/vector/index.d.cts +103 -5
  57. package/dist/vector/index.d.ts +103 -5
  58. package/dist/vector/index.js +317 -14
  59. package/dist/vector/index.js.map +1 -1
  60. package/package.json +1 -1
  61. package/skills/pixerate-image-editor/references/photoshop-files.md +5 -2
  62. package/skills/pixerate-vector/SKILL.md +13 -1
  63. package/skills/pixerate-vector/references/commands.md +1 -0
  64. package/dist/chunk-2J3LS7JZ.cjs.map +0 -1
  65. package/dist/chunk-7LNZAWSJ.js.map +0 -1
  66. package/dist/chunk-BYAWOAST.cjs.map +0 -1
  67. package/dist/chunk-EBSYZRSW.cjs.map +0 -1
  68. package/dist/chunk-FODKPD44.cjs.map +0 -1
  69. package/dist/chunk-IVSNUXW7.js.map +0 -1
  70. package/dist/chunk-JHXMNOMF.js.map +0 -1
  71. package/dist/chunk-L2T6EJ5S.cjs.map +0 -1
  72. package/dist/chunk-R2JE6SA7.js.map +0 -1
  73. package/dist/chunk-VD2UDVF7.js.map +0 -1
  74. /package/dist/{chunk-T2P5TIZ6.js.map → chunk-TDQDMBUR.js.map} +0 -0
@@ -418,6 +418,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
418
418
  function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
419
419
  const linear = samples instanceof Float32Array;
420
420
  const scale = linear ? 1 : 65535;
421
+ const n = options.channels ?? 4;
421
422
  const out = (options.into ?? samples).slice();
422
423
  const ox = tx * TILE + s.offset.x;
423
424
  const oy = ty * TILE + s.offset.y;
@@ -432,8 +433,9 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
432
433
  x1 = Math.min(TILE, Math.ceil(r.x + r.width) - ox);
433
434
  y1 = Math.min(TILE, Math.ceil(r.y + r.height) - oy);
434
435
  if (x1 <= x0 || y1 <= y0) return out;
435
- if (options.into) for (let y = y0; y < y1; y++) out.set(samples.subarray((y * TILE + x0) * 4, (y * TILE + x1) * 4), (y * TILE + x0) * 4);
436
+ if (options.into) for (let y = y0; y < y1; y++) out.set(samples.subarray((y * TILE + x0) * n, (y * TILE + x1) * n), (y * TILE + x0) * n);
436
437
  }
438
+ const grey = (s.mode === "erase" ? s.background[0] : s.color[0]) / 255 * scale;
437
439
  const colour = (c) => {
438
440
  const v = [c[0] / 255, c[1] / 255, c[2] / 255, c[3] / 255];
439
441
  if (linear) for (let k = 0; k < 3; k++) v[k] = srgbDecode(v[k]);
@@ -461,6 +463,12 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
461
463
  }
462
464
  if (k > 1) k = 1;
463
465
  if (k <= 0) continue;
466
+ if (n === 1) {
467
+ const p = y * TILE + x;
468
+ const v = out[p] + (grey - out[p]) * k;
469
+ out[p] = linear ? v : Math.round(v);
470
+ continue;
471
+ }
464
472
  const i = (y * TILE + x) * 4;
465
473
  if (s.mode === "erase" && !s.lockTransparency) {
466
474
  put(i + 3, out[i + 3] / scale * (1 - k));
@@ -597,6 +605,10 @@ var PaintExchange = class {
597
605
  this.amount *= 1 - this.rates.drain;
598
606
  }
599
607
  };
608
+ function put255(px, i, v) {
609
+ if (px instanceof Float32Array) px[i] = v > 0 ? v * 255 : 0;
610
+ else px[i] = Math.round(v * 255);
611
+ }
600
612
  var TileMedium = class {
601
613
  constructor(target, options = {}) {
602
614
  this.target = target;
@@ -716,10 +728,10 @@ var TileMedium = class {
716
728
  src[1] = pg;
717
729
  src[2] = pb;
718
730
  const r = blendPixel(blend, cb, src, k);
719
- px[i] = Math.round(r[0] * 255);
720
- px[i + 1] = Math.round(r[1] * 255);
721
- px[i + 2] = Math.round(r[2] * 255);
722
- if (!t.lockTransparency) px[i + 3] = Math.round(r[3] * 255);
731
+ put255(px, i, r[0]);
732
+ put255(px, i + 1, r[1]);
733
+ put255(px, i + 2, r[2]);
734
+ if (!t.lockTransparency) put255(px, i + 3, r[3]);
723
735
  continue;
724
736
  }
725
737
  const a = px[i + 3] / 255;
@@ -730,10 +742,10 @@ var TileMedium = class {
730
742
  o[1] = pg;
731
743
  o[2] = pb;
732
744
  } else if (pigment && field) {
733
- mixPigment8(px[i], px[i + 1], px[i + 2], Math.round(pr * 255), Math.round(pg * 255), Math.round(pb * 255), share, o);
745
+ mixPigment8(Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2]), Math.round(pr * 255), Math.round(pg * 255), Math.round(pb * 255), share, o);
734
746
  } else if (pigment) {
735
- const key = px[i] << 16 | px[i + 1] << 8 | px[i + 2];
736
- if (key !== lastKey) {
747
+ const key = px instanceof Float32Array ? -2 : px[i] << 16 | px[i + 1] << 8 | px[i + 2];
748
+ if (key !== lastKey || key === -2) {
737
749
  setPigmentColor(this.canvasPig, px[i] / 255, px[i + 1] / 255, px[i + 2] / 255);
738
750
  lastKey = key;
739
751
  }
@@ -752,10 +764,10 @@ var TileMedium = class {
752
764
  o[1] = px[i + 1] / 255 + (pg - px[i + 1] / 255) * share;
753
765
  o[2] = px[i + 2] / 255 + (pb - px[i + 2] / 255) * share;
754
766
  }
755
- px[i] = Math.round(o[0] * 255);
756
- px[i + 1] = Math.round(o[1] * 255);
757
- px[i + 2] = Math.round(o[2] * 255);
758
- px[i + 3] = Math.round(na * 255);
767
+ put255(px, i, o[0]);
768
+ put255(px, i + 1, o[1]);
769
+ put255(px, i + 2, o[2]);
770
+ put255(px, i + 3, na);
759
771
  }
760
772
  }
761
773
  }
@@ -904,7 +916,7 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch2) {
904
916
  const a = px[i + 3] / 255;
905
917
  if (a > 0) {
906
918
  if (pigment) {
907
- const p = pigment8(px[i], px[i + 1], px[i + 2]);
919
+ const p = pigment8(Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2]));
908
920
  const sa = p.scatter * p.strength * a;
909
921
  for (let k = 0; k < N; k++) row[k] += sa * p.ks[k];
910
922
  row[N] += sa;
@@ -952,7 +964,7 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch2) {
952
964
  if (asum <= 1e-9) {
953
965
  if (lock || a <= 0) continue;
954
966
  const i2 = medium.locate(dx, dy, true);
955
- medium.pixels[i2 + 3] = Math.round(na * 255);
967
+ put255(medium.pixels, i2 + 3, na);
956
968
  continue;
957
969
  }
958
970
  const share = lock ? t : na > 0 ? t * avgA / na : 1;
@@ -963,17 +975,17 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch2) {
963
975
  for (let c = 0; c < N; c++) mixPig.ks[c] = sum(c, x1, y1, x2, y2) / sa;
964
976
  mixPig.scatter = sa / asum;
965
977
  if (a <= 0 || share >= 1) lerpPigmentInto(mixPig, mixPig, 0, out, 0);
966
- else lerpPigmentInto(pigment8(px[i], px[i + 1], px[i + 2]), mixPig, share, out, 0);
978
+ else lerpPigmentInto(pigment8(Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2])), mixPig, share, out, 0);
967
979
  } else {
968
980
  for (let c = 0; c < 3; c++) {
969
981
  const m = sum(c, x1, y1, x2, y2) / asum;
970
982
  out[c] = a <= 0 || share >= 1 ? m : px[i + c] / 255 + (m - px[i + c] / 255) * share;
971
983
  }
972
984
  }
973
- px[i] = Math.round(out[0] * 255);
974
- px[i + 1] = Math.round(out[1] * 255);
975
- px[i + 2] = Math.round(out[2] * 255);
976
- if (!lock) px[i + 3] = Math.round(na * 255);
985
+ put255(px, i, out[0]);
986
+ put255(px, i + 1, out[1]);
987
+ put255(px, i + 2, out[2]);
988
+ if (!lock) put255(px, i + 3, na);
977
989
  }
978
990
  }
979
991
  }
@@ -1078,10 +1090,10 @@ var SmudgeTip = class {
1078
1090
  }
1079
1091
  const i = medium.locate(dx, dy, true);
1080
1092
  const out = medium.pixels;
1081
- out[i] = Math.round(r * 255);
1082
- out[i + 1] = Math.round(g * 255);
1083
- out[i + 2] = Math.round(b * 255);
1084
- out[i + 3] = Math.round(na * 255);
1093
+ put255(out, i, r);
1094
+ put255(out, i + 1, g);
1095
+ put255(out, i + 2, b);
1096
+ put255(out, i + 3, na);
1085
1097
  }
1086
1098
  const pick = (1 - length) * Math.min(1, cv * d.opacity);
1087
1099
  if (pick > 0) {
@@ -3241,6 +3253,7 @@ export {
3241
3253
  MIXER_DRAIN,
3242
3254
  exchangeRates,
3243
3255
  PaintExchange,
3256
+ put255,
3244
3257
  TileMedium,
3245
3258
  DEFAULT_MIXER,
3246
3259
  normalizeMixer,
@@ -3336,4 +3349,4 @@ export {
3336
3349
  flowField,
3337
3350
  WetMedium
3338
3351
  };
3339
- //# sourceMappingURL=chunk-IVSNUXW7.js.map
3352
+ //# sourceMappingURL=chunk-T7IZDNSL.js.map