@pixerate/editor 0.51.0 → 0.53.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 (69) hide show
  1. package/dist/agent/index.cjs +23 -23
  2. package/dist/agent/index.js +4 -4
  3. package/dist/chart/index.cjs +475 -124
  4. package/dist/chart/index.cjs.map +1 -1
  5. package/dist/chart/index.d.cts +174 -25
  6. package/dist/chart/index.d.ts +174 -25
  7. package/dist/chart/index.js +375 -24
  8. package/dist/chart/index.js.map +1 -1
  9. package/dist/{chunk-GJBIVWB2.js → chunk-3S72F46R.js} +387 -9
  10. package/dist/chunk-3S72F46R.js.map +1 -0
  11. package/dist/{chunk-5TWIN7ZJ.js → chunk-47WWV3LI.js} +34 -4
  12. package/dist/chunk-47WWV3LI.js.map +1 -0
  13. package/dist/{chunk-OV7UAKIY.js → chunk-633QC34G.js} +172 -1
  14. package/dist/chunk-633QC34G.js.map +1 -0
  15. package/dist/{chunk-MR2764X2.js → chunk-AGGUNWT6.js} +2 -322
  16. package/dist/chunk-AGGUNWT6.js.map +1 -0
  17. package/dist/{chunk-T6XU4B54.js → chunk-BQQZ6MOI.js} +7 -7
  18. package/dist/{chunk-LNKZPIQD.cjs → chunk-C3JHII3M.cjs} +67 -67
  19. package/dist/{chunk-LNKZPIQD.cjs.map → chunk-C3JHII3M.cjs.map} +1 -1
  20. package/dist/{chunk-JOX6MJW4.cjs → chunk-CKRNELPO.cjs} +176 -5
  21. package/dist/chunk-CKRNELPO.cjs.map +1 -0
  22. package/dist/{chunk-TGBCBQFV.cjs → chunk-DK6QBGCS.cjs} +45 -15
  23. package/dist/chunk-DK6QBGCS.cjs.map +1 -0
  24. package/dist/{chunk-GTZXF4BI.cjs → chunk-NK3WL5TJ.cjs} +298 -133
  25. package/dist/chunk-NK3WL5TJ.cjs.map +1 -0
  26. package/dist/{chunk-3JNRQVTS.cjs → chunk-NN3JGUSX.cjs} +402 -24
  27. package/dist/chunk-NN3JGUSX.cjs.map +1 -0
  28. package/dist/{chunk-3CC7OPUQ.cjs → chunk-O6FO6VI3.cjs} +3 -323
  29. package/dist/chunk-O6FO6VI3.cjs.map +1 -0
  30. package/dist/{chunk-DQPBQXKG.js → chunk-OIKYP7XC.js} +8 -8
  31. package/dist/{chunk-FEMIVHN3.cjs → chunk-P43HUQRX.cjs} +16 -16
  32. package/dist/{chunk-FEMIVHN3.cjs.map → chunk-P43HUQRX.cjs.map} +1 -1
  33. package/dist/{chunk-QFTVLEVN.js → chunk-RIXTW3C4.js} +3 -3
  34. package/dist/{chunk-WBOAXDKD.js → chunk-VODBAO32.js} +222 -57
  35. package/dist/chunk-VODBAO32.js.map +1 -0
  36. package/dist/{chunk-2Q46FKZK.cjs → chunk-YZZMX6V7.cjs} +25 -25
  37. package/dist/{chunk-2Q46FKZK.cjs.map → chunk-YZZMX6V7.cjs.map} +1 -1
  38. package/dist/{controller-DS3drIvy.d.cts → controller-CX0QfSv0.d.cts} +53 -2
  39. package/dist/{controller-BdKzaxs2.d.ts → controller-DscWQbjO.d.ts} +53 -2
  40. package/dist/export/index.cjs +5 -5
  41. package/dist/export/index.js +4 -4
  42. package/dist/extensions/index.cjs +7 -7
  43. package/dist/extensions/index.d.cts +2 -2
  44. package/dist/extensions/index.d.ts +2 -2
  45. package/dist/extensions/index.js +6 -6
  46. package/dist/{index-Dt9lzydb.d.ts → index-CALDD35B.d.ts} +1 -1
  47. package/dist/{index-DOy9HzfC.d.cts → index-DIWB6xMf.d.cts} +1 -1
  48. package/dist/index.cjs +15 -14
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +6 -113
  51. package/dist/index.d.ts +6 -113
  52. package/dist/index.js +13 -12
  53. package/dist/index.js.map +1 -1
  54. package/dist/zip-4nG0YAH7.d.cts +110 -0
  55. package/dist/zip-4nG0YAH7.d.ts +110 -0
  56. package/package.json +1 -1
  57. package/dist/chunk-3CC7OPUQ.cjs.map +0 -1
  58. package/dist/chunk-3JNRQVTS.cjs.map +0 -1
  59. package/dist/chunk-5TWIN7ZJ.js.map +0 -1
  60. package/dist/chunk-GJBIVWB2.js.map +0 -1
  61. package/dist/chunk-GTZXF4BI.cjs.map +0 -1
  62. package/dist/chunk-JOX6MJW4.cjs.map +0 -1
  63. package/dist/chunk-MR2764X2.js.map +0 -1
  64. package/dist/chunk-OV7UAKIY.js.map +0 -1
  65. package/dist/chunk-TGBCBQFV.cjs.map +0 -1
  66. package/dist/chunk-WBOAXDKD.js.map +0 -1
  67. /package/dist/{chunk-T6XU4B54.js.map → chunk-BQQZ6MOI.js.map} +0 -0
  68. /package/dist/{chunk-DQPBQXKG.js.map → chunk-OIKYP7XC.js.map} +0 -0
  69. /package/dist/{chunk-QFTVLEVN.js.map → chunk-RIXTW3C4.js.map} +0 -0
@@ -1,7 +1,8 @@
1
- import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScene, d as ChartSpec, e as ChartLayoutOptions, f as ChartTheme, g as ChartWarning, h as ChartAxis, i as ChartLegend, j as ChartType, k as ChartStacking, l as ChartSeries, m as ChartIssue, n as ChartController, o as ChartValueScale, p as ChartSelection, q as ChartSpecPatch } from '../controller-DS3drIvy.cjs';
2
- export { r as CHART_AXIS_KINDS, s as CHART_CURVES, t as CHART_LABEL_POSITIONS, u as CHART_LEGEND_POSITIONS, v as CHART_MARKERS, w as CHART_NUMBER_STYLES, x as CHART_ORIENTATIONS, y as CHART_SERIES_TYPES, z as CHART_STACKINGS, A as CHART_TRENDLINE_TYPES, B as CHART_TYPES, D as CHART_TYPE_LABELS, E as CSS_VARIABLE_CHART_THEME, F as ChartActionResult, G as ChartCircleMark, H as ChartControllerOptions, I as ChartCurve, J as ChartDomSpec, K as ChartEditOptions, L as ChartFamily, M as ChartLabelPosition, N as ChartLegendPosition, O as ChartLineMark, P as ChartMark, Q as ChartMarkRole, R as ChartMarker, S as ChartOrientation, T as ChartPathMark, U as ChartRectMark, V as ChartSeriesInput, W as ChartSeriesPatch, X as ChartSeriesType, Y as ChartSparklineKind, Z as ChartSparklineOptions, _ as ChartState, $ as ChartSvgOptions, a0 as ChartTableData, a1 as ChartTableOptions, a2 as ChartTextMark, a3 as ChartTextMeasure, a4 as ChartTrendFit, a5 as ChartTrendline, a6 as ChartTrendlineType, a7 as DEFAULT_CHART_PALETTE, a8 as DEFAULT_CHART_THEME, a9 as chartColorInputValue, aa as chartColorsByCategory, ab as chartDataFromTable, ac as chartDataToTable, ad as chartFamily, ae as chartMovingAverage, af as chartPointColor, ag as chartSceneToDomSpec, ah as chartSceneToSvg, ai as chartSeriesColor, aj as chartSeriesType, ak as chartSliceColor, al as chartSupportsTrendlines, am as chartTextBaseline, an as chartTextTransform, ao as chartToSvg, ap as chartTrendlineName, aq as cloneChartSeries, ar as cloneChartSpec, as as contrastingTextColor, at as createChartController, au as createChartSpec, av as defaultChartAxis, aw as estimateChartTextWidth, ax as fitChartTrendline, ay as isCartesianChart, az as isXyChart, aA as layoutSparkline, aB as normalizeChartAxis, aC as normalizeChartSpec, aD as normalizeChartTrendline, aE as normalizeChartValues, aF as parseChartValue, aG as sameChartSelection, aH as sparklineToSvg, aI as trendNumberText, aJ as uniqueChartSeriesId } from '../controller-DS3drIvy.cjs';
1
+ import { C as ChartValueScale, a as ChartNumberFormat, b as ChartValue, c as ChartRect, d as ChartErrorBars, e as ChartErrorBarType, f as ChartScene, g as ChartSpec, h as ChartLayoutOptions, i as ChartTheme, j as ChartWarning, k as ChartAxis, l as ChartLegend, m as ChartType, n as ChartStacking, o as ChartSeries, p as ChartIssue, q as ChartController, r as ChartSelection, s as ChartSpecPatch } from '../controller-CX0QfSv0.cjs';
2
+ export { t as CHART_AXIS_KINDS, u as CHART_AXIS_SCALES, v as CHART_CURVES, w as CHART_LABEL_POSITIONS, x as CHART_LEGEND_POSITIONS, y as CHART_MARKERS, z as CHART_NUMBER_STYLES, A as CHART_ORIENTATIONS, B as CHART_SERIES_TYPES, D as CHART_STACKINGS, E as CHART_TRENDLINE_TYPES, F as CHART_TYPES, G as CHART_TYPE_LABELS, H as CSS_VARIABLE_CHART_THEME, I as ChartActionResult, J as ChartCircleMark, K as ChartControllerOptions, L as ChartCurve, M as ChartDomSpec, N as ChartEditOptions, O as ChartFamily, P as ChartLabelPosition, Q as ChartLegendPosition, R as ChartLineMark, S as ChartMark, T as ChartMarkRole, U as ChartMarker, V as ChartOrientation, W as ChartPathMark, X as ChartRectMark, Y as ChartSeriesInput, Z as ChartSeriesPatch, _ as ChartSeriesType, $ as ChartSparklineKind, a0 as ChartSparklineOptions, a1 as ChartState, a2 as ChartSvgOptions, a3 as ChartTableData, a4 as ChartTableOptions, a5 as ChartTextMark, a6 as ChartTextMeasure, a7 as ChartTrendFit, a8 as ChartTrendline, a9 as ChartTrendlineType, aa as DEFAULT_CHART_PALETTE, ab as DEFAULT_CHART_THEME, ac as chartColorInputValue, ad as chartColorsByCategory, ae as chartDataFromTable, af as chartDataToTable, ag as chartFamily, ah as chartMovingAverage, ai as chartPointColor, aj as chartSceneToDomSpec, ak as chartSceneToSvg, al as chartSeriesColor, am as chartSeriesType, an as chartSliceColor, ao as chartSupportsTrendlines, ap as chartTextBaseline, aq as chartTextTransform, ar as chartToSvg, as as chartTrendlineName, at as cloneChartSeries, au as cloneChartSpec, av as contrastingTextColor, aw as createChartController, ax as createChartSpec, ay as defaultChartAxis, az as estimateChartTextWidth, aA as fitChartTrendline, aB as isCartesianChart, aC as isXyChart, aD as layoutSparkline, aE as normalizeChartAxis, aF as normalizeChartErrorBars, aG as normalizeChartSpec, aH as normalizeChartTrendline, aI as normalizeChartValues, aJ as parseChartValue, aK as sameChartSelection, aL as sparklineToSvg, aM as trendNumberText, aN as uniqueChartSeriesId } from '../controller-CX0QfSv0.cjs';
3
3
  import { C as CommandSpec } from '../registry-CaR7LC6W.cjs';
4
4
  import { A as AgentToolProvider } from '../registry-B4l-lYts.cjs';
5
+ import { Z as ZipReadOptions } from '../zip-4nG0YAH7.cjs';
5
6
  import '../HistoryManager-DeQQMBCj.cjs';
6
7
  import '../types-DsiXGmjo.cjs';
7
8
  import '../schema-Di0CS6Pe.cjs';
