@pixerate/editor 0.249.0 → 0.250.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 (69) hide show
  1. package/dist/animation-editor/index.cjs +114 -113
  2. package/dist/animation-editor/index.js +7 -6
  3. package/dist/{brushstrokeRender-T3JZST44.js → brushstrokeRender-2FHFLSEG.js} +4 -3
  4. package/dist/{brushstrokeRender-GCKK7V2I.cjs → brushstrokeRender-QGRXOKDA.cjs} +7 -6
  5. package/dist/canvas/index.cjs +71 -15
  6. package/dist/canvas/index.d.cts +1 -0
  7. package/dist/canvas/index.d.ts +1 -0
  8. package/dist/canvas/index.js +58 -2
  9. package/dist/canvas/stickers.d.cts +35 -0
  10. package/dist/canvas/stickers.d.ts +35 -0
  11. package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
  12. package/dist/{chunk-UBRJOIR5.js → chunk-3TWOCSCY.js} +1 -1
  13. package/dist/{chunk-ZEYMKDYS.cjs → chunk-4JNWA3VT.cjs} +53 -20
  14. package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
  15. package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
  16. package/dist/{chunk-LJRCU3BJ.cjs → chunk-ATK6ABN3.cjs} +15 -13
  17. package/dist/{chunk-H4AOUUBE.cjs → chunk-GT77U7QG.cjs} +18 -16
  18. package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
  19. package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
  20. package/dist/{chunk-PZP2SZIZ.js → chunk-KDLBJ6QR.js} +1 -1
  21. package/dist/{chunk-LP2MCSBE.cjs → chunk-M2VKFE5L.cjs} +86 -86
  22. package/dist/{chunk-DOIU7VJG.js → chunk-NOHJP5TK.js} +1 -1
  23. package/dist/{chunk-O75V4ZS3.js → chunk-NTRAVM2I.js} +1 -1
  24. package/dist/{chunk-J7T5QZ45.js → chunk-OTEPAQJX.js} +4 -2
  25. package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
  26. package/dist/{chunk-6BIDVPED.js → chunk-SMSGP2HQ.js} +1 -1
  27. package/dist/chunk-SZTI6EER.js +13 -0
  28. package/dist/{chunk-EJLRBS5Q.js → chunk-U4NUOKBT.js} +4 -2
  29. package/dist/chunk-U67EN7GG.cjs +13 -0
  30. package/dist/{chunk-5RH3VXAK.js → chunk-WKH5ZAUA.js} +45 -12
  31. package/dist/{chunk-IOFVM3L3.cjs → chunk-WPUXGDH4.cjs} +2 -2
  32. package/dist/{chunk-2SMMZDMG.cjs → chunk-X7WRL5ZZ.cjs} +35 -35
  33. package/dist/{chunk-WLJZZHUZ.cjs → chunk-YM6ZBTXG.cjs} +23 -23
  34. package/dist/{chunk-KYX7NZ5V.cjs → chunk-YW43M56C.cjs} +1 -1
  35. package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
  36. package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
  37. package/dist/effects/helpers.d.cts +6 -0
  38. package/dist/effects/helpers.d.ts +6 -0
  39. package/dist/effects/index.cjs +62 -60
  40. package/dist/effects/index.js +5 -3
  41. package/dist/effects/tools.d.cts +6 -0
  42. package/dist/effects/tools.d.ts +6 -0
  43. package/dist/image-editor/effects.d.cts +1 -1
  44. package/dist/image-editor/effects.d.ts +1 -1
  45. package/dist/image-editor/index.cjs +814 -791
  46. package/dist/image-editor/index.d.cts +1 -0
  47. package/dist/image-editor/index.d.ts +1 -0
  48. package/dist/image-editor/index.js +35 -12
  49. package/dist/image-editor/stickers.d.cts +9 -0
  50. package/dist/image-editor/stickers.d.ts +9 -0
  51. package/dist/paint-editor/index.cjs +165 -164
  52. package/dist/paint-editor/index.js +8 -7
  53. package/dist/stickers/index.cjs +22 -16
  54. package/dist/stickers/index.d.cts +1 -1
  55. package/dist/stickers/index.d.ts +1 -1
  56. package/dist/stickers/index.js +9 -3
  57. package/dist/stickers/tools.d.cts +57 -1
  58. package/dist/stickers/tools.d.ts +57 -1
  59. package/dist/vector/index.cjs +1003 -969
  60. package/dist/vector/index.d.cts +1 -0
  61. package/dist/vector/index.d.ts +1 -0
  62. package/dist/vector/index.js +40 -6
  63. package/dist/vector/stickers.d.cts +11 -0
  64. package/dist/vector/stickers.d.ts +11 -0
  65. package/dist/video-editor/index.cjs +344 -344
  66. package/dist/video-editor/index.js +4 -4
  67. package/package.json +1 -1
  68. package/skills/pixerate-image-editor/SKILL.md +1 -1
  69. package/skills/pixerate-stickers/SKILL.md +13 -1
@@ -72,3 +72,4 @@ export * from './editorDocument.cjs';
72
72
  export * from './paths.cjs';
