@silurus/ooxml 0.75.5 → 0.76.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 (52) hide show
  1. package/README.md +66 -28
  2. package/dist/bounded-raw-part-cache-C6ro6Ezf.js +254 -0
  3. package/dist/{find-cursor-Dc5iM6s7.js → canvas-viewer-mechanics-CwVSOYke.js} +192 -64
  4. package/dist/{document-pull-client-BcNYhoAG.js → document-pull-client-DQNen8c4.js} +3620 -3597
  5. package/dist/docx-DYRguRRi.js +1301 -0
  6. package/dist/docx.mjs +4 -6
  7. package/dist/docx_parser_bg.wasm +0 -0
  8. package/dist/index.mjs +3 -3
  9. package/dist/{line-distribute-B8sqT8kC.js → line-distribute-C1r2zvji.js} +141 -141
  10. package/dist/{line-metrics-D9gqQWHl.js → line-metrics-BdCACYlq.js} +4026 -1170
  11. package/dist/math.mjs +1 -1
  12. package/dist/node.mjs +779 -465
  13. package/dist/pptx-B-EJp83T.js +1735 -0
  14. package/dist/pptx.mjs +5 -7
  15. package/dist/pptx_parser_bg.wasm +0 -0
  16. package/dist/{render-CalC7GX4.js → render-CLcpSi0m.js} +11 -18
  17. package/dist/render-worker-host-Bkf1jUcW.js +27 -0
  18. package/dist/render-worker-host-CKOmXdyr.js +27 -0
  19. package/dist/render-worker-host-DWLyqwI3.js +27 -0
  20. package/dist/resource-measurement-E_S_iau4.js +119 -0
  21. package/dist/session-B4Y54cbT.js +730 -0
  22. package/dist/{renderer-B9R6F_QY.js → slide-pull-client-WCuYCjio.js} +973 -820
  23. package/dist/types/docx.d.ts +1181 -3994
  24. package/dist/types/index.d.ts +2733 -8171
  25. package/dist/types/math.d.ts +8 -33
  26. package/dist/types/node.d.ts +1852 -4433
  27. package/dist/types/pptx.d.ts +1030 -3678
  28. package/dist/types/xlsx.d.ts +1291 -3262
  29. package/dist/worksheet-pull-client-YzjJMOns.js +455 -0
  30. package/dist/xlsx-BBmmZNQn.js +6362 -0
  31. package/dist/xlsx.mjs +5 -7
  32. package/dist/xlsx_parser_bg.wasm +0 -0
  33. package/package.json +14 -7
  34. package/dist/bounded-raw-part-cache-BTfZD_Sz.js +0 -1248
  35. package/dist/docx-DjF8FgoP.js +0 -1274
  36. package/dist/duotone-bitmap-by-path-CWsSJkJu.js +0 -28
  37. package/dist/hyperlink-D85FexTa.js +0 -27
  38. package/dist/pptx-C17xP8AV.js +0 -1705
  39. package/dist/pptx-Dl8tOSmP.js +0 -822
  40. package/dist/preload-BEouWnlI.js +0 -132
  41. package/dist/render-worker-host-BG3a7brz.js +0 -27
  42. package/dist/render-worker-host-CsB-dPJv.js +0 -27
  43. package/dist/render-worker-host-Cyv5Hkbh.js +0 -27
  44. package/dist/resource-measurement-6aReN3K0.js +0 -93
  45. package/dist/slide-pull-client-D_T0AIoX.js +0 -175
  46. package/dist/svg-image-by-path-C1M3N2pT.js +0 -1623
  47. package/dist/worksheet-pull-worker-DCei8u-4.js +0 -347
  48. package/dist/xlsx-BaH9irS0.js +0 -5515
  49. /package/dist/{highlight-rect-cCvVU-MW.js → highlight-rect-CAkCWJ37.js} +0 -0
  50. /package/dist/{mathjax-Dqo857oC.js → mathjax-CMjda8Ip.js} +0 -0
  51. /package/dist/{transfer-3QEJrsJa.js → transfer-DCu4c2BL.js} +0 -0
  52. /package/dist/{visible-index-CKvgpUrf.js → visible-index-CgyJLAS_.js} +0 -0
@@ -1,3552 +1,1581 @@
1
- //#region dist/.types-work/mathjax-Cp9KrvN5.d.ts
2
- //#region packages/core/src/math/mathjax.d.ts
1
+ //#region dist/.types-work/mathjax-CKU2W8zq.d.ts
3
2
  interface MathSvg {
4
- /** standalone `<svg>…</svg>` markup. */
5
- svg: string;
6
- /** extents in em (the SVG viewBox uses 1em = 1000 units). */
7
- widthEm: number;
8
- ascentEm: number;
9
- descentEm: number;
10
- }
11
- /**
12
- * The math engine contract a viewer needs to render equations. Satisfied by the
13
- * `math` named export of the separate `@silurus/ooxml/math` entry point, which
14
- * the consumer opts into:
15
- *
16
- * ```ts
17
- * import { DocxViewer } from '@silurus/ooxml/docx';
18
- * import { math } from '@silurus/ooxml/math';
19
- * new DocxViewer(canvas, { math });
20
- * ```
21
- *
22
- * Omit it and the equation engine (MathJax + STIX Two Math, ~3 MB) is never
23
- * imported, so a bundler drops it entirely.
24
- */
3
+ svg: string;
4
+ widthEm: number;
5
+ ascentEm: number;
6
+ descentEm: number;
7
+ }
25
8
  interface MathRenderer {
26
- /** Preload the engine. Called once before converting equations. */
27
- loadMathJax(): Promise<void>;
28
- /** MathML string → standalone SVG + baseline-relative em extents. */
29
- mathMLToSvg(mathml: string): Promise<MathSvg>;
9
+ loadMathJax(): Promise<void>;
10
+ mathMLToSvg(mathml: string): Promise<MathSvg>;
30
11
  }
31
12
  //#endregion
32
- //#region dist/.types-work/hyperlink-DTGUpBI3.d.ts
33
- //#region packages/core/src/types/math.d.ts
13
+ //#region dist/.types-work/hyperlink-BnJnsq2_.d.ts
34
14
  type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
35
15
  interface MathRun {
36
- kind: 'run';
37
- text: string;
38
- style: MathStyle;
16
+ kind: 'run';
17
+ text: string;
18
+ style: MathStyle;
39
19
  }
40
20
  interface MathFraction {
41
- kind: 'fraction';
42
- num: MathNode[];
43
- den: MathNode[];
44
- /** false = no rule (e.g. binomial); defaults to true. */
45
- bar?: boolean;
21
+ kind: 'fraction';
22
+ num: MathNode[];
23
+ den: MathNode[];
24
+ bar?: boolean;
46
25
  }
47
26
  interface MathScript {
48
- kind: 'sup' | 'sub' | 'subSup';
49
- base: MathNode[];
50
- sup?: MathNode[];
51
- sub?: MathNode[];
27
+ kind: 'sup' | 'sub' | 'subSup';
28
+ base: MathNode[];
29
+ sup?: MathNode[];
30
+ sub?: MathNode[];
52
31
  }
53
32
  interface MathNary {
54
- kind: 'nary';
55
- /** operator char, e.g. '∑', '∫', '∏'. */
56
- op: string;
57
- /** limit location (`m:limLoc`): 'subSup' = beside the op, 'undOvr' = above/below.
58
- * Empty/omitted = default by operator class (integrals → subSup, others → undOvr). */
59
- limLoc?: string;
60
- sub?: MathNode[];
61
- sup?: MathNode[];
62
- body: MathNode[];
33
+ kind: 'nary';
34
+ op: string;
35
+ limLoc?: string;
36
+ sub?: MathNode[];
37
+ sup?: MathNode[];
38
+ body: MathNode[];
63
39
  }
64
40
  interface MathDelimiter {
65
- kind: 'delimiter';
66
- /** opening char (default '('). */
67
- begChar: string;
68
- /** closing char (default ')'). */
69
- endChar: string;
70
- /** separated groups (e.g. for cases / multiple args). */
71
- items: MathNode[][];
41
+ kind: 'delimiter';
42
+ begChar: string;
43
+ endChar: string;
44
+ items: MathNode[][];
72
45
  }
73
46
  interface MathRadical {
74
- kind: 'radical';
75
- /** optional index (e.g. cube root); empty/omitted = square root. */
76
- index?: MathNode[];
77
- radicand: MathNode[];
47
+ kind: 'radical';
48
+ index?: MathNode[];
49
+ radicand: MathNode[];
78
50
  }
79
- /** Lower/upper limit (`m:limLow` / `m:limUpp`), e.g. lim under n→∞. */
80
51
  interface MathLimit {
81
- kind: 'limit';
82
- base: MathNode[];
83
- lower?: MathNode[];
84
- upper?: MathNode[];
52
+ kind: 'limit';
53
+ base: MathNode[];
54
+ lower?: MathNode[];
55
+ upper?: MathNode[];
85
56
  }
86
- /** Matrix (`m:m`) or aligned equation array (`m:eqArr`). rows → cells → nodes. */
87
57
  interface MathArray {
88
- kind: 'array';
89
- rows: MathNode[][][];
90
- /** 'eq' = alternating right/left (eqArr); 'center' = matrix; 'left'. */
91
- align: 'eq' | 'center' | 'left';
58
+ kind: 'array';
59
+ rows: MathNode[][][];
60
+ align: 'eq' | 'center' | 'left';
92
61
  }
93
- /** Group character (`m:groupChr`), e.g. under/over brace. */
94
62
  interface MathGroupChr {
95
- kind: 'groupChr';
96
- char: string;
97
- pos: 'top' | 'bot';
98
- base: MathNode[];
63
+ kind: 'groupChr';
64
+ char: string;
65
+ pos: 'top' | 'bot';
66
+ base: MathNode[];
99
67
  }
100
- /** Over/under bar (`m:bar`). */
101
68
  interface MathBar {
102
- kind: 'bar';
103
- pos: 'top' | 'bot';
104
- base: MathNode[];
69
+ kind: 'bar';
70
+ pos: 'top' | 'bot';
71
+ base: MathNode[];
105
72
  }
106
- /** Accent (`m:acc`), e.g. hat, bar, vector arrow over the base. */
107
73
  interface MathAccent {
108
- kind: 'accent';
109
- char: string;
110
- base: MathNode[];
74
+ kind: 'accent';
75
+ char: string;
76
+ base: MathNode[];
111
77
  }
112
78
  interface MathFunc {
113
- kind: 'func';
114
- name: MathNode[];
115
- arg: MathNode[];
79
+ kind: 'func';
80
+ name: MathNode[];
81
+ arg: MathNode[];
116
82
  }
117
83
  interface MathGroup {
118
- kind: 'group';
119
- items: MathNode[];
84
+ kind: 'group';
85
+ items: MathNode[];
120
86
  }
121
- /** Phantom object (`m:phant`, §22.1.2.81): contributes the spacing of `base`
122
- * while optionally hiding it and/or zeroing individual dimensions. */
123
87
  interface MathPhant {
124
- kind: 'phant';
125
- /** §22.1.2.96 `m:show` — `false` hides the base (invisible but occupies space,
126
- * i.e. `<mphantom>`); `true` (default) shows it and the phant only tweaks
127
- * spacing. */
128
- show: boolean;
129
- /** §22.1.2 zeroWid / zeroAsc / zeroDesc — suppress width / ascent / descent so
130
- * the base takes no space along that axis. Omitted ⇒ false. */
131
- zeroWid?: boolean;
132
- zeroAsc?: boolean;
133
- zeroDesc?: boolean;
134
- base: MathNode[];
135
- }
136
- /** Pre-sub-superscript object (`m:sPre`, §22.1.2.99): sub + sup to the LEFT of
137
- * the base (e.g. ²₁A). */
88
+ kind: 'phant';
89
+ show: boolean;
90
+ zeroWid?: boolean;
91
+ zeroAsc?: boolean;
92
+ zeroDesc?: boolean;
93
+ base: MathNode[];
94
+ }
138
95
  interface MathSPre {
139
- kind: 'sPre';
140
- sub: MathNode[];
141
- sup: MathNode[];
142
- base: MathNode[];
96
+ kind: 'sPre';
97
+ sub: MathNode[];
98
+ sup: MathNode[];
99
+ base: MathNode[];
143
100
  }
144
- /** Box object (`m:box`, §22.1.2.13): a logical grouping (operator emulator /
145
- * line-break control). Draws NO border — a transparent group around `base`. */
146
101
  interface MathBox {
147
- kind: 'box';
148
- base: MathNode[];
102
+ kind: 'box';
103
+ base: MathNode[];
149
104
  }
150
- /** Border-box object (`m:borderBox`, §22.1.2.11): a border/strikes around the
151
- * base. Absent flags ⇒ a full rectangular box. */
152
105
  interface MathBorderBox {
153
- kind: 'borderBox';
154
- /** §22.1.2 hide* — when true the corresponding edge is NOT drawn. */
155
- hideTop?: boolean;
156
- hideBot?: boolean;
157
- hideLeft?: boolean;
158
- hideRight?: boolean;
159
- /** §22.1.2 strike* — strikeBLTR = bottom-left→top-right, strikeTLBR =
160
- * top-left→bottom-right diagonal. */
161
- strikeH?: boolean;
162
- strikeV?: boolean;
163
- strikeBltr?: boolean;
164
- strikeTlbr?: boolean;
165
- base: MathNode[];
106
+ kind: 'borderBox';
107
+ hideTop?: boolean;
108
+ hideBot?: boolean;
109
+ hideLeft?: boolean;
110
+ hideRight?: boolean;
111
+ strikeH?: boolean;
112
+ strikeV?: boolean;
113
+ strikeBltr?: boolean;
114
+ strikeTlbr?: boolean;
115
+ base: MathNode[];
166
116
  }
167
117
  type MathNode = MathRun | MathFraction | MathScript | MathNary | MathDelimiter | MathRadical | MathLimit | MathArray | MathGroupChr | MathBar | MathAccent | MathFunc | MathGroup | MathPhant | MathSPre | MathBox | MathBorderBox;
168
118
  type SpaceLine = {
169
- type: 'pct';
170
- val: number;
119
+ type: 'pct';
120
+ val: number;
171
121
  } | {
172
- type: 'pts';
173
- val: number;
122
+ type: 'pts';
123
+ val: number;
174
124
  };
175
- //#endregion
176
- //#region packages/core/src/types/chart.d.ts
177
125
  interface ChartSeries {
178
- name: string;
179
- /** Hex without '#'. null = fall back to palette. */
180
- color: string | null;
181
- /** Numeric values; null = missing data point. */
182
- values: (number | null)[];
183
- /**
184
- * Per-data-point colors (pie / doughnut). Hex without '#'. null inside the
185
- * array = use palette for that slice. Omit entirely for non-pie series.
186
- */
187
- dataPointColors?: (string | null)[] | null;
188
- /**
189
- * Per-data-point data-label text colors. Used by chartEx (`<cx:dataLabel idx>`)
190
- * to override label colour per bar — sample-2's waterfall paints negative
191
- * values in red while positive values stay black. Null inside the array =
192
- * fall back to the chart-level `dataLabelFontColor`.
193
- */
194
- dataLabelColors?: (string | null)[] | null;
195
- /**
196
- * Series-level data-label text colour (`<c:ser><c:dLbls><c:txPr>…solidFill`,
197
- * ECMA-376 §21.2.2.216). Hex without '#'. Stacked-bar charts colour each
198
- * segment's label independently (e.g. white on the dark segment, black on
199
- * the light one), which a single chart-level `dataLabelFontColor` can't
200
- * express. Takes precedence over `dataLabelFontColor`; null = no override.
201
- */
202
- labelColor?: string | null;
203
- /**
204
- * Mixed chart: per-series chart type override. Currently only "line" (XLSX
205
- * and PPTX combo charts) is honoured; other values are treated as the
206
- * chart's primary type.
207
- */
208
- seriesType?: string | null;
209
- /**
210
- * Combo chart: this series is plotted against the SECONDARY value axis
211
- * (`ChartModel.secondaryValAxis`) — the `<c:valAx>` with `axPos="r"` /
212
- * `<c:crosses val="max">`. When false/absent the series uses the primary
213
- * (left) value-axis scale. PowerPoint's "Revenue vs. gross margin" combo
214
- * (sample-14 slide-8) puts the margin line on a 0–100% secondary axis.
215
- */
216
- useSecondaryAxis?: boolean | null;
217
- /**
218
- * Scatter-only X values (as strings). When null the series uses
219
- * `ChartModel.categories` as X.
220
- */
221
- categories?: string[] | null;
222
- /**
223
- * Resolved marker visibility for line/scatter series. ECMA-376 §21.2.2.32
224
- * `<c:marker><c:symbol>` defaults to "none" for line charts unless the
225
- * chart-level `<c:marker val="1"/>` or a per-series symbol opts in. When
226
- * undefined/null the renderer uses its own default (visible) so callers
227
- * that don't parse markers (e.g. pptx today) keep their existing behavior.
228
- */
229
- showMarker?: boolean | null;
230
- /**
231
- * Excel number-format code for this series' values (ECMA-376 §21.2.2.37,
232
- * `<c:val>/<c:numRef>/<c:formatCode>`). Used to format data labels when the
233
- * chart-level `<c:dLbls><c:numFmt>` is not set. null = no series-level code.
234
- */
235
- valFormatCode?: string | null;
236
- /**
237
- * `<c:marker><c:symbol val>` (ECMA-376 §21.2.2.32) — point marker shape.
238
- * One of "circle"|"square"|"diamond"|"triangle"|"x"|"plus"|"star"|
239
- * "dot"|"dash"|"picture"|"none". null = renderer default (circle when
240
- * showMarker is true).
241
- */
242
- markerSymbol?: string | null;
243
- /**
244
- * `<c:marker><c:size val>` (ECMA-376 §21.2.2.34) — marker side length in
245
- * points. null = renderer default (~5 pt).
246
- */
247
- markerSize?: number | null;
248
- /** `<c:marker><c:spPr><a:solidFill>` resolved hex (no `#`). */
249
- markerFill?: string | null;
250
- /** `<c:marker><c:spPr><a:ln><a:solidFill>` resolved hex (no `#`). */
251
- markerLine?: string | null;
252
- /**
253
- * Per-data-point overrides (ECMA-376 §21.2.2.39 `<c:dPt>`). Keyed by point
254
- * index. Any unset field falls back to the series-level value.
255
- */
256
- dataPointOverrides?: ChartDataPointOverride[] | null;
257
- /**
258
- * Per-data-point custom labels (ECMA-376 §21.2.2.45 `<c:dLbl idx>`).
259
- * `text` is the resolved plain string — `<a:fld type="CELLRANGE">`
260
- * placeholders are already substituted at parse time. An empty string
261
- * means the point's label was deleted with `<c:delete val="1"/>` and
262
- * the renderer should skip it.
263
- */
264
- dataLabelOverrides?: ChartDataLabelOverride[] | null;
265
- /**
266
- * Series-level `<c:dLbls>` block (showVal / showSerName / position).
267
- * Applied to every point lacking its own `<c:dLbl>` override.
268
- */
269
- seriesDataLabels?: ChartSeriesDataLabels | null;
270
- /**
271
- * `<c:errBars>` per-series error bars (ECMA-376 §21.2.2.20). Up to two
272
- * (one per direction). Plus / minus deltas are absolute per-point values
273
- * regardless of `errValType`.
274
- */
275
- errBars?: ChartErrBars[] | null;
276
- /**
277
- * `<c:bubbleSize>` per-point sizes for bubble charts (ECMA-376 §21.2.2.4).
278
- * Drives marker radius — renderer treats the values as areas (radius
279
- * scales by sqrt) so visual area is proportional to value, matching
280
- * Excel. null / empty array = uniform marker size. Ignored for non-bubble
281
- * series.
282
- */
283
- bubbleSizes?: (number | null)[] | null;
284
- /**
285
- * `<c:ser><c:smooth val>` (ECMA-376 §21.2.2.194) — line/area series flag
286
- * requesting a smoothed (spline) curve through the points instead of straight
287
- * segments. Only consulted for the line and area families (scatter carries its
288
- * smoothing in `ChartModel.scatterStyle`). null/undefined/false = straight
289
- * polyline (the default; byte-stable for series that never set it).
290
- */
291
- smooth?: boolean | null;
292
- /**
293
- * `<c:ser><c:trendline>` per-series trendlines (ECMA-376 §21.2.2.211,
294
- * `CT_Trendline`). A series can carry several (e.g. a linear fit + a moving
295
- * average). null/undefined/empty = no trendline (the default; byte-stable for
296
- * series that never declare one).
297
- */
298
- trendLines?: ChartTrendline[] | null;
299
- /**
300
- * `<c:ser><c:spPr><a:ln><a:noFill/>` (ECMA-376 §21.2.2.198 CT_ShapeProperties
301
- * → DrawingML §20.1.2.2.24 CT_LineProperties). true when the series connecting
302
- * line is explicitly turned OFF. For a scatter/line series this OVERRIDES the
303
- * chart-group `<c:scatterStyle>` (§21.2.2.42) / line default — Excel and
304
- * PowerPoint draw markers only (no connecting line) even when the group style
305
- * is `lineMarker`. null/undefined = no explicit line-off, so the group default
306
- * governs (byte-stable for series that carry a paintable line).
307
- */
308
- lineHidden?: boolean | null;
309
- }
310
- /**
311
- * `<c:ser><c:trendline>` (ECMA-376 §21.2.2.211). A regression/smoothing curve
312
- * fitted to the series' data points.
313
- */
126
+ name: string;
127
+ color: string | null;
128
+ values: (number | null)[];
129
+ dataPointColors?: (string | null)[] | null;
130
+ dataLabelColors?: (string | null)[] | null;
131
+ labelColor?: string | null;
132
+ seriesType?: string | null;
133
+ useSecondaryAxis?: boolean | null;
134
+ categories?: string[] | null;
135
+ showMarker?: boolean | null;
136
+ valFormatCode?: string | null;
137
+ markerSymbol?: string | null;
138
+ markerSize?: number | null;
139
+ markerFill?: string | null;
140
+ markerLine?: string | null;
141
+ dataPointOverrides?: ChartDataPointOverride[] | null;
142
+ dataLabelOverrides?: ChartDataLabelOverride[] | null;
143
+ seriesDataLabels?: ChartSeriesDataLabels | null;
144
+ errBars?: ChartErrBars[] | null;
145
+ bubbleSizes?: (number | null)[] | null;
146
+ smooth?: boolean | null;
147
+ trendLines?: ChartTrendline[] | null;
148
+ lineHidden?: boolean | null;
149
+ }
314
150
  interface ChartTrendline {
315
- /**
316
- * `<c:trendlineType val>` (§21.2.2.213, `ST_TrendlineType` §21.2.3.50):
317
- * "linear" | "exp" | "log" | "power" | "poly" | "movingAvg". The renderer
318
- * currently draws "linear" (least squares) and "movingAvg"; other types parse
319
- * but are not yet plotted (tracked as a follow-up).
320
- */
321
- trendlineType: string;
322
- /** `<c:order val>` — polynomial order (`poly`, default 2). */
323
- order?: number | null;
324
- /** `<c:period val>` — moving-average window (`movingAvg`, default 2). */
325
- period?: number | null;
326
- /** `<c:forward val>` — units to extend the line past the last point. */
327
- forward?: number | null;
328
- /** `<c:backward val>` — units to extend the line before the first point. */
329
- backward?: number | null;
330
- /** `<c:intercept val>` — forced y-intercept (linear/exp). null = free fit. */
331
- intercept?: number | null;
332
- /** `<c:dispRSqr val="1">` — show the R² value (label; not yet rendered). */
333
- dispRSqr?: boolean | null;
334
- /** `<c:dispEq val="1">` — show the fit equation (label; not yet rendered). */
335
- dispEq?: boolean | null;
336
- /** `<c:spPr><a:ln><a:solidFill>` trendline color (hex without '#'). null =
337
- * inherit the series color. */
338
- lineColor?: string | null;
339
- /** `<c:spPr><a:ln w>` trendline width in EMU. */
340
- lineWidthEmu?: number | null;
151
+ trendlineType: string;
152
+ order?: number | null;
153
+ period?: number | null;
154
+ forward?: number | null;
155
+ backward?: number | null;
156
+ intercept?: number | null;
157
+ dispRSqr?: boolean | null;
158
+ dispEq?: boolean | null;
159
+ lineColor?: string | null;
160
+ lineWidthEmu?: number | null;
341
161
  }
342
162
  interface ChartDataPointOverride {
343
- idx: number;
344
- /** Resolved fill hex (no `#`). */
345
- color?: string;
346
- markerSymbol?: string;
347
- markerSize?: number;
348
- markerFill?: string;
349
- markerLine?: string;
350
- /**
351
- * `<c:dPt><c:explosion val>` (ECMA-376 §21.2.2.61) — the amount this
352
- * pie/doughnut slice is moved out from the center. The schema type is
353
- * `CT_UnsignedInt` (unbounded `xsd:unsignedInt`); the spec text only says
354
- * "the amount the data point shall be moved from the center of the pie"
355
- * and does not itself define units or a 0–100 range. We treat it as a
356
- * de-facto percentage of the outer radius (0–100 typical), matching
357
- * Office's UI (the Point Explosion slider caps at 100%) rather than a
358
- * spec-mandated bound. undefined/absent = 0 (no explosion, flush with the
359
- * ring). Only consulted by the pie/doughnut renderer.
360
- */
361
- explosion?: number;
163
+ idx: number;
164
+ color?: string;
165
+ markerSymbol?: string;
166
+ markerSize?: number;
167
+ markerFill?: string;
168
+ markerLine?: string;
169
+ explosion?: number;
362
170
  }
363
171
  interface ChartDataLabelOverride {
364
- idx: number;
365
- /** Empty string = label deleted (skip drawing). */
366
- text: string;
367
- /** "l"|"r"|"t"|"b"|"ctr"|"outEnd"|"bestFit". undefined = inherit. */
368
- position?: string;
369
- fontColor?: string;
370
- fontSizeHpt?: number;
371
- /** `<a:defRPr b="1">` inside the per-idx rich text. */
372
- fontBold?: boolean;
373
- /** Per-point callout box (`<c:dLbl><c:spPr>`, ECMA-376 §21.2.2.47/§21.2.2.197):
374
- * overrides the series-default box for this one slice. */
375
- labelBox?: ChartLabelBox;
376
- /**
377
- * Per-point label-content flags (`<c:dLbl>` §21.2.2.47 carries the same
378
- * show-flag group as the series `<c:dLbls>` §21.2.2.49: §21.2.2.189
379
- * `<c:showVal>`, §21.2.2.177 `<c:showCatName>`, §21.2.2.180 `<c:showSerName>`,
380
- * §21.2.2.187 `<c:showPercent>`). When present they OVERRIDE the series-level
381
- * defaults for that one point (e.g. sample-14 slide-7's pie sets
382
- * `showCatName=0 showPercent=1` per slice while the series default is
383
- * `showCatName=1`, so each label is percent only). undefined = inherit the
384
- * series default for that flag.
385
- */
386
- showVal?: boolean;
387
- showCatName?: boolean;
388
- showSerName?: boolean;
389
- showPercent?: boolean;
390
- /**
391
- * `<c:dLbl><c:delete val="1"/>` (ECMA-376 §21.2.2.43) — the point's label is
392
- * removed. Distinguishes a genuine delete from a `<c:dLbl>` that only carries
393
- * style / flag overrides with no `<c:tx>` (both otherwise present as
394
- * `text === ''`). true = skip the label; undefined/absent = not deleted.
395
- */
396
- deleted?: boolean;
397
- }
398
- /** Callout-box style for a pie/doughnut data label — the white (or themed)
399
- * rounded rectangle with a thin border Word draws around a `bestFit` label
400
- * placed outside its slice. From the label's `<c:spPr>` (§21.2.2.197). All
401
- * fields optional: absent → transparent / unbordered. Mirror of Rust
402
- * `ChartLabelBox`. */
172
+ idx: number;
173
+ text: string;
174
+ position?: string;
175
+ fontColor?: string;
176
+ fontSizeHpt?: number;
177
+ fontBold?: boolean;
178
+ labelBox?: ChartLabelBox;
179
+ showVal?: boolean;
180
+ showCatName?: boolean;
181
+ showSerName?: boolean;
182
+ showPercent?: boolean;
183
+ deleted?: boolean;
184
+ }
403
185
  interface ChartLabelBox {
404
- /** `<a:solidFill>` resolved hex (no `#`). Box background. */
405
- fill?: string;
406
- /** `<a:ln><a:solidFill>` resolved hex (no `#`). Border stroke. */
407
- borderColor?: string;
408
- /** `<a:ln w>` border width in EMU (12700 EMU = 1 pt). */
409
- borderWidthEmu?: number;
186
+ fill?: string;
187
+ borderColor?: string;
188
+ borderWidthEmu?: number;
410
189
  }
411
190
  interface ChartSeriesDataLabels {
412
- showVal: boolean;
413
- showCatName: boolean;
414
- showSerName: boolean;
415
- showPercent: boolean;
416
- position?: string;
417
- fontColor?: string;
418
- formatCode?: string;
419
- /** Series-level bold default for data labels. */
420
- fontBold?: boolean;
421
- /** Series-level font size for data labels (OOXML hundredths of a point). */
422
- fontSizeHpt?: number;
423
- /** Series-default callout box (`<c:dLbls><c:spPr>`, ECMA-376 §21.2.2.49/
424
- * §21.2.2.197). When present the pie/doughnut renderer draws Word's boxed
425
- * callout layout (box + optional leader line) instead of plain text. */
426
- labelBox?: ChartLabelBox;
427
- /** `<c:dLbls><c:showLeaderLines val>` (§21.2.2.183) — draw leader lines from
428
- * a pulled-away label back to its slice. Default false. */
429
- showLeaderLines?: boolean;
430
- /** `<c:leaderLines><c:spPr><a:ln><a:solidFill>` (§21.2.2.92) resolved hex
431
- * (no `#`). undefined → renderer uses a neutral grey. */
432
- leaderLineColor?: string;
433
- /** `<c:leaderLines><c:spPr><a:ln w>` leader-line width in EMU. */
434
- leaderLineWidthEmu?: number;
191
+ showVal: boolean;
192
+ showCatName: boolean;
193
+ showSerName: boolean;
194
+ showPercent: boolean;
195
+ position?: string;
196
+ fontColor?: string;
197
+ formatCode?: string;
198
+ fontBold?: boolean;
199
+ fontSizeHpt?: number;
200
+ labelBox?: ChartLabelBox;
201
+ showLeaderLines?: boolean;
202
+ leaderLineColor?: string;
203
+ leaderLineWidthEmu?: number;
435
204
  }