@@ -30,6 +31,20 @@ declare function stepDecimals(step: number): number;
30
31
  declare function formatChartNumber(value: number | null | undefined, format?: ChartNumberFormat, fallbackDecimals?: number): string;
31
32
  /** Linear map from `domain` to `range`. */
32
33
  declare function linearMap(value: number, domain: readonly [number, number], range: readonly [number, number]): number;
34
+ /**
35
+ * A logarithmic scale over `[lo, hi]` (only positive values count): the ends extend to whole
36
+ * powers of `base` unless fixed, and ticks sit on the powers, thinned to about `count`, or, in
37
+ * base 10 over a few decades, on the 1-2-5 steps between them. `step` is the base. Non-positive
38
+ * or non-finite ends fall back to the data, and no positive data at all gives 1 to `base`.
39
+ */
40
+ declare function niceLogScale(lo: number, hi: number, count?: number, base?: number, fixedMin?: number | null, fixedMax?: number | null): NiceScale;
41
+ /**
42
+ * A data value's pixel on a value scale: linear, or by logarithm when `scale.logBase` is set
43
+ * (values of 0 or less have no pixel there and give NaN).
44
+ */
45
+ declare function chartScaleToPixel(value: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
46
+ /** The data value at a pixel on a value scale (the inverse of `chartScaleToPixel`). */
47
+ declare function chartScaleFromPixel(px: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
33
48
 
34
49
  /**
35
50
  * A compiled spreadsheet number format code for chart labels, e.g. `#,##0.00`, `0.0%`,
@@ -255,6 +270,39 @@ declare function summarizeChartSeries(series: {
255
270
  values: readonly ChartValue[];
256
271
  }, categories: readonly string[]): ChartSeriesSummary;
257
272
 
273
+ declare const CHART_ERROR_BAR_TYPES: readonly ChartErrorBarType[];
274
+ declare const CHART_ERROR_BAR_DIRECTIONS: readonly NonNullable<ChartErrorBars['direction']>[];
275
+ /** Labels for pickers, shared by the React and Svelte components. */
276
+ declare const CHART_ERROR_BAR_LABELS: Readonly<Record<ChartErrorBarType, string>>;
277
+ /** The default `value` per type (`fixed` 1, `percent` 5, `stddev` 1). */
278
+ declare function defaultChartErrorBarValue(type: ChartErrorBarType): number | undefined;
279
+ /** One point's error bar: where it is centred and how far it reaches each way (both 0 or more). */
280
+ interface ChartErrorAmount {
281
+ /** The point's value, or the series mean for `stddev` (as Excel draws it). */
282
+ center: number;
283
+ plus: number;
284
+ minus: number;
285
+ }
286
+ /**
287
+ * The error bar at each point of `values` (a series' values, or its x values for x error
288
+ * bars), following Excel's error amount types: `fixed` and `percent` from `value`, `stddev`
289
+ * around the series mean, `stderr` (sample standard deviation / √n) and `custom` amounts from
290
+ * `plus` / `minus`. Gaps (and custom points without an amount) give `null`.
291
+ */
292
+ declare function chartErrorAmounts(bars: ChartErrorBars, values: readonly ChartValue[]): (ChartErrorAmount | null)[];
293
+ /** A one-line description of error bars ("±5% error bars", "±1 standard deviation error bars"). */
294
+ declare function describeChartErrorBars(bars: ChartErrorBars): string;
295
+ /**
296
+ * Error bars for a picker change: `null` for none, else bars of `type` that keep the current
297
+ * direction and caps. Switching to `custom` starts from the amounts the current bars (or ±1)
298
+ * draw, so the picture does not jump. Shared by the React and Svelte inspectors.
299
+ */
300
+ declare function chartErrorBarsOfType(type: ChartErrorBarType | '' | null, current: ChartErrorBars | undefined, values: readonly ChartValue[]): ChartErrorBars | null;
301
+ /** Custom amounts as text for an input: "1, 2, -, 0.5" (`-` is a point without a bar). */
302
+ declare function formatChartAmountList(values: readonly ChartValue[] | undefined): string;
303
+ /** Reads amounts typed as "1, 2, -, 0.5" (commas, semicolons or spaces; `-` or blank for none). */
304
+ declare function parseChartAmountList(text: string): (string | null)[];
305
+
258
306
  /**
259
307
  * Lays a chart out as drawing primitives (rects, paths, circles, lines and text) in a
260
308
  * `width × height` box. Pure and DOM-free: the React and Svelte canvases render the marks
@@ -266,7 +314,7 @@ declare function layoutChart(spec: ChartSpec, options: ChartLayoutOptions): Char
266
314
  /**
267
315
  * The data value at a scene point along the value axis (for dragging a bar or point), or
268
316
  * `undefined` when the scene has no value scale or is percent-stacked. `secondary` reads the
269
- * secondary axis.
317
+ * secondary axis. Reversed and logarithmic axes are mapped as drawn.
270
318
  */
271
319
  declare function chartValueAtPoint(scene: ChartScene, point: {
272
320
  x: number;
@@ -277,8 +325,12 @@ declare function chartXAtPoint(scene: ChartScene, point: {
277
325
  x: number;
278
326
  y: number;
279
327
  }): number | undefined;
280
- /** The value a drag should store: snapped to a tenth of the tick step (or `step`) and kept finite. */
281
- declare function snapChartValue(scene: ChartScene, value: number, step?: number, ticks?: readonly number[]): number;
328
+ /**
329
+ * The value a drag should store: snapped to a tenth of the tick step (or `step`) and kept
330
+ * finite. On a logarithmic axis (`logBase`, without a `step`) ticks are not evenly spaced, so
331
+ * the value is rounded to two significant digits instead.
332
+ */
333
+ declare function snapChartValue(scene: ChartScene, value: number, step?: number, ticks?: readonly number[], logBase?: number): number;
282
334
 
283
335
  /** Data labels are skipped on series with more points than this. */
284
336
  declare const MAX_CHART_DATA_LABELS = 200;
@@ -367,27 +419,23 @@ declare function downloadChartPng(spec: ChartSpec, options?: DownloadChartPngOpt
367
419
  filename: string;
368
420
  }>;
369
421
 
422
+ /** An axis as drawn. `logBase` is set on a logarithmic axis, `reversed` when it runs the other way. */
423
+ interface ChartAxisSummary {
424
+ min: number;
425
+ max: number;
426
+ ticks: number[];
427
+ logBase?: number;
428
+ reversed?: boolean;
429
+ }
370
430
  interface ChartSummary {
371
431
  type: ChartSpec['type'];
372
432
  title: string;
373
433
  categories: number;
374
434
  series: ChartSeriesSummary[];
375
435
  /** The value axis as drawn: range and ticks (absent for pies and treemaps). */
376
- valueAxis?: {
377
- min: number;
378
- max: number;
379
- ticks: number[];
380
- };
381
- secondaryAxis?: {
382
- min: number;
383
- max: number;
384
- ticks: number[];
385
- };
386
- xAxis?: {
387
- min: number;
388
- max: number;
389
- ticks: number[];
390
- };
436
+ valueAxis?: ChartAxisSummary;
437
+ secondaryAxis?: ChartAxisSummary;
438
+ xAxis?: ChartAxisSummary;
391
439
  /** What the layout left out at this size (hidden labels, thinned lines, …). */
392
440
  warnings: ChartWarning[];
393
441
  /** Whether the series colours can be told apart (also with colour-blindness). */
@@ -684,12 +732,12 @@ declare function findMermaidCharts(text: string): FoundChartMermaid[];
684
732
  declare const CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
685
733
  declare const CHART_OOXML_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
686
734
  declare const CHART_OOXML_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
687
- type ParserCtor$1 = {
735
+ type ParserCtor$3 = {
688
736
  new (): DOMParser;
689
737
  };
690
738
  interface ChartOoxmlReadOptions {
691
739
  /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
692
- DOMParser?: ParserCtor$1;
740
+ DOMParser?: ParserCtor$3;
693
741
  }
694
742
  interface ChartOoxmlReadResult {
695
743
  spec: ChartSpec;
@@ -863,7 +911,7 @@ declare class ChartDirector {
863
911
  private performOne;
864
912
  }
865
913
 
866
- type ParserCtor = {
914
+ type ParserCtor$2 = {
867
915
  new (): DOMParser;
868
916
  };
869
917
  interface ChartToolProviderOptions {
@@ -882,7 +930,7 @@ interface ChartToolProviderOptions {
882
930
  height: number;
883
931
  };
884
932
  /** Enables `import_chart_ooxml` (reading Office chart XML needs a DOMParser). Default: the global one, if any. */
885
- DOMParser?: ParserCtor;
933
+ DOMParser?: ParserCtor$2;
886
934
  /**
887
935
  * Acts out `set_chart_values` and `select_chart_element` with a visible cursor (see
888
936
  * `ChartDirector`); each call is still one undo step. Without it, edits apply at once.
@@ -962,4 +1010,105 @@ declare function blendChartScenes(from: ChartScene | null, to: ChartScene, t: nu
962
1010
  /** Ease-out cubic, for tweens. */
963
1011
  declare const easeChartTween: (t: number) => number;
964
1012
 
965
- export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, downloadChartPng, easeChartTween, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
1013
+ type ParserCtor$1 = {
1014
+ new (): DOMParser;
1015
+ };
1016
+ /** Office files charts can be read from. */
1017
+ type OfficeChartFileFormat = 'xlsx' | 'pptx' | 'docx';
1018
+ /** A chart found in an Excel workbook, PowerPoint deck or Word document. */
1019
+ interface OfficeFileChart {
1020
+ /** `chart-1`, `chart-2`, … in file order (sheets, slides or the document body). */
1021
+ id: string;
1022
+ /** The chart part, e.g. `xl/charts/chart1.xml` or `ppt/charts/chartEx1.xml`. */
1023
+ path: string;
1024
+ /** `chart` for DrawingML (`c:chartSpace`), `chartex` for Office 2016 charts (`cx:chartSpace`). */
1025
+ partKind: 'chart' | 'chartex';
1026
+ /** Worksheet or chart sheet name (xlsx). */
1027
+ sheet?: string;
1028
+ /** 1-based slide number (pptx). */
1029
+ slide?: number;
1030
+ /** Top-left cell the chart is anchored to, e.g. `B2` (xlsx worksheets). */
1031
+ anchor?: string;
1032
+ /** The cells the chart covers, e.g. `B2:H18` (xlsx two-cell anchors). */
1033
+ range?: string;
1034
+ /** The shape name (`cNvPr name`), e.g. `Chart 3`. */
1035
+ name?: string;
1036
+ /** The chart's title (may be empty). */
1037
+ title: string;
1038
+ spec: ChartSpec;
1039
+ /** Problems reading it, as sentences. */
1040
+ issues: string[];
1041
+ /** Features the chart editor cannot hold (3-D, stock, …). */
1042
+ unsupported: string[];
1043
+ /** Writing `spec` back loses nothing. */
1044
+ lossless: boolean;
1045
+ }
1046
+ interface OfficeChartsResult {
1047
+ format: OfficeChartFileFormat;
1048
+ charts: OfficeFileChart[];
1049
+ }
1050
+ interface OfficeChartsReadOptions extends ZipReadOptions {
1051
+ /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
1052
+ DOMParser?: ParserCtor$1;
1053
+ /** Stop after this many charts (default 500). */
1054
+ maxCharts?: number;
1055
+ }
1056
+ /** Thrown when the bytes are not a readable Office file of the expected kind. */
1057
+ declare class OfficeChartsError extends Error {
1058
+ constructor(message: string, options?: {
1059
+ cause?: unknown;
1060
+ });
1061
+ }
1062
+ /**
1063
+ * Reads every chart in an Office file, detecting whether it is a workbook (charts on each
1064
+ * worksheet's or chart sheet's drawing, with the sheet name and anchor cell), a presentation
1065
+ * (charts on each slide, with the slide number) or a Word document (charts in the body).
1066
+ * DrawingML and Office 2016 chartex parts are both read with `chartFromOoxml`; data comes
1067
+ * from the cached values. Throws `OfficeChartsError` when the bytes are not an Office file.
1068
+ */
1069
+ declare function extractOfficeCharts(bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions): Promise<OfficeChartsResult>;
1070
+ /** The charts in an Excel workbook (`xl/drawings/drawingN.xml` → `xl/charts/chartN.xml`), with sheet and anchor cell. */
1071
+ declare const extractXlsxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1072
+ /** The charts in a PowerPoint deck (`p:graphicFrame` → `ppt/charts/chartN.xml`), with their slide number. */
1073
+ declare const extractPptxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1074
+ /** The charts in the body of a Word document (`word/charts/chartN.xml`). */
1075
+ declare const extractDocxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1076
+ /** Where a chart sits, for labels: `Sheet1!B2`, `Slide 3`, `Document`. */
1077
+ declare function describeOfficeChartPlace(chart: OfficeFileChart): string;
1078
+
1079
+ type ParserCtor = {
1080
+ new (): DOMParser;
1081
+ };
1082
+ /** A file the host has opened and lets the agent read charts from. */
1083
+ interface OfficeChartFile {
1084
+ name: string;
1085
+ data: ArrayBuffer | ArrayBufferView;
1086
+ }
1087
+ interface OfficeChartToolProviderOptions {
1088
+ /** Provider id (unique per registry). Default `office-charts`. */
1089
+ id?: string;
1090
+ /** Always prefix tool names with `<namespace>__`. */
1091
+ namespace?: string;
1092
+ /**
1093
+ * Files the user opened. With it, the tools take a `file` name (and `list_open_files` lists
1094
+ * them); without it, they take the file's bytes as base64 `data`.
1095
+ */
1096
+ files?: () => readonly OfficeChartFile[];
1097
+ /** Enables `load_file_chart`, which replaces this chart with one from a file. */
1098
+ controller?: ChartController;
1099
+ /** The chart cannot be edited: `load_file_chart` is hidden. A string is the reason. */
1100
+ readOnly?: boolean | string | (() => boolean | string);
1101
+ /** `DOMParser` constructor (default: the global one). */
1102
+ DOMParser?: ParserCtor;
1103
+ }
1104
+ /**
1105
+ * Agent tools for reading charts out of Office files (`.xlsx`, `.pptx`, `.docx`), for a
1106
+ * `ToolRegistry`. `list_file_charts` lists every chart with where it sits (sheet and anchor
1107
+ * cell, slide number) and its read problems; `get_file_chart` returns one chart's full spec;
1108
+ * with a `controller`, `load_file_chart` replaces that chart editor's chart with one of them
1109
+ * as one undo step. With `files`, the tools address the files the user opened by name
1110
+ * (`list_open_files`); otherwise they take the file as base64.
1111
+ */
1112
+ declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
1113
+
1114
+ export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_ERROR_BAR_DIRECTIONS, CHART_ERROR_BAR_LABELS, CHART_ERROR_BAR_TYPES, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartAxisSummary, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartErrorAmount, ChartErrorBarType, ChartErrorBars, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartErrorAmounts, chartErrorBarsOfType, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartScaleFromPixel, chartScaleToPixel, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, defaultChartErrorBarValue, describeChart, describeChartErrorBars, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartAmountList, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceLogScale, niceScale, niceStep, parseChartAmountList, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
@@ -1,7 +1,8 @@
1
- import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScene, d as ChartSpec, e as ChartLayoutOptions, f as ChartTheme, g as ChartWarning, h as ChartAxis, i as ChartLegend, j as ChartType, k as ChartStacking, l as ChartSeries, m as ChartIssue, n as ChartController, o as ChartValueScale, p as ChartSelection, q as ChartSpecPatch } from '../controller-BdKzaxs2.js';
2
- export { r as CHART_AXIS_KINDS, s as CHART_CURVES, t as CHART_LABEL_POSITIONS, u as CHART_LEGEND_POSITIONS, v as CHART_MARKERS, w as CHART_NUMBER_STYLES, x as CHART_ORIENTATIONS, y as CHART_SERIES_TYPES, z as CHART_STACKINGS, A as CHART_TRENDLINE_TYPES, B as CHART_TYPES, D as CHART_TYPE_LABELS, E as CSS_VARIABLE_CHART_THEME, F as ChartActionResult, G as ChartCircleMark, H as ChartControllerOptions, I as ChartCurve, J as ChartDomSpec, K as ChartEditOptions, L as ChartFamily, M as ChartLabelPosition, N as ChartLegendPosition, O as ChartLineMark, P as ChartMark, Q as ChartMarkRole, R as ChartMarker, S as ChartOrientation, T as ChartPathMark, U as ChartRectMark, V as ChartSeriesInput, W as ChartSeriesPatch, X as ChartSeriesType, Y as ChartSparklineKind, Z as ChartSparklineOptions, _ as ChartState, $ as ChartSvgOptions, a0 as ChartTableData, a1 as ChartTableOptions, a2 as ChartTextMark, a3 as ChartTextMeasure, a4 as ChartTrendFit, a5 as ChartTrendline, a6 as ChartTrendlineType, a7 as DEFAULT_CHART_PALETTE, a8 as DEFAULT_CHART_THEME, a9 as chartColorInputValue, aa as chartColorsByCategory, ab as chartDataFromTable, ac as chartDataToTable, ad as chartFamily, ae as chartMovingAverage, af as chartPointColor, ag as chartSceneToDomSpec, ah as chartSceneToSvg, ai as chartSeriesColor, aj as chartSeriesType, ak as chartSliceColor, al as chartSupportsTrendlines, am as chartTextBaseline, an as chartTextTransform, ao as chartToSvg, ap as chartTrendlineName, aq as cloneChartSeries, ar as cloneChartSpec, as as contrastingTextColor, at as createChartController, au as createChartSpec, av as defaultChartAxis, aw as estimateChartTextWidth, ax as fitChartTrendline, ay as isCartesianChart, az as isXyChart, aA as layoutSparkline, aB as normalizeChartAxis, aC as normalizeChartSpec, aD as normalizeChartTrendline, aE as normalizeChartValues, aF as parseChartValue, aG as sameChartSelection, aH as sparklineToSvg, aI as trendNumberText, aJ as uniqueChartSeriesId } from '../controller-BdKzaxs2.js';
1
+ import { C as ChartValueScale, a as ChartNumberFormat, b as ChartValue, c as ChartRect, d as ChartErrorBars, e as ChartErrorBarType, f as ChartScene, g as ChartSpec, h as ChartLayoutOptions, i as ChartTheme, j as ChartWarning, k as ChartAxis, l as ChartLegend, m as ChartType, n as ChartStacking, o as ChartSeries, p as ChartIssue, q as ChartController, r as ChartSelection, s as ChartSpecPatch } from '../controller-DscWQbjO.js';
2
+ export { t as CHART_AXIS_KINDS, u as CHART_AXIS_SCALES, v as CHART_CURVES, w as CHART_LABEL_POSITIONS, x as CHART_LEGEND_POSITIONS, y as CHART_MARKERS, z as CHART_NUMBER_STYLES, A as CHART_ORIENTATIONS, B as CHART_SERIES_TYPES, D as CHART_STACKINGS, E as CHART_TRENDLINE_TYPES, F as CHART_TYPES, G as CHART_TYPE_LABELS, H as CSS_VARIABLE_CHART_THEME, I as ChartActionResult, J as ChartCircleMark, K as ChartControllerOptions, L as ChartCurve, M as ChartDomSpec, N as ChartEditOptions, O as ChartFamily, P as ChartLabelPosition, Q as ChartLegendPosition, R as ChartLineMark, S as ChartMark, T as ChartMarkRole, U as ChartMarker, V as ChartOrientation, W as ChartPathMark, X as ChartRectMark, Y as ChartSeriesInput, Z as ChartSeriesPatch, _ as ChartSeriesType, $ as ChartSparklineKind, a0 as ChartSparklineOptions, a1 as ChartState, a2 as ChartSvgOptions, a3 as ChartTableData, a4 as ChartTableOptions, a5 as ChartTextMark, a6 as ChartTextMeasure, a7 as ChartTrendFit, a8 as ChartTrendline, a9 as ChartTrendlineType, aa as DEFAULT_CHART_PALETTE, ab as DEFAULT_CHART_THEME, ac as chartColorInputValue, ad as chartColorsByCategory, ae as chartDataFromTable, af as chartDataToTable, ag as chartFamily, ah as chartMovingAverage, ai as chartPointColor, aj as chartSceneToDomSpec, ak as chartSceneToSvg, al as chartSeriesColor, am as chartSeriesType, an as chartSliceColor, ao as chartSupportsTrendlines, ap as chartTextBaseline, aq as chartTextTransform, ar as chartToSvg, as as chartTrendlineName, at as cloneChartSeries, au as cloneChartSpec, av as contrastingTextColor, aw as createChartController, ax as createChartSpec, ay as defaultChartAxis, az as estimateChartTextWidth, aA as fitChartTrendline, aB as isCartesianChart, aC as isXyChart, aD as layoutSparkline, aE as normalizeChartAxis, aF as normalizeChartErrorBars, aG as normalizeChartSpec, aH as normalizeChartTrendline, aI as normalizeChartValues, aJ as parseChartValue, aK as sameChartSelection, aL as sparklineToSvg, aM as trendNumberText, aN as uniqueChartSeriesId } from '../controller-DscWQbjO.js';
3
3
  import { C as CommandSpec } from '../registry-rVtFJjRM.js';
4
4
  import { A as AgentToolProvider } from '../registry-CSlH4iUn.js';
5
+ import { Z as ZipReadOptions } from '../zip-4nG0YAH7.js';
5
6
  import '../HistoryManager-DWSLd6Tf.js';
6
7
  import '../types-DsiXGmjo.js';
7
8
  import '../schema-Di0CS6Pe.js';
@@ -30,6 +31,20 @@ declare function stepDecimals(step: number): number;
30
31
  declare function formatChartNumber(value: number | null | undefined, format?: ChartNumberFormat, fallbackDecimals?: number): string;
31
32
  /** Linear map from `domain` to `range`. */
32
33
  declare function linearMap(value: number, domain: readonly [number, number], range: readonly [number, number]): number;
34
+ /**
35
+ * A logarithmic scale over `[lo, hi]` (only positive values count): the ends extend to whole
36
+ * powers of `base` unless fixed, and ticks sit on the powers, thinned to about `count`, or, in
37
+ * base 10 over a few decades, on the 1-2-5 steps between them. `step` is the base. Non-positive
38
+ * or non-finite ends fall back to the data, and no positive data at all gives 1 to `base`.
39
+ */
40
+ declare function niceLogScale(lo: number, hi: number, count?: number, base?: number, fixedMin?: number | null, fixedMax?: number | null): NiceScale;
41
+ /**
42
+ * A data value's pixel on a value scale: linear, or by logarithm when `scale.logBase` is set
43
+ * (values of 0 or less have no pixel there and give NaN).
44
+ */
45
+ declare function chartScaleToPixel(value: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
46
+ /** The data value at a pixel on a value scale (the inverse of `chartScaleToPixel`). */
47
+ declare function chartScaleFromPixel(px: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
33
48
 
34
49
  /**
35
50
  * A compiled spreadsheet number format code for chart labels, e.g. `#,##0.00`, `0.0%`,
@@ -255,6 +270,39 @@ declare function summarizeChartSeries(series: {
255
270
  values: readonly ChartValue[];
256
271
  }, categories: readonly string[]): ChartSeriesSummary;
257
272
 
273
+ declare const CHART_ERROR_BAR_TYPES: readonly ChartErrorBarType[];
274
+ declare const CHART_ERROR_BAR_DIRECTIONS: readonly NonNullable<ChartErrorBars['direction']>[];
275
+ /** Labels for pickers, shared by the React and Svelte components. */
276
+ declare const CHART_ERROR_BAR_LABELS: Readonly<Record<ChartErrorBarType, string>>;
277
+ /** The default `value` per type (`fixed` 1, `percent` 5, `stddev` 1). */
278
+ declare function defaultChartErrorBarValue(type: ChartErrorBarType): number | undefined;
279
+ /** One point's error bar: where it is centred and how far it reaches each way (both 0 or more). */
280
+ interface ChartErrorAmount {
281
+ /** The point's value, or the series mean for `stddev` (as Excel draws it). */
282
+ center: number;
283
+ plus: number;
284
+ minus: number;
285
+ }
286
+ /**
287
+ * The error bar at each point of `values` (a series' values, or its x values for x error
288
+ * bars), following Excel's error amount types: `fixed` and `percent` from `value`, `stddev`
289
+ * around the series mean, `stderr` (sample standard deviation / √n) and `custom` amounts from
290
+ * `plus` / `minus`. Gaps (and custom points without an amount) give `null`.
291
+ */
292
+ declare function chartErrorAmounts(bars: ChartErrorBars, values: readonly ChartValue[]): (ChartErrorAmount | null)[];
293
+ /** A one-line description of error bars ("±5% error bars", "±1 standard deviation error bars"). */
294
+ declare function describeChartErrorBars(bars: ChartErrorBars): string;
295
+ /**
296
+ * Error bars for a picker change: `null` for none, else bars of `type` that keep the current
297
+ * direction and caps. Switching to `custom` starts from the amounts the current bars (or ±1)
298
+ * draw, so the picture does not jump. Shared by the React and Svelte inspectors.
299
+ */
300
+ declare function chartErrorBarsOfType(type: ChartErrorBarType | '' | null, current: ChartErrorBars | undefined, values: readonly ChartValue[]): ChartErrorBars | null;
301
+ /** Custom amounts as text for an input: "1, 2, -, 0.5" (`-` is a point without a bar). */
302
+ declare function formatChartAmountList(values: readonly ChartValue[] | undefined): string;
303
+ /** Reads amounts typed as "1, 2, -, 0.5" (commas, semicolons or spaces; `-` or blank for none). */
304
+ declare function parseChartAmountList(text: string): (string | null)[];
305
+
258
306
  /**
259
307
  * Lays a chart out as drawing primitives (rects, paths, circles, lines and text) in a
260
308
  * `width × height` box. Pure and DOM-free: the React and Svelte canvases render the marks
@@ -266,7 +314,7 @@ declare function layoutChart(spec: ChartSpec, options: ChartLayoutOptions): Char
266
314
  /**
267
315
  * The data value at a scene point along the value axis (for dragging a bar or point), or
268
316
  * `undefined` when the scene has no value scale or is percent-stacked. `secondary` reads the
269
- * secondary axis.
317
+ * secondary axis. Reversed and logarithmic axes are mapped as drawn.
270
318
  */
271
319
  declare function chartValueAtPoint(scene: ChartScene, point: {
272
320
  x: number;
@@ -277,8 +325,12 @@ declare function chartXAtPoint(scene: ChartScene, point: {
277
325
  x: number;
278
326
  y: number;
279
327
  }): number | undefined;
280
- /** The value a drag should store: snapped to a tenth of the tick step (or `step`) and kept finite. */
281
- declare function snapChartValue(scene: ChartScene, value: number, step?: number, ticks?: readonly number[]): number;
328
+ /**
329
+ * The value a drag should store: snapped to a tenth of the tick step (or `step`) and kept
330
+ * finite. On a logarithmic axis (`logBase`, without a `step`) ticks are not evenly spaced, so
331
+ * the value is rounded to two significant digits instead.
332
+ */
333
+ declare function snapChartValue(scene: ChartScene, value: number, step?: number, ticks?: readonly number[], logBase?: number): number;
282
334
 
283
335
  /** Data labels are skipped on series with more points than this. */
284
336
  declare const MAX_CHART_DATA_LABELS = 200;
@@ -367,27 +419,23 @@ declare function downloadChartPng(spec: ChartSpec, options?: DownloadChartPngOpt
367
419
  filename: string;
368
420
  }>;
369
421
 
422
+ /** An axis as drawn. `logBase` is set on a logarithmic axis, `reversed` when it runs the other way. */
423
+ interface ChartAxisSummary {
424
+ min: number;
425
+ max: number;
426
+ ticks: number[];
427
+ logBase?: number;
428
+ reversed?: boolean;
429
+ }
370
430
  interface ChartSummary {
371
431
  type: ChartSpec['type'];
372
432
  title: string;
373
433
  categories: number;
374
434
  series: ChartSeriesSummary[];
375
435
  /** The value axis as drawn: range and ticks (absent for pies and treemaps). */
376
- valueAxis?: {
377
- min: number;
378
- max: number;
379
- ticks: number[];
380
- };
381
- secondaryAxis?: {
382
- min: number;
383
- max: number;
384
- ticks: number[];
385
- };
386
- xAxis?: {
387
- min: number;
388
- max: number;
389
- ticks: number[];
390
- };
436
+ valueAxis?: ChartAxisSummary;
437
+ secondaryAxis?: ChartAxisSummary;
438
+ xAxis?: ChartAxisSummary;
391
439
  /** What the layout left out at this size (hidden labels, thinned lines, …). */
392
440
  warnings: ChartWarning[];
393
441
  /** Whether the series colours can be told apart (also with colour-blindness). */
@@ -684,12 +732,12 @@ declare function findMermaidCharts(text: string): FoundChartMermaid[];
684
732
  declare const CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
685
733
  declare const CHART_OOXML_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
686
734
  declare const CHART_OOXML_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
687
- type ParserCtor$1 = {
735
+ type ParserCtor$3 = {
688
736
  new (): DOMParser;
689
737
  };
690
738
  interface ChartOoxmlReadOptions {
691
739
  /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
692
- DOMParser?: ParserCtor$1;
740
+ DOMParser?: ParserCtor$3;
693
741
  }
694
742
  interface ChartOoxmlReadResult {
695
743
  spec: ChartSpec;
@@ -863,7 +911,7 @@ declare class ChartDirector {
863
911
  private performOne;
864
912
  }
865
913
 
866
- type ParserCtor = {
914
+ type ParserCtor$2 = {
867
915
  new (): DOMParser;
868
916
  };
869
917
  interface ChartToolProviderOptions {
@@ -882,7 +930,7 @@ interface ChartToolProviderOptions {
882
930
  height: number;
883
931
  };
884
932
  /** Enables `import_chart_ooxml` (reading Office chart XML needs a DOMParser). Default: the global one, if any. */
885
- DOMParser?: ParserCtor;
933
+ DOMParser?: ParserCtor$2;
886
934
  /**
887
935
  * Acts out `set_chart_values` and `select_chart_element` with a visible cursor (see
888
936
  * `ChartDirector`); each call is still one undo step. Without it, edits apply at once.
@@ -962,4 +1010,105 @@ declare function blendChartScenes(from: ChartScene | null, to: ChartScene, t: nu
962
1010
  /** Ease-out cubic, for tweens. */
963
1011
  declare const easeChartTween: (t: number) => number;
964
1012
 
965
- export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, downloadChartPng, easeChartTween, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
1013
+ type ParserCtor$1 = {
1014
+ new (): DOMParser;
1015
+ };
1016
+ /** Office files charts can be read from. */
1017
+ type OfficeChartFileFormat = 'xlsx' | 'pptx' | 'docx';
1018
+ /** A chart found in an Excel workbook, PowerPoint deck or Word document. */
1019
+ interface OfficeFileChart {
1020
+ /** `chart-1`, `chart-2`, … in file order (sheets, slides or the document body). */
1021
+ id: string;
1022
+ /** The chart part, e.g. `xl/charts/chart1.xml` or `ppt/charts/chartEx1.xml`. */
1023
+ path: string;
1024
+ /** `chart` for DrawingML (`c:chartSpace`), `chartex` for Office 2016 charts (`cx:chartSpace`). */
1025
+ partKind: 'chart' | 'chartex';
1026
+ /** Worksheet or chart sheet name (xlsx). */
1027
+ sheet?: string;
1028
+ /** 1-based slide number (pptx). */
1029
+ slide?: number;
1030
+ /** Top-left cell the chart is anchored to, e.g. `B2` (xlsx worksheets). */
1031
+ anchor?: string;
1032
+ /** The cells the chart covers, e.g. `B2:H18` (xlsx two-cell anchors). */
1033
+ range?: string;
1034
+ /** The shape name (`cNvPr name`), e.g. `Chart 3`. */
1035
+ name?: string;
1036
+ /** The chart's title (may be empty). */
1037
+ title: string;
1038
+ spec: ChartSpec;
1039
+ /** Problems reading it, as sentences. */
1040
+ issues: string[];
1041
+ /** Features the chart editor cannot hold (3-D, stock, …). */
1042
+ unsupported: string[];
1043
+ /** Writing `spec` back loses nothing. */
1044
+ lossless: boolean;
1045
+ }
1046
+ interface OfficeChartsResult {
1047
+ format: OfficeChartFileFormat;
1048
+ charts: OfficeFileChart[];
1049
+ }
1050
+ interface OfficeChartsReadOptions extends ZipReadOptions {
1051
+ /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
1052
+ DOMParser?: ParserCtor$1;
1053
+ /** Stop after this many charts (default 500). */
1054
+ maxCharts?: number;
1055
+ }
1056
+ /** Thrown when the bytes are not a readable Office file of the expected kind. */
1057
+ declare class OfficeChartsError extends Error {
1058
+ constructor(message: string, options?: {
1059
+ cause?: unknown;
1060
+ });
1061
+ }
1062
+ /**
1063
+ * Reads every chart in an Office file, detecting whether it is a workbook (charts on each
1064
+ * worksheet's or chart sheet's drawing, with the sheet name and anchor cell), a presentation
1065
+ * (charts on each slide, with the slide number) or a Word document (charts in the body).
1066
+ * DrawingML and Office 2016 chartex parts are both read with `chartFromOoxml`; data comes
1067
+ * from the cached values. Throws `OfficeChartsError` when the bytes are not an Office file.
1068
+ */
1069
+ declare function extractOfficeCharts(bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions): Promise<OfficeChartsResult>;
1070
+ /** The charts in an Excel workbook (`xl/drawings/drawingN.xml` → `xl/charts/chartN.xml`), with sheet and anchor cell. */
1071
+ declare const extractXlsxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1072
+ /** The charts in a PowerPoint deck (`p:graphicFrame` → `ppt/charts/chartN.xml`), with their slide number. */
1073
+ declare const extractPptxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1074
+ /** The charts in the body of a Word document (`word/charts/chartN.xml`). */
1075
+ declare const extractDocxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1076
+ /** Where a chart sits, for labels: `Sheet1!B2`, `Slide 3`, `Document`. */
1077
+ declare function describeOfficeChartPlace(chart: OfficeFileChart): string;
1078
+
1079
+ type ParserCtor = {
1080
+ new (): DOMParser;
1081
+ };
1082
+ /** A file the host has opened and lets the agent read charts from. */
1083
+ interface OfficeChartFile {
1084
+ name: string;
1085
+ data: ArrayBuffer | ArrayBufferView;
1086
+ }
1087
+ interface OfficeChartToolProviderOptions {
1088
+ /** Provider id (unique per registry). Default `office-charts`. */
1089
+ id?: string;
1090
+ /** Always prefix tool names with `<namespace>__`. */
1091
+ namespace?: string;
1092
+ /**
1093
+ * Files the user opened. With it, the tools take a `file` name (and `list_open_files` lists
1094
+ * them); without it, they take the file's bytes as base64 `data`.
1095
+ */
1096
+ files?: () => readonly OfficeChartFile[];
1097
+ /** Enables `load_file_chart`, which replaces this chart with one from a file. */
1098
+ controller?: ChartController;
1099
+ /** The chart cannot be edited: `load_file_chart` is hidden. A string is the reason. */
1100
+ readOnly?: boolean | string | (() => boolean | string);
1101
+ /** `DOMParser` constructor (default: the global one). */
1102
+ DOMParser?: ParserCtor;
1103
+ }
1104
+ /**
1105
+ * Agent tools for reading charts out of Office files (`.xlsx`, `.pptx`, `.docx`), for a
1106
+ * `ToolRegistry`. `list_file_charts` lists every chart with where it sits (sheet and anchor
1107
+ * cell, slide number) and its read problems; `get_file_chart` returns one chart's full spec;
1108
+ * with a `controller`, `load_file_chart` replaces that chart editor's chart with one of them
1109
+ * as one undo step. With `files`, the tools address the files the user opened by name
1110
+ * (`list_open_files`); otherwise they take the file as base64.
1111
+ */
1112
+ declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
1113
+
1114
+ export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_ERROR_BAR_DIRECTIONS, CHART_ERROR_BAR_LABELS, CHART_ERROR_BAR_TYPES, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartAxisSummary, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartErrorAmount, ChartErrorBarType, ChartErrorBars, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartErrorAmounts, chartErrorBarsOfType, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartScaleFromPixel, chartScaleToPixel, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, defaultChartErrorBarValue, describeChart, describeChartErrorBars, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartAmountList, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceLogScale, niceScale, niceStep, parseChartAmountList, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };