@silurus/ooxml 0.55.0 → 0.57.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;
@@ -305,7 +333,7 @@ declare interface ChartData {
305
333
  * adapter tell "spec said noFill → transparent" from "no spPr → default". */
306
334
  hasChartSpPr?: boolean;
307
335
  /** `<c:legend><c:manualLayout>` fractions of chart space (§21.2.2.31). */
308
- legendManualLayout?: LegendManualLayout | null;
336
+ legendManualLayout?: LegendManualLayout_2 | null;
309
337
  /** `<c:catAx><c:delete val="1"/>` — hide the category axis (§21.2.2.40). */
310
338
  catAxisHidden?: boolean;
311
339
  /** `<c:valAx><c:delete val="1"/>` — hide the value axis (§21.2.2.40). */
@@ -512,6 +540,169 @@ declare interface ChartManualLayout {
512
540
  h?: number;
513
541
  }
514
542
 
543
+ declare interface ChartModel {
544
+ chartType: ChartType;
545
+ title: string | null;
546
+ categories: string[];
547
+ series: ChartSeries[];
548
+ /** Show data labels on bars / points / slices. */
549
+ showDataLabels: boolean;
550
+ /** Explicit Y-axis minimum (OOXML `<c:valAx><c:min>`). */
551
+ valMin: number | null;
552
+ /** Explicit Y-axis maximum (OOXML `<c:valAx><c:max>`). */
553
+ valMax: number | null;
554
+ catAxisTitle: string | null;
555
+ valAxisTitle: string | null;
556
+ /** `<c:catAx><c:delete val="1"/>`. */
557
+ catAxisHidden: boolean;
558
+ /** `<c:valAx><c:delete val="1"/>`. */
559
+ valAxisHidden: boolean;
560
+ /** `<c:catAx><c:spPr><a:ln><a:noFill>` — hide just the axis LINE; labels
561
+ * and tick marks still render. Distinct from `catAxisHidden` (which
562
+ * removes everything via `<c:delete val="1"/>`). */
563
+ catAxisLineHidden: boolean;
564
+ /** `<c:valAx><c:spPr><a:ln><a:noFill>` — hide just the axis LINE; labels
565
+ * and tick marks still render. */
566
+ valAxisLineHidden: boolean;
567
+ /** Hex without '#'. From `<c:plotArea><c:spPr><a:solidFill>`. */
568
+ plotAreaBg: string | null;
569
+ /** Outer chartSpace background (hex without '#'). null when noFill/absent. */
570
+ chartBg: string | null;
571
+ /** True when `<c:legend>` is declared in the chart XML. False = no legend. */
572
+ showLegend: boolean;
573
+ /** `<c:legend><c:legendPos val>` — "r"|"l"|"t"|"b"|"tr". null = default (r). */
574
+ legendPos: 'r' | 'l' | 't' | 'b' | 'tr' | null;
575
+ /** `<c:catAx><c:crossBetween val="..."/>`. "between" inserts 0.5-step padding
576
+ * on each end of the category axis; "midCat" anchors endpoints to the axes. */
577
+ catAxisCrossBetween: 'between' | 'midCat' | string;
578
+ /** `<c:valAx><c:majorTickMark>`. ECMA-376 default is "cross". */
579
+ valAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
580
+ /** `<c:catAx><c:majorTickMark>`. */
581
+ catAxisMajorTickMark: 'cross' | 'out' | 'in' | 'none' | string;
582
+ /** `<c:valAx | catAx><c:minorTickMark>`. ECMA-376 default is "none". */
583
+ valAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
584
+ catAxisMinorTickMark?: 'cross' | 'out' | 'in' | 'none' | string | null;
585
+ /** Title font size in OOXML hundredths of a point (1600 = 16pt). null = default. */
586
+ titleFontSizeHpt: number | null;
587
+ /** Title font color as a hex string without '#' (e.g. "1B4332"). null = default. */
588
+ titleFontColor: string | null;
589
+ /** Title font family from `<a:latin typeface>` (ECMA-376 §20.1.4.2.24). null = default. */
590
+ titleFontFace: string | null;
591
+ /** `<c:catAx><c:txPr>` font size (hpt). null = fall back to proportional default. */
592
+ catAxisFontSizeHpt: number | null;
593
+ /** `<c:valAx><c:txPr>` font size (hpt). null = fall back to proportional default. */
594
+ valAxisFontSizeHpt: number | null;
595
+ /** `<c:catAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#').
596
+ * null = renderer default. Lets templates color category labels gray. */
597
+ catAxisFontColor?: string | null;
598
+ /** `<c:valAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
599
+ valAxisFontColor?: string | null;
600
+ /** `<c:dLbls><c:txPr>` font size (hpt) for data-point value labels. */
601
+ dataLabelFontSizeHpt: number | null;
602
+ /** Waterfall subtotal category indices. */
603
+ subtotalIndices: number[];
604
+ /** `<c:legend><c:manualLayout>` absolute placement fractions of the chart
605
+ * space (ECMA-376 §21.2.2.31). Overrides the default side-based legend
606
+ * rectangle while still letting `legendPos` decide which side of the plot
607
+ * gets the reserved band. null = use default layout. */
608
+ legendManualLayout?: LegendManualLayout | null;
609
+ /**
610
+ * `<c:valAx><c:numFmt@formatCode>` — format code applied to value-axis tick
611
+ * labels (ECMA-376 §21.2.2.21). null = plain numeric formatting.
612
+ */
613
+ valAxisFormatCode?: string | null;
614
+ /**
615
+ * `<c:barChart><c:gapWidth>` — space between category groups as a
616
+ * percentage of bar width (ECMA-376 §21.2.2.13). Default per spec is 150.
617
+ * null = renderer default.
618
+ */
619
+ barGapWidth?: number | null;
620
+ /**
621
+ * `<c:barChart><c:overlap>` — signed percentage overlap between bars in the
622
+ * same category cluster (ECMA-376 §21.2.2.25). Negative = gap, positive =
623
+ * overlap, 0 = flush. Range [-100, 100]. null = renderer default (0).
624
+ */
625
+ barOverlap?: number | null;
626
+ /**
627
+ * `<c:dLbls><c:dLblPos>` — data label position (ECMA-376 §21.2.2.16).
628
+ * "ctr"|"inBase"|"inEnd"|"outEnd"|"l"|"r"|"t"|"b"|"bestFit" etc.
629
+ */
630
+ dataLabelPosition?: string | null;
631
+ /** Hex (no `#`) for data label text, resolved from `<c:dLbls><c:txPr>`. */
632
+ dataLabelFontColor?: string | null;
633
+ /**
634
+ * `<c:dLbls><c:numFmt@formatCode>` — chart-level override for data label
635
+ * number format (ECMA-376 §21.2.2.35). When absent, `valFormatCode` on each
636
+ * series is used.
637
+ */
638
+ dataLabelFormatCode?: string | null;
639
+ /** `<c:title>...defRPr@b>` chart title bold flag. */
640
+ titleFontBold?: boolean | null;
641
+ /** `<c:catAx><c:txPr>...defRPr@b>` X-axis tick label bold flag. */
642
+ catAxisFontBold?: boolean | null;
643
+ /** `<c:valAx><c:txPr>...defRPr@b>` Y-axis tick label bold flag. */
644
+ valAxisFontBold?: boolean | null;
645
+ /**
646
+ * `<c:catAx><c:crosses val>` (`autoZero` | `min` | `max`). Drives the Y
647
+ * coordinate where the X axis is drawn. Default `autoZero` puts the X
648
+ * axis at y=0 — that's how Excel "Project Timeline" templates split
649
+ * milestones (positive Y) above and tasks (negative Y) below the axis.
650
+ */
651
+ catAxisCrosses?: string | null;
652
+ /** `<c:catAx><c:crossesAt val>` — explicit numeric override for the
653
+ * crossing point. Takes precedence over `catAxisCrosses`. */
654
+ catAxisCrossesAt?: number | null;
655
+ valAxisCrosses?: string | null;
656
+ valAxisCrossesAt?: number | null;
657
+ /** Axis line color (hex without `#`) and width in EMU from
658
+ * `<c:catAx|valAx><c:spPr><a:ln>`. */
659
+ catAxisLineColor?: string | null;
660
+ catAxisLineWidthEmu?: number | null;
661
+ valAxisLineColor?: string | null;
662
+ valAxisLineWidthEmu?: number | null;
663
+ /**
664
+ * `<c:catAx><c:numFmt@formatCode>` (or scatter X-axis valAx). When set,
665
+ * the renderer formats X-axis tick labels with this code (e.g. dates).
666
+ */
667
+ catAxisFormatCode?: string | null;
668
+ /**
669
+ * `<c:catAx><c:scaling><c:min/max>` — explicit X-axis range. Used by
670
+ * scatter / bubble charts whose X axis is numeric. null = derive from
671
+ * data extents.
672
+ */
673
+ catAxisMin?: number | null;
674
+ catAxisMax?: number | null;
675
+ /**
676
+ * `<c:title><c:layout><c:manualLayout>` (ECMA-376 §21.2.2.27) absolute
677
+ * placement for the chart title.
678
+ */
679
+ titleManualLayout?: ChartManualLayout | null;
680
+ /**
681
+ * `<c:plotArea><c:layout><c:manualLayout>` absolute placement for the
682
+ * plot area. `layoutTarget="inner"` (default) describes the inner plot
683
+ * rect (no axes / labels); `outer` describes the outer rect (axes
684
+ * included).
685
+ */
686
+ plotAreaManualLayout?: ChartManualLayout | null;
687
+ /**
688
+ * `<c:scatterChart><c:scatterStyle val>` (ECMA-376 §21.2.2.42). Drives
689
+ * whether scatter charts connect points with lines and whether those
690
+ * lines are smoothed. Values: "marker" (markers only — Excel default
691
+ * "Scatter"), "line" / "lineMarker" (straight segments), "smooth" /
692
+ * "smoothMarker" (cubic Bézier through points), "lineNoMarker",
693
+ * "smoothNoMarker". null = renderer default ("marker"). Only consulted
694
+ * for `chartType === "scatter"`; bubble ignores it.
695
+ */
696
+ scatterStyle?: string | null;
697
+ /**
698
+ * `<c:radarChart><c:radarStyle val>` (ECMA-376 §21.2.3.10). Controls
699
+ * whether radar series render as line + markers ("standard" / "marker")
700
+ * or as a closed polygon with area fill ("filled"). null = default
701
+ * ("standard" — line, no fill). Only consulted for `chartType === "radar"`.
702
+ */
703
+ radarStyle?: string | null;
704
+ }
705
+
515
706
  declare interface ChartSeries {
516
707
  name: string;
517
708
  /** Hex without '#'. null = fall back to palette. */
@@ -626,6 +817,13 @@ declare interface ChartSeriesDataLabels {
626
817
  fontSizeHpt?: number;
627
818
  }
628
819
 
820
+ /**
821
+ * Canonical chart type vocabulary. Embeds direction (`H` = horizontal) and
822
+ * grouping (`Pct` = percent-stacked) so renderers do not need to inspect
823
+ * separate `barDir`/`grouping` fields.
824
+ */
825
+ declare type ChartType = 'line' | 'stackedLine' | 'stackedLinePct' | 'clusteredBar' | 'clusteredBarH' | 'stackedBar' | 'stackedBarH' | 'stackedBarPct' | 'stackedBarHPct' | 'area' | 'stackedArea' | 'stackedAreaPct' | 'pie' | 'doughnut' | 'scatter' | 'bubble' | 'radar' | 'waterfall' | string;
826
+
629
827
  declare interface ConditionalFormat {
630
828
  sqref: CellRange[];
631
829
  rules: CfRule[];
@@ -705,6 +903,12 @@ declare interface DocParagraph {
705
903
  /** Default font family resolved from the style chain. Used to size empty
706
904
  * paragraphs (no runs) with the intended font's line metrics. */
707
905
  defaultFontFamily?: string | null;
906
+ /**
907
+ * ECMA-376 §17.3.1.6 `<w:bidi>` — right-to-left paragraph. `true` = RTL,
908
+ * `false` = explicitly LTR, absent = unspecified (inherit). Phase 0 of RTL
909
+ * support: recorded only; alignment/column-order resolution is deferred.
910
+ */
911
+ bidi?: boolean;
708
912
  }
709
913
 
710
914
  declare interface DocRevision {
@@ -734,6 +938,19 @@ declare type DocRun = {
734
938
  fontSize: number;
735
939
  };
736
940
 
941
+ declare interface DocSettings {
942
+ /** §17.15.1.58 `w:kinsoku` — East-Asian line-breaking toggle. `undefined`
943
+ * means the element is absent; the spec default is ON (treated as `true`). */
944
+ kinsoku?: boolean;
945
+ /** §17.15.1.60 `w:noLineBreaksBefore@w:val` — custom set of characters that
946
+ * cannot begin a line (行頭禁則). When present it REPLACES the application
947
+ * default set. Word's per-`w:lang` sets are merged into one string. */
948
+ noLineBreaksBefore?: string;
949
+ /** §17.15.1.59 `w:noLineBreaksAfter@w:val` — custom set of characters that
950
+ * cannot end a line (行末禁則). Replaces the default when present. */
951
+ noLineBreaksAfter?: string;
952
+ }
953
+
737
954
  declare interface DocTable {
738
955
  colWidths: number[];
739
956
  rows: DocTableRow[];
@@ -744,6 +961,22 @@ declare interface DocTable {
744
961
  cellMarginRight: number;
745
962
  /** table horizontal alignment on the page: 'left' | 'center' | 'right'. */
746
963
  jc: string;
964
+ /** ECMA-376 §17.4.52 `<w:tblLayout w:type>` — 'fixed' | 'autofit'. Absent
965
+ * (undefined) ⇒ spec default 'autofit': columns are sized by the per-column
966
+ * max preferred width (cell `widthPt`), tblGrid only as fallback. 'fixed'
967
+ * uses tblGrid widths verbatim (scaled to fit). */
968
+ layout?: string;
969
+ /** ECMA-376 §17.4.63 `<w:tblW>` preferred table width (type="dxa"), pt. */
970
+ widthPt?: number;
971
+ /** `<w:tblW>` type="pct": 50ths of a percent of available content width. */
972
+ widthPct?: number;
973
+ /**
974
+ * ECMA-376 §17.4.1 `<w:bidiVisual>` — render columns in right-to-left
975
+ * (visual) order. `true` = RTL columns, `false` = explicitly LTR, absent =
976
+ * unspecified. Phase 0 of RTL support: recorded only; column-order
977
+ * resolution is deferred.
978
+ */
979
+ bidiVisual?: boolean;
747
980
  }
748
981
 
749
982
  declare interface DocTableCell {
@@ -753,7 +986,13 @@ declare interface DocTableCell {
753
986
  borders: CellBorders;
754
987
  background: string | null;
755
988
  vAlign: 'top' | 'center' | 'bottom';
989
+ /** ECMA-376 §17.4.71 `<w:tcW>` preferred cell width (type="dxa"), pt. Drives
990
+ * autofit column sizing: each grid column's width is the max `widthPt` over
991
+ * the cells anchored in it. */
756
992
  widthPt: number | null;
993
+ /** `<w:tcW>` type="pct": 50ths of a percent of available content width.
994
+ * Resolved against the available width at render time. */
995
+ widthPct?: number;
757
996
  /** Per-cell margins (pt) from `<w:tcPr><w:tcMar>` (ECMA-376 §17.4.42). Each
758
997
  * edge overrides the table-level `cellMargin*` default when set; null/absent
759
998
  * = inherit the table default. */
@@ -781,17 +1020,38 @@ export declare namespace docx {
781
1020
  autoResize,
782
1021
  AutoResizeOptions,
783
1022
  DocxDocumentModel,
1023
+ DocSettings,
784
1024
  SectionProps,
1025
+ HeadersFooters,
1026
+ HeaderFooter,
1027
+ NumberingInfo,
785
1028
  BodyElement,
786
1029
  DocParagraph,
787
1030
  DocRun,
788
1031
  DocxTextRun,
1032
+ FieldRun,
789
1033
  ImageRun,
1034
+ ShapeRun,
1035
+ ShapeText_2 as ShapeText,
1036
+ RubyAnnotation,
790
1037
  RenderPageOptions,
791
1038
  RunRevision,
792
1039
  DocRevision,
793
1040
  DocComment,
794
1041
  DocNote,
1042
+ LineSpacing,
1043
+ TabStop_2 as TabStop,
1044
+ ParagraphBorders,
1045
+ ParaBorderEdge,
1046
+ DocTable,
1047
+ DocTableRow,
1048
+ DocTableCell,
1049
+ CellElement,
1050
+ TableBorders,
1051
+ CellBorders,
1052
+ BorderSpec,
1053
+ PathCmd_3 as PathCmd,
1054
+ GradientStop_2 as GradientStop,
795
1055
  DocxTextRunInfo
796
1056
  }
797
1057
  }
@@ -843,6 +1103,11 @@ declare interface DocxDocumentModel {
843
1103
  /** ECMA-376 §17.11.4 — `word/endnotes.xml` (id + text). Same shape as
844
1104
  * `footnotes`. */
845
1105
  endnotes?: DocNote[];
1106
+ /** ECMA-376 §17.15.1.* — document-wide compatibility / typography settings
1107
+ * from `word/settings.xml`. Currently carries the Japanese line-breaking
1108
+ * (kinsoku) configuration. Absent when settings.xml has no relevant
1109
+ * elements (the renderer then uses spec defaults: kinsoku ON). */
1110
+ settings?: DocSettings;
846
1111
  }
847
1112
 
848
1113
  declare interface DocxTextRun {
@@ -871,6 +1136,27 @@ declare interface DocxTextRun {
871
1136
  * underline and deletions with an author-coloured strikethrough so
872
1137
  * tracked changes appear inline. */
873
1138
  revision?: RunRevision;
1139
+ /** ECMA-376 §17.3.2.30 `<w:rtl>` — complex-script / right-to-left run.
1140
+ * `true` = RTL, `false` = explicitly LTR, absent = unspecified.
1141
+ * Phase 0: recorded only; glyph-order resolution is deferred. */
1142
+ rtl?: boolean;
1143
+ /** ECMA-376 §17.3.2.7 `<w:cs/>` — complex-script run toggle: cs formatting
1144
+ * applies to ALL characters of the run (§17.3.2.26). Distinct from
1145
+ * `rFonts@cs` (`fontFamilyCs`), which is only a font slot. */
1146
+ cs?: boolean;
1147
+ /** ECMA-376 §17.3.2.26 `<w:rFonts w:cs>` — complex-script typeface
1148
+ * (theme references resolved to a literal family). */
1149
+ fontFamilyCs?: string;
1150
+ /** ECMA-376 §17.3.2.39 `<w:szCs>` — complex-script font size in pt
1151
+ * (same units as `fontSize`). */
1152
+ fontSizeCs?: number;
1153
+ /** ECMA-376 §17.3.2.3 `<w:bCs>` — complex-script bold toggle. */
1154
+ boldCs?: boolean;
1155
+ /** ECMA-376 §17.3.2.17 `<w:iCs>` — complex-script italic toggle. */
1156
+ italicCs?: boolean;
1157
+ /** ECMA-376 §17.3.2.20 `<w:lang w:bidi>` — complex-script (RTL) language tag,
1158
+ * lower-cased (e.g. "ar-sa", "ae-ar"). Drives Word's AN digit ordering. */
1159
+ langBidi?: string;
874
1160
  }
875
1161
 
876
1162
  /** Information about a rendered text segment for building a transparent selection overlay. */
@@ -1128,6 +1414,18 @@ declare interface ImageRun {
1128
1414
  }
1129
1415
 
1130
1416
  declare interface LegendManualLayout {
1417
+ /** `"edge"` = `x`/`y` are fractions from top-left of chart space;
1418
+ * `"factor"` = fractions offset from the default position. */
1419
+ xMode: string;
1420
+ yMode: string;
1421
+ /** Fractions of chart space width/height. */
1422
+ x: number;
1423
+ y: number;
1424
+ w: number;
1425
+ h: number;
1426
+ }
1427
+
1428
+ declare interface LegendManualLayout_2 {
1131
1429
  xMode: string;
1132
1430
  yMode: string;
1133
1431
  x: number;
@@ -1136,6 +1434,19 @@ declare interface LegendManualLayout {
1136
1434
  h: number;
1137
1435
  }
1138
1436
 
1437
+ /**
1438
+ * `<a:lightRig>` — ECMA-376 §20.1.5.9 (`CT_LightRig`). Parsed for Phase B
1439
+ * (lighting/bevel shading); the Phase A camera renderer ignores it.
1440
+ */
1441
+ declare interface LightRig {
1442
+ /** Light-rig preset (`ST_LightRigType`), e.g. "threePt". */
1443
+ rig: string;
1444
+ /** Light direction (`ST_LightRigDirection`): tl/t/tr/l/r/bl/b/br. */
1445
+ dir: string;
1446
+ /** Optional rotation override of the rig. */
1447
+ rot?: Rot3d;
1448
+ }
1449
+
1139
1450
  declare interface LineBreak {
1140
1451
  type: 'break';
1141
1452
  }
@@ -1568,8 +1879,29 @@ declare interface PictureElement {
1568
1879
  flipV: boolean;
1569
1880
  /** Data URL, e.g. "data:image/png;base64,..." */
1570
1881
  dataUrl: string;
1571
- /** OOXML adj value (0–100000) for roundRect clip, null = plain rectangle */
1572
- clipAdjust: number | null;
1882
+ /**
1883
+ * Border line from `<p:pic><p:spPr><a:ln>` (ECMA-376 §20.1.2.2.24). A
1884
+ * `p:pic`'s spPr is `CT_ShapeProperties` (§19.3.1.37), so a picture carries
1885
+ * the same line model as a shape. `null` when there is no `<a:ln>` or it
1886
+ * resolves to `<a:noFill/>` (border explicitly suppressed). The border is
1887
+ * stroked along the picture's clip silhouette (roundRect / custGeom / rect).
1888
+ */
1889
+ stroke: Stroke | null;
1890
+ /**
1891
+ * `<p:spPr><a:prstGeom prst="…">` preset name (e.g. `"roundRect"`,
1892
+ * `"ellipse"`). ECMA-376 §20.1.9.18: a picture's preset geometry is its clip
1893
+ * silhouette and the path its border / contour hug. Undefined / omitted = a
1894
+ * plain rectangle (`prst="rect"` or no prstGeom). When set, the renderer
1895
+ * builds the silhouette via the shared preset-geometry engine (any of the 186
1896
+ * presets). `custGeom` takes priority when both are present.
1897
+ */
1898
+ prstGeom?: string;
1899
+ /**
1900
+ * Adjust guides from the prstGeom `<a:avLst>` (1/1000-of-a-percent OOXML
1901
+ * units), in `gd@name` declaration order (index 0 = adj/adj1, 1 = adj2, …).
1902
+ * Omitted when avLst is empty — the preset's own declared defaults then apply.
1903
+ */
1904
+ prstAdjust?: number[];
1573
1905
  /**
1574
1906
  * ECMA-376 a:srcRect — source image crop as fractions (0..1) of the source
1575
1907
  * width/height. Omitted when the image is not cropped.
@@ -1590,6 +1922,27 @@ declare interface PictureElement {
1590
1922
  * trimmed to the laptop / device silhouette declared in the file.
1591
1923
  */
1592
1924
  custGeom?: PathCmd[][] | null;
1925
+ /**
1926
+ * Drop shadow from `spPr > effectLst > outerShdw`. A `p:pic`'s `spPr` is
1927
+ * `CT_ShapeProperties` (ECMA-376 §19.3.1.37), so the same effects shapes
1928
+ * carry apply to images. ECMA-376 §20.1.8.45 (CT_OuterShadowEffect).
1929
+ */
1930
+ shadow?: Shadow;
1931
+ /** Inner (inset) shadow from effectLst > innerShdw. ECMA-376 §20.1.8.40. */
1932
+ innerShadow?: Shadow;
1933
+ /** Coloured glow halo from effectLst > glow. ECMA-376 §20.1.8.32. */
1934
+ glow?: Glow;
1935
+ /** Soft (feathered) edge from effectLst > softEdge. ECMA-376 §20.1.8.53. */
1936
+ softEdge?: SoftEdge;
1937
+ /** Mirrored reflection from effectLst > reflection. ECMA-376 §20.1.8.50. */
1938
+ reflection?: Reflection;
1939
+ /** `<a:scene3d>` 3D camera scene (ECMA-376 §20.1.5.5). A `p:pic`'s spPr is
1940
+ * `CT_ShapeProperties`, so 3D scenes apply to images. When non-identity the
1941
+ * renderer projects the picture through the camera homography (Phase A). */
1942
+ scene3d?: Scene3d;
1943
+ /** `<a:sp3d>` 3D shape properties (ECMA-376 §20.1.5.12). Parsed but not
1944
+ * rendered in Phase A. */
1945
+ sp3d?: Sp3d;
1593
1946
  }
1594
1947
 
1595
1948
  export declare namespace pptx {
@@ -1603,6 +1956,7 @@ export declare namespace pptx {
1603
1956
  RenderOptions,
1604
1957
  PptxTextRunInfo,
1605
1958
  TextRunCallback,
1959
+ PresentationHandle,
1606
1960
  autoResize,
1607
1961
  AutoResizeOptions,
1608
1962
  Presentation,
@@ -1610,15 +1964,39 @@ export declare namespace pptx {
1610
1964
  SlideElement,
1611
1965
  ShapeElement,
1612
1966
  PictureElement,
1967
+ TableElement,
1968
+ TableRow,
1969
+ TableCell,
1970
+ ChartElement,
1971
+ MediaElement,
1972
+ TextRect,
1973
+ Scene3d,
1974
+ Camera3d,
1975
+ Rot3d,
1976
+ LightRig,
1977
+ Sp3d,
1978
+ Bevel3d,
1613
1979
  Fill,
1614
1980
  SolidFill,
1615
1981
  NoFill,
1982
+ GradientFill,
1983
+ GradientStop,
1616
1984
  Stroke,
1985
+ Shadow,
1986
+ Glow,
1987
+ SoftEdge,
1988
+ Reflection,
1989
+ PathCmd,
1990
+ Bullet,
1991
+ SpaceLine,
1992
+ TabStop,
1617
1993
  TextBody,
1618
1994
  Paragraph,
1619
1995
  TextRun,
1620
1996
  TextRunData,
1621
- LineBreak
1997
+ LineBreak,
1998
+ ChartModel,
1999
+ ChartSeries
1622
2000
  }
1623
2001
  }
1624
2002
 
@@ -1669,9 +2047,9 @@ declare class PptxPresentation {
1669
2047
  private _findMimeTypeForPath;
1670
2048
  /**
1671
2049
  * Render a slide and attach canvas-native playback controls for any
1672
- * embedded audio/video. Returns a disposable handle that owns the RAF loop,
1673
- * media elements, and object URLs. Unlike {@link renderSlide}, this method
1674
- * is stateful — always call `handle.dispose()` when leaving the slide.
2050
+ * embedded audio/video. Returns a {@link PresentationHandle} that owns the
2051
+ * RAF loop, media elements, and object URLs. Unlike {@link renderSlide}, this
2052
+ * method is stateful — always call `handle.destroy()` when leaving the slide.
1675
2053
  */
1676
2054
  presentSlide(canvas: HTMLCanvasElement, slideIndex: number, opts?: RenderSlideOptions): Promise<PresentationHandle>;
1677
2055
  /** Terminate the worker and release all resources. */
@@ -1790,7 +2168,13 @@ declare interface Presentation {
1790
2168
  declare interface PresentationHandle {
1791
2169
  play(mediaPath?: string): void;
1792
2170
  pause(mediaPath?: string): void;
1793
- dispose(): void;
2171
+ /**
2172
+ * Stop the playback RAF loop, detach pointer listeners and release every
2173
+ * media blob URL. Named `destroy()` to match the teardown method on the
2174
+ * viewers/documents (`PptxViewer.destroy()`, `XlsxWorkbook.destroy()`, …)
2175
+ * so the public API uses one consistent teardown verb.
2176
+ */
2177
+ destroy(): void;
1794
2178
  }
1795
2179
 
1796
2180
  /** ECMA-376 §20.1.8.27 (CT_ReflectionEffect) — mirrored copy below the
@@ -1913,6 +2297,21 @@ declare interface RenderViewportOptions {
1913
2297
  } | null;
1914
2298
  }
1915
2299
 
2300
+ /**
2301
+ * 3D rotation in sphere coordinates — ECMA-376 §20.1.5.11 (`CT_SphereCoords`).
2302
+ * Angles are in **degrees** (the XML carries 60000ths of a degree; the parser
2303
+ * divides once). Per the spec, `lat`/`lon` are latitude/longitude and `rev` is
2304
+ * the revolution about the resulting view axis.
2305
+ */
2306
+ declare interface Rot3d {
2307
+ /** Latitude — rotation about the horizontal (X) axis, degrees. */
2308
+ lat: number;
2309
+ /** Longitude — rotation about the vertical (Y) axis, degrees. */
2310
+ lon: number;
2311
+ /** Revolution — in-plane rotation about the view (Z) axis, degrees. */
2312
+ rev: number;
2313
+ }
2314
+
1916
2315
  declare interface Row {
1917
2316
  index: number;
1918
2317
  height: number | null;
@@ -1960,6 +2359,15 @@ declare interface RunRevision {
1960
2359
  date?: string;
1961
2360
  }
1962
2361
 
2362
+ /**
2363
+ * `<a:scene3d>` — ECMA-376 §20.1.4.1.41 (`CT_Scene3D`). Camera + light rig for
2364
+ * a shape's 3D scene.
2365
+ */
2366
+ declare interface Scene3d {
2367
+ camera: Camera3d;
2368
+ lightRig?: LightRig;
2369
+ }
2370
+
1963
2371
  declare interface SectionProps {
1964
2372
  pageWidth: number;
1965
2373
  pageHeight: number;
@@ -2072,6 +2480,13 @@ declare interface ShapeElement {
2072
2480
  * same space as x/y/width/height). When present the renderer lays text out in
2073
2481
  * this rectangle instead of the preset/ellipse-derived text rectangle. */
2074
2482
  textRect?: TextRect;
2483
+ /** `<a:scene3d>` 3D camera scene (ECMA-376 §20.1.5.5). When the camera is
2484
+ * non-identity the renderer projects the shape through the camera
2485
+ * homography (Phase A). */
2486
+ scene3d?: Scene3d;
2487
+ /** `<a:sp3d>` 3D shape properties (ECMA-376 §20.1.5.12). Parsed but not
2488
+ * rendered in Phase A. */
2489
+ sp3d?: Sp3d;
2075
2490
  }
2076
2491
 
2077
2492
  declare type ShapeFill = {
@@ -2087,6 +2502,11 @@ declare type ShapeFill = {
2087
2502
  declare type ShapeGeom = {
2088
2503
  type: 'preset';
2089
2504
  name: string;
2505
+ /** Adjust handles from `<a:avLst><a:gd>` in `adj1..adj8` order
2506
+ * (ECMA-376 §19.5.31.3 / §20.1.9.5). `null` entries mean "use the
2507
+ * preset's declared default". Omitted entirely when the shape has no
2508
+ * `<a:avLst>`. Consumed by the shared `renderPresetShape` engine. */
2509
+ adj?: (number | null)[];
2090
2510
  } | {
2091
2511
  type: 'custom';
2092
2512
  paths: PathInfo[];
@@ -2120,6 +2540,9 @@ declare interface ShapeInfo {
2120
2540
  declare interface ShapeParagraph {
2121
2541
  /** `<a:pPr@algn>` — `l` (default) | `ctr` | `r` | `just` | `dist`. */
2122
2542
  align: string;
2543
+ /** `<a:pPr@rtl>` — whether the paragraph reads right-to-left
2544
+ * (ECMA-376 §21.1.2.2.7). Omitted (undefined) when false. */
2545
+ rtl?: boolean;
2123
2546
  runs: ShapeTextRun[];
2124
2547
  }
2125
2548
 
@@ -2299,6 +2722,31 @@ declare interface SolidFill {
2299
2722
  color: string;
2300
2723
  }
2301
2724
 
2725
+ /**
2726
+ * `<a:sp3d>` — ECMA-376 §20.1.5.12 (`CT_Shape3D`). Parsed in full but **not
2727
+ * rendered in Phase A** (camera-only). bevel/contour/extrusion are Phase B.
2728
+ * Numeric fields are omitted from JSON when zero.
2729
+ */
2730
+ declare interface Sp3d {
2731
+ /** Z position of the front face in EMU (default 0). */
2732
+ z?: number;
2733
+ /** Extrusion (depth) height in EMU (default 0). */
2734
+ extrusionH?: number;
2735
+ /** Contour (outline) width in EMU (default 0). */
2736
+ contourW?: number;
2737
+ /** Contour colour (`<a:contourClr>`, ECMA-376 §20.1.5.12) as a hex string
2738
+ * (e.g. "969696"). Omitted when absent. The renderer draws a flat
2739
+ * approximation of the 3D contour edge (uniform-width outline, no bevel
2740
+ * shading) when both `contourW` and `contourClr` are present. */
2741
+ contourClr?: string;
2742
+ /** Preset surface material (`ST_PresetMaterialType`), default "warmMatte". */
2743
+ prstMaterial: string;
2744
+ /** Top bevel. */
2745
+ bevelT?: Bevel3d;
2746
+ /** Bottom bevel. */
2747
+ bevelB?: Bevel3d;
2748
+ }
2749
+
2302
2750
  declare type SpaceLine = {
2303
2751
  type: 'pct';
2304
2752
  val: number;
@@ -2427,6 +2875,8 @@ declare interface TableElement {
2427
2875
  /** Column widths in EMU */
2428
2876
  cols: number[];
2429
2877
  rows: TableRow[];
2878
+ /** `<a:tblPr rtl="1">` (ECMA-376 §21.1.3.13): right-to-left table — column 0 at the right edge. */
2879
+ rtl?: boolean;
2430
2880
  }
2431
2881
 
2432
2882
  declare interface TableInfo {
@@ -2441,13 +2891,29 @@ declare interface TableInfo {
2441
2891
  /** Accent color resolved by the parser from the built-in style name against
2442
2892
  * the file's theme accents (e.g. `TableStyleLight18` → accent3). */
2443
2893
  accentColor: string;
2894
+ /** `true` when `styleName` is defined in the file's `<tableStyles>` block,
2895
+ * i.e. a *custom* style (ECMA-376 §18.5.1.2). The renderer draws such tables
2896
+ * strictly from their declared element dxfs and must NOT apply the accent
2897
+ * approximation (banding / synthesized rules / header) reserved for built-in
2898
+ * style names whose definitions are absent from the file. */
2899
+ isCustom?: boolean;
2444
2900
  /** Dxf index for the `wholeTable` element of a custom `<tableStyle>`
2445
- * (ECMA-376 §18.8.40). When set, its border/fill apply to every cell of
2901
+ * (ECMA-376 §18.8.83). When set, its border/fill apply to every cell of
2446
2902
  * the table as a base layer. Undefined for built-in style names. */
2447
2903
  wholeTableDxf?: number;
2448
2904
  /** Dxf index for the `headerRow` element of a custom `<tableStyle>` —
2449
2905
  * provides header background, font color/weight, and vertical separators. */
2450
2906
  headerRowDxf?: number;
2907
+ /** Dxf index for the `totalRow` element (ECMA-376 §18.18.93). */
2908
+ totalRowDxf?: number;
2909
+ /** Dxf index for the `firstColumn` element. */
2910
+ firstColumnDxf?: number;
2911
+ /** Dxf index for the `lastColumn` element. */
2912
+ lastColumnDxf?: number;
2913
+ /** Dxf index for `firstRowStripe` (band1 horizontal) — odd banded-row stripe. */
2914
+ band1HorizontalDxf?: number;
2915
+ /** Dxf index for `secondRowStripe` (band2 horizontal) — even banded-row stripe. */
2916
+ band2HorizontalDxf?: number;
2451
2917
  /** Per-column DXF references (ECMA-376 §18.5.1.3 `tableColumn`). Index by
2452
2918
  * `cellCol - range.left`. The renderer can use these to apply column-level
2453
2919
  * overlays for named-style tables; for files where Excel pre-bakes the
@@ -2476,7 +2942,21 @@ declare interface TabStop_2 {
2476
2942
  leader: 'none' | 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot';
2477
2943
  }
2478
2944
 
2479
- declare interface TextBody {
2945
+ /**
2946
+ * PPTX text body. Extends the shared core `TextBody` with PPTX-only bodyPr
2947
+ * fields that the pptx parser surfaces but the shared core model does not yet
2948
+ * carry.
2949
+ */
2950
+ declare interface TextBody extends TextBody_2 {
2951
+ /**
2952
+ * `<a:bodyPr rtlCol>` (ECMA-376 §21.1.2.1.1) — when true the columns of a
2953
+ * multi-column text body are laid out right-to-left. Defaults to false;
2954
+ * omitted from JSON when false. Only meaningful when `numCol > 1`.
2955
+ */
2956
+ rtlCol?: boolean;
2957
+ }
2958
+
2959
+ declare interface TextBody_2 {
2480
2960
  /** Vertical anchor: "t" | "ctr" | "b" */
2481
2961
  verticalAnchor: string;
2482
2962
  paragraphs: Paragraph[];
@@ -2646,6 +3126,10 @@ declare interface Worksheet {
2646
3126
  * `<sheetView showGridLines>`). Mirrors the Excel "View → Gridlines"
2647
3127
  * checkbox. Defaults to true. */
2648
3128
  showGridlines?: boolean;
3129
+ /** Whether the sheet grid is laid out right-to-left, mirroring the entire
3130
+ * grid so column A sits on the right (ECMA-376 §18.3.1.87
3131
+ * `<sheetView rightToLeft>`). Defaults to false. */
3132
+ rightToLeft?: boolean;
2649
3133
  /** Sheet tab color (ECMA-376 §18.3.1.79). */
2650
3134
  tabColor?: string | null;
2651
3135
  /** AutoFilter header range (ECMA-376 §18.3.1.2). */
@@ -2708,7 +3192,43 @@ export declare namespace xlsx {
2708
3192
  ParsedWorkbook,
2709
3193
  ViewportRange,
2710
3194
  RenderViewportOptions,
2711
- XlsxTextRunInfo
3195
+ XlsxTextRunInfo,
3196
+ Run,
3197
+ RunFont,
3198
+ SharedString,
3199
+ Dxf,
3200
+ GradientFillSpec,
3201
+ ConditionalFormat,
3202
+ CfRule,
3203
+ CfValue,
3204
+ CfStop,
3205
+ CfIcon,
3206
+ DefinedName,
3207
+ Hyperlink,
3208
+ TableInfo,
3209
+ TableColumnInfo,
3210
+ SlicerAnchor,
3211
+ SlicerItem,
3212
+ SparklineGroup,
3213
+ Sparkline,
3214
+ ImageAnchor,
3215
+ ChartAnchor,
3216
+ ShapeAnchor,
3217
+ ShapeInfo,
3218
+ ShapeGeom,
3219
+ ShapeText,
3220
+ ShapeParagraph,
3221
+ ShapeTextRun,
3222
+ PathInfo,
3223
+ PathCmd_2 as PathCmd,
3224
+ ChartData,
3225
+ XlsxChartSeries,
3226
+ SeriesDataLabels,
3227
+ DataLabelOverride,
3228
+ DataPointOverride,
3229
+ ErrBars,
3230
+ ManualLayout,
3231
+ LegendManualLayout_2 as LegendManualLayout
2712
3232
  }
2713
3233
  }
2714
3234
 
@@ -2794,6 +3314,17 @@ declare class XlsxViewer {
2794
3314
  private currentWorksheet;
2795
3315
  private opts;
2796
3316
  private resizeObserver;
3317
+ /**
3318
+ * Start-anchored horizontal scroll position (the {@link effectiveScrollLeft}
3319
+ * value last produced by a real user scroll or a programmatic reset), kept
3320
+ * as the source of truth across container size changes. The native
3321
+ * `scrollLeft` cannot serve that role for RTL sheets (ECMA-376 §18.3.1.87):
3322
+ * it is the *inverse* of the start-anchored offset, and the browser clamps
3323
+ * any assignment to 0 while the host is unlaid-out (`display:none` mount —
3324
+ * e.g. a host revealed only after `load()` resolves), which would otherwise
3325
+ * strand the view at the sheet's far end once the host gains its real size.
3326
+ */
3327
+ private effectiveH;
2797
3328
  private anchorCell;
2798
3329
  private activeCell;
2799
3330
  private selectionMode;
@@ -2813,6 +3344,45 @@ declare class XlsxViewer {
2813
3344
  /** The loaded workbook, or throws if {@link load} has not completed. */
2814
3345
  private get workbook();
2815
3346
  showSheet(index: number): Promise<void>;
3347
+ /** True when the current sheet's grid is laid out right-to-left. */
3348
+ private get isRtl();
3349
+ /** Maximum horizontal scroll offset the native scroll host allows (≥ 0). */
3350
+ private get maxScrollLeft();
3351
+ /**
3352
+ * The logical horizontal scroll position used to find the start-of-sheet
3353
+ * (col A) edge, in *scaled* CSS pixels — the same unit as
3354
+ * `scrollHost.scrollLeft`. The renderer always lays the grid out LTR and then
3355
+ * mirrors it (ECMA-376 §18.3.1.87), so the viewer must hand it a position
3356
+ * where 0 = the START of the sheet (col A) and increasing values reveal later
3357
+ * columns.
3358
+ *
3359
+ * For LTR that is exactly the native `scrollLeft`. For RTL the sheet starts at
3360
+ * the RIGHT, so the native scrollbar runs the opposite way: thumb fully right
3361
+ * (`scrollLeft = maxScrollLeft`) is the start, thumb left is the far columns.
3362
+ * Inverting here makes wheel/trackpad follow the finger and aligns the
3363
+ * thumb↔page mapping with Excel, without depending on browser-specific RTL
3364
+ * `scrollLeft` sign conventions.
3365
+ */
3366
+ private get effectiveScrollLeft();
3367
+ /**
3368
+ * Map between the logical-LTR x used by all the cell-geometry math and the
3369
+ * on-screen (canvasArea CSS-pixel) x, applying the RTL mirror (ECMA-376
3370
+ * §18.3.1.87) via the same {@link rtlMirrorX} the renderer uses. For LTR this
3371
+ * is the identity. The mirror is an involution, so this one method serves
3372
+ * both cell→px (overlay draw, `w` = cell width) and px→cell (pointer
3373
+ * hit-testing, `w` = 0 for a point) — guaranteeing the overlay sits exactly
3374
+ * where the cell is drawn and a click resolves to that same cell at every
3375
+ * scroll offset. `canvasArea.clientWidth` equals the renderer's `canvasW`.
3376
+ */
3377
+ private screenX;
3378
+ /** Park the scrollbar at the sheet's natural start: scrollLeft=0 for LTR,
3379
+ * the right end for RTL (so col A shows first). */
3380
+ private resetHorizontalScroll;
3381
+ /** Re-derive the native scrollLeft from the tracked start-anchored
3382
+ * position after the scroll host's size changes. Only RTL needs this:
3383
+ * for LTR the native scrollLeft *is* start-anchored and the browser
3384
+ * already clamps it sensibly on resize. */
3385
+ private reanchorHorizontalScroll;
2816
3386
  /** 0-based index of the currently displayed sheet. */
2817
3387
  get sheetIndex(): number;
2818
3388
  /** Total number of sheets in the loaded workbook. */
@@ -2886,7 +3456,15 @@ declare interface XlsxViewerOptions {
2886
3456
  zoomMin?: number;
2887
3457
  zoomMax?: number;
2888
3458
  onReady?: (sheetNames: string[]) => void;
2889
- onSheetChange?: (index: number, name: string) => void;
3459
+ /**
3460
+ * Called when the active sheet changes, with the new sheet's zero-based
3461
+ * `index` and the `total` number of sheets in the workbook. This mirrors the
3462
+ * docx `onPageChange` and pptx `onSlideChange` contracts so all three viewers
3463
+ * share one callback shape. To get the sheet *name*, look it up by index from
3464
+ * `viewer.sheetNames[index]` (or the `sheetNames` array delivered to
3465
+ * `onReady`).
3466
+ */
3467
+ onSheetChange?: (index: number, total: number) => void;
2890
3468
  onError?: (err: Error) => void;
2891
3469
  /** Called when the selected cell range changes. null means no selection. */
2892
3470
  onSelectionChange?: (selection: CellRange_2 | null) => void;