docx-plus 0.0.4 → 0.0.5
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 +11 -16
- package/dist/index.cjs +181 -28
- package/dist/index.d.cts +98 -8
- package/dist/index.d.mts +98 -8
- package/dist/index.iife.js +181 -28
- package/dist/index.mjs +180 -28
- package/dist/index.umd.js +181 -28
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="./logo/logo-animate.svg" width="100%" height="300" alt="docx-plus">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<p align="center">
|
|
6
|
-
Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.
|
|
7
|
-
</p>
|
|
8
|
-
|
|
9
|
-
---
|
|
1
|
+
# docx-plus
|
|
10
2
|
|
|
11
3
|
[![NPM version][npm-image]][npm-url]
|
|
12
4
|
[![Downloads per month][downloads-image]][downloads-url]
|
|
13
5
|
[![GitHub Action Workflow Status][github-actions-workflow-image]][github-actions-workflow-url]
|
|
14
|
-
[![Known Vulnerabilities][snky-image]][snky-url]
|
|
15
6
|
[![PRs Welcome][pr-image]][pr-url]
|
|
16
|
-
[codecov][codecov-image][codecov-url]
|
|
17
7
|
|
|
18
|
-
|
|
8
|
+
Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.
|
|
19
9
|
|
|
20
10
|
**docx-plus** is an enhanced fork of [docx](https://github.com/dolanmiu/docx) — a TypeScript/JavaScript library for generating and modifying Word documents (.docx) programmatically with a declarative API.
|
|
21
11
|
|
|
@@ -27,6 +17,15 @@
|
|
|
27
17
|
| Data conversion | Manual env detection (`Buffer.from` etc.) | **undio** (universal `toUint8Array`) |
|
|
28
18
|
| `Packer.toStream()` | Removed (pseudo-streaming) | **Restored** with real streaming ZIP |
|
|
29
19
|
| Test environment | jsdom | happy-dom |
|
|
20
|
+
| OOXML compliance | ECMA-376 (legacy) | **ISO/IEC 29500-4** (latest) |
|
|
21
|
+
| Theme support | Partial (missing `ThemeColor`/`ThemeFont`) | **Full** (`ThemeColor`, `ThemeFont` enums, theme attributes on `Color`, `Underline`, `Border`, `Shading`) |
|
|
22
|
+
| CT_Ind | Twips-only indent | **Character-based** (`startChars`, `endChars`, `hangingChars`, `firstLineChars`) |
|
|
23
|
+
| CT_Spacing | Missing `beforeLines`/`afterLines` | **Complete** (both twips & line-unit spacing) |
|
|
24
|
+
| CT_Border | Missing `shadow`/`frame`/theme attrs | **Complete** (`shadow`, `frame`, `themeColor`, `themeTint`, `themeShade`) |
|
|
25
|
+
| CT_Shd | Missing theme fill/color attrs | **Complete** (`themeColor`, `themeFill`, `themeTint`/`themeShade`) |
|
|
26
|
+
| EG_RPrBase | Missing `outline`/`shadow`/`webHidden`/`fitText`/`cs` | **Complete** (all spec-defined elements) |
|
|
27
|
+
| ST_Em | `dot` only | **Complete** (`none`, `comma`, `circle`, `dot`, `underDot`) |
|
|
28
|
+
| ST_TabTlc | Missing `heavy` | **Complete** (`none`, `dot`, `hyphen`, `middleDot`, `underscore`, `heavy`) |
|
|
30
29
|
|
|
31
30
|
## Installation
|
|
32
31
|
|
|
@@ -88,9 +87,5 @@ Contributions are welcome! Please feel free to submit pull requests.
|
|
|
88
87
|
[downloads-url]: https://npmjs.org/package/docx-plus
|
|
89
88
|
[github-actions-workflow-image]: https://github.com/DemoMacro/docx-plus/workflows/Default/badge.svg?branch=main
|
|
90
89
|
[github-actions-workflow-url]: https://github.com/DemoMacro/docx-plus/actions
|
|
91
|
-
[snky-image]: https://snyk.io/test/github/DemoMacro/docx-plus/badge.svg
|
|
92
|
-
[snky-url]: https://snyk.io/test/github/DemoMacro/docx-plus
|
|
93
90
|
[pr-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
|
|
94
91
|
[pr-url]: http://makeapullrequest.com
|
|
95
|
-
[codecov-image]: https://codecov.io/gh/DemoMacro/docx-plus/branch/main/graph/badge.svg
|
|
96
|
-
[codecov-url]: https://codecov.io/gh/DemoMacro/docx-plus
|
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
|
|
@@ -2210,7 +2316,13 @@ var InsertionTrackChange = class extends XmlComponent {
|
|
|
2210
2316
|
*
|
|
2211
2317
|
* @publicApi
|
|
2212
2318
|
*/
|
|
2213
|
-
const EmphasisMarkType = {
|
|
2319
|
+
const EmphasisMarkType = {
|
|
2320
|
+
NONE: "none",
|
|
2321
|
+
COMMA: "comma",
|
|
2322
|
+
CIRCLE: "circle",
|
|
2323
|
+
DOT: "dot",
|
|
2324
|
+
UNDER_DOT: "underDot"
|
|
2325
|
+
};
|
|
2214
2326
|
/**
|
|
2215
2327
|
* Creates an emphasis mark element for a WordprocessingML document.
|
|
2216
2328
|
*
|
|
@@ -2301,16 +2413,27 @@ var CharacterSpacing = class extends XmlComponent {
|
|
|
2301
2413
|
*
|
|
2302
2414
|
* @example
|
|
2303
2415
|
* ```typescript
|
|
2304
|
-
* new Color("FF0000"); // Red text
|
|
2416
|
+
* new Color("FF0000"); // Red text (backward compatible)
|
|
2305
2417
|
* new Color("auto"); // Automatic color
|
|
2418
|
+
* new Color({ themeColor: ThemeColor.ACCENT1, themeTint: "99" }); // Theme color with tint
|
|
2306
2419
|
* ```
|
|
2307
2420
|
*
|
|
2308
2421
|
* @internal
|
|
2309
2422
|
*/
|
|
2310
2423
|
var Color = class extends XmlComponent {
|
|
2311
|
-
constructor(
|
|
2424
|
+
constructor(colorOrOptions) {
|
|
2312
2425
|
super("w:color");
|
|
2313
|
-
|
|
2426
|
+
if (typeof colorOrOptions === "string") {
|
|
2427
|
+
this.root.push(new Attributes({ val: hexColorValue(colorOrOptions) }));
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2430
|
+
const opts = colorOrOptions;
|
|
2431
|
+
this.root.push(new Attributes({
|
|
2432
|
+
val: opts.val === void 0 ? void 0 : hexColorValue(opts.val),
|
|
2433
|
+
themeColor: opts.themeColor,
|
|
2434
|
+
themeTint: opts.themeTint === void 0 ? void 0 : uCharHexNumber(opts.themeTint),
|
|
2435
|
+
themeShade: opts.themeShade === void 0 ? void 0 : uCharHexNumber(opts.themeShade)
|
|
2436
|
+
}));
|
|
2314
2437
|
}
|
|
2315
2438
|
};
|
|
2316
2439
|
/**
|
|
@@ -2509,18 +2632,34 @@ const createRunFonts = (nameOrAttrs, hint) => {
|
|
|
2509
2632
|
key: "w:ascii",
|
|
2510
2633
|
value: attrs.ascii
|
|
2511
2634
|
},
|
|
2635
|
+
asciiTheme: {
|
|
2636
|
+
key: "w:asciiTheme",
|
|
2637
|
+
value: attrs.asciiTheme
|
|
2638
|
+
},
|
|
2512
2639
|
cs: {
|
|
2513
2640
|
key: "w:cs",
|
|
2514
2641
|
value: attrs.cs
|
|
2515
2642
|
},
|
|
2643
|
+
cstheme: {
|
|
2644
|
+
key: "w:cstheme",
|
|
2645
|
+
value: attrs.cstheme
|
|
2646
|
+
},
|
|
2516
2647
|
eastAsia: {
|
|
2517
2648
|
key: "w:eastAsia",
|
|
2518
2649
|
value: attrs.eastAsia
|
|
2519
2650
|
},
|
|
2651
|
+
eastAsiaTheme: {
|
|
2652
|
+
key: "w:eastAsiaTheme",
|
|
2653
|
+
value: attrs.eastAsiaTheme
|
|
2654
|
+
},
|
|
2520
2655
|
hAnsi: {
|
|
2521
2656
|
key: "w:hAnsi",
|
|
2522
2657
|
value: attrs.hAnsi
|
|
2523
2658
|
},
|
|
2659
|
+
hAnsiTheme: {
|
|
2660
|
+
key: "w:hAnsiTheme",
|
|
2661
|
+
value: attrs.hAnsiTheme
|
|
2662
|
+
},
|
|
2524
2663
|
hint: {
|
|
2525
2664
|
key: "w:hint",
|
|
2526
2665
|
value: attrs.hint
|
|
@@ -2677,12 +2816,24 @@ const UnderlineType = {
|
|
|
2677
2816
|
* createUnderline(UnderlineType.WAVE, "FF0000");
|
|
2678
2817
|
* ```
|
|
2679
2818
|
*/
|
|
2680
|
-
const createUnderline = (underlineType = UnderlineType.SINGLE, color) => new BuilderElement({
|
|
2819
|
+
const createUnderline = (underlineType = UnderlineType.SINGLE, color, themeColor, themeTint, themeShade) => new BuilderElement({
|
|
2681
2820
|
attributes: {
|
|
2682
2821
|
color: {
|
|
2683
2822
|
key: "w:color",
|
|
2684
2823
|
value: color === void 0 ? void 0 : hexColorValue(color)
|
|
2685
2824
|
},
|
|
2825
|
+
themeColor: {
|
|
2826
|
+
key: "w:themeColor",
|
|
2827
|
+
value: themeColor
|
|
2828
|
+
},
|
|
2829
|
+
themeShade: {
|
|
2830
|
+
key: "w:themeShade",
|
|
2831
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
2832
|
+
},
|
|
2833
|
+
themeTint: {
|
|
2834
|
+
key: "w:themeTint",
|
|
2835
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
2836
|
+
},
|
|
2686
2837
|
val: {
|
|
2687
2838
|
key: "w:val",
|
|
2688
2839
|
value: underlineType
|
|
@@ -2834,6 +2985,9 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
2834
2985
|
if (options.doubleStrike !== void 0) this.push(new OnOffElement("w:dstrike", options.doubleStrike));
|
|
2835
2986
|
if (options.emboss !== void 0) this.push(new OnOffElement("w:emboss", options.emboss));
|
|
2836
2987
|
if (options.imprint !== void 0) this.push(new OnOffElement("w:imprint", options.imprint));
|
|
2988
|
+
if (options.outline !== void 0) this.push(new OnOffElement("w:outline", options.outline));
|
|
2989
|
+
if (options.shadow !== void 0) this.push(new OnOffElement("w:shadow", options.shadow));
|
|
2990
|
+
if (options.webHidden !== void 0) this.push(new OnOffElement("w:webHidden", options.webHidden));
|
|
2837
2991
|
if (options.noProof !== void 0) this.push(new OnOffElement("w:noProof", options.noProof));
|
|
2838
2992
|
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
2839
2993
|
if (options.vanish) this.push(new OnOffElement("w:vanish", options.vanish));
|
|
@@ -2859,6 +3013,8 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
2859
3013
|
if (options.language) this.push(createLanguageComponent(options.language));
|
|
2860
3014
|
if (options.specVanish) this.push(new OnOffElement("w:specVanish", options.vanish));
|
|
2861
3015
|
if (options.math) this.push(new OnOffElement("w:oMath", options.math));
|
|
3016
|
+
if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
|
|
3017
|
+
if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
|
|
2862
3018
|
if (options.revision) this.push(new RunPropertiesChange(options.revision));
|
|
2863
3019
|
}
|
|
2864
3020
|
push(item) {
|
|
@@ -3294,18 +3450,6 @@ const generateUuidPart = (count) => (0, nanoid_non_secure.customAlphabet)("12345
|
|
|
3294
3450
|
* ```
|
|
3295
3451
|
*/
|
|
3296
3452
|
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
3453
|
//#endregion
|
|
3310
3454
|
//#region src/file/drawing/floating/floating-position.ts
|
|
3311
3455
|
/**
|
|
@@ -6968,7 +7112,7 @@ const LineRuleType = {
|
|
|
6968
7112
|
* });
|
|
6969
7113
|
* ```
|
|
6970
7114
|
*/
|
|
6971
|
-
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing }) => new BuilderElement({
|
|
7115
|
+
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing, beforeLines, afterLines }) => new BuilderElement({
|
|
6972
7116
|
attributes: {
|
|
6973
7117
|
after: {
|
|
6974
7118
|
key: "w:after",
|
|
@@ -6978,6 +7122,10 @@ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, after
|
|
|
6978
7122
|
key: "w:afterAutospacing",
|
|
6979
7123
|
value: afterAutoSpacing
|
|
6980
7124
|
},
|
|
7125
|
+
afterLines: {
|
|
7126
|
+
key: "w:afterLines",
|
|
7127
|
+
value: afterLines === void 0 ? void 0 : decimalNumber(afterLines)
|
|
7128
|
+
},
|
|
6981
7129
|
before: {
|
|
6982
7130
|
key: "w:before",
|
|
6983
7131
|
value: before
|
|
@@ -6986,6 +7134,10 @@ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, after
|
|
|
6986
7134
|
key: "w:beforeAutospacing",
|
|
6987
7135
|
value: beforeAutoSpacing
|
|
6988
7136
|
},
|
|
7137
|
+
beforeLines: {
|
|
7138
|
+
key: "w:beforeLines",
|
|
7139
|
+
value: beforeLines === void 0 ? void 0 : decimalNumber(beforeLines)
|
|
7140
|
+
},
|
|
6989
7141
|
line: {
|
|
6990
7142
|
key: "w:line",
|
|
6991
7143
|
value: line
|
|
@@ -7096,6 +7248,7 @@ const TabStopType = {
|
|
|
7096
7248
|
*/
|
|
7097
7249
|
const LeaderType = {
|
|
7098
7250
|
DOT: "dot",
|
|
7251
|
+
HEAVY: "heavy",
|
|
7099
7252
|
HYPHEN: "hyphen",
|
|
7100
7253
|
MIDDLE_DOT: "middleDot",
|
|
7101
7254
|
NONE: "none",
|
|
@@ -21706,13 +21859,12 @@ var Compiler = class {
|
|
|
21706
21859
|
const footerFormattedViews = /* @__PURE__ */ new Map();
|
|
21707
21860
|
const xmlifiedFileMapping = this.xmlifyFile(file, headerFormattedViews, footerFormattedViews, prettifyXml);
|
|
21708
21861
|
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 {
|
|
21862
|
+
for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
21863
|
+
else files[obj.path] = (0, undio.textToUint8Array)(obj.data);
|
|
21864
|
+
for (const subFile of overrides) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
21865
|
+
for (const mediaData of file.Media.Array) {
|
|
21714
21866
|
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 }];
|
|
21867
|
+
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
|
|
21716
21868
|
}
|
|
21717
21869
|
for (const { data: buffer, name, fontKey } of file.FontTable.fontOptionsWithKey) {
|
|
21718
21870
|
const [nameWithoutExtension] = name.split(".");
|
|
@@ -23255,6 +23407,8 @@ exports.TextWrappingSide = TextWrappingSide;
|
|
|
23255
23407
|
exports.TextWrappingType = TextWrappingType;
|
|
23256
23408
|
exports.Textbox = Textbox;
|
|
23257
23409
|
exports.ThematicBreak = ThematicBreak;
|
|
23410
|
+
exports.ThemeColor = ThemeColor;
|
|
23411
|
+
exports.ThemeFont = ThemeFont;
|
|
23258
23412
|
exports.UnderlineType = UnderlineType;
|
|
23259
23413
|
exports.VerticalAlign = VerticalAlign;
|
|
23260
23414
|
exports.VerticalAlignSection = VerticalAlignSection;
|
|
@@ -23333,7 +23487,6 @@ exports.dateTimeValue = dateTimeValue;
|
|
|
23333
23487
|
exports.decimalNumber = decimalNumber;
|
|
23334
23488
|
exports.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen;
|
|
23335
23489
|
exports.eighthPointMeasureValue = eighthPointMeasureValue;
|
|
23336
|
-
exports.encodeUtf8 = encodeUtf8;
|
|
23337
23490
|
exports.hashedId = hashedId;
|
|
23338
23491
|
exports.hexColorValue = hexColorValue;
|
|
23339
23492
|
exports.hpsMeasureValue = hpsMeasureValue;
|