docx-plus 0.0.4 → 0.0.6

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/index.mjs CHANGED
@@ -364,6 +364,9 @@ var Attributes = class extends XmlAttributeComponent {
364
364
  rsidSect: "w:rsidSect",
365
365
  space: "w:space",
366
366
  sz: "w:sz",
367
+ themeColor: "w:themeColor",
368
+ themeShade: "w:themeShade",
369
+ themeTint: "w:themeTint",
367
370
  top: "w:top",
368
371
  type: "w:type",
369
372
  val: "w:val",
@@ -890,6 +893,49 @@ const pointMeasureValue = unsignedDecimalNumber;
890
893
  * ```
891
894
  */
892
895
  const dateTimeValue = (val) => val.toISOString();
896
+ /**
897
+ * Theme color values used throughout OOXML for referencing document theme colors.
898
+ *
899
+ * Reference: ST_ThemeColor in OOXML specification
900
+ *
901
+ * @publicApi
902
+ */
903
+ const ThemeColor = {
904
+ DARK1: "dark1",
905
+ LIGHT1: "light1",
906
+ DARK2: "dark2",
907
+ LIGHT2: "light2",
908
+ ACCENT1: "accent1",
909
+ ACCENT2: "accent2",
910
+ ACCENT3: "accent3",
911
+ ACCENT4: "accent4",
912
+ ACCENT5: "accent5",
913
+ ACCENT6: "accent6",
914
+ HYPERLINK: "hyperlink",
915
+ FOLLOWED_HYPERLINK: "followedHyperlink",
916
+ NONE: "none",
917
+ BACKGROUND1: "background1",
918
+ TEXT1: "text1",
919
+ BACKGROUND2: "background2",
920
+ TEXT2: "text2"
921
+ };
922
+ /**
923
+ * Theme font values used for referencing document theme fonts.
924
+ *
925
+ * Reference: ST_Theme in OOXML specification
926
+ *
927
+ * @publicApi
928
+ */
929
+ const ThemeFont = {
930
+ MAJOR_EAST_ASIA: "majorEastAsia",
931
+ MAJOR_BIDI: "majorBidi",
932
+ MAJOR_ASCII: "majorAscii",
933
+ MAJOR_H_ANSI: "majorHAnsi",
934
+ MINOR_EAST_ASIA: "minorEastAsia",
935
+ MINOR_BIDI: "minorBidi",
936
+ MINOR_ASCII: "minorAscii",
937
+ MINOR_H_ANSI: "minorHAnsi"
938
+ };
893
939
  //#endregion
894
940
  //#region src/file/xml-components/simple-elements.ts
895
941
  /**
@@ -1302,12 +1348,20 @@ const createAlignment = (type) => new BuilderElement({
1302
1348
  * });
1303
1349
  * ```
1304
1350
  */
1305
- const createBorderElement = (elementName, { color, size, space, style }) => new BuilderElement({
1351
+ const createBorderElement = (elementName, { color, size, space, style, themeColor, themeTint, themeShade, shadow, frame }) => new BuilderElement({
1306
1352
  attributes: {
1307
1353
  color: {
1308
1354
  key: "w:color",
1309
1355
  value: color === void 0 ? void 0 : hexColorValue(color)
1310
1356
  },
1357
+ frame: {
1358
+ key: "w:frame",
1359
+ value: frame
1360
+ },
1361
+ shadow: {
1362
+ key: "w:shadow",
1363
+ value: shadow
1364
+ },
1311
1365
  size: {
1312
1366
  key: "w:sz",
1313
1367
  value: size === void 0 ? void 0 : eighthPointMeasureValue(size)
@@ -1319,6 +1373,18 @@ const createBorderElement = (elementName, { color, size, space, style }) => new
1319
1373
  style: {
1320
1374
  key: "w:val",
1321
1375
  value: style
1376
+ },
1377
+ themeColor: {
1378
+ key: "w:themeColor",
1379
+ value: themeColor
1380
+ },
1381
+ themeShade: {
1382
+ key: "w:themeShade",
1383
+ value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
1384
+ },
1385
+ themeTint: {
1386
+ key: "w:themeTint",
1387
+ value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
1322
1388
  }
1323
1389
  },
1324
1390
  name: elementName
@@ -1522,20 +1588,32 @@ var ThematicBreak = class extends XmlComponent {
1522
1588
  * </xsd:complexType>
1523
1589
  * ```
1524
1590
  */
1525
- const createIndent = ({ start, end, left, right, hanging, firstLine }) => new BuilderElement({
1591
+ const createIndent = ({ start, startChars, end, endChars, left, right, hanging, hangingChars, firstLine, firstLineChars }) => new BuilderElement({
1526
1592
  attributes: {
1527
1593
  end: {
1528
1594
  key: "w:end",
1529
1595
  value: end === void 0 ? void 0 : signedTwipsMeasureValue(end)
1530
1596
  },
1597
+ endChars: {
1598
+ key: "w:endChars",
1599
+ value: endChars === void 0 ? void 0 : decimalNumber(endChars)
1600
+ },
1531
1601
  firstLine: {
1532
1602
  key: "w:firstLine",
1533
1603
  value: firstLine === void 0 ? void 0 : twipsMeasureValue(firstLine)
1534
1604
  },
1605
+ firstLineChars: {
1606
+ key: "w:firstLineChars",
1607
+ value: firstLineChars === void 0 ? void 0 : decimalNumber(firstLineChars)
1608
+ },
1535
1609
  hanging: {
1536
1610
  key: "w:hanging",
1537
1611
  value: hanging === void 0 ? void 0 : twipsMeasureValue(hanging)
1538
1612
  },
1613
+ hangingChars: {
1614
+ key: "w:hangingChars",
1615
+ value: hangingChars === void 0 ? void 0 : decimalNumber(hangingChars)
1616
+ },
1539
1617
  left: {
1540
1618
  key: "w:left",
1541
1619
  value: left === void 0 ? void 0 : signedTwipsMeasureValue(left)
@@ -1547,6 +1625,10 @@ const createIndent = ({ start, end, left, right, hanging, firstLine }) => new Bu
1547
1625
  start: {
1548
1626
  key: "w:start",
1549
1627
  value: start === void 0 ? void 0 : signedTwipsMeasureValue(start)
1628
+ },
1629
+ startChars: {
1630
+ key: "w:startChars",
1631
+ value: startChars === void 0 ? void 0 : decimalNumber(startChars)
1550
1632
  }
1551
1633
  },
1552
1634
  name: "w:ind"
@@ -1997,7 +2079,7 @@ var CurrentSection = class extends XmlComponent {
1997
2079
  *
1998
2080
  * Reference: http://officeopenxml.com/WPshading.php
1999
2081
  */
2000
- const createShading = ({ fill, color, type }) => new BuilderElement({
2082
+ const createShading = ({ fill, color, type, themeColor, themeTint, themeShade, themeFill, themeFillTint, themeFillShade }) => new BuilderElement({
2001
2083
  attributes: {
2002
2084
  color: {
2003
2085
  key: "w:color",
@@ -2007,6 +2089,30 @@ const createShading = ({ fill, color, type }) => new BuilderElement({
2007
2089
  key: "w:fill",
2008
2090
  value: fill === void 0 ? void 0 : hexColorValue(fill)
2009
2091
  },
2092
+ themeColor: {
2093
+ key: "w:themeColor",
2094
+ value: themeColor
2095
+ },
2096
+ themeFill: {
2097
+ key: "w:themeFill",
2098
+ value: themeFill
2099
+ },
2100
+ themeFillShade: {
2101
+ key: "w:themeFillShade",
2102
+ value: themeFillShade === void 0 ? void 0 : uCharHexNumber(themeFillShade)
2103
+ },
2104
+ themeFillTint: {
2105
+ key: "w:themeFillTint",
2106
+ value: themeFillTint === void 0 ? void 0 : uCharHexNumber(themeFillTint)
2107
+ },
2108
+ themeShade: {
2109
+ key: "w:themeShade",
2110
+ value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
2111
+ },
2112
+ themeTint: {
2113
+ key: "w:themeTint",
2114
+ value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
2115
+ },
2010
2116
  type: {
2011
2117
  key: "w:val",
2012
2118
  value: type
@@ -2153,6 +2259,57 @@ var InsertionTrackChange = class extends XmlComponent {
2153
2259
  }
2154
2260
  };
2155
2261
  //#endregion
2262
+ //#region src/file/paragraph/run/east-asian-layout.ts
2263
+ /**
2264
+ * East Asian layout module for WordprocessingML run properties.
2265
+ *
2266
+ * Specifies East Asian typography settings for a run, including
2267
+ * character combination, vertical text, and compression.
2268
+ *
2269
+ * Reference: ISO/IEC 29500-4, CT_EastAsianLayout
2270
+ *
2271
+ * @module
2272
+ */
2273
+ /**
2274
+ * Creates an East Asian layout element (w:eastAsianLayout) for a run.
2275
+ *
2276
+ * ## XSD Schema
2277
+ * ```xml
2278
+ * <xsd:complexType name="CT_EastAsianLayout">
2279
+ * <xsd:attribute name="id" type="ST_DecimalNumber" use="optional"/>
2280
+ * <xsd:attribute name="combine" type="s:ST_OnOff" use="optional"/>
2281
+ * <xsd:attribute name="combineBrackets" type="ST_CombineBrackets" use="optional"/>
2282
+ * <xsd:attribute name="vert" type="s:ST_OnOff" use="optional"/>
2283
+ * <xsd:attribute name="vertCompress" type="s:ST_OnOff" use="optional"/>
2284
+ * </xsd:complexType>
2285
+ * ```
2286
+ */
2287
+ const createEastAsianLayout = ({ id, combine, combineBrackets, vert, vertCompress }) => new BuilderElement({
2288
+ attributes: {
2289
+ combine: {
2290
+ key: "w:combine",
2291
+ value: combine
2292
+ },
2293
+ combineBrackets: {
2294
+ key: "w:combineBrackets",
2295
+ value: combineBrackets
2296
+ },
2297
+ id: {
2298
+ key: "w:id",
2299
+ value: id === void 0 ? void 0 : decimalNumber(id)
2300
+ },
2301
+ vert: {
2302
+ key: "w:vert",
2303
+ value: vert
2304
+ },
2305
+ vertCompress: {
2306
+ key: "w:vertCompress",
2307
+ value: vertCompress
2308
+ }
2309
+ },
2310
+ name: "w:eastAsianLayout"
2311
+ });
2312
+ //#endregion
2156
2313
  //#region src/file/paragraph/run/emphasis-mark.ts
2157
2314
  /**
2158
2315
  * Emphasis mark module for WordprocessingML run properties.
@@ -2185,7 +2342,13 @@ var InsertionTrackChange = class extends XmlComponent {
2185
2342
  *
2186
2343
  * @publicApi
2187
2344
  */
2188
- const EmphasisMarkType = { DOT: "dot" };
2345
+ const EmphasisMarkType = {
2346
+ NONE: "none",
2347
+ COMMA: "comma",
2348
+ CIRCLE: "circle",
2349
+ DOT: "dot",
2350
+ UNDER_DOT: "underDot"
2351
+ };
2189
2352
  /**
2190
2353
  * Creates an emphasis mark element for a WordprocessingML document.
2191
2354
  *
@@ -2276,16 +2439,27 @@ var CharacterSpacing = class extends XmlComponent {
2276
2439
  *
2277
2440
  * @example
2278
2441
  * ```typescript
2279
- * new Color("FF0000"); // Red text
2442
+ * new Color("FF0000"); // Red text (backward compatible)
2280
2443
  * new Color("auto"); // Automatic color
2444
+ * new Color({ themeColor: ThemeColor.ACCENT1, themeTint: "99" }); // Theme color with tint
2281
2445
  * ```
2282
2446
  *
2283
2447
  * @internal
2284
2448
  */
2285
2449
  var Color = class extends XmlComponent {
2286
- constructor(color) {
2450
+ constructor(colorOrOptions) {
2287
2451
  super("w:color");
2288
- this.root.push(new Attributes({ val: hexColorValue(color) }));
2452
+ if (typeof colorOrOptions === "string") {
2453
+ this.root.push(new Attributes({ val: hexColorValue(colorOrOptions) }));
2454
+ return;
2455
+ }
2456
+ const opts = colorOrOptions;
2457
+ this.root.push(new Attributes({
2458
+ val: opts.val === void 0 ? void 0 : hexColorValue(opts.val),
2459
+ themeColor: opts.themeColor,
2460
+ themeTint: opts.themeTint === void 0 ? void 0 : uCharHexNumber(opts.themeTint),
2461
+ themeShade: opts.themeShade === void 0 ? void 0 : uCharHexNumber(opts.themeShade)
2462
+ }));
2289
2463
  }
2290
2464
  };
2291
2465
  /**
@@ -2484,18 +2658,34 @@ const createRunFonts = (nameOrAttrs, hint) => {
2484
2658
  key: "w:ascii",
2485
2659
  value: attrs.ascii
2486
2660
  },
2661
+ asciiTheme: {
2662
+ key: "w:asciiTheme",
2663
+ value: attrs.asciiTheme
2664
+ },
2487
2665
  cs: {
2488
2666
  key: "w:cs",
2489
2667
  value: attrs.cs
2490
2668
  },
2669
+ cstheme: {
2670
+ key: "w:cstheme",
2671
+ value: attrs.cstheme
2672
+ },
2491
2673
  eastAsia: {
2492
2674
  key: "w:eastAsia",
2493
2675
  value: attrs.eastAsia
2494
2676
  },
2677
+ eastAsiaTheme: {
2678
+ key: "w:eastAsiaTheme",
2679
+ value: attrs.eastAsiaTheme
2680
+ },
2495
2681
  hAnsi: {
2496
2682
  key: "w:hAnsi",
2497
2683
  value: attrs.hAnsi
2498
2684
  },
2685
+ hAnsiTheme: {
2686
+ key: "w:hAnsiTheme",
2687
+ value: attrs.hAnsiTheme
2688
+ },
2499
2689
  hint: {
2500
2690
  key: "w:hint",
2501
2691
  value: attrs.hint
@@ -2652,12 +2842,24 @@ const UnderlineType = {
2652
2842
  * createUnderline(UnderlineType.WAVE, "FF0000");
2653
2843
  * ```
2654
2844
  */
2655
- const createUnderline = (underlineType = UnderlineType.SINGLE, color) => new BuilderElement({
2845
+ const createUnderline = (underlineType = UnderlineType.SINGLE, color, themeColor, themeTint, themeShade) => new BuilderElement({
2656
2846
  attributes: {
2657
2847
  color: {
2658
2848
  key: "w:color",
2659
2849
  value: color === void 0 ? void 0 : hexColorValue(color)
2660
2850
  },
2851
+ themeColor: {
2852
+ key: "w:themeColor",
2853
+ value: themeColor
2854
+ },
2855
+ themeShade: {
2856
+ key: "w:themeShade",
2857
+ value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
2858
+ },
2859
+ themeTint: {
2860
+ key: "w:themeTint",
2861
+ value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
2862
+ },
2661
2863
  val: {
2662
2864
  key: "w:val",
2663
2865
  value: underlineType
@@ -2809,6 +3011,9 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
2809
3011
  if (options.doubleStrike !== void 0) this.push(new OnOffElement("w:dstrike", options.doubleStrike));
2810
3012
  if (options.emboss !== void 0) this.push(new OnOffElement("w:emboss", options.emboss));
2811
3013
  if (options.imprint !== void 0) this.push(new OnOffElement("w:imprint", options.imprint));
3014
+ if (options.outline !== void 0) this.push(new OnOffElement("w:outline", options.outline));
3015
+ if (options.shadow !== void 0) this.push(new OnOffElement("w:shadow", options.shadow));
3016
+ if (options.webHidden !== void 0) this.push(new OnOffElement("w:webHidden", options.webHidden));
2812
3017
  if (options.noProof !== void 0) this.push(new OnOffElement("w:noProof", options.noProof));
2813
3018
  if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
2814
3019
  if (options.vanish) this.push(new OnOffElement("w:vanish", options.vanish));
@@ -2834,6 +3039,9 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
2834
3039
  if (options.language) this.push(createLanguageComponent(options.language));
2835
3040
  if (options.specVanish) this.push(new OnOffElement("w:specVanish", options.vanish));
2836
3041
  if (options.math) this.push(new OnOffElement("w:oMath", options.math));
3042
+ if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
3043
+ if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
3044
+ if (options.eastAsianLayout) this.push(createEastAsianLayout(options.eastAsianLayout));
2837
3045
  if (options.revision) this.push(new RunPropertiesChange(options.revision));
2838
3046
  }
2839
3047
  push(item) {
@@ -3269,18 +3477,6 @@ const generateUuidPart = (count) => customAlphabet("1234567890abcdef", count)();
3269
3477
  * ```
3270
3478
  */
3271
3479
  const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
3272
- /**
3273
- * Encode a string to UTF-8 bytes.
3274
- *
3275
- * This is used to pre-encode XML content before passing to fflate's zipSync,
3276
- * which expects Uint8Array input for text content.
3277
- *
3278
- * The copy via `new Uint8Array()` ensures the returned array uses the
3279
- * current module's Uint8Array constructor, avoiding cross-realm issues
3280
- * in test environments (happy-dom) where TextEncoder returns a different
3281
- * realm's Uint8Array.
3282
- */
3283
- const encodeUtf8 = (str) => new Uint8Array(new TextEncoder().encode(str));
3284
3480
  //#endregion
3285
3481
  //#region src/file/drawing/floating/floating-position.ts
3286
3482
  /**
@@ -6943,7 +7139,7 @@ const LineRuleType = {
6943
7139
  * });
6944
7140
  * ```
6945
7141
  */
6946
- const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing }) => new BuilderElement({
7142
+ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing, beforeLines, afterLines }) => new BuilderElement({
6947
7143
  attributes: {
6948
7144
  after: {
6949
7145
  key: "w:after",
@@ -6953,6 +7149,10 @@ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, after
6953
7149
  key: "w:afterAutospacing",
6954
7150
  value: afterAutoSpacing
6955
7151
  },
7152
+ afterLines: {
7153
+ key: "w:afterLines",
7154
+ value: afterLines === void 0 ? void 0 : decimalNumber(afterLines)
7155
+ },
6956
7156
  before: {
6957
7157
  key: "w:before",
6958
7158
  value: before
@@ -6961,6 +7161,10 @@ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, after
6961
7161
  key: "w:beforeAutospacing",
6962
7162
  value: beforeAutoSpacing
6963
7163
  },
7164
+ beforeLines: {
7165
+ key: "w:beforeLines",
7166
+ value: beforeLines === void 0 ? void 0 : decimalNumber(beforeLines)
7167
+ },
6964
7168
  line: {
6965
7169
  key: "w:line",
6966
7170
  value: line
@@ -7071,6 +7275,7 @@ const TabStopType = {
7071
7275
  */
7072
7276
  const LeaderType = {
7073
7277
  DOT: "dot",
7278
+ HEAVY: "heavy",
7074
7279
  HYPHEN: "hyphen",
7075
7280
  MIDDLE_DOT: "middleDot",
7076
7281
  NONE: "none",
@@ -8343,6 +8548,34 @@ const createFrameProperties = (options) => {
8343
8548
  * @module
8344
8549
  */
8345
8550
  /**
8551
+ * Vertical text alignment types for paragraphs.
8552
+ *
8553
+ * Specifies the vertical alignment of text within the paragraph.
8554
+ *
8555
+ * @publicApi
8556
+ */
8557
+ const TextAlignmentType = {
8558
+ TOP: "top",
8559
+ CENTER: "center",
8560
+ BASELINE: "baseline",
8561
+ BOTTOM: "bottom",
8562
+ AUTO: "auto"
8563
+ };
8564
+ /**
8565
+ * Textbox tight wrap types for paragraphs.
8566
+ *
8567
+ * Specifies how tightly text wraps around a textbox.
8568
+ *
8569
+ * @publicApi
8570
+ */
8571
+ const TextboxTightWrapType = {
8572
+ NONE: "none",
8573
+ ALL_LINES: "allLines",
8574
+ FIRST_AND_LAST_LINE: "firstAndLastLine",
8575
+ FIRST_LINE_ONLY: "firstLineOnly",
8576
+ LAST_LINE_ONLY: "lastLineOnly"
8577
+ };
8578
+ /**
8346
8579
  * Represents paragraph properties (pPr) in a WordprocessingML document.
8347
8580
  *
8348
8581
  * The paragraph properties element specifies all formatting applied to a paragraph,
@@ -8505,6 +8738,27 @@ var ParagraphProperties = class extends IgnoreIfEmptyXmlComponent {
8505
8738
  if (options.outlineLevel !== void 0) this.push(createOutlineLevel(options.outlineLevel));
8506
8739
  if (options.suppressLineNumbers !== void 0) this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
8507
8740
  if (options.autoSpaceEastAsianText !== void 0) this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
8741
+ if (options.suppressAutoHyphens !== void 0) this.push(new OnOffElement("w:suppressAutoHyphens", options.suppressAutoHyphens));
8742
+ if (options.adjustRightInd !== void 0) this.push(new OnOffElement("w:adjustRightInd", options.adjustRightInd));
8743
+ if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
8744
+ if (options.mirrorIndents !== void 0) this.push(new OnOffElement("w:mirrorIndents", options.mirrorIndents));
8745
+ if (options.kinsoku !== void 0) this.push(new OnOffElement("w:kinsoku", options.kinsoku));
8746
+ if (options.topLinePunct !== void 0) this.push(new OnOffElement("w:topLinePunct", options.topLinePunct));
8747
+ if (options.autoSpaceDE !== void 0) this.push(new OnOffElement("w:autoSpaceDE", options.autoSpaceDE));
8748
+ if (options.textAlignment !== void 0) this.push(new BuilderElement({
8749
+ attributes: { val: {
8750
+ key: "w:val",
8751
+ value: options.textAlignment
8752
+ } },
8753
+ name: "w:textAlignment"
8754
+ }));
8755
+ if (options.textboxTightWrap !== void 0) this.push(new BuilderElement({
8756
+ attributes: { val: {
8757
+ key: "w:val",
8758
+ value: options.textboxTightWrap
8759
+ } },
8760
+ name: "w:textboxTightWrap"
8761
+ }));
8508
8762
  if (options.run) this.push(new ParagraphRunProperties(options.run));
8509
8763
  if (options.revision) this.push(new ParagraphPropertiesChange(options.revision));
8510
8764
  }
@@ -12874,6 +13128,137 @@ const createDocumentGrid = ({ type, linePitch, charSpace }) => new BuilderElemen
12874
13128
  name: "w:docGrid"
12875
13129
  });
12876
13130
  //#endregion
13131
+ //#region src/file/document/body/section-properties/properties/footnote-endnote-properties.ts
13132
+ /**
13133
+ * Footnote and endnote properties module for WordprocessingML section properties.
13134
+ *
13135
+ * Specifies footnote/endnote placement and numbering format within a section.
13136
+ *
13137
+ * Reference: ISO/IEC 29500-4, CT_FtnProps / CT_EdnProps
13138
+ *
13139
+ * @module
13140
+ */
13141
+ /**
13142
+ * Creates footnote properties element (w:footnotePr) for a section.
13143
+ *
13144
+ * ## XSD Schema
13145
+ * ```xml
13146
+ * <xsd:complexType name="CT_FtnProps">
13147
+ * <xsd:sequence>
13148
+ * <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
13149
+ * <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
13150
+ * <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
13151
+ * </xsd:sequence>
13152
+ * </xsd:complexType>
13153
+ * ```
13154
+ */
13155
+ const createFootnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
13156
+ const container = new FootnoteProperties();
13157
+ if (pos !== void 0) container.addChildElement(new BuilderElement({
13158
+ attributes: { val: {
13159
+ key: "w:val",
13160
+ value: pos
13161
+ } },
13162
+ name: "w:pos"
13163
+ }));
13164
+ if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
13165
+ attributes: {
13166
+ format: {
13167
+ key: "w:format",
13168
+ value: format
13169
+ },
13170
+ val: {
13171
+ key: "w:fmt",
13172
+ value: formatType
13173
+ }
13174
+ },
13175
+ name: "w:numFmt"
13176
+ }));
13177
+ if (numStart !== void 0) container.addChildElement(new BuilderElement({
13178
+ attributes: { val: {
13179
+ key: "w:val",
13180
+ value: decimalNumber(numStart)
13181
+ } },
13182
+ name: "w:numStart"
13183
+ }));
13184
+ if (numRestart !== void 0) container.addChildElement(new BuilderElement({
13185
+ attributes: { val: {
13186
+ key: "w:val",
13187
+ value: numRestart
13188
+ } },
13189
+ name: "w:numRestart"
13190
+ }));
13191
+ return container;
13192
+ };
13193
+ /**
13194
+ * Footnote properties container element.
13195
+ */
13196
+ var FootnoteProperties = class extends IgnoreIfEmptyXmlComponent {
13197
+ constructor() {
13198
+ super("w:footnotePr", true);
13199
+ }
13200
+ };
13201
+ /**
13202
+ * Creates endnote properties element (w:endnotePr) for a section.
13203
+ *
13204
+ * ## XSD Schema
13205
+ * ```xml
13206
+ * <xsd:complexType name="CT_EdnProps">
13207
+ * <xsd:sequence>
13208
+ * <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
13209
+ * <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
13210
+ * <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
13211
+ * </xsd:sequence>
13212
+ * </xsd:complexType>
13213
+ * ```
13214
+ */
13215
+ const createEndnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
13216
+ const container = new EndnoteProperties();
13217
+ if (pos !== void 0) container.addChildElement(new BuilderElement({
13218
+ attributes: { val: {
13219
+ key: "w:val",
13220
+ value: pos
13221
+ } },
13222
+ name: "w:pos"
13223
+ }));
13224
+ if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
13225
+ attributes: {
13226
+ format: {
13227
+ key: "w:format",
13228
+ value: format
13229
+ },
13230
+ val: {
13231
+ key: "w:fmt",
13232
+ value: formatType
13233
+ }
13234
+ },
13235
+ name: "w:numFmt"
13236
+ }));
13237
+ if (numStart !== void 0) container.addChildElement(new BuilderElement({
13238
+ attributes: { val: {
13239
+ key: "w:val",
13240
+ value: decimalNumber(numStart)
13241
+ } },
13242
+ name: "w:numStart"
13243
+ }));
13244
+ if (numRestart !== void 0) container.addChildElement(new BuilderElement({
13245
+ attributes: { val: {
13246
+ key: "w:val",
13247
+ value: numRestart
13248
+ } },
13249
+ name: "w:numRestart"
13250
+ }));
13251
+ return container;
13252
+ };
13253
+ /**
13254
+ * Endnote properties container element.
13255
+ */
13256
+ var EndnoteProperties = class extends IgnoreIfEmptyXmlComponent {
13257
+ constructor() {
13258
+ super("w:endnotePr", true);
13259
+ }
13260
+ };
13261
+ //#endregion
12877
13262
  //#region src/file/document/body/section-properties/properties/header-footer-reference.ts
12878
13263
  /**
12879
13264
  * This simple type specifies the possible types of headers and footers which may be specified for a given header or footer reference in a document. This value determines the page(s) on which the current header or footer shall be displayed.
@@ -13236,8 +13621,12 @@ const PageNumberSeparator = {
13236
13621
  * });
13237
13622
  * ```
13238
13623
  */
13239
- const createPageNumberType = ({ start, formatType, separator }) => new BuilderElement({
13624
+ const createPageNumberType = ({ start, formatType, separator, chapStyle }) => new BuilderElement({
13240
13625
  attributes: {
13626
+ chapStyle: {
13627
+ key: "w:chapStyle",
13628
+ value: chapStyle === void 0 ? void 0 : decimalNumber(chapStyle)
13629
+ },
13241
13630
  formatType: {
13242
13631
  key: "w:fmt",
13243
13632
  value: formatType
@@ -13526,7 +13915,7 @@ const sectionPageSizeDefaults = {
13526
13915
  * ```
13527
13916
  */
13528
13917
  var SectionProperties = class extends XmlComponent {
13529
- constructor({ page: { size: { width = sectionPageSizeDefaults.WIDTH, height = sectionPageSizeDefaults.HEIGHT, orientation = sectionPageSizeDefaults.ORIENTATION } = {}, margin: { top = sectionMarginDefaults.TOP, right = sectionMarginDefaults.RIGHT, bottom = sectionMarginDefaults.BOTTOM, left = sectionMarginDefaults.LEFT, header = sectionMarginDefaults.HEADER, footer = sectionMarginDefaults.FOOTER, gutter = sectionMarginDefaults.GUTTER } = {}, pageNumbers = {}, borders, textDirection } = {}, grid: { linePitch = 360, charSpace, type: gridType } = {}, headerWrapperGroup = {}, footerWrapperGroup = {}, lineNumbers, titlePage, verticalAlign, column, type, revision } = {}) {
13918
+ constructor({ page: { size: { width = sectionPageSizeDefaults.WIDTH, height = sectionPageSizeDefaults.HEIGHT, orientation = sectionPageSizeDefaults.ORIENTATION } = {}, margin: { top = sectionMarginDefaults.TOP, right = sectionMarginDefaults.RIGHT, bottom = sectionMarginDefaults.BOTTOM, left = sectionMarginDefaults.LEFT, header = sectionMarginDefaults.HEADER, footer = sectionMarginDefaults.FOOTER, gutter = sectionMarginDefaults.GUTTER } = {}, pageNumbers = {}, borders, textDirection } = {}, grid: { linePitch = 360, charSpace, type: gridType } = {}, headerWrapperGroup = {}, footerWrapperGroup = {}, lineNumbers, titlePage, verticalAlign, column, type, revision, noEndnote, bidi, rtlGutter, paperSrc, footnotePr, endnotePr } = {}) {
13530
13919
  super("w:sectPr");
13531
13920
  this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
13532
13921
  this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
@@ -13545,6 +13934,24 @@ var SectionProperties = class extends XmlComponent {
13545
13934
  if (titlePage !== void 0) this.root.push(new OnOffElement("w:titlePg", titlePage));
13546
13935
  if (textDirection) this.root.push(new PageTextDirection(textDirection));
13547
13936
  if (revision) this.root.push(new SectionPropertiesChange(revision));
13937
+ if (noEndnote !== void 0) this.root.push(new OnOffElement("w:noEndnote", noEndnote));
13938
+ if (bidi !== void 0) this.root.push(new OnOffElement("w:bidi", bidi));
13939
+ if (rtlGutter !== void 0) this.root.push(new OnOffElement("w:rtlGutter", rtlGutter));
13940
+ if (paperSrc) this.root.push(new BuilderElement({
13941
+ attributes: {
13942
+ first: {
13943
+ key: "w:first",
13944
+ value: paperSrc.first === void 0 ? void 0 : decimalNumber(paperSrc.first)
13945
+ },
13946
+ other: {
13947
+ key: "w:other",
13948
+ value: paperSrc.other === void 0 ? void 0 : decimalNumber(paperSrc.other)
13949
+ }
13950
+ },
13951
+ name: "w:paperSrc"
13952
+ }));
13953
+ if (footnotePr) this.root.push(createFootnoteProperties(footnotePr));
13954
+ if (endnotePr) this.root.push(createEndnoteProperties(endnotePr));
13548
13955
  this.root.push(createDocumentGrid({
13549
13956
  charSpace,
13550
13957
  linePitch,
@@ -21681,13 +22088,12 @@ var Compiler = class {
21681
22088
  const footerFormattedViews = /* @__PURE__ */ new Map();
21682
22089
  const xmlifiedFileMapping = this.xmlifyFile(file, headerFormattedViews, footerFormattedViews, prettifyXml);
21683
22090
  const map = new Map(Object.entries(xmlifiedFileMapping));
21684
- for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = encodeUtf8(subFile.data);
21685
- else files[obj.path] = encodeUtf8(obj.data);
21686
- for (const subFile of overrides) files[subFile.path] = encodeUtf8(subFile.data);
21687
- for (const mediaData of file.Media.Array) if (mediaData.type !== "svg") files[`word/media/${mediaData.fileName}`] = [toUint8Array(mediaData.data), { level: 0 }];
21688
- else {
22091
+ for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = textToUint8Array(subFile.data);
22092
+ else files[obj.path] = textToUint8Array(obj.data);
22093
+ for (const subFile of overrides) files[subFile.path] = textToUint8Array(subFile.data);
22094
+ for (const mediaData of file.Media.Array) {
21689
22095
  files[`word/media/${mediaData.fileName}`] = [toUint8Array(mediaData.data), { level: 0 }];
21690
- files[`word/media/${mediaData.fallback.fileName}`] = [toUint8Array(mediaData.fallback.data), { level: 0 }];
22096
+ if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [toUint8Array(mediaData.fallback.data), { level: 0 }];
21691
22097
  }
21692
22098
  for (const { data: buffer, name, fontKey } of file.FontTable.fontOptionsWithKey) {
21693
22099
  const [nameWithoutExtension] = name.split(".");
@@ -23028,4 +23434,4 @@ const findPatchKeys = (text) => {
23028
23434
  return (_text$match = text.match(/(?<=\{\{).+?(?=\}\})/gs)) !== null && _text$match !== void 0 ? _text$match : [];
23029
23435
  };
23030
23436
  //#endregion
23031
- export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };
23437
+ export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, ThemeColor, ThemeFont, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };