docx 9.3.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +564 -433
- package/dist/index.d.cts +89 -76
- package/dist/index.d.ts +89 -76
- package/dist/index.iife.js +564 -433
- package/dist/index.mjs +564 -433
- package/dist/index.umd.cjs +564 -433
- package/package.json +4 -4
package/dist/index.umd.cjs
CHANGED
|
@@ -9378,32 +9378,59 @@ var __async = (__this, __arguments, generator) => {
|
|
|
9378
9378
|
}
|
|
9379
9379
|
}
|
|
9380
9380
|
const BorderStyle = {
|
|
9381
|
+
/** a single line */
|
|
9381
9382
|
SINGLE: "single",
|
|
9383
|
+
/** a line with a series of alternating thin and thick strokes */
|
|
9382
9384
|
DASH_DOT_STROKED: "dashDotStroked",
|
|
9385
|
+
/** a dashed line */
|
|
9383
9386
|
DASHED: "dashed",
|
|
9387
|
+
/** a dashed line with small gaps */
|
|
9384
9388
|
DASH_SMALL_GAP: "dashSmallGap",
|
|
9389
|
+
/** a line with alternating dots and dashes */
|
|
9385
9390
|
DOT_DASH: "dotDash",
|
|
9391
|
+
/** a line with a repeating dot - dot - dash sequence */
|
|
9386
9392
|
DOT_DOT_DASH: "dotDotDash",
|
|
9393
|
+
/** a dotted line */
|
|
9387
9394
|
DOTTED: "dotted",
|
|
9395
|
+
/** a double line */
|
|
9388
9396
|
DOUBLE: "double",
|
|
9397
|
+
/** a double wavy line */
|
|
9389
9398
|
DOUBLE_WAVE: "doubleWave",
|
|
9399
|
+
/** an inset set of lines */
|
|
9390
9400
|
INSET: "inset",
|
|
9401
|
+
/** no border */
|
|
9391
9402
|
NIL: "nil",
|
|
9403
|
+
/** no border */
|
|
9392
9404
|
NONE: "none",
|
|
9405
|
+
/** an outset set of lines */
|
|
9393
9406
|
OUTSET: "outset",
|
|
9407
|
+
/** a single line */
|
|
9394
9408
|
THICK: "thick",
|
|
9409
|
+
/** a thick line contained within a thin line with a large-sized intermediate gap */
|
|
9395
9410
|
THICK_THIN_LARGE_GAP: "thickThinLargeGap",
|
|
9411
|
+
/** a thick line contained within a thin line with a medium-sized intermediate gap */
|
|
9396
9412
|
THICK_THIN_MEDIUM_GAP: "thickThinMediumGap",
|
|
9413
|
+
/** a thick line contained within a thin line with a small intermediate gap */
|
|
9397
9414
|
THICK_THIN_SMALL_GAP: "thickThinSmallGap",
|
|
9415
|
+
/** a thin line contained within a thick line with a large-sized intermediate gap */
|
|
9398
9416
|
THIN_THICK_LARGE_GAP: "thinThickLargeGap",
|
|
9417
|
+
/** a thick line contained within a thin line with a medium-sized intermediate gap */
|
|
9399
9418
|
THIN_THICK_MEDIUM_GAP: "thinThickMediumGap",
|
|
9419
|
+
/** a thick line contained within a thin line with a small intermediate gap */
|
|
9400
9420
|
THIN_THICK_SMALL_GAP: "thinThickSmallGap",
|
|
9421
|
+
/** a thin-thick-thin line with a large gap */
|
|
9401
9422
|
THIN_THICK_THIN_LARGE_GAP: "thinThickThinLargeGap",
|
|
9423
|
+
/** a thin-thick-thin line with a medium gap */
|
|
9402
9424
|
THIN_THICK_THIN_MEDIUM_GAP: "thinThickThinMediumGap",
|
|
9425
|
+
/** a thin-thick-thin line with a small gap */
|
|
9403
9426
|
THIN_THICK_THIN_SMALL_GAP: "thinThickThinSmallGap",
|
|
9427
|
+
/** a three-staged gradient line, getting darker towards the paragraph */
|
|
9404
9428
|
THREE_D_EMBOSS: "threeDEmboss",
|
|
9429
|
+
/** a three-staged gradient like, getting darker away from the paragraph */
|
|
9405
9430
|
THREE_D_ENGRAVE: "threeDEngrave",
|
|
9431
|
+
/** a triple line */
|
|
9406
9432
|
TRIPLE: "triple",
|
|
9433
|
+
/** a wavy line */
|
|
9407
9434
|
WAVE: "wave"
|
|
9408
9435
|
};
|
|
9409
9436
|
class Border extends IgnoreIfEmptyXmlComponent {
|
|
@@ -11803,107 +11830,157 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11803
11830
|
const generateUuidPart = (count) => customAlphabet("1234567890abcdef", count)();
|
|
11804
11831
|
const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
|
|
11805
11832
|
const HorizontalPositionRelativeFrom = {
|
|
11833
|
+
/**
|
|
11834
|
+
* ## Character
|
|
11835
|
+
*
|
|
11836
|
+
* Specifies that the horizontal positioning shall be relative to the position of the anchor within its run content.
|
|
11837
|
+
*/
|
|
11806
11838
|
CHARACTER: "character",
|
|
11839
|
+
/**
|
|
11840
|
+
* ## Column
|
|
11841
|
+
*
|
|
11842
|
+
* Specifies that the horizontal positioning shall be relative to the extents of the column which contains its anchor.
|
|
11843
|
+
*/
|
|
11807
11844
|
COLUMN: "column",
|
|
11845
|
+
/**
|
|
11846
|
+
* ## Inside Margin
|
|
11847
|
+
*
|
|
11848
|
+
* Specifies that the horizontal positioning shall be relative to the inside margin of the current page (the left margin on odd pages, right on even pages).
|
|
11849
|
+
*/
|
|
11808
11850
|
INSIDE_MARGIN: "insideMargin",
|
|
11851
|
+
/**
|
|
11852
|
+
* ## Left Margin
|
|
11853
|
+
*
|
|
11854
|
+
* Specifies that the horizontal positioning shall be relative to the left margin of the page.
|
|
11855
|
+
*/
|
|
11809
11856
|
LEFT_MARGIN: "leftMargin",
|
|
11857
|
+
/**
|
|
11858
|
+
* ## Page Margin
|
|
11859
|
+
*
|
|
11860
|
+
* Specifies that the horizontal positioning shall be relative to the page margins.
|
|
11861
|
+
*/
|
|
11810
11862
|
MARGIN: "margin",
|
|
11863
|
+
/**
|
|
11864
|
+
* ## Outside Margin
|
|
11865
|
+
*
|
|
11866
|
+
* Specifies that the horizontal positioning shall be relative to the outside margin of the current page (the right margin on odd pages, left on even pages).
|
|
11867
|
+
*/
|
|
11811
11868
|
OUTSIDE_MARGIN: "outsideMargin",
|
|
11869
|
+
/**
|
|
11870
|
+
* ## Page Edge
|
|
11871
|
+
*
|
|
11872
|
+
* Specifies that the horizontal positioning shall be relative to the edge of the page.
|
|
11873
|
+
*/
|
|
11812
11874
|
PAGE: "page",
|
|
11875
|
+
/**
|
|
11876
|
+
* ## Right Margin
|
|
11877
|
+
*
|
|
11878
|
+
* Specifies that the horizontal positioning shall be relative to the right margin of the page.
|
|
11879
|
+
*/
|
|
11813
11880
|
RIGHT_MARGIN: "rightMargin"
|
|
11814
11881
|
};
|
|
11815
11882
|
const VerticalPositionRelativeFrom = {
|
|
11883
|
+
/**
|
|
11884
|
+
* ## Bottom Margin
|
|
11885
|
+
*
|
|
11886
|
+
* Specifies that the vertical positioning shall be relative to the bottom margin of the current page.
|
|
11887
|
+
*/
|
|
11816
11888
|
BOTTOM_MARGIN: "bottomMargin",
|
|
11889
|
+
/**
|
|
11890
|
+
* ## Inside Margin
|
|
11891
|
+
*
|
|
11892
|
+
* Specifies that the vertical positioning shall be relative to the inside margin of the current page.
|
|
11893
|
+
*/
|
|
11817
11894
|
INSIDE_MARGIN: "insideMargin",
|
|
11895
|
+
/**
|
|
11896
|
+
* ## Line
|
|
11897
|
+
*
|
|
11898
|
+
* Specifies that the vertical positioning shall be relative to the line containing the anchor character.
|
|
11899
|
+
*/
|
|
11818
11900
|
LINE: "line",
|
|
11901
|
+
/**
|
|
11902
|
+
* ## Page Margin
|
|
11903
|
+
*
|
|
11904
|
+
* Specifies that the vertical positioning shall be relative to the page margins.
|
|
11905
|
+
*/
|
|
11819
11906
|
MARGIN: "margin",
|
|
11907
|
+
/**
|
|
11908
|
+
* ## Outside Margin
|
|
11909
|
+
*
|
|
11910
|
+
* Specifies that the vertical positioning shall be relative to the outside margin of the current page.
|
|
11911
|
+
*/
|
|
11820
11912
|
OUTSIDE_MARGIN: "outsideMargin",
|
|
11913
|
+
/**
|
|
11914
|
+
* ## Page Edge
|
|
11915
|
+
*
|
|
11916
|
+
* Specifies that the vertical positioning shall be relative to the edge of the page.
|
|
11917
|
+
*/
|
|
11821
11918
|
PAGE: "page",
|
|
11919
|
+
/**
|
|
11920
|
+
* ## Paragraph
|
|
11921
|
+
*
|
|
11922
|
+
* Specifies that the vertical positioning shall be relative to the paragraph which contains the drawing anchor.
|
|
11923
|
+
*/
|
|
11822
11924
|
PARAGRAPH: "paragraph",
|
|
11925
|
+
/**
|
|
11926
|
+
* ## Top Margin
|
|
11927
|
+
*
|
|
11928
|
+
* Specifies that the vertical positioning shall be relative to the top margin of the current page.
|
|
11929
|
+
*/
|
|
11823
11930
|
TOP_MARGIN: "topMargin"
|
|
11824
11931
|
};
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
});
|
|
11832
|
-
}
|
|
11833
|
-
}
|
|
11834
|
-
class SimplePos extends XmlComponent {
|
|
11835
|
-
constructor() {
|
|
11836
|
-
super("wp:simplePos");
|
|
11837
|
-
this.root.push(
|
|
11838
|
-
new SimplePosAttributes({
|
|
11839
|
-
x: 0,
|
|
11840
|
-
y: 0
|
|
11841
|
-
})
|
|
11842
|
-
);
|
|
11843
|
-
}
|
|
11844
|
-
}
|
|
11845
|
-
class Align extends XmlComponent {
|
|
11846
|
-
constructor(value) {
|
|
11847
|
-
super("wp:align");
|
|
11848
|
-
this.root.push(value);
|
|
11849
|
-
}
|
|
11850
|
-
}
|
|
11851
|
-
class PositionOffset extends XmlComponent {
|
|
11852
|
-
constructor(offsetValue) {
|
|
11853
|
-
super("wp:posOffset");
|
|
11854
|
-
this.root.push(offsetValue.toString());
|
|
11855
|
-
}
|
|
11856
|
-
}
|
|
11857
|
-
class HorizontalPositionAttributes extends XmlAttributeComponent {
|
|
11858
|
-
constructor() {
|
|
11859
|
-
super(...arguments);
|
|
11860
|
-
__publicField(this, "xmlKeys", {
|
|
11861
|
-
relativeFrom: "relativeFrom"
|
|
11862
|
-
});
|
|
11863
|
-
}
|
|
11864
|
-
}
|
|
11865
|
-
class HorizontalPosition extends XmlComponent {
|
|
11866
|
-
constructor(horizontalPosition) {
|
|
11867
|
-
super("wp:positionH");
|
|
11868
|
-
this.root.push(
|
|
11869
|
-
new HorizontalPositionAttributes({
|
|
11870
|
-
relativeFrom: horizontalPosition.relative || HorizontalPositionRelativeFrom.PAGE
|
|
11871
|
-
})
|
|
11872
|
-
);
|
|
11873
|
-
if (horizontalPosition.align) {
|
|
11874
|
-
this.root.push(new Align(horizontalPosition.align));
|
|
11875
|
-
} else if (horizontalPosition.offset !== void 0) {
|
|
11876
|
-
this.root.push(new PositionOffset(horizontalPosition.offset));
|
|
11877
|
-
} else {
|
|
11878
|
-
throw new Error("There is no configuration provided for floating position (Align or offset)");
|
|
11879
|
-
}
|
|
11880
|
-
}
|
|
11881
|
-
}
|
|
11882
|
-
class VerticalPositionAttributes extends XmlAttributeComponent {
|
|
11883
|
-
constructor() {
|
|
11884
|
-
super(...arguments);
|
|
11885
|
-
__publicField(this, "xmlKeys", {
|
|
11886
|
-
relativeFrom: "relativeFrom"
|
|
11887
|
-
});
|
|
11888
|
-
}
|
|
11889
|
-
}
|
|
11890
|
-
class VerticalPosition extends XmlComponent {
|
|
11891
|
-
constructor(verticalPosition) {
|
|
11892
|
-
super("wp:positionV");
|
|
11893
|
-
this.root.push(
|
|
11894
|
-
new VerticalPositionAttributes({
|
|
11895
|
-
relativeFrom: verticalPosition.relative || VerticalPositionRelativeFrom.PAGE
|
|
11896
|
-
})
|
|
11897
|
-
);
|
|
11898
|
-
if (verticalPosition.align) {
|
|
11899
|
-
this.root.push(new Align(verticalPosition.align));
|
|
11900
|
-
} else if (verticalPosition.offset !== void 0) {
|
|
11901
|
-
this.root.push(new PositionOffset(verticalPosition.offset));
|
|
11902
|
-
} else {
|
|
11903
|
-
throw new Error("There is no configuration provided for floating position (Align or offset)");
|
|
11904
|
-
}
|
|
11932
|
+
const createSimplePos = () => new BuilderElement({
|
|
11933
|
+
name: "wp:simplePos",
|
|
11934
|
+
// NOTE: It's not fully supported in Microsoft Word, but this element is needed anyway
|
|
11935
|
+
attributes: {
|
|
11936
|
+
x: { key: "x", value: 0 },
|
|
11937
|
+
y: { key: "y", value: 0 }
|
|
11905
11938
|
}
|
|
11906
|
-
}
|
|
11939
|
+
});
|
|
11940
|
+
const createAlign = (value) => new BuilderElement({
|
|
11941
|
+
name: "wp:align",
|
|
11942
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11943
|
+
children: [value]
|
|
11944
|
+
});
|
|
11945
|
+
const createPositionOffset = (offsetValue) => new BuilderElement({
|
|
11946
|
+
name: "wp:posOffset",
|
|
11947
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11948
|
+
children: [offsetValue.toString()]
|
|
11949
|
+
});
|
|
11950
|
+
const createHorizontalPosition = ({ relative, align, offset }) => new BuilderElement({
|
|
11951
|
+
name: "wp:positionH",
|
|
11952
|
+
attributes: {
|
|
11953
|
+
relativeFrom: { key: "relativeFrom", value: relative != null ? relative : HorizontalPositionRelativeFrom.PAGE }
|
|
11954
|
+
},
|
|
11955
|
+
children: [
|
|
11956
|
+
(() => {
|
|
11957
|
+
if (align) {
|
|
11958
|
+
return createAlign(align);
|
|
11959
|
+
} else if (offset !== void 0) {
|
|
11960
|
+
return createPositionOffset(offset);
|
|
11961
|
+
} else {
|
|
11962
|
+
throw new Error("There is no configuration provided for floating position (Align or offset)");
|
|
11963
|
+
}
|
|
11964
|
+
})()
|
|
11965
|
+
]
|
|
11966
|
+
});
|
|
11967
|
+
const createVerticalPosition = ({ relative, align, offset }) => new BuilderElement({
|
|
11968
|
+
name: "wp:positionV",
|
|
11969
|
+
attributes: {
|
|
11970
|
+
relativeFrom: { key: "relativeFrom", value: relative != null ? relative : VerticalPositionRelativeFrom.PAGE }
|
|
11971
|
+
},
|
|
11972
|
+
children: [
|
|
11973
|
+
(() => {
|
|
11974
|
+
if (align) {
|
|
11975
|
+
return createAlign(align);
|
|
11976
|
+
} else if (offset !== void 0) {
|
|
11977
|
+
return createPositionOffset(offset);
|
|
11978
|
+
} else {
|
|
11979
|
+
throw new Error("There is no configuration provided for floating position (Align or offset)");
|
|
11980
|
+
}
|
|
11981
|
+
})()
|
|
11982
|
+
]
|
|
11983
|
+
});
|
|
11907
11984
|
class GraphicDataAttributes extends XmlAttributeComponent {
|
|
11908
11985
|
constructor() {
|
|
11909
11986
|
super(...arguments);
|
|
@@ -12446,26 +12523,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12446
12523
|
}
|
|
12447
12524
|
}
|
|
12448
12525
|
});
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
cy: "cy"
|
|
12455
|
-
});
|
|
12456
|
-
}
|
|
12457
|
-
}
|
|
12458
|
-
class Extent extends XmlComponent {
|
|
12459
|
-
constructor(x, y) {
|
|
12460
|
-
super("wp:extent");
|
|
12461
|
-
__publicField(this, "attributes");
|
|
12462
|
-
this.attributes = new ExtentAttributes({
|
|
12463
|
-
cx: x,
|
|
12464
|
-
cy: y
|
|
12465
|
-
});
|
|
12466
|
-
this.root.push(this.attributes);
|
|
12526
|
+
const createExtent = ({ x, y }) => new BuilderElement({
|
|
12527
|
+
name: "wp:extent",
|
|
12528
|
+
attributes: {
|
|
12529
|
+
x: { key: "cx", value: x },
|
|
12530
|
+
y: { key: "cy", value: y }
|
|
12467
12531
|
}
|
|
12468
|
-
}
|
|
12532
|
+
});
|
|
12469
12533
|
class GraphicFrameLockAttributes extends XmlAttributeComponent {
|
|
12470
12534
|
constructor() {
|
|
12471
12535
|
super(...arguments);
|
|
@@ -12486,12 +12550,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12486
12550
|
);
|
|
12487
12551
|
}
|
|
12488
12552
|
}
|
|
12489
|
-
|
|
12490
|
-
|
|
12491
|
-
|
|
12492
|
-
|
|
12493
|
-
}
|
|
12494
|
-
}
|
|
12553
|
+
const createGraphicFrameProperties = () => new BuilderElement({
|
|
12554
|
+
name: "wp:cNvGraphicFramePr",
|
|
12555
|
+
children: [new GraphicFrameLocks()]
|
|
12556
|
+
});
|
|
12495
12557
|
class AnchorAttributes extends XmlAttributeComponent {
|
|
12496
12558
|
constructor() {
|
|
12497
12559
|
super(...arguments);
|
|
@@ -12539,10 +12601,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12539
12601
|
relativeHeight: floating.zIndex ? floating.zIndex : transform.emus.y
|
|
12540
12602
|
})
|
|
12541
12603
|
);
|
|
12542
|
-
this.root.push(
|
|
12543
|
-
this.root.push(
|
|
12544
|
-
this.root.push(
|
|
12545
|
-
this.root.push(
|
|
12604
|
+
this.root.push(createSimplePos());
|
|
12605
|
+
this.root.push(createHorizontalPosition(floating.horizontalPosition));
|
|
12606
|
+
this.root.push(createVerticalPosition(floating.verticalPosition));
|
|
12607
|
+
this.root.push(createExtent({ x: transform.emus.x, y: transform.emus.y }));
|
|
12546
12608
|
this.root.push(createEffectExtent({ top: 0, right: 0, bottom: 0, left: 0 }));
|
|
12547
12609
|
if (drawingOptions.floating !== void 0 && drawingOptions.floating.wrap !== void 0) {
|
|
12548
12610
|
switch (drawingOptions.floating.wrap.type) {
|
|
@@ -12563,7 +12625,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12563
12625
|
this.root.push(new WrapNone());
|
|
12564
12626
|
}
|
|
12565
12627
|
this.root.push(new DocProperties(drawingOptions.docProperties));
|
|
12566
|
-
this.root.push(
|
|
12628
|
+
this.root.push(createGraphicFrameProperties());
|
|
12567
12629
|
this.root.push(new Graphic({ mediaData, transform, outline: drawingOptions.outline }));
|
|
12568
12630
|
}
|
|
12569
12631
|
}
|
|
@@ -12590,7 +12652,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12590
12652
|
}
|
|
12591
12653
|
},
|
|
12592
12654
|
children: [
|
|
12593
|
-
|
|
12655
|
+
createExtent({ x: transform.emus.x, y: transform.emus.y }),
|
|
12594
12656
|
createEffectExtent(
|
|
12595
12657
|
outline ? {
|
|
12596
12658
|
top: ((_a = outline.width) != null ? _a : 9525) * 2,
|
|
@@ -12600,7 +12662,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12600
12662
|
} : { top: 0, right: 0, bottom: 0, left: 0 }
|
|
12601
12663
|
),
|
|
12602
12664
|
new DocProperties(docProperties),
|
|
12603
|
-
|
|
12665
|
+
createGraphicFrameProperties(),
|
|
12604
12666
|
new Graphic({ mediaData, transform, outline })
|
|
12605
12667
|
]
|
|
12606
12668
|
});
|
|
@@ -12723,6 +12785,59 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12723
12785
|
super(` MERGEFIELD ${fieldName} `, `«${fieldName}»`);
|
|
12724
12786
|
}
|
|
12725
12787
|
}
|
|
12788
|
+
class RelationshipsAttributes extends XmlAttributeComponent {
|
|
12789
|
+
constructor() {
|
|
12790
|
+
super(...arguments);
|
|
12791
|
+
__publicField(this, "xmlKeys", {
|
|
12792
|
+
xmlns: "xmlns"
|
|
12793
|
+
});
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12796
|
+
class RelationshipAttributes extends XmlAttributeComponent {
|
|
12797
|
+
constructor() {
|
|
12798
|
+
super(...arguments);
|
|
12799
|
+
__publicField(this, "xmlKeys", {
|
|
12800
|
+
id: "Id",
|
|
12801
|
+
type: "Type",
|
|
12802
|
+
target: "Target",
|
|
12803
|
+
targetMode: "TargetMode"
|
|
12804
|
+
});
|
|
12805
|
+
}
|
|
12806
|
+
}
|
|
12807
|
+
const TargetModeType = {
|
|
12808
|
+
EXTERNAL: "External"
|
|
12809
|
+
};
|
|
12810
|
+
class Relationship extends XmlComponent {
|
|
12811
|
+
constructor(id, type2, target, targetMode) {
|
|
12812
|
+
super("Relationship");
|
|
12813
|
+
this.root.push(
|
|
12814
|
+
new RelationshipAttributes({
|
|
12815
|
+
id,
|
|
12816
|
+
type: type2,
|
|
12817
|
+
target,
|
|
12818
|
+
targetMode
|
|
12819
|
+
})
|
|
12820
|
+
);
|
|
12821
|
+
}
|
|
12822
|
+
}
|
|
12823
|
+
class Relationships extends XmlComponent {
|
|
12824
|
+
constructor() {
|
|
12825
|
+
super("Relationships");
|
|
12826
|
+
this.root.push(
|
|
12827
|
+
new RelationshipsAttributes({
|
|
12828
|
+
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
|
|
12829
|
+
})
|
|
12830
|
+
);
|
|
12831
|
+
}
|
|
12832
|
+
createRelationship(id, type2, target, targetMode) {
|
|
12833
|
+
const relationship = new Relationship(`rId${id}`, type2, target, targetMode);
|
|
12834
|
+
this.root.push(relationship);
|
|
12835
|
+
return relationship;
|
|
12836
|
+
}
|
|
12837
|
+
get RelationshipCount() {
|
|
12838
|
+
return this.root.length - 1;
|
|
12839
|
+
}
|
|
12840
|
+
}
|
|
12726
12841
|
class CommentAttributes extends XmlAttributeComponent {
|
|
12727
12842
|
constructor() {
|
|
12728
12843
|
super(...arguments);
|
|
@@ -12810,6 +12925,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12810
12925
|
class Comments extends XmlComponent {
|
|
12811
12926
|
constructor({ children }) {
|
|
12812
12927
|
super("w:comments");
|
|
12928
|
+
__publicField(this, "relationships");
|
|
12813
12929
|
this.root.push(
|
|
12814
12930
|
new RootCommentsAttributes({
|
|
12815
12931
|
"xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
|
|
@@ -12848,6 +12964,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12848
12964
|
for (const child of children) {
|
|
12849
12965
|
this.root.push(new Comment(child));
|
|
12850
12966
|
}
|
|
12967
|
+
this.relationships = new Relationships();
|
|
12968
|
+
}
|
|
12969
|
+
get Relationships() {
|
|
12970
|
+
return this.relationships;
|
|
12851
12971
|
}
|
|
12852
12972
|
}
|
|
12853
12973
|
class NoBreakHyphen extends EmptyElement {
|
|
@@ -13133,33 +13253,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13133
13253
|
__publicField(this, "fileChild", Symbol());
|
|
13134
13254
|
}
|
|
13135
13255
|
}
|
|
13136
|
-
class RelationshipAttributes extends XmlAttributeComponent {
|
|
13137
|
-
constructor() {
|
|
13138
|
-
super(...arguments);
|
|
13139
|
-
__publicField(this, "xmlKeys", {
|
|
13140
|
-
id: "Id",
|
|
13141
|
-
type: "Type",
|
|
13142
|
-
target: "Target",
|
|
13143
|
-
targetMode: "TargetMode"
|
|
13144
|
-
});
|
|
13145
|
-
}
|
|
13146
|
-
}
|
|
13147
|
-
const TargetModeType = {
|
|
13148
|
-
EXTERNAL: "External"
|
|
13149
|
-
};
|
|
13150
|
-
class Relationship extends XmlComponent {
|
|
13151
|
-
constructor(id, type2, target, targetMode) {
|
|
13152
|
-
super("Relationship");
|
|
13153
|
-
this.root.push(
|
|
13154
|
-
new RelationshipAttributes({
|
|
13155
|
-
id,
|
|
13156
|
-
type: type2,
|
|
13157
|
-
target,
|
|
13158
|
-
targetMode
|
|
13159
|
-
})
|
|
13160
|
-
);
|
|
13161
|
-
}
|
|
13162
|
-
}
|
|
13163
13256
|
class HyperlinkAttributes extends XmlAttributeComponent {
|
|
13164
13257
|
constructor() {
|
|
13165
13258
|
super(...arguments);
|
|
@@ -13318,36 +13411,40 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13318
13411
|
}
|
|
13319
13412
|
}
|
|
13320
13413
|
const DocumentGridType = {
|
|
13414
|
+
/**
|
|
13415
|
+
* Specifies that no document grid shall be applied to the contents of the current section in the document.
|
|
13416
|
+
*/
|
|
13321
13417
|
DEFAULT: "default",
|
|
13418
|
+
/**
|
|
13419
|
+
* Specifies that the parent section shall have additional line pitch added to each line within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain the specified number of lines per page.
|
|
13420
|
+
*/
|
|
13322
13421
|
LINES: "lines",
|
|
13422
|
+
/**
|
|
13423
|
+
* Specifies that the parent section shall have both the additional line pitch and character pitch added to each line and character within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain a specific number of lines per page and characters per line.
|
|
13424
|
+
*
|
|
13425
|
+
* When this value is set, the input specified via the user interface may be allowed in exact number of line/character pitch units. */
|
|
13323
13426
|
LINES_AND_CHARS: "linesAndChars",
|
|
13427
|
+
/**
|
|
13428
|
+
* Specifies that the parent section shall have both the additional line pitch and character pitch added to each line and character within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain a specific number of lines per page and characters per line.
|
|
13429
|
+
*
|
|
13430
|
+
* When this value is set, the input specified via the user interface may be restricted to the number of lines per page and characters per line, with the consumer or producer translating this information based on the current font data to get the resulting line and character pitch values
|
|
13431
|
+
*/
|
|
13324
13432
|
SNAP_TO_CHARS: "snapToChars"
|
|
13325
13433
|
};
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
charSpace: "w:charSpace"
|
|
13333
|
-
});
|
|
13334
|
-
}
|
|
13335
|
-
}
|
|
13336
|
-
class DocumentGrid extends XmlComponent {
|
|
13337
|
-
constructor(linePitch, charSpace, type2) {
|
|
13338
|
-
super("w:docGrid");
|
|
13339
|
-
this.root.push(
|
|
13340
|
-
new DocGridAttributes({
|
|
13341
|
-
type: type2,
|
|
13342
|
-
linePitch: decimalNumber(linePitch),
|
|
13343
|
-
charSpace: charSpace ? decimalNumber(charSpace) : void 0
|
|
13344
|
-
})
|
|
13345
|
-
);
|
|
13434
|
+
const createDocumentGrid = ({ type: type2, linePitch, charSpace }) => new BuilderElement({
|
|
13435
|
+
name: "w:docGrid",
|
|
13436
|
+
attributes: {
|
|
13437
|
+
type: { key: "w:type", value: type2 },
|
|
13438
|
+
linePitch: { key: "w:linePitch", value: decimalNumber(linePitch) },
|
|
13439
|
+
charSpace: { key: "w:charSpace", value: charSpace ? decimalNumber(charSpace) : void 0 }
|
|
13346
13440
|
}
|
|
13347
|
-
}
|
|
13441
|
+
});
|
|
13348
13442
|
const HeaderFooterReferenceType = {
|
|
13443
|
+
/** Specifies that this header or footer shall appear on every page in this section which is not overridden with a specific `even` or `first` page header/footer. In a section with all three types specified, this type shall be used on all odd numbered pages (counting from the `first` page in the section, not the section numbering). */
|
|
13349
13444
|
DEFAULT: "default",
|
|
13445
|
+
/** Specifies that this header or footer shall appear on the first page in this section. The appearance of this header or footer is contingent on the setting of the `titlePg` element (§2.10.6). */
|
|
13350
13446
|
FIRST: "first",
|
|
13447
|
+
/** Specifies that this header or footer shall appear on all even numbered pages in this section (counting from the first page in the section, not the section numbering). The appearance of this header or footer is contingent on the setting of the `evenAndOddHeaders` element (§2.10.1). */
|
|
13351
13448
|
EVEN: "even"
|
|
13352
13449
|
};
|
|
13353
13450
|
class FooterReferenceAttributes extends XmlAttributeComponent {
|
|
@@ -13375,8 +13472,23 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13375
13472
|
}
|
|
13376
13473
|
}
|
|
13377
13474
|
const LineNumberRestartFormat = {
|
|
13475
|
+
/**
|
|
13476
|
+
* ## Restart Line Numbering on Each Page
|
|
13477
|
+
*
|
|
13478
|
+
* Specifies that line numbering for the parent section shall restart to the starting value whenever a new page is displayed.
|
|
13479
|
+
*/
|
|
13378
13480
|
NEW_PAGE: "newPage",
|
|
13481
|
+
/**
|
|
13482
|
+
* ## Restart Line Numbering for Each Section
|
|
13483
|
+
*
|
|
13484
|
+
* Specifies that line numbering for the parent section shall restart to the starting value whenever the parent begins.
|
|
13485
|
+
*/
|
|
13379
13486
|
NEW_SECTION: "newSection",
|
|
13487
|
+
/**
|
|
13488
|
+
* ## Continue Line Numbering From Previous Section
|
|
13489
|
+
*
|
|
13490
|
+
* Specifies that line numbering for the parent section shall continue from the line numbering from the end of the previous section, if any.
|
|
13491
|
+
*/
|
|
13380
13492
|
CONTINUOUS: "continuous"
|
|
13381
13493
|
};
|
|
13382
13494
|
const createLineNumberType = ({ countBy, start, restart, distance }) => new BuilderElement({
|
|
@@ -13491,24 +13603,32 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13491
13603
|
}
|
|
13492
13604
|
}
|
|
13493
13605
|
const PageOrientation = {
|
|
13606
|
+
/**
|
|
13607
|
+
* ## Portrait Mode
|
|
13608
|
+
*
|
|
13609
|
+
* Specifies that pages in this section shall be printed in portrait mode.
|
|
13610
|
+
*/
|
|
13494
13611
|
PORTRAIT: "portrait",
|
|
13612
|
+
/**
|
|
13613
|
+
* ## Landscape Mode
|
|
13614
|
+
*
|
|
13615
|
+
* Specifies that pages in this section shall be printed in landscape mode, which prints the page contents with a 90 degree rotation with respect to the normal page orientation.
|
|
13616
|
+
*/
|
|
13495
13617
|
LANDSCAPE: "landscape"
|
|
13496
13618
|
};
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
}
|
|
13511
|
-
}
|
|
13619
|
+
const createPageSize = ({ width, height, orientation, code }) => {
|
|
13620
|
+
const widthTwips = twipsMeasureValue(width);
|
|
13621
|
+
const heightTwips = twipsMeasureValue(height);
|
|
13622
|
+
return new BuilderElement({
|
|
13623
|
+
name: "w:pgSz",
|
|
13624
|
+
attributes: {
|
|
13625
|
+
width: { key: "w:w", value: orientation === PageOrientation.LANDSCAPE ? heightTwips : widthTwips },
|
|
13626
|
+
height: { key: "w:h", value: orientation === PageOrientation.LANDSCAPE ? widthTwips : heightTwips },
|
|
13627
|
+
orientation: { key: "w:orient", value: orientation },
|
|
13628
|
+
code: { key: "w:code", value: code }
|
|
13629
|
+
}
|
|
13630
|
+
});
|
|
13631
|
+
};
|
|
13512
13632
|
const PageTextDirectionType = {
|
|
13513
13633
|
LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
|
|
13514
13634
|
TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl"
|
|
@@ -13600,7 +13720,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13600
13720
|
if (type2) {
|
|
13601
13721
|
this.root.push(new Type(type2));
|
|
13602
13722
|
}
|
|
13603
|
-
this.root.push(
|
|
13723
|
+
this.root.push(createPageSize({ width, height, orientation }));
|
|
13604
13724
|
this.root.push(new PageMargin(top, right, bottom, left, header, footer, gutter));
|
|
13605
13725
|
if (borders) {
|
|
13606
13726
|
this.root.push(new PageBorders(borders));
|
|
@@ -13621,7 +13741,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13621
13741
|
if (textDirection) {
|
|
13622
13742
|
this.root.push(new PageTextDirection(textDirection));
|
|
13623
13743
|
}
|
|
13624
|
-
this.root.push(
|
|
13744
|
+
this.root.push(createDocumentGrid({ linePitch, charSpace, type: gridType }));
|
|
13625
13745
|
}
|
|
13626
13746
|
addHeaderFooterGroup(type2, group) {
|
|
13627
13747
|
if (group.default) {
|
|
@@ -13827,32 +13947,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13827
13947
|
return this.body;
|
|
13828
13948
|
}
|
|
13829
13949
|
}
|
|
13830
|
-
class RelationshipsAttributes extends XmlAttributeComponent {
|
|
13831
|
-
constructor() {
|
|
13832
|
-
super(...arguments);
|
|
13833
|
-
__publicField(this, "xmlKeys", {
|
|
13834
|
-
xmlns: "xmlns"
|
|
13835
|
-
});
|
|
13836
|
-
}
|
|
13837
|
-
}
|
|
13838
|
-
class Relationships extends XmlComponent {
|
|
13839
|
-
constructor() {
|
|
13840
|
-
super("Relationships");
|
|
13841
|
-
this.root.push(
|
|
13842
|
-
new RelationshipsAttributes({
|
|
13843
|
-
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
|
|
13844
|
-
})
|
|
13845
|
-
);
|
|
13846
|
-
}
|
|
13847
|
-
createRelationship(id, type2, target, targetMode) {
|
|
13848
|
-
const relationship = new Relationship(`rId${id}`, type2, target, targetMode);
|
|
13849
|
-
this.root.push(relationship);
|
|
13850
|
-
return relationship;
|
|
13851
|
-
}
|
|
13852
|
-
get RelationshipCount() {
|
|
13853
|
-
return this.root.length - 1;
|
|
13854
|
-
}
|
|
13855
|
-
}
|
|
13856
13950
|
class DocumentWrapper {
|
|
13857
13951
|
constructor(options) {
|
|
13858
13952
|
__publicField(this, "document");
|
|
@@ -14173,117 +14267,93 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14173
14267
|
this.root.push(new MathDenominator(options.denominator));
|
|
14174
14268
|
}
|
|
14175
14269
|
}
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
}
|
|
14181
|
-
}
|
|
14182
|
-
class MathAccentCharacter extends XmlComponent {
|
|
14183
|
-
constructor(accent) {
|
|
14184
|
-
super("m:chr");
|
|
14185
|
-
this.root.push(new MathAccentCharacterAttributes({ accent }));
|
|
14186
|
-
}
|
|
14187
|
-
}
|
|
14188
|
-
class MathBase extends XmlComponent {
|
|
14189
|
-
constructor(children) {
|
|
14190
|
-
super("m:e");
|
|
14191
|
-
for (const child of children) {
|
|
14192
|
-
this.root.push(child);
|
|
14193
|
-
}
|
|
14194
|
-
}
|
|
14195
|
-
}
|
|
14196
|
-
class MathLimitLocationAttributes extends XmlAttributeComponent {
|
|
14197
|
-
constructor() {
|
|
14198
|
-
super(...arguments);
|
|
14199
|
-
__publicField(this, "xmlKeys", { value: "m:val" });
|
|
14200
|
-
}
|
|
14201
|
-
}
|
|
14202
|
-
class MathLimitLocation extends XmlComponent {
|
|
14203
|
-
constructor(value) {
|
|
14204
|
-
super("m:limLoc");
|
|
14205
|
-
this.root.push(new MathLimitLocationAttributes({ value: value || "undOvr" }));
|
|
14206
|
-
}
|
|
14207
|
-
}
|
|
14208
|
-
class MathSubScriptHideAttributes extends XmlAttributeComponent {
|
|
14209
|
-
constructor() {
|
|
14210
|
-
super(...arguments);
|
|
14211
|
-
__publicField(this, "xmlKeys", { hide: "m:val" });
|
|
14212
|
-
}
|
|
14213
|
-
}
|
|
14214
|
-
class MathSubScriptHide extends XmlComponent {
|
|
14215
|
-
constructor() {
|
|
14216
|
-
super("m:subHide");
|
|
14217
|
-
this.root.push(new MathSubScriptHideAttributes({ hide: 1 }));
|
|
14218
|
-
}
|
|
14219
|
-
}
|
|
14220
|
-
class MathSuperScriptHideAttributes extends XmlAttributeComponent {
|
|
14221
|
-
constructor() {
|
|
14222
|
-
super(...arguments);
|
|
14223
|
-
__publicField(this, "xmlKeys", { hide: "m:val" });
|
|
14224
|
-
}
|
|
14225
|
-
}
|
|
14226
|
-
class MathSuperScriptHide extends XmlComponent {
|
|
14227
|
-
constructor() {
|
|
14228
|
-
super("m:supHide");
|
|
14229
|
-
this.root.push(new MathSuperScriptHideAttributes({ hide: 1 }));
|
|
14270
|
+
const createMathAccentCharacter = ({ accent }) => new BuilderElement({
|
|
14271
|
+
name: "m:chr",
|
|
14272
|
+
attributes: {
|
|
14273
|
+
accent: { key: "m:val", value: accent }
|
|
14230
14274
|
}
|
|
14231
|
-
}
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
|
|
14240
|
-
this.root.push(new MathSuperScriptHide());
|
|
14241
|
-
}
|
|
14242
|
-
if (!hasSubScript) {
|
|
14243
|
-
this.root.push(new MathSubScriptHide());
|
|
14244
|
-
}
|
|
14275
|
+
});
|
|
14276
|
+
const createMathBase = ({ children }) => new BuilderElement({
|
|
14277
|
+
name: "m:e",
|
|
14278
|
+
children
|
|
14279
|
+
});
|
|
14280
|
+
const createMathLimitLocation = ({ value }) => new BuilderElement({
|
|
14281
|
+
name: "m:limLoc",
|
|
14282
|
+
attributes: {
|
|
14283
|
+
value: { key: "m:val", value: value || "undOvr" }
|
|
14245
14284
|
}
|
|
14246
|
-
}
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
14251
|
-
this.root.push(child);
|
|
14252
|
-
}
|
|
14285
|
+
});
|
|
14286
|
+
const createMathSubScriptHide = () => new BuilderElement({
|
|
14287
|
+
name: "m:subHide",
|
|
14288
|
+
attributes: {
|
|
14289
|
+
hide: { key: "m:val", value: 1 }
|
|
14253
14290
|
}
|
|
14254
|
-
}
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
this.root.push(child);
|
|
14260
|
-
}
|
|
14291
|
+
});
|
|
14292
|
+
const createMathSuperScriptHide = () => new BuilderElement({
|
|
14293
|
+
name: "m:supHide",
|
|
14294
|
+
attributes: {
|
|
14295
|
+
hide: { key: "m:val", value: 1 }
|
|
14261
14296
|
}
|
|
14262
|
-
}
|
|
14297
|
+
});
|
|
14298
|
+
const createMathNAryProperties = ({
|
|
14299
|
+
accent,
|
|
14300
|
+
hasSuperScript,
|
|
14301
|
+
hasSubScript,
|
|
14302
|
+
limitLocationVal
|
|
14303
|
+
}) => new BuilderElement({
|
|
14304
|
+
name: "m:naryPr",
|
|
14305
|
+
children: [
|
|
14306
|
+
...!!accent ? [createMathAccentCharacter({ accent })] : [],
|
|
14307
|
+
createMathLimitLocation({ value: limitLocationVal }),
|
|
14308
|
+
...!hasSuperScript ? [createMathSuperScriptHide()] : [],
|
|
14309
|
+
...!hasSubScript ? [createMathSubScriptHide()] : []
|
|
14310
|
+
]
|
|
14311
|
+
});
|
|
14312
|
+
const createMathSubScriptElement = ({ children }) => new BuilderElement({
|
|
14313
|
+
name: "m:sub",
|
|
14314
|
+
children
|
|
14315
|
+
});
|
|
14316
|
+
const createMathSuperScriptElement = ({ children }) => new BuilderElement({
|
|
14317
|
+
name: "m:sup",
|
|
14318
|
+
children
|
|
14319
|
+
});
|
|
14263
14320
|
class MathSum extends XmlComponent {
|
|
14264
14321
|
constructor(options) {
|
|
14265
14322
|
super("m:nary");
|
|
14266
|
-
this.root.push(
|
|
14323
|
+
this.root.push(
|
|
14324
|
+
createMathNAryProperties({
|
|
14325
|
+
accent: "∑",
|
|
14326
|
+
hasSuperScript: !!options.superScript,
|
|
14327
|
+
hasSubScript: !!options.subScript
|
|
14328
|
+
})
|
|
14329
|
+
);
|
|
14267
14330
|
if (!!options.subScript) {
|
|
14268
|
-
this.root.push(
|
|
14331
|
+
this.root.push(createMathSubScriptElement({ children: options.subScript }));
|
|
14269
14332
|
}
|
|
14270
14333
|
if (!!options.superScript) {
|
|
14271
|
-
this.root.push(
|
|
14334
|
+
this.root.push(createMathSuperScriptElement({ children: options.superScript }));
|
|
14272
14335
|
}
|
|
14273
|
-
this.root.push(
|
|
14336
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14274
14337
|
}
|
|
14275
14338
|
}
|
|
14276
14339
|
class MathIntegral extends XmlComponent {
|
|
14277
14340
|
constructor(options) {
|
|
14278
14341
|
super("m:nary");
|
|
14279
|
-
this.root.push(
|
|
14342
|
+
this.root.push(
|
|
14343
|
+
createMathNAryProperties({
|
|
14344
|
+
accent: "",
|
|
14345
|
+
hasSuperScript: !!options.superScript,
|
|
14346
|
+
hasSubScript: !!options.subScript,
|
|
14347
|
+
limitLocationVal: "subSup"
|
|
14348
|
+
})
|
|
14349
|
+
);
|
|
14280
14350
|
if (!!options.subScript) {
|
|
14281
|
-
this.root.push(
|
|
14351
|
+
this.root.push(createMathSubScriptElement({ children: options.subScript }));
|
|
14282
14352
|
}
|
|
14283
14353
|
if (!!options.superScript) {
|
|
14284
|
-
this.root.push(
|
|
14354
|
+
this.root.push(createMathSuperScriptElement({ children: options.superScript }));
|
|
14285
14355
|
}
|
|
14286
|
-
this.root.push(
|
|
14356
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14287
14357
|
}
|
|
14288
14358
|
}
|
|
14289
14359
|
class MathLimit extends XmlComponent {
|
|
@@ -14297,69 +14367,65 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14297
14367
|
class MathLimitUpper extends XmlComponent {
|
|
14298
14368
|
constructor(options) {
|
|
14299
14369
|
super("m:limUpp");
|
|
14300
|
-
this.root.push(
|
|
14370
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14301
14371
|
this.root.push(new MathLimit(options.limit));
|
|
14302
14372
|
}
|
|
14303
14373
|
}
|
|
14304
14374
|
class MathLimitLower extends XmlComponent {
|
|
14305
14375
|
constructor(options) {
|
|
14306
14376
|
super("m:limLow");
|
|
14307
|
-
this.root.push(
|
|
14377
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14308
14378
|
this.root.push(new MathLimit(options.limit));
|
|
14309
14379
|
}
|
|
14310
14380
|
}
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
}
|
|
14315
|
-
}
|
|
14381
|
+
const createMathSuperScriptProperties = () => new BuilderElement({
|
|
14382
|
+
name: "m:sSupPr"
|
|
14383
|
+
});
|
|
14316
14384
|
class MathSuperScript extends XmlComponent {
|
|
14317
14385
|
constructor(options) {
|
|
14318
14386
|
super("m:sSup");
|
|
14319
|
-
this.root.push(
|
|
14320
|
-
this.root.push(
|
|
14321
|
-
this.root.push(
|
|
14322
|
-
}
|
|
14323
|
-
}
|
|
14324
|
-
class MathSubScriptProperties extends XmlComponent {
|
|
14325
|
-
constructor() {
|
|
14326
|
-
super("m:sSubPr");
|
|
14387
|
+
this.root.push(createMathSuperScriptProperties());
|
|
14388
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14389
|
+
this.root.push(createMathSuperScriptElement({ children: options.superScript }));
|
|
14327
14390
|
}
|
|
14328
14391
|
}
|
|
14392
|
+
const createMathSubScriptProperties = () => new BuilderElement({
|
|
14393
|
+
name: "m:sSubPr"
|
|
14394
|
+
});
|
|
14329
14395
|
class MathSubScript extends XmlComponent {
|
|
14330
14396
|
constructor(options) {
|
|
14331
14397
|
super("m:sSub");
|
|
14332
|
-
this.root.push(
|
|
14333
|
-
this.root.push(
|
|
14334
|
-
this.root.push(
|
|
14335
|
-
}
|
|
14336
|
-
}
|
|
14337
|
-
class MathSubSuperScriptProperties extends XmlComponent {
|
|
14338
|
-
constructor() {
|
|
14339
|
-
super("m:sSubSupPr");
|
|
14398
|
+
this.root.push(createMathSubScriptProperties());
|
|
14399
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14400
|
+
this.root.push(createMathSubScriptElement({ children: options.subScript }));
|
|
14340
14401
|
}
|
|
14341
14402
|
}
|
|
14403
|
+
const createMathSubSuperScriptProperties = () => new BuilderElement({
|
|
14404
|
+
name: "m:sSubSupPr"
|
|
14405
|
+
});
|
|
14342
14406
|
class MathSubSuperScript extends XmlComponent {
|
|
14343
14407
|
constructor(options) {
|
|
14344
14408
|
super("m:sSubSup");
|
|
14345
|
-
this.root.push(
|
|
14346
|
-
this.root.push(
|
|
14347
|
-
this.root.push(
|
|
14348
|
-
this.root.push(
|
|
14409
|
+
this.root.push(createMathSubSuperScriptProperties());
|
|
14410
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14411
|
+
this.root.push(createMathSubScriptElement({ children: options.subScript }));
|
|
14412
|
+
this.root.push(createMathSuperScriptElement({ children: options.superScript }));
|
|
14349
14413
|
}
|
|
14350
14414
|
}
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14415
|
+
const createMathPreSubSuperScriptProperties = () => new BuilderElement({
|
|
14416
|
+
name: "m:sPrePr"
|
|
14417
|
+
});
|
|
14418
|
+
class MathPreSubSuperScript extends BuilderElement {
|
|
14419
|
+
constructor({ children, subScript, superScript }) {
|
|
14420
|
+
super({
|
|
14421
|
+
name: "m:sPre",
|
|
14422
|
+
children: [
|
|
14423
|
+
createMathPreSubSuperScriptProperties(),
|
|
14424
|
+
createMathBase({ children }),
|
|
14425
|
+
createMathSubScriptElement({ children: subScript }),
|
|
14426
|
+
createMathSuperScriptElement({ children: superScript })
|
|
14427
|
+
]
|
|
14428
|
+
});
|
|
14363
14429
|
}
|
|
14364
14430
|
}
|
|
14365
14431
|
const WORKAROUND4 = "";
|
|
@@ -14398,7 +14464,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14398
14464
|
super("m:rad");
|
|
14399
14465
|
this.root.push(new MathRadicalProperties(!!options.degree));
|
|
14400
14466
|
this.root.push(new MathDegree(options.degree));
|
|
14401
|
-
this.root.push(
|
|
14467
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14402
14468
|
}
|
|
14403
14469
|
}
|
|
14404
14470
|
class MathFunctionName extends XmlComponent {
|
|
@@ -14419,83 +14485,75 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14419
14485
|
super("m:func");
|
|
14420
14486
|
this.root.push(new MathFunctionProperties());
|
|
14421
14487
|
this.root.push(new MathFunctionName(options.name));
|
|
14422
|
-
this.root.push(
|
|
14423
|
-
}
|
|
14424
|
-
}
|
|
14425
|
-
class MathBeginningCharacterAttributes extends XmlAttributeComponent {
|
|
14426
|
-
constructor() {
|
|
14427
|
-
super(...arguments);
|
|
14428
|
-
__publicField(this, "xmlKeys", { character: "m:val" });
|
|
14429
|
-
}
|
|
14430
|
-
}
|
|
14431
|
-
class MathBeginningCharacter extends XmlComponent {
|
|
14432
|
-
constructor(character) {
|
|
14433
|
-
super("m:begChr");
|
|
14434
|
-
this.root.push(new MathBeginningCharacterAttributes({ character }));
|
|
14435
|
-
}
|
|
14436
|
-
}
|
|
14437
|
-
class MathEndingCharacterAttributes extends XmlAttributeComponent {
|
|
14438
|
-
constructor() {
|
|
14439
|
-
super(...arguments);
|
|
14440
|
-
__publicField(this, "xmlKeys", { character: "m:val" });
|
|
14488
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14441
14489
|
}
|
|
14442
14490
|
}
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14491
|
+
const createMathBeginningCharacter = ({ character }) => new BuilderElement({
|
|
14492
|
+
name: "m:begChr",
|
|
14493
|
+
attributes: {
|
|
14494
|
+
character: { key: "m:val", value: character }
|
|
14447
14495
|
}
|
|
14448
|
-
}
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
this.root.push(new MathBeginningCharacter(options.beginningCharacter));
|
|
14454
|
-
this.root.push(new MathEndingCharacter(options.endingCharacter));
|
|
14455
|
-
}
|
|
14496
|
+
});
|
|
14497
|
+
const createMathEndingCharacter = ({ character }) => new BuilderElement({
|
|
14498
|
+
name: "m:endChr",
|
|
14499
|
+
attributes: {
|
|
14500
|
+
character: { key: "m:val", value: character }
|
|
14456
14501
|
}
|
|
14457
|
-
}
|
|
14502
|
+
});
|
|
14503
|
+
const createMathBracketProperties = ({ characters }) => new BuilderElement({
|
|
14504
|
+
name: "m:dPr",
|
|
14505
|
+
children: !!characters ? [
|
|
14506
|
+
createMathBeginningCharacter({ character: characters.beginningCharacter }),
|
|
14507
|
+
createMathEndingCharacter({ character: characters.endingCharacter })
|
|
14508
|
+
] : []
|
|
14509
|
+
});
|
|
14458
14510
|
class MathRoundBrackets extends XmlComponent {
|
|
14459
14511
|
constructor(options) {
|
|
14460
14512
|
super("m:d");
|
|
14461
|
-
this.root.push(
|
|
14462
|
-
this.root.push(
|
|
14513
|
+
this.root.push(createMathBracketProperties({}));
|
|
14514
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14463
14515
|
}
|
|
14464
14516
|
}
|
|
14465
14517
|
class MathSquareBrackets extends XmlComponent {
|
|
14466
14518
|
constructor(options) {
|
|
14467
14519
|
super("m:d");
|
|
14468
14520
|
this.root.push(
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14521
|
+
createMathBracketProperties({
|
|
14522
|
+
characters: {
|
|
14523
|
+
beginningCharacter: "[",
|
|
14524
|
+
endingCharacter: "]"
|
|
14525
|
+
}
|
|
14472
14526
|
})
|
|
14473
14527
|
);
|
|
14474
|
-
this.root.push(
|
|
14528
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14475
14529
|
}
|
|
14476
14530
|
}
|
|
14477
14531
|
class MathCurlyBrackets extends XmlComponent {
|
|
14478
14532
|
constructor(options) {
|
|
14479
14533
|
super("m:d");
|
|
14480
14534
|
this.root.push(
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14535
|
+
createMathBracketProperties({
|
|
14536
|
+
characters: {
|
|
14537
|
+
beginningCharacter: "{",
|
|
14538
|
+
endingCharacter: "}"
|
|
14539
|
+
}
|
|
14484
14540
|
})
|
|
14485
14541
|
);
|
|
14486
|
-
this.root.push(
|
|
14542
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14487
14543
|
}
|
|
14488
14544
|
}
|
|
14489
14545
|
class MathAngledBrackets extends XmlComponent {
|
|
14490
14546
|
constructor(options) {
|
|
14491
14547
|
super("m:d");
|
|
14492
14548
|
this.root.push(
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14549
|
+
createMathBracketProperties({
|
|
14550
|
+
characters: {
|
|
14551
|
+
beginningCharacter: "〈",
|
|
14552
|
+
endingCharacter: "〉"
|
|
14553
|
+
}
|
|
14496
14554
|
})
|
|
14497
14555
|
);
|
|
14498
|
-
this.root.push(
|
|
14556
|
+
this.root.push(createMathBase({ children: options.children }));
|
|
14499
14557
|
}
|
|
14500
14558
|
}
|
|
14501
14559
|
class TableGrid extends XmlComponent {
|
|
@@ -14854,6 +14912,21 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14854
14912
|
this.root.push(new TableLayoutAttributes({ type: type2 }));
|
|
14855
14913
|
}
|
|
14856
14914
|
}
|
|
14915
|
+
const CellSpacingType = {
|
|
14916
|
+
/** Value is in twentieths of a point */
|
|
14917
|
+
DXA: "dxa"
|
|
14918
|
+
};
|
|
14919
|
+
class TableCellSpacingElement extends XmlComponent {
|
|
14920
|
+
constructor({ type: type2 = CellSpacingType.DXA, value }) {
|
|
14921
|
+
super("w:tblCellSpacing");
|
|
14922
|
+
this.root.push(
|
|
14923
|
+
new NextAttributeComponent({
|
|
14924
|
+
type: { key: "w:type", value: type2 },
|
|
14925
|
+
value: { key: "w:w", value: measurementOrPercentValue(value) }
|
|
14926
|
+
})
|
|
14927
|
+
);
|
|
14928
|
+
}
|
|
14929
|
+
}
|
|
14857
14930
|
class TableProperties extends IgnoreIfEmptyXmlComponent {
|
|
14858
14931
|
constructor(options) {
|
|
14859
14932
|
super("w:tblPr");
|
|
@@ -14887,6 +14960,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14887
14960
|
if (options.cellMargin) {
|
|
14888
14961
|
this.root.push(new TableCellMargin(TableCellMarginElementType.TABLE, options.cellMargin));
|
|
14889
14962
|
}
|
|
14963
|
+
if (options.cellSpacing) {
|
|
14964
|
+
this.root.push(new TableCellSpacingElement(options.cellSpacing));
|
|
14965
|
+
}
|
|
14890
14966
|
}
|
|
14891
14967
|
}
|
|
14892
14968
|
class Table extends FileChild {
|
|
@@ -14902,7 +14978,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14902
14978
|
style,
|
|
14903
14979
|
borders,
|
|
14904
14980
|
alignment,
|
|
14905
|
-
visuallyRightToLeft
|
|
14981
|
+
visuallyRightToLeft,
|
|
14982
|
+
cellSpacing
|
|
14906
14983
|
}) {
|
|
14907
14984
|
super("w:tbl");
|
|
14908
14985
|
this.root.push(
|
|
@@ -14915,7 +14992,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14915
14992
|
style,
|
|
14916
14993
|
alignment,
|
|
14917
14994
|
cellMargin: margins,
|
|
14918
|
-
visuallyRightToLeft
|
|
14995
|
+
visuallyRightToLeft,
|
|
14996
|
+
cellSpacing
|
|
14919
14997
|
})
|
|
14920
14998
|
);
|
|
14921
14999
|
this.root.push(new TableGrid(columnWidths));
|
|
@@ -14981,6 +15059,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14981
15059
|
if (options.height) {
|
|
14982
15060
|
this.root.push(new TableRowHeight(options.height.value, options.height.rule));
|
|
14983
15061
|
}
|
|
15062
|
+
if (options.cellSpacing) {
|
|
15063
|
+
this.root.push(new TableCellSpacingElement(options.cellSpacing));
|
|
15064
|
+
}
|
|
14984
15065
|
}
|
|
14985
15066
|
}
|
|
14986
15067
|
class TableRow extends XmlComponent {
|
|
@@ -17526,12 +17607,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
17526
17607
|
zIndex: "z-index"
|
|
17527
17608
|
};
|
|
17528
17609
|
const formatShapeStyle = (style) => style ? Object.entries(style).map(([key, value]) => `${styleToKeyMap[key]}:${value}`).join(";") : void 0;
|
|
17529
|
-
const createShape = ({
|
|
17530
|
-
id,
|
|
17531
|
-
children,
|
|
17532
|
-
type: type2 = SHAPE_TYPE,
|
|
17533
|
-
style
|
|
17534
|
-
}) => new BuilderElement({
|
|
17610
|
+
const createShape = ({ id, children, type: type2 = SHAPE_TYPE, style }) => new BuilderElement({
|
|
17535
17611
|
name: "v:shape",
|
|
17536
17612
|
attributes: {
|
|
17537
17613
|
id: {
|
|
@@ -20248,7 +20324,26 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20248
20324
|
}
|
|
20249
20325
|
}
|
|
20250
20326
|
);
|
|
20327
|
+
const commentRelationshipCount = file.Comments.Relationships.RelationshipCount + 1;
|
|
20328
|
+
const commentXmlData = xml(
|
|
20329
|
+
this.formatter.format(file.Comments, {
|
|
20330
|
+
viewWrapper: {
|
|
20331
|
+
View: file.Comments,
|
|
20332
|
+
Relationships: file.Comments.Relationships
|
|
20333
|
+
},
|
|
20334
|
+
file,
|
|
20335
|
+
stack: []
|
|
20336
|
+
}),
|
|
20337
|
+
{
|
|
20338
|
+
indent: prettify,
|
|
20339
|
+
declaration: {
|
|
20340
|
+
standalone: "yes",
|
|
20341
|
+
encoding: "UTF-8"
|
|
20342
|
+
}
|
|
20343
|
+
}
|
|
20344
|
+
);
|
|
20251
20345
|
const documentMediaDatas = this.imageReplacer.getMediaData(documentXmlData, file.Media);
|
|
20346
|
+
const commentMediaDatas = this.imageReplacer.getMediaData(commentXmlData, file.Media);
|
|
20252
20347
|
return {
|
|
20253
20348
|
Relationships: {
|
|
20254
20349
|
data: (() => {
|
|
@@ -20581,22 +20676,41 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20581
20676
|
path: "word/settings.xml"
|
|
20582
20677
|
},
|
|
20583
20678
|
Comments: {
|
|
20584
|
-
data:
|
|
20585
|
-
this.
|
|
20586
|
-
|
|
20587
|
-
|
|
20588
|
-
|
|
20589
|
-
}),
|
|
20590
|
-
{
|
|
20591
|
-
indent: prettify,
|
|
20592
|
-
declaration: {
|
|
20593
|
-
standalone: "yes",
|
|
20594
|
-
encoding: "UTF-8"
|
|
20595
|
-
}
|
|
20596
|
-
}
|
|
20597
|
-
),
|
|
20679
|
+
data: (() => {
|
|
20680
|
+
const xmlData = this.imageReplacer.replace(commentXmlData, commentMediaDatas, commentRelationshipCount);
|
|
20681
|
+
const referenedXmlData = this.numberingReplacer.replace(xmlData, file.Numbering.ConcreteNumbering);
|
|
20682
|
+
return referenedXmlData;
|
|
20683
|
+
})(),
|
|
20598
20684
|
path: "word/comments.xml"
|
|
20599
20685
|
},
|
|
20686
|
+
CommentsRelationships: {
|
|
20687
|
+
data: (() => {
|
|
20688
|
+
commentMediaDatas.forEach((mediaData, i) => {
|
|
20689
|
+
file.Comments.Relationships.createRelationship(
|
|
20690
|
+
commentRelationshipCount + i,
|
|
20691
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
|
20692
|
+
`media/${mediaData.fileName}`
|
|
20693
|
+
);
|
|
20694
|
+
});
|
|
20695
|
+
return xml(
|
|
20696
|
+
this.formatter.format(file.Comments.Relationships, {
|
|
20697
|
+
viewWrapper: {
|
|
20698
|
+
View: file.Comments,
|
|
20699
|
+
Relationships: file.Comments.Relationships
|
|
20700
|
+
},
|
|
20701
|
+
file,
|
|
20702
|
+
stack: []
|
|
20703
|
+
}),
|
|
20704
|
+
{
|
|
20705
|
+
indent: prettify,
|
|
20706
|
+
declaration: {
|
|
20707
|
+
encoding: "UTF-8"
|
|
20708
|
+
}
|
|
20709
|
+
}
|
|
20710
|
+
);
|
|
20711
|
+
})(),
|
|
20712
|
+
path: "word/_rels/comments.xml.rels"
|
|
20713
|
+
},
|
|
20600
20714
|
FontTable: {
|
|
20601
20715
|
data: xml(
|
|
20602
20716
|
this.formatter.format(file.FontTable.View, {
|
|
@@ -20925,9 +21039,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20925
21039
|
currentNode = queue2.shift();
|
|
20926
21040
|
if (currentNode.element.name === "w:p") {
|
|
20927
21041
|
renderedParagraphs = [...renderedParagraphs, renderParagraphNode(currentNode)];
|
|
20928
|
-
} else {
|
|
20929
|
-
queue2.push(...elementsToWrapper(currentNode));
|
|
20930
21042
|
}
|
|
21043
|
+
queue2.push(...elementsToWrapper(currentNode));
|
|
20931
21044
|
}
|
|
20932
21045
|
return renderedParagraphs;
|
|
20933
21046
|
};
|
|
@@ -21005,14 +21118,21 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21005
21118
|
PARAGRAPH: "paragraph"
|
|
21006
21119
|
};
|
|
21007
21120
|
const imageReplacer = new ImageReplacer();
|
|
21121
|
+
const UTF16LE = Buffer.from([255, 254]);
|
|
21122
|
+
const UTF16BE = Buffer.from([254, 255]);
|
|
21008
21123
|
const patchDocument = (_0) => __async(this, [_0], function* ({
|
|
21009
21124
|
outputType,
|
|
21010
21125
|
data,
|
|
21011
21126
|
patches,
|
|
21012
|
-
keepOriginalStyles
|
|
21127
|
+
keepOriginalStyles,
|
|
21128
|
+
placeholderDelimiters = { start: "{{", end: "}}" },
|
|
21129
|
+
/**
|
|
21130
|
+
* Search for occurrences over patched document
|
|
21131
|
+
*/
|
|
21132
|
+
recursive = true
|
|
21013
21133
|
}) {
|
|
21014
|
-
var _a, _b, _c
|
|
21015
|
-
const zipContent = yield JSZip.loadAsync(data);
|
|
21134
|
+
var _a, _b, _c;
|
|
21135
|
+
const zipContent = data instanceof JSZip ? data : yield JSZip.loadAsync(data);
|
|
21016
21136
|
const contexts = /* @__PURE__ */ new Map();
|
|
21017
21137
|
const file = {
|
|
21018
21138
|
Media: new Media()
|
|
@@ -21023,15 +21143,20 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21023
21143
|
let hasMedia = false;
|
|
21024
21144
|
const binaryContentMap = /* @__PURE__ */ new Map();
|
|
21025
21145
|
for (const [key, value] of Object.entries(zipContent.files)) {
|
|
21146
|
+
const binaryValue = yield value.async("uint8array");
|
|
21147
|
+
const startBytes = binaryValue.slice(0, 2);
|
|
21148
|
+
if (UTF16LE.equals(startBytes) || UTF16BE.equals(startBytes)) {
|
|
21149
|
+
binaryContentMap.set(key, binaryValue);
|
|
21150
|
+
continue;
|
|
21151
|
+
}
|
|
21026
21152
|
if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
|
|
21027
|
-
binaryContentMap.set(key,
|
|
21153
|
+
binaryContentMap.set(key, binaryValue);
|
|
21028
21154
|
continue;
|
|
21029
21155
|
}
|
|
21030
21156
|
const json = toJson(yield value.async("text"));
|
|
21031
21157
|
if (key === "word/document.xml") {
|
|
21032
21158
|
const document2 = (_a = json.elements) == null ? void 0 : _a.find((i) => i.name === "w:document");
|
|
21033
|
-
if (document2) {
|
|
21034
|
-
document2.attributes = (_b = document2.attributes) != null ? _b : {};
|
|
21159
|
+
if (document2 && document2.attributes) {
|
|
21035
21160
|
for (const ns of ["mc", "wp", "r", "w15", "m"]) {
|
|
21036
21161
|
document2.attributes[`xmlns:${ns}`] = DocumentAttributeNamespaces[ns];
|
|
21037
21162
|
}
|
|
@@ -21057,8 +21182,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21057
21182
|
stack: []
|
|
21058
21183
|
};
|
|
21059
21184
|
contexts.set(key, context);
|
|
21185
|
+
if (!(placeholderDelimiters == null ? void 0 : placeholderDelimiters.start.trim()) || !(placeholderDelimiters == null ? void 0 : placeholderDelimiters.end.trim())) {
|
|
21186
|
+
throw new Error("Both start and end delimiters must be non-empty strings.");
|
|
21187
|
+
}
|
|
21188
|
+
const { start, end } = placeholderDelimiters;
|
|
21060
21189
|
for (const [patchKey, patchValue] of Object.entries(patches)) {
|
|
21061
|
-
const patchText =
|
|
21190
|
+
const patchText = `${start}${patchKey}${end}`;
|
|
21062
21191
|
while (true) {
|
|
21063
21192
|
const { didFindOccurrence } = replacer({
|
|
21064
21193
|
json,
|
|
@@ -21084,7 +21213,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21084
21213
|
context,
|
|
21085
21214
|
keepOriginalStyles
|
|
21086
21215
|
});
|
|
21087
|
-
if (!didFindOccurrence) {
|
|
21216
|
+
if (!recursive || !didFindOccurrence) {
|
|
21088
21217
|
break;
|
|
21089
21218
|
}
|
|
21090
21219
|
}
|
|
@@ -21102,7 +21231,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21102
21231
|
}
|
|
21103
21232
|
for (const { key, mediaDatas } of imageRelationshipAdditions) {
|
|
21104
21233
|
const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
|
|
21105
|
-
const relationshipsJson = (
|
|
21234
|
+
const relationshipsJson = (_b = map.get(relationshipKey)) != null ? _b : createRelationshipFile();
|
|
21106
21235
|
map.set(relationshipKey, relationshipsJson);
|
|
21107
21236
|
const index = getNextRelationshipIndex(relationshipsJson);
|
|
21108
21237
|
const newJson = imageReplacer.replace(JSON.stringify(map.get(key)), mediaDatas, index);
|
|
@@ -21119,7 +21248,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21119
21248
|
}
|
|
21120
21249
|
for (const { key, hyperlink } of hyperlinkRelationshipAdditions) {
|
|
21121
21250
|
const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
|
|
21122
|
-
const relationshipsJson = (
|
|
21251
|
+
const relationshipsJson = (_c = map.get(relationshipKey)) != null ? _c : createRelationshipFile();
|
|
21123
21252
|
map.set(relationshipKey, relationshipsJson);
|
|
21124
21253
|
appendRelationship(
|
|
21125
21254
|
relationshipsJson,
|
|
@@ -21159,7 +21288,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21159
21288
|
});
|
|
21160
21289
|
});
|
|
21161
21290
|
const toXml = (jsonObj) => {
|
|
21162
|
-
const output = libExports.js2xml(jsonObj
|
|
21291
|
+
const output = libExports.js2xml(jsonObj, {
|
|
21292
|
+
attributeValueFn: (str) => String(str).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'")
|
|
21293
|
+
// cspell:words apos
|
|
21294
|
+
});
|
|
21163
21295
|
return output;
|
|
21164
21296
|
};
|
|
21165
21297
|
const createRelationshipFile = () => ({
|
|
@@ -21182,7 +21314,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21182
21314
|
]
|
|
21183
21315
|
});
|
|
21184
21316
|
const patchDetector = (_0) => __async(this, [_0], function* ({ data }) {
|
|
21185
|
-
const zipContent = yield JSZip.loadAsync(data);
|
|
21317
|
+
const zipContent = data instanceof JSZip ? data : yield JSZip.loadAsync(data);
|
|
21186
21318
|
const patches = /* @__PURE__ */ new Set();
|
|
21187
21319
|
for (const [key, value] of Object.entries(zipContent.files)) {
|
|
21188
21320
|
if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
|
|
@@ -21235,14 +21367,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21235
21367
|
exports2.DayLong = DayLong;
|
|
21236
21368
|
exports2.DayShort = DayShort;
|
|
21237
21369
|
exports2.DeletedTextRun = DeletedTextRun;
|
|
21238
|
-
exports2.DocGridAttributes = DocGridAttributes;
|
|
21239
21370
|
exports2.Document = File;
|
|
21240
21371
|
exports2.DocumentAttributeNamespaces = DocumentAttributeNamespaces;
|
|
21241
21372
|
exports2.DocumentAttributes = DocumentAttributes;
|
|
21242
21373
|
exports2.DocumentBackground = DocumentBackground;
|
|
21243
21374
|
exports2.DocumentBackgroundAttributes = DocumentBackgroundAttributes;
|
|
21244
21375
|
exports2.DocumentDefaults = DocumentDefaults;
|
|
21245
|
-
exports2.DocumentGrid = DocumentGrid;
|
|
21246
21376
|
exports2.DocumentGridType = DocumentGridType;
|
|
21247
21377
|
exports2.DotEmphasisMark = DotEmphasisMark;
|
|
21248
21378
|
exports2.Drawing = Drawing;
|
|
@@ -21273,7 +21403,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21273
21403
|
exports2.HeadingLevel = HeadingLevel;
|
|
21274
21404
|
exports2.HeightRule = HeightRule;
|
|
21275
21405
|
exports2.HighlightColor = HighlightColor;
|
|
21276
|
-
exports2.HorizontalPosition = HorizontalPosition;
|
|
21277
21406
|
exports2.HorizontalPositionAlign = HorizontalPositionAlign;
|
|
21278
21407
|
exports2.HorizontalPositionRelativeFrom = HorizontalPositionRelativeFrom;
|
|
21279
21408
|
exports2.HpsMeasureElement = HpsMeasureElement;
|
|
@@ -21297,9 +21426,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21297
21426
|
exports2.LineNumberRestartFormat = LineNumberRestartFormat;
|
|
21298
21427
|
exports2.LineRuleType = LineRuleType;
|
|
21299
21428
|
exports2.Math = Math$1;
|
|
21300
|
-
exports2.MathAccentCharacter = MathAccentCharacter;
|
|
21301
21429
|
exports2.MathAngledBrackets = MathAngledBrackets;
|
|
21302
|
-
exports2.MathBase = MathBase;
|
|
21303
21430
|
exports2.MathCurlyBrackets = MathCurlyBrackets;
|
|
21304
21431
|
exports2.MathDegree = MathDegree;
|
|
21305
21432
|
exports2.MathDenominator = MathDenominator;
|
|
@@ -21309,27 +21436,19 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21309
21436
|
exports2.MathFunctionProperties = MathFunctionProperties;
|
|
21310
21437
|
exports2.MathIntegral = MathIntegral;
|
|
21311
21438
|
exports2.MathLimit = MathLimit;
|
|
21312
|
-
exports2.MathLimitLocation = MathLimitLocation;
|
|
21313
21439
|
exports2.MathLimitLower = MathLimitLower;
|
|
21314
21440
|
exports2.MathLimitUpper = MathLimitUpper;
|
|
21315
|
-
exports2.MathNAryProperties = MathNAryProperties;
|
|
21316
21441
|
exports2.MathNumerator = MathNumerator;
|
|
21317
21442
|
exports2.MathPreSubSuperScript = MathPreSubSuperScript;
|
|
21318
|
-
exports2.MathPreSubSuperScriptProperties = MathPreSubSuperScriptProperties;
|
|
21319
21443
|
exports2.MathRadical = MathRadical;
|
|
21320
21444
|
exports2.MathRadicalProperties = MathRadicalProperties;
|
|
21321
21445
|
exports2.MathRoundBrackets = MathRoundBrackets;
|
|
21322
21446
|
exports2.MathRun = MathRun;
|
|
21323
21447
|
exports2.MathSquareBrackets = MathSquareBrackets;
|
|
21324
21448
|
exports2.MathSubScript = MathSubScript;
|
|
21325
|
-
exports2.MathSubScriptElement = MathSubScriptElement;
|
|
21326
|
-
exports2.MathSubScriptProperties = MathSubScriptProperties;
|
|
21327
21449
|
exports2.MathSubSuperScript = MathSubSuperScript;
|
|
21328
|
-
exports2.MathSubSuperScriptProperties = MathSubSuperScriptProperties;
|
|
21329
21450
|
exports2.MathSum = MathSum;
|
|
21330
21451
|
exports2.MathSuperScript = MathSuperScript;
|
|
21331
|
-
exports2.MathSuperScriptElement = MathSuperScriptElement;
|
|
21332
|
-
exports2.MathSuperScriptProperties = MathSuperScriptProperties;
|
|
21333
21452
|
exports2.Media = Media;
|
|
21334
21453
|
exports2.MonthLong = MonthLong;
|
|
21335
21454
|
exports2.MonthShort = MonthShort;
|
|
@@ -21357,7 +21476,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21357
21476
|
exports2.PageNumberTypeAttributes = PageNumberTypeAttributes;
|
|
21358
21477
|
exports2.PageOrientation = PageOrientation;
|
|
21359
21478
|
exports2.PageReference = PageReference;
|
|
21360
|
-
exports2.PageSize = PageSize;
|
|
21361
21479
|
exports2.PageTextDirection = PageTextDirection;
|
|
21362
21480
|
exports2.PageTextDirectionType = PageTextDirectionType;
|
|
21363
21481
|
exports2.Paragraph = Paragraph;
|
|
@@ -21385,7 +21503,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21385
21503
|
exports2.ShadingType = ShadingType;
|
|
21386
21504
|
exports2.SimpleField = SimpleField;
|
|
21387
21505
|
exports2.SimpleMailMergeField = SimpleMailMergeField;
|
|
21388
|
-
exports2.SimplePos = SimplePos;
|
|
21389
21506
|
exports2.SoftHyphen = SoftHyphen;
|
|
21390
21507
|
exports2.SpaceType = SpaceType;
|
|
21391
21508
|
exports2.Spacing = Spacing;
|
|
@@ -21435,7 +21552,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21435
21552
|
exports2.VerticalAlignElement = VerticalAlignElement;
|
|
21436
21553
|
exports2.VerticalMerge = VerticalMerge;
|
|
21437
21554
|
exports2.VerticalMergeType = VerticalMergeType;
|
|
21438
|
-
exports2.VerticalPosition = VerticalPosition;
|
|
21439
21555
|
exports2.VerticalPositionAlign = VerticalPositionAlign;
|
|
21440
21556
|
exports2.VerticalPositionRelativeFrom = VerticalPositionRelativeFrom;
|
|
21441
21557
|
exports2.WORKAROUND2 = WORKAROUND2;
|
|
@@ -21456,9 +21572,24 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21456
21572
|
exports2.convertInchesToTwip = convertInchesToTwip;
|
|
21457
21573
|
exports2.convertMillimetersToTwip = convertMillimetersToTwip;
|
|
21458
21574
|
exports2.convertToXmlComponent = convertToXmlComponent;
|
|
21575
|
+
exports2.createDocumentGrid = createDocumentGrid;
|
|
21459
21576
|
exports2.createFrameProperties = createFrameProperties;
|
|
21577
|
+
exports2.createHorizontalPosition = createHorizontalPosition;
|
|
21460
21578
|
exports2.createLineNumberType = createLineNumberType;
|
|
21579
|
+
exports2.createMathAccentCharacter = createMathAccentCharacter;
|
|
21580
|
+
exports2.createMathBase = createMathBase;
|
|
21581
|
+
exports2.createMathLimitLocation = createMathLimitLocation;
|
|
21582
|
+
exports2.createMathNAryProperties = createMathNAryProperties;
|
|
21583
|
+
exports2.createMathPreSubSuperScriptProperties = createMathPreSubSuperScriptProperties;
|
|
21584
|
+
exports2.createMathSubScriptElement = createMathSubScriptElement;
|
|
21585
|
+
exports2.createMathSubScriptProperties = createMathSubScriptProperties;
|
|
21586
|
+
exports2.createMathSubSuperScriptProperties = createMathSubSuperScriptProperties;
|
|
21587
|
+
exports2.createMathSuperScriptElement = createMathSuperScriptElement;
|
|
21588
|
+
exports2.createMathSuperScriptProperties = createMathSuperScriptProperties;
|
|
21589
|
+
exports2.createPageSize = createPageSize;
|
|
21590
|
+
exports2.createSimplePos = createSimplePos;
|
|
21461
21591
|
exports2.createStringElement = createStringElement;
|
|
21592
|
+
exports2.createVerticalPosition = createVerticalPosition;
|
|
21462
21593
|
exports2.dateTimeValue = dateTimeValue;
|
|
21463
21594
|
exports2.decimalNumber = decimalNumber;
|
|
21464
21595
|
exports2.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen;
|