@pixerate/editor 0.164.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 (146) hide show
  1. package/dist/agent/index.cjs +54 -39
  2. package/dist/agent/index.js +24 -9
  3. package/dist/animation/index.cjs +6 -5
  4. package/dist/animation/index.js +5 -4
  5. package/dist/animation-editor/index.cjs +65 -64
  6. package/dist/animation-editor/index.js +8 -7
  7. package/dist/bridge/cli.cjs +3 -3
  8. package/dist/bridge/cli.js +2 -2
  9. package/dist/bridge/index.cjs +3 -3
  10. package/dist/bridge/index.js +2 -2
  11. package/dist/canvas/index.cjs +89 -87
  12. package/dist/canvas/index.js +11 -9
  13. package/dist/chart/controller.d.cts +60 -2
  14. package/dist/chart/controller.d.ts +60 -2
  15. package/dist/chart/index.cjs +657 -163
  16. package/dist/chart/index.d.cts +3 -0
  17. package/dist/chart/index.d.ts +3 -0
  18. package/dist/chart/index.js +512 -18
  19. package/dist/chart/layout-families.d.cts +14 -0
  20. package/dist/chart/layout-families.d.ts +14 -0
  21. package/dist/chart/layout-shared.d.cts +5 -0
  22. package/dist/chart/layout-shared.d.ts +5 -0
  23. package/dist/chart/links.d.cts +34 -0
  24. package/dist/chart/links.d.ts +34 -0
  25. package/dist/chart/mermaid.d.cts +9 -6
  26. package/dist/chart/mermaid.d.ts +9 -6
  27. package/dist/chart/race.d.cts +26 -0
  28. package/dist/chart/race.d.ts +26 -0
  29. package/dist/chart/schemas.d.cts +5 -0
  30. package/dist/chart/schemas.d.ts +5 -0
  31. package/dist/chart/spec.d.cts +3 -2
  32. package/dist/chart/spec.d.ts +3 -2
  33. package/dist/chart/style.d.cts +33 -0
  34. package/dist/chart/style.d.ts +33 -0
  35. package/dist/chart/types.d.cts +28 -2
  36. package/dist/chart/types.d.ts +28 -2
  37. package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
  38. package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
  39. package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
  40. package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
  41. package/dist/{chunk-5FNGLV2D.js → chunk-5UNQDC3Q.js} +18 -3
  42. package/dist/{chunk-YSAGBIRW.cjs → chunk-6FYIFGBW.cjs} +16 -16
  43. package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
  44. package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
  45. package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
  46. package/dist/{chunk-R3P2M7HU.cjs → chunk-BPX4Z3N3.cjs} +355 -207
  47. package/dist/{chunk-D54JHQK2.cjs → chunk-CHLV7UFP.cjs} +51 -51
  48. package/dist/{chunk-OXERWBKE.js → chunk-DFCAR7AW.js} +3 -3
  49. package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
  50. package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
  51. package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
  52. package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
  53. package/dist/{chunk-3NEZJCBY.js → chunk-FR432ROA.js} +349 -201
  54. package/dist/chunk-HIDFL5LQ.js +484 -0
  55. package/dist/{chunk-22KLZZGH.cjs → chunk-HXOBOHH2.cjs} +8 -8
  56. package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
  57. package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
  58. package/dist/{chunk-Z4P2RBMJ.js → chunk-ITANXMZD.js} +177 -3
  59. package/dist/chunk-KGRZMHZB.js +204 -0
  60. package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
  61. package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
  62. package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
  63. package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
  64. package/dist/{chunk-NZD2MZJC.cjs → chunk-MZFZSVUJ.cjs} +38 -23
  65. package/dist/{chunk-DAPQGA55.js → chunk-NQQDGGXY.js} +2 -2
  66. package/dist/chunk-O6OGNDND.js +164 -0
  67. package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
  68. package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
  69. package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
  70. package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
  71. package/dist/{chunk-YGG7WDWT.cjs → chunk-SZWVMB3B.cjs} +24 -18
  72. package/dist/chunk-TFF2GTGN.cjs +153 -0
  73. package/dist/chunk-TTCJPX4U.cjs +204 -0
  74. package/dist/{chunk-SBQVEBSU.cjs → chunk-UUUTEVX6.cjs} +242 -68
  75. package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
  76. package/dist/{chunk-GKNEJ6EN.cjs → chunk-V5L2G22R.cjs} +321 -107
  77. package/dist/{chunk-TALQONZ5.js → chunk-VB2CY6EG.js} +3 -3
  78. package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
  79. package/dist/chunk-VU6WQSMB.cjs +164 -0
  80. package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
  81. package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
  82. package/dist/{chunk-POR54B55.js → chunk-XNU45TYA.js} +7 -1
  83. package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
  84. package/dist/chunk-YBAPT7NL.js +153 -0
  85. package/dist/{chunk-SZA42R4N.js → chunk-YUFTVNLX.js} +230 -16
  86. package/dist/chunk-Z2UQYMPS.cjs +484 -0
  87. package/dist/color/index.cjs +5 -3
  88. package/dist/color/index.js +12 -10
  89. package/dist/diagram/index.cjs +55 -243
  90. package/dist/diagram/index.js +12 -200
  91. package/dist/export/index.cjs +7 -6
  92. package/dist/export/index.js +6 -5
  93. package/dist/extensions/index.cjs +12 -9
  94. package/dist/extensions/index.js +11 -8
  95. package/dist/gradient/index.cjs +29 -27
  96. package/dist/gradient/index.js +6 -4
  97. package/dist/image-editor/index.cjs +644 -643
  98. package/dist/image-editor/index.js +7 -6
  99. package/dist/index.cjs +21 -18
  100. package/dist/index.js +14 -11
  101. package/dist/paint-editor/index.cjs +19 -18
  102. package/dist/paint-editor/index.js +7 -6
  103. package/dist/parameters/index.cjs +2 -2
  104. package/dist/parameters/index.js +1 -1
  105. package/dist/persistence/assetWrites.d.cts +22 -0
  106. package/dist/persistence/assetWrites.d.ts +22 -0
  107. package/dist/persistence/assets.d.cts +71 -0
  108. package/dist/persistence/assets.d.ts +71 -0
  109. package/dist/persistence/documentStore.d.cts +17 -1
  110. package/dist/persistence/documentStore.d.ts +17 -1
  111. package/dist/persistence/documentTools.d.cts +5 -1
  112. package/dist/persistence/documentTools.d.ts +5 -1
  113. package/dist/persistence/editorAutosave.d.cts +7 -0
  114. package/dist/persistence/editorAutosave.d.ts +7 -0
  115. package/dist/persistence/index.cjs +141 -21
  116. package/dist/persistence/index.js +130 -10
  117. package/dist/persistence/storage.d.cts +13 -1
  118. package/dist/persistence/storage.d.ts +13 -1
  119. package/dist/spreadsheet/index.cjs +3 -3
  120. package/dist/spreadsheet/index.js +2 -2
  121. package/dist/tokens/index.cjs +11 -3
  122. package/dist/tokens/index.d.cts +1 -0
  123. package/dist/tokens/index.d.ts +1 -0
  124. package/dist/tokens/index.js +10 -2
  125. package/dist/tokens/style.d.cts +36 -0
  126. package/dist/tokens/style.d.ts +36 -0
  127. package/dist/tools/index.cjs +15 -3
  128. package/dist/tools/index.d.cts +2 -0
  129. package/dist/tools/index.d.ts +2 -0
  130. package/dist/tools/index.js +14 -2
  131. package/dist/tools/style-tools.d.cts +19 -0
  132. package/dist/tools/style-tools.d.ts +19 -0
  133. package/dist/tools/style.d.cts +212 -0
  134. package/dist/tools/style.d.ts +212 -0
  135. package/dist/tools/view.d.cts +6 -0
  136. package/dist/tools/view.d.ts +6 -0
  137. package/dist/typography/index.cjs +8 -6
  138. package/dist/typography/index.js +5 -3
  139. package/dist/vector/index.cjs +953 -952
  140. package/dist/vector/index.js +7 -6
  141. package/dist/video-editor/index.cjs +8 -7
  142. package/dist/video-editor/index.js +6 -5
  143. package/package.json +1 -1
  144. package/skills/pixerate-chart/SKILL.md +20 -2
  145. package/dist/chunk-ERAGQL2N.cjs +0 -68
  146. package/dist/chunk-KMU6QJB7.js +0 -68
