docx-plus 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -2289,6 +2289,57 @@
2289
2289
  }
2290
2290
  };
2291
2291
  //#endregion
2292
+ //#region src/file/paragraph/run/east-asian-layout.ts
2293
+ /**
2294
+ * East Asian layout module for WordprocessingML run properties.
2295
+ *
2296
+ * Specifies East Asian typography settings for a run, including
2297
+ * character combination, vertical text, and compression.
2298
+ *
2299
+ * Reference: ISO/IEC 29500-4, CT_EastAsianLayout
2300
+ *
2301
+ * @module
2302
+ */
2303
+ /**
2304
+ * Creates an East Asian layout element (w:eastAsianLayout) for a run.
2305
+ *
2306
+ * ## XSD Schema
2307
+ * ```xml
2308
+ * <xsd:complexType name="CT_EastAsianLayout">
2309
+ * <xsd:attribute name="id" type="ST_DecimalNumber" use="optional"/>
2310
+ * <xsd:attribute name="combine" type="s:ST_OnOff" use="optional"/>
2311
+ * <xsd:attribute name="combineBrackets" type="ST_CombineBrackets" use="optional"/>
2312
+ * <xsd:attribute name="vert" type="s:ST_OnOff" use="optional"/>
2313
+ * <xsd:attribute name="vertCompress" type="s:ST_OnOff" use="optional"/>
2314
+ * </xsd:complexType>
2315
+ * ```
2316
+ */
2317
+ const createEastAsianLayout = ({ id, combine, combineBrackets, vert, vertCompress }) => new BuilderElement({
2318
+ attributes: {
2319
+ combine: {
2320
+ key: "w:combine",
2321
+ value: combine
2322
+ },
2323
+ combineBrackets: {
2324
+ key: "w:combineBrackets",
2325
+ value: combineBrackets
2326
+ },
2327
+ id: {
2328
+ key: "w:id",
2329
+ value: id === void 0 ? void 0 : decimalNumber(id)
2330
+ },
2331
+ vert: {
2332
+ key: "w:vert",
2333
+ value: vert
2334
+ },
2335
+ vertCompress: {
2336
+ key: "w:vertCompress",
2337
+ value: vertCompress
2338
+ }
2339
+ },
2340
+ name: "w:eastAsianLayout"
2341
+ });
2342
+ //#endregion
2292
2343
  //#region src/file/paragraph/run/emphasis-mark.ts
2293
2344
  /**
2294
2345
  * Emphasis mark module for WordprocessingML run properties.
@@ -3020,6 +3071,7 @@
3020
3071
  if (options.math) this.push(new OnOffElement("w:oMath", options.math));
3021
3072
  if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
3022
3073
  if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
3074
+ if (options.eastAsianLayout) this.push(createEastAsianLayout(options.eastAsianLayout));
3023
3075
  if (options.revision) this.push(new RunPropertiesChange(options.revision));
3024
3076
  }
3025
3077
  push(item) {
@@ -8526,6 +8578,34 @@
8526
8578
  * @module
8527
8579
  */
