@pixerate/editor 0.237.0 → 0.238.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 (88) hide show
  1. package/dist/agent/index.cjs +40 -39
  2. package/dist/agent/index.js +9 -8
  3. package/dist/animation/index.cjs +7 -6
  4. package/dist/animation/index.js +6 -5
  5. package/dist/animation-editor/index.cjs +66 -65
  6. package/dist/animation-editor/index.js +9 -8
  7. package/dist/{brushstrokeRender-WDTKD54B.cjs → brushstrokeRender-MPOM7BFW.cjs} +7 -5
  8. package/dist/{brushstrokeRender-MAHOXL7K.js → brushstrokeRender-WB67GMUP.js} +4 -2
  9. package/dist/canvas/index.cjs +55 -54
  10. package/dist/canvas/index.js +10 -9
  11. package/dist/chart/index.cjs +159 -158
  12. package/dist/chart/index.js +9 -8
  13. package/dist/{chunk-L6Y7TSQ4.js → chunk-36ZTV7WO.js} +1 -1
  14. package/dist/{chunk-JVNGCS26.js → chunk-3E36VDMJ.js} +1 -1
  15. package/dist/{chunk-WRZ6C4TU.cjs → chunk-3R5P3DVY.cjs} +6 -6
  16. package/dist/{chunk-RUONPPMC.cjs → chunk-44BMJJVA.cjs} +8 -8
  17. package/dist/{chunk-YBAPT7NL.js → chunk-6ADHGQ73.js} +4 -2
  18. package/dist/chunk-7AHBW2CQ.cjs +200 -0
  19. package/dist/{chunk-EUIDTZNQ.cjs → chunk-7PT4RJL5.cjs} +113 -111
  20. package/dist/{chunk-CU6ANS5L.js → chunk-7YGBSFC6.js} +2 -2
  21. package/dist/{chunk-ATKKG76G.cjs → chunk-AD7GA3TL.cjs} +23 -23
  22. package/dist/{chunk-FSLKBQU7.js → chunk-AIS56JOO.js} +3 -3
  23. package/dist/{chunk-5VQXSS2S.cjs → chunk-BBUE3UJL.cjs} +86 -86
  24. package/dist/{chunk-7272D3K2.js → chunk-BP6KSGVD.js} +6 -4
  25. package/dist/{chunk-F6R67I3A.js → chunk-CXXXAZ7H.js} +1 -1
  26. package/dist/{chunk-5DQPDXOM.cjs → chunk-D2SGV525.cjs} +76 -76
  27. package/dist/chunk-F67XMVDI.js +200 -0
  28. package/dist/{chunk-JVSX5QTS.js → chunk-FQVVO5YA.js} +3 -3
  29. package/dist/{chunk-UXETV2NC.cjs → chunk-GA4EU4P3.cjs} +4 -4
  30. package/dist/{chunk-UFEDHACQ.js → chunk-GXAK6Q5J.js} +2 -2
  31. package/dist/{chunk-MHLU6GRJ.js → chunk-JEGJP4OW.js} +7 -196
  32. package/dist/{chunk-GOBOCZZI.js → chunk-LEQKZGQI.js} +1 -1
  33. package/dist/{chunk-M5GLQQWG.cjs → chunk-LJZRHVZV.cjs} +2 -2
  34. package/dist/{chunk-N76AMOKE.cjs → chunk-MOW3JMNG.cjs} +42 -42
  35. package/dist/{chunk-WKMUBATU.js → chunk-N4DFDI73.js} +1 -1
  36. package/dist/{chunk-GNZI3KYK.cjs → chunk-NKTNLJUJ.cjs} +49 -9
  37. package/dist/{chunk-TQOL6CF7.js → chunk-PJYG6FCF.js} +49 -9
  38. package/dist/{chunk-V3L7U63N.cjs → chunk-PP6BXVRL.cjs} +1 -1
  39. package/dist/{chunk-TFF2GTGN.cjs → chunk-PPFJHTW5.cjs} +24 -22
  40. package/dist/{chunk-6ZZKRH7R.js → chunk-QARCM66V.js} +3 -3
  41. package/dist/{chunk-5UEFBM2M.cjs → chunk-RD7RX52G.cjs} +18 -207
  42. package/dist/{chunk-CDP2AKMA.js → chunk-RV5DKZHU.js} +1 -1
  43. package/dist/{chunk-HUAISCUX.cjs → chunk-T7KQEMAE.cjs} +18 -18
  44. package/dist/{chunk-BQE3Y6ZO.cjs → chunk-THXFU3JB.cjs} +5 -5
  45. package/dist/{chunk-4ZC5QJE2.cjs → chunk-UTI5IITZ.cjs} +3 -3
  46. package/dist/{chunk-XSVUNSDJ.js → chunk-UUBO6RB5.js} +1 -1
  47. package/dist/{chunk-CZWUDFR3.cjs → chunk-UZU6DIZA.cjs} +52 -52
  48. package/dist/{chunk-M2TPMYJE.js → chunk-V6DT2CDH.js} +1 -1
  49. package/dist/{chunk-WV5WTOC6.cjs → chunk-W7GRGGBH.cjs} +16 -16
  50. package/dist/{chunk-23E5GI2U.js → chunk-WGN7AUKB.js} +2 -2
  51. package/dist/{chunk-YMREOA67.js → chunk-XK4SST43.js} +2 -2
  52. package/dist/{chunk-SOSBOS5T.cjs → chunk-XWOLPNBW.cjs} +22 -22
  53. package/dist/{chunk-ILP77UD6.js → chunk-YGQVCQTG.js} +1 -1
  54. package/dist/{chunk-GXLZZVR5.cjs → chunk-ZXNO3ZOX.cjs} +37 -37
  55. package/dist/color/index.cjs +6 -4
  56. package/dist/color/index.js +9 -7
  57. package/dist/export/index.cjs +8 -7
  58. package/dist/export/index.js +7 -6
  59. package/dist/extensions/index.cjs +11 -10
  60. package/dist/extensions/index.js +10 -9
  61. package/dist/gradient/index.cjs +29 -28
  62. package/dist/gradient/index.js +4 -3
  63. package/dist/image-editor/index.cjs +778 -777
  64. package/dist/image-editor/index.js +9 -8
  65. package/dist/index.cjs +17 -16
  66. package/dist/index.js +11 -10
  67. package/dist/paint-editor/controller.d.cts +31 -1
  68. package/dist/paint-editor/controller.d.ts +31 -1
  69. package/dist/paint-editor/index.cjs +403 -195
  70. package/dist/paint-editor/index.js +231 -23
  71. package/dist/paint-editor/sticker-tools.d.cts +1 -1
  72. package/dist/paint-editor/sticker-tools.d.ts +1 -1
  73. package/dist/paint-editor/stickers.d.cts +10 -3
  74. package/dist/paint-editor/stickers.d.ts +10 -3
  75. package/dist/paint-editor/ui.d.cts +10 -3
  76. package/dist/paint-editor/ui.d.ts +10 -3
  77. package/dist/tokens/index.cjs +4 -3
  78. package/dist/tokens/index.js +3 -2
  79. package/dist/typography/index.cjs +8 -7
  80. package/dist/typography/index.js +3 -2
  81. package/dist/vector/index.cjs +967 -966
  82. package/dist/vector/index.js +9 -8
  83. package/dist/video-editor/index.cjs +7 -6
  84. package/dist/video-editor/index.js +6 -5
  85. package/package.json +1 -1
  86. package/skills/pixerate-color/SKILL.md +3 -0
  87. package/skills/pixerate-image-editor/SKILL.md +1 -0
  88. package/skills/pixerate-paint-editor/SKILL.md +6 -2
