@pixerate/editor 0.262.1 → 0.263.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 (68) hide show
  1. package/dist/animation-editor/index.cjs +60 -60
  2. package/dist/animation-editor/index.js +4 -4
  3. package/dist/brushes/index.cjs +52 -52
  4. package/dist/brushes/index.js +4 -4
  5. package/dist/{brushstrokeRender-N6UPZSQS.cjs → brushstrokeRender-2GBME4XD.cjs} +13 -13
  6. package/dist/{brushstrokeRender-25Q5BEY6.js → brushstrokeRender-S5DABANG.js} +3 -3
  7. package/dist/canvas/index.cjs +15 -14
  8. package/dist/canvas/index.js +3 -2
  9. package/dist/canvas/stickers.d.cts +5 -1
  10. package/dist/canvas/stickers.d.ts +5 -1
  11. package/dist/{chunk-6NZL24W4.js → chunk-34HIZXFX.js} +1 -1
  12. package/dist/{chunk-UVZ7RQOE.cjs → chunk-4E6BGHWN.cjs} +1 -1
  13. package/dist/{chunk-J5UQHWVL.js → chunk-6JL2D5SG.js} +27 -15
  14. package/dist/{chunk-QAR2N7HZ.js → chunk-6XX7E7O2.js} +1 -1
  15. package/dist/{chunk-3TQW5MPW.cjs → chunk-73QFSPDG.cjs} +23 -23
  16. package/dist/{chunk-APX63ILU.js → chunk-ACFSFUQH.js} +31 -0
  17. package/dist/{chunk-X2EXYY4J.js → chunk-CNLO6E2K.js} +2 -2
  18. package/dist/{chunk-F7CPSRLN.js → chunk-DOZ6F2K2.js} +12 -4
  19. package/dist/{chunk-CQVTGBQI.js → chunk-JGI4PZWO.js} +1 -1
  20. package/dist/{chunk-EHALWBBD.js → chunk-LG6MEEV7.js} +1 -1
  21. package/dist/{chunk-7AUQ2UJ3.cjs → chunk-LWHUU6A6.cjs} +10 -10
  22. package/dist/{chunk-JSDND7DF.cjs → chunk-OTN6VB5S.cjs} +32 -1
  23. package/dist/{chunk-5IW65VQ6.js → chunk-P5343XZO.js} +1 -1
  24. package/dist/{chunk-AVTPZO4Z.cjs → chunk-PE6YJMQT.cjs} +37 -25
  25. package/dist/{chunk-D4TE5JNW.js → chunk-QW7LKWKE.js} +1 -1
  26. package/dist/{chunk-YLUIFXSL.cjs → chunk-TIHW7CUY.cjs} +35 -35
  27. package/dist/{chunk-PYTJBVW5.cjs → chunk-TILEUVRO.cjs} +31 -31
  28. package/dist/{chunk-RVGP2XLF.cjs → chunk-XORJ7UZO.cjs} +21 -13
  29. package/dist/{chunk-43NT242D.cjs → chunk-XQW6R7VW.cjs} +86 -86
  30. package/dist/{chunk-TZOX7KWV.cjs → chunk-ZBACQHW3.cjs} +8 -8
  31. package/dist/image-editor/index.cjs +789 -788
  32. package/dist/image-editor/index.js +7 -6
  33. package/dist/image-editor/stickers.d.cts +7 -2
  34. package/dist/image-editor/stickers.d.ts +7 -2
  35. package/dist/paint-editor/controller.d.cts +7 -2
  36. package/dist/paint-editor/controller.d.ts +7 -2
  37. package/dist/paint-editor/index.cjs +574 -521
  38. package/dist/paint-editor/index.js +97 -44
  39. package/dist/paint-editor/sticker-art.d.cts +20 -10
  40. package/dist/paint-editor/sticker-art.d.ts +20 -10
  41. package/dist/paint-editor/stickers.d.cts +8 -1
  42. package/dist/paint-editor/stickers.d.ts +8 -1
  43. package/dist/paint-editor/stroke.d.cts +2 -0
  44. package/dist/paint-editor/stroke.d.ts +2 -0
  45. package/dist/stickers/browser.d.cts +10 -3
  46. package/dist/stickers/browser.d.ts +10 -3
  47. package/dist/stickers/combine.d.cts +2 -0
  48. package/dist/stickers/combine.d.ts +2 -0
  49. package/dist/stickers/conformance.d.cts +1 -1
  50. package/dist/stickers/conformance.d.ts +1 -1
  51. package/dist/stickers/errors.d.cts +1 -1
  52. package/dist/stickers/errors.d.ts +1 -1
  53. package/dist/stickers/fake.d.cts +4 -2
  54. package/dist/stickers/fake.d.ts +4 -2
  55. package/dist/stickers/helpers.d.cts +16 -2
  56. package/dist/stickers/helpers.d.ts +16 -2
  57. package/dist/stickers/index.cjs +116 -29
  58. package/dist/stickers/index.js +106 -19
  59. package/dist/stickers/tools.d.cts +9 -2
  60. package/dist/stickers/tools.d.ts +9 -2
  61. package/dist/stickers/types.d.cts +32 -5
  62. package/dist/stickers/types.d.ts +32 -5
  63. package/dist/vector/index.cjs +972 -971
  64. package/dist/vector/index.js +7 -6
  65. package/dist/vector/stickers.d.cts +7 -2
  66. package/dist/vector/stickers.d.ts +7 -2
  67. package/package.json +1 -1
  68. package/skills/pixerate-stickers/SKILL.md +20 -9