@@ -38,7 +38,7 @@ import {
38
38
  reverseMorphContour,
39
39
  subpathToMorphContour,
40
40
  turnMorphContour
41
- } from "../chunk-QY4KUDMY.js";
41
+ } from "../chunk-VRXXAXUT.js";
42
42
  import {
43
43
  DEFAULT_VECTOR_FONT,
44
44
  IDENTITY_MATRIX,
@@ -507,7 +507,7 @@ import {
507
507
  withVectorStrokes,
508
508
  withVectorTargetPaint,
509
509
  zigzagPaths
510
- } from "../chunk-SET6KJOP.js";
510
+ } from "../chunk-LPIKXPBM.js";
511
511
  import "../chunk-YXKLVD56.js";
512
512
  import {
513
513
  createProvenance
@@ -560,18 +560,19 @@ import "../chunk-SIFAIGB3.js";
560
560
  import "../chunk-VDGBHYC7.js";
561
561
  import {
562
562
  defineEditorDocument
563
- } from "../chunk-NHLYK3AX.js";
563
+ } from "../chunk-XBQX76CT.js";
564
564
  import "../chunk-HF5QZS7Z.js";
565
565
  import {
566
566
  HistoryManager
567
567
  } from "../chunk-RNSANXPT.js";
568
568
  import "../chunk-5UJHB3BW.js";
