@silurus/ooxml 0.41.0 → 0.43.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.
@@ -99,6 +99,9 @@ export declare interface DocParagraph {
99
99
  styleId?: string | null;
100
100
  /** Default font size (pt) inherited from style + direct pPr/rPr. Falls back to 10pt. */
101
101
  defaultFontSize?: number;
102
+ /** Default font family resolved from the style chain. Used to size empty
103
+ * paragraphs (no runs) with the intended font's line metrics. */
104
+ defaultFontFamily?: string | null;
102
105
  }
103
106
 
104
107
  export declare interface DocRevision {
@@ -141,6 +144,13 @@ declare interface DocTableCell {
141
144
  background: string | null;
142
145
  vAlign: 'top' | 'center' | 'bottom';
143
146
  widthPt: number | null;
147
+ /** Per-cell margins (pt) from `<w:tcPr><w:tcMar>` (ECMA-376 §17.4.42). Each
148
+ * edge overrides the table-level `cellMargin*` default when set; null/absent
149
+ * = inherit the table default. */
150
+ marginTop?: number | null;
151
+ marginBottom?: number | null;
152
+ marginLeft?: number | null;
153
+ marginRight?: number | null;
144
154
  }
145
155
 
146
156
  declare interface DocTableRow {
@@ -421,6 +421,18 @@ declare interface ChartElement {
421
421
  catAxisFontSizeHpt: number | null;
422
422
  /** `<c:valAx><c:txPr>` font size (hpt). null = proportional default. */
423
423
  valAxisFontSizeHpt: number | null;
424
+ /** `<c:catAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
425
+ catAxisFontColor?: string | null;
426
+ /** `<c:valAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
427
+ valAxisFontColor?: string | null;
428
+ /** `<c:catAx><c:spPr><a:ln><a:solidFill>` axis-line color (hex without '#'). */
429
+ catAxisLineColor?: string | null;
430
+ /** `<c:catAx><c:spPr><a:ln w>` axis-line width in EMU. */
431
+ catAxisLineWidthEmu?: number | null;
432
+ /** `<c:valAx><c:spPr><a:ln><a:solidFill>` axis-line color (hex without '#'). */
433
+ valAxisLineColor?: string | null;
434
+ /** `<c:valAx><c:spPr><a:ln w>` axis-line width in EMU. */
435
+ valAxisLineWidthEmu?: number | null;
424
436
  /** `<c:dLbls><c:txPr>` font size (hpt) for data-point value labels. */
425
437
  dataLabelFontSizeHpt: number | null;
426
438
  /** `<c:legend><c:legendPos val>` — "r" (default) | "l" | "t" | "b" | "tr". */
@@ -496,6 +508,14 @@ declare interface ChartSeries {
496
508
  * fall back to the chart-level `dataLabelFontColor`.
497
509
  */
498
510
  dataLabelColors?: (string | null)[] | null;
511
+ /**
512
+ * Series-level data-label text colour (`<c:ser><c:dLbls><c:txPr>…solidFill`,
513
+ * ECMA-376 §21.2.2.216). Hex without '#'. Stacked-bar charts colour each
514
+ * segment's label independently (e.g. white on the dark segment, black on
515
+ * the light one), which a single chart-level `dataLabelFontColor` can't
516
+ * express. Takes precedence over `dataLabelFontColor`; null = no override.
517
+ */
518
+ labelColor?: string | null;
499
519
  /**
500
520
  * Mixed chart: per-series chart type override. Currently only "line" (XLSX)
501
521
  * is honoured; other values are treated as the chart's primary type.
@@ -660,6 +680,9 @@ declare interface DocParagraph {
660
680
  styleId?: string | null;
661
681
  /** Default font size (pt) inherited from style + direct pPr/rPr. Falls back to 10pt. */
662
682
  defaultFontSize?: number;
683
+ /** Default font family resolved from the style chain. Used to size empty
684
+ * paragraphs (no runs) with the intended font's line metrics. */
685
+ defaultFontFamily?: string | null;
663
686
  }
664
687
 
665
688
  declare interface DocRevision {
@@ -702,6 +725,13 @@ declare interface DocTableCell {
702
725
  background: string | null;
703
726
  vAlign: 'top' | 'center' | 'bottom';
704
727
  widthPt: number | null;
728
+ /** Per-cell margins (pt) from `<w:tcPr><w:tcMar>` (ECMA-376 §17.4.42). Each
729
+ * edge overrides the table-level `cellMargin*` default when set; null/absent
730
+ * = inherit the table default. */
731
+ marginTop?: number | null;
732
+ marginBottom?: number | null;
733
+ marginLeft?: number | null;
734
+ marginRight?: number | null;
705
735
  }
706
736
 
707
737
  declare interface DocTableRow {
@@ -1807,6 +1837,10 @@ declare interface ShapeElement {
1807
1837
  softEdge?: SoftEdge;
1808
1838
  /** Mirrored reflection — ECMA-376 §20.1.8.27. */
1809
1839
  reflection?: Reflection;
1840
+ /** Explicit text frame from a SmartArt drawing's `<dsp:txXfrm>` (absolute EMU,
1841
+ * same space as x/y/width/height). When present the renderer lays text out in
1842
+ * this rectangle instead of the preset/ellipse-derived text rectangle. */
1843
+ textRect?: TextRect;
1810
1844
  }
1811
1845
 
1812
1846
  declare type ShapeFill = {
@@ -1964,6 +1998,10 @@ declare interface SheetMeta {
1964
1998
  name: string;
1965
1999
  sheetId: number;
1966
2000
  rId: string;
2001
+ /** Sheet tab color (`<sheetPr><tabColor>`, ECMA-376 §18.3.1.93) resolved to
2002
+ * `#RRGGBB`. Surfaced at workbook-list time so tabs can be painted up front.
2003
+ * Absent when the sheet declares no tab color. */
2004
+ tabColor?: string | null;
1967
2005
  }
1968
2006
 
1969
2007
  declare interface SlicerAnchor {
@@ -2228,6 +2266,14 @@ declare interface TextOutline {
2228
2266
  color?: string;
2229
2267
  }
2230
2268
 
2269
+ /** Absolute text-frame rectangle in EMU (from SmartArt `<dsp:txXfrm>`). */
2270
+ declare interface TextRect {
2271
+ x: number;
2272
+ y: number;
2273
+ width: number;
2274
+ height: number;
2275
+ }
2276
+
2231
2277
  declare type TextRun = TextRunData | LineBreak;
2232
2278
 
2233
2279
  declare interface TextRun_2 {
@@ -2499,6 +2545,10 @@ declare interface XlsxChartSeries {
2499
2545
  /** `<c:val>/<c:numRef>/<c:formatCode>` — Excel number format for series
2500
2546
  * values (ECMA-376 §21.2.2.37). */
2501
2547
  valFormatCode?: string | null;
2548
+ /** `<c:ser><c:dLbls><c:txPr>…solidFill` — per-series data-label text color
2549
+ * (ECMA-376 §21.2.2.216). Takes precedence over the chart-level color so
2550
+ * each series can color its labels independently. */
2551
+ labelColor?: string | null;
2502
2552
  /** `<c:ser><c:order>` — stacking/legend display order (§21.2.2.28). */
2503
2553
  order?: number;
2504
2554
  /** `<c:marker><c:symbol val>` — point marker shape (ECMA-376 §21.2.2.32). */
@@ -2534,7 +2584,12 @@ declare class XlsxViewer {
2534
2584
  private tabStrip;
2535
2585
  private navPrev;
2536
2586
  private navNext;
2587
+ private navGroup;
2537
2588
  private tabs;
2589
+ /** Per-tab colors parallel to `tabs`, from `<sheetPr><tabColor>`. */
2590
+ private tabColors;
2591
+ private zoomSlider;
2592
+ private zoomLabel;
2538
2593
  private currentSheet;
2539
2594
  private currentWorksheet;
2540
2595
  private opts;
@@ -2577,6 +2632,18 @@ declare class XlsxViewer {
2577
2632
  private updateNavButtons;
2578
2633
  private updateTabActive;
2579
2634
  private tabStyle;
2635
+ /** Excel-style zoom control pinned to the right end of the tab bar:
2636
+ * `− [────slider────] + 100%`. Live-updates the cell scale on input. */
2637
+ private buildZoomControl;
2638
+ /** Map a slider position [0,100] to a scale factor. 50 → 1.0 (100%), with a
2639
+ * separate linear segment on each side so the center is always 100%. */
2640
+ private zoomPosToScale;
2641
+ /** Inverse of {@link zoomPosToScale}: scale factor → slider position [0,100]. */
2642
+ private zoomScaleToPos;
2643
+ /** Set the cell/header scale and re-lay-out the current sheet. Clamped to the
2644
+ * zoom bounds; keeps the slider thumb, percentage label and the row-header-
2645
+ * aligned tab-nav width in sync. */
2646
+ setScale(scale: number): void;
2580
2647
  private updateSpacerSize;
2581
2648
  private renderCurrentSheet;
2582
2649
  private computeHeaderHighlight;
@@ -2587,6 +2654,14 @@ declare class XlsxViewer {
2587
2654
  declare interface XlsxViewerOptions {
2588
2655
  /** Scale factor for cell/header dimensions (default 1). 0.5 = half size. */
2589
2656
  cellScale?: number;
2657
+ /** Show the Excel-style zoom slider at the right end of the sheet-tab bar.
2658
+ * Default `true`. Set `false` to hide it (e.g. when the host supplies its
2659
+ * own zoom control). */
2660
+ showZoomSlider?: boolean;
2661
+ /** Lower/upper bounds for the zoom slider as scale factors. Default 0.1–4
2662
+ * (10%–400%, matching Excel's zoom range). */
2663
+ zoomMin?: number;
2664
+ zoomMax?: number;
2590
2665
  onReady?: (sheetNames: string[]) => void;
2591
2666
  onSheetChange?: (index: number, name: string) => void;
2592
2667
  onError?: (err: Error) => void;
@@ -2620,6 +2695,9 @@ declare class XlsxWorkbook {
2620
2695
  load(source: string | ArrayBuffer, opts?: LoadOptions_3): Promise<void>;
2621
2696
  get sheetNames(): string[];
2622
2697
  get sheetCount(): number;
2698
+ /** Per-sheet tab colors (`#RRGGBB`) parallel to {@link sheetNames}.
2699
+ * `null` for sheets that declare no tab color. */
2700
+ get tabColors(): (string | null)[];
2623
2701
  getWorksheet(sheetIndex: number): Promise<Worksheet>;
2624
2702
  renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
2625
2703
  destroy(): void;
@@ -116,6 +116,18 @@ declare interface ChartElement {
116
116
  catAxisFontSizeHpt: number | null;
117
117
  /** `<c:valAx><c:txPr>` font size (hpt). null = proportional default. */
118
118
  valAxisFontSizeHpt: number | null;
119
+ /** `<c:catAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
120
+ catAxisFontColor?: string | null;
121
+ /** `<c:valAx><c:txPr>…<a:solidFill>` tick-label color (hex without '#'). */
122
+ valAxisFontColor?: string | null;
123
+ /** `<c:catAx><c:spPr><a:ln><a:solidFill>` axis-line color (hex without '#'). */
124
+ catAxisLineColor?: string | null;
125
+ /** `<c:catAx><c:spPr><a:ln w>` axis-line width in EMU. */
126
+ catAxisLineWidthEmu?: number | null;
127
+ /** `<c:valAx><c:spPr><a:ln><a:solidFill>` axis-line color (hex without '#'). */
128
+ valAxisLineColor?: string | null;
129
+ /** `<c:valAx><c:spPr><a:ln w>` axis-line width in EMU. */
130
+ valAxisLineWidthEmu?: number | null;
119
131
  /** `<c:dLbls><c:txPr>` font size (hpt) for data-point value labels. */
120
132
  dataLabelFontSizeHpt: number | null;
121
133
  /** `<c:legend><c:legendPos val>` — "r" (default) | "l" | "t" | "b" | "tr". */
@@ -191,6 +203,14 @@ declare interface ChartSeries {
191
203
  * fall back to the chart-level `dataLabelFontColor`.
192
204
  */
193
205
  dataLabelColors?: (string | null)[] | null;
206
+ /**
207
+ * Series-level data-label text colour (`<c:ser><c:dLbls><c:txPr>…solidFill`,
208
+ * ECMA-376 §21.2.2.216). Hex without '#'. Stacked-bar charts colour each
209
+ * segment's label independently (e.g. white on the dark segment, black on
210
+ * the light one), which a single chart-level `dataLabelFontColor` can't
211
+ * express. Takes precedence over `dataLabelFontColor`; null = no override.
212
+ */
213
+ labelColor?: string | null;
194
214
  /**
195
215
  * Mixed chart: per-series chart type override. Currently only "line" (XLSX)
196
216
  * is honoured; other values are treated as the chart's primary type.
@@ -734,6 +754,10 @@ export declare interface ShapeElement {
734
754
  softEdge?: SoftEdge;
735
755
  /** Mirrored reflection — ECMA-376 §20.1.8.27. */
736
756
  reflection?: Reflection;
757
+ /** Explicit text frame from a SmartArt drawing's `<dsp:txXfrm>` (absolute EMU,
758
+ * same space as x/y/width/height). When present the renderer lays text out in
759
+ * this rectangle instead of the preset/ellipse-derived text rectangle. */
760
+ textRect?: TextRect;
737
761
  }
738
762
 
739
763
  export declare interface Slide {
@@ -875,6 +899,14 @@ declare interface TextOutline {
875
899
  color?: string;
876
900
  }
877
901
 
902
+ /** Absolute text-frame rectangle in EMU (from SmartArt `<dsp:txXfrm>`). */
903
+ declare interface TextRect {
904
+ x: number;
905
+ y: number;
906
+ width: number;
907
+ height: number;
908
+ }
909
+
878
910
  export declare type TextRun = TextRunData | LineBreak;
879
911
 
880
912
  export declare type TextRunCallback = (run: TextRunInfo) => void;
@@ -703,6 +703,10 @@ export declare interface SheetMeta {
703
703
  name: string;
704
704
  sheetId: number;
705
705
  rId: string;
706
+ /** Sheet tab color (`<sheetPr><tabColor>`, ECMA-376 §18.3.1.93) resolved to
707
+ * `#RRGGBB`. Surfaced at workbook-list time so tabs can be painted up front.
708
+ * Absent when the sheet declares no tab color. */
709
+ tabColor?: string | null;
706
710
  }
707
711
 
708
712
  declare interface SlicerAnchor {
@@ -913,6 +917,10 @@ declare interface XlsxChartSeries {
913
917
  /** `<c:val>/<c:numRef>/<c:formatCode>` — Excel number format for series
914
918
  * values (ECMA-376 §21.2.2.37). */
915
919
  valFormatCode?: string | null;
920
+ /** `<c:ser><c:dLbls><c:txPr>…solidFill` — per-series data-label text color
921
+ * (ECMA-376 §21.2.2.216). Takes precedence over the chart-level color so
922
+ * each series can color its labels independently. */
923
+ labelColor?: string | null;
916
924
  /** `<c:ser><c:order>` — stacking/legend display order (§21.2.2.28). */
917
925
  order?: number;
918
926
  /** `<c:marker><c:symbol val>` — point marker shape (ECMA-376 §21.2.2.32). */
@@ -948,7 +956,12 @@ export declare class XlsxViewer {
948
956
  private tabStrip;
949
957
  private navPrev;
950
958
  private navNext;
959
+ private navGroup;
951
960
  private tabs;
961
+ /** Per-tab colors parallel to `tabs`, from `<sheetPr><tabColor>`. */
962
+ private tabColors;
963
+ private zoomSlider;
964
+ private zoomLabel;
952
965
  private currentSheet;
953
966
  private currentWorksheet;
954
967
  private opts;
@@ -991,6 +1004,18 @@ export declare class XlsxViewer {
991
1004
  private updateNavButtons;
992
1005
  private updateTabActive;
993
1006
  private tabStyle;
1007
+ /** Excel-style zoom control pinned to the right end of the tab bar:
1008
+ * `− [────slider────] + 100%`. Live-updates the cell scale on input. */
1009
+ private buildZoomControl;
1010
+ /** Map a slider position [0,100] to a scale factor. 50 → 1.0 (100%), with a
1011
+ * separate linear segment on each side so the center is always 100%. */
1012
+ private zoomPosToScale;
1013
+ /** Inverse of {@link zoomPosToScale}: scale factor → slider position [0,100]. */
1014
+ private zoomScaleToPos;
1015
+ /** Set the cell/header scale and re-lay-out the current sheet. Clamped to the
1016
+ * zoom bounds; keeps the slider thumb, percentage label and the row-header-
1017
+ * aligned tab-nav width in sync. */
1018
+ setScale(scale: number): void;
994
1019
  private updateSpacerSize;
995
1020
  private renderCurrentSheet;
996
1021
  private computeHeaderHighlight;
@@ -1001,6 +1026,14 @@ export declare class XlsxViewer {
1001
1026
  export declare interface XlsxViewerOptions {
1002
1027
  /** Scale factor for cell/header dimensions (default 1). 0.5 = half size. */
1003
1028
  cellScale?: number;
1029
+ /** Show the Excel-style zoom slider at the right end of the sheet-tab bar.
1030
+ * Default `true`. Set `false` to hide it (e.g. when the host supplies its
1031
+ * own zoom control). */
1032
+ showZoomSlider?: boolean;
1033
+ /** Lower/upper bounds for the zoom slider as scale factors. Default 0.1–4
1034
+ * (10%–400%, matching Excel's zoom range). */
1035
+ zoomMin?: number;
1036
+ zoomMax?: number;
1004
1037
  onReady?: (sheetNames: string[]) => void;
1005
1038
  onSheetChange?: (index: number, name: string) => void;
1006
1039
  onError?: (err: Error) => void;
@@ -1034,6 +1067,9 @@ export declare class XlsxWorkbook {
1034
1067
  load(source: string | ArrayBuffer, opts?: LoadOptions): Promise<void>;
1035
1068
  get sheetNames(): string[];
1036
1069
  get sheetCount(): number;
1070
+ /** Per-sheet tab colors (`#RRGGBB`) parallel to {@link sheetNames}.
1071
+ * `null` for sheets that declare no tab color. */
1072
+ get tabColors(): (string | null)[];
1037
1073
  getWorksheet(sheetIndex: number): Promise<Worksheet>;
1038
1074
  renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
1039
1075
  destroy(): void;