@pixerate/editor 0.151.0 → 0.153.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 +4 -4
  2. package/dist/animation-editor/index.js +4 -4
  3. package/dist/canvas/index.cjs +16 -13
  4. package/dist/canvas/index.js +4 -1
  5. package/dist/chart/index.cjs +3 -3
  6. package/dist/chart/index.js +3 -3
  7. package/dist/{chunk-VGJTUCWM.js → chunk-4J4MC3F5.js} +72 -5
  8. package/dist/{chunk-LFKLA7RC.js → chunk-BCY22GBH.js} +39 -1
  9. package/dist/{chunk-2ZO4RSDS.cjs → chunk-HVX35M2I.cjs} +39 -1
  10. package/dist/{chunk-QSM3MDDJ.cjs → chunk-XFDQEAOS.cjs} +92 -25
  11. package/dist/image-editor/index.cjs +3 -3
  12. package/dist/image-editor/index.js +3 -3
  13. package/dist/index.cjs +41 -2
  14. package/dist/index.d.cts +1 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.js +40 -1
  17. package/dist/paint-editor/controller.d.cts +8 -2
  18. package/dist/paint-editor/controller.d.ts +8 -2
  19. package/dist/paint-editor/index.cjs +8 -4
  20. package/dist/paint-editor/index.js +8 -4
  21. package/dist/richTextDocument.d.cts +10 -0
  22. package/dist/richTextDocument.d.ts +10 -0
  23. package/dist/spreadsheet/controller.d.cts +17 -4
  24. package/dist/spreadsheet/controller.d.ts +17 -4
  25. package/dist/spreadsheet/editorDocument.d.cts +9 -0
  26. package/dist/spreadsheet/editorDocument.d.ts +9 -0
  27. package/dist/spreadsheet/index.cjs +7 -2
  28. package/dist/spreadsheet/index.d.cts +1 -0
  29. package/dist/spreadsheet/index.d.ts +1 -0
  30. package/dist/spreadsheet/index.js +6 -1
  31. package/dist/tokens/editorDocument.d.cts +10 -0
  32. package/dist/tokens/editorDocument.d.ts +10 -0
  33. package/dist/tokens/index.cjs +7 -2
  34. package/dist/tokens/index.d.cts +1 -0
  35. package/dist/tokens/index.d.ts +1 -0
  36. package/dist/tokens/index.js +6 -1
  37. package/dist/vector/index.cjs +4 -4
  38. package/dist/vector/index.js +4 -4
  39. package/dist/video-editor/index.cjs +4 -4
  40. package/dist/video-editor/index.js +4 -4
  41. package/package.json +1 -1
  42. package/skills/README.md +1 -0
  43. package/skills/pixerate-rich-text/SKILL.md +14 -0
  44. package/skills/pixerate-spreadsheet/SKILL.md +14 -0
  45. package/skills/pixerate-tokens/SKILL.md +56 -0
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: pixerate-tokens
3
+ description: How to read and change Pixerate design tokens (collections of variables with a value per mode, such as Light and Dark, and aliases between variables) through the shared document tools - getting the whole token set, editing collections, modes, variables and aliases, loading it back as one undo step, undo and redo, and saving or opening named token sets. Use when token tools (get_tokens_document, load_tokens_document...) are available or the user asks to change design tokens, theme colours, spacing scales or light / dark modes.
4
+ ---
5
+
6
+ # Design tokens
7
+
8
+ A token set holds **collections** (for example "Colours" or "Spacing"), each with one or more
9
+ **modes** ("Light" and "Dark", or "Mobile" and "Desktop"), and **variables** (`color`,
10
+ `number`, `string` or `boolean`) with a value for each mode of their collection. A value can be
11
+ an alias to another variable, so `button/background` can point at `brand/primary` and follow it.
12
+ Hosts turn the set into CSS variables per mode (`exportTokensCss`) and W3C design-token JSON.
13
+
14
+ There are no per-variable tools yet: read the whole set with `get_tokens_document`, change the
15
+ JSON, and write it back with `load_tokens_document`. Read `pixerate-agent-tools` first for tool
16
+ naming and errors.
17
+
18
+ ## Working method
19
+
20
+ 1. **Read.** `get_tokens_document`. Note collection, mode and variable ids: values are keyed by
21
+ mode id, and aliases name variable ids.
22
+ 2. **Change the copy.** Keep every id you are not deliberately removing. New ids must be unique
23
+ strings. Give every variable a value for every mode of its collection.
24
+ 3. **Write once.** `load_tokens_document` with the whole edited document. It is checked first: a
25
+ variable in a missing collection, a value for a missing mode or a broken alias is refused and
26
+ nothing changes. One load is one undo step.
27
+ 4. **Check.** Read the result's `revision`; if it did not change, nothing was different.
28
+
29
+ ## Best practices
30
+
31
+ - Name variables by role, not value: `text/primary`, not `grey-900`. Use `/` for groups.
32
+ - Put raw values in one primitives collection and point role variables at them with aliases,
33
+ so a theme change touches one place.
34
+ - Keep modes for real alternatives (Light / Dark). Do not make a mode per brand colour.
35
+ - Do not alias a variable to itself or in a cycle.
36
+
37
+ ## Save and open
38
+
39
+ The host may add the shared document tools (see `pixerate-agent-tools`). A tokens document is the whole `TokenState`: `{ collections: [{ id, name, modes: [{ id, name }] }], variables: [{ id, collectionId, name, type, valuesByMode }] }`. A value is a literal for its type (`"#rrggbb"` colours, numbers, strings, booleans) or an alias `{ "alias": "<variable id>" }`.
40
+
41
+ | Tool | Use |
42
+ | --- | --- |
43
+ | `get_tokens_document` | Take a copy of the whole token set as `{ kind, formatVersion, revision, document }` before a risky rewrite, or to hand it on. To read the token set, use `get_tokens_document`: it is smaller and says more. Refuses very large documents. |
44
+ | `load_tokens_document` | Put back a copy from `get_tokens_document` (its `document`, or the whole result). Checked first: when anything is wrong nothing changes and the error says what. One undo step (`undo_tokens` brings the previous token set back). Use it for every change: read the document, edit the JSON, load it back. |
45
+ | `undo_tokens` | Undo the last token set edit (one tool call or one user gesture). Returns `undone` (the step's name, when it has one) and whether more can be undone. Fails with "Nothing to undo." when there is nothing. |
46
+ | `redo_tokens` | Redo the last undone token set edit. |
47
+ | `save_tokens_document` | Save the token set under a `name` in the host's storage (the same name replaces that copy). Returns the `key`. Only listed when the host has storage. Save when the user asks, not after every edit. |
48
+ | `list_saved_tokens_documents` | List saved token sets (`key`, `name`, `savedAt`), newest first. |
49
+ | `open_saved_tokens_document` | Replace the token set with a saved one by `key`. One undo step. Ask before opening over changes the user has not saved. |
50
+
51
+ ## Pitfalls
52
+
53
+ - Removing a variable that others alias leaves broken aliases: point them elsewhere in the same
54
+ load.
55
+ - `load_tokens_document` replaces everything. Do not send a partial document: missing
56
+ collections and variables are deleted.