436
205
  interface ChartErrBars {
437
- /** "x" | "y". */
438
- dir: string;
439
- /** "plus" | "minus" | "both". */
440
- barType: string;
441
- plus: (number | null)[];
442
- minus: (number | null)[];
443
- noEndCap: boolean;
444
- /** Resolved hex (no `#`). */
445
- color?: string;
446
- lineWidthEmu?: number;
447
- /** "solid"|"dash"|"dot"|"dashDot"|... */
448
- dash?: string;
449
- }
450
- /**
451
- * Canonical chart type vocabulary. Embeds direction (`H` = horizontal) and
452
- * grouping (`Pct` = percent-stacked) so renderers do not need to inspect
453
- * separate `barDir`/`grouping` fields.
454
- */
206
+ dir: string;
207
+ barType: string;
208
+ plus: (number | null)[];
209
+ minus: (number | null)[];
210
+ noEndCap: boolean;
211
+ color?: string;
212
+ lineWidthEmu?: number;
213
+ dash?: string;
214
+ }
455
215
  type ChartType = 'line' | 'stackedLine' | 'stackedLinePct' | 'clusteredBar' | 'clusteredBarH' | 'stackedBar' | 'stackedBarH' | 'stackedBarPct' | 'stackedBarHPct' | 'area' | 'stackedArea' | 'stackedAreaPct' | 'pie' | 'doughnut' | 'scatter' | 'bubble' | 'radar' | 'waterfall' | 'stock' | 'boxWhisker' | 'sunburst' | string;
456
216
  interface ChartModel {
457
- chartType: ChartType;
458
- title: string | null;
459
- categories: string[];
460
- series: ChartSeries[];
461
- /**
462
- * §21.2.2.227 `<c:varyColors val="1"/>` on a SINGLE-series bar/column chart:
463
- * color each data point (bar) from the theme/palette sequence and list one
464
- * legend entry per point, matching Office. Set by the shared parser ONLY for
465
- * that non-pie, single-series case (pie/doughnut already vary by point via
466
- * `chartType` + `dataPointColors`); absent/false otherwise.
467
- */
468
- varyColors?: boolean | null;
469
- /** Show data labels on bars / points / slices. */
470
- showDataLabels: boolean;
471
- /** Explicit Y-axis minimum (OOXML `<c:valAx><c:min>`). */
472
- valMin: number | null;
473
- /** Explicit Y-axis maximum (OOXML `<c:valAx><c:max>`). */
474
- valMax: number | null;
475
- catAxisTitle: string | null;
476
- valAxisTitle: string | null;
477
- /** `<c:catAx><c:delete val="1"/>`. */
478
- catAxisHidden: boolean;
479
- /** `<c:valAx><c:delete val="1"/>`. */
480
- valAxisHidden: boolean;
481
- /** `<c:catAx><c:spPr><a:ln><a:noFill>` hide just the axis LINE; labels
482
- * and tick marks still render. Distinct from `catAxisHidden` (which
483
- * removes everything via `<c:delete val="1"/>`). */
484
- catAxisLineHidden: boolean;
485
- /** `<c:valAx><c:spPr><a:ln><a:noFill>` hide just the axis LINE; labels
486
- * and tick marks still render. */
487
- valAxisLineHidden: boolean;
488
- /** Hex without '#'. From `<c:plotArea><c:spPr><a:solidFill>`. */
489
- plotAreaBg: string | null;
490
- /** Outer chartSpace background (hex without '#'). null when noFill/absent. */
491
- chartBg: string | null;
492
- /** True when `<c:legend>` is declared in the chart XML. False = no legend. */
493
- showLegend: boolean;
494
- /** `<c:legend><c:legendPos val>` — "r"|"l"|"t"|"b"|"tr". null = default (r). */
495
- legendPos: 'r' | 'l' | 't' | 'b' | 'tr' | null;
496
- /** `<c:catAx><c:crossBetween val="..."/>`. "between" inserts 0.5-step padding
497
- * on each end of the category axis; "midCat" anchors endpoints to the axes. */
498
- catAxisCrossBetween: 'between' | 'midCat' | string;
499
- /** `<c:valAx><c:majorTickMark>`. ECMA-376 default is "cross". */
500
- valAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
501
- /** `<c:catAx><c:majorTickMark>`. */
502
- catAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
503
- /** `<c:valAx | catAx><c:minorTickMark>`. ECMA-376 default is "none". */
504
- valAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
505
- catAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
506
- /** Title font size in OOXML hundredths of a point (1600 = 16pt). null = default. */
507
- titleFontSizeHpt: number | null;
508
- /** Title font color as a hex string without '#' (e.g. "1B4332"). null = default. */
509
- titleFontColor: string | null;
510
- /** Title font family from `<a:latin typeface>` (ECMA-376 §20.1.4.2.24). null = default. */
511
- titleFontFace: string | null;
512
- /** `<c:catAx><c:txPr>` font size (hpt). null = fall back to proportional default. */
513
- catAxisFontSizeHpt: number | null;
514
- /** `<c:valAx><c:txPr>` font size (hpt). null = fall back to proportional default. */
515
- valAxisFontSizeHpt: number | null;
516
- /** `<c:catAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#').
517
- * null = renderer default. Lets templates color category labels gray. */
518
- catAxisFontColor?: string | null;
519
- /** `<c:valAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
520
- valAxisFontColor?: string | null;
521
- /** `<c:dLbls><c:txPr>` font size (hpt) for data-point value labels. */
522
- dataLabelFontSizeHpt: number | null;
523
- /** Waterfall subtotal category indices. */
524
- subtotalIndices: number[];
525
- /** `<c:legend><c:manualLayout>` absolute placement fractions of the chart
526
- * space (ECMA-376 §21.2.2.31). Overrides the default side-based legend
527
- * rectangle while still letting `legendPos` decide which side of the plot
528
- * gets the reserved band. null = use default layout. */
529
- legendManualLayout?: LegendManualLayout | null;
530
- /**
531
- * `<c:valAx><c:numFmt@formatCode>` format code applied to value-axis tick
532
- * labels (ECMA-376 §21.2.2.21). null = plain numeric formatting.
533
- */
534
- valAxisFormatCode?: string | null;
535
- /**
536
- * `<c:barChart><c:gapWidth>` space between category groups as a
537
- * percentage of bar width (ECMA-376 §21.2.2.13). Default per spec is 150.
538
- * null = renderer default.
539
- */
540
- barGapWidth?: number | null;
541
- /**
542
- * `<c:barChart><c:overlap>` signed percentage overlap between bars in the
543
- * same category cluster (ECMA-376 §21.2.2.25). Negative = gap, positive =
544
- * overlap, 0 = flush. Range [-100, 100]. null = renderer default (0).
545
- */
546
- barOverlap?: number | null;
547
- /**
548
- * `<c:dLbls><c:dLblPos>` data label position (ECMA-376 §21.2.2.16).
549
- * "ctr"|"inBase"|"inEnd"|"outEnd"|"l"|"r"|"t"|"b"|"bestFit" etc.
550
- */
551
- dataLabelPosition?: string | null;
552
- /** Hex (no `#`) for data label text, resolved from `<c:dLbls><c:txPr>`. */
553
- dataLabelFontColor?: string | null;
554
- /**
555
- * `<c:dLbls><c:numFmt@formatCode>` chart-level override for data label
556
- * number format (ECMA-376 §21.2.2.35). When absent, `valFormatCode` on each
557
- * series is used.
558
- */
559
- dataLabelFormatCode?: string | null;
560
- /** `<c:title>...defRPr@b>` chart title bold flag. */
561
- titleFontBold?: boolean | null;
562
- /** `<c:catAx><c:txPr>...defRPr@b>` X-axis tick label bold flag. */
563
- catAxisFontBold?: boolean | null;
564
- /** `<c:valAx><c:txPr>...defRPr@b>` Y-axis tick label bold flag. */
565
- valAxisFontBold?: boolean | null;
566
- /** `<c:catAx><c:title>` run-prop font size (hpt). Distinct from
567
- * `catAxisFontSizeHpt` (tick labels). null = renderer default. */
568
- catAxisTitleFontSizeHpt?: number | null;
569
- /** `<c:catAx><c:title>` run-prop bold flag. null = not bold. */
570
- catAxisTitleFontBold?: boolean | null;
571
- /** `<c:catAx><c:title>` run-prop color (hex without '#'). null = default. */
572
- catAxisTitleFontColor?: string | null;
573
- /** `<c:valAx><c:title>` run-prop font size (hpt). null = renderer default. */
574
- valAxisTitleFontSizeHpt?: number | null;
575
- /** `<c:valAx><c:title>` run-prop bold flag. null = not bold. */
576
- valAxisTitleFontBold?: boolean | null;
577
- /** `<c:valAx><c:title>` run-prop color (hex without '#'). null = default. */
578
- valAxisTitleFontColor?: string | null;
579
- /** `<c:catAx><c:txPr>…<a:latin typeface>` tick-label font. */
580
- catAxisFontFace?: string | null;
581
- /** `<c:valAx><c:txPr>…<a:latin typeface>` tick-label font. */
582
- valAxisFontFace?: string | null;
583
- /** `<c:catAx><c:title>…<a:latin typeface>` axis-title font. */
584
- catAxisTitleFontFace?: string | null;
585
- /** `<c:valAx><c:title>…<a:latin typeface>` axis-title font. */
586
- valAxisTitleFontFace?: string | null;
587
- /** `<c:dLbls><c:txPr>…<a:latin typeface>` data-label font. */
588
- dataLabelFontFace?: string | null;
589
- /** `<c:legend><c:txPr>…<a:latin typeface>` legend font. */
590
- legendFontFace?: string | null;
591
- /** `<c:legend><c:txPr>…<a:solidFill>` legend text color (hex without '#'). */
592
- legendFontColor?: string | null;
593
- /** `<c:legend><c:txPr>` legend font size (OOXML hundredths of a point). */
594
- legendFontSizeHpt?: number | null;
595
- /** `<c:legend><c:txPr>…defRPr@b` legend bold flag. */
596
- legendFontBold?: boolean | null;
597
- /**
598
- * Theme font-scheme faces (`<a:fontScheme>`, ECMA-376 §20.1.4.2). Latin
599
- * heading (majorFont) and body (minorFont) typefaces, used as the fallback
600
- * for any chart text element whose own `<c:txPr>` supplies no `<a:latin>`.
601
- * null when the theme is not threaded to the chart (then the renderer's
602
- * built-in sans-serif remains, byte-stable). Axis titles / chart title use
603
- * the major (heading) face; tick labels / data labels / legend use the
604
- * minor (body) face — matching Office's default chart text styling.
605
- */
606
- themeMajorFontLatin?: string | null;
607
- themeMinorFontLatin?: string | null;
608
- /** Explicit chart border color (hex without '#') from
609
- * `<c:chartSpace><c:spPr><a:ln><a:solidFill><a:srgbClr>`. Only set when the
610
- * XML explicitly declares a paintable line; null otherwise (no default
611
- * border is drawn). */
612
- chartBorderColor?: string | null;
613
- /** `<c:chartSpace><c:spPr><a:ln@w>` border width in EMU. null = 1px hairline
614
- * when a color is present. */
615
- chartBorderWidthEmu?: number | null;
616
- /**
617
- * `<c:catAx><c:crosses val>` (`autoZero` | `min` | `max`). Drives the Y
618
- * coordinate where the X axis is drawn. Default `autoZero` puts the X
619
- * axis at y=0 — that's how Excel "Project Timeline" templates split
620
- * milestones (positive Y) above and tasks (negative Y) below the axis.
621
- */
622
- catAxisCrosses?: string | null;
623
- /** `<c:catAx><c:crossesAt val>` — explicit numeric override for the
624
- * crossing point. Takes precedence over `catAxisCrosses`. */
625
- catAxisCrossesAt?: number | null;
626
- valAxisCrosses?: string | null;
627
- valAxisCrossesAt?: number | null;
628
- /** Axis line color (hex without `#`) and width in EMU from
629
- * `<c:catAx|valAx><c:spPr><a:ln>`. */
630
- catAxisLineColor?: string | null;
631
- catAxisLineWidthEmu?: number | null;
632
- valAxisLineColor?: string | null;
633
- valAxisLineWidthEmu?: number | null;
634
- /**
635
- * `<c:catAx><c:numFmt@formatCode>` (or scatter X-axis valAx). When set,
636
- * the renderer formats X-axis tick labels with this code (e.g. dates).
637
- */
638
- catAxisFormatCode?: string | null;
639
- /**
640
- * `<c:catAx><c:scaling><c:min/max>` — explicit X-axis range. Used by
641
- * scatter / bubble charts whose X axis is numeric. null = derive from
642
- * data extents.
643
- */
644
- catAxisMin?: number | null;
645
- catAxisMax?: number | null;
646
- /**
647
- * `<c:title><c:layout><c:manualLayout>` (ECMA-376 §21.2.2.27) absolute
648
- * placement for the chart title.
649
- */
650
- titleManualLayout?: ChartManualLayout | null;
651
- /**
652
- * `<c:plotArea><c:layout><c:manualLayout>` absolute placement for the
653
- * plot area. `layoutTarget="inner"` (default) describes the inner plot
654
- * rect (no axes / labels); `outer` describes the outer rect (axes
655
- * included).
656
- */
657
- plotAreaManualLayout?: ChartManualLayout | null;
658
- /**
659
- * `<c:scatterChart><c:scatterStyle val>` (ECMA-376 §21.2.2.42). Drives
660
- * whether scatter charts connect points with lines and whether those
661
- * lines are smoothed. Values: "marker" (markers only — Excel default
662
- * "Scatter"), "line" / "lineMarker" (straight segments), "smooth" /
663
- * "smoothMarker" (cubic Bézier through points), "lineNoMarker",
664
- * "smoothNoMarker". null = renderer default ("marker"). Only consulted
665
- * for `chartType === "scatter"`; bubble ignores it.
666
- */
667
- scatterStyle?: string | null;
668
- /**
669
- * `<c:radarChart><c:radarStyle val>` (ECMA-376 §21.2.3.10). Controls
670
- * whether radar series render as line + markers ("standard" / "marker")
671
- * or as a closed polygon with area fill ("filled"). null = default
672
- * ("standard" — line, no fill). Only consulted for `chartType === "radar"`.
673
- */
674
- radarStyle?: string | null;
675
- /**
676
- * Secondary value axis for combo charts (bar + line). When present, series
677
- * with `useSecondaryAxis` are plotted against this axis's independent scale
678
- * and the axis is drawn on the right edge of the plot. null/absent = single
679
- * value axis (the common case). See {@link SecondaryValueAxis}.
680
- */
681
- secondaryValAxis?: SecondaryValueAxis | null;
682
- /**
683
- * `<c:date1904>` (ECMA-376 §21.2.2.38). When true the chart's serial
684
- * date-times resolve against the 1904 date system (base 1904-01-01) instead
685
- * of the default 1900 system. Threaded to the date formatters for date-axis
686
- * category labels and value-axis tick labels. Omitted/false ⇒ 1900 system.
687
- * Note: per §21.2.2.38 the element's `val` defaults to true when present but
688
- * the attribute is omitted, so `<c:date1904/>` alone means date1904=true.
689
- */
690
- date1904?: boolean;
691
- /**
692
- * `<c:doughnutChart><c:holeSize val>` (ECMA-376 §21.2.2.60,
693
- * `ST_HoleSizePercent` §21.2.3.55) — the doughnut hole diameter as a
694
- * percentage 1–90 of the outer diameter. Ignored for pie (which has no
695
- * hole). null/undefined = use the renderer's doughnut default when the
696
- * element is absent. Note the ECMA `CT_HoleSize` schema default is 10%, but
697
- * a real doughnut file always writes an explicit `<c:holeSize>` (Excel /
698
- * PowerPoint emit 50–75%); the renderer falls back to 50% only for the
699
- * pathological absent case.
700
- */
701
- holeSize?: number | null;
702
- /**
703
- * `<c:pieChart | doughnutChart><c:firstSliceAng val>` (ECMA-376 §21.2.2.52,
704
- * `ST_FirstSliceAng` §21.2.3.15) — the angle in degrees (0–360, clockwise
705
- * from the 12 o'clock position) at which the first slice begins.
706
- * null/undefined = 0 (start at 12 o'clock), which matches the renderer's
707
- * historical fixed −90° (canvas up) start.
708
- */
709
- firstSliceAngle?: number | null;
710
- /**
711
- * `<c:chartSpace><c:chart><c:dispBlanksAs val>` (ECMA-376 §21.2.2.42,
712
- * `ST_DispBlanksAs` §21.2.3.10) — how blank (null) cells are plotted on
713
- * line/area charts:
714
- * - "gap" → leave a gap (break the line). The renderer's historical
715
- * behavior and the model default when the element is absent.
716
- * - "zero" → plot the blank as the value 0 (the point drops to the axis).
717
- * - "span" → skip the blank but connect its neighbours with a straight
718
- * line (bridge the gap).
719
- * Note the XSD `@val` default is "zero" (applies when `<c:dispBlanksAs/>` is
720
- * present but the attribute is omitted); when the ELEMENT is absent entirely
721
- * Office falls back to "gap", which is what we model as the default. Only
722
- * consulted for the line and area families. null/undefined = "gap".
723
- */
724
- dispBlanksAs?: string | null;
725
- /**
726
- * `<c:valAx><c:majorGridlines>` presence (ECMA-376 §21.2.2.100). `false` when
727
- * the value axis exists but omits the element (Office suppresses value
728
- * gridlines). null/undefined ⇒ the renderer's historical always-on value
729
- * gridlines (byte-stable). `true` is redundant with the default but honored.
730
- */
731
- valAxisMajorGridlines?: boolean | null;
732
- /**
733
- * `<c:catAx><c:majorGridlines>` presence (§21.2.2.100). `true` turns on
734
- * category-axis gridlines (Office omits them by default). null/undefined/false
735
- * ⇒ no category gridlines (the historical default, byte-stable).
736
- */
737
- catAxisMajorGridlines?: boolean | null;
738
- /**
739
- * `<c:valAx><c:majorGridlines><c:spPr><a:ln><a:solidFill>` resolved gridline
740
- * color (hex without `#`) — ECMA-376 §21.2.2.100. When set, the value-axis
741
- * major gridlines are stroked in this color instead of the renderer's faint
742
- * `#e0e0e0` default (e.g. sample-1 slide 5's `accent3` gridlines). null/absent
743
- * ⇒ the historical default (byte-stable).
744
- */
745
- valAxisGridlineColor?: string | null;
746
- /**
747
- * `<c:valAx><c:majorGridlines><c:spPr><a:ln w>` gridline width in EMU. When
748
- * set, the value-axis gridline stroke width is derived from this (floored so a
749
- * hairline stays visible). null/absent ⇒ the renderer's 0.5 px default.
750
- */
751
- valAxisGridlineWidthEmu?: number | null;
752
- /**
753
- * `<c:catAx><c:majorGridlines><c:spPr><a:ln><a:solidFill>` resolved gridline
754
- * color (hex without `#`). Only meaningful when {@link catAxisMajorGridlines}
755
- * is on. null/absent ⇒ the faint default.
756
- */
757
- catAxisGridlineColor?: string | null;
758
- /** `<c:catAx><c:majorGridlines><c:spPr><a:ln w>` gridline width in EMU. */
759
- catAxisGridlineWidthEmu?: number | null;
760
- /** `<c:valAx><c:minorGridlines>` presence (§21.2.2.109). Only drawn when a
761
- * minor step is resolvable (see {@link valAxisMinorUnit}). */
762
- valAxisMinorGridlines?: boolean | null;
763
- /**
764
- * `<c:valAx><c:majorUnit val>` (§21.2.2.103) — explicit distance between major
765
- * gridlines/ticks, overriding the Excel-style auto "nice" step. null/undefined
766
- * ⇒ auto step (byte-stable).
767
- */
768
- valAxisMajorUnit?: number | null;
769
- /** `<c:valAx><c:minorUnit val>` (§21.2.2.112) — explicit minor step. Drives
770
- * minor gridlines/ticks when present. null ⇒ no minor divisions. */
771
- valAxisMinorUnit?: number | null;
772
- /**
773
- * `<c:valAx><c:scaling><c:logBase val>` (§21.2.2.98, `ST_LogBase` §21.2.3.25)
774
- * — logarithmic value-axis base (>= 2). When set, values map to pixels in log
775
- * space and gridlines fall on powers of the base. null/undefined ⇒ linear
776
- * (byte-stable).
777
- */
778
- valAxisLogBase?: number | null;
779
- /**
780
- * `<c:valAx><c:scaling><c:orientation val>` (§21.2.2.130, `ST_Orientation`
781
- * §21.2.3.30) — "minMax" (normal) | "maxMin" (reversed, so the value axis runs
782
- * top→bottom max→min). null/undefined/"minMax" ⇒ normal (byte-stable).
783
- */
784
- valAxisOrientation?: 'minMax' | 'maxMin' | string | null;
785
- /** `<c:catAx><c:scaling><c:orientation val>` — "maxMin" reverses the category
786
- * axis left↔right. null/"minMax" ⇒ normal. */
787
- catAxisOrientation?: 'minMax' | 'maxMin' | string | null;
788
- /**
789
- * `<c:catAx><c:tickLblPos val>` (§21.2.2.207, `ST_TickLblPos` §21.2.3.47) —
790
- * "nextTo" (default) | "low" | "high" | "none". "none" hides the category tick
791
- * labels. null/undefined ⇒ nextTo (byte-stable).
792
- */
793
- catAxisTickLabelPos?: string | null;
794
- /** `<c:valAx><c:tickLblPos val>` (§21.2.2.207). "none" hides value tick labels. */
795
- valAxisTickLabelPos?: string | null;
796
- /**
797
- * `<c:catAx><c:txPr><a:bodyPr rot>` (DrawingML `ST_Angle`, 60000ths of a
798
- * degree) — category tick-label rotation. e.g. -2700000 = -45°. null/undefined
799
- * /0 ⇒ horizontal labels (byte-stable).
800
- */
801
- catAxisLabelRotation?: number | null;
802
- /**
803
- * `<c:stockChart><c:hiLowLines>` presence (ECMA-376 §21.2.2.60). When true
804
- * the stock renderer draws a vertical line spanning each category's low↔high
805
- * value. Only set for `chartType === "stock"`; null/undefined on every other
806
- * chart type (byte-stable).
807
- */
808
- stockHiLowLines?: boolean | null;
809
- /**
810
- * `<c:hiLowLines><c:spPr><a:ln><a:solidFill>` resolved color (hex, no `#`).
811
- * null = the renderer's default gray hi-lo line.
812
- */
813
- stockHiLowLineColor?: string | null;
814
- /**
815
- * `<c:stockChart><c:upDownBars>` presence (ECMA-376 §21.2.2.227). Parsed so a
816
- * stock file carrying open-close up/down bars is recognized; the renderer does
817
- * NOT yet draw them (tracked follow-up). null/undefined when absent.
818
- */
819
- stockUpDownBars?: boolean | null;
820
- /**
821
- * Structured box-and-whisker data (`chartType === 'boxWhisker'`). Present
822
- * ONLY for boxWhisker charts; null/absent otherwise so the flat
823
- * `categories`/`series` model the other chartEx renderers consume is
824
- * untouched. The renderer computes quartiles / mean / whiskers / outliers.
825
- */
826
- chartexBox?: ChartexBoxWhisker | null;
827
- /**
828
- * Structured sunburst hierarchy (`chartType === 'sunburst'`). Present ONLY
829
- * for sunburst charts; null/absent otherwise.
830
- */
831
- chartexSunburst?: ChartexSunburst | null;
832
- /**
833
- * Theme accent palette (`accent1..6`, hex without '#') for chartEx charts
834
- * that color by branch/series index (boxWhisker series, sunburst branches).
835
- * null/absent when the resolver supplies no default palette (pptx); the
836
- * renderer then falls back to its own `CHART_PALETTE`.
837
- */
838
- chartexAccents?: string[] | null;
839
- }
840
- /**
841
- * One box-and-whisker series (chartEx `boxWhisker`, MS 2014 chartex ext). Each
842
- * `<cx:series>` references its own raw sample points via `<cx:dataId>`; the
843
- * parser groups them by category and threads the `<cx:layoutPr>` flags. The
844
- * renderer derives the statistics.
845
- */
217
+ chartType: ChartType;
218
+ title: string | null;
219
+ categories: string[];
220
+ series: ChartSeries[];
221
+ varyColors?: boolean | null;
222
+ showDataLabels: boolean;
223
+ valMin: number | null;
224
+ valMax: number | null;
225
+ catAxisTitle: string | null;
226
+ valAxisTitle: string | null;
227
+ catAxisHidden: boolean;
228
+ valAxisHidden: boolean;
229
+ catAxisLineHidden: boolean;
230
+ valAxisLineHidden: boolean;
231
+ plotAreaBg: string | null;
232
+ chartBg: string | null;
233
+ showLegend: boolean;
234
+ legendPos: 'r' | 'l' | 't' | 'b' | 'tr' | null;
235
+ catAxisCrossBetween: 'between' | 'midCat' | string;
236
+ valAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
237
+ catAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
238
+ valAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
239
+ catAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
240
+ titleFontSizeHpt: number | null;
241
+ titleFontColor: string | null;
242
+ titleFontFace: string | null;
243
+ catAxisFontSizeHpt: number | null;
244
+ valAxisFontSizeHpt: number | null;
245
+ catAxisFontColor?: string | null;
246
+ valAxisFontColor?: string | null;
247
+ dataLabelFontSizeHpt: number | null;
248
+ subtotalIndices: number[];
249
+ legendManualLayout?: LegendManualLayout | null;
250
+ valAxisFormatCode?: string | null;
251
+ barGapWidth?: number | null;
252
+ barOverlap?: number | null;
253
+ dataLabelPosition?: string | null;
254
+ dataLabelFontColor?: string | null;
255
+ dataLabelFormatCode?: string | null;
256
+ titleFontBold?: boolean | null;
257
+ catAxisFontBold?: boolean | null;
258
+ valAxisFontBold?: boolean | null;
259
+ catAxisTitleFontSizeHpt?: number | null;
260
+ catAxisTitleFontBold?: boolean | null;
261
+ catAxisTitleFontColor?: string | null;
262
+ valAxisTitleFontSizeHpt?: number | null;
263
+ valAxisTitleFontBold?: boolean | null;
264
+ valAxisTitleFontColor?: string | null;
265
+ catAxisFontFace?: string | null;
266
+ valAxisFontFace?: string | null;
267
+ catAxisTitleFontFace?: string | null;
268
+ valAxisTitleFontFace?: string | null;
269
+ dataLabelFontFace?: string | null;
270
+ legendFontFace?: string | null;
271
+ legendFontColor?: string | null;
272
+ legendFontSizeHpt?: number | null;
273
+ legendFontBold?: boolean | null;
274
+ themeMajorFontLatin?: string | null;
275
+ themeMinorFontLatin?: string | null;
276
+ chartBorderColor?: string | null;
277
+ chartBorderWidthEmu?: number | null;
278
+ catAxisCrosses?: string | null;
279
+ catAxisCrossesAt?: number | null;
280
+ valAxisCrosses?: string | null;
281
+ valAxisCrossesAt?: number | null;
282
+ catAxisLineColor?: string | null;
283
+ catAxisLineWidthEmu?: number | null;
284
+ valAxisLineColor?: string | null;
285
+ valAxisLineWidthEmu?: number | null;
286
+ catAxisFormatCode?: string | null;
287
+ catAxisMin?: number | null;
288
+ catAxisMax?: number | null;
289
+ titleManualLayout?: ChartManualLayout | null;
290
+ plotAreaManualLayout?: ChartManualLayout | null;
291
+ scatterStyle?: string | null;
292
+ radarStyle?: string | null;
293
+ secondaryValAxis?: SecondaryValueAxis | null;
294
+ date1904?: boolean;
295
+ holeSize?: number | null;
296
+ firstSliceAngle?: number | null;
297
+ dispBlanksAs?: string | null;
298
+ valAxisMajorGridlines?: boolean | null;
299
+ catAxisMajorGridlines?: boolean | null;
300
+ valAxisGridlineColor?: string | null;
301
+ valAxisGridlineWidthEmu?: number | null;
302
+ catAxisGridlineColor?: string | null;
303
+ catAxisGridlineWidthEmu?: number | null;
304
+ valAxisMinorGridlines?: boolean | null;
305
+ valAxisMajorUnit?: number | null;
306
+ valAxisMinorUnit?: number | null;
307
+ valAxisLogBase?: number | null;
308
+ valAxisOrientation?: 'minMax' | 'maxMin' | string | null;
309
+ catAxisOrientation?: 'minMax' | 'maxMin' | string | null;
310
+ catAxisTickLabelPos?: string | null;
311
+ valAxisTickLabelPos?: string | null;
312
+ catAxisLabelRotation?: number | null;
313
+ stockHiLowLines?: boolean | null;
314
+ stockHiLowLineColor?: string | null;
315
+ stockUpDownBars?: boolean | null;
316
+ chartexBox?: ChartexBoxWhisker | null;
317
+ chartexSunburst?: ChartexSunburst | null;
318
+ chartexAccents?: string[] | null;
319
+ }
846
320
  interface ChartexBoxSeries {
847
- /** Series display name (`<cx:tx><cx:v>`). */
848
- name: string;
849
- /** Fill (hex, no '#') — theme accent cycled by series index. null = fall
850
- * back to the renderer palette. */
851
- color?: string | null;
852
- /** Raw sample values grouped by category (outer = category index parallel to
853
- * {@link ChartexBoxWhisker.categories}, inner = the points in that group). */
854
- valuesByCategory: number[][];
855
- /** `<cx:visibility meanMarker>` — draw the mean `×`. */
856
- meanMarker: boolean;
857
- /** `<cx:visibility meanLine>` — draw a mean connector line across categories. */
858
- meanLine: boolean;
859
- /** `<cx:visibility outliers>` — draw outlier points. */
860
- showOutliers: boolean;
861
- /** `<cx:visibility nonoutliers>` — draw the interior (non-outlier) sample
862
- * points as jittered dots on top of the box. Flag parsed; interior-dot
863
- * rendering is pending a fixture that enables it (every sample-24 series
864
- * ships `nonoutliers="0"`, so there is nothing to verify against yet). */
865
- showNonoutliers: boolean;
866
- /** `<cx:statistics quartileMethod>` — "exclusive" (Excel default) | "inclusive". */
867
- quartileMethod: string;
868
- }
869
- /** A chartEx box-and-whisker chart: unique categories + one series per column. */
321
+ name: string;
322
+ color?: string | null;
323
+ valuesByCategory: number[][];
324
+ meanMarker: boolean;
325
+ meanLine: boolean;
326
+ showOutliers: boolean;
327
+ showNonoutliers: boolean;
328
+ quartileMethod: string;
329
+ }
870
330
  interface ChartexBoxWhisker {
871
- /** Unique category labels in first-seen order. */
872
- categories: string[];
873
- /** One entry per `<cx:series>`. */
874
- series: ChartexBoxSeries[];
875
- }
876
- /**
877
- * One row of a chartEx `sunburst`: the branch→…→leaf label chain (empty
878
- * trailing segments trimmed) and its size value.
879
- */
331
+ categories: string[];
332
+ series: ChartexBoxSeries[];
333
+ }
880
334
  interface ChartexSunburstRow {
881
- /** Label chain root→leaf. */
882
- path: string[];
883
- /** `<cx:numDim type="size">` value attaching to the deepest node in `path`. */
884
- size: number;
335
+ path: string[];
336
+ size: number;
885
337
  }
