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/LICENSE +1 -1
- package/README.md +20 -22
- package/dist/index.cjs +439 -30
- package/dist/index.d.cts +247 -71
- package/dist/index.d.mts +247 -71
- package/dist/index.iife.js +439 -30
- package/dist/index.mjs +436 -30
- package/dist/index.umd.js +439 -30
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -389,6 +389,9 @@ var Attributes = class extends XmlAttributeComponent {
|
|
|
389
389
|
rsidSect: "w:rsidSect",
|
|
390
390
|
space: "w:space",
|
|
391
391
|
sz: "w:sz",
|
|
392
|
+
themeColor: "w:themeColor",
|
|
393
|
+
themeShade: "w:themeShade",
|
|
394
|
+
themeTint: "w:themeTint",
|
|
392
395
|
top: "w:top",
|
|
393
396
|
type: "w:type",
|
|
394
397
|
val: "w:val",
|
|
@@ -915,6 +918,49 @@ const pointMeasureValue = unsignedDecimalNumber;
|
|
|
915
918
|
* ```
|
|
916
919
|
*/
|
|
917
920
|
const dateTimeValue = (val) => val.toISOString();
|
|
921
|
+
/**
|
|
922
|
+
* Theme color values used throughout OOXML for referencing document theme colors.
|
|
923
|
+
*
|
|
924
|
+
* Reference: ST_ThemeColor in OOXML specification
|
|
925
|
+
*
|
|
926
|
+
* @publicApi
|
|
927
|
+
*/
|
|
928
|
+
const ThemeColor = {
|
|
929
|
+
DARK1: "dark1",
|
|
930
|
+
LIGHT1: "light1",
|
|
931
|
+
DARK2: "dark2",
|
|
932
|
+
LIGHT2: "light2",
|
|
933
|
+
ACCENT1: "accent1",
|
|
934
|
+
ACCENT2: "accent2",
|
|
935
|
+
ACCENT3: "accent3",
|
|
936
|
+
ACCENT4: "accent4",
|
|
937
|
+
ACCENT5: "accent5",
|
|
938
|
+
ACCENT6: "accent6",
|
|
939
|
+
HYPERLINK: "hyperlink",
|
|
940
|
+
FOLLOWED_HYPERLINK: "followedHyperlink",
|
|
941
|
+
NONE: "none",
|
|
942
|
+
BACKGROUND1: "background1",
|
|
943
|
+
TEXT1: "text1",
|
|
944
|
+
BACKGROUND2: "background2",
|
|
945
|
+
TEXT2: "text2"
|
|
946
|
+
};
|
|
947
|
+
/**
|
|
948
|
+
* Theme font values used for referencing document theme fonts.
|
|
949
|
+
*
|
|
950
|
+
* Reference: ST_Theme in OOXML specification
|
|
951
|
+
*
|
|
952
|
+
* @publicApi
|
|
953
|
+
*/
|
|
954
|
+
const ThemeFont = {
|
|
955
|
+
MAJOR_EAST_ASIA: "majorEastAsia",
|
|
956
|
+
MAJOR_BIDI: "majorBidi",
|
|
957
|
+
MAJOR_ASCII: "majorAscii",
|
|
958
|
+
MAJOR_H_ANSI: "majorHAnsi",
|
|
959
|
+
MINOR_EAST_ASIA: "minorEastAsia",
|
|
960
|
+
MINOR_BIDI: "minorBidi",
|
|
961
|
+
MINOR_ASCII: "minorAscii",
|
|
962
|
+
MINOR_H_ANSI: "minorHAnsi"
|
|
963
|
+
};
|
|
918
964
|
//#endregion
|
|
919
965
|
//#region src/file/xml-components/simple-elements.ts
|
|
920
966
|
/**
|
|
@@ -1327,12 +1373,20 @@ const createAlignment = (type) => new BuilderElement({
|
|
|
1327
1373
|
* });
|
|
1328
1374
|
* ```
|
|
1329
1375
|
*/
|
|
1330
|
-
const createBorderElement = (elementName, { color, size, space, style }) => new BuilderElement({
|
|
1376
|
+
const createBorderElement = (elementName, { color, size, space, style, themeColor, themeTint, themeShade, shadow, frame }) => new BuilderElement({
|
|
1331
1377
|
attributes: {
|
|
1332
1378
|
color: {
|
|
1333
1379
|
key: "w:color",
|
|
1334
1380
|
value: color === void 0 ? void 0 : hexColorValue(color)
|
|
1335
1381
|
},
|
|
1382
|
+
frame: {
|
|
1383
|
+
key: "w:frame",
|
|
1384
|
+
value: frame
|
|
1385
|
+
},
|
|
1386
|
+
shadow: {
|
|
1387
|
+
key: "w:shadow",
|
|
1388
|
+
value: shadow
|
|
1389
|
+
},
|
|
1336
1390
|
size: {
|
|
1337
1391
|
key: "w:sz",
|
|
1338
1392
|
value: size === void 0 ? void 0 : eighthPointMeasureValue(size)
|
|
@@ -1344,6 +1398,18 @@ const createBorderElement = (elementName, { color, size, space, style }) => new
|
|
|
1344
1398
|
style: {
|
|
1345
1399
|
key: "w:val",
|
|
1346
1400
|
value: style
|
|
1401
|
+
},
|
|
1402
|
+
themeColor: {
|
|
1403
|
+
key: "w:themeColor",
|
|
1404
|
+
value: themeColor
|
|
1405
|
+
},
|
|
1406
|
+
themeShade: {
|
|
1407
|
+
key: "w:themeShade",
|
|
1408
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
1409
|
+
},
|
|
1410
|
+
themeTint: {
|
|
1411
|
+
key: "w:themeTint",
|
|
1412
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
1347
1413
|
}
|
|
1348
1414
|
},
|
|
1349
1415
|
name: elementName
|
|
@@ -1547,20 +1613,32 @@ var ThematicBreak = class extends XmlComponent {
|
|
|
1547
1613
|
* </xsd:complexType>
|
|
1548
1614
|
* ```
|
|
1549
1615
|
*/
|
|
1550
|
-
const createIndent = ({ start, end, left, right, hanging, firstLine }) => new BuilderElement({
|
|
1616
|
+
const createIndent = ({ start, startChars, end, endChars, left, right, hanging, hangingChars, firstLine, firstLineChars }) => new BuilderElement({
|
|
1551
1617
|
attributes: {
|
|
1552
1618
|
end: {
|
|
1553
1619
|
key: "w:end",
|
|
1554
1620
|
value: end === void 0 ? void 0 : signedTwipsMeasureValue(end)
|
|
1555
1621
|
},
|
|
1622
|
+
endChars: {
|
|
1623
|
+
key: "w:endChars",
|
|
1624
|
+
value: endChars === void 0 ? void 0 : decimalNumber(endChars)
|
|
1625
|
+
},
|
|
1556
1626
|
firstLine: {
|
|
1557
1627
|
key: "w:firstLine",
|
|
1558
1628
|
value: firstLine === void 0 ? void 0 : twipsMeasureValue(firstLine)
|
|
1559
1629
|
},
|
|
1630
|
+
firstLineChars: {
|
|
1631
|
+
key: "w:firstLineChars",
|
|
1632
|
+
value: firstLineChars === void 0 ? void 0 : decimalNumber(firstLineChars)
|
|
1633
|
+
},
|
|
1560
1634
|
hanging: {
|
|
1561
1635
|
key: "w:hanging",
|
|
1562
1636
|
value: hanging === void 0 ? void 0 : twipsMeasureValue(hanging)
|
|
1563
1637
|
},
|
|
1638
|
+
hangingChars: {
|
|
1639
|
+
key: "w:hangingChars",
|
|
1640
|
+
value: hangingChars === void 0 ? void 0 : decimalNumber(hangingChars)
|
|
1641
|
+
},
|
|
1564
1642
|
left: {
|
|
1565
1643
|
key: "w:left",
|
|
1566
1644
|
value: left === void 0 ? void 0 : signedTwipsMeasureValue(left)
|
|
@@ -1572,6 +1650,10 @@ const createIndent = ({ start, end, left, right, hanging, firstLine }) => new Bu
|
|
|
1572
1650
|
start: {
|
|
1573
1651
|
key: "w:start",
|
|
1574
1652
|
value: start === void 0 ? void 0 : signedTwipsMeasureValue(start)
|
|
1653
|
+
},
|
|
1654
|
+
startChars: {
|
|
1655
|
+
key: "w:startChars",
|
|
1656
|
+
value: startChars === void 0 ? void 0 : decimalNumber(startChars)
|
|
1575
1657
|
}
|
|
1576
1658
|
},
|
|
1577
1659
|
name: "w:ind"
|
|
@@ -2022,7 +2104,7 @@ var CurrentSection = class extends XmlComponent {
|
|
|
2022
2104
|
*
|
|
2023
2105
|
* Reference: http://officeopenxml.com/WPshading.php
|
|
2024
2106
|
*/
|
|
2025
|
-
const createShading = ({ fill, color, type }) => new BuilderElement({
|
|
2107
|
+
const createShading = ({ fill, color, type, themeColor, themeTint, themeShade, themeFill, themeFillTint, themeFillShade }) => new BuilderElement({
|
|
2026
2108
|
attributes: {
|
|
2027
2109
|
color: {
|
|
2028
2110
|
key: "w:color",
|
|
@@ -2032,6 +2114,30 @@ const createShading = ({ fill, color, type }) => new BuilderElement({
|
|
|
2032
2114
|
key: "w:fill",
|
|
2033
2115
|
value: fill === void 0 ? void 0 : hexColorValue(fill)
|
|
2034
2116
|
},
|
|
2117
|
+
themeColor: {
|
|
2118
|
+
key: "w:themeColor",
|
|
2119
|
+
value: themeColor
|
|
2120
|
+
},
|
|
2121
|
+
themeFill: {
|
|
2122
|
+
key: "w:themeFill",
|
|
2123
|
+
value: themeFill
|
|
2124
|
+
},
|
|
2125
|
+
themeFillShade: {
|
|
2126
|
+
key: "w:themeFillShade",
|
|
2127
|
+
value: themeFillShade === void 0 ? void 0 : uCharHexNumber(themeFillShade)
|
|
2128
|
+
},
|
|
2129
|
+
themeFillTint: {
|
|
2130
|
+
key: "w:themeFillTint",
|
|
2131
|
+
value: themeFillTint === void 0 ? void 0 : uCharHexNumber(themeFillTint)
|
|
2132
|
+
},
|
|
2133
|
+
themeShade: {
|
|
2134
|
+
key: "w:themeShade",
|
|
2135
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
2136
|
+
},
|
|
2137
|
+
themeTint: {
|
|
2138
|
+
key: "w:themeTint",
|
|
2139
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
2140
|
+
},
|
|
2035
2141
|
type: {
|
|
2036
2142
|
key: "w:val",
|
|
2037
2143
|
value: type
|
|
@@ -2178,6 +2284,57 @@ var InsertionTrackChange = class extends XmlComponent {
|
|
|
2178
2284
|
}
|
|
2179
2285
|
};
|
|
2180
2286
|
//#endregion
|
|
2287
|
+
//#region src/file/paragraph/run/east-asian-layout.ts
|
|
2288
|
+
/**
|
|
2289
|
+
* East Asian layout module for WordprocessingML run properties.
|
|
2290
|
+
*
|
|
2291
|
+
* Specifies East Asian typography settings for a run, including
|
|
2292
|
+
* character combination, vertical text, and compression.
|
|
2293
|
+
*
|
|
2294
|
+
* Reference: ISO/IEC 29500-4, CT_EastAsianLayout
|
|
2295
|
+
*
|
|
2296
|
+
* @module
|
|
2297
|
+
*/
|
|
2298
|
+
/**
|
|
2299
|
+
* Creates an East Asian layout element (w:eastAsianLayout) for a run.
|
|
2300
|
+
*
|
|
2301
|
+
* ## XSD Schema
|
|
2302
|
+
* ```xml
|
|
2303
|
+
* <xsd:complexType name="CT_EastAsianLayout">
|
|
2304
|
+
* <xsd:attribute name="id" type="ST_DecimalNumber" use="optional"/>
|
|
2305
|
+
* <xsd:attribute name="combine" type="s:ST_OnOff" use="optional"/>
|
|
2306
|
+
* <xsd:attribute name="combineBrackets" type="ST_CombineBrackets" use="optional"/>
|
|
2307
|
+
* <xsd:attribute name="vert" type="s:ST_OnOff" use="optional"/>
|
|
2308
|
+
* <xsd:attribute name="vertCompress" type="s:ST_OnOff" use="optional"/>
|
|
2309
|
+
* </xsd:complexType>
|
|
2310
|
+
* ```
|
|
2311
|
+
*/
|
|
2312
|
+
const createEastAsianLayout = ({ id, combine, combineBrackets, vert, vertCompress }) => new BuilderElement({
|
|
2313
|
+
attributes: {
|
|
2314
|
+
combine: {
|
|
2315
|
+
key: "w:combine",
|
|
2316
|
+
value: combine
|
|
2317
|
+
},
|
|
2318
|
+
combineBrackets: {
|
|
2319
|
+
key: "w:combineBrackets",
|
|
2320
|
+
value: combineBrackets
|
|
2321
|
+
},
|
|
2322
|
+
id: {
|
|
2323
|
+
key: "w:id",
|
|
2324
|
+
value: id === void 0 ? void 0 : decimalNumber(id)
|
|
2325
|
+
},
|
|
2326
|
+
vert: {
|
|
2327
|
+
key: "w:vert",
|
|
2328
|
+
value: vert
|
|
2329
|
+
},
|
|
2330
|
+
vertCompress: {
|
|
2331
|
+
key: "w:vertCompress",
|
|
2332
|
+
value: vertCompress
|
|
2333
|
+
}
|
|
2334
|
+
},
|
|
2335
|
+
name: "w:eastAsianLayout"
|
|
2336
|
+
});
|
|
2337
|
+
//#endregion
|
|
2181
2338
|
//#region src/file/paragraph/run/emphasis-mark.ts
|
|
2182
2339
|
/**
|
|
2183
2340
|
* Emphasis mark module for WordprocessingML run properties.
|
|
@@ -2210,7 +2367,13 @@ var InsertionTrackChange = class extends XmlComponent {
|
|
|
2210
2367
|
*
|
|
2211
2368
|
* @publicApi
|
|
2212
2369
|
*/
|
|
2213
|
-
const EmphasisMarkType = {
|
|
2370
|
+
const EmphasisMarkType = {
|
|
2371
|
+
NONE: "none",
|
|
2372
|
+
COMMA: "comma",
|
|
2373
|
+
CIRCLE: "circle",
|
|
2374
|
+
DOT: "dot",
|
|
2375
|
+
UNDER_DOT: "underDot"
|
|
2376
|
+
};
|
|
2214
2377
|
/**
|
|
2215
2378
|
* Creates an emphasis mark element for a WordprocessingML document.
|
|
2216
2379
|
*
|
|
@@ -2301,16 +2464,27 @@ var CharacterSpacing = class extends XmlComponent {
|
|
|
2301
2464
|
*
|
|
2302
2465
|
* @example
|
|
2303
2466
|
* ```typescript
|
|
2304
|
-
* new Color("FF0000"); // Red text
|
|
2467
|
+
* new Color("FF0000"); // Red text (backward compatible)
|
|
2305
2468
|
* new Color("auto"); // Automatic color
|
|
2469
|
+
* new Color({ themeColor: ThemeColor.ACCENT1, themeTint: "99" }); // Theme color with tint
|
|
2306
2470
|
* ```
|
|
2307
2471
|
*
|
|
2308
2472
|
* @internal
|
|
2309
2473
|
*/
|
|
2310
2474
|
var Color = class extends XmlComponent {
|
|
2311
|
-
constructor(
|
|
2475
|
+
constructor(colorOrOptions) {
|
|
2312
2476
|
super("w:color");
|
|
2313
|
-
|
|
2477
|
+
if (typeof colorOrOptions === "string") {
|
|
2478
|
+
this.root.push(new Attributes({ val: hexColorValue(colorOrOptions) }));
|
|
2479
|
+
return;
|
|
2480
|
+
}
|
|
2481
|
+
const opts = colorOrOptions;
|
|
2482
|
+
this.root.push(new Attributes({
|
|
2483
|
+
val: opts.val === void 0 ? void 0 : hexColorValue(opts.val),
|
|
2484
|
+
themeColor: opts.themeColor,
|
|
2485
|
+
themeTint: opts.themeTint === void 0 ? void 0 : uCharHexNumber(opts.themeTint),
|
|
2486
|
+
themeShade: opts.themeShade === void 0 ? void 0 : uCharHexNumber(opts.themeShade)
|
|
2487
|
+
}));
|
|
2314
2488
|
}
|
|
2315
2489
|
};
|
|
2316
2490
|
/**
|
|
@@ -2509,18 +2683,34 @@ const createRunFonts = (nameOrAttrs, hint) => {
|
|
|
2509
2683
|
key: "w:ascii",
|
|
2510
2684
|
value: attrs.ascii
|
|
2511
2685
|
},
|
|
2686
|
+
asciiTheme: {
|
|
2687
|
+
key: "w:asciiTheme",
|
|
2688
|
+
value: attrs.asciiTheme
|
|
2689
|
+
},
|
|
2512
2690
|
cs: {
|
|
2513
2691
|
key: "w:cs",
|
|
2514
2692
|
value: attrs.cs
|
|
2515
2693
|
},
|
|
2694
|
+
cstheme: {
|
|
2695
|
+
key: "w:cstheme",
|
|
2696
|
+
value: attrs.cstheme
|
|
2697
|
+
},
|
|
2516
2698
|
eastAsia: {
|
|
2517
2699
|
key: "w:eastAsia",
|
|
2518
2700
|
value: attrs.eastAsia
|
|
2519
2701
|
},
|
|
2702
|
+
eastAsiaTheme: {
|
|
2703
|
+
key: "w:eastAsiaTheme",
|
|
2704
|
+
value: attrs.eastAsiaTheme
|
|
2705
|
+
},
|
|
2520
2706
|
hAnsi: {
|
|
2521
2707
|
key: "w:hAnsi",
|
|
2522
2708
|
value: attrs.hAnsi
|
|
2523
2709
|
},
|
|
2710
|
+
hAnsiTheme: {
|
|
2711
|
+
key: "w:hAnsiTheme",
|
|
2712
|
+
value: attrs.hAnsiTheme
|
|
2713
|
+
},
|
|
2524
2714
|
hint: {
|
|
2525
2715
|
key: "w:hint",
|
|
2526
2716
|
value: attrs.hint
|
|
@@ -2677,12 +2867,24 @@ const UnderlineType = {
|
|
|
2677
2867
|
* createUnderline(UnderlineType.WAVE, "FF0000");
|
|
2678
2868
|
* ```
|
|
2679
2869
|
*/
|
|
2680
|
-
const createUnderline = (underlineType = UnderlineType.SINGLE, color) => new BuilderElement({
|
|
2870
|
+
const createUnderline = (underlineType = UnderlineType.SINGLE, color, themeColor, themeTint, themeShade) => new BuilderElement({
|
|
2681
2871
|
attributes: {
|
|
2682
2872
|
color: {
|
|
2683
2873
|
key: "w:color",
|
|
2684
2874
|
value: color === void 0 ? void 0 : hexColorValue(color)
|
|
2685
2875
|
},
|
|
2876
|
+
themeColor: {
|
|
2877
|
+
key: "w:themeColor",
|
|
2878
|
+
value: themeColor
|
|
2879
|
+
},
|
|
2880
|
+
themeShade: {
|
|
2881
|
+
key: "w:themeShade",
|
|
2882
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
2883
|
+
},
|
|
2884
|
+
themeTint: {
|
|
2885
|
+
key: "w:themeTint",
|
|
2886
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
2887
|
+
},
|
|
2686
2888
|
val: {
|
|
2687
2889
|
key: "w:val",
|
|
2688
2890
|
value: underlineType
|
|
@@ -2834,6 +3036,9 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
2834
3036
|
if (options.doubleStrike !== void 0) this.push(new OnOffElement("w:dstrike", options.doubleStrike));
|
|
2835
3037
|
if (options.emboss !== void 0) this.push(new OnOffElement("w:emboss", options.emboss));
|
|
2836
3038
|
if (options.imprint !== void 0) this.push(new OnOffElement("w:imprint", options.imprint));
|
|
3039
|
+
if (options.outline !== void 0) this.push(new OnOffElement("w:outline", options.outline));
|
|
3040
|
+
if (options.shadow !== void 0) this.push(new OnOffElement("w:shadow", options.shadow));
|
|
3041
|
+
if (options.webHidden !== void 0) this.push(new OnOffElement("w:webHidden", options.webHidden));
|
|
2837
3042
|
if (options.noProof !== void 0) this.push(new OnOffElement("w:noProof", options.noProof));
|
|
2838
3043
|
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
2839
3044
|
if (options.vanish) this.push(new OnOffElement("w:vanish", options.vanish));
|
|
@@ -2859,6 +3064,9 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
2859
3064
|
if (options.language) this.push(createLanguageComponent(options.language));
|
|
2860
3065
|
if (options.specVanish) this.push(new OnOffElement("w:specVanish", options.vanish));
|
|
2861
3066
|
if (options.math) this.push(new OnOffElement("w:oMath", options.math));
|
|
3067
|
+
if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
|
|
3068
|
+
if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
|
|
3069
|
+
if (options.eastAsianLayout) this.push(createEastAsianLayout(options.eastAsianLayout));
|
|
2862
3070
|
if (options.revision) this.push(new RunPropertiesChange(options.revision));
|
|
2863
3071
|
}
|
|
2864
3072
|
push(item) {
|
|
@@ -3294,18 +3502,6 @@ const generateUuidPart = (count) => (0, nanoid_non_secure.customAlphabet)("12345
|
|
|
3294
3502
|
* ```
|
|
3295
3503
|
*/
|
|
3296
3504
|
const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
|
|
3297
|
-
/**
|
|
3298
|
-
* Encode a string to UTF-8 bytes.
|
|
3299
|
-
*
|
|
3300
|
-
* This is used to pre-encode XML content before passing to fflate's zipSync,
|
|
3301
|
-
* which expects Uint8Array input for text content.
|
|
3302
|
-
*
|
|
3303
|
-
* The copy via `new Uint8Array()` ensures the returned array uses the
|
|
3304
|
-
* current module's Uint8Array constructor, avoiding cross-realm issues
|
|
3305
|
-
* in test environments (happy-dom) where TextEncoder returns a different
|
|
3306
|
-
* realm's Uint8Array.
|
|
3307
|
-
*/
|
|
3308
|
-
const encodeUtf8 = (str) => new Uint8Array(new TextEncoder().encode(str));
|
|
3309
3505
|
//#endregion
|
|
3310
3506
|
//#region src/file/drawing/floating/floating-position.ts
|
|
3311
3507
|
/**
|
|
@@ -6968,7 +7164,7 @@ const LineRuleType = {
|
|
|
6968
7164
|
* });
|
|
6969
7165
|
* ```
|
|
6970
7166
|
*/
|
|
6971
|
-
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing }) => new BuilderElement({
|
|
7167
|
+
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing, beforeLines, afterLines }) => new BuilderElement({
|
|
6972
7168
|
attributes: {
|
|
6973
7169
|
after: {
|
|
6974
7170
|
key: "w:after",
|
|
@@ -6978,6 +7174,10 @@ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, after
|
|
|
6978
7174
|
key: "w:afterAutospacing",
|
|
6979
7175
|
value: afterAutoSpacing
|
|
6980
7176
|
},
|
|
7177
|
+
afterLines: {
|
|
7178
|
+
key: "w:afterLines",
|
|
7179
|
+
value: afterLines === void 0 ? void 0 : decimalNumber(afterLines)
|
|
7180
|
+
},
|
|
6981
7181
|
before: {
|
|
6982
7182
|
key: "w:before",
|
|
6983
7183
|
value: before
|
|
@@ -6986,6 +7186,10 @@ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, after
|
|
|
6986
7186
|
key: "w:beforeAutospacing",
|
|
6987
7187
|
value: beforeAutoSpacing
|
|
6988
7188
|
},
|
|
7189
|
+
beforeLines: {
|
|
7190
|
+
key: "w:beforeLines",
|
|
7191
|
+
value: beforeLines === void 0 ? void 0 : decimalNumber(beforeLines)
|
|
7192
|
+
},
|
|
6989
7193
|
line: {
|
|
6990
7194
|
key: "w:line",
|
|
6991
7195
|
value: line
|
|
@@ -7096,6 +7300,7 @@ const TabStopType = {
|
|
|
7096
7300
|
*/
|
|
7097
7301
|
const LeaderType = {
|
|
7098
7302
|
DOT: "dot",
|
|
7303
|
+
HEAVY: "heavy",
|
|
7099
7304
|
HYPHEN: "hyphen",
|
|
7100
7305
|
MIDDLE_DOT: "middleDot",
|
|
7101
7306
|
NONE: "none",
|
|
@@ -8368,6 +8573,34 @@ const createFrameProperties = (options) => {
|
|
|
8368
8573
|
* @module
|
|
8369
8574
|
*/
|
|
8370
8575
|
/**
|
|
8576
|
+
* Vertical text alignment types for paragraphs.
|
|
8577
|
+
*
|
|
8578
|
+
* Specifies the vertical alignment of text within the paragraph.
|
|
8579
|
+
*
|
|
8580
|
+
* @publicApi
|
|
8581
|
+
*/
|
|
8582
|
+
const TextAlignmentType = {
|
|
8583
|
+
TOP: "top",
|
|
8584
|
+
CENTER: "center",
|
|
8585
|
+
BASELINE: "baseline",
|
|
8586
|
+
BOTTOM: "bottom",
|
|
8587
|
+
AUTO: "auto"
|
|
8588
|
+
};
|
|
8589
|
+
/**
|
|
8590
|
+
* Textbox tight wrap types for paragraphs.
|
|
8591
|
+
*
|
|
8592
|
+
* Specifies how tightly text wraps around a textbox.
|
|
8593
|
+
*
|
|
8594
|
+
* @publicApi
|
|
8595
|
+
*/
|
|
8596
|
+
const TextboxTightWrapType = {
|
|
8597
|
+
NONE: "none",
|
|
8598
|
+
ALL_LINES: "allLines",
|
|
8599
|
+
FIRST_AND_LAST_LINE: "firstAndLastLine",
|
|
8600
|
+
FIRST_LINE_ONLY: "firstLineOnly",
|
|
8601
|
+
LAST_LINE_ONLY: "lastLineOnly"
|
|
8602
|
+
};
|
|
8603
|
+
/**
|
|
8371
8604
|
* Represents paragraph properties (pPr) in a WordprocessingML document.
|
|
8372
8605
|
*
|
|
8373
8606
|
* The paragraph properties element specifies all formatting applied to a paragraph,
|
|
@@ -8530,6 +8763,27 @@ var ParagraphProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
8530
8763
|
if (options.outlineLevel !== void 0) this.push(createOutlineLevel(options.outlineLevel));
|
|
8531
8764
|
if (options.suppressLineNumbers !== void 0) this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
|
|
8532
8765
|
if (options.autoSpaceEastAsianText !== void 0) this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
|
|
8766
|
+
if (options.suppressAutoHyphens !== void 0) this.push(new OnOffElement("w:suppressAutoHyphens", options.suppressAutoHyphens));
|
|
8767
|
+
if (options.adjustRightInd !== void 0) this.push(new OnOffElement("w:adjustRightInd", options.adjustRightInd));
|
|
8768
|
+
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
8769
|
+
if (options.mirrorIndents !== void 0) this.push(new OnOffElement("w:mirrorIndents", options.mirrorIndents));
|
|
8770
|
+
if (options.kinsoku !== void 0) this.push(new OnOffElement("w:kinsoku", options.kinsoku));
|
|
8771
|
+
if (options.topLinePunct !== void 0) this.push(new OnOffElement("w:topLinePunct", options.topLinePunct));
|
|
8772
|
+
if (options.autoSpaceDE !== void 0) this.push(new OnOffElement("w:autoSpaceDE", options.autoSpaceDE));
|
|
8773
|
+
if (options.textAlignment !== void 0) this.push(new BuilderElement({
|
|
8774
|
+
attributes: { val: {
|
|
8775
|
+
key: "w:val",
|
|
8776
|
+
value: options.textAlignment
|
|
8777
|
+
} },
|
|
8778
|
+
name: "w:textAlignment"
|
|
8779
|
+
}));
|
|
8780
|
+
if (options.textboxTightWrap !== void 0) this.push(new BuilderElement({
|
|
8781
|
+
attributes: { val: {
|
|
8782
|
+
key: "w:val",
|
|
8783
|
+
value: options.textboxTightWrap
|
|
8784
|
+
} },
|
|
8785
|
+
name: "w:textboxTightWrap"
|
|
8786
|
+
}));
|
|
8533
8787
|
if (options.run) this.push(new ParagraphRunProperties(options.run));
|
|
8534
8788
|
if (options.revision) this.push(new ParagraphPropertiesChange(options.revision));
|
|
8535
8789
|
}
|
|
@@ -12899,6 +13153,137 @@ const createDocumentGrid = ({ type, linePitch, charSpace }) => new BuilderElemen
|
|
|
12899
13153
|
name: "w:docGrid"
|
|
12900
13154
|
});
|
|
12901
13155
|
//#endregion
|
|
13156
|
+
//#region src/file/document/body/section-properties/properties/footnote-endnote-properties.ts
|
|
13157
|
+
/**
|
|
13158
|
+
* Footnote and endnote properties module for WordprocessingML section properties.
|
|
13159
|
+
*
|
|
13160
|
+
* Specifies footnote/endnote placement and numbering format within a section.
|
|
13161
|
+
*
|
|
13162
|
+
* Reference: ISO/IEC 29500-4, CT_FtnProps / CT_EdnProps
|
|
13163
|
+
*
|
|
13164
|
+
* @module
|
|
13165
|
+
*/
|
|
13166
|
+
/**
|
|
13167
|
+
* Creates footnote properties element (w:footnotePr) for a section.
|
|
13168
|
+
*
|
|
13169
|
+
* ## XSD Schema
|
|
13170
|
+
* ```xml
|
|
13171
|
+
* <xsd:complexType name="CT_FtnProps">
|
|
13172
|
+
* <xsd:sequence>
|
|
13173
|
+
* <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
|
|
13174
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
13175
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
13176
|
+
* </xsd:sequence>
|
|
13177
|
+
* </xsd:complexType>
|
|
13178
|
+
* ```
|
|
13179
|
+
*/
|
|
13180
|
+
const createFootnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
13181
|
+
const container = new FootnoteProperties();
|
|
13182
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
13183
|
+
attributes: { val: {
|
|
13184
|
+
key: "w:val",
|
|
13185
|
+
value: pos
|
|
13186
|
+
} },
|
|
13187
|
+
name: "w:pos"
|
|
13188
|
+
}));
|
|
13189
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
13190
|
+
attributes: {
|
|
13191
|
+
format: {
|
|
13192
|
+
key: "w:format",
|
|
13193
|
+
value: format
|
|
13194
|
+
},
|
|
13195
|
+
val: {
|
|
13196
|
+
key: "w:fmt",
|
|
13197
|
+
value: formatType
|
|
13198
|
+
}
|
|
13199
|
+
},
|
|
13200
|
+
name: "w:numFmt"
|
|
13201
|
+
}));
|
|
13202
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
13203
|
+
attributes: { val: {
|
|
13204
|
+
key: "w:val",
|
|
13205
|
+
value: decimalNumber(numStart)
|
|
13206
|
+
} },
|
|
13207
|
+
name: "w:numStart"
|
|
13208
|
+
}));
|
|
13209
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
13210
|
+
attributes: { val: {
|
|
13211
|
+
key: "w:val",
|
|
13212
|
+
value: numRestart
|
|
13213
|
+
} },
|
|
13214
|
+
name: "w:numRestart"
|
|
13215
|
+
}));
|
|
13216
|
+
return container;
|
|
13217
|
+
};
|
|
13218
|
+
/**
|
|
13219
|
+
* Footnote properties container element.
|
|
13220
|
+
*/
|
|
13221
|
+
var FootnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
13222
|
+
constructor() {
|
|
13223
|
+
super("w:footnotePr", true);
|
|
13224
|
+
}
|
|
13225
|
+
};
|
|
13226
|
+
/**
|
|
13227
|
+
* Creates endnote properties element (w:endnotePr) for a section.
|
|
13228
|
+
*
|
|
13229
|
+
* ## XSD Schema
|
|
13230
|
+
* ```xml
|
|
13231
|
+
* <xsd:complexType name="CT_EdnProps">
|
|
13232
|
+
* <xsd:sequence>
|
|
13233
|
+
* <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
|
|
13234
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
13235
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
13236
|
+
* </xsd:sequence>
|
|
13237
|
+
* </xsd:complexType>
|
|
13238
|
+
* ```
|
|
13239
|
+
*/
|
|
13240
|
+
const createEndnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
13241
|
+
const container = new EndnoteProperties();
|
|
13242
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
13243
|
+
attributes: { val: {
|
|
13244
|
+
key: "w:val",
|
|
13245
|
+
value: pos
|
|
13246
|
+
} },
|
|
13247
|
+
name: "w:pos"
|
|
13248
|
+
}));
|
|
13249
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
13250
|
+
attributes: {
|
|
13251
|
+
format: {
|
|
13252
|
+
key: "w:format",
|
|
13253
|
+
value: format
|
|
13254
|
+
},
|
|
13255
|
+
val: {
|
|
13256
|
+
key: "w:fmt",
|
|
13257
|
+
value: formatType
|
|
13258
|
+
}
|
|
13259
|
+
},
|
|
13260
|
+
name: "w:numFmt"
|
|
13261
|
+
}));
|
|
13262
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
13263
|
+
attributes: { val: {
|
|
13264
|
+
key: "w:val",
|
|
13265
|
+
value: decimalNumber(numStart)
|
|
13266
|
+
} },
|
|
13267
|
+
name: "w:numStart"
|
|
13268
|
+
}));
|
|
13269
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
13270
|
+
attributes: { val: {
|
|
13271
|
+
key: "w:val",
|
|
13272
|
+
value: numRestart
|
|
13273
|
+
} },
|
|
13274
|
+
name: "w:numRestart"
|
|
13275
|
+
}));
|
|
13276
|
+
return container;
|
|
13277
|
+
};
|
|
13278
|
+
/**
|
|
13279
|
+
* Endnote properties container element.
|
|
13280
|
+
*/
|
|
13281
|
+
var EndnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
13282
|
+
constructor() {
|
|
13283
|
+
super("w:endnotePr", true);
|
|
13284
|
+
}
|
|
13285
|
+
};
|
|
13286
|
+
//#endregion
|
|
12902
13287
|
//#region src/file/document/body/section-properties/properties/header-footer-reference.ts
|
|
12903
13288
|
/**
|
|
12904
13289
|
* 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.
|
|
@@ -13261,8 +13646,12 @@ const PageNumberSeparator = {
|
|
|
13261
13646
|
* });
|
|
13262
13647
|
* ```
|
|
13263
13648
|
*/
|
|
13264
|
-
const createPageNumberType = ({ start, formatType, separator }) => new BuilderElement({
|
|
13649
|
+
const createPageNumberType = ({ start, formatType, separator, chapStyle }) => new BuilderElement({
|
|
13265
13650
|
attributes: {
|
|
13651
|
+
chapStyle: {
|
|
13652
|
+
key: "w:chapStyle",
|
|
13653
|
+
value: chapStyle === void 0 ? void 0 : decimalNumber(chapStyle)
|
|
13654
|
+
},
|
|
13266
13655
|
formatType: {
|
|
13267
13656
|
key: "w:fmt",
|
|
13268
13657
|
value: formatType
|
|
@@ -13551,7 +13940,7 @@ const sectionPageSizeDefaults = {
|
|
|
13551
13940
|
* ```
|
|
13552
13941
|
*/
|
|
13553
13942
|
var SectionProperties = class extends XmlComponent {
|
|
13554
|
-
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 } = {}) {
|
|
13943
|
+
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 } = {}) {
|
|
13555
13944
|
super("w:sectPr");
|
|
13556
13945
|
this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
|
|
13557
13946
|
this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
|
|
@@ -13570,6 +13959,24 @@ var SectionProperties = class extends XmlComponent {
|
|
|
13570
13959
|
if (titlePage !== void 0) this.root.push(new OnOffElement("w:titlePg", titlePage));
|
|
13571
13960
|
if (textDirection) this.root.push(new PageTextDirection(textDirection));
|
|
13572
13961
|
if (revision) this.root.push(new SectionPropertiesChange(revision));
|
|
13962
|
+
if (noEndnote !== void 0) this.root.push(new OnOffElement("w:noEndnote", noEndnote));
|
|
13963
|
+
if (bidi !== void 0) this.root.push(new OnOffElement("w:bidi", bidi));
|
|
13964
|
+
if (rtlGutter !== void 0) this.root.push(new OnOffElement("w:rtlGutter", rtlGutter));
|
|
13965
|
+
if (paperSrc) this.root.push(new BuilderElement({
|
|
13966
|
+
attributes: {
|
|
13967
|
+
first: {
|
|
13968
|
+
key: "w:first",
|
|
13969
|
+
value: paperSrc.first === void 0 ? void 0 : decimalNumber(paperSrc.first)
|
|
13970
|
+
},
|
|
13971
|
+
other: {
|
|
13972
|
+
key: "w:other",
|
|
13973
|
+
value: paperSrc.other === void 0 ? void 0 : decimalNumber(paperSrc.other)
|
|
13974
|
+
}
|
|
13975
|
+
},
|
|
13976
|
+
name: "w:paperSrc"
|
|
13977
|
+
}));
|
|
13978
|
+
if (footnotePr) this.root.push(createFootnoteProperties(footnotePr));
|
|
13979
|
+
if (endnotePr) this.root.push(createEndnoteProperties(endnotePr));
|
|
13573
13980
|
this.root.push(createDocumentGrid({
|
|
13574
13981
|
charSpace,
|
|
13575
13982
|
linePitch,
|
|
@@ -21706,13 +22113,12 @@ var Compiler = class {
|
|
|
21706
22113
|
const footerFormattedViews = /* @__PURE__ */ new Map();
|
|
21707
22114
|
const xmlifiedFileMapping = this.xmlifyFile(file, headerFormattedViews, footerFormattedViews, prettifyXml);
|
|
21708
22115
|
const map = new Map(Object.entries(xmlifiedFileMapping));
|
|
21709
|
-
for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] =
|
|
21710
|
-
else files[obj.path] =
|
|
21711
|
-
for (const subFile of overrides) files[subFile.path] =
|
|
21712
|
-
for (const mediaData of file.Media.Array)
|
|
21713
|
-
else {
|
|
22116
|
+
for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
22117
|
+
else files[obj.path] = (0, undio.textToUint8Array)(obj.data);
|
|
22118
|
+
for (const subFile of overrides) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
22119
|
+
for (const mediaData of file.Media.Array) {
|
|
21714
22120
|
files[`word/media/${mediaData.fileName}`] = [(0, undio.toUint8Array)(mediaData.data), { level: 0 }];
|
|
21715
|
-
files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
|
|
22121
|
+
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
|
|
21716
22122
|
}
|
|
21717
22123
|
for (const { data: buffer, name, fontKey } of file.FontTable.fontOptionsWithKey) {
|
|
21718
22124
|
const [nameWithoutExtension] = name.split(".");
|
|
@@ -23248,13 +23654,17 @@ exports.TableProperties = TableProperties;
|
|
|
23248
23654
|
exports.TableRow = TableRow;
|
|
23249
23655
|
exports.TableRowProperties = TableRowProperties;
|
|
23250
23656
|
exports.TableRowPropertiesChange = TableRowPropertiesChange;
|
|
23657
|
+
exports.TextAlignmentType = TextAlignmentType;
|
|
23251
23658
|
exports.TextDirection = TextDirection;
|
|
23252
23659
|
exports.TextEffect = TextEffect;
|
|
23253
23660
|
exports.TextRun = TextRun;
|
|
23254
23661
|
exports.TextWrappingSide = TextWrappingSide;
|
|
23255
23662
|
exports.TextWrappingType = TextWrappingType;
|
|
23256
23663
|
exports.Textbox = Textbox;
|
|
23664
|
+
exports.TextboxTightWrapType = TextboxTightWrapType;
|
|
23257
23665
|
exports.ThematicBreak = ThematicBreak;
|
|
23666
|
+
exports.ThemeColor = ThemeColor;
|
|
23667
|
+
exports.ThemeFont = ThemeFont;
|
|
23258
23668
|
exports.UnderlineType = UnderlineType;
|
|
23259
23669
|
exports.VerticalAlign = VerticalAlign;
|
|
23260
23670
|
exports.VerticalAlignSection = VerticalAlignSection;
|
|
@@ -23333,7 +23743,6 @@ exports.dateTimeValue = dateTimeValue;
|
|
|
23333
23743
|
exports.decimalNumber = decimalNumber;
|
|
23334
23744
|
exports.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen;
|
|
23335
23745
|
exports.eighthPointMeasureValue = eighthPointMeasureValue;
|
|
23336
|
-
exports.encodeUtf8 = encodeUtf8;
|
|
23337
23746
|
exports.hashedId = hashedId;
|
|
23338
23747
|
exports.hexColorValue = hexColorValue;
|
|
23339
23748
|
exports.hpsMeasureValue = hpsMeasureValue;
|