@pixerate/editor 0.165.0 → 0.166.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/agent/index.cjs +34 -34
  2. package/dist/agent/index.js +5 -5
  3. package/dist/canvas/index.cjs +6 -6
  4. package/dist/canvas/index.js +2 -2
  5. package/dist/chart/controller.d.cts +29 -0
  6. package/dist/chart/controller.d.ts +29 -0
  7. package/dist/chart/index.cjs +301 -179
  8. package/dist/chart/index.d.cts +1 -0
  9. package/dist/chart/index.d.ts +1 -0
  10. package/dist/chart/index.js +132 -10
  11. package/dist/chart/layout-families.d.cts +7 -0
  12. package/dist/chart/layout-families.d.ts +7 -0
  13. package/dist/chart/layout-shared.d.cts +5 -0
  14. package/dist/chart/layout-shared.d.ts +5 -0
  15. package/dist/chart/race.d.cts +26 -0
  16. package/dist/chart/race.d.ts +26 -0
  17. package/dist/chart/schemas.d.cts +2 -0
  18. package/dist/chart/schemas.d.ts +2 -0
  19. package/dist/chart/spec.d.cts +1 -1
  20. package/dist/chart/spec.d.ts +1 -1
  21. package/dist/chart/types.d.cts +6 -2
  22. package/dist/chart/types.d.ts +6 -2
  23. package/dist/{chunk-FEU2XVQH.js → chunk-5UNQDC3Q.js} +5 -2
  24. package/dist/{chunk-64VWWR5U.cjs → chunk-6FYIFGBW.cjs} +16 -16
  25. package/dist/{chunk-UVXTOZ2B.cjs → chunk-BPX4Z3N3.cjs} +12 -3
  26. package/dist/{chunk-MKXK6E4O.cjs → chunk-CHLV7UFP.cjs} +51 -51
  27. package/dist/{chunk-X5W645RI.js → chunk-DFCAR7AW.js} +3 -3
  28. package/dist/{chunk-2ZRN43IN.js → chunk-FR432ROA.js} +12 -3
  29. package/dist/{chunk-ODFCS7HF.cjs → chunk-HXOBOHH2.cjs} +8 -8
  30. package/dist/{chunk-V5GSY3NC.js → chunk-ITANXMZD.js} +78 -2
  31. package/dist/{chunk-TVQW26AV.cjs → chunk-MZFZSVUJ.cjs} +26 -23
  32. package/dist/{chunk-N7NBGT2Y.js → chunk-NQQDGGXY.js} +2 -2
  33. package/dist/{chunk-Q25WAFTD.cjs → chunk-SZWVMB3B.cjs} +21 -18
  34. package/dist/{chunk-QO2T6KA5.cjs → chunk-UUUTEVX6.cjs} +116 -40
  35. package/dist/{chunk-IMRXC7OA.cjs → chunk-V5L2G22R.cjs} +153 -77
  36. package/dist/{chunk-2J5VLJHC.js → chunk-VB2CY6EG.js} +3 -3
  37. package/dist/{chunk-CRFSQWKQ.js → chunk-XNU45TYA.js} +4 -1
  38. package/dist/{chunk-FRBRLKNQ.js → chunk-YUFTVNLX.js} +78 -2
  39. package/dist/export/index.cjs +4 -4
  40. package/dist/export/index.js +3 -3
  41. package/dist/extensions/index.cjs +7 -7
  42. package/dist/extensions/index.js +6 -6
  43. package/dist/index.cjs +13 -13
  44. package/dist/index.js +7 -7
  45. package/package.json +1 -1
  46. package/skills/pixerate-chart/SKILL.md +20 -2
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  exportDocx,
13
13
  exportDocxBlob,
14
14
  stripInvalidXmlChars