73
73
  export * from './path-edit.cjs';
74
74
  export * from './content-aware-fill-session.cjs';
75
+ export * from './stickers.cjs';
@@ -72,3 +72,4 @@ export * from './editorDocument.js';
72
72
  export * from './paths.js';
73
73
  export * from './path-edit.js';
74
74
  export * from './content-aware-fill-session.js';
75
+ export * from './stickers.js';
@@ -8,7 +8,7 @@ import {
8
8
  parseOpenTypeFont,
9
9
  removeAnchorsKeepingShape,
10
10
  traceField
11
- } from "../chunk-DOIU7VJG.js";
11
+ } from "../chunk-NOHJP5TK.js";
12
12
  import {
13
13
  ColorGmm,
14
14
  GAMMA,
@@ -413,7 +413,7 @@ import {
413
413
  writePsd,
414
414
  xyToTempTint,
415
415
  xyToUv
416
- } from "../chunk-UBRJOIR5.js";
416
+ } from "../chunk-3TWOCSCY.js";
417
417
  import {
418
418
  parseCssColor
419
419
  } from "../chunk-3CI7FRMK.js";
@@ -743,9 +743,9 @@ import {
743
743
  warpMeshParamAt,
744
744
  warpMeshRows,
745
745
  warpPresetMesh
746
- } from "../chunk-PZP2SZIZ.js";
747
- import "../chunk-J7T5QZ45.js";
748
- import "../chunk-5RH3VXAK.js";
746
+ } from "../chunk-KDLBJ6QR.js";
747
+ import "../chunk-OTEPAQJX.js";
748
+ import "../chunk-WKH5ZAUA.js";
749
749
  import "../chunk-M6DNZNVY.js";
750
750
  import {
751
751
  bezierPathToSvg,
@@ -753,6 +753,7 @@ import {
753
753
  segmentNearest
754
754
  } from "../chunk-WEIK3UYB.js";
755
755
  import "../chunk-PWBZH3FK.js";
756
+ import "../chunk-SZTI6EER.js";
756
757
  import {
757
758
  EffectRendererPool
758
759
  } from "../chunk-EHLOCVWB.js";
@@ -761,9 +762,10 @@ import {
761
762
  EffectsSlot,
762
763
  createEffectPixels,
763
764
  createEffectToolProvider,
765
+ layerImageInput,
764
766
  linearToSrgb,
765
767
  resolveEffectValues
766
- } from "../chunk-OFH6Q67U.js";
768
+ } from "../chunk-JA57JIT5.js";
767
769
  import "../chunk-V2ZCJRDM.js";
