@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.
- package/dist/agent/index.cjs +23 -23
- package/dist/agent/index.js +4 -4
- package/dist/chart/index.cjs +475 -124
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +174 -25
- package/dist/chart/index.d.ts +174 -25
- package/dist/chart/index.js +375 -24
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-GJBIVWB2.js → chunk-3S72F46R.js} +387 -9
- package/dist/chunk-3S72F46R.js.map +1 -0
- package/dist/{chunk-5TWIN7ZJ.js → chunk-47WWV3LI.js} +34 -4
- package/dist/chunk-47WWV3LI.js.map +1 -0
- package/dist/{chunk-OV7UAKIY.js → chunk-633QC34G.js} +172 -1
- package/dist/chunk-633QC34G.js.map +1 -0
- package/dist/{chunk-MR2764X2.js → chunk-AGGUNWT6.js} +2 -322
- package/dist/chunk-AGGUNWT6.js.map +1 -0
- package/dist/{chunk-T6XU4B54.js → chunk-BQQZ6MOI.js} +7 -7
- package/dist/{chunk-LNKZPIQD.cjs → chunk-C3JHII3M.cjs} +67 -67
- package/dist/{chunk-LNKZPIQD.cjs.map → chunk-C3JHII3M.cjs.map} +1 -1
- package/dist/{chunk-JOX6MJW4.cjs → chunk-CKRNELPO.cjs} +176 -5
- package/dist/chunk-CKRNELPO.cjs.map +1 -0
- package/dist/{chunk-TGBCBQFV.cjs → chunk-DK6QBGCS.cjs} +45 -15
- package/dist/chunk-DK6QBGCS.cjs.map +1 -0
- package/dist/{chunk-GTZXF4BI.cjs → chunk-NK3WL5TJ.cjs} +298 -133
- package/dist/chunk-NK3WL5TJ.cjs.map +1 -0
- package/dist/{chunk-3JNRQVTS.cjs → chunk-NN3JGUSX.cjs} +402 -24
- package/dist/chunk-NN3JGUSX.cjs.map +1 -0
- package/dist/{chunk-3CC7OPUQ.cjs → chunk-O6FO6VI3.cjs} +3 -323
- package/dist/chunk-O6FO6VI3.cjs.map +1 -0
- package/dist/{chunk-DQPBQXKG.js → chunk-OIKYP7XC.js} +8 -8
- package/dist/{chunk-FEMIVHN3.cjs → chunk-P43HUQRX.cjs} +16 -16
- package/dist/{chunk-FEMIVHN3.cjs.map → chunk-P43HUQRX.cjs.map} +1 -1
- package/dist/{chunk-QFTVLEVN.js → chunk-RIXTW3C4.js} +3 -3
- package/dist/{chunk-WBOAXDKD.js → chunk-VODBAO32.js} +222 -57
- package/dist/chunk-VODBAO32.js.map +1 -0
- package/dist/{chunk-2Q46FKZK.cjs → chunk-YZZMX6V7.cjs} +25 -25
- package/dist/{chunk-2Q46FKZK.cjs.map → chunk-YZZMX6V7.cjs.map} +1 -1
- package/dist/{controller-DS3drIvy.d.cts → controller-CX0QfSv0.d.cts} +53 -2
- package/dist/{controller-BdKzaxs2.d.ts → controller-DscWQbjO.d.ts} +53 -2
- package/dist/export/index.cjs +5 -5
- package/dist/export/index.js +4 -4
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/extensions/index.js +6 -6
- package/dist/{index-Dt9lzydb.d.ts → index-CALDD35B.d.ts} +1 -1
- package/dist/{index-DOy9HzfC.d.cts → index-DIWB6xMf.d.cts} +1 -1
- package/dist/index.cjs +15 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -113
- package/dist/index.d.ts +6 -113
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/zip-4nG0YAH7.d.cts +110 -0
- package/dist/zip-4nG0YAH7.d.ts +110 -0
- package/package.json +1 -1
- package/dist/chunk-3CC7OPUQ.cjs.map +0 -1
- package/dist/chunk-3JNRQVTS.cjs.map +0 -1
- package/dist/chunk-5TWIN7ZJ.js.map +0 -1
- package/dist/chunk-GJBIVWB2.js.map +0 -1
- package/dist/chunk-GTZXF4BI.cjs.map +0 -1
- package/dist/chunk-JOX6MJW4.cjs.map +0 -1
- package/dist/chunk-MR2764X2.js.map +0 -1
- package/dist/chunk-OV7UAKIY.js.map +0 -1
- package/dist/chunk-TGBCBQFV.cjs.map +0 -1
- package/dist/chunk-WBOAXDKD.js.map +0 -1
- /package/dist/{chunk-T6XU4B54.js.map → chunk-BQQZ6MOI.js.map} +0 -0
- /package/dist/{chunk-DQPBQXKG.js.map → chunk-OIKYP7XC.js.map} +0 -0
- /package/dist/{chunk-QFTVLEVN.js.map → chunk-RIXTW3C4.js.map} +0 -0
package/dist/chart/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export {
|
|
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
|
-
/**
|
|
281
|
-
|
|
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
|
-
|
|
378
|
-
|
|
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$
|
|
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$
|
|
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
|
-
|
|
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 };
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export {
|
|
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
|
-
/**
|
|
281
|
-
|
|
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
|
-
|
|
378
|
-
|
|
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$
|
|
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$
|
|
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
|
-
|
|
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 };
|