@@ -26,7 +26,7 @@ import {
26
26
  traceField,
27
27
  traceVectorImage,
28
28
  vectorTraceContours
29
- } from "../chunk-XSVUNSDJ.js";
29
+ } from "../chunk-UUBO6RB5.js";
30
30
  import {
31
31
  applyHomography,
32
32
  homographyFromPoints,
@@ -53,7 +53,7 @@ import {
53
53
  reverseMorphContour,
54
54
  subpathToMorphContour,
55
55
  turnMorphContour
56
- } from "../chunk-YMREOA67.js";
56
+ } from "../chunk-XK4SST43.js";
57
57
  import {
58
58
  DEFAULT_VECTOR_FONT,
59
59
  IDENTITY_MATRIX,
@@ -526,8 +526,8 @@ import {
526
526
  withVectorStrokes,
527
527
  withVectorTargetPaint,
528
528
  zigzagPaths
529
- } from "../chunk-CU6ANS5L.js";
530
- import "../chunk-TQOL6CF7.js";
529
+ } from "../chunk-7YGBSFC6.js";
530
+ import "../chunk-PJYG6FCF.js";
531
531
  import {
532
532
  createProvenance
533
533
  } from "../chunk-M6DNZNVY.js";
@@ -584,13 +584,14 @@ import {
584
584
  HistoryManager
585
585
  } from "../chunk-RNSANXPT.js";
586
586
  import "../chunk-5UJHB3BW.js";
587
- import "../chunk-M2TPMYJE.js";
587
+ import "../chunk-V6DT2CDH.js";
588
588
  import {
589
589
  hexToRgba
590
590
  } from "../chunk-2WPNAGHI.js";
591
- import "../chunk-7272D3K2.js";
592
- import "../chunk-YBAPT7NL.js";
593
- import "../chunk-MHLU6GRJ.js";
591
+ import "../chunk-BP6KSGVD.js";
592
+ import "../chunk-6ADHGQ73.js";
593
+ import "../chunk-JEGJP4OW.js";
594
+ import "../chunk-F67XMVDI.js";
594
595
  import "../chunk-6ONMQ6WF.js";
595
596
 
596
597
  // src/vector/stylize.ts
@@ -181,16 +181,17 @@ require('../chunk-2BSBFBOA.cjs');
181
181
  var _chunkFJ2MSI43cjs = require('../chunk-FJ2MSI43.cjs');
182
182
 
183
183
 
184
- var _chunkM5GLQQWGcjs = require('../chunk-M5GLQQWG.cjs');
184
+ var _chunkLJZRHVZVcjs = require('../chunk-LJZRHVZV.cjs');
185
185
 
186
186
 
187
187
 
188
188
  var _chunkDWJJI6RTcjs = require('../chunk-DWJJI6RT.cjs');
189
- require('../chunk-4ZC5QJE2.cjs');
189
+ require('../chunk-UTI5IITZ.cjs');
190
190
  require('../chunk-A6QWKBJP.cjs');
191
- require('../chunk-EUIDTZNQ.cjs');
192
- require('../chunk-TFF2GTGN.cjs');
193
- require('../chunk-5UEFBM2M.cjs');
191
+ require('../chunk-7PT4RJL5.cjs');
192
+ require('../chunk-PPFJHTW5.cjs');
193
+ require('../chunk-RD7RX52G.cjs');
194
+ require('../chunk-7AHBW2CQ.cjs');
194
195
  require('../chunk-IPJ3TEYR.cjs');
195
196
 
196
197
  // src/video-editor/parse.ts
@@ -3606,7 +3607,7 @@ var VideoEditorController = (_class7 = class _VideoEditorController {
3606
3607
  this.readOnly = _nullishCoalesce(options.readOnly, () => ( false));
3607
3608
  this.previewScale = checkPreviewScale(_nullishCoalesce(options.previewScale, () => ( "auto")));
3608
3609
  this.onChange = options.onChange;
3609
- this.player = new (0, _chunkM5GLQQWGcjs.AnimationPlayer)({ clock: options.clock, duration: () => _chunkZQIWBJGHcjs.videoProjectDuration.call(void 0, this.project), loop: "none" });
3610
+ this.player = new (0, _chunkLJZRHVZVcjs.AnimationPlayer)({ clock: options.clock, duration: () => _chunkZQIWBJGHcjs.videoProjectDuration.call(void 0, this.project), loop: "none" });
3610
3611
  this.state = this.computeState();
3611
3612
  this.connect();
3612
3613
  }
@@ -181,16 +181,17 @@ import {
181
181
  } from "../chunk-RNSANXPT.js";
182
182
  import {
183
183
  AnimationPlayer
184
- } from "../chunk-F6R67I3A.js";
184
+ } from "../chunk-CXXXAZ7H.js";
185
185
  import {
186
186
  CUBIC_BEZIER_PRESETS,
187
187
  evaluateEasing
188
188
  } from "../chunk-5UJHB3BW.js";
189
- import "../chunk-M2TPMYJE.js";
189
+ import "../chunk-V6DT2CDH.js";
190
190
  import "../chunk-2WPNAGHI.js";
191
- import "../chunk-7272D3K2.js";
192
- import "../chunk-YBAPT7NL.js";
193
- import "../chunk-MHLU6GRJ.js";
191
+ import "../chunk-BP6KSGVD.js";
192
+ import "../chunk-6ADHGQ73.js";
193
+ import "../chunk-JEGJP4OW.js";
194
+ import "../chunk-F67XMVDI.js";
194
195
  import "../chunk-6ONMQ6WF.js";