@@ -26,7 +26,7 @@ import {
26
26
  traceField,
27
27
  traceVectorImage,
28
28
  vectorTraceContours
29
- } from "../chunk-CQVTGBQI.js";
29
+ } from "../chunk-JGI4PZWO.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-QAR2N7HZ.js";
56
+ } from "../chunk-6XX7E7O2.js";
57
57
  import {
58
58
  DEFAULT_VECTOR_FONT,
59
59
  IDENTITY_MATRIX,
@@ -529,11 +529,11 @@ import {
529
529
  withVectorStrokes,
530
530
  withVectorTargetPaint,
531
531
  zigzagPaths
532
- } from "../chunk-6NZL24W4.js";
532
+ } from "../chunk-34HIZXFX.js";
533
533
  import {
534
534
  snapshotBrushLibrary
535
- } from "../chunk-5IW65VQ6.js";
536
- import "../chunk-APX63ILU.js";
535
+ } from "../chunk-P5343XZO.js";
536
+ import "../chunk-ACFSFUQH.js";
537
537
  import {
538
538
  createProvenance
539
539
  } from "../chunk-M6DNZNVY.js";
@@ -18372,10 +18372,11 @@ function stickerVectorGroup(placement, id = "sticker") {
18372
18372
  const s = placement.width / box.width;
18373
18373
  return transformVectorNode(group, [s, 0, 0, s, placement.x - box.width * s / 2, placement.y - box.height * s / 2]);
18374
18374
  }
