@pixerate/editor 0.130.0 → 0.132.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 (72) hide show
  1. package/dist/animation-editor/index.cjs +55 -55
  2. package/dist/animation-editor/index.d.cts +4 -4
  3. package/dist/animation-editor/index.d.ts +4 -4
  4. package/dist/animation-editor/index.js +2 -2
  5. package/dist/{bezier-CigmusV_.d.ts → bezier-0IHDCvv_.d.ts} +1 -1
  6. package/dist/{bezier-CdoGygwG.d.cts → bezier-oCBfrGDG.d.cts} +1 -1
  7. package/dist/canvas/index.d.cts +7 -7
  8. package/dist/canvas/index.d.ts +7 -7
  9. package/dist/{chunk-PMHPXCJC.cjs → chunk-55UEZIU4.cjs} +119 -90
  10. package/dist/chunk-55UEZIU4.cjs.map +1 -0
  11. package/dist/{chunk-L5OTIYOO.js → chunk-ECVI5QRE.js} +2 -2
  12. package/dist/{chunk-ERYGCA72.js → chunk-G5FX56KX.js} +39 -10
  13. package/dist/{chunk-ERYGCA72.js.map → chunk-G5FX56KX.js.map} +1 -1
  14. package/dist/{chunk-PRYMC442.js → chunk-IEYXYMRQ.js} +255 -10
  15. package/dist/chunk-IEYXYMRQ.js.map +1 -0
  16. package/dist/{chunk-2PXRKMOH.cjs → chunk-OYPJGGF3.cjs} +36 -36
  17. package/dist/{chunk-2PXRKMOH.cjs.map → chunk-OYPJGGF3.cjs.map} +1 -1
  18. package/dist/{chunk-LXGOYRPE.cjs → chunk-YYJKIESX.cjs} +320 -75
  19. package/dist/chunk-YYJKIESX.cjs.map +1 -0
  20. package/dist/effects/index.d.cts +4 -4
  21. package/dist/effects/index.d.ts +4 -4
  22. package/dist/{export-B4r8b9Ft.d.ts → export-ByJvAvR7.d.ts} +26 -4
  23. package/dist/{export-5WDKJqTy.d.cts → export-CfAogLEr.d.cts} +1 -1
  24. package/dist/{export-CU_ARP3A.d.ts → export-Crl82sbE.d.ts} +1 -1
  25. package/dist/{export-CejjC2iI.d.cts → export-D-gkjBkB.d.cts} +26 -4
  26. package/dist/{helpers-X_rycLNJ.d.ts → helpers-BCd2-PAR.d.ts} +34 -1
  27. package/dist/{helpers-CzZu51eI.d.cts → helpers-CoIeXQnW.d.cts} +34 -1
  28. package/dist/image-editor/index.cjs +775 -723
  29. package/dist/image-editor/index.cjs.map +1 -1
  30. package/dist/image-editor/index.d.cts +8 -8
  31. package/dist/image-editor/index.d.ts +8 -8
  32. package/dist/image-editor/index.js +59 -7
  33. package/dist/image-editor/index.js.map +1 -1
  34. package/dist/index.cjs +11 -4
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.js +11 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/{opentype-DlRMYcCW.d.cts → opentype-BDahNRTe.d.cts} +1 -1
  39. package/dist/{opentype-CrHAsKh3.d.ts → opentype-BQFEvy-t.d.ts} +1 -1
  40. package/dist/paint-editor/index.cjs +7 -7
  41. package/dist/paint-editor/index.d.cts +5 -5
  42. package/dist/paint-editor/index.d.ts +5 -5
  43. package/dist/paint-editor/index.js +2 -2
  44. package/dist/{pathfinder-CKfKOVP4.d.cts → pathfinder-01ZgAwqV.d.cts} +1 -1
  45. package/dist/{pathfinder-Dlss70hL.d.ts → pathfinder-DaVdT8jq.d.ts} +1 -1
  46. package/dist/{pool-DDOo0xJH.d.ts → pool-D2A3WTt9.d.ts} +1 -1
  47. package/dist/{pool-DKic69LD.d.cts → pool-D6a45MoE.d.cts} +1 -1
  48. package/dist/{svg-BRaii3pI.d.cts → svg-CcDz7Zq2.d.cts} +2 -2
  49. package/dist/{svg-BYVZeVo0.d.ts → svg-DELNVerw.d.ts} +2 -2
  50. package/dist/{tools-CtheDLDr.d.cts → tools-BFvkFnRj.d.cts} +1 -1
  51. package/dist/{tools-D8bZ-7YG.d.ts → tools-D7ws-OKL.d.ts} +1 -1
  52. package/dist/vector/index.cjs +1136 -1014
  53. package/dist/vector/index.cjs.map +1 -1
  54. package/dist/vector/index.d.cts +63 -10
  55. package/dist/vector/index.d.ts +63 -10
  56. package/dist/vector/index.js +129 -7
  57. package/dist/vector/index.js.map +1 -1
  58. package/dist/video-editor/index.d.cts +4 -4
  59. package/dist/video-editor/index.d.ts +4 -4
  60. package/dist/{warp-CZVC8pB5.d.ts → warp-2N9wkOkL.d.ts} +1 -1
  61. package/dist/{warp-BFoYxy_s.d.cts → warp-DErXW5rz.d.cts} +1 -1
  62. package/package.json +2 -2
  63. package/skills/pixerate-image-editor/SKILL.md +6 -2
  64. package/skills/pixerate-image-editor/references/color-management.md +1 -1
  65. package/skills/pixerate-image-editor/references/photoshop-files.md +2 -2
  66. package/skills/pixerate-image-editor/references/retouching.md +9 -1
  67. package/skills/pixerate-vector/SKILL.md +17 -0
  68. package/skills/pixerate-vector/references/commands.md +19 -0
  69. package/dist/chunk-LXGOYRPE.cjs.map +0 -1
  70. package/dist/chunk-PMHPXCJC.cjs.map +0 -1
  71. package/dist/chunk-PRYMC442.js.map +0 -1
  72. /package/dist/{chunk-L5OTIYOO.js.map → chunk-ECVI5QRE.js.map} +0 -0