768
770
  import {
769
771
  BrushstrokeCache,
@@ -4847,14 +4849,15 @@ function effectLayerTiming(g, d) {
4847
4849
 
4848
4850
  // src/image-editor/effects.ts
4849
4851
  var IMAGE_EFFECT_PLACES = {
4850
- /** A smart filter: the effect changes the pixels below it. */
4852
+ /** A smart filter: the effect changes the pixels below it (and any effect that takes a picture: the layer is its input). */
4851
4853
  filter: ["filter"],
4852
4854
  /** An effect layer: drawn at the document's size. */
4853
4855
  layer: ["generator", "overlay", "title"]
4854
4856
  };
4855
4857
  function checkImageEffectPlace(d, place) {
4856
4858
  const allowed = IMAGE_EFFECT_PLACES[place];
4857
- if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
4859
+ const takesLayer = place === "filter" && layerImageInput(d) !== null;
4860
+ if (d.kind === "motion" || !takesLayer && !d.uses.some((u) => allowed.includes(u))) {
4858
4861
  const instead = place === "filter" && d.uses.some((u) => IMAGE_EFFECT_PLACES.layer.includes(u)) ? "; add it as an effect layer with add_effect_layer instead" : place === "layer" && d.uses.includes("filter") ? "; apply it to a layer as a smart filter with apply_effect instead" : "";
4859
4862
  throw new EffectUnsupportedError(
4860
4863
  `"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect, and ${place === "filter" ? "a smart filter takes filter effects" : "an effect layer takes generator, overlay or title effects"}${instead}.`,
@@ -4947,9 +4950,9 @@ var ImageEffectsEngine = class {
4947
4950
  /** A filter effect over `source`: its result, or (for an overlay) the effect drawn over it. */
4948
4951
  async filter(provider, effect, values, source) {
4949
4952
  const d = await this.describe(provider, effect);
4950
- const takesSource = d.inputs.some((i) => i.name === "source");
4951
- const out = await this.render(provider, effect, source.width, source.height, 8, { time: 0, values, ...takesSource ? { inputs: { source } } : {} });
4952
- return takesSource ? out.data : over(source.data, out.data);
4953
+ const input = layerImageInput(d);
4954
+ const out = await this.render(provider, effect, source.width, source.height, 8, { time: 0, values, ...input ? { inputs: { [input]: source } } : {} });
4955
+ return input ? out.data : over(source.data, out.data);
4953
4956
  }
4954
4957
  /**
4955
4958
  * Renders a generator or overlay effect at a size and depth (an effect layer's pixels). Rejects
@@ -21496,7 +21499,8 @@ function createImageEffectsToolProvider(controller, options = {}) {
21496
21499
  skill: "pixerate-image-editor",
21497
21500
  target: { noun: "layer", id: "A layer id from list_layers." },
21498
21501
  applyUses: ["filter"],
21499
- applyDetails: "The effect becomes a smart filter: it runs on the layer's pixels after the smart filters below it, with its own blend and opacity, under the smart filter mask, and can be changed or removed later. It keeps the layer's transparency by default (preserveTransparency: the result only changes the layer's own pixels, never fills transparent ones); preserveTransparency false lets it draw over the whole canvas. A pixel, shape or type layer (or a group) is converted to a smart object first, in the same undo step (one layer keeps its id; the result says converted). With a selection, the filter mask is set from it in the same step, so the filter only changes the selected area (the result says masked); deselect first to filter the whole layer. Generators and overlays go on their own layer through add_effect_layer.",
21502
+ applyImageInputs: true,
21503
+ applyDetails: "Any effect that takes a picture also applies (an inserted sticker into a holo-foil treatment): the layer is its picture. The effect becomes a smart filter: it runs on the layer's pixels after the smart filters below it, with its own blend and opacity, under the smart filter mask, and can be changed or removed later. It keeps the layer's transparency by default (preserveTransparency: the result only changes the layer's own pixels, never fills transparent ones); preserveTransparency false lets it draw over the whole canvas. A pixel, shape or type layer (or a group) is converted to a smart object first, in the same undo step (one layer keeps its id; the result says converted). With a selection, the filter mask is set from it in the same step, so the filter only changes the selected area (the result says masked); deselect first to filter the whole layer. Generators and overlays go on their own layer through add_effect_layer.",
21500
21504
  provider: () => controller.effectsProvider,
21501
21505
  readOnlyReason,
21502
21506
  applyOptions: {
@@ -22486,6 +22490,24 @@ var ContentAwareFillSession = class _ContentAwareFillSession {
22486
22490
  return this.controller.contentAwareFillAsync({ layerId: this.plan.layerId, samplingArea: area, seed: this.settingsValue.seed, output: this.settingsValue.output, signal: options.signal });
22487
22491
  }
22488
22492
  };
22493
+
22494
+ // src/image-editor/stickers.ts
22495
+ function createImageStickerHost(controller) {
22496
+ return {
22497
+ noun: "pixel layer",
22498
+ format: "png",
22499
+ defaultCentre: () => {
22500
+ const { width, height } = controller.getCanvasSize();
22501
+ return { x: width / 2, y: height / 2 };
22502
+ },
22503
+ async insert({ asset, description, x, y }) {
22504
+ const image = asset.kind === "image" ? asset.url : `data:image/svg+xml;charset=utf-8,${encodeURIComponent(asset.svg)}`;
22505
+ const pixels = await controller.decodeImage(image);
22506
+ const id = controller.addPixelLayer({ name: description.name, pixels, x: Math.round(x - pixels.width / 2), y: Math.round(y - pixels.height / 2) });
22507
+ return { id, layerWidth: pixels.width, layerHeight: pixels.height };
22508
+ }
22509
+ };
22510
+ }
22489
22511
  export {
22490
22512
  ADJUSTMENT_KEYS,
22491
22513
  ADJUSTMENT_KINDS,
@@ -22922,6 +22944,7 @@ export {
22922
22944
  createImageSelectionTools,
22923
22945
  createImageShapeTools,
22924
22946
  createImageSmartObjectTools,
22947
+ createImageStickerHost,
22925
22948
  createImageSubjectSelectionTool,
22926
22949
  createImageTransformTools,
22927
22950
  createImageTypeTools,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Stickers in the image editor: `insert_sticker` (see `@pixerate/editor/stickers`) puts a
3
+ * sticker's art in as a new pixel layer, centred where asked. The layer can then take any effect
4
+ * that takes a picture (`apply_effect`): the sticker is the effect's input.
5
+ */
6
+ import type { StickerInsertHost } from '../stickers/tools.cjs';
7
+ import type { ImageEditorController } from './controller.cjs';
8
+ /** `insert_sticker` for an image editor: a new pixel layer named after the sticker, one undo step. */
9
+ export declare function createImageStickerHost(controller: ImageEditorController): StickerInsertHost;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Stickers in the image editor: `insert_sticker` (see `@pixerate/editor/stickers`) puts a
3
+ * sticker's art in as a new pixel layer, centred where asked. The layer can then take any effect
4
+ * that takes a picture (`apply_effect`): the sticker is the effect's input.
5
+ */
6
+ import type { StickerInsertHost } from '../stickers/tools.js';
7
+ import type { ImageEditorController } from './controller.js';
8
+ /** `insert_sticker` for an image editor: a new pixel layer named after the sticker, one undo step. */
9
+ export declare function createImageStickerHost(controller: ImageEditorController): StickerInsertHost;