@pixerate/editor 0.239.0 → 0.241.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 (45) hide show
  1. package/dist/animation-editor/index.cjs +58 -58
  2. package/dist/animation-editor/index.js +3 -3
  3. package/dist/{brushstrokeRender-WB67GMUP.js → brushstrokeRender-MOYGEXOC.js} +2 -2
  4. package/dist/{brushstrokeRender-MPOM7BFW.cjs → brushstrokeRender-UKADOV5D.cjs} +5 -5
  5. package/dist/canvas/index.cjs +8 -8
  6. package/dist/canvas/index.js +1 -1
  7. package/dist/{chunk-NKTNLJUJ.cjs → chunk-5BR7LC24.cjs} +99 -11
  8. package/dist/{chunk-ZXNO3ZOX.cjs → chunk-7F4G74UQ.cjs} +35 -35
  9. package/dist/{chunk-AD7GA3TL.cjs → chunk-AFLMXITL.cjs} +23 -23
  10. package/dist/{chunk-PP6BXVRL.cjs → chunk-HGGJ36HR.cjs} +1 -1
  11. package/dist/{chunk-BBUE3UJL.cjs → chunk-HW72ABGR.cjs} +86 -86
  12. package/dist/{chunk-7YGBSFC6.js → chunk-ILM6GYAX.js} +1 -1
  13. package/dist/{chunk-THXFU3JB.cjs → chunk-KCMV2534.cjs} +2 -2
  14. package/dist/{chunk-3E36VDMJ.js → chunk-NE6OOKWJ.js} +1 -1
  15. package/dist/{chunk-RV5DKZHU.js → chunk-QP2B3MID.js} +1 -1
  16. package/dist/{chunk-UUBO6RB5.js → chunk-UDBDYZET.js} +1 -1
  17. package/dist/{chunk-PJYG6FCF.js → chunk-XBZK47LV.js} +98 -10
  18. package/dist/{chunk-XK4SST43.js → chunk-ZDPLZDTT.js} +1 -1
  19. package/dist/image-editor/index.cjs +775 -775
  20. package/dist/image-editor/index.js +4 -4
  21. package/dist/paint-editor/controller.d.cts +158 -1
  22. package/dist/paint-editor/controller.d.ts +158 -1
  23. package/dist/paint-editor/document.d.cts +7 -2
  24. package/dist/paint-editor/document.d.ts +7 -2
  25. package/dist/paint-editor/effect-paint.d.cts +60 -3
  26. package/dist/paint-editor/effect-paint.d.ts +60 -3
  27. package/dist/paint-editor/index.cjs +1246 -430
  28. package/dist/paint-editor/index.d.cts +1 -0
  29. package/dist/paint-editor/index.d.ts +1 -0
  30. package/dist/paint-editor/index.js +888 -72
  31. package/dist/paint-editor/live-strokes.d.cts +24 -0
  32. package/dist/paint-editor/live-strokes.d.ts +24 -0
  33. package/dist/paint-editor/stickers.d.cts +6 -0
  34. package/dist/paint-editor/stickers.d.ts +6 -0
  35. package/dist/paint-editor/thick.d.cts +4 -0
  36. package/dist/paint-editor/thick.d.ts +4 -0
  37. package/dist/paint-editor/ui.d.cts +24 -4
  38. package/dist/paint-editor/ui.d.ts +24 -4
  39. package/dist/paint-editor/wet.d.cts +8 -0
  40. package/dist/paint-editor/wet.d.ts +8 -0
  41. package/dist/vector/index.cjs +962 -962
  42. package/dist/vector/index.js +4 -4
  43. package/package.json +1 -1
  44. package/skills/pixerate-paint-editor/SKILL.md +38 -27
  45. package/skills/pixerate-paint-editor/references/effect-paint.md +25 -0
