@silurus/ooxml 0.70.2 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -6
- package/THIRD_PARTY_NOTICES.md +356 -0
- package/dist/docx-BPF-eH0O.js +10183 -0
- package/dist/docx.mjs +3 -3
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{line-metrics-DG9p1RvA.js → find-cursor-DTrEBxjE.js} +15946 -6230
- package/dist/highlight-rect-B--cPQOV.js +881 -0
- package/dist/index.mjs +4 -4
- package/dist/math.mjs +1 -1
- package/dist/pptx-BMxDfEYI.js +6641 -0
- package/dist/pptx.mjs +3 -3
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/render-worker-host-DL_kkykF.js +27 -0
- package/dist/render-worker-host-S0HOWgs0.js +27 -0
- package/dist/render-worker-host-l8yqDUfE.js +27 -0
- package/dist/{segments-BTivjRMw.js → segments-Da-soh2U.js} +1 -1
- package/dist/types/docx.d.ts +2109 -45
- package/dist/types/index.d.ts +2867 -96
- package/dist/types/pptx.d.ts +1302 -40
- package/dist/types/xlsx.d.ts +1229 -14
- package/dist/visible-index-5hdq_oAL.js +50 -0
- package/dist/{xlsx-B1XUgnO7.js → xlsx-bwQD8c1Q.js} +2209 -1214
- package/dist/xlsx.mjs +3 -3
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +5 -2
- package/dist/docx-BKsYFx78.js +0 -3895
- package/dist/pptx-B4xa92BQ.js +0 -3325
- package/dist/render-worker-host-2V2UCnvB.js +0 -27
- package/dist/render-worker-host-BcmXt3yA.js +0 -27
- package/dist/render-worker-host-UUYE6Oqt.js +0 -27
- package/dist/virtual-scroll-CsikPntn.js +0 -873
- package/dist/visible-index-B4ljB_dg.js +0 -1266
- /package/dist/{mathjax-BRfWlbSJ.js → mathjax-Dk_JzbFj.js} +0 -0
package/dist/types/xlsx.d.ts
CHANGED
|
@@ -46,14 +46,23 @@ export declare interface BorderEdge {
|
|
|
46
46
|
export declare interface Cell {
|
|
47
47
|
col: number;
|
|
48
48
|
row: number;
|
|
49
|
-
colRef: string;
|
|
50
49
|
value: CellValue;
|
|
51
|
-
|
|
50
|
+
/** Style index into the styles table. Omitted on the wire when `0` (the
|
|
51
|
+
* common unstyled case), so read it as `styleIndex ?? 0`. */
|
|
52
|
+
styleIndex?: number;
|
|
52
53
|
/** Raw `<f>` formula text (ECMA-376 §18.3.1.40), when present. The renderer
|
|
53
54
|
* uses this to recompute volatile functions (TODAY, NOW) at display time
|
|
54
55
|
* so the cached `<v>` — frozen when the file was last saved — doesn't
|
|
55
56
|
* show a stale date. */
|
|
56
57
|
formula?: string;
|
|
58
|
+
/** Whether this cell displays its phonetic hint (furigana). The parser
|
|
59
|
+
* resolves it as `cell/@ph ?? row/@ph ?? false` — the per-cell `<c ph>`
|
|
60
|
+
* (ECMA-376 §18.3.1.4) wins when present (an explicit `ph="0"` overrides an
|
|
61
|
+
* enabled row), otherwise the row-level `<row ph>` (§18.3.1.73) is inherited,
|
|
62
|
+
* otherwise the schema default (false). Omitted on the wire when false, so
|
|
63
|
+
* read as `showPhonetic ?? false`. A cell whose String Item carries `<rPh>`
|
|
64
|
+
* runs still shows NO furigana unless the resolved value is true. */
|
|
65
|
+
showPhonetic?: boolean;
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
export declare interface CellAddress {
|
|
@@ -102,6 +111,15 @@ export declare type CellValue = {
|
|
|
102
111
|
type: 'text';
|
|
103
112
|
text: string;
|
|
104
113
|
runs?: Run[];
|
|
114
|
+
/** ECMA-376 §18.4.6 phonetic runs (furigana) carried over from the
|
|
115
|
+
* resolved String Item. Present for inline strings, and populated by
|
|
116
|
+
* {@link resolveSharedStrings} for shared-string cells. Absent when the
|
|
117
|
+
* string has no furigana. */
|
|
118
|
+
phoneticRuns?: PhoneticRun[];
|
|
119
|
+
/** ECMA-376 §18.4.3 phonetic display properties (font index / char set /
|
|
120
|
+
* alignment) for the furigana above. Absent when the `<si>` had no
|
|
121
|
+
* `<phoneticPr>`. */
|
|
122
|
+
phoneticPr?: PhoneticProperties;
|
|
105
123
|
} | {
|
|
106
124
|
type: 'number';
|
|
107
125
|
number: number;
|
|
@@ -111,6 +129,14 @@ export declare type CellValue = {
|
|
|
111
129
|
} | {
|
|
112
130
|
type: 'error';
|
|
113
131
|
error: string;
|
|
132
|
+
}
|
|
133
|
+
/** Shared-string reference into `ParsedWorkbook.sharedStrings` (ECMA-376
|
|
134
|
+
* §18.4.8). Resolved to `{ type: 'text', ... }` by the workbook before the
|
|
135
|
+
* renderer (or any other consumer) sees it, so downstream code never
|
|
136
|
+
* encounters this variant. */
|
|
137
|
+
| {
|
|
138
|
+
type: 'shared';
|
|
139
|
+
si: number;
|
|
114
140
|
};
|
|
115
141
|
|
|
116
142
|
export declare interface CellXf {
|
|
@@ -223,6 +249,30 @@ export declare interface ChartDataLabelOverride {
|
|
|
223
249
|
fontSizeHpt?: number;
|
|
224
250
|
/** `<a:defRPr b="1">` inside the per-idx rich text. */
|
|
225
251
|
fontBold?: boolean;
|
|
252
|
+
/** Per-point callout box (`<c:dLbl><c:spPr>`, ECMA-376 §21.2.2.47/§21.2.2.197):
|
|
253
|
+
* overrides the series-default box for this one slice. */
|
|
254
|
+
labelBox?: ChartLabelBox;
|
|
255
|
+
/**
|
|
256
|
+
* Per-point label-content flags (`<c:dLbl>` §21.2.2.47 carries the same
|
|
257
|
+
* show-flag group as the series `<c:dLbls>` §21.2.2.49: §21.2.2.189
|
|
258
|
+
* `<c:showVal>`, §21.2.2.177 `<c:showCatName>`, §21.2.2.180 `<c:showSerName>`,
|
|
259
|
+
* §21.2.2.187 `<c:showPercent>`). When present they OVERRIDE the series-level
|
|
260
|
+
* defaults for that one point (e.g. sample-14 slide-7's pie sets
|
|
261
|
+
* `showCatName=0 showPercent=1` per slice while the series default is
|
|
262
|
+
* `showCatName=1`, so each label is percent only). undefined = inherit the
|
|
263
|
+
* series default for that flag.
|
|
264
|
+
*/
|
|
265
|
+
showVal?: boolean;
|
|
266
|
+
showCatName?: boolean;
|
|
267
|
+
showSerName?: boolean;
|
|
268
|
+
showPercent?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* `<c:dLbl><c:delete val="1"/>` (ECMA-376 §21.2.2.43) — the point's label is
|
|
271
|
+
* removed. Distinguishes a genuine delete from a `<c:dLbl>` that only carries
|
|
272
|
+
* style / flag overrides with no `<c:tx>` (both otherwise present as
|
|
273
|
+
* `text === ''`). true = skip the label; undefined/absent = not deleted.
|
|
274
|
+
*/
|
|
275
|
+
deleted?: boolean;
|
|
226
276
|
}
|
|
227
277
|
|
|
228
278
|
export declare interface ChartDataPointOverride {
|
|
@@ -233,6 +283,18 @@ export declare interface ChartDataPointOverride {
|
|
|
233
283
|
markerSize?: number;
|
|
234
284
|
markerFill?: string;
|
|
235
285
|
markerLine?: string;
|
|
286
|
+
/**
|
|
287
|
+
* `<c:dPt><c:explosion val>` (ECMA-376 §21.2.2.61) — the amount this
|
|
288
|
+
* pie/doughnut slice is moved out from the center. The schema type is
|
|
289
|
+
* `CT_UnsignedInt` (unbounded `xsd:unsignedInt`); the spec text only says
|
|
290
|
+
* "the amount the data point shall be moved from the center of the pie"
|
|
291
|
+
* and does not itself define units or a 0–100 range. We treat it as a
|
|
292
|
+
* de-facto percentage of the outer radius (0–100 typical), matching
|
|
293
|
+
* Office's UI (the Point Explosion slider caps at 100%) rather than a
|
|
294
|
+
* spec-mandated bound. undefined/absent = 0 (no explosion, flush with the
|
|
295
|
+
* ring). Only consulted by the pie/doughnut renderer.
|
|
296
|
+
*/
|
|
297
|
+
explosion?: number;
|
|
236
298
|
}
|
|
237
299
|
|
|
238
300
|
export declare interface ChartErrBars {
|
|
@@ -250,6 +312,74 @@ export declare interface ChartErrBars {
|
|
|
250
312
|
dash?: string;
|
|
251
313
|
}
|
|
252
314
|
|
|
315
|
+
/**
|
|
316
|
+
* One box-and-whisker series (chartEx `boxWhisker`, MS 2014 chartex ext). Each
|
|
317
|
+
* `<cx:series>` references its own raw sample points via `<cx:dataId>`; the
|
|
318
|
+
* parser groups them by category and threads the `<cx:layoutPr>` flags. The
|
|
319
|
+
* renderer derives the statistics.
|
|
320
|
+
*/
|
|
321
|
+
declare interface ChartexBoxSeries {
|
|
322
|
+
/** Series display name (`<cx:tx><cx:v>`). */
|
|
323
|
+
name: string;
|
|
324
|
+
/** Fill (hex, no '#') — theme accent cycled by series index. null = fall
|
|
325
|
+
* back to the renderer palette. */
|
|
326
|
+
color?: string | null;
|
|
327
|
+
/** Raw sample values grouped by category (outer = category index parallel to
|
|
328
|
+
* {@link ChartexBoxWhisker.categories}, inner = the points in that group). */
|
|
329
|
+
valuesByCategory: number[][];
|
|
330
|
+
/** `<cx:visibility meanMarker>` — draw the mean `×`. */
|
|
331
|
+
meanMarker: boolean;
|
|
332
|
+
/** `<cx:visibility meanLine>` — draw a mean connector line across categories. */
|
|
333
|
+
meanLine: boolean;
|
|
334
|
+
/** `<cx:visibility outliers>` — draw outlier points. */
|
|
335
|
+
showOutliers: boolean;
|
|
336
|
+
/** `<cx:visibility nonoutliers>` — draw the interior (non-outlier) sample
|
|
337
|
+
* points as jittered dots on top of the box. Flag parsed; interior-dot
|
|
338
|
+
* rendering is pending a fixture that enables it (every sample-24 series
|
|
339
|
+
* ships `nonoutliers="0"`, so there is nothing to verify against yet). */
|
|
340
|
+
showNonoutliers: boolean;
|
|
341
|
+
/** `<cx:statistics quartileMethod>` — "exclusive" (Excel default) | "inclusive". */
|
|
342
|
+
quartileMethod: string;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** A chartEx box-and-whisker chart: unique categories + one series per column. */
|
|
346
|
+
declare interface ChartexBoxWhisker {
|
|
347
|
+
/** Unique category labels in first-seen order. */
|
|
348
|
+
categories: string[];
|
|
349
|
+
/** One entry per `<cx:series>`. */
|
|
350
|
+
series: ChartexBoxSeries[];
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** A chartEx sunburst: the flat rows the renderer folds into a ring tree. */
|
|
354
|
+
declare interface ChartexSunburst {
|
|
355
|
+
rows: ChartexSunburstRow[];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* One row of a chartEx `sunburst`: the branch→…→leaf label chain (empty
|
|
360
|
+
* trailing segments trimmed) and its size value.
|
|
361
|
+
*/
|
|
362
|
+
declare interface ChartexSunburstRow {
|
|
363
|
+
/** Label chain root→leaf. */
|
|
364
|
+
path: string[];
|
|
365
|
+
/** `<cx:numDim type="size">` value attaching to the deepest node in `path`. */
|
|
366
|
+
size: number;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Callout-box style for a pie/doughnut data label — the white (or themed)
|
|
370
|
+
* rounded rectangle with a thin border Word draws around a `bestFit` label
|
|
371
|
+
* placed outside its slice. From the label's `<c:spPr>` (§21.2.2.197). All
|
|
372
|
+
* fields optional: absent → transparent / unbordered. Mirror of Rust
|
|
373
|
+
* `ChartLabelBox`. */
|
|
374
|
+
declare interface ChartLabelBox {
|
|
375
|
+
/** `<a:solidFill>` resolved hex (no `#`). Box background. */
|
|
376
|
+
fill?: string;
|
|
377
|
+
/** `<a:ln><a:solidFill>` resolved hex (no `#`). Border stroke. */
|
|
378
|
+
borderColor?: string;
|
|
379
|
+
/** `<a:ln w>` border width in EMU (12700 EMU = 1 pt). */
|
|
380
|
+
borderWidthEmu?: number;
|
|
381
|
+
}
|
|
382
|
+
|
|
253
383
|
/**
|
|
254
384
|
* `<c:manualLayout>` block. Fractions are of the chart-space rect.
|
|
255
385
|
* `xMode`/`yMode`: "edge" = absolute fraction from top-left, "factor" =
|
|
@@ -270,6 +400,14 @@ export declare interface ChartModel {
|
|
|
270
400
|
title: string | null;
|
|
271
401
|
categories: string[];
|
|
272
402
|
series: ChartSeries[];
|
|
403
|
+
/**
|
|
404
|
+
* §21.2.2.227 `<c:varyColors val="1"/>` on a SINGLE-series bar/column chart:
|
|
405
|
+
* color each data point (bar) from the theme/palette sequence and list one
|
|
406
|
+
* legend entry per point, matching Office. Set by the shared parser ONLY for
|
|
407
|
+
* that non-pie, single-series case (pie/doughnut already vary by point via
|
|
408
|
+
* `chartType` + `dataPointColors`); absent/false otherwise.
|
|
409
|
+
*/
|
|
410
|
+
varyColors?: boolean | null;
|
|
273
411
|
/** Show data labels on bars / points / slices. */
|
|
274
412
|
showDataLabels: boolean;
|
|
275
413
|
/** Explicit Y-axis minimum (OOXML `<c:valAx><c:min>`). */
|
|
@@ -380,6 +518,35 @@ export declare interface ChartModel {
|
|
|
380
518
|
valAxisTitleFontBold?: boolean | null;
|
|
381
519
|
/** `<c:valAx><c:title>` run-prop color (hex without '#'). null = default. */
|
|
382
520
|
valAxisTitleFontColor?: string | null;
|
|
521
|
+
/** `<c:catAx><c:txPr>…<a:latin typeface>` tick-label font. */
|
|
522
|
+
catAxisFontFace?: string | null;
|
|
523
|
+
/** `<c:valAx><c:txPr>…<a:latin typeface>` tick-label font. */
|
|
524
|
+
valAxisFontFace?: string | null;
|
|
525
|
+
/** `<c:catAx><c:title>…<a:latin typeface>` axis-title font. */
|
|
526
|
+
catAxisTitleFontFace?: string | null;
|
|
527
|
+
/** `<c:valAx><c:title>…<a:latin typeface>` axis-title font. */
|
|
528
|
+
valAxisTitleFontFace?: string | null;
|
|
529
|
+
/** `<c:dLbls><c:txPr>…<a:latin typeface>` data-label font. */
|
|
530
|
+
dataLabelFontFace?: string | null;
|
|
531
|
+
/** `<c:legend><c:txPr>…<a:latin typeface>` legend font. */
|
|
532
|
+
legendFontFace?: string | null;
|
|
533
|
+
/** `<c:legend><c:txPr>…<a:solidFill>` legend text color (hex without '#'). */
|
|
534
|
+
legendFontColor?: string | null;
|
|
535
|
+
/** `<c:legend><c:txPr>` legend font size (OOXML hundredths of a point). */
|
|
536
|
+
legendFontSizeHpt?: number | null;
|
|
537
|
+
/** `<c:legend><c:txPr>…defRPr@b` legend bold flag. */
|
|
538
|
+
legendFontBold?: boolean | null;
|
|
539
|
+
/**
|
|
540
|
+
* Theme font-scheme faces (`<a:fontScheme>`, ECMA-376 §20.1.4.2). Latin
|
|
541
|
+
* heading (majorFont) and body (minorFont) typefaces, used as the fallback
|
|
542
|
+
* for any chart text element whose own `<c:txPr>` supplies no `<a:latin>`.
|
|
543
|
+
* null when the theme is not threaded to the chart (then the renderer's
|
|
544
|
+
* built-in sans-serif remains, byte-stable). Axis titles / chart title use
|
|
545
|
+
* the major (heading) face; tick labels / data labels / legend use the
|
|
546
|
+
* minor (body) face — matching Office's default chart text styling.
|
|
547
|
+
*/
|
|
548
|
+
themeMajorFontLatin?: string | null;
|
|
549
|
+
themeMinorFontLatin?: string | null;
|
|
383
550
|
/** Explicit chart border color (hex without '#') from
|
|
384
551
|
* `<c:chartSpace><c:spPr><a:ln><a:solidFill><a:srgbClr>`. Only set when the
|
|
385
552
|
* XML explicitly declares a paintable line; null otherwise (no default
|
|
@@ -454,6 +621,163 @@ export declare interface ChartModel {
|
|
|
454
621
|
* value axis (the common case). See {@link SecondaryValueAxis}.
|
|
455
622
|
*/
|
|
456
623
|
secondaryValAxis?: SecondaryValueAxis | null;
|
|
624
|
+
/**
|
|
625
|
+
* `<c:date1904>` (ECMA-376 §21.2.2.38). When true the chart's serial
|
|
626
|
+
* date-times resolve against the 1904 date system (base 1904-01-01) instead
|
|
627
|
+
* of the default 1900 system. Threaded to the date formatters for date-axis
|
|
628
|
+
* category labels and value-axis tick labels. Omitted/false ⇒ 1900 system.
|
|
629
|
+
* Note: per §21.2.2.38 the element's `val` defaults to true when present but
|
|
630
|
+
* the attribute is omitted, so `<c:date1904/>` alone means date1904=true.
|
|
631
|
+
*/
|
|
632
|
+
date1904?: boolean;
|
|
633
|
+
/**
|
|
634
|
+
* `<c:doughnutChart><c:holeSize val>` (ECMA-376 §21.2.2.60,
|
|
635
|
+
* `ST_HoleSizePercent` §21.2.3.55) — the doughnut hole diameter as a
|
|
636
|
+
* percentage 1–90 of the outer diameter. Ignored for pie (which has no
|
|
637
|
+
* hole). null/undefined = use the renderer's doughnut default when the
|
|
638
|
+
* element is absent. Note the ECMA `CT_HoleSize` schema default is 10%, but
|
|
639
|
+
* a real doughnut file always writes an explicit `<c:holeSize>` (Excel /
|
|
640
|
+
* PowerPoint emit 50–75%); the renderer falls back to 50% only for the
|
|
641
|
+
* pathological absent case.
|
|
642
|
+
*/
|
|
643
|
+
holeSize?: number | null;
|
|
644
|
+
/**
|
|
645
|
+
* `<c:pieChart | doughnutChart><c:firstSliceAng val>` (ECMA-376 §21.2.2.52,
|
|
646
|
+
* `ST_FirstSliceAng` §21.2.3.15) — the angle in degrees (0–360, clockwise
|
|
647
|
+
* from the 12 o'clock position) at which the first slice begins.
|
|
648
|
+
* null/undefined = 0 (start at 12 o'clock), which matches the renderer's
|
|
649
|
+
* historical fixed −90° (canvas up) start.
|
|
650
|
+
*/
|
|
651
|
+
firstSliceAngle?: number | null;
|
|
652
|
+
/**
|
|
653
|
+
* `<c:chartSpace><c:chart><c:dispBlanksAs val>` (ECMA-376 §21.2.2.42,
|
|
654
|
+
* `ST_DispBlanksAs` §21.2.3.10) — how blank (null) cells are plotted on
|
|
655
|
+
* line/area charts:
|
|
656
|
+
* - "gap" → leave a gap (break the line). The renderer's historical
|
|
657
|
+
* behavior and the model default when the element is absent.
|
|
658
|
+
* - "zero" → plot the blank as the value 0 (the point drops to the axis).
|
|
659
|
+
* - "span" → skip the blank but connect its neighbours with a straight
|
|
660
|
+
* line (bridge the gap).
|
|
661
|
+
* Note the XSD `@val` default is "zero" (applies when `<c:dispBlanksAs/>` is
|
|
662
|
+
* present but the attribute is omitted); when the ELEMENT is absent entirely
|
|
663
|
+
* Office falls back to "gap", which is what we model as the default. Only
|
|
664
|
+
* consulted for the line and area families. null/undefined = "gap".
|
|
665
|
+
*/
|
|
666
|
+
dispBlanksAs?: string | null;
|
|
667
|
+
/**
|
|
668
|
+
* `<c:valAx><c:majorGridlines>` presence (ECMA-376 §21.2.2.100). `false` when
|
|
669
|
+
* the value axis exists but omits the element (Office suppresses value
|
|
670
|
+
* gridlines). null/undefined ⇒ the renderer's historical always-on value
|
|
671
|
+
* gridlines (byte-stable). `true` is redundant with the default but honored.
|
|
672
|
+
*/
|
|
673
|
+
valAxisMajorGridlines?: boolean | null;
|
|
674
|
+
/**
|
|
675
|
+
* `<c:catAx><c:majorGridlines>` presence (§21.2.2.100). `true` turns on
|
|
676
|
+
* category-axis gridlines (Office omits them by default). null/undefined/false
|
|
677
|
+
* ⇒ no category gridlines (the historical default, byte-stable).
|
|
678
|
+
*/
|
|
679
|
+
catAxisMajorGridlines?: boolean | null;
|
|
680
|
+
/**
|
|
681
|
+
* `<c:valAx><c:majorGridlines><c:spPr><a:ln><a:solidFill>` resolved gridline
|
|
682
|
+
* color (hex without `#`) — ECMA-376 §21.2.2.100. When set, the value-axis
|
|
683
|
+
* major gridlines are stroked in this color instead of the renderer's faint
|
|
684
|
+
* `#e0e0e0` default (e.g. sample-1 slide 5's `accent3` gridlines). null/absent
|
|
685
|
+
* ⇒ the historical default (byte-stable).
|
|
686
|
+
*/
|
|
687
|
+
valAxisGridlineColor?: string | null;
|
|
688
|
+
/**
|
|
689
|
+
* `<c:valAx><c:majorGridlines><c:spPr><a:ln w>` gridline width in EMU. When
|
|
690
|
+
* set, the value-axis gridline stroke width is derived from this (floored so a
|
|
691
|
+
* hairline stays visible). null/absent ⇒ the renderer's 0.5 px default.
|
|
692
|
+
*/
|
|
693
|
+
valAxisGridlineWidthEmu?: number | null;
|
|
694
|
+
/**
|
|
695
|
+
* `<c:catAx><c:majorGridlines><c:spPr><a:ln><a:solidFill>` resolved gridline
|
|
696
|
+
* color (hex without `#`). Only meaningful when {@link catAxisMajorGridlines}
|
|
697
|
+
* is on. null/absent ⇒ the faint default.
|
|
698
|
+
*/
|
|
699
|
+
catAxisGridlineColor?: string | null;
|
|
700
|
+
/** `<c:catAx><c:majorGridlines><c:spPr><a:ln w>` gridline width in EMU. */
|
|
701
|
+
catAxisGridlineWidthEmu?: number | null;
|
|
702
|
+
/** `<c:valAx><c:minorGridlines>` presence (§21.2.2.109). Only drawn when a
|
|
703
|
+
* minor step is resolvable (see {@link valAxisMinorUnit}). */
|
|
704
|
+
valAxisMinorGridlines?: boolean | null;
|
|
705
|
+
/**
|
|
706
|
+
* `<c:valAx><c:majorUnit val>` (§21.2.2.103) — explicit distance between major
|
|
707
|
+
* gridlines/ticks, overriding the Excel-style auto "nice" step. null/undefined
|
|
708
|
+
* ⇒ auto step (byte-stable).
|
|
709
|
+
*/
|
|
710
|
+
valAxisMajorUnit?: number | null;
|
|
711
|
+
/** `<c:valAx><c:minorUnit val>` (§21.2.2.112) — explicit minor step. Drives
|
|
712
|
+
* minor gridlines/ticks when present. null ⇒ no minor divisions. */
|
|
713
|
+
valAxisMinorUnit?: number | null;
|
|
714
|
+
/**
|
|
715
|
+
* `<c:valAx><c:scaling><c:logBase val>` (§21.2.2.98, `ST_LogBase` §21.2.3.25)
|
|
716
|
+
* — logarithmic value-axis base (>= 2). When set, values map to pixels in log
|
|
717
|
+
* space and gridlines fall on powers of the base. null/undefined ⇒ linear
|
|
718
|
+
* (byte-stable).
|
|
719
|
+
*/
|
|
720
|
+
valAxisLogBase?: number | null;
|
|
721
|
+
/**
|
|
722
|
+
* `<c:valAx><c:scaling><c:orientation val>` (§21.2.2.130, `ST_Orientation`
|
|
723
|
+
* §21.2.3.30) — "minMax" (normal) | "maxMin" (reversed, so the value axis runs
|
|
724
|
+
* top→bottom max→min). null/undefined/"minMax" ⇒ normal (byte-stable).
|
|
725
|
+
*/
|
|
726
|
+
valAxisOrientation?: 'minMax' | 'maxMin' | string | null;
|
|
727
|
+
/** `<c:catAx><c:scaling><c:orientation val>` — "maxMin" reverses the category
|
|
728
|
+
* axis left↔right. null/"minMax" ⇒ normal. */
|
|
729
|
+
catAxisOrientation?: 'minMax' | 'maxMin' | string | null;
|
|
730
|
+
/**
|
|
731
|
+
* `<c:catAx><c:tickLblPos val>` (§21.2.2.207, `ST_TickLblPos` §21.2.3.47) —
|
|
732
|
+
* "nextTo" (default) | "low" | "high" | "none". "none" hides the category tick
|
|
733
|
+
* labels. null/undefined ⇒ nextTo (byte-stable).
|
|
734
|
+
*/
|
|
735
|
+
catAxisTickLabelPos?: string | null;
|
|
736
|
+
/** `<c:valAx><c:tickLblPos val>` (§21.2.2.207). "none" hides value tick labels. */
|
|
737
|
+
valAxisTickLabelPos?: string | null;
|
|
738
|
+
/**
|
|
739
|
+
* `<c:catAx><c:txPr><a:bodyPr rot>` (DrawingML `ST_Angle`, 60000ths of a
|
|
740
|
+
* degree) — category tick-label rotation. e.g. -2700000 = -45°. null/undefined
|
|
741
|
+
* /0 ⇒ horizontal labels (byte-stable).
|
|
742
|
+
*/
|
|
743
|
+
catAxisLabelRotation?: number | null;
|
|
744
|
+
/**
|
|
745
|
+
* `<c:stockChart><c:hiLowLines>` presence (ECMA-376 §21.2.2.60). When true
|
|
746
|
+
* the stock renderer draws a vertical line spanning each category's low↔high
|
|
747
|
+
* value. Only set for `chartType === "stock"`; null/undefined on every other
|
|
748
|
+
* chart type (byte-stable).
|
|
749
|
+
*/
|
|
750
|
+
stockHiLowLines?: boolean | null;
|
|
751
|
+
/**
|
|
752
|
+
* `<c:hiLowLines><c:spPr><a:ln><a:solidFill>` resolved color (hex, no `#`).
|
|
753
|
+
* null = the renderer's default gray hi-lo line.
|
|
754
|
+
*/
|
|
755
|
+
stockHiLowLineColor?: string | null;
|
|
756
|
+
/**
|
|
757
|
+
* `<c:stockChart><c:upDownBars>` presence (ECMA-376 §21.2.2.227). Parsed so a
|
|
758
|
+
* stock file carrying open-close up/down bars is recognized; the renderer does
|
|
759
|
+
* NOT yet draw them (tracked follow-up). null/undefined when absent.
|
|
760
|
+
*/
|
|
761
|
+
stockUpDownBars?: boolean | null;
|
|
762
|
+
/**
|
|
763
|
+
* Structured box-and-whisker data (`chartType === 'boxWhisker'`). Present
|
|
764
|
+
* ONLY for boxWhisker charts; null/absent otherwise so the flat
|
|
765
|
+
* `categories`/`series` model the other chartEx renderers consume is
|
|
766
|
+
* untouched. The renderer computes quartiles / mean / whiskers / outliers.
|
|
767
|
+
*/
|
|
768
|
+
chartexBox?: ChartexBoxWhisker | null;
|
|
769
|
+
/**
|
|
770
|
+
* Structured sunburst hierarchy (`chartType === 'sunburst'`). Present ONLY
|
|
771
|
+
* for sunburst charts; null/absent otherwise.
|
|
772
|
+
*/
|
|
773
|
+
chartexSunburst?: ChartexSunburst | null;
|
|
774
|
+
/**
|
|
775
|
+
* Theme accent palette (`accent1..6`, hex without '#') for chartEx charts
|
|
776
|
+
* that color by branch/series index (boxWhisker series, sunburst branches).
|
|
777
|
+
* null/absent when the resolver supplies no default palette (pptx); the
|
|
778
|
+
* renderer then falls back to its own `CHART_PALETTE`.
|
|
779
|
+
*/
|
|
780
|
+
chartexAccents?: string[] | null;
|
|
457
781
|
}
|
|
458
782
|
|
|
459
783
|
export declare interface ChartSeries {
|
|
@@ -563,6 +887,31 @@ export declare interface ChartSeries {
|
|
|
563
887
|
* series.
|
|
564
888
|
*/
|
|
565
889
|
bubbleSizes?: (number | null)[] | null;
|
|
890
|
+
/**
|
|
891
|
+
* `<c:ser><c:smooth val>` (ECMA-376 §21.2.2.194) — line/area series flag
|
|
892
|
+
* requesting a smoothed (spline) curve through the points instead of straight
|
|
893
|
+
* segments. Only consulted for the line and area families (scatter carries its
|
|
894
|
+
* smoothing in `ChartModel.scatterStyle`). null/undefined/false = straight
|
|
895
|
+
* polyline (the default; byte-stable for series that never set it).
|
|
896
|
+
*/
|
|
897
|
+
smooth?: boolean | null;
|
|
898
|
+
/**
|
|
899
|
+
* `<c:ser><c:trendline>` per-series trendlines (ECMA-376 §21.2.2.211,
|
|
900
|
+
* `CT_Trendline`). A series can carry several (e.g. a linear fit + a moving
|
|
901
|
+
* average). null/undefined/empty = no trendline (the default; byte-stable for
|
|
902
|
+
* series that never declare one).
|
|
903
|
+
*/
|
|
904
|
+
trendLines?: ChartTrendline[] | null;
|
|
905
|
+
/**
|
|
906
|
+
* `<c:ser><c:spPr><a:ln><a:noFill/>` (ECMA-376 §21.2.2.198 CT_ShapeProperties
|
|
907
|
+
* → DrawingML §20.1.2.2.24 CT_LineProperties). true when the series connecting
|
|
908
|
+
* line is explicitly turned OFF. For a scatter/line series this OVERRIDES the
|
|
909
|
+
* chart-group `<c:scatterStyle>` (§21.2.2.42) / line default — Excel and
|
|
910
|
+
* PowerPoint draw markers only (no connecting line) even when the group style
|
|
911
|
+
* is `lineMarker`. null/undefined = no explicit line-off, so the group default
|
|
912
|
+
* governs (byte-stable for series that carry a paintable line).
|
|
913
|
+
*/
|
|
914
|
+
lineHidden?: boolean | null;
|
|
566
915
|
}
|
|
567
916
|
|
|
568
917
|
export declare interface ChartSeriesDataLabels {
|
|
@@ -577,6 +926,51 @@ export declare interface ChartSeriesDataLabels {
|
|
|
577
926
|
fontBold?: boolean;
|
|
578
927
|
/** Series-level font size for data labels (OOXML hundredths of a point). */
|
|
579
928
|
fontSizeHpt?: number;
|
|
929
|
+
/** Series-default callout box (`<c:dLbls><c:spPr>`, ECMA-376 §21.2.2.49/
|
|
930
|
+
* §21.2.2.197). When present the pie/doughnut renderer draws Word's boxed
|
|
931
|
+
* callout layout (box + optional leader line) instead of plain text. */
|
|
932
|
+
labelBox?: ChartLabelBox;
|
|
933
|
+
/** `<c:dLbls><c:showLeaderLines val>` (§21.2.2.183) — draw leader lines from
|
|
934
|
+
* a pulled-away label back to its slice. Default false. */
|
|
935
|
+
showLeaderLines?: boolean;
|
|
936
|
+
/** `<c:leaderLines><c:spPr><a:ln><a:solidFill>` (§21.2.2.92) resolved hex
|
|
937
|
+
* (no `#`). undefined → renderer uses a neutral grey. */
|
|
938
|
+
leaderLineColor?: string;
|
|
939
|
+
/** `<c:leaderLines><c:spPr><a:ln w>` leader-line width in EMU. */
|
|
940
|
+
leaderLineWidthEmu?: number;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* `<c:ser><c:trendline>` (ECMA-376 §21.2.2.211). A regression/smoothing curve
|
|
945
|
+
* fitted to the series' data points.
|
|
946
|
+
*/
|
|
947
|
+
declare interface ChartTrendline {
|
|
948
|
+
/**
|
|
949
|
+
* `<c:trendlineType val>` (§21.2.2.213, `ST_TrendlineType` §21.2.3.50):
|
|
950
|
+
* "linear" | "exp" | "log" | "power" | "poly" | "movingAvg". The renderer
|
|
951
|
+
* currently draws "linear" (least squares) and "movingAvg"; other types parse
|
|
952
|
+
* but are not yet plotted (tracked as a follow-up).
|
|
953
|
+
*/
|
|
954
|
+
trendlineType: string;
|
|
955
|
+
/** `<c:order val>` — polynomial order (`poly`, default 2). */
|
|
956
|
+
order?: number | null;
|
|
957
|
+
/** `<c:period val>` — moving-average window (`movingAvg`, default 2). */
|
|
958
|
+
period?: number | null;
|
|
959
|
+
/** `<c:forward val>` — units to extend the line past the last point. */
|
|
960
|
+
forward?: number | null;
|
|
961
|
+
/** `<c:backward val>` — units to extend the line before the first point. */
|
|
962
|
+
backward?: number | null;
|
|
963
|
+
/** `<c:intercept val>` — forced y-intercept (linear/exp). null = free fit. */
|
|
964
|
+
intercept?: number | null;
|
|
965
|
+
/** `<c:dispRSqr val="1">` — show the R² value (label; not yet rendered). */
|
|
966
|
+
dispRSqr?: boolean | null;
|
|
967
|
+
/** `<c:dispEq val="1">` — show the fit equation (label; not yet rendered). */
|
|
968
|
+
dispEq?: boolean | null;
|
|
969
|
+
/** `<c:spPr><a:ln><a:solidFill>` trendline color (hex without '#'). null =
|
|
970
|
+
* inherit the series color. */
|
|
971
|
+
lineColor?: string | null;
|
|
972
|
+
/** `<c:spPr><a:ln w>` trendline width in EMU. */
|
|
973
|
+
lineWidthEmu?: number | null;
|
|
580
974
|
}
|
|
581
975
|
|
|
582
976
|
/**
|
|
@@ -584,7 +978,7 @@ export declare interface ChartSeriesDataLabels {
|
|
|
584
978
|
* grouping (`Pct` = percent-stacked) so renderers do not need to inspect
|
|
585
979
|
* separate `barDir`/`grouping` fields.
|
|
586
980
|
*/
|
|
587
|
-
declare type ChartType = 'line' | 'stackedLine' | 'stackedLinePct' | 'clusteredBar' | 'clusteredBarH' | 'stackedBar' | 'stackedBarH' | 'stackedBarPct' | 'stackedBarHPct' | 'area' | 'stackedArea' | 'stackedAreaPct' | 'pie' | 'doughnut' | 'scatter' | 'bubble' | 'radar' | 'waterfall' | string;
|
|
981
|
+
declare type ChartType = 'line' | 'stackedLine' | 'stackedLinePct' | 'clusteredBar' | 'clusteredBarH' | 'stackedBar' | 'stackedBarH' | 'stackedBarPct' | 'stackedBarHPct' | 'area' | 'stackedArea' | 'stackedAreaPct' | 'pie' | 'doughnut' | 'scatter' | 'bubble' | 'radar' | 'waterfall' | 'stock' | 'boxWhisker' | 'sunburst' | string;
|
|
588
982
|
|
|
589
983
|
export declare interface ConditionalFormat {
|
|
590
984
|
sqref: CellRange_2[];
|
|
@@ -624,6 +1018,16 @@ export declare interface DefinedName {
|
|
|
624
1018
|
formula: string;
|
|
625
1019
|
}
|
|
626
1020
|
|
|
1021
|
+
/** ECMA-376 §20.1.8.23 `<a:duotone>` image effect, resolved to its two endpoint
|
|
1022
|
+
* colours (mirrors the shared Rust `ooxml_common::blip::Duotone`). `clr1` is the
|
|
1023
|
+
* dark endpoint (luminance 0), `clr2` the light endpoint (luminance 1); both are
|
|
1024
|
+
* 6-char uppercase hex WITHOUT a leading `#`, with per-colour transforms already
|
|
1025
|
+
* applied by the parser. */
|
|
1026
|
+
export declare interface Duotone {
|
|
1027
|
+
clr1: string;
|
|
1028
|
+
clr2: string;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
627
1031
|
export declare interface Dxf {
|
|
628
1032
|
font: CellFont | null;
|
|
629
1033
|
fill: CellFill | null;
|
|
@@ -638,6 +1042,47 @@ export declare interface Dxf {
|
|
|
638
1042
|
/** @deprecated Use `ChartErrBars` from @silurus/ooxml-core. */
|
|
639
1043
|
export declare type ErrBars = ChartErrBars;
|
|
640
1044
|
|
|
1045
|
+
/**
|
|
1046
|
+
* IX2 public find-result shape, shared by all three viewers.
|
|
1047
|
+
*
|
|
1048
|
+
* `findText` returns an ordered list of {@link FindMatch}. Every match carries
|
|
1049
|
+
* its ordinal position (`matchIndex`, 0-based, document order — the same index
|
|
1050
|
+
* `findNext` / `findPrev` cycle through), the matched `text`, and a
|
|
1051
|
+
* format-specific `location`. The location is where the three formats
|
|
1052
|
+
* legitimately differ — a docx match lives on a page, a pptx match on a slide,
|
|
1053
|
+
* an xlsx match in a sheet cell — so `FindMatch` is generic over it rather than
|
|
1054
|
+
* forcing an artificial common shape. Each viewer instantiates it with its own
|
|
1055
|
+
* location type:
|
|
1056
|
+
*
|
|
1057
|
+
* - `DocxViewer.findText` → `FindMatch<DocxMatchLocation>` ({ page })
|
|
1058
|
+
* - `PptxViewer.findText` → `FindMatch<PptxMatchLocation>` ({ slide })
|
|
1059
|
+
* - `XlsxViewer.findText` → `FindMatch<XlsxMatchLocation>` ({ sheet, ref, … })
|
|
1060
|
+
*
|
|
1061
|
+
* The generic default is `unknown` so `FindMatch` can be referenced without a
|
|
1062
|
+
* type argument (e.g. in generic UI code) while each viewer's return type stays
|
|
1063
|
+
* precise.
|
|
1064
|
+
*/
|
|
1065
|
+
export declare interface FindMatch<Loc = unknown> {
|
|
1066
|
+
/** 0-based ordinal among all matches, in document order. This is the index
|
|
1067
|
+
* `findNext`/`findPrev` make active, so a caller can correlate the array it
|
|
1068
|
+
* got from `findText` with the active-match reported by navigation. */
|
|
1069
|
+
matchIndex: number;
|
|
1070
|
+
/** The text that matched (the query as it appears in the document — its
|
|
1071
|
+
* original case, not the folded form used for case-insensitive matching). */
|
|
1072
|
+
text: string;
|
|
1073
|
+
/** Where the match is, in the format's own coordinates. */
|
|
1074
|
+
location: Loc;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/** Options for {@link findMatches}. */
|
|
1078
|
+
export declare interface FindMatchesOptions {
|
|
1079
|
+
/**
|
|
1080
|
+
* Match case exactly. Default `false` (case-insensitive, like a browser's
|
|
1081
|
+
* find-in-page). IX2 default — an integrator can pass `true`.
|
|
1082
|
+
*/
|
|
1083
|
+
caseSensitive?: boolean;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
641
1086
|
export declare interface GradientFillSpec {
|
|
642
1087
|
/** "linear" (default) or "path". */
|
|
643
1088
|
gradientType: string;
|
|
@@ -660,9 +1105,60 @@ export declare type HiddenSheetMode = 'show' | 'skip' | 'dim';
|
|
|
660
1105
|
export declare interface Hyperlink {
|
|
661
1106
|
col: number;
|
|
662
1107
|
row: number;
|
|
1108
|
+
/** External target (ECMA-376 §18.3.1.47 `r:id`, resolved via worksheet rels).
|
|
1109
|
+
* `null` for a purely internal hyperlink. */
|
|
663
1110
|
url: string | null;
|
|
1111
|
+
/** Internal target (§18.3.1.47 `location`): a defined name or a cell reference
|
|
1112
|
+
* such as `Sheet1!A1`. Present when the hyperlink navigates within the
|
|
1113
|
+
* workbook rather than to an external URL. */
|
|
1114
|
+
location?: string | null;
|
|
1115
|
+
/** Optional display text (§18.3.1.47 `display`). Not used for rendering. */
|
|
1116
|
+
display?: string | null;
|
|
664
1117
|
}
|
|
665
1118
|
|
|
1119
|
+
/**
|
|
1120
|
+
* Shared hyperlink model + URL sanitisation for docx / pptx / xlsx (IX1).
|
|
1121
|
+
*
|
|
1122
|
+
* All three formats carry the same two ECMA-376 concepts:
|
|
1123
|
+
* - an **external** hyperlink — an absolute URL resolved from a relationship
|
|
1124
|
+
* part target (`document.xml.rels` for docx §17.16.22, the slide rels for
|
|
1125
|
+
* pptx §21.1.2.3.5, the worksheet rels for xlsx §18.3.1.47), with
|
|
1126
|
+
* `TargetMode="External"`.
|
|
1127
|
+
* - an **internal** hyperlink — a jump within the document itself:
|
|
1128
|
+
* docx `w:anchor` -> a `<w:bookmarkStart w:name>` (§17.16.23), pptx
|
|
1129
|
+
* `action="ppaction://hlinksldjump"` -> a slide, xlsx `location` -> a defined
|
|
1130
|
+
* name or a `Sheet!A1` cell reference.
|
|
1131
|
+
*
|
|
1132
|
+
* The parsers (Rust, one per format) do the format-specific rels lookup and hand
|
|
1133
|
+
* each run / shape / cell a {@link HyperlinkTarget}. Everything downstream — the
|
|
1134
|
+
* text-layer overlay, the viewer default click behaviour, and any integrator
|
|
1135
|
+
* callback — is format-agnostic and consumes this one shape. Keeping the type +
|
|
1136
|
+
* the pure `sanitizeHyperlinkUrl` predicate here (not duplicated per package)
|
|
1137
|
+
* follows the cross-package unification principle: a scheme-allowlist bug fixed
|
|
1138
|
+
* once is fixed everywhere.
|
|
1139
|
+
*/
|
|
1140
|
+
/**
|
|
1141
|
+
* A resolved hyperlink attached to a run, shape, or cell.
|
|
1142
|
+
*
|
|
1143
|
+
* - `external` — `url` is the raw target as authored in the file. It is NOT
|
|
1144
|
+
* guaranteed safe; run it through {@link sanitizeHyperlinkUrl} before
|
|
1145
|
+
* navigating. It is kept verbatim here so an integrator can apply its own
|
|
1146
|
+
* policy (e.g. allow `file:` on a trusted intranet viewer).
|
|
1147
|
+
* - `internal` — `ref` is the in-document destination, verbatim from the file:
|
|
1148
|
+
* docx: the bookmark name (`w:anchor`).
|
|
1149
|
+
* pptx: the internal action (e.g. `ppaction://hlinksldjump`), with the
|
|
1150
|
+
* resolved 0-based `slideIndex` when the rels target names a slide.
|
|
1151
|
+
* xlsx: the `location` string (a defined name or `Sheet1!A1`).
|
|
1152
|
+
*/
|
|
1153
|
+
export declare type HyperlinkTarget = {
|
|
1154
|
+
kind: 'external';
|
|
1155
|
+
url: string;
|
|
1156
|
+
} | {
|
|
1157
|
+
kind: 'internal';
|
|
1158
|
+
ref: string;
|
|
1159
|
+
slideIndex?: number;
|
|
1160
|
+
};
|
|
1161
|
+
|
|
666
1162
|
/**
|
|
667
1163
|
* Image anchored to a rectangle of cells (EMU offsets within the anchor cells).
|
|
668
1164
|
* 914400 EMU = 1 inch, 9525 EMU = 1 px @ 96 DPI.
|
|
@@ -711,6 +1207,15 @@ export declare interface ImageAnchor {
|
|
|
711
1207
|
r: number;
|
|
712
1208
|
b: number;
|
|
713
1209
|
};
|
|
1210
|
+
/** ECMA-376 §20.1.8.6 `<a:alphaModFix@amt>` — the blip's overall opacity as a
|
|
1211
|
+
* fraction (0..1). Absent ⇒ opaque. The renderer sets `ctx.globalAlpha` so the
|
|
1212
|
+
* picture composites over the cells beneath it (e.g. a pink translucent photo
|
|
1213
|
+
* over a matching cell fill). */
|
|
1214
|
+
alpha?: number;
|
|
1215
|
+
/** ECMA-376 §20.1.8.23 `<a:duotone>` recolour effect. Absent (the common case)
|
|
1216
|
+
* ⇒ no effect. When present, the renderer remaps the image along the
|
|
1217
|
+
* `clr1`→`clr2` luminance ramp before drawing. */
|
|
1218
|
+
duotone?: Duotone;
|
|
714
1219
|
}
|
|
715
1220
|
|
|
716
1221
|
export declare interface LegendManualLayout {
|
|
@@ -760,6 +1265,35 @@ declare interface LoadOptions_2 {
|
|
|
760
1265
|
* via `@font-face` in your application CSS.
|
|
761
1266
|
*/
|
|
762
1267
|
useGoogleFonts?: boolean;
|
|
1268
|
+
/**
|
|
1269
|
+
* Password for an encrypted OOXML file ([MS-OFFCRYPTO] Agile Encryption).
|
|
1270
|
+
*
|
|
1271
|
+
* Password-protected Office documents are CFB (OLE2) containers, not ZIPs.
|
|
1272
|
+
* When this is set and the input is Agile-encrypted, `load()` decrypts it on
|
|
1273
|
+
* the main thread (via WebCrypto) and parses the recovered plaintext ZIP.
|
|
1274
|
+
*
|
|
1275
|
+
* Errors (thrown as {@link import('../errors/ooxml-error').OoxmlError}):
|
|
1276
|
+
* - no `password` on an encrypted file → code `'encrypted'`
|
|
1277
|
+
* - wrong `password` → code `'invalid-password'`
|
|
1278
|
+
* - a non-Agile scheme (Standard / Extensible / legacy) → code
|
|
1279
|
+
* `'unsupported-encryption'`
|
|
1280
|
+
*
|
|
1281
|
+
* Note: Agile Encryption uses a high password-hash spin count (commonly
|
|
1282
|
+
* 100,000), so decryption of a protected file adds roughly a second of
|
|
1283
|
+
* WebCrypto work before parsing begins.
|
|
1284
|
+
*
|
|
1285
|
+
* Security notes:
|
|
1286
|
+
* - This value is held as an ordinary JS `string` in memory for the
|
|
1287
|
+
* duration of key derivation. The library does not zero it, and does
|
|
1288
|
+
* not wrap it in a `SecureString`-equivalent — it becomes eligible for
|
|
1289
|
+
* garbage collection like any other string once nothing references it,
|
|
1290
|
+
* but no explicit wipe is performed. It is never logged or included in
|
|
1291
|
+
* thrown errors.
|
|
1292
|
+
* - Decryption recovers the plaintext but does not verify the file's HMAC
|
|
1293
|
+
* data-integrity tag ([MS-OFFCRYPTO] §2.3.4.14), so ciphertext tampering
|
|
1294
|
+
* is not detected — see "Security & Privacy" in the README.
|
|
1295
|
+
*/
|
|
1296
|
+
password?: string;
|
|
763
1297
|
/**
|
|
764
1298
|
* Override the URL the parser worker fetches the WebAssembly module from.
|
|
765
1299
|
*
|
|
@@ -829,6 +1363,31 @@ declare interface MathBar {
|
|
|
829
1363
|
base: MathNode[];
|
|
830
1364
|
}
|
|
831
1365
|
|
|
1366
|
+
/** Border-box object (`m:borderBox`, §22.1.2.11): a border/strikes around the
|
|
1367
|
+
* base. Absent flags ⇒ a full rectangular box. */
|
|
1368
|
+
declare interface MathBorderBox {
|
|
1369
|
+
kind: 'borderBox';
|
|
1370
|
+
/** §22.1.2 hide* — when true the corresponding edge is NOT drawn. */
|
|
1371
|
+
hideTop?: boolean;
|
|
1372
|
+
hideBot?: boolean;
|
|
1373
|
+
hideLeft?: boolean;
|
|
1374
|
+
hideRight?: boolean;
|
|
1375
|
+
/** §22.1.2 strike* — strikeBLTR = bottom-left→top-right, strikeTLBR =
|
|
1376
|
+
* top-left→bottom-right diagonal. */
|
|
1377
|
+
strikeH?: boolean;
|
|
1378
|
+
strikeV?: boolean;
|
|
1379
|
+
strikeBltr?: boolean;
|
|
1380
|
+
strikeTlbr?: boolean;
|
|
1381
|
+
base: MathNode[];
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
/** Box object (`m:box`, §22.1.2.13): a logical grouping (operator emulator /
|
|
1385
|
+
* line-break control). Draws NO border — a transparent group around `base`. */
|
|
1386
|
+
declare interface MathBox {
|
|
1387
|
+
kind: 'box';
|
|
1388
|
+
base: MathNode[];
|
|
1389
|
+
}
|
|
1390
|
+
|
|
832
1391
|
declare interface MathDelimiter {
|
|
833
1392
|
kind: 'delimiter';
|
|
834
1393
|
/** opening char (default '('). */
|
|
@@ -886,7 +1445,23 @@ declare interface MathNary {
|
|
|
886
1445
|
body: MathNode[];
|
|
887
1446
|
}
|
|
888
1447
|
|
|
889
|
-
declare type MathNode = MathRun | MathFraction | MathScript | MathNary | MathDelimiter | MathRadical | MathLimit | MathArray | MathGroupChr | MathBar | MathAccent | MathFunc | MathGroup;
|
|
1448
|
+
declare type MathNode = MathRun | MathFraction | MathScript | MathNary | MathDelimiter | MathRadical | MathLimit | MathArray | MathGroupChr | MathBar | MathAccent | MathFunc | MathGroup | MathPhant | MathSPre | MathBox | MathBorderBox;
|
|
1449
|
+
|
|
1450
|
+
/** Phantom object (`m:phant`, §22.1.2.81): contributes the spacing of `base`
|
|
1451
|
+
* while optionally hiding it and/or zeroing individual dimensions. */
|
|
1452
|
+
declare interface MathPhant {
|
|
1453
|
+
kind: 'phant';
|
|
1454
|
+
/** §22.1.2.96 `m:show` — `false` hides the base (invisible but occupies space,
|
|
1455
|
+
* i.e. `<mphantom>`); `true` (default) shows it and the phant only tweaks
|
|
1456
|
+
* spacing. */
|
|
1457
|
+
show: boolean;
|
|
1458
|
+
/** §22.1.2 zeroWid / zeroAsc / zeroDesc — suppress width / ascent / descent so
|
|
1459
|
+
* the base takes no space along that axis. Omitted ⇒ false. */
|
|
1460
|
+
zeroWid?: boolean;
|
|
1461
|
+
zeroAsc?: boolean;
|
|
1462
|
+
zeroDesc?: boolean;
|
|
1463
|
+
base: MathNode[];
|
|
1464
|
+
}
|
|
890
1465
|
|
|
891
1466
|
declare interface MathRadical {
|
|
892
1467
|
kind: 'radical';
|
|
@@ -929,6 +1504,15 @@ declare interface MathScript {
|
|
|
929
1504
|
sub?: MathNode[];
|
|
930
1505
|
}
|
|
931
1506
|
|
|
1507
|
+
/** Pre-sub-superscript object (`m:sPre`, §22.1.2.99): sub + sup to the LEFT of
|
|
1508
|
+
* the base (e.g. ²₁A). */
|
|
1509
|
+
declare interface MathSPre {
|
|
1510
|
+
kind: 'sPre';
|
|
1511
|
+
sub: MathNode[];
|
|
1512
|
+
sup: MathNode[];
|
|
1513
|
+
base: MathNode[];
|
|
1514
|
+
}
|
|
1515
|
+
|
|
932
1516
|
declare type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
|
|
933
1517
|
|
|
934
1518
|
declare interface MathSvg {
|
|
@@ -952,6 +1536,73 @@ export declare interface NumFmt {
|
|
|
952
1536
|
formatCode: string;
|
|
953
1537
|
}
|
|
954
1538
|
|
|
1539
|
+
/**
|
|
1540
|
+
* Typed error thrown by the docx / pptx / xlsx `load()` factories for failures
|
|
1541
|
+
* that carry a stable, programmatic {@link OoxmlErrorCode} (e.g. a
|
|
1542
|
+
* password-protected or legacy-binary file detected from its container magic).
|
|
1543
|
+
*
|
|
1544
|
+
* Note on workers: `instanceof OoxmlError` does not survive a structured-clone
|
|
1545
|
+
* across the worker boundary. Detection that needs a typed error is therefore
|
|
1546
|
+
* done on the main thread (before the worker is involved) so a genuine
|
|
1547
|
+
* `OoxmlError` instance is thrown to the caller. Errors that must cross the
|
|
1548
|
+
* worker boundary should carry the `code` string and be reconstructed on the
|
|
1549
|
+
* main side.
|
|
1550
|
+
*/
|
|
1551
|
+
export declare class OoxmlError extends Error {
|
|
1552
|
+
readonly code: OoxmlErrorCode;
|
|
1553
|
+
constructor(code: OoxmlErrorCode, message: string);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Machine-readable code for a typed load-time failure.
|
|
1558
|
+
*
|
|
1559
|
+
* The container-level failures the `load()` factories detect on the main thread
|
|
1560
|
+
* before handing bytes to the parser worker (see `sniffCfb` / `decryptOoxml`).
|
|
1561
|
+
* This is the seed of the broader typed-error surface tracked as PD4 (OoxmlError
|
|
1562
|
+
* typed errors). Add codes here rather than throwing bare `Error(string)`, so
|
|
1563
|
+
* callers can `switch` on `err.code` instead of matching message text.
|
|
1564
|
+
*
|
|
1565
|
+
* - `'encrypted'` — password-protected, but no `password` was
|
|
1566
|
+
* supplied (pass `LoadOptions.password` to decrypt).
|
|
1567
|
+
* - `'invalid-password'` — a `password` was supplied but did not match.
|
|
1568
|
+
* - `'unsupported-encryption'`— encrypted with a scheme other than Agile
|
|
1569
|
+
* (Standard / Extensible / a legacy binary encryptor), which this library
|
|
1570
|
+
* cannot decrypt (PD8 implements Agile only).
|
|
1571
|
+
* - `'legacy-binary-format'` — a raw .doc / .xls / .ppt (not OOXML).
|
|
1572
|
+
* - `'not-ooxml'` — a CFB of an unrecognised kind, or otherwise
|
|
1573
|
+
* not an OOXML ZIP.
|
|
1574
|
+
*/
|
|
1575
|
+
export declare type OoxmlErrorCode = 'encrypted' | 'invalid-password' | 'unsupported-encryption' | 'legacy-binary-format' | 'not-ooxml';
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* The default action a viewer takes for an **external** hyperlink click when
|
|
1579
|
+
* the integrator supplies no `onHyperlinkClick` handler: sanitise the URL and,
|
|
1580
|
+
* if allowed, open it in a new tab with `noopener,noreferrer` so the opened page
|
|
1581
|
+
* gets no `window.opener` handle back into this document. A blocked scheme is a
|
|
1582
|
+
* silent no-op (returns `false`) — the click does nothing rather than navigate
|
|
1583
|
+
* somewhere dangerous.
|
|
1584
|
+
*
|
|
1585
|
+
* Internal targets are intentionally NOT handled here: the in-document jump
|
|
1586
|
+
* (page / slide / cell) is format-specific and lives in each viewer.
|
|
1587
|
+
*
|
|
1588
|
+
* Split out (not inlined in three viewers) so the "open in new tab, drop opener,
|
|
1589
|
+
* refuse unsafe schemes" policy is defined once. `win` is injected for tests;
|
|
1590
|
+
* defaults to the ambient `window`.
|
|
1591
|
+
*
|
|
1592
|
+
* @returns `true` if navigation was initiated, `false` if the URL was blocked.
|
|
1593
|
+
*/
|
|
1594
|
+
export declare function openExternalHyperlink(url: string, allowed?: readonly string[], win?: Pick<Window, 'open'> | undefined): boolean;
|
|
1595
|
+
|
|
1596
|
+
/** `<sheetPr><outlinePr>` flags (ECMA-376 §18.3.1.61). Both default to `true`. */
|
|
1597
|
+
export declare interface OutlinePr {
|
|
1598
|
+
/** `true` (default) ⇒ a group's summary row sits *below* its detail rows;
|
|
1599
|
+
* `false` ⇒ above. */
|
|
1600
|
+
summaryBelow: boolean;
|
|
1601
|
+
/** `true` (default) ⇒ a group's summary column sits to the *right* of its
|
|
1602
|
+
* detail columns; `false` ⇒ to the left. */
|
|
1603
|
+
summaryRight: boolean;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
955
1606
|
export declare interface ParsedWorkbook {
|
|
956
1607
|
workbook: Workbook;
|
|
957
1608
|
styles: Styles;
|
|
@@ -999,6 +1650,38 @@ export declare interface PathInfo {
|
|
|
999
1650
|
commands: PathCmd[];
|
|
1000
1651
|
}
|
|
1001
1652
|
|
|
1653
|
+
/** ECMA-376 §18.18.56 ST_PhoneticAlignment — how the furigana is aligned over
|
|
1654
|
+
* the base text. Absent on {@link PhoneticProperties} defaults to `'left'`. */
|
|
1655
|
+
export declare type PhoneticAlignment = 'left' | 'center' | 'distributed' | 'noControl';
|
|
1656
|
+
|
|
1657
|
+
/** ECMA-376 §18.4.3 `<phoneticPr>` — phonetic display properties. */
|
|
1658
|
+
export declare interface PhoneticProperties {
|
|
1659
|
+
/** Zero-based index into `Styles.fonts` (§18.18.32 ST_FontId). Out of bounds
|
|
1660
|
+
* falls back to font 0 (§18.4.3). Drives the furigana font size / family. */
|
|
1661
|
+
fontId: number;
|
|
1662
|
+
/** §18.18.57 — absent means `'fullwidthKatakana'` (schema default). */
|
|
1663
|
+
type?: PhoneticType;
|
|
1664
|
+
/** §18.18.56 — absent means `'left'` (schema default). */
|
|
1665
|
+
alignment?: PhoneticAlignment;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
/** ECMA-376 §18.4.6 `<rPh sb=".." eb="..">` — one furigana run. `sb`/`eb` are
|
|
1669
|
+
* zero-based character offsets into the base text; the hint `text` is shown
|
|
1670
|
+
* over base characters `[sb, eb)`. */
|
|
1671
|
+
export declare interface PhoneticRun {
|
|
1672
|
+
/** Zero-based start character offset into the base text (inclusive). */
|
|
1673
|
+
sb: number;
|
|
1674
|
+
/** Zero-based end character offset into the base text (exclusive). */
|
|
1675
|
+
eb: number;
|
|
1676
|
+
/** The phonetic hint text (e.g. the katakana reading). */
|
|
1677
|
+
text: string;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
/** ECMA-376 §18.18.57 ST_PhoneticType — the East-Asian character set the
|
|
1681
|
+
* furigana is displayed in. Absent on {@link PhoneticProperties} defaults to
|
|
1682
|
+
* `'fullwidthKatakana'` per the CT_PhoneticPr schema. */
|
|
1683
|
+
export declare type PhoneticType = 'fullwidthKatakana' | 'halfwidthKatakana' | 'Hiragana' | 'noConversion';
|
|
1684
|
+
|
|
1002
1685
|
export declare interface RenderViewportOptions {
|
|
1003
1686
|
width?: number;
|
|
1004
1687
|
height?: number;
|
|
@@ -1052,10 +1735,34 @@ export declare type ResolvedList = {
|
|
|
1052
1735
|
formula: string;
|
|
1053
1736
|
};
|
|
1054
1737
|
|
|
1738
|
+
/**
|
|
1739
|
+
* Resolve every `{ type: 'shared', si }` cell in `ws` to a concrete
|
|
1740
|
+
* `{ type: 'text', text, runs? }` by looking `si` up in the workbook
|
|
1741
|
+
* `sharedStrings` table (ECMA-376 §18.4.8). Mutates cells in place and returns
|
|
1742
|
+
* `ws` for chaining. Out-of-range / missing `si` resolves to empty text —
|
|
1743
|
+
* matching the parser's historical fallback. Idempotent: a `Worksheet` with no
|
|
1744
|
+
* `shared` cells is returned unchanged.
|
|
1745
|
+
*
|
|
1746
|
+
* This keeps the dedup win on the wire (each shared string ships ONCE in the
|
|
1747
|
+
* workbook) while every downstream consumer — renderer, formula engine, number
|
|
1748
|
+
* formatter, markdown — still sees fully-resolved cell text.
|
|
1749
|
+
*/
|
|
1750
|
+
export declare function resolveSharedStrings(ws: Worksheet, sharedStrings: SharedString[]): Worksheet;
|
|
1751
|
+
|
|
1055
1752
|
export declare interface Row {
|
|
1056
1753
|
index: number;
|
|
1057
1754
|
height: number | null;
|
|
1058
1755
|
cells: Cell[];
|
|
1756
|
+
/** Outline (grouping) depth 0-7 (ECMA-376 §18.3.1.73 `<row outlineLevel>`).
|
|
1757
|
+
* Omitted on the wire when `0` (ungrouped); read as `outlineLevel ?? 0`. */
|
|
1758
|
+
outlineLevel?: number;
|
|
1759
|
+
/** `<row collapsed>` (§18.3.1.73): `true` on a summary row whose
|
|
1760
|
+
* one-level-deeper detail rows are collapsed. Omitted when false. */
|
|
1761
|
+
collapsed?: boolean;
|
|
1762
|
+
/** `<row hidden>` (§18.3.1.73): `true` when the row is hidden — most often
|
|
1763
|
+
* because a collapsed outline hides its detail rows. Distinct from
|
|
1764
|
+
* `height === 0`. Omitted on the wire when false. */
|
|
1765
|
+
hidden?: boolean;
|
|
1059
1766
|
}
|
|
1060
1767
|
|
|
1061
1768
|
export declare interface Run {
|
|
@@ -1113,6 +1820,13 @@ declare interface SecondaryValueAxis {
|
|
|
1113
1820
|
lineHidden: boolean;
|
|
1114
1821
|
/** `<c:majorTickMark>` — "cross" (default) | "out" | "in" | "none". */
|
|
1115
1822
|
majorTickMark: string;
|
|
1823
|
+
/**
|
|
1824
|
+
* `<c:valAx><c:majorUnit val>` (§21.2.2.103) — explicit distance between
|
|
1825
|
+
* major ticks/gridlines on THIS secondary axis, overriding the Excel-style
|
|
1826
|
+
* auto "nice" step. null/undefined ⇒ auto step (byte-stable). Symmetric with
|
|
1827
|
+
* {@link ChartModel.valAxisMajorUnit} on the primary axis.
|
|
1828
|
+
*/
|
|
1829
|
+
majorUnit?: number | null;
|
|
1116
1830
|
/** `<c:title>` run-prop font size (hpt). */
|
|
1117
1831
|
titleFontSizeHpt?: number | null;
|
|
1118
1832
|
/** `<c:title>` run-prop bold flag. */
|
|
@@ -1186,6 +1900,12 @@ export declare type ShapeGeom = {
|
|
|
1186
1900
|
r: number;
|
|
1187
1901
|
b: number;
|
|
1188
1902
|
};
|
|
1903
|
+
/** ECMA-376 §20.1.8.6 `<a:alphaModFix@amt>` opacity fraction (0..1) on the
|
|
1904
|
+
* leaf pic. Absent ⇒ opaque. Applied via `globalAlpha`. */
|
|
1905
|
+
alpha?: number;
|
|
1906
|
+
/** ECMA-376 §20.1.8.23 `<a:duotone>` recolour on the leaf pic. Absent ⇒
|
|
1907
|
+
* no effect. */
|
|
1908
|
+
duotone?: Duotone;
|
|
1189
1909
|
};
|
|
1190
1910
|
|
|
1191
1911
|
export declare interface ShapeInfo {
|
|
@@ -1300,6 +2020,12 @@ export declare type ShapeTextRun = {
|
|
|
1300
2020
|
export declare interface SharedString {
|
|
1301
2021
|
text: string;
|
|
1302
2022
|
runs?: Run[];
|
|
2023
|
+
/** ECMA-376 §18.4.6 phonetic runs (furigana). Absent when the `<si>` has no
|
|
2024
|
+
* `<rPh>`. */
|
|
2025
|
+
phoneticRuns?: PhoneticRun[];
|
|
2026
|
+
/** ECMA-376 §18.4.3 phonetic display properties. Absent when the `<si>` has
|
|
2027
|
+
* no `<phoneticPr>`. */
|
|
2028
|
+
phoneticPr?: PhoneticProperties;
|
|
1303
2029
|
}
|
|
1304
2030
|
|
|
1305
2031
|
export declare interface SheetMeta {
|
|
@@ -1460,11 +2186,51 @@ export declare interface ViewportRange {
|
|
|
1460
2186
|
|
|
1461
2187
|
/** Serializable subset of RenderViewportOptions: drop the callback, the image
|
|
1462
2188
|
* cache, and the `fetchImage` loader (all non-cloneable; the worker owns its
|
|
1463
|
-
* own cache and supplies its own in-worker fetchImage).
|
|
1464
|
-
|
|
2189
|
+
* own cache and supplies its own in-worker fetchImage). Extended with the
|
|
2190
|
+
* optional {@link WireSizeOverrides} so view-only size mutations reach the
|
|
2191
|
+
* worker's local sheet copy; absent (the common case) when nothing has been
|
|
2192
|
+
* resized or collapsed, keeping the wire payload unchanged. */
|
|
2193
|
+
export declare type WireRenderViewportOptions = Omit<RenderViewportOptions, 'onTextRun' | 'loadedImages' | 'fetchImage'> & {
|
|
2194
|
+
sizeOverrides?: WireSizeOverrides;
|
|
2195
|
+
};
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* View-only per-band size overrides for one sheet, carried with every worker
|
|
2199
|
+
* `renderViewport` request. The render worker draws from its own worker-local
|
|
2200
|
+
* parsed-sheet cache, so main-thread Worksheet mutations (outline
|
|
2201
|
+
* collapse/expand via the size-0 hidden encoding, drag-to-resize #567) never
|
|
2202
|
+
* reach it on their own — without this channel the gutter/overlays update but
|
|
2203
|
+
* the grid bitmap stays stale.
|
|
2204
|
+
*
|
|
2205
|
+
* Semantics: keys are 1-based band indices; a number is the band's current
|
|
2206
|
+
* `rowHeights` / `colWidths` model value, `null` means "no entry — fall back
|
|
2207
|
+
* to the sheet default". The main thread accumulates every band the user has
|
|
2208
|
+
* touched this session (entries are updated in place, never removed), so
|
|
2209
|
+
* re-applying the full map is idempotent and converges the worker's cached
|
|
2210
|
+
* sheet to the main model even across worker-side re-parses.
|
|
2211
|
+
*/
|
|
2212
|
+
export declare interface WireSizeOverrides {
|
|
2213
|
+
rows?: Record<number, number | null>;
|
|
2214
|
+
cols?: Record<number, number | null>;
|
|
2215
|
+
}
|
|
1465
2216
|
|
|
1466
2217
|
export declare interface Workbook {
|
|
1467
2218
|
sheets: SheetMeta[];
|
|
2219
|
+
/** Workbook date system (`<workbookPr date1904>`, ECMA-376 §18.2.28).
|
|
2220
|
+
* `true` selects the 1904 date system (Mac-authored workbooks); serial
|
|
2221
|
+
* dates are resolved against the 1904 epoch (§18.17.4.1). Omitted from the
|
|
2222
|
+
* parser JSON when false (default 1900 date system). */
|
|
2223
|
+
date1904?: boolean;
|
|
2224
|
+
/** #773 partial degradation: a WORKBOOK-LEVEL degradation that leaves every
|
|
2225
|
+
* sheet openable. Set when a shared workbook part was PRESENT but corrupt —
|
|
2226
|
+
* most commonly `xl/sharedStrings.xml` (§18.4.9): a broken shared-string table
|
|
2227
|
+
* silently blanks every string cell across ALL sheets, so unlike a per-sheet
|
|
2228
|
+
* break it can't be attributed to one placeholder sheet. Tagged with the
|
|
2229
|
+
* offending part (e.g. `"xl/sharedStrings.xml: <detail>"`) so the loss is
|
|
2230
|
+
* surfaced instead of silent, while every sheet still renders its non-string
|
|
2231
|
+
* content. Absent (`undefined`) when every shared part read cleanly. Also set
|
|
2232
|
+
* (`"(zip container): <detail>"`) for a whole-container degradation (#774). */
|
|
2233
|
+
parseError?: string;
|
|
1468
2234
|
}
|
|
1469
2235
|
|
|
1470
2236
|
export declare interface Worksheet {
|
|
@@ -1472,6 +2238,17 @@ export declare interface Worksheet {
|
|
|
1472
2238
|
rows: Row[];
|
|
1473
2239
|
colWidths: Record<number, number>;
|
|
1474
2240
|
rowHeights: Record<number, number>;
|
|
2241
|
+
/** Per-column outline (grouping) depth 0-7 (ECMA-376 §18.3.1.13
|
|
2242
|
+
* `<col outlineLevel>`), keyed by 1-based column index. Present only for
|
|
2243
|
+
* grouped columns; absent (⇒ level 0) on outline-free sheets. */
|
|
2244
|
+
colOutlineLevels?: Record<number, number>;
|
|
2245
|
+
/** Per-column `<col collapsed>` (§18.3.1.13): `true` on a summary column whose
|
|
2246
|
+
* one-level-deeper detail columns are collapsed. Only `true` entries. */
|
|
2247
|
+
colCollapsed?: Record<number, boolean>;
|
|
2248
|
+
/** Per-column `<col hidden>` (§18.3.1.13): `true` when the column is hidden
|
|
2249
|
+
* (e.g. a collapsed outline hides its detail columns). Distinct from
|
|
2250
|
+
* `colWidths[c] === 0`. Only `true` entries. */
|
|
2251
|
+
colHidden?: Record<number, boolean>;
|
|
1475
2252
|
defaultColWidth: number;
|
|
1476
2253
|
defaultRowHeight: number;
|
|
1477
2254
|
mergeCells: MergeCell[];
|
|
@@ -1494,6 +2271,11 @@ export declare interface Worksheet {
|
|
|
1494
2271
|
* grid so column A sits on the right (ECMA-376 §18.3.1.87
|
|
1495
2272
|
* `<sheetView rightToLeft>`). Defaults to false. */
|
|
1496
2273
|
rightToLeft?: boolean;
|
|
2274
|
+
/** Outline display flags from `<sheetPr><outlinePr>` (ECMA-376 §18.3.1.61).
|
|
2275
|
+
* Absent when the sheet declares no `<outlinePr>`; consumers apply the
|
|
2276
|
+
* schema defaults (`summaryBelow` / `summaryRight` both `true`). Decides
|
|
2277
|
+
* which side of a group the summary row/column (and its +/- toggle) sits. */
|
|
2278
|
+
outlinePr?: OutlinePr;
|
|
1497
2279
|
/** Sheet tab color (ECMA-376 §18.3.1.79). */
|
|
1498
2280
|
tabColor?: string | null;
|
|
1499
2281
|
/** AutoFilter header range (ECMA-376 §18.3.1.2). */
|
|
@@ -1537,6 +2319,17 @@ export declare interface Worksheet {
|
|
|
1537
2319
|
defaultFontFamily?: string;
|
|
1538
2320
|
/** Point size of the workbook's Normal-style font (`<fonts>[N].sz.val`). */
|
|
1539
2321
|
defaultFontSize?: number;
|
|
2322
|
+
/** Workbook date system (`<workbookPr date1904>`, ECMA-376 §18.2.28),
|
|
2323
|
+
* denormalized onto every worksheet by the parser so the cell formatter can
|
|
2324
|
+
* resolve serial dates (§18.17.4.1) without a workbook back-reference.
|
|
2325
|
+
* `true` = 1904 date system. Omitted (⇒ false) for the default 1900 system. */
|
|
2326
|
+
date1904?: boolean;
|
|
2327
|
+
/** RB7 partial degradation: set when THIS sheet's part could not be
|
|
2328
|
+
* read/parsed. The workbook still opens with the OTHER sheets intact; this one
|
|
2329
|
+
* is an empty placeholder (`rows` empty) whose `parseError` names the offending
|
|
2330
|
+
* part (e.g. `"xl/worksheets/sheet3.xml: <detail>"`). Absent (`undefined`) for
|
|
2331
|
+
* every healthy sheet. The renderer paints a visible error overlay. */
|
|
2332
|
+
parseError?: string;
|
|
1540
2333
|
}
|
|
1541
2334
|
|
|
1542
2335
|
/**
|
|
@@ -1563,6 +2356,20 @@ export declare interface XlsxComment {
|
|
|
1563
2356
|
text: string;
|
|
1564
2357
|
}
|
|
1565
2358
|
|
|
2359
|
+
/** Where an xlsx match lives: the sheet, its name, and the cell (A1 + row/col). */
|
|
2360
|
+
export declare interface XlsxMatchLocation {
|
|
2361
|
+
/** 0-based sheet index. */
|
|
2362
|
+
sheet: number;
|
|
2363
|
+
/** The sheet's display name. */
|
|
2364
|
+
sheetName: string;
|
|
2365
|
+
/** A1 cell reference, e.g. `"B7"`. */
|
|
2366
|
+
ref: string;
|
|
2367
|
+
/** 1-based row. */
|
|
2368
|
+
row: number;
|
|
2369
|
+
/** 1-based column. */
|
|
2370
|
+
col: number;
|
|
2371
|
+
}
|
|
2372
|
+
|
|
1566
2373
|
/** Emitted once per cell that has text, with the cell's canvas-pixel bounds. */
|
|
1567
2374
|
export declare interface XlsxTextRunInfo {
|
|
1568
2375
|
text: string;
|
|
@@ -1578,13 +2385,53 @@ export declare interface XlsxTextRunInfo {
|
|
|
1578
2385
|
col: number;
|
|
1579
2386
|
}
|
|
1580
2387
|
|
|
1581
|
-
export declare class XlsxViewer {
|
|
2388
|
+
export declare class XlsxViewer implements ZoomableViewer {
|
|
1582
2389
|
private wb;
|
|
1583
2390
|
/** The single subtree root the constructor appended to the caller's
|
|
1584
2391
|
* container. destroy() removes it to return the container to its original
|
|
1585
2392
|
* (empty) state. */
|
|
1586
2393
|
private wrapper;
|
|
1587
2394
|
private canvas;
|
|
2395
|
+
/** Region holding the outline gutters (top/left) and the inset {@link canvasArea}.
|
|
2396
|
+
* When the active sheet has no outlining the gutters collapse to 0 px and this
|
|
2397
|
+
* is a transparent pass-through, so an outline-free sheet lays out identically. */
|
|
2398
|
+
private gridRegion;
|
|
2399
|
+
/** Left gutter canvas: row group brackets + toggles (XL4). */
|
|
2400
|
+
private rowGutter;
|
|
2401
|
+
/** Top gutter canvas: column group brackets + toggles (XL4). */
|
|
2402
|
+
private colGutter;
|
|
2403
|
+
/** Top-left corner canvas: numbered level buttons (XL4). */
|
|
2404
|
+
private cornerGutter;
|
|
2405
|
+
/** Cached extents (unscaled CSS px) of the current sheet's gutters; both 0 for
|
|
2406
|
+
* an outline-free sheet. `w` insets {@link canvasArea} from the left, `h` from
|
|
2407
|
+
* the top. */
|
|
2408
|
+
private gutter;
|
|
2409
|
+
/** Per-axis outline layout (group brackets + toggles) for the current sheet,
|
|
2410
|
+
* recomputed on sheet switch and after each collapse/expand. `null` axis ⇒ no
|
|
2411
|
+
* outlining on that axis. */
|
|
2412
|
+
private rowOutline;
|
|
2413
|
+
private colOutline;
|
|
2414
|
+
private rowOutlineBands;
|
|
2415
|
+
private colOutlineBands;
|
|
2416
|
+
/** Original row heights / column widths stashed the first time a band is
|
|
2417
|
+
* collapsed, so expanding restores a custom size rather than the default.
|
|
2418
|
+
* Keyed by band index; per current worksheet (cleared on sheet switch). */
|
|
2419
|
+
private stashedRowHeights;
|
|
2420
|
+
private stashedColWidths;
|
|
2421
|
+
/**
|
|
2422
|
+
* Per-sheet cumulative record of every view-only size mutation (outline
|
|
2423
|
+
* collapse/expand, drag-to-resize #567), keyed by sheet index. Value = the
|
|
2424
|
+
* band's current model size, or `null` when the model has no entry (default
|
|
2425
|
+
* size). Serialized as {@link WireSizeOverrides} with every worker
|
|
2426
|
+
* `renderViewport` so the worker's local sheet cache converges to the
|
|
2427
|
+
* main-thread model — without it the worker keeps drawing the file's
|
|
2428
|
+
* original sizes and the grid bitmap goes stale under the (up-to-date)
|
|
2429
|
+
* gutter and overlays. Entries are updated in place and never removed
|
|
2430
|
+
* (idempotent re-application); the whole store resets when a new workbook
|
|
2431
|
+
* loads. Main mode never reads it (the main renderer draws from the mutated
|
|
2432
|
+
* model directly).
|
|
2433
|
+
*/
|
|
2434
|
+
private sizeOverrideStore;
|
|
1588
2435
|
private canvasArea;
|
|
1589
2436
|
private scrollHost;
|
|
1590
2437
|
private spacer;
|
|
@@ -1608,6 +2455,26 @@ export declare class XlsxViewer {
|
|
|
1608
2455
|
* holds one context type for its lifetime, so this is obtained once and the
|
|
1609
2456
|
* main-mode 2d render path is never used on the same canvas. */
|
|
1610
2457
|
private _bitmapCtx;
|
|
2458
|
+
/** Set by {@link destroy} (first line). Guards {@link _reportRenderError} so a
|
|
2459
|
+
* render rejection that lands AFTER teardown is swallowed rather than surfaced
|
|
2460
|
+
* to an `onError` / `console.error` on a dead viewer — parity with the scroll
|
|
2461
|
+
* viewers' `_destroyed` flag. */
|
|
2462
|
+
private _destroyed;
|
|
2463
|
+
/**
|
|
2464
|
+
* Concurrent-load latch (generation token). Every {@link load} increments this
|
|
2465
|
+
* and captures the value; after its workbook finishes loading it re-checks the
|
|
2466
|
+
* live value and BAILS (destroying its own just-loaded workbook) if a newer
|
|
2467
|
+
* `load()` has since started. Without it, two overlapping `load(A)`/`load(B)`
|
|
2468
|
+
* calls race the WASM parse / worker init, and whichever RESOLVES last wins the
|
|
2469
|
+
* swap — even the stale `load(A)` resolving after `load(B)`; the loser's freshly
|
|
2470
|
+
* created workbook (never installed, or installed then overwritten) then leaks
|
|
2471
|
+
* its worker + pinned WASM allocation. The latch composes with SC20: the check
|
|
2472
|
+
* runs AFTER the new workbook loads but BEFORE the field assignment and
|
|
2473
|
+
* `previous?.destroy()`, so a superseded load never touches `this.wb` nor frees
|
|
2474
|
+
* the current (newer) workbook. {@link destroy} also bumps it so a load in
|
|
2475
|
+
* flight at teardown is treated as superseded and its workbook cleaned up.
|
|
2476
|
+
*/
|
|
2477
|
+
private _loadGen;
|
|
1611
2478
|
private resizeObserver;
|
|
1612
2479
|
/**
|
|
1613
2480
|
* Pending `requestAnimationFrame` handle for a coalesced re-render, or `null`
|
|
@@ -1646,13 +2513,27 @@ export declare class XlsxViewer {
|
|
|
1646
2513
|
* strand the view at the sheet's far end once the host gains its real size.
|
|
1647
2514
|
*/
|
|
1648
2515
|
private effectiveH;
|
|
2516
|
+
/** Gesture-only pointer anchor for the NEXT `setScale`, in canvasArea-viewport
|
|
2517
|
+
* px (`{ x, y }` from the wheel event, relative to the grid's top-left). Set by
|
|
2518
|
+
* the Ctrl/⌘+wheel handler right before it calls `setScale` so the zoom pivots
|
|
2519
|
+
* on the cursor ("zoom toward the pointer") in BOTH axes, past the fixed
|
|
2520
|
+
* header + frozen-pane lead-in; consumed and cleared by `setScale`. `null` for
|
|
2521
|
+
* every non-gesture source (the public `setScale`, the +/- steppers, the zoom
|
|
2522
|
+
* slider, `fitWidth`/`fitPage`), which keep the historical START-anchored
|
|
2523
|
+
* (top-left) preservation so their behaviour is unchanged. */
|
|
2524
|
+
private _pendingZoomAnchor;
|
|
1649
2525
|
private anchorCell;
|
|
1650
2526
|
private activeCell;
|
|
1651
2527
|
private selectionMode;
|
|
1652
2528
|
private isSelecting;
|
|
1653
2529
|
private selectionOverlay;
|
|
2530
|
+
/** IX2 — find-highlight overlay (matched-cell boxes). */
|
|
2531
|
+
private findOverlay;
|
|
2532
|
+
/** IX2 — find state (matches + active cursor). */
|
|
2533
|
+
private _find;
|
|
1654
2534
|
private keydownHandler;
|
|
1655
2535
|
private pendingTap;
|
|
2536
|
+
private pendingClick;
|
|
1656
2537
|
private resizeDrag;
|
|
1657
2538
|
/** DOM overlay element that shows the hovered cell's comment. Lives in
|
|
1658
2539
|
* canvasArea above the scrollHost; `pointer-events:none` so it never blocks
|
|
@@ -1660,6 +2541,11 @@ export declare class XlsxViewer {
|
|
|
1660
2541
|
private commentPopup;
|
|
1661
2542
|
/** `"row:col"` → comment for the current sheet, rebuilt on every showSheet. */
|
|
1662
2543
|
private commentMap;
|
|
2544
|
+
/** IX1 — `"row:col"` → hyperlink for the current sheet, rebuilt on every
|
|
2545
|
+
* showSheet. Keys mirror the renderer's `hyperlinkMap` (1-based row/col, the
|
|
2546
|
+
* first cell of a hyperlink `ref` range per the parser), so a `getCellAt`
|
|
2547
|
+
* {row,col} looks up directly. */
|
|
2548
|
+
private hyperlinkMap;
|
|
1663
2549
|
/** `"row:col"` of the cell whose popup is currently shown (or pending), so a
|
|
1664
2550
|
* pointermove within the same cell doesn't restart the show timer. */
|
|
1665
2551
|
private commentPopupKey;
|
|
@@ -1681,17 +2567,80 @@ export declare class XlsxViewer {
|
|
|
1681
2567
|
* click; installed only while the panel is open. */
|
|
1682
2568
|
private validationOutsideHandler;
|
|
1683
2569
|
constructor(container: HTMLElement, opts?: XlsxViewerOptions);
|
|
2570
|
+
/** Every non-empty cell of a sheet with its rendered display text (IX2 find
|
|
2571
|
+
* source). Reads the parsed worksheet model directly — no render — so search
|
|
2572
|
+
* covers the whole sheet, not just the on-screen viewport. */
|
|
2573
|
+
private _collectSheetCells;
|
|
1684
2574
|
/**
|
|
1685
2575
|
* Load an XLSX from URL or ArrayBuffer and render the first sheet.
|
|
1686
2576
|
*
|
|
1687
|
-
* Error contract (shared by all three viewers):
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
2577
|
+
* Error contract (shared by all three viewers):
|
|
2578
|
+
* - Parse/load failure (the underlying `XlsxWorkbook.load()` call itself
|
|
2579
|
+
* rejects): if an `onError` callback was provided it is invoked and `load`
|
|
2580
|
+
* resolves normally; if not, the error is rethrown so it is never silently
|
|
2581
|
+
* swallowed.
|
|
2582
|
+
* - Render failure (the first sheet fails to draw AFTER a successful
|
|
2583
|
+
* parse/load): routed to the shared `_reportRenderError` contract (`onError`
|
|
2584
|
+
* if provided, else `console.error` — never silent) and `load` still
|
|
2585
|
+
* RESOLVES, matching every subsequent navigation call.
|
|
1690
2586
|
*/
|
|
1691
2587
|
load(source: string | ArrayBuffer): Promise<void>;
|
|
1692
2588
|
/** The loaded workbook, or throws if {@link load} has not completed. */
|
|
1693
2589
|
private get workbook();
|
|
1694
2590
|
showSheet(index: number): Promise<void>;
|
|
2591
|
+
/** Recompute the per-axis outline layout for `ws` and cache the band lists.
|
|
2592
|
+
* Both axes are `null` (gutters collapse to 0) when the sheet has no
|
|
2593
|
+
* outlining, so an outline-free sheet is untouched. */
|
|
2594
|
+
private buildOutline;
|
|
2595
|
+
/** Size and place the three gutter canvases (corner / col / row) from the
|
|
2596
|
+
* current outline, and inset {@link canvasArea} by the gutter extents. When
|
|
2597
|
+
* neither axis is grouped both extents are 0 and canvasArea covers the whole
|
|
2598
|
+
* region — pixel-identical to a viewer built before XL4. */
|
|
2599
|
+
private layoutGutters;
|
|
2600
|
+
/** Paint all visible gutter strips for the current scroll offset. Called at the
|
|
2601
|
+
* end of every grid render so the brackets track scroll / zoom exactly. */
|
|
2602
|
+
private renderGutters;
|
|
2603
|
+
/** Draw one axis's group brackets and +/- toggles into its gutter canvas,
|
|
2604
|
+
* aligned to the on-screen band positions via {@link getCellRect}. */
|
|
2605
|
+
private paintAxisGutter;
|
|
2606
|
+
/** Draw a small square +/- toggle centered at (cx, cy) in gutter-canvas CSS px. */
|
|
2607
|
+
private drawToggleBox;
|
|
2608
|
+
/** Draw one numbered level button centered at (cx, cy) in gutter-canvas CSS
|
|
2609
|
+
* px. Shared by the row bank (in the row gutter's top strip) and the column
|
|
2610
|
+
* bank (in the column gutter's left strip). */
|
|
2611
|
+
private drawLevelButton;
|
|
2612
|
+
/** Paint the corner (intersection of the two gutters) as plain background.
|
|
2613
|
+
* The numbered level banks live in each axis gutter's own header strip
|
|
2614
|
+
* (see paintAxisGutter), so the corner carries no interactive content. */
|
|
2615
|
+
private paintCornerGutter;
|
|
2616
|
+
/** Handle a click in a row/col gutter: hit-test the +/- toggles and toggle the
|
|
2617
|
+
* matching group's collapse state. */
|
|
2618
|
+
private onGutterPointerDown;
|
|
2619
|
+
/** Flip a single group's collapse state in the in-memory model, then rebuild
|
|
2620
|
+
* the outline + repaint. View-only: the file is never written. */
|
|
2621
|
+
private applyGroupToggle;
|
|
2622
|
+
/** Collapse/expand the whole sheet to `level` on one axis. */
|
|
2623
|
+
private applyLevelButton;
|
|
2624
|
+
/** Set a row/column hidden by mapping to the size-0 encoding the axis/renderer
|
|
2625
|
+
* already understand, stashing the original size so expand can restore it. */
|
|
2626
|
+
private setBandHidden;
|
|
2627
|
+
/** Record band `index`'s CURRENT model size (or `null` = no entry) in the
|
|
2628
|
+
* per-sheet override store. Called after every view-only size mutation —
|
|
2629
|
+
* outline hide/show above and drag-to-resize (#567) — so worker renders
|
|
2630
|
+
* converge to the main model. */
|
|
2631
|
+
private recordSizeOverride;
|
|
2632
|
+
/** The current sheet's override store serialized for the wire, or undefined
|
|
2633
|
+
* when nothing has been mutated (keeps the request payload unchanged). */
|
|
2634
|
+
private wireSizeOverrides;
|
|
2635
|
+
/** Update the `collapsed` flag on a band's model entry so the outline rebuild
|
|
2636
|
+
* reflects the new state. */
|
|
2637
|
+
private setBandCollapsed;
|
|
2638
|
+
/** Shared tail of a gutter interaction: invalidate the axis cache, rebuild the
|
|
2639
|
+
* outline (collapsed flags changed), refresh dependent geometry, re-render. */
|
|
2640
|
+
private afterOutlineMutation;
|
|
2641
|
+
/** Rebuild only the layout + band lists (not the stashes) after a collapse
|
|
2642
|
+
* state change, so the +/- glyphs and bracket set stay in sync. */
|
|
2643
|
+
private buildOutlineLayoutOnly;
|
|
1695
2644
|
/** True when the current sheet's grid is laid out right-to-left. */
|
|
1696
2645
|
private get isRtl();
|
|
1697
2646
|
/** Maximum horizontal scroll offset the native scroll host allows (≥ 0). */
|
|
@@ -1816,6 +2765,46 @@ export declare class XlsxViewer {
|
|
|
1816
2765
|
* whole range) to mirror Excel, which attaches the button to the active
|
|
1817
2766
|
* cell of the selection. */
|
|
1818
2767
|
private maybeDrawValidationDropdown;
|
|
2768
|
+
/**
|
|
2769
|
+
* Redraw the find-highlight overlay: one translucent box per matched cell on
|
|
2770
|
+
* the current sheet, the active match in a stronger colour. Uses the SAME
|
|
2771
|
+
* `getCellRect` + `screenX` + header/frozen clamp the selection overlay uses,
|
|
2772
|
+
* so a box lands exactly on the drawn cell at any scroll offset / zoom / RTL.
|
|
2773
|
+
* Rebuilt on every render and scroll (cheap DOM geometry, no canvas paint).
|
|
2774
|
+
*/
|
|
2775
|
+
private updateFindOverlay;
|
|
2776
|
+
/**
|
|
2777
|
+
* IX2 — find every occurrence of `query` across every sheet and highlight the
|
|
2778
|
+
* matched cells. Returns every match in document order (sheet ascending, then
|
|
2779
|
+
* row-major within a sheet), each tagged with its
|
|
2780
|
+
* `{ sheet, sheetName, ref, row, col }`. A cell is the search unit: search
|
|
2781
|
+
* runs over each cell's *rendered* display text (number formats, dates, rich
|
|
2782
|
+
* text flattened), so a query matches what the grid shows. Case-insensitive by
|
|
2783
|
+
* default; pass `{ caseSensitive: true }` for an exact match. An empty query
|
|
2784
|
+
* clears the find.
|
|
2785
|
+
*/
|
|
2786
|
+
findText(query: string, opts?: FindMatchesOptions): Promise<FindMatch<XlsxMatchLocation>[]>;
|
|
2787
|
+
/**
|
|
2788
|
+
* IX2 — move to the next match (wrap-around), switching sheets and scrolling
|
|
2789
|
+
* the matched cell into view as needed, and highlight it as the active match.
|
|
2790
|
+
* Returns the now-active match, or `null` when there are none. Call
|
|
2791
|
+
* {@link findText} first.
|
|
2792
|
+
*/
|
|
2793
|
+
findNext(): Promise<FindMatch<XlsxMatchLocation> | null>;
|
|
2794
|
+
/** IX2 — move to the previous match (wrap-around). */
|
|
2795
|
+
findPrev(): Promise<FindMatch<XlsxMatchLocation> | null>;
|
|
2796
|
+
/** IX2 — clear all highlights and reset the find state. */
|
|
2797
|
+
clearFind(): void;
|
|
2798
|
+
private _activateMatch;
|
|
2799
|
+
/**
|
|
2800
|
+
* Scroll the grid so cell (row, col) is comfortably in view. Computes the
|
|
2801
|
+
* cell's absolute logical offset from the axis metrics (the same the renderer
|
|
2802
|
+
* uses) and nudges `scrollHost.scrollTop` / start-anchored horizontal scroll
|
|
2803
|
+
* only when the cell is outside the scrollable viewport — an in-view cell is
|
|
2804
|
+
* left where it is (Excel's find behaviour). Frozen cells are always visible,
|
|
2805
|
+
* so they need no scroll.
|
|
2806
|
+
*/
|
|
2807
|
+
private _scrollCellIntoView;
|
|
1819
2808
|
/** Toggle the dropdown panel for the active cell's list validation. Called
|
|
1820
2809
|
* from pointerdown when the arrow rect is hit. Re-clicking the same arrow
|
|
1821
2810
|
* closes it. */
|
|
@@ -1843,6 +2832,37 @@ export declare class XlsxViewer {
|
|
|
1843
2832
|
* collision (Excel allows at most one note per cell, so this is moot in
|
|
1844
2833
|
* practice). */
|
|
1845
2834
|
private buildCommentMap;
|
|
2835
|
+
/** IX1 — index the current sheet's hyperlinks by `"row:col"` (1-based, first
|
|
2836
|
+
* cell of the `ref` range) so a clicked/hovered cell resolves in O(1). Keys
|
|
2837
|
+
* match the renderer's `hyperlinkMap` exactly (`${hl.row}:${hl.col}`). */
|
|
2838
|
+
private buildHyperlinkMap;
|
|
2839
|
+
/** IX1 — the hyperlink at a cell, or null. `getCellAt` returns 1-based
|
|
2840
|
+
* {row,col}, matching the parser/renderer keying.
|
|
2841
|
+
*
|
|
2842
|
+
* Returns null unconditionally when `enableHyperlinks` is `false`: this is the
|
|
2843
|
+
* single gate that disables hyperlink interactivity. Both consumers — the
|
|
2844
|
+
* pointermove pointer-cursor affordance and the click dispatch
|
|
2845
|
+
* ({@link dispatchHyperlink}) — funnel through this hit-test, so a null result
|
|
2846
|
+
* means no cursor change, no default navigation, and no `onHyperlinkClick`. */
|
|
2847
|
+
private hyperlinkAtCell;
|
|
2848
|
+
/**
|
|
2849
|
+
* IX1 — dispatch a click on a hyperlinked cell. Builds a
|
|
2850
|
+
* {@link HyperlinkTarget} from the parsed hyperlink (external `url` wins over
|
|
2851
|
+
* internal `location`, matching Excel: a `<hyperlink>` carrying both navigates
|
|
2852
|
+
* to the external target) and routes it to the caller's `onHyperlinkClick`
|
|
2853
|
+
* (which fully owns behaviour) or the built-in default. Returns true when a
|
|
2854
|
+
* hyperlink was found and dispatched.
|
|
2855
|
+
*/
|
|
2856
|
+
private dispatchHyperlink;
|
|
2857
|
+
/**
|
|
2858
|
+
* IX1 default handler for an internal `location` target (§18.3.1.47): a defined
|
|
2859
|
+
* name or a cell ref like `Sheet1!A1`. Best-effort: if the part before `!`
|
|
2860
|
+
* names a sheet in the workbook, switch to it. There is no scroll-to-cell
|
|
2861
|
+
* primitive on this viewer, so the cell part is not yet honoured (switching the
|
|
2862
|
+
* sheet already lands the user on the right surface). A bare defined name that
|
|
2863
|
+
* does not resolve to a sheet is a documented no-op.
|
|
2864
|
+
*/
|
|
2865
|
+
private navigateInternalHyperlink;
|
|
1846
2866
|
/** Show the popup for the comment on `cell` after the hover dwell, anchored to
|
|
1847
2867
|
* the cell's current on-screen rect. No-op when the cell carries no comment.
|
|
1848
2868
|
* Re-hovering the same cell does not restart the timer. */
|
|
@@ -1877,10 +2897,46 @@ export declare class XlsxViewer {
|
|
|
1877
2897
|
private zoomPosToScale;
|
|
1878
2898
|
/** Inverse of {@link zoomPosToScale}: scale factor → slider position [0,100]. */
|
|
1879
2899
|
private zoomScaleToPos;
|
|
1880
|
-
/**
|
|
1881
|
-
*
|
|
1882
|
-
*
|
|
2900
|
+
/**
|
|
2901
|
+
* IX9 {@link ZoomableViewer} — set the cell/header scale (`1` = 100%; the
|
|
2902
|
+
* viewer's `cellScale`) and re-lay-out the current sheet. Clamped to the zoom
|
|
2903
|
+
* bounds and snapped to whole percent; keeps the slider thumb, percentage label
|
|
2904
|
+
* and the row-header-aligned tab-nav width in sync, and fires `onScaleChange`
|
|
2905
|
+
* when the resolved scale actually changes.
|
|
2906
|
+
*/
|
|
1883
2907
|
setScale(scale: number): void;
|
|
2908
|
+
/** IX9 {@link ZoomableViewer} — the current zoom factor (`1` = 100%). This is
|
|
2909
|
+
* the viewer's `cellScale`; `1` before anything is set. */
|
|
2910
|
+
getScale(): number;
|
|
2911
|
+
/** IX9 {@link ZoomableViewer} — step up to the next rung of the shared zoom
|
|
2912
|
+
* ladder (clamped to `zoomMax` by {@link setScale}). */
|
|
2913
|
+
zoomIn(): void;
|
|
2914
|
+
/** IX9 {@link ZoomableViewer} — step down to the next lower ladder rung. */
|
|
2915
|
+
zoomOut(): void;
|
|
2916
|
+
/**
|
|
2917
|
+
* IX9 {@link ZoomableViewer} — fit the used data range's WIDTH to the canvas
|
|
2918
|
+
* area. The "content" is the natural (100%) width of the row header plus the
|
|
2919
|
+
* used columns; the container is `canvasArea.clientWidth`. A no-op (defers) when
|
|
2920
|
+
* nothing is loaded or the container is unlaid-out. Routes through
|
|
2921
|
+
* {@link setScale}, so the result is clamped/snapped and fires `onScaleChange`.
|
|
2922
|
+
*/
|
|
2923
|
+
fitWidth(): void;
|
|
2924
|
+
/**
|
|
2925
|
+
* IX9 {@link ZoomableViewer} — fit the used data range's WIDTH AND HEIGHT inside
|
|
2926
|
+
* the canvas area (header + used columns/rows), so the whole used range is
|
|
2927
|
+
* visible without scrolling. Takes the tighter of the width- and height-fit
|
|
2928
|
+
* factors. Defers when unloaded / unlaid-out; routes through {@link setScale}.
|
|
2929
|
+
*/
|
|
2930
|
+
fitPage(): void;
|
|
2931
|
+
/** Shared fit implementation for {@link fitWidth} / {@link fitPage}: derive the
|
|
2932
|
+
* natural (cs=1) content extent of the used data range, ask core's pure
|
|
2933
|
+
* {@link fitScale} for the factor, and apply it via {@link setScale}. */
|
|
2934
|
+
private _fit;
|
|
2935
|
+
/** Natural (unscaled, cs=1) CSS-px extent of a worksheet's used data range:
|
|
2936
|
+
* the row/column header plus every used column width / row height. Mirrors
|
|
2937
|
+
* {@link updateSpacerSize} at cs=1 (same used-range detection) so the fit
|
|
2938
|
+
* targets exactly the region the spacer/scroll extent covers. */
|
|
2939
|
+
private _naturalContentExtent;
|
|
1884
2940
|
private updateSpacerSize;
|
|
1885
2941
|
/**
|
|
1886
2942
|
* Coalesce a re-render into the next animation frame. Called from the
|
|
@@ -1896,6 +2952,11 @@ export declare class XlsxViewer {
|
|
|
1896
2952
|
*/
|
|
1897
2953
|
private scheduleRender;
|
|
1898
2954
|
private renderCurrentSheet;
|
|
2955
|
+
/** Route a render failure to `onError`, or `console.error` when none is given
|
|
2956
|
+
* (never fully silent), and never after teardown. Mirrors the scroll viewers'
|
|
2957
|
+
* `_reportRenderError`. */
|
|
2958
|
+
private _reportRenderError;
|
|
2959
|
+
private _renderCurrentSheet;
|
|
1899
2960
|
private computeHeaderHighlight;
|
|
1900
2961
|
get sheetNames(): string[];
|
|
1901
2962
|
/** The underlying <canvas> element the grid is drawn on. */
|
|
@@ -1932,9 +2993,20 @@ export declare interface XlsxViewerOptions extends LoadOptions_2 {
|
|
|
1932
2993
|
* own zoom control). */
|
|
1933
2994
|
showZoomSlider?: boolean;
|
|
1934
2995
|
/** Lower/upper bounds for the zoom slider as scale factors. Default 0.1–4
|
|
1935
|
-
* (10%–400%, matching Excel's zoom range).
|
|
2996
|
+
* (10%–400%, matching Excel's zoom range). Also the clamp range for the IX9
|
|
2997
|
+
* {@link ZoomableViewer} zoom contract ({@link XlsxViewer.setScale} etc.). */
|
|
1936
2998
|
zoomMin?: number;
|
|
1937
2999
|
zoomMax?: number;
|
|
3000
|
+
/**
|
|
3001
|
+
* IX9 — fires whenever the zoom factor actually changes (`1` = 100%), whatever
|
|
3002
|
+
* the source: {@link XlsxViewer.setScale}, {@link XlsxViewer.zoomIn} /
|
|
3003
|
+
* {@link XlsxViewer.zoomOut}, {@link XlsxViewer.fitWidth} /
|
|
3004
|
+
* {@link XlsxViewer.fitPage}, the built-in zoom slider, the +/- buttons, or a
|
|
3005
|
+
* Ctrl/⌘+wheel gesture. Named `onScaleChange` to match the docx/pptx viewers so
|
|
3006
|
+
* all five share one notification shape. Not fired when a call resolves to the
|
|
3007
|
+
* same (clamped/snapped) scale.
|
|
3008
|
+
*/
|
|
3009
|
+
onScaleChange?: (scale: number) => void;
|
|
1938
3010
|
onReady?: (sheetNames: string[]) => void;
|
|
1939
3011
|
/**
|
|
1940
3012
|
* Called when the active sheet changes, with the new sheet's zero-based
|
|
@@ -1948,6 +3020,23 @@ export declare interface XlsxViewerOptions extends LoadOptions_2 {
|
|
|
1948
3020
|
onError?: (err: Error) => void;
|
|
1949
3021
|
/** Called when the selected cell range changes. null means no selection. */
|
|
1950
3022
|
onSelectionChange?: (selection: CellRange | null) => void;
|
|
3023
|
+
/**
|
|
3024
|
+
* IX1 (design decision — NOT user-confirmed, integrator may veto). Fires when a
|
|
3025
|
+
* cell carrying a hyperlink (ECMA-376 §18.3.1.47) is clicked. Default when
|
|
3026
|
+
* omitted: external → {@link openExternalHyperlink} (new tab, sanitised,
|
|
3027
|
+
* noopener); internal (`location`) → navigate to the referenced sheet/cell
|
|
3028
|
+
* when resolvable. When supplied, this callback fully owns the behaviour and
|
|
3029
|
+
* receives the raw {@link HyperlinkTarget} verbatim (URL sanitisation is the
|
|
3030
|
+
* default handler's job, so a blocked scheme still reaches a custom callback).
|
|
3031
|
+
*/
|
|
3032
|
+
onHyperlinkClick?: (target: HyperlinkTarget) => void;
|
|
3033
|
+
/** IX1 — master switch for hyperlink interactivity. Default `true`. When
|
|
3034
|
+
* `false`, the cell hit-test reports no hyperlink under any cell, so hyperlink
|
|
3035
|
+
* interactivity is disabled entirely: no pointer cursor over a link, no default
|
|
3036
|
+
* navigation (external new-tab / internal sheet jump), and `onHyperlinkClick`
|
|
3037
|
+
* is never called. Hyperlinked cells still render exactly as authored but are
|
|
3038
|
+
* inert. */
|
|
3039
|
+
enableHyperlinks?: boolean;
|
|
1951
3040
|
/**
|
|
1952
3041
|
* Color of the cell-selection highlight. A single CSS color drives both the
|
|
1953
3042
|
* selection rectangle's border (drawn in this color) and its fill (the same
|
|
@@ -2006,6 +3095,12 @@ export declare class XlsxWorkbook {
|
|
|
2006
3095
|
* `renderViewport` call reuses it — equations in shapes render when present,
|
|
2007
3096
|
* and are skipped (engine tree-shaken) when omitted. */
|
|
2008
3097
|
private math;
|
|
3098
|
+
/** Google-Fonts `FontFace` objects this workbook preloaded into `document.fonts`
|
|
3099
|
+
* (main mode only — in worker mode the worker owns them and terminates with its
|
|
3100
|
+
* own FontFaceSet). Released in {@link destroy} so they do not leak into the
|
|
3101
|
+
* shared FontFaceSet for the lifetime of the SPA (deduped + refcounted in core,
|
|
3102
|
+
* so a web font shared with another open workbook survives until both go). */
|
|
3103
|
+
private googleFontFaces;
|
|
2009
3104
|
private _mode;
|
|
2010
3105
|
private constructor();
|
|
2011
3106
|
/** Parse an XLSX from a URL or ArrayBuffer. */
|
|
@@ -2045,6 +3140,22 @@ export declare class XlsxWorkbook {
|
|
|
2045
3140
|
* route-through-worker decision).
|
|
2046
3141
|
*/
|
|
2047
3142
|
getImage(imagePath: string, mimeType: string): Promise<Blob>;
|
|
3143
|
+
/**
|
|
3144
|
+
* Project the workbook to GitHub-flavoured markdown: each sheet becomes a
|
|
3145
|
+
* `## SheetName` section followed by a pipe table of its populated bounding
|
|
3146
|
+
* box (fully-empty middle rows trimmed, ULP noise masked). Styling, charts,
|
|
3147
|
+
* and drawings are discarded — the projection is meant for AI ingestion and
|
|
3148
|
+
* full-text search, not layout.
|
|
3149
|
+
*
|
|
3150
|
+
* Runs entirely in the worker off the archive opened at {@link load} (no
|
|
3151
|
+
* re-copy of the file, no re-parse of the model on the main thread), so it
|
|
3152
|
+
* works in BOTH `mode: 'main'` and `mode: 'worker'`.
|
|
3153
|
+
*
|
|
3154
|
+
* @example
|
|
3155
|
+
* const wb = await XlsxWorkbook.load(buffer);
|
|
3156
|
+
* const md = await wb.toMarkdown();
|
|
3157
|
+
*/
|
|
3158
|
+
toMarkdown(): Promise<string>;
|
|
2048
3159
|
/**
|
|
2049
3160
|
* Resolve a `list`-type data-validation `formula1` (ECMA-376 §18.3.1.32) into
|
|
2050
3161
|
* the set of allowed values to display, evaluated relative to `sheetIndex`
|
|
@@ -2061,6 +3172,24 @@ export declare class XlsxWorkbook {
|
|
|
2061
3172
|
* Read-only: this only reads cell values for display; it never writes.
|
|
2062
3173
|
*/
|
|
2063
3174
|
resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
|
|
3175
|
+
/**
|
|
3176
|
+
* IX2 — the display string a cell shows on the grid, i.e. exactly what
|
|
3177
|
+
* {@link renderViewport} would draw (number formats, dates, booleans, rich
|
|
3178
|
+
* text flattened). Used by {@link XlsxViewer.findText} to search the *rendered*
|
|
3179
|
+
* text rather than the raw stored value, so a search matches what the user
|
|
3180
|
+
* sees. Threads the workbook styles + the sheet's date system through the
|
|
3181
|
+
* shared {@link formatCellValue} (the same call the renderer and
|
|
3182
|
+
* validation-list expansion use). Returns `''` before the workbook is loaded.
|
|
3183
|
+
*/
|
|
3184
|
+
cellText(ws: Worksheet, cell: Cell): string;
|
|
3185
|
+
/**
|
|
3186
|
+
* Render a sheet viewport into `target`. Note: `opts.fetchImage` is ignored
|
|
3187
|
+
* here — image bytes always come from this workbook's own archive through its
|
|
3188
|
+
* stable per-instance loader, whose closure identity keys the shared decoded
|
|
3189
|
+
* caches, the render-pass lease, and {@link destroy}'s cache drops. Callers
|
|
3190
|
+
* needing a custom byte source should use the standalone
|
|
3191
|
+
* `renderWorksheetViewport` orchestrator directly.
|
|
3192
|
+
*/
|
|
2064
3193
|
renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
|
|
2065
3194
|
/**
|
|
2066
3195
|
* Render a sheet viewport and return it as an ImageBitmap (both modes; in
|
|
@@ -2080,4 +3209,90 @@ export declare class XlsxWorkbook {
|
|
|
2080
3209
|
destroy(): void;
|
|
2081
3210
|
}
|
|
2082
3211
|
|
|
3212
|
+
/**
|
|
3213
|
+
* IX9 — the shared zoom API contract for every viewer (DocxViewer, PptxViewer,
|
|
3214
|
+
* DocxScrollViewer, PptxScrollViewer, XlsxViewer).
|
|
3215
|
+
*
|
|
3216
|
+
* This module owns ONLY the pure, DOM-free pieces of the contract: the type
|
|
3217
|
+
* ({@link ZoomableViewer}), the discrete zoom-step ladder ({@link nextZoomStep} /
|
|
3218
|
+
* {@link prevZoomStep}), the fit-to-content scale math ({@link fitScale}), and the
|
|
3219
|
+
* range clamp ({@link clampScale}). Each viewer implements the interface with its
|
|
3220
|
+
* own scale field and re-render path; this keeps ONE definition of "what a zoom
|
|
3221
|
+
* factor means" and "what the +/- steps are" across all five, so a host can drive
|
|
3222
|
+
* any viewer through the same six calls without special-casing the format.
|
|
3223
|
+
*
|
|
3224
|
+
* SCALE SEMANTICS (the contract): a scale of `1` means 100% — the content at its
|
|
3225
|
+
* natural size (a docx page at `widthPt × PT_TO_PX`, a pptx slide at
|
|
3226
|
+
* `slideWidth / EMU_PER_PX`, an xlsx grid at `cellScale` 1). `getScale()` and
|
|
3227
|
+
* `setScale(n)` speak this user-facing factor for EVERY viewer.
|
|
3228
|
+
*
|
|
3229
|
+
* KNOWN FAMILY DIFFERENCE — the INITIAL scale right after load (deliberate,
|
|
3230
|
+
* documented rather than papered over): the single-canvas viewers (DocxViewer /
|
|
3231
|
+
* PptxViewer) and XlsxViewer start at `1` (or the effective factor implied by an
|
|
3232
|
+
* explicit `width` option); the continuous-scroll viewers (DocxScrollViewer /
|
|
3233
|
+
* PptxScrollViewer) AUTO-FIT to the container on first layout, so their
|
|
3234
|
+
* `getScale()` right after load reports the fit-to-width BASE factor (≠ 1 unless
|
|
3235
|
+
* the container happens to match the natural width). The unit is identical — only
|
|
3236
|
+
* the starting point differs, because fit-to-width is the natural resting state
|
|
3237
|
+
* of a continuous document viewer.
|
|
3238
|
+
*
|
|
3239
|
+
* PRE-LOAD `setScale` (family-unified, IX9 F1): a `setScale` called before the
|
|
3240
|
+
* content is loaded / before the layout is established is LATCHED — never
|
|
3241
|
+
* silently dropped — and applied once the viewer establishes its scale (the
|
|
3242
|
+
* single-canvas viewers honour it on the first render; the scroll viewers apply
|
|
3243
|
+
* it right after the base fit establishes, firing `onScaleChange` at application
|
|
3244
|
+
* time). `getScale()` reports the latched factor while it is pending.
|
|
3245
|
+
*
|
|
3246
|
+
* API SHAPE (idiomatic default — the integrator MAY veto; see the IX9 PR): a
|
|
3247
|
+
* six-method surface plus one change notification (`onScaleChange`). Deliberately
|
|
3248
|
+
* NO new UI here — the contract is API only (design decision IX9 §4). Touch-pinch
|
|
3249
|
+
* (IX8) is out of scope.
|
|
3250
|
+
*/
|
|
3251
|
+
/**
|
|
3252
|
+
* The zoom contract every viewer satisfies. All scales are the user-facing factor
|
|
3253
|
+
* where `1` = 100% (see the module note). `fitWidth`/`fitPage` are async because a
|
|
3254
|
+
* fit re-renders at the new scale; the getters/steppers resolve synchronously.
|
|
3255
|
+
*/
|
|
3256
|
+
declare interface ZoomableViewer {
|
|
3257
|
+
/** The current zoom factor (`1` = 100%). Never throws — returns the default
|
|
3258
|
+
* (`1`) before anything is loaded, or the latched pending factor when a
|
|
3259
|
+
* pre-load `setScale` is waiting to be applied (see the module note). */
|
|
3260
|
+
getScale(): number;
|
|
3261
|
+
/** Set the absolute zoom factor (`1` = 100%), clamped to the viewer's
|
|
3262
|
+
* `[zoomMin, zoomMax]`. Re-renders at the new scale and fires `onScaleChange`
|
|
3263
|
+
* when the clamped value actually changes. Called BEFORE the content is
|
|
3264
|
+
* loaded / the layout is established, the (clamped) factor is LATCHED and
|
|
3265
|
+
* applied once the viewer establishes its scale — family-unified semantics
|
|
3266
|
+
* (IX9 F1): never silently dropped by any viewer. */
|
|
3267
|
+
setScale(scale: number): void | Promise<void>;
|
|
3268
|
+
/** Step up to the next larger rung of the shared zoom ladder (25 %→400 %),
|
|
3269
|
+
* clamped to `zoomMax`. Equivalent to `setScale(nextZoomStep(getScale()))`. */
|
|
3270
|
+
zoomIn(): void | Promise<void>;
|
|
3271
|
+
/** Step down to the next smaller ladder rung, clamped to `zoomMin`. */
|
|
3272
|
+
zoomOut(): void | Promise<void>;
|
|
3273
|
+
/** Fit the content's WIDTH to the container (the common "fit width" / "fit
|
|
3274
|
+
* page width" verb). Sets the scale so one page/slide/sheet-column-run spans
|
|
3275
|
+
* the available width, then re-renders. Resolves once the fit render settles.
|
|
3276
|
+
*
|
|
3277
|
+
* PERSISTENCE is viewer-implementation-dependent (deliberate, by family): the
|
|
3278
|
+
* single-canvas viewers (DocxViewer / PptxViewer) and XlsxViewer apply the fit
|
|
3279
|
+
* ONE-SHOT — they observe no container resizes, so a later resize does NOT
|
|
3280
|
+
* re-fit (call `fitWidth()` again after a layout change). The continuous-
|
|
3281
|
+
* scroll viewers (DocxScrollViewer / PptxScrollViewer) re-fit their width-fit
|
|
3282
|
+
* base on every container resize, so a `fitWidth()` there effectively
|
|
3283
|
+
* PERSISTS across resizes (the resize re-fit preserves the width-fit state). */
|
|
3284
|
+
fitWidth(): void | Promise<void>;
|
|
3285
|
+
/** Fit the WHOLE content (width AND height) inside the container, so an entire
|
|
3286
|
+
* page/slide is visible without scrolling. Sets the scale to the smaller of the
|
|
3287
|
+
* width- and height-fit factors, then re-renders.
|
|
3288
|
+
*
|
|
3289
|
+
* PERSISTENCE is viewer-implementation-dependent, and — unlike `fitWidth` —
|
|
3290
|
+
* a page fit does NOT persist across container resizes on ANY viewer: the
|
|
3291
|
+
* single-canvas viewers and XlsxViewer observe no resizes at all (one-shot),
|
|
3292
|
+
* and the continuous-scroll viewers' resize handler re-applies the WIDTH fit
|
|
3293
|
+
* (preserving the zoom multiplier), not the page fit. Re-invoke `fitPage()`
|
|
3294
|
+
* after a layout change to re-fit. */
|
|
3295
|
+
fitPage(): void | Promise<void>;
|
|
3296
|
+
}
|
|
3297
|
+
|
|
2083
3298
|
export { }
|