@silurus/ooxml 0.56.0 → 0.58.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.
@@ -32,6 +32,19 @@ declare interface AutoResizeOptions {
32
32
  pauseWhenHidden?: boolean;
33
33
  }
34
34
 
35
+ /**
36
+ * `<a:bevel>` — ECMA-376 §20.1.5.3 (`CT_Bevel`). Lengths in EMU; `w`/`h`
37
+ * default to 76200 EMU and `prst` to "circle".
38
+ */
39
+ declare interface Bevel3d {
40
+ /** Bevel width in EMU. */
41
+ w: number;
42
+ /** Bevel height in EMU. */
43
+ h: number;
44
+ /** Bevel preset name (`ST_BevelPresetType`). */
45
+ prst: string;
46
+ }
47
+
35
48
  declare type BodyElement = {
36
49
  type: 'paragraph';
37
50
  } & DocParagraph | {
@@ -83,6 +96,21 @@ declare type Bullet = {
83
96
  startAt: number | null;
84
97
  };
85
98
 
99
+ /**
100
+ * `<a:camera>` — ECMA-376 §20.1.5.5 (`CT_Camera`). `prst` selects one of the
101
+ * 62 preset cameras (§20.1.10.47); `fov`/`zoom`/`rot` optionally override it.
102
+ */
103
+ declare interface Camera3d {
104
+ /** Preset camera name (`ST_PresetCameraType`), e.g. "perspectiveRelaxed". */
105
+ prst: string;
106
+ /** Field-of-view override in degrees. Omitted = preset default. */
107
+ fov?: number;
108
+ /** Zoom factor as a unit ratio (1.0 = 100%). Omitted = 1.0. */
109
+ zoom?: number;
110
+ /** Camera rotation override. Omitted = preset base orientation. */
111
+ rot?: Rot3d;
112
+ }
113
+
86
114
  declare interface Cell {
87
115
  col: number;
88
116
  row: number;
@@ -223,6 +251,8 @@ declare type CfRule = {
223
251
  } | {
224
252
  type: 'aboveAverage';
225
253
  aboveAverage: boolean;
254
+ equalAverage?: boolean;
255
+ stdDev?: number;
226
256
  dxfId: number | null;
227
257
  priority: number;
228
258
  } | {
@@ -305,7 +335,7 @@ declare interface ChartData {
305
335
  * adapter tell "spec said noFill → transparent" from "no spPr → default". */
306
336
  hasChartSpPr?: boolean;
307
337
  /** `<c:legend><c:manualLayout>` fractions of chart space (§21.2.2.31). */
308
- legendManualLayout?: LegendManualLayout | null;
338
+ legendManualLayout?: LegendManualLayout_2 | null;
309
339
  /** `<c:catAx><c:delete val="1"/>` — hide the category axis (§21.2.2.40). */
310
340
  catAxisHidden?: boolean;
311
341
  /** `<c:valAx><c:delete val="1"/>` — hide the value axis (§21.2.2.40). */
@@ -512,6 +542,169 @@ declare interface ChartManualLayout {
512
542
  h?: number;
513
543
  }
514
544
 
545
+ declare interface ChartModel {
546
+ chartType: ChartType;
547
+ title: string | null;
548
+ categories: string[];
549
+ series: ChartSeries[];
550
+ /** Show data labels on bars / points / slices. */
551
+ showDataLabels: boolean;
552
+ /** Explicit Y-axis minimum (OOXML `<c:valAx><c:min>`). */
553
+ valMin: number | null;
554
+ /** Explicit Y-axis maximum (OOXML `<c:valAx><c:max>`). */
555
+ valMax: number | null;
556
+ catAxisTitle: string | null;
557
+ valAxisTitle: string | null;
558
+ /** `<c:catAx><c:delete val="1"/>`. */
559
+ catAxisHidden: boolean;
560
+ /** `<c:valAx><c:delete val="1"/>`. */
561
+ valAxisHidden: boolean;
562
+ /** `<c:catAx><c:spPr><a:ln><a:noFill>` — hide just the axis LINE; labels
563
+ * and tick marks still render. Distinct from `catAxisHidden` (which
564
+ * removes everything via `<c:delete val="1"/>`). */
565
+ catAxisLineHidden: boolean;
566
+ /** `<c:valAx><c:spPr><a:ln><a:noFill>` — hide just the axis LINE; labels
567
+ * and tick marks still render. */
568
+ valAxisLineHidden: boolean;
569
+ /** Hex without '#'. From `<c:plotArea><c:spPr><a:solidFill>`. */
570
+ plotAreaBg: string | null;
571
+ /** Outer chartSpace background (hex without '#'). null when noFill/absent. */
572
+ chartBg: string | null;
573
+ /** True when `<c:legend>` is declared in the chart XML. False = no legend. */
574
+ showLegend: boolean;
575
+ /** `<c:legend><c:legendPos val>` — "r"|"l"|"t"|"b"|"tr". null = default (r). */
576
+ legendPos: 'r' | 'l' | 't' | 'b' | 'tr' | null;
577
+ /** `<c:catAx><c:crossBetween val="..."/>`. "between" inserts 0.5-step padding
578
+ * on each end of the category axis; "midCat" anchors endpoints to the axes. */
579
+ catAxisCrossBetween: 'between' | 'midCat' | string;
580
+ /** `<c:valAx><c:majorTickMark>`. ECMA-376 default is "cross". */
581
+ valAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
582
+ /** `<c:catAx><c:majorTickMark>`. */
583
+ catAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
584
+ /** `<c:valAx | catAx><c:minorTickMark>`. ECMA-376 default is "none". */
585
+ valAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
586
+ catAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
587
+ /** Title font size in OOXML hundredths of a point (1600 = 16pt). null = default. */
588
+ titleFontSizeHpt: number | null;
589
+ /** Title font color as a hex string without '#' (e.g. "1B4332"). null = default. */
590
+ titleFontColor: string | null;
591
+ /** Title font family from `<a:latin typeface>` (ECMA-376 §20.1.4.2.24). null = default. */
592
+ titleFontFace: string | null;
593
+ /** `<c:catAx><c:txPr>` font size (hpt). null = fall back to proportional default. */
594
+ catAxisFontSizeHpt: number | null;
595
+ /** `<c:valAx><c:txPr>` font size (hpt). null = fall back to proportional default. */
596
+ valAxisFontSizeHpt: number | null;
597
+ /** `<c:catAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#').
598
+ * null = renderer default. Lets templates color category labels gray. */
599
+ catAxisFontColor?: string | null;
600
+ /** `<c:valAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
601
+ valAxisFontColor?: string | null;
602
+ /** `<c:dLbls><c:txPr>` font size (hpt) for data-point value labels. */
603
+ dataLabelFontSizeHpt: number | null;
604
+ /** Waterfall subtotal category indices. */
605
+ subtotalIndices: number[];
606
+ /** `<c:legend><c:manualLayout>` absolute placement fractions of the chart
607
+ * space (ECMA-376 §21.2.2.31). Overrides the default side-based legend
608
+ * rectangle while still letting `legendPos` decide which side of the plot
609
+ * gets the reserved band. null = use default layout. */
610
+ legendManualLayout?: LegendManualLayout | null;
611
+ /**
612
+ * `<c:valAx><c:numFmt@formatCode>` — format code applied to value-axis tick
613
+ * labels (ECMA-376 §21.2.2.21). null = plain numeric formatting.
614
+ */
615
+ valAxisFormatCode?: string | null;
616
+ /**
617
+ * `<c:barChart><c:gapWidth>` — space between category groups as a
618
+ * percentage of bar width (ECMA-376 §21.2.2.13). Default per spec is 150.
619
+ * null = renderer default.
620
+ */
621
+ barGapWidth?: number | null;
622
+ /**
623
+ * `<c:barChart><c:overlap>` — signed percentage overlap between bars in the
624
+ * same category cluster (ECMA-376 §21.2.2.25). Negative = gap, positive =
625
+ * overlap, 0 = flush. Range [-100, 100]. null = renderer default (0).
626
+ */
627
+ barOverlap?: number | null;
628
+ /**
629
+ * `<c:dLbls><c:dLblPos>` — data label position (ECMA-376 §21.2.2.16).
630
+ * "ctr"|"inBase"|"inEnd"|"outEnd"|"l"|"r"|"t"|"b"|"bestFit" etc.
631
+ */
632
+ dataLabelPosition?: string | null;
633
+ /** Hex (no `#`) for data label text, resolved from `<c:dLbls><c:txPr>`. */
634
+ dataLabelFontColor?: string | null;
635
+ /**
636
+ * `<c:dLbls><c:numFmt@formatCode>` — chart-level override for data label
637
+ * number format (ECMA-376 §21.2.2.35). When absent, `valFormatCode` on each
638
+ * series is used.
639
+ */
640
+ dataLabelFormatCode?: string | null;
641
+ /** `<c:title>...defRPr@b>` chart title bold flag. */
642
+ titleFontBold?: boolean | null;
643
+ /** `<c:catAx><c:txPr>...defRPr@b>` X-axis tick label bold flag. */
644
+ catAxisFontBold?: boolean | null;
645
+ /** `<c:valAx><c:txPr>...defRPr@b>` Y-axis tick label bold flag. */
646
+ valAxisFontBold?: boolean | null;
647
+ /**
648
+ * `<c:catAx><c:crosses val>` (`autoZero` | `min` | `max`). Drives the Y
649
+ * coordinate where the X axis is drawn. Default `autoZero` puts the X
650
+ * axis at y=0 — that's how Excel "Project Timeline" templates split
651
+ * milestones (positive Y) above and tasks (negative Y) below the axis.
652
+ */
653
+ catAxisCrosses?: string | null;
654
+ /** `<c:catAx><c:crossesAt val>` — explicit numeric override for the
655
+ * crossing point. Takes precedence over `catAxisCrosses`. */
656
+ catAxisCrossesAt?: number | null;
657
+ valAxisCrosses?: string | null;
658
+ valAxisCrossesAt?: number | null;
659
+ /** Axis line color (hex without `#`) and width in EMU from
660
+ * `<c:catAx|valAx><c:spPr><a:ln>`. */
661
+ catAxisLineColor?: string | null;
662
+ catAxisLineWidthEmu?: number | null;
663
+ valAxisLineColor?: string | null;
664
+ valAxisLineWidthEmu?: number | null;
665
+ /**
666
+ * `<c:catAx><c:numFmt@formatCode>` (or scatter X-axis valAx). When set,
667
+ * the renderer formats X-axis tick labels with this code (e.g. dates).
668
+ */
669
+ catAxisFormatCode?: string | null;
670
+ /**
671
+ * `<c:catAx><c:scaling><c:min/max>` — explicit X-axis range. Used by
672
+ * scatter / bubble charts whose X axis is numeric. null = derive from
673
+ * data extents.
674
+ */
675
+ catAxisMin?: number | null;
676
+ catAxisMax?: number | null;
677
+ /**
678
+ * `<c:title><c:layout><c:manualLayout>` (ECMA-376 §21.2.2.27) absolute
679
+ * placement for the chart title.
680
+ */
681
+ titleManualLayout?: ChartManualLayout | null;
682
+ /**
683
+ * `<c:plotArea><c:layout><c:manualLayout>` absolute placement for the
684
+ * plot area. `layoutTarget="inner"` (default) describes the inner plot
685
+ * rect (no axes / labels); `outer` describes the outer rect (axes
686
+ * included).
687
+ */
688
+ plotAreaManualLayout?: ChartManualLayout | null;
689
+ /**
690
+ * `<c:scatterChart><c:scatterStyle val>` (ECMA-376 §21.2.2.42). Drives
691
+ * whether scatter charts connect points with lines and whether those
692
+ * lines are smoothed. Values: "marker" (markers only — Excel default
693
+ * "Scatter"), "line" / "lineMarker" (straight segments), "smooth" /
694
+ * "smoothMarker" (cubic Bézier through points), "lineNoMarker",
695
+ * "smoothNoMarker". null = renderer default ("marker"). Only consulted
696
+ * for `chartType === "scatter"`; bubble ignores it.
697
+ */
698
+ scatterStyle?: string | null;
699
+ /**
700
+ * `<c:radarChart><c:radarStyle val>` (ECMA-376 §21.2.3.10). Controls
701
+ * whether radar series render as line + markers ("standard" / "marker")
702
+ * or as a closed polygon with area fill ("filled"). null = default
703
+ * ("standard" — line, no fill). Only consulted for `chartType === "radar"`.
704
+ */
705
+ radarStyle?: string | null;
706
+ }
707
+
515
708
  declare interface ChartSeries {
516
709
  name: string;
517
710
  /** Hex without '#'. null = fall back to palette. */
@@ -626,6 +819,13 @@ declare interface ChartSeriesDataLabels {
626
819
  fontSizeHpt?: number;
627
820
  }
628
821
 
822
+ /**
823
+ * Canonical chart type vocabulary. Embeds direction (`H` = horizontal) and
824
+ * grouping (`Pct` = percent-stacked) so renderers do not need to inspect
825
+ * separate `barDir`/`grouping` fields.
826
+ */
827
+ declare type ChartType = 'line' | 'stackedLine' | 'stackedLinePct' | 'clusteredBar' | 'clusteredBarH' | 'stackedBar' | 'stackedBarH' | 'stackedBarPct' | 'stackedBarHPct' | 'area' | 'stackedArea' | 'stackedAreaPct' | 'pie' | 'doughnut' | 'scatter' | 'bubble' | 'radar' | 'waterfall' | string;
828
+
629
829
  declare interface ConditionalFormat {
630
830
  sqref: CellRange[];
631
831
  rules: CfRule[];
@@ -650,6 +850,28 @@ declare interface DataPointOverride {
650
850
  markerLine?: string;
651
851
  }
652
852
 
853
+ /** One `<dataValidation>` rule (ECMA-376 §18.3.1.33). `type` is the constraint
854
+ * class (`list` | `whole` | `decimal` | `date` | `time` | `textLength` |
855
+ * `custom`); `operator` qualifies it (`between` | `notBetween` | `equal` | …).
856
+ * `formula1` / `formula2` are the operands (for `list`, `formula1` is the
857
+ * comma-separated literal list or a range/named reference). 1:1 with the Rust
858
+ * `DataValidation` (serde camelCase). */
859
+ declare interface DataValidation {
860
+ /** Affected cell ranges, verbatim from `@sqref` (space-separated A1 refs). */
861
+ sqref: string;
862
+ /** Constraint class. Absent means the spec default (`none`, no constraint). */
863
+ validationType?: string;
864
+ operator?: string;
865
+ formula1?: string;
866
+ formula2?: string;
867
+ /** `@allowBlank` — empty input is permitted. */
868
+ allowBlank?: boolean;
869
+ promptTitle?: string;
870
+ prompt?: string;
871
+ errorTitle?: string;
872
+ errorMessage?: string;
873
+ }
874
+
653
875
  declare interface DefinedName {
654
876
  name: string;
655
877
  formula: string;
@@ -665,7 +887,12 @@ declare interface DocComment {
665
887
 
666
888
  declare interface DocNote {
667
889
  id: string;
668
- text: string;
890
+ /** ECMA-376 §17.11.2 / §17.11.10 — the note's block-level content
891
+ * (paragraphs / nested tables), parsed with the document's styles +
892
+ * numbering. The leading run is the `<w:footnoteRef/>` auto-number marker
893
+ * (carries a {@link DocxTextRun.noteRef}). Use {@link noteText} to extract
894
+ * the plain-text body without the marker. */
895
+ content: BodyElement[];
669
896
  }
670
897
 
671
898
  declare interface DocParagraph {
@@ -707,10 +934,21 @@ declare interface DocParagraph {
707
934
  defaultFontFamily?: string | null;
708
935
  /**
709
936
  * ECMA-376 §17.3.1.6 `<w:bidi>` — right-to-left paragraph. `true` = RTL,
710
- * `false` = explicitly LTR, absent = unspecified (inherit). Phase 0 of RTL
711
- * support: recorded only; alignment/column-order resolution is deferred.
937
+ * `false` = explicitly LTR, absent = unspecified (inherit). The renderer uses
938
+ * this as the paragraph base direction: it seeds the UAX#9 reordering pass
939
+ * (`computeLineVisualOrder`), swaps the left/right indents, resolves the
940
+ * `w:jc` start/end edges (`resolveAlignEdge`), and lays out lines from the
941
+ * right.
712
942
  */
713
943
  bidi?: boolean;
944
+ /**
945
+ * ECMA-376 §17.3.1.32 `<w:snapToGrid>` — when `false`, this paragraph opts out
946
+ * of the section's document grid (`w:docGrid`): its lines use natural font
947
+ * metrics / the line-spacing multiplier directly instead of snapping to the
948
+ * grid pitch. `undefined` = inherit (default on). Set on Word's "Footnote
949
+ * Text" style, so footnote bodies use compact natural line height.
950
+ */
951
+ snapToGrid?: boolean;
714
952
  }
715
953
 
716
954
  declare interface DocRevision {
@@ -775,8 +1013,8 @@ declare interface DocTable {
775
1013
  /**
776
1014
  * ECMA-376 §17.4.1 `<w:bidiVisual>` — render columns in right-to-left
777
1015
  * (visual) order. `true` = RTL columns, `false` = explicitly LTR, absent =
778
- * unspecified. Phase 0 of RTL support: recorded only; column-order
779
- * resolution is deferred.
1016
+ * unspecified. When `true` the renderer mirrors the grid so logical column 0
1017
+ * is placed rightmost, and flips per-cell left/right borders accordingly.
780
1018
  */
781
1019
  bidiVisual?: boolean;
782
1020
  }
@@ -821,18 +1059,41 @@ export declare namespace docx {
821
1059
  DocxViewerOptions,
822
1060
  autoResize,
823
1061
  AutoResizeOptions,
1062
+ noteText,
824
1063
  DocxDocumentModel,
1064
+ DocSettings,
825
1065
  SectionProps,
1066
+ HeadersFooters,
1067
+ HeaderFooter,
1068
+ NumberingInfo,
826
1069
  BodyElement,
827
1070
  DocParagraph,
828
1071
  DocRun,
829
1072
  DocxTextRun,
1073
+ FieldRun,
830
1074
  ImageRun,
1075
+ ShapeRun,
1076
+ ShapeText_2 as ShapeText,
1077
+ RubyAnnotation,
831
1078
  RenderPageOptions,
832
1079
  RunRevision,
833
1080
  DocRevision,
834
1081
  DocComment,
835
1082
  DocNote,
1083
+ NoteRef,
1084
+ LineSpacing,
1085
+ TabStop_2 as TabStop,
1086
+ ParagraphBorders,
1087
+ ParaBorderEdge,
1088
+ DocTable,
1089
+ DocTableRow,
1090
+ DocTableCell,
1091
+ CellElement,
1092
+ TableBorders,
1093
+ CellBorders,
1094
+ BorderSpec,
1095
+ PathCmd_3 as PathCmd,
1096
+ GradientStop_2 as GradientStop,
836
1097
  DocxTextRunInfo
837
1098
  }
838
1099
  }
@@ -848,6 +1109,29 @@ declare class DocxDocument {
848
1109
  destroy(): void;
849
1110
  get pageCount(): number;
850
1111
  get document(): DocxDocumentModel;
1112
+ /**
1113
+ * ECMA-376 §17.13.4 — the document's comments (`word/comments.xml`), each with
1114
+ * id / author / initials / date / plain-text body. Comments are a data-only
1115
+ * API: they are NOT drawn on the page (Word renders them in a margin pane /
1116
+ * balloons, which this viewer does not reproduce). Use this to build a review
1117
+ * panel, export an annotation list, etc. Returns `[]` when the document has no
1118
+ * comments part. The same data is also reachable via `document.comments`.
1119
+ */
1120
+ get comments(): DocComment[];
1121
+ /**
1122
+ * ECMA-376 §17.11.10 — the document's footnotes (`word/footnotes.xml`),
1123
+ * excluding the reserved separator entries. Each note carries its `id` and
1124
+ * block-level `content`; use {@link noteText} for the plain-text body. These
1125
+ * ARE drawn at the bottom of the page that holds their reference; this getter
1126
+ * additionally exposes them as data. Returns `[]` when absent.
1127
+ */
1128
+ get footnotes(): DocNote[];
1129
+ /**
1130
+ * ECMA-376 §17.11.4 — the document's endnotes (`word/endnotes.xml`). Same
1131
+ * shape as {@link footnotes}; rendered at the end of the document. Returns
1132
+ * `[]` when absent.
1133
+ */
1134
+ get endnotes(): DocNote[];
851
1135
  private _getPages;
852
1136
  renderPage(target: HTMLCanvasElement | OffscreenCanvas, pageIndex: number, opts?: RenderPageOptions): Promise<void>;
853
1137
  }
@@ -918,8 +1202,10 @@ declare interface DocxTextRun {
918
1202
  * tracked changes appear inline. */
919
1203
  revision?: RunRevision;
920
1204
  /** ECMA-376 §17.3.2.30 `<w:rtl>` — complex-script / right-to-left run.
921
- * `true` = RTL, `false` = explicitly LTR, absent = unspecified.
922
- * Phase 0: recorded only; glyph-order resolution is deferred. */
1205
+ * `true` = RTL, `false` = explicitly LTR, absent = unspecified. The renderer
1206
+ * treats a `true` run as RTL for the UAX#9 pass (it forces complex-script
1207
+ * shaping and marks the segment so `computeLineVisualOrder` reorders it), and
1208
+ * draws the slice with `ctx.direction = 'rtl'` so Canvas mirrors the glyphs. */
923
1209
  rtl?: boolean;
924
1210
  /** ECMA-376 §17.3.2.7 `<w:cs/>` — complex-script run toggle: cs formatting
925
1211
  * applies to ALL characters of the run (§17.3.2.26). Distinct from
@@ -938,6 +1224,12 @@ declare interface DocxTextRun {
938
1224
  /** ECMA-376 §17.3.2.20 `<w:lang w:bidi>` — complex-script (RTL) language tag,
939
1225
  * lower-cased (e.g. "ar-sa", "ae-ar"). Drives Word's AN digit ordering. */
940
1226
  langBidi?: string;
1227
+ /** ECMA-376 §17.11.6/.7/.16/.17 — set when this run is a footnote/endnote
1228
+ * reference marker (`<w:footnoteReference>` in the body, `<w:footnoteRef>` at
1229
+ * the start of the note's content, and the endnote equivalents). `text` holds
1230
+ * the raw `@w:id`; the renderer overrides the displayed glyph with the note's
1231
+ * sequential number. */
1232
+ noteRef?: NoteRef;
941
1233
  }
942
1234
 
943
1235
  /** Information about a rendered text segment for building a transparent selection overlay. */
@@ -1061,7 +1353,20 @@ declare interface FieldRun {
1061
1353
  highlight?: string | null;
1062
1354
  }
1063
1355
 
1064
- declare type Fill = SolidFill | NoFill | GradientFill | PatternFill;
1356
+ declare type Fill = SolidFill | NoFill | GradientFill | PatternFill | ImageFill;
1357
+
1358
+ /**
1359
+ * ECMA-376 §20.1.8.30 (CT_RelativeRect) — the destination rectangle a stretched
1360
+ * blip is mapped into, as edge insets relative to the fill region. Values are
1361
+ * fractions (ST_Percentage / 100000); **negative values let the image bleed
1362
+ * past the box (overscan)**. Absent edges default to 0.
1363
+ */
1364
+ declare interface FillRect {
1365
+ l?: number;
1366
+ t?: number;
1367
+ r?: number;
1368
+ b?: number;
1369
+ }
1065
1370
 
1066
1371
  /** ECMA-376 §20.1.8.17 (CT_GlowEffect) — coloured halo with blur radius. */
1067
1372
  declare interface Glow {
@@ -1150,6 +1455,30 @@ declare interface ImageAnchor {
1150
1455
  dataUrl: string;
1151
1456
  }
1152
1457
 
1458
+ /**
1459
+ * Image fill — ECMA-376 §20.1.8.14 (CT_BlipFillProperties). The embedded blip
1460
+ * is resolved to a base64 data URL at parse time. Both fill-modes are modelled
1461
+ * and mutually exclusive: `stretch` (§20.1.8.56) carries {@link ImageFill.fillRect};
1462
+ * `tile` (§20.1.8.58) carries {@link ImageFill.tile}.
1463
+ */
1464
+ declare interface ImageFill {
1465
+ fillType: 'image';
1466
+ /** `data:<mime>;base64,…` of the embedded blip. */
1467
+ dataUrl: string;
1468
+ /**
1469
+ * `<a:stretch><a:fillRect>` insets. Absent → fills the whole box (or the
1470
+ * fill is tiled — see {@link ImageFill.tile}).
1471
+ */
1472
+ fillRect?: FillRect;
1473
+ /**
1474
+ * `<a:tile>` descriptor. Present only when the blipFill is tiled; mutually
1475
+ * exclusive with {@link ImageFill.fillRect}.
1476
+ */
1477
+ tile?: TileInfo;
1478
+ /** `a:blip > a:alphaModFix@amt` as a fraction (0.0–1.0). Absent = opaque. */
1479
+ alpha?: number;
1480
+ }
1481
+
1153
1482
  declare interface ImageRun {
1154
1483
  dataUrl: string;
1155
1484
  widthPt: number;
@@ -1195,14 +1524,39 @@ declare interface ImageRun {
1195
1524
  }
1196
1525
 
1197
1526
  declare interface LegendManualLayout {
1527
+ /** `"edge"` = `x`/`y` are fractions from top-left of chart space;
1528
+ * `"factor"` = fractions offset from the default position. */
1198
1529
  xMode: string;
1199
1530
  yMode: string;
1531
+ /** Fractions of chart space width/height. */
1200
1532
  x: number;
1201
1533
  y: number;
1202
1534
  w: number;
1203
1535
  h: number;
1204
1536
  }
1205
1537
 
1538
+ declare interface LegendManualLayout_2 {
1539
+ xMode: string;
1540
+ yMode: string;
1541
+ x: number;
1542
+ y: number;
1543
+ w: number;
1544
+ h: number;
1545
+ }
1546
+
1547
+ /**
1548
+ * `<a:lightRig>` — ECMA-376 §20.1.5.9 (`CT_LightRig`). Drives the bevel-lip
1549
+ * lighting (Phase B): `dir` selects the key-light octant.
1550
+ */
1551
+ declare interface LightRig {
1552
+ /** Light-rig preset (`ST_LightRigType`), e.g. "threePt". */
1553
+ rig: string;
1554
+ /** Light direction (`ST_LightRigDirection`): tl/t/tr/l/r/bl/b/br. */
1555
+ dir: string;
1556
+ /** Optional rotation override of the rig. */
1557
+ rot?: Rot3d;
1558
+ }
1559
+
1206
1560
  declare interface LineBreak {
1207
1561
  type: 'break';
1208
1562
  }
@@ -1449,6 +1803,20 @@ declare interface NoFill {
1449
1803
  fillType: 'none';
1450
1804
  }
1451
1805
 
1806
+ /** A footnote / endnote reference marker (ECMA-376 §17.11). */
1807
+ declare interface NoteRef {
1808
+ /** "footnote" | "endnote" */
1809
+ kind: 'footnote' | 'endnote' | string;
1810
+ /** `@w:id` linking the marker to its note. Empty for the in-note
1811
+ * `<w:footnoteRef/>` placeholder (the renderer uses the enclosing note). */
1812
+ id: string;
1813
+ }
1814
+
1815
+ /** Flatten a footnote/endnote's content to its plain-text body, excluding the
1816
+ * auto-number reference marker. Convenience for data-only consumers
1817
+ * (the renderer draws {@link DocNote.content} directly). */
1818
+ declare function noteText(note: DocNote): string;
1819
+
1452
1820
  declare interface NumberingInfo {
1453
1821
  numId: number;
1454
1822
  level: number;
@@ -1635,8 +2003,29 @@ declare interface PictureElement {
1635
2003
  flipV: boolean;
1636
2004
  /** Data URL, e.g. "data:image/png;base64,..." */
1637
2005
  dataUrl: string;
1638
- /** OOXML adj value (0–100000) for roundRect clip, null = plain rectangle */
1639
- clipAdjust: number | null;
2006
+ /**
2007
+ * Border line from `<p:pic><p:spPr><a:ln>` (ECMA-376 §20.1.2.2.24). A
2008
+ * `p:pic`'s spPr is `CT_ShapeProperties` (§19.3.1.37), so a picture carries
2009
+ * the same line model as a shape. `null` when there is no `<a:ln>` or it
2010
+ * resolves to `<a:noFill/>` (border explicitly suppressed). The border is
2011
+ * stroked along the picture's clip silhouette (roundRect / custGeom / rect).
2012
+ */
2013
+ stroke: Stroke | null;
2014
+ /**
2015
+ * `<p:spPr><a:prstGeom prst="…">` preset name (e.g. `"roundRect"`,
2016
+ * `"ellipse"`). ECMA-376 §20.1.9.18: a picture's preset geometry is its clip
2017
+ * silhouette and the path its border / contour hug. Undefined / omitted = a
2018
+ * plain rectangle (`prst="rect"` or no prstGeom). When set, the renderer
2019
+ * builds the silhouette via the shared preset-geometry engine (any of the 186
2020
+ * presets). `custGeom` takes priority when both are present.
2021
+ */
2022
+ prstGeom?: string;
2023
+ /**
2024
+ * Adjust guides from the prstGeom `<a:avLst>` (1/1000-of-a-percent OOXML
2025
+ * units), in `gd@name` declaration order (index 0 = adj/adj1, 1 = adj2, …).
2026
+ * Omitted when avLst is empty — the preset's own declared defaults then apply.
2027
+ */
2028
+ prstAdjust?: number[];
1640
2029
  /**
1641
2030
  * ECMA-376 a:srcRect — source image crop as fractions (0..1) of the source
1642
2031
  * width/height. Omitted when the image is not cropped.
@@ -1657,6 +2046,27 @@ declare interface PictureElement {
1657
2046
  * trimmed to the laptop / device silhouette declared in the file.
1658
2047
  */
1659
2048
  custGeom?: PathCmd[][] | null;
2049
+ /**
2050
+ * Drop shadow from `spPr > effectLst > outerShdw`. A `p:pic`'s `spPr` is
2051
+ * `CT_ShapeProperties` (ECMA-376 §19.3.1.37), so the same effects shapes
2052
+ * carry apply to images. ECMA-376 §20.1.8.45 (CT_OuterShadowEffect).
2053
+ */
2054
+ shadow?: Shadow;
2055
+ /** Inner (inset) shadow from effectLst > innerShdw. ECMA-376 §20.1.8.40. */
2056
+ innerShadow?: Shadow;
2057
+ /** Coloured glow halo from effectLst > glow. ECMA-376 §20.1.8.32. */
2058
+ glow?: Glow;
2059
+ /** Soft (feathered) edge from effectLst > softEdge. ECMA-376 §20.1.8.53. */
2060
+ softEdge?: SoftEdge;
2061
+ /** Mirrored reflection from effectLst > reflection. ECMA-376 §20.1.8.50. */
2062
+ reflection?: Reflection;
2063
+ /** `<a:scene3d>` 3D camera scene (ECMA-376 §20.1.5.5). A `p:pic`'s spPr is
2064
+ * `CT_ShapeProperties`, so 3D scenes apply to images. When non-identity the
2065
+ * renderer projects the picture through the camera homography (Phase A). */
2066
+ scene3d?: Scene3d;
2067
+ /** `<a:sp3d>` 3D shape properties (ECMA-376 §20.1.5.12). Parsed but not
2068
+ * rendered in Phase A. */
2069
+ sp3d?: Sp3d;
1660
2070
  }
1661
2071
 
1662
2072
  export declare namespace pptx {
@@ -1670,25 +2080,65 @@ export declare namespace pptx {
1670
2080
  RenderOptions,
1671
2081
  PptxTextRunInfo,
1672
2082
  TextRunCallback,
2083
+ PresentationHandle,
1673
2084
  autoResize,
1674
2085
  AutoResizeOptions,
1675
2086
  Presentation,
1676
2087
  Slide,
2088
+ PptxComment,
1677
2089
  SlideElement,
1678
2090
  ShapeElement,
1679
2091
  PictureElement,
2092
+ TableElement,
2093
+ TableRow,
2094
+ TableCell,
2095
+ ChartElement,
2096
+ MediaElement,
2097
+ TextRect,
2098
+ Scene3d,
2099
+ Camera3d,
2100
+ Rot3d,
2101
+ LightRig,
2102
+ Sp3d,
2103
+ Bevel3d,
1680
2104
  Fill,
1681
2105
  SolidFill,
1682
2106
  NoFill,
2107
+ GradientFill,
2108
+ GradientStop,
2109
+ ImageFill,
2110
+ FillRect,
2111
+ TileInfo,
1683
2112
  Stroke,
2113
+ Shadow,
2114
+ Glow,
2115
+ SoftEdge,
2116
+ Reflection,
2117
+ PathCmd,
2118
+ Bullet,
2119
+ SpaceLine,
2120
+ TabStop,
1684
2121
  TextBody,
1685
2122
  Paragraph,
1686
2123
  TextRun,
1687
2124
  TextRunData,
1688
- LineBreak
2125
+ LineBreak,
2126
+ ChartModel,
2127
+ ChartSeries
1689
2128
  }
1690
2129
  }
1691
2130
 
2131
+ /** A single legacy slide comment (`<p:cm>` in `ppt/comments/commentN.xml`). */
2132
+ declare interface PptxComment {
2133
+ /** Resolved author name from `ppt/commentAuthors.xml`. Absent when the
2134
+ * authors file is missing or the `authorId` is out of range. */
2135
+ author?: string;
2136
+ /** `<p:cm @dt>` — ISO-8601 timestamp the comment was authored. */
2137
+ date?: string;
2138
+ /** Plain-text comment body (`<p:text>`). */
2139
+ text: string;
2140
+ }
2141
+
1692
2142
  /**
1693
2143
  * Headless PPTX rendering engine.
1694
2144
  *
@@ -1726,6 +2176,26 @@ declare class PptxPresentation {
1726
2176
  get slideWidth(): number;
1727
2177
  /** Slide height in EMU. */
1728
2178
  get slideHeight(): number;
2179
+ /**
2180
+ * Speaker-notes text for a slide (`ppt/notesSlides/notesSlideN.xml`,
2181
+ * ECMA-376 §13.3.5 — Notes Slide). Returns the notes-body text as a single
2182
+ * string (paragraphs joined with `\n`), or `null` when the slide has no
2183
+ * notes part. The notes are parsed at {@link load} time, so this is a
2184
+ * synchronous lookup.
2185
+ *
2186
+ * `slideIndex` is 0-based. Unlike navigation methods it is *not* clamped:
2187
+ * an out-of-range or non-integer index returns `null` rather than the notes
2188
+ * of the nearest slide (so a tool iterating by index gets an honest "no
2189
+ * notes" instead of a duplicated neighbour).
2190
+ *
2191
+ * @example
2192
+ * const pres = await PptxPresentation.load(buffer);
2193
+ * for (let i = 0; i < pres.slideCount; i++) {
2194
+ * const notes = pres.getNotes(i);
2195
+ * if (notes) console.log(`Slide ${i + 1} notes:`, notes);
2196
+ * }
2197
+ */
2198
+ getNotes(slideIndex: number): string | null;
1729
2199
  /** Render a slide onto the given canvas. */
1730
2200
  renderSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: RenderSlideOptions): Promise<void>;
1731
2201
  /**
@@ -1736,9 +2206,9 @@ declare class PptxPresentation {
1736
2206
  private _findMimeTypeForPath;
1737
2207
  /**
1738
2208
  * Render a slide and attach canvas-native playback controls for any
1739
- * embedded audio/video. Returns a disposable handle that owns the RAF loop,
1740
- * media elements, and object URLs. Unlike {@link renderSlide}, this method
1741
- * is stateful — always call `handle.dispose()` when leaving the slide.
2209
+ * embedded audio/video. Returns a {@link PresentationHandle} that owns the
2210
+ * RAF loop, media elements, and object URLs. Unlike {@link renderSlide}, this
2211
+ * method is stateful — always call `handle.destroy()` when leaving the slide.
1742
2212
  */
1743
2213
  presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: RenderSlideOptions): Promise<PresentationHandle>;
1744
2214
  /** Terminate the worker and release all resources. */
@@ -1810,6 +2280,13 @@ declare class PptxViewer {
1810
2280
  prevSlide(): Promise<void>;
1811
2281
  get slideIndex(): number;
1812
2282
  get slideCount(): number;
2283
+ /**
2284
+ * Speaker-notes text for a slide (`ppt/notesSlides/notesSlideN.xml`,
2285
+ * ECMA-376 §13.3.5). Passthrough to {@link PptxPresentation.getNotes}:
2286
+ * 0-based index, returns `null` when the slide has no notes part, the index
2287
+ * is out of range, or nothing is loaded yet.
2288
+ */
2289
+ getNotes(slideIndex: number): string | null;
1813
2290
  /** The underlying <canvas> element. */
1814
2291
  get canvasElement(): HTMLCanvasElement;
1815
2292
  private renderCurrentSlide;
@@ -1857,7 +2334,13 @@ declare interface Presentation {
1857
2334
  declare interface PresentationHandle {
1858
2335
  play(mediaPath?: string): void;
1859
2336
  pause(mediaPath?: string): void;
1860
- dispose(): void;
2337
+ /**
2338
+ * Stop the playback RAF loop, detach pointer listeners and release every
2339
+ * media blob URL. Named `destroy()` to match the teardown method on the
2340
+ * viewers/documents (`PptxViewer.destroy()`, `XlsxWorkbook.destroy()`, …)
2341
+ * so the public API uses one consistent teardown verb.
2342
+ */
2343
+ destroy(): void;
1861
2344
  }
1862
2345
 
1863
2346
  /** ECMA-376 §20.1.8.27 (CT_ReflectionEffect) — mirrored copy below the
@@ -1980,6 +2463,35 @@ declare interface RenderViewportOptions {
1980
2463
  } | null;
1981
2464
  }
1982
2465
 
2466
+ /**
2467
+ * Resolved allowed-value set for a list validation. Either concrete display
2468
+ * `values` (inline list or expanded range), or — when the operand is a defined
2469
+ * name / complex formula we cannot expand — the raw `formula` text so the panel
2470
+ * can disclose it instead of showing nothing.
2471
+ */
2472
+ declare type ResolvedList = {
2473
+ kind: 'values';
2474
+ values: string[];
2475
+ } | {
2476
+ kind: 'formula';
2477
+ formula: string;
2478
+ };
2479
+
2480
+ /**
2481
+ * 3D rotation in sphere coordinates — ECMA-376 §20.1.5.11 (`CT_SphereCoords`).
2482
+ * Angles are in **degrees** (the XML carries 60000ths of a degree; the parser
2483
+ * divides once). Per the spec, `lat`/`lon` are latitude/longitude and `rev` is
2484
+ * the revolution about the resulting view axis.
2485
+ */
2486
+ declare interface Rot3d {
2487
+ /** Latitude — rotation about the horizontal (X) axis, degrees. */
2488
+ lat: number;
2489
+ /** Longitude — rotation about the vertical (Y) axis, degrees. */
2490
+ lon: number;
2491
+ /** Revolution — in-plane rotation about the view (Z) axis, degrees. */
2492
+ rev: number;
2493
+ }
2494
+
1983
2495
  declare interface Row {
1984
2496
  index: number;
1985
2497
  height: number | null;
@@ -2027,6 +2539,15 @@ declare interface RunRevision {
2027
2539
  date?: string;
2028
2540
  }
2029
2541
 
2542
+ /**
2543
+ * `<a:scene3d>` — ECMA-376 §20.1.4.1.41 (`CT_Scene3D`). Camera + light rig for
2544
+ * a shape's 3D scene.
2545
+ */
2546
+ declare interface Scene3d {
2547
+ camera: Camera3d;
2548
+ lightRig?: LightRig;
2549
+ }
2550
+
2030
2551
  declare interface SectionProps {
2031
2552
  pageWidth: number;
2032
2553
  pageHeight: number;
@@ -2139,6 +2660,13 @@ declare interface ShapeElement {
2139
2660
  * same space as x/y/width/height). When present the renderer lays text out in
2140
2661
  * this rectangle instead of the preset/ellipse-derived text rectangle. */
2141
2662
  textRect?: TextRect;
2663
+ /** `<a:scene3d>` 3D camera scene (ECMA-376 §20.1.5.5). When the camera is
2664
+ * non-identity the renderer projects the shape through the camera
2665
+ * homography (Phase A). */
2666
+ scene3d?: Scene3d;
2667
+ /** `<a:sp3d>` 3D shape properties (ECMA-376 §20.1.5.12). Parsed but not
2668
+ * rendered in Phase A. */
2669
+ sp3d?: Sp3d;
2142
2670
  }
2143
2671
 
2144
2672
  declare type ShapeFill = {
@@ -2154,6 +2682,11 @@ declare type ShapeFill = {
2154
2682
  declare type ShapeGeom = {
2155
2683
  type: 'preset';
2156
2684
  name: string;
2685
+ /** Adjust handles from `<a:avLst><a:gd>` in `adj1..adj8` order
2686
+ * (ECMA-376 §19.5.31.3 / §20.1.9.5). `null` entries mean "use the
2687
+ * preset's declared default". Omitted entirely when the shape has no
2688
+ * `<a:avLst>`. Consumed by the shared `renderPresetShape` engine. */
2689
+ adj?: (number | null)[];
2157
2690
  } | {
2158
2691
  type: 'custom';
2159
2692
  paths: PathInfo[];
@@ -2345,6 +2878,20 @@ declare interface Slide {
2345
2878
  slideNumber: number;
2346
2879
  background: Fill | null;
2347
2880
  elements: SlideElement[];
2881
+ /**
2882
+ * Speaker-notes pane text from `ppt/notesSlides/notesSlideN.xml`
2883
+ * (ECMA-376 §13.3.5 — Notes Slide). The full notes-body text as a single
2884
+ * string, paragraphs joined with `\n`. Absent (`undefined`) when the slide
2885
+ * has no notes part. The renderer ignores this — it is surfaced for tools;
2886
+ * read it via {@link PptxPresentation.getNotes}.
2887
+ */
2888
+ notes?: string;
2889
+ /**
2890
+ * Legacy slide comments (`ppt/comments/commentN.xml`, ECMA-376 §13.3.4).
2891
+ * Modern Office 365 threaded comments are not parsed. Omitted from the JSON
2892
+ * when the slide has no comments.
2893
+ */
2894
+ comments?: PptxComment[];
2348
2895
  }
2349
2896
 
2350
2897
  declare type SlideElement = ShapeElement | PictureElement | TableElement | ChartElement | MediaElement;
@@ -2369,6 +2916,32 @@ declare interface SolidFill {
2369
2916
  color: string;
2370
2917
  }
2371
2918
 
2919
+ /**
2920
+ * `<a:sp3d>` — ECMA-376 §20.1.5.12 (`CT_Shape3D`). Rendered in Phase B: bevelT/
2921
+ * bevelB are shaded as a lit lip (distance-field + lightRig), extrusionH as a
2922
+ * swept side wall, and contour as a flat outline approximation. Numeric fields
2923
+ * are omitted from JSON when zero.
2924
+ */
2925
+ declare interface Sp3d {
2926
+ /** Z position of the front face in EMU (default 0). */
2927
+ z?: number;
2928
+ /** Extrusion (depth) height in EMU (default 0). */
2929
+ extrusionH?: number;
2930
+ /** Contour (outline) width in EMU (default 0). */
2931
+ contourW?: number;
2932
+ /** Contour colour (`<a:contourClr>`, ECMA-376 §20.1.5.12) as a hex string
2933
+ * (e.g. "969696"). Omitted when absent. The renderer draws a flat
2934
+ * approximation of the 3D contour edge (uniform-width outline, no bevel
2935
+ * shading) when both `contourW` and `contourClr` are present. */
2936
+ contourClr?: string;
2937
+ /** Preset surface material (`ST_PresetMaterialType`), default "warmMatte". */
2938
+ prstMaterial: string;
2939
+ /** Top bevel. */
2940
+ bevelT?: Bevel3d;
2941
+ /** Bottom bevel. */
2942
+ bevelB?: Bevel3d;
2943
+ }
2944
+
2372
2945
  declare type SpaceLine = {
2373
2946
  type: 'pct';
2374
2947
  val: number;
@@ -2513,13 +3086,29 @@ declare interface TableInfo {
2513
3086
  /** Accent color resolved by the parser from the built-in style name against
2514
3087
  * the file's theme accents (e.g. `TableStyleLight18` → accent3). */
2515
3088
  accentColor: string;
3089
+ /** `true` when `styleName` is defined in the file's `<tableStyles>` block,
3090
+ * i.e. a *custom* style (ECMA-376 §18.5.1.2). The renderer draws such tables
3091
+ * strictly from their declared element dxfs and must NOT apply the accent
3092
+ * approximation (banding / synthesized rules / header) reserved for built-in
3093
+ * style names whose definitions are absent from the file. */
3094
+ isCustom?: boolean;
2516
3095
  /** Dxf index for the `wholeTable` element of a custom `<tableStyle>`
2517
- * (ECMA-376 §18.8.40). When set, its border/fill apply to every cell of
3096
+ * (ECMA-376 §18.8.83). When set, its border/fill apply to every cell of
2518
3097
  * the table as a base layer. Undefined for built-in style names. */
2519
3098
  wholeTableDxf?: number;
2520
3099
  /** Dxf index for the `headerRow` element of a custom `<tableStyle>` —
2521
3100
  * provides header background, font color/weight, and vertical separators. */
2522
3101
  headerRowDxf?: number;
3102
+ /** Dxf index for the `totalRow` element (ECMA-376 §18.18.93). */
3103
+ totalRowDxf?: number;
3104
+ /** Dxf index for the `firstColumn` element. */
3105
+ firstColumnDxf?: number;
3106
+ /** Dxf index for the `lastColumn` element. */
3107
+ lastColumnDxf?: number;
3108
+ /** Dxf index for `firstRowStripe` (band1 horizontal) — odd banded-row stripe. */
3109
+ band1HorizontalDxf?: number;
3110
+ /** Dxf index for `secondRowStripe` (band2 horizontal) — even banded-row stripe. */
3111
+ band2HorizontalDxf?: number;
2523
3112
  /** Per-column DXF references (ECMA-376 §18.5.1.3 `tableColumn`). Index by
2524
3113
  * `cellCol - range.left`. The renderer can use these to apply column-level
2525
3114
  * overlays for named-style tables; for files where Excel pre-bakes the
@@ -2698,6 +3287,29 @@ declare interface TextRunData {
2698
3287
  outline?: TextOutline;
2699
3288
  }
2700
3289
 
3290
+ /**
3291
+ * ECMA-376 §20.1.8.58 (CT_TileInfoProperties) — tiled blip-fill placement.
3292
+ * The blip repeats at its native size (scaled by sx/sy) across the fill box.
3293
+ * Mutually exclusive with {@link ImageFill.fillRect} (the `stretch` mode).
3294
+ */
3295
+ declare interface TileInfo {
3296
+ /** Horizontal offset of the first tile, in EMU (`tx`). Default 0. */
3297
+ tx: number;
3298
+ /** Vertical offset of the first tile, in EMU (`ty`). Default 0. */
3299
+ ty: number;
3300
+ /** Horizontal tile scale as a fraction (`sx` / 100000). Default 1.0. */
3301
+ sx: number;
3302
+ /** Vertical tile scale as a fraction (`sy` / 100000). Default 1.0. */
3303
+ sy: number;
3304
+ /** Mirror mode: `'none' | 'x' | 'y' | 'xy'` (`flip`). Default `'none'`. */
3305
+ flip: string;
3306
+ /**
3307
+ * Anchor corner the tile grid registers against:
3308
+ * `tl|t|tr|l|ctr|r|bl|b|br` (`algn`). Default `'tl'`.
3309
+ */
3310
+ algn: string;
3311
+ }
3312
+
2701
3313
  declare interface ViewportRange {
2702
3314
  row: number;
2703
3315
  col: number;
@@ -2745,6 +3357,17 @@ declare interface Worksheet {
2745
3357
  /** A1-style cell refs of commented cells (ECMA-376 §18.7.3). Rendered as a
2746
3358
  * small red triangle in each cell's top-right corner. */
2747
3359
  commentRefs?: string[];
3360
+ /** Full-fidelity comment bodies (cell ref + author + plain text) for every
3361
+ * `<comment>` in `xl/commentsN.xml` (ECMA-376 §18.7). Parallel to
3362
+ * {@link commentRefs} (one entry per ref). Consume this to read the note
3363
+ * text; the renderer uses {@link commentRefs} for the red indicator and the
3364
+ * viewer surfaces these bodies in an Excel-style hover popup. */
3365
+ comments?: XlsxComment[];
3366
+ /** Data-validation rules on this sheet (ECMA-376 §18.3.1.32–33). Exposed for
3367
+ * tooling. The viewer draws a list-dropdown arrow on the active cell when the
3368
+ * selection intersects a `list`-type rule's `sqref` (display only — opening
3369
+ * the list / picking a value is out of scope for a viewer). */
3370
+ dataValidations?: DataValidation[];
2748
3371
  /** Defined names in scope for this sheet (ECMA-376 §18.2.5). Used by
2749
3372
  * conditional-formatting `expression` rules that call named ranges
2750
3373
  * (e.g. `task_start`, `today`). */
@@ -2775,6 +3398,7 @@ export declare namespace xlsx {
2775
3398
  XlsxWorkbook,
2776
3399
  LoadOptions_3 as LoadOptions,
2777
3400
  XlsxViewer,
3401
+ ResolvedList,
2778
3402
  XlsxViewerOptions,
2779
3403
  CellAddress,
2780
3404
  CellRange_2 as CellRange,
@@ -2798,7 +3422,45 @@ export declare namespace xlsx {
2798
3422
  ParsedWorkbook,
2799
3423
  ViewportRange,
2800
3424
  RenderViewportOptions,
2801
- XlsxTextRunInfo
3425
+ XlsxTextRunInfo,
3426
+ Run,
3427
+ RunFont,
3428
+ SharedString,
3429
+ Dxf,
3430
+ GradientFillSpec,
3431
+ ConditionalFormat,
3432
+ CfRule,
3433
+ CfValue,
3434
+ CfStop,
3435
+ CfIcon,
3436
+ DefinedName,
3437
+ Hyperlink,
3438
+ XlsxComment,
3439
+ DataValidation,
3440
+ TableInfo,
3441
+ TableColumnInfo,
3442
+ SlicerAnchor,
3443
+ SlicerItem,
3444
+ SparklineGroup,
3445
+ Sparkline,
3446
+ ImageAnchor,
3447
+ ChartAnchor,
3448
+ ShapeAnchor,
3449
+ ShapeInfo,
3450
+ ShapeGeom,
3451
+ ShapeText,
3452
+ ShapeParagraph,
3453
+ ShapeTextRun,
3454
+ PathInfo,
3455
+ PathCmd_2 as PathCmd,
3456
+ ChartData,
3457
+ XlsxChartSeries,
3458
+ SeriesDataLabels,
3459
+ DataLabelOverride,
3460
+ DataPointOverride,
3461
+ ErrBars,
3462
+ ManualLayout,
3463
+ LegendManualLayout_2 as LegendManualLayout
2802
3464
  }
2803
3465
  }
2804
3466
 
@@ -2849,6 +3511,24 @@ declare interface XlsxChartSeries {
2849
3511
  errBars?: ErrBars[];
2850
3512
  }
2851
3513
 
3514
+ /** One cell comment. Sourced from the classic notes file `xl/commentsN.xml`
3515
+ * (ECMA-376 §18.7) when present, otherwise from the Office-365 threaded
3516
+ * comments part `xl/threadedComments/` (MS-XLSX schema
3517
+ * `…/spreadsheetml/2018/threadedcomments`, `personId` resolved via
3518
+ * `xl/persons/`). `text` is the joined plain text — every `<r><t>` run for
3519
+ * classic notes, every reply in the thread (newline-joined) for threaded
3520
+ * comments; rich-text formatting is dropped. 1:1 with the Rust `XlsxComment`
3521
+ * (serde camelCase). */
3522
+ declare interface XlsxComment {
3523
+ /** A1-style cell reference (`@ref` on the comment element). */
3524
+ cellRef: string;
3525
+ /** Resolved author name — the `<authors>` entry (classic) or the `<person>`
3526
+ * `displayName` (threaded). Absent when unresolved. */
3527
+ author?: string;
3528
+ /** Concatenated plain text of every run / threaded reply. */
3529
+ text: string;
3530
+ }
3531
+
2852
3532
  /** Emitted once per cell that has text, with the cell's canvas-pixel bounds. */
2853
3533
  declare interface XlsxTextRunInfo {
2854
3534
  text: string;
@@ -2884,6 +3564,17 @@ declare class XlsxViewer {
2884
3564
  private currentWorksheet;
2885
3565
  private opts;
2886
3566
  private resizeObserver;
3567
+ /**
3568
+ * Start-anchored horizontal scroll position (the {@link effectiveScrollLeft}
3569
+ * value last produced by a real user scroll or a programmatic reset), kept
3570
+ * as the source of truth across container size changes. The native
3571
+ * `scrollLeft` cannot serve that role for RTL sheets (ECMA-376 §18.3.1.87):
3572
+ * it is the *inverse* of the start-anchored offset, and the browser clamps
3573
+ * any assignment to 0 while the host is unlaid-out (`display:none` mount —
3574
+ * e.g. a host revealed only after `load()` resolves), which would otherwise
3575
+ * strand the view at the sheet's far end once the host gains its real size.
3576
+ */
3577
+ private effectiveH;
2887
3578
  private anchorCell;
2888
3579
  private activeCell;
2889
3580
  private selectionMode;
@@ -2891,6 +3582,32 @@ declare class XlsxViewer {
2891
3582
  private selectionOverlay;
2892
3583
  private keydownHandler;
2893
3584
  private pendingTap;
3585
+ /** DOM overlay element that shows the hovered cell's comment. Lives in
3586
+ * canvasArea above the scrollHost; `pointer-events:none` so it never blocks
3587
+ * cell interaction. */
3588
+ private commentPopup;
3589
+ /** `"row:col"` → comment for the current sheet, rebuilt on every showSheet. */
3590
+ private commentMap;
3591
+ /** `"row:col"` of the cell whose popup is currently shown (or pending), so a
3592
+ * pointermove within the same cell doesn't restart the show timer. */
3593
+ private commentPopupKey;
3594
+ /** Pending show timer (see {@link COMMENT_POPUP_DELAY_MS}). */
3595
+ private commentPopupTimer;
3596
+ /** DOM overlay listing a list-validated cell's allowed values. Lives in
3597
+ * canvasArea above the scrollHost; unlike the comment popup this is a click
3598
+ * target (`pointer-events:auto`). Read-only: hovering an item highlights it
3599
+ * but selecting does NOT change the cell. */
3600
+ private validationPanel;
3601
+ /** `"row:col"` of the cell whose panel is currently open, or null. Lets a
3602
+ * re-click on the same arrow toggle the panel closed. */
3603
+ private validationPanelKey;
3604
+ /** Screen rect (canvasArea CSS px) of the dropdown arrow button last drawn by
3605
+ * {@link maybeDrawValidationDropdown}, so pointerdown can hit-test it. Null
3606
+ * when no arrow is currently visible. */
3607
+ private validationArrowRect;
3608
+ /** Document-level pointerdown listener that closes the panel on an outside
3609
+ * click; installed only while the panel is open. */
3610
+ private validationOutsideHandler;
2894
3611
  constructor(container: HTMLElement, opts?: XlsxViewerOptions);
2895
3612
  /**
2896
3613
  * Load an XLSX from URL or ArrayBuffer and render the first sheet.
@@ -2937,6 +3654,11 @@ declare class XlsxViewer {
2937
3654
  /** Park the scrollbar at the sheet's natural start: scrollLeft=0 for LTR,
2938
3655
  * the right end for RTL (so col A shows first). */
2939
3656
  private resetHorizontalScroll;
3657
+ /** Re-derive the native scrollLeft from the tracked start-anchored
3658
+ * position after the scroll host's size changes. Only RTL needs this:
3659
+ * for LTR the native scrollLeft *is* start-anchored and the browser
3660
+ * already clamps it sensibly on resize. */
3661
+ private reanchorHorizontalScroll;
2940
3662
  /** 0-based index of the currently displayed sheet. */
2941
3663
  get sheetIndex(): number;
2942
3664
  /** Total number of sheets in the loaded workbook. */
@@ -2960,6 +3682,14 @@ declare class XlsxViewer {
2960
3682
  private getCellRect;
2961
3683
  /** Returns the current selection, including mode. */
2962
3684
  get selection(): CellRange_2 | null;
3685
+ /**
3686
+ * Programmatically select a single cell by A1 reference (e.g. `"B2"`), as if
3687
+ * the user had clicked it: updates the active/anchor cell, redraws the
3688
+ * selection overlay (including any list-validation dropdown arrow), and fires
3689
+ * `onSelectionChange`. A no-op for malformed refs. Closes any open validation
3690
+ * panel, matching the click path.
3691
+ */
3692
+ select(ref: string): void;
2963
3693
  /**
2964
3694
  * Returns what the header area contains at the given client coordinates.
2965
3695
  * Returns null when the point is in the cell grid (not a header).
@@ -2968,6 +3698,49 @@ declare class XlsxViewer {
2968
3698
  /** Copy the selected cell range as tab-separated text to the clipboard. */
2969
3699
  private copySelection;
2970
3700
  private updateSelectionOverlay;
3701
+ /** Draw the Excel list-validation dropdown button just outside the
3702
+ * bottom-right corner of the *active* cell when that cell is covered by a
3703
+ * `list` data-validation rule. Anchored to the single active cell (not the
3704
+ * whole range) to mirror Excel, which attaches the button to the active
3705
+ * cell of the selection. */
3706
+ private maybeDrawValidationDropdown;
3707
+ /** Toggle the dropdown panel for the active cell's list validation. Called
3708
+ * from pointerdown when the arrow rect is hit. Re-clicking the same arrow
3709
+ * closes it. */
3710
+ private toggleValidationPanel;
3711
+ /** Resolve the allowed values for `formula1` (relative to the current sheet)
3712
+ * and render them in the panel anchored below the active cell. Async because
3713
+ * cross-sheet range references may need a lazily-parsed worksheet. */
3714
+ private openValidationPanel;
3715
+ /** Build the panel's children. Uses textContent throughout (no HTML injection
3716
+ * from cell values). Items highlight on hover but are NOT selectable —
3717
+ * this is a read-only viewer, so clicking a value must not change the cell. */
3718
+ private renderValidationPanel;
3719
+ /** Position the (already-populated, visible-or-becoming-visible) panel below
3720
+ * the dropdown arrow / active cell using the pure geometry calculator. */
3721
+ private positionValidationPanel;
3722
+ /** Install a document-level pointerdown listener that closes the panel on a
3723
+ * click outside it (and outside the arrow, which toggles via its own path).
3724
+ * Removed by {@link hideValidationPanel}. */
3725
+ private installValidationOutsideHandler;
3726
+ /** Hide the panel and detach its outside-click listener. Called on re-click,
3727
+ * outside click, Esc, scroll, selection change, sheet switch and destroy. */
3728
+ private hideValidationPanel;
3729
+ /** Build the `"row:col"` → comment index for the given sheet. Parses each
3730
+ * `XlsxComment.cellRef` with the shared {@link parseA1}; later refs win on a
3731
+ * collision (Excel allows at most one note per cell, so this is moot in
3732
+ * practice). */
3733
+ private buildCommentMap;
3734
+ /** Show the popup for the comment on `cell` after the hover dwell, anchored to
3735
+ * the cell's current on-screen rect. No-op when the cell carries no comment.
3736
+ * Re-hovering the same cell does not restart the timer. */
3737
+ private scheduleCommentPopup;
3738
+ /** Immediately render the popup for `comment` anchored to `cell` (used by the
3739
+ * hover-dwell timer and by touch selection, which has no hover). */
3740
+ private renderCommentPopup;
3741
+ /** Hide the popup and cancel any pending show. Called on cell-out, scroll,
3742
+ * sheet switch and destroy. */
3743
+ private hideCommentPopup;
2971
3744
  private applyPointerSelection;
2972
3745
  private setupSelectionEvents;
2973
3746
  private buildTabs;
@@ -3010,7 +3783,15 @@ declare interface XlsxViewerOptions {
3010
3783
  zoomMin?: number;
3011
3784
  zoomMax?: number;
3012
3785
  onReady?: (sheetNames: string[]) => void;
3013
- onSheetChange?: (index: number, name: string) => void;
3786
+ /**
3787
+ * Called when the active sheet changes, with the new sheet's zero-based
3788
+ * `index` and the `total` number of sheets in the workbook. This mirrors the
3789
+ * docx `onPageChange` and pptx `onSlideChange` contracts so all three viewers
3790
+ * share one callback shape. To get the sheet *name*, look it up by index from
3791
+ * `viewer.sheetNames[index]` (or the `sheetNames` array delivered to
3792
+ * `onReady`).
3793
+ */
3794
+ onSheetChange?: (index: number, total: number) => void;
3014
3795
  onError?: (err: Error) => void;
3015
3796
  /** Called when the selected cell range changes. null means no selection. */
3016
3797
  onSelectionChange?: (selection: CellRange_2 | null) => void;
@@ -3061,6 +3842,22 @@ declare class XlsxWorkbook {
3061
3842
  * `null` for sheets that declare no tab color. */
3062
3843
  get tabColors(): (string | null)[];
3063
3844
  getWorksheet(sheetIndex: number): Promise<Worksheet>;
3845
+ /**
3846
+ * Resolve a `list`-type data-validation `formula1` (ECMA-376 §18.3.1.32) into
3847
+ * the set of allowed values to display, evaluated relative to `sheetIndex`
3848
+ * (the sheet that owns the validation, used to resolve unqualified ranges):
3849
+ *
3850
+ * - Inline quoted list `"A,B,C"` → the literal values.
3851
+ * - Range ref `$B$2:$B$5` → each non-empty cell's *display
3852
+ * string* (the same formatted text the grid shows, via {@link formatCellValue}),
3853
+ * walked row-major. `Sheet2!$A$1:$A$9` resolves against the named sheet
3854
+ * (lazily parsed via {@link getWorksheet}, hence async).
3855
+ * - Named range / complex formula → `{ kind: 'formula' }` carrying the
3856
+ * raw text so the caller can disclose it rather than blanking it.
3857
+ *
3858
+ * Read-only: this only reads cell values for display; it never writes.
3859
+ */
3860
+ resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
3064
3861
  renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
3065
3862
  destroy(): void;
3066
3863
  }