15
- } from "./chunk-N7NBGT2Y.js";
15
+ } from "./chunk-NQQDGGXY.js";
16
16
  import {
17
17
  deflateRaw,
18
18
  writeZip
@@ -165,7 +165,7 @@ import {
165
165
  updateImageSrc,
166
166
  validateFindPattern,
167
167
  writeRichClipboard
168
- } from "./chunk-2J5VLJHC.js";
168
+ } from "./chunk-VB2CY6EG.js";
169
169
  import {
170
170
  DEFAULT_STYLES,
171
171
  NORMAL_STYLE_ID,
@@ -174,7 +174,7 @@ import {
174
174
  isValidStyleId,
175
175
  safeCSSValue
176
176
  } from "./chunk-CXXKJBQZ.js";
177
- import "./chunk-CRFSQWKQ.js";
177
+ import "./chunk-XNU45TYA.js";
178
178
  import {
179
179
  compareDocuments,
180
180
  compareHtml,
@@ -246,11 +246,11 @@ import {
246
246
  tableNestingPluginKey,
247
247
  typeAgentText,
248
248
  unnestTables
249
- } from "./chunk-X5W645RI.js";
250
- import "./chunk-FRBRLKNQ.js";
249
+ } from "./chunk-DFCAR7AW.js";
250
+ import "./chunk-YUFTVNLX.js";
251
251
  import "./chunk-KGRZMHZB.js";
252
- import "./chunk-V5GSY3NC.js";
253
- import "./chunk-2ZRN43IN.js";
252
+ import "./chunk-ITANXMZD.js";
253
+ import "./chunk-FR432ROA.js";
254
254
  import "./chunk-O6OGNDND.js";
255
255
  import "./chunk-6T4BV5B4.js";
256
256
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.165.0",
3
+ "version": "0.166.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-chart
3
- description: How to build, edit and check charts in the Pixerate chart editor through its agent tools and chart.* commands - bar, column, line, area, scatter, bubble, pie, donut, radar, waterfall, histogram, box plot, funnel, treemap (flat or grouped), sunburst, Sankey, slope, Likert (survey) and parliament charts; series, categories, stacking, secondary axis, log axis, number formats, data labels, legend, trendline, error bars, reference lines and target bands, callouts, highlighting, footnotes, colour palettes and colour-blind checks, CSV and Mermaid import, Office chart XML export, and reading charts out of open .xlsx, .pptx and .docx files. Use when a chart editor's tools (get_chart, update_chart, set_chart_values, list_file_charts...) are available or the user asks to make, restyle, fix or explain a chart.
3
+ description: How to build, edit and check charts in the Pixerate chart editor through its agent tools and chart.* commands - bar, column, line, area, scatter, bubble, pie, donut, radar, waterfall, histogram, box plot, funnel, treemap (flat or grouped), sunburst, Sankey, slope, Likert (survey), parliament and bar chart race charts; series, categories, stacking, secondary axis, log axis, number formats, data labels, legend, trendline, error bars, reference lines and target bands, callouts, highlighting, footnotes, colour palettes and colour-blind checks, CSV and Mermaid import, Office chart XML export, and reading charts out of open .xlsx, .pptx and .docx files. Use when a chart editor's tools (get_chart, update_chart, set_chart_values, list_file_charts...) are available or the user asks to make, restyle, fix or explain a chart.
4
4
  ---
5
5
 
6
6
  # Charts
@@ -24,6 +24,11 @@ and the first series their totals, so a treemap nests the groups, a sunburst dra
24
24
  rings, and any other type draws the totals. Nodes are addressed by `path`, the names from the
25
25
  top down (`["Europe", "France"]`); `get_chart` returns them as `treeTable`.
26
26
 
27
+ A bar race (`barrace`) reads the ordinary table differently: each category is a time point
28
+ and each series a name, and it draws the top `raceTopN` names at one moment as ranked bars.
29
+ Which moment is shown is view state (`set_chart_race_frame`, `play_chart_race`), not part of
30
+ the chart.
31
+
27
32
  Flows live in `spec.links` (`{source, target, value}` between named nodes). They work the same
28
33
  way: when set they are the data, the categories are the nodes (stacked in `sankeyNodes`
29
34
  order) and the first series how much passes through each. Flows are addressed by index in
@@ -81,6 +86,8 @@ Charts inside a rich-text document are not edited with these tools: use `insert_
81
86
  total in the middle). Load the levels with `import_chart_tree_csv` or `set_chart_tree`.
82
87
  Flows from stage to stage (a pipeline, a budget, energy or traffic sources): sankey; load
83
88
  rows of source, target, value with `import_chart_links_csv` or `set_chart_links`.
89
+ A ranking that changes over time (sales by product per year, top cities per decade): barrace,
90
+ with time points as categories and one series per name; keep `raceTopN` to about 10.
84
91
  Seats or votes per group with a majority: parliament (`parliamentMajority`,
85
92
  `parliamentArc`, `parliamentLabel`).
86
93
  - **Bars start at zero.** Bar length encodes the value, so never set a non-zero `min` on the
@@ -142,6 +149,7 @@ Charts inside a rich-text document are not edited with these tools: use `insert_
142
149
  | `check_chart_colors` | Check the chart's series (or slice) colours, or a `colors` list, for normal vision, protanopia, deuteranopia and tritanopia, and contrast against `surface` (default white). Returns the closest pair per vision and problems as sentences. Run after any colour change. |
143
150
  | `recommend_chart` | Ranked chart types with a reason each, from `csv` when given, else the current data (series count, points, dates, negative values). Use before choosing a type. |
144
151
  | `get_chart_trendline` | Read a trendline's fit (`series`, `index`): coefficients, R2, equation and point count, or the moving-average points. Fails when the fit needs more or positive values. |
152
+ | `get_chart_race_ranking` | Read who leads a bar race at a moment (`time`: a category label or index, fractional between time points; default the moment shown): the top `raceTopN` with rank, series id and value. Read-only; use it to describe the race instead of rendering frames. |
145
153
  | `list_chart_presets` | List the quick layouts (`standard`, `minimal`, `labelled`, `legend-right`, `presentation`, `analysis`) and colour schemes (such as `default`, `okabe-ito`, `office`, monochrome) with what each changes. |
146
154
  | `export_chart_mermaid` | Get the chart as Mermaid for Markdown or chat: `xychart-beta`, `pie` or `radar-beta`, `sankey-beta` for Sankey diagrams with flows (title in frontmatter), `treemap-beta` for treemaps and sunbursts with their levels. With `meta` (default true) a `%% @pixerate` comment keeps everything Mermaid cannot express so `import_chart_mermaid` restores it exactly. |
147
155
  | `export_chart_ooxml` | Get a DrawingML `c:chartSpace` part for Word or PowerPoint, plus sentences for anything that could not be written. |
@@ -156,7 +164,7 @@ it changed.
156
164
 
157
165
  | Tool | Use it to |
158
166
  | --- | --- |
159
- | `update_chart` | Change presentation in one all-or-nothing call: `type`, `title`, `subtitle`, `xAxis` / `yAxis` / `yAxis2` (show, title, min, max, step, gridlines, format, kind `"date"`, scale `"log"`, logBase, reverse), `legend` (show, position top / bottom / left / right), `stacking` (none / stacked / percent), `orientation`, `curve`, `points`, `dataLabels`, `labelPosition`, `palette`, `innerRadius` (donut hole, 0-0.9), `gapWidth`, `overlap`, `bins`, `showTotal`, `radarTicks` (radar ring count 1-50, null for round numbers), `radarGraticule` (radar rings as `polygon` or `circle`), `note` (footnote, "" for none), `highlight` (whole list of names), `referenceLines` / `referenceBands` (whole lists; prefer the add tools), `varyColors` (one colour per category on a one-series chart), `likertNeutral` (`split` / `separate`), `likertSort` (`none` / `positive` / `negative`), `parliamentArc` (90-360 degrees), `parliamentMajority` (seats, null for half plus one), `parliamentLabel` (caption under the total), `sunburstLabel` (caption under a sunburst's total), `sankeyLinkColor` (`source` / `target` / `gray`), `sankeyNodes` (node stacking order). Invalid values change nothing and come back as sentences. Returns the spec. |
167
+ | `update_chart` | Change presentation in one all-or-nothing call: `type`, `title`, `subtitle`, `xAxis` / `yAxis` / `yAxis2` (show, title, min, max, step, gridlines, format, kind `"date"`, scale `"log"`, logBase, reverse), `legend` (show, position top / bottom / left / right), `stacking` (none / stacked / percent), `orientation`, `curve`, `points`, `dataLabels`, `labelPosition`, `palette`, `innerRadius` (donut hole, 0-0.9), `gapWidth`, `overlap`, `bins`, `showTotal`, `radarTicks` (radar ring count 1-50, null for round numbers), `radarGraticule` (radar rings as `polygon` or `circle`), `note` (footnote, "" for none), `highlight` (whole list of names), `referenceLines` / `referenceBands` (whole lists; prefer the add tools), `varyColors` (one colour per category on a one-series chart), `likertNeutral` (`split` / `separate`), `likertSort` (`none` / `positive` / `negative`), `parliamentArc` (90-360 degrees), `parliamentMajority` (seats, null for half plus one), `parliamentLabel` (caption under the total), `sunburstLabel` (caption under a sunburst's total), `sankeyLinkColor` (`source` / `target` / `gray`), `sankeyNodes` (node stacking order), `raceTopN` (bars per moment, 1-30). Invalid values change nothing and come back as sentences. Returns the spec. |
160
168
  | `set_chart_data` | Replace `categories` and / or all `series` (each with `name`, `values` and optional settings). Values are padded with gaps to the categories. Use for whole tables and for re-sorting. Returns the table and series ids. |
161
169
  | `set_chart_values` | Set individual `cells` (`series`, `category`, `value`) all-or-nothing. Values may be numbers, numeric text (`"1,200"`, `"12%"`, `"$40"`, `"(3)"`) or `null` for a gap. Returns the stored values. Acted out with a cursor when the host has a director. |
162
170
  | `add_chart_series` | Add a series (`name` required; `values`, `color`, `type` for a combo, `axis: "secondary"`, `x` / `sizes` for scatter and bubble, marker, format, error bars, `id`, `at`). Selects it and returns its id. |
@@ -188,6 +196,8 @@ it changed.
188
196
  | `add_chart_link` | Add one flow (new names add nodes). Refused for a repeated pair or a loop. Returns its `index` and its two nodes' throughput. |
189
197
  | `update_chart_link` | Change a flow's source, target, value or colour by `index` (from `spec.links`). |
190
198
  | `remove_chart_link` | Delete a flow by `index`; nodes no flow uses any more go. Returns the flows left. |
199
+ | `set_chart_race_frame` | Show the bar race at a moment (`time`, or null for the last) and stop playback. View state, not an undo step. Returns the moment and the ranking shown. |
200
+ | `play_chart_race` | Start playing the race for the user from the moment shown, one time point every `msPerStep` ms; returns at once with the duration. |
191
201
  | `apply_chart_preset` | Apply a quick `layout` and / or a `colors` scheme from `list_chart_presets` in one step. |
192
202
  | `transpose_chart` | Swap series and categories. Drops per-series colours and settings, so restyle afterwards. |
193
203
  | `select_chart_element` | Select part of the chart (`kind`: none, chart, title, subtitle, legend, axis, series, point, category, trendline) for the user to see or before `press_chart_key`. |
@@ -249,6 +259,10 @@ several charts may register them with another prefix.
249
259
  | `chart.addLink` | Add a flow; returns its index. |
250
260
  | `chart.updateLink` | Change a flow by index. |
251
261
  | `chart.removeLink` | Delete a flow by index. |
262
+ | `chart.raceRanking` | Read a bar race ranking (as `get_chart_race_ranking`). |
263
+ | `chart.setRaceFrame` | Show a bar race moment. |
264
+ | `chart.playRace` | Play the bar race. |
265
+ | `chart.pauseRace` | Pause bar race playback (the palette command people use; agents use `set_chart_race_frame`). |
252
266
  | `chart.applyPreset` | Apply a quick layout and / or colour scheme. |
253
267
  | `chart.transpose` | Swap series and categories. |
254
268
  | `chart.importCsv` | Replace data from CSV / TSV (no automatic chart type). |
@@ -283,6 +297,10 @@ several charts may register them with another prefix.
283
297
  categories, `transpose_chart`) are refused, because the totals come from the tree or flows.
284
298
  Edit the nodes or flows, or replace the data (`set_chart_data`, `import_chart_csv`), which
285
299
  clears them.
300
+ - A bar race fills gaps with the last known value (0 before a name's first), and values and
301
+ places ease between time points, so a name can sit between two places mid-swap. `render_chart`
302
+ takes `time` to draw one moment. Office and Mermaid export cannot animate: they get every
303
+ name at every time point as clustered bars.
286
304
  - Sankey columns come from the flows: a node sits one column after the furthest node that
287
305
  flows into it, and nodes with no outgoing flow line up on the right. Within a column nodes
288
306
  stack in `sankeyNodes` order; if flows cross badly, reorder `sankeyNodes` (for instance,