886
- /** A chartEx sunburst: the flat rows the renderer folds into a ring tree. */
887
338
  interface ChartexSunburst {
888
- rows: ChartexSunburstRow[];
889
- }
890
- /**
891
- * A secondary value axis (combo charts). Mirrors the primary value-axis
892
- * properties but lives in its own object so the flat primary-axis fields stay
893
- * untouched. Parsed from the right-hand `<c:valAx>` (`axPos="r"`,
894
- * `<c:crosses val="max">`).
895
- */
339
+ rows: ChartexSunburstRow[];
340
+ }
896
341
  interface SecondaryValueAxis {
897
- /** `<c:scaling><c:min val>`. null = derive from the series data. */
898
- min: number | null;
899
- /** `<c:scaling><c:max val>`. null = derive from the series data. */
900
- max: number | null;
901
- /** `<c:title>` plain text. null = no title. */
902
- title: string | null;
903
- /** `<c:delete val="1"/>` — hide labels/ticks entirely. */
904
- hidden: boolean;
905
- /** `<c:numFmt formatCode>` for tick labels. */
906
- formatCode?: string | null;
907
- /** `<c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
908
- fontColor?: string | null;
909
- /** `<c:txPr>` tick-label font size (hpt). */
910
- fontSizeHpt?: number | null;
911
- /** `<c:spPr><a:ln><a:solidFill>` axis-line color (hex without '#'). */
912
- lineColor?: string | null;
913
- /** `<c:spPr><a:ln w>` axis-line width in EMU. */
914
- lineWidthEmu?: number | null;
915
- /** `<c:spPr><a:ln><a:noFill>` — hide just the axis rule. */
916
- lineHidden: boolean;
917
- /** `<c:majorTickMark>` — "cross" (default) | "out" | "in" | "none". */
918
- majorTickMark: string;
919
- /**
920
- * `<c:valAx><c:majorUnit val>` (§21.2.2.103) — explicit distance between
921
- * major ticks/gridlines on THIS secondary axis, overriding the Excel-style
922
- * auto "nice" step. null/undefined ⇒ auto step (byte-stable). Symmetric with
923
- * {@link ChartModel.valAxisMajorUnit} on the primary axis.
924
- */
925
- majorUnit?: number | null;
926
- /** `<c:title>` run-prop font size (hpt). */
927
- titleFontSizeHpt?: number | null;
928
- /** `<c:title>` run-prop bold flag. */
929
- titleFontBold?: boolean | null;
930
- /** `<c:title>` run-prop color (hex without '#'). */
931
- titleFontColor?: string | null;
932
- }
933
- /**
934
- * `<c:manualLayout>` block. Fractions are of the chart-space rect.
935
- * `xMode`/`yMode`: "edge" = absolute fraction from top-left, "factor" =
936
- * fraction offset from default position.
937
- */
342
+ min: number | null;
343
+ max: number | null;
344
+ title: string | null;
345
+ hidden: boolean;
346
+ formatCode?: string | null;
347
+ fontColor?: string | null;
348
+ fontSizeHpt?: number | null;
349
+ lineColor?: string | null;
350
+ lineWidthEmu?: number | null;
351
+ lineHidden: boolean;
352
+ majorTickMark: string;
353
+ majorUnit?: number | null;
354
+ titleFontSizeHpt?: number | null;
355
+ titleFontBold?: boolean | null;
356
+ titleFontColor?: string | null;
357
+ }
938
358
  interface ChartManualLayout {
939
- xMode: string;
940
- yMode: string;
941
- layoutTarget?: string;
942
- x: number;
943
- y: number;
944
- w?: number;
945
- h?: number;
359
+ xMode: string;
360
+ yMode: string;
361
+ layoutTarget?: string;
362
+ x: number;
363
+ y: number;
364
+ w?: number;
365
+ h?: number;
946
366
  }
947
367
  interface LegendManualLayout {
948
- /** `"edge"` = `x`/`y` are fractions from top-left of chart space;
949
- * `"factor"` = fractions offset from the default position. */
950
- xMode: string;
951
- yMode: string;
952
- /** Fractions of chart space width/height. */
953
- x: number;
954
- y: number;
955
- w: number;
956
- h: number;
368
+ xMode: string;
369
+ yMode: string;
370
+ x: number;
371
+ y: number;
372
+ w: number;
373
+ h: number;
957
374
  }
958
- //#endregion
959
- //#region packages/core/src/errors/ooxml-error.d.ts
960
- /**
961
- * Machine-readable code for a typed load-time failure.
962
- *
963
- * The container-level failures the `load()` factories detect on the main thread
964
- * before handing bytes to the parser worker (see `sniffCfb` / `decryptOoxml`).
965
- * This is the seed of the broader typed-error surface tracked as PD4 (OoxmlError
966
- * typed errors). Add codes here rather than throwing bare `Error(string)`, so
967
- * callers can `switch` on `err.code` instead of matching message text.
968
- *
969
- * - `'encrypted'` — password-protected, but no `password` was
970
- * supplied (pass `LoadOptions.password` to decrypt).
971
- * - `'invalid-password'` — a `password` was supplied but did not match.
972
- * - `'unsupported-encryption'`— encrypted with a scheme other than Agile
973
- * (Standard / Extensible / a legacy binary encryptor), which this library
974
- * cannot decrypt (PD8 implements Agile only).
975
- * - `'legacy-binary-format'` — a raw .doc / .xls / .ppt (not OOXML).
976
- * - `'not-ooxml'` — a CFB of an unrecognised kind, or otherwise
977
- * not an OOXML ZIP.
978
- */
979
375
  type OoxmlErrorCode = 'encrypted' | 'invalid-password' | 'unsupported-encryption' | 'legacy-binary-format' | 'not-ooxml';
980
376
  type OoxmlErrorStage = 'container' | 'decompression' | 'parsing' | 'serialization' | 'layout' | 'rendering' | 'worker';
981
- /**
982
- * @deprecated Use {@link OoxmlErrorStage}. Retained as a compatibility alias
983
- * for the short-lived resource-governance API that exposed this vocabulary;
984
- * scheduled for removal in a future breaking release.
985
- */
986
377
  type OoxmlErrorSource = 'container' | 'zip-part' | 'parser' | 'serializer' | 'layout' | 'renderer' | 'worker';
987
- /**
988
- * Typed error thrown by the docx / pptx / xlsx `load()` factories for failures
989
- * that carry a stable, programmatic {@link OoxmlErrorCode} (e.g. a
990
- * password-protected or legacy-binary file detected from its container magic).
991
- *
992
- * Note on workers: `instanceof OoxmlError` does not survive a structured-clone
993
- * across the worker boundary. Detection that needs a typed error is therefore
994
- * done on the main thread (before the worker is involved) so a genuine
995
- * `OoxmlError` instance is thrown to the caller. Errors that must cross the
996
- * worker boundary should carry the `code` string and be reconstructed on the
997
- * main side.
998
- */
999
378
  declare class OoxmlError extends Error {
1000
- readonly code: OoxmlErrorCode;
1001
- constructor(code: OoxmlErrorCode, message: string);
379
+ readonly code: OoxmlErrorCode;
380
+ constructor(code: OoxmlErrorCode, message: string);
1002
381
  }
1003
382
  type OoxmlFormat = 'docx' | 'xlsx' | 'pptx';
1004
383
  interface OoxmlResourceUsageSnapshot {
1005
- readonly archiveEntryCount: number;
1006
- readonly declaredInflatedBytes: number;
1007
- /** Largest actual decompressed size observed for one ZIP entry. */
1008
- readonly largestInflatedEntryBytes?: number;
1009
- readonly distinctInflatedBytes: number;
1010
- readonly operationInflatedBytes: number;
384
+ readonly archiveEntryCount: number;
385
+ readonly declaredInflatedBytes: number;
386
+ readonly largestInflatedEntryBytes?: number;
387
+ readonly distinctInflatedBytes: number;
388
+ readonly operationInflatedBytes: number;
1011
389
  }
1012
390
  type ExtensibleLiteral<Known extends string> = Known | (string & Record<never, never>);
1013
- /**
1014
- * Resource family reported by a policy or hard-quota violation.
1015
- *
1016
- * The known literals provide editor completion. The string tail is deliberate:
1017
- * adding a future format-owned unit must not break exhaustive switches compiled
1018
- * against an older host while a newer worker is already able to report it.
1019
- */
1020
391
  type OoxmlResourceName = ExtensibleLiteral<'archive' | 'archive-entry' | 'xml-event' | 'xml-context' | 'xml-tree' | 'worksheet-row' | 'worksheet-shell'>;
1021
- /** Measurement axis used by an OOXML resource violation. Extensible by design. */
1022
392
  type OoxmlResourceMetric = ExtensibleLiteral<'declared-inflated-bytes' | 'actual-inflated-bytes' | 'entry-count' | 'central-directory-bytes' | 'distinct-inflated-bytes' | 'bytes' | 'depth' | 'projected-bytes'>;
1023
- /** Stable public violation record. Valid resource/metric pairings are enforced
1024
- * by the emitting parser and the worker decoder rather than by a closed public
1025
- * union that would require a breaking expansion for every new hard quota. */
1026
393
  interface OoxmlResourceViolation {
1027
- readonly format: OoxmlFormat;
1028
- readonly operation: string;
1029
- readonly resource: OoxmlResourceName;
1030
- readonly metric: OoxmlResourceMetric;
1031
- readonly part?: string;
1032
- readonly limit: number;
1033
- readonly observed: number;
1034
- readonly configurable: boolean;
1035
- readonly usage: OoxmlResourceUsageSnapshot;
394
+ readonly format: OoxmlFormat;
395
+ readonly operation: string;
396
+ readonly resource: OoxmlResourceName;
397
+ readonly metric: OoxmlResourceMetric;
398
+ readonly part?: string;
399
+ readonly limit: number;
400
+ readonly observed: number;
401
+ readonly configurable: boolean;
402
+ readonly usage: OoxmlResourceUsageSnapshot;
1036
403
  }
1037
404
  interface OoxmlResourceLimitErrorDetails {
1038
- readonly stage: OoxmlErrorStage;
1039
- readonly violation: OoxmlResourceViolation;
405
+ readonly stage: OoxmlErrorStage;
406
+ readonly violation: OoxmlResourceViolation;
1040
407
  }
1041
- /** Deterministic rejection caused by a measured OOXML resource-policy breach. */
1042
408
  declare class OoxmlResourceLimitError extends Error {
1043
- readonly code: "ooxml-resource-limit";
1044
- readonly details: OoxmlResourceLimitErrorDetails;
1045
- constructor(message: string, details: OoxmlResourceLimitErrorDetails);
409
+ readonly code: 'ooxml-resource-limit';
410
+ readonly details: OoxmlResourceLimitErrorDetails;
411
+ constructor(message: string, details: OoxmlResourceLimitErrorDetails);
1046
412
  }
1047
- //#endregion
1048
- //#region packages/core/src/types/resource-metrics.d.ts
1049
- /** Configured public admission policy used for one measured operation. */
1050
413
  interface OoxmlResourcePolicySnapshot {
1051
- readonly maxArchiveEntryBytes: number | null;
1052
- readonly maxTotalInflatedBytes: number | null;
414
+ readonly maxArchiveEntryBytes: number | null;
415
+ readonly maxTotalInflatedBytes: number | null;
416
+ readonly maxArchiveEntries: number | null;
1053
417
  }
1054
418
  interface OoxmlResourceMetricsCheckpoint {
1055
- readonly name: string;
1056
- readonly elapsedMs: number;
1057
- readonly usage?: OoxmlResourceUsageSnapshot;
1058
- }
1059
- /**
1060
- * Content-free, machine-readable resource report for an OOXML load or bounded
1061
- * Node session. Byte counters describe measured package work, not the JavaScript
1062
- * heap, WASM allocator overhead, decoded images, canvas, or GPU. Browser engines
1063
- * and Viewers can return a newer snapshot after lazy package access.
1064
- *
1065
- * No source URL, filename, OOXML part name, document text, password, or raw
1066
- * error message is included. Sizes, counts, and timings are still
1067
- * document-derived metadata; applications apply their own consent, retention,
1068
- * and telemetry policy.
1069
- */
419
+ readonly name: string;
420
+ readonly elapsedMs: number;
421
+ readonly usage?: OoxmlResourceUsageSnapshot;
422
+ }
1070
423
  interface OoxmlResourceMetrics {
1071
- /** Version of this metrics payload, independent of the package version. */
1072
- readonly schemaVersion: 1;
1073
- /**
1074
- * Browser factories report `load`; bounded Node sessions report `session`.
1075
- */
1076
- readonly scope: 'load' | 'session';
1077
- readonly format: OoxmlFormat;
1078
- readonly mode: 'main' | 'worker' | 'node';
1079
- /** Outcome of this measured load/session, not of later render operations. */
1080
- readonly status: 'ok' | 'error';
1081
- /** Compressed or decrypted OOXML container bytes supplied to the parser. */
1082
- readonly sourceBytes?: number;
1083
- readonly elapsedMs: number;
1084
- readonly policy: Readonly<OoxmlResourcePolicySnapshot>;
1085
- /** Last complete observed package-usage checkpoint. */
1086
- readonly usage?: OoxmlResourceUsageSnapshot;
1087
- readonly checkpoints: readonly OoxmlResourceMetricsCheckpoint[];
1088
- readonly outcome?: Readonly<Record<string, number>>;
1089
- readonly error?: Readonly<{
1090
- readonly code?: string;
1091
- readonly stage?: string;
1092
- readonly resource?: string;
1093
- readonly metric?: string;
1094
- }>;
424
+ readonly schemaVersion: 1;
425
+ readonly scope: 'load' | 'session';
426
+ readonly format: OoxmlFormat;
427
+ readonly mode: 'main' | 'worker' | 'node';
428
+ readonly status: 'ok' | 'error';
429
+ readonly sourceBytes?: number;
430
+ readonly elapsedMs: number;
431
+ readonly policy: Readonly<OoxmlResourcePolicySnapshot>;
432
+ readonly usage?: OoxmlResourceUsageSnapshot;
433
+ readonly checkpoints: readonly OoxmlResourceMetricsCheckpoint[];
434
+ readonly outcome?: Readonly<Record<string, number>>;
435
+ readonly error?: Readonly<{
436
+ readonly code?: string;
437
+ readonly stage?: string;
438
+ readonly resource?: string;
439
+ readonly metric?: string;
440
+ }>;
1095
441
  }
1096
- //#endregion
1097
- //#region packages/core/src/types/load-options.d.ts
1098
- /** A positive safe-integer byte count, or `null` to disable one public limit. */
1099
442
  type OoxmlResourceLimit = number | null;
1100
- /** Admission limits for the inflated contents of one OOXML package session. */
1101
443
  interface OoxmlResourceLimits {
1102
- /**
1103
- * Maximum permitted inflated size for any one archive entry, including
1104
- * media. Enforced against both the ZIP declaration and actual output.
1105
- */
1106
- maxArchiveEntryBytes?: OoxmlResourceLimit;
1107
- /** Maximum actual inflated bytes across distinct entries in the session. */
1108
- maxTotalInflatedBytes?: OoxmlResourceLimit;
1109
- }
1110
- /**
1111
- * Common load-time options shared by the docx / pptx / xlsx
1112
- * `Document.load` / `Presentation.load` / `Workbook.load` factories and their
1113
- * viewer wrappers.
1114
- *
1115
- * This is the single source of truth — each package re-exports this exact type
1116
- * as its `LoadOptions` so application code can pass one options object to any
1117
- * of the three.
1118
- */
444
+ maxArchiveEntryBytes?: OoxmlResourceLimit;
445
+ maxTotalInflatedBytes?: OoxmlResourceLimit;
446
+ maxArchiveEntries?: OoxmlResourceLimit;
447
+ }
1119
448
  interface LoadOptions$1 {
1120
- /**
1121
- * Opt in to loading webfont substitutes from Google Fonts
1122
- * (`fonts.googleapis.com`). Default `false` — the canvas falls back to
1123
- * locally available fonts.
1124
- *
1125
- * When enabled, end-user IP / User-Agent is sent to Google, which may
1126
- * have privacy / GDPR implications for your application. To avoid the
1127
- * third-party request, host the substitutes yourself and reference them
1128
- * via `@font-face` in your application CSS.
1129
- */
1130
- useGoogleFonts?: boolean;
1131
- /**
1132
- * Password for an encrypted OOXML file ([MS-OFFCRYPTO] Agile Encryption).
1133
- *
1134
- * Password-protected Office documents are CFB (OLE2) containers, not ZIPs.
1135
- * When this is set and the input is Agile-encrypted, `load()` decrypts it on
1136
- * the main thread (via WebCrypto) and parses the recovered plaintext ZIP.
1137
- *
1138
- * Errors (thrown as {@link import('../errors/ooxml-error').OoxmlError}):
1139
- * - no `password` on an encrypted file → code `'encrypted'`
1140
- * - wrong `password` → code `'invalid-password'`
1141
- * - a non-Agile scheme (Standard / Extensible / legacy) → code
1142
- * `'unsupported-encryption'`
1143
- *
1144
- * Note: Agile Encryption uses a high password-hash spin count (commonly
1145
- * 100,000), so decryption of a protected file adds roughly a second of
1146
- * WebCrypto work before parsing begins.
1147
- *
1148
- * Security notes:
1149
- * - This value is held as an ordinary JS `string` in memory for the
1150
- * duration of key derivation. The library does not zero it, and does
1151
- * not wrap it in a `SecureString`-equivalent — it becomes eligible for
1152
- * garbage collection like any other string once nothing references it,
1153
- * but no explicit wipe is performed. It is never logged or included in
1154
- * thrown errors.
1155
- * - Decryption recovers the plaintext but does not verify the file's HMAC
1156
- * data-integrity tag ([MS-OFFCRYPTO] §2.3.4.14), so ciphertext tampering
1157
- * is not detected — see "Security & Privacy" in the README.
1158
- */
1159
- password?: string;
1160
- /**
1161
- * Override the URL the parser worker fetches the WebAssembly module from.
1162
- *
1163
- * By default each format resolves the `.wasm` asset that ships next to its
1164
- * bundle (relative to the module URL), so no configuration is needed. Set
1165
- * this to serve the parser WASM from a CDN or a self-hosted path instead — a
1166
- * relative value is resolved against the current document URL. The same
1167
- * dependency-injection contract across docx / pptx / xlsx.
1168
- *
1169
- * The referenced file must be the matching format's `*_parser_bg.wasm`
1170
- * artifact (the one wasm-bindgen emitted for that parser); pointing it at a
1171
- * mismatched or missing file makes `load()` reject when the worker
1172
- * instantiates it.
1173
- */
1174
- wasmUrl?: string | URL;
1175
- /**
1176
- * @deprecated Use `resourceLimits.maxArchiveEntryBytes`. Scheduled for
1177
- * removal in a future breaking release.
1178
- *
1179
- * Existing positive safe-integer values remain an all-entry inflated-byte
1180
- * limit. Zero, negative, and NaN values retain their historical fallback
1181
- * behavior; other invalid positive values reject during `load()`.
1182
- */
1183
- maxZipEntryBytes?: number;
1184
- /**
1185
- * Inflated archive admission limits for one document session. Omitted fields
1186
- * use the library defaults. A positive safe integer overrides a default;
1187
- * `null` disables that configurable limit only. Limits are admission policy,
1188
- * not guarantees of exact browser-process memory use.
1189
- */
1190
- resourceLimits?: OoxmlResourceLimits;
1191
- /**
1192
- * Emit one content-free resource-usage card after load succeeds or fails.
1193
- * Includes observed archive counters and configured limits, but never source
1194
- * URLs, part names, document text, passwords, or error messages.
1195
- */
1196
- debug?: boolean;
1197
- /**
1198
- * Receive the initial content-free, machine-readable report that powers the
1199
- * debug card, without enabling console output. After resource options validate,
1200
- * the callback runs once when the current load settles, including failed loads
1201
- * for which no renderer instance is returned. The callback is not awaited;
1202
- * synchronous exceptions and rejected promises are ignored and never change
1203
- * load results.
1204
- *
1205
- * A browser report covers the underlying document/workbook/presentation
1206
- * factory. It does not wait for a Viewer's first canvas paint; that paint and
1207
- * later lazy worksheet, slide, image, or media access may increase counters or
1208
- * surface a separate render error. Successfully opened packages include the
1209
- * declared package total and source byte size in the report. On a successful
1210
- * load, call `getResourceMetrics()` on the returned engine or Viewer for a fresh
1211
- * snapshot that includes subsequently observed lazy package work.
1212
- */
1213
- onResourceMetrics?: (metrics: OoxmlResourceMetrics) => void;
1214
- /**
1215
- * Reject the parse request if the parser worker does not answer within this
1216
- * many milliseconds. Opt-in safety net for a wedged or crashed worker that
1217
- * would otherwise leave `load()` pending forever. **Default: unlimited** —
1218
- * parsing a large document with heavy embedded media can legitimately take
1219
- * tens of seconds, so no timeout is imposed unless you set one. A worker that
1220
- * throws or fails to load already rejects immediately regardless of this
1221
- * value; this bound only covers the "silent, never-responds" case.
1222
- */
1223
- workerTimeoutMs?: number;
1224
- /**
1225
- * Opt-in OMML equation engine (MathJax + STIX Two Math, ~3 MB). Inject it
1226
- * **once** here and every render of this document / presentation / workbook
1227
- * uses it — the same dependency-injection contract across all three formats
1228
- * and their viewers. Import it from the separate `@silurus/ooxml/math` entry
1229
- * (`import { math } from '@silurus/ooxml/math'`). Omit it and equations are
1230
- * skipped and the engine tree-shakes away entirely (no network, no bundle
1231
- * cost).
1232
- */
1233
- math?: MathRenderer;
449
+ useGoogleFonts?: boolean;
450
+ password?: string;
451
+ wasmUrl?: string | URL;
452
+ maxZipEntryBytes?: number;
453
+ resourceLimits?: OoxmlResourceLimits;
454
+ debug?: boolean;
455
+ onResourceMetrics?: (metrics: OoxmlResourceMetrics) => void;
456
+ workerTimeoutMs?: number;
457
+ math?: MathRenderer;
1234
458
  }
1235
- //#endregion
1236
- //#region packages/core/src/image/pixel-budget.d.ts
1237
459
  type OoxmlDecodedImageLimitMetric = 'image-pixels' | 'active-decoded-bytes';
1238
- /** Catchable hard-quota crossing for decoded image surfaces. */
1239
460
  declare class OoxmlDecodedImageLimitError extends RangeError {
1240
- readonly metric: OoxmlDecodedImageLimitMetric;
1241
- readonly limit: number;
1242
- readonly observed: number;
1243
- readonly code: "ooxml-decoded-image-limit";
1244
- constructor(metric: OoxmlDecodedImageLimitMetric, limit: number, observed: number);
461
+ readonly metric: OoxmlDecodedImageLimitMetric;
462
+ readonly limit: number;
463
+ readonly observed: number;
464
+ readonly code: 'ooxml-decoded-image-limit';
465
+ constructor(metric: OoxmlDecodedImageLimitMetric, limit: number, observed: number);
1245
466
  }
1246
467
  declare function isOoxmlDecodedImageLimitError(error: unknown): error is OoxmlDecodedImageLimitError;
1247
- //#endregion
1248
- //#region packages/core/src/interaction/hyperlink.d.ts
1249
- /**
1250
- * Shared hyperlink model + URL sanitisation for docx / pptx / xlsx (IX1).
1251
- *
1252
- * All three formats carry the same two ECMA-376 concepts:
1253
- * - an **external** hyperlink — an absolute URL resolved from a relationship
1254
- * part target (`document.xml.rels` for docx §17.16.22, the slide rels for
1255
- * pptx §21.1.2.3.5, the worksheet rels for xlsx §18.3.1.47), with
1256
- * `TargetMode="External"`.
1257
- * - an **internal** hyperlink — a jump within the document itself:
1258
- * docx `w:anchor` -> a `<w:bookmarkStart w:name>` (§17.16.23), pptx
1259
- * `action="ppaction://hlinksldjump"` -> a slide, xlsx `location` -> a defined
1260
- * name or a `Sheet!A1` cell reference.
1261
- *
1262
- * The parsers (Rust, one per format) do the format-specific rels lookup and hand
1263
- * each run / shape / cell a {@link HyperlinkTarget}. Everything downstream — the
1264
- * text-layer overlay, the viewer default click behaviour, and any integrator
1265
- * callback — is format-agnostic and consumes this one shape. Keeping the type +
1266
- * the pure `sanitizeHyperlinkUrl` predicate here (not duplicated per package)
1267
- * follows the cross-package unification principle: a scheme-allowlist bug fixed
1268
- * once is fixed everywhere.
1269
- */
1270
- /**
1271
- * A resolved hyperlink attached to a run, shape, or cell.
1272
- *
1273
- * - `external` — `url` is the raw target as authored in the file. It is NOT
1274
- * guaranteed safe; run it through {@link sanitizeHyperlinkUrl} before
1275
- * navigating. It is kept verbatim here so an integrator can apply its own
1276
- * policy (e.g. allow `file:` on a trusted intranet viewer).
1277
- * - `internal` — `ref` is the in-document destination, verbatim from the file:
1278
- * docx: the bookmark name (`w:anchor`).
1279
- * pptx: the internal action (e.g. `ppaction://hlinksldjump`), with the
1280
- * resolved 0-based `slideIndex` when the rels target names a slide.
1281
- * xlsx: the `location` string (a defined name or `Sheet1!A1`).
1282
- */
1283
468
  type HyperlinkTarget = {
1284
- kind: 'external';
1285
- url: string;
469
+ kind: 'external';
470
+ url: string;
1286
471
  } | {
1287
- kind: 'internal';
1288
- ref: string;
1289
- slideIndex?: number;
472
+ kind: 'internal';
473
+ ref: string;
474
+ slideIndex?: number;
1290
475
  };
1291
- /**
1292
- * The default action a viewer takes for an **external** hyperlink click when
1293
- * the integrator supplies no `onHyperlinkClick` handler: sanitise the URL and,
1294
- * if allowed, open it in a new tab with `noopener,noreferrer` so the opened page
1295
- * gets no `window.opener` handle back into this document. A blocked scheme is a
1296
- * silent no-op (returns `false`) — the click does nothing rather than navigate
1297
- * somewhere dangerous.
1298
- *
1299
- * Internal targets are intentionally NOT handled here: the in-document jump
1300
- * (page / slide / cell) is format-specific and lives in each viewer.
1301
- *
1302
- * Split out (not inlined in three viewers) so the "open in new tab, drop opener,
1303
- * refuse unsafe schemes" policy is defined once. `win` is injected for tests;
1304
- * defaults to the ambient `window`.
1305
- *
1306
- * @returns `true` if navigation was initiated, `false` if the URL was blocked.
1307
- */
1308
476
  declare function openExternalHyperlink(url: string, allowed?: readonly string[], win?: Pick<Window, 'open'> | undefined): boolean;
1309
477
  //#endregion
1310
- //#region dist/.types-work/find-highlight-CnpZn3yb.d.ts
1311
- //#region packages/core/src/autoResize.d.ts
478
+ //#region dist/.types-work/find-highlight-DkZhNxUb.d.ts
1312
479
  interface AutoResizeOptions {
1313
- /**
1314
- * Skip rendering while `document.hidden` is true and fire once with the latest
1315
- * observed size when the tab becomes visible again. Default: true.
1316
- */
1317
- pauseWhenHidden?: boolean;
1318
- }
1319
- /**
1320
- * Observe an element's size and invoke a render callback, coalescing bursts to
1321
- * one call per animation frame and serializing overlapping async renders.
1322
- *
1323
- * Framework-agnostic: call from any mount/setup hook and invoke the returned
1324
- * disposer in the corresponding teardown hook.
1325
- *
1326
- * @example
1327
- * const detach = autoResize(
1328
- * (width) => pres.renderSlide(canvas, 0, { width }),
1329
- * canvas,
1330
- * );
1331
- * // later
1332
- * detach();
1333
- */
480
+ pauseWhenHidden?: boolean;
481
+ }
1334
482
  declare function autoResize(render: (width: number, height: number) => void | Promise<void>, element: Element, opts?: AutoResizeOptions): () => void;
