@pixerate/editor 0.51.0 → 0.52.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/chart/index.cjs +315 -7
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +107 -5
- package/dist/chart/index.d.ts +107 -5
- package/dist/chart/index.js +312 -4
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-2Q46FKZK.cjs → chunk-2DEBI6KU.cjs} +23 -23
- package/dist/{chunk-2Q46FKZK.cjs.map → chunk-2DEBI6KU.cjs.map} +1 -1
- package/dist/{chunk-3JNRQVTS.cjs → chunk-3ZBAXET6.cjs} +323 -3
- package/dist/chunk-3ZBAXET6.cjs.map +1 -0
- package/dist/{chunk-T6XU4B54.js → chunk-5N6AQCVB.js} +6 -6
- package/dist/{chunk-MR2764X2.js → chunk-AGGUNWT6.js} +2 -322
- package/dist/chunk-AGGUNWT6.js.map +1 -0
- package/dist/{chunk-LNKZPIQD.cjs → chunk-M5Z77GFH.cjs} +21 -21
- package/dist/{chunk-LNKZPIQD.cjs.map → chunk-M5Z77GFH.cjs.map} +1 -1
- package/dist/{chunk-3CC7OPUQ.cjs → chunk-O6FO6VI3.cjs} +3 -323
- package/dist/chunk-O6FO6VI3.cjs.map +1 -0
- package/dist/{chunk-GJBIVWB2.js → chunk-UAW5FEMD.js} +322 -2
- package/dist/chunk-UAW5FEMD.js.map +1 -0
- package/dist/{chunk-DQPBQXKG.js → chunk-YMKPMXZ4.js} +6 -6
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +4 -4
- package/dist/extensions/index.js +3 -3
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -110
- package/dist/index.d.ts +3 -110
- package/dist/index.js +10 -9
- 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-GJBIVWB2.js.map +0 -1
- package/dist/chunk-MR2764X2.js.map +0 -1
- /package/dist/{chunk-T6XU4B54.js.map → chunk-5N6AQCVB.js.map} +0 -0
- /package/dist/{chunk-DQPBQXKG.js.map → chunk-YMKPMXZ4.js.map} +0 -0
package/dist/chart/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScen
|
|
|
2
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';
|
|
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';
|
|
@@ -684,12 +685,12 @@ declare function findMermaidCharts(text: string): FoundChartMermaid[];
|
|
|
684
685
|
declare const CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
685
686
|
declare const CHART_OOXML_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
686
687
|
declare const CHART_OOXML_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
|
|
687
|
-
type ParserCtor$
|
|
688
|
+
type ParserCtor$3 = {
|
|
688
689
|
new (): DOMParser;
|
|
689
690
|
};
|
|
690
691
|
interface ChartOoxmlReadOptions {
|
|
691
692
|
/** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
|
|
692
|
-
DOMParser?: ParserCtor$
|
|
693
|
+
DOMParser?: ParserCtor$3;
|
|
693
694
|
}
|
|
694
695
|
interface ChartOoxmlReadResult {
|
|
695
696
|
spec: ChartSpec;
|
|
@@ -863,7 +864,7 @@ declare class ChartDirector {
|
|
|
863
864
|
private performOne;
|
|
864
865
|
}
|
|
865
866
|
|
|
866
|
-
type ParserCtor = {
|
|
867
|
+
type ParserCtor$2 = {
|
|
867
868
|
new (): DOMParser;
|
|
868
869
|
};
|
|
869
870
|
interface ChartToolProviderOptions {
|
|
@@ -882,7 +883,7 @@ interface ChartToolProviderOptions {
|
|
|
882
883
|
height: number;
|
|
883
884
|
};
|
|
884
885
|
/** Enables `import_chart_ooxml` (reading Office chart XML needs a DOMParser). Default: the global one, if any. */
|
|
885
|
-
DOMParser?: ParserCtor;
|
|
886
|
+
DOMParser?: ParserCtor$2;
|
|
886
887
|
/**
|
|
887
888
|
* Acts out `set_chart_values` and `select_chart_element` with a visible cursor (see
|
|
888
889
|
* `ChartDirector`); each call is still one undo step. Without it, edits apply at once.
|
|
@@ -962,4 +963,105 @@ declare function blendChartScenes(from: ChartScene | null, to: ChartScene, t: nu
|
|
|
962
963
|
/** Ease-out cubic, for tweens. */
|
|
963
964
|
declare const easeChartTween: (t: number) => number;
|
|
964
965
|
|
|
965
|
-
|
|
966
|
+
type ParserCtor$1 = {
|
|
967
|
+
new (): DOMParser;
|
|
968
|
+
};
|
|
969
|
+
/** Office files charts can be read from. */
|
|
970
|
+
type OfficeChartFileFormat = 'xlsx' | 'pptx' | 'docx';
|
|
971
|
+
/** A chart found in an Excel workbook, PowerPoint deck or Word document. */
|
|
972
|
+
interface OfficeFileChart {
|
|
973
|
+
/** `chart-1`, `chart-2`, … in file order (sheets, slides or the document body). */
|
|
974
|
+
id: string;
|
|
975
|
+
/** The chart part, e.g. `xl/charts/chart1.xml` or `ppt/charts/chartEx1.xml`. */
|
|
976
|
+
path: string;
|
|
977
|
+
/** `chart` for DrawingML (`c:chartSpace`), `chartex` for Office 2016 charts (`cx:chartSpace`). */
|
|
978
|
+
partKind: 'chart' | 'chartex';
|
|
979
|
+
/** Worksheet or chart sheet name (xlsx). */
|
|
980
|
+
sheet?: string;
|
|
981
|
+
/** 1-based slide number (pptx). */
|
|
982
|
+
slide?: number;
|
|
983
|
+
/** Top-left cell the chart is anchored to, e.g. `B2` (xlsx worksheets). */
|
|
984
|
+
anchor?: string;
|
|
985
|
+
/** The cells the chart covers, e.g. `B2:H18` (xlsx two-cell anchors). */
|
|
986
|
+
range?: string;
|
|
987
|
+
/** The shape name (`cNvPr name`), e.g. `Chart 3`. */
|
|
988
|
+
name?: string;
|
|
989
|
+
/** The chart's title (may be empty). */
|
|
990
|
+
title: string;
|
|
991
|
+
spec: ChartSpec;
|
|
992
|
+
/** Problems reading it, as sentences. */
|
|
993
|
+
issues: string[];
|
|
994
|
+
/** Features the chart editor cannot hold (3-D, stock, …). */
|
|
995
|
+
unsupported: string[];
|
|
996
|
+
/** Writing `spec` back loses nothing. */
|
|
997
|
+
lossless: boolean;
|
|
998
|
+
}
|
|
999
|
+
interface OfficeChartsResult {
|
|
1000
|
+
format: OfficeChartFileFormat;
|
|
1001
|
+
charts: OfficeFileChart[];
|
|
1002
|
+
}
|
|
1003
|
+
interface OfficeChartsReadOptions extends ZipReadOptions {
|
|
1004
|
+
/** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
|
|
1005
|
+
DOMParser?: ParserCtor$1;
|
|
1006
|
+
/** Stop after this many charts (default 500). */
|
|
1007
|
+
maxCharts?: number;
|
|
1008
|
+
}
|
|
1009
|
+
/** Thrown when the bytes are not a readable Office file of the expected kind. */
|
|
1010
|
+
declare class OfficeChartsError extends Error {
|
|
1011
|
+
constructor(message: string, options?: {
|
|
1012
|
+
cause?: unknown;
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Reads every chart in an Office file, detecting whether it is a workbook (charts on each
|
|
1017
|
+
* worksheet's or chart sheet's drawing, with the sheet name and anchor cell), a presentation
|
|
1018
|
+
* (charts on each slide, with the slide number) or a Word document (charts in the body).
|
|
1019
|
+
* DrawingML and Office 2016 chartex parts are both read with `chartFromOoxml`; data comes
|
|
1020
|
+
* from the cached values. Throws `OfficeChartsError` when the bytes are not an Office file.
|
|
1021
|
+
*/
|
|
1022
|
+
declare function extractOfficeCharts(bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions): Promise<OfficeChartsResult>;
|
|
1023
|
+
/** The charts in an Excel workbook (`xl/drawings/drawingN.xml` → `xl/charts/chartN.xml`), with sheet and anchor cell. */
|
|
1024
|
+
declare const extractXlsxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
|
|
1025
|
+
/** The charts in a PowerPoint deck (`p:graphicFrame` → `ppt/charts/chartN.xml`), with their slide number. */
|
|
1026
|
+
declare const extractPptxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
|
|
1027
|
+
/** The charts in the body of a Word document (`word/charts/chartN.xml`). */
|
|
1028
|
+
declare const extractDocxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
|
|
1029
|
+
/** Where a chart sits, for labels: `Sheet1!B2`, `Slide 3`, `Document`. */
|
|
1030
|
+
declare function describeOfficeChartPlace(chart: OfficeFileChart): string;
|
|
1031
|
+
|
|
1032
|
+
type ParserCtor = {
|
|
1033
|
+
new (): DOMParser;
|
|
1034
|
+
};
|
|
1035
|
+
/** A file the host has opened and lets the agent read charts from. */
|
|
1036
|
+
interface OfficeChartFile {
|
|
1037
|
+
name: string;
|
|
1038
|
+
data: ArrayBuffer | ArrayBufferView;
|
|
1039
|
+
}
|
|
1040
|
+
interface OfficeChartToolProviderOptions {
|
|
1041
|
+
/** Provider id (unique per registry). Default `office-charts`. */
|
|
1042
|
+
id?: string;
|
|
1043
|
+
/** Always prefix tool names with `<namespace>__`. */
|
|
1044
|
+
namespace?: string;
|
|
1045
|
+
/**
|
|
1046
|
+
* Files the user opened. With it, the tools take a `file` name (and `list_open_files` lists
|
|
1047
|
+
* them); without it, they take the file's bytes as base64 `data`.
|
|
1048
|
+
*/
|
|
1049
|
+
files?: () => readonly OfficeChartFile[];
|
|
1050
|
+
/** Enables `load_file_chart`, which replaces this chart with one from a file. */
|
|
1051
|
+
controller?: ChartController;
|
|
1052
|
+
/** The chart cannot be edited: `load_file_chart` is hidden. A string is the reason. */
|
|
1053
|
+
readOnly?: boolean | string | (() => boolean | string);
|
|
1054
|
+
/** `DOMParser` constructor (default: the global one). */
|
|
1055
|
+
DOMParser?: ParserCtor;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Agent tools for reading charts out of Office files (`.xlsx`, `.pptx`, `.docx`), for a
|
|
1059
|
+
* `ToolRegistry`. `list_file_charts` lists every chart with where it sits (sheet and anchor
|
|
1060
|
+
* cell, slide number) and its read problems; `get_file_chart` returns one chart's full spec;
|
|
1061
|
+
* with a `controller`, `load_file_chart` replaces that chart editor's chart with one of them
|
|
1062
|
+
* as one undo step. With `files`, the tools address the files the user opened by name
|
|
1063
|
+
* (`list_open_files`); otherwise they take the file as base64.
|
|
1064
|
+
*/
|
|
1065
|
+
declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
|
|
1066
|
+
|
|
1067
|
+
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, 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, 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, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, 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 };
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScen
|
|
|
2
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';
|
|
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';
|
|
@@ -684,12 +685,12 @@ declare function findMermaidCharts(text: string): FoundChartMermaid[];
|
|
|
684
685
|
declare const CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
685
686
|
declare const CHART_OOXML_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
686
687
|
declare const CHART_OOXML_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
|
|
687
|
-
type ParserCtor$
|
|
688
|
+
type ParserCtor$3 = {
|
|
688
689
|
new (): DOMParser;
|
|
689
690
|
};
|
|
690
691
|
interface ChartOoxmlReadOptions {
|
|
691
692
|
/** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
|
|
692
|
-
DOMParser?: ParserCtor$
|
|
693
|
+
DOMParser?: ParserCtor$3;
|
|
693
694
|
}
|
|
694
695
|
interface ChartOoxmlReadResult {
|
|
695
696
|
spec: ChartSpec;
|
|
@@ -863,7 +864,7 @@ declare class ChartDirector {
|
|
|
863
864
|
private performOne;
|
|
864
865
|
}
|
|
865
866
|
|
|
866
|
-
type ParserCtor = {
|
|
867
|
+
type ParserCtor$2 = {
|
|
867
868
|
new (): DOMParser;
|
|
868
869
|
};
|
|
869
870
|
interface ChartToolProviderOptions {
|
|
@@ -882,7 +883,7 @@ interface ChartToolProviderOptions {
|
|
|
882
883
|
height: number;
|
|
883
884
|
};
|
|
884
885
|
/** Enables `import_chart_ooxml` (reading Office chart XML needs a DOMParser). Default: the global one, if any. */
|
|
885
|
-
DOMParser?: ParserCtor;
|
|
886
|
+
DOMParser?: ParserCtor$2;
|
|
886
887
|
/**
|
|
887
888
|
* Acts out `set_chart_values` and `select_chart_element` with a visible cursor (see
|
|
888
889
|
* `ChartDirector`); each call is still one undo step. Without it, edits apply at once.
|
|
@@ -962,4 +963,105 @@ declare function blendChartScenes(from: ChartScene | null, to: ChartScene, t: nu
|
|
|
962
963
|
/** Ease-out cubic, for tweens. */
|
|
963
964
|
declare const easeChartTween: (t: number) => number;
|
|
964
965
|
|
|
965
|
-
|
|
966
|
+
type ParserCtor$1 = {
|
|
967
|
+
new (): DOMParser;
|
|
968
|
+
};
|
|
969
|
+
/** Office files charts can be read from. */
|
|
970
|
+
type OfficeChartFileFormat = 'xlsx' | 'pptx' | 'docx';
|
|
971
|
+
/** A chart found in an Excel workbook, PowerPoint deck or Word document. */
|
|
972
|
+
interface OfficeFileChart {
|
|
973
|
+
/** `chart-1`, `chart-2`, … in file order (sheets, slides or the document body). */
|
|
974
|
+
id: string;
|
|
975
|
+
/** The chart part, e.g. `xl/charts/chart1.xml` or `ppt/charts/chartEx1.xml`. */
|
|
976
|
+
path: string;
|
|
977
|
+
/** `chart` for DrawingML (`c:chartSpace`), `chartex` for Office 2016 charts (`cx:chartSpace`). */
|
|
978
|
+
partKind: 'chart' | 'chartex';
|
|
979
|
+
/** Worksheet or chart sheet name (xlsx). */
|
|
980
|
+
sheet?: string;
|
|
981
|
+
/** 1-based slide number (pptx). */
|
|
982
|
+
slide?: number;
|
|
983
|
+
/** Top-left cell the chart is anchored to, e.g. `B2` (xlsx worksheets). */
|
|
984
|
+
anchor?: string;
|
|
985
|
+
/** The cells the chart covers, e.g. `B2:H18` (xlsx two-cell anchors). */
|
|
986
|
+
range?: string;
|
|
987
|
+
/** The shape name (`cNvPr name`), e.g. `Chart 3`. */
|
|
988
|
+
name?: string;
|
|
989
|
+
/** The chart's title (may be empty). */
|
|
990
|
+
title: string;
|
|
991
|
+
spec: ChartSpec;
|
|
992
|
+
/** Problems reading it, as sentences. */
|
|
993
|
+
issues: string[];
|
|
994
|
+
/** Features the chart editor cannot hold (3-D, stock, …). */
|
|
995
|
+
unsupported: string[];
|
|
996
|
+
/** Writing `spec` back loses nothing. */
|
|
997
|
+
lossless: boolean;
|
|
998
|
+
}
|
|
999
|
+
interface OfficeChartsResult {
|
|
1000
|
+
format: OfficeChartFileFormat;
|
|
1001
|
+
charts: OfficeFileChart[];
|
|
1002
|
+
}
|
|
1003
|
+
interface OfficeChartsReadOptions extends ZipReadOptions {
|
|
1004
|
+
/** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
|
|
1005
|
+
DOMParser?: ParserCtor$1;
|
|
1006
|
+
/** Stop after this many charts (default 500). */
|
|
1007
|
+
maxCharts?: number;
|
|
1008
|
+
}
|
|
1009
|
+
/** Thrown when the bytes are not a readable Office file of the expected kind. */
|
|
1010
|
+
declare class OfficeChartsError extends Error {
|
|
1011
|
+
constructor(message: string, options?: {
|
|
1012
|
+
cause?: unknown;
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Reads every chart in an Office file, detecting whether it is a workbook (charts on each
|
|
1017
|
+
* worksheet's or chart sheet's drawing, with the sheet name and anchor cell), a presentation
|
|
1018
|
+
* (charts on each slide, with the slide number) or a Word document (charts in the body).
|
|
1019
|
+
* DrawingML and Office 2016 chartex parts are both read with `chartFromOoxml`; data comes
|
|
1020
|
+
* from the cached values. Throws `OfficeChartsError` when the bytes are not an Office file.
|
|
1021
|
+
*/
|
|
1022
|
+
declare function extractOfficeCharts(bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions): Promise<OfficeChartsResult>;
|
|
1023
|
+
/** The charts in an Excel workbook (`xl/drawings/drawingN.xml` → `xl/charts/chartN.xml`), with sheet and anchor cell. */
|
|
1024
|
+
declare const extractXlsxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
|
|
1025
|
+
/** The charts in a PowerPoint deck (`p:graphicFrame` → `ppt/charts/chartN.xml`), with their slide number. */
|
|
1026
|
+
declare const extractPptxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
|
|
1027
|
+
/** The charts in the body of a Word document (`word/charts/chartN.xml`). */
|
|
1028
|
+
declare const extractDocxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
|
|
1029
|
+
/** Where a chart sits, for labels: `Sheet1!B2`, `Slide 3`, `Document`. */
|
|
1030
|
+
declare function describeOfficeChartPlace(chart: OfficeFileChart): string;
|
|
1031
|
+
|
|
1032
|
+
type ParserCtor = {
|
|
1033
|
+
new (): DOMParser;
|
|
1034
|
+
};
|
|
1035
|
+
/** A file the host has opened and lets the agent read charts from. */
|
|
1036
|
+
interface OfficeChartFile {
|
|
1037
|
+
name: string;
|
|
1038
|
+
data: ArrayBuffer | ArrayBufferView;
|
|
1039
|
+
}
|
|
1040
|
+
interface OfficeChartToolProviderOptions {
|
|
1041
|
+
/** Provider id (unique per registry). Default `office-charts`. */
|
|
1042
|
+
id?: string;
|
|
1043
|
+
/** Always prefix tool names with `<namespace>__`. */
|
|
1044
|
+
namespace?: string;
|
|
1045
|
+
/**
|
|
1046
|
+
* Files the user opened. With it, the tools take a `file` name (and `list_open_files` lists
|
|
1047
|
+
* them); without it, they take the file's bytes as base64 `data`.
|
|
1048
|
+
*/
|
|
1049
|
+
files?: () => readonly OfficeChartFile[];
|
|
1050
|
+
/** Enables `load_file_chart`, which replaces this chart with one from a file. */
|
|
1051
|
+
controller?: ChartController;
|
|
1052
|
+
/** The chart cannot be edited: `load_file_chart` is hidden. A string is the reason. */
|
|
1053
|
+
readOnly?: boolean | string | (() => boolean | string);
|
|
1054
|
+
/** `DOMParser` constructor (default: the global one). */
|
|
1055
|
+
DOMParser?: ParserCtor;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Agent tools for reading charts out of Office files (`.xlsx`, `.pptx`, `.docx`), for a
|
|
1059
|
+
* `ToolRegistry`. `list_file_charts` lists every chart with where it sits (sheet and anchor
|
|
1060
|
+
* cell, slide number) and its read problems; `get_file_chart` returns one chart's full spec;
|
|
1061
|
+
* with a `controller`, `load_file_chart` replaces that chart editor's chart with one of them
|
|
1062
|
+
* as one undo step. With `files`, the tools address the files the user opened by name
|
|
1063
|
+
* (`list_open_files`); otherwise they take the file as base64.
|
|
1064
|
+
*/
|
|
1065
|
+
declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
|
|
1066
|
+
|
|
1067
|
+
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, 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, 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, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, 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 };
|