@@ -26,7 +26,7 @@ import {
26
26
  traceField,
27
27
  traceVectorImage,
28
28
  vectorTraceContours
29
- } from "../chunk-UUBO6RB5.js";
29
+ } from "../chunk-UDBDYZET.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-XK4SST43.js";
56
+ } from "../chunk-ZDPLZDTT.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-7YGBSFC6.js";
530
- import "../chunk-PJYG6FCF.js";
529
+ } from "../chunk-ILM6GYAX.js";
530
+ import "../chunk-XBZK47LV.js";
531
531
  import {
532
532
  createProvenance
533
533
  } from "../chunk-M6DNZNVY.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.239.0",
3
+ "version": "0.241.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -40,6 +40,8 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
40
40
  - **Strokes are data.** Every stroke is recorded (brush, colour, raw points, seed, symmetry
41
41
  copies) and gets a `strokeId`. `replay_strokes` paints recorded strokes again, exactly or
42
42
  varied. That is the main way an agent should make many similar marks.
43
+ - **Stroke layers keep strokes editable** (`add_layer {type: "strokes"}`): tune a stroke's brush,
44
+ colour, seed or points after painting it instead of repainting. See "Stroke layers" below.
43
45
  - **Guides** are editor state saved with the document: a symmetry guide makes every stroke paint
44
46
  its mirror or kaleidoscope copies (one stroke), a perspective guide snaps strokes to lines
45
47
  towards one to three vanishing points, a tracing image sits under the paint (never exported)
@@ -196,11 +198,13 @@ Paint that changes colour as the stroke goes: give a gradient where a colour wou
196
198
  bristle draws its own line: press harder to splay the tuft, tilt to flatten it; soft bristles
197
199
  bend into curves at turns; a low `bristle.load` runs dry into broken streaks.
198
200
  - **Sticker spray** (category `sticker`): stamps (`star`, `leaf`, `confetti`, `flower`, `heart`,
199
- `splat`, `sparkle`, `ring`, `dot`) sprayed along the stroke onto an **empty layer**, where each
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.
201
+ `splat`, `sparkle`, `ring`, `dot`) sprayed onto an **empty layer**, each staying an object:
202
+ `add_stickers` (exact places), `sticker_at`, `list_stickers`, `update_sticker`, `arrange_stickers`,
203
+ `remove_stickers`. A sticker layer takes no other paint; sprays are refused under an enabled
204
+ mask stencil (hide it with `update_stencil` `enabled` false, then remove unwanted stickers).
205
+ - **Stroke layers**: pixels drawn from the layer's strokes; they take `dab`, `particle`, `bristle`
206
+ and Mixer Brush strokes that pick up no paint. `list_strokes {live: true}` → `update_stroke` /
207
+ `edit_stroke_points` / `reorder_stroke` / `remove_strokes`; `rasterize_stroke_layer` once settled.
204
208
  - **Stencils**: `add_stencil` lays a `ruler` or `arc` (strokes that start within `snap` px follow
205
209
  it exactly: straight lines, circles, rainbows) or a `line` / `shape` mask (paint lands only on
206
210
  one side or inside a rect, ellipse or polygon; `invert` for outside). Stencils stay until
@@ -231,27 +235,29 @@ for the controls and presets.
231
235
 
232
236
  ## Effect paint
233
237
 
234
- `set_effect_paint` makes a generator, overlay or title effect the paint. It is rendered once at
235
- the canvas size, and every stroke then takes each pixel's colour from that picture, fixed to the
236
- canvas: painting reveals a hidden image where the brush goes. Its transparency paints nothing, so
237
- an overlay paints only where it has pixels.
238
+ `set_effect_paint` makes a generator, overlay or title effect the paint: rendered once, every
239
+ stroke takes each pixel's colour from it, fixed to the canvas (painting reveals a hidden image).
240
+ Its transparency paints nothing.
238
241
 
239
242
  1. `search_effects` (`use` generator, overlay or title) and `describe_effect` for the controls.