1335
- //#endregion
1336
- //#region packages/core/src/interaction/zoomable.d.ts
1337
- /**
1338
- * IX9 — the shared zoom API contract for every viewer (DocxViewer, PptxViewer,
1339
- * DocxScrollViewer, PptxScrollViewer, XlsxViewer).
1340
- *
1341
- * This module owns ONLY the pure, DOM-free pieces of the contract: the type
1342
- * ({@link ZoomableViewer}), the discrete zoom-step ladder ({@link nextZoomStep} /
1343
- * {@link prevZoomStep}), the fit-to-content scale math ({@link fitScale}), and the
1344
- * range clamp ({@link clampScale}). Each viewer implements the interface with its
1345
- * own scale field and re-render path; this keeps ONE definition of "what a zoom
1346
- * factor means" and "what the +/- steps are" across all five, so a host can drive
1347
- * any viewer through the same six calls without special-casing the format.
1348
- *
1349
- * SCALE SEMANTICS (the contract): a scale of `1` means 100% — the content at its
1350
- * natural size (a docx page at `widthPt × PT_TO_PX`, a pptx slide at
1351
- * `slideWidth / EMU_PER_PX`, an xlsx grid at `cellScale` 1). `getScale()` and
1352
- * `setScale(n)` speak this user-facing factor for EVERY viewer.
1353
- *
1354
- * KNOWN FAMILY DIFFERENCE — the INITIAL scale right after load (deliberate,
1355
- * documented rather than papered over): the single-canvas viewers (DocxViewer /
1356
- * PptxViewer) and XlsxViewer start at `1` (or the effective factor implied by an
1357
- * explicit `width` option); the continuous-scroll viewers (DocxScrollViewer /
1358
- * PptxScrollViewer) AUTO-FIT to the container on first layout, so their
1359
- * `getScale()` right after load reports the fit-to-width BASE factor (≠ 1 unless
1360
- * the container happens to match the natural width). The unit is identical — only
1361
- * the starting point differs, because fit-to-width is the natural resting state
1362
- * of a continuous document viewer.
1363
- *
1364
- * PRE-LOAD `setScale` (family-unified, IX9 F1): a `setScale` called before the
1365
- * content is loaded / before the layout is established is LATCHED — never
1366
- * silently dropped — and applied once the viewer establishes its scale (the
1367
- * single-canvas viewers honour it on the first render; the scroll viewers apply
1368
- * it right after the base fit establishes, firing `onScaleChange` at application
1369
- * time). `getScale()` reports the latched factor while it is pending.
1370
- *
1371
- * API SHAPE (idiomatic default — the integrator MAY veto; see the IX9 PR): a
1372
- * six-method surface plus one change notification (`onScaleChange`). Deliberately
1373
- * NO new UI here — the contract is API only (design decision IX9 §4). Touch-pinch
1374
- * (IX8) is out of scope.
1375
- */
1376
- /**
1377
- * The zoom contract every viewer satisfies. All scales are the user-facing factor
1378
- * where `1` = 100% (see the module note). `fitWidth`/`fitPage` are async because a
1379
- * fit re-renders at the new scale; the getters/steppers resolve synchronously.
1380
- */
1381
483
  interface ZoomableViewer {
1382
- /** The current zoom factor (`1` = 100%). Never throws — returns the default
1383
- * (`1`) before anything is loaded, or the latched pending factor when a
1384
- * pre-load `setScale` is waiting to be applied (see the module note). */
1385
- getScale(): number;
1386
- /** Set the absolute zoom factor (`1` = 100%), clamped to the viewer's
1387
- * `[zoomMin, zoomMax]`. Re-renders at the new scale and fires `onScaleChange`
1388
- * when the clamped value actually changes. Called BEFORE the content is
1389
- * loaded / the layout is established, the (clamped) factor is LATCHED and
1390
- * applied once the viewer establishes its scale — family-unified semantics
1391
- * (IX9 F1): never silently dropped by any viewer. */
1392
- setScale(scale: number): void | Promise<void>;
1393
- /** Step up to the next larger rung of the shared zoom ladder (25 %→400 %),
1394
- * clamped to `zoomMax`. Equivalent to `setScale(nextZoomStep(getScale()))`. */
1395
- zoomIn(): void | Promise<void>;
1396
- /** Step down to the next smaller ladder rung, clamped to `zoomMin`. */
1397
- zoomOut(): void | Promise<void>;
1398
- /** Fit the content's WIDTH to the container (the common "fit width" / "fit
1399
- * page width" verb). Sets the scale so one page/slide/sheet-column-run spans
1400
- * the available width, then re-renders. Resolves once the fit render settles.
1401
- *
1402
- * PERSISTENCE is viewer-implementation-dependent (deliberate, by family): the
1403
- * single-canvas viewers (DocxViewer / PptxViewer) and XlsxViewer apply the fit
1404
- * ONE-SHOT — they observe no container resizes, so a later resize does NOT
1405
- * re-fit (call `fitWidth()` again after a layout change). The continuous-
1406
- * scroll viewers (DocxScrollViewer / PptxScrollViewer) re-fit their width-fit
1407
- * base on every container resize, so a `fitWidth()` there effectively
1408
- * PERSISTS across resizes (the resize re-fit preserves the width-fit state). */
1409
- fitWidth(): void | Promise<void>;
1410
- /** Fit the WHOLE content (width AND height) inside the container, so an entire
1411
- * page/slide is visible without scrolling. Sets the scale to the smaller of the
1412
- * width- and height-fit factors, then re-renders.
1413
- *
1414
- * PERSISTENCE is viewer-implementation-dependent, and — unlike `fitWidth` —
1415
- * a page fit does NOT persist across container resizes on ANY viewer: the
1416
- * single-canvas viewers and XlsxViewer observe no resizes at all (one-shot),
1417
- * and the continuous-scroll viewers' resize handler re-applies the WIDTH fit
1418
- * (preserving the zoom multiplier), not the page fit. Re-invoke `fitPage()`
1419
- * after a layout change to re-fit. */
1420
- fitPage(): void | Promise<void>;
1421
- }
1422
- /** Options for {@link findMatches}. */
484
+ getScale(): number;
485
+ setScale(scale: number): void | Promise<void>;
486
+ zoomIn(): void | Promise<void>;
487
+ zoomOut(): void | Promise<void>;
488
+ fitWidth(): void | Promise<void>;
489
+ fitPage(): void | Promise<void>;
490
+ }
1423
491
  interface FindMatchesOptions {
1424
- /**
1425
- * Match case exactly. Default `false` (case-insensitive, like a browser's
1426
- * find-in-page). IX2 default — an integrator can pass `true`.
1427
- */
1428
- caseSensitive?: boolean;
492
+ caseSensitive?: boolean;
1429
493
  }
1430
- //#endregion
1431
- //#region packages/core/src/search/find-match.d.ts
1432
- /**
1433
- * IX2 public find-result shape, shared by all three viewers.
1434
- *
1435
- * `findText` returns an ordered list of {@link FindMatch}. Every match carries
1436
- * its ordinal position (`matchIndex`, 0-based, document order — the same index
1437
- * `findNext` / `findPrev` cycle through), the matched `text`, and a
1438
- * format-specific `location`. The location is where the three formats
1439
- * legitimately differ — a docx match lives on a page, a pptx match on a slide,
1440
- * an xlsx match in a sheet cell — so `FindMatch` is generic over it rather than
1441
- * forcing an artificial common shape. Each viewer instantiates it with its own
1442
- * location type:
1443
- *
1444
- * - `DocxViewer.findText` → `FindMatch<DocxMatchLocation>` ({ page })
1445
- * - `PptxViewer.findText` → `FindMatch<PptxMatchLocation>` ({ slide })
1446
- * - `XlsxViewer.findText` → `FindMatch<XlsxMatchLocation>` ({ sheet, ref, … })
1447
- *
1448
- * The generic default is `unknown` so `FindMatch` can be referenced without a
1449
- * type argument (e.g. in generic UI code) while each viewer's return type stays
1450
- * precise.
1451
- */
1452
494
  interface FindMatch<Loc = unknown> {
1453
- /** 0-based ordinal among all matches, in document order. This is the index
1454
- * `findNext`/`findPrev` make active, so a caller can correlate the array it
1455
- * got from `findText` with the active-match reported by navigation. */
1456
- matchIndex: number;
1457
- /** The text that matched (the query as it appears in the document — its
1458
- * original case, not the folded form used for case-insensitive matching). */
1459
- text: string;
1460
- /** Where the match is, in the format's own coordinates. */
1461
- location: Loc;
495
+ matchIndex: number;
496
+ text: string;
497
+ location: Loc;
1462
498
  }
1463
- //#endregion
1464
- //#region packages/core/src/search/find-highlight.d.ts
1465
- /**
1466
- * CSS colours used by in-document search overlays.
1467
- *
1468
- * The values are applied as the overlay backgrounds verbatim. Use an alpha
1469
- * colour (`rgba(...)`, 8-digit hex, or `color-mix(...)`) when the rendered text
1470
- * should remain visible through the highlight.
1471
- */
1472
499
  interface FindHighlightColors {
1473
- /** Background for every match except the active one. */
1474
- match?: string;
1475
- /** Background for the match selected by findNext/findPrev. */
1476
- active?: string;
500
+ match?: string;
501
+ active?: string;
1477
502
  }
1478
503
  //#endregion
1479
- //#region dist/.types-work/xlsx-Dyp8TxbZ.d.ts
1480
- //#region packages/xlsx/src/types.d.ts
504
+ //#region dist/.types-work/xlsx-D1NhipZN.d.ts
1481
505
  interface Workbook {
1482
- sheets: SheetMeta[];
1483
- /** Workbook date system (`<workbookPr date1904>`, ECMA-376 §18.2.28).
1484
- * `true` selects the 1904 date system (Mac-authored workbooks); serial
1485
- * dates are resolved against the 1904 epoch (§18.17.4.1). Omitted from the
1486
- * parser JSON when false (default 1900 date system). */
1487
- date1904?: boolean;
1488
- /** #773 partial degradation: a WORKBOOK-LEVEL degradation that leaves every
1489
- * sheet openable. Set when a shared workbook part was PRESENT but corrupt —
1490
- * most commonly `xl/sharedStrings.xml` (§18.4.9): a broken shared-string table
1491
- * silently blanks every string cell across ALL sheets, so unlike a per-sheet
1492
- * break it can't be attributed to one placeholder sheet. Tagged with the
1493
- * offending part (e.g. `"xl/sharedStrings.xml: <detail>"`) so the loss is
1494
- * surfaced instead of silent, while every sheet still renders its non-string
1495
- * content. Absent (`undefined`) when every shared part read cleanly. Also set
1496
- * (`"(zip container): <detail>"`) for a whole-container degradation (#774). */
1497
- parseError?: string;
1498
- }
1499
- /** Sheet visibility (`<sheet state>`, ECMA-376 §18.2.19 `ST_SheetState`). */
506
+ sheets: SheetMeta[];
507
+ date1904?: boolean;
508
+ parseError?: string;
509
+ }
1500
510
  type SheetVisibility = 'visible' | 'hidden' | 'veryHidden';
1501
511
  interface SheetMeta {
1502
- name: string;
1503
- sheetId: number;
1504
- rId: string;
1505
- /** Sheet tab color (`<sheetPr><tabColor>`, ECMA-376 §18.3.1.93) resolved to
1506
- * `#RRGGBB`. Surfaced at workbook-list time so tabs can be painted up front.
1507
- * Absent when the sheet declares no tab color. */
1508
- tabColor?: string | null;
1509
- /** Sheet visibility (`<sheet state>`, ECMA-376 §18.2.19 `ST_SheetState`).
1510
- * Absent ⇒ visible. `'veryHidden'` sheets are revealable only
1511
- * programmatically in Excel. Read via `XlsxWorkbook.isHidden` /
1512
- * `XlsxWorkbook.sheetVisibility`. */
1513
- visibility?: 'hidden' | 'veryHidden';
512
+ name: string;
513
+ sheetId: number;
514
+ rId: string;
515
+ tabColor?: string | null;
516
+ visibility?: 'hidden' | 'veryHidden';
1514
517
  }
1515
518
  interface MergeCell {
1516
- top: number;
1517
- left: number;
1518
- bottom: number;
1519
- right: number;
519
+ top: number;
520
+ left: number;
521
+ bottom: number;
522
+ right: number;
1520
523
  }
1521
524
  interface Worksheet {
1522
- name: string;
1523
- rows: Row[];
1524
- colWidths: Record<number, number>;
1525
- rowHeights: Record<number, number>;
1526
- /** Per-column outline (grouping) depth 0-7 (ECMA-376 §18.3.1.13
1527
- * `<col outlineLevel>`), keyed by 1-based column index. Present only for
1528
- * grouped columns; absent (⇒ level 0) on outline-free sheets. */
1529
- colOutlineLevels?: Record<number, number>;
1530
- /** Per-column `<col collapsed>` (§18.3.1.13): `true` on a summary column whose
1531
- * one-level-deeper detail columns are collapsed. Only `true` entries. */
1532
- colCollapsed?: Record<number, boolean>;
1533
- /** Per-column `<col hidden>` (§18.3.1.13): `true` when the column is hidden
1534
- * (e.g. a collapsed outline hides its detail columns). Distinct from
1535
- * `colWidths[c] === 0`. Only `true` entries. */
1536
- colHidden?: Record<number, boolean>;
1537
- defaultColWidth: number;
1538
- defaultRowHeight: number;
1539
- mergeCells: MergeCell[];
1540
- freezeRows: number;
1541
- freezeCols: number;
1542
- conditionalFormats: ConditionalFormat[];
1543
- images: ImageAnchor[];
1544
- charts: ChartAnchor[];
1545
- /** Grouped shapes from `<xdr:grpSp>` inside twoCellAnchors
1546
- * (ECMA-376 §20.5.2.17). Each anchor holds leaf shapes pre-flattened
1547
- * with normalized [0,1] geometry relative to the anchor rect. */
1548
- shapeGroups?: ShapeAnchor[];
1549
- /** Whether to display zero values (ECMA-376 §18.3.1.94). Defaults to true. */
1550
- showZeros?: boolean;
1551
- /** Whether to draw default grid lines (ECMA-376 §18.3.1.83
1552
- * `<sheetView showGridLines>`). Mirrors the Excel "View → Gridlines"
1553
- * checkbox. Defaults to true. */
1554
- showGridlines?: boolean;
1555
- /** Whether the sheet grid is laid out right-to-left, mirroring the entire
1556
- * grid so column A sits on the right (ECMA-376 §18.3.1.87
1557
- * `<sheetView rightToLeft>`). Defaults to false. */
1558
- rightToLeft?: boolean;
1559
- /** Outline display flags from `<sheetPr><outlinePr>` (ECMA-376 §18.3.1.61).
1560
- * Absent when the sheet declares no `<outlinePr>`; consumers apply the
1561
- * schema defaults (`summaryBelow` / `summaryRight` both `true`). Decides
1562
- * which side of a group the summary row/column (and its +/- toggle) sits. */
1563
- outlinePr?: OutlinePr;
1564
- /** Sheet tab color (ECMA-376 §18.3.1.79). */
1565
- tabColor?: string | null;
1566
- /** AutoFilter header range (ECMA-376 §18.3.1.2). */
1567
- autoFilter?: CellRange$1 | null;
1568
- /** Hyperlinks in this worksheet (ECMA-376 §18.3.1.47). */
1569
- hyperlinks?: Hyperlink[];
1570
- /** A1-style cell refs of commented cells (ECMA-376 §18.7.3). Rendered as a
1571
- * small red triangle in each cell's top-right corner. */
1572
- commentRefs?: string[];
1573
- /** Full-fidelity comment bodies (cell ref + author + plain text) for every
1574
- * `<comment>` in `xl/commentsN.xml` (ECMA-376 §18.7). Parallel to
1575
- * {@link commentRefs} (one entry per ref). Consume this to read the note
1576
- * text; the renderer uses {@link commentRefs} for the red indicator and the
1577
- * viewer surfaces these bodies in an Excel-style hover popup. */
1578
- comments?: XlsxComment[];
1579
- /** Data-validation rules on this sheet (ECMA-376 §18.3.1.32–33). Exposed for
1580
- * tooling. The viewer draws a list-dropdown arrow on the active cell when the
1581
- * selection intersects a `list`-type rule's `sqref` (display only — opening
1582
- * the list / picking a value is out of scope for a viewer). */
1583
- dataValidations?: DataValidation[];
1584
- /** Defined names in scope for this sheet (ECMA-376 §18.2.5). Used by
1585
- * conditional-formatting `expression` rules that call named ranges
1586
- * (e.g. `task_start`, `today`). */
1587
- definedNames?: DefinedName[];
1588
- /** Excel Tables on this sheet (ECMA-376 §18.5). The renderer overlays a
1589
- * built-in style (bold header, banded rows) on the given ranges. */
1590
- tables?: TableInfo[];
1591
- /** Pivot / table slicers (Office 2010+ extension). Each anchor carries a
1592
- * caption and the saved item list (with selection flags) so the renderer
1593
- * can draw a static button bank without the live pivot engine. */
1594
- slicers?: SlicerAnchor[];
1595
- /** Metadata-only pivot facts (ECMA-376 §18.10). Consumers must treat saved
1596
- * worksheet cell values and styles as authoritative. */
1597
- pivotTables?: PivotTableMetadata[];
1598
- /** Pivot parts skipped because their XML, identity, or location was invalid. */
1599
- pivotDiagnostics?: PivotDiagnostic[];
1600
- /** Sparkline groups (Office 2010+ extension `x14:sparklineGroup`).
1601
- * Cross-sheet `<xm:f>` data references are resolved to numeric values at
1602
- * parse time, and theme + tint colors are flattened to `#RRGGBB`. */
1603
- sparklineGroups?: SparklineGroup[];
1604
- /** Family name of the workbook's Normal-style font, resolved by the parser
1605
- * from `<cellStyleXfs>[0].fontId` → `<fonts>[fontId].name.val`. The
1606
- * renderer uses this together with `defaultFontSize` to compute the Max
1607
- * Digit Width for column-width pixel conversion (ECMA-376 §18.3.1.13).
1608
- * Workbook-wide value, denormalized onto every worksheet. */
1609
- defaultFontFamily?: string;
1610
- /** Point size of the workbook's Normal-style font (`<fonts>[N].sz.val`). */
1611
- defaultFontSize?: number;
1612
- /** Workbook date system (`<workbookPr date1904>`, ECMA-376 §18.2.28),
1613
- * denormalized onto every worksheet by the parser so the cell formatter can
1614
- * resolve serial dates (§18.17.4.1) without a workbook back-reference.
1615
- * `true` = 1904 date system. Omitted (⇒ false) for the default 1900 system. */
1616
- date1904?: boolean;
1617
- /** RB7 partial degradation: set when THIS sheet's part could not be
1618
- * read/parsed. The workbook still opens with the OTHER sheets intact; this one
1619
- * is an empty placeholder (`rows` empty) whose `parseError` names the offending
1620
- * part (e.g. `"xl/worksheets/sheet3.xml: <detail>"`). Absent (`undefined`) for
1621
- * every healthy sheet. The renderer paints a visible error overlay. */
1622
- parseError?: string;
525
+ name: string;
526
+ rows: Row[];
527
+ colWidths: Record<number, number>;
528
+ rowHeights: Record<number, number>;
529
+ colOutlineLevels?: Record<number, number>;
530
+ colCollapsed?: Record<number, boolean>;
531
+ colHidden?: Record<number, boolean>;
532
+ defaultColWidth: number;
533
+ defaultRowHeight: number;
534
+ mergeCells: MergeCell[];
535
+ freezeRows: number;
536
+ freezeCols: number;
537
+ conditionalFormats: ConditionalFormat[];
538
+ images: ImageAnchor[];
539
+ charts: ChartAnchor[];
540
+ shapeGroups?: ShapeAnchor[];
541
+ showZeros?: boolean;
542
+ showGridlines?: boolean;
543
+ rightToLeft?: boolean;
544
+ outlinePr?: OutlinePr;
545
+ tabColor?: string | null;
546
+ autoFilter?: CellRange$1 | null;
547
+ hyperlinks?: Hyperlink[];
548
+ commentRefs?: string[];
549
+ comments?: XlsxComment[];
550
+ dataValidations?: DataValidation[];
551
+ definedNames?: DefinedName[];
552
+ tables?: TableInfo[];
553
+ slicers?: SlicerAnchor[];
554
+ pivotTables?: PivotTableMetadata[];
555
+ pivotDiagnostics?: PivotDiagnostic[];
556
+ sparklineGroups?: SparklineGroup[];
557
+ defaultFontFamily?: string;
558
+ defaultFontSize?: number;
559
+ date1904?: boolean;
560
+ parseError?: string;
1623
561
  }
1624
562
  interface PivotTableMetadata {
1625
- name: string;
1626
- /** Declarative identity fact only; cache resolution uses the pivot part relationship. */
1627
- cacheId: number;
1628
- location: PivotLocation;
1629
- /** Signed field indexes; `-2` is the Values pseudo-field sentinel. */
1630
- rowFields: number[];
1631
- columnFields: number[];
1632
- pageFields: PivotPageField[];
1633
- dataFields: PivotDataField[];
1634
- /** Absent when the cache definition could not be parsed; false includes the schema default. */
1635
- refreshOnLoad?: boolean;
1636
- /** Cache invalidity flag; absent when the cache definition did not parse. */
1637
- cacheInvalid?: boolean;
1638
- cacheDefinitionPart?: string;
1639
- cacheSource?: PivotCacheSource;
1640
- status: PivotMetadataStatus;
1641
- extensionUris?: string[];
563
+ name: string;
564
+ cacheId: number;
565
+ location: PivotLocation;
566
+ rowFields: number[];
567
+ columnFields: number[];
568
+ pageFields: PivotPageField[];
569
+ dataFields: PivotDataField[];
570
+ refreshOnLoad?: boolean;
571
+ cacheInvalid?: boolean;
572
+ cacheDefinitionPart?: string;
573
+ cacheSource?: PivotCacheSource;
574
+ status: PivotMetadataStatus;
575
+ extensionUris?: string[];
1642
576
  }
1643
577
  interface PivotLocation extends CellRange$1 {
1644
- firstHeaderRow: number;
1645
- firstDataRow: number;
1646
- firstDataCol: number;
578
+ firstHeaderRow: number;
579
+ firstDataRow: number;
580
+ firstDataCol: number;
1647
581
  }
1648
582
  interface PivotPageField {
1649
- field: number;
1650
- item?: number;
1651
- name?: string;
583
+ field: number;
584
+ item?: number;
585
+ name?: string;
1652
586
  }
1653
587
  interface PivotDataField {
1654
- field: number;
1655
- subtotal?: string;
1656
- rawSubtotal?: string;
1657
- name?: string;
588
+ field: number;
589
+ subtotal?: string;
590
+ rawSubtotal?: string;
591
+ name?: string;
1658
592
  }
1659
593
  type PivotCacheSource = {
1660
- kind: 'worksheet';
1661
- sheet?: string;
1662
- reference?: string;
1663
- name?: string;
1664
- relationshipId?: string;
594
+ kind: 'worksheet';
595
+ sheet?: string;
596
+ reference?: string;
597
+ name?: string;
598
+ relationshipId?: string;
1665
599
  } | {
1666
- kind: 'external';
600
+ kind: 'external';
1667
601
  } | {
1668
- kind: 'consolidation';
602
+ kind: 'consolidation';
1669
603
  } | {
1670
- kind: 'scenario';
604
+ kind: 'scenario';
1671
605
  };
1672
606
  type PivotMetadataStatus = {
1673
- state: 'complete';
607
+ state: 'complete';
1674
608
  } | {
1675
- state: 'partial';
1676
- reasons: PivotPartialReason[];
609
+ state: 'partial';
610
+ reasons: PivotPartialReason[];
1677
611
  };
1678
612
  type PivotPartialReason = {
1679
- kind: 'missingCacheRelationship';
613
+ kind: 'missingCacheRelationship';
1680
614
  } | {
1681
- kind: 'malformedCacheRelationships';
615
+ kind: 'malformedCacheRelationships';
1682
616
  } | {
1683
- kind: 'unreadableCacheRelationships';
617
+ kind: 'unreadableCacheRelationships';
1684
618
  } | {
1685
- kind: 'externalCacheRelationship';
619
+ kind: 'externalCacheRelationship';
1686
620
  } | {
1687
- kind: 'ambiguousCacheRelationship';
621
+ kind: 'ambiguousCacheRelationship';
1688
622
  } | {
1689
- kind: 'unreadableCacheDefinition';
623
+ kind: 'unreadableCacheDefinition';
1690
624
  } | {
1691
- kind: 'malformedCacheDefinition';
625
+ kind: 'malformedCacheDefinition';
1692
626
  } | {
1693
- kind: 'malformedField';
1694
- field: string;
627
+ kind: 'malformedField';
628
+ field: string;
1695
629
  } | {
1696
- kind: 'unsupportedCacheSource';
1697
- sourceType: string;
630
+ kind: 'unsupportedCacheSource';
631
+ sourceType: string;
1698
632
  } | {
1699
- kind: 'unresolvedWorksheetSourceRelationship';
633
+ kind: 'unresolvedWorksheetSourceRelationship';
1700
634
  } | {
1701
- kind: 'unsupportedSemanticFeature';
1702
- feature: string;
635
+ kind: 'unsupportedSemanticFeature';
636
+ feature: string;
1703
637
  };
1704
638
  interface PivotDiagnostic {
1705
- part: string;
1706
- reason: {
1707
- kind: 'unreadableWorksheetRelationships';
1708
- } | {
1709
- kind: 'malformedWorksheetRelationships';
1710
- } | {
1711
- kind: 'malformedPivotRelationship';
1712
- } | {
1713
- kind: 'externalPivotRelationship';
1714
- } | {
1715
- kind: 'unreadablePart';
1716
- } | {
1717
- kind: 'malformedXml';
1718
- } | {
1719
- kind: 'missingIdentity';
1720
- } | {
1721
- kind: 'invalidLocation';
1722
- };
639
+ part: string;
640
+ reason: {
641
+ kind: 'unreadableWorksheetRelationships';
642
+ } | {
643
+ kind: 'malformedWorksheetRelationships';
644
+ } | {
645
+ kind: 'malformedPivotRelationship';
646
+ } | {
647
+ kind: 'externalPivotRelationship';
648
+ } | {
649
+ kind: 'unreadablePart';
650
+ } | {
651
+ kind: 'malformedXml';
652
+ } | {
653
+ kind: 'missingIdentity';
654
+ } | {
655
+ kind: 'invalidLocation';
656
+ };
1723
657
  }
1724
658
  interface SparklineGroup {
1725
- /** `line` (default) | `column` | `stem` (win-loss). */
1726
- kind: 'line' | 'column' | 'stem';
1727
- markers: boolean;
1728
- high: boolean;
1729
- low: boolean;
1730
- first: boolean;
1731
- last: boolean;
1732
- negative: boolean;
1733
- /** Show the horizontal axis line through 0 when data crosses it. */
1734
- displayXAxis: boolean;
1735
- /** `gap` (default) | `zero` | `span`. */
1736
- displayEmptyCellsAs: string;
1737
- /** `individual` (default) | `group` | `custom`. */
1738
- minAxisType: string;
1739
- maxAxisType: string;
1740
- manualMin?: number;
1741
- manualMax?: number;
1742
- /** Stroke weight in pt for `line`. ECMA-376 default 0.75. */
1743
- lineWeight: number;
1744
- /** Resolved RGB hex strings (theme/tint already flattened by the parser). */
1745
- colorSeries?: string;
1746
- colorNegative?: string;
1747
- colorAxis?: string;
1748
- colorMarkers?: string;
1749
- colorFirst?: string;
1750
- colorLast?: string;
1751
- colorHigh?: string;
1752
- colorLow?: string;
1753
- sparklines: Sparkline[];
659
+ kind: 'line' | 'column' | 'stem';
660
+ markers: boolean;
661
+ high: boolean;
662
+ low: boolean;
663
+ first: boolean;
664
+ last: boolean;
665
+ negative: boolean;
666
+ displayXAxis: boolean;
667
+ displayEmptyCellsAs: string;
668
+ minAxisType: string;
669
+ maxAxisType: string;
670
+ manualMin?: number;
671
+ manualMax?: number;
672
+ lineWeight: number;
673
+ colorSeries?: string;
674
+ colorNegative?: string;
675
+ colorAxis?: string;
676
+ colorMarkers?: string;
677
+ colorFirst?: string;
678
+ colorLast?: string;
679
+ colorHigh?: string;
680
+ colorLow?: string;
681
+ sparklines: Sparkline[];
1754
682
  }
1755
683
  interface Sparkline {
1756
- /** 1-based row of the destination cell (`<xm:sqref>`). */
1757
- row: number;
1758
- /** 1-based column of the destination cell. */
1759
- col: number;
1760
- /** Numeric values resolved from the `<xm:f>` range. `null` for empty
1761
- * / non-numeric cells; honored as gaps at render time. */
1762
- values: (number | null)[];
684
+ row: number;
685
+ col: number;
686
+ values: (number | null)[];
1763
687
  }
1764
688
  interface SlicerAnchor {
1765
- fromCol: number;
1766
- fromColOff: number;
1767
- fromRow: number;
1768
- fromRowOff: number;
1769
- toCol: number;
1770
- toColOff: number;
1771
- toRow: number;
1772
- toRowOff: number;
1773
- caption: string;
1774
- items: SlicerItem[];
1775
- /** Resolved custom slicer style. Absent means use the built-in fallback. */
1776
- style?: SlicerStyle;
689
+ fromCol: number;
690
+ fromColOff: number;
691
+ fromRow: number;
692
+ fromRowOff: number;
693
+ toCol: number;
694
+ toColOff: number;
695
+ toRow: number;
696
+ toRowOff: number;
697
+ caption: string;
698
+ items: SlicerItem[];
699
+ style?: SlicerStyle;
1777
700
  }
1778
701
  interface SlicerItem {
1779
- name: string;
1780
- selected: boolean;
702
+ name: string;
703
+ selected: boolean;
1781
704
  }
1782
705
  interface SlicerStyle {
1783
- whole?: SlicerElementStyle;
1784
- header?: SlicerElementStyle;
1785
- selectedItemWithData?: SlicerElementStyle;
1786
- unselectedItemWithData?: SlicerElementStyle;
706
+ whole?: SlicerElementStyle;
707
+ header?: SlicerElementStyle;
708
+ selectedItemWithData?: SlicerElementStyle;
709
+ unselectedItemWithData?: SlicerElementStyle;
1787
710
  }
1788
711
  interface SlicerElementStyle {
1789
- fontColor?: string;
1790
- fontSize?: number;
1791
- fontBold?: boolean;
1792
- fontFamily?: string;
1793
- fillColor?: string;
1794
- borderColor?: string;
712
+ fontColor?: string;
713
+ fontSize?: number;
714
+ fontBold?: boolean;
715
+ fontFamily?: string;
716
+ fillColor?: string;
717
+ borderColor?: string;
1795
718
  }
1796
719
  interface TableInfo {
1797
- range: CellRange$1;
1798
- styleName: string;
1799
- headerRowCount: number;
1800
- totalsRowCount: number;
1801
- showRowStripes: boolean;
1802
- showColumnStripes: boolean;
1803
- showFirstColumn: boolean;
1804
- showLastColumn: boolean;
1805
- /** Accent color resolved by the parser from the built-in style name against
1806
- * the file's theme accents (e.g. `TableStyleLight18` → accent3). */
1807
- accentColor: string;
1808
- /** `true` when `styleName` is defined in the file's `<tableStyles>` block,
1809
- * i.e. a *custom* style (ECMA-376 §18.5.1.2). The renderer draws such tables
1810
- * strictly from their declared element dxfs and must NOT apply the accent
1811
- * approximation (banding / synthesized rules / header) reserved for built-in
1812
- * style names whose definitions are absent from the file. */
1813
- isCustom?: boolean;
1814
- /** Dxf index for the `wholeTable` element of a custom `<tableStyle>`
1815
- * (ECMA-376 §18.8.83). When set, its border/fill apply to every cell of
1816
- * the table as a base layer. Undefined for built-in style names. */
1817
- wholeTableDxf?: number;
1818
- /** Dxf index for the `headerRow` element of a custom `<tableStyle>` —
1819
- * provides header background, font color/weight, and vertical separators. */
1820
- headerRowDxf?: number;
1821
- /** Dxf index for the `totalRow` element (ECMA-376 §18.18.93). */
1822
- totalRowDxf?: number;
1823
- /** Dxf index for the `firstColumn` element. */
1824
- firstColumnDxf?: number;
1825
- /** Dxf index for the `lastColumn` element. */
1826
- lastColumnDxf?: number;
1827
- /** Dxf index for `firstRowStripe` (band1 horizontal) — odd banded-row stripe. */
1828
- band1HorizontalDxf?: number;
1829
- /** Dxf index for `secondRowStripe` (band2 horizontal) — even banded-row stripe. */
1830
- band2HorizontalDxf?: number;
1831
- /** Per-column DXF references (ECMA-376 §18.5.1.3 `tableColumn`). Index by
1832
- * `cellCol - range.left`. The renderer can use these to apply column-level
1833
- * overlays for named-style tables; for files where Excel pre-bakes the
1834
- * column DXF result into the cell `xf` (the common case), reading `xf` is
1835
- * sufficient and these fields are informational. */
1836
- columns: TableColumnInfo[];
1837
- }
1838
- /** Per-column DXF references inside a `<table>` element
1839
- * (ECMA-376 §18.5.1.3 `tableColumn`). */
720
+ range: CellRange$1;
721
+ styleName: string;
722
+ headerRowCount: number;
723
+ totalsRowCount: number;
724
+ showRowStripes: boolean;
725
+ showColumnStripes: boolean;
726
+ showFirstColumn: boolean;
727
+ showLastColumn: boolean;
728
+ accentColor: string;
729
+ isCustom?: boolean;
730
+ wholeTableDxf?: number;
731
+ headerRowDxf?: number;
732
+ totalRowDxf?: number;
733
+ firstColumnDxf?: number;
734
+ lastColumnDxf?: number;
735
+ band1HorizontalDxf?: number;
736
+ band2HorizontalDxf?: number;
737
+ columns: TableColumnInfo[];
738
+ }
1840
739
  interface TableColumnInfo {
1841
- /** `<tableColumn dataDxfId>` — applied to data cells in this column. */
1842
- dataDxfId?: number;
1843
- /** `<tableColumn headerRowDxfId>` — applied to the header cell of this column. */
1844
- headerRowDxfId?: number;
1845
- /** `<tableColumn totalsRowDxfId>` — applied to the totals cell of this column. */
1846
- totalsRowDxfId?: number;
740
+ dataDxfId?: number;
741
+ headerRowDxfId?: number;
742
+ totalsRowDxfId?: number;
1847
743
  }
