@silurus/ooxml 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pptx.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./autoResize-C6N7p_Or.cjs`),t=require(`./pptx-DMP47DvZ.cjs`);exports.PptxPresentation=t.r,exports.PptxViewer=t.n,exports.autoResize=e.t,exports.renderSlide=t.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./autoResize-C6N7p_Or.cjs`),t=require(`./pptx-t25UgAwI.cjs`);exports.PptxPresentation=t.r,exports.PptxViewer=t.n,exports.autoResize=e.t,exports.renderSlide=t.i;
package/dist/pptx.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { t as e } from "./autoResize-D-Yz7Izt.js";
2
- import { i as t, n, r } from "./pptx-Dr6cMPL2.js";
2
+ import { i as t, n, r } from "./pptx-BEYjdXut.js";
3
3
  export { r as PptxPresentation, n as PptxViewer, e as autoResize, t as renderSlide };
@@ -747,7 +747,7 @@ declare interface FieldRun {
747
747
  highlight?: string | null;
748
748
  }
749
749
 
750
- declare type Fill = SolidFill | NoFill | GradientFill;
750
+ declare type Fill = SolidFill | NoFill | GradientFill | PatternFill;
751
751
 
752
752
  declare interface Fill_2 {
753
753
  patternType: string;
@@ -765,6 +765,18 @@ declare interface Font {
765
765
  size: number;
766
766
  color: string | null;
767
767
  name: string | null;
768
+ /** ECMA-376 §18.4.13 ST_UnderlineValues — see RunFont.underlineStyle. */
769
+ underlineStyle?: string;
770
+ /** ECMA-376 §18.4.6 ST_VerticalAlignRun on a cell-level <font>. */
771
+ vertAlign?: 'superscript' | 'subscript';
772
+ }
773
+
774
+ /** ECMA-376 §20.1.8.17 (CT_GlowEffect) — coloured halo with blur radius. */
775
+ declare interface Glow {
776
+ color: string;
777
+ alpha: number;
778
+ /** Blur radius in EMU. */
779
+ radius: number;
768
780
  }
769
781
 
770
782
  declare interface GradientFill {
@@ -1132,6 +1144,20 @@ declare interface PathInfo {
1132
1144
  commands: PathCmd_2[];
1133
1145
  }
1134
1146
 
1147
+ /**
1148
+ * Preset pattern fill — ECMA-376 §20.1.8.40 (CT_PatternFillProperties)
1149
+ * with `preset` drawn from §20.1.10.59 (ST_PresetPatternVal).
1150
+ */
1151
+ declare interface PatternFill {
1152
+ fillType: 'pattern';
1153
+ /** Foreground hex colour — used for the "1" pixels of the preset bitmap. */
1154
+ fg: string;
1155
+ /** Background hex colour — used for the "0" pixels. */
1156
+ bg: string;
1157
+ /** Preset name, e.g. "pct25", "horz", "diagCross", "lgGrid". */
1158
+ preset: string;
1159
+ }
1160
+
1135
1161
  declare interface PictureElement {
1136
1162
  type: 'picture';
1137
1163
  x: number;
@@ -1313,6 +1339,10 @@ declare interface Presentation {
1313
1339
  majorFont: string | null;
1314
1340
  /** Theme minor (body) font family name (e.g. "Aptos", "Nunito Sans"). Null if not set. */
1315
1341
  minorFont: string | null;
1342
+ /** Theme hyperlink colour (hex 6 chars). Used to colour hyperlink runs that have no explicit colour. */
1343
+ hlinkColor?: string;
1344
+ /** Theme followed-hyperlink colour. Reserved for future visited-link styling. */
1345
+ folHlinkColor?: string;
1316
1346
  }
1317
1347
 
1318
1348
  declare interface PresentationHandle {
@@ -1321,12 +1351,36 @@ declare interface PresentationHandle {
1321
1351
  dispose(): void;
1322
1352
  }
1323
1353
 
1354
+ /** ECMA-376 §20.1.8.27 (CT_ReflectionEffect) — mirrored copy below the
1355
+ * shape with a linear alpha gradient. Carries the spec attributes whose
1356
+ * defaults the renderer needs to interpret correctly. */
1357
+ declare interface Reflection {
1358
+ blur: number;
1359
+ dist: number;
1360
+ /** Direction in degrees, clockwise from East. */
1361
+ dir: number;
1362
+ /** Start alpha (0–1). Default 1.0. */
1363
+ stA: number;
1364
+ /** Start position along the gradient (0–1). Default 0. */
1365
+ stPos: number;
1366
+ /** End alpha. Default 0. */
1367
+ endA: number;
1368
+ /** End position. Default 1.0. */
1369
+ endPos: number;
1370
+ /** Horizontal scale (1.0 = same width). */
1371
+ sx: number;
1372
+ /** Vertical scale (-1.0 = full mirror). */
1373
+ sy: number;
1374
+ }
1375
+
1324
1376
  declare interface RenderOptions {
1325
1377
  width?: number;
1326
1378
  defaultTextColor?: string | null;
1327
1379
  dpr?: number;
1328
1380
  majorFont?: string | null;
1329
1381
  minorFont?: string | null;
1382
+ /** Theme hyperlink colour (hex 6 chars). Used to colour hyperlink runs without an explicit colour. */
1383
+ hlinkColor?: string | null;
1330
1384
  /**
1331
1385
  * Lazily resolve an archive-internal asset (by zip path) to a Blob. The
1332
1386
  * renderer uses this to fetch posters and other large embedded assets on
@@ -1418,6 +1472,17 @@ declare interface RunFont {
1418
1472
  size?: number;
1419
1473
  color?: string | null;
1420
1474
  name?: string | null;
1475
+ /**
1476
+ * Underline style when not the default single line. ECMA-376 §18.4.13
1477
+ * (`ST_UnderlineValues`): "double" | "singleAccounting" | "doubleAccounting".
1478
+ * Absent means single (when `underline` is true) or no underline.
1479
+ */
1480
+ underlineStyle?: string;
1481
+ /**
1482
+ * ECMA-376 §18.4.6 (`ST_VerticalAlignRun`): "superscript" | "subscript".
1483
+ * Absent leaves the run on the baseline.
1484
+ */
1485
+ vertAlign?: 'superscript' | 'subscript';
1421
1486
  }
1422
1487
 
1423
1488
  declare interface SectionProps {
@@ -1511,6 +1576,14 @@ declare interface ShapeElement {
1511
1576
  adj8: number | null;
1512
1577
  /** Drop shadow from effectLst > outerShdw (null if not present). */
1513
1578
  shadow: Shadow | null;
1579
+ /** Inner (inset) shadow from effectLst > innerShdw. ECMA-376 §20.1.8.21. */
1580
+ innerShadow?: Shadow;
1581
+ /** Coloured glow halo from effectLst > glow. ECMA-376 §20.1.8.17. */
1582
+ glow?: Glow;
1583
+ /** Soft (feathered) edge — ECMA-376 §20.1.8.31. */
1584
+ softEdge?: SoftEdge;
1585
+ /** Mirrored reflection — ECMA-376 §20.1.8.27. */
1586
+ reflection?: Reflection;
1514
1587
  }
1515
1588
 
1516
1589
  declare type ShapeFill = {
@@ -1643,6 +1716,11 @@ declare interface Slide {
1643
1716
 
1644
1717
  declare type SlideElement = ShapeElement | PictureElement | TableElement | ChartElement | MediaElement;
1645
1718
 
1719
+ /** ECMA-376 §20.1.8.31 (CT_SoftEdgesEffect) — feather radius in EMU. */
1720
+ declare interface SoftEdge {
1721
+ radius: number;
1722
+ }
1723
+
1646
1724
  declare interface SolidFill {
1647
1725
  fillType: 'solid';
1648
1726
  color: string;
@@ -1708,6 +1786,11 @@ declare interface Stroke {
1708
1786
  headEnd?: ArrowEnd;
1709
1787
  /** Arrow head at the end of the line */
1710
1788
  tailEnd?: ArrowEnd;
1789
+ /**
1790
+ * ECMA-376 §20.1.8.42 ST_CompoundLine. "sng" (default) | "dbl" |
1791
+ * "thinThick" | "thickThin" | "tri". Absent means single line.
1792
+ */
1793
+ cmpd?: string;
1711
1794
  }
1712
1795
 
1713
1796
  declare interface Styles {
@@ -1873,16 +1956,58 @@ declare interface TextRunData {
1873
1956
  /** null = not set, inherit from paragraph/body defaults */
1874
1957
  italic: boolean | null;
1875
1958
  underline: boolean;
1876
- /** true when rPr strike = "sngStrike" or "dblStrike" */
1959
+ /**
1960
+ * Specific underline style when not the default single line. Values come
1961
+ * from ECMA-376 §21.1.2.3.16 (ST_TextUnderlineType): "dbl", "heavy",
1962
+ * "dotted", "dottedHeavy", "dash", "dashHeavy", "dashLong",
1963
+ * "dashLongHeavy", "dotDash", "dotDashHeavy", "dotDotDash",
1964
+ * "dotDotDashHeavy", "wavy", "wavyHeavy", "wavyDbl". Absent means either
1965
+ * no underline (when `underline` is false) or the default single line.
1966
+ */
1967
+ underlineStyle?: string;
1968
+ /**
1969
+ * Underline-only colour from rPr > uFill (ECMA-376 §21.1.2.3.20). Absent
1970
+ * means the underline follows the text colour (uFillTx default).
1971
+ */
1972
+ underlineColor?: string;
1973
+ /** True when rPr strike is sngStrike or dblStrike. */
1877
1974
  strikethrough: boolean;
1975
+ /**
1976
+ * True only when rPr strike = "dblStrike". Lets the renderer draw two parallel
1977
+ * lines instead of one. ECMA-376 §21.1.2.3.10 (ST_TextStrikeType).
1978
+ */
1979
+ strikeDouble?: boolean;
1878
1980
  /** Font size in points */
1879
1981
  fontSize: number | null;
1880
1982
  color: string | null;
1881
1983
  fontFamily: string | null;
1984
+ /**
1985
+ * East Asian font family from rPr > a:ea (ECMA-376 §21.1.2.3.7),
1986
+ * resolved through the theme. Renderer uses this for CJK glyphs when
1987
+ * present; absent means CJK falls back to fontFamily.
1988
+ */
1989
+ fontFamilyEa?: string;
1882
1990
  /** Baseline shift in thousandths of a point. Positive = superscript, negative = subscript. */
1883
1991
  baseline?: number;
1992
+ /**
1993
+ * Capitalisation transform — ECMA-376 §21.1.2.3.13 (ST_TextCapsType).
1994
+ * 'all' renders text in upper case; 'small' uses small caps (rendered as
1995
+ * upper case at ~80% size when no smcp font feature is available).
1996
+ * 'none' or omitted leaves the text unchanged.
1997
+ */
1998
+ caps?: 'none' | 'small' | 'all';
1999
+ /**
2000
+ * Inter-character spacing in 100ths of a point — ECMA-376 §21.1.2.3.5
2001
+ * (rPr @spc). Positive values add space, negative values tighten.
2002
+ */
2003
+ letterSpacing?: number;
1884
2004
  /** Set for OOXML field runs (e.g. "slidenum"). When set, renderer replaces text with field value. */
1885
2005
  fieldType?: string;
2006
+ /**
2007
+ * Hyperlink target URL resolved from rPr > a:hlinkClick @r:id via the slide's _rels.
2008
+ * Undefined for runs without a hyperlink. ECMA-376 §21.1.2.3.5 (CT_Hyperlink).
2009
+ */
2010
+ hyperlink?: string;
1886
2011
  }
1887
2012
 
1888
2013
  /** Information about a rendered text segment for building a transparent selection overlay. */
@@ -2098,7 +2223,12 @@ declare class XlsxViewer {
2098
2223
  showSheet(index: number): Promise<void>;
2099
2224
  /** Returns the cell at canvas-client coordinates, or null if outside the cell grid. */
2100
2225
  getCellAt(clientX: number, clientY: number): CellAddress | null;
2101
- /** Returns the CSS-pixel rect of a cell within canvasArea, or null if not computable. */
2226
+ /** Returns the CSS-pixel rect of a cell within canvasArea, or null if not
2227
+ * computable. Mirrors the renderer's per-cell rounding (Math.round(px * cs))
2228
+ * so the selection overlay sits exactly on the canvas's drawn cell borders;
2229
+ * multiplying logical accumulators by `cs` once at the end (the previous
2230
+ * approach) drifted by up to 1 px per cell at non-integer scales.
2231
+ */
2102
2232
  private getCellRect;
2103
2233
  /** Returns the current selection, including mode. */
2104
2234
  get selection(): CellRange_2 | null;
@@ -222,7 +222,15 @@ declare interface ChartSeriesDataLabels {
222
222
  fontSizeHpt?: number;
223
223
  }
224
224
 
225
- export declare type Fill = SolidFill | NoFill | GradientFill;
225
+ export declare type Fill = SolidFill | NoFill | GradientFill | PatternFill;
226
+
227
+ /** ECMA-376 §20.1.8.17 (CT_GlowEffect) — coloured halo with blur radius. */
228
+ declare interface Glow {
229
+ color: string;
230
+ alpha: number;
231
+ /** Blur radius in EMU. */
232
+ radius: number;
233
+ }
226
234
 
227
235
  declare interface GradientFill {
228
236
  fillType: 'gradient';
@@ -341,6 +349,20 @@ declare type PathCmd = {
341
349
  cmd: 'close';
342
350
  };
343
351
 
352
+ /**
353
+ * Preset pattern fill — ECMA-376 §20.1.8.40 (CT_PatternFillProperties)
354
+ * with `preset` drawn from §20.1.10.59 (ST_PresetPatternVal).
355
+ */
356
+ declare interface PatternFill {
357
+ fillType: 'pattern';
358
+ /** Foreground hex colour — used for the "1" pixels of the preset bitmap. */
359
+ fg: string;
360
+ /** Background hex colour — used for the "0" pixels. */
361
+ bg: string;
362
+ /** Preset name, e.g. "pct25", "horz", "diagCross", "lgGrid". */
363
+ preset: string;
364
+ }
365
+
344
366
  export declare interface PictureElement {
345
367
  type: 'picture';
346
368
  x: number;
@@ -492,6 +514,10 @@ export declare interface Presentation {
492
514
  majorFont: string | null;
493
515
  /** Theme minor (body) font family name (e.g. "Aptos", "Nunito Sans"). Null if not set. */
494
516
  minorFont: string | null;
517
+ /** Theme hyperlink colour (hex 6 chars). Used to colour hyperlink runs that have no explicit colour. */
518
+ hlinkColor?: string;
519
+ /** Theme followed-hyperlink colour. Reserved for future visited-link styling. */
520
+ folHlinkColor?: string;
495
521
  }
496
522
 
497
523
  declare interface PresentationHandle {
@@ -500,12 +526,36 @@ declare interface PresentationHandle {
500
526
  dispose(): void;
501
527
  }
502
528
 
529
+ /** ECMA-376 §20.1.8.27 (CT_ReflectionEffect) — mirrored copy below the
530
+ * shape with a linear alpha gradient. Carries the spec attributes whose
531
+ * defaults the renderer needs to interpret correctly. */
532
+ declare interface Reflection {
533
+ blur: number;
534
+ dist: number;
535
+ /** Direction in degrees, clockwise from East. */
536
+ dir: number;
537
+ /** Start alpha (0–1). Default 1.0. */
538
+ stA: number;
539
+ /** Start position along the gradient (0–1). Default 0. */
540
+ stPos: number;
541
+ /** End alpha. Default 0. */
542
+ endA: number;
543
+ /** End position. Default 1.0. */
544
+ endPos: number;
545
+ /** Horizontal scale (1.0 = same width). */
546
+ sx: number;
547
+ /** Vertical scale (-1.0 = full mirror). */
548
+ sy: number;
549
+ }
550
+
503
551
  export declare interface RenderOptions {
504
552
  width?: number;
505
553
  defaultTextColor?: string | null;
506
554
  dpr?: number;
507
555
  majorFont?: string | null;
508
556
  minorFont?: string | null;
557
+ /** Theme hyperlink colour (hex 6 chars). Used to colour hyperlink runs without an explicit colour. */
558
+ hlinkColor?: string | null;
509
559
  /**
510
560
  * Lazily resolve an archive-internal asset (by zip path) to a Blob. The
511
561
  * renderer uses this to fetch posters and other large embedded assets on
@@ -589,6 +639,14 @@ export declare interface ShapeElement {
589
639
  adj8: number | null;
590
640
  /** Drop shadow from effectLst > outerShdw (null if not present). */
591
641
  shadow: Shadow | null;
642
+ /** Inner (inset) shadow from effectLst > innerShdw. ECMA-376 §20.1.8.21. */
643
+ innerShadow?: Shadow;
644
+ /** Coloured glow halo from effectLst > glow. ECMA-376 §20.1.8.17. */
645
+ glow?: Glow;
646
+ /** Soft (feathered) edge — ECMA-376 §20.1.8.31. */
647
+ softEdge?: SoftEdge;
648
+ /** Mirrored reflection — ECMA-376 §20.1.8.27. */
649
+ reflection?: Reflection;
592
650
  }
593
651
 
594
652
  export declare interface Slide {
@@ -601,6 +659,11 @@ export declare interface Slide {
601
659
 
602
660
  export declare type SlideElement = ShapeElement | PictureElement | TableElement | ChartElement | MediaElement;
603
661
 
662
+ /** ECMA-376 §20.1.8.31 (CT_SoftEdgesEffect) — feather radius in EMU. */
663
+ declare interface SoftEdge {
664
+ radius: number;
665
+ }
666
+
604
667
  export declare interface SolidFill {
605
668
  fillType: 'solid';
606
669
  color: string;
@@ -624,6 +687,11 @@ export declare interface Stroke {
624
687
  headEnd?: ArrowEnd;
625
688
  /** Arrow head at the end of the line */
626
689
  tailEnd?: ArrowEnd;
690
+ /**
691
+ * ECMA-376 §20.1.8.42 ST_CompoundLine. "sng" (default) | "dbl" |
692
+ * "thinThick" | "thickThin" | "tri". Absent means single line.
693
+ */
694
+ cmpd?: string;
627
695
  }
628
696
 
629
697
  declare interface TableCell {
@@ -706,16 +774,58 @@ export declare interface TextRunData {
706
774
  /** null = not set, inherit from paragraph/body defaults */
707
775
  italic: boolean | null;
708
776
  underline: boolean;
709
- /** true when rPr strike = "sngStrike" or "dblStrike" */
777
+ /**
778
+ * Specific underline style when not the default single line. Values come
779
+ * from ECMA-376 §21.1.2.3.16 (ST_TextUnderlineType): "dbl", "heavy",
780
+ * "dotted", "dottedHeavy", "dash", "dashHeavy", "dashLong",
781
+ * "dashLongHeavy", "dotDash", "dotDashHeavy", "dotDotDash",
782
+ * "dotDotDashHeavy", "wavy", "wavyHeavy", "wavyDbl". Absent means either
783
+ * no underline (when `underline` is false) or the default single line.
784
+ */
785
+ underlineStyle?: string;
786
+ /**
787
+ * Underline-only colour from rPr > uFill (ECMA-376 §21.1.2.3.20). Absent
788
+ * means the underline follows the text colour (uFillTx default).
789
+ */
790
+ underlineColor?: string;
791
+ /** True when rPr strike is sngStrike or dblStrike. */
710
792
  strikethrough: boolean;
793
+ /**
794
+ * True only when rPr strike = "dblStrike". Lets the renderer draw two parallel
795
+ * lines instead of one. ECMA-376 §21.1.2.3.10 (ST_TextStrikeType).
796
+ */
797
+ strikeDouble?: boolean;
711
798
  /** Font size in points */
712
799
  fontSize: number | null;
713
800
  color: string | null;
714
801
  fontFamily: string | null;
802
+ /**
803
+ * East Asian font family from rPr > a:ea (ECMA-376 §21.1.2.3.7),
804
+ * resolved through the theme. Renderer uses this for CJK glyphs when
805
+ * present; absent means CJK falls back to fontFamily.
806
+ */
807
+ fontFamilyEa?: string;
715
808
  /** Baseline shift in thousandths of a point. Positive = superscript, negative = subscript. */
716
809
  baseline?: number;
810
+ /**
811
+ * Capitalisation transform — ECMA-376 §21.1.2.3.13 (ST_TextCapsType).
812
+ * 'all' renders text in upper case; 'small' uses small caps (rendered as
813
+ * upper case at ~80% size when no smcp font feature is available).
814
+ * 'none' or omitted leaves the text unchanged.
815
+ */
816
+ caps?: 'none' | 'small' | 'all';
817
+ /**
818
+ * Inter-character spacing in 100ths of a point — ECMA-376 §21.1.2.3.5
819
+ * (rPr @spc). Positive values add space, negative values tighten.
820
+ */
821
+ letterSpacing?: number;
717
822
  /** Set for OOXML field runs (e.g. "slidenum"). When set, renderer replaces text with field value. */
718
823
  fieldType?: string;
824
+ /**
825
+ * Hyperlink target URL resolved from rPr > a:hlinkClick @r:id via the slide's _rels.
826
+ * Undefined for runs without a hyperlink. ECMA-376 §21.1.2.3.5 (CT_Hyperlink).
827
+ */
828
+ hyperlink?: string;
719
829
  }
720
830
 
721
831
  /** Information about a rendered text segment for building a transparent selection overlay. */
@@ -360,6 +360,10 @@ export declare interface Font {
360
360
  size: number;
361
361
  color: string | null;
362
362
  name: string | null;
363
+ /** ECMA-376 §18.4.13 ST_UnderlineValues — see RunFont.underlineStyle. */
364
+ underlineStyle?: string;
365
+ /** ECMA-376 §18.4.6 ST_VerticalAlignRun on a cell-level <font>. */
366
+ vertAlign?: 'superscript' | 'subscript';
363
367
  }
364
368
 
365
369
  declare interface GradientFillSpec {
@@ -542,6 +546,17 @@ declare interface RunFont {
542
546
  size?: number;
543
547
  color?: string | null;
544
548
  name?: string | null;
549
+ /**
550
+ * Underline style when not the default single line. ECMA-376 §18.4.13
551
+ * (`ST_UnderlineValues`): "double" | "singleAccounting" | "doubleAccounting".
552
+ * Absent means single (when `underline` is true) or no underline.
553
+ */
554
+ underlineStyle?: string;
555
+ /**
556
+ * ECMA-376 §18.4.6 (`ST_VerticalAlignRun`): "superscript" | "subscript".
557
+ * Absent leaves the run on the baseline.
558
+ */
559
+ vertAlign?: 'superscript' | 'subscript';
545
560
  }
546
561
 
547
562
  declare type SelectionMode_2 = 'cells' | 'rows' | 'cols' | 'all';
@@ -898,7 +913,12 @@ export declare class XlsxViewer {
898
913
  showSheet(index: number): Promise<void>;
899
914
  /** Returns the cell at canvas-client coordinates, or null if outside the cell grid. */
900
915
  getCellAt(clientX: number, clientY: number): CellAddress | null;
901
- /** Returns the CSS-pixel rect of a cell within canvasArea, or null if not computable. */
916
+ /** Returns the CSS-pixel rect of a cell within canvasArea, or null if not
917
+ * computable. Mirrors the renderer's per-cell rounding (Math.round(px * cs))
918
+ * so the selection overlay sits exactly on the canvas's drawn cell borders;
919
+ * multiplying logical accumulators by `cs` once at the end (the previous
920
+ * approach) drifted by up to 1 px per cell at non-integer scales.
921
+ */
902
922
  private getCellRect;
903
923
  /** Returns the current selection, including mode. */
904
924
  get selection(): CellRange | null;