195
196
 
196
197
  // src/video-editor/parse.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.237.0",
3
+ "version": "0.238.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -33,6 +33,7 @@ the pitfalls, and uses the tools below.
33
33
  - Run `check_gradient` to audit for crowded stops, banding risk, out-of-gamut colours, and text contrast along the ramp.
34
34
  - Run `list_gradient_presets` and `apply_gradient_preset` to quickly set tested gradient compositions.
35
35
  - Modify gradient structure using `set_gradient`, `set_gradient_geometry`, `add_gradient_stop`, `update_gradient_stop`, `remove_gradient_stop`, `reverse_gradient`, or `distribute_gradient_stops`.
36
+ - To match a gradient in a picture, read colours along a line (the image editor's `sample_gradient`, or your own picks) and pass them to `set_gradient_from_samples`. Raise `tolerance` (or lower `maxStops`) for a cleaner ramp, lower it for a closer match; `maxError` says how close it got.
36
37
 
37
38
  ## Best practices
38
39
 
@@ -65,6 +66,7 @@ the pitfalls, and uses the tools below.
65
66
  | `remove_gradient_stop` | Removes a color stop by ID | `{ gradient, css }` |
66
67
  | `reverse_gradient` | Reverses the order and offsets of all stops | `{ gradient, css }` |
67
68
  | `distribute_gradient_stops` | Evenly distributes all color stops between 0 and 1 | `{ gradient, css }` |
69
+ | `set_gradient_from_samples` | Fits the fewest stops to colours sampled along a line (noise smoothed first) and makes them the stops, keeping type and angle, interpolation oklab. One undo step. Use it after sampling a gradient from a picture | `{ gradient, css, stopCount, maxError }` |
68
70
  | `apply_gradient_preset` | Applies a built-in gradient preset by ID | `{ preset, gradient, css }` |
69
71
 
70
72
  ## Pitfalls
@@ -72,6 +74,7 @@ the pitfalls, and uses the tools below.
72
74
  - **`light-dark()` requires `color-scheme`.** CSS `light-dark()` only resolves the dark colour when `color-scheme: light dark;` is set on the element or an ancestor (such as `:root`). Without `color-scheme`, browsers always render the light colour.
73
75
  - **JavaScript resolution required for non-CSS targets.** Canvas 2D, WebGL, SVG presentation attributes, and raster image exporters cannot read `light-dark()` strings; resolve them in JavaScript with `resolveColor(value, scheme)`.
74
76
  - **Gamut clipping.** Colours specified in wide-gamut spaces (e.g. high-chroma OKLCH) will be mapped into sRGB for hex representations. Check `inSrgbGamut` if exact fidelity is required.
77
+ - **Sampled gradients are smoothed.** A sharp edge along the sampled line (a horizon, a hard shadow) is softened by `smoothing` and fitted as a steep ramp; pass `smoothing: 0` and a lower `tolerance` to keep it close to a step.
75
78
  - **Large text thresholds.** WCAG allows 3:1 for large text (18pt / 24px or 14pt / 18.5px bold); pass `large: true` to avoid overly aggressive contrast suggestions.
76
79
  - **Geometry fields depend on the type.** To make a radial circle, send `type: "radial"` and `shape: "circle"` in the same `set_gradient_geometry` call; sending `shape` to a linear gradient is an error.
77
80
  - **Ramp steps bounds.** `blend_colors` requires `steps` to be between 2 and 32 when generating a ramp.
@@ -312,6 +312,7 @@ in the source frame at the document's bit depth, colour mode and profile. Read
312
312
  | `paint_stroke` | Paint (`tool` brush), blend with the Mixer Brush (`tool` mixer) or erase (`tool` eraser) along `points` in document px (optional `pressure` 0..1) on a pixel layer or its mask (`channel`; the mixer paints pixels only); `color` #rrggbb (on a mask: black hides, white reveals; for the mixer, the reservoir colour) or `paint` (brush only: a gradient for this stroke); `brush` `{size, hardness, spacing, angle, roundness, opacity, flow, smoothing, pressureSize, pressureOpacity, blend}`; `mixer` `{wet, load, mix, loadEachStroke, cleanEachStroke, mixing: rgb \| pigment}` (tool mixer only). The selection limits the paint. One undo step per call. Returns the layer, channel, changed `bounds`, dab count and, for the mixer, `mixerLoad` `{reservoir, amount, pickup}`. |
313
313
  | `set_paint` | Set what the brush paints: one colour (it becomes the foreground) or gradient paint (`stops` sorted by offset, `space` pigment / oklab / srgb, `map`, `softness`). Errors say what is wrong. Returns `paint`, `foreground`, `background`, `brush`. |
314
314
  | `sample_color` | The Eyedropper: read the composite colour at a document point (`size` averages a square; default 1 px) and, unless `setForeground` is false, make it the paint foreground. Use it to match a colour already in the image before painting or retouching. Fails outside the canvas or on transparent pixels. Returns `color` and `foreground`. |
315
+ | `sample_gradient` | Read the composite along a line (`start` → `end`, document pixels) and fit the fewest gradient stops to it (`tolerance` OKLab ΔE, `maxStops`, `sampleSize` averaging, `snapStep`). Changes nothing. Returns a linear `gradient` (angle of the line, oklab), its `css` and `pointsRead`. Use it to match a sky, a backdrop or a light falloff before painting a gradient or styling one. |
315
316
  | `get_paint` | Read-only. What the brush paints (`paint`), the foreground and background colours and the brush settings. |
316
317
  | `get_mixer_brush` | Read-only. The Mixer Brush settings and what it carries (`reservoir` #rrggbb or null, `amount` left 0..1, `pickup` #rrggbb or null). Call it before a mixer stroke with `loadEachStroke: false`. |
317
318
  | `load_mixer_brush` | Fill the Mixer Brush reservoir with `color` (default the foreground), amount 1; keeps the pickup. View state, not an undo step. Use before strokes with `loadEachStroke: false`. Returns the load. |
@@ -197,8 +197,10 @@ Paint that changes colour as the stroke goes: give a gradient where a colour wou
197
197
  bend into curves at turns; a low `bristle.load` runs dry into broken streaks.
198
198
  - **Sticker spray** (category `sticker`): stamps (`star`, `leaf`, `confetti`, `flower`, `heart`,
199
199
  `splat`, `sparkle`, `ring`, `dot`) sprayed along the stroke onto an **empty layer**, where each
200
- stays an object: `list_stickers`, `update_sticker` (move, turn, resize, recolour, restamp),
201
- `arrange_stickers`, `remove_stickers`. A sticker layer takes no other paint.
200
+ stays an object: `add_stickers` (place them exactly), `sticker_at` (pick one by point), `list_stickers`, `update_sticker` (move, turn, resize, recolour, restamp),
201
+ `arrange_stickers`, `remove_stickers`. A sticker layer takes no other paint. Stickers are drawn
202
+ whole, so a spray is refused while a mask stencil is on: hide it (`update_stencil` `enabled`
203
+ false) first, then remove the stickers you don't want.
202
204
  - **Stencils**: `add_stencil` lays a `ruler` or `arc` (strokes that start within `snap` px follow
203
205
  it exactly: straight lines, circles, rainbows) or a `line` / `shape` mask (paint lands only on
204
206
  one side or inside a rect, ellipse or polygon; `invert` for outside). Stencils stay until
@@ -367,6 +369,8 @@ view), so work with the tools you are given.
367
369
  | Tool | Use |
368
370
  | --- | --- |
369
371
  | `list_stickers` | Read a layer's stickers bottom first: id, stamp, x, y, size, rotation, color, opacity. |
372
+ | `add_stickers` | Place stickers exactly (`stamp`, `x`, `y`, optional `size`, `rotation`, `color`, `opacity`, `seed`) on a sticker layer or an empty layer. Use it for deliberate placement, a sticker brush for a scatter. One undo step. Returns the new stickers with ids. |
373
+ | `sticker_at` | Read the top-most sticker under a point (`x`, `y`), or null. Use it to pick one sticker among many similar ones before `update_sticker`, `arrange_stickers` or `remove_stickers`. |
370
374
  | `update_sticker` | Change one sticker by `id`: `stamp`, `x`, `y`, `size`, `rotation`, `color`, `opacity`. One undo step. Returns it. |
371
375
  | `arrange_stickers` | Move stickers (`ids`) to the `front` or `back` of their layer. One undo step. |
372
376
  | `remove_stickers` | Delete stickers by `ids`, or all on the layer. One undo step. |