569
- import "../chunk-BQWGN5WH.js";
569
+ import "../chunk-M2TPMYJE.js";
570
570
  import {
571
571
  hexToRgba
572
572
  } from "../chunk-2WPNAGHI.js";
573
- import "../chunk-QYZGBVNC.js";
574
- import "../chunk-4VU4CP7R.js";
573
+ import "../chunk-7272D3K2.js";
574
+ import "../chunk-YBAPT7NL.js";
575
+ import "../chunk-MHLU6GRJ.js";
575
576
  import "../chunk-6ONMQ6WF.js";
576
577
 
577
578
  // src/vector/trace.ts
@@ -161,22 +161,23 @@ var _chunkRUZQMYXHcjs = require('../chunk-RUZQMYXH.cjs');
161
161
  require('../chunk-WOFXZ3XU.cjs');
162
162
 
163
163
 
164
- var _chunkM4MIZPQIcjs = require('../chunk-M4MIZPQI.cjs');
164
+ var _chunkSJ2CPTQCcjs = require('../chunk-SJ2CPTQC.cjs');
165
165
  require('../chunk-2BSBFBOA.cjs');
166
166
 
167
167
 
168
168
  var _chunkFJ2MSI43cjs = require('../chunk-FJ2MSI43.cjs');
169
169
 
170
170
 
171
- var _chunkGTELFJREcjs = require('../chunk-GTELFJRE.cjs');
171
+ var _chunkM5GLQQWGcjs = require('../chunk-M5GLQQWG.cjs');
172
172
 
173
173
 
174
174
 
175
175
  var _chunkDWJJI6RTcjs = require('../chunk-DWJJI6RT.cjs');
176
- require('../chunk-CIPIESX4.cjs');
176
+ require('../chunk-4ZC5QJE2.cjs');
177
177
  require('../chunk-A6QWKBJP.cjs');
178
- require('../chunk-ES3UEVUT.cjs');
179
- require('../chunk-S6X2QRVU.cjs');
178
+ require('../chunk-EUIDTZNQ.cjs');
179
+ require('../chunk-TFF2GTGN.cjs');
180
+ require('../chunk-5UEFBM2M.cjs');
180
181
  require('../chunk-IPJ3TEYR.cjs');
181
182
 
182
183
  // src/video-editor/parse.ts