1848
744
  interface DefinedName {
1849
- name: string;
1850
- formula: string;
1851
- }
1852
- /** One cell comment. Sourced from the classic notes file `xl/commentsN.xml`
1853
- * (ECMA-376 §18.7) when present, otherwise from the Office-365 threaded
1854
- * comments part `xl/threadedComments/` (MS-XLSX schema
1855
- * `…/spreadsheetml/2018/threadedcomments`, `personId` resolved via
1856
- * `xl/persons/`). `text` is the joined plain text — every `<r><t>` run for
1857
- * classic notes, every reply in the thread (newline-joined) for threaded
1858
- * comments; rich-text formatting is dropped. 1:1 with the Rust `XlsxComment`
1859
- * (serde camelCase). */
745
+ name: string;
746
+ formula: string;
747
+ }
1860
748
  interface XlsxComment {
1861
- /** A1-style cell reference (`@ref` on the comment element). */
1862
- cellRef: string;
1863
- /** Resolved author name — the `<authors>` entry (classic) or the `<person>`
1864
- * `displayName` (threaded). Absent when unresolved. */
1865
- author?: string;
1866
- /** Concatenated plain text of every run / threaded reply. */
1867
- text: string;
1868
- }
1869
- /** One `<dataValidation>` rule (ECMA-376 §18.3.1.33). `type` is the constraint
1870
- * class (`list` | `whole` | `decimal` | `date` | `time` | `textLength` |
1871
- * `custom`); `operator` qualifies it (`between` | `notBetween` | `equal` | …).
1872
- * `formula1` / `formula2` are the operands (for `list`, `formula1` is the
1873
- * comma-separated literal list or a range/named reference). 1:1 with the Rust
1874
- * `DataValidation` (serde camelCase). */
749
+ cellRef: string;
750
+ author?: string;
751
+ text: string;
752
+ }
1875
753
  interface DataValidation {
1876
- /** Affected cell ranges, verbatim from `@sqref` (space-separated A1 refs). */
1877
- sqref: string;
1878
- /** Constraint class. Absent means the spec default (`none`, no constraint). */
1879
- validationType?: string;
1880
- operator?: string;
1881
- formula1?: string;
1882
- formula2?: string;
1883
- /** `@allowBlank` — empty input is permitted. */
1884
- allowBlank?: boolean;
1885
- promptTitle?: string;
1886
- prompt?: string;
1887
- errorTitle?: string;
1888
- errorMessage?: string;
1889
- }
1890
- /**
1891
- * @deprecated Chart series are now the core {@link ChartModel}'s `ChartSeries`.
1892
- * Kept as an alias for backward-compatible imports; scheduled for removal in a
1893
- * future breaking release.
1894
- */
754
+ sqref: string;
755
+ validationType?: string;
756
+ operator?: string;
757
+ formula1?: string;
758
+ formula2?: string;
759
+ allowBlank?: boolean;
760
+ promptTitle?: string;
761
+ prompt?: string;
762
+ errorTitle?: string;
763
+ errorMessage?: string;
764
+ }
1895
765
  type XlsxChartSeries = ChartSeries;
1896
- /** @deprecated Use `ChartSeriesDataLabels` from @silurus/ooxml-core. Scheduled
1897
- * for removal in a future breaking release. */
1898
766
  type SeriesDataLabels = ChartSeriesDataLabels;
1899
- /** @deprecated Use `ChartDataLabelOverride` from @silurus/ooxml-core. Scheduled
1900
- * for removal in a future breaking release. */
1901
767
  type DataLabelOverride = ChartDataLabelOverride;
1902
- /** @deprecated Use `ChartDataPointOverride` from @silurus/ooxml-core. Scheduled
1903
- * for removal in a future breaking release. */
1904
768
  type DataPointOverride = ChartDataPointOverride;
1905
- /** @deprecated Use `ChartErrBars` from @silurus/ooxml-core. Scheduled for
1906
- * removal in a future breaking release. */
1907
769
  type ErrBars = ChartErrBars;
1908
- /** @deprecated Use `ChartManualLayout` from @silurus/ooxml-core. Scheduled for
1909
- * removal in a future breaking release. */
1910
770
  type ManualLayout = ChartManualLayout;
1911
771
  interface ChartAnchor {
1912
- fromCol: number;
1913
- fromColOff: number;
1914
- fromRow: number;
1915
- fromRowOff: number;
1916
- toCol: number;
1917
- toColOff: number;
1918
- toRow: number;
1919
- toRowOff: number;
1920
- /** The chart payload, already in the canonical {@link ChartModel} shape the
1921
- * Rust parser emits. The parser adapts its internal parse structure into
1922
- * `ChartModel` (formerly the TS `adaptChartData`); this is passed straight
1923
- * to `renderChart`. */
1924
- chart: ChartModel;
772
+ fromCol: number;
773
+ fromColOff: number;
774
+ fromRow: number;
775
+ fromRowOff: number;
776
+ toCol: number;
777
+ toColOff: number;
778
+ toRow: number;
779
+ toRowOff: number;
780
+ chart: ChartModel;
1925
781
  }
1926
782
  interface ShapeAnchor {
1927
- fromCol: number;
1928
- fromColOff: number;
1929
- fromRow: number;
1930
- fromRowOff: number;
1931
- toCol: number;
1932
- toColOff: number;
1933
- toRow: number;
1934
- toRowOff: number;
1935
- /** `twoCellAnchor@editAs` (ECMA-376 §20.5.2.33). With `"oneCell"` the
1936
- * renderer uses `nativeExtCx`/`nativeExtCy` as the on-sheet size, since
1937
- * Excel preserves the group's saved EMU extent regardless of cell
1938
- * resizing ("Move but don't size with cells"). Absent ⇒ default `"twoCell"`. */
1939
- editAs?: string;
1940
- /** Saved EMU extent of the top-level grpSp (or the stand-alone sp/pic).
1941
- * Authoritative when `editAs === "oneCell"`. 0 = unavailable. */
1942
- nativeExtCx: number;
1943
- nativeExtCy: number;
1944
- shapes: ShapeInfo[];
783
+ fromCol: number;
784
+ fromColOff: number;
785
+ fromRow: number;
786
+ fromRowOff: number;
787
+ toCol: number;
788
+ toColOff: number;
789
+ toRow: number;
790
+ toRowOff: number;
791
+ editAs?: string;
792
+ nativeExtCx: number;
793
+ nativeExtCy: number;
794
+ shapes: ShapeInfo[];
1945
795
  }
1946
796
  interface ShapeInfo {
1947
- /** Normalized [0,1] position/size relative to the anchor rect. */
1948
- x: number;
1949
- y: number;
1950
- w: number;
1951
- h: number;
1952
- /** Rotation in degrees, clockwise. */
1953
- rot: number;
1954
- /** Effective DrawingML reflection after composing parent groups. */
1955
- flipH?: boolean;
1956
- flipV?: boolean;
1957
- fillColor?: string;
1958
- strokeColor?: string;
1959
- /** Stroke width in EMU. 0 = no stroke. */
1960
- strokeWidth: number;
1961
- geom: ShapeGeom;
1962
- /** Optional text body (`<xdr:txBody>`, ECMA-376 §20.5.2.34). Present for
1963
- * text boxes (`txBox="1"`) and any other shape that carries visible text. */
1964
- text?: ShapeText;
797
+ x: number;
798
+ y: number;
799
+ w: number;
800
+ h: number;
801
+ rot: number;
802
+ flipH?: boolean;
803
+ flipV?: boolean;
804
+ fillColor?: string;
805
+ strokeColor?: string;
806
+ strokeWidth: number;
807
+ geom: ShapeGeom;
808
+ text?: ShapeText;
1965
809
  }
1966
810
  interface ShapeText {
1967
- /** `<a:bodyPr@anchor>` — vertical alignment of the text block within the
1968
- * shape rect. `t` (top, default), `ctr` (middle), `b` (bottom). */
1969
- anchor: string;
1970
- /** `<a:bodyPr@wrap>` — `square` (wrap to width) | `none`. */
1971
- wrap: string;
1972
- /** `<a:bodyPr>` autofit child — `'sp'` (`spAutoFit`), `'norm'` (`normAutofit`),
1973
- * or `'none'` (`noAutofit`/absent). ECMA-376 §21.1.2.1.1-.3. Always present
1974
- * (default `'none'`), mirroring the core `TextBody.autoFit`. */
1975
- autoFit?: string;
1976
- /** `<a:normAutofit@fontScale>` — stored font-shrink fraction (e.g. 0.625 for
1977
- * `fontScale="62500"`). Null/absent when unset. Modeled for parity with
1978
- * pptx; the xlsx renderer does not currently apply it. */
1979
- fontScale?: number | null;
1980
- /** `<a:normAutofit@lnSpcReduction>` — stored line-spacing reduction fraction
1981
- * (e.g. 0.20 for `lnSpcReduction="20000"`). Null/absent when unset. */
1982
- lnSpcReduction?: number | null;
1983
- /** `<a:bodyPr@lIns>` — left text inset in EMU (ECMA-376 §21.1.2.1.1). Always
1984
- * present; the spec default 91440 EMU (7.2 pt) when the attribute is absent.
1985
- * Same EMU convention as `ShapeParagraph.marL`. */
1986
- lIns: number;
1987
- /** `<a:bodyPr@tIns>` — top text inset in EMU. Default 45720 (3.6 pt). */
1988
- tIns: number;
1989
- /** `<a:bodyPr@rIns>` — right text inset in EMU. Default 91440 (7.2 pt). */
1990
- rIns: number;
1991
- /** `<a:bodyPr@bIns>` — bottom text inset in EMU. Default 45720 (3.6 pt). */
1992
- bIns: number;
1993
- paragraphs: ShapeParagraph[];
811
+ anchor: string;
812
+ wrap: string;
813
+ autoFit?: string;
814
+ fontScale?: number | null;
815
+ lnSpcReduction?: number | null;
816
+ lIns: number;
817
+ tIns: number;
818
+ rIns: number;
819
+ bIns: number;
820
+ paragraphs: ShapeParagraph[];
1994
821
  }
1995
822
  interface ShapeParagraph {
1996
- /** `<a:pPr@algn>` — `l` (default) | `ctr` | `r` | `just` | `dist`. */
1997
- align: string;
1998
- /** `<a:pPr@rtl>` — whether the paragraph reads right-to-left
1999
- * (ECMA-376 §21.1.2.2.7). Omitted (undefined) when false. */
2000
- rtl?: boolean;
2001
- /** `<a:pPr@marL>` left margin in EMU (ECMA-376 §21.1.2.2.7,
2002
- * `CT_TextParagraphProperties`). Direct attribute only — xlsx text boxes
2003
- * have no lstStyle/level cascade. Omitted (undefined) when unset. */
2004
- marL?: number;
2005
- /** `<a:pPr@marR>` — right margin in EMU (ECMA-376 §21.1.2.2.7).
2006
- * Omitted (undefined) when unset. */
2007
- marR?: number;
2008
- /** `<a:pPr@indent>` — first-line indent in EMU (negative = hanging),
2009
- * ECMA-376 §21.1.2.2.7. Omitted (undefined) when unset. */
2010
- indent?: number;
2011
- /** `<a:pPr>/<a:lnSpc>` line spacing (ECMA-376 §21.1.2.2.5). Direct-only;
2012
- * omitted when unset. */
2013
- spaceLine?: SpaceLine | null;
2014
- runs: ShapeTextRun[];
2015
- }
2016
- /** A run within a shape paragraph — tagged union mirroring the Rust enum
2017
- * (matches the pptx `TextRun` shape): styled text, a soft line break, or an
2018
- * OMML equation. Excel stores "Insert > Equation" as OMML inside the shared
2019
- * DrawingML `<xdr:txBody>` grammar (ECMA-376 §22.1), like PowerPoint. */
823
+ align: string;
824
+ rtl?: boolean;
825
+ marL?: number;
826
+ marR?: number;
827
+ indent?: number;
828
+ spaceLine?: SpaceLine | null;
829
+ runs: ShapeTextRun[];
830
+ }
2020
831
  type ShapeTextRun = {
2021
- type: 'text';
2022
- text: string;
2023
- bold: boolean;
2024
- italic: boolean;
2025
- /** Font size in points (already converted from `<a:rPr@sz>` 100ths-of-a-pt).
2026
- * 0 = inherit (renderer falls back to its default). */
2027
- size: number;
2028
- color?: string;
2029
- fontFace?: string;
2030
- /** East-Asian typeface (`<a:ea@typeface>`, ECMA-376 §21.1.2.3.1). The
2031
- * common Japanese encoding sets Meiryo here while leaving `<a:latin>`
2032
- * default; the renderer floors the line box by this face's design line
2033
- * too (see `drawShapeText`). Undefined when the run declares no `<a:ea>`. */
2034
- fontFaceEa?: string;
2035
- /** Complex-script typeface (`<a:cs@typeface>`, ECMA-376 §21.1.2.3.1).
2036
- * Parsed/modeled but NOT used in the line-box floor: the cs face renders
2037
- * only complex-script glyphs (Arabic/Hebrew/Thai), so flooring the whole
2038
- * line box by it would over-grow Latin/CJK runs (deferred to per-glyph
2039
- * handling — see `drawShapeText`). Undefined when the run declares no
2040
- * `<a:cs>`. */
2041
- fontFaceCs?: string;
832
+ type: 'text';
833
+ text: string;
834
+ bold: boolean;
835
+ italic: boolean;
836
+ size: number;
837
+ color?: string;
838
+ fontFace?: string;
839
+ fontFaceEa?: string;
840
+ fontFaceCs?: string;
2042
841
  } | {
2043
- type: 'break';
842
+ type: 'break';
2044
843
  } | {
2045
- type: 'math';
2046
- /** OMML AST (shared `MathNode` model) for the equation. */
2047
- nodes: MathNode[];
2048
- /** true = block (`m:oMathPara`), false = inline (`m:oMath`). */
2049
- display: boolean;
2050
- /** Point size when the run carries an explicit `rPr@sz`; else inherit. */
2051
- fontSize?: number;
2052
- color?: string;
844
+ type: 'math';
845
+ nodes: MathNode[];
846
+ display: boolean;
847
+ fontSize?: number;
848
+ color?: string;
2053
849
  };
2054
850
  type ShapeGeom = {
2055
- type: 'preset';
2056
- name: string;
2057
- /** Adjust handles from `<a:avLst><a:gd>` in `adj1..adj8` order
2058
- * (ECMA-376 §19.5.31.3 / §20.1.9.5). `null` entries mean "use the
2059
- * preset's declared default". Omitted entirely when the shape has no
2060
- * `<a:avLst>`. Consumed by the shared `renderPresetShape` engine. */
2061
- adj?: (number | null)[];
851
+ type: 'preset';
852
+ name: string;
853
+ adj?: (number | null)[];
854
+ } | {
855
+ type: 'custom';
856
+ paths: PathInfo[];
2062
857
  } | {
2063
- type: 'custom';
2064
- paths: PathInfo[];
2065
- } |
2066
- /** Bitmap (or vector) picture leaf inside a `<xdr:grpSp>`. `imagePath` is the
2067
- * zip path of the drawing's relationship target — the blip's raster `r:embed`
2068
- * fallback, or the SVG itself when no raster is embedded — and `mimeType` its
2069
- * MIME. Bytes are fetched lazily by path; nothing is inlined as base64. */
2070
- {
2071
- type: 'image';
2072
- imagePath: string;
2073
- /** MIME type of the blip at {@link imagePath} (e.g. `image/png`, or
2074
- * `image/svg+xml` for the SVG-only fallback). */
2075
- mimeType: string;
2076
- /** Vector original from the Microsoft `asvg:svgBlip` extension
2077
- * (MS-ODRAWXML), as a zip path. Prefer this over `imagePath` (the raster
2078
- * fallback, or the SVG itself when no raster blip is embedded). Absent
2079
- * when the picture carries no svgBlip extension. Its MIME is always
2080
- * `image/svg+xml` and is owned by the SVG decoder. */
2081
- svgImagePath?: string;
2082
- /** ECMA-376 §20.1.8.55 `<a:srcRect>` source-image crop on the leaf pic
2083
- * (signed fractions from each edge; visible region `[l, t, 1-r,
2084
- * 1-b]`). Absent ⇒ the whole blip fills the leaf rect. Honored identically
2085
- * to the top-level {@link ImageAnchor.srcRect} (raster only). */
2086
- srcRect?: {
2087
- l: number;
2088
- t: number;
2089
- r: number;
2090
- b: number;
2091
- };
2092
- /** ECMA-376 §20.1.8.6 `<a:alphaModFix@amt>` opacity fraction (0..1) on the
2093
- * leaf pic. Absent ⇒ opaque. Applied via `globalAlpha`. */
2094
- alpha?: number;
2095
- /** ECMA-376 §20.1.8.23 `<a:duotone>` recolour on the leaf pic. Absent ⇒
2096
- * no effect. */
2097
- duotone?: Duotone;
858
+ type: 'image';
859
+ imagePath: string;
860
+ mimeType: string;
861
+ svgImagePath?: string;
862
+ srcRect?: {
863
+ l: number;
864
+ t: number;
865
+ r: number;
866
+ b: number;
867
+ };
868
+ alpha?: number;
869
+ duotone?: Duotone;
2098
870
  };
2099
- /** ECMA-376 §20.1.8.23 `<a:duotone>` image effect, resolved to its two endpoint
2100
- * colours (mirrors the shared Rust `ooxml_common::blip::Duotone`). `clr1` is the
2101
- * dark endpoint (luminance 0), `clr2` the light endpoint (luminance 1); both are
2102
- * 6-char uppercase hex WITHOUT a leading `#`, with per-colour transforms already
2103
- * applied by the parser. */
2104
871
  interface Duotone {
2105
- clr1: string;
2106
- clr2: string;
872
+ clr1: string;
873
+ clr2: string;
2107
874
  }
2108
875
  interface PathInfo {
2109
- w: number;
2110
- h: number;
2111
- commands: PathCmd[];
876
+ w: number;
877
+ h: number;
878
+ commands: PathCmd[];
2112
879
  }
2113
880
  type PathCmd = {
2114
- op: 'moveTo';
2115
- x: number;
2116
- y: number;
881
+ op: 'moveTo';
882
+ x: number;
883
+ y: number;
2117
884
  } | {
2118
- op: 'lineTo';
2119
- x: number;
2120
- y: number;
885
+ op: 'lineTo';
886
+ x: number;
887
+ y: number;
2121
888
  } | {
2122
- op: 'cubicBezTo';
2123
- x1: number;
2124
- y1: number;
2125
- x2: number;
2126
- y2: number;
2127
- x3: number;
2128
- y3: number;
889
+ op: 'cubicBezTo';
890
+ x1: number;
891
+ y1: number;
892
+ x2: number;
893
+ y2: number;
894
+ x3: number;
895
+ y3: number;
2129
896
  } | {
2130
- op: 'quadBezTo';
2131
- x1: number;
2132
- y1: number;
2133
- x2: number;
2134
- y2: number;
2135
- } |
2136
- /** ECMA-376 §20.1.9.3. stAng/swAng in 60000ths of a degree. wr/hr in
2137
- * the path's own coordinate units. Pen position is the arc start. */
2138
- {
2139
- op: 'arcTo';
2140
- wr: number;
2141
- hr: number;
2142
- stAng: number;
2143
- swAng: number;
897
+ op: 'quadBezTo';
898
+ x1: number;
899
+ y1: number;
900
+ x2: number;
901
+ y2: number;
2144
902
  } | {
2145
- op: 'close';
903
+ op: 'arcTo';
904
+ wr: number;
905
+ hr: number;
906
+ stAng: number;
907
+ swAng: number;
908
+ } | {
909
+ op: 'close';
2146
910
  };
2147
- /**
2148
- * Image anchored to a rectangle of cells (EMU offsets within the anchor cells).
2149
- * 914400 EMU = 1 inch, 9525 EMU = 1 px @ 96 DPI.
2150
- */
2151
911
  interface ImageAnchor {
2152
- fromCol: number;
2153
- fromColOff: number;
2154
- fromRow: number;
2155
- fromRowOff: number;
2156
- toCol: number;
2157
- toColOff: number;
2158
- toRow: number;
2159
- toRowOff: number;
2160
- /** `twoCellAnchor@editAs` (ECMA-376 §20.5.2.33). `"oneCell"` instructs the
2161
- * renderer to use `nativeExtCx`/`nativeExtCy` as the size and ignore the
2162
- * `to` anchor (Excel's "Move but don't size with cells"). Absent ⇒ default
2163
- * `"twoCell"`. */
2164
- editAs?: string;
2165
- /** `<xdr:pic><xdr:spPr><a:xfrm><a:ext cx cy>` in EMU — the picture's saved
2166
- * size. Authoritative when `editAs === "oneCell"`. 0 = unavailable. */
2167
- nativeExtCx: number;
2168
- nativeExtCy: number;
2169
- /** Zip path of the blip inside the package (e.g. `xl/media/image1.png`). The
2170
- * blip's own `r:embed` raster fallback when an svgBlip extension is present;
2171
- * otherwise the only source. Falls back to the SVG part itself when the
2172
- * picture has no raster `r:embed`. Bytes are fetched lazily by path. */
2173
- imagePath: string;
2174
- /** MIME type of the blip at {@link ImageAnchor.imagePath} (e.g. `image/png`,
2175
- * or `image/svg+xml` for the SVG-only fallback). */
2176
- mimeType: string;
2177
- /** Vector original from the Microsoft `asvg:svgBlip` extension (MS-ODRAWXML),
2178
- * as a zip path. Preferred over `imagePath` (the raster fallback, or the SVG
2179
- * itself when no raster blip is embedded). Absent when the picture carries no
2180
- * svgBlip extension. Its MIME is always `image/svg+xml` and is owned by the
2181
- * SVG decoder. */
2182
- svgImagePath?: string;
2183
- /** ECMA-376 §20.1.8.55 `<a:srcRect>` source-image crop. Each edge inset is a
2184
- * signed fraction of the source bitmap, measured from its edge, so the visible
2185
- * source region is `[l, t, 1-r, 1-b]`. Absent (the common case) ⇒ the whole
2186
- * blip fills the anchor rect; when present, the renderer draws only the
2187
- * cropped sub-rectangle (raster only — a metafile is rasterized to the
2188
- * display box, so its crop can't be honored faithfully and is skipped). */
2189
- srcRect?: {
2190
- l: number;
2191
- t: number;
2192
- r: number;
2193
- b: number;
2194
- };
2195
- /** ECMA-376 §20.1.8.6 `<a:alphaModFix@amt>` — the blip's overall opacity as a
2196
- * fraction (0..1). Absent ⇒ opaque. The renderer sets `ctx.globalAlpha` so the
2197
- * picture composites over the cells beneath it (e.g. a pink translucent photo
2198
- * over a matching cell fill). */
2199
- alpha?: number;
2200
- /** ECMA-376 §20.1.8.23 `<a:duotone>` recolour effect. Absent (the common case)
2201
- * ⇒ no effect. When present, the renderer remaps the image along the
2202
- * `clr1`→`clr2` luminance ramp before drawing. */
2203
- duotone?: Duotone;
912
+ fromCol: number;
913
+ fromColOff: number;
914
+ fromRow: number;
915
+ fromRowOff: number;
916
+ toCol: number;
917
+ toColOff: number;
918
+ toRow: number;
919
+ toRowOff: number;
920
+ editAs?: string;
921
+ nativeExtCx: number;
922
+ nativeExtCy: number;
923
+ imagePath: string;
924
+ mimeType: string;
925
+ svgImagePath?: string;
926
+ srcRect?: {
927
+ l: number;
928
+ t: number;
929
+ r: number;
930
+ b: number;
931
+ };
932
+ alpha?: number;
933
+ duotone?: Duotone;
2204
934
  }
2205
935
  interface CellRange$1 {
2206
- top: number;
2207
- left: number;
2208
- bottom: number;
2209
- right: number;
936
+ top: number;
937
+ left: number;
938
+ bottom: number;
939
+ right: number;
2210
940
  }
2211
941
  interface Hyperlink {
2212
- col: number;
2213
- row: number;
2214
- /** External target (ECMA-376 §18.3.1.47 `r:id`, resolved via worksheet rels).
2215
- * `null` for a purely internal hyperlink. */
2216
- url: string | null;
2217
- /** Internal target (§18.3.1.47 `location`): a defined name or a cell reference
2218
- * such as `Sheet1!A1`. Present when the hyperlink navigates within the
2219
- * workbook rather than to an external URL. */
2220
- location?: string | null;
2221
- /** Optional display text (§18.3.1.47 `display`). Not used for rendering. */
2222
- display?: string | null;
942
+ col: number;
943
+ row: number;
944
+ url: string | null;
945
+ location?: string | null;
946
+ display?: string | null;
2223
947
  }
2224
948
  interface ConditionalFormat {
2225
- sqref: CellRange$1[];
2226
- rules: CfRule[];
949
+ sqref: CellRange$1[];
950
+ rules: CfRule[];
2227
951
  }
2228
952
  type CfRule = {
2229
- type: 'cellIs';
2230
- operator: string;
2231
- formulas: string[];
2232
- dxfId: number | null;
2233
- priority: number;
953
+ type: 'cellIs';
954
+ operator: string;
955
+ formulas: string[];
956
+ dxfId: number | null;
957
+ priority: number;
2234
958
  } | {
2235
- type: 'expression';
2236
- formula: string;
2237
- dxfId: number | null;
2238
- priority: number;
2239
- stopIfTrue: boolean;
959
+ type: 'expression';
960
+ formula: string;
961
+ dxfId: number | null;
962
+ priority: number;
963
+ stopIfTrue: boolean;
2240
964
  } | {
2241
- type: 'colorScale';
2242
- stops: CfStop[];
2243
- priority: number;
965
+ type: 'colorScale';
966
+ stops: CfStop[];
967
+ priority: number;
2244
968
  } | {
2245
- type: 'dataBar';
2246
- color: string;
2247
- min: CfValue;
2248
- max: CfValue;
2249
- priority: number;
2250
- gradient: boolean;
969
+ type: 'dataBar';
970
+ color: string;
971
+ min: CfValue;
972
+ max: CfValue;
973
+ priority: number;
974
+ gradient: boolean;
2251
975
  } | {
2252
- type: 'top10';
2253
- top: boolean;
2254
- percent: boolean;
2255
- rank: number;
2256
- dxfId: number | null;
2257
- priority: number;
976
+ type: 'top10';
977
+ top: boolean;
978
+ percent: boolean;
979
+ rank: number;
980
+ dxfId: number | null;
981
+ priority: number;
2258
982
  } | {
2259
- type: 'aboveAverage';
2260
- aboveAverage: boolean;
2261
- equalAverage?: boolean;
2262
- stdDev?: number;
2263
- dxfId: number | null;
2264
- priority: number;
983
+ type: 'aboveAverage';
984
+ aboveAverage: boolean;
985
+ equalAverage?: boolean;
986
+ stdDev?: number;
987
+ dxfId: number | null;
988
+ priority: number;
2265
989
  } | {
2266
- type: 'iconSet';
2267
- iconSet: string;
2268
- cfvos: CfValue[];
2269
- reverse: boolean;
2270
- priority: number;
2271
- customIcons?: CfIcon[];
990
+ type: 'iconSet';
991
+ iconSet: string;
992
+ cfvos: CfValue[];
993
+ reverse: boolean;
994
+ priority: number;
995
+ customIcons?: CfIcon[];
2272
996
  } | {
2273
- type: 'other';
2274
- kind: string;
2275
- priority: number;
997
+ type: 'other';
998
+ kind: string;
999
+ priority: number;
2276
1000
  };
2277
1001
  interface CfIcon {
2278
- iconSet: string;
2279
- iconId: number;
1002
+ iconSet: string;
1003
+ iconId: number;
2280
1004
  }
2281
1005
  interface CfStop {
2282
- kind: string;
2283
- value: string | null;
2284
- color: string;
1006
+ kind: string;
1007
+ value: string | null;
1008
+ color: string;
2285
1009
  }
2286
1010
  interface CfValue {
2287
- kind: string;
2288
- value: string | null;
1011
+ kind: string;
1012
+ value: string | null;
2289
1013
  }
2290
1014
  interface Row {
2291
- index: number;
2292
- height: number | null;
2293
- cells: Cell[];
2294
- /** Outline (grouping) depth 0-7 (ECMA-376 §18.3.1.73 `<row outlineLevel>`).
2295
- * Omitted on the wire when `0` (ungrouped); read as `outlineLevel ?? 0`. */
2296
- outlineLevel?: number;
2297
- /** `<row collapsed>` (§18.3.1.73): `true` on a summary row whose
2298
- * one-level-deeper detail rows are collapsed. Omitted when false. */
2299
- collapsed?: boolean;
2300
- /** `<row hidden>` (§18.3.1.73): `true` when the row is hidden — most often
2301
- * because a collapsed outline hides its detail rows. Distinct from
2302
- * `height === 0`. Omitted on the wire when false. */
2303
- hidden?: boolean;
2304
- }
2305
- /** `<sheetPr><outlinePr>` flags (ECMA-376 §18.3.1.61). Both default to `true`. */
1015
+ index: number;
1016
+ height: number | null;
1017
+ cells: Cell[];
1018
+ outlineLevel?: number;
1019
+ collapsed?: boolean;
1020
+ hidden?: boolean;
1021
+ }
2306
1022
  interface OutlinePr {
2307
- /** `true` (default) ⇒ a group's summary row sits *below* its detail rows;
2308
- * `false` ⇒ above. */
2309
- summaryBelow: boolean;
2310
- /** `true` (default) ⇒ a group's summary column sits to the *right* of its
2311
- * detail columns; `false` ⇒ to the left. */
2312
- summaryRight: boolean;
1023
+ summaryBelow: boolean;
1024
+ summaryRight: boolean;
2313
1025
  }