240
- 2. `set_effect_paint` with `effect`, `values` and `time` (ms, default 0). Wait for it: strokes that
241
- would use it are refused while it renders.
242
- 3. Paint with a dry brush: dab, particle and bristle brushes take the colour per pixel (the most
243
- faithful), the Mixer Brush and dab brushes with `behavior.pickup` take it per dab at the dab's
244
- centre and mix it with what they pick up. Brush opacity, flow, grain and pressure still apply.
245
- 4. `set_color` or `set_paint` goes back to colour; `remove_effect` (target and effect `paint`)
246
- does too, and `update_effect` (target and effect `paint`, `values`) renders new values.
243
+ 2. `set_effect_paint` with `effect`, `values`, `time` (ms, default 0). Wait for it to return.
244
+ 3. Paint: dab, particle and bristle brushes take the colour per pixel; the Mixer Brush and pick-up
245
+ dab brushes take it per dab at its centre. Wet and impasto brushes take it per pixel, shifted by
246
+ paint they pick up (in watercolour and gouache it flows with the water; impasto keeps its relief).
247
+ Sprayed stickers each take the colour at their centre (they stay recolourable).
248
+ 4. `set_color`, `set_paint` or `remove_effect` (target and effect `paint`) go back to colour;
249
+ `update_effect` (target and effect `paint`, `values`) renders new values.
250
+ 5. Along each stroke (`map`) or playing on stroke layers (`live`): [references/effect-paint.md](references/effect-paint.md).
247
251
 
248
252
  When to use which:
249
253
 
250
254
  | Want | Use |
251
255
  | --- | --- |
252
256
  | The effect inside brushed marks, hand-painted edges | `set_effect_paint` and a dry brush |
253
- | The effect inside an exact shape, or in wet / thick paint | Paint the shape, dry it, then `fill_layer_with_effect` with `lockTransparency: true` |
257
+ | The effect in a wash that flows, or in thick paint | `set_effect_paint` and a watercolour, gouache, oil or impasto brush |
258
+ | The effect inside an exact shape, unchanged by water | Paint the shape, dry it, then `fill_layer_with_effect` with `lockTransparency: true` |
254
259
  | The effect over the whole sheet | `set_paper_effect` or `add_effect_layer` |
260
+ | A pattern that follows the stroke, or paint that moves | `map: { by: "stroke" }`, `live: true` on a stroke layer |
255
261
 
256
262
  ## Canvas-hosted layer
257
263
 
@@ -281,7 +287,7 @@ view), so work with the tools you are given.
281
287
  | Tool | Use |
282
288
  | --- | --- |
283
289
  | `list_layers` | Read the layers top first: id, name, type (`pixel` / `group`), visible, opacity, blend, clipped, locks, `active`, painted `bounds` (null when empty), parent and depth. |
284
- | `add_layer` | Add an empty pixel layer (or `type: "group"`) above the active layer, above `aboveId`, or at the top of group `parentId`; it becomes active. Returns the layer. Put each pass of a painting on its own layer. |
290
+ | `add_layer` | Add an empty pixel layer (or `type: "group"`, or `type: "strokes"` for a stroke layer whose strokes stay editable) above the active layer, above `aboveId`, or at the top of group `parentId`; it becomes active. Returns the layer. Put each pass of a painting on its own layer. |
285
291
  | `update_layer` | Change `name`, `visible`, `opacity` (0..1), `blend`, `clipped` (clip to the layer below) or `locks` (`pixels`, `transparency`: paint only where there is paint, `position`, `all`). Returns the layer. |
286
292
  | `list_blend_modes` | Read every blend mode: id, label, group (`standard`, `pigment`, `painterly`), what the pigment and painterly modes do, and the `psd` mode export writes instead. Read before choosing a painterly mode. Changes nothing. |
287
293
  | `set_active_layer` | Make a layer the default target of strokes, fills and clears. Editor state. |
@@ -335,7 +341,14 @@ view), so work with the tools you are given.
335
341
  | Tool | Use |
336
342
  | --- | --- |
337
343
  | `paint_stroke` | Paint one stroke through `points` (document px; `pressure` 0..1, `t` ms, `tiltX` / `tiltY` or `altitude` / `azimuth`, `twist`) with `brushId` (default the active brush), optional per-stroke `brush` changes, `color` or `paint` (a gradient for this stroke), `layerId`, `seed`, `snapToPerspective`. The symmetry guide adds its copies; a sampling tracing image supplies the colour when `color` is missing. Returns `layerId`, `bounds`, `dabs`, `strokeId` and, for brushes that pick up paint, `mixerLoad` (what the brush carries now). Refused on locked, hidden or group layers, with the fix in the message. |