8528
8580
  /**
8581
+ * Vertical text alignment types for paragraphs.
8582
+ *
8583
+ * Specifies the vertical alignment of text within the paragraph.
8584
+ *
8585
+ * @publicApi
8586
+ */
8587
+ const TextAlignmentType = {
8588
+ TOP: "top",
8589
+ CENTER: "center",
8590
+ BASELINE: "baseline",
8591
+ BOTTOM: "bottom",
8592
+ AUTO: "auto"
8593
+ };
8594
+ /**
8595
+ * Textbox tight wrap types for paragraphs.
8596
+ *
8597
+ * Specifies how tightly text wraps around a textbox.
8598
+ *
8599
+ * @publicApi
8600
+ */
8601
+ const TextboxTightWrapType = {
8602
+ NONE: "none",
8603
+ ALL_LINES: "allLines",
8604
+ FIRST_AND_LAST_LINE: "firstAndLastLine",
8605
+ FIRST_LINE_ONLY: "firstLineOnly",
8606
+ LAST_LINE_ONLY: "lastLineOnly"
8607
+ };
8608
+ /**
8529
8609
  * Represents paragraph properties (pPr) in a WordprocessingML document.
8530
8610
  *
8531
8611
  * The paragraph properties element specifies all formatting applied to a paragraph,
@@ -8688,6 +8768,27 @@
8688
8768
  if (options.outlineLevel !== void 0) this.push(createOutlineLevel(options.outlineLevel));
8689
8769
  if (options.suppressLineNumbers !== void 0) this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
8690
8770
  if (options.autoSpaceEastAsianText !== void 0) this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
8771
+ if (options.suppressAutoHyphens !== void 0) this.push(new OnOffElement("w:suppressAutoHyphens", options.suppressAutoHyphens));
8772
+ if (options.adjustRightInd !== void 0) this.push(new OnOffElement("w:adjustRightInd", options.adjustRightInd));
8773
+ if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
8774
+ if (options.mirrorIndents !== void 0) this.push(new OnOffElement("w:mirrorIndents", options.mirrorIndents));
8775
+ if (options.kinsoku !== void 0) this.push(new OnOffElement("w:kinsoku", options.kinsoku));
8776
+ if (options.topLinePunct !== void 0) this.push(new OnOffElement("w:topLinePunct", options.topLinePunct));
8777
+ if (options.autoSpaceDE !== void 0) this.push(new OnOffElement("w:autoSpaceDE", options.autoSpaceDE));
8778
+ if (options.textAlignment !== void 0) this.push(new BuilderElement({
8779
+ attributes: { val: {
8780
+ key: "w:val",
8781
+ value: options.textAlignment
8782
+ } },
8783
+ name: "w:textAlignment"
8784
+ }));
8785
+ if (options.textboxTightWrap !== void 0) this.push(new BuilderElement({
8786
+ attributes: { val: {
8787
+ key: "w:val",
8788
+ value: options.textboxTightWrap
8789
+ } },
8790
+ name: "w:textboxTightWrap"
8791
+ }));
8691
8792
  if (options.run) this.push(new ParagraphRunProperties(options.run));
8692
8793
  if (options.revision) this.push(new ParagraphPropertiesChange(options.revision));
8693
8794
  }
@@ -13057,6 +13158,137 @@
13057
13158
  name: "w:docGrid"
13058
13159
  });
13059
13160
  //#endregion
13161
+ //#region src/file/document/body/section-properties/properties/footnote-endnote-properties.ts
13162
+ /**
13163
+ * Footnote and endnote properties module for WordprocessingML section properties.
13164
+ *
13165
+ * Specifies footnote/endnote placement and numbering format within a section.
13166
+ *
13167
+ * Reference: ISO/IEC 29500-4, CT_FtnProps / CT_EdnProps
13168
+ *
13169
+ * @module
13170
+ */
13171
+ /**
13172
+ * Creates footnote properties element (w:footnotePr) for a section.
13173
+ *
13174
+ * ## XSD Schema
13175
+ * ```xml
13176
+ * <xsd:complexType name="CT_FtnProps">
13177
+ * <xsd:sequence>
13178
+ * <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
13179
+ * <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
13180
+ * <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
13181
+ * </xsd:sequence>
13182
+ * </xsd:complexType>
13183
+ * ```
13184
+ */
13185
+ const createFootnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
13186
+ const container = new FootnoteProperties();
13187
+ if (pos !== void 0) container.addChildElement(new BuilderElement({
13188
+ attributes: { val: {
13189
+ key: "w:val",
13190
+ value: pos
13191
+ } },
13192
+ name: "w:pos"
13193
+ }));
13194
+ if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
13195
+ attributes: {
13196
+ format: {
13197
+ key: "w:format",
13198
+ value: format
13199
+ },
13200
+ val: {
13201
+ key: "w:fmt",
13202
+ value: formatType
13203
+ }
13204
+ },
13205
+ name: "w:numFmt"
13206
+ }));
13207
+ if (numStart !== void 0) container.addChildElement(new BuilderElement({
13208
+ attributes: { val: {
13209
+ key: "w:val",
13210
+ value: decimalNumber(numStart)
13211
+ } },
13212
+ name: "w:numStart"
13213
+ }));
13214
+ if (numRestart !== void 0) container.addChildElement(new BuilderElement({
13215
+ attributes: { val: {
13216
+ key: "w:val",
13217
+ value: numRestart
13218
+ } },
13219
+ name: "w:numRestart"
13220
+ }));
13221
+ return container;
13222
+ };
13223
+ /**
13224
+ * Footnote properties container element.
13225
+ */
13226
+ var FootnoteProperties = class extends IgnoreIfEmptyXmlComponent {
13227
+ constructor() {
13228
+ super("w:footnotePr", true);
13229
+ }
13230
+ };
13231
+ /**
13232
+ * Creates endnote properties element (w:endnotePr) for a section.
13233
+ *
13234
+ * ## XSD Schema
13235
+ * ```xml
13236
+ * <xsd:complexType name="CT_EdnProps">
13237
+ * <xsd:sequence>
13238
+ * <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
13239
+ * <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
13240
+ * <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
13241
+ * </xsd:sequence>
13242
+ * </xsd:complexType>
13243
+ * ```
13244
+ */
13245
+ const createEndnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
13246
+ const container = new EndnoteProperties();
13247
+ if (pos !== void 0) container.addChildElement(new BuilderElement({
13248
+ attributes: { val: {
13249
+ key: "w:val",
13250
+ value: pos
13251
+ } },
13252
+ name: "w:pos"
13253
+ }));
13254
+ if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
13255
+ attributes: {
13256
+ format: {
13257
+ key: "w:format",
13258
+ value: format
13259
+ },
13260
+ val: {
13261
+ key: "w:fmt",
13262
+ value: formatType
13263
+ }
13264
+ },
13265
+ name: "w:numFmt"
13266
+ }));
13267
+ if (numStart !== void 0) container.addChildElement(new BuilderElement({
13268
+ attributes: { val: {
13269
+ key: "w:val",
13270
+ value: decimalNumber(numStart)
13271
+ } },
13272
+ name: "w:numStart"
13273
+ }));
13274
+ if (numRestart !== void 0) container.addChildElement(new BuilderElement({
13275
+ attributes: { val: {
13276
+ key: "w:val",
13277
+ value: numRestart
13278
+ } },
13279
+ name: "w:numRestart"
13280
+ }));
13281
+ return container;
13282
+ };
13283
+ /**
13284
+ * Endnote properties container element.
13285
+ */
13286
+ var EndnoteProperties = class extends IgnoreIfEmptyXmlComponent {
13287
+ constructor() {
13288
+ super("w:endnotePr", true);
13289
+ }
13290
+ };
13291
+ //#endregion
13060
13292
  //#region src/file/document/body/section-properties/properties/header-footer-reference.ts