2314
1026
  interface Cell {
2315
- col: number;
2316
- row: number;
2317
- value: CellValue;
2318
- /** Style index into the styles table. Omitted on the wire when `0` (the
2319
- * common unstyled case), so read it as `styleIndex ?? 0`. */
2320
- styleIndex?: number;
2321
- /** Raw `<f>` formula text (ECMA-376 §18.3.1.40), when present. The renderer
2322
- * uses this to recompute volatile functions (TODAY, NOW) at display time
2323
- * so the cached `<v>` — frozen when the file was last saved — doesn't
2324
- * show a stale date. */
2325
- formula?: string;
2326
- /** Whether this cell displays its phonetic hint (furigana). The parser
2327
- * resolves it as `cell/@ph ?? row/@ph ?? false` — the per-cell `<c ph>`
2328
- * (ECMA-376 §18.3.1.4) wins when present (an explicit `ph="0"` overrides an
2329
- * enabled row), otherwise the row-level `<row ph>` (§18.3.1.73) is inherited,
2330
- * otherwise the schema default (false). Omitted on the wire when false, so
2331
- * read as `showPhonetic ?? false`. A cell whose String Item carries `<rPh>`
2332
- * runs still shows NO furigana unless the resolved value is true. */
2333
- showPhonetic?: boolean;
1027
+ col: number;
1028
+ row: number;
1029
+ value: CellValue;
1030
+ styleIndex?: number;
1031
+ formula?: string;
1032
+ showPhonetic?: boolean;
2334
1033
  }
2335
1034
  type CellValue = {
2336
- type: 'empty';
1035
+ type: 'empty';
1036
+ } | {
1037
+ type: 'text';
1038
+ text: string;
1039
+ runs?: Run[];
1040
+ phoneticRuns?: PhoneticRun[];
1041
+ phoneticPr?: PhoneticProperties;
2337
1042
  } | {
2338
- type: 'text';
2339
- text: string;
2340
- runs?: Run[];
2341
- /** ECMA-376 §18.4.6 phonetic runs (furigana) carried over from the
2342
- * resolved String Item. Present for inline strings, and populated by
2343
- * {@link resolveSharedStrings} for shared-string cells. Absent when the
2344
- * string has no furigana. */
2345
- phoneticRuns?: PhoneticRun[];
2346
- /** ECMA-376 §18.4.3 phonetic display properties (font index / char set /
2347
- * alignment) for the furigana above. Absent when the `<si>` had no
2348
- * `<phoneticPr>`. */
2349
- phoneticPr?: PhoneticProperties;
1043
+ type: 'number';
1044
+ number: number;
2350
1045
  } | {
2351
- type: 'number';
2352
- number: number;
1046
+ type: 'bool';
1047
+ bool: boolean;
2353
1048
  } | {
2354
- type: 'bool';
2355
- bool: boolean;
1049
+ type: 'error';
1050
+ error: string;
2356
1051
  } | {
2357
- type: 'error';
2358
- error: string;
2359
- } |
2360
- /** Shared-string reference into `ParsedWorkbook.sharedStrings` (ECMA-376
2361
- * §18.4.8). Resolved to `{ type: 'text', ... }` by the workbook before the
2362
- * renderer (or any other consumer) sees it, so downstream code never
2363
- * encounters this variant. */
2364
- {
2365
- type: 'shared';
2366
- si: number;
1052
+ type: 'shared';
1053
+ si: number;
2367
1054
  };
2368
- /** ECMA-376 §18.4.6 `<rPh sb=".." eb="..">` — one furigana run. `sb`/`eb` are
2369
- * zero-based character offsets into the base text; the hint `text` is shown
2370
- * over base characters `[sb, eb)`. */
2371
1055
  interface PhoneticRun {
2372
- /** Zero-based start character offset into the base text (inclusive). */
2373
- sb: number;
2374
- /** Zero-based end character offset into the base text (exclusive). */
2375
- eb: number;
2376
- /** The phonetic hint text (e.g. the katakana reading). */
2377
- text: string;
2378
- }
2379
- /** ECMA-376 §18.18.57 ST_PhoneticType — the East-Asian character set the
2380
- * furigana is displayed in. Absent on {@link PhoneticProperties} defaults to
2381
- * `'fullwidthKatakana'` per the CT_PhoneticPr schema. */
1056
+ sb: number;
1057
+ eb: number;
1058
+ text: string;
1059
+ }
2382
1060
  type PhoneticType = 'fullwidthKatakana' | 'halfwidthKatakana' | 'Hiragana' | 'noConversion';
2383
- /** ECMA-376 §18.18.56 ST_PhoneticAlignment — how the furigana is aligned over
2384
- * the base text. Absent on {@link PhoneticProperties} defaults to `'left'`. */
2385
1061
  type PhoneticAlignment = 'left' | 'center' | 'distributed' | 'noControl';
2386
- /** ECMA-376 §18.4.3 `<phoneticPr>` — phonetic display properties. */
2387
1062
  interface PhoneticProperties {
2388
- /** Zero-based index into `Styles.fonts` (§18.18.32 ST_FontId). Out of bounds
2389
- * falls back to font 0 (§18.4.3). Drives the furigana font size / family. */
2390
- fontId: number;
2391
- /** §18.18.57 — absent means `'fullwidthKatakana'` (schema default). */
2392
- type?: PhoneticType;
2393
- /** §18.18.56 — absent means `'left'` (schema default). */
2394
- alignment?: PhoneticAlignment;
1063
+ fontId: number;
1064
+ type?: PhoneticType;
1065
+ alignment?: PhoneticAlignment;
2395
1066
  }
2396
1067
  interface Run {
2397
- text: string;
2398
- font?: RunFont;
1068
+ text: string;
1069
+ font?: RunFont;
2399
1070
  }
2400
1071
  interface RunFont {
2401
- bold: boolean;
2402
- italic: boolean;
2403
- underline: boolean;
2404
- strike: boolean;
2405
- size?: number;
2406
- color?: string | null;
2407
- name?: string | null;
2408
- /**
2409
- * Underline style when not the default single line. ECMA-376 §18.4.13
2410
- * (`ST_UnderlineValues`): "double" | "singleAccounting" | "doubleAccounting".
2411
- * Absent means single (when `underline` is true) or no underline.
2412
- */
2413
- underlineStyle?: string;
2414
- /**
2415
- * ECMA-376 §18.4.6 (`ST_VerticalAlignRun`): "superscript" | "subscript".
2416
- * Absent leaves the run on the baseline.
2417
- */
2418
- vertAlign?: 'superscript' | 'subscript';
1072
+ bold: boolean;
1073
+ italic: boolean;
1074
+ underline: boolean;
1075
+ strike: boolean;
1076
+ size?: number;
1077
+ color?: string | null;
1078
+ name?: string | null;
1079
+ underlineStyle?: string;
1080
+ vertAlign?: 'superscript' | 'subscript';
2419
1081
  }
2420
1082
  interface SharedString {
2421
- text: string;
2422
- runs?: Run[];
2423
- /** ECMA-376 §18.4.6 phonetic runs (furigana). Absent when the `<si>` has no
2424
- * `<rPh>`. */
2425
- phoneticRuns?: PhoneticRun[];
2426
- /** ECMA-376 §18.4.3 phonetic display properties. Absent when the `<si>` has
2427
- * no `<phoneticPr>`. */
2428
- phoneticPr?: PhoneticProperties;
1083
+ text: string;
1084
+ runs?: Run[];
1085
+ phoneticRuns?: PhoneticRun[];
1086
+ phoneticPr?: PhoneticProperties;
2429
1087
  }
2430
1088
  interface NumFmt {
2431
- numFmtId: number;
2432
- formatCode: string;
1089
+ numFmtId: number;
1090
+ formatCode: string;
2433
1091
  }
2434
1092
  interface Styles {
2435
- fonts: CellFont[];
2436
- fills: CellFill[];
2437
- borders: Border[];
2438
- cellXfs: CellXf[];
2439
- numFmts: NumFmt[];
2440
- dxfs: Dxf[];
1093
+ fonts: CellFont[];
1094
+ fills: CellFill[];
1095
+ borders: Border[];
1096
+ cellXfs: CellXf[];
1097
+ numFmts: NumFmt[];
1098
+ dxfs: Dxf[];
2441
1099
  }
2442
1100
  interface Dxf {
2443
- font: CellFont | null;
2444
- fill: CellFill | null;
2445
- border: Border | null;
2446
- /** Number format override from the dxf (ECMA-376 §18.8.17). When a
2447
- * conditional-formatting rule matches, this numFmt replaces the cell's own
2448
- * style numFmt for rendering — e.g. switching a calendar cell from `d` to
2449
- * `m"月"d"日"` on the first day of each month. */
2450
- numFmt?: NumFmt | null;
1101
+ font: CellFont | null;
1102
+ fill: CellFill | null;
1103
+ border: Border | null;
1104
+ numFmt?: NumFmt | null;
2451
1105
  }
2452
1106
  interface CellFont {
2453
- bold: boolean;
2454
- italic: boolean;
2455
- underline: boolean;
2456
- strike: boolean;
2457
- size: number;
2458
- color: string | null;
2459
- name: string | null;
2460
- /** ECMA-376 §18.4.13 ST_UnderlineValues — see RunFont.underlineStyle. */
2461
- underlineStyle?: string;
2462
- /** ECMA-376 §18.4.6 ST_VerticalAlignRun on a cell-level <font>. */
2463
- vertAlign?: 'superscript' | 'subscript';
1107
+ bold: boolean;
1108
+ italic: boolean;
1109
+ underline: boolean;
1110
+ strike: boolean;
1111
+ size: number;
1112
+ color: string | null;
1113
+ name: string | null;
1114
+ underlineStyle?: string;
1115
+ vertAlign?: 'superscript' | 'subscript';
2464
1116
  }
2465
1117
  interface CellFill {
2466
- patternType: string;
2467
- fgColor: string | null;
2468
- bgColor: string | null;
2469
- /** Set when the style's `<fill>` was a `<gradientFill>`; patternType stays "none". */
2470
- gradient?: GradientFillSpec | null;
1118
+ patternType: string;
1119
+ fgColor: string | null;
1120
+ bgColor: string | null;
1121
+ gradient?: GradientFillSpec | null;
2471
1122
  }
2472
1123
  interface GradientFillSpec {
2473
- /** "linear" (default) or "path". */
2474
- gradientType: string;
2475
- /** Rotation in degrees for linear gradients (0 = left→right). */
2476
- degree: number;
2477
- /** Path-gradient bounding box (0..1) — unused for linear. */
2478
- left: number;
2479
- right: number;
2480
- top: number;
2481
- bottom: number;
2482
- stops: {
2483
- position: number;
2484
- color: string;
2485
- }[];
1124
+ gradientType: string;
1125
+ degree: number;
1126
+ left: number;
1127
+ right: number;
1128
+ top: number;
1129
+ bottom: number;
1130
+ stops: {
1131
+ position: number;
1132
+ color: string;
1133
+ }[];
2486
1134
  }
2487
1135
  interface Border {
2488
- left: BorderEdge | null;
2489
- right: BorderEdge | null;
2490
- top: BorderEdge | null;
2491
- bottom: BorderEdge | null;
2492
- diagonalUp?: BorderEdge | null;
2493
- diagonalDown?: BorderEdge | null;
2494
- /** Inner horizontal rule between rows inside a region
2495
- * (ECMA-376 §18.8.40 `tableStyleElement/border/horizontal`).
2496
- * Only set on table-style dxfs; absent on cell-level borders. */
2497
- horizontal?: BorderEdge | null;
2498
- /** Inner vertical rule between columns inside a region. */
2499
- vertical?: BorderEdge | null;
1136
+ left: BorderEdge | null;
1137
+ right: BorderEdge | null;
1138
+ top: BorderEdge | null;
1139
+ bottom: BorderEdge | null;
1140
+ diagonalUp?: BorderEdge | null;
1141
+ diagonalDown?: BorderEdge | null;
1142
+ horizontal?: BorderEdge | null;
1143
+ vertical?: BorderEdge | null;
2500
1144
  }
2501
1145
  interface BorderEdge {
2502
- style: string;
2503
- color: string | null;
1146
+ style: string;
1147
+ color: string | null;
2504
1148
  }
2505
1149
  interface CellXf {
2506
- fontId: number;
2507
- fillId: number;
2508
- borderId: number;
2509
- numFmtId: number;
2510
- alignH: string | null;
2511
- alignV: string | null;
2512
- wrapText: boolean;
2513
- /** Indentation level (each level ≈ 3 characters, ECMA-376 §18.8.44) */
2514
- indent?: number;
2515
- /** Text rotation: 1–90 = counter-clockwise °, 91–180 = (val−90)° clockwise, 255 = stacked */
2516
- textRotation?: number;
2517
- shrinkToFit?: boolean;
2518
- /** `<alignment readingOrder>` (ECMA-376 §18.8.1) — 0 = context (default),
2519
- * 1 = LTR, 2 = RTL. Drives canvas `direction`. */
2520
- readingOrder?: number;
1150
+ fontId: number;
1151
+ fillId: number;
1152
+ borderId: number;
1153
+ numFmtId: number;
1154
+ alignH: string | null;
1155
+ alignV: string | null;
1156
+ wrapText: boolean;
1157
+ indent?: number;
1158
+ textRotation?: number;
1159
+ shrinkToFit?: boolean;
1160
+ readingOrder?: number;
2521
1161
  }
2522
1162
  interface ParsedWorkbook {
2523
- workbook: Workbook;
2524
- styles: Styles;
2525
- sharedStrings: SharedString[];
1163
+ workbook: Workbook;
1164
+ styles: Styles;
1165
+ sharedStrings: SharedString[];
2526
1166
  }
2527
1167
  interface ViewportRange {
2528
- row: number;
2529
- col: number;
2530
- rows: number;
2531
- cols: number;
1168
+ row: number;
1169
+ col: number;
1170
+ rows: number;
1171
+ cols: number;
2532
1172
  }
2533
- /** Emitted once per cell that has text, with the cell's canvas-pixel bounds. */
2534
1173
  interface XlsxTextRunInfo {
2535
- /** Worksheet name used by Office CLI's `/Sheet/A1` addressing. */
2536
- sheetName: string;
2537
- /** Stable A1 cell reference within {@link sheetName}. */
2538
- cellRef: string;
2539
- text: string;
2540
- /** Canvas CSS-pixel x of the cell's top-left corner. */
2541
- x: number;
2542
- /** Canvas CSS-pixel y of the cell's top-left corner. */
2543
- y: number;
2544
- /** Cell width in canvas CSS pixels. */
2545
- width: number;
2546
- /** Cell height in canvas CSS pixels. */
2547
- height: number;
2548
- row: number;
2549
- col: number;
1174
+ sheetName: string;
1175
+ cellRef: string;
1176
+ text: string;
1177
+ x: number;
1178
+ y: number;
1179
+ width: number;
1180
+ height: number;
1181
+ row: number;
1182
+ col: number;
2550
1183
  }
2551
1184
  interface RenderViewportOptions {
2552
- width?: number;
2553
- height?: number;
2554
- dpr?: number;
2555
- defaultFontFamily?: string;
2556
- defaultFontSize?: number;
2557
- scrollOffsetX?: number;
2558
- scrollOffsetY?: number;
2559
- freezeRows?: number;
2560
- freezeCols?: number;
2561
- /** Scale factor applied to all cell/header dimensions (default 1). */
2562
- cellScale?: number;
2563
- /** Pre-decoded image sources keyed by their zip `imagePath` (for ImageAnchor
2564
- * and group-leaf image rendering). */
2565
- loadedImages?: Map<string, CanvasImageSource | null>;
2566
- /** Fetch an embedded image's bytes by zip path, wrapped in a Blob of the given
2567
- * MIME (twin of pptx/docx `fetchImage`). The orchestrator decodes these into
2568
- * {@link loadedImages} before the synchronous draw. Supplied by
2569
- * {@link XlsxWorkbook} (routing through the worker) or the render worker
2570
- * (reading its retained buffer). Absent ⇒ no images are decoded. */
2571
- fetchImage?: (path: string, mimeType: string) => Promise<Blob>;
2572
- /** Called once per cell that contains text, with canvas-pixel position and cell address. */
2573
- onTextRun?: (info: XlsxTextRunInfo) => void;
2574
- /** Highlighted row range for selected row headers (1-indexed inclusive).
2575
- * `strong: true` → light blue + blue border (rows / cols / all selection modes).
2576
- * `strong: false` → slightly darker grey (cells selection mode). */
2577
- selectedRowRange?: {
2578
- start: number;
2579
- end: number;
2580
- strong: boolean;
2581
- } | null;
2582
- /** Same shape as selectedRowRange, for column headers. */
2583
- selectedColRange?: {
2584
- start: number;
2585
- end: number;
2586
- strong: boolean;
2587
- } | null;
1185
+ width?: number;
1186
+ height?: number;
1187
+ dpr?: number;
1188
+ defaultFontFamily?: string;
1189
+ defaultFontSize?: number;
1190
+ scrollOffsetX?: number;
1191
+ scrollOffsetY?: number;
1192
+ freezeRows?: number;
1193
+ freezeCols?: number;
1194
+ cellScale?: number;
1195
+ loadedImages?: Map<string, CanvasImageSource | null>;
1196
+ fetchImage?: (path: string, mimeType: string) => Promise<Blob>;
1197
+ onTextRun?: (info: XlsxTextRunInfo) => void;
1198
+ selectedRowRange?: {
1199
+ start: number;
1200
+ end: number;
1201
+ strong: boolean;
1202
+ } | null;
1203
+ selectedColRange?: {
1204
+ start: number;
1205
+ end: number;
1206
+ strong: boolean;
1207
+ } | null;
2588
1208
  }
2589
- //#endregion
2590
- //#region packages/xlsx/src/validation-list.d.ts
2591
- /**
2592
- * Resolved allowed-value set for a list validation. Either concrete display
2593
- * `values` (inline list or expanded range), or — when the operand is a defined
2594
- * name / complex formula we cannot expand — the raw `formula` text so the panel
2595
- * can disclose it instead of showing nothing.
2596
- */
2597
1209
  type ResolvedList = {
2598
- kind: 'values';
2599
- values: string[];
1210
+ kind: 'values';
1211
+ values: string[];
2600
1212
  } | {
2601
- kind: 'formula';
2602
- formula: string;
1213
+ kind: 'formula';
1214
+ formula: string;
2603
1215
  };
2604
- //#endregion
2605
- //#region packages/xlsx/src/worker-protocol.d.ts
2606
- /**
2607
- * View-only per-band size overrides for one sheet, carried with every worker
2608
- * `renderViewport` request. The render worker draws from its own worker-local
2609
- * parsed-sheet cache, so main-thread Worksheet mutations (outline
2610
- * collapse/expand via the size-0 hidden encoding, drag-to-resize #567) never
2611
- * reach it on their own — without this channel the gutter/overlays update but
2612
- * the grid bitmap stays stale.
2613
- *
2614
- * Semantics: keys are 1-based band indices; a number is the band's current
2615
- * `rowHeights` / `colWidths` model value, `null` means "no entry — fall back
2616
- * to the sheet default". The main thread accumulates every band the user has
2617
- * touched this session (entries are updated in place, never removed), so
2618
- * re-applying the full map is idempotent and converges the worker's cached
2619
- * sheet to the main model even across worker-side re-parses.
2620
- */
2621
1216
  interface WireSizeOverrides {
2622
- rows?: Record<number, number | null>;
2623
- cols?: Record<number, number | null>;
2624
- }
2625
- /** Serializable subset of RenderViewportOptions: drop the callback, the image
2626
- * cache, and the `fetchImage` loader (all non-cloneable; the worker owns its
2627
- * own cache and supplies its own in-worker fetchImage). Extended with the
2628
- * optional {@link WireSizeOverrides} so view-only size mutations reach the
2629
- * worker's local sheet copy; absent (the common case) when nothing has been
2630
- * resized or collapsed, keeping the wire payload unchanged. */
1217
+ rows?: Record<number, number | null>;
1218
+ cols?: Record<number, number | null>;
1219
+ }
2631
1220
  type WireRenderViewportOptions = Omit<RenderViewportOptions, 'onTextRun' | 'loadedImages' | 'fetchImage'> & {
2632
- sizeOverrides?: WireSizeOverrides;
1221
+ sizeOverrides?: WireSizeOverrides;
2633
1222
  };
2634
- //#endregion
2635
- //#region packages/xlsx/src/workbook.d.ts
2636
- /** Options for {@link XlsxWorkbook.load}. Extends the shared load-options type
2637
- * from `@silurus/ooxml-core` (`useGoogleFonts`, `resourceLimits`, the
2638
- * deprecated `maxZipEntryBytes` alias, and `math`) with worker rendering. */
2639
1223
  interface LoadOptions extends LoadOptions$1 {
2640
- /**
2641
- * 'main' (default): parse in a worker, render on the main thread (current
2642
- * behaviour). 'worker': parse AND render inside the worker; use
2643
- * {@link XlsxWorkbook.renderViewportToBitmap} and paint the returned
2644
- * ImageBitmap via an `ImageBitmapRenderingContext`. Requires OffscreenCanvas.
2645
- * The math engine is unavailable in this mode (equations are skipped).
2646
- */
2647
- mode?: 'main' | 'worker';
1224
+ mode?: 'main' | 'worker';
2648
1225
  }
2649
1226
  declare class XlsxWorkbook {
2650
- private metrics;
2651
- private worker;
2652
- private bridge;
2653
- private parsedWorkbook;
2654
- private sheetCache;
2655
- /** One materialization per sheet at a time. This becomes the ownership seam
2656
- * for the bounded worksheet cursor: concurrent callers share one cursor and
2657
- * one eventual mutable compatibility object instead of doubling peak work. */
2658
- private sheetLoads;
2659
- /** Cache of fetched image *bytes* (as Blobs) keyed by zip path, populated by
2660
- * {@link XlsxWorkbook.getImage}. Twin of pptx/docx's per-instance
2661
- * raw-part owner; decoded sources are owned separately by core. */
2662
- private readonly rawParts;
2663
- /** Public archive-queue reservations. Kept separate so an active render does
2664
- * not await a same-path load that is queued behind that render. */
2665
- private queuedImageLoads;
2666
- /** One stable closure per instance: core's path-keyed SVG cache namespaces on
2667
- * this identity, so two open workbooks never swap a shared zip path (e.g.
2668
- * xl/media/image1.svg). Reusing one reference also lets the SVG cache hit
2669
- * across viewport renders. */
2670
- private readonly _fetchImage;
2671
- private resourcePolicy;
2672
- /** Opt-in OMML equation engine, injected once at {@link load}. Every
2673
- * `renderViewport` call reuses it equations in shapes render when present,
2674
- * and are skipped (engine tree-shaken) when omitted. */
2675
- private math;
2676
- /** Google-Fonts `FontFace` objects this workbook preloaded into `document.fonts`
2677
- * (main mode only — in worker mode the worker owns them and terminates with its
2678
- * own FontFaceSet). Released in {@link destroy} so they do not leak into the
2679
- * shared FontFaceSet for the lifetime of the SPA (deduped + refcounted in core,
2680
- * so a web font shared with another open workbook survives until both go). */
2681
- private googleFontFaces;
2682
- private _mode;
2683
- private generation;
2684
- private nextSheetSessionId;
2685
- private archiveOperationTail;
2686
- private sheetSessions;
2687
- private workerTimeoutMs;
2688
- private retainedSheetUsage;
2689
- /** First fatal model/package violation. Compatibility materialization happens
2690
- * on main, so this latch is the document-level poison boundary for every
2691
- * later public operation on the same workbook instance. */
2692
- private resourceFailure;
2693
- private constructor();
2694
- /** Parse an XLSX from a URL or ArrayBuffer. */
2695
- static load(source: string | ArrayBuffer, opts?: LoadOptions): Promise<XlsxWorkbook>;
2696
- private _load;
2697
- get sheetNames(): string[];
2698
- get sheetCount(): number;
2699
- /** Per-sheet tab colors (`#RRGGBB`) parallel to {@link sheetNames}.
2700
- * `null` for sheets that declare no tab color. */
2701
- get tabColors(): (string | null)[];
2702
- /**
2703
- * Full visibility fact for the sheet at `sheetIndex` (0-based):
2704
- * `'visible'` | `'hidden'` | `'veryHidden'` (`<sheet state>`, ECMA-376
2705
- * §18.2.19). NOT clamped — out-of-range / non-integer ⇒ `'visible'`. This is a
2706
- * *fact*; deciding what to do with a hidden sheet (hide/skip/dim its tab) is
2707
- * {@link XlsxViewer}'s policy. `'veryHidden'` is revealable only
2708
- * programmatically in Excel; it is surfaced distinctly here.
2709
- */
2710
- sheetVisibility(sheetIndex: number): SheetVisibility;
2711
- /**
2712
- * Whether the sheet at `sheetIndex` is hidden or veryHidden. Convenience over
2713
- * {@link sheetVisibility}; mirrors {@link PptxPresentation.isHidden} (non-
2714
- * clamped: out-of-range / non-integer ⇒ `false`).
2715
- */
2716
- isHidden(sheetIndex: number): boolean;
2717
- getWorksheet(sheetIndex: number): Promise<Worksheet>;
2718
- /** Return a fresh content-free metrics snapshot, including lazy worksheet and
2719
- * media work completed since load. */
2720
- getResourceMetrics(): Promise<OoxmlResourceMetrics>;
2721
- private loadWorksheet;
2722
- private loadWorksheetStream;
2723
- private runArchiveOperation;
2724
- /**
2725
- * Fetch an embedded image's bytes by zip path (e.g. `xl/media/image1.png`),
2726
- * wrapped in a Blob of the given MIME. The bytes are pulled through the
2727
- * persistent worker via the `extractImage` message (twin of pptx/docx's
2728
- * `getImage`/`getMedia`); results are cached by path for the lifetime of this
2729
- * instance. The renderer's `fetchImage` option points here so image bytes are
2730
- * extracted lazily rather than inlined as base64 at parse time.
2731
- *
2732
- * Routed through the persistent worker so all WASM `extract_image` decoding
2733
- * stays with the archive owner.
2734
- */
2735
- getImage(imagePath: string, mimeType: string): Promise<Blob>;
2736
- private getImageWithinArchiveOperation;
2737
- private requestImage;
2738
- /**
2739
- * Project the workbook to GitHub-flavoured markdown: each sheet becomes a
2740
- * `## SheetName` section followed by a pipe table of its populated bounding
2741
- * box (fully-empty middle rows trimmed, ULP noise masked). Styling, charts,
2742
- * and drawings are discarded — the projection is meant for AI ingestion and
2743
- * full-text search, not layout.
2744
- *
2745
- * Runs entirely in the worker off the archive opened at {@link load} (no
2746
- * re-copy of the file, no re-parse of the model on the main thread), so it
2747
- * works in BOTH `mode: 'main'` and `mode: 'worker'`.
2748
- *
2749
- * @example
2750
- * const wb = await XlsxWorkbook.load(buffer);
2751
- * const md = await wb.toMarkdown();
2752
- */
2753
- toMarkdown(): Promise<string>;
2754
- /**
2755
- * Resolve a `list`-type data-validation `formula1` (ECMA-376 §18.3.1.32) into
2756
- * the set of allowed values to display, evaluated relative to `sheetIndex`
2757
- * (the sheet that owns the validation, used to resolve unqualified ranges):
2758
- *
2759
- * - Inline quoted list `"A,B,C"` → the literal values.
2760
- * - Range ref `$B$2:$B$5` → each non-empty cell's *display
2761
- * string* (the same formatted text the grid shows, via {@link formatCellValue}),
2762
- * walked row-major. `Sheet2!$A$1:$A$9` resolves against the named sheet
2763
- * (lazily parsed via {@link getWorksheet}, hence async).
2764
- * - Named range / complex formula → `{ kind: 'formula' }` carrying the
2765
- * raw text so the caller can disclose it rather than blanking it.
2766
- *
2767
- * Read-only: this only reads cell values for display; it never writes.
2768
- */
2769
- resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
2770
- /**
2771
- * IX2 — the display string a cell shows on the grid, i.e. exactly what
2772
- * {@link renderViewport} would draw (number formats, dates, booleans, rich
2773
- * text flattened). Used by {@link XlsxViewer.findText} to search the *rendered*
2774
- * text rather than the raw stored value, so a search matches what the user
2775
- * sees. Threads the workbook styles + the sheet's date system through the
2776
- * shared {@link formatCellValue} (the same call the renderer and
2777
- * validation-list expansion use). Returns `''` before the workbook is loaded.
2778
- */
2779
- cellText(ws: Worksheet, cell: Cell): string;
2780
- /**
2781
- * Render a sheet viewport into `target`. Note: `opts.fetchImage` is ignored
2782
- * here — image bytes always come from this workbook's own archive through its
2783
- * stable per-instance loader, whose closure identity keys the shared decoded
2784
- * caches, the render-pass lease, and {@link destroy}'s cache drops. Callers
2785
- * needing a custom byte source should use the standalone
2786
- * `renderWorksheetViewport` orchestrator directly.
2787
- */
2788
- renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
2789
- /**
2790
- * Render a sheet viewport and return it as an ImageBitmap (both modes; in
2791
- * worker mode the render runs entirely off the main thread). `opts.width` /
2792
- * `opts.height` are required: there is no DOM element to measure in a worker
2793
- * or on an OffscreenCanvas. Paint with
2794
- * `canvas.getContext('bitmaprenderer').transferFromImageBitmap(bitmap)`.
2795
- *
2796
- * The returned ImageBitmap is owned by the caller: pass it to
2797
- * `transferFromImageBitmap` (which consumes it) or call `bitmap.close()`
2798
- * when done, or its backing memory is held until GC.
2799
- */
2800
- renderViewportToBitmap(sheetIndex: number, viewport: ViewportRange, opts: WireRenderViewportOptions & {
2801
- width: number;
2802
- height: number;
2803
- }): Promise<ImageBitmap>;
2804
- private withWorksheetArchiveOperation;
2805
- destroy(): void;
2806
- private assertResourceHealthy;
1227
+ private metrics;
1228
+ private worker;
1229
+ private bridge;
1230
+ private parsedWorkbook;
1231
+ private sheetCache;
1232
+ private sheetLoads;
1233
+ private readonly rawParts;
1234
+ private queuedImageLoads;
1235
+ private readonly _fetchImage;
1236
+ private resourcePolicy;
1237
+ private math;
1238
+ private googleFontNames;
1239
+ private readonly retainedFontSets;
1240
+ private fontsDestroyed;
1241
+ private _mode;
1242
+ private generation;
1243
+ private archiveOperationTail;
1244
+ private worksheetPullClient;
1245
+ private workerTimeoutMs;
1246
+ private retainedSheetUsage;
1247
+ private resourceFailure;
1248
+ private constructor();
1249
+ get mode(): 'main' | 'worker';
1250
+ static load(source: string | ArrayBuffer, opts?: LoadOptions): Promise<XlsxWorkbook>;
1251
+ private _load;
1252
+ private retainFontsInSet;
1253
+ get sheetNames(): string[];
1254
+ get sheetCount(): number;
1255
+ get tabColors(): (string | null)[];
1256
+ sheetVisibility(sheetIndex: number): SheetVisibility;
1257
+ isHidden(sheetIndex: number): boolean;
1258
+ getWorksheet(sheetIndex: number): Promise<Worksheet>;
1259
+ getResourceMetrics(): Promise<OoxmlResourceMetrics>;
1260
+ private loadWorksheet;
1261
+ private loadWorksheetStream;
1262
+ private ensureWorksheetPullClient;
1263
+ private runArchiveOperation;
1264
+ getImage(imagePath: string, mimeType: string): Promise<Blob>;
1265
+ private getImageWithinArchiveOperation;
1266
+ private requestImage;
1267
+ toMarkdown(): Promise<string>;
1268
+ resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
1269
+ cellText(ws: Worksheet, cell: Cell): string;
1270
+ renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
1271
+ renderViewportToBitmap(sheetIndex: number, viewport: ViewportRange, opts: WireRenderViewportOptions & {
1272
+ width: number;
1273
+ height: number;
1274
+ }): Promise<ImageBitmap>;
1275
+ private withWorksheetArchiveOperation;
1276
+ destroy(): void;
1277
+ private assertResourceHealthy;
2807
1278
  }