338
- | `list_strokes` | Read the recorded strokes, oldest first (default the last 100): id, layer, brush, colour, point count, seed, bounds. With `ids`, their points too. |
344
+ | `list_strokes` | Read the recorded strokes, oldest first (default the last 100): id, layer, brush, colour, point count, seed, bounds, `live`. With `ids`, their points too; with `layerId`, one layer's. With `live: true`, the editable strokes of stroke layers as they are now, bottom first: the ids for the stroke layer tools. |
345
+ | `stroke_at` | Read the top-most stroke of a stroke layer that painted the pixel at `x`, `y`, or null. Use it to pick one stroke among overlapping ones. |
346
+ | `update_stroke` | Change a stroke on a stroke layer: `brushId` (keeps its size), `brush` settings, `color`, `paint` (null drops a gradient), `seed`. Redraws exactly. One undo step. Returns the stroke and the changed `bounds`. |
347
+ | `edit_stroke_points` | Replace a stroke's `points`, or `transform` it (`dx`, `dy`, `scale`, `rotate`, `flipX`, about its centre or `origin`). One undo step. Returns the stroke with its points and the changed `bounds`. |
348
+ | `reorder_stroke` | Move a stroke to `index` in its stroke layer (0 = bottom). One undo step. Returns the order. |
349
+ | `remove_strokes` | Delete strokes from stroke layers (their eraser). One undo step. Returns the ids and `bounds`. |
350
+ | `convert_to_stroke_layer` | Make an empty pixel layer a stroke layer. Returns the layer. |
351
+ | `rasterize_stroke_layer` | Turn a stroke layer into a plain pixel layer with the same pixels (strokes no longer editable). Do it before erasing, smudging or filling on it. |
339
352
  | `replay_strokes` | Paint recorded `strokeIds` again: exactly, or varied by `dx` / `dy` (px), `rotate` (degrees clockwise), `scale` (brush size follows), `flipX`, `origin`, `pressureScale`, `color`, `brushId`, `layerId`, `repeat` (each copy applies the variation again). One undo step. Returns the new stroke ids, bounds and layers. |
340
353
  | `undo_paint` | Undo the last step (a wet stroke's undo puts the wet paint back as it was before it). Returns what was undone and what is next. |
341
354
  | `redo_paint` | Redo the step just undone. |
@@ -388,7 +401,8 @@ view), so work with the tools you are given.
388
401
  | `set_paper_effect` | Draw a generator over the paper (`values`, `opacity`, `blend` default `multiply`, `time`); `effect: null` removes it. One undo step. Returns the effect paper. |
389
402
  | `add_effect_layer` | Add a layer drawn by a generator, overlay or title effect (`values`, `name`, `aboveId`, `opacity`, `blend`, `time`); it becomes active. Returns the layer and its effect. |
390
403
  | `fill_layer_with_effect` | Composite a generator, overlay or title effect onto a layer (`layerId`, `values`, `opacity`, `lockTransparency`, `time`). One undo step. Returns the layer id and the effect. |
391
- | `set_effect_paint` | Paint with a generator, overlay or title effect (`effect`, `values`, `time` ms default 0): rendered once at the canvas size, strokes take each pixel's colour from it. Call after `describe_effect`, then `paint_stroke` with a dry brush. Editor state, not an undo step. Returns `effectPaint` (`effect`, `provider`, `values`, `time`). |
404
+ | `set_effect_paint` | Paint with a generator, overlay or title effect (`effect`, `values`, `time` ms default 0): rendered once at the canvas size, strokes take each pixel's colour from it; `map` `{ by: "stroke", length, repeat }` lays it along each stroke; `live` keeps it playing on stroke layers. Call after `describe_effect`, then `paint_stroke`. Editor state, not an undo step. Returns `effectPaint`. |
405
+ | `set_effect_playback` | Play or pause live effect paint in the view (`playing`) and cap its frame rate (`fps` 1..60). Editor state. Returns `playing`, `fps`, `time` and `animation` (what plays, or null). Export a moment with `export_image` / `export_psd` `time`. |
392
406
 