13061
13293
  /**
13062
13294
  * 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.
@@ -13419,8 +13651,12 @@
13419
13651
  * });
13420
13652
  * ```
13421
13653
  */
13422
- const createPageNumberType = ({ start, formatType, separator }) => new BuilderElement({
13654
+ const createPageNumberType = ({ start, formatType, separator, chapStyle }) => new BuilderElement({
13423
13655
  attributes: {
13656
+ chapStyle: {
13657
+ key: "w:chapStyle",
13658
+ value: chapStyle === void 0 ? void 0 : decimalNumber(chapStyle)
13659
+ },
13424
13660
  formatType: {
13425
13661
  key: "w:fmt",
13426
13662
  value: formatType
@@ -13709,7 +13945,7 @@
13709
13945
  * ```
13710
13946
  */
13711
13947
  var SectionProperties = class extends XmlComponent {
13712
- 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 } = {}) {
13948
+ 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 } = {}) {
13713
13949
  super("w:sectPr");
13714
13950
  this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
13715
13951
  this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
@@ -13728,6 +13964,24 @@
13728
13964
  if (titlePage !== void 0) this.root.push(new OnOffElement("w:titlePg", titlePage));
13729
13965
  if (textDirection) this.root.push(new PageTextDirection(textDirection));
13730
13966
  if (revision) this.root.push(new SectionPropertiesChange(revision));
13967
+ if (noEndnote !== void 0) this.root.push(new OnOffElement("w:noEndnote", noEndnote));
13968
+ if (bidi !== void 0) this.root.push(new OnOffElement("w:bidi", bidi));
13969
+ if (rtlGutter !== void 0) this.root.push(new OnOffElement("w:rtlGutter", rtlGutter));
13970
+ if (paperSrc) this.root.push(new BuilderElement({
13971
+ attributes: {
13972
+ first: {
13973
+ key: "w:first",
13974
+ value: paperSrc.first === void 0 ? void 0 : decimalNumber(paperSrc.first)
13975
+ },
13976
+ other: {
13977
+ key: "w:other",
13978
+ value: paperSrc.other === void 0 ? void 0 : decimalNumber(paperSrc.other)
13979
+ }
13980
+ },
13981
+ name: "w:paperSrc"
13982
+ }));
13983
+ if (footnotePr) this.root.push(createFootnoteProperties(footnotePr));
13984
+ if (endnotePr) this.root.push(createEndnoteProperties(endnotePr));
13731
13985
  this.root.push(createDocumentGrid({
13732
13986
  charSpace,
13733
13987
  linePitch,
@@ -23405,12 +23659,14 @@
23405
23659
  exports.TableRow = TableRow;
23406
23660
  exports.TableRowProperties = TableRowProperties;
23407
23661
  exports.TableRowPropertiesChange = TableRowPropertiesChange;
23662
+ exports.TextAlignmentType = TextAlignmentType;
23408
23663
  exports.TextDirection = TextDirection;
23409
23664
  exports.TextEffect = TextEffect;
23410
23665
  exports.TextRun = TextRun;
23411
23666
  exports.TextWrappingSide = TextWrappingSide;
23412
23667
  exports.TextWrappingType = TextWrappingType;
23413
23668
  exports.Textbox = Textbox;
23669
+ exports.TextboxTightWrapType = TextboxTightWrapType;
23414
23670
  exports.ThematicBreak = ThematicBreak;
23415
23671
  exports.ThemeColor = ThemeColor;
23416
23672
  exports.ThemeFont = ThemeFont;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docx-plus",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
5
5
  "keywords": [
6
6
  "clippy",