2808
- //#endregion
2809
- //#region packages/xlsx/src/find.d.ts
2810
- /** Where an xlsx match lives: the sheet, its name, and the cell (A1 + row/col). */
1279
+ type CanvasViewerRenderMode = 'main' | 'worker';
2811
1280
  interface XlsxMatchLocation {
2812
- /** 0-based sheet index. */
2813
- sheet: number;
2814
- /** The sheet's display name. */
2815
- sheetName: string;
2816
- /** A1 cell reference, e.g. `"B7"`. */
2817
- ref: string;
2818
- /** 1-based row. */
2819
- row: number;
2820
- /** 1-based column. */
2821
- col: number;
1281
+ sheet: number;
1282
+ sheetName: string;
1283
+ ref: string;
1284
+ row: number;
1285
+ col: number;
2822
1286
  }
2823
- //#endregion
2824
- //#region packages/xlsx/src/viewer.d.ts
2825
- /** How {@link XlsxViewer} presents hidden sheets (`<sheet state>`, §18.2.19). */
2826
1287
  type HiddenSheetMode = 'show' | 'skip' | 'dim';
2827
- interface XlsxViewerOptions extends LoadOptions$1 {
2828
- /** Scale factor for cell/header dimensions (default 1). 0.5 = half size. */
2829
- cellScale?: number;
2830
- /**
2831
- * Enable drag-to-resize of column widths / row heights by dragging header
2832
- * borders. Resizing only changes the on-screen view — it never modifies the
2833
- * loaded file. Default: true.
2834
- */
2835
- resizable?: boolean;
2836
- /** Show the Excel-style zoom slider at the right end of the sheet-tab bar.
2837
- * Default `true`. Set `false` to hide it (e.g. when the host supplies its
2838
- * own zoom control). */
2839
- showZoomSlider?: boolean;
2840
- /** Lower/upper bounds for the zoom slider as scale factors. Default 0.1–4
2841
- * (10%–400%, matching Excel's zoom range). Also the clamp range for the IX9
2842
- * {@link ZoomableViewer} zoom contract ({@link XlsxViewer.setScale} etc.). */
2843
- zoomMin?: number;
2844
- zoomMax?: number;
2845
- /**
2846
- * IX9 — fires whenever the zoom factor actually changes (`1` = 100%), whatever
2847
- * the source: {@link XlsxViewer.setScale}, {@link XlsxViewer.zoomIn} /
2848
- * {@link XlsxViewer.zoomOut}, {@link XlsxViewer.fitWidth} /
2849
- * {@link XlsxViewer.fitPage}, the built-in zoom slider, the +/- buttons, or a
2850
- * Ctrl/⌘+wheel gesture. Named `onScaleChange` to match the docx/pptx viewers so
2851
- * all five share one notification shape. Not fired when a call resolves to the
2852
- * same (clamped/snapped) scale.
2853
- */
2854
- onScaleChange?: (scale: number) => void;
2855
- onReady?: (sheetNames: string[]) => void;
2856
- /**
2857
- * Called when the active sheet changes, with the new sheet's zero-based
2858
- * `index` and the `total` number of sheets in the workbook. This mirrors the
2859
- * docx `onPageChange` and pptx `onSlideChange` contracts so all three viewers
2860
- * share one callback shape. To get the sheet *name*, look it up by index from
2861
- * `viewer.sheetNames[index]` (or the `sheetNames` array delivered to
2862
- * `onReady`).
2863
- */
2864
- onSheetChange?: (index: number, total: number) => void;
2865
- /**
2866
- * Receives load failures and asynchronous render failures handled by the
2867
- * Viewer. Supplying this callback changes load-failure delivery: `load()`
2868
- * invokes it and resolves; without it, the same load/parse failure rejects
2869
- * `load()`. Viewer-managed render failures invoke it, or fall back to
2870
- * `console.error` when omitted.
2871
- *
2872
- * Stable cases can be narrowed with `OoxmlError`,
2873
- * `OoxmlResourceLimitError`, or `OoxmlDecodedImageLimitError` re-exported by
2874
- * this package. Other failures remain `Error` values; do not parse message
2875
- * text as an API. A `code` of `parser-crashed` identifies a recognized WASM
2876
- * trap, not a reliably classified OOM.
2877
- */
2878
- onError?: (err: Error) => void;
2879
- /** Called when the selected cell range changes. null means no selection. */
2880
- onSelectionChange?: (selection: CellRange | null) => void;
2881
- /**
2882
- * IX1 (design decision — NOT user-confirmed, integrator may veto). Fires when a
2883
- * cell carrying a hyperlink (ECMA-376 §18.3.1.47) is clicked. Default when
2884
- * omitted: external → {@link openExternalHyperlink} (new tab, sanitised,
2885
- * noopener); internal (`location`) → navigate to the referenced sheet/cell
2886
- * when resolvable. When supplied, this callback fully owns the behaviour and
2887
- * receives the raw {@link HyperlinkTarget} verbatim (URL sanitisation is the
2888
- * default handler's job, so a blocked scheme still reaches a custom callback).
2889
- */
2890
- onHyperlinkClick?: (target: HyperlinkTarget) => void;
2891
- /** IX1 — master switch for hyperlink interactivity. Default `true`. When
2892
- * `false`, the cell hit-test reports no hyperlink under any cell, so hyperlink
2893
- * interactivity is disabled entirely: no pointer cursor over a link, no default
2894
- * navigation (external new-tab / internal sheet jump), and `onHyperlinkClick`
2895
- * is never called. Hyperlinked cells still render exactly as authored but are
2896
- * inert. */
2897
- enableHyperlinks?: boolean;
2898
- /**
2899
- * Color of the cell-selection highlight. A single CSS color drives both the
2900
- * selection rectangle's border (drawn in this color) and its fill (the same
2901
- * color made translucent — see {@link selectionOverlayStyle}), so callers pick
2902
- * one accent color instead of a separate border + background. Any CSS color
2903
- * string works (`#1a73e8`, `rgb(...)`, `tomato`, …). Default `#1a73e8`
2904
- * (Google blue), matching the historical look. Can also be changed at runtime
2905
- * via {@link XlsxViewer.setSelectionColor}.
2906
- */
2907
- selectionColor?: string;
2908
- /** CSS backgrounds for ordinary and active in-document search matches. */
2909
- findHighlightColors?: FindHighlightColors;
2910
- /**
2911
- * `'main'` (default): parse in a worker, render on the main thread. `'worker'`:
2912
- * parse AND render entirely inside the worker and paint the returned
2913
- * ImageBitmap onto the viewer's canvas, so document rendering never blocks the
2914
- * UI thread. All interaction (scroll, sheet tabs, frozen panes, zoom, cell
2915
- * selection) is unchanged. Requires `Worker` + `OffscreenCanvas`. Equations
2916
- * require `'main'` (the math engine cannot cross the worker boundary).
2917
- */
2918
- mode?: 'main' | 'worker';
2919
- /**
2920
- * How hidden / veryHidden sheets (`<sheet state>`, ECMA-376 §18.2.19) are
2921
- * presented:
2922
- * - `'show'` (default): every sheet gets a tab — current behavior.
2923
- * - `'skip'`: hidden/veryHidden sheets get no tab and are jumped over by
2924
- * `nextSheet`/`prevSheet` and initial load; absolute indices are unchanged,
2925
- * and an explicit `goToSheet(i)` to a hidden sheet is still honored.
2926
- * - `'dim'`: hidden/veryHidden tabs are shown greyed but stay selectable.
2927
- *
2928
- * Named to match the {@link XlsxViewer.hiddenSheetMode} getter and
2929
- * {@link XlsxViewer.setHiddenSheetMode} setter. Mirrors pptx `hiddenSlideMode`.
2930
- */
2931
- hiddenSheetMode?: HiddenSheetMode;
1288
+ interface XlsxSheetViewerOptions extends LoadOptions$1 {
1289
+ cellScale?: number;
1290
+ resizable?: boolean;
1291
+ zoomMin?: number;
1292
+ zoomMax?: number;
1293
+ onScaleChange?: (scale: number) => void;
1294
+ onReady?: (sheetNames: string[]) => void;
1295
+ onSheetChange?: (index: number, total: number) => void;
1296
+ onError?: (err: Error) => void;
1297
+ onSelectionChange?: (selection: CellRange | null) => void;
1298
+ onHyperlinkClick?: (target: HyperlinkTarget) => void;
1299
+ enableHyperlinks?: boolean;
1300
+ selectionColor?: string;
1301
+ findHighlightColors?: FindHighlightColors;
1302
+ mode?: 'main' | 'worker';
1303
+ hiddenSheetMode?: HiddenSheetMode;
1304
+ onViewportChange?: (offset: XlsxViewportOffset) => void;
1305
+ }
1306
+ interface XlsxViewerOptions extends XlsxSheetViewerOptions {
1307
+ showZoomSlider?: boolean;
1308
+ }
1309
+ interface XlsxViewportOffset {
1310
+ readonly x: number;
1311
+ readonly y: number;
1312
+ }
1313
+ interface XlsxScrollToCellOptions {
1314
+ readonly align?: 'nearest' | 'start' | 'center' | 'end';
2932
1315
  }
2933
1316
  interface CellAddress {
2934
- row: number;
2935
- col: number;
1317
+ row: number;
1318
+ col: number;
2936
1319
  }
2937
1320
  type SelectionMode = 'cells' | 'rows' | 'cols' | 'all';
2938
1321
  interface CellRange {
2939
- anchor: CellAddress;
2940
- active: CellAddress;
2941
- mode: SelectionMode;
2942
- }
2943
- declare class XlsxViewer implements ZoomableViewer {
2944
- private wb;
2945
- /** The single subtree root the constructor appended to the caller's
2946
- * container. destroy() removes it to return the container to its original
2947
- * (empty) state. */
2948
- private wrapper;
2949
- private canvas;
2950
- /** Region holding the outline gutters (top/left) and the inset {@link canvasArea}.
2951
- * When the active sheet has no outlining the gutters collapse to 0 px and this
2952
- * is a transparent pass-through, so an outline-free sheet lays out identically. */
2953
- private gridRegion;
2954
- /** Left gutter canvas: row group brackets + toggles (XL4). */
2955
- private rowGutter;
2956
- /** Top gutter canvas: column group brackets + toggles (XL4). */
2957
- private colGutter;
2958
- /** Top-left corner canvas: numbered level buttons (XL4). */
2959
- private cornerGutter;
2960
- /** Cached extents (unscaled CSS px) of the current sheet's gutters; both 0 for
2961
- * an outline-free sheet. `w` insets {@link canvasArea} from the left, `h` from
2962
- * the top. */
2963
- private gutter;
2964
- /** Per-axis outline layout (group brackets + toggles) for the current sheet,
2965
- * recomputed on sheet switch and after each collapse/expand. `null` axis ⇒ no
2966
- * outlining on that axis. */
2967
- private rowOutline;
2968
- private colOutline;
2969
- private rowOutlineBands;
2970
- private colOutlineBands;
2971
- /** Original row heights / column widths stashed the first time a band is
2972
- * collapsed, so expanding restores a custom size rather than the default.
2973
- * Keyed by band index; per current worksheet (cleared on sheet switch). */
2974
- private stashedRowHeights;
2975
- private stashedColWidths;
2976
- /**
2977
- * Per-sheet cumulative record of every view-only size mutation (outline
2978
- * collapse/expand, drag-to-resize #567), keyed by sheet index. Value = the
2979
- * band's current model size, or `null` when the model has no entry (default
2980
- * size). Serialized as {@link WireSizeOverrides} with every worker
2981
- * `renderViewport` so the worker's local sheet cache converges to the
2982
- * main-thread model — without it the worker keeps drawing the file's
2983
- * original sizes and the grid bitmap goes stale under the (up-to-date)
2984
- * gutter and overlays. Entries are updated in place and never removed
2985
- * (idempotent re-application); the whole store resets when a new workbook
2986
- * loads. Main mode never reads it (the main renderer draws from the mutated
2987
- * model directly).
2988
- */
2989
- private sizeOverrideStore;
2990
- private canvasArea;
2991
- private scrollHost;
2992
- private spacer;
2993
- private tabBar;
2994
- private tabStrip;
2995
- private navPrev;
2996
- private navNext;
2997
- private tabs;
2998
- /** Per-tab colors parallel to `tabs`, from `<sheetPr><tabColor>`. */
2999
- private tabColors;
3000
- private zoomSlider;
3001
- private zoomLabel;
3002
- private currentSheet;
3003
- private _hiddenSheetMode;
3004
- private currentWorksheet;
3005
- private opts;
3006
- /** 'main' renders on this thread; 'worker' paints worker-produced bitmaps. */
3007
- private readonly _mode;
3008
- /** The canvas's bitmaprenderer context, used only in worker mode. A canvas
3009
- * holds one context type for its lifetime, so this is obtained once and the
3010
- * main-mode 2d render path is never used on the same canvas. */
3011
- private _bitmapCtx;
3012
- /** Set by {@link destroy} (first line). Guards {@link _reportRenderError} so a
3013
- * render rejection that lands AFTER teardown is swallowed rather than surfaced
3014
- * to an `onError` / `console.error` on a dead viewer — parity with the scroll
3015
- * viewers' `_destroyed` flag. */
3016
- private _destroyed;
3017
- /**
3018
- * Concurrent-load latch (generation token). Every {@link load} increments this
3019
- * and captures the value; after its workbook finishes loading it re-checks the
3020
- * live value and BAILS (destroying its own just-loaded workbook) if a newer
3021
- * `load()` has since started. Without it, two overlapping `load(A)`/`load(B)`
3022
- * calls race the WASM parse / worker init, and whichever RESOLVES last wins the
3023
- * swap — even the stale `load(A)` resolving after `load(B)`; the loser's freshly
3024
- * created workbook (never installed, or installed then overwritten) then leaks
3025
- * its worker + pinned WASM allocation. The latch composes with SC20: the check
3026
- * runs AFTER the new workbook loads but BEFORE the field assignment and
3027
- * `previous?.destroy()`, so a superseded load never touches `this.wb` nor frees
3028
- * the current (newer) workbook. {@link destroy} also bumps it so a load in
3029
- * flight at teardown is treated as superseded and its workbook cleaned up.
3030
- */
3031
- private _loadGen;
3032
- private resizeObserver;
3033
- /**
3034
- * Pending `requestAnimationFrame` handle for a coalesced re-render, or `null`
3035
- * when none is scheduled. High-frequency event-driven repaints (scroll, live
3036
- * resize drag, selection drag, container resize) route through
3037
- * {@link scheduleRender} so at most one render runs per animation frame: a
3038
- * burst of scroll events within a single frame collapses to one draw at the
3039
- * frame's latest scroll position (`renderCurrentSheet` reads the live scroll
3040
- * offset, so "latest wins" needs no stored position). Explicit API calls
3041
- * (`showSheet`/`goToSheet`, `select`, `setScale`) stay synchronous — they must
3042
- * paint immediately, not a frame later. `destroy()` cancels any pending frame.
3043
- */
3044
- private _rafId;
3045
- /**
3046
- * Monotonic render-request counter for worker-mode stale-frame dropping.
3047
- * Every {@link renderCurrentSheet} bumps it and captures the value before it
3048
- * awaits the worker's bitmap; on resolution a captured value below the current
3049
- * one means a newer render was requested meanwhile (scroll moved on, the sheet
3050
- * switched, a zoom changed), so that bitmap is stale and must be closed and
3051
- * dropped instead of painted over the fresher frame. The WorkerBridge already
3052
- * correlates each request↔response by id, but requests overlap — a slow bitmap
3053
- * for an old scroll position can resolve after a newer one — so the viewer
3054
- * needs this generation guard, the single-canvas analogue of the pptx
3055
- * scroll-viewer's per-slot render epoch (PR #663). The main-thread path renders
3056
- * synchronously and cannot interleave, so it needs no guard.
3057
- */
3058
- private _renderSeq;
3059
- /**
3060
- * Start-anchored horizontal scroll position (the {@link effectiveScrollLeft}
3061
- * value last produced by a real user scroll or a programmatic reset), kept
3062
- * as the source of truth across container size changes. The native
3063
- * `scrollLeft` cannot serve that role for RTL sheets (ECMA-376 §18.3.1.87):
3064
- * it is the *inverse* of the start-anchored offset, and the browser clamps
3065
- * any assignment to 0 while the host is unlaid-out (`display:none` mount —
3066
- * e.g. a host revealed only after `load()` resolves), which would otherwise
3067
- * strand the view at the sheet's far end once the host gains its real size.
3068
- */
3069
- private effectiveH;
3070
- /** Gesture-only pointer anchor for the NEXT `setScale`, in canvasArea-viewport
3071
- * px (`{ x, y }` from the wheel event, relative to the grid's top-left). Set by
3072
- * the Ctrl/⌘+wheel handler right before it calls `setScale` so the zoom pivots
3073
- * on the cursor ("zoom toward the pointer") in BOTH axes, past the fixed
3074
- * header + frozen-pane lead-in; consumed and cleared by `setScale`. `null` for
3075
- * every non-gesture source (the public `setScale`, the +/- steppers, the zoom
3076
- * slider, `fitWidth`/`fitPage`), which keep the historical START-anchored
3077
- * (top-left) preservation so their behaviour is unchanged. */
3078
- private _pendingZoomAnchor;
3079
- private anchorCell;
3080
- private activeCell;
3081
- private selectionMode;
3082
- private isSelecting;
3083
- private selectionOverlay;
3084
- /** IX2 — find-highlight overlay (matched-cell boxes). */
3085
- private findOverlay;
3086
- /** IX2 — find state (matches + active cursor). */
3087
- private _find;
3088
- private keydownHandler;
3089
- private pendingTap;
3090
- private pendingClick;
3091
- private resizeDrag;
3092
- /** DOM overlay element that shows the hovered cell's comment. Lives in
3093
- * canvasArea above the scrollHost; `pointer-events:none` so it never blocks
3094
- * cell interaction. */
3095
- private commentPopup;
3096
- /** `"row:col"` comment for the current sheet, rebuilt on every showSheet. */
3097
- private commentMap;
3098
- /** IX1 — `"row:col"` → hyperlink for the current sheet, rebuilt on every
3099
- * showSheet. Keys mirror the renderer's `hyperlinkMap` (1-based row/col, the
3100
- * first cell of a hyperlink `ref` range per the parser), so a `getCellAt`
3101
- * {row,col} looks up directly. */
3102
- private hyperlinkMap;
3103
- /** `"row:col"` of the cell whose popup is currently shown (or pending), so a
3104
- * pointermove within the same cell doesn't restart the show timer. */
3105
- private commentPopupKey;
3106
- /** Pending show timer (see {@link COMMENT_POPUP_DELAY_MS}). */
3107
- private commentPopupTimer;
3108
- /** DOM overlay listing a list-validated cell's allowed values. Lives in
3109
- * canvasArea above the scrollHost; unlike the comment popup this is a click
3110
- * target (`pointer-events:auto`). Read-only: hovering an item highlights it
3111
- * but selecting does NOT change the cell. */
3112
- private validationPanel;
3113
- /** `"row:col"` of the cell whose panel is currently open, or null. Lets a
3114
- * re-click on the same arrow toggle the panel closed. */
3115
- private validationPanelKey;
3116
- /** Screen rect (canvasArea CSS px) of the dropdown arrow button last drawn by
3117
- * {@link maybeDrawValidationDropdown}, so pointerdown can hit-test it. Null
3118
- * when no arrow is currently visible. */
3119
- private validationArrowRect;
3120
- /** Document-level pointerdown listener that closes the panel on an outside
3121
- * click; installed only while the panel is open. */
3122
- private validationOutsideHandler;
3123
- constructor(container: HTMLElement, opts?: XlsxViewerOptions);
3124
- /** Every non-empty cell of a sheet with its rendered display text (IX2 find
3125
- * source). Reads the parsed worksheet model directly — no render — so search
3126
- * covers the whole sheet, not just the on-screen viewport. */
3127
- private _collectSheetCells;
3128
- /**
3129
- * Load an XLSX from URL or ArrayBuffer and render the first sheet.
3130
- *
3131
- * Error contract (shared by all three viewers):
3132
- * - Parse/load failure (the underlying `XlsxWorkbook.load()` call itself
3133
- * rejects): if an `onError` callback was provided it is invoked and `load`
3134
- * resolves normally; if not, the error is rethrown so it is never silently
3135
- * swallowed.
3136
- * - Render failure (the first sheet fails to draw AFTER a successful
3137
- * parse/load): routed to the shared `_reportRenderError` contract (`onError`
3138
- * if provided, else `console.error` — never silent) and `load` still
3139
- * RESOLVES, matching every subsequent navigation call.
3140
- */
3141
- load(source: string | ArrayBuffer): Promise<void>;
3142
- /** The loaded workbook, or throws if {@link load} has not completed. */
3143
- private get workbook();
3144
- showSheet(index: number): Promise<void>;
3145
- /** Recompute the per-axis outline layout for `ws` and cache the band lists.
3146
- * Both axes are `null` (gutters collapse to 0) when the sheet has no
3147
- * outlining, so an outline-free sheet is untouched. */
3148
- private buildOutline;
3149
- /** Size and place the three gutter canvases (corner / col / row) from the
3150
- * current outline, and inset {@link canvasArea} by the gutter extents. When
3151
- * neither axis is grouped both extents are 0 and canvasArea covers the whole
3152
- * region — pixel-identical to a viewer built before XL4. */
3153
- private layoutGutters;
3154
- /** Paint all visible gutter strips for the current scroll offset. Called at the
3155
- * end of every grid render so the brackets track scroll / zoom exactly. */
3156
- private renderGutters;
3157
- /** Draw one axis's group brackets and +/- toggles into its gutter canvas,
3158
- * aligned to the on-screen band positions via {@link getCellRect}. */
3159
- private paintAxisGutter;
3160
- /** Draw a small square +/- toggle centered at (cx, cy) in gutter-canvas CSS px. */
3161
- private drawToggleBox;
3162
- /** Draw one numbered level button centered at (cx, cy) in gutter-canvas CSS
3163
- * px. Shared by the row bank (in the row gutter's top strip) and the column
3164
- * bank (in the column gutter's left strip). */
3165
- private drawLevelButton;
3166
- /** Paint the corner (intersection of the two gutters) as plain background.
3167
- * The numbered level banks live in each axis gutter's own header strip
3168
- * (see paintAxisGutter), so the corner carries no interactive content. */
3169
- private paintCornerGutter;
3170
- /** Handle a click in a row/col gutter: hit-test the +/- toggles and toggle the
3171
- * matching group's collapse state. */
3172
- private onGutterPointerDown;
3173
- /** Flip a single group's collapse state in the in-memory model, then rebuild
3174
- * the outline + repaint. View-only: the file is never written. */
3175
- private applyGroupToggle;
3176
- /** Collapse/expand the whole sheet to `level` on one axis. */
3177
- private applyLevelButton;
3178
- /** Set a row/column hidden by mapping to the size-0 encoding the axis/renderer
3179
- * already understand, stashing the original size so expand can restore it. */
3180
- private setBandHidden;
3181
- /** Record band `index`'s CURRENT model size (or `null` = no entry) in the
3182
- * per-sheet override store. Called after every view-only size mutation —
3183
- * outline hide/show above and drag-to-resize (#567) — so worker renders
3184
- * converge to the main model. */
3185
- private recordSizeOverride;
3186
- /** The current sheet's override store serialized for the wire, or undefined
3187
- * when nothing has been mutated (keeps the request payload unchanged). */
3188
- private wireSizeOverrides;
3189
- /** Update the `collapsed` flag on a band's model entry so the outline rebuild
3190
- * reflects the new state. */
3191
- private setBandCollapsed;
3192
- /** Shared tail of a gutter interaction: invalidate the axis cache, rebuild the
3193
- * outline (collapsed flags changed), refresh dependent geometry, re-render. */
3194
- private afterOutlineMutation;
3195
- /** Rebuild only the layout + band lists (not the stashes) after a collapse
3196
- * state change, so the +/- glyphs and bracket set stay in sync. */
3197
- private buildOutlineLayoutOnly;
3198
- /** True when the current sheet's grid is laid out right-to-left. */
3199
- private get isRtl();
3200
- /** Maximum horizontal scroll offset the native scroll host allows (≥ 0). */
3201
- private get maxScrollLeft();
3202
- /**
3203
- * The logical horizontal scroll position used to find the start-of-sheet
3204
- * (col A) edge, in *scaled* CSS pixels — the same unit as
3205
- * `scrollHost.scrollLeft`. The renderer always lays the grid out LTR and then
3206
- * mirrors it (ECMA-376 §18.3.1.87), so the viewer must hand it a position
3207
- * where 0 = the START of the sheet (col A) and increasing values reveal later
3208
- * columns.
3209
- *
3210
- * For LTR that is exactly the native `scrollLeft`. For RTL the sheet starts at
3211
- * the RIGHT, so the native scrollbar runs the opposite way: thumb fully right
3212
- * (`scrollLeft = maxScrollLeft`) is the start, thumb left is the far columns.
3213
- * Inverting here makes wheel/trackpad follow the finger and aligns the
3214
- * thumb↔page mapping with Excel, without depending on browser-specific RTL
3215
- * `scrollLeft` sign conventions.
3216
- */
3217
- private get effectiveScrollLeft();
3218
- /**
3219
- * Map between the logical-LTR x used by all the cell-geometry math and the
3220
- * on-screen (canvasArea CSS-pixel) x, applying the RTL mirror (ECMA-376
3221
- * §18.3.1.87) via the same {@link rtlMirrorX} the renderer uses. For LTR this
3222
- * is the identity. The mirror is an involution, so this one method serves
3223
- * both cell→px (overlay draw, `w` = cell width) and px→cell (pointer
3224
- * hit-testing, `w` = 0 for a point) — guaranteeing the overlay sits exactly
3225
- * where the cell is drawn and a click resolves to that same cell at every
3226
- * scroll offset. `canvasArea.clientWidth` equals the renderer's `canvasW`.
3227
- */
3228
- private screenX;
3229
- /** Park the scrollbar at the sheet's natural start: scrollLeft=0 for LTR,
3230
- * the right end for RTL (so col A shows first). */
3231
- private resetHorizontalScroll;
3232
- /** Re-derive the native scrollLeft from the tracked start-anchored
3233
- * position after the scroll host's size changes. Only RTL needs this:
3234
- * for LTR the native scrollLeft *is* start-anchored and the browser
3235
- * already clamps it sensibly on resize. */
3236
- private reanchorHorizontalScroll;
3237
- /** 0-based index of the currently displayed sheet. */
3238
- get sheetIndex(): number;
3239
- /** Total number of sheets in the loaded workbook. */
3240
- get sheetCount(): number;
3241
- /**
3242
- * Navigate to a sheet by index, clamped to range. Canonical navigation verb
3243
- * matching {@link PptxViewer.goToSlide} / {@link DocxViewer.goToPage};
3244
- * {@link showSheet} is the lower-level form that assumes a valid index.
3245
- */
3246
- goToSheet(index: number): Promise<void>;
3247
- nextSheet(): Promise<void>;
3248
- prevSheet(): Promise<void>;
3249
- /** Next sheet index for sequential nav: skip mode jumps over hidden sheets. */
3250
- private _stepSheet;
3251
- /** Initial sheet for load() / entering skip mode: land on a visible sheet. */
3252
- private _initialSheet;
3253
- /** Returns the cell at canvas-client coordinates, or null if outside the cell grid. */
3254
- getCellAt(clientX: number, clientY: number): CellAddress | null;
3255
- /** Returns the CSS-pixel rect of a cell within canvasArea, or null if not
3256
- * computable. Mirrors the renderer's per-cell rounding (Math.round(px * cs))
3257
- * so the selection overlay sits exactly on the canvas's drawn cell borders;
3258
- * multiplying logical accumulators by `cs` once at the end (the previous
3259
- * approach) drifted by up to 1 px per cell at non-integer scales.
3260
- */
3261
- private getCellRect;
3262
- /** Returns the current selection, including mode. */
3263
- get selection(): CellRange | null;
3264
- /**
3265
- * Programmatically select a single cell by A1 reference (e.g. `"B2"`), as if
3266
- * the user had clicked it: updates the active/anchor cell, redraws the
3267
- * selection overlay (including any list-validation dropdown arrow), and fires
3268
- * `onSelectionChange`. A no-op for malformed refs. Closes any open validation
3269
- * panel, matching the click path.
3270
- */
3271
- select(ref: string): void;
3272
- /**
3273
- * Returns what the header area contains at the given client coordinates.
3274
- * Returns null when the point is in the cell grid (not a header).
3275
- */
3276
- private getHeaderHit;
3277
- /**
3278
- * If the pointer sits on a column/row-header border (within {@link
3279
- * RESIZE_GRAB_PX}), return the resize target: which index to resize and the
3280
- * fixed LTR edge it grows from (in canvasArea CSS px). Excel resizes the band
3281
- * whose *trailing* border you grab — the column to the left of a vertical
3282
- * border, the row above a horizontal one — so both that band and its
3283
- * neighbour-to-the-far-side are checked. Geometry comes straight from {@link
3284
- * getCellRect}, so the grab line always coincides with the drawn border at any
3285
- * scroll offset / zoom / RTL. Returns null off the header borders.
3286
- */
3287
- private getResizeTarget;
3288
- /**
3289
- * Apply a live resize drag: size the band from its fixed origin edge to the
3290
- * current pointer, clamp to {@link RESIZE_MIN_PX}, and write the result back
3291
- * into the in-memory worksheet model in its native unit (Excel column widths /
3292
- * points). This is a *view-only* mutation — the file is never written. The
3293
- * memoized axis cache for this sheet is invalidated so every geometry read
3294
- * (spacer, hit-test, overlay, renderer) sees the new size on the next frame.
3295
- */
3296
- private applyResize;
3297
- /**
3298
- * Change the cell-selection highlight color at runtime (see {@link
3299
- * XlsxViewerOptions.selectionColor}). The border takes the color as-is and the
3300
- * fill becomes a translucent shade of it; the current selection repaints
3301
- * immediately.
3302
- */
3303
- setSelectionColor(color: string): void;
3304
- /**
3305
- * Switch the hidden-sheet mode at runtime: restyle the tabs and re-render.
3306
- * Entering `'skip'` while on a hidden sheet advances to the nearest visible.
3307
- */
3308
- setHiddenSheetMode(mode: HiddenSheetMode): Promise<void>;
3309
- /** The current hidden-sheet mode. */
3310
- get hiddenSheetMode(): HiddenSheetMode;
3311
- /** Number of non-hidden sheets (absolute `sheetCount` is unchanged). */
3312
- get visibleSheetCount(): number;
3313
- /** Copy the selected cell range as tab-separated text to the clipboard. */
3314
- private copySelection;
3315
- private updateSelectionOverlay;
3316
- /** Draw the Excel list-validation dropdown button just outside the
3317
- * bottom-right corner of the *active* cell when that cell is covered by a
3318
- * `list` data-validation rule. Anchored to the single active cell (not the
3319
- * whole range) to mirror Excel, which attaches the button to the active
3320
- * cell of the selection. */
3321
- private maybeDrawValidationDropdown;
3322
- /**
3323
- * Redraw the find-highlight overlay: one translucent box per matched cell on
3324
- * the current sheet, the active match in a stronger colour. Uses the SAME
3325
- * `getCellRect` + `screenX` + header/frozen clamp the selection overlay uses,
3326
- * so a box lands exactly on the drawn cell at any scroll offset / zoom / RTL.
3327
- * Rebuilt on every render and scroll (cheap DOM geometry, no canvas paint).
3328
- */
3329
- private updateFindOverlay;
3330
- /**
3331
- * IX2 — find every occurrence of `query` across every sheet and highlight the
3332
- * matched cells. Returns every match in document order (sheet ascending, then
3333
- * row-major within a sheet), each tagged with its
3334
- * `{ sheet, sheetName, ref, row, col }`. A cell is the search unit: search
3335
- * runs over each cell's *rendered* display text (number formats, dates, rich
3336
- * text flattened), so a query matches what the grid shows. Case-insensitive by
3337
- * default; pass `{ caseSensitive: true }` for an exact match. An empty query
3338
- * clears the find.
3339
- */
3340
- findText(query: string, opts?: FindMatchesOptions): Promise<FindMatch<XlsxMatchLocation>[]>;
3341
- /**
3342
- * IX2 — move to the next match (wrap-around), switching sheets and scrolling
3343
- * the matched cell into view as needed, and highlight it as the active match.
3344
- * Returns the now-active match, or `null` when there are none. Call
3345
- * {@link findText} first.
3346
- */
3347
- findNext(): Promise<FindMatch<XlsxMatchLocation> | null>;
3348
- /** IX2 — move to the previous match (wrap-around). */
3349
- findPrev(): Promise<FindMatch<XlsxMatchLocation> | null>;
3350
- /** IX2 — clear all highlights and reset the find state. */
3351
- clearFind(): void;
3352
- private _activateMatch;
3353
- /**
3354
- * Scroll the grid so cell (row, col) is comfortably in view. Computes the
3355
- * cell's absolute logical offset from the axis metrics (the same the renderer
3356
- * uses) and nudges `scrollHost.scrollTop` / start-anchored horizontal scroll
3357
- * only when the cell is outside the scrollable viewport — an in-view cell is
3358
- * left where it is (Excel's find behaviour). Frozen cells are always visible,
3359
- * so they need no scroll.
3360
- */
3361
- private _scrollCellIntoView;
3362
- /** Toggle the dropdown panel for the active cell's list validation. Called
3363
- * from pointerdown when the arrow rect is hit. Re-clicking the same arrow
3364
- * closes it. */
3365
- private toggleValidationPanel;
3366
- /** Resolve the allowed values for `formula1` (relative to the current sheet)
3367
- * and render them in the panel anchored below the active cell. Async because
3368
- * cross-sheet range references may need a lazily-parsed worksheet. */
3369
- private openValidationPanel;
3370
- /** Build the panel's children. Uses textContent throughout (no HTML injection
3371
- * from cell values). Items highlight on hover but are NOT selectable —
3372
- * this is a read-only viewer, so clicking a value must not change the cell. */
3373
- private renderValidationPanel;
3374
- /** Position the (already-populated, visible-or-becoming-visible) panel below
3375
- * the dropdown arrow / active cell using the pure geometry calculator. */
3376
- private positionValidationPanel;
3377
- /** Install a document-level pointerdown listener that closes the panel on a
3378
- * click outside it (and outside the arrow, which toggles via its own path).
3379
- * Removed by {@link hideValidationPanel}. */
3380
- private installValidationOutsideHandler;
3381
- /** Hide the panel and detach its outside-click listener. Called on re-click,
3382
- * outside click, Esc, scroll, selection change, sheet switch and destroy. */
3383
- private hideValidationPanel;
3384
- /** Build the `"row:col"` → comment index for the given sheet. Parses each
3385
- * `XlsxComment.cellRef` with the shared {@link parseA1}; later refs win on a
3386
- * collision (Excel allows at most one note per cell, so this is moot in
3387
- * practice). */
3388
- private buildCommentMap;
3389
- /** IX1 — index the current sheet's hyperlinks by `"row:col"` (1-based, first
3390
- * cell of the `ref` range) so a clicked/hovered cell resolves in O(1). Keys
3391
- * match the renderer's `hyperlinkMap` exactly (`${hl.row}:${hl.col}`). */
3392
- private buildHyperlinkMap;
3393
- /** IX1 — the hyperlink at a cell, or null. `getCellAt` returns 1-based
3394
- * {row,col}, matching the parser/renderer keying.
3395
- *
3396
- * Returns null unconditionally when `enableHyperlinks` is `false`: this is the
3397
- * single gate that disables hyperlink interactivity. Both consumers — the
3398
- * pointermove pointer-cursor affordance and the click dispatch
3399
- * ({@link dispatchHyperlink}) — funnel through this hit-test, so a null result
3400
- * means no cursor change, no default navigation, and no `onHyperlinkClick`. */
3401
- private hyperlinkAtCell;
3402
- /**
3403
- * IX1 — dispatch a click on a hyperlinked cell. Builds a
3404
- * {@link HyperlinkTarget} from the parsed hyperlink (external `url` wins over
3405
- * internal `location`, matching Excel: a `<hyperlink>` carrying both navigates
3406
- * to the external target) and routes it to the caller's `onHyperlinkClick`
3407
- * (which fully owns behaviour) or the built-in default. Returns true when a
3408
- * hyperlink was found and dispatched.
3409
- */
3410
- private dispatchHyperlink;
3411
- /**
3412
- * IX1 default handler for an internal `location` target (§18.3.1.47): a defined
3413
- * name or a cell ref like `Sheet1!A1`. Best-effort: if the part before `!`
3414
- * names a sheet in the workbook, switch to it. There is no scroll-to-cell
3415
- * primitive on this viewer, so the cell part is not yet honoured (switching the
3416
- * sheet already lands the user on the right surface). A bare defined name that
3417
- * does not resolve to a sheet is a documented no-op.
3418
- */
3419
- private navigateInternalHyperlink;
3420
- /** Show the popup for the comment on `cell` after the hover dwell, anchored to
3421
- * the cell's current on-screen rect. No-op when the cell carries no comment.
3422
- * Re-hovering the same cell does not restart the timer. */
3423
- private scheduleCommentPopup;
3424
- /** Immediately render the popup for `comment` anchored to `cell` (used by the
3425
- * hover-dwell timer and by touch selection, which has no hover). */
3426
- private renderCommentPopup;
3427
- /** Hide the popup and cancel any pending show. Called on cell-out, scroll,
3428
- * sheet switch and destroy. */
3429
- private hideCommentPopup;
3430
- private applyPointerSelection;
3431
- private setupSelectionEvents;
3432
- private buildTabs;
3433
- private makeNavButton;
3434
- private navButtonStyle;
3435
- private scrollTabs;
3436
- private updateNavButtons;
3437
- private updateTabActive;
3438
- private tabStyle;
3439
- /**
3440
- * Full inline style for the tab of sheet `i`, honoring the hidden-sheet mode:
3441
- * `'skip'` hides the tab of a hidden/veryHidden sheet (`display:none`); `'dim'`
3442
- * greys it but leaves it clickable; `'show'` styles every tab normally. Used
3443
- * by both buildTabs and updateTabActive so navigation never wipes the styling.
3444
- */
3445
- private tabCss;
3446
- /** Excel-style zoom control pinned to the right end of the tab bar:
3447
- * `− [────slider────] + 100%`. Live-updates the cell scale on input. */
3448
- private buildZoomControl;
3449
- /** Map a slider position [0,100] to a scale factor. 50 → 1.0 (100%), with a
3450
- * separate linear segment on each side so the center is always 100%. */
3451
- private zoomPosToScale;
3452
- /** Inverse of {@link zoomPosToScale}: scale factor → slider position [0,100]. */
3453
- private zoomScaleToPos;
3454
- /**
3455
- * IX9 {@link ZoomableViewer} — set the cell/header scale (`1` = 100%; the
3456
- * viewer's `cellScale`) and re-lay-out the current sheet. Clamped to the zoom
3457
- * bounds and snapped to whole percent; keeps the slider thumb, percentage label
3458
- * in sync, and fires `onScaleChange` when the resolved scale actually changes.
3459
- */
3460
- setScale(scale: number): void;
3461
- /** IX9 {@link ZoomableViewer} — the current zoom factor (`1` = 100%). This is
3462
- * the viewer's `cellScale`; `1` before anything is set. */
3463
- getScale(): number;
3464
- /** IX9 {@link ZoomableViewer} — step up to the next rung of the shared zoom
3465
- * ladder (clamped to `zoomMax` by {@link setScale}). */
3466
- zoomIn(): void;
3467
- /** IX9 {@link ZoomableViewer} — step down to the next lower ladder rung. */
3468
- zoomOut(): void;
3469
- /**
3470
- * IX9 {@link ZoomableViewer} — fit the used data range's WIDTH to the canvas
3471
- * area. The "content" is the natural (100%) width of the row header plus the
3472
- * used columns; the container is `canvasArea.clientWidth`. A no-op (defers) when
3473
- * nothing is loaded or the container is unlaid-out. Routes through
3474
- * {@link setScale}, so the result is clamped/snapped and fires `onScaleChange`.
3475
- */
3476
- fitWidth(): void;
3477
- /**
3478
- * IX9 {@link ZoomableViewer} — fit the used data range's WIDTH AND HEIGHT inside
3479
- * the canvas area (header + used columns/rows), so the whole used range is
3480
- * visible without scrolling. Takes the tighter of the width- and height-fit
3481
- * factors. Defers when unloaded / unlaid-out; routes through {@link setScale}.
3482
- */
3483
- fitPage(): void;
3484
- /** Shared fit implementation for {@link fitWidth} / {@link fitPage}: derive the
3485
- * natural (cs=1) content extent of the used data range, ask core's pure
3486
- * {@link fitScale} for the factor, and apply it via {@link setScale}. */
3487
- private _fit;
3488
- /** Natural (unscaled, cs=1) CSS-px extent of a worksheet's used data range:
3489
- * the row/column header plus every used column width / row height. Mirrors
3490
- * {@link updateSpacerSize} at cs=1 (same used-range detection) so the fit
3491
- * targets exactly the region the spacer/scroll extent covers. */
3492
- private _naturalContentExtent;
3493
- private updateSpacerSize;
3494
- /**
3495
- * Coalesce a re-render into the next animation frame. Called from the
3496
- * high-frequency event-driven paths (scroll, live column/row resize, drag-
3497
- * selection, container resize); a burst of these within one frame schedules a
3498
- * single {@link renderCurrentSheet}, avoiding the previous behavior where every
3499
- * scroll event forced its own synchronous full redraw. Already-scheduled frames
3500
- * are not re-scheduled — the one pending render reads the live scroll/scale
3501
- * state when it runs, so the most recent position always wins without threading
3502
- * a coordinate through. Falls back to a synchronous render when
3503
- * `requestAnimationFrame` is unavailable (e.g. a non-DOM host), preserving the
3504
- * old semantics there.
3505
- */
3506
- private scheduleRender;
3507
- private renderCurrentSheet;
3508
- /** Route a render failure to `onError`, or `console.error` when none is given
3509
- * (never fully silent), and never after teardown. Mirrors the scroll viewers'
3510
- * `_reportRenderError`. */
3511
- private _reportRenderError;
3512
- private _renderCurrentSheet;
3513
- private computeHeaderHighlight;
3514
- get sheetNames(): string[];
3515
- /** The underlying <canvas> element the grid is drawn on. */
3516
- get canvasElement(): HTMLCanvasElement;
3517
- /** Latest content-free resource metrics for the loaded workbook. */
3518
- getResourceMetrics(): Promise<OoxmlResourceMetrics>;
3519
- /**
3520
- * Tear down the viewer and release resources.
3521
- *
3522
- * The caller's container is returned to the state it had before construction
3523
- * (empty): the entire wrapper subtree the constructor appended is removed.
3524
- * All document-level listeners are detached — the keydown handler here, and
3525
- * the validation-panel outside-click handler via {@link hideValidationPanel}.
3526
- * Listeners on elements inside the wrapper (scrollHost, tabs, …) need no
3527
- * explicit removal: removing the subtree makes them unreachable and eligible
3528
- * for GC. Safe to call more than once.
3529
- *
3530
- * NOTE: the shared `<style>` in `document.head` is intentionally NOT removed —
3531
- * it is a class constant that any still-live viewer may depend on, and one
3532
- * leftover sheet is a bounded, harmless cost (see {@link ensureViewerStyleInjected}).
3533
- */
3534
- destroy(): void;
1322
+ anchor: CellAddress;
1323
+ active: CellAddress;
1324
+ mode: SelectionMode;
1325
+ }
1326
+ type XlsxViewerMount = {
1327
+ readonly kind: 'composite';
1328
+ } | {
1329
+ readonly kind: 'sheet';
1330
+ readonly canvas: HTMLCanvasElement;
1331
+ readonly mode: CanvasViewerRenderMode;
1332
+ };
1333
+ declare class XlsxViewerEngine implements ZoomableViewer {
1334
+ private readonly hostDocument;
1335
+ private readonly hostWindow;
1336
+ private readonly acquisition;
1337
+ private readonly viewport;
1338
+ private readonly renderDispatcher;
1339
+ private wrapper;
1340
+ private canvas;
1341
+ private gridRegion;
1342
+ private rowGutter;
1343
+ private colGutter;
1344
+ private cornerGutter;
1345
+ private gutter;
1346
+ private rowOutline;
1347
+ private colOutline;
1348
+ private rowOutlineBands;
1349
+ private colOutlineBands;
1350
+ private stashedRowHeights;
1351
+ private stashedColWidths;
1352
+ private sizeOverrideStore;
1353
+ private readonly projectionId;
1354
+ private canvasArea;
1355
+ private scrollHost;
1356
+ private spacer;
1357
+ private readonly surface;
1358
+ private readonly overlayHost;
1359
+ private tabBar;
1360
+ private tabStrip;
1361
+ private tabList;
1362
+ private navPrev;
1363
+ private navNext;
1364
+ private tabs;
1365
+ private tabColors;
1366
+ private zoomSlider;
1367
+ private zoomLabel;
1368
+ private currentSheet;
1369
+ private sheetRequestGeneration;
1370
+ private fontBindingGeneration;
1371
+ private fontBinding;
1372
+ private _hiddenSheetMode;
1373
+ private currentWorksheet;
1374
+ private sheetViews;
1375
+ private opts;
1376
+ private readonly _mountKind;
1377
+ private readonly _mode;
1378
+ private _borrowed;
1379
+ private preparedWorkbook;
1380
+ private _destroyed;
1381
+ private resizeObserver;
1382
+ private _lastViewportNotification;
1383
+ private get anchorCell();
1384
+ private set anchorCell(value);
1385
+ private get activeCell();
1386
+ private set activeCell(value);
1387
+ private get selectionMode();
1388
+ private set selectionMode(value);
1389
+ private get isSelecting();
1390
+ private set isSelecting(value);
1391
+ private _pendingZoomAnchor;
1392
+ private readonly selectionController;
1393
+ private selectionOverlay;
1394
+ private findOverlay;
1395
+ private _find;
1396
+ private keydownHandler;
1397
+ private pendingTap;
1398
+ private pendingClick;
1399
+ private resizeDrag;
1400
+ private commentPopup;
1401
+ private commentMap;
1402
+ private hyperlinkMap;
1403
+ private commentPopupKey;
1404
+ private commentPopupTimer;
1405
+ private validationPanel;
1406
+ private validationPanelKey;
1407
+ private validationRequestGeneration;
1408
+ private validationArrowRect;
1409
+ private validationOutsideHandler;
1410
+ constructor(container: HTMLElement, opts: XlsxViewerOptions | XlsxSheetViewerOptions | undefined, mount: XlsxViewerMount);
1411
+ private _collectSheetCells;
1412
+ load(source: string | ArrayBuffer): Promise<void>;
1413
+ private activateWorkbook;
1414
+ private ensureHostFonts;
1415
+ private releaseHostFonts;
1416
+ private prepareWorkbook;
1417
+ private get workbook();
1418
+ private get wb();
1419
+ private set wb(value);
1420
+ showSheet(index: number): Promise<void>;
1421
+ private isCurrentSheetRequest;
1422
+ private buildOutline;
1423
+ private layoutGutters;
1424
+ private renderGutters;
1425
+ private paintAxisGutter;
1426
+ private drawToggleBox;
1427
+ private drawLevelButton;
1428
+ private paintCornerGutter;
1429
+ private onGutterPointerDown;
1430
+ private applyGroupToggle;
1431
+ private applyLevelButton;
1432
+ private setBandHidden;
1433
+ private recordSizeOverride;
1434
+ private wireSizeOverrides;
1435
+ private setBandCollapsed;
1436
+ private afterOutlineMutation;
1437
+ private buildOutlineLayoutOnly;
1438
+ private get isRtl();
1439
+ private updateFooterDirection;
1440
+ private get maxScrollLeft();
1441
+ private get maxScrollTop();
1442
+ private syncNativeViewportExtent;
1443
+ private get viewportTop();
1444
+ private set viewportTop(value);
1445
+ private get effectiveScrollLeft();
1446
+ private setViewportLeft;
1447
+ private screenX;
1448
+ private resetHorizontalScroll;
1449
+ private reanchorHorizontalScroll;
1450
+ get sheetIndex(): number;
1451
+ get sheetCount(): number;
1452
+ goToSheet(index: number): Promise<void>;
1453
+ nextSheet(): Promise<void>;
1454
+ prevSheet(): Promise<void>;
1455
+ getViewportOffset(): XlsxViewportOffset;
1456
+ private emitViewportChange;
1457
+ setViewportOffset(offset: XlsxViewportOffset): Promise<void>;
1458
+ relayout(): Promise<void>;
1459
+ scrollToCell(ref: string, options?: XlsxScrollToCellOptions): Promise<void>;
1460
+ private _stepSheet;
1461
+ private _initialSheet;
1462
+ getCellAt(clientX: number, clientY: number): CellAddress | null;
1463
+ private getCellRect;
1464
+ get selection(): CellRange | null;
1465
+ select(ref: string): void;
1466
+ private getHeaderHit;
1467
+ private getResizeTarget;
1468
+ private applyResize;
1469
+ setSelectionColor(color: string): void;
1470
+ setHiddenSheetMode(mode: HiddenSheetMode): Promise<void>;
1471
+ get hiddenSheetMode(): HiddenSheetMode;
1472
+ get visibleSheetCount(): number;
1473
+ private copySelection;
1474
+ private updateSelectionOverlay;
1475
+ private maybeDrawValidationDropdown;
1476
+ private updateFindOverlay;
1477
+ findText(query: string, opts?: FindMatchesOptions): Promise<FindMatch<XlsxMatchLocation>[]>;
1478
+ findNext(): Promise<FindMatch<XlsxMatchLocation> | null>;
1479
+ findPrev(): Promise<FindMatch<XlsxMatchLocation> | null>;
1480
+ clearFind(): void;
1481
+ private _activateMatch;
1482
+ private _scrollCellIntoView;
1483
+ private toggleValidationPanel;
1484
+ private openValidationPanel;
1485
+ private isCurrentValidationRequest;
1486
+ private renderValidationPanel;
1487
+ private positionValidationPanel;
1488
+ private installValidationOutsideHandler;
1489
+ private hideValidationPanel;
1490
+ private buildCommentMap;
1491
+ private buildHyperlinkMap;
1492
+ private hyperlinkAtCell;
1493
+ private dispatchHyperlink;
1494
+ private navigateInternalHyperlink;
1495
+ private scheduleCommentPopup;
1496
+ private renderCommentPopup;
1497
+ private hideCommentPopup;
1498
+ private applyPointerSelection;
1499
+ private setupSelectionEvents;
1500
+ private buildTabs;
1501
+ private makeNavButton;
1502
+ private navButtonStyle;
1503
+ private scrollTabs;
1504
+ private updateNavButtons;
1505
+ private updateTabActive;
1506
+ private tabStyle;
1507
+ private tabCss;
1508
+ private buildZoomControl;
1509
+ private zoomPosToScale;
1510
+ private zoomScaleToPos;
1511
+ setScale(scale: number): void;
1512
+ getScale(): number;
1513
+ zoomIn(): void;
1514
+ zoomOut(): void;
1515
+ fitWidth(): void;
1516
+ fitPage(): void;
1517
+ private _fit;
1518
+ private _naturalContentExtent;
1519
+ private updateSpacerSize;
1520
+ private scheduleRender;
1521
+ private renderCurrentSheet;
1522
+ private _reportRenderError;
1523
+ private _renderCurrentSheet;
1524
+ private computeHeaderHighlight;
1525
+ get sheetNames(): string[];
1526
+ get canvasElement(): HTMLCanvasElement;
1527
+ getResourceMetrics(): Promise<OoxmlResourceMetrics>;
1528
+ destroy(): void;
1529
+ private assertOpen;
1530
+ private destroyedError;
1531
+ }
1532
+ declare class XlsxViewer extends XlsxViewerEngine {
1533
+ static fromWorkbook(container: HTMLElement, workbook: XlsxWorkbook, opts?: Omit<XlsxViewerOptions, keyof LoadOptions$1>): Omit<XlsxViewer, 'load'>;
1534
+ constructor(container: HTMLElement, opts?: XlsxViewerOptions);
1535
+ }
1536
+ declare class XlsxSheetViewer implements ZoomableViewer {
1537
+ readonly canvasElement: HTMLCanvasElement;
1538
+ private readonly engine;
1539
+ private readonly canvasMount;
1540
+ private destroyed;
1541
+ private snapshot;
1542
+ private lastMetrics;
1543
+ static fromWorkbook(canvasElement: HTMLCanvasElement, workbook: XlsxWorkbook, options?: Omit<XlsxSheetViewerOptions, keyof LoadOptions$1>): Omit<XlsxSheetViewer, 'load'>;
1544
+ constructor(canvasElement: HTMLCanvasElement, options?: XlsxSheetViewerOptions);
1545
+ load(source: string | ArrayBuffer): Promise<void>;
1546
+ get sheetIndex(): number;
1547
+ get sheetCount(): number;
1548
+ get sheetNames(): string[];
1549
+ goToSheet(index: number): Promise<void>;
1550
+ nextSheet(): Promise<void>;
1551
+ prevSheet(): Promise<void>;
1552
+ getViewportOffset(): XlsxViewportOffset;
1553
+ setViewportOffset(offset: XlsxViewportOffset): Promise<void>;
1554
+ scrollToCell(ref: string, options?: XlsxScrollToCellOptions): Promise<void>;
1555
+ relayout(): Promise<void>;
1556
+ getScale(): number;
1557
+ setScale(scale: number): void;
1558
+ zoomIn(): void;
1559
+ zoomOut(): void;
1560
+ fitWidth(): void;
1561
+ fitPage(): void;
1562
+ getCellAt(clientX: number, clientY: number): CellAddress | null;
1563
+ get selection(): CellRange | null;
1564
+ select(ref: string): void;
1565
+ setSelectionColor(color: string): void;
1566
+ setHiddenSheetMode(mode: HiddenSheetMode): Promise<void>;
1567
+ get hiddenSheetMode(): HiddenSheetMode;
1568
+ get visibleSheetCount(): number;
1569
+ findText(query: string, options?: FindMatchesOptions): Promise<FindMatch<XlsxMatchLocation>[]>;
1570
+ findNext(): Promise<FindMatch<XlsxMatchLocation> | null>;
1571
+ findPrev(): Promise<FindMatch<XlsxMatchLocation> | null>;
1572
+ clearFind(): void;
1573
+ getResourceMetrics(): Promise<OoxmlResourceMetrics>;
1574
+ destroy(): void;
1575
+ private captureSnapshot;
1576
+ private assertOpen;
1577
+ private destroyedError;
3535
1578
  }
3536
- //#endregion
3537
- //#region packages/xlsx/src/shared-strings.d.ts
3538
- /**
3539
- * Resolve every `{ type: 'shared', si }` cell in `ws` to a concrete
3540
- * `{ type: 'text', text, runs? }` by looking `si` up in the workbook
3541
- * `sharedStrings` table (ECMA-376 §18.4.8). Mutates cells in place and returns
3542
- * `ws` for chaining. Out-of-range / missing `si` resolves to empty text —
3543
- * matching the parser's historical fallback. Idempotent: a `Worksheet` with no
3544
- * `shared` cells is returned unchanged.
3545
- *
3546
- * This keeps the dedup win on the wire (each shared string ships ONCE in the
3547
- * workbook) while every downstream consumer — renderer, formula engine, number
3548
- * formatter, markdown — still sees fully-resolved cell text.
3549
- */
3550
1579
  declare function resolveSharedStrings(ws: Worksheet, sharedStrings: SharedString[]): Worksheet;
3551
1580
  //#endregion
3552
- export { type AutoResizeOptions, type Border, type BorderEdge, type Cell, type CellAddress, type CellFill, type CellFont, type CellRange, type CellValue, type CellXf, type CfIcon, type CfRule, type CfStop, type CfValue, type ChartAnchor, type ChartDataLabelOverride, type ChartDataPointOverride, type ChartErrBars, type ChartManualLayout, type ChartModel, type ChartSeries, type ChartSeriesDataLabels, type ConditionalFormat, type DataLabelOverride, type DataPointOverride, type DataValidation, type DefinedName, type Duotone, type Dxf, type ErrBars, type FindHighlightColors, type FindMatch, type FindMatchesOptions, type GradientFillSpec, type HiddenSheetMode, type Hyperlink, type HyperlinkTarget, type ImageAnchor, type LegendManualLayout, type LoadOptions, type ManualLayout, type MergeCell, type NumFmt, OoxmlDecodedImageLimitError, type OoxmlDecodedImageLimitMetric, OoxmlError, type OoxmlErrorCode, type OoxmlErrorSource, type OoxmlErrorStage, type OoxmlFormat, type OoxmlResourceLimit, OoxmlResourceLimitError, type OoxmlResourceLimitErrorDetails, type OoxmlResourceLimits, type OoxmlResourceMetric, type OoxmlResourceMetrics, type OoxmlResourceMetricsCheckpoint, type OoxmlResourceName, type OoxmlResourcePolicySnapshot, type OoxmlResourceUsageSnapshot, type OoxmlResourceViolation, type OutlinePr, type ParsedWorkbook, type PathCmd, type PathInfo, type PhoneticAlignment, type PhoneticProperties, type PhoneticRun, type PhoneticType, type PivotCacheSource, type PivotDataField, type PivotDiagnostic, type PivotLocation, type PivotMetadataStatus, type PivotPageField, type PivotPartialReason, type PivotTableMetadata, type RenderViewportOptions, type ResolvedList, type Row, type Run, type RunFont, type SelectionMode, type SeriesDataLabels, type ShapeAnchor, type ShapeGeom, type ShapeInfo, type ShapeParagraph, type ShapeText, type ShapeTextRun, type SharedString, type SheetMeta, type SheetVisibility, type SlicerAnchor, type SlicerElementStyle, type SlicerItem, type SlicerStyle, type Sparkline, type SparklineGroup, type Styles, type TableColumnInfo, type TableInfo, type ViewportRange, type WireRenderViewportOptions, type WireSizeOverrides, type Workbook, type Worksheet, type XlsxChartSeries, type XlsxComment, type XlsxMatchLocation, type XlsxTextRunInfo, XlsxViewer, type XlsxViewerOptions, XlsxWorkbook, autoResize, isOoxmlDecodedImageLimitError, openExternalHyperlink, resolveSharedStrings };
1581
+ export { type AutoResizeOptions, type Border, type BorderEdge, type Cell, type CellAddress, type CellFill, type CellFont, type CellRange, type CellValue, type CellXf, type CfIcon, type CfRule, type CfStop, type CfValue, type ChartAnchor, type ChartDataLabelOverride, type ChartDataPointOverride, type ChartErrBars, type ChartManualLayout, type ChartModel, type ChartSeries, type ChartSeriesDataLabels, type ConditionalFormat, type DataLabelOverride, type DataPointOverride, type DataValidation, type DefinedName, type Duotone, type Dxf, type ErrBars, type FindHighlightColors, type FindMatch, type FindMatchesOptions, type GradientFillSpec, type HiddenSheetMode, type Hyperlink, type HyperlinkTarget, type ImageAnchor, type LegendManualLayout, type LoadOptions, type ManualLayout, type MergeCell, type NumFmt, OoxmlDecodedImageLimitError, type OoxmlDecodedImageLimitMetric, OoxmlError, type OoxmlErrorCode, type OoxmlErrorSource, type OoxmlErrorStage, type OoxmlFormat, type OoxmlResourceLimit, OoxmlResourceLimitError, type OoxmlResourceLimitErrorDetails, type OoxmlResourceLimits, type OoxmlResourceMetric, type OoxmlResourceMetrics, type OoxmlResourceMetricsCheckpoint, type OoxmlResourceName, type OoxmlResourcePolicySnapshot, type OoxmlResourceUsageSnapshot, type OoxmlResourceViolation, type OutlinePr, type ParsedWorkbook, type PathCmd, type PathInfo, type PhoneticAlignment, type PhoneticProperties, type PhoneticRun, type PhoneticType, type PivotCacheSource, type PivotDataField, type PivotDiagnostic, type PivotLocation, type PivotMetadataStatus, type PivotPageField, type PivotPartialReason, type PivotTableMetadata, type RenderViewportOptions, type ResolvedList, type Row, type Run, type RunFont, type SelectionMode, type SeriesDataLabels, type ShapeAnchor, type ShapeGeom, type ShapeInfo, type ShapeParagraph, type ShapeText, type ShapeTextRun, type SharedString, type SheetMeta, type SheetVisibility, type SlicerAnchor, type SlicerElementStyle, type SlicerItem, type SlicerStyle, type Sparkline, type SparklineGroup, type Styles, type TableColumnInfo, type TableInfo, type ViewportRange, type WireRenderViewportOptions, type WireSizeOverrides, type Workbook, type Worksheet, type XlsxChartSeries, type XlsxComment, type XlsxMatchLocation, type XlsxScrollToCellOptions, XlsxSheetViewer, type XlsxSheetViewerOptions, type XlsxTextRunInfo, XlsxViewer, type XlsxViewerOptions, type XlsxViewportOffset, XlsxWorkbook, autoResize, isOoxmlDecodedImageLimitError, openExternalHyperlink, resolveSharedStrings };