393
407
  ### Guides
394
408
 
@@ -481,12 +495,9 @@ The host may add the shared document tools (see `pixerate-agent-tools`). A paint
481
495
  strokes record it, and replays render it again first, so they need the same provider (an
482
496
  error names the effect and provider when it is missing; `color` on `replay_strokes` repaints
483
497
  in one colour instead).
484
- - **Effect paint refuses wet, impasto and sticker brushes** (they carry one colour as pigment,
485
- thick paint or stamps). Paint the shape, dry it, and `fill_layer_with_effect` with
486
- `lockTransparency: true`. Erasers, blenders and smudges ignore it, and a brush with its own
487
- gradient, a stroke `color` or `paint`, or `set_color` / `set_paint` paints colour instead.
488
- - **Effect paint is fixed to the canvas, not the stroke**: a replayed or moved stroke shows the
489
- part of the effect under its new place. Wait for `set_effect_paint` to return before painting;
490
- strokes are refused while it renders.
498
+ - **Effect paint is fixed to the canvas by default** (`map: { by: "stroke" }` follows the stroke),
499
+ and in wet paint it flows with the water; for a crisp pattern in an exact shape, paint and dry
500
+ the shape, then `fill_layer_with_effect` (`lockTransparency: true`). Erasers, blenders and
501
+ smudges ignore it. Wait for `set_effect_paint` to return; strokes are refused while it renders.
491
502
  - **Recorded strokes are kept in saved documents** (`save_paint_document`, `get_paint_document`),
492
503
  so a painting can be replayed and repainted at a higher resolution.
@@ -0,0 +1,25 @@
1
+ # Effect paint along the stroke, and live effect paint
2
+
3
+ - **Along the stroke** (`set_effect_paint` `map: { by: "stroke", length, repeat }`): the effect is
4
+ rendered as a strip `length` px long (16..4096, default 300) and 256 px across. Each pixel takes
5
+ the colour at its distance along the stroke and its place across the tip, so the pattern follows
6
+ the stroke's turns instead of staying fixed to the canvas. `repeat` starts the strip again
7
+ (default), `mirror` runs it back, `clamp` holds the last colour. Use it for ribbons, ropes,
8
+ flames and textures that should flow with the mark; use the default canvas mapping to reveal one
9
+ hidden picture across many strokes. Every colour-laying brush takes it (watercolour, gouache, oil
10
+ and impasto too; sprayed stickers at their centre); particle and bristle marks take the place of
11
+ their pen dab.
12
+ Scaled replays (`export_high_res`) scale `length` with the canvas.
13
+ - **Live** (`live: true`): on a stroke layer (`add_layer {type: "strokes"}`) each stroke keeps
14
+ playing the effect, so the paint moves. Paint the strokes, then `set_effect_playback`
15
+ (`playing`, `fps` 1..60, default 30) plays or pauses them in the view. The document keeps the
16
+ frame at the effect's own `time`; `export_image` and `export_psd` take `time` (ms) to export
17
+ another moment. Live strokes stay editable like any stroke on a stroke layer
18
+ (`update_stroke` with `paint` changes the effect).
19
+ - **Where it applies**: live only plays on stroke layers; on a pixel layer the stroke bakes the
20
+ frame at `time`. A painting plays at most 8 distinct live effects (each needs a renderer per
21
+ frame); paint more strokes with one of them, or bake new ones (`live: false`).
22
+ - **Cost**: each frame redraws the live strokes (and any stroke overlapping them), and renders
23
+ each live effect once. On a large canvas with many live strokes, lower `fps`.
24
+ - **Without the provider** (a document opened elsewhere): the saved pixels show the frame as
25
+ painted, and nothing plays until the provider is registered.