@pixerate/editor 0.264.0 → 0.265.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 (46) hide show
  1. package/dist/animation-editor/index.cjs +60 -61
  2. package/dist/animation-editor/index.js +4 -5
  3. package/dist/brushes/index.cjs +73 -60
  4. package/dist/brushes/index.d.cts +1 -0
  5. package/dist/brushes/index.d.ts +1 -0
  6. package/dist/brushes/index.js +17 -4
  7. package/dist/brushes/preview.d.cts +59 -0
  8. package/dist/brushes/preview.d.ts +59 -0
  9. package/dist/brushes/tools.d.cts +12 -5
  10. package/dist/brushes/tools.d.ts +12 -5
  11. package/dist/{brushstrokeRender-3MOI7PH4.js → brushstrokeRender-4UB6NRJW.js} +11 -4
  12. package/dist/{brushstrokeRender-SMMPIJF2.cjs → brushstrokeRender-JQ2XQRUD.cjs} +22 -15
  13. package/dist/canvas/brushstroke.d.cts +6 -1
  14. package/dist/canvas/brushstroke.d.ts +6 -1
  15. package/dist/canvas/index.cjs +16 -17
  16. package/dist/canvas/index.js +2 -3
  17. package/dist/{chunk-F3KKR6DD.cjs → chunk-5OE4ZZ6V.cjs} +30 -30
  18. package/dist/{chunk-BY5EBP26.cjs → chunk-677777GH.cjs} +3 -3
  19. package/dist/{chunk-G5ADO47G.cjs → chunk-7NQOGWLM.cjs} +3 -2
  20. package/dist/{chunk-WWI6FLH2.js → chunk-7PW6VCNW.js} +2 -2
  21. package/dist/{chunk-CECCP2V7.js → chunk-BLR4KWYQ.js} +1 -1
  22. package/dist/chunk-DEBIFWY6.cjs +77 -0
  23. package/dist/{chunk-KXNZNOEF.cjs → chunk-DGXTEPCU.cjs} +94 -94
  24. package/dist/{chunk-3CI7FRMK.js → chunk-DVPQFMH6.js} +13 -1
  25. package/dist/{chunk-EE7SAYBF.js → chunk-J4SGJCPW.js} +3 -3
  26. package/dist/{chunk-A2IS7EHE.cjs → chunk-JBZRVLXV.cjs} +14 -2
  27. package/dist/{chunk-V7MJ4HIN.cjs → chunk-NOP4Y5AB.cjs} +23 -23
  28. package/dist/{chunk-FQC5TDB6.cjs → chunk-O53MOGXG.cjs} +35 -35
  29. package/dist/{chunk-4OJC4MCD.js → chunk-Q6RVVJW6.js} +1 -1
  30. package/dist/{chunk-HAUDEVMC.js → chunk-WY23AUCA.js} +2 -2
  31. package/dist/{chunk-JEML4FSA.js → chunk-XDNWQMHY.js} +3 -2
  32. package/dist/{chunk-ROBSFJ6F.js → chunk-Z2Z2OHRM.js} +1 -1
  33. package/dist/{chunk-USJX5SW4.cjs → chunk-ZHRVCW3M.cjs} +12 -12
  34. package/dist/chunk-ZS7LB2MV.js +77 -0
  35. package/dist/image-editor/index.cjs +788 -790
  36. package/dist/image-editor/index.js +6 -8
  37. package/dist/paint-editor/controller.d.cts +1 -1
  38. package/dist/paint-editor/controller.d.ts +1 -1
  39. package/dist/paint-editor/index.cjs +92 -87
  40. package/dist/paint-editor/index.js +16 -11
  41. package/dist/vector/index.cjs +970 -971
  42. package/dist/vector/index.js +5 -6
  43. package/package.json +1 -1
  44. package/skills/pixerate-brushes/SKILL.md +7 -2
  45. package/dist/chunk-FJBQTZS4.js +0 -17
  46. package/dist/chunk-LRTR4ASZ.cjs +0 -17
@@ -11,11 +11,15 @@ import {
11
11
  mergeBrushPatch,
12
12
  multiColorSliders,
13
13
  patchBrushValue
14
- } from "../chunk-4OJC4MCD.js";
14
+ } from "../chunk-Q6RVVJW6.js";
15
15
  import {
16
16
  createStickerTools,
17
17
  describeStickerRef
18
18
  } from "../chunk-6JL2D5SG.js";
19
+ import {
20
+ BRUSH_PREVIEW_DARK_PAPER,
21
+ brushPreviewsOnDark
22
+ } from "../chunk-ZS7LB2MV.js";
19
23
  import {
20
24
  toVideoFfmpeg
21
25
  } from "../chunk-MWUZCEFT.js";
@@ -30,7 +34,7 @@ import {
30
34
  resolveExternalAssets,
31
35
  serializeLayers,
32
36
  serializeLayersExternal
33
- } from "../chunk-HAUDEVMC.js";
37
+ } from "../chunk-WY23AUCA.js";
34
38
  import "../chunk-WJ4WQJCC.js";