18375
- function createVectorStickerHost(controller) {
18375
+ function createVectorStickerHost(controller, options = {}) {
18376
18376
  return {
18377
18377
  noun: "group of editable paths",
18378
18378
  format: "svg",
18379
+ ...options.dark ? { dark: options.dark } : {},
18379
18380
  defaultCentre: () => {
18380
18381
  const d = controller.getDocument();
18381
18382
  return { x: d.width / 2, y: d.height / 2 };
@@ -7,5 +7,10 @@ import type { VectorEditorController } from './controller.cjs';
7
7
  import type { VectorGroupNode } from './types.cjs';
8
8
  /** A group of the sticker's paths, `placement.width` wide and centred on (`x`, `y`). */
9
9
  export declare function stickerVectorGroup(placement: StickerPlacement, id?: string): VectorGroupNode;
10
- /** `insert_sticker` for a vector editor: a group of editable paths, one undo step, selected. */
11
- export declare function createVectorStickerHost(controller: VectorEditorController): StickerInsertHost;
10
+ /**
11
+ * `insert_sticker` for a vector editor: a group of editable paths, one undo step, selected. With
12
+ * `dark` (the host's dark theme or artboard), stickers that have a dark variant use it.
13
+ */
14
+ export declare function createVectorStickerHost(controller: VectorEditorController, options?: {
15
+ dark?: () => boolean;
16
+ }): StickerInsertHost;
@@ -7,5 +7,10 @@ import type { VectorEditorController } from './controller.js';
7
7
  import type { VectorGroupNode } from './types.js';
8
8
  /** A group of the sticker's paths, `placement.width` wide and centred on (`x`, `y`). */
9
9
  export declare function stickerVectorGroup(placement: StickerPlacement, id?: string): VectorGroupNode;
10
- /** `insert_sticker` for a vector editor: a group of editable paths, one undo step, selected. */
11
- export declare function createVectorStickerHost(controller: VectorEditorController): StickerInsertHost;
10
+ /**
11
+ * `insert_sticker` for a vector editor: a group of editable paths, one undo step, selected. With
12
+ * `dark` (the host's dark theme or artboard), stickers that have a dark variant use it.
13
+ */
14
+ export declare function createVectorStickerHost(controller: VectorEditorController, options?: {
15
+ dark?: () => boolean;
16
+ }): StickerInsertHost;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.262.1",
3
+ "version": "0.263.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pixerate-stickers
3
- description: How to find, check and use stickers from the Pixerate sticker library through find_stickers and describe_sticker - the editor's own stamps (editor:star, editor:heart, ...) or any library a host plugged in (brand packs, uploads, third-party APIs), with refs (provider:id), categories, tags, tintable art and licences. Use when asked to add, spray, place, search for or credit stickers, or when find_stickers or describe_sticker are available.
3
+ description: How to find, check and use stickers from the Pixerate sticker library through find_stickers and describe_sticker - the editor's own stamps (editor:star, editor:heart, ...) or any library a host plugged in (brand packs, uploads, third-party APIs), with refs (provider:id), categories, collections, tags, tintable art, light / dark variants, AI-generated labels and licences. Use when asked to add, spray, place, search for or credit stickers, or when find_stickers or describe_sticker are available.
4
4
  ---
5
5
 
6
6
  # Stickers
@@ -14,17 +14,22 @@ none, it is the editor's own stamps (`editorStickers()`: `editor:dot`, `editor:s
14
14
  ## Working method
15
15
 
16
16
  1. **Find.** `find_stickers` with a few words (`query`) and, when the result's `categories`
17
- suggest one, a `category`. Pages are small: pass `next` as `after` for more, or narrow the
18
- query. Filter with `commercial: true` for anything that will be sold or used in marketing.
17
+ suggest one, a `category`. When the result lists `collections` (themed sets, such as one per
18
+ brand) and the job names one, pass its id as `collection`. Pages are small: pass `next` as
19
+ `after` for more, or narrow the query. Filter with `commercial: true` for anything that will
20
+ be sold or used in marketing.
19
21
  2. **Check.** `describe_sticker` when the choice matters: its licence (and the attribution line
20
- it asks for), dominant colours, variants and outline.
22
+ it asks for), whether the art is `aiGenerated`, its `variants`, dominant colours and outline.
21
23
  3. **Use.** Pass refs to the editor that places them: in the paint editor, a sticker brush
22
24
  (`set_brush` `tip.stamps`, then `paint_stroke`) sprays them and `add_stickers` places
23
25
  them exactly. In the vector, image and canvas editors, `insert_sticker` puts one in (`x`,
24
26
  `y` centre, `width`): vector, a group of editable paths; image, a pixel layer; canvas, a
25
27
  shape node from its outline in one colour. A provider's art loads before it is drawn.
26
28
  4. **Colour.** Tintable stickers (flat, single-colour art) take the paint colour or a sticker's
27
- `color`; the rest keep their own colours.
29
+ `color`; the rest keep their own colours. A sticker whose `variants` include `dark` has art
30
+ drawn for dark backgrounds: `insert_sticker` uses it when the host's canvas or theme is dark
31
+ (or pass `variant`), and the paint editor's sticker brush sprays it on a dark colour scheme
32
+ (each sticker keeps the variant it was drawn in).
28
33
  5. **Treat it with an effect.** In the image editor, `insert_sticker` returns the layer `id`;
29
34
  `apply_effect` with that `target` and any effect whose `describe_effect` inputs take an
30
35
  image (`appliesHere`) uses the sticker as its picture (holo foil, cut-out). For a whole set,
@@ -35,6 +40,10 @@ none, it is the editor's own stamps (`editorStickers()`: `editor:dot`, `editor:s
35
40
  - Keep refs exactly as `find_stickers` returns them; a bare editor stamp (`star`) also works
36
41
  and means `editor:star`.
37
42
  - Credit stickers whose licence has an `attribution` wherever the work is published.
43
+ - Say when art is `aiGenerated: true` if the user asked for hand-made art or must disclose AI
44
+ content; absent means the provider didn't say, not that it is hand-made.
45
+ - Leave `variant` out of `insert_sticker` unless the user asked for one: the default matches the
46
+ background.
38
47
  - Prefer tintable stickers when they must match a palette.
39
48
  - Vector stickers need SVG art and canvas stickers an outline (`silhouette`); `find_stickers`
40
49
  lists `formats`, and `describe_sticker` the outline. The image editor takes either.
@@ -42,7 +51,9 @@ none, it is the editor's own stamps (`editorStickers()`: `editor:dot`, `editor:s
42
51
  ## Pitfalls
43
52
 
44
53
  - An unknown ref is refused with the closest refs: pick one of those or search again.
45
- - A category that the library doesn't have is refused with the list of its categories.
54
+ - A category or collection that the library doesn't have is refused with the list of its
55
+ categories or collections. In a combined library, collection ids are `provider:collection`.
56
+ - `variant: "dark"` on a sticker without a dark variant is refused; check `variants` first.
46
57
  - `limit` is 1..100; results beyond a page need `after`, not a larger limit.
47
58
  - `color` on a sticker that is not tintable is refused; leave it out.
48
59
  - On the canvas, multi-colour art becomes its outline in its dominant colour; for the art itself,
@@ -52,6 +63,6 @@ none, it is the editor's own stamps (`editorStickers()`: `editor:dot`, `editor:s
52
63
 
53
64
  | Tool | Use |
54
65
  | --- | --- |
55
- | `find_stickers` | Search or list the library: `query`, `category`, `tags`, `commercial`, `limit`, `after`. Returns `items` (each `ref`, name, category, tags, width, height, formats, tintable, licence), `total`, `next`, `categories`. Changes nothing. |
56
- | `insert_sticker` | Put one sticker (`ref`) into the vector, image or canvas editor, centred at `x`, `y` (default the middle), `width` wide (default natural), tinted with `color` when tintable. One undo step. Returns the new group, layer or node `id`, the size and the licence. |
57
- | `describe_sticker` | One sticker by `ref`: everything `find_stickers` returns plus `silhouette` (SVG path data), `colours` and `variants`. Unknown refs are refused with the closest ones. Changes nothing. |
66
+ | `find_stickers` | Search or list the library: `query`, `category`, `collection`, `tags`, `commercial`, `limit`, `after`. Returns `items` (each `ref`, name, category, collection, tags, width, height, formats, tintable, aiGenerated, variants, licence), `total`, `next`, `categories`, `collections`. Changes nothing. |
67
+ | `insert_sticker` | Put one sticker (`ref`) into the vector, image or canvas editor, centred at `x`, `y` (default the middle), `width` wide (default natural), tinted with `color` when tintable, in its dark `variant` on a dark background (or the one passed). One undo step. Returns the new group, layer or node `id`, the size, the `variant` used and the licence. |
68
+ | `describe_sticker` | One sticker by `ref`: everything `find_stickers` returns plus `silhouette` (SVG path data) and `colours`. Unknown refs are refused with the closest ones. Changes nothing. |