@@ -3357,7 +3358,7 @@ var VideoEditorController = (_class7 = class _VideoEditorController {
3357
3358
  this.readOnly = _nullishCoalesce(options.readOnly, () => ( false));
3358
3359
  this.previewScale = checkPreviewScale(_nullishCoalesce(options.previewScale, () => ( "auto")));
3359
3360
  this.onChange = options.onChange;
3360
- this.player = new (0, _chunkGTELFJREcjs.AnimationPlayer)({ clock: options.clock, duration: () => _chunk3OSXHLITcjs.videoProjectDuration.call(void 0, this.project), loop: "none" });
3361
+ this.player = new (0, _chunkM5GLQQWGcjs.AnimationPlayer)({ clock: options.clock, duration: () => _chunk3OSXHLITcjs.videoProjectDuration.call(void 0, this.project), loop: "none" });
3361
3362
  this.state = this.computeState();
3362
3363
  this.connect();
3363
3364
  }
@@ -6152,7 +6153,7 @@ var videoAuthorableEffects = (clip) => _nullishCoalesce(clip.effects, () => ( []
6152
6153
 
6153
6154
  // src/video-editor/editorDocument.ts
6154
6155
  function createVideoEditorDocument(controller) {
6155
- return _chunkM4MIZPQIcjs.defineEditorDocument.call(void 0, {
6156
+ return _chunkSJ2CPTQCcjs.defineEditorDocument.call(void 0, {
6156
6157
  kind: "video",
6157
6158
  get: () => controller.getProject(),
6158
6159
  load: (document2, { history }) => {
@@ -161,22 +161,23 @@ import {
161
161
  import "../chunk-V2ZCJRDM.js";
162
162
  import {
163
163
  defineEditorDocument
164
- } from "../chunk-NHLYK3AX.js";
164
+ } from "../chunk-XBQX76CT.js";
165
165
  import "../chunk-HF5QZS7Z.js";
166
166
  import {
167
167
  HistoryManager
168
168
  } from "../chunk-RNSANXPT.js";
169
169
  import {
170
170
  AnimationPlayer
171
- } from "../chunk-H3OEM3Q2.js";
171
+ } from "../chunk-F6R67I3A.js";
172
172
  import {
173
173
  CUBIC_BEZIER_PRESETS,
174
174
  evaluateEasing
175
175
  } from "../chunk-5UJHB3BW.js";
176
- import "../chunk-BQWGN5WH.js";
176
+ import "../chunk-M2TPMYJE.js";
177
177
  import "../chunk-2WPNAGHI.js";
178
- import "../chunk-QYZGBVNC.js";
179
- import "../chunk-4VU4CP7R.js";
178
+ import "../chunk-7272D3K2.js";
179
+ import "../chunk-YBAPT7NL.js";
180
+ import "../chunk-MHLU6GRJ.js";
180
181
  import "../chunk-6ONMQ6WF.js";
181
182
 
182
183
  // src/video-editor/parse.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.164.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,
@@ -1,68 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkGMWNBSBScjs = require('./chunk-GMWNBSBS.cjs');
4
-
5
- // src/tools/script.ts
6
- function toolResultValue(result) {
7
- if (result.structuredContent) return result.structuredContent;
8
- const text = result.content.find((b) => b.type === "text");
9
- if (!_optionalChain([text, 'optionalAccess', _ => _.text])) return void 0;
10
- try {
11
- return JSON.parse(text.text);
12
- } catch (e) {
13
- return text.text;
14
- }
15
- }
16
- function toolResultError(result) {
17
- const text = result.content.find((b) => b.type === "text");
18
- return _nullishCoalesce(_optionalChain([text, 'optionalAccess', _2 => _2.text]), () => ( "The tool failed."));
19
- }
20
- var realWait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
21
- async function runToolScript(source, script, options = {}) {
22
- const control = _nullishCoalesce(options.control, () => ( { speed: 1, stopped: false }));
23
- const wait = _nullishCoalesce(options.wait, () => ( realWait));
24
- const pause = (ms) => Number.isFinite(control.speed) ? wait(ms / Math.max(0.1, control.speed)) : Promise.resolve();
25
- const emit = _nullishCoalesce(options.onEvent, () => ( (() => {
26
- })));
27
- const ctx = { results: {}, last: void 0 };
28
- const finish = (ok) => {
29
- if (control.stopped) _optionalChain([options, 'access', _3 => _3.playback, 'optionalAccess', _4 => _4.stop, 'call', _5 => _5()]);
30
- emit({ type: "done", ok, stopped: control.stopped });
31
- return { ok, ctx };
32
- };
33
- for (let i = 0; i < script.steps.length; i++) {
34
- if (control.stopped) return finish(false);
35
- const step = script.steps[i];
36
- if (step.say) {
37
- emit({ type: "say", step: i, text: step.say });
38
- _optionalChain([options, 'access', _6 => _6.playback, 'optionalAccess', _7 => _7.say, 'call', _8 => _8(step.say, options.actor ? { actor: options.actor } : {})]);
39
- await pause(_chunkGMWNBSBScjs.readingTime.call(void 0, step.say));
40
- }
41
- if (!step.tool) continue;
42
- if (control.stopped) return finish(false);
43
- let args;
44
- try {
45
- args = typeof step.args === "function" ? step.args(ctx) : _nullishCoalesce(step.args, () => ( {}));
46
- } catch (error) {
47
- emit({ type: "error", step: i, message: error instanceof Error ? error.message : String(error) });
48
- return finish(false);
49
- }
50
- emit({ type: "call", step: i, tool: step.tool, args });
51
- const result = await source.callTool(step.tool, args, options.actor ? { actor: options.actor } : {});
52
- emit({ type: "result", step: i, tool: step.tool, result });
53
- if (result.isError) {
54
- emit({ type: "error", step: i, message: toolResultError(result) });
55
- return finish(false);
56
- }
57
- ctx.last = toolResultValue(result);
58
- if (step.as) ctx.results[step.as] = ctx.last;
59
- await pause(350);
60
- }
61
- return finish(true);
62
- }
63
-
64
-
65
-
66
-
67
-
68
- exports.toolResultValue = toolResultValue; exports.toolResultError = toolResultError; exports.runToolScript = runToolScript;
@@ -1,68 +0,0 @@
1
- import {
2
- readingTime
3
- } from "./chunk-6DXDUVSL.js";
4
-
5
- // src/tools/script.ts
6
- function toolResultValue(result) {
7
- if (result.structuredContent) return result.structuredContent;
8
- const text = result.content.find((b) => b.type === "text");
9
- if (!text?.text) return void 0;
10
- try {
11
- return JSON.parse(text.text);
12
- } catch {
13
- return text.text;
14
- }
15
- }
16
- function toolResultError(result) {
17
- const text = result.content.find((b) => b.type === "text");
18
- return text?.text ?? "The tool failed.";
19
- }
20
- var realWait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
21
- async function runToolScript(source, script, options = {}) {
22
- const control = options.control ?? { speed: 1, stopped: false };
23
- const wait = options.wait ?? realWait;
24
- const pause = (ms) => Number.isFinite(control.speed) ? wait(ms / Math.max(0.1, control.speed)) : Promise.resolve();
25
- const emit = options.onEvent ?? (() => {
26
- });
27
- const ctx = { results: {}, last: void 0 };
28
- const finish = (ok) => {
29
- if (control.stopped) options.playback?.stop();
30
- emit({ type: "done", ok, stopped: control.stopped });
31
- return { ok, ctx };
32
- };
33
- for (let i = 0; i < script.steps.length; i++) {
34
- if (control.stopped) return finish(false);
35
- const step = script.steps[i];
36
- if (step.say) {
37
- emit({ type: "say", step: i, text: step.say });
38
- options.playback?.say(step.say, options.actor ? { actor: options.actor } : {});
39
- await pause(readingTime(step.say));
40
- }
41
- if (!step.tool) continue;
42
- if (control.stopped) return finish(false);
43
- let args;
44
- try {
45
- args = typeof step.args === "function" ? step.args(ctx) : step.args ?? {};
46
- } catch (error) {
47
- emit({ type: "error", step: i, message: error instanceof Error ? error.message : String(error) });
48
- return finish(false);
49
- }
50
- emit({ type: "call", step: i, tool: step.tool, args });
51
- const result = await source.callTool(step.tool, args, options.actor ? { actor: options.actor } : {});
52
- emit({ type: "result", step: i, tool: step.tool, result });
53
- if (result.isError) {
54
- emit({ type: "error", step: i, message: toolResultError(result) });
55
- return finish(false);
56
- }
57
- ctx.last = toolResultValue(result);
58
- if (step.as) ctx.results[step.as] = ctx.last;
59
- await pause(350);
60
- }
61
- return finish(true);
62
- }
63
-
64
- export {
65
- toolResultValue,
66
- toolResultError,
67
- runToolScript
68
- };