35
39
  import {
36
40
  LAYER_EFFECT_KINDS,
@@ -88,7 +92,7 @@ import {
88
92
  realPresenceClock,
89
93
  tweenPresenceCursor
90
94
  } from "../chunk-IVSWRVB4.js";
91
- import "../chunk-WWI6FLH2.js";
95
+ import "../chunk-7PW6VCNW.js";
92
96
  import {
93
97
  BRUSH_ID,
94
98
  BRUSH_PRESETS,
@@ -143,7 +147,7 @@ import {
143
147
  parseBrushLibrary,
144
148
  resolveBrush,
145
149
  usesPaintExchange
146
- } from "../chunk-EE7SAYBF.js";
150
+ } from "../chunk-J4SGJCPW.js";
147
151
  import {
148
152
  STAMP_KINDS,
149
153
  StickersSlot,
@@ -162,8 +166,7 @@ import {
162
166
  import "../chunk-PWBZH3FK.js";
163
167
  import {
164
168
  brushColourHex
165
- } from "../chunk-FJBQTZS4.js";
166
- import "../chunk-3CI7FRMK.js";
169
+ } from "../chunk-DVPQFMH6.js";
167
170
  import {
168
171
  StickerError
169
172
  } from "../chunk-SZTI6EER.js";
@@ -4728,7 +4731,7 @@ function renderBrushThumbnail(brush, options) {
4728
4731
  if (b.engine === "wet") surface = paintWetTestStroke(b, options.paper, options.color, width, height);
4729
4732
  else ({ surface, light } = paintTestStroke(surface, b, options.paper, options.color, width, height));
4730
4733
  const layer = { type: "pixel", id: "thumbnail", name: "thumbnail", visible: true, opacity: 1, blend: "normal", surface, offset: { x: 0, y: 0 } };
4731
- const paper = light ? { ...options.paper, color: "#141414" } : options.paper;
4734
+ const paper = light && brushPreviewsOnDark(b) ? { ...options.paper, color: BRUSH_PREVIEW_DARK_PAPER } : options.paper;
4732
4735
  const spill = light ? computeSpill(surface, light, { radius: Math.max(4, height / 6), strength: 1 }) : null;
4733
4736
  const layers = [paperNode(paper), layer];
4734
4737
  if (spill) layers.push({ type: "pixel", id: "thumbnail-light", name: "light", visible: true, opacity: 1, blend: "linear-dodge", surface: spill, offset: { x: 0, y: 0 } });
@@ -5579,7 +5582,8 @@ async function replayPainting(source, target, options = {}) {
5579
5582
  const maxStrokes = options.strokes ?? source.strokes.length;
5580
5583
  const chunk = Math.max(1, options.wetChunk ?? 0) || Infinity;
5581
5584
  let strokes = 0;
5582
- await target.prepareEffectPaints(source.strokes.slice(0, maxStrokes).flatMap((st) => st.paint?.type === "effect" ? [st.paint] : []));
5585
+ const scaled = source.strokes.slice(0, maxStrokes).map((st) => s === 1 ? st : varyStroke(st, scaleM, { scale: s }));
5586
+ await target.prepareEffectPaints(scaled.flatMap((st) => st.paint?.type === "effect" ? [st.paint] : []));
5583
5587
  const advanceTo = async (clock) => {
5584
5588
  const now = target.getState().wet.clock;
5585
5589
  let left = clock - now;
@@ -9588,11 +9592,11 @@ var PaintEditorController = class _PaintEditorController {
9588
9592
  if (!layers.length) return null;
9589
9593
  return { layerIds: layers.map((x) => x.layer.id), strokes: layers.reduce((n, x) => n + x.strokes.filter(isLiveEffect).length, 0), sources: sources.length };
9590
9594
  }
9591
- /** Plays or pauses live effect paint, and caps its frame rate (1..60). Editor state, not an undo step. */
9595
+ /** Plays or pauses live effect paint, and caps its frame rate (1..60); a setting left out keeps its value. Editor state, not an undo step. */
9592
9596
  setEffectPlayback(update) {
9593
9597
  if (update.playing !== void 0 && typeof update.playing !== "boolean") throw new PaintEditorError("playing must be true or false.");
9594
9598
  if (update.fps !== void 0 && !(Number.isInteger(update.fps) && update.fps >= 1 && update.fps <= 60)) throw new PaintEditorError(`fps ${update.fps} is out of range; use a whole number 1..60.`);
9595
- this.effectPlaybackState = { ...this.effectPlaybackState, ...update };
9599
+ this.effectPlaybackState = { playing: update.playing ?? this.effectPlaybackState.playing, fps: update.fps ?? this.effectPlaybackState.fps };
9596
9600
  this.emit([]);
9597
9601
  return { ...this.effectPlaybackState, time: this.effectTime };
9598
9602
  }
@@ -12151,10 +12155,11 @@ function strokeSummary(s, withPoints, live) {
12151
12155
 
12152
12156
  // src/paint-editor/brush-library-tools.ts
12153
12157
  function paintBrushPreviewRenderer(paper = () => DEFAULT_PAPER) {
12154
- return (brush, { width, height, color }) => {
12158
+ const render = (brush, { width, height, color }) => {
12155
12159
  const t = renderBrushThumbnail(resolveBrush(brush), { paper: paper(), width, height, color: color.toLowerCase() });
12156
12160
  return { data: bytesToBase64(encodePng(t.width, t.height, t.data)), mimeType: "image/png" };
12157
12161
  };
12162
+ return Object.defineProperty(render, "paper", { get: () => paper().color, enumerable: true });
12158
12163
  }
12159
12164
  function createPaintBrushLibraryToolProvider(controller, options = {}) {
12160
12165
  return createBrushLibraryToolProvider(controller.brushLibrary, {