@@ -18,7 +18,7 @@ import {
18
18
  unionBounds,
19
19
  vectorGradientPoints,
20
20
  widthProfileAt
21
- } from "./chunk-PRYMC442.js";
21
+ } from "./chunk-IEYXYMRQ.js";
22
22
  import {
23
23
  segmentLength,
24
24
  segmentParamAtLength,
@@ -750,4 +750,4 @@ export {
750
750
  interpolateVectorPaths,
751
751
  evaluateVectorPathKeyframes
752
752
  };
753
- //# sourceMappingURL=chunk-L5OTIYOO.js.map
753
+ //# sourceMappingURL=chunk-ECVI5QRE.js.map
@@ -125,7 +125,7 @@ import {
125
125
  textRectPath,
126
126
  translateMatrix,
127
127
  warpPresetMesh
128
- } from "./chunk-PRYMC442.js";
128
+ } from "./chunk-IEYXYMRQ.js";
129
129
  import {
130
130
  bezierPathBounds,
131
131
  outlineStroke,
@@ -9359,6 +9359,16 @@ function toRgbaDeep(set) {
9359
9359
  };
9360
9360
  const planes = set.color.map((p) => raw(p, cmyk ? 1 : 0));
9361
9361
  const alpha = raw(set.alpha, 1);
9362
+ if (depth === 16 && cmyk && set.cmykToRgb16) {
9363
+ const ink = new Uint16Array(n * 4);
9364
+ const out2 = new Uint16Array(n * 4);
9365
+ for (let i = 0, o = 0; i < n; i++, o += 4) {
9366
+ for (let c = 0; c < 4; c++) ink[o + c] = Math.round((1 - (planes[c] ? planes[c](i) : 1)) * 65535);
9367
+ out2[o + 3] = Math.round(clamp012(alpha(i)) * 65535);
9368
+ }
9369
+ set.cmykToRgb16(ink, out2);
9370
+ return out2;
9371
+ }
9362
9372
  if (depth === 16) {
9363
9373
  const out2 = new Uint16Array(n * 4);
9364
9374
  const q2 = (v) => Math.round(clamp012(v) * 65535);
@@ -9752,9 +9762,10 @@ function recordPixels(ctx, rec, name) {
9752
9762
  color: planes.slice(0, ctx.colorCount),
9753
9763
  alpha: planes[ctx.colorCount],
9754
9764
  palette: ctx.palette,
9755
- cmykToRgb: ctx.cmykToRgb
9765
+ cmykToRgb: ctx.cmykToRgb,
9766
+ cmykToRgb16: ctx.cmykToRgb16
9756
9767
  };
9757
- const deep = set.cmykToRgb ? null : toRgbaDeep(set);
9768
+ const deep = set.cmykToRgb && !set.cmykToRgb16 ? null : toRgbaDeep(set);
9758
9769
  if (deep) return surfaceFromDeepPixels({ width, height, data: deep }, 4, rec.rect.left, rec.rect.top);
9759
9770
  return surfaceFromPixels({ width, height, data: toRgba8(set) }, 4, rec.rect.left, rec.rect.top);
9760
9771
  }
@@ -9772,7 +9783,7 @@ function recordMask(ctx, rec, name) {
9772
9783
  if (width && height && !ctx.skipPixels) {
9773
9784
  const plane = decodeOr(ctx, rec, id, name);
9774
9785
  const depth = ctx.file.header.depth;
9775
- if (plane && (depth === 16 || depth === 32) && ctx.file.header.colorMode !== MODE_CMYK) surface = surfaceFromDeepPixels({ width, height, data: toMaskDeep(plane, width, height, depth) }, 1, rect.left, rect.top, def);
9786
+ if (plane && (depth === 16 || depth === 32)) surface = surfaceFromDeepPixels({ width, height, data: toMaskDeep(plane, width, height, depth) }, 1, rect.left, rect.top, def);
9776
9787
  else if (plane) surface = surfaceFromPixels({ width, height, data: toMask8(plane, width, height, depth) }, 1, rect.left, rect.top, def);
9777
9788
  }
9778
9789
  const mask = { surface, defaultValue: def };
@@ -10164,9 +10175,10 @@ function mergedLayer(ctx) {
10164
10175
  color: Array.from({ length: cc }, (_, i) => plane(i)),
10165
10176
  alpha: hasAlpha ? plane(cc) : void 0,
10166
10177
  palette: ctx.palette,
10167
- cmykToRgb: ctx.cmykToRgb
10178
+ cmykToRgb: ctx.cmykToRgb,
10179
+ cmykToRgb16: ctx.cmykToRgb16
10168
10180
  };
10169
- const deep = hasAlpha || set.cmykToRgb ? null : toRgbaDeep(set);
10181
+ const deep = hasAlpha || set.cmykToRgb && !set.cmykToRgb16 ? null : toRgbaDeep(set);
10170
10182
  let surface;
10171
10183
  if (deep) surface = surfaceFromDeepPixels({ width, height, data: deep }, 4);
10172
10184
  else {
@@ -10225,6 +10237,7 @@ function psdToLayers(file, options = {}) {
10225
10237
  }
10226
10238
  const t = Transform.create(src, srgbProfile(), { intent: "relative", bpc: true });
10227
10239
  ctx.cmykToRgb = (ink, out) => t.convert8(ink, 4, out, 4, false);
10240
+ if (header.depth === 16) ctx.cmykToRgb16 = (ink, out) => t.convert16(ink, 4, out, 4, false);
10228
10241
  }
10229
10242
  for (const block of file.globalBlocks) {
10230
10243
  if (LINKED_FILE_KEYS.includes(block.key)) {
@@ -11091,7 +11104,8 @@ function exportPsd(input) {
11091
11104
  if (width < 1 || height < 1) throw new PsdError("The document is empty.");
11092
11105
  const mode = input.colorMode ?? "rgb";
11093
11106
  if (mode !== "rgb" && !input.colorPlanes) throw new PsdError(`A ${mode.toUpperCase()} file needs colorPlanes to convert the pixels.`);
11094
- if (mode !== "rgb" && depth !== 8) throw new PsdError(`${mode.toUpperCase()} files are written at 8 bits per channel.`);
11107
+ if (mode !== "rgb" && depth === 32) throw new PsdError(`${mode.toUpperCase()} files are written at 8 or 16 bits per channel.`);
11108
+ if (mode !== "rgb" && depth === 16 && !input.colorPlanes16) throw new PsdError(`A 16-bit ${mode.toUpperCase()} file needs colorPlanes16 to convert the pixels.`);
11095
11109
  const colorIds = mode === "cmyk" ? [0, 1, 2, 3] : [0, 1, 2];
11096
11110
  const colorPlanes = (rgba, n2) => mode === "rgb" ? rgbaToPlanes(rgba, n2).slice(0, 3) : input.colorPlanes(rgba, n2);
11097
11111
  const pixelChannels = (rgba, w, h) => {
@@ -11100,6 +11114,14 @@ function exportPsd(input) {
11100
11114
  return [rleChannel(CHANNEL_ALPHA, alpha, w, h, psb), ...colorPlanes(rgba, n2).map((p, i) => rleChannel(i, p, w, h, psb))];
11101
11115
  };
11102
11116
  const surfaceChannels = (surface, bounds) => {
11117
+ if (mode !== "rgb" && depth === 16) {
11118
+ const n2 = bounds.width * bounds.height;
11119
+ const s = readDeepRegion(surface, bounds, 16);
11120
+ const alpha = new Uint16Array(n2);
11121
+ for (let i = 0; i < n2; i++) alpha[i] = s[i * 4 + 3];
11122
+ const planes2 = [alpha, ...input.colorPlanes16(s, n2)];
11123
+ return [CHANNEL_ALPHA, ...colorIds].map((id, i) => rleChannel(id, deepMaskPlane(planes2[i]), bounds.width, bounds.height, psb, 16));
11124
+ }
11103
11125
  if (mode !== "rgb") return pixelChannels(readRegion(surface, bounds), bounds.width, bounds.height);
11104
11126
  const [r, g, b, a2] = surfacePlanes(surface, bounds, depth);
11105
11127
  return [CHANNEL_ALPHA, 0, 1, 2].map((id, i) => rleChannel(id, [a2, r, g, b][i], bounds.width, bounds.height, psb, depth));
@@ -11304,8 +11326,15 @@ function exportPsd(input) {
11304
11326
  let planes = [...colorPlanes(matted, n), ...transparent ? [a] : []].map((p) => planeAtDepth(p, depth));
11305
11327
  const deep = input.mergedDeep;
11306
11328
  if (deep && depth !== 8 && deep.length >= n * 4 && (deep instanceof Uint16Array ? depth === 16 : depth === 32)) {
11307
- const dp = deepToPlanes(matteWhiteDeep(deep), n);
11308
- planes = transparent ? dp : dp.slice(0, 3);
11329
+ const mattedDeep = matteWhiteDeep(deep);
11330
+ if (mode !== "rgb" && mattedDeep instanceof Uint16Array) {
11331
+ const alpha = new Uint16Array(n);
11332
+ for (let i = 0; i < n; i++) alpha[i] = mattedDeep[i * 4 + 3];
11333
+ planes = [...input.colorPlanes16(mattedDeep, n), ...transparent ? [alpha] : []].map(deepMaskPlane);
11334
+ } else {
11335
+ const dp = deepToPlanes(mattedDeep, n);
11336
+ planes = transparent ? dp : dp.slice(0, 3);
11337
+ }
11309
11338
  }
11310
11339
  const planeBytes = n * (depth >> 3);
11311
11340
  const merged2 = new Uint8Array(planeBytes * planes.length);
@@ -11736,4 +11765,4 @@ export {
11736
11765
  smartContentsFile,
11737
11766
  exportPsd
11738
11767
  };
11739
- //# sourceMappingURL=chunk-ERYGCA72.js.map
11768
+ //# sourceMappingURL=chunk-G5FX56KX.js.map