From 2276572902bb82362344ecbed6e7b2bea1e355d6 Mon Sep 17 00:00:00 2001 From: alexbogomolov Date: Tue, 29 Oct 2019 12:55:15 +0200 Subject: [PATCH 001/147] add ability to vertically align content of section --- demo/48-vertical-align.ts | 31 +++++++++++++++++++ .../document/body/section-properties/index.ts | 1 + .../section-properties/section-properties.ts | 9 +++++- .../vertical-align/index.ts | 2 ++ .../vertical-align-attributes.ts | 12 +++++++ .../vertical-align/vertical-align.ts | 18 +++++++++++ 6 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 demo/48-vertical-align.ts create mode 100644 src/file/document/body/section-properties/vertical-align/index.ts create mode 100644 src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts create mode 100644 src/file/document/body/section-properties/vertical-align/vertical-align.ts diff --git a/demo/48-vertical-align.ts b/demo/48-vertical-align.ts new file mode 100644 index 0000000000..c22e6da45a --- /dev/null +++ b/demo/48-vertical-align.ts @@ -0,0 +1,31 @@ +// Example of making content of section vertically aligned +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, Packer, Paragraph, SectionVerticalAlignValue, TextRun } from "../build"; + +const doc = new Document(); + +doc.addSection({ + properties: { + valign: SectionVerticalAlignValue.Center, + }, + children: [ + new Paragraph({ + children: [ + new TextRun("Hello World"), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + new TextRun({ + text: "Github is the best", + bold: true, + }).tab(), + ], + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/src/file/document/body/section-properties/index.ts b/src/file/document/body/section-properties/index.ts index a8985b1249..47e56ec172 100644 --- a/src/file/document/body/section-properties/index.ts +++ b/src/file/document/body/section-properties/index.ts @@ -5,3 +5,4 @@ export * from "./page-size"; export * from "./page-number"; export * from "./page-border"; export * from "./line-number"; +export * from "./vertical-align"; diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts index 072f68acca..b4732dea32 100644 --- a/src/file/document/body/section-properties/section-properties.ts +++ b/src/file/document/body/section-properties/section-properties.ts @@ -18,6 +18,7 @@ import { IPageNumberTypeAttributes, PageNumberType } from "./page-number"; import { PageSize } from "./page-size/page-size"; import { IPageSizeAttributes, PageOrientation } from "./page-size/page-size-attributes"; import { TitlePage } from "./title-page/title-page"; +import { ISectionVerticalAlignAttributes, SectionVerticalAlign } from "./vertical-align"; export interface IHeaderFooterGroup { readonly default?: T; @@ -45,7 +46,8 @@ export type SectionPropertiesOptions = IPageSizeAttributes & IPageNumberTypeAttributes & ILineNumberAttributes & IPageBordersOptions & - ITitlePageOptions & { + ITitlePageOptions & + ISectionVerticalAlignAttributes & { readonly column?: { readonly space?: number; readonly count?: number; @@ -87,6 +89,7 @@ export class SectionProperties extends XmlComponent { pageBorderBottom, pageBorderLeft, titlePage = false, + valign, } = options; this.options = options; @@ -121,6 +124,10 @@ export class SectionProperties extends XmlComponent { if (titlePage) { this.root.push(new TitlePage()); } + + if (valign) { + this.root.push(new SectionVerticalAlign(valign)); + } } private addHeaders(headers?: IHeaderFooterGroup): void { diff --git a/src/file/document/body/section-properties/vertical-align/index.ts b/src/file/document/body/section-properties/vertical-align/index.ts new file mode 100644 index 0000000000..1f3fb76bb2 --- /dev/null +++ b/src/file/document/body/section-properties/vertical-align/index.ts @@ -0,0 +1,2 @@ +export * from "./vertical-align"; +export * from "./vertical-align-attributes"; diff --git a/src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts b/src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts new file mode 100644 index 0000000000..3e7af94460 --- /dev/null +++ b/src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts @@ -0,0 +1,12 @@ +import { XmlAttributeComponent } from "file/xml-components"; +import { SectionVerticalAlignValue } from "./vertical-align"; + +export interface ISectionVerticalAlignAttributes { + readonly valign?: SectionVerticalAlignValue; +} + +export class SectionVerticalAlignAttributes extends XmlAttributeComponent { + protected readonly xmlKeys = { + valign: "w:val", + }; +} diff --git a/src/file/document/body/section-properties/vertical-align/vertical-align.ts b/src/file/document/body/section-properties/vertical-align/vertical-align.ts new file mode 100644 index 0000000000..bde6408ddd --- /dev/null +++ b/src/file/document/body/section-properties/vertical-align/vertical-align.ts @@ -0,0 +1,18 @@ +// http://officeopenxml.com/WPsection.php + +import { XmlComponent } from "file/xml-components"; +import { SectionVerticalAlignAttributes } from "./vertical-align-attributes"; + +export enum SectionVerticalAlignValue { + Both = "both", + Bottom = "bottom", + Center = "center", + Top = "top", +} + +export class SectionVerticalAlign extends XmlComponent { + constructor(value: SectionVerticalAlignValue) { + super("w:vAlign"); + this.root.push(new SectionVerticalAlignAttributes({ valign: value })); + } +} From afd468277edff74bd6080230ee6c29f01bb7affc Mon Sep 17 00:00:00 2001 From: alexbogomolov Date: Thu, 31 Oct 2019 13:54:53 +0200 Subject: [PATCH 002/147] refactor code --- demo/48-vertical-align.ts | 2 +- .../body/section-properties/section-properties.ts | 6 +++--- .../vertical-align/vertical-align-attributes.ts | 4 ++-- .../vertical-align/vertical-align.ts | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/demo/48-vertical-align.ts b/demo/48-vertical-align.ts index c22e6da45a..a9eb7986da 100644 --- a/demo/48-vertical-align.ts +++ b/demo/48-vertical-align.ts @@ -7,7 +7,7 @@ const doc = new Document(); doc.addSection({ properties: { - valign: SectionVerticalAlignValue.Center, + verticalAlign: SectionVerticalAlignValue.CENTER, }, children: [ new Paragraph({ diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts index b4732dea32..37e09e4498 100644 --- a/src/file/document/body/section-properties/section-properties.ts +++ b/src/file/document/body/section-properties/section-properties.ts @@ -89,7 +89,7 @@ export class SectionProperties extends XmlComponent { pageBorderBottom, pageBorderLeft, titlePage = false, - valign, + verticalAlign, } = options; this.options = options; @@ -125,8 +125,8 @@ export class SectionProperties extends XmlComponent { this.root.push(new TitlePage()); } - if (valign) { - this.root.push(new SectionVerticalAlign(valign)); + if (verticalAlign) { + this.root.push(new SectionVerticalAlign(verticalAlign)); } } diff --git a/src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts b/src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts index 3e7af94460..fa09712a00 100644 --- a/src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts +++ b/src/file/document/body/section-properties/vertical-align/vertical-align-attributes.ts @@ -2,11 +2,11 @@ import { XmlAttributeComponent } from "file/xml-components"; import { SectionVerticalAlignValue } from "./vertical-align"; export interface ISectionVerticalAlignAttributes { - readonly valign?: SectionVerticalAlignValue; + readonly verticalAlign?: SectionVerticalAlignValue; } export class SectionVerticalAlignAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { - valign: "w:val", + verticalAlign: "w:val", }; } diff --git a/src/file/document/body/section-properties/vertical-align/vertical-align.ts b/src/file/document/body/section-properties/vertical-align/vertical-align.ts index bde6408ddd..b025059d16 100644 --- a/src/file/document/body/section-properties/vertical-align/vertical-align.ts +++ b/src/file/document/body/section-properties/vertical-align/vertical-align.ts @@ -4,15 +4,15 @@ import { XmlComponent } from "file/xml-components"; import { SectionVerticalAlignAttributes } from "./vertical-align-attributes"; export enum SectionVerticalAlignValue { - Both = "both", - Bottom = "bottom", - Center = "center", - Top = "top", + BOTH = "both", + BOTTOM = "bottom", + CENTER = "center", + TOP = "top", } export class SectionVerticalAlign extends XmlComponent { constructor(value: SectionVerticalAlignValue) { super("w:vAlign"); - this.root.push(new SectionVerticalAlignAttributes({ valign: value })); + this.root.push(new SectionVerticalAlignAttributes({ verticalAlign: value })); } } From 8566c64eab6f601f5fc0e6fa75cf59bf9010208a Mon Sep 17 00:00:00 2001 From: alexbogomolov Date: Thu, 31 Oct 2019 17:01:17 +0200 Subject: [PATCH 003/147] improve coverage --- .../document/body/section-properties/section-properties.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/file/document/body/section-properties/section-properties.spec.ts b/src/file/document/body/section-properties/section-properties.spec.ts index abdbf9e1ed..70fc567b83 100644 --- a/src/file/document/body/section-properties/section-properties.spec.ts +++ b/src/file/document/body/section-properties/section-properties.spec.ts @@ -8,6 +8,7 @@ import { Media } from "file/media"; import { PageBorderOffsetFrom } from "./page-border"; import { PageNumberFormat } from "./page-number"; import { SectionProperties } from "./section-properties"; +import { SectionVerticalAlignValue } from "./vertical-align"; describe("SectionProperties", () => { describe("#constructor()", () => { @@ -39,6 +40,7 @@ describe("SectionProperties", () => { pageNumberStart: 10, pageNumberFormatType: PageNumberFormat.CARDINAL_TEXT, titlePage: true, + verticalAlign: SectionVerticalAlignValue.TOP, }); const tree = new Formatter().format(properties); expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); From 8eff6bd0cfb7e890b0b8520122266f74365e6853 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 1 Nov 2019 01:57:01 +0000 Subject: [PATCH 004/147] Declarative numbering work --- docs/usage/paragraph.md | 51 +- src/file/core-properties/properties.ts | 2 + src/file/file.ts | 4 +- src/file/numbering/abstract-numbering.spec.ts | 665 ++++++++++++++++++ src/file/numbering/abstract-numbering.ts | 21 +- src/file/numbering/concrete-numbering.spec.ts | 80 +++ src/file/numbering/level.ts | 235 +++---- src/file/numbering/num.ts | 2 +- src/file/numbering/numbering.spec.ts | 431 +----------- src/file/numbering/numbering.ts | 157 ++++- src/file/paragraph/paragraph.spec.ts | 24 +- src/file/paragraph/paragraph.ts | 4 +- src/file/styles/style-options.ts | 39 + src/file/styles/style/paragraph-style.ts | 55 +- 14 files changed, 1071 insertions(+), 699 deletions(-) create mode 100644 src/file/numbering/abstract-numbering.spec.ts create mode 100644 src/file/numbering/concrete-numbering.spec.ts create mode 100644 src/file/styles/style-options.ts diff --git a/docs/usage/paragraph.md b/docs/usage/paragraph.md index f681a09148..f6da3ec963 100644 --- a/docs/usage/paragraph.md +++ b/docs/usage/paragraph.md @@ -20,11 +20,7 @@ This method is useful for adding different [text](text.md) with different styles ```ts const paragraph = new Paragraph({ - children: [ - new TextRun("Lorem Ipsum Foo Bar"), - new TextRun("Hello World"), - new SymbolRun("F071"), - ], + children: [new TextRun("Lorem Ipsum Foo Bar"), new TextRun("Hello World"), new SymbolRun("F071")], }); ``` @@ -60,27 +56,27 @@ doc.addSection({ This is the list of options for a paragraph. A detailed explanation is below: -| Property | Type | Mandatory? | Possible Values | -| ----------------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- | -| [text](#text) | `string` | Optional | | -| [heading](#heading) | `HeadingLevel` | Optional | `HEADING_1`, `HEADING_2`, `HEADING_3`, `HEADING_4`, `HEADING_5`, `HEADING_6`, `TITLE` | -| [border](#border) | `IBorderOptions` | Optional | `top`, `bottom`, `left`, `right`. Each of these are of type IBorderPropertyOptions. Click here for Example | -| [spacing](#spacing) | `ISpacingProperties` | Optional | See below for ISpacingProperties | +| Property | Type | Mandatory? | Possible Values | +| ------------------------------ | ------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- | +| [text](#text) | `string` | Optional | | +| [heading](#heading) | `HeadingLevel` | Optional | `HEADING_1`, `HEADING_2`, `HEADING_3`, `HEADING_4`, `HEADING_5`, `HEADING_6`, `TITLE` | +| [border](#border) | `IBorderOptions` | Optional | `top`, `bottom`, `left`, `right`. Each of these are of type IBorderPropertyOptions. Click here for Example | +| [spacing](#spacing) | `ISpacingProperties` | Optional | See below for ISpacingProperties | | [outlineLevel](#outline-level) | `number` | Optional | | -| alignment | `AlignmentType` | Optional | | -| heading | `HeadingLevel` | Optional | | -| bidirectional | `boolean` | Optional | | -| thematicBreak | `boolean` | Optional | | -| pageBreakBefore | `boolean` | Optional | | -| contextualSpacing | `boolean` | Optional | | -| indent | `IIndentAttributesProperties` | Optional | | -| keepLines | `boolean` | Optional | | -| keepNext | `boolean` | Optional | | -| children | `(TextRun or PictureRun or Hyperlink)[]` | Optional | | -| style | `string` | Optional | | -| tabStop | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | | -| bullet | `{ level: number }` | Optional | | -| numbering | `{ num: Num; level: number; custom?: boolean }` | Optional | | +| alignment | `AlignmentType` | Optional | | +| heading | `HeadingLevel` | Optional | | +| bidirectional | `boolean` | Optional | | +| thematicBreak | `boolean` | Optional | | +| pageBreakBefore | `boolean` | Optional | | +| contextualSpacing | `boolean` | Optional | | +| indent | `IIndentAttributesProperties` | Optional | | +| keepLines | `boolean` | Optional | | +| keepNext | `boolean` | Optional | | +| children | `(TextRun or PictureRun or Hyperlink)[]` | Optional | | +| style | `string` | Optional | | +| tabStop | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | | +| bullet | `{ level: number }` | Optional | | +| numbering | `{ num: ConcreteNumbering; level: number; custom?: boolean }` | Optional | | ## Text @@ -252,10 +248,7 @@ To move to a new page (insert a page break): ```ts const paragraph = new docx.Paragraph({ - children: [ - new TextRun("Amazing Heading"), - new PageBreak(), - ] + children: [new TextRun("Amazing Heading"), new PageBreak()], }); ``` diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index a99c74d98f..e86a0732d0 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -1,6 +1,7 @@ import { XmlComponent } from "file/xml-components"; import { DocumentAttributes } from "../document/document-attributes"; +import { IAbstractNumberingOptions } from "../numbering"; import { IStylesOptions } from "../styles"; import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components"; @@ -14,6 +15,7 @@ export interface IPropertiesOptions { readonly revision?: string; readonly externalStyles?: string; readonly styles?: IStylesOptions; + readonly numbering?: IAbstractNumberingOptions; } export class CoreProperties extends XmlComponent { diff --git a/src/file/file.ts b/src/file/file.ts index ccf5fe374c..63bb272596 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -71,7 +71,9 @@ export class File { sections: ISectionOptions[] = [], ) { this.coreProperties = new CoreProperties(options); - this.numbering = new Numbering(); + this.numbering = new Numbering({ + levels: options.numbering ? options.numbering.levels : [], + }); this.docRelationships = new Relationships(); this.fileRelationships = new Relationships(); this.appProperties = new AppProperties(); diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts new file mode 100644 index 0000000000..45d7f25f0e --- /dev/null +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -0,0 +1,665 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; +import { EMPTY_OBJECT } from "file/xml-components"; + +import { AlignmentType, TabStopPosition } from "../paragraph"; +import { UnderlineType } from "../paragraph/run/underline"; +import { ShadingType } from "../table"; +import { AbstractNumbering } from "./abstract-numbering"; + +describe.only("AbstractNumbering", () => { + it("stores its ID at its .id property", () => { + const abstractNumbering = new AbstractNumbering(5, { + levels: [], + }); + expect(abstractNumbering.id).to.equal(5); + }); + + describe("#createLevel", () => { + it("creates a level with the given characteristics", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 3, + format: "lowerLetter", + text: "%1)", + alignment: AlignmentType.END, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); + expect(tree["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); + expect(tree["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "end" } } }); + expect(tree["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); + expect(tree["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); + }); + + it("uses 'start' as the default alignment", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 3, + format: "lowerLetter", + text: "%1)", + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); + expect(tree["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); + expect(tree["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "start" } } }); + expect(tree["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); + expect(tree["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); + }); + + describe("formatting methods: paragraph properties", () => { + it("#indent", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + indent: { left: 720 }, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:ind": { _attr: { "w:left": 720 } } }], + }); + }); + + it("#spacing", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + spacing: { before: 50, after: 150 }, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:spacing": { _attr: { "w:before": 50, "w:after": 150 } } }], + }); + }); + + it("#center", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.CENTER, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:jc": { _attr: { "w:val": "center" } } }], + }); + }); + + it("#left", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.LEFT, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:jc": { _attr: { "w:val": "left" } } }], + }); + }); + + it("#right", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.RIGHT, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:jc": { _attr: { "w:val": "right" } } }], + }); + }); + + it("#justified", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.JUSTIFIED, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:jc": { _attr: { "w:val": "both" } } }], + }); + }); + + it("#thematicBreak", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + thematicBreak: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [ + { + "w:pBdr": [ + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 1, + "w:val": "single", + "w:sz": 6, + }, + }, + }, + ], + }, + ], + }); + }); + + it("#leftTabStop", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + leftTabStop: 1200, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [ + { + "w:tabs": [{ "w:tab": { _attr: { "w:val": "left", "w:pos": 1200 } } }], + }, + ], + }); + }); + + it("#maxRightTabStop", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + rightTabStop: TabStopPosition.MAX, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [ + { + "w:tabs": [{ "w:tab": { _attr: { "w:val": "right", "w:pos": 9026 } } }], + }, + ], + }); + }); + + it("#keepLines", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + keepLines: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:keepLines": EMPTY_OBJECT }], + }); + }); + + it("#keepNext", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + keepNext: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:pPr": [{ "w:keepNext": EMPTY_OBJECT }], + }); + }); + }); + + describe("formatting methods: run properties", () => { + it("#size", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + size: 24, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:sz": { _attr: { "w:val": 24 } } }], + }); + }); + + it("#smallCaps", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + smallCaps: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:smallCaps": { _attr: { "w:val": true } } }], + }); + }); + + it("#allCaps", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + allCaps: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:caps": { _attr: { "w:val": true } } }], + }); + }); + + it("#strike", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + strike: true, + }, + }, + }, + ], + }); + + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:strike": { _attr: { "w:val": true } } }], + }); + }); + + it("#doubleStrike", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + doubleStrike: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:dstrike": { _attr: { "w:val": true } } }], + }); + }); + + it("#subScript", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + subScript: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "subscript" } } }], + }); + }); + + it("#superScript", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + superScript: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "superscript" } } }], + }); + }); + + it("#font", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + font: "Times", + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [ + { "w:rFonts": { _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } } }, + ], + }); + }); + + it("#bold", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + bold: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }], + }); + }); + + it("#italics", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + italics: true, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:i": { _attr: { "w:val": true } } }], + }); + }); + + it("#highlight", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + highlight: "005599", + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:highlight": { _attr: { "w:val": "005599" } } }], + }); + }); + + it("#shadow", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + shadow: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], + }); + }); + + describe("#underline", () => { + it("should set underline to 'single' if no arguments are given", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + underline: {}, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:u": { _attr: { "w:val": "single" } } }], + }); + }); + + it("should set the style if given", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + underline: { + type: UnderlineType.DOUBLE, + }, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:u": { _attr: { "w:val": "double" } } }], + }); + }); + + it("should set the style and color if given", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + underline: { + type: UnderlineType.DOUBLE, + color: "005599", + }, + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:u": { _attr: { "w:val": "double", "w:color": "005599" } } }], + }); + }); + }); + + it("#color", () => { + const abstractNumbering = new AbstractNumbering(1, { + levels: [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + color: "123456", + }, + }, + }, + ], + }); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:lvl"]).to.include({ + "w:rPr": [{ "w:color": { _attr: { "w:val": "123456" } } }], + }); + }); + }); + }); +}); diff --git a/src/file/numbering/abstract-numbering.ts b/src/file/numbering/abstract-numbering.ts index e42e2e4fc8..49b1175812 100644 --- a/src/file/numbering/abstract-numbering.ts +++ b/src/file/numbering/abstract-numbering.ts @@ -1,5 +1,6 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; -import { Level } from "./level"; + +import { ILevelsOptions, Level } from "./level"; import { MultiLevelType } from "./multi-level-type"; interface IAbstractNumberingAttributesProperties { @@ -14,10 +15,14 @@ class AbstractNumberingAttributes extends XmlAttributeComponent { + describe("#overrideLevel", () => { + let concreteNumbering; + beforeEach(() => { + concreteNumbering = new ConcreteNumbering(0, 1); + }); + + it("sets a new override level for the given level number", () => { + concreteNumbering.overrideLevel(3); + const tree = new Formatter().format(concreteNumbering); + expect(tree["w:num"]).to.include({ + "w:lvlOverride": [ + { + _attr: { + "w:ilvl": 3, + }, + }, + { + "w:lvl": { + _attr: { + "w:ilvl": 3, + "w15:tentative": 1, + }, + }, + }, + ], + }); + }); + + it("sets the startOverride element if start is given", () => { + concreteNumbering.overrideLevel(1, 9); + const tree = new Formatter().format(concreteNumbering); + expect(tree["w:num"]).to.include({ + "w:lvlOverride": [ + { + _attr: { + "w:ilvl": 1, + }, + }, + { + "w:startOverride": { + _attr: { + "w:val": 9, + }, + }, + }, + { + "w:lvl": { + _attr: { + "w:ilvl": 1, + "w15:tentative": 1, + }, + }, + }, + ], + }); + }); + + it("sets the lvl element if overrideLevel.Level is accessed", () => { + const ol = concreteNumbering.overrideLevel(1); + expect(ol.Level).to.be.instanceof(LevelForOverride); + const tree = new Formatter().format(concreteNumbering); + expect(tree["w:num"]).to.include({ + "w:lvlOverride": [ + { _attr: { "w:ilvl": 1 } }, + { + "w:lvl": { _attr: { "w15:tentative": 1, "w:ilvl": 1 } }, + }, + ], + }); + }); + }); +}); diff --git a/src/file/numbering/level.ts b/src/file/numbering/level.ts index bdc65fbba4..b9f66a89c0 100644 --- a/src/file/numbering/level.ts +++ b/src/file/numbering/level.ts @@ -2,9 +2,7 @@ import { Attributes, XmlAttributeComponent, XmlComponent } from "file/xml-compon import { Alignment, AlignmentType, - IIndentAttributesProperties, Indent, - ISpacingProperties, KeepLines, KeepNext, Spacing, @@ -15,7 +13,7 @@ import { import { ParagraphProperties } from "../paragraph/properties"; import * as formatting from "../paragraph/run/formatting"; import { RunProperties } from "../paragraph/run/properties"; -import { UnderlineType } from "../paragraph/run/underline"; +import { IParagraphStyleOptions2, IRunStyleOptions } from "../styles/style-options"; interface ILevelAttributesProperties { readonly ilvl?: number; @@ -63,7 +61,7 @@ class LevelText extends XmlComponent { } class LevelJc extends XmlComponent { - constructor(value: string) { + constructor(value: AlignmentType) { super("w:lvlJc"); this.root.push( new Attributes({ @@ -79,6 +77,19 @@ export enum LevelSuffix { TAB = "tab", } +export interface ILevelsOptions { + readonly level: number; + readonly format: string; + readonly text: string; + readonly alignment?: AlignmentType; + readonly start?: number; + readonly suffix?: LevelSuffix; + readonly style?: { + readonly run?: IRunStyleOptions; + readonly paragraph?: IParagraphStyleOptions2; + }; +} + class Suffix extends XmlComponent { constructor(value: LevelSuffix) { super("w:suff"); @@ -94,7 +105,7 @@ export class LevelBase extends XmlComponent { private readonly paragraphProperties: ParagraphProperties; private readonly runProperties: RunProperties; - constructor(level: number, start?: number, numberFormat?: string, levelText?: string, lvlJc?: string) { + constructor({ level, format, text, alignment = AlignmentType.START, start = 1, style, suffix }: ILevelsOptions) { super("w:lvl"); this.root.push( new LevelAttributes({ @@ -103,174 +114,122 @@ export class LevelBase extends XmlComponent { }), ); - if (start !== undefined) { - this.root.push(new Start(start)); - } - if (numberFormat !== undefined) { - this.root.push(new NumberFormat(numberFormat)); - } - if (levelText !== undefined) { - this.root.push(new LevelText(levelText)); - } - if (lvlJc !== undefined) { - this.root.push(new LevelJc(lvlJc)); - } + this.root.push(new Start(start)); + this.root.push(new NumberFormat(format)); + this.root.push(new LevelText(text)); + this.root.push(new LevelJc(alignment)); this.paragraphProperties = new ParagraphProperties({}); this.runProperties = new RunProperties(); this.root.push(this.paragraphProperties); this.root.push(this.runProperties); - } - public setSuffix(value: LevelSuffix): LevelBase { - this.root.push(new Suffix(value)); - return this; - } + if (suffix) { + this.root.push(new Suffix(suffix)); + } - public addParagraphProperty(property: XmlComponent): Level { - this.paragraphProperties.push(property); - return this; - } + if (style) { + if (style.run) { + if (style.run.size) { + this.runProperties.push(new formatting.Size(style.run.size)); + } - public addRunProperty(property: XmlComponent): Level { - this.runProperties.push(property); - return this; - } + if (style.run.bold) { + this.runProperties.push(new formatting.Bold()); + } - // ---------- Run formatting ---------------------- // + if (style.run.italics) { + this.runProperties.push(new formatting.Italics()); + } - public size(twips: number): Level { - this.addRunProperty(new formatting.Size(twips)); - return this; - } + if (style.run.smallCaps) { + this.runProperties.push(new formatting.SmallCaps()); + } - public bold(): Level { - this.addRunProperty(new formatting.Bold()); - return this; - } + if (style.run.allCaps) { + this.runProperties.push(new formatting.Caps()); + } - public italics(): Level { - this.addRunProperty(new formatting.Italics()); - return this; - } + if (style.run.strike) { + this.runProperties.push(new formatting.Strike()); + } - public smallCaps(): Level { - this.addRunProperty(new formatting.SmallCaps()); - return this; - } + if (style.run.doubleStrike) { + this.runProperties.push(new formatting.DoubleStrike()); + } - public allCaps(): Level { - this.addRunProperty(new formatting.Caps()); - return this; - } + if (style.run.subScript) { + this.runProperties.push(new formatting.SubScript()); + } - public strike(): Level { - this.addRunProperty(new formatting.Strike()); - return this; - } + if (style.run.superScript) { + this.runProperties.push(new formatting.SuperScript()); + } - public doubleStrike(): Level { - this.addRunProperty(new formatting.DoubleStrike()); - return this; - } + if (style.run.underline) { + this.runProperties.push(new formatting.Underline(style.run.underline.type, style.run.underline.color)); + } - public subScript(): Level { - this.addRunProperty(new formatting.SubScript()); - return this; - } + if (style.run.color) { + this.runProperties.push(new formatting.Color(style.run.color)); + } - public superScript(): Level { - this.addRunProperty(new formatting.SuperScript()); - return this; - } + if (style.run.font) { + this.runProperties.push(new formatting.RunFonts(style.run.font)); + } - public underline(underlineType?: UnderlineType, color?: string): Level { - this.addRunProperty(new formatting.Underline(underlineType, color)); - return this; - } + if (style.run.highlight) { + this.runProperties.push(new formatting.Highlight(style.run.highlight)); + } - public color(color: string): Level { - this.addRunProperty(new formatting.Color(color)); - return this; - } + if (style.run.shadow) { + this.runProperties.push(new formatting.Shading(style.run.shadow.type, style.run.shadow.fill, style.run.shadow.color)); + } + } - public font(fontName: string): Level { - this.addRunProperty(new formatting.RunFonts(fontName)); - return this; - } + if (style.paragraph) { + if (style.paragraph.alignment) { + this.paragraphProperties.push(new Alignment(style.paragraph.alignment)); + } - public highlight(color: string): Level { - this.addRunProperty(new formatting.Highlight(color)); - return this; - } + if (style.paragraph.thematicBreak) { + this.paragraphProperties.push(new ThematicBreak()); + } - public shadow(value: string, fill: string, color: string): Level { - this.addRunProperty(new formatting.Shading(value, fill, color)); - return this; - } - // --------------------- Paragraph formatting ------------------------ // + if (style.paragraph.rightTabStop) { + this.paragraphProperties.push(new TabStop(TabStopType.RIGHT, style.paragraph.rightTabStop)); + } - public center(): Level { - this.addParagraphProperty(new Alignment(AlignmentType.CENTER)); - return this; - } + if (style.paragraph.leftTabStop) { + this.paragraphProperties.push(new TabStop(TabStopType.LEFT, style.paragraph.leftTabStop)); + } - public left(): Level { - this.addParagraphProperty(new Alignment(AlignmentType.LEFT)); - return this; - } + if (style.paragraph.indent) { + this.paragraphProperties.push(new Indent(style.paragraph.indent)); + } - public right(): Level { - this.addParagraphProperty(new Alignment(AlignmentType.RIGHT)); - return this; - } + if (style.paragraph.spacing) { + this.paragraphProperties.push(new Spacing(style.paragraph.spacing)); + } - public justified(): Level { - this.addParagraphProperty(new Alignment(AlignmentType.BOTH)); - return this; - } + if (style.paragraph.keepNext) { + this.paragraphProperties.push(new KeepNext()); + } - public thematicBreak(): Level { - this.addParagraphProperty(new ThematicBreak()); - return this; - } - - public rightTabStop(position: number): Level { - return this.addParagraphProperty(new TabStop(TabStopType.RIGHT, position)); - } - - public leftTabStop(position: number): Level { - this.addParagraphProperty(new TabStop(TabStopType.LEFT, position)); - return this; - } - - public indent(attrs: IIndentAttributesProperties): Level { - this.addParagraphProperty(new Indent(attrs)); - return this; - } - - public spacing(params: ISpacingProperties): Level { - this.addParagraphProperty(new Spacing(params)); - return this; - } - - public keepNext(): Level { - this.addParagraphProperty(new KeepNext()); - return this; - } - - public keepLines(): Level { - this.addParagraphProperty(new KeepLines()); - return this; + if (style.paragraph.keepLines) { + this.paragraphProperties.push(new KeepLines()); + } + } + } } } export class Level extends LevelBase { // This is the level that sits under abstractNum. We make a // handful of properties required - constructor(level: number, numberFormat: string, levelText: string, lvlJc: string) { - super(level, 1, numberFormat, levelText, lvlJc); + constructor(options: ILevelsOptions) { + super(options); } } diff --git a/src/file/numbering/num.ts b/src/file/numbering/num.ts index bf552593aa..c19c81a39b 100644 --- a/src/file/numbering/num.ts +++ b/src/file/numbering/num.ts @@ -20,7 +20,7 @@ class NumAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { numId: "w:numId" }; } -export class Num extends XmlComponent { +export class ConcreteNumbering extends XmlComponent { public readonly id: number; constructor(numId: number, abstractNumId: number) { diff --git a/src/file/numbering/numbering.spec.ts b/src/file/numbering/numbering.spec.ts index d5f2f9e168..0c16884300 100644 --- a/src/file/numbering/numbering.spec.ts +++ b/src/file/numbering/numbering.spec.ts @@ -2,24 +2,15 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; -import { AbstractNumbering } from "./abstract-numbering"; -import { LevelForOverride } from "./level"; -import { Num } from "./num"; import { Numbering } from "./numbering"; -import { EMPTY_OBJECT } from "file/xml-components"; -import { TabStopPosition } from "../paragraph"; -import { UnderlineType } from "../paragraph/run/underline"; - describe("Numbering", () => { - let numbering: Numbering; - - beforeEach(() => { - numbering = new Numbering(); - }); - describe("#constructor", () => { it("creates a default numbering with one abstract and one concrete instance", () => { + const numbering = new Numbering({ + levels: [], + }); + const tree = new Formatter().format(numbering); expect(Object.keys(tree)).to.deep.equal(["w:numbering"]); const abstractNums = tree["w:numbering"].filter((el) => el["w:abstractNum"]); @@ -48,418 +39,4 @@ describe("Numbering", () => { }); }); }); - - describe("#createAbstractNumbering", () => { - it("returns a new AbstractNumbering instance", () => { - const a2 = numbering.createAbstractNumbering(); - expect(a2).to.be.instanceof(AbstractNumbering); - }); - - it("assigns a unique ID to each abstract numbering it creates", () => { - const a2 = numbering.createAbstractNumbering(); - const a3 = numbering.createAbstractNumbering(); - expect(a2.id).not.to.equal(a3.id); - }); - }); - - describe("#createConcreteNumbering", () => { - it("returns a new Num instance with its abstract ID set to the AbstractNumbering's ID", () => { - const a2 = numbering.createAbstractNumbering(); - const n = numbering.createConcreteNumbering(a2); - expect(n).to.be.instanceof(Num); - const tree = new Formatter().format(numbering); - const serializedN = tree["w:numbering"].find((obj) => obj["w:num"] && obj["w:num"][0]._attr["w:numId"] === n.id); - expect(serializedN["w:num"][1]["w:abstractNumId"]._attr["w:val"]).to.equal(a2.id); - }); - - it("assigns a unique ID to each concrete numbering it creates", () => { - const a2 = numbering.createAbstractNumbering(); - const n = numbering.createConcreteNumbering(a2); - const n2 = numbering.createConcreteNumbering(a2); - expect(n.id).not.to.equal(n2.id); - }); - }); -}); - -describe("AbstractNumbering", () => { - it("stores its ID at its .id property", () => { - const abstractNumbering = new AbstractNumbering(5); - expect(abstractNumbering.id).to.equal(5); - }); - - describe("#createLevel", () => { - it("creates a level with the given characteristics", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(3, "lowerLetter", "%1)", "end"); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); - expect(tree["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "end" } } }); - expect(tree["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); - }); - - it("uses 'start' as the default alignment", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(3, "lowerLetter", "%1)"); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); - expect(tree["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "start" } } }); - expect(tree["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); - }); - - describe("formatting methods: paragraph properties", () => { - it("#indent", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerLetter", "%0.").indent({ left: 720 }); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:ind": { _attr: { "w:left": 720 } } }], - }); - }); - - it("#spacing", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerLetter", "%0.").spacing({ before: 50, after: 150 }); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:spacing": { _attr: { "w:before": 50, "w:after": 150 } } }], - }); - }); - - it("#center", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerLetter", "%0.").center(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:jc": { _attr: { "w:val": "center" } } }], - }); - }); - - it("#left", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.", "left").left(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:jc": { _attr: { "w:val": "left" } } }], - }); - }); - - it("#right", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").right(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:jc": { _attr: { "w:val": "right" } } }], - }); - }); - - it("#justified", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").justified(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:jc": { _attr: { "w:val": "both" } } }], - }); - }); - - it("#thematicBreak", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").thematicBreak(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [ - { - "w:pBdr": [ - { - "w:bottom": { - _attr: { - "w:color": "auto", - "w:space": 1, - "w:val": "single", - "w:sz": 6, - }, - }, - }, - ], - }, - ], - }); - }); - - it("#leftTabStop", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").leftTabStop(1200); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [ - { - "w:tabs": [{ "w:tab": { _attr: { "w:val": "left", "w:pos": 1200 } } }], - }, - ], - }); - }); - - it("#maxRightTabStop", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").rightTabStop(TabStopPosition.MAX); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [ - { - "w:tabs": [{ "w:tab": { _attr: { "w:val": "right", "w:pos": 9026 } } }], - }, - ], - }); - }); - - it("#keepLines", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").keepLines(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:keepLines": EMPTY_OBJECT }], - }); - }); - - it("#keepNext", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").keepNext(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:pPr": [{ "w:keepNext": EMPTY_OBJECT }], - }); - }); - }); - - describe("formatting methods: run properties", () => { - it("#size", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").size(24); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:sz": { _attr: { "w:val": 24 } } }], - }); - }); - - it("#smallCaps", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").smallCaps(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:smallCaps": { _attr: { "w:val": true } } }], - }); - }); - - it("#allCaps", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").allCaps(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:caps": { _attr: { "w:val": true } } }], - }); - }); - - it("#strike", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").strike(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:strike": { _attr: { "w:val": true } } }], - }); - }); - - it("#doubleStrike", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").doubleStrike(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:dstrike": { _attr: { "w:val": true } } }], - }); - }); - - it("#subScript", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").subScript(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "subscript" } } }], - }); - }); - - it("#superScript", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").superScript(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "superscript" } } }], - }); - }); - - it("#font", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").font("Times"); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [ - { "w:rFonts": { _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } } }, - ], - }); - }); - - it("#bold", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").bold(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }], - }); - }); - - it("#italics", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").italics(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:i": { _attr: { "w:val": true } } }], - }); - }); - - it("#highlight", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").highlight("005599"); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:highlight": { _attr: { "w:val": "005599" } } }], - }); - }); - - it("#shadow", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").shadow("pct10", "00FFFF", "FF0000"); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], - }); - }); - - describe("#underline", () => { - it("should set underline to 'single' if no arguments are given", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").underline(); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:u": { _attr: { "w:val": "single" } } }], - }); - }); - - it("should set the style if given", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").underline(UnderlineType.DOUBLE); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:u": { _attr: { "w:val": "double" } } }], - }); - }); - - it("should set the style and color if given", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").underline(UnderlineType.DOUBLE, "005599"); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:u": { _attr: { "w:val": "double", "w:color": "005599" } } }], - }); - }); - }); - - it("#color", () => { - const abstractNumbering = new AbstractNumbering(1); - const level = abstractNumbering.createLevel(0, "lowerRoman", "%0.").color("123456"); - const tree = new Formatter().format(level); - expect(tree["w:lvl"]).to.include({ - "w:rPr": [{ "w:color": { _attr: { "w:val": "123456" } } }], - }); - }); - }); - }); -}); - -describe("concrete numbering", () => { - describe("#overrideLevel", () => { - let numbering; - let abstractNumbering; - let concreteNumbering; - beforeEach(() => { - numbering = new Numbering(); - abstractNumbering = numbering.createAbstractNumbering(); - concreteNumbering = numbering.createConcreteNumbering(abstractNumbering); - }); - - it("sets a new override level for the given level number", () => { - concreteNumbering.overrideLevel(3); - const tree = new Formatter().format(concreteNumbering); - expect(tree["w:num"]).to.include({ - "w:lvlOverride": [ - { - _attr: { - "w:ilvl": 3, - }, - }, - { - "w:lvl": { - _attr: { - "w:ilvl": 3, - "w15:tentative": 1, - }, - }, - }, - ], - }); - }); - - it("sets the startOverride element if start is given", () => { - concreteNumbering.overrideLevel(1, 9); - const tree = new Formatter().format(concreteNumbering); - expect(tree["w:num"]).to.include({ - "w:lvlOverride": [ - { - _attr: { - "w:ilvl": 1, - }, - }, - { - "w:startOverride": { - _attr: { - "w:val": 9, - }, - }, - }, - { - "w:lvl": { - _attr: { - "w:ilvl": 1, - "w15:tentative": 1, - }, - }, - }, - ], - }); - }); - - it("sets the lvl element if overrideLevel.Level is accessed", () => { - const ol = concreteNumbering.overrideLevel(1); - expect(ol.Level).to.be.instanceof(LevelForOverride); - const tree = new Formatter().format(concreteNumbering); - expect(tree["w:num"]).to.include({ - "w:lvlOverride": [ - { _attr: { "w:ilvl": 1 } }, - { - "w:lvl": { _attr: { "w15:tentative": 1, "w:ilvl": 1 } }, - }, - ], - }); - }); - }); }); diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index 0080b6b349..891aa2ab3a 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -1,8 +1,10 @@ -import { Indent } from "file/paragraph"; +// http://officeopenxml.com/WPnumbering.php +import { AlignmentType } from "file/paragraph"; import { IXmlableObject, XmlComponent } from "file/xml-components"; + import { DocumentAttributes } from "../document/document-attributes"; -import { AbstractNumbering } from "./abstract-numbering"; -import { Num } from "./num"; +import { AbstractNumbering, IAbstractNumberingOptions } from "./abstract-numbering"; +import { ConcreteNumbering } from "./num"; export class Numbering extends XmlComponent { // tslint:disable-next-line:readonly-keyword @@ -11,7 +13,7 @@ export class Numbering extends XmlComponent { private readonly abstractNumbering: XmlComponent[] = []; private readonly concreteNumbering: XmlComponent[] = []; - constructor() { + constructor(options: IAbstractNumberingOptions) { super("w:numbering"); this.root.push( new DocumentAttributes({ @@ -37,39 +39,114 @@ export class Numbering extends XmlComponent { this.nextId = 0; - const abstractNumbering = this.createAbstractNumbering(); - - abstractNumbering.createLevel(0, "bullet", "\u25CF", "left").addParagraphProperty(new Indent({ left: 720, hanging: 360 })); - - abstractNumbering.createLevel(1, "bullet", "\u25CB", "left").addParagraphProperty(new Indent({ left: 1440, hanging: 360 })); - - abstractNumbering.createLevel(2, "bullet", "\u25A0", "left").addParagraphProperty(new Indent({ left: 2160, hanging: 360 })); - - abstractNumbering.createLevel(3, "bullet", "\u25CF", "left").addParagraphProperty(new Indent({ left: 2880, hanging: 360 })); - - abstractNumbering.createLevel(4, "bullet", "\u25CB", "left").addParagraphProperty(new Indent({ left: 3600, hanging: 360 })); - - abstractNumbering.createLevel(5, "bullet", "\u25A0", "left").addParagraphProperty(new Indent({ left: 4320, hanging: 360 })); - - abstractNumbering.createLevel(6, "bullet", "\u25CF", "left").addParagraphProperty(new Indent({ left: 5040, hanging: 360 })); - - abstractNumbering.createLevel(7, "bullet", "\u25CB", "left").addParagraphProperty(new Indent({ left: 5760, hanging: 360 })); - - abstractNumbering.createLevel(8, "bullet", "\u25A0", "left").addParagraphProperty(new Indent({ left: 6480, hanging: 360 })); + const abstractNumbering = this.createAbstractNumbering({ + levels: [ + { + level: 0, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 720, hanging: 360 }, + }, + }, + }, + { + level: 1, + format: "bullet", + text: "\u25CB", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 1440, hanging: 360 }, + }, + }, + }, + { + level: 2, + format: "bullet", + text: "\u25A0", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 2160, hanging: 360 }, + }, + }, + }, + { + level: 3, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 2880, hanging: 360 }, + }, + }, + }, + { + level: 4, + format: "bullet", + text: "\u25CB", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 3600, hanging: 360 }, + }, + }, + }, + { + level: 5, + format: "bullet", + text: "\u25A0", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 4320, hanging: 360 }, + }, + }, + }, + { + level: 6, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 5040, hanging: 360 }, + }, + }, + }, + { + level: 7, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 5760, hanging: 360 }, + }, + }, + }, + { + level: 8, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 6480, hanging: 360 }, + }, + }, + }, + ], + }); this.createConcreteNumbering(abstractNumbering); - } - public createAbstractNumbering(): AbstractNumbering { - const num = new AbstractNumbering(this.nextId++); - this.abstractNumbering.push(num); - return num; - } - - public createConcreteNumbering(abstractNumbering: AbstractNumbering): Num { - const num = new Num(this.nextId++, abstractNumbering.id); - this.concreteNumbering.push(num); - return num; + const currentAbstractNumbering = this.createAbstractNumbering(options); + this.createConcreteNumbering(currentAbstractNumbering); } public prepForXml(): IXmlableObject | undefined { @@ -77,4 +154,16 @@ export class Numbering extends XmlComponent { this.concreteNumbering.forEach((x) => this.root.push(x)); return super.prepForXml(); } + + private createConcreteNumbering(abstractNumbering: AbstractNumbering): ConcreteNumbering { + const num = new ConcreteNumbering(this.nextId++, abstractNumbering.id); + this.concreteNumbering.push(num); + return num; + } + + private createAbstractNumbering(options: IAbstractNumberingOptions): AbstractNumbering { + const num = new AbstractNumbering(this.nextId++, options); + this.abstractNumbering.push(num); + return num; + } } diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index e8e5f6c8c9..013bf59f5d 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -596,10 +596,15 @@ describe("Paragraph", () => { describe("#setNumbering", () => { it("should add list paragraph style to JSON", () => { - const numbering = new Numbering(); - const numberedAbstract = numbering.createAbstractNumbering(); - numberedAbstract.createLevel(0, "lowerLetter", "%1)", "start"); - const letterNumbering = numbering.createConcreteNumbering(numberedAbstract); + const numbering = new Numbering({ + levels: [ + { + level: 0, + format: "lowerLetter", + text: "%1)", + }, + ], + }); const paragraph = new Paragraph({ numbering: { @@ -622,9 +627,16 @@ describe("Paragraph", () => { }); it("it should add numbered properties", () => { - const numbering = new Numbering(); + const numbering = new Numbering({ + levels: [ + { + level: 0, + format: "lowerLetter", + text: "%1)", + }, + ], + }); const numberedAbstract = numbering.createAbstractNumbering(); - numberedAbstract.createLevel(0, "lowerLetter", "%1)", "start"); const letterNumbering = numbering.createConcreteNumbering(numberedAbstract); const paragraph = new Paragraph({ diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index b11393ee37..1a26a7c666 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -1,6 +1,6 @@ // http://officeopenxml.com/WPparagraph.php import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; -import { Num } from "file/numbering/num"; +import { ConcreteNumbering } from "file/numbering/num"; import { XmlComponent } from "file/xml-components"; import { Alignment, AlignmentType } from "./formatting/alignment"; @@ -41,7 +41,7 @@ export interface IParagraphOptions { readonly level: number; }; readonly numbering?: { - readonly num: Num; + readonly num: ConcreteNumbering; readonly level: number; readonly custom?: boolean; }; diff --git a/src/file/styles/style-options.ts b/src/file/styles/style-options.ts new file mode 100644 index 0000000000..dcedadbec5 --- /dev/null +++ b/src/file/styles/style-options.ts @@ -0,0 +1,39 @@ +import { AlignmentType, IIndentAttributesProperties, ISpacingProperties, UnderlineType } from "../paragraph"; +import { ShadingType } from "../table"; + +export interface IRunStyleOptions { + readonly size?: number; + readonly bold?: boolean; + readonly italics?: boolean; + readonly smallCaps?: boolean; + readonly allCaps?: boolean; + readonly strike?: boolean; + readonly doubleStrike?: boolean; + readonly subScript?: boolean; + readonly superScript?: boolean; + readonly underline?: { + readonly type?: UnderlineType; + readonly color?: string; + }; + readonly color?: string; + readonly font?: string; + readonly characterSpacing?: number; + readonly highlight?: string; + readonly shadow?: { + readonly type: ShadingType; + readonly fill: string; + readonly color: string; + }; +} + +export interface IParagraphStyleOptions2 { + readonly alignment?: AlignmentType; + readonly thematicBreak?: boolean; + readonly rightTabStop?: number; + readonly leftTabStop?: number; + readonly indent?: IIndentAttributesProperties; + readonly spacing?: ISpacingProperties; + readonly keepNext?: boolean; + readonly keepLines?: boolean; + readonly outlineLevel?: number; +} diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index ab592a9fc6..a47a33f492 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -1,21 +1,9 @@ -import { - Alignment, - AlignmentType, - Indent, - ISpacingProperties, - KeepLines, - KeepNext, - OutlineLevel, - ParagraphProperties, - Spacing, - ThematicBreak, -} from "file/paragraph"; -import { IIndentAttributesProperties, TabStop, TabStopType } from "file/paragraph/formatting"; +import { Alignment, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph"; +import { TabStop, TabStopType } from "file/paragraph/formatting"; import * as formatting from "file/paragraph/run/formatting"; import { RunProperties } from "file/paragraph/run/properties"; -import { UnderlineType } from "file/paragraph/run/underline"; -import { ShadingType } from "file/table"; +import { IParagraphStyleOptions2, IRunStyleOptions } from "../style-options"; import { BasedOn, Link, Next, QuickFormat, SemiHidden, UiPriority, UnhideWhenUsed } from "./components"; import { Style } from "./style"; @@ -27,41 +15,8 @@ export interface IBaseParagraphStyleOptions { readonly semiHidden?: boolean; readonly uiPriority?: number; readonly unhideWhenUsed?: boolean; - readonly run?: { - readonly size?: number; - readonly bold?: boolean; - readonly italics?: boolean; - readonly smallCaps?: boolean; - readonly allCaps?: boolean; - readonly strike?: boolean; - readonly doubleStrike?: boolean; - readonly subScript?: boolean; - readonly superScript?: boolean; - readonly underline?: { - readonly type?: UnderlineType; - readonly color?: string; - }; - readonly color?: string; - readonly font?: string; - readonly characterSpacing?: number; - readonly highlight?: string; - readonly shadow?: { - readonly type: ShadingType; - readonly fill: string; - readonly color: string; - }; - }; - readonly paragraph?: { - readonly alignment?: AlignmentType; - readonly thematicBreak?: boolean; - readonly rightTabStop?: number; - readonly leftTabStop?: number; - readonly indent?: IIndentAttributesProperties; - readonly spacing?: ISpacingProperties; - readonly keepNext?: boolean; - readonly keepLines?: boolean; - readonly outlineLevel?: number; - }; + readonly run?: IRunStyleOptions; + readonly paragraph?: IParagraphStyleOptions2; } export interface IParagraphStyleOptions extends IBaseParagraphStyleOptions { From 617af8706504a9a789e06b29d2d4e1c84c09cee9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2019 15:07:36 +0000 Subject: [PATCH 005/147] Bump lodash from 4.17.11 to 4.17.15 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15) Signed-off-by: dependabot[bot] --- package-lock.json | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 90cf8f386f..1313298723 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,12 +31,6 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -151,12 +145,6 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -176,12 +164,6 @@ "to-fast-properties": "^2.0.0" }, "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -4542,9 +4524,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, "lodash.assign": { From a622c210efc701a8356db9db9986851de77b8f48 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Mon, 4 Nov 2019 20:19:09 +0000 Subject: [PATCH 006/147] Progress on declaritive numbering --- src/export/packer/numbering-replacer.ts | 0 src/file/paragraph/paragraph.spec.ts | 2 -- 2 files changed, 2 deletions(-) create mode 100644 src/export/packer/numbering-replacer.ts diff --git a/src/export/packer/numbering-replacer.ts b/src/export/packer/numbering-replacer.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index 013bf59f5d..d4c7fc81e9 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -636,8 +636,6 @@ describe("Paragraph", () => { }, ], }); - const numberedAbstract = numbering.createAbstractNumbering(); - const letterNumbering = numbering.createConcreteNumbering(numberedAbstract); const paragraph = new Paragraph({ numbering: { From 9b40b5e55e9bdfa6bffe4d3e856c76a90b02f375 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 6 Nov 2019 20:54:39 +0000 Subject: [PATCH 007/147] Add work for custom level id --- src/file/numbering/abstract-numbering.spec.ts | 76 +++++++++---------- src/file/numbering/concrete-numbering.spec.ts | 37 +++++---- src/file/numbering/level.ts | 14 +++- src/file/numbering/num.ts | 4 +- .../paragraph/formatting/unordered-list.ts | 6 +- src/file/paragraph/paragraph.spec.ts | 30 +------- src/file/paragraph/paragraph.ts | 5 +- 7 files changed, 77 insertions(+), 95 deletions(-) diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index 45d7f25f0e..6552775cd5 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -8,7 +8,7 @@ import { UnderlineType } from "../paragraph/run/underline"; import { ShadingType } from "../table"; import { AbstractNumbering } from "./abstract-numbering"; -describe.only("AbstractNumbering", () => { +describe("AbstractNumbering", () => { it("stores its ID at its .id property", () => { const abstractNumbering = new AbstractNumbering(5, { levels: [], @@ -29,11 +29,11 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); - expect(tree["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "end" } } }); - expect(tree["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "end" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); }); it("uses 'start' as the default alignment", () => { @@ -47,11 +47,11 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); - expect(tree["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "start" } } }); - expect(tree["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); - expect(tree["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "start" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); }); describe("formatting methods: paragraph properties", () => { @@ -71,7 +71,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:ind": { _attr: { "w:left": 720 } } }], }); }); @@ -92,7 +92,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:spacing": { _attr: { "w:before": 50, "w:after": 150 } } }], }); }); @@ -113,7 +113,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "center" } } }], }); }); @@ -134,7 +134,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "left" } } }], }); }); @@ -155,7 +155,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "right" } } }], }); }); @@ -176,7 +176,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "both" } } }], }); }); @@ -197,7 +197,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [ { "w:pBdr": [ @@ -233,7 +233,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [ { "w:tabs": [{ "w:tab": { _attr: { "w:val": "left", "w:pos": 1200 } } }], @@ -258,7 +258,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [ { "w:tabs": [{ "w:tab": { _attr: { "w:val": "right", "w:pos": 9026 } } }], @@ -283,7 +283,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:keepLines": EMPTY_OBJECT }], }); }); @@ -304,7 +304,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:keepNext": EMPTY_OBJECT }], }); }); @@ -327,7 +327,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:sz": { _attr: { "w:val": 24 } } }], }); }); @@ -348,7 +348,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:smallCaps": { _attr: { "w:val": true } } }], }); }); @@ -369,7 +369,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:caps": { _attr: { "w:val": true } } }], }); }); @@ -391,7 +391,7 @@ describe.only("AbstractNumbering", () => { }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:strike": { _attr: { "w:val": true } } }], }); }); @@ -412,7 +412,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:dstrike": { _attr: { "w:val": true } } }], }); }); @@ -433,7 +433,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "subscript" } } }], }); }); @@ -454,7 +454,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "superscript" } } }], }); }); @@ -475,7 +475,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [ { "w:rFonts": { _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } } }, ], @@ -498,7 +498,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }], }); }); @@ -519,7 +519,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:i": { _attr: { "w:val": true } } }], }); }); @@ -540,7 +540,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:highlight": { _attr: { "w:val": "005599" } } }], }); }); @@ -565,7 +565,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], }); }); @@ -587,7 +587,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:u": { _attr: { "w:val": "single" } } }], }); }); @@ -610,7 +610,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:u": { _attr: { "w:val": "double" } } }], }); }); @@ -634,7 +634,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:u": { _attr: { "w:val": "double", "w:color": "005599" } } }], }); }); @@ -656,7 +656,7 @@ describe.only("AbstractNumbering", () => { ], }); const tree = new Formatter().format(abstractNumbering); - expect(tree["w:lvl"]).to.include({ + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:color": { _attr: { "w:val": "123456" } } }], }); }); diff --git a/src/file/numbering/concrete-numbering.spec.ts b/src/file/numbering/concrete-numbering.spec.ts index dd15fb5431..42ccc87f2b 100644 --- a/src/file/numbering/concrete-numbering.spec.ts +++ b/src/file/numbering/concrete-numbering.spec.ts @@ -7,7 +7,7 @@ import { ConcreteNumbering } from "./num"; describe("ConcreteNumbering", () => { describe("#overrideLevel", () => { - let concreteNumbering; + let concreteNumbering: ConcreteNumbering; beforeEach(() => { concreteNumbering = new ConcreteNumbering(0, 1); }); @@ -17,18 +17,13 @@ describe("ConcreteNumbering", () => { const tree = new Formatter().format(concreteNumbering); expect(tree["w:num"]).to.include({ "w:lvlOverride": [ + { _attr: { "w:ilvl": 3 } }, { - _attr: { - "w:ilvl": 3, - }, - }, - { - "w:lvl": { - _attr: { - "w:ilvl": 3, - "w15:tentative": 1, - }, - }, + "w:lvl": [ + { _attr: { "w:ilvl": 3, "w15:tentative": 1 } }, + { "w:start": { _attr: { "w:val": 1 } } }, + { "w:lvlJc": { _attr: { "w:val": "start" } } }, + ], }, ], }); @@ -52,12 +47,11 @@ describe("ConcreteNumbering", () => { }, }, { - "w:lvl": { - _attr: { - "w:ilvl": 1, - "w15:tentative": 1, - }, - }, + "w:lvl": [ + { _attr: { "w:ilvl": 1, "w15:tentative": 1 } }, + { "w:start": { _attr: { "w:val": 1 } } }, + { "w:lvlJc": { _attr: { "w:val": "start" } } }, + ], }, ], }); @@ -67,11 +61,16 @@ describe("ConcreteNumbering", () => { const ol = concreteNumbering.overrideLevel(1); expect(ol.Level).to.be.instanceof(LevelForOverride); const tree = new Formatter().format(concreteNumbering); + expect(tree["w:num"]).to.include({ "w:lvlOverride": [ { _attr: { "w:ilvl": 1 } }, { - "w:lvl": { _attr: { "w15:tentative": 1, "w:ilvl": 1 } }, + "w:lvl": [ + { _attr: { "w:ilvl": 1, "w15:tentative": 1 } }, + { "w:start": { _attr: { "w:val": 1 } } }, + { "w:lvlJc": { _attr: { "w:val": "start" } } }, + ], }, ], }); diff --git a/src/file/numbering/level.ts b/src/file/numbering/level.ts index b9f66a89c0..cbef58dfc0 100644 --- a/src/file/numbering/level.ts +++ b/src/file/numbering/level.ts @@ -79,8 +79,8 @@ export enum LevelSuffix { export interface ILevelsOptions { readonly level: number; - readonly format: string; - readonly text: string; + readonly format?: string; + readonly text?: string; readonly alignment?: AlignmentType; readonly start?: number; readonly suffix?: LevelSuffix; @@ -115,10 +115,16 @@ export class LevelBase extends XmlComponent { ); this.root.push(new Start(start)); - this.root.push(new NumberFormat(format)); - this.root.push(new LevelText(text)); this.root.push(new LevelJc(alignment)); + if (format) { + this.root.push(new NumberFormat(format)); + } + + if (text) { + this.root.push(new LevelText(text)); + } + this.paragraphProperties = new ParagraphProperties({}); this.runProperties = new RunProperties(); diff --git a/src/file/numbering/num.ts b/src/file/numbering/num.ts index c19c81a39b..dac54fe668 100644 --- a/src/file/numbering/num.ts +++ b/src/file/numbering/num.ts @@ -55,7 +55,9 @@ export class LevelOverride extends XmlComponent { this.root.push(new StartOverride(start)); } - this.lvl = new LevelForOverride(this.levelNum); + this.lvl = new LevelForOverride({ + level: this.levelNum, + }); this.root.push(this.lvl); } diff --git a/src/file/paragraph/formatting/unordered-list.ts b/src/file/paragraph/formatting/unordered-list.ts index 0b6c4daae0..f7650fc844 100644 --- a/src/file/paragraph/formatting/unordered-list.ts +++ b/src/file/paragraph/formatting/unordered-list.ts @@ -1,7 +1,7 @@ import { Attributes, XmlComponent } from "file/xml-components"; export class NumberProperties extends XmlComponent { - constructor(numberId: number, indentLevel: number) { + constructor(numberId: number | string, indentLevel: number) { super("w:numPr"); this.root.push(new IndentLevel(indentLevel)); this.root.push(new NumberId(numberId)); @@ -20,11 +20,11 @@ class IndentLevel extends XmlComponent { } class NumberId extends XmlComponent { - constructor(id: number) { + constructor(id: number | string) { super("w:numId"); this.root.push( new Attributes({ - val: id, + val: typeof id === "string" ? `__${id}__` : id, }), ); } diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index d4c7fc81e9..99c8efb0c0 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -3,7 +3,6 @@ import { assert, expect } from "chai"; import { Formatter } from "export/formatter"; import { EMPTY_OBJECT } from "file/xml-components"; -import { Numbering } from "../numbering"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; import { Paragraph } from "./paragraph"; @@ -596,19 +595,9 @@ describe("Paragraph", () => { describe("#setNumbering", () => { it("should add list paragraph style to JSON", () => { - const numbering = new Numbering({ - levels: [ - { - level: 0, - format: "lowerLetter", - text: "%1)", - }, - ], - }); - const paragraph = new Paragraph({ numbering: { - num: letterNumbering, + reference: "test id", level: 0, }, }); @@ -627,19 +616,9 @@ describe("Paragraph", () => { }); it("it should add numbered properties", () => { - const numbering = new Numbering({ - levels: [ - { - level: 0, - format: "lowerLetter", - text: "%1)", - }, - ], - }); - const paragraph = new Paragraph({ numbering: { - num: letterNumbering, + reference: "test id", level: 0, }, }); @@ -650,10 +629,7 @@ describe("Paragraph", () => { "w:pPr": [ { "w:pStyle": { _attr: { "w:val": "ListParagraph" } } }, { - "w:numPr": [ - { "w:ilvl": { _attr: { "w:val": 0 } } }, - { "w:numId": { _attr: { "w:val": letterNumbering.id } } }, - ], + "w:numPr": [{ "w:ilvl": { _attr: { "w:val": 0 } } }, { "w:numId": { _attr: { "w:val": "__test id__" } } }], }, ], }, diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index 1a26a7c666..1defd01779 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -1,6 +1,5 @@ // http://officeopenxml.com/WPparagraph.php import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; -import { ConcreteNumbering } from "file/numbering/num"; import { XmlComponent } from "file/xml-components"; import { Alignment, AlignmentType } from "./formatting/alignment"; @@ -41,7 +40,7 @@ export interface IParagraphOptions { readonly level: number; }; readonly numbering?: { - readonly num: ConcreteNumbering; + readonly reference: string; readonly level: number; readonly custom?: boolean; }; @@ -141,7 +140,7 @@ export class Paragraph extends XmlComponent { if (!options.numbering.custom) { this.properties.push(new Style("ListParagraph")); } - this.properties.push(new NumberProperties(options.numbering.num.id, options.numbering.level)); + this.properties.push(new NumberProperties(options.numbering.reference, options.numbering.level)); } if (options.children) { From 643e3c2f8493c2e199dd70cfb84ac49ff59e8986 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 8 Nov 2019 03:11:19 +0000 Subject: [PATCH 008/147] Finish making numbering declarative --- demo/2-declaritive-styles.ts | 30 +- demo/29-numbered-lists.ts | 40 +- demo/3-numbering-and-bullet-points.ts | 64 +- src/export/packer/next-compiler.ts | 6 +- src/export/packer/numbering-replacer.ts | 17 + src/file/core-properties/properties.ts | 4 +- src/file/file.ts | 10 +- src/file/numbering/abstract-numbering.spec.ts | 644 ++++++++---------- src/file/numbering/abstract-numbering.ts | 8 +- src/file/numbering/num.ts | 2 +- src/file/numbering/numbering.spec.ts | 2 +- src/file/numbering/numbering.ts | 200 +++--- .../paragraph/formatting/unordered-list.ts | 2 +- src/file/paragraph/paragraph.spec.ts | 2 +- 14 files changed, 530 insertions(+), 501 deletions(-) diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index 34d7e19e70..472b916091 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -1,7 +1,7 @@ // Example on how to customise the look at feel using Styles // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HeadingLevel, Packer, Paragraph, TextRun, UnderlineType } from "../build"; +import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, TextRun, UnderlineType } from "../build"; const doc = new Document({ creator: "Clippy", @@ -83,15 +83,23 @@ const doc = new Document({ }, ], }, + numbering: { + config: [ + { + reference: "my-crazy-numbering", + levels: [ + { + level: 0, + format: "lowerLetter", + text: "%1)", + alignment: AlignmentType.LEFT, + }, + ], + }, + ], + }, }); -const numberedAbstract = doc.Numbering.createAbstractNumbering(); -numberedAbstract.createLevel(0, "lowerLetter", "%1)", "left"); - -const letterNumbering = doc.Numbering.createConcreteNumbering(numberedAbstract); -const letterNumbering5 = doc.Numbering.createConcreteNumbering(numberedAbstract); -letterNumbering5.overrideLevel(0, 5); - doc.addSection({ children: [ new Paragraph({ @@ -106,21 +114,21 @@ doc.addSection({ new Paragraph({ text: "Option1", numbering: { - num: letterNumbering, + reference: "my-crazy-numbering", level: 0, }, }), new Paragraph({ text: "Option5 -- override 2 to 5", numbering: { - num: letterNumbering, + reference: "my-crazy-numbering", level: 0, }, }), new Paragraph({ text: "Option3", numbering: { - num: letterNumbering, + reference: "my-crazy-numbering", level: 0, }, }), diff --git a/demo/29-numbered-lists.ts b/demo/29-numbered-lists.ts index 740320e5f8..18da5cc359 100644 --- a/demo/29-numbered-lists.ts +++ b/demo/29-numbered-lists.ts @@ -1,23 +1,37 @@ // Numbered lists // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Numbering, Packer, Paragraph } from "../build"; +import { AlignmentType, Document, Packer, Paragraph } from "../build"; -const doc = new Document(); - -const numbering = new Numbering(); - -const abstractNum = numbering.createAbstractNumbering(); -abstractNum.createLevel(0, "upperRoman", "%1", "start").indent({ left: 720, hanging: 260 }); - -const concrete = numbering.createConcreteNumbering(abstractNum); +const doc = new Document({ + numbering: { + config: [ + { + levels: [ + { + level: 0, + format: "upperRoman", + text: "%1", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 720, hanging: 260 }, + }, + }, + }, + ], + reference: "my-crazy-reference", + }, + ], + }, +}); doc.addSection({ children: [ new Paragraph({ text: "line with contextual spacing", numbering: { - num: concrete, + reference: "my-crazy-reference", level: 0, }, contextualSpacing: true, @@ -28,7 +42,7 @@ doc.addSection({ new Paragraph({ text: "line with contextual spacing", numbering: { - num: concrete, + reference: "my-crazy-reference", level: 0, }, contextualSpacing: true, @@ -39,7 +53,7 @@ doc.addSection({ new Paragraph({ text: "line without contextual spacing", numbering: { - num: concrete, + reference: "my-crazy-reference", level: 0, }, contextualSpacing: false, @@ -50,7 +64,7 @@ doc.addSection({ new Paragraph({ text: "line without contextual spacing", numbering: { - num: concrete, + reference: "my-crazy-reference", level: 0, }, contextualSpacing: false, diff --git a/demo/3-numbering-and-bullet-points.ts b/demo/3-numbering-and-bullet-points.ts index e87e6616d2..72b33d2e8e 100644 --- a/demo/3-numbering-and-bullet-points.ts +++ b/demo/3-numbering-and-bullet-points.ts @@ -1,46 +1,80 @@ // Numbering and bullet points example // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Numbering, Packer, Paragraph } from "../build"; +import { AlignmentType, Document, Packer, Paragraph } from "../build"; -const doc = new Document(); - -const numbering = new Numbering(); - -const abstractNum = numbering.createAbstractNumbering(); -abstractNum.createLevel(0, "upperRoman", "%1", "start").indent({ left: 720, hanging: 260 }); -abstractNum.createLevel(1, "decimal", "%2.", "start").indent({ left: 1440, hanging: 980 }); -abstractNum.createLevel(2, "lowerLetter", "%3)", "start").indent({ left: 2160, hanging: 1700 }); - -const concrete = numbering.createConcreteNumbering(abstractNum); +const doc = new Document({ + numbering: { + config: [ + { + reference: "my-crazy-numbering", + levels: [ + { + level: 0, + format: "upperRoman", + text: "%1", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 720, hanging: 260 }, + }, + }, + }, + { + level: 1, + format: "decimal", + text: "%2.", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 1440, hanging: 980 }, + }, + }, + }, + { + level: 2, + format: "lowerLetter", + text: "%3)", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 2160, hanging: 1700 }, + }, + }, + }, + ], + }, + ], + }, +}); doc.addSection({ children: [ new Paragraph({ text: "Hey you", numbering: { - num: concrete, + reference: "my-crazy-numbering", level: 0, }, }), new Paragraph({ text: "What's up fam", numbering: { - num: concrete, + reference: "my-crazy-numbering", level: 1, }, }), new Paragraph({ text: "Hello World 2", numbering: { - num: concrete, + reference: "my-crazy-numbering", level: 1, }, }), new Paragraph({ text: "Yeah boi", numbering: { - num: concrete, + reference: "my-crazy-numbering", level: 2, }, }), diff --git a/src/export/packer/next-compiler.ts b/src/export/packer/next-compiler.ts index 6a3e752098..bff24a8ef7 100644 --- a/src/export/packer/next-compiler.ts +++ b/src/export/packer/next-compiler.ts @@ -4,6 +4,7 @@ import * as xml from "xml"; import { File } from "file"; import { Formatter } from "../formatter"; import { ImageReplacer } from "./image-replacer"; +import { NumberingReplacer } from "./numbering-replacer"; interface IXmlifyedFile { readonly data: string; @@ -30,10 +31,12 @@ interface IXmlifyedFileMapping { export class Compiler { private readonly formatter: Formatter; private readonly imageReplacer: ImageReplacer; + private readonly numberingReplacer: NumberingReplacer; constructor() { this.formatter = new Formatter(); this.imageReplacer = new ImageReplacer(); + this.numberingReplacer = new NumberingReplacer(); } public compile(file: File, prettifyXml?: boolean): JSZip { @@ -89,8 +92,9 @@ export class Compiler { Document: { data: (() => { const xmlData = this.imageReplacer.replace(documentXmlData, documentMediaDatas, documentRelationshipCount); + const referenedXmlData = this.numberingReplacer.replace(xmlData, file.Numbering.ConcreteNumbering); - return xmlData; + return referenedXmlData; })(), path: "word/document.xml", }, diff --git a/src/export/packer/numbering-replacer.ts b/src/export/packer/numbering-replacer.ts index e69de29bb2..4ac5dcbf1d 100644 --- a/src/export/packer/numbering-replacer.ts +++ b/src/export/packer/numbering-replacer.ts @@ -0,0 +1,17 @@ +import { ConcreteNumbering } from "file"; + +export class NumberingReplacer { + public replace(xmlData: string, concreteNumberings: ConcreteNumbering[]): string { + let currentXmlData = xmlData; + + for (const concreteNumbering of concreteNumberings) { + if (!concreteNumbering.reference) { + continue; + } + + currentXmlData = currentXmlData.replace(new RegExp(`{${concreteNumbering.reference}}`, "g"), concreteNumbering.id.toString()); + } + + return currentXmlData; + } +} diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index e86a0732d0..8ac2130310 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -1,7 +1,7 @@ import { XmlComponent } from "file/xml-components"; import { DocumentAttributes } from "../document/document-attributes"; -import { IAbstractNumberingOptions } from "../numbering"; +import { INumberingOptions } from "../numbering"; import { IStylesOptions } from "../styles"; import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components"; @@ -15,7 +15,7 @@ export interface IPropertiesOptions { readonly revision?: string; readonly externalStyles?: string; readonly styles?: IStylesOptions; - readonly numbering?: IAbstractNumberingOptions; + readonly numbering?: INumberingOptions; } export class CoreProperties extends XmlComponent { diff --git a/src/file/file.ts b/src/file/file.ts index 63bb272596..6d46fdb338 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -71,9 +71,13 @@ export class File { sections: ISectionOptions[] = [], ) { this.coreProperties = new CoreProperties(options); - this.numbering = new Numbering({ - levels: options.numbering ? options.numbering.levels : [], - }); + this.numbering = new Numbering( + options.numbering + ? options.numbering + : { + config: [], + }, + ); this.docRelationships = new Relationships(); this.fileRelationships = new Relationships(); this.appProperties = new AppProperties(); diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index 6552775cd5..59655aa40e 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -10,24 +10,20 @@ import { AbstractNumbering } from "./abstract-numbering"; describe("AbstractNumbering", () => { it("stores its ID at its .id property", () => { - const abstractNumbering = new AbstractNumbering(5, { - levels: [], - }); + const abstractNumbering = new AbstractNumbering(5, []); expect(abstractNumbering.id).to.equal(5); }); describe("#createLevel", () => { it("creates a level with the given characteristics", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 3, - format: "lowerLetter", - text: "%1)", - alignment: AlignmentType.END, - }, - ], - }); + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 3, + format: "lowerLetter", + text: "%1)", + alignment: AlignmentType.END, + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); @@ -37,15 +33,13 @@ describe("AbstractNumbering", () => { }); it("uses 'start' as the default alignment", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 3, - format: "lowerLetter", - text: "%1)", - }, - ], - }); + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 3, + format: "lowerLetter", + text: "%1)", + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); @@ -56,20 +50,18 @@ describe("AbstractNumbering", () => { describe("formatting methods: paragraph properties", () => { it("#indent", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - indent: { left: 720 }, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + indent: { left: 720 }, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:ind": { _attr: { "w:left": 720 } } }], @@ -77,20 +69,18 @@ describe("AbstractNumbering", () => { }); it("#spacing", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - spacing: { before: 50, after: 150 }, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + spacing: { before: 50, after: 150 }, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:spacing": { _attr: { "w:before": 50, "w:after": 150 } } }], @@ -98,20 +88,18 @@ describe("AbstractNumbering", () => { }); it("#center", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - alignment: AlignmentType.CENTER, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.CENTER, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "center" } } }], @@ -119,20 +107,18 @@ describe("AbstractNumbering", () => { }); it("#left", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - alignment: AlignmentType.LEFT, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.LEFT, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "left" } } }], @@ -140,20 +126,18 @@ describe("AbstractNumbering", () => { }); it("#right", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - alignment: AlignmentType.RIGHT, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.RIGHT, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "right" } } }], @@ -161,20 +145,18 @@ describe("AbstractNumbering", () => { }); it("#justified", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - alignment: AlignmentType.JUSTIFIED, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + alignment: AlignmentType.JUSTIFIED, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:jc": { _attr: { "w:val": "both" } } }], @@ -182,20 +164,18 @@ describe("AbstractNumbering", () => { }); it("#thematicBreak", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - thematicBreak: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + thematicBreak: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [ @@ -218,20 +198,18 @@ describe("AbstractNumbering", () => { }); it("#leftTabStop", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - leftTabStop: 1200, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + leftTabStop: 1200, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [ @@ -243,20 +221,18 @@ describe("AbstractNumbering", () => { }); it("#maxRightTabStop", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - rightTabStop: TabStopPosition.MAX, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + rightTabStop: TabStopPosition.MAX, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [ @@ -268,20 +244,18 @@ describe("AbstractNumbering", () => { }); it("#keepLines", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - keepLines: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + keepLines: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:keepLines": EMPTY_OBJECT }], @@ -289,20 +263,18 @@ describe("AbstractNumbering", () => { }); it("#keepNext", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - paragraph: { - keepNext: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + paragraph: { + keepNext: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:pPr": [{ "w:keepNext": EMPTY_OBJECT }], @@ -312,20 +284,18 @@ describe("AbstractNumbering", () => { describe("formatting methods: run properties", () => { it("#size", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - size: 24, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + size: 24, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:sz": { _attr: { "w:val": 24 } } }], @@ -333,20 +303,18 @@ describe("AbstractNumbering", () => { }); it("#smallCaps", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - smallCaps: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + smallCaps: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:smallCaps": { _attr: { "w:val": true } } }], @@ -354,20 +322,18 @@ describe("AbstractNumbering", () => { }); it("#allCaps", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - allCaps: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + allCaps: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:caps": { _attr: { "w:val": true } } }], @@ -375,20 +341,18 @@ describe("AbstractNumbering", () => { }); it("#strike", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - strike: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + strike: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ @@ -397,20 +361,18 @@ describe("AbstractNumbering", () => { }); it("#doubleStrike", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - doubleStrike: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + doubleStrike: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:dstrike": { _attr: { "w:val": true } } }], @@ -418,20 +380,18 @@ describe("AbstractNumbering", () => { }); it("#subScript", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - subScript: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + subScript: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "subscript" } } }], @@ -439,20 +399,18 @@ describe("AbstractNumbering", () => { }); it("#superScript", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - superScript: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + superScript: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "superscript" } } }], @@ -460,20 +418,18 @@ describe("AbstractNumbering", () => { }); it("#font", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - font: "Times", - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + font: "Times", }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [ @@ -483,20 +439,18 @@ describe("AbstractNumbering", () => { }); it("#bold", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - bold: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + bold: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }], @@ -504,20 +458,18 @@ describe("AbstractNumbering", () => { }); it("#italics", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - italics: true, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + italics: true, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:i": { _attr: { "w:val": true } } }], @@ -525,20 +477,18 @@ describe("AbstractNumbering", () => { }); it("#highlight", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - highlight: "005599", - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + highlight: "005599", }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:highlight": { _attr: { "w:val": "005599" } } }], @@ -546,24 +496,22 @@ describe("AbstractNumbering", () => { }); it("#shadow", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - shadow: { - type: ShadingType.PERCENT_10, - fill: "00FFFF", - color: "FF0000", - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + shadow: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", }, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], @@ -572,20 +520,18 @@ describe("AbstractNumbering", () => { describe("#underline", () => { it("should set underline to 'single' if no arguments are given", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - underline: {}, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + underline: {}, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:u": { _attr: { "w:val": "single" } } }], @@ -593,22 +539,20 @@ describe("AbstractNumbering", () => { }); it("should set the style if given", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - underline: { - type: UnderlineType.DOUBLE, - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + underline: { + type: UnderlineType.DOUBLE, }, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:u": { _attr: { "w:val": "double" } } }], @@ -616,23 +560,21 @@ describe("AbstractNumbering", () => { }); it("should set the style and color if given", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - underline: { - type: UnderlineType.DOUBLE, - color: "005599", - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + underline: { + type: UnderlineType.DOUBLE, + color: "005599", }, }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:u": { _attr: { "w:val": "double", "w:color": "005599" } } }], @@ -641,20 +583,18 @@ describe("AbstractNumbering", () => { }); it("#color", () => { - const abstractNumbering = new AbstractNumbering(1, { - levels: [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - color: "123456", - }, + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + color: "123456", }, }, - ], - }); + }, + ]); const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [{ "w:color": { _attr: { "w:val": "123456" } } }], diff --git a/src/file/numbering/abstract-numbering.ts b/src/file/numbering/abstract-numbering.ts index 49b1175812..2eed73fe39 100644 --- a/src/file/numbering/abstract-numbering.ts +++ b/src/file/numbering/abstract-numbering.ts @@ -15,14 +15,10 @@ class AbstractNumberingAttributes extends XmlAttributeComponent { export class ConcreteNumbering extends XmlComponent { public readonly id: number; - constructor(numId: number, abstractNumId: number) { + constructor(numId: number, abstractNumId: number, public readonly reference?: string) { super("w:num"); this.root.push( new NumAttributes({ diff --git a/src/file/numbering/numbering.spec.ts b/src/file/numbering/numbering.spec.ts index 0c16884300..79a824b67a 100644 --- a/src/file/numbering/numbering.spec.ts +++ b/src/file/numbering/numbering.spec.ts @@ -8,7 +8,7 @@ describe("Numbering", () => { describe("#constructor", () => { it("creates a default numbering with one abstract and one concrete instance", () => { const numbering = new Numbering({ - levels: [], + config: [], }); const tree = new Formatter().format(numbering); diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index 891aa2ab3a..b8747991d0 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -3,17 +3,25 @@ import { AlignmentType } from "file/paragraph"; import { IXmlableObject, XmlComponent } from "file/xml-components"; import { DocumentAttributes } from "../document/document-attributes"; -import { AbstractNumbering, IAbstractNumberingOptions } from "./abstract-numbering"; +import { AbstractNumbering } from "./abstract-numbering"; +import { ILevelsOptions } from "./level"; import { ConcreteNumbering } from "./num"; +export interface INumberingOptions { + readonly config: Array<{ + readonly levels: ILevelsOptions[]; + readonly reference: string; + }>; +} + export class Numbering extends XmlComponent { // tslint:disable-next-line:readonly-keyword private nextId: number; - private readonly abstractNumbering: XmlComponent[] = []; - private readonly concreteNumbering: XmlComponent[] = []; + private readonly abstractNumbering: AbstractNumbering[] = []; + private readonly concreteNumbering: ConcreteNumbering[] = []; - constructor(options: IAbstractNumberingOptions) { + constructor(options: INumberingOptions) { super("w:numbering"); this.root.push( new DocumentAttributes({ @@ -39,114 +47,114 @@ export class Numbering extends XmlComponent { this.nextId = 0; - const abstractNumbering = this.createAbstractNumbering({ - levels: [ - { - level: 0, - format: "bullet", - text: "\u25CF", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 720, hanging: 360 }, - }, + const abstractNumbering = this.createAbstractNumbering([ + { + level: 0, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 720, hanging: 360 }, }, }, - { - level: 1, - format: "bullet", - text: "\u25CB", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 1440, hanging: 360 }, - }, + }, + { + level: 1, + format: "bullet", + text: "\u25CB", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 1440, hanging: 360 }, }, }, - { - level: 2, - format: "bullet", - text: "\u25A0", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 2160, hanging: 360 }, - }, + }, + { + level: 2, + format: "bullet", + text: "\u25A0", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 2160, hanging: 360 }, }, }, - { - level: 3, - format: "bullet", - text: "\u25CF", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 2880, hanging: 360 }, - }, + }, + { + level: 3, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 2880, hanging: 360 }, }, }, - { - level: 4, - format: "bullet", - text: "\u25CB", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 3600, hanging: 360 }, - }, + }, + { + level: 4, + format: "bullet", + text: "\u25CB", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 3600, hanging: 360 }, }, }, - { - level: 5, - format: "bullet", - text: "\u25A0", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 4320, hanging: 360 }, - }, + }, + { + level: 5, + format: "bullet", + text: "\u25A0", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 4320, hanging: 360 }, }, }, - { - level: 6, - format: "bullet", - text: "\u25CF", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 5040, hanging: 360 }, - }, + }, + { + level: 6, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 5040, hanging: 360 }, }, }, - { - level: 7, - format: "bullet", - text: "\u25CF", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 5760, hanging: 360 }, - }, + }, + { + level: 7, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 5760, hanging: 360 }, }, }, - { - level: 8, - format: "bullet", - text: "\u25CF", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 6480, hanging: 360 }, - }, + }, + { + level: 8, + format: "bullet", + text: "\u25CF", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 6480, hanging: 360 }, }, }, - ], - }); + }, + ]); this.createConcreteNumbering(abstractNumbering); - const currentAbstractNumbering = this.createAbstractNumbering(options); - this.createConcreteNumbering(currentAbstractNumbering); + for (const con of options.config) { + const currentAbstractNumbering = this.createAbstractNumbering(con.levels); + this.createConcreteNumbering(currentAbstractNumbering, con.reference); + } } public prepForXml(): IXmlableObject | undefined { @@ -155,15 +163,19 @@ export class Numbering extends XmlComponent { return super.prepForXml(); } - private createConcreteNumbering(abstractNumbering: AbstractNumbering): ConcreteNumbering { - const num = new ConcreteNumbering(this.nextId++, abstractNumbering.id); + private createConcreteNumbering(abstractNumbering: AbstractNumbering, reference?: string): ConcreteNumbering { + const num = new ConcreteNumbering(this.nextId++, abstractNumbering.id, reference); this.concreteNumbering.push(num); return num; } - private createAbstractNumbering(options: IAbstractNumberingOptions): AbstractNumbering { + private createAbstractNumbering(options: ILevelsOptions[]): AbstractNumbering { const num = new AbstractNumbering(this.nextId++, options); this.abstractNumbering.push(num); return num; } + + public get ConcreteNumbering(): ConcreteNumbering[] { + return this.concreteNumbering; + } } diff --git a/src/file/paragraph/formatting/unordered-list.ts b/src/file/paragraph/formatting/unordered-list.ts index f7650fc844..bd1bcb562a 100644 --- a/src/file/paragraph/formatting/unordered-list.ts +++ b/src/file/paragraph/formatting/unordered-list.ts @@ -24,7 +24,7 @@ class NumberId extends XmlComponent { super("w:numId"); this.root.push( new Attributes({ - val: typeof id === "string" ? `__${id}__` : id, + val: typeof id === "string" ? `{${id}}` : id, }), ); } diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index 99c8efb0c0..b4a797a8c2 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -629,7 +629,7 @@ describe("Paragraph", () => { "w:pPr": [ { "w:pStyle": { _attr: { "w:val": "ListParagraph" } } }, { - "w:numPr": [{ "w:ilvl": { _attr: { "w:val": 0 } } }, { "w:numId": { _attr: { "w:val": "__test id__" } } }], + "w:numPr": [{ "w:ilvl": { _attr: { "w:val": 0 } } }, { "w:numId": { _attr: { "w:val": "{test id}" } } }], }, ], }, From 3427d220c79baffefb92753f2d459c88362de58f Mon Sep 17 00:00:00 2001 From: Nicolas Rotier Date: Fri, 8 Nov 2019 10:50:18 +0100 Subject: [PATCH 009/147] fix hyperlink id --- package.json | 1 + src/file/file.ts | 5 +++-- src/file/paragraph/links/hyperlink.spec.ts | 6 +++--- src/file/paragraph/links/hyperlink.ts | 6 +++--- src/file/relationships/relationships.ts | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 976e4d23f3..3be39c2012 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "dependencies": { "@types/jszip": "^3.1.4", "jszip": "^3.1.5", + "shortid": "^2.2.15", "xml": "^1.0.1", "xml-js": "^1.6.8" }, diff --git a/src/file/file.ts b/src/file/file.ts index ccf5fe374c..ded794fd40 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -25,6 +25,7 @@ import { ExternalStylesFactory } from "./styles/external-styles-factory"; import { DefaultStylesFactory } from "./styles/factory"; import { Table } from "./table"; import { TableOfContents } from "./table-of-contents"; +import * as shortid from "shortid"; export interface ISectionOptions { readonly headers?: { @@ -133,7 +134,7 @@ export class File { public createHyperlink(link: string, text?: string): Hyperlink { const newText = text === undefined ? link : text; - const hyperlink = new Hyperlink(newText, this.docRelationships.RelationshipCount); + const hyperlink = new Hyperlink(newText, shortid.generate().toLowerCase()); this.docRelationships.createRelationship( hyperlink.linkId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", @@ -145,7 +146,7 @@ export class File { public createInternalHyperLink(anchor: string, text?: string): Hyperlink { const newText = text === undefined ? anchor : text; - const hyperlink = new Hyperlink(newText, this.docRelationships.RelationshipCount, anchor); + const hyperlink = new Hyperlink(newText, shortid.generate().toLowerCase(), anchor); // NOTE: unlike File#createHyperlink(), since the link is to an internal bookmark // we don't need to create a new relationship. return hyperlink; diff --git a/src/file/paragraph/links/hyperlink.spec.ts b/src/file/paragraph/links/hyperlink.spec.ts index 09dd07b86f..836f3f733f 100644 --- a/src/file/paragraph/links/hyperlink.spec.ts +++ b/src/file/paragraph/links/hyperlink.spec.ts @@ -8,7 +8,7 @@ describe("Hyperlink", () => { let hyperlink: Hyperlink; beforeEach(() => { - hyperlink = new Hyperlink("https://example.com", 0); + hyperlink = new Hyperlink("https://example.com", 'superid'); }); describe("#constructor()", () => { @@ -19,7 +19,7 @@ describe("Hyperlink", () => { { _attr: { "w:history": 1, - "r:id": "rId1", + "r:id": "rIdsuperid", }, }, { @@ -34,7 +34,7 @@ describe("Hyperlink", () => { describe("with optional anchor parameter", () => { beforeEach(() => { - hyperlink = new Hyperlink("Anchor Text", 0, "anchor"); + hyperlink = new Hyperlink("Anchor Text", 'superid2', "anchor"); }); it("should create an internal link with anchor tag", () => { diff --git a/src/file/paragraph/links/hyperlink.ts b/src/file/paragraph/links/hyperlink.ts index b41980ed77..30e60616ec 100644 --- a/src/file/paragraph/links/hyperlink.ts +++ b/src/file/paragraph/links/hyperlink.ts @@ -4,13 +4,13 @@ import { TextRun } from "../run"; import { HyperlinkAttributes, IHyperlinkAttributesProperties } from "./hyperlink-attributes"; export class Hyperlink extends XmlComponent { - public readonly linkId: number; + public readonly linkId: string; private readonly textRun: TextRun; - constructor(text: string, relationshipsCount: number, anchor?: string) { + constructor(text: string, relationshipId: string, anchor?: string) { super("w:hyperlink"); - this.linkId = relationshipsCount + 1; + this.linkId = relationshipId; const props: IHyperlinkAttributesProperties = { history: 1, diff --git a/src/file/relationships/relationships.ts b/src/file/relationships/relationships.ts index bd56ff1aab..3a5447c2d9 100644 --- a/src/file/relationships/relationships.ts +++ b/src/file/relationships/relationships.ts @@ -16,7 +16,7 @@ export class Relationships extends XmlComponent { this.root.push(relationship); } - public createRelationship(id: number, type: RelationshipType, target: string, targetMode?: TargetModeType): Relationship { + public createRelationship(id: number | string, type: RelationshipType, target: string, targetMode?: TargetModeType): Relationship { const relationship = new Relationship(`rId${id}`, type, target, targetMode); this.addRelationship(relationship); From e8410ff692c668e8118093c3cf8f455ac6f8cfd5 Mon Sep 17 00:00:00 2001 From: Nicolas Rotier Date: Fri, 8 Nov 2019 11:22:27 +0100 Subject: [PATCH 010/147] fix lint --- src/file/file.ts | 2 +- src/file/paragraph/links/hyperlink.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/file/file.ts b/src/file/file.ts index ded794fd40..10a85bf79a 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -1,3 +1,4 @@ +import * as shortid from "shortid"; import { AppProperties } from "./app-properties/app-properties"; import { ContentTypes } from "./content-types/content-types"; import { CoreProperties, IPropertiesOptions } from "./core-properties"; @@ -25,7 +26,6 @@ import { ExternalStylesFactory } from "./styles/external-styles-factory"; import { DefaultStylesFactory } from "./styles/factory"; import { Table } from "./table"; import { TableOfContents } from "./table-of-contents"; -import * as shortid from "shortid"; export interface ISectionOptions { readonly headers?: { diff --git a/src/file/paragraph/links/hyperlink.spec.ts b/src/file/paragraph/links/hyperlink.spec.ts index 836f3f733f..93b59e07b6 100644 --- a/src/file/paragraph/links/hyperlink.spec.ts +++ b/src/file/paragraph/links/hyperlink.spec.ts @@ -8,7 +8,7 @@ describe("Hyperlink", () => { let hyperlink: Hyperlink; beforeEach(() => { - hyperlink = new Hyperlink("https://example.com", 'superid'); + hyperlink = new Hyperlink("https://example.com", "superid"); }); describe("#constructor()", () => { @@ -34,7 +34,7 @@ describe("Hyperlink", () => { describe("with optional anchor parameter", () => { beforeEach(() => { - hyperlink = new Hyperlink("Anchor Text", 'superid2', "anchor"); + hyperlink = new Hyperlink("Anchor Text", "superid2", "anchor"); }); it("should create an internal link with anchor tag", () => { From da9e6d6664e08beea82fda4e57c78f121a2a1954 Mon Sep 17 00:00:00 2001 From: Dolan Date: Mon, 18 Nov 2019 01:04:31 +0000 Subject: [PATCH 011/147] Add table borders --- demo/49-table-borders.ts | 37 ++++++++ src/file/table/table-properties/index.ts | 1 + .../table/table-properties/table-borders.ts | 95 +++++++++++++++++-- .../table-properties/table-properties.ts | 6 +- src/file/table/table.ts | 11 ++- 5 files changed, 138 insertions(+), 12 deletions(-) create mode 100644 demo/49-table-borders.ts diff --git a/demo/49-table-borders.ts b/demo/49-table-borders.ts new file mode 100644 index 0000000000..2aebf1feb1 --- /dev/null +++ b/demo/49-table-borders.ts @@ -0,0 +1,37 @@ +// Add custom borders to the table itself +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { BorderStyle, Document, Packer, Paragraph, Table, TableCell, TableRow } from "../build"; + +const doc = new Document(); + +const table = new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("Hello")], + }), + new TableCell({ + children: [], + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [], + }), + new TableCell({ + children: [new Paragraph("World")], + }), + ], + }), + ], +}); + +doc.addSection({ children: [table] }); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/src/file/table/table-properties/index.ts b/src/file/table/table-properties/index.ts index dde973ee7a..aefcc9e0aa 100644 --- a/src/file/table/table-properties/index.ts +++ b/src/file/table/table-properties/index.ts @@ -1,3 +1,4 @@ export * from "./table-properties"; export * from "./table-float-properties"; export * from "./table-layout"; +export * from "./table-borders"; diff --git a/src/file/table/table-properties/table-borders.ts b/src/file/table/table-properties/table-borders.ts index 204bccf496..fa83621968 100644 --- a/src/file/table/table-properties/table-borders.ts +++ b/src/file/table/table-properties/table-borders.ts @@ -1,14 +1,95 @@ +// http://officeopenxml.com/WPtableBorders.php +import { BorderStyle } from "file/styles"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; +export interface ITableBordersOptions { + readonly top?: { + readonly style: BorderStyle; + readonly size: number; + readonly color: string; + }; + readonly bottom?: { + readonly style: BorderStyle; + readonly size: number; + readonly color: string; + }; + readonly left?: { + readonly style: BorderStyle; + readonly size: number; + readonly color: string; + }; + readonly right?: { + readonly style: BorderStyle; + readonly size: number; + readonly color: string; + }; + readonly insideHorizontal?: { + readonly style: BorderStyle; + readonly size: number; + readonly color: string; + }; + readonly insideVertical?: { + readonly style: BorderStyle; + readonly size: number; + readonly color: string; + }; +} + export class TableBorders extends XmlComponent { - constructor() { + constructor(options: ITableBordersOptions) { super("w:tblBorders"); - this.root.push(new TableBordersElement("w:top", "single", 4, 0, "auto")); - this.root.push(new TableBordersElement("w:left", "single", 4, 0, "auto")); - this.root.push(new TableBordersElement("w:bottom", "single", 4, 0, "auto")); - this.root.push(new TableBordersElement("w:right", "single", 4, 0, "auto")); - this.root.push(new TableBordersElement("w:insideH", "single", 4, 0, "auto")); - this.root.push(new TableBordersElement("w:insideV", "single", 4, 0, "auto")); + + if (options.top) { + this.root.push(new TableBordersElement("w:top", options.top.style, options.top.size, 0, options.top.color)); + } else { + this.root.push(new TableBordersElement("w:top", BorderStyle.SINGLE, 4, 0, "auto")); + } + + if (options.left) { + this.root.push(new TableBordersElement("w:left", options.left.style, options.left.size, 0, options.left.color)); + } else { + this.root.push(new TableBordersElement("w:left", BorderStyle.SINGLE, 4, 0, "auto")); + } + + if (options.bottom) { + this.root.push(new TableBordersElement("w:bottom", options.bottom.style, options.bottom.size, 0, options.bottom.color)); + } else { + this.root.push(new TableBordersElement("w:bottom", BorderStyle.SINGLE, 4, 0, "auto")); + } + + if (options.right) { + this.root.push(new TableBordersElement("w:right", options.right.style, 4, 0, "auto")); + } else { + this.root.push(new TableBordersElement("w:right", BorderStyle.SINGLE, 4, 0, "auto")); + } + + if (options.insideHorizontal) { + this.root.push( + new TableBordersElement( + "w:insideH", + options.insideHorizontal.style, + options.insideHorizontal.size, + 0, + options.insideHorizontal.color, + ), + ); + } else { + this.root.push(new TableBordersElement("w:insideH", BorderStyle.SINGLE, 4, 0, "auto")); + } + + if (options.insideVertical) { + this.root.push( + new TableBordersElement( + "w:insideV", + options.insideVertical.style, + options.insideVertical.size, + 0, + options.insideVertical.color, + ), + ); + } else { + this.root.push(new TableBordersElement("w:insideV", BorderStyle.SINGLE, 4, 0, "auto")); + } } } diff --git a/src/file/table/table-properties/table-properties.ts b/src/file/table/table-properties/table-properties.ts index fd1f844978..6744558d1a 100644 --- a/src/file/table/table-properties/table-properties.ts +++ b/src/file/table/table-properties/table-properties.ts @@ -2,7 +2,7 @@ import { IgnoreIfEmptyXmlComponent } from "file/xml-components"; import { ITableShadingAttributesProperties, TableShading } from "../shading"; import { WidthType } from "../table-cell"; -import { TableBorders } from "./table-borders"; +import { ITableBordersOptions, TableBorders } from "./table-borders"; import { TableCellMargin } from "./table-cell-margin"; import { ITableFloatOptions, TableFloatProperties } from "./table-float-properties"; import { TableLayout, TableLayoutType } from "./table-layout"; @@ -27,8 +27,8 @@ export class TableProperties extends IgnoreIfEmptyXmlComponent { this.root.push(new TableLayout(type)); } - public setBorder(): TableProperties { - this.root.push(new TableBorders()); + public setBorder(borderOptions: ITableBordersOptions): TableProperties { + this.root.push(new TableBorders(borderOptions)); return this; } diff --git a/src/file/table/table.ts b/src/file/table/table.ts index 08bd47eda2..17c5f4fefd 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -2,7 +2,7 @@ import { XmlComponent } from "file/xml-components"; import { TableGrid } from "./grid"; import { TableCell, VerticalMergeType, WidthType } from "./table-cell"; -import { ITableFloatOptions, TableProperties } from "./table-properties"; +import { ITableBordersOptions, ITableFloatOptions, TableProperties } from "./table-properties"; import { TableLayoutType } from "./table-properties/table-layout"; import { TableRow } from "./table-row"; @@ -32,6 +32,7 @@ export interface ITableOptions { }; readonly float?: ITableFloatOptions; readonly layout?: TableLayoutType; + readonly borders?: ITableBordersOptions; } export class Table extends XmlComponent { @@ -44,11 +45,17 @@ export class Table extends XmlComponent { margins: { marginUnitType, top, bottom, right, left } = { marginUnitType: WidthType.AUTO, top: 0, bottom: 0, right: 0, left: 0 }, float, layout, + borders, }: ITableOptions) { super("w:tbl"); this.properties = new TableProperties(); this.root.push(this.properties); - this.properties.setBorder(); + + if (borders) { + this.properties.setBorder(borders); + } else { + this.properties.setBorder({}); + } if (width) { this.properties.setWidth(width.size, width.type); From 05a4ef17021b1e2b7dfde7be753ae63a4786e329 Mon Sep 17 00:00:00 2001 From: Dolan Date: Mon, 18 Nov 2019 11:29:32 +0000 Subject: [PATCH 012/147] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3be39c2012..cc50a5d9e0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "docx", "version": "5.0.0-rc7", - "description": "Generate .docx documents with JavaScript (formerly Office-Clippy)", + "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { "pretest": "rimraf ./build", From bd1f5898a8f3b389f02afd1a182096a7eaa70c35 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 19 Nov 2019 22:06:10 +0000 Subject: [PATCH 013/147] Add tests --- .../table-properties/table-borders.spec.ts | 550 ++++++++++++++++++ .../table/table-properties/table-borders.ts | 2 +- 2 files changed, 551 insertions(+), 1 deletion(-) create mode 100644 src/file/table/table-properties/table-borders.spec.ts diff --git a/src/file/table/table-properties/table-borders.spec.ts b/src/file/table/table-properties/table-borders.spec.ts new file mode 100644 index 0000000000..679192f120 --- /dev/null +++ b/src/file/table/table-properties/table-borders.spec.ts @@ -0,0 +1,550 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; +import { BorderStyle } from "file/styles"; + +import { TableBorders } from "./table-borders"; + +describe("TableBorders", () => { + describe("#constructor", () => { + describe("default borders", () => { + it("should add a table cell top border using default width type", () => { + const tableBorders = new TableBorders({}); + const tree = new Formatter().format(tableBorders); + + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + ], + }); + }); + }); + + describe("top border", () => { + it("should add a table cell top border", () => { + const tableBorders = new TableBorders({ + top: { + style: BorderStyle.DOUBLE, + size: 1, + color: "red", + }, + }); + + const tree = new Formatter().format(tableBorders); + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "red", + "w:space": 0, + "w:sz": 1, + "w:val": "double", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + ], + }); + }); + }); + + describe("left border", () => { + it("should add a table cell left border", () => { + const tableBorders = new TableBorders({ + left: { + style: BorderStyle.DOUBLE, + size: 1, + color: "red", + }, + }); + const tree = new Formatter().format(tableBorders); + + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "red", + "w:space": 0, + "w:sz": 1, + "w:val": "double", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + ], + }); + }); + }); + + describe("bottom border", () => { + it("should add a table cell bottom border", () => { + const tableBorders = new TableBorders({ + bottom: { + style: BorderStyle.DOUBLE, + size: 1, + color: "red", + }, + }); + const tree = new Formatter().format(tableBorders); + + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "red", + "w:space": 0, + "w:sz": 1, + "w:val": "double", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + ], + }); + }); + }); + + describe("right border", () => { + it("should add a table cell right border", () => { + const tableBorders = new TableBorders({ + right: { + style: BorderStyle.DOUBLE, + size: 1, + color: "red", + }, + }); + const tree = new Formatter().format(tableBorders); + + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "red", + "w:space": 0, + "w:sz": 1, + "w:val": "double", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + ], + }); + }); + }); + + describe("inside horizontal border", () => { + it("should add a table cell inside horizontal border", () => { + const tableBorders = new TableBorders({ + insideHorizontal: { + style: BorderStyle.DOUBLE, + size: 1, + color: "red", + }, + }); + const tree = new Formatter().format(tableBorders); + + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "red", + "w:space": 0, + "w:sz": 1, + "w:val": "double", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + ], + }); + }); + }); + + describe("inside vertical border", () => { + it("should add a table cell inside horizontal border", () => { + const tableBorders = new TableBorders({ + insideVertical: { + style: BorderStyle.DOUBLE, + size: 1, + color: "red", + }, + }); + const tree = new Formatter().format(tableBorders); + + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 4, + "w:val": "single", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "red", + "w:space": 0, + "w:sz": 1, + "w:val": "double", + }, + }, + }, + ], + }); + }); + }); + }); +}); diff --git a/src/file/table/table-properties/table-borders.ts b/src/file/table/table-properties/table-borders.ts index fa83621968..7c7ac96ca9 100644 --- a/src/file/table/table-properties/table-borders.ts +++ b/src/file/table/table-properties/table-borders.ts @@ -58,7 +58,7 @@ export class TableBorders extends XmlComponent { } if (options.right) { - this.root.push(new TableBordersElement("w:right", options.right.style, 4, 0, "auto")); + this.root.push(new TableBordersElement("w:right", options.right.style, options.right.size, 0, options.right.color)); } else { this.root.push(new TableBordersElement("w:right", BorderStyle.SINGLE, 4, 0, "auto")); } From 8f4c78e2a8f0a695077484b450d91fc157531cfe Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 19 Nov 2019 22:08:01 +0000 Subject: [PATCH 014/147] Update package lock --- package-lock.json | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1313298723..ee20450d0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1098,7 +1098,7 @@ }, "browserify-aes": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -1135,7 +1135,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -1169,7 +1169,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { @@ -1642,7 +1642,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -1655,7 +1655,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -1894,7 +1894,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { @@ -3921,7 +3921,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", "dev": true }, "is-ci": { @@ -4345,7 +4345,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4771,7 +4771,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -4935,6 +4935,11 @@ "dev": true, "optional": true }, + "nanoid": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.6.tgz", + "integrity": "sha512-2NDzpiuEy3+H0AVtdt8LoFi7PnqkOnIzYmJQp7xsEU6VexLluHQwKREuiz57XaQC5006seIadPrIZJhyS2n7aw==" + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -6600,7 +6605,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -6634,6 +6639,14 @@ "rechoir": "^0.6.2" } }, + "shortid": { + "version": "2.2.15", + "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.15.tgz", + "integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==", + "requires": { + "nanoid": "^2.1.0" + } + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", From 7dfb016faa093a026e7fb13817e4fda7dc8565bc Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 21 Nov 2019 01:02:46 +0000 Subject: [PATCH 015/147] Make tab and page numbers declarative --- demo/1-basic.ts | 4 +- demo/10-my-cv.ts | 4 +- demo/17-footnotes.ts | 11 ++- demo/19-export-to-base64.ts | 4 +- demo/39-page-numbers.ts | 50 +++++++++---- demo/48-vertical-align.ts | 4 +- demo/6-page-borders.ts | 4 +- demo/browser-demo.html | 4 +- docs/README.md | 4 +- docs/usage/tab-stops.md | 6 +- src/file/paragraph/run/index.ts | 1 + .../paragraph/run/run-components/text.spec.ts | 6 -- src/file/paragraph/run/run-components/text.ts | 5 +- src/file/paragraph/run/run.spec.ts | 30 ++++---- src/file/paragraph/run/run.ts | 70 +++++++++++-------- src/file/paragraph/run/text-run.spec.ts | 7 +- src/file/paragraph/run/text-run.ts | 13 +--- 17 files changed, 124 insertions(+), 103 deletions(-) diff --git a/demo/1-basic.ts b/demo/1-basic.ts index 7db8870259..eb417f52b4 100644 --- a/demo/1-basic.ts +++ b/demo/1-basic.ts @@ -16,9 +16,9 @@ doc.addSection({ bold: true, }), new TextRun({ - text: "Github is the best", + text: "\tGithub is the best", bold: true, - }).tab(), + }), ], }), ], diff --git a/demo/10-my-cv.ts b/demo/10-my-cv.ts index b3e7c55e01..b91ca318bb 100644 --- a/demo/10-my-cv.ts +++ b/demo/10-my-cv.ts @@ -238,9 +238,9 @@ class DocumentCreator { bold: true, }), new TextRun({ - text: dateText, + text: `\t${dateText}`, bold: true, - }).tab(), + }), ], }); } diff --git a/demo/17-footnotes.ts b/demo/17-footnotes.ts index bf3f11eb91..51b5b66b05 100644 --- a/demo/17-footnotes.ts +++ b/demo/17-footnotes.ts @@ -1,14 +1,21 @@ // Footnotes // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Packer, Paragraph, TextRun } from "../build"; +import { Document, Packer, Paragraph, TextRun, FootnoteReferenceRun } from "../build"; const doc = new Document(); doc.addSection({ children: [ new Paragraph({ - children: [new TextRun("Hello").referenceFootnote(1), new TextRun(" World!").referenceFootnote(2)], + children: [ + new TextRun({ + children: ["Hello", new FootnoteReferenceRun(1)], + }), + new TextRun({ + children: [" World!", new FootnoteReferenceRun(2)], + }), + ], }), new Paragraph("Hello World").referenceFootnote(3), ], diff --git a/demo/19-export-to-base64.ts b/demo/19-export-to-base64.ts index 676d844c8d..1d94cf5ff7 100644 --- a/demo/19-export-to-base64.ts +++ b/demo/19-export-to-base64.ts @@ -15,9 +15,9 @@ doc.addSection({ bold: true, }), new TextRun({ - text: "Bar", + text: "\tBar", bold: true, - }).tab(), + }), ], }), ], diff --git a/demo/39-page-numbers.ts b/demo/39-page-numbers.ts index edc9c411f9..2ab61419ef 100644 --- a/demo/39-page-numbers.ts +++ b/demo/39-page-numbers.ts @@ -1,7 +1,7 @@ // Example how to display page numbers // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, Footer, Header, Packer, PageNumberFormat, Paragraph, TextRun } from "../build"; +import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, PageNumberFormat, Paragraph, TextRun } from "../build"; const doc = new Document({}); @@ -9,9 +9,17 @@ doc.addSection({ headers: { default: new Header({ children: [ - new Paragraph("Foo Bar corp. ") - .addRun(new TextRun("Page Number ").pageNumber()) - .addRun(new TextRun(" to ").numberOfTotalPages()), + new Paragraph({ + children: [ + new TextRun("Foo Bar corp. "), + new TextRun({ + children: ["Page Number ", PageNumber.CURRENT], + }), + new TextRun({ + children: [" to ", PageNumber.TOTAL_PAGES], + }), + ], + }), ], }), }, @@ -19,11 +27,17 @@ doc.addSection({ default: new Footer({ children: [ new Paragraph({ - text: "Foo Bar corp. ", alignment: AlignmentType.CENTER, - }) - .addRun(new TextRun("Page Number: ").pageNumber()) - .addRun(new TextRun(" to ").numberOfTotalPages()), + children: [ + new TextRun("Foo Bar corp. "), + new TextRun({ + children: ["Page Number: ", PageNumber.CURRENT], + }), + new TextRun({ + children: [" to ", PageNumber.TOTAL_PAGES], + }), + ], + }), ], }), }, @@ -32,11 +46,21 @@ doc.addSection({ pageNumberFormatType: PageNumberFormat.DECIMAL, }, children: [ - new Paragraph("Hello World 1").pageBreak(), - new Paragraph("Hello World 2").pageBreak(), - new Paragraph("Hello World 3").pageBreak(), - new Paragraph("Hello World 4").pageBreak(), - new Paragraph("Hello World 5").pageBreak(), + new Paragraph({ + children: [new TextRun("Hello World 1"), new PageBreak()], + }), + new Paragraph({ + children: [new TextRun("Hello World 2"), new PageBreak()], + }), + new Paragraph({ + children: [new TextRun("Hello World 3"), new PageBreak()], + }), + new Paragraph({ + children: [new TextRun("Hello World 4"), new PageBreak()], + }), + new Paragraph({ + children: [new TextRun("Hello World 5"), new PageBreak()], + }), ], }); diff --git a/demo/48-vertical-align.ts b/demo/48-vertical-align.ts index a9eb7986da..35181d271c 100644 --- a/demo/48-vertical-align.ts +++ b/demo/48-vertical-align.ts @@ -18,9 +18,9 @@ doc.addSection({ bold: true, }), new TextRun({ - text: "Github is the best", + text: "\tGithub is the best", bold: true, - }).tab(), + }), ], }), ], diff --git a/demo/6-page-borders.ts b/demo/6-page-borders.ts index d54aac9a94..e83f18233b 100644 --- a/demo/6-page-borders.ts +++ b/demo/6-page-borders.ts @@ -21,9 +21,9 @@ doc.addSection({ bold: true, }), new TextRun({ - text: "Github is the best", + text: "\tGithub is the best", bold: true, - }).tab(), + }), ], }), new Paragraph({ diff --git a/demo/browser-demo.html b/demo/browser-demo.html index 82f064deb2..ecd7f47701 100644 --- a/demo/browser-demo.html +++ b/demo/browser-demo.html @@ -24,9 +24,9 @@ bold: true, }), new docx.TextRun({ - text: "Github is the best", + text: "\tGithub is the best", bold: true, - }).tab(), + }), ], }), ], diff --git a/docs/README.md b/docs/README.md index 089c133ac2..dae964d87a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,9 +50,9 @@ doc.addSection({ bold: true, }), new TextRun({ - text: "Github is the best", + text: "\tGithub is the best", bold: true, - }).tab(), + }), ], }), ], diff --git a/docs/usage/tab-stops.md b/docs/usage/tab-stops.md index 5c7a99da42..1a3d1e3b2e 100644 --- a/docs/usage/tab-stops.md +++ b/docs/usage/tab-stops.md @@ -12,7 +12,7 @@ Simply call the relevant methods on the paragraph listed below. Then just add a ```ts const paragraph = new Paragraph({ - children: [new TextRun("Hey everyone").bold(), new TextRun("11th November 1999").tab()], + children: [new TextRun("Hey everyone").bold(), new TextRun(\t"11th November 1999")], tabStops: [ { type: TabStopType.RIGHT, @@ -26,7 +26,7 @@ The example above will create a left aligned text, and a right aligned text on t ```ts const paragraph = new Paragraph({ - children: [new TextRun("Second tab stop here I come!").tab().tab()], + children: [new TextRun("Second tab stop here I come!")], tabStops: [ { type: TabStopType.RIGHT, @@ -46,7 +46,7 @@ You can add multiple tab stops of the same `type` too. ```ts const paragraph = new Paragraph({ - children: [new TextRun("Multiple tab stops!").tab().tab()], + children: [new TextRun("Multiple tab stops!")], tabStops: [ { type: TabStopType.RIGHT, diff --git a/src/file/paragraph/run/index.ts b/src/file/paragraph/run/index.ts index 353e794c06..21df415f35 100644 --- a/src/file/paragraph/run/index.ts +++ b/src/file/paragraph/run/index.ts @@ -5,3 +5,4 @@ export * from "./picture-run"; export * from "./run-fonts"; export * from "./sequential-identifier"; export * from "./underline"; +export * from "./tab"; diff --git a/src/file/paragraph/run/run-components/text.spec.ts b/src/file/paragraph/run/run-components/text.spec.ts index 57a3a5ede1..6393cebd8b 100644 --- a/src/file/paragraph/run/run-components/text.spec.ts +++ b/src/file/paragraph/run/run-components/text.spec.ts @@ -6,12 +6,6 @@ import { Text } from "./text"; describe("Text", () => { describe("#constructor", () => { - it("creates an empty text run if no text is given", () => { - const t = new Text(""); - const f = new Formatter().format(t); - expect(f).to.deep.equal({ "w:t": { _attr: { "xml:space": "preserve" } } }); - }); - it("adds the passed in text to the component", () => { const t = new Text(" this is\n text"); const f = new Formatter().format(t); diff --git a/src/file/paragraph/run/run-components/text.ts b/src/file/paragraph/run/run-components/text.ts index 5cac4500b4..f730d37d3b 100644 --- a/src/file/paragraph/run/run-components/text.ts +++ b/src/file/paragraph/run/run-components/text.ts @@ -9,8 +9,7 @@ export class Text extends XmlComponent { constructor(text: string) { super("w:t"); this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); - if (text) { - this.root.push(text); - } + + this.root.push(text); } } diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index c16eb82b03..37aadfb8d8 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -1,9 +1,11 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; +// import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { ShadingType } from "file/table"; import { Run } from "./"; +import { PageNumber } from "./run"; import { UnderlineType } from "./underline"; describe("Run", () => { @@ -197,17 +199,6 @@ describe("Run", () => { }); }); - describe("#tab()", () => { - it("it should add break to the run", () => { - const run = new Run({}); - run.tab(); - const tree = new Formatter().format(run); - expect(tree).to.deep.equal({ - "w:r": [{ "w:tab": {} }], - }); - }); - }); - describe("#font()", () => { it("should set the font as named", () => { const run = new Run({ @@ -270,8 +261,10 @@ describe("Run", () => { describe("#numberOfTotalPages", () => { it("should set the run to the RTL mode", () => { - const run = new Run({}); - run.numberOfTotalPages(); + const run = new Run({ + children: [PageNumber.TOTAL_PAGES], + }); + const tree = new Formatter().format(run); expect(tree).to.deep.equal({ "w:r": [ @@ -286,8 +279,10 @@ describe("Run", () => { describe("#numberOfTotalPagesSection", () => { it("should set the run to the RTL mode", () => { - const run = new Run({}); - run.numberOfTotalPagesSection(); + const run = new Run({ + children: [PageNumber.TOTAL_PAGES_IN_SECTION], + }); + const tree = new Formatter().format(run); expect(tree).to.deep.equal({ "w:r": [ @@ -302,8 +297,9 @@ describe("Run", () => { describe("#pageNumber", () => { it("should set the run to the RTL mode", () => { - const run = new Run({}); - run.pageNumber(); + const run = new Run({ + children: [PageNumber.CURRENT], + }); const tree = new Formatter().format(run); expect(tree).to.deep.equal({ "w:r": [ diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index e586f8807d..20777b72a2 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -2,6 +2,7 @@ import { ShadingType } from "file/table"; import { XmlComponent } from "file/xml-components"; +import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { FieldInstruction } from "file/table-of-contents/field-instruction"; import { Break } from "./break"; import { Caps, SmallCaps } from "./caps"; @@ -24,10 +25,10 @@ import { } from "./formatting"; import { NumberOfPages, NumberOfPagesSection, Page } from "./page-number"; import { RunProperties } from "./properties"; +import { Text } from "./run-components/text"; import { RunFonts } from "./run-fonts"; import { SubScript, SuperScript } from "./script"; import { Style } from "./style"; -import { Tab } from "./tab"; import { Underline, UnderlineType } from "./underline"; export interface IRunOptions { @@ -57,7 +58,14 @@ export interface IRunOptions { readonly fill: string; readonly color: string; }; - readonly children?: Array; + readonly children?: Array; + readonly text?: string; +} + +export enum PageNumber { + CURRENT = "CURRENT", + TOTAL_PAGES = "TOTAL_PAGES", + TOTAL_PAGES_IN_SECTION = "TOTAL_PAGES_IN_SECTION", } export class Run extends XmlComponent { @@ -139,8 +147,37 @@ export class Run extends XmlComponent { if (options.children) { for (const child of options.children) { + if (typeof child === "string") { + switch (child) { + case PageNumber.CURRENT: + this.root.push(new Begin()); + this.root.push(new Page()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + case PageNumber.TOTAL_PAGES: + this.root.push(new Begin()); + this.root.push(new NumberOfPages()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + case PageNumber.TOTAL_PAGES_IN_SECTION: + this.root.push(new Begin()); + this.root.push(new NumberOfPagesSection()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + default: + this.root.push(new Text(child)); + break; + } + continue; + } + this.root.push(child); } + } else if (options.text) { + this.root.push(new Text(options.text)); } } @@ -148,33 +185,4 @@ export class Run extends XmlComponent { this.root.splice(1, 0, new Break()); return this; } - - public tab(): Run { - this.root.splice(1, 0, new Tab()); - return this; - } - - public pageNumber(): Run { - this.root.push(new Begin()); - this.root.push(new Page()); - this.root.push(new Separate()); - this.root.push(new End()); - return this; - } - - public numberOfTotalPages(): Run { - this.root.push(new Begin()); - this.root.push(new NumberOfPages()); - this.root.push(new Separate()); - this.root.push(new End()); - return this; - } - - public numberOfTotalPagesSection(): Run { - this.root.push(new Begin()); - this.root.push(new NumberOfPagesSection()); - this.root.push(new Separate()); - this.root.push(new End()); - return this; - } } diff --git a/src/file/paragraph/run/text-run.spec.ts b/src/file/paragraph/run/text-run.spec.ts index ae8e5bd9b4..b36b3c3139 100644 --- a/src/file/paragraph/run/text-run.spec.ts +++ b/src/file/paragraph/run/text-run.spec.ts @@ -1,6 +1,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; +import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { TextRun } from "./text-run"; @@ -19,9 +20,11 @@ describe("TextRun", () => { describe("#referenceFootnote()", () => { it("should add a valid footnote reference", () => { - run = new TextRun("test"); - run.referenceFootnote(1); + run = new TextRun({ + children: ["test", new FootnoteReferenceRun(1)], + }); const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ "w:r": [ { "w:t": [{ _attr: { "xml:space": "preserve" } }, "test"] }, diff --git a/src/file/paragraph/run/text-run.ts b/src/file/paragraph/run/text-run.ts index 2bbf1bae75..200651c9de 100644 --- a/src/file/paragraph/run/text-run.ts +++ b/src/file/paragraph/run/text-run.ts @@ -1,13 +1,8 @@ -import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { IRunOptions, Run } from "./run"; import { Text } from "./run-components/text"; -export interface ITextRunOptions extends IRunOptions { - readonly text: string; -} - export class TextRun extends Run { - constructor(options: ITextRunOptions | string) { + constructor(options: IRunOptions | string) { if (typeof options === "string") { super({}); this.root.push(new Text(options)); @@ -15,11 +10,5 @@ export class TextRun extends Run { } super(options); - this.root.push(new Text(options.text)); - } - - public referenceFootnote(id: number): TextRun { - this.root.push(new FootnoteReferenceRun(id)); - return this; } } From bf1d10e8939d9c99a589ad9114b734a8586dfcf8 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 21 Nov 2019 01:12:32 +0000 Subject: [PATCH 016/147] Fix demos --- demo/14-page-numbers.ts | 15 +++++++++++++-- demo/16-multiple-sections.ts | 20 ++++++++++++++++---- demo/47-number-of-total-pages-section.ts | 6 ++++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/demo/14-page-numbers.ts b/demo/14-page-numbers.ts index ae34300b5c..82f8c0a07b 100644 --- a/demo/14-page-numbers.ts +++ b/demo/14-page-numbers.ts @@ -2,6 +2,7 @@ // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; import { AlignmentType, Document, Header, Packer, PageBreak, Paragraph, TextRun } from "../build"; +import { PageNumber } from "../build/file/paragraph"; const doc = new Document(); @@ -11,7 +12,12 @@ doc.addSection({ children: [ new Paragraph({ alignment: AlignmentType.RIGHT, - children: [new TextRun("My Title "), new TextRun("Page ").pageNumber()], + children: [ + new TextRun("My Title "), + new TextRun({ + children: ["Page ", PageNumber.CURRENT], + }), + ], }), ], }), @@ -19,7 +25,12 @@ doc.addSection({ children: [ new Paragraph({ alignment: AlignmentType.RIGHT, - children: [new TextRun("First Page Header "), new TextRun("Page ").pageNumber()], + children: [ + new TextRun("First Page Header "), + new TextRun({ + children: ["Page ", PageNumber.CURRENT], + }), + ], }), ], }), diff --git a/demo/16-multiple-sections.ts b/demo/16-multiple-sections.ts index 5518eb5416..6f2e350b23 100644 --- a/demo/16-multiple-sections.ts +++ b/demo/16-multiple-sections.ts @@ -1,7 +1,7 @@ // Multiple sections and headers // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Footer, Header, Packer, PageNumberFormat, PageOrientation, Paragraph, TextRun } from "../build"; +import { Document, Footer, Header, Packer, PageNumber, PageNumberFormat, PageOrientation, Paragraph, TextRun } from "../build"; const doc = new Document(); @@ -53,7 +53,11 @@ doc.addSection({ default: new Header({ children: [ new Paragraph({ - children: [new TextRun("Page number: ").pageNumber()], + children: [ + new TextRun({ + children: ["Page number: ", PageNumber.CURRENT], + }), + ], }), ], }), @@ -69,7 +73,11 @@ doc.addSection({ default: new Header({ children: [ new Paragraph({ - children: [new TextRun("Page number: ").pageNumber()], + children: [ + new TextRun({ + children: ["Page number: ", PageNumber.CURRENT], + }), + ], }), ], }), @@ -90,7 +98,11 @@ doc.addSection({ default: new Header({ children: [ new Paragraph({ - children: [new TextRun("Page number: ").pageNumber()], + children: [ + new TextRun({ + children: ["Page number: ", PageNumber.CURRENT], + }), + ], }), ], }), diff --git a/demo/47-number-of-total-pages-section.ts b/demo/47-number-of-total-pages-section.ts index 988206e524..a26dacf066 100644 --- a/demo/47-number-of-total-pages-section.ts +++ b/demo/47-number-of-total-pages-section.ts @@ -1,7 +1,7 @@ // Multiple sections with total number of pages in each section // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, Packer, PageNumberFormat, TextRun, Header, Paragraph, Footer, PageBreak } from "../build"; +import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, PageNumberFormat, Paragraph, TextRun } from "../build"; const doc = new Document(); @@ -10,7 +10,9 @@ const header = new Header({ new Paragraph({ children: [ new TextRun("Header on another page"), - new TextRun("Page Number: ").pageNumber(), + new TextRun({ + children: ["Page number: ", PageNumber.CURRENT], + }), new TextRun(" to ").numberOfTotalPagesSection(), ], alignment: AlignmentType.CENTER, From 0be7c26798479c2bf2524cf3e845de995bd7bd22 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 23 Nov 2019 01:21:25 +0000 Subject: [PATCH 017/147] Add companies --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7cb5c93879..4af1a5e887 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide [drawing](https://www.dabblewriter.com/) [drawing](https://turbopatent.com/) [drawing](http://www.madisoncres.com/) +[drawing](https://www.beekast.com/) +[drawing](https://herraizsoto.com/) ...and many more! From b37aefdc8dd90f216b332874c1db781b045272eb Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 23 Nov 2019 02:26:59 +0000 Subject: [PATCH 018/147] Correctly exporting methods --- demo/14-page-numbers.ts | 3 +-- demo/17-footnotes.ts | 6 ++++-- demo/47-number-of-total-pages-section.ts | 4 +++- src/file/footnotes/footnote/index.ts | 1 + src/file/footnotes/footnote/run/index.ts | 1 + src/file/footnotes/index.ts | 1 + src/file/index.ts | 1 + src/file/paragraph/paragraph.ts | 9 +++------ 8 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 src/file/footnotes/footnote/index.ts create mode 100644 src/file/footnotes/footnote/run/index.ts diff --git a/demo/14-page-numbers.ts b/demo/14-page-numbers.ts index 82f8c0a07b..00b77cfe31 100644 --- a/demo/14-page-numbers.ts +++ b/demo/14-page-numbers.ts @@ -1,8 +1,7 @@ // Page numbers // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, Header, Packer, PageBreak, Paragraph, TextRun } from "../build"; -import { PageNumber } from "../build/file/paragraph"; +import { AlignmentType, Document, Header, Packer, PageBreak, PageNumber, Paragraph, TextRun } from "../build"; const doc = new Document(); diff --git a/demo/17-footnotes.ts b/demo/17-footnotes.ts index 51b5b66b05..3ed1f4ea91 100644 --- a/demo/17-footnotes.ts +++ b/demo/17-footnotes.ts @@ -1,7 +1,7 @@ // Footnotes // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Packer, Paragraph, TextRun, FootnoteReferenceRun } from "../build"; +import { Document, FootnoteReferenceRun, Packer, Paragraph, TextRun } from "../build"; const doc = new Document(); @@ -17,7 +17,9 @@ doc.addSection({ }), ], }), - new Paragraph("Hello World").referenceFootnote(3), + new Paragraph({ + children: [new TextRun("Hello World"), new FootnoteReferenceRun(3)], + }), ], }); diff --git a/demo/47-number-of-total-pages-section.ts b/demo/47-number-of-total-pages-section.ts index a26dacf066..7e8cf91b2c 100644 --- a/demo/47-number-of-total-pages-section.ts +++ b/demo/47-number-of-total-pages-section.ts @@ -13,7 +13,9 @@ const header = new Header({ new TextRun({ children: ["Page number: ", PageNumber.CURRENT], }), - new TextRun(" to ").numberOfTotalPagesSection(), + new TextRun({ + children: [" to ", PageNumber.TOTAL_PAGES_IN_SECTION], + }), ], alignment: AlignmentType.CENTER, }), diff --git a/src/file/footnotes/footnote/index.ts b/src/file/footnotes/footnote/index.ts new file mode 100644 index 0000000000..11d8ba33a9 --- /dev/null +++ b/src/file/footnotes/footnote/index.ts @@ -0,0 +1 @@ +export * from "./run"; diff --git a/src/file/footnotes/footnote/run/index.ts b/src/file/footnotes/footnote/run/index.ts new file mode 100644 index 0000000000..548e717bbd --- /dev/null +++ b/src/file/footnotes/footnote/run/index.ts @@ -0,0 +1 @@ +export * from "./reference-run"; diff --git a/src/file/footnotes/index.ts b/src/file/footnotes/index.ts index 91f3a9948b..1e11cca76a 100644 --- a/src/file/footnotes/index.ts +++ b/src/file/footnotes/index.ts @@ -1 +1,2 @@ export * from "./footnotes"; +export * from "./footnote"; diff --git a/src/file/index.ts b/src/file/index.ts index d14d4d9b1a..c4ce99e345 100644 --- a/src/file/index.ts +++ b/src/file/index.ts @@ -12,3 +12,4 @@ export * from "./xml-components"; export * from "./header-wrapper"; export * from "./footer-wrapper"; export * from "./header"; +export * from "./footnotes"; diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index 1defd01779..7de245fab8 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -44,7 +44,9 @@ export interface IParagraphOptions { readonly level: number; readonly custom?: boolean; }; - readonly children?: Array; + readonly children?: Array< + TextRun | PictureRun | Hyperlink | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun + >; } export class Paragraph extends XmlComponent { @@ -157,11 +159,6 @@ export class Paragraph extends XmlComponent { } } - public referenceFootnote(id: number): Paragraph { - this.root.push(new FootnoteReferenceRun(id)); - return this; - } - public addRunToFront(run: Run): Paragraph { this.root.splice(1, 0, run); return this; From c12101fbc66627aea5236561325c05dc1c2fc7c5 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 23 Nov 2019 21:06:15 +0000 Subject: [PATCH 019/147] Add decimal to numbering demo --- demo/29-numbered-lists.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/demo/29-numbered-lists.ts b/demo/29-numbered-lists.ts index 18da5cc359..5cd3966015 100644 --- a/demo/29-numbered-lists.ts +++ b/demo/29-numbered-lists.ts @@ -22,6 +22,22 @@ const doc = new Document({ ], reference: "my-crazy-reference", }, + { + levels: [ + { + level: 0, + format: "decimal", + text: "%1", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 720, hanging: 260 }, + }, + }, + }, + ], + reference: "my-number-numbering-reference", + }, ], }, }); @@ -72,6 +88,27 @@ doc.addSection({ before: 200, }, }), + new Paragraph({ + text: "Step 1 - Add sugar", + numbering: { + reference: "my-number-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "Step 2 - Add wheat", + numbering: { + reference: "my-number-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "Step 3 - Put in oven", + numbering: { + reference: "my-number-numbering-reference", + level: 0, + }, + }), ], }); From 1bdc93ef595a078bf1be2baa9598b02df1deb0cf Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 23 Nov 2019 23:22:02 +0000 Subject: [PATCH 020/147] Update numbering demo to add more numbering levels --- demo/3-numbering-and-bullet-points.ts | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/demo/3-numbering-and-bullet-points.ts b/demo/3-numbering-and-bullet-points.ts index 72b33d2e8e..58c0a4f5a6 100644 --- a/demo/3-numbering-and-bullet-points.ts +++ b/demo/3-numbering-and-bullet-points.ts @@ -42,6 +42,17 @@ const doc = new Document({ }, }, }, + { + level: 3, + format: "upperLetter", + text: "%4)", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 2880, hanging: 2420 }, + }, + }, + }, ], }, ], @@ -102,6 +113,27 @@ doc.addSection({ level: 3, }, }), + new Paragraph({ + text: "101 MSXFM", + numbering: { + reference: "my-crazy-numbering", + level: 3, + }, + }), + new Paragraph({ + text: "back to level 1", + numbering: { + reference: "my-crazy-numbering", + level: 1, + }, + }), + new Paragraph({ + text: "back to level 0", + numbering: { + reference: "my-crazy-numbering", + level: 0, + }, + }), ], }); From 8bdbd1de398a8535efbba3c28dbd47d3f450f54a Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 24 Nov 2019 01:22:17 +0000 Subject: [PATCH 021/147] Alignment of tables --- demo/32-merge-and-shade-table-cells.ts | 5 +++- .../table-properties/table-properties.spec.ts | 20 +++++++++++++++ .../table-properties/table-properties.ts | 5 ++++ src/file/table/table.spec.ts | 25 ++++++++++++++++++- src/file/table/table.ts | 8 ++++++ 5 files changed, 61 insertions(+), 2 deletions(-) diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index 77d6815d1e..db3174aeaf 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -1,7 +1,8 @@ // Example of how you would merge cells together (Rows and Columns) and apply shading +// Also includes an example on how to center tables // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HeadingLevel, Packer, Paragraph, ShadingType, Table, TableCell, TableRow, WidthType } from "../build"; +import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, ShadingType, Table, TableCell, TableRow, WidthType } from "../build"; const doc = new Document(); @@ -29,6 +30,7 @@ const table = new Table({ }); const table2 = new Table({ + alignment: AlignmentType.CENTER, rows: [ new TableRow({ children: [ @@ -66,6 +68,7 @@ const table2 = new Table({ }); const table3 = new Table({ + alignment: AlignmentType.CENTER, rows: [ new TableRow({ children: [ diff --git a/src/file/table/table-properties/table-properties.spec.ts b/src/file/table/table-properties/table-properties.spec.ts index 960d117b7c..1c10e09b6a 100644 --- a/src/file/table/table-properties/table-properties.spec.ts +++ b/src/file/table/table-properties/table-properties.spec.ts @@ -2,6 +2,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; +import { AlignmentType } from "../../paragraph"; import { ShadingType } from "../shading"; import { WidthType } from "../table-cell"; import { TableLayoutType } from "./table-layout"; @@ -92,4 +93,23 @@ describe("TableProperties", () => { }); }); }); + + describe("#setAlignment", () => { + it("sets the shading of the table", () => { + const tp = new TableProperties(); + tp.setAlignment(AlignmentType.CENTER); + const tree = new Formatter().format(tp); + expect(tree).to.deep.equal({ + "w:tblPr": [ + { + "w:jc": { + _attr: { + "w:val": "center", + }, + }, + }, + ], + }); + }); + }); }); diff --git a/src/file/table/table-properties/table-properties.ts b/src/file/table/table-properties/table-properties.ts index 6744558d1a..f78d225cbd 100644 --- a/src/file/table/table-properties/table-properties.ts +++ b/src/file/table/table-properties/table-properties.ts @@ -1,5 +1,6 @@ import { IgnoreIfEmptyXmlComponent } from "file/xml-components"; +import { Alignment, AlignmentType } from "../../paragraph"; import { ITableShadingAttributesProperties, TableShading } from "../shading"; import { WidthType } from "../table-cell"; import { ITableBordersOptions, TableBorders } from "./table-borders"; @@ -46,4 +47,8 @@ export class TableProperties extends IgnoreIfEmptyXmlComponent { return this; } + + public setAlignment(type: AlignmentType): void { + this.root.push(new Alignment(type)); + } } diff --git a/src/file/table/table.spec.ts b/src/file/table/table.spec.ts index d2aec26051..d2098fb1e4 100644 --- a/src/file/table/table.spec.ts +++ b/src/file/table/table.spec.ts @@ -3,7 +3,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; -import { Paragraph } from "../paragraph"; +import { AlignmentType, Paragraph } from "../paragraph"; import { Table } from "./table"; // import { WidthType } from "./table-cell"; import { RelativeHorizontalPosition, RelativeVerticalPosition, TableAnchorType } from "./table-properties"; @@ -211,6 +211,29 @@ describe("Table", () => { }); }); + it("should center the table", () => { + const table = new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("hello")], + }), + ], + }), + ], + alignment: AlignmentType.CENTER, + }); + const tree = new Formatter().format(table); + expect(tree) + .to.have.property("w:tbl") + .which.is.an("array") + .with.has.length.at.least(1); + expect(tree["w:tbl"][0]).to.deep.equal({ + "w:tblPr": [DEFAULT_TABLE_PROPERTIES, BORDERS, WIDTHS, { "w:jc": { _attr: { "w:val": "center" } } }], + }); + }); + it("should set the table to provided width", () => { const table = new Table({ rows: [ diff --git a/src/file/table/table.ts b/src/file/table/table.ts index 17c5f4fefd..a0e6dab88f 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -1,5 +1,7 @@ // http://officeopenxml.com/WPtableGrid.php import { XmlComponent } from "file/xml-components"; + +import { AlignmentType } from "../paragraph"; import { TableGrid } from "./grid"; import { TableCell, VerticalMergeType, WidthType } from "./table-cell"; import { ITableBordersOptions, ITableFloatOptions, TableProperties } from "./table-properties"; @@ -33,6 +35,7 @@ export interface ITableOptions { readonly float?: ITableFloatOptions; readonly layout?: TableLayoutType; readonly borders?: ITableBordersOptions; + readonly alignment?: AlignmentType; } export class Table extends XmlComponent { @@ -46,6 +49,7 @@ export class Table extends XmlComponent { float, layout, borders, + alignment, }: ITableOptions) { super("w:tbl"); this.properties = new TableProperties(); @@ -103,5 +107,9 @@ export class Table extends XmlComponent { if (layout) { this.properties.setLayout(layout); } + + if (alignment) { + this.properties.setAlignment(alignment); + } } } From 6db37eb4fb717ee98c30300b7144e9bbe8a13d03 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 24 Nov 2019 03:22:50 +0000 Subject: [PATCH 022/147] Overlap tables --- demo/34-floating-tables.ts | 2 ++ src/file/paragraph/formatting/alignment.ts | 1 + src/file/table/table-properties/index.ts | 1 + .../table-float-properties.spec.ts | 31 +++++++++++++++++-- .../table-float-properties.ts | 7 +++++ .../table-properties/table-overlap.spec.ts | 22 +++++++++++++ .../table/table-properties/table-overlap.ts | 17 ++++++++++ .../table-properties/table-properties.ts | 1 + 8 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/file/table/table-properties/table-overlap.spec.ts create mode 100644 src/file/table/table-properties/table-overlap.ts diff --git a/demo/34-floating-tables.ts b/demo/34-floating-tables.ts index dadf80f9da..aa8128de7e 100644 --- a/demo/34-floating-tables.ts +++ b/demo/34-floating-tables.ts @@ -3,6 +3,7 @@ import * as fs from "fs"; import { Document, + OverlapType, Packer, Paragraph, RelativeHorizontalPosition, @@ -43,6 +44,7 @@ const table = new Table({ verticalAnchor: TableAnchorType.MARGIN, relativeHorizontalPosition: RelativeHorizontalPosition.RIGHT, relativeVerticalPosition: RelativeVerticalPosition.BOTTOM, + overlap: OverlapType.NEVER, }, width: { size: 4535, diff --git a/src/file/paragraph/formatting/alignment.ts b/src/file/paragraph/formatting/alignment.ts index 8acf41ee4b..117b584a01 100644 --- a/src/file/paragraph/formatting/alignment.ts +++ b/src/file/paragraph/formatting/alignment.ts @@ -1,4 +1,5 @@ // http://officeopenxml.com/WPalignment.php +// http://officeopenxml.com/WPtableAlignment.php import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; export enum AlignmentType { diff --git a/src/file/table/table-properties/index.ts b/src/file/table/table-properties/index.ts index aefcc9e0aa..c5b5935d7f 100644 --- a/src/file/table/table-properties/index.ts +++ b/src/file/table/table-properties/index.ts @@ -2,3 +2,4 @@ export * from "./table-properties"; export * from "./table-float-properties"; export * from "./table-layout"; export * from "./table-borders"; +export * from "./table-overlap"; diff --git a/src/file/table/table-properties/table-float-properties.spec.ts b/src/file/table/table-properties/table-float-properties.spec.ts index a1422d871b..10d38f31f3 100644 --- a/src/file/table/table-properties/table-float-properties.spec.ts +++ b/src/file/table/table-properties/table-float-properties.spec.ts @@ -3,11 +3,12 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; import { RelativeHorizontalPosition, RelativeVerticalPosition, TableAnchorType, TableFloatProperties } from "./table-float-properties"; +import { OverlapType } from "./table-overlap"; describe("Table Float Properties", () => { describe("#constructor", () => { it("should construct a TableFloatProperties with all options", () => { - const tfp = new TableFloatProperties({ + const properties = new TableFloatProperties({ horizontalAnchor: TableAnchorType.MARGIN, verticalAnchor: TableAnchorType.PAGE, absoluteHorizontalPosition: 10, @@ -19,8 +20,32 @@ describe("Table Float Properties", () => { leftFromText: 50, rightFromText: 60, }); - const tree = new Formatter().format(tfp); - expect(tree).to.be.deep.equal(DEFAULT_TFP); + const tree = new Formatter().format(properties); + expect(tree).to.deep.equal(DEFAULT_TFP); + }); + + it("should add overlap", () => { + const properties = new TableFloatProperties({ + overlap: OverlapType.NEVER, + }); + const tree = new Formatter().format(properties); + + expect(tree).to.deep.equal({ + "w:tblpPr": [ + { + _attr: { + overlap: "never", + }, + }, + { + "w:tblOverlap": { + _attr: { + "w:val": "never", + }, + }, + }, + ], + }); }); }); }); diff --git a/src/file/table/table-properties/table-float-properties.ts b/src/file/table/table-properties/table-float-properties.ts index a1053c4ab2..2b97d86c1c 100644 --- a/src/file/table/table-properties/table-float-properties.ts +++ b/src/file/table/table-properties/table-float-properties.ts @@ -1,5 +1,7 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; +import { OverlapType, TableOverlap } from "./table-overlap"; + export enum TableAnchorType { MARGIN = "margin", PAGE = "page", @@ -109,6 +111,7 @@ export interface ITableFloatOptions { * to the right of the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero. */ readonly rightFromText?: number; + readonly overlap?: OverlapType; } export class TableFloatOptionsAttributes extends XmlAttributeComponent { @@ -130,5 +133,9 @@ export class TableFloatProperties extends XmlComponent { constructor(options: ITableFloatOptions) { super("w:tblpPr"); this.root.push(new TableFloatOptionsAttributes(options)); + + if (options.overlap) { + this.root.push(new TableOverlap(options.overlap)); + } } } diff --git a/src/file/table/table-properties/table-overlap.spec.ts b/src/file/table/table-properties/table-overlap.spec.ts new file mode 100644 index 0000000000..80ddd13e3d --- /dev/null +++ b/src/file/table/table-properties/table-overlap.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { OverlapType, TableOverlap } from "./table-overlap"; + +describe("TableOverlap", () => { + describe("#constructor", () => { + it("sets the width attribute to the value given", () => { + const tableOverlap = new TableOverlap(OverlapType.OVERLAP); + const tree = new Formatter().format(tableOverlap); + + expect(tree).to.deep.equal({ + "w:tblOverlap": { + _attr: { + "w:val": "overlap", + }, + }, + }); + }); + }); +}); diff --git a/src/file/table/table-properties/table-overlap.ts b/src/file/table/table-properties/table-overlap.ts new file mode 100644 index 0000000000..387cf27943 --- /dev/null +++ b/src/file/table/table-properties/table-overlap.ts @@ -0,0 +1,17 @@ +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +export enum OverlapType { + NEVER = "never", + OVERLAP = "overlap", +} + +class TableOverlapAttributes extends XmlAttributeComponent<{ readonly val: OverlapType }> { + protected readonly xmlKeys = { val: "w:val" }; +} + +export class TableOverlap extends XmlComponent { + constructor(type: OverlapType) { + super("w:tblOverlap"); + this.root.push(new TableOverlapAttributes({ val: type })); + } +} diff --git a/src/file/table/table-properties/table-properties.ts b/src/file/table/table-properties/table-properties.ts index f78d225cbd..8a7d000d5b 100644 --- a/src/file/table/table-properties/table-properties.ts +++ b/src/file/table/table-properties/table-properties.ts @@ -1,3 +1,4 @@ +// http://officeopenxml.com/WPtableProperties.php import { IgnoreIfEmptyXmlComponent } from "file/xml-components"; import { Alignment, AlignmentType } from "../../paragraph"; From 2b0953bb1916af7d2f38eed09a0a58d9ea319794 Mon Sep 17 00:00:00 2001 From: Dolan Date: Mon, 2 Dec 2019 23:13:26 +0000 Subject: [PATCH 023/147] Add right indent --- src/file/paragraph/formatting/indent.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/file/paragraph/formatting/indent.ts b/src/file/paragraph/formatting/indent.ts index 035571b690..3aad7d4e8a 100644 --- a/src/file/paragraph/formatting/indent.ts +++ b/src/file/paragraph/formatting/indent.ts @@ -7,6 +7,7 @@ export interface IIndentAttributesProperties { readonly firstLine?: number; readonly start?: number; readonly end?: number; + readonly right?: number; } class IndentAttributes extends XmlAttributeComponent { @@ -16,6 +17,7 @@ class IndentAttributes extends XmlAttributeComponent Date: Tue, 3 Dec 2019 23:04:48 +0000 Subject: [PATCH 024/147] Make create footnote declarative --- demo/17-footnotes.ts | 31 ++++- src/file/core-properties/properties.ts | 2 + src/file/file.spec.ts | 185 ++++++++++++++++++++++++- src/file/file.ts | 11 +- 4 files changed, 216 insertions(+), 13 deletions(-) diff --git a/demo/17-footnotes.ts b/demo/17-footnotes.ts index 3ed1f4ea91..a41f84a3c8 100644 --- a/demo/17-footnotes.ts +++ b/demo/17-footnotes.ts @@ -3,7 +3,16 @@ import * as fs from "fs"; import { Document, FootnoteReferenceRun, Packer, Paragraph, TextRun } from "../build"; -const doc = new Document(); +const doc = new Document({ + footnotes: [ + new Paragraph("Foo"), + new Paragraph("Test"), + new Paragraph("My amazing reference"), + new Paragraph("Foo1"), + new Paragraph("Test1"), + new Paragraph("My amazing reference1"), + ], +}); doc.addSection({ children: [ @@ -23,9 +32,23 @@ doc.addSection({ ], }); -doc.createFootnote(new Paragraph("Foo")); -doc.createFootnote(new Paragraph("Test")); -doc.createFootnote(new Paragraph("My amazing reference")); +doc.addSection({ + children: [ + new Paragraph({ + children: [ + new TextRun({ + children: ["Hello", new FootnoteReferenceRun(4)], + }), + new TextRun({ + children: [" World!", new FootnoteReferenceRun(5)], + }), + ], + }), + new Paragraph({ + children: [new TextRun("Hello World"), new FootnoteReferenceRun(6)], + }), + ], +}); Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index 8ac2130310..e807f0fd5f 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -2,6 +2,7 @@ import { XmlComponent } from "file/xml-components"; import { DocumentAttributes } from "../document/document-attributes"; import { INumberingOptions } from "../numbering"; +import { Paragraph } from "../paragraph"; import { IStylesOptions } from "../styles"; import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components"; @@ -16,6 +17,7 @@ export interface IPropertiesOptions { readonly externalStyles?: string; readonly styles?: IStylesOptions; readonly numbering?: INumberingOptions; + readonly footnotes?: Paragraph[]; } export class CoreProperties extends XmlComponent { diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index b82748ca54..e34feea1b6 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -149,12 +149,187 @@ describe("File", () => { }); describe("#createFootnote", () => { - it("should call the underlying document's createFootnote", () => { - const wrapper = new File(); - const spy = sinon.spy(wrapper.FootNotes, "createFootNote"); - wrapper.createFootnote(new Paragraph("")); + it("should create footnote", () => { + const wrapper = new File({ + footnotes: [new Paragraph("hello")], + }); - expect(spy.called).to.equal(true); + const tree = new Formatter().format(wrapper.FootNotes); + + expect(tree).to.deep.equal({ + "w:footnotes": [ + { + _attr: { + "mc:Ignorable": "w14 w15 wp14", + "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math", + "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006", + "xmlns:o": "urn:schemas-microsoft-com:office:office", + "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + "xmlns:v": "urn:schemas-microsoft-com:vml", + "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + "xmlns:w10": "urn:schemas-microsoft-com:office:word", + "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml", + "xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml", + "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml", + "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", + "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", + "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", + "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", + "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", + "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", + }, + }, + { + "w:footnote": [ + { + _attr: { + "w:id": -1, + "w:type": "separator", + }, + }, + { + "w:p": [ + { + "w:pPr": [ + { + "w:spacing": { + _attr: { + "w:after": 0, + "w:line": 240, + "w:lineRule": "auto", + }, + }, + }, + ], + }, + { + "w:r": [ + { + "w:rPr": [ + { + "w:rStyle": { + _attr: { + "w:val": "FootnoteReference", + }, + }, + }, + ], + }, + { + "w:footnoteRef": {}, + }, + ], + }, + { + "w:r": [ + { + "w:separator": {}, + }, + ], + }, + ], + }, + ], + }, + { + "w:footnote": [ + { + _attr: { + "w:id": 0, + "w:type": "continuationSeparator", + }, + }, + { + "w:p": [ + { + "w:pPr": [ + { + "w:spacing": { + _attr: { + "w:after": 0, + "w:line": 240, + "w:lineRule": "auto", + }, + }, + }, + ], + }, + { + "w:r": [ + { + "w:rPr": [ + { + "w:rStyle": { + _attr: { + "w:val": "FootnoteReference", + }, + }, + }, + ], + }, + { + "w:footnoteRef": {}, + }, + ], + }, + { + "w:r": [ + { + "w:continuationSeparator": {}, + }, + ], + }, + ], + }, + ], + }, + { + "w:footnote": [ + { + _attr: { + "w:id": 1, + }, + }, + { + "w:p": [ + { + "w:r": [ + { + "w:rPr": [ + { + "w:rStyle": { + _attr: { + "w:val": "FootnoteReference", + }, + }, + }, + ], + }, + { + "w:footnoteRef": {}, + }, + ], + }, + { + "w:r": [ + { + "w:t": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "hello", + ], + }, + ], + }, + ], + }, + ], + }, + ], + }); }); }); }); diff --git a/src/file/file.ts b/src/file/file.ts index 4cb14d3e3d..f2bcad3610 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -67,6 +67,7 @@ export class File { creator: "Un-named", revision: "1", lastModifiedBy: "Un-named", + footnotes: [], }, fileProperties: IFileProperties = {}, sections: ISectionOptions[] = [], @@ -136,6 +137,12 @@ export class File { this.document.add(child); } } + + if (options.footnotes) { + for (const paragraph of options.footnotes) { + this.footNotes.createFootNote(paragraph); + } + } } public createHyperlink(link: string, text?: string): Hyperlink { @@ -191,10 +198,6 @@ export class File { } } - public createFootnote(paragraph: Paragraph): void { - this.footNotes.createFootNote(paragraph); - } - public verifyUpdateFields(): void { if (this.document.getTablesOfContents().length) { this.settings.addUpdateFields(); From 1649d2a0fac657084403e8cdb9f422e878f0dba2 Mon Sep 17 00:00:00 2001 From: Max Lay Date: Wed, 11 Dec 2019 15:05:09 +1300 Subject: [PATCH 025/147] Allow contextual spacing to be specified as an argument to paragraph style --- src/file/styles/style-options.ts | 1 + src/file/styles/style/paragraph-style.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/file/styles/style-options.ts b/src/file/styles/style-options.ts index dcedadbec5..744f4244fb 100644 --- a/src/file/styles/style-options.ts +++ b/src/file/styles/style-options.ts @@ -29,6 +29,7 @@ export interface IRunStyleOptions { export interface IParagraphStyleOptions2 { readonly alignment?: AlignmentType; readonly thematicBreak?: boolean; + readonly contextualSpacing?: boolean; readonly rightTabStop?: number; readonly leftTabStop?: number; readonly indent?: IIndentAttributesProperties; diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index a47a33f492..4f7111625c 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -1,4 +1,4 @@ -import { Alignment, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph"; +import { Alignment, ContextualSpacing, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph"; import { TabStop, TabStopType } from "file/paragraph/formatting"; import * as formatting from "file/paragraph/run/formatting"; import { RunProperties } from "file/paragraph/run/properties"; @@ -134,6 +134,10 @@ export class ParagraphStyle extends Style { this.paragraphProperties.push(new ThematicBreak()); } + if (options.paragraph.contextualSpacing) { + this.paragraphProperties.push(new ContextualSpacing(options.paragraph.contextualSpacing)); + } + if (options.paragraph.rightTabStop) { this.paragraphProperties.push(new TabStop(TabStopType.RIGHT, options.paragraph.rightTabStop)); } From e0698554ad0276d1bba37e453c8a6fb1b99d9164 Mon Sep 17 00:00:00 2001 From: Max Lay Date: Wed, 11 Dec 2019 15:21:50 +1300 Subject: [PATCH 026/147] Fix style linting error --- src/file/styles/style/paragraph-style.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index 4f7111625c..3adb1edbbe 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -1,4 +1,14 @@ -import { Alignment, ContextualSpacing, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph"; +import { + Alignment, + ContextualSpacing, + Indent, + KeepLines, + KeepNext, + OutlineLevel, + ParagraphProperties, + Spacing, + ThematicBreak, +} from "file/paragraph"; import { TabStop, TabStopType } from "file/paragraph/formatting"; import * as formatting from "file/paragraph/run/formatting"; import { RunProperties } from "file/paragraph/run/properties"; From b4cce534a5f57494e3953ed4e0756e8f894dd08f Mon Sep 17 00:00:00 2001 From: Max Lay Date: Thu, 12 Dec 2019 11:44:00 +1300 Subject: [PATCH 027/147] Test contextual spacing --- src/file/styles/style/paragraph-style.spec.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index 93b0c6777c..8d9b4da15a 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -220,6 +220,32 @@ describe("ParagraphStyle", () => { }); }); + it("#contextualSpacing", () => { + const style = new ParagraphStyle({ + id: "myStyleId", + paragraph: { + contextualSpacing: true, + }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, + { + "w:pPr": [ + { + "w:contextualSpacing": { + _attr: { + "w:val": 1, + }, + }, + }, + ], + }, + ], + }); + }); + it("#leftTabStop", () => { const style = new ParagraphStyle({ id: "myStyleId", From 96471ecb456509c8b6492a47a945afc8a1bf36f1 Mon Sep 17 00:00:00 2001 From: mustapelto <46607498+mustapelto@users.noreply.github.com> Date: Sun, 15 Dec 2019 22:56:24 +0200 Subject: [PATCH 028/147] Fix for empty first paragraph If there is only one section, remove the extraneous empty paragraph during XML creation. --- src/file/document/body/body.spec.ts | 3 --- src/file/document/body/body.ts | 1 + src/file/file.spec.ts | 24 ++++++++++++------------ 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/file/document/body/body.spec.ts b/src/file/document/body/body.spec.ts index a5bc222fb4..b63a95dcd1 100644 --- a/src/file/document/body/body.spec.ts +++ b/src/file/document/body/body.spec.ts @@ -22,9 +22,6 @@ describe("Body", () => { expect(tree).to.deep.equal({ "w:body": [ - { - "w:p": {}, - }, { "w:sectPr": [ { "w:pgSz": { _attr: { "w:w": 10000, "w:h": 10000, "w:orient": "portrait" } } }, diff --git a/src/file/document/body/body.ts b/src/file/document/body/body.ts index e91b72d59a..ddf577b429 100644 --- a/src/file/document/body/body.ts +++ b/src/file/document/body/body.ts @@ -26,6 +26,7 @@ export class Body extends XmlComponent { public prepForXml(): IXmlableObject | undefined { if (this.sections.length === 1) { + this.root.splice(0, 1); this.root.push(this.sections.pop() as SectionProperties); } diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index e34feea1b6..13bdec87af 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -20,8 +20,8 @@ describe("File", () => { const tree = new Formatter().format(doc.Document.Body); - expect(tree["w:body"][1]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); - expect(tree["w:body"][1]["w:sectPr"][5]["w:footerReference"]._attr["w:type"]).to.equal("default"); + expect(tree["w:body"][0]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); + expect(tree["w:body"][0]["w:sectPr"][5]["w:footerReference"]._attr["w:type"]).to.equal("default"); }); it("should create with correct headers and footers", () => { @@ -39,8 +39,8 @@ describe("File", () => { const tree = new Formatter().format(doc.Document.Body); - expect(tree["w:body"][1]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); - expect(tree["w:body"][1]["w:sectPr"][5]["w:footerReference"]._attr["w:type"]).to.equal("default"); + expect(tree["w:body"][0]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); + expect(tree["w:body"][0]["w:sectPr"][5]["w:footerReference"]._attr["w:type"]).to.equal("default"); }); it("should create with first headers and footers", () => { @@ -58,8 +58,8 @@ describe("File", () => { const tree = new Formatter().format(doc.Document.Body); - expect(tree["w:body"][1]["w:sectPr"][5]["w:headerReference"]._attr["w:type"]).to.equal("first"); - expect(tree["w:body"][1]["w:sectPr"][7]["w:footerReference"]._attr["w:type"]).to.equal("first"); + expect(tree["w:body"][0]["w:sectPr"][5]["w:headerReference"]._attr["w:type"]).to.equal("first"); + expect(tree["w:body"][0]["w:sectPr"][7]["w:footerReference"]._attr["w:type"]).to.equal("first"); }); it("should create with correct headers", () => { @@ -81,13 +81,13 @@ describe("File", () => { const tree = new Formatter().format(doc.Document.Body); - expect(tree["w:body"][1]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); - expect(tree["w:body"][1]["w:sectPr"][5]["w:headerReference"]._attr["w:type"]).to.equal("first"); - expect(tree["w:body"][1]["w:sectPr"][6]["w:headerReference"]._attr["w:type"]).to.equal("even"); + expect(tree["w:body"][0]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); + expect(tree["w:body"][0]["w:sectPr"][5]["w:headerReference"]._attr["w:type"]).to.equal("first"); + expect(tree["w:body"][0]["w:sectPr"][6]["w:headerReference"]._attr["w:type"]).to.equal("even"); - expect(tree["w:body"][1]["w:sectPr"][7]["w:footerReference"]._attr["w:type"]).to.equal("default"); - expect(tree["w:body"][1]["w:sectPr"][8]["w:footerReference"]._attr["w:type"]).to.equal("first"); - expect(tree["w:body"][1]["w:sectPr"][9]["w:footerReference"]._attr["w:type"]).to.equal("even"); + expect(tree["w:body"][0]["w:sectPr"][7]["w:footerReference"]._attr["w:type"]).to.equal("default"); + expect(tree["w:body"][0]["w:sectPr"][8]["w:footerReference"]._attr["w:type"]).to.equal("first"); + expect(tree["w:body"][0]["w:sectPr"][9]["w:footerReference"]._attr["w:type"]).to.equal("even"); }); }); From c68dc8c52a44eb2ec198331bb1d2ddade149b330 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 18 Dec 2019 21:11:15 +0000 Subject: [PATCH 029/147] Make hyperlinks declarative --- demo/35-hyperlinks.ts | 14 ++++-- src/export/formatter.ts | 5 ++- src/export/packer/next-compiler.ts | 32 ++++++------- src/file/core-properties/properties.ts | 6 +++ src/file/document/body/body.ts | 5 ++- src/file/document/document.ts | 4 +- src/file/file.ts | 57 ++++++++++++++++++------ src/file/paragraph/formatting/style.ts | 3 -- src/file/paragraph/links/hyperlink.ts | 4 ++ src/file/paragraph/paragraph.ts | 18 ++++++-- src/file/table/table-cell/table-cell.ts | 5 ++- src/file/xml-components/base.ts | 3 +- src/file/xml-components/index.ts | 1 + src/file/xml-components/xml-component.ts | 10 ++--- 14 files changed, 114 insertions(+), 53 deletions(-) diff --git a/demo/35-hyperlinks.ts b/demo/35-hyperlinks.ts index 6392299b84..9d2bd5062e 100644 --- a/demo/35-hyperlinks.ts +++ b/demo/35-hyperlinks.ts @@ -1,15 +1,21 @@ // Example on how to add hyperlinks to websites // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Packer, Paragraph } from "../build"; +import { Document, HyperlinkRef, Packer, Paragraph } from "../build"; -const doc = new Document(); -const link = doc.createHyperlink("http://www.example.com", "Hyperlink"); +const doc = new Document({ + hyperlinks: { + myCoolLink: { + link: "http://www.example.com", + text: "Hyperlink", + }, + }, +}); doc.addSection({ children: [ new Paragraph({ - children: [link], + children: [new HyperlinkRef("myCoolLink")], }), ], }); diff --git a/src/export/formatter.ts b/src/export/formatter.ts index 0a28070d13..b863ea4b97 100644 --- a/src/export/formatter.ts +++ b/src/export/formatter.ts @@ -1,8 +1,9 @@ import { BaseXmlComponent, IXmlableObject } from "file/xml-components"; +import { File } from "../file"; export class Formatter { - public format(input: BaseXmlComponent): IXmlableObject { - const output = input.prepForXml(); + public format(input: BaseXmlComponent, file?: File): IXmlableObject { + const output = input.prepForXml(file); if (output) { return output; diff --git a/src/export/packer/next-compiler.ts b/src/export/packer/next-compiler.ts index bff24a8ef7..a7b5fb617e 100644 --- a/src/export/packer/next-compiler.ts +++ b/src/export/packer/next-compiler.ts @@ -71,7 +71,7 @@ export class Compiler { file.verifyUpdateFields(); const documentRelationshipCount = file.DocumentRelationships.RelationshipCount + 1; - const documentXmlData = xml(this.formatter.format(file.Document), prettify); + const documentXmlData = xml(this.formatter.format(file.Document, file), prettify); const documentMediaDatas = this.imageReplacer.getMediaData(documentXmlData, file.Media); return { @@ -85,7 +85,7 @@ export class Compiler { ); }); - return xml(this.formatter.format(file.DocumentRelationships), prettify); + return xml(this.formatter.format(file.DocumentRelationships, file), prettify); })(), path: "word/_rels/document.xml.rels", }, @@ -99,11 +99,11 @@ export class Compiler { path: "word/document.xml", }, Styles: { - data: xml(this.formatter.format(file.Styles), prettify), + data: xml(this.formatter.format(file.Styles, file), prettify), path: "word/styles.xml", }, Properties: { - data: xml(this.formatter.format(file.CoreProperties), { + data: xml(this.formatter.format(file.CoreProperties, file), { declaration: { standalone: "yes", encoding: "UTF-8", @@ -112,15 +112,15 @@ export class Compiler { path: "docProps/core.xml", }, Numbering: { - data: xml(this.formatter.format(file.Numbering), prettify), + data: xml(this.formatter.format(file.Numbering, file), prettify), path: "word/numbering.xml", }, FileRelationships: { - data: xml(this.formatter.format(file.FileRelationships), prettify), + data: xml(this.formatter.format(file.FileRelationships, file), prettify), path: "_rels/.rels", }, HeaderRelationships: file.Headers.map((headerWrapper, index) => { - const xmlData = xml(this.formatter.format(headerWrapper.Header), prettify); + const xmlData = xml(this.formatter.format(headerWrapper.Header, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); mediaDatas.forEach((mediaData, i) => { @@ -132,12 +132,12 @@ export class Compiler { }); return { - data: xml(this.formatter.format(headerWrapper.Relationships), prettify), + data: xml(this.formatter.format(headerWrapper.Relationships, file), prettify), path: `word/_rels/header${index + 1}.xml.rels`, }; }), FooterRelationships: file.Footers.map((footerWrapper, index) => { - const xmlData = xml(this.formatter.format(footerWrapper.Footer), prettify); + const xmlData = xml(this.formatter.format(footerWrapper.Footer, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); mediaDatas.forEach((mediaData, i) => { @@ -149,12 +149,12 @@ export class Compiler { }); return { - data: xml(this.formatter.format(footerWrapper.Relationships), prettify), + data: xml(this.formatter.format(footerWrapper.Relationships, file), prettify), path: `word/_rels/footer${index + 1}.xml.rels`, }; }), Headers: file.Headers.map((headerWrapper, index) => { - const tempXmlData = xml(this.formatter.format(headerWrapper.Header), prettify); + const tempXmlData = xml(this.formatter.format(headerWrapper.Header, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); // TODO: 0 needs to be changed when headers get relationships of their own const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); @@ -165,7 +165,7 @@ export class Compiler { }; }), Footers: file.Footers.map((footerWrapper, index) => { - const tempXmlData = xml(this.formatter.format(footerWrapper.Footer), prettify); + const tempXmlData = xml(this.formatter.format(footerWrapper.Footer, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); // TODO: 0 needs to be changed when headers get relationships of their own const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); @@ -176,19 +176,19 @@ export class Compiler { }; }), ContentTypes: { - data: xml(this.formatter.format(file.ContentTypes), prettify), + data: xml(this.formatter.format(file.ContentTypes, file), prettify), path: "[Content_Types].xml", }, AppProperties: { - data: xml(this.formatter.format(file.AppProperties), prettify), + data: xml(this.formatter.format(file.AppProperties, file), prettify), path: "docProps/app.xml", }, FootNotes: { - data: xml(this.formatter.format(file.FootNotes), prettify), + data: xml(this.formatter.format(file.FootNotes, file), prettify), path: "word/footnotes.xml", }, Settings: { - data: xml(this.formatter.format(file.Settings), prettify), + data: xml(this.formatter.format(file.Settings, file), prettify), path: "word/settings.xml", }, }; diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index e807f0fd5f..3fb7bf45a4 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -18,6 +18,12 @@ export interface IPropertiesOptions { readonly styles?: IStylesOptions; readonly numbering?: INumberingOptions; readonly footnotes?: Paragraph[]; + readonly hyperlinks?: { + readonly [key: string]: { + readonly link: string; + readonly text: string; + }; + }; } export class CoreProperties extends XmlComponent { diff --git a/src/file/document/body/body.ts b/src/file/document/body/body.ts index e91b72d59a..1fcb3ab412 100644 --- a/src/file/document/body/body.ts +++ b/src/file/document/body/body.ts @@ -1,5 +1,6 @@ import { IXmlableObject, XmlComponent } from "file/xml-components"; import { Paragraph, ParagraphProperties, TableOfContents } from "../.."; +import { File } from "../../../file"; import { SectionProperties, SectionPropertiesOptions } from "./section-properties/section-properties"; export class Body extends XmlComponent { @@ -24,12 +25,12 @@ export class Body extends XmlComponent { this.sections.push(new SectionProperties(options)); } - public prepForXml(): IXmlableObject | undefined { + public prepForXml(file?: File): IXmlableObject | undefined { if (this.sections.length === 1) { this.root.push(this.sections.pop() as SectionProperties); } - return super.prepForXml(); + return super.prepForXml(file); } public push(component: XmlComponent): void { diff --git a/src/file/document/document.ts b/src/file/document/document.ts index d8c0c55131..80b04a379c 100644 --- a/src/file/document/document.ts +++ b/src/file/document/document.ts @@ -1,6 +1,6 @@ // http://officeopenxml.com/WPdocument.php import { XmlComponent } from "file/xml-components"; -import { Paragraph } from "../paragraph"; +import { Hyperlink, Paragraph } from "../paragraph"; import { Table } from "../table"; import { TableOfContents } from "../table-of-contents"; import { Body } from "./body"; @@ -36,7 +36,7 @@ export class Document extends XmlComponent { this.root.push(this.body); } - public add(item: Paragraph | Table | TableOfContents): Document { + public add(item: Paragraph | Table | TableOfContents | Hyperlink): Document { this.body.push(item); return this; } diff --git a/src/file/file.ts b/src/file/file.ts index f2bcad3610..14f6382b9f 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -17,7 +17,7 @@ import { Footer, Header } from "./header"; import { HeaderWrapper, IDocumentHeader } from "./header-wrapper"; import { Media } from "./media"; import { Numbering } from "./numbering"; -import { Bookmark, Hyperlink, Paragraph } from "./paragraph"; +import { Bookmark, Hyperlink, HyperlinkRef, Paragraph } from "./paragraph"; import { Relationships } from "./relationships"; import { TargetModeType } from "./relationships/relationship/relationship"; import { Settings } from "./settings"; @@ -61,13 +61,13 @@ export class File { private readonly contentTypes: ContentTypes; private readonly appProperties: AppProperties; private readonly styles: Styles; + private readonly hyperlinkCache: { readonly [key: string]: Hyperlink }; constructor( options: IPropertiesOptions = { creator: "Un-named", revision: "1", lastModifiedBy: "Un-named", - footnotes: [], }, fileProperties: IFileProperties = {}, sections: ISectionOptions[] = [], @@ -134,6 +134,12 @@ export class File { this.document.Body.addSection(section.properties ? section.properties : {}); for (const child of section.children) { + if (child instanceof HyperlinkRef) { + const hyperlink = this.hyperlinkCache[child.id]; + this.document.add(hyperlink); + continue; + } + this.document.add(child); } } @@ -143,18 +149,21 @@ export class File { this.footNotes.createFootNote(paragraph); } } - } - public createHyperlink(link: string, text?: string): Hyperlink { - const newText = text === undefined ? link : text; - const hyperlink = new Hyperlink(newText, shortid.generate().toLowerCase()); - this.docRelationships.createRelationship( - hyperlink.linkId, - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", - link, - TargetModeType.EXTERNAL, - ); - return hyperlink; + if (options.hyperlinks) { + const cache = {}; + + for (const key in options.hyperlinks) { + if (!options.hyperlinks[key]) { + continue; + } + + const hyperlink = this.createHyperlink(options.hyperlinks[key].link, options.hyperlinks[key].text); + cache[key] = hyperlink; + } + + this.hyperlinkCache = cache; + } } public createInternalHyperLink(anchor: string, text?: string): Hyperlink { @@ -194,6 +203,12 @@ export class File { }); for (const child of children) { + if (child instanceof HyperlinkRef) { + const hyperlink = this.hyperlinkCache[child.id]; + this.document.add(hyperlink); + continue; + } + this.document.add(child); } } @@ -204,6 +219,18 @@ export class File { } } + private createHyperlink(link: string, text?: string): Hyperlink { + const newText = text === undefined ? link : text; + const hyperlink = new Hyperlink(newText, shortid.generate().toLowerCase()); + this.docRelationships.createRelationship( + hyperlink.linkId, + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", + link, + TargetModeType.EXTERNAL, + ); + return hyperlink; + } + private createHeader(header: Header): HeaderWrapper { const wrapper = new HeaderWrapper(this.media, this.currentRelationshipId++); @@ -336,4 +363,8 @@ export class File { public get Settings(): Settings { return this.settings; } + + public get HyperlinkCache(): { readonly [key: string]: Hyperlink } { + return this.hyperlinkCache; + } } diff --git a/src/file/paragraph/formatting/style.ts b/src/file/paragraph/formatting/style.ts index a493e4b025..edde301290 100644 --- a/src/file/paragraph/formatting/style.ts +++ b/src/file/paragraph/formatting/style.ts @@ -11,11 +11,8 @@ export enum HeadingLevel { } export class Style extends XmlComponent { - public readonly styleId: string; - constructor(styleId: string) { super("w:pStyle"); - this.styleId = styleId; this.root.push( new Attributes({ val: styleId, diff --git a/src/file/paragraph/links/hyperlink.ts b/src/file/paragraph/links/hyperlink.ts index 30e60616ec..ed69331863 100644 --- a/src/file/paragraph/links/hyperlink.ts +++ b/src/file/paragraph/links/hyperlink.ts @@ -3,6 +3,10 @@ import { XmlComponent } from "file/xml-components"; import { TextRun } from "../run"; import { HyperlinkAttributes, IHyperlinkAttributesProperties } from "./hyperlink-attributes"; +export class HyperlinkRef { + constructor(public readonly id: string) {} +} + export class Hyperlink extends XmlComponent { public readonly linkId: string; private readonly textRun: TextRun; diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index 7de245fab8..c97d8d34fd 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -1,7 +1,8 @@ // http://officeopenxml.com/WPparagraph.php import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; -import { XmlComponent } from "file/xml-components"; +import { IXmlableObject, XmlComponent } from "file/xml-components"; +import { File } from "../file"; import { Alignment, AlignmentType } from "./formatting/alignment"; import { Bidirectional } from "./formatting/bidirectional"; import { IBorderOptions, ThematicBreak } from "./formatting/border"; @@ -12,7 +13,7 @@ import { ContextualSpacing, ISpacingProperties, Spacing } from "./formatting/spa import { HeadingLevel, Style } from "./formatting/style"; import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop"; import { NumberProperties } from "./formatting/unordered-list"; -import { Bookmark, Hyperlink, OutlineLevel } from "./links"; +import { Bookmark, HyperlinkRef, OutlineLevel } from "./links"; import { ParagraphProperties } from "./properties"; import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run"; @@ -45,7 +46,7 @@ export interface IParagraphOptions { readonly custom?: boolean; }; readonly children?: Array< - TextRun | PictureRun | Hyperlink | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun + TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef >; } @@ -159,6 +160,17 @@ export class Paragraph extends XmlComponent { } } + public prepForXml(file: File): IXmlableObject | undefined { + for (const element of this.root) { + if (element instanceof HyperlinkRef) { + const index = this.root.indexOf(element); + this.root[index] = file.HyperlinkCache[element.id]; + } + } + + return super.prepForXml(); + } + public addRunToFront(run: Run): Paragraph { this.root.splice(1, 0, run); return this; diff --git a/src/file/table/table-cell/table-cell.ts b/src/file/table/table-cell/table-cell.ts index 469331bc08..fe8f8b5868 100644 --- a/src/file/table/table-cell/table-cell.ts +++ b/src/file/table/table-cell/table-cell.ts @@ -3,6 +3,7 @@ import { Paragraph } from "file/paragraph"; import { BorderStyle } from "file/styles"; import { IXmlableObject, XmlComponent } from "file/xml-components"; +import { File } from "../../file"; import { ITableShadingAttributesProperties } from "../shading"; import { Table } from "../table"; import { ITableCellMarginOptions } from "./cell-margin/table-cell-margins"; @@ -110,11 +111,11 @@ export class TableCell extends XmlComponent { } } - public prepForXml(): IXmlableObject | undefined { + public prepForXml(file?: File): IXmlableObject | undefined { // Cells must end with a paragraph if (!(this.root[this.root.length - 1] instanceof Paragraph)) { this.root.push(new Paragraph({})); } - return super.prepForXml(); + return super.prepForXml(file); } } diff --git a/src/file/xml-components/base.ts b/src/file/xml-components/base.ts index cfc4ec47b3..782dfdba12 100644 --- a/src/file/xml-components/base.ts +++ b/src/file/xml-components/base.ts @@ -1,3 +1,4 @@ +import { File } from "../file"; import { IXmlableObject } from "./xmlable-object"; export abstract class BaseXmlComponent { @@ -9,7 +10,7 @@ export abstract class BaseXmlComponent { this.rootKey = rootKey; } - public abstract prepForXml(): IXmlableObject | undefined; + public abstract prepForXml(file?: File): IXmlableObject | undefined; public get IsDeleted(): boolean { return this.deleted; diff --git a/src/file/xml-components/index.ts b/src/file/xml-components/index.ts index 66e9641bfd..295161b395 100644 --- a/src/file/xml-components/index.ts +++ b/src/file/xml-components/index.ts @@ -4,3 +4,4 @@ export * from "./default-attributes"; export * from "./imported-xml-component"; export * from "./xmlable-object"; export * from "./initializable-xml-component"; +export * from "./base"; diff --git a/src/file/xml-components/xml-component.ts b/src/file/xml-components/xml-component.ts index 59192e3e4d..dfe3800b96 100644 --- a/src/file/xml-components/xml-component.ts +++ b/src/file/xml-components/xml-component.ts @@ -1,19 +1,19 @@ +import { File } from "../file"; import { BaseXmlComponent } from "./base"; import { IXmlableObject } from "./xmlable-object"; -export { BaseXmlComponent }; export const EMPTY_OBJECT = Object.seal({}); export abstract class XmlComponent extends BaseXmlComponent { - // tslint:disable-next-line:readonly-keyword - protected root: Array; + // tslint:disable-next-line:readonly-keyword no-any + protected root: Array; constructor(rootKey: string) { super(rootKey); this.root = new Array(); } - public prepForXml(): IXmlableObject | undefined { + public prepForXml(file?: File): IXmlableObject | undefined { const children = this.root .filter((c) => { if (c instanceof BaseXmlComponent) { @@ -23,7 +23,7 @@ export abstract class XmlComponent extends BaseXmlComponent { }) .map((comp) => { if (comp instanceof BaseXmlComponent) { - return comp.prepForXml(); + return comp.prepForXml(file); } return comp; }) From 3fdbca939e95223ccbb50e572915f61514e9ec0b Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 21 Dec 2019 03:31:09 +0000 Subject: [PATCH 030/147] Make internal hyperlink declarative --- demo/21-bookmarks.ts | 15 +++++++------ demo/35-hyperlinks.ts | 3 ++- src/file/core-properties/properties.ts | 18 +++++++++++----- src/file/file.ts | 30 +++++++++++++++----------- src/file/paragraph/links/bookmark.ts | 4 ++++ src/file/paragraph/links/hyperlink.ts | 5 +++++ src/file/paragraph/paragraph.ts | 4 ++-- 7 files changed, 52 insertions(+), 27 deletions(-) diff --git a/demo/21-bookmarks.ts b/demo/21-bookmarks.ts index cc0bac5517..d104ca7574 100644 --- a/demo/21-bookmarks.ts +++ b/demo/21-bookmarks.ts @@ -1,7 +1,7 @@ // This demo shows how to create bookmarks then link to them with internal hyperlinks // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HeadingLevel, Packer, PageBreak, Paragraph } from "../build"; +import { Document, HeadingLevel, HyperlinkRef, HyperlinkType, Packer, PageBreak, Paragraph } from "../build"; const LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi velit, convallis convallis scelerisque nec, faucibus nec leo. Phasellus at posuere mauris, tempus dignissim velit. Integer et tortor dolor. Duis auctor efficitur mattis. Vivamus ut metus accumsan tellus auctor sollicitudin venenatis et nibh. Cras quis massa ac metus fringilla venenatis. Proin rutrum mauris purus, ut suscipit magna consectetur id. Integer consectetur sollicitudin ante, vitae faucibus neque efficitur in. Praesent ultricies nibh lectus. Mauris pharetra id odio eget iaculis. Duis dictum, risus id pellentesque rutrum, lorem quam malesuada massa, quis ullamcorper turpis urna a diam. Cras vulputate metus vel massa porta ullamcorper. Etiam porta condimentum nulla nec tristique. Sed nulla urna, pharetra non tortor sed, sollicitudin molestie diam. Maecenas enim leo, feugiat eget vehicula id, sollicitudin vitae ante."; @@ -10,13 +10,16 @@ const doc = new Document({ creator: "Clippy", title: "Sample Document", description: "A brief example of using docx with bookmarks and internal hyperlinks", + hyperlinks: { + myAnchorId: { + text: "Hyperlink", + type: HyperlinkType.INTERNAL, + }, + }, }); -const anchorId = "anchorID"; - // First create the bookmark -const bookmark = doc.createBookmark(anchorId, "Lorem Ipsum"); -const hyperlink = doc.createInternalHyperLink(anchorId, `Click me!`); +const bookmark = doc.createBookmark("myAnchorId", "Lorem Ipsum"); doc.addSection({ children: [ @@ -30,7 +33,7 @@ doc.addSection({ children: [new PageBreak()], }), new Paragraph({ - children: [hyperlink], + children: [new HyperlinkRef("myAnchorId")], }), ], }); diff --git a/demo/35-hyperlinks.ts b/demo/35-hyperlinks.ts index 9d2bd5062e..fb84f13099 100644 --- a/demo/35-hyperlinks.ts +++ b/demo/35-hyperlinks.ts @@ -1,13 +1,14 @@ // Example on how to add hyperlinks to websites // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HyperlinkRef, Packer, Paragraph } from "../build"; +import { Document, HyperlinkRef, HyperlinkType, Packer, Paragraph } from "../build"; const doc = new Document({ hyperlinks: { myCoolLink: { link: "http://www.example.com", text: "Hyperlink", + type: HyperlinkType.EXTERNAL, }, }, }); diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index 3fb7bf45a4..ceddff39e0 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -2,10 +2,21 @@ import { XmlComponent } from "file/xml-components"; import { DocumentAttributes } from "../document/document-attributes"; import { INumberingOptions } from "../numbering"; -import { Paragraph } from "../paragraph"; +import { HyperlinkType, Paragraph } from "../paragraph"; import { IStylesOptions } from "../styles"; import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components"; +export interface IInternalHyperlinkDefinition { + readonly text: string; + readonly type: HyperlinkType.INTERNAL; +} + +export interface IExternalHyperlinkDefinition { + readonly link: string; + readonly text: string; + readonly type: HyperlinkType.EXTERNAL; +} + export interface IPropertiesOptions { readonly title?: string; readonly subject?: string; @@ -19,10 +30,7 @@ export interface IPropertiesOptions { readonly numbering?: INumberingOptions; readonly footnotes?: Paragraph[]; readonly hyperlinks?: { - readonly [key: string]: { - readonly link: string; - readonly text: string; - }; + readonly [key: string]: IInternalHyperlinkDefinition | IExternalHyperlinkDefinition; }; } diff --git a/src/file/file.ts b/src/file/file.ts index 14f6382b9f..21a8487d71 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -17,7 +17,7 @@ import { Footer, Header } from "./header"; import { HeaderWrapper, IDocumentHeader } from "./header-wrapper"; import { Media } from "./media"; import { Numbering } from "./numbering"; -import { Bookmark, Hyperlink, HyperlinkRef, Paragraph } from "./paragraph"; +import { Bookmark, Hyperlink, HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph"; import { Relationships } from "./relationships"; import { TargetModeType } from "./relationships/relationship/relationship"; import { Settings } from "./settings"; @@ -158,7 +158,13 @@ export class File { continue; } - const hyperlink = this.createHyperlink(options.hyperlinks[key].link, options.hyperlinks[key].text); + const hyperlinkRef = options.hyperlinks[key]; + + const hyperlink = + hyperlinkRef.type === HyperlinkType.EXTERNAL + ? this.createHyperlink(hyperlinkRef.link, hyperlinkRef.text) + : this.createInternalHyperLink(key, hyperlinkRef.text); + cache[key] = hyperlink; } @@ -166,14 +172,6 @@ export class File { } } - public createInternalHyperLink(anchor: string, text?: string): Hyperlink { - const newText = text === undefined ? anchor : text; - const hyperlink = new Hyperlink(newText, shortid.generate().toLowerCase(), anchor); - // NOTE: unlike File#createHyperlink(), since the link is to an internal bookmark - // we don't need to create a new relationship. - return hyperlink; - } - public createBookmark(name: string, text: string = name): Bookmark { return new Bookmark(name, text, this.docRelationships.RelationshipCount); } @@ -219,9 +217,8 @@ export class File { } } - private createHyperlink(link: string, text?: string): Hyperlink { - const newText = text === undefined ? link : text; - const hyperlink = new Hyperlink(newText, shortid.generate().toLowerCase()); + private createHyperlink(link: string, text: string = link): Hyperlink { + const hyperlink = new Hyperlink(text, shortid.generate().toLowerCase()); this.docRelationships.createRelationship( hyperlink.linkId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", @@ -231,6 +228,13 @@ export class File { return hyperlink; } + private createInternalHyperLink(anchor: string, text: string = anchor): Hyperlink { + const hyperlink = new Hyperlink(text, shortid.generate().toLowerCase(), anchor); + // NOTE: unlike File#createHyperlink(), since the link is to an internal bookmark + // we don't need to create a new relationship. + return hyperlink; + } + private createHeader(header: Header): HeaderWrapper { const wrapper = new HeaderWrapper(this.media, this.currentRelationshipId++); diff --git a/src/file/paragraph/links/bookmark.ts b/src/file/paragraph/links/bookmark.ts index c8c339e578..5ef567899b 100644 --- a/src/file/paragraph/links/bookmark.ts +++ b/src/file/paragraph/links/bookmark.ts @@ -3,6 +3,10 @@ import { XmlComponent } from "file/xml-components"; import { TextRun } from "../run"; import { BookmarkEndAttributes, BookmarkStartAttributes } from "./bookmark-attributes"; +export class BookmarkRef { + constructor(public readonly name: string, public readonly text: string) {} +} + export class Bookmark { public readonly linkId: number; public readonly start: BookmarkStart; diff --git a/src/file/paragraph/links/hyperlink.ts b/src/file/paragraph/links/hyperlink.ts index ed69331863..302acfd603 100644 --- a/src/file/paragraph/links/hyperlink.ts +++ b/src/file/paragraph/links/hyperlink.ts @@ -3,6 +3,11 @@ import { XmlComponent } from "file/xml-components"; import { TextRun } from "../run"; import { HyperlinkAttributes, IHyperlinkAttributesProperties } from "./hyperlink-attributes"; +export enum HyperlinkType { + INTERNAL = "INTERNAL", + EXTERNAL = "EXTERNAL", +} + export class HyperlinkRef { constructor(public readonly id: string) {} } diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index c97d8d34fd..c1a8861568 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -13,7 +13,7 @@ import { ContextualSpacing, ISpacingProperties, Spacing } from "./formatting/spa import { HeadingLevel, Style } from "./formatting/style"; import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop"; import { NumberProperties } from "./formatting/unordered-list"; -import { Bookmark, HyperlinkRef, OutlineLevel } from "./links"; +import { Bookmark, BookmarkRef, HyperlinkRef, OutlineLevel } from "./links"; import { ParagraphProperties } from "./properties"; import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run"; @@ -46,7 +46,7 @@ export interface IParagraphOptions { readonly custom?: boolean; }; readonly children?: Array< - TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef + TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef | BookmarkRef >; } From ee5425bef71ff99301e30f8be66debbc912760d2 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 21 Dec 2019 03:58:58 +0000 Subject: [PATCH 031/147] Add shortId type --- package-lock.json | 6 ++++++ package.json | 1 + 2 files changed, 7 insertions(+) diff --git a/package-lock.json b/package-lock.json index ee20450d0e..792ca7e14b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -355,6 +355,12 @@ "@types/node": "*" } }, + "@types/shortid": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/shortid/-/shortid-0.0.29.tgz", + "integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=", + "dev": true + }, "@types/sinon": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.3.3.tgz", diff --git a/package.json b/package.json index cc50a5d9e0..2ad66b4a64 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "@types/chai": "^3.4.35", "@types/mocha": "^2.2.39", "@types/request-promise": "^4.1.42", + "@types/shortid": "0.0.29", "@types/sinon": "^4.3.1", "@types/webpack": "^4.4.24", "awesome-typescript-loader": "^3.4.1", From b83d2c388fefb943893cae9610747eb2f6bba057 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 21 Dec 2019 03:59:40 +0000 Subject: [PATCH 032/147] Make Bookmark declarative --- demo/21-bookmarks.ts | 7 ++---- src/file/file.ts | 6 +----- src/file/paragraph/links/bookmark.spec.ts | 16 +++++--------- src/file/paragraph/links/bookmark.ts | 26 ++++++++--------------- 4 files changed, 17 insertions(+), 38 deletions(-) diff --git a/demo/21-bookmarks.ts b/demo/21-bookmarks.ts index d104ca7574..1ad50eb9b1 100644 --- a/demo/21-bookmarks.ts +++ b/demo/21-bookmarks.ts @@ -1,7 +1,7 @@ // This demo shows how to create bookmarks then link to them with internal hyperlinks // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HeadingLevel, HyperlinkRef, HyperlinkType, Packer, PageBreak, Paragraph } from "../build"; +import { Bookmark, Document, HeadingLevel, HyperlinkRef, HyperlinkType, Packer, PageBreak, Paragraph } from "../build"; const LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi velit, convallis convallis scelerisque nec, faucibus nec leo. Phasellus at posuere mauris, tempus dignissim velit. Integer et tortor dolor. Duis auctor efficitur mattis. Vivamus ut metus accumsan tellus auctor sollicitudin venenatis et nibh. Cras quis massa ac metus fringilla venenatis. Proin rutrum mauris purus, ut suscipit magna consectetur id. Integer consectetur sollicitudin ante, vitae faucibus neque efficitur in. Praesent ultricies nibh lectus. Mauris pharetra id odio eget iaculis. Duis dictum, risus id pellentesque rutrum, lorem quam malesuada massa, quis ullamcorper turpis urna a diam. Cras vulputate metus vel massa porta ullamcorper. Etiam porta condimentum nulla nec tristique. Sed nulla urna, pharetra non tortor sed, sollicitudin molestie diam. Maecenas enim leo, feugiat eget vehicula id, sollicitudin vitae ante."; @@ -18,14 +18,11 @@ const doc = new Document({ }, }); -// First create the bookmark -const bookmark = doc.createBookmark("myAnchorId", "Lorem Ipsum"); - doc.addSection({ children: [ new Paragraph({ heading: HeadingLevel.HEADING_1, - children: [bookmark], + children: [new Bookmark("myAnchorId", "Lorem Ipsum")], }), new Paragraph("\n"), new Paragraph(LOREM_IPSUM), diff --git a/src/file/file.ts b/src/file/file.ts index 21a8487d71..e549b4b624 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -17,7 +17,7 @@ import { Footer, Header } from "./header"; import { HeaderWrapper, IDocumentHeader } from "./header-wrapper"; import { Media } from "./media"; import { Numbering } from "./numbering"; -import { Bookmark, Hyperlink, HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph"; +import { Hyperlink, HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph"; import { Relationships } from "./relationships"; import { TargetModeType } from "./relationships/relationship/relationship"; import { Settings } from "./settings"; @@ -172,10 +172,6 @@ export class File { } } - public createBookmark(name: string, text: string = name): Bookmark { - return new Bookmark(name, text, this.docRelationships.RelationshipCount); - } - public addSection({ headers = { default: new Header() }, footers = { default: new Header() }, diff --git a/src/file/paragraph/links/bookmark.spec.ts b/src/file/paragraph/links/bookmark.spec.ts index a597347013..fe342fc374 100644 --- a/src/file/paragraph/links/bookmark.spec.ts +++ b/src/file/paragraph/links/bookmark.spec.ts @@ -1,4 +1,4 @@ -import { assert } from "chai"; +import { assert, expect } from "chai"; import { Utility } from "tests/utility"; @@ -8,7 +8,7 @@ describe("Bookmark", () => { let bookmark: Bookmark; beforeEach(() => { - bookmark = new Bookmark("anchor", "Internal Link", 0); + bookmark = new Bookmark("anchor", "Internal Link"); }); it("should create a bookmark with three root elements", () => { @@ -21,11 +21,8 @@ describe("Bookmark", () => { it("should create a bookmark with the correct attributes on the bookmark start element", () => { const newJson = Utility.jsonify(bookmark); - const attributes = { - name: "anchor", - id: "1", - }; - assert.equal(JSON.stringify(newJson.start.root[0].root), JSON.stringify(attributes)); + + assert.equal(newJson.start.root[0].root.name, "anchor"); }); it("should create a bookmark with the correct attributes on the text element", () => { @@ -35,9 +32,6 @@ describe("Bookmark", () => { it("should create a bookmark with the correct attributes on the bookmark end element", () => { const newJson = Utility.jsonify(bookmark); - const attributes = { - id: "1", - }; - assert.equal(JSON.stringify(newJson.end.root[0].root), JSON.stringify(attributes)); + expect(newJson.end.root[0].root.id).to.be.a("string"); }); }); diff --git a/src/file/paragraph/links/bookmark.ts b/src/file/paragraph/links/bookmark.ts index 5ef567899b..addf14530e 100644 --- a/src/file/paragraph/links/bookmark.ts +++ b/src/file/paragraph/links/bookmark.ts @@ -1,5 +1,6 @@ // http://officeopenxml.com/WPbookmark.php import { XmlComponent } from "file/xml-components"; +import * as shortid from "shortid"; import { TextRun } from "../run"; import { BookmarkEndAttributes, BookmarkStartAttributes } from "./bookmark-attributes"; @@ -8,46 +9,37 @@ export class BookmarkRef { } export class Bookmark { - public readonly linkId: number; public readonly start: BookmarkStart; public readonly text: TextRun; public readonly end: BookmarkEnd; - constructor(name: string, text: string, relationshipsCount: number) { - this.linkId = relationshipsCount + 1; + constructor(name: string, text: string) { + const linkId = shortid.generate().toLowerCase(); - this.start = new BookmarkStart(name, this.linkId); + this.start = new BookmarkStart(name, linkId); this.text = new TextRun(text); - this.end = new BookmarkEnd(this.linkId); + this.end = new BookmarkEnd(linkId); } } export class BookmarkStart extends XmlComponent { - public readonly linkId: number; - - constructor(name: string, relationshipsCount: number) { + constructor(name: string, linkId: string) { super("w:bookmarkStart"); - this.linkId = relationshipsCount; - const id = `${this.linkId}`; const attributes = new BookmarkStartAttributes({ name, - id, + id: linkId, }); this.root.push(attributes); } } export class BookmarkEnd extends XmlComponent { - public readonly linkId: number; - - constructor(relationshipsCount: number) { + constructor(linkId: string) { super("w:bookmarkEnd"); - this.linkId = relationshipsCount; - const id = `${this.linkId}`; const attributes = new BookmarkEndAttributes({ - id, + id: linkId, }); this.root.push(attributes); } From de03f19b46ba375832ea18fdf60777c51b5c3325 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 24 Dec 2019 00:44:15 +0000 Subject: [PATCH 033/147] Remove unused code and improve coverage --- src/file/paragraph/links/bookmark.ts | 4 ---- src/file/paragraph/links/hyperlink.spec.ts | 9 ++++++++ src/file/paragraph/paragraph.ts | 4 ++-- src/file/paragraph/run/picture-run.ts | 4 ---- src/file/paragraph/run/run.spec.ts | 24 ++++++++++++++++++++++ 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/file/paragraph/links/bookmark.ts b/src/file/paragraph/links/bookmark.ts index addf14530e..261a756864 100644 --- a/src/file/paragraph/links/bookmark.ts +++ b/src/file/paragraph/links/bookmark.ts @@ -4,10 +4,6 @@ import * as shortid from "shortid"; import { TextRun } from "../run"; import { BookmarkEndAttributes, BookmarkStartAttributes } from "./bookmark-attributes"; -export class BookmarkRef { - constructor(public readonly name: string, public readonly text: string) {} -} - export class Bookmark { public readonly start: BookmarkStart; public readonly text: TextRun; diff --git a/src/file/paragraph/links/hyperlink.spec.ts b/src/file/paragraph/links/hyperlink.spec.ts index 93b59e07b6..4b06a933f5 100644 --- a/src/file/paragraph/links/hyperlink.spec.ts +++ b/src/file/paragraph/links/hyperlink.spec.ts @@ -3,6 +3,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; import { Hyperlink } from "./"; +import { HyperlinkRef } from "./hyperlink"; describe("Hyperlink", () => { let hyperlink: Hyperlink; @@ -59,3 +60,11 @@ describe("Hyperlink", () => { }); }); }); + +describe("HyperlinkRef", () => { + describe("#constructor()", () => { + const hyperlinkRef = new HyperlinkRef("test-id"); + + expect(hyperlinkRef.id).to.equal("test-id"); + }); +}); diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index c1a8861568..c97d8d34fd 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -13,7 +13,7 @@ import { ContextualSpacing, ISpacingProperties, Spacing } from "./formatting/spa import { HeadingLevel, Style } from "./formatting/style"; import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop"; import { NumberProperties } from "./formatting/unordered-list"; -import { Bookmark, BookmarkRef, HyperlinkRef, OutlineLevel } from "./links"; +import { Bookmark, HyperlinkRef, OutlineLevel } from "./links"; import { ParagraphProperties } from "./properties"; import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run"; @@ -46,7 +46,7 @@ export interface IParagraphOptions { readonly custom?: boolean; }; readonly children?: Array< - TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef | BookmarkRef + TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef >; } diff --git a/src/file/paragraph/run/picture-run.ts b/src/file/paragraph/run/picture-run.ts index c796beebfc..e98dba573a 100644 --- a/src/file/paragraph/run/picture-run.ts +++ b/src/file/paragraph/run/picture-run.ts @@ -7,10 +7,6 @@ export class PictureRun extends Run { constructor(imageData: IMediaData, drawingOptions?: IDrawingOptions) { super({}); - if (imageData === undefined) { - throw new Error("imageData cannot be undefined"); - } - const drawing = new Drawing(imageData, drawingOptions); this.root.push(drawing); diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index 37aadfb8d8..b5febf199e 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -132,6 +132,30 @@ describe("Run", () => { }); }); + describe("#subScript()", () => { + it("it should add subScript to the properties", () => { + const run = new Run({ + subScript: true, + }); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [{ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "subscript" } } }] }], + }); + }); + }); + + describe("#superScript()", () => { + it("it should add superScript to the properties", () => { + const run = new Run({ + superScript: true, + }); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [{ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "superscript" } } }] }], + }); + }); + }); + describe("#highlight()", () => { it("it should add highlight to the properties", () => { const run = new Run({ From 47533cf4e29f881c9327232d1b40bcf9ea0ac39c Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 24 Dec 2019 03:39:55 +0000 Subject: [PATCH 034/147] Bookmark tests --- src/file/paragraph/paragraph.spec.ts | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index b4a797a8c2..cdbe99c7d8 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -1,9 +1,12 @@ import { assert, expect } from "chai"; +import * as shortid from "shortid"; +import { stub } from "sinon"; import { Formatter } from "export/formatter"; import { EMPTY_OBJECT } from "file/xml-components"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; +import { Bookmark } from "./links"; import { Paragraph } from "./paragraph"; describe("Paragraph", () => { @@ -638,6 +641,49 @@ describe("Paragraph", () => { }); }); + it("it should add bookmark", () => { + stub(shortid, "generate").callsFake(() => { + return "test-unique-id"; + }); + const paragraph = new Paragraph({ + children: [new Bookmark("test-id", "test")], + }); + const tree = new Formatter().format(paragraph); + expect(tree).to.deep.equal({ + "w:p": [ + { + "w:bookmarkStart": { + _attr: { + "w:id": "test-unique-id", + "w:name": "test-id", + }, + }, + }, + { + "w:r": [ + { + "w:t": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "test", + ], + }, + ], + }, + { + "w:bookmarkEnd": { + _attr: { + "w:id": "test-unique-id", + }, + }, + }, + ], + }); + }); + describe("#style", () => { it("should set the paragraph style to the given styleId", () => { const paragraph = new Paragraph({ From 3591e116373994f64d257eb1320c2326eac5dddb Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 24 Dec 2019 16:31:35 +0000 Subject: [PATCH 035/147] Add hyperlink cache test --- src/file/file.spec.ts | 8 ++++++++ src/file/file.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index e34feea1b6..c9ec7b3a3e 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -148,6 +148,14 @@ describe("File", () => { }); }); + describe("#HyperlinkCache", () => { + it("should initially have empty hyperlink cache", () => { + const file = new File(); + + expect(file.HyperlinkCache).to.deep.equal({}); + }); + }); + describe("#createFootnote", () => { it("should create footnote", () => { const wrapper = new File({ diff --git a/src/file/file.ts b/src/file/file.ts index e549b4b624..583d4ace3a 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -61,7 +61,7 @@ export class File { private readonly contentTypes: ContentTypes; private readonly appProperties: AppProperties; private readonly styles: Styles; - private readonly hyperlinkCache: { readonly [key: string]: Hyperlink }; + private readonly hyperlinkCache: { readonly [key: string]: Hyperlink } = {}; constructor( options: IPropertiesOptions = { From 1a9e71bfa1a0f6e4fbe8e9f3760640977a2ea425 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Fri, 27 Dec 2019 01:21:19 +0000 Subject: [PATCH 036/147] Add children and section tests for File --- src/file/file.spec.ts | 100 +++++++++++++++++++++++++++++++++++++++++- src/file/file.ts | 2 +- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index c9ec7b3a3e..0ad7474644 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -5,7 +5,7 @@ import { Formatter } from "export/formatter"; import { File } from "./file"; import { Footer, Header } from "./header"; -import { Paragraph } from "./paragraph"; +import { HyperlinkRef, Paragraph } from "./paragraph"; import { Table, TableCell, TableRow } from "./table"; import { TableOfContents } from "./table-of-contents"; @@ -89,6 +89,94 @@ describe("File", () => { expect(tree["w:body"][1]["w:sectPr"][8]["w:footerReference"]._attr["w:type"]).to.equal("first"); expect(tree["w:body"][1]["w:sectPr"][9]["w:footerReference"]._attr["w:type"]).to.equal("even"); }); + + it("should add child", () => { + const doc = new File(undefined, undefined, [ + { + children: [new Paragraph("test")], + }, + ]); + + const tree = new Formatter().format(doc.Document.Body); + + expect(tree).to.deep.equal({ + "w:body": [ + { + "w:p": {}, + }, + { + "w:p": [ + { + "w:r": [ + { + "w:t": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "test", + ], + }, + ], + }, + ], + }, + { + "w:sectPr": [ + { + "w:pgSz": { + _attr: { + "w:h": 16838, + "w:orient": "portrait", + "w:w": 11906, + }, + }, + }, + { + "w:pgMar": { + _attr: { + "w:bottom": 1440, + "w:footer": 708, + "w:gutter": 0, + "w:header": 708, + "w:left": 1440, + "w:mirrorMargins": false, + "w:right": 1440, + "w:top": 1440, + }, + }, + }, + { + "w:cols": { + _attr: { + "w:num": 1, + "w:space": 708, + }, + }, + }, + { + "w:docGrid": { + _attr: { + "w:linePitch": 360, + }, + }, + }, + ], + }, + ], + }); + }); + + it("should add hyperlink child", () => { + const doc = new File(undefined, undefined, [ + { + children: [new HyperlinkRef("test")], + }, + ]); + + expect(doc.HyperlinkCache).to.deep.equal({}); + }); }); describe("#addSection", () => { @@ -102,6 +190,16 @@ describe("File", () => { expect(spy.called).to.equal(true); }); + it("should add hyperlink child", () => { + const doc = new File(); + + doc.addSection({ + children: [new HyperlinkRef("test")], + }); + + expect(doc.HyperlinkCache).to.deep.equal({}); + }); + it("should call the underlying document's add when adding a Table", () => { const file = new File(); const spy = sinon.spy(file.Document, "add"); diff --git a/src/file/file.ts b/src/file/file.ts index 583d4ace3a..59af9fa7f7 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -41,7 +41,7 @@ export interface ISectionOptions { readonly size?: IPageSizeAttributes; readonly margins?: IPageMarginAttributes; readonly properties?: SectionPropertiesOptions; - readonly children: Array; + readonly children: Array; } export class File { From f6bcaef5b58a8007caa1d64e7dab2c5fe7e4f3c5 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Fri, 27 Dec 2019 01:29:15 +0000 Subject: [PATCH 037/147] Fix test --- src/file/file.spec.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index 0ad7474644..398a1bb72b 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -101,9 +101,6 @@ describe("File", () => { expect(tree).to.deep.equal({ "w:body": [ - { - "w:p": {}, - }, { "w:p": [ { From 83450e62778016c3609cea86e9c48ed861187116 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Fri, 27 Dec 2019 01:44:20 +0000 Subject: [PATCH 038/147] Bump up coverage stats --- .nycrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.nycrc b/.nycrc index d5f12ccbc3..41a461385e 100644 --- a/.nycrc +++ b/.nycrc @@ -1,9 +1,9 @@ { "check-coverage": true, - "lines": 92.35, - "functions": 88.28, - "branches": 84.64, - "statements": 92.16, + "lines": 93.53, + "functions": 89.63, + "branches": 88.57, + "statements": 93.34, "include": [ "src/**/*.ts" ], From 49b7ac212d705e9f9edf9fc98d46bb436e71c97d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Dec 2019 01:44:24 +0000 Subject: [PATCH 039/147] Bump handlebars from 4.1.2 to 4.5.3 Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.1.2 to 4.5.3. - [Release notes](https://github.com/wycats/handlebars.js/releases) - [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md) - [Commits](https://github.com/wycats/handlebars.js/compare/v4.1.2...v4.5.3) Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 792ca7e14b..dc42129249 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3573,9 +3573,9 @@ "dev": true }, "handlebars": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", - "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", + "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==", "dev": true, "requires": { "neo-async": "^2.6.0", @@ -4351,7 +4351,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, From 4f3cb490765134e4f416f4770fae92351d64969e Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 31 Dec 2019 15:49:34 +0000 Subject: [PATCH 040/147] Add new image for README --- README.md | 2 +- demo/50-readme-demo.ts | 61 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 demo/50-readme-demo.ts diff --git a/README.md b/README.md index 4af1a5e887..3a421f93f4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ [![codecov][codecov-image]][codecov-url]

- drawing + drawing

# Demo diff --git a/demo/50-readme-demo.ts b/demo/50-readme-demo.ts new file mode 100644 index 0000000000..6b1cc0ecab --- /dev/null +++ b/demo/50-readme-demo.ts @@ -0,0 +1,61 @@ +// Simple example to add text to a document +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, HeadingLevel, Media, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign } from "../build"; + +const doc = new Document(); + +const image1 = Media.addImage(doc, fs.readFileSync("./demo/images/image1.jpeg")); +const image2 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif")); + +const table = new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph(image1)], + verticalAlign: VerticalAlign.CENTER, + }), + new TableCell({ + children: [ + new Paragraph({ + text: "Hello", + heading: HeadingLevel.HEADING_1, + }), + ], + verticalAlign: VerticalAlign.CENTER, + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [ + new Paragraph({ + text: "World", + heading: HeadingLevel.HEADING_1, + }), + ], + }), + new TableCell({ + children: [new Paragraph(image1)], + }), + ], + }), + ], +}); + +doc.addSection({ + children: [ + new Paragraph({ + text: "Hello World", + heading: HeadingLevel.HEADING_1, + }), + table, + new Paragraph(image2), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); From 97824f1bb5538cee68cdd63f56c553d5b9e458dc Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 31 Dec 2019 15:52:01 +0000 Subject: [PATCH 041/147] Version 5.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ad66b4a64..a742fc4faf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.0-rc7", + "version": "5.0.0", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From 2ee918b845840e9b63a24e940b6be1a11387a2a6 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 11 Jan 2020 19:16:36 +0000 Subject: [PATCH 042/147] Add type and node type definition exports --- package-lock.json | 6 +++--- package.json | 1 + src/file/styles/index.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 792ca7e14b..a1d9b5824e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -319,9 +319,9 @@ "dev": true }, "@types/node": { - "version": "12.0.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.12.tgz", - "integrity": "sha512-Uy0PN4R5vgBUXFoJrKryf5aTk3kJ8Rv3PdlHjl6UaX+Cqp1QE0yPQ68MPXGrZOfG7gZVNDIJZYyot0B9ubXUrQ==" + "version": "13.1.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.6.tgz", + "integrity": "sha512-Jg1F+bmxcpENHP23sVKkNuU3uaxPnsBMW0cLjleiikFKomJQbsn0Cqk2yDvQArqzZN6ABfBkZ0To7pQ8sLdWDg==" }, "@types/request": { "version": "2.48.1", diff --git a/package.json b/package.json index a742fc4faf..4d10110920 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "types": "./build/index.d.ts", "dependencies": { "@types/jszip": "^3.1.4", + "@types/node": "^13.1.6", "jszip": "^3.1.5", "shortid": "^2.2.15", "xml": "^1.0.1", diff --git a/src/file/styles/index.ts b/src/file/styles/index.ts index 144bbcb1fd..01ddf2d84e 100644 --- a/src/file/styles/index.ts +++ b/src/file/styles/index.ts @@ -1,3 +1,4 @@ export * from "./styles"; export * from "./style/character-style"; export * from "./style/paragraph-style"; +export * from "./style-options"; From f13e676c3b1e0395405b6421d4f3eec04dd2ca42 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 11 Jan 2020 20:52:59 +0000 Subject: [PATCH 043/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d10110920..030ea0cbc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.0", + "version": "5.0.1", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From a8201b265834004a7f3c71db60741998df6cf033 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 15 Jan 2020 22:33:04 +0000 Subject: [PATCH 044/147] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3a421f93f4..e8a66b1ca4 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,8 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide [drawing](http://www.madisoncres.com/) [drawing](https://www.beekast.com/) [drawing](https://herraizsoto.com/) +[drawing](http://www.ativer.com.br/) + ...and many more! From 99ab2f0ef52241c86f3f79180779f145f56b63bf Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 15 Jan 2020 22:46:42 +0000 Subject: [PATCH 045/147] Version bump package lock --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index a1d9b5824e..8f864bd4e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.0-rc7", + "version": "5.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { From 212adbbffbf50e5344b0652d7d0d51ff69e15164 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 16 Jan 2020 02:23:17 +0000 Subject: [PATCH 046/147] Add workaround for loading --- src/file/styles/style-options.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/file/styles/style-options.ts b/src/file/styles/style-options.ts index 744f4244fb..18a9e9aab9 100644 --- a/src/file/styles/style-options.ts +++ b/src/file/styles/style-options.ts @@ -38,3 +38,9 @@ export interface IParagraphStyleOptions2 { readonly keepLines?: boolean; readonly outlineLevel?: number; } + +// Needed because of: https://github.com/s-panferov/awesome-typescript-loader/issues/432 +/** + * @ignore + */ +export const WORKAROUND4 = ""; From 5cf534ad26ad24838eda7178ab8fa24960d0005d Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 16 Jan 2020 03:04:38 +0000 Subject: [PATCH 047/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 030ea0cbc4..05e824f186 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.1", + "version": "5.0.2", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From b5172e73f9e9b170a17ce87b84de98e955c9a129 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 17 Jan 2020 21:26:09 +0000 Subject: [PATCH 048/147] Package lock bump --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 8f864bd4e4..eb9cf05001 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.1", + "version": "5.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { From 78f6ea6c44c29bfc58683e2a6ed16921cde329bc Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 19 Jan 2020 02:50:31 +0000 Subject: [PATCH 049/147] Update JSFiddle Demo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8a66b1ca4..a67a7c7dee 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Here are examples of `docx` being used with basic `HTML/JS` in a browser environment: * https://codepen.io/anon/pen/dqoVgQ -* https://jsfiddle.net/3xhezb5w/2 +* https://jsfiddle.net/kqxrj35u/ Here is an example of `docx` working in `Angular`: From 5b58e520f92db0b643f6e8faa322a18813f9d28d Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 19 Jan 2020 02:55:31 +0000 Subject: [PATCH 050/147] Update CodePen and JSFiddle examples --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a67a7c7dee..be6eca6898 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ Here are examples of `docx` being used with basic `HTML/JS` in a browser environment: -* https://codepen.io/anon/pen/dqoVgQ -* https://jsfiddle.net/kqxrj35u/ +* https://codepen.io/dolanmiu/pen/RwNeObg +* https://jsfiddle.net/dolanmiu/kqxrj35u/1/ Here is an example of `docx` working in `Angular`: From 7bcdaab2f280d701edd4e75fc9f80dd658ace840 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 27 Feb 2020 10:44:07 +0000 Subject: [PATCH 051/147] Updated Hyperlink demo To test image followed up by hyperlink bug --- demo/35-hyperlinks.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/demo/35-hyperlinks.ts b/demo/35-hyperlinks.ts index fb84f13099..65ed9390d4 100644 --- a/demo/35-hyperlinks.ts +++ b/demo/35-hyperlinks.ts @@ -1,7 +1,7 @@ // Example on how to add hyperlinks to websites // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HyperlinkRef, HyperlinkType, Packer, Paragraph } from "../build"; +import { Document, HyperlinkRef, HyperlinkType, Packer, Paragraph, Media } from "../build"; const doc = new Document({ hyperlinks: { @@ -10,14 +10,24 @@ const doc = new Document({ text: "Hyperlink", type: HyperlinkType.EXTERNAL, }, + myOtherLink: { + link: "http://www.google.com", + text: "Google Link", + type: HyperlinkType.EXTERNAL, + }, }, }); +const image1 = Media.addImage(doc, fs.readFileSync("./demo/images/image1.jpeg")); + doc.addSection({ children: [ new Paragraph({ children: [new HyperlinkRef("myCoolLink")], }), + new Paragraph({ + children: [image1, new HyperlinkRef("myOtherLink")], + }), ], }); From 1c8cd325d7909c9481321148481caa70e031b6d5 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 27 Feb 2020 11:10:00 +0000 Subject: [PATCH 052/147] Add character styles demo --- demo/51-character-styles.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 demo/51-character-styles.ts diff --git a/demo/51-character-styles.ts b/demo/51-character-styles.ts new file mode 100644 index 0000000000..3230a7c86f --- /dev/null +++ b/demo/51-character-styles.ts @@ -0,0 +1,37 @@ +// Custom character styles using JavaScript configuration +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, Packer, Paragraph, TextRun } from "../build"; + +const doc = new Document({ + styles: { + characterStyles: [ + { + id: "myRedStyle", + name: "My Wonky Style", + basedOn: "Normal", + run: { + color: "990000", + italics: true, + }, + }, + ], + }, +}); + +doc.addSection({ + children: [ + new Paragraph({ + children: [ + new TextRun({ + text: "Foo bar", + style: "myRedStyle", + }), + ], + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); From 632f3cd19bc83d9bf8d7445cfd0a44e0bc70ef9f Mon Sep 17 00:00:00 2001 From: boopathikumar Date: Sat, 18 Apr 2020 01:48:00 +0530 Subject: [PATCH 053/147] Enabled dark and light mode with switch for docs using docsify-darklight-theme --- docs/index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 9af955e10e..29ab70ff59 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7,7 +7,12 @@ - + @@ -26,6 +31,10 @@ + From 250a1de71e151e59f3e2499c8a4d16869533cbd9 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 23 Apr 2020 11:50:56 +0100 Subject: [PATCH 054/147] Disable e2e temporarily --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3bf1b47690..d27f452f86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ script: - npm run style - npm run build - npm run ts-node -- ./demo/1-basic.ts - - npm run e2e "My Document.docx" +# - npm run e2e "My Document.docx" - npm run ts-node -- ./demo/2-declaritive-styles.ts - npm run ts-node -- ./demo/3-numbering-and-bullet-points.ts - npm run ts-node -- ./demo/4-basic-table.ts @@ -20,7 +20,7 @@ script: - npm run ts-node -- ./demo/8-header-footer.ts - npm run ts-node -- ./demo/9-images-in-header-and-footer.ts - npm run ts-node -- ./demo/10-my-cv.ts - - npm run e2e "My Document.docx" +# - npm run e2e "My Document.docx" - npm run ts-node -- ./demo/11-declaritive-styles-2.ts - npm run ts-node -- ./demo/12-scaling-images.ts - npm run ts-node -- ./demo/13-xml-styles.ts From faefbae3a14fcd6f4ef22a51079a2ddef27a7345 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Wed, 6 May 2020 02:13:25 +0100 Subject: [PATCH 055/147] Add Japanese example --- demo/52-japanese.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 demo/52-japanese.ts diff --git a/demo/52-japanese.ts b/demo/52-japanese.ts new file mode 100644 index 0000000000..5339c4b3a9 --- /dev/null +++ b/demo/52-japanese.ts @@ -0,0 +1,37 @@ +// Japanese text - Need to use a Japanese font +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, HeadingLevel, Packer, Paragraph } from "../build"; + +const doc = new Document({ + styles: { + paragraphStyles: [ + { + id: "Normal", + name: "Normal", + basedOn: "Normal", + next: "Normal", + quickFormat: true, + run: { + font: "MS Gothic", + }, + }, + ], + }, +}); + +doc.addSection({ + children: [ + new Paragraph({ + text: "KFCを食べるのが好き", + heading: HeadingLevel.HEADING_1, + }), + new Paragraph({ + text: "こんにちは", + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); From 0ebdcc30edba98b990e2bd7fb2b3a76a7ce2822a Mon Sep 17 00:00:00 2001 From: adrielstar Date: Thu, 7 May 2020 11:49:42 +0200 Subject: [PATCH 056/147] Update numbering.ts --- src/file/numbering/numbering.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index b8747991d0..4c0d299fb6 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -147,6 +147,17 @@ export class Numbering extends XmlComponent { }, }, }, + { + level: 9, + format: "bullet", + text: "\u2726", + alignment: AlignmentType.LEFT, + style: { + paragraph: { + indent: { left: 720, hanging: 360 }, + }, + }, + }, ]); this.createConcreteNumbering(abstractNumbering); From 25a7ce37428c2df5d4f47603994a350258f7d343 Mon Sep 17 00:00:00 2001 From: bs595r Date: Sun, 10 May 2020 10:36:25 -0700 Subject: [PATCH 057/147] adds textDirection to table cells --- demo/31-tables.ts | 26 +++++++++++++++- .../table/table-cell/table-cell-components.ts | 25 ++++++++++++++++ .../table/table-cell/table-cell-properties.ts | 8 +++++ src/file/table/table-cell/table-cell.spec.ts | 30 ++++++++++++++++++- src/file/table/table-cell/table-cell.ts | 7 ++++- 5 files changed, 93 insertions(+), 3 deletions(-) diff --git a/demo/31-tables.ts b/demo/31-tables.ts index 7daec1506d..601e216c49 100644 --- a/demo/31-tables.ts +++ b/demo/31-tables.ts @@ -1,7 +1,7 @@ // Example of how you would create a table and add data to it // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign } from "../build"; +import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "../build"; const doc = new Document(); @@ -17,6 +17,14 @@ const table = new Table({ children: [new Paragraph({}), new Paragraph({})], verticalAlign: VerticalAlign.CENTER, }), + new TableCell({ + children: [new Paragraph({text: "bottom to top"}), new Paragraph({})], + textDirection: TextDirection.BOTTOMTOTOPLEFTTORIGHT + }), + new TableCell({ + children: [new Paragraph({text: "top to bottom"}), new Paragraph({})], + textDirection: TextDirection.TOPTOBOTTOMRIGHTTOLEFT + }), ], }), new TableRow({ @@ -38,6 +46,22 @@ const table = new Table({ ], verticalAlign: VerticalAlign.CENTER, }), + new TableCell({ + children: [ + new Paragraph({ + text: "Text above should be vertical from bottom to top", + }), + ], + verticalAlign: VerticalAlign.CENTER, + }), + new TableCell({ + children: [ + new Paragraph({ + text: "Text above should be vertical from top to bottom", + }), + ], + verticalAlign: VerticalAlign.CENTER, + }), ], }), ], diff --git a/src/file/table/table-cell/table-cell-components.ts b/src/file/table/table-cell/table-cell-components.ts index e16c2f6885..0afe1cd291 100644 --- a/src/file/table/table-cell/table-cell-components.ts +++ b/src/file/table/table-cell/table-cell-components.ts @@ -158,6 +158,31 @@ export class VAlign extends XmlComponent { } } +export enum TextDirection { + BOTTOMTOTOPLEFTTORIGHT = "btLr", + LEFTTORIGHTTOPTOBOTTOM = "lrTb", + TOPTOBOTTOMRIGHTTOLEFT = "tbRl", +} + +class TDirectionAttributes extends XmlAttributeComponent<{ readonly val: TextDirection }> { + protected readonly xmlKeys = { val: "w:val" }; +} + +/** + * Text Direction within a table cell + */ +export class TDirection extends XmlComponent { + constructor(value: TextDirection) { + super("w:textDirection"); + + this.root.push( + new TDirectionAttributes({ + val: value, + }), + ); + } +} + export enum WidthType { /** Auto. */ AUTO = "auto", diff --git a/src/file/table/table-cell/table-cell-properties.ts b/src/file/table/table-cell/table-cell-properties.ts index aed56aaeda..e248290294 100644 --- a/src/file/table/table-cell/table-cell-properties.ts +++ b/src/file/table/table-cell/table-cell-properties.ts @@ -6,6 +6,8 @@ import { GridSpan, TableCellBorders, TableCellWidth, + TDirection, + TextDirection, VAlign, VerticalAlign, VerticalMerge, @@ -61,4 +63,10 @@ export class TableCellProperties extends IgnoreIfEmptyXmlComponent { return this; } + + public setTextDirection(type: TextDirection): TableCellProperties { + this.root.push(new TDirection(type)); + + return this; + } } diff --git a/src/file/table/table-cell/table-cell.spec.ts b/src/file/table/table-cell/table-cell.spec.ts index a4c316f7ba..b22538978b 100644 --- a/src/file/table/table-cell/table-cell.spec.ts +++ b/src/file/table/table-cell/table-cell.spec.ts @@ -5,7 +5,7 @@ import { BorderStyle } from "file/styles"; import { ShadingType } from "../shading"; import { TableCell } from "./table-cell"; -import { TableCellBorders, TableCellWidth, VerticalAlign, VerticalMergeType, WidthType } from "./table-cell-components"; +import { TableCellBorders, TableCellWidth, TextDirection, VerticalAlign, VerticalMergeType, WidthType } from "./table-cell-components"; describe("TableCellBorders", () => { describe("#prepForXml", () => { @@ -271,6 +271,34 @@ describe("TableCell", () => { }); }); + it("should create with text direction", () => { + const cell = new TableCell({ + children: [], + textDirection: TextDirection.BOTTOMTOTOPLEFTTORIGHT, + }); + + const tree = new Formatter().format(cell); + + expect(tree).to.deep.equal({ + "w:tc": [ + { + "w:tcPr": [ + { + "w:textDirection": { + _attr: { + "w:val": "btLr", + }, + }, + }, + ], + }, + { + "w:p": {}, + }, + ], + }); + }); + it("should create with vertical merge", () => { const cell = new TableCell({ children: [], diff --git a/src/file/table/table-cell/table-cell.ts b/src/file/table/table-cell/table-cell.ts index fe8f8b5868..c809c157ad 100644 --- a/src/file/table/table-cell/table-cell.ts +++ b/src/file/table/table-cell/table-cell.ts @@ -7,13 +7,14 @@ import { File } from "../../file"; import { ITableShadingAttributesProperties } from "../shading"; import { Table } from "../table"; import { ITableCellMarginOptions } from "./cell-margin/table-cell-margins"; -import { VerticalAlign, VerticalMergeType, WidthType } from "./table-cell-components"; +import { TextDirection, VerticalAlign, VerticalMergeType, WidthType } from "./table-cell-components"; import { TableCellProperties } from "./table-cell-properties"; export interface ITableCellOptions { readonly shading?: ITableShadingAttributesProperties; readonly margins?: ITableCellMarginOptions; readonly verticalAlign?: VerticalAlign; + readonly textDirection?: TextDirection; readonly verticalMerge?: VerticalMergeType; readonly width?: { readonly size: number | string; @@ -63,6 +64,10 @@ export class TableCell extends XmlComponent { this.properties.setVerticalAlign(options.verticalAlign); } + if (options.textDirection) { + this.properties.setTextDirection(options.textDirection); + } + if (options.verticalMerge) { this.properties.addVerticalMerge(options.verticalMerge); } From b4f1c4dd6a56d64cfa155970a495a6b7451c15fe Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Wed, 13 May 2020 02:51:47 +0100 Subject: [PATCH 058/147] Increase readability for enums --- demo/31-tables.ts | 8 ++++---- src/file/table/table-cell/table-cell-components.ts | 6 +++--- src/file/table/table-cell/table-cell.spec.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/demo/31-tables.ts b/demo/31-tables.ts index 601e216c49..24fc6030f8 100644 --- a/demo/31-tables.ts +++ b/demo/31-tables.ts @@ -18,12 +18,12 @@ const table = new Table({ verticalAlign: VerticalAlign.CENTER, }), new TableCell({ - children: [new Paragraph({text: "bottom to top"}), new Paragraph({})], - textDirection: TextDirection.BOTTOMTOTOPLEFTTORIGHT + children: [new Paragraph({ text: "bottom to top" }), new Paragraph({})], + textDirection: TextDirection.BOTTOM_TO_TOP_LEFT_TO_RIGHT, }), new TableCell({ - children: [new Paragraph({text: "top to bottom"}), new Paragraph({})], - textDirection: TextDirection.TOPTOBOTTOMRIGHTTOLEFT + children: [new Paragraph({ text: "top to bottom" }), new Paragraph({})], + textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT, }), ], }), diff --git a/src/file/table/table-cell/table-cell-components.ts b/src/file/table/table-cell/table-cell-components.ts index 0afe1cd291..f3ebe570e9 100644 --- a/src/file/table/table-cell/table-cell-components.ts +++ b/src/file/table/table-cell/table-cell-components.ts @@ -159,9 +159,9 @@ export class VAlign extends XmlComponent { } export enum TextDirection { - BOTTOMTOTOPLEFTTORIGHT = "btLr", - LEFTTORIGHTTOPTOBOTTOM = "lrTb", - TOPTOBOTTOMRIGHTTOLEFT = "tbRl", + BOTTOM_TO_TOP_LEFT_TO_RIGHT = "btLr", + LEFT_TO_RIGHT_TOP_TO_BOTTOM = "lrTb", + TOP_TO_BOTTOM_RIGHT_TO_LEFT = "tbRl", } class TDirectionAttributes extends XmlAttributeComponent<{ readonly val: TextDirection }> { diff --git a/src/file/table/table-cell/table-cell.spec.ts b/src/file/table/table-cell/table-cell.spec.ts index b22538978b..2ba34bc9d4 100644 --- a/src/file/table/table-cell/table-cell.spec.ts +++ b/src/file/table/table-cell/table-cell.spec.ts @@ -274,7 +274,7 @@ describe("TableCell", () => { it("should create with text direction", () => { const cell = new TableCell({ children: [], - textDirection: TextDirection.BOTTOMTOTOPLEFTTORIGHT, + textDirection: TextDirection.BOTTOM_TO_TOP_LEFT_TO_RIGHT, }); const tree = new Formatter().format(cell); From 2654799822493edbe4b96af544f6d51c79381f9a Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 19 May 2020 19:24:29 +0100 Subject: [PATCH 059/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 05e824f186..bea66bd3a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.2", + "version": "5.1.0", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From 120c3a7bbef10736ed37e5eb806e1975e52a50be Mon Sep 17 00:00:00 2001 From: wangfengming Date: Fri, 22 May 2020 12:22:45 +0800 Subject: [PATCH 060/147] :feat: support emphasis mark --- package-lock.json | 2 +- src/file/numbering/abstract-numbering.spec.ts | 55 +++++++- src/file/numbering/level.ts | 4 + src/file/paragraph/run/emphasis-mark.spec.ts | 29 ++++ src/file/paragraph/run/emphasis-mark.ts | 28 ++++ src/file/paragraph/run/formatting.ts | 2 + src/file/paragraph/run/index.ts | 1 + src/file/paragraph/run/run.spec.ts | 36 ++++- src/file/paragraph/run/run.ts | 8 ++ src/file/paragraph/run/symbol-run.spec.ts | 6 + src/file/styles/style-options.ts | 5 +- src/file/styles/style/character-style.spec.ts | 73 +++++++++- src/file/styles/style/character-style.ts | 8 ++ src/file/styles/style/paragraph-style.spec.ts | 125 ++++++++++++++++-- src/file/styles/style/paragraph-style.ts | 4 + 15 files changed, 371 insertions(+), 15 deletions(-) create mode 100644 src/file/paragraph/run/emphasis-mark.spec.ts create mode 100644 src/file/paragraph/run/emphasis-mark.ts diff --git a/package-lock.json b/package-lock.json index f0226f8dc5..f149d49335 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.2", + "version": "5.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index 59655aa40e..a2fb61b000 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -3,7 +3,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; import { EMPTY_OBJECT } from "file/xml-components"; -import { AlignmentType, TabStopPosition } from "../paragraph"; +import { AlignmentType, EmphasisMarkType, TabStopPosition } from "../paragraph"; import { UnderlineType } from "../paragraph/run/underline"; import { ShadingType } from "../table"; import { AbstractNumbering } from "./abstract-numbering"; @@ -433,7 +433,16 @@ describe("AbstractNumbering", () => { const tree = new Formatter().format(abstractNumbering); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": [ - { "w:rFonts": { _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } } }, + { + "w:rFonts": { + _attr: { + "w:ascii": "Times", + "w:cs": "Times", + "w:eastAsia": "Times", + "w:hAnsi": "Times", + }, + }, + }, ], }); }); @@ -582,6 +591,48 @@ describe("AbstractNumbering", () => { }); }); + describe("#emphasisMark", () => { + it("should set emphasisMark to 'dot' if no arguments are given", () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + emphasisMark: {}, + }, + }, + }, + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ + "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }], + }); + }); + + it("should set the style if given", () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + emphasisMark: { + type: EmphasisMarkType.DOT, + }, + }, + }, + }, + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ + "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }], + }); + }); + }); + it("#color", () => { const abstractNumbering = new AbstractNumbering(1, [ { diff --git a/src/file/numbering/level.ts b/src/file/numbering/level.ts index cbef58dfc0..ddef2b2d78 100644 --- a/src/file/numbering/level.ts +++ b/src/file/numbering/level.ts @@ -177,6 +177,10 @@ export class LevelBase extends XmlComponent { this.runProperties.push(new formatting.Underline(style.run.underline.type, style.run.underline.color)); } + if (style.run.emphasisMark) { + this.runProperties.push(new formatting.EmphasisMark(style.run.emphasisMark.type)); + } + if (style.run.color) { this.runProperties.push(new formatting.Color(style.run.color)); } diff --git a/src/file/paragraph/run/emphasis-mark.spec.ts b/src/file/paragraph/run/emphasis-mark.spec.ts new file mode 100644 index 0000000000..4ad4878f64 --- /dev/null +++ b/src/file/paragraph/run/emphasis-mark.spec.ts @@ -0,0 +1,29 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import * as em from "./emphasis-mark"; + +describe("EmphasisMark", () => { + describe("#constructor()", () => { + it("should create a new EmphasisMark object with w:em as the rootKey", () => { + const emphasisMark = new em.EmphasisMark(); + const tree = new Formatter().format(emphasisMark); + expect(tree).to.deep.equal({ + "w:em": { _attr: { "w:val": "dot" } }, + }); + }); + }); +}); + +describe("DotEmphasisMark", () => { + describe("#constructor()", () => { + it("should put value in attribute", () => { + const emphasisMark = new em.DotEmphasisMark(); + const tree = new Formatter().format(emphasisMark); + expect(tree).to.deep.equal({ + "w:em": { _attr: { "w:val": "dot" } }, + }); + }); + }); +}); diff --git a/src/file/paragraph/run/emphasis-mark.ts b/src/file/paragraph/run/emphasis-mark.ts new file mode 100644 index 0000000000..b8af756072 --- /dev/null +++ b/src/file/paragraph/run/emphasis-mark.ts @@ -0,0 +1,28 @@ +import { Attributes, XmlComponent } from "file/xml-components"; + +export enum EmphasisMarkType { + DOT = "dot", +} + +export abstract class BaseEmphasisMark extends XmlComponent { + protected constructor(emphasisMarkType: EmphasisMarkType) { + super("w:em"); + this.root.push( + new Attributes({ + val: emphasisMarkType, + }), + ); + } +} + +export class EmphasisMark extends BaseEmphasisMark { + constructor(emphasisMarkType: EmphasisMarkType = EmphasisMarkType.DOT) { + super(emphasisMarkType); + } +} + +export class DotEmphasisMark extends BaseEmphasisMark { + constructor() { + super(EmphasisMarkType.DOT); + } +} diff --git a/src/file/paragraph/run/formatting.ts b/src/file/paragraph/run/formatting.ts index 549f2ae552..3055ba44e7 100644 --- a/src/file/paragraph/run/formatting.ts +++ b/src/file/paragraph/run/formatting.ts @@ -1,5 +1,7 @@ import { Attributes, XmlComponent } from "file/xml-components"; + export { Underline } from "./underline"; +export { EmphasisMark } from "./emphasis-mark"; export { SubScript, SuperScript } from "./script"; export { RunFonts } from "./run-fonts"; diff --git a/src/file/paragraph/run/index.ts b/src/file/paragraph/run/index.ts index 21df415f35..745e33ea5a 100644 --- a/src/file/paragraph/run/index.ts +++ b/src/file/paragraph/run/index.ts @@ -5,4 +5,5 @@ export * from "./picture-run"; export * from "./run-fonts"; export * from "./sequential-identifier"; export * from "./underline"; +export * from "./emphasis-mark"; export * from "./tab"; diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index b5febf199e..8712622921 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -5,6 +5,7 @@ import { Formatter } from "export/formatter"; import { ShadingType } from "file/table"; import { Run } from "./"; +import { EmphasisMarkType } from "./emphasis-mark"; import { PageNumber } from "./run"; import { UnderlineType } from "./underline"; @@ -84,6 +85,30 @@ describe("Run", () => { }); }); + describe("#emphasisMark()", () => { + it("should default to 'dot'", () => { + const run = new Run({ + emphasisMark: {}, + }); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [{ "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }] }], + }); + }); + + it("should set the style type if given", () => { + const run = new Run({ + emphasisMark: { + type: EmphasisMarkType.DOT, + }, + }); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [{ "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }] }], + }); + }); + }); + describe("#smallCaps()", () => { it("it should add smallCaps to the properties", () => { const run = new Run({ @@ -235,7 +260,16 @@ describe("Run", () => { "w:r": [ { "w:rPr": [ - { "w:rFonts": { _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } } }, + { + "w:rFonts": { + _attr: { + "w:ascii": "Times", + "w:cs": "Times", + "w:eastAsia": "Times", + "w:hAnsi": "Times", + }, + }, + }, ], }, ], diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index 20777b72a2..8225ebdc95 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -6,6 +6,7 @@ import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run" import { FieldInstruction } from "file/table-of-contents/field-instruction"; import { Break } from "./break"; import { Caps, SmallCaps } from "./caps"; +import { EmphasisMark, EmphasisMarkType } from "./emphasis-mark"; import { Begin, End, Separate } from "./field"; import { Bold, @@ -38,6 +39,9 @@ export interface IRunOptions { readonly color?: string; readonly type?: UnderlineType; }; + readonly emphasisMark?: { + readonly type?: EmphasisMarkType; + }; readonly color?: string; readonly size?: number; readonly rightToLeft?: boolean; @@ -90,6 +94,10 @@ export class Run extends XmlComponent { this.properties.push(new Underline(options.underline.type, options.underline.color)); } + if (options.emphasisMark) { + this.properties.push(new EmphasisMark(options.emphasisMark.type)); + } + if (options.color) { this.properties.push(new Color(options.color)); } diff --git a/src/file/paragraph/run/symbol-run.spec.ts b/src/file/paragraph/run/symbol-run.spec.ts index f3faee8bb0..c41e6e1d51 100644 --- a/src/file/paragraph/run/symbol-run.spec.ts +++ b/src/file/paragraph/run/symbol-run.spec.ts @@ -1,5 +1,7 @@ import { expect } from "chai"; +import { EmphasisMarkType } from "./emphasis-mark"; + import { Formatter } from "export/formatter"; import { UnderlineType } from "./underline"; @@ -44,6 +46,9 @@ describe("SymbolRun", () => { color: "red", type: UnderlineType.DOUBLE, }, + emphasisMark: { + type: EmphasisMarkType.DOT, + }, color: "green", size: 40, highlight: "yellow", @@ -59,6 +64,7 @@ describe("SymbolRun", () => { { "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }, { "w:u": { _attr: { "w:val": "double", "w:color": "red" } } }, + { "w:em": { _attr: { "w:val": "dot" } } }, { "w:color": { _attr: { "w:val": "green" } } }, { "w:sz": { _attr: { "w:val": 40 } } }, { "w:szCs": { _attr: { "w:val": 40 } } }, diff --git a/src/file/styles/style-options.ts b/src/file/styles/style-options.ts index 18a9e9aab9..b748c42e79 100644 --- a/src/file/styles/style-options.ts +++ b/src/file/styles/style-options.ts @@ -1,4 +1,4 @@ -import { AlignmentType, IIndentAttributesProperties, ISpacingProperties, UnderlineType } from "../paragraph"; +import { AlignmentType, EmphasisMarkType, IIndentAttributesProperties, ISpacingProperties, UnderlineType } from "../paragraph"; import { ShadingType } from "../table"; export interface IRunStyleOptions { @@ -15,6 +15,9 @@ export interface IRunStyleOptions { readonly type?: UnderlineType; readonly color?: string; }; + readonly emphasisMark?: { + readonly type?: EmphasisMarkType; + }; readonly color?: string; readonly font?: string; readonly characterSpacing?: number; diff --git a/src/file/styles/style/character-style.spec.ts b/src/file/styles/style/character-style.spec.ts index fe269bfceb..c660b152be 100644 --- a/src/file/styles/style/character-style.spec.ts +++ b/src/file/styles/style/character-style.spec.ts @@ -1,6 +1,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; +import { EmphasisMarkType } from "file/paragraph/run/emphasis-mark"; import { UnderlineType } from "file/paragraph/run/underline"; import { ShadingType } from "file/table"; import { EMPTY_OBJECT } from "file/xml-components"; @@ -412,6 +413,66 @@ describe("CharacterStyle", () => { }); }); + describe("#emphasisMark", () => { + it("should set emphasisMark to 'dot' if no arguments are given", () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { + emphasisMark: {}, + }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }], + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, + }, + }, + }, + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); + }); + + it("should set the style if given", () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { + emphasisMark: { + type: EmphasisMarkType.DOT, + }, + }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }], + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, + }, + }, + }, + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); + }); + }); + it("#superScript", () => { const style = new CharacterStyle({ id: "myStyleId", @@ -616,7 +677,17 @@ describe("CharacterStyle", () => { "w:style": [ { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, { - "w:rPr": [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], + "w:rPr": [ + { + "w:shd": { + _attr: { + "w:val": "pct10", + "w:fill": "00FFFF", + "w:color": "FF0000", + }, + }, + }, + ], }, { "w:uiPriority": { diff --git a/src/file/styles/style/character-style.ts b/src/file/styles/style/character-style.ts index 32ff4b6b69..f92540dc16 100644 --- a/src/file/styles/style/character-style.ts +++ b/src/file/styles/style/character-style.ts @@ -1,3 +1,4 @@ +import { EmphasisMarkType } from "file/paragraph/run/emphasis-mark"; import * as formatting from "file/paragraph/run/formatting"; import { RunProperties } from "file/paragraph/run/properties"; import { UnderlineType } from "file/paragraph/run/underline"; @@ -23,6 +24,9 @@ export interface IBaseCharacterStyleOptions { readonly type?: UnderlineType; readonly color?: string; }; + readonly emphasisMark?: { + readonly type?: EmphasisMarkType; + }; readonly color?: string; readonly font?: string; readonly characterSpacing?: number; @@ -104,6 +108,10 @@ export class CharacterStyle extends Style { this.runProperties.push(new formatting.Underline(options.run.underline.type, options.run.underline.color)); } + if (options.run.emphasisMark) { + this.runProperties.push(new formatting.EmphasisMark(options.run.emphasisMark.type)); + } + if (options.run.color) { this.runProperties.push(new formatting.Color(options.run.color)); } diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index 8d9b4da15a..3331dc3513 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; -import { AlignmentType, TabStopPosition } from "file/paragraph"; +import { AlignmentType, EmphasisMarkType, TabStopPosition } from "file/paragraph"; import { UnderlineType } from "file/paragraph/run/underline"; import { ShadingType } from "file/table"; import { EMPTY_OBJECT } from "file/xml-components"; @@ -49,7 +49,15 @@ describe("ParagraphStyle", () => { const style = new ParagraphStyle({ id: "myStyleId", quickFormat: true }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ - "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:qFormat": EMPTY_OBJECT }], + "w:style": [ + { + _attr: { + "w:type": "paragraph", + "w:styleId": "myStyleId", + }, + }, + { "w:qFormat": EMPTY_OBJECT }, + ], }); }); @@ -299,7 +307,15 @@ describe("ParagraphStyle", () => { }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ - "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:pPr": [{ "w:keepLines": EMPTY_OBJECT }] }], + "w:style": [ + { + _attr: { + "w:type": "paragraph", + "w:styleId": "myStyleId", + }, + }, + { "w:pPr": [{ "w:keepLines": EMPTY_OBJECT }] }, + ], }); }); @@ -312,7 +328,15 @@ describe("ParagraphStyle", () => { }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ - "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:pPr": [{ "w:keepNext": EMPTY_OBJECT }] }], + "w:style": [ + { + _attr: { + "w:type": "paragraph", + "w:styleId": "myStyleId", + }, + }, + { "w:pPr": [{ "w:keepNext": EMPTY_OBJECT }] }, + ], }); }); @@ -473,7 +497,16 @@ describe("ParagraphStyle", () => { { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:rPr": [ - { "w:rFonts": { _attr: { "w:ascii": "Times", "w:cs": "Times", "w:eastAsia": "Times", "w:hAnsi": "Times" } } }, + { + "w:rFonts": { + _attr: { + "w:ascii": "Times", + "w:cs": "Times", + "w:eastAsia": "Times", + "w:hAnsi": "Times", + }, + }, + }, ], }, ], @@ -550,7 +583,17 @@ describe("ParagraphStyle", () => { "w:style": [ { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { - "w:rPr": [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], + "w:rPr": [ + { + "w:shd": { + _attr: { + "w:val": "pct10", + "w:fill": "00FFFF", + "w:color": "FF0000", + }, + }, + }, + ], }, ], }); @@ -617,6 +660,46 @@ describe("ParagraphStyle", () => { }); }); + describe("#emphasisMark", () => { + it("should set emphasisMark to 'dot' if no arguments are given", () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { + emphasisMark: {}, + }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, + { + "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }], + }, + ], + }); + }); + + it("should set the style if given", () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { + emphasisMark: { + type: EmphasisMarkType.DOT, + }, + }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, + { + "w:rPr": [{ "w:em": { _attr: { "w:val": "dot" } } }], + }, + ], + }); + }); + }); + it("#color", () => { const style = new ParagraphStyle({ id: "myStyleId", @@ -639,7 +722,15 @@ describe("ParagraphStyle", () => { const style = new ParagraphStyle({ id: "myStyleId", link: "MyLink" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ - "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:link": { _attr: { "w:val": "MyLink" } } }], + "w:style": [ + { + _attr: { + "w:type": "paragraph", + "w:styleId": "myStyleId", + }, + }, + { "w:link": { _attr: { "w:val": "MyLink" } } }, + ], }); }); @@ -647,7 +738,15 @@ describe("ParagraphStyle", () => { const style = new ParagraphStyle({ id: "myStyleId", semiHidden: true }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ - "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:semiHidden": EMPTY_OBJECT }], + "w:style": [ + { + _attr: { + "w:type": "paragraph", + "w:styleId": "myStyleId", + }, + }, + { "w:semiHidden": EMPTY_OBJECT }, + ], }); }); @@ -672,7 +771,15 @@ describe("ParagraphStyle", () => { const style = new ParagraphStyle({ id: "myStyleId", unhideWhenUsed: true }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ - "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:unhideWhenUsed": EMPTY_OBJECT }], + "w:style": [ + { + _attr: { + "w:type": "paragraph", + "w:styleId": "myStyleId", + }, + }, + { "w:unhideWhenUsed": EMPTY_OBJECT }, + ], }); }); }); diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index 3adb1edbbe..0a53c9251a 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -114,6 +114,10 @@ export class ParagraphStyle extends Style { this.runProperties.push(new formatting.Underline(options.run.underline.type, options.run.underline.color)); } + if (options.run.emphasisMark) { + this.runProperties.push(new formatting.EmphasisMark(options.run.emphasisMark.type)); + } + if (options.run.color) { this.runProperties.push(new formatting.Color(options.run.color)); } From 6bcd1c2c242ed4012906d516ea2ef06d1ce2bd29 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Fri, 22 May 2020 12:32:40 +0800 Subject: [PATCH 061/147] :doc: support emphasis mark --- docs/usage/styling-with-js.md | 3 ++- docs/usage/text.md | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/usage/styling-with-js.md b/docs/usage/styling-with-js.md index 26d294c942..c8bbb5c8db 100644 --- a/docs/usage/styling-with-js.md +++ b/docs/usage/styling-with-js.md @@ -22,7 +22,8 @@ const name = new TextRun({ ### Run formatting - `bold`, `italics`, `smallCaps`, `allCaps`, `strike`, `doubleStrike`, `subScript`, `superScript`: Set the formatting property to true -- `underline(style="single", color=null)`: Set the underline style and color +- `underline({type="single", color=null})`: Set the underline style and color +- `emphasisMark({type="dot"})`: Set the emphasis mark style - `color(color)`: Set the text color, using 6 hex characters for RRGGBB (no leading `#`) - `size(halfPts)`: Set the font size, measured in half-points - `font(name)`: Set the run's font diff --git a/docs/usage/text.md b/docs/usage/text.md index 6cbd9da224..4816959eb6 100644 --- a/docs/usage/text.md +++ b/docs/usage/text.md @@ -68,6 +68,15 @@ const text = new TextRun({ }); ``` +### Emphasis Mark + +```ts +const text = new TextRun({ + text: "and then emphasis mark", + emphasisMark: {}, +}); +``` + ### Strike through ```ts From 538264dec5d6960d535f91f1b8b01f03f4ddc20b Mon Sep 17 00:00:00 2001 From: wangfengming Date: Fri, 22 May 2020 12:56:02 +0800 Subject: [PATCH 062/147] :demo: support emphasis mark --- demo/2-declaritive-styles.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index 472b916091..c34eae9628 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -161,6 +161,10 @@ doc.addSection({ text: "and then underlined ", underline: {}, }), + new TextRun({ + text: "and then emphasis-mark ", + emphasisMark: {}, + }), new TextRun({ text: "and back to normal.", }), From 5ae824358c8ab885e1b5b37cb4a1b0115c986d72 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 26 May 2020 21:06:43 +0100 Subject: [PATCH 063/147] Revert "Update numbering.ts" This reverts commit 0ebdcc30edba98b990e2bd7fb2b3a76a7ce2822a. --- src/file/numbering/numbering.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index 4c0d299fb6..b8747991d0 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -147,17 +147,6 @@ export class Numbering extends XmlComponent { }, }, }, - { - level: 9, - format: "bullet", - text: "\u2726", - alignment: AlignmentType.LEFT, - style: { - paragraph: { - indent: { left: 720, hanging: 360 }, - }, - }, - }, ]); this.createConcreteNumbering(abstractNumbering); From 20e6b987701286b5493fd73556d8544fef1646d9 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 26 May 2020 21:07:30 +0100 Subject: [PATCH 064/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bea66bd3a4..2d8bc02945 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.0", + "version": "5.1.1", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From d657f61e1179a66289815a206daf389136d8ff8c Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 28 May 2020 18:38:55 +0100 Subject: [PATCH 065/147] Update node types --- package-lock.json | 76 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index f0226f8dc5..78bcd81aee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.0.2", + "version": "5.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -256,7 +256,7 @@ }, "@types/fs-extra": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.1.tgz", + "resolved": "http://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.1.tgz", "integrity": "sha512-h3wnflb+jMTipvbbZnClgA2BexrT4w0GcfoCz5qyxd0IRsbqhLSyesM6mqZTAnhbVmhyTm5tuxfRu9R+8l+lGw==", "dev": true, "requires": { @@ -296,7 +296,7 @@ }, "@types/lodash": { "version": "4.14.104", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.104.tgz", + "resolved": "http://registry.npmjs.org/@types/lodash/-/lodash-4.14.104.tgz", "integrity": "sha512-ufQcVg4daO8xQ5kopxRHanqFdL4AI7ondQkV+2f+7mz3gvp0LkBx2zBRC6hfs3T87mzQFmf5Fck7Fi145Ul6NQ==", "dev": true }, @@ -319,9 +319,9 @@ "dev": true }, "@types/node": { - "version": "13.1.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.6.tgz", - "integrity": "sha512-Jg1F+bmxcpENHP23sVKkNuU3uaxPnsBMW0cLjleiikFKomJQbsn0Cqk2yDvQArqzZN6ABfBkZ0To7pQ8sLdWDg==" + "version": "14.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz", + "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==" }, "@types/request": { "version": "2.48.1", @@ -702,7 +702,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +731,7 @@ }, "async": { "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -755,7 +755,7 @@ }, "awesome-typescript-loader": { "version": "3.5.0", - "resolved": "https://registry.npmjs.org/awesome-typescript-loader/-/awesome-typescript-loader-3.5.0.tgz", + "resolved": "http://registry.npmjs.org/awesome-typescript-loader/-/awesome-typescript-loader-3.5.0.tgz", "integrity": "sha512-qzgm9SEvodVkSi9QY7Me1/rujg+YBNMjayNSAyzNghwTEez++gXoPCwMvpbHRG7wrOkDCiF6dquvv9ESmUBAuw==", "dev": true, "requires": { @@ -799,7 +799,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1285,7 +1285,7 @@ }, "chai": { "version": "3.5.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", + "resolved": "http://registry.npmjs.org/chai/-/chai-3.5.0.tgz", "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", "dev": true, "requires": { @@ -1507,7 +1507,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -1763,7 +1763,7 @@ }, "deep-eql": { "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "resolved": "http://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", "dev": true, "requires": { @@ -2586,7 +2586,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -3927,7 +3927,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, "is-ci": { @@ -4351,7 +4351,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4483,7 +4483,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4777,7 +4777,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -4812,7 +4812,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -4967,7 +4967,7 @@ }, "ncp": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz", "integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY=", "dev": true }, @@ -4985,7 +4985,7 @@ }, "next-tick": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, @@ -5518,7 +5518,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5695,7 +5695,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5766,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -6467,7 +6467,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -7034,7 +7034,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7052,7 +7052,7 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, @@ -7440,7 +7440,7 @@ }, "typedoc": { "version": "0.11.1", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.11.1.tgz", + "resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.11.1.tgz", "integrity": "sha512-jdNIoHm5wkZqxQTe/g9AQ3LKnZyrzHXqu6A/c9GUOeJyBWLxNr7/Dm3rwFvLksuxRNwTvY/0HRDU9sJTa9WQSg==", "dev": true, "requires": { @@ -7482,7 +7482,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7586,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8015,7 +8015,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8216,7 +8216,7 @@ }, "winston": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz", + "resolved": "http://registry.npmjs.org/winston/-/winston-2.1.1.tgz", "integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=", "dev": true, "requires": { @@ -8231,13 +8231,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8257,7 +8257,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8391,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8435,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { diff --git a/package.json b/package.json index 2d8bc02945..900a6f6357 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "types": "./build/index.d.ts", "dependencies": { "@types/jszip": "^3.1.4", - "@types/node": "^13.1.6", + "@types/node": "^14.0.5", "jszip": "^3.1.5", "shortid": "^2.2.15", "xml": "^1.0.1", From fdfce79e87b4c1973c70c9cf63b19427175e6137 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sun, 7 Jun 2020 12:38:03 +0800 Subject: [PATCH 066/147] :feat: Font for eastAsia --- src/file/paragraph/run/formatting.ts | 2 +- src/file/paragraph/run/run-fonts.ts | 42 +++++++++++++--------- src/file/paragraph/run/run.ts | 18 ++++++---- src/file/styles/defaults/run-properties.ts | 6 ++-- src/file/styles/style-options.ts | 11 ++++-- src/file/styles/style/character-style.ts | 3 +- 6 files changed, 53 insertions(+), 29 deletions(-) diff --git a/src/file/paragraph/run/formatting.ts b/src/file/paragraph/run/formatting.ts index 3055ba44e7..51b14be5cf 100644 --- a/src/file/paragraph/run/formatting.ts +++ b/src/file/paragraph/run/formatting.ts @@ -3,7 +3,7 @@ import { Attributes, XmlComponent } from "file/xml-components"; export { Underline } from "./underline"; export { EmphasisMark } from "./emphasis-mark"; export { SubScript, SuperScript } from "./script"; -export { RunFonts } from "./run-fonts"; +export { RunFonts, IFontAttributesProperties } from "./run-fonts"; export class Bold extends XmlComponent { constructor() { diff --git a/src/file/paragraph/run/run-fonts.ts b/src/file/paragraph/run/run-fonts.ts index 10a441626c..c1eed32613 100644 --- a/src/file/paragraph/run/run-fonts.ts +++ b/src/file/paragraph/run/run-fonts.ts @@ -1,14 +1,14 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; -interface IRunFontAttributesProperties { - readonly ascii: string; - readonly cs: string; - readonly eastAsia: string; - readonly hAnsi: string; +export interface IFontAttributesProperties { + readonly ascii?: string; + readonly cs?: string; + readonly eastAsia?: string; + readonly hAnsi?: string; readonly hint?: string; } -class RunFontAttributes extends XmlAttributeComponent { +class RunFontAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { ascii: "w:ascii", cs: "w:cs", @@ -19,16 +19,26 @@ class RunFontAttributes extends XmlAttributeComponent Date: Sun, 7 Jun 2020 12:38:31 +0800 Subject: [PATCH 067/147] :test: Font for eastAsia --- src/file/numbering/abstract-numbering.spec.ts | 33 ++++++++++++++- src/file/paragraph/run/run-fonts.spec.ts | 7 ++++ src/file/paragraph/run/run.spec.ts | 26 ++++++++++++ src/file/styles/style/character-style.spec.ts | 42 ++++++++++++++++++- src/file/styles/style/paragraph-style.spec.ts | 32 +++++++++++++- 5 files changed, 137 insertions(+), 3 deletions(-) diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index a2fb61b000..6548a4436d 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -417,7 +417,7 @@ describe("AbstractNumbering", () => { }); }); - it("#font", () => { + it("#font by name", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, @@ -447,6 +447,37 @@ describe("AbstractNumbering", () => { }); }); + it("#font for ascii and eastAsia", () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { + font: { + ascii: "Times", + eastAsia: "KaiTi", + }, + }, + }, + }, + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ + "w:rPr": [ + { + "w:rFonts": { + _attr: { + "w:ascii": "Times", + "w:eastAsia": "KaiTi", + }, + }, + }, + ], + }); + }); + it("#bold", () => { const abstractNumbering = new AbstractNumbering(1, [ { diff --git a/src/file/paragraph/run/run-fonts.spec.ts b/src/file/paragraph/run/run-fonts.spec.ts index 1eacc8ecc9..a0180eae81 100644 --- a/src/file/paragraph/run/run-fonts.spec.ts +++ b/src/file/paragraph/run/run-fonts.spec.ts @@ -21,5 +21,12 @@ describe("RunFonts", () => { }, }); }); + + it("uses the font attrs for ascii and eastAsia", () => { + const tree = new Formatter().format(new RunFonts({ ascii: "Times", eastAsia: "KaiTi" })); + expect(tree).to.deep.equal({ + "w:rFonts": { _attr: { "w:ascii": "Times", "w:eastAsia": "KaiTi" } }, + }); + }); }); }); diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index 8712622921..32904327d8 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -275,6 +275,32 @@ describe("Run", () => { ], }); }); + + it("should set the font for ascii and eastAsia", () => { + const run = new Run({ + font: { + ascii: "Times", + eastAsia: "KaiTi", + }, + }); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [ + { + "w:rPr": [ + { + "w:rFonts": { + _attr: { + "w:ascii": "Times", + "w:eastAsia": "KaiTi", + }, + }, + }, + ], + }, + ], + }); + }); }); describe("#color", () => { diff --git a/src/file/styles/style/character-style.spec.ts b/src/file/styles/style/character-style.spec.ts index c660b152be..64c866a8c8 100644 --- a/src/file/styles/style/character-style.spec.ts +++ b/src/file/styles/style/character-style.spec.ts @@ -202,7 +202,7 @@ describe("CharacterStyle", () => { }); }); - it("should add font", () => { + it("should add font by name", () => { const style = new CharacterStyle({ id: "myStyleId", run: { @@ -241,6 +241,46 @@ describe("CharacterStyle", () => { }); }); + it("should add font for ascii and eastAsia", () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { + font: { + ascii: "test font ascii", + eastAsia: "test font eastAsia", + }, + }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": [ + { + "w:rFonts": { + _attr: { + "w:ascii": "test font ascii", + "w:eastAsia": "test font eastAsia", + }, + }, + }, + ], + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, + }, + }, + }, + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); + }); + it("should add character spacing", () => { const style = new CharacterStyle({ id: "myStyleId", diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index 3331dc3513..7d01ef87e7 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -484,7 +484,7 @@ describe("ParagraphStyle", () => { }); }); - it("#font", () => { + it("#font by name", () => { const style = new ParagraphStyle({ id: "myStyleId", run: { @@ -513,6 +513,36 @@ describe("ParagraphStyle", () => { }); }); + it("#font for ascii and eastAsia", () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { + font: { + ascii: "Times", + eastAsia: "KaiTi", + }, + }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, + { + "w:rPr": [ + { + "w:rFonts": { + _attr: { + "w:ascii": "Times", + "w:eastAsia": "KaiTi", + }, + }, + }, + ], + }, + ], + }); + }); + it("#bold", () => { const style = new ParagraphStyle({ id: "myStyleId", From 596761d78db497f368bd04ea2f8b77cfc53b441a Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sun, 7 Jun 2020 12:39:17 +0800 Subject: [PATCH 068/147] :doc: doc and demo for "Font for eastAsia" --- demo/53-chinese.ts | 46 +++++++++++++++++++++++++++++++++++ docs/usage/styling-with-js.md | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 demo/53-chinese.ts diff --git a/demo/53-chinese.ts b/demo/53-chinese.ts new file mode 100644 index 0000000000..eb9afb39a2 --- /dev/null +++ b/demo/53-chinese.ts @@ -0,0 +1,46 @@ +// Chinese text - Chinese need to use a Chinese font. And ascii Text Need to use a ascii font. +// Different from the `52-japanese.ts`. +// `52-japanese.ts` will set all characters to use Japanese font. +// `53-chinese.ts` will set Chinese characters to use Chinese font, and set ascii characters to use ascii font. + +// Note that if the compute have not install `KaiTi` font, this demo doesn't work. + +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, HeadingLevel, Packer, Paragraph } from "../build"; + +const doc = new Document({ + styles: { + paragraphStyles: [ + { + id: "Normal", + name: "Normal", + basedOn: "Normal", + next: "Normal", + quickFormat: true, + run: { + font: { + ascii: "Times", + eastAsia: "KaiTi", + }, + }, + }, + ], + }, +}); + +doc.addSection({ + children: [ + new Paragraph({ + text: "中文和英文 Chinese and English", + heading: HeadingLevel.HEADING_1, + }), + new Paragraph({ + text: "中文和英文 Chinese and English", + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/docs/usage/styling-with-js.md b/docs/usage/styling-with-js.md index c8bbb5c8db..0dafac2904 100644 --- a/docs/usage/styling-with-js.md +++ b/docs/usage/styling-with-js.md @@ -26,7 +26,7 @@ const name = new TextRun({ - `emphasisMark({type="dot"})`: Set the emphasis mark style - `color(color)`: Set the text color, using 6 hex characters for RRGGBB (no leading `#`) - `size(halfPts)`: Set the font size, measured in half-points -- `font(name)`: Set the run's font +- `font(name)` or `font({ascii, cs, eastAsia, hAnsi, hint})`: Set the run's font - `style(name)`: Apply a named run style - `characterSpacing(value)`: Set the character spacing adjustment (in TWIPs) From f11bca728fa28c73b3bef61e9d630080d7496cfe Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sun, 7 Jun 2020 12:46:21 +0800 Subject: [PATCH 069/147] :typo: update comment for the demo --- demo/53-chinese.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/53-chinese.ts b/demo/53-chinese.ts index eb9afb39a2..1bacf888a6 100644 --- a/demo/53-chinese.ts +++ b/demo/53-chinese.ts @@ -1,9 +1,9 @@ -// Chinese text - Chinese need to use a Chinese font. And ascii Text Need to use a ascii font. +// Chinese text - Chinese text need to use a Chinese font. And ascii text need to use a ascii font. // Different from the `52-japanese.ts`. // `52-japanese.ts` will set all characters to use Japanese font. // `53-chinese.ts` will set Chinese characters to use Chinese font, and set ascii characters to use ascii font. -// Note that if the compute have not install `KaiTi` font, this demo doesn't work. +// Note that if the OS have not install `KaiTi` font, this demo doesn't work. // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; From d6fa33035a02130d1c3826547194aeb9c75b8668 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sun, 7 Jun 2020 14:58:59 +0800 Subject: [PATCH 070/147] :doc: update demo `53-chinese.ts` --- demo/53-chinese.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/demo/53-chinese.ts b/demo/53-chinese.ts index 1bacf888a6..eee6eb9032 100644 --- a/demo/53-chinese.ts +++ b/demo/53-chinese.ts @@ -7,7 +7,7 @@ // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HeadingLevel, Packer, Paragraph } from "../build"; +import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "../build"; const doc = new Document({ styles: { @@ -38,6 +38,15 @@ doc.addSection({ new Paragraph({ text: "中文和英文 Chinese and English", }), + new Paragraph({ + children: [ + new TextRun({ + text: "中文和英文 Chinese and English", + font: { eastAsia: "SimSun" }, // set eastAsia to "SimSun". + // The ascii characters will use the default font ("Times") specified in paragraphStyles + }), + ], + }), ], }); From 3cdf96ee0ccf3d69a665e24e325baeed75b82053 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Wed, 17 Jun 2020 14:34:27 +0100 Subject: [PATCH 071/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 900a6f6357..09b272cb5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.0", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From 994df8531b171c48b9b6b645649026563dffefe0 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sat, 20 Jun 2020 19:47:46 +0800 Subject: [PATCH 072/147] :fix: `rowSpan` does not work correctly --- demo/32-merge-and-shade-table-cells.ts | 39 ++++++++++++++++++++++++++ src/file/table/table-row/table-row.ts | 4 +++ src/file/table/table.ts | 15 ++++------ 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index db3174aeaf..14667ffd78 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -209,6 +209,43 @@ const table5 = new Table({ }, }); +const table6 = new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("11")], + }), + new TableCell({ + children: [new Paragraph("12")], + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("21"), new Paragraph("31")], + rowSpan: 2, + }), + new TableCell({ + children: [new Paragraph("22")], + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("32")], + }), + ], + }), + ], + width: { + size: 100, + type: WidthType.PERCENTAGE, + }, +}); + doc.addSection({ children: [ table, @@ -226,6 +263,8 @@ doc.addSection({ table4, new Paragraph("More Merging columns"), table5, + new Paragraph("Another Merging columns"), + table6, ], }); diff --git a/src/file/table/table-row/table-row.ts b/src/file/table/table-row/table-row.ts index 466b7eb320..2a655a535d 100644 --- a/src/file/table/table-row/table-row.ts +++ b/src/file/table/table-row/table-row.ts @@ -46,6 +46,10 @@ export class TableRow extends XmlComponent { return this.options.children; } + public get cells(): TableCell[] { + return this.root.filter((xmlComponent) => xmlComponent instanceof TableCell); + } + public addCellToIndex(cell: TableCell, index: number): void { // Offset because properties is also in root. this.root.splice(index + 1, 0, cell); diff --git a/src/file/table/table.ts b/src/file/table/table.ts index a0e6dab88f..2cc408dc64 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -78,27 +78,24 @@ export class Table extends XmlComponent { this.root.push(row); } - for (const row of rows) { - row.Children.forEach((cell, cellIndex) => { - const column = rows.map((r) => r.Children[cellIndex]); + rows.forEach((row, rowIndex) => { + row.cells.forEach((cell, cellIndex) => { // Row Span has to be added in this method and not the constructor because it needs to know information about the column which happens after Table Cell construction // Row Span of 1 will crash word as it will add RESTART and not a corresponding CONTINUE if (cell.options.rowSpan && cell.options.rowSpan > 1) { - const thisCellsColumnIndex = column.indexOf(cell); - const endColumnIndex = thisCellsColumnIndex + (cell.options.rowSpan - 1); - - for (let i = thisCellsColumnIndex + 1; i <= endColumnIndex; i++) { + const endRowIndex = rowIndex + (cell.options.rowSpan - 1); + for (let i = rowIndex + 1; i <= endRowIndex; i++) { rows[i].addCellToIndex( new TableCell({ children: [], verticalMerge: VerticalMergeType.CONTINUE, }), - i, + cellIndex, ); } } }); - } + }); if (float) { this.properties.setTableFloatProperties(float); From 3977c8ab3bdea6d7b83b09723c71ad9c6ee47013 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sat, 20 Jun 2020 20:20:22 +0800 Subject: [PATCH 073/147] :fix: `rowSpan` continue cell should has the same border to the first row cell --- demo/32-merge-and-shade-table-cells.ts | 39 +++++++++++++++++++++----- src/file/table/table.ts | 1 + 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index 14667ffd78..615f97c46b 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -2,7 +2,7 @@ // Also includes an example on how to center tables // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, ShadingType, Table, TableCell, TableRow, WidthType } from "../build"; +import { AlignmentType, BorderStyle, Document, HeadingLevel, Packer, Paragraph, ShadingType, Table, TableCell, TableRow, WidthType } from "../build"; const doc = new Document(); @@ -209,14 +209,40 @@ const table5 = new Table({ }, }); +const borders = { + top: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, + bottom: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, + left: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, + right: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, +}; + const table6 = new Table({ rows: [ new TableRow({ children: [ new TableCell({ - children: [new Paragraph("11")], + borders, + children: [new Paragraph("11"), new Paragraph("21")], + rowSpan: 2, }), new TableCell({ + borders, children: [new Paragraph("12")], }), ], @@ -224,18 +250,17 @@ const table6 = new Table({ new TableRow({ children: [ new TableCell({ - children: [new Paragraph("21"), new Paragraph("31")], + borders, + children: [new Paragraph("22"), new Paragraph("32")], rowSpan: 2, }), - new TableCell({ - children: [new Paragraph("22")], - }), ], }), new TableRow({ children: [ new TableCell({ - children: [new Paragraph("32")], + borders, + children: [new Paragraph("31")], }), ], }), diff --git a/src/file/table/table.ts b/src/file/table/table.ts index 2cc408dc64..2422f50161 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -87,6 +87,7 @@ export class Table extends XmlComponent { for (let i = rowIndex + 1; i <= endRowIndex; i++) { rows[i].addCellToIndex( new TableCell({ + borders: cell.options.borders, children: [], verticalMerge: VerticalMergeType.CONTINUE, }), From fa7cb0bef1d998fab185f5a57c96d00b53ad589a Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sat, 20 Jun 2020 21:01:23 +0800 Subject: [PATCH 074/147] :test: add test case for `columnSpan` and `rowSpan` --- src/file/table/table.spec.ts | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/file/table/table.spec.ts b/src/file/table/table.spec.ts index d2098fb1e4..49eb7a3f46 100644 --- a/src/file/table/table.spec.ts +++ b/src/file/table/table.spec.ts @@ -188,6 +188,72 @@ describe("Table", () => { }); }); + it("creates a table with the correct columnSpan and rowSpan", () => { + const table = new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("hello")], + columnSpan: 2, + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("hello")], + rowSpan: 2, + }), + new TableCell({ + children: [new Paragraph("hello")], + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("hello")], + }), + ], + }), + ], + }); + const tree = new Formatter().format(table); + const cellP = { "w:p": [{ "w:r": [{ "w:t": [{ _attr: { "xml:space": "preserve" } }, "hello"] }] }] }; + expect(tree).to.deep.equal({ + "w:tbl": [ + { "w:tblPr": [DEFAULT_TABLE_PROPERTIES, BORDERS, WIDTHS] }, + { + "w:tblGrid": [{ "w:gridCol": { _attr: { "w:w": 100 } } }, { "w:gridCol": { _attr: { "w:w": 100 } } }], + }, + { + "w:tr": [ + { + "w:tc": [{ "w:tcPr": [{ "w:gridSpan": { _attr: { "w:val": 2 } } }] }, cellP], + }, + ], + }, + { + "w:tr": [ + { + "w:tc": [{ "w:tcPr": [{ "w:vMerge": { _attr: { "w:val": "restart" } } }] }, cellP], + }, + { "w:tc": [cellP] }, + ], + }, + { + "w:tr": [ + { + "w:tc": [{ "w:tcPr": [{ "w:vMerge": { _attr: { "w:val": "continue" } } }] }, { "w:p": {} }], + }, + { "w:tc": [cellP] }, + ], + }, + ], + }); + }); + it("sets the table to fixed width layout", () => { const table = new Table({ rows: [ From 11e54b3e2cb5ea5721a8f1e4546e29edff35d2c1 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sat, 20 Jun 2020 21:36:35 +0800 Subject: [PATCH 075/147] :fix: handle cell that has both `columnSpan` and `rowSpan` --- src/file/table/table.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/file/table/table.ts b/src/file/table/table.ts index 2422f50161..888f91dca1 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -87,6 +87,7 @@ export class Table extends XmlComponent { for (let i = rowIndex + 1; i <= endRowIndex; i++) { rows[i].addCellToIndex( new TableCell({ + columnSpan: cell.options.columnSpan, borders: cell.options.borders, children: [], verticalMerge: VerticalMergeType.CONTINUE, From 8c9b61b37aa3d4acaa43d1e1a03741a88fa6bd4a Mon Sep 17 00:00:00 2001 From: wangfengming Date: Mon, 22 Jun 2020 12:25:51 +0800 Subject: [PATCH 076/147] :fix: handle `rowSpan` by convert between the virtual column index and the root index --- demo/32-merge-and-shade-table-cells.ts | 87 +++++++++++++++++++--- src/file/table/table-row/table-row.spec.ts | 87 ++++++++++++++++++++++ src/file/table/table-row/table-row.ts | 40 ++++++++++ src/file/table/table.ts | 8 +- 4 files changed, 209 insertions(+), 13 deletions(-) diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index 615f97c46b..6fc7f867ec 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -184,7 +184,7 @@ const table5 = new Table({ new TableRow({ children: [ new TableCell({ - children: [], + children: [new Paragraph("1,0")], }), new TableCell({ children: [new Paragraph("1,2")], @@ -195,10 +195,10 @@ const table5 = new Table({ new TableRow({ children: [ new TableCell({ - children: [], + children: [new Paragraph("2,0")], }), new TableCell({ - children: [], + children: [new Paragraph("2,1")], }), ], }), @@ -238,12 +238,12 @@ const table6 = new Table({ children: [ new TableCell({ borders, - children: [new Paragraph("11"), new Paragraph("21")], + children: [new Paragraph("0,0")], rowSpan: 2, }), new TableCell({ borders, - children: [new Paragraph("12")], + children: [new Paragraph("0,1")], }), ], }), @@ -251,7 +251,7 @@ const table6 = new Table({ children: [ new TableCell({ borders, - children: [new Paragraph("22"), new Paragraph("32")], + children: [new Paragraph("1,1")], rowSpan: 2, }), ], @@ -260,7 +260,72 @@ const table6 = new Table({ children: [ new TableCell({ borders, - children: [new Paragraph("31")], + children: [new Paragraph("2,0")], + }), + ], + }), + ], + width: { + size: 100, + type: WidthType.PERCENTAGE, + }, +}); + +const table7 = new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("0,0")], + }), + new TableCell({ + children: [new Paragraph("0,1")], + }), + new TableCell({ + children: [new Paragraph("0,2")], + rowSpan: 2, + }), + new TableCell({ + children: [new Paragraph("0,3")], + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("1,0")], + columnSpan: 2, + }), + new TableCell({ + children: [new Paragraph("1,3")], + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("2,0")], + columnSpan: 2, + }), + new TableCell({ + children: [new Paragraph("2,2")], + rowSpan: 2, + }), + new TableCell({ + children: [new Paragraph("2,3")], + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("3,0")], + }), + new TableCell({ + children: [new Paragraph("3,1")], + }), + new TableCell({ + children: [new Paragraph("3,3")], }), ], }), @@ -284,12 +349,14 @@ doc.addSection({ heading: HeadingLevel.HEADING_2, }), table3, - new Paragraph("Merging columns"), + new Paragraph("Merging columns 1"), table4, - new Paragraph("More Merging columns"), + new Paragraph("Merging columns 2"), table5, - new Paragraph("Another Merging columns"), + new Paragraph("Merging columns 3"), table6, + new Paragraph("Merging columns 4"), + table7, ], }); diff --git a/src/file/table/table-row/table-row.spec.ts b/src/file/table/table-row/table-row.spec.ts index e013153cd8..0cdb0196b8 100644 --- a/src/file/table/table-row/table-row.spec.ts +++ b/src/file/table/table-row/table-row.spec.ts @@ -182,4 +182,91 @@ describe("TableRow", () => { }); }); }); + + describe("#rootIndexToColumnIndex", () => { + it("should get the correct virtual column index by root index", () => { + const tableRow = new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("test")], + columnSpan: 3, + }), + new TableCell({ + children: [new Paragraph("test")], + }), + new TableCell({ + children: [new Paragraph("test")], + }), + new TableCell({ + children: [new Paragraph("test")], + columnSpan: 3, + }), + ], + }); + + expect(tableRow.rootIndexToColumnIndex(1)).to.equal(0); + expect(tableRow.rootIndexToColumnIndex(2)).to.equal(3); + expect(tableRow.rootIndexToColumnIndex(3)).to.equal(4); + expect(tableRow.rootIndexToColumnIndex(4)).to.equal(5); + }); + }); + + describe("#columnIndexToRootIndex", () => { + it("should get the correct root index by virtual column index", () => { + const tableRow = new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("test")], + columnSpan: 3, + }), + new TableCell({ + children: [new Paragraph("test")], + }), + new TableCell({ + children: [new Paragraph("test")], + }), + new TableCell({ + children: [new Paragraph("test")], + columnSpan: 3, + }), + ], + }); + + expect(tableRow.columnIndexToRootIndex(0)).to.equal(1); + expect(tableRow.columnIndexToRootIndex(1)).to.equal(1); + expect(tableRow.columnIndexToRootIndex(2)).to.equal(1); + + expect(tableRow.columnIndexToRootIndex(3)).to.equal(2); + expect(tableRow.columnIndexToRootIndex(4)).to.equal(3); + + expect(tableRow.columnIndexToRootIndex(5)).to.equal(4); + expect(tableRow.columnIndexToRootIndex(6)).to.equal(4); + expect(tableRow.columnIndexToRootIndex(7)).to.equal(4); + }); + + it("should allow end new cell index", () => { + const tableRow = new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("test")], + columnSpan: 3, + }), + new TableCell({ + children: [new Paragraph("test")], + }), + new TableCell({ + children: [new Paragraph("test")], + }), + new TableCell({ + children: [new Paragraph("test")], + columnSpan: 3, + }), + ], + }); + + expect(() => tableRow.columnIndexToRootIndex(8)).to.throw(`cell 'columnIndex' should not great than 7`); + expect(tableRow.columnIndexToRootIndex(8, true)).to.equal(5); + expect(() => tableRow.columnIndexToRootIndex(9, true)).to.throw(`cell 'columnIndex' should not great than 8`); + }); + }); }); diff --git a/src/file/table/table-row/table-row.ts b/src/file/table/table-row/table-row.ts index 2a655a535d..320616e809 100644 --- a/src/file/table/table-row/table-row.ts +++ b/src/file/table/table-row/table-row.ts @@ -54,4 +54,44 @@ export class TableRow extends XmlComponent { // Offset because properties is also in root. this.root.splice(index + 1, 0, cell); } + + public addCellToColumnIndex(cell: TableCell, columnIndex: number): void { + const rootIndex = this.columnIndexToRootIndex(columnIndex, true); + this.addCellToIndex(cell, rootIndex - 1); + } + + public rootIndexToColumnIndex(rootIndex: number): number { + // convert the root index to the virtual column index + if (rootIndex < 1 || rootIndex >= this.root.length) { + throw new Error(`cell 'rootIndex' should between 1 to ${this.root.length - 1}`); + } + let colIdx = 0; + // Offset because properties is also in root. + for (let rootIdx = 1; rootIdx < rootIndex; rootIdx++) { + const cell = this.root[rootIdx] as TableCell; + colIdx += cell.options.columnSpan || 1; + } + return colIdx; + } + + public columnIndexToRootIndex(columnIndex: number, allowEndNewCell: boolean = false): number { + // convert the virtual column index to the root index + // `allowEndNewCell` for get index to inert new cell + if (columnIndex < 0) { + throw new Error(`cell 'columnIndex' should not less than zero`); + } + let colIdx = 0; + // Offset because properties is also in root. + let rootIdx = 1; + const endRootIndex = allowEndNewCell ? this.root.length : this.root.length - 1; + while (colIdx <= columnIndex) { + if (rootIdx > endRootIndex) { + throw new Error(`cell 'columnIndex' should not great than ${colIdx - 1}`); + } + const cell = this.root[rootIdx] as TableCell; + rootIdx += 1; + colIdx += (cell && cell.options.columnSpan) || 1; + } + return rootIdx - 1; + } } diff --git a/src/file/table/table.ts b/src/file/table/table.ts index 888f91dca1..f99b6fc9b1 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -83,16 +83,18 @@ export class Table extends XmlComponent { // Row Span has to be added in this method and not the constructor because it needs to know information about the column which happens after Table Cell construction // Row Span of 1 will crash word as it will add RESTART and not a corresponding CONTINUE if (cell.options.rowSpan && cell.options.rowSpan > 1) { + const columnIndex = row.rootIndexToColumnIndex(cellIndex + 1); + const startRowIndex = rowIndex + 1; const endRowIndex = rowIndex + (cell.options.rowSpan - 1); - for (let i = rowIndex + 1; i <= endRowIndex; i++) { - rows[i].addCellToIndex( + for (let i = startRowIndex; i <= endRowIndex; i++) { + rows[i].addCellToColumnIndex( new TableCell({ columnSpan: cell.options.columnSpan, borders: cell.options.borders, children: [], verticalMerge: VerticalMergeType.CONTINUE, }), - cellIndex, + columnIndex, ); } } From 057f41e35558bd687d8751d4439f69da3047c1ca Mon Sep 17 00:00:00 2001 From: wangfengming Date: Mon, 22 Jun 2020 12:34:08 +0800 Subject: [PATCH 077/147] :test: more test cases --- src/file/table/table-row/table-row.spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/file/table/table-row/table-row.spec.ts b/src/file/table/table-row/table-row.spec.ts index 0cdb0196b8..03b8b2862e 100644 --- a/src/file/table/table-row/table-row.spec.ts +++ b/src/file/table/table-row/table-row.spec.ts @@ -208,6 +208,9 @@ describe("TableRow", () => { expect(tableRow.rootIndexToColumnIndex(2)).to.equal(3); expect(tableRow.rootIndexToColumnIndex(3)).to.equal(4); expect(tableRow.rootIndexToColumnIndex(4)).to.equal(5); + + expect(() => tableRow.rootIndexToColumnIndex(0)).to.throw(`cell 'rootIndex' should between 1 to 4`); + expect(() => tableRow.rootIndexToColumnIndex(5)).to.throw(`cell 'rootIndex' should between 1 to 4`); }); }); @@ -242,6 +245,9 @@ describe("TableRow", () => { expect(tableRow.columnIndexToRootIndex(5)).to.equal(4); expect(tableRow.columnIndexToRootIndex(6)).to.equal(4); expect(tableRow.columnIndexToRootIndex(7)).to.equal(4); + + expect(() => tableRow.columnIndexToRootIndex(-1)).to.throw(`cell 'columnIndex' should not less than zero`); + expect(() => tableRow.columnIndexToRootIndex(8)).to.throw(`cell 'columnIndex' should not great than 7`); }); it("should allow end new cell index", () => { @@ -264,7 +270,6 @@ describe("TableRow", () => { ], }); - expect(() => tableRow.columnIndexToRootIndex(8)).to.throw(`cell 'columnIndex' should not great than 7`); expect(tableRow.columnIndexToRootIndex(8, true)).to.equal(5); expect(() => tableRow.columnIndexToRootIndex(9, true)).to.throw(`cell 'columnIndex' should not great than 8`); }); From ba3d551c9fb9357adc64770684fd9ab6ef514969 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Mon, 29 Jun 2020 01:17:13 +0100 Subject: [PATCH 078/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09b272cb5b..4e1157e9d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.2.0", + "version": "5.2.1", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From 80bab95f6c6f3149bf2f7f0ad572bcc9b8f75218 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Wed, 8 Jul 2020 10:55:15 +0800 Subject: [PATCH 079/147] :fix: `rowSpan` can't work when column index out of range --- demo/32-merge-and-shade-table-cells.ts | 7 +------ src/file/table/table-row/table-row.spec.ts | 3 ++- src/file/table/table-row/table-row.ts | 10 +++++++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index 6fc7f867ec..3dca2423d4 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -287,6 +287,7 @@ const table7 = new Table({ }), new TableCell({ children: [new Paragraph("0,3")], + rowSpan: 3, }), ], }), @@ -296,9 +297,6 @@ const table7 = new Table({ children: [new Paragraph("1,0")], columnSpan: 2, }), - new TableCell({ - children: [new Paragraph("1,3")], - }), ], }), new TableRow({ @@ -311,9 +309,6 @@ const table7 = new Table({ children: [new Paragraph("2,2")], rowSpan: 2, }), - new TableCell({ - children: [new Paragraph("2,3")], - }), ], }), new TableRow({ diff --git a/src/file/table/table-row/table-row.spec.ts b/src/file/table/table-row/table-row.spec.ts index 03b8b2862e..e381056c3e 100644 --- a/src/file/table/table-row/table-row.spec.ts +++ b/src/file/table/table-row/table-row.spec.ts @@ -271,7 +271,8 @@ describe("TableRow", () => { }); expect(tableRow.columnIndexToRootIndex(8, true)).to.equal(5); - expect(() => tableRow.columnIndexToRootIndex(9, true)).to.throw(`cell 'columnIndex' should not great than 8`); + // for column 10, just place the new cell at the end of cell + expect(tableRow.columnIndexToRootIndex(10, true)).to.equal(5); }); }); }); diff --git a/src/file/table/table-row/table-row.ts b/src/file/table/table-row/table-row.ts index 320616e809..05ba1264a5 100644 --- a/src/file/table/table-row/table-row.ts +++ b/src/file/table/table-row/table-row.ts @@ -83,10 +83,14 @@ export class TableRow extends XmlComponent { let colIdx = 0; // Offset because properties is also in root. let rootIdx = 1; - const endRootIndex = allowEndNewCell ? this.root.length : this.root.length - 1; while (colIdx <= columnIndex) { - if (rootIdx > endRootIndex) { - throw new Error(`cell 'columnIndex' should not great than ${colIdx - 1}`); + if (rootIdx >= this.root.length) { + if (allowEndNewCell) { + // for insert verticalMerge CONTINUE at row end + return this.root.length; + } else { + throw new Error(`cell 'columnIndex' should not great than ${colIdx - 1}`); + } } const cell = this.root[rootIdx] as TableCell; rootIdx += 1; From 0de302d19209f283a05e35287404985fa070fc51 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Wed, 8 Jul 2020 11:26:24 +0800 Subject: [PATCH 080/147] :typo: update comments --- src/file/table/table-row/table-row.spec.ts | 2 +- src/file/table/table-row/table-row.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/file/table/table-row/table-row.spec.ts b/src/file/table/table-row/table-row.spec.ts index e381056c3e..90f6ad4937 100644 --- a/src/file/table/table-row/table-row.spec.ts +++ b/src/file/table/table-row/table-row.spec.ts @@ -271,7 +271,7 @@ describe("TableRow", () => { }); expect(tableRow.columnIndexToRootIndex(8, true)).to.equal(5); - // for column 10, just place the new cell at the end of cell + // for column 10, just place the new cell at the end of row expect(tableRow.columnIndexToRootIndex(10, true)).to.equal(5); }); }); diff --git a/src/file/table/table-row/table-row.ts b/src/file/table/table-row/table-row.ts index 05ba1264a5..11ea0bb2e2 100644 --- a/src/file/table/table-row/table-row.ts +++ b/src/file/table/table-row/table-row.ts @@ -86,7 +86,7 @@ export class TableRow extends XmlComponent { while (colIdx <= columnIndex) { if (rootIdx >= this.root.length) { if (allowEndNewCell) { - // for insert verticalMerge CONTINUE at row end + // for inserting verticalMerge CONTINUE cell at end of row return this.root.length; } else { throw new Error(`cell 'columnIndex' should not great than ${colIdx - 1}`); From 40dc90e585a75307ae4b0c6b9929b4de8fbf90be Mon Sep 17 00:00:00 2001 From: wangfengming Date: Wed, 8 Jul 2020 12:32:01 +0800 Subject: [PATCH 081/147] :fix: insert the continue cell properly --- demo/32-merge-and-shade-table-cells.ts | 37 +++++++++++++++++++++++++ src/file/table/table-cell/table-cell.ts | 7 ++--- src/file/table/table.ts | 31 +++++++++++---------- 3 files changed, 56 insertions(+), 19 deletions(-) diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index 3dca2423d4..f12350988e 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -331,6 +331,41 @@ const table7 = new Table({ }, }); +const table8 = new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ children: [new Paragraph("1,1")] }), + new TableCell({ children: [new Paragraph("1,2")] }), + new TableCell({ children: [new Paragraph("1,3")] }), + new TableCell({ children: [new Paragraph("1,4")], rowSpan: 4, borders }), + ], + }), + new TableRow({ + children: [ + new TableCell({ children: [new Paragraph("2,1")] }), + new TableCell({ children: [new Paragraph("2,2")] }), + new TableCell({ children: [new Paragraph("2,3")], rowSpan: 3 }), + ], + }), + new TableRow({ + children: [ + new TableCell({ children: [new Paragraph("3,1")] }), + new TableCell({ children: [new Paragraph("3,2")], rowSpan: 2 }), + ], + }), + new TableRow({ + children: [ + new TableCell({ children: [new Paragraph("4,1")] }), + ], + }), + ], + width: { + size: 100, + type: WidthType.PERCENTAGE, + }, +}); + doc.addSection({ children: [ table, @@ -352,6 +387,8 @@ doc.addSection({ table6, new Paragraph("Merging columns 4"), table7, + new Paragraph("Merging columns 5"), + table8, ], }); diff --git a/src/file/table/table-cell/table-cell.ts b/src/file/table/table-cell/table-cell.ts index c809c157ad..babd0031ff 100644 --- a/src/file/table/table-cell/table-cell.ts +++ b/src/file/table/table-cell/table-cell.ts @@ -70,6 +70,9 @@ export class TableCell extends XmlComponent { if (options.verticalMerge) { this.properties.addVerticalMerge(options.verticalMerge); + } else if (options.rowSpan && options.rowSpan > 1) { + // if cell already have a `verticalMerge`, don't handle `rowSpan` + this.properties.addVerticalMerge(VerticalMergeType.RESTART); } if (options.margins) { @@ -84,10 +87,6 @@ export class TableCell extends XmlComponent { this.properties.addGridSpan(options.columnSpan); } - if (options.rowSpan && options.rowSpan > 1) { - this.properties.addVerticalMerge(VerticalMergeType.RESTART); - } - if (options.width) { this.properties.setWidth(options.width.size, options.width.type); } diff --git a/src/file/table/table.ts b/src/file/table/table.ts index f99b6fc9b1..69b3c0f775 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -79,25 +79,26 @@ export class Table extends XmlComponent { } rows.forEach((row, rowIndex) => { - row.cells.forEach((cell, cellIndex) => { + if (rowIndex === rows.length - 1) { + // don't process the end row + return; + } + let columnIndex = 0; + row.cells.forEach((cell) => { // Row Span has to be added in this method and not the constructor because it needs to know information about the column which happens after Table Cell construction // Row Span of 1 will crash word as it will add RESTART and not a corresponding CONTINUE if (cell.options.rowSpan && cell.options.rowSpan > 1) { - const columnIndex = row.rootIndexToColumnIndex(cellIndex + 1); - const startRowIndex = rowIndex + 1; - const endRowIndex = rowIndex + (cell.options.rowSpan - 1); - for (let i = startRowIndex; i <= endRowIndex; i++) { - rows[i].addCellToColumnIndex( - new TableCell({ - columnSpan: cell.options.columnSpan, - borders: cell.options.borders, - children: [], - verticalMerge: VerticalMergeType.CONTINUE, - }), - columnIndex, - ); - } + const continueCell = new TableCell({ + // the inserted CONTINUE cell has rowSpan, and will be handled when process the next row + rowSpan: cell.options.rowSpan - 1, + columnSpan: cell.options.columnSpan, + borders: cell.options.borders, + children: [], + verticalMerge: VerticalMergeType.CONTINUE, + }); + rows[rowIndex + 1].addCellToColumnIndex(continueCell, columnIndex); } + columnIndex += cell.options.columnSpan || 1; }); }); From b8232f7a02c2ef30fbdc890c6f145d8a21037f10 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 11 Jul 2020 19:34:29 +0100 Subject: [PATCH 082/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4e1157e9d6..d88a3731f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.2.1", + "version": "5.2.2", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From 437e83ab7849baf134a7d877611aacec3cbc9ccf Mon Sep 17 00:00:00 2001 From: wangfengming Date: Sat, 11 Jul 2020 17:01:32 +0800 Subject: [PATCH 083/147] :feat: refine paragraph/run properties options --- src/file/document/body/body.ts | 2 +- src/file/numbering/abstract-numbering.spec.ts | 5 + src/file/numbering/level.ts | 124 +----------- src/file/paragraph/paragraph.ts | 113 +---------- src/file/paragraph/properties.ts | 123 +++++++++++- src/file/paragraph/run/caps.ts | 13 -- src/file/paragraph/run/formatting.ts | 11 -- src/file/paragraph/run/index.ts | 1 + src/file/paragraph/run/properties.ts | 177 +++++++++++++++++- src/file/paragraph/run/run.spec.ts | 4 +- src/file/paragraph/run/run.ts | 137 +------------- src/file/styles/defaults/index.ts | 15 +- .../styles/defaults/paragraph-properties.ts | 6 +- src/file/styles/defaults/run-properties.ts | 6 +- src/file/styles/index.ts | 2 +- src/file/styles/style-options.ts | 56 ------ src/file/styles/style/character-style.spec.ts | 4 + src/file/styles/style/character-style.ts | 105 +---------- src/file/styles/style/paragraph-style.spec.ts | 4 + src/file/styles/style/paragraph-style.ts | 135 +------------ 20 files changed, 360 insertions(+), 683 deletions(-) delete mode 100644 src/file/paragraph/run/caps.ts delete mode 100644 src/file/styles/style-options.ts diff --git a/src/file/document/body/body.ts b/src/file/document/body/body.ts index a0b7c27a2c..ea0d24a448 100644 --- a/src/file/document/body/body.ts +++ b/src/file/document/body/body.ts @@ -45,7 +45,7 @@ export class Body extends XmlComponent { private createSectionParagraph(section: SectionProperties): Paragraph { const paragraph = new Paragraph({}); const properties = new ParagraphProperties({}); - properties.addChildElement(section); + properties.push(section); paragraph.addChildElement(properties); return paragraph; } diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index 6548a4436d..36173364c0 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -292,6 +292,7 @@ describe("AbstractNumbering", () => { style: { run: { size: 24, + sizeComplexScript: false, }, }, }, @@ -487,6 +488,7 @@ describe("AbstractNumbering", () => { style: { run: { bold: true, + boldComplexScript: false, }, }, }, @@ -506,6 +508,7 @@ describe("AbstractNumbering", () => { style: { run: { italics: true, + italicsComplexScript: false, }, }, }, @@ -525,6 +528,7 @@ describe("AbstractNumbering", () => { style: { run: { highlight: "005599", + highlightComplexScript: false, }, }, }, @@ -548,6 +552,7 @@ describe("AbstractNumbering", () => { fill: "00FFFF", color: "FF0000", }, + shadingComplexScript: false, }, }, }, diff --git a/src/file/numbering/level.ts b/src/file/numbering/level.ts index ddef2b2d78..6a68f0712f 100644 --- a/src/file/numbering/level.ts +++ b/src/file/numbering/level.ts @@ -1,19 +1,7 @@ import { Attributes, XmlAttributeComponent, XmlComponent } from "file/xml-components"; -import { - Alignment, - AlignmentType, - Indent, - KeepLines, - KeepNext, - Spacing, - TabStop, - TabStopType, - ThematicBreak, -} from "../paragraph/formatting"; -import { ParagraphProperties } from "../paragraph/properties"; -import * as formatting from "../paragraph/run/formatting"; -import { RunProperties } from "../paragraph/run/properties"; -import { IParagraphStyleOptions2, IRunStyleOptions } from "../styles/style-options"; +import { AlignmentType } from "../paragraph/formatting"; +import { IParagraphStylePropertiesOptions, ParagraphProperties } from "../paragraph/properties"; +import { IRunStylePropertiesOptions, RunProperties } from "../paragraph/run/properties"; interface ILevelAttributesProperties { readonly ilvl?: number; @@ -85,8 +73,8 @@ export interface ILevelsOptions { readonly start?: number; readonly suffix?: LevelSuffix; readonly style?: { - readonly run?: IRunStyleOptions; - readonly paragraph?: IParagraphStyleOptions2; + readonly run?: IRunStylePropertiesOptions; + readonly paragraph?: IParagraphStylePropertiesOptions; }; } @@ -125,8 +113,8 @@ export class LevelBase extends XmlComponent { this.root.push(new LevelText(text)); } - this.paragraphProperties = new ParagraphProperties({}); - this.runProperties = new RunProperties(); + this.paragraphProperties = new ParagraphProperties(style && style.paragraph); + this.runProperties = new RunProperties(style && style.run); this.root.push(this.paragraphProperties); this.root.push(this.runProperties); @@ -134,104 +122,6 @@ export class LevelBase extends XmlComponent { if (suffix) { this.root.push(new Suffix(suffix)); } - - if (style) { - if (style.run) { - if (style.run.size) { - this.runProperties.push(new formatting.Size(style.run.size)); - } - - if (style.run.bold) { - this.runProperties.push(new formatting.Bold()); - } - - if (style.run.italics) { - this.runProperties.push(new formatting.Italics()); - } - - if (style.run.smallCaps) { - this.runProperties.push(new formatting.SmallCaps()); - } - - if (style.run.allCaps) { - this.runProperties.push(new formatting.Caps()); - } - - if (style.run.strike) { - this.runProperties.push(new formatting.Strike()); - } - - if (style.run.doubleStrike) { - this.runProperties.push(new formatting.DoubleStrike()); - } - - if (style.run.subScript) { - this.runProperties.push(new formatting.SubScript()); - } - - if (style.run.superScript) { - this.runProperties.push(new formatting.SuperScript()); - } - - if (style.run.underline) { - this.runProperties.push(new formatting.Underline(style.run.underline.type, style.run.underline.color)); - } - - if (style.run.emphasisMark) { - this.runProperties.push(new formatting.EmphasisMark(style.run.emphasisMark.type)); - } - - if (style.run.color) { - this.runProperties.push(new formatting.Color(style.run.color)); - } - - if (style.run.font) { - this.runProperties.push(new formatting.RunFonts(style.run.font)); - } - - if (style.run.highlight) { - this.runProperties.push(new formatting.Highlight(style.run.highlight)); - } - - if (style.run.shadow) { - this.runProperties.push(new formatting.Shading(style.run.shadow.type, style.run.shadow.fill, style.run.shadow.color)); - } - } - - if (style.paragraph) { - if (style.paragraph.alignment) { - this.paragraphProperties.push(new Alignment(style.paragraph.alignment)); - } - - if (style.paragraph.thematicBreak) { - this.paragraphProperties.push(new ThematicBreak()); - } - - if (style.paragraph.rightTabStop) { - this.paragraphProperties.push(new TabStop(TabStopType.RIGHT, style.paragraph.rightTabStop)); - } - - if (style.paragraph.leftTabStop) { - this.paragraphProperties.push(new TabStop(TabStopType.LEFT, style.paragraph.leftTabStop)); - } - - if (style.paragraph.indent) { - this.paragraphProperties.push(new Indent(style.paragraph.indent)); - } - - if (style.paragraph.spacing) { - this.paragraphProperties.push(new Spacing(style.paragraph.spacing)); - } - - if (style.paragraph.keepNext) { - this.paragraphProperties.push(new KeepNext()); - } - - if (style.paragraph.keepLines) { - this.paragraphProperties.push(new KeepLines()); - } - } - } } } diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index c97d8d34fd..a593f6f0ab 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -3,48 +3,13 @@ import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run" import { IXmlableObject, XmlComponent } from "file/xml-components"; import { File } from "../file"; -import { Alignment, AlignmentType } from "./formatting/alignment"; -import { Bidirectional } from "./formatting/bidirectional"; -import { IBorderOptions, ThematicBreak } from "./formatting/border"; -import { IIndentAttributesProperties, Indent } from "./formatting/indent"; -import { KeepLines, KeepNext } from "./formatting/keep"; -import { PageBreak, PageBreakBefore } from "./formatting/page-break"; -import { ContextualSpacing, ISpacingProperties, Spacing } from "./formatting/spacing"; -import { HeadingLevel, Style } from "./formatting/style"; -import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop"; -import { NumberProperties } from "./formatting/unordered-list"; -import { Bookmark, HyperlinkRef, OutlineLevel } from "./links"; -import { ParagraphProperties } from "./properties"; +import { PageBreak } from "./formatting/page-break"; +import { Bookmark, HyperlinkRef } from "./links"; +import { IParagraphPropertiesOptions, ParagraphProperties } from "./properties"; import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run"; -export interface IParagraphOptions { +export interface IParagraphOptions extends IParagraphPropertiesOptions { readonly text?: string; - readonly border?: IBorderOptions; - readonly spacing?: ISpacingProperties; - readonly outlineLevel?: number; - readonly alignment?: AlignmentType; - readonly heading?: HeadingLevel; - readonly bidirectional?: boolean; - readonly thematicBreak?: boolean; - readonly pageBreakBefore?: boolean; - readonly contextualSpacing?: boolean; - readonly indent?: IIndentAttributesProperties; - readonly keepLines?: boolean; - readonly keepNext?: boolean; - readonly tabStops?: Array<{ - readonly position: number | TabStopPosition; - readonly type: TabStopType; - readonly leader?: LeaderType; - }>; - readonly style?: string; - readonly bullet?: { - readonly level: number; - }; - readonly numbering?: { - readonly reference: string; - readonly level: number; - readonly custom?: boolean; - }; readonly children?: Array< TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef >; @@ -70,9 +35,7 @@ export class Paragraph extends XmlComponent { return; } - this.properties = new ParagraphProperties({ - border: options.border, - }); + this.properties = new ParagraphProperties(options); this.root.push(this.properties); @@ -80,72 +43,6 @@ export class Paragraph extends XmlComponent { this.root.push(new TextRun(options.text)); } - if (options.spacing) { - this.properties.push(new Spacing(options.spacing)); - } - - if (options.outlineLevel !== undefined) { - this.properties.push(new OutlineLevel(options.outlineLevel)); - } - - if (options.alignment) { - this.properties.push(new Alignment(options.alignment)); - } - - if (options.heading) { - this.properties.push(new Style(options.heading)); - } - - if (options.bidirectional) { - this.properties.push(new Bidirectional()); - } - - if (options.thematicBreak) { - this.properties.push(new ThematicBreak()); - } - - if (options.pageBreakBefore) { - this.properties.push(new PageBreakBefore()); - } - - if (options.contextualSpacing) { - this.properties.push(new ContextualSpacing(options.contextualSpacing)); - } - - if (options.indent) { - this.properties.push(new Indent(options.indent)); - } - - if (options.keepLines) { - this.properties.push(new KeepLines()); - } - - if (options.keepNext) { - this.properties.push(new KeepNext()); - } - - if (options.tabStops) { - for (const tabStop of options.tabStops) { - this.properties.push(new TabStop(tabStop.type, tabStop.position, tabStop.leader)); - } - } - - if (options.style) { - this.properties.push(new Style(options.style)); - } - - if (options.bullet) { - this.properties.push(new Style("ListParagraph")); - this.properties.push(new NumberProperties(1, options.bullet.level)); - } - - if (options.numbering) { - if (!options.numbering.custom) { - this.properties.push(new Style("ListParagraph")); - } - this.properties.push(new NumberProperties(options.numbering.reference, options.numbering.level)); - } - if (options.children) { for (const child of options.children) { if (child instanceof Bookmark) { diff --git a/src/file/paragraph/properties.ts b/src/file/paragraph/properties.ts index 35836ce30e..52afbd1dd8 100644 --- a/src/file/paragraph/properties.ts +++ b/src/file/paragraph/properties.ts @@ -1,19 +1,136 @@ // http://officeopenxml.com/WPparagraphProperties.php import { IgnoreIfEmptyXmlComponent, XmlComponent } from "file/xml-components"; +import { Alignment, AlignmentType } from "./formatting/alignment"; +import { Bidirectional } from "./formatting/bidirectional"; +import { Border, IBorderOptions, ThematicBreak } from "./formatting/border"; +import { IIndentAttributesProperties, Indent } from "./formatting/indent"; +import { KeepLines, KeepNext } from "./formatting/keep"; +import { PageBreakBefore } from "./formatting/page-break"; +import { ContextualSpacing, ISpacingProperties, Spacing } from "./formatting/spacing"; +import { HeadingLevel, Style } from "./formatting/style"; +import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop"; +import { NumberProperties } from "./formatting/unordered-list"; +import { OutlineLevel } from "./links"; -import { Border, IBorderOptions } from "./formatting/border"; +export interface IParagraphStylePropertiesOptions { + readonly alignment?: AlignmentType; + readonly thematicBreak?: boolean; + readonly contextualSpacing?: boolean; + readonly rightTabStop?: number; + readonly leftTabStop?: number; + readonly indent?: IIndentAttributesProperties; + readonly spacing?: ISpacingProperties; + readonly keepNext?: boolean; + readonly keepLines?: boolean; + readonly outlineLevel?: number; +} -interface IParagraphPropertiesOptions { +export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOptions { readonly border?: IBorderOptions; + readonly heading?: HeadingLevel; + readonly bidirectional?: boolean; + readonly pageBreakBefore?: boolean; + readonly tabStops?: Array<{ + readonly position: number | TabStopPosition; + readonly type: TabStopType; + readonly leader?: LeaderType; + }>; + readonly style?: string; + readonly bullet?: { + readonly level: number; + }; + readonly numbering?: { + readonly reference: string; + readonly level: number; + readonly custom?: boolean; + }; } export class ParagraphProperties extends IgnoreIfEmptyXmlComponent { - constructor(options: IParagraphPropertiesOptions) { + constructor(options?: IParagraphPropertiesOptions) { super("w:pPr"); + if (!options) { + return; + } + if (options.border) { this.push(new Border(options.border)); } + + if (options.spacing) { + this.push(new Spacing(options.spacing)); + } + + if (options.outlineLevel !== undefined) { + this.push(new OutlineLevel(options.outlineLevel)); + } + + if (options.alignment) { + this.push(new Alignment(options.alignment)); + } + + if (options.heading) { + this.push(new Style(options.heading)); + } + + if (options.bidirectional) { + this.push(new Bidirectional()); + } + + if (options.thematicBreak) { + this.push(new ThematicBreak()); + } + + if (options.pageBreakBefore) { + this.push(new PageBreakBefore()); + } + + if (options.contextualSpacing) { + this.push(new ContextualSpacing(options.contextualSpacing)); + } + + if (options.indent) { + this.push(new Indent(options.indent)); + } + + if (options.keepLines) { + this.push(new KeepLines()); + } + + if (options.keepNext) { + this.push(new KeepNext()); + } + + if (options.tabStops) { + for (const tabStop of options.tabStops) { + this.push(new TabStop(tabStop.type, tabStop.position, tabStop.leader)); + } + } + + if (options.style) { + this.push(new Style(options.style)); + } + + if (options.bullet) { + this.push(new Style("ListParagraph")); + this.push(new NumberProperties(1, options.bullet.level)); + } + + if (options.numbering) { + if (!options.numbering.custom) { + this.push(new Style("ListParagraph")); + } + this.push(new NumberProperties(options.numbering.reference, options.numbering.level)); + } + + if (options.rightTabStop) { + this.push(new TabStop(TabStopType.RIGHT, options.rightTabStop)); + } + + if (options.leftTabStop) { + this.push(new TabStop(TabStopType.LEFT, options.leftTabStop)); + } } public push(item: XmlComponent): void { diff --git a/src/file/paragraph/run/caps.ts b/src/file/paragraph/run/caps.ts deleted file mode 100644 index 0b9fb510be..0000000000 --- a/src/file/paragraph/run/caps.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { XmlComponent } from "file/xml-components"; - -export class SmallCaps extends XmlComponent { - constructor() { - super("w:smallCaps"); - } -} - -export class Caps extends XmlComponent { - constructor() { - super("w:caps"); - } -} diff --git a/src/file/paragraph/run/formatting.ts b/src/file/paragraph/run/formatting.ts index 51b14be5cf..3ef041d7d9 100644 --- a/src/file/paragraph/run/formatting.ts +++ b/src/file/paragraph/run/formatting.ts @@ -115,17 +115,6 @@ export class Imprint extends XmlComponent { } } -/* export class Shadow extends XmlComponent { - constructor() { - super("w:shadow"); - this.root.push( - new Attributes({ - val: true, - }), - ); - } -} */ - export class SmallCaps extends XmlComponent { constructor() { super("w:smallCaps"); diff --git a/src/file/paragraph/run/index.ts b/src/file/paragraph/run/index.ts index 745e33ea5a..3bf62d66cf 100644 --- a/src/file/paragraph/run/index.ts +++ b/src/file/paragraph/run/index.ts @@ -1,4 +1,5 @@ export * from "./run"; +export * from "./properties"; export * from "./text-run"; export * from "./symbol-run"; export * from "./picture-run"; diff --git a/src/file/paragraph/run/properties.ts b/src/file/paragraph/run/properties.ts index 903282b5a6..0bd082afc5 100644 --- a/src/file/paragraph/run/properties.ts +++ b/src/file/paragraph/run/properties.ts @@ -1,8 +1,183 @@ +import { ShadingType } from "file/table"; import { IgnoreIfEmptyXmlComponent, XmlComponent } from "file/xml-components"; +import { EmphasisMark, EmphasisMarkType } from "./emphasis-mark"; +import { + Bold, + BoldComplexScript, + Caps, + CharacterSpacing, + Color, + DoubleStrike, + Highlight, + HighlightComplexScript, + Italics, + ItalicsComplexScript, + RightToLeft, + Shading, + ShadowComplexScript, + Size, + SizeComplexScript, + SmallCaps, + Strike, +} from "./formatting"; +import { IFontAttributesProperties, RunFonts } from "./run-fonts"; +import { SubScript, SuperScript } from "./script"; +import { Style } from "./style"; +import { Underline, UnderlineType } from "./underline"; + +interface IFontOptions { + readonly name: string; + readonly hint?: string; +} + +export interface IRunStylePropertiesOptions { + readonly bold?: boolean; + readonly boldComplexScript?: boolean; + readonly italics?: boolean; + readonly italicsComplexScript?: boolean; + readonly underline?: { + readonly color?: string; + readonly type?: UnderlineType; + }; + readonly emphasisMark?: { + readonly type?: EmphasisMarkType; + }; + readonly color?: string; + readonly size?: number; + readonly sizeComplexScript?: boolean | number; + readonly rightToLeft?: boolean; + readonly smallCaps?: boolean; + readonly allCaps?: boolean; + readonly strike?: boolean; + readonly doubleStrike?: boolean; + readonly subScript?: boolean; + readonly superScript?: boolean; + readonly font?: string | IFontOptions | IFontAttributesProperties; + readonly highlight?: string; + readonly highlightComplexScript?: boolean | string; + readonly characterSpacing?: number; + readonly shading?: { + readonly type: ShadingType; + readonly fill: string; + readonly color: string; + }; + readonly shadingComplexScript?: boolean | IRunStylePropertiesOptions["shading"]; + readonly shadow?: IRunStylePropertiesOptions["shading"]; +} + +export interface IRunPropertiesOptions extends IRunStylePropertiesOptions { + readonly style?: string; +} export class RunProperties extends IgnoreIfEmptyXmlComponent { - constructor() { + constructor(options?: IRunPropertiesOptions) { super("w:rPr"); + + if (!options) { + return; + } + + if (options.bold) { + this.push(new Bold()); + } + if ((options.boldComplexScript === undefined && options.bold) || options.boldComplexScript) { + this.push(new BoldComplexScript()); + } + + if (options.italics) { + this.push(new Italics()); + } + if ((options.italicsComplexScript === undefined && options.italics) || options.italicsComplexScript) { + this.push(new ItalicsComplexScript()); + } + + if (options.underline) { + this.push(new Underline(options.underline.type, options.underline.color)); + } + + if (options.emphasisMark) { + this.push(new EmphasisMark(options.emphasisMark.type)); + } + + if (options.color) { + this.push(new Color(options.color)); + } + + if (options.size) { + this.push(new Size(options.size)); + } + const szCs = + options.sizeComplexScript === undefined || options.sizeComplexScript === true ? options.size : options.sizeComplexScript; + if (szCs) { + this.push(new SizeComplexScript(szCs)); + } + + if (options.rightToLeft) { + this.push(new RightToLeft()); + } + + if (options.smallCaps) { + this.push(new SmallCaps()); + } + + if (options.allCaps) { + this.push(new Caps()); + } + + if (options.strike) { + this.push(new Strike()); + } + + if (options.doubleStrike) { + this.push(new DoubleStrike()); + } + + if (options.subScript) { + this.push(new SubScript()); + } + + if (options.superScript) { + this.push(new SuperScript()); + } + + if (options.style) { + this.push(new Style(options.style)); + } + + if (options.font) { + if (typeof options.font === "string") { + this.push(new RunFonts(options.font)); + } else if ("name" in options.font) { + this.push(new RunFonts(options.font.name, options.font.hint)); + } else { + this.push(new RunFonts(options.font)); + } + } + + if (options.highlight) { + this.push(new Highlight(options.highlight)); + } + const highlightCs = + options.highlightComplexScript === undefined || options.highlightComplexScript === true + ? options.highlight + : options.highlightComplexScript; + if (highlightCs) { + this.push(new HighlightComplexScript(highlightCs)); + } + + if (options.characterSpacing) { + this.push(new CharacterSpacing(options.characterSpacing)); + } + + const shading = options.shading || options.shadow; + if (shading) { + this.push(new Shading(shading.type, shading.fill, shading.color)); + } + const shdCs = + options.shadingComplexScript === undefined || options.shadingComplexScript === true ? shading : options.shadingComplexScript; + if (shdCs) { + this.push(new ShadowComplexScript(shdCs.type, shdCs.fill, shdCs.color)); + } } public push(item: XmlComponent): void { diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index 32904327d8..40cc7055cd 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -116,7 +116,7 @@ describe("Run", () => { }); const tree = new Formatter().format(run); expect(tree).to.deep.equal({ - "w:r": [{ "w:rPr": [{ "w:smallCaps": {} }] }], + "w:r": [{ "w:rPr": [{ "w:smallCaps": { _attr: { "w:val": true } } }] }], }); }); }); @@ -128,7 +128,7 @@ describe("Run", () => { }); const tree = new Formatter().format(run); expect(tree).to.deep.equal({ - "w:r": [{ "w:rPr": [{ "w:caps": {} }] }], + "w:r": [{ "w:rPr": [{ "w:caps": { _attr: { "w:val": true } } }] }], }); }); }); diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index 5a26f3352c..8b5fb0ddd3 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -1,69 +1,15 @@ // http://officeopenxml.com/WPtext.php -import { ShadingType } from "file/table"; import { XmlComponent } from "file/xml-components"; import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { FieldInstruction } from "file/table-of-contents/field-instruction"; import { Break } from "./break"; -import { Caps, SmallCaps } from "./caps"; -import { EmphasisMark, EmphasisMarkType } from "./emphasis-mark"; import { Begin, End, Separate } from "./field"; -import { - Bold, - BoldComplexScript, - Color, - DoubleStrike, - Highlight, - HighlightComplexScript, - Italics, - ItalicsComplexScript, - RightToLeft, - Shading, - ShadowComplexScript, - Size, - SizeComplexScript, - Strike, -} from "./formatting"; import { NumberOfPages, NumberOfPagesSection, Page } from "./page-number"; -import { RunProperties } from "./properties"; +import { IRunPropertiesOptions, RunProperties } from "./properties"; import { Text } from "./run-components/text"; -import { IFontAttributesProperties, RunFonts } from "./run-fonts"; -import { SubScript, SuperScript } from "./script"; -import { Style } from "./style"; -import { Underline, UnderlineType } from "./underline"; -interface IFontOptions { - readonly name: string; - readonly hint?: string; -} - -export interface IRunOptions { - readonly bold?: true; - readonly italics?: true; - readonly underline?: { - readonly color?: string; - readonly type?: UnderlineType; - }; - readonly emphasisMark?: { - readonly type?: EmphasisMarkType; - }; - readonly color?: string; - readonly size?: number; - readonly rightToLeft?: boolean; - readonly smallCaps?: boolean; - readonly allCaps?: boolean; - readonly strike?: boolean; - readonly doubleStrike?: boolean; - readonly subScript?: boolean; - readonly superScript?: boolean; - readonly style?: string; - readonly font?: IFontOptions | IFontAttributesProperties; - readonly highlight?: string; - readonly shading?: { - readonly type: ShadingType; - readonly fill: string; - readonly color: string; - }; +export interface IRunOptions extends IRunPropertiesOptions { readonly children?: Array; readonly text?: string; } @@ -79,86 +25,9 @@ export class Run extends XmlComponent { constructor(options: IRunOptions) { super("w:r"); - this.properties = new RunProperties(); + this.properties = new RunProperties(options); this.root.push(this.properties); - if (options.bold) { - this.properties.push(new Bold()); - this.properties.push(new BoldComplexScript()); - } - - if (options.italics) { - this.properties.push(new Italics()); - this.properties.push(new ItalicsComplexScript()); - } - - if (options.underline) { - this.properties.push(new Underline(options.underline.type, options.underline.color)); - } - - if (options.emphasisMark) { - this.properties.push(new EmphasisMark(options.emphasisMark.type)); - } - - if (options.color) { - this.properties.push(new Color(options.color)); - } - - if (options.size) { - this.properties.push(new Size(options.size)); - this.properties.push(new SizeComplexScript(options.size)); - } - - if (options.rightToLeft) { - this.properties.push(new RightToLeft()); - } - - if (options.smallCaps) { - this.properties.push(new SmallCaps()); - } - - if (options.allCaps) { - this.properties.push(new Caps()); - } - - if (options.strike) { - this.properties.push(new Strike()); - } - - if (options.doubleStrike) { - this.properties.push(new DoubleStrike()); - } - - if (options.subScript) { - this.properties.push(new SubScript()); - } - - if (options.superScript) { - this.properties.push(new SuperScript()); - } - - if (options.style) { - this.properties.push(new Style(options.style)); - } - - if (options.font) { - if ("name" in options.font) { - this.properties.push(new RunFonts(options.font.name, options.font.hint)); - } else { - this.properties.push(new RunFonts(options.font)); - } - } - - if (options.highlight) { - this.properties.push(new Highlight(options.highlight)); - this.properties.push(new HighlightComplexScript(options.highlight)); - } - - if (options.shading) { - this.properties.push(new Shading(options.shading.type, options.shading.fill, options.shading.color)); - this.properties.push(new ShadowComplexScript(options.shading.type, options.shading.fill, options.shading.color)); - } - if (options.children) { for (const child of options.children) { if (typeof child === "string") { diff --git a/src/file/styles/defaults/index.ts b/src/file/styles/defaults/index.ts index 2b6c49e299..1f97bb2b07 100644 --- a/src/file/styles/defaults/index.ts +++ b/src/file/styles/defaults/index.ts @@ -1,15 +1,24 @@ +import { IParagraphStylePropertiesOptions } from "file/paragraph/properties"; +import { IRunStylePropertiesOptions } from "file/paragraph/run/properties"; import { XmlComponent } from "file/xml-components"; import { ParagraphPropertiesDefaults } from "./paragraph-properties"; import { RunPropertiesDefaults } from "./run-properties"; +export interface IDocumentDefaultsOptions { + readonly paragraph?: IParagraphStylePropertiesOptions; + readonly run?: IRunStylePropertiesOptions; +} + export class DocumentDefaults extends XmlComponent { private readonly runPropertiesDefaults: RunPropertiesDefaults; private readonly paragraphPropertiesDefaults: ParagraphPropertiesDefaults; - constructor() { + constructor(options?: IDocumentDefaultsOptions) { super("w:docDefaults"); - this.runPropertiesDefaults = new RunPropertiesDefaults(); - this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(); + + this.runPropertiesDefaults = new RunPropertiesDefaults(options && options.run); + this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(options && options.paragraph); + this.root.push(this.runPropertiesDefaults); this.root.push(this.paragraphPropertiesDefaults); } diff --git a/src/file/styles/defaults/paragraph-properties.ts b/src/file/styles/defaults/paragraph-properties.ts index c5f2bee86c..cac92575a4 100644 --- a/src/file/styles/defaults/paragraph-properties.ts +++ b/src/file/styles/defaults/paragraph-properties.ts @@ -1,9 +1,9 @@ -import { ParagraphProperties } from "file/paragraph/properties"; +import { IParagraphStylePropertiesOptions, ParagraphProperties } from "file/paragraph/properties"; import { XmlComponent } from "file/xml-components"; export class ParagraphPropertiesDefaults extends XmlComponent { - constructor() { + constructor(options?: IParagraphStylePropertiesOptions) { super("w:pPrDefault"); - this.root.push(new ParagraphProperties({})); + this.root.push(new ParagraphProperties(options)); } } diff --git a/src/file/styles/defaults/run-properties.ts b/src/file/styles/defaults/run-properties.ts index 2228f84de6..7852306faa 100644 --- a/src/file/styles/defaults/run-properties.ts +++ b/src/file/styles/defaults/run-properties.ts @@ -1,14 +1,14 @@ import { Size, SizeComplexScript } from "file/paragraph/run/formatting"; -import { RunProperties } from "file/paragraph/run/properties"; +import { IRunStylePropertiesOptions, RunProperties } from "file/paragraph/run/properties"; import { IFontAttributesProperties, RunFonts } from "file/paragraph/run/run-fonts"; import { XmlComponent } from "file/xml-components"; export class RunPropertiesDefaults extends XmlComponent { private readonly properties: RunProperties; - constructor() { + constructor(options?: IRunStylePropertiesOptions) { super("w:rPrDefault"); - this.properties = new RunProperties(); + this.properties = new RunProperties(options); this.root.push(this.properties); } diff --git a/src/file/styles/index.ts b/src/file/styles/index.ts index 01ddf2d84e..e18813fbb8 100644 --- a/src/file/styles/index.ts +++ b/src/file/styles/index.ts @@ -1,4 +1,4 @@ export * from "./styles"; export * from "./style/character-style"; export * from "./style/paragraph-style"; -export * from "./style-options"; +export * from "./defaults"; diff --git a/src/file/styles/style-options.ts b/src/file/styles/style-options.ts deleted file mode 100644 index 8ce1e6460b..0000000000 --- a/src/file/styles/style-options.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { - AlignmentType, - EmphasisMarkType, - IFontAttributesProperties, - IIndentAttributesProperties, - ISpacingProperties, - UnderlineType, -} from "../paragraph"; -import { ShadingType } from "../table"; - -export interface IRunStyleOptions { - readonly size?: number; - readonly bold?: boolean; - readonly italics?: boolean; - readonly smallCaps?: boolean; - readonly allCaps?: boolean; - readonly strike?: boolean; - readonly doubleStrike?: boolean; - readonly subScript?: boolean; - readonly superScript?: boolean; - readonly underline?: { - readonly type?: UnderlineType; - readonly color?: string; - }; - readonly emphasisMark?: { - readonly type?: EmphasisMarkType; - }; - readonly color?: string; - readonly font?: string | IFontAttributesProperties; - readonly characterSpacing?: number; - readonly highlight?: string; - readonly shadow?: { - readonly type: ShadingType; - readonly fill: string; - readonly color: string; - }; -} - -export interface IParagraphStyleOptions2 { - readonly alignment?: AlignmentType; - readonly thematicBreak?: boolean; - readonly contextualSpacing?: boolean; - readonly rightTabStop?: number; - readonly leftTabStop?: number; - readonly indent?: IIndentAttributesProperties; - readonly spacing?: ISpacingProperties; - readonly keepNext?: boolean; - readonly keepLines?: boolean; - readonly outlineLevel?: number; -} - -// Needed because of: https://github.com/s-panferov/awesome-typescript-loader/issues/432 -/** - * @ignore - */ -export const WORKAROUND4 = ""; diff --git a/src/file/styles/style/character-style.spec.ts b/src/file/styles/style/character-style.spec.ts index 64c866a8c8..70d52c802b 100644 --- a/src/file/styles/style/character-style.spec.ts +++ b/src/file/styles/style/character-style.spec.ts @@ -582,6 +582,7 @@ describe("CharacterStyle", () => { id: "myStyleId", run: { bold: true, + boldComplexScript: false, }, }); const tree = new Formatter().format(style); @@ -610,6 +611,7 @@ describe("CharacterStyle", () => { id: "myStyleId", run: { italics: true, + italicsComplexScript: false, }, }); const tree = new Formatter().format(style); @@ -678,6 +680,7 @@ describe("CharacterStyle", () => { id: "myStyleId", run: { highlight: "005599", + highlightComplexScript: false, }, }); const tree = new Formatter().format(style); @@ -710,6 +713,7 @@ describe("CharacterStyle", () => { fill: "00FFFF", color: "FF0000", }, + shadingComplexScript: false, }, }); const tree = new Formatter().format(style); diff --git a/src/file/styles/style/character-style.ts b/src/file/styles/style/character-style.ts index f0d6c24639..0191a0460e 100644 --- a/src/file/styles/style/character-style.ts +++ b/src/file/styles/style/character-style.ts @@ -1,8 +1,4 @@ -import { EmphasisMarkType } from "file/paragraph/run/emphasis-mark"; -import * as formatting from "file/paragraph/run/formatting"; -import { RunProperties } from "file/paragraph/run/properties"; -import { IFontAttributesProperties } from "file/paragraph/run/run-fonts"; -import { UnderlineType } from "file/paragraph/run/underline"; +import { IRunStylePropertiesOptions, RunProperties } from "file/paragraph/run/properties"; import { BasedOn, Link, SemiHidden, UiPriority, UnhideWhenUsed } from "./components"; import { Style } from "./style"; @@ -11,33 +7,7 @@ export interface IBaseCharacterStyleOptions { readonly basedOn?: string; readonly link?: string; readonly semiHidden?: boolean; - readonly run?: { - readonly size?: number; - readonly bold?: boolean; - readonly italics?: boolean; - readonly smallCaps?: boolean; - readonly allCaps?: boolean; - readonly strike?: boolean; - readonly doubleStrike?: boolean; - readonly subScript?: boolean; - readonly superScript?: boolean; - readonly underline?: { - readonly type?: UnderlineType; - readonly color?: string; - }; - readonly emphasisMark?: { - readonly type?: EmphasisMarkType; - }; - readonly color?: string; - readonly font?: string | IFontAttributesProperties; - readonly characterSpacing?: number; - readonly highlight?: string; - readonly shadow?: { - readonly type: string; - readonly fill: string; - readonly color: string; - }; - }; + readonly run?: IRunStylePropertiesOptions; } export interface ICharacterStyleOptions extends IBaseCharacterStyleOptions { @@ -50,7 +20,9 @@ export class CharacterStyle extends Style { constructor(options: ICharacterStyleOptions) { super({ type: "character", styleId: options.id }, options.name); - this.runProperties = new RunProperties(); + + this.runProperties = new RunProperties(options.run); + this.root.push(this.runProperties); this.root.push(new UiPriority(99)); this.root.push(new UnhideWhenUsed()); @@ -66,72 +38,5 @@ export class CharacterStyle extends Style { if (options.semiHidden) { this.root.push(new SemiHidden()); } - - if (options.run) { - if (options.run.size) { - this.runProperties.push(new formatting.Size(options.run.size)); - this.runProperties.push(new formatting.SizeComplexScript(options.run.size)); - } - - if (options.run.bold) { - this.runProperties.push(new formatting.Bold()); - } - - if (options.run.italics) { - this.runProperties.push(new formatting.Italics()); - } - - if (options.run.smallCaps) { - this.runProperties.push(new formatting.SmallCaps()); - } - - if (options.run.allCaps) { - this.runProperties.push(new formatting.Caps()); - } - - if (options.run.strike) { - this.runProperties.push(new formatting.Strike()); - } - - if (options.run.doubleStrike) { - this.runProperties.push(new formatting.DoubleStrike()); - } - - if (options.run.subScript) { - this.runProperties.push(new formatting.SubScript()); - } - - if (options.run.superScript) { - this.runProperties.push(new formatting.SuperScript()); - } - - if (options.run.underline) { - this.runProperties.push(new formatting.Underline(options.run.underline.type, options.run.underline.color)); - } - - if (options.run.emphasisMark) { - this.runProperties.push(new formatting.EmphasisMark(options.run.emphasisMark.type)); - } - - if (options.run.color) { - this.runProperties.push(new formatting.Color(options.run.color)); - } - - if (options.run.font) { - this.runProperties.push(new formatting.RunFonts(options.run.font)); - } - - if (options.run.characterSpacing) { - this.runProperties.push(new formatting.CharacterSpacing(options.run.characterSpacing)); - } - - if (options.run.highlight) { - this.runProperties.push(new formatting.Highlight(options.run.highlight)); - } - - if (options.run.shadow) { - this.runProperties.push(new formatting.Shading(options.run.shadow.type, options.run.shadow.fill, options.run.shadow.color)); - } - } } } diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index 7d01ef87e7..79e4f20cc7 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -548,6 +548,7 @@ describe("ParagraphStyle", () => { id: "myStyleId", run: { bold: true, + boldComplexScript: false, }, }); const tree = new Formatter().format(style); @@ -566,6 +567,7 @@ describe("ParagraphStyle", () => { id: "myStyleId", run: { italics: true, + italicsComplexScript: false, }, }); const tree = new Formatter().format(style); @@ -584,6 +586,7 @@ describe("ParagraphStyle", () => { id: "myStyleId", run: { highlight: "005599", + highlightComplexScript: false, }, }); const tree = new Formatter().format(style); @@ -606,6 +609,7 @@ describe("ParagraphStyle", () => { fill: "00FFFF", color: "FF0000", }, + shadingComplexScript: false, }, }); const tree = new Formatter().format(style); diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index 0a53c9251a..635e7b7e2f 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -1,19 +1,6 @@ -import { - Alignment, - ContextualSpacing, - Indent, - KeepLines, - KeepNext, - OutlineLevel, - ParagraphProperties, - Spacing, - ThematicBreak, -} from "file/paragraph"; -import { TabStop, TabStopType } from "file/paragraph/formatting"; -import * as formatting from "file/paragraph/run/formatting"; +import { IParagraphStylePropertiesOptions, IRunStylePropertiesOptions, ParagraphProperties } from "file/paragraph"; import { RunProperties } from "file/paragraph/run/properties"; -import { IParagraphStyleOptions2, IRunStyleOptions } from "../style-options"; import { BasedOn, Link, Next, QuickFormat, SemiHidden, UiPriority, UnhideWhenUsed } from "./components"; import { Style } from "./style"; @@ -25,22 +12,25 @@ export interface IBaseParagraphStyleOptions { readonly semiHidden?: boolean; readonly uiPriority?: number; readonly unhideWhenUsed?: boolean; - readonly run?: IRunStyleOptions; - readonly paragraph?: IParagraphStyleOptions2; + readonly paragraph?: IParagraphStylePropertiesOptions; + readonly run?: IRunStylePropertiesOptions; } export interface IParagraphStyleOptions extends IBaseParagraphStyleOptions { readonly id: string; readonly name?: string; } + export class ParagraphStyle extends Style { private readonly paragraphProperties: ParagraphProperties; private readonly runProperties: RunProperties; constructor(options: IParagraphStyleOptions) { super({ type: "paragraph", styleId: options.id }, options.name); - this.paragraphProperties = new ParagraphProperties({}); - this.runProperties = new RunProperties(); + + this.paragraphProperties = new ParagraphProperties(options.paragraph); + this.runProperties = new RunProperties(options.run); + this.root.push(this.paragraphProperties); this.root.push(this.runProperties); @@ -71,114 +61,5 @@ export class ParagraphStyle extends Style { if (options.unhideWhenUsed) { this.root.push(new UnhideWhenUsed()); } - - if (options.run) { - if (options.run.size) { - this.runProperties.push(new formatting.Size(options.run.size)); - this.runProperties.push(new formatting.SizeComplexScript(options.run.size)); - } - - if (options.run.bold) { - this.runProperties.push(new formatting.Bold()); - } - - if (options.run.italics) { - this.runProperties.push(new formatting.Italics()); - } - - if (options.run.smallCaps) { - this.runProperties.push(new formatting.SmallCaps()); - } - - if (options.run.allCaps) { - this.runProperties.push(new formatting.Caps()); - } - - if (options.run.strike) { - this.runProperties.push(new formatting.Strike()); - } - - if (options.run.doubleStrike) { - this.runProperties.push(new formatting.DoubleStrike()); - } - - if (options.run.subScript) { - this.runProperties.push(new formatting.SubScript()); - } - - if (options.run.superScript) { - this.runProperties.push(new formatting.SuperScript()); - } - - if (options.run.underline) { - this.runProperties.push(new formatting.Underline(options.run.underline.type, options.run.underline.color)); - } - - if (options.run.emphasisMark) { - this.runProperties.push(new formatting.EmphasisMark(options.run.emphasisMark.type)); - } - - if (options.run.color) { - this.runProperties.push(new formatting.Color(options.run.color)); - } - - if (options.run.font) { - this.runProperties.push(new formatting.RunFonts(options.run.font)); - } - - if (options.run.characterSpacing) { - this.runProperties.push(new formatting.CharacterSpacing(options.run.characterSpacing)); - } - - if (options.run.highlight) { - this.runProperties.push(new formatting.Highlight(options.run.highlight)); - } - - if (options.run.shadow) { - this.runProperties.push(new formatting.Shading(options.run.shadow.type, options.run.shadow.fill, options.run.shadow.color)); - } - } - - if (options.paragraph) { - if (options.paragraph.alignment) { - this.paragraphProperties.push(new Alignment(options.paragraph.alignment)); - } - - if (options.paragraph.thematicBreak) { - this.paragraphProperties.push(new ThematicBreak()); - } - - if (options.paragraph.contextualSpacing) { - this.paragraphProperties.push(new ContextualSpacing(options.paragraph.contextualSpacing)); - } - - if (options.paragraph.rightTabStop) { - this.paragraphProperties.push(new TabStop(TabStopType.RIGHT, options.paragraph.rightTabStop)); - } - - if (options.paragraph.leftTabStop) { - this.paragraphProperties.push(new TabStop(TabStopType.LEFT, options.paragraph.leftTabStop)); - } - - if (options.paragraph.indent) { - this.paragraphProperties.push(new Indent(options.paragraph.indent)); - } - - if (options.paragraph.spacing) { - this.paragraphProperties.push(new Spacing(options.paragraph.spacing)); - } - - if (options.paragraph.keepNext) { - this.paragraphProperties.push(new KeepNext()); - } - - if (options.paragraph.keepLines) { - this.paragraphProperties.push(new KeepLines()); - } - - if (options.paragraph.outlineLevel) { - this.paragraphProperties.push(new OutlineLevel(options.paragraph.outlineLevel)); - } - } } } From 75a03f157679411bf9ccfc7a4506f55b8283d203 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Wed, 15 Jul 2020 12:46:46 +0800 Subject: [PATCH 084/147] :test: update test for complex script --- src/file/numbering/abstract-numbering.spec.ts | 274 +++++++++---- src/file/styles/style/character-style.spec.ts | 379 ++++++++++++------ src/file/styles/style/paragraph-style.spec.ts | 274 ++++++++----- 3 files changed, 626 insertions(+), 301 deletions(-) diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index 36173364c0..49eae73577 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -283,23 +283,41 @@ describe("AbstractNumbering", () => { }); describe("formatting methods: run properties", () => { - it("#size", () => { - const abstractNumbering = new AbstractNumbering(1, [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - size: 24, - sizeComplexScript: false, + const sizeTests = [ + { + size: 24, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: true, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: false, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: 26, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 26 } } }], + }, + ]; + sizeTests.forEach(({ size, sizeComplexScript, expected }) => { + it(`#size ${size} cs ${sizeComplexScript}`, () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { size, sizeComplexScript }, }, }, - }, - ]); - const tree = new Formatter().format(abstractNumbering); - expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ - "w:rPr": [{ "w:sz": { _attr: { "w:val": 24 } } }], + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": expected }); }); }); @@ -479,87 +497,185 @@ describe("AbstractNumbering", () => { }); }); - it("#bold", () => { - const abstractNumbering = new AbstractNumbering(1, [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - bold: true, - boldComplexScript: false, + const boldTests = [ + { + bold: true, + expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }], + }, + { + bold: true, + boldComplexScript: true, + expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }], + }, + { + bold: true, + boldComplexScript: false, + expected: [{ "w:b": { _attr: { "w:val": true } } }], + }, + ]; + boldTests.forEach(({ bold, boldComplexScript, expected }) => { + it(`#bold ${bold} cs ${boldComplexScript}`, () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { bold, boldComplexScript }, }, }, - }, - ]); - const tree = new Formatter().format(abstractNumbering); - expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ - "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }], + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": expected }); }); }); - it("#italics", () => { - const abstractNumbering = new AbstractNumbering(1, [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - italics: true, - italicsComplexScript: false, + const italicsTests = [ + { + italics: true, + expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }], + }, + { + italics: true, + italicsComplexScript: true, + expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }], + }, + { + italics: true, + italicsComplexScript: false, + expected: [{ "w:i": { _attr: { "w:val": true } } }], + }, + ]; + italicsTests.forEach(({ italics, italicsComplexScript, expected }) => { + it(`#italics ${italics} cs ${italicsComplexScript}`, () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { italics, italicsComplexScript }, }, }, - }, - ]); - const tree = new Formatter().format(abstractNumbering); - expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ - "w:rPr": [{ "w:i": { _attr: { "w:val": true } } }], + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": expected }); }); }); - it("#highlight", () => { - const abstractNumbering = new AbstractNumbering(1, [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - highlight: "005599", - highlightComplexScript: false, + const highlightTests = [ + { + highlight: "005599", + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: true, + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: false, + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: "550099", + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "550099" } } }], + }, + ]; + highlightTests.forEach(({ highlight, highlightComplexScript, expected }) => { + it(`#highlight ${highlight} cs ${highlightComplexScript}`, () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { highlight, highlightComplexScript }, }, }, - }, - ]); - const tree = new Formatter().format(abstractNumbering); - expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ - "w:rPr": [{ "w:highlight": { _attr: { "w:val": "005599" } } }], + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": expected }); }); }); - it("#shadow", () => { - const abstractNumbering = new AbstractNumbering(1, [ - { - level: 0, - format: "lowerRoman", - text: "%0.", - style: { - run: { - shadow: { - type: ShadingType.PERCENT_10, - fill: "00FFFF", - color: "FF0000", - }, - shadingComplexScript: false, + const shadingTests = [ + { + shadow: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: true, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: false, + expected: [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "00FF00", + }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "00FF00" } } }, + ], + }, + ]; + shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => { + it("#shadow correctly", () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 0, + format: "lowerRoman", + text: "%0.", + style: { + run: { shadow, shading, shadingComplexScript }, }, }, - }, - ]); - const tree = new Formatter().format(abstractNumbering); - expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ - "w:rPr": [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:rPr": expected }); }); }); diff --git a/src/file/styles/style/character-style.spec.ts b/src/file/styles/style/character-style.spec.ts index 70d52c802b..2fddce1c1b 100644 --- a/src/file/styles/style/character-style.spec.ts +++ b/src/file/styles/style/character-style.spec.ts @@ -334,31 +334,52 @@ describe("CharacterStyle", () => { }); describe("formatting methods: run properties", () => { - it("#size", () => { - const style = new CharacterStyle({ - id: "myStyleId", - run: { - size: 24, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], - }, - { - "w:uiPriority": { - _attr: { - "w:val": 99, + const sizeTests = [ + { + size: 24, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: true, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: false, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: 26, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 26 } } }], + }, + ]; + sizeTests.forEach(({ size, sizeComplexScript, expected }) => { + it(`#size ${size} cs ${sizeComplexScript}`, () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { size, sizeComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": expected, + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, + }, }, }, - }, - { - "w:unhideWhenUsed": EMPTY_OBJECT, - }, - ], + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); }); }); @@ -577,61 +598,91 @@ describe("CharacterStyle", () => { }); }); - it("#bold", () => { - const style = new CharacterStyle({ - id: "myStyleId", - run: { - bold: true, - boldComplexScript: false, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }], - }, - { - "w:uiPriority": { - _attr: { - "w:val": 99, + const boldTests = [ + { + bold: true, + expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }], + }, + { + bold: true, + boldComplexScript: true, + expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }], + }, + { + bold: true, + boldComplexScript: false, + expected: [{ "w:b": { _attr: { "w:val": true } } }], + }, + ]; + boldTests.forEach(({ bold, boldComplexScript, expected }) => { + it(`#bold ${bold} cs ${boldComplexScript}`, () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { bold, boldComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": expected, + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, + }, }, }, - }, - { - "w:unhideWhenUsed": EMPTY_OBJECT, - }, - ], + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); }); }); - it("#italics", () => { - const style = new CharacterStyle({ - id: "myStyleId", - run: { - italics: true, - italicsComplexScript: false, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:i": { _attr: { "w:val": true } } }], - }, - { - "w:uiPriority": { - _attr: { - "w:val": 99, + const italicsTests = [ + { + italics: true, + expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }], + }, + { + italics: true, + italicsComplexScript: true, + expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }], + }, + { + italics: true, + italicsComplexScript: false, + expected: [{ "w:i": { _attr: { "w:val": true } } }], + }, + ]; + italicsTests.forEach(({ italics, italicsComplexScript, expected }) => { + it(`#italics ${italics} cs ${italicsComplexScript}`, () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { italics, italicsComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": expected, + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, + }, }, }, - }, - { - "w:unhideWhenUsed": EMPTY_OBJECT, - }, - ], + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); }); }); @@ -675,75 +726,141 @@ describe("CharacterStyle", () => { }); }); - it("#highlight", () => { - const style = new CharacterStyle({ - id: "myStyleId", - run: { - highlight: "005599", - highlightComplexScript: false, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:highlight": { _attr: { "w:val": "005599" } } }], - }, - { - "w:uiPriority": { - _attr: { - "w:val": 99, + const highlightTests = [ + { + highlight: "005599", + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: true, + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: false, + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: "550099", + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "550099" } } }], + }, + ]; + highlightTests.forEach(({ highlight, highlightComplexScript, expected }) => { + it(`#highlight ${highlight} cs ${highlightComplexScript}`, () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { highlight, highlightComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": expected, + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, + }, }, }, - }, - { - "w:unhideWhenUsed": EMPTY_OBJECT, - }, - ], + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); }); }); - it("#shadow", () => { - const style = new CharacterStyle({ - id: "myStyleId", - run: { - shadow: { - type: ShadingType.PERCENT_10, - fill: "00FFFF", - color: "FF0000", - }, - shadingComplexScript: false, + const shadingTests = [ + { + shadow: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, - { - "w:rPr": [ - { - "w:shd": { - _attr: { - "w:val": "pct10", - "w:fill": "00FFFF", - "w:color": "FF0000", - }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: true, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: false, + expected: [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "00FF00", + }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "00FF00" } } }, + ], + }, + ]; + shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => { + it("#shadow correctly", () => { + const style = new CharacterStyle({ + id: "myStyleId", + run: { shadow, shading, shadingComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "character", "w:styleId": "myStyleId" } }, + { + "w:rPr": expected, + }, + { + "w:uiPriority": { + _attr: { + "w:val": 99, }, }, - ], - }, - { - "w:uiPriority": { - _attr: { - "w:val": 99, - }, }, - }, - { - "w:unhideWhenUsed": EMPTY_OBJECT, - }, - ], + { + "w:unhideWhenUsed": EMPTY_OBJECT, + }, + ], + }); }); }); }); diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index 79e4f20cc7..92b798f862 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -358,21 +358,37 @@ describe("ParagraphStyle", () => { }); describe("formatting methods: run properties", () => { - it("#size", () => { - const style = new ParagraphStyle({ - id: "myStyleId", - run: { - size: 24, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], - }, - ], + const sizeTests = [ + { + size: 24, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: true, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: false, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }], + }, + { + size: 24, + sizeComplexScript: 26, + expected: [{ "w:sz": { _attr: { "w:val": 24 } } }, { "w:szCs": { _attr: { "w:val": 26 } } }], + }, + ]; + sizeTests.forEach(({ size, sizeComplexScript, expected }) => { + it(`#size ${size} cs ${sizeComplexScript}`, () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { size, sizeComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:rPr": expected }], + }); }); }); @@ -543,93 +559,169 @@ describe("ParagraphStyle", () => { }); }); - it("#bold", () => { - const style = new ParagraphStyle({ - id: "myStyleId", - run: { - bold: true, - boldComplexScript: false, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }], - }, - ], + const boldTests = [ + { + bold: true, + expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }], + }, + { + bold: true, + boldComplexScript: true, + expected: [{ "w:b": { _attr: { "w:val": true } } }, { "w:bCs": { _attr: { "w:val": true } } }], + }, + { + bold: true, + boldComplexScript: false, + expected: [{ "w:b": { _attr: { "w:val": true } } }], + }, + ]; + boldTests.forEach(({ bold, boldComplexScript, expected }) => { + it(`#bold ${bold} cs ${boldComplexScript}`, () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { bold, boldComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:rPr": expected }], + }); }); }); - it("#italics", () => { - const style = new ParagraphStyle({ - id: "myStyleId", - run: { - italics: true, - italicsComplexScript: false, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:i": { _attr: { "w:val": true } } }], - }, - ], + const italicsTests = [ + { + italics: true, + expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }], + }, + { + italics: true, + italicsComplexScript: true, + expected: [{ "w:i": { _attr: { "w:val": true } } }, { "w:iCs": { _attr: { "w:val": true } } }], + }, + { + italics: true, + italicsComplexScript: false, + expected: [{ "w:i": { _attr: { "w:val": true } } }], + }, + ]; + italicsTests.forEach(({ italics, italicsComplexScript, expected }) => { + it(`#italics ${italics} cs ${italicsComplexScript}`, () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { italics, italicsComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:rPr": expected }], + }); }); }); - it("#highlight", () => { - const style = new ParagraphStyle({ - id: "myStyleId", - run: { - highlight: "005599", - highlightComplexScript: false, - }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, - { - "w:rPr": [{ "w:highlight": { _attr: { "w:val": "005599" } } }], - }, - ], + const highlightTests = [ + { + highlight: "005599", + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: true, + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: false, + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }], + }, + { + highlight: "005599", + highlightComplexScript: "550099", + expected: [{ "w:highlight": { _attr: { "w:val": "005599" } } }, { "w:highlightCs": { _attr: { "w:val": "550099" } } }], + }, + ]; + highlightTests.forEach(({ highlight, highlightComplexScript, expected }) => { + it(`#highlight ${highlight} cs ${highlightComplexScript}`, () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { highlight, highlightComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:rPr": expected }], + }); }); }); - it("#shadow", () => { - const style = new ParagraphStyle({ - id: "myStyleId", - run: { - shadow: { - type: ShadingType.PERCENT_10, - fill: "00FFFF", - color: "FF0000", - }, - shadingComplexScript: false, + const shadingTests = [ + { + shadow: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", }, - }); - const tree = new Formatter().format(style); - expect(tree).to.deep.equal({ - "w:style": [ - { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, - { - "w:rPr": [ - { - "w:shd": { - _attr: { - "w:val": "pct10", - "w:fill": "00FFFF", - "w:color": "FF0000", - }, - }, - }, - ], - }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: true, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + ], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: false, + expected: [{ "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }], + }, + { + shading: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "FF0000", + }, + shadingComplexScript: { + type: ShadingType.PERCENT_10, + fill: "00FFFF", + color: "00FF00", + }, + expected: [ + { "w:shd": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "FF0000" } } }, + { "w:shdCs": { _attr: { "w:val": "pct10", "w:fill": "00FFFF", "w:color": "00FF00" } } }, + ], + }, + ]; + shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => { + it("#shadow correctly", () => { + const style = new ParagraphStyle({ + id: "myStyleId", + run: { shadow, shading, shadingComplexScript }, + }); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, { "w:rPr": expected }], + }); }); }); From 36e1c5fe6a72d8b4d41e07923201f70970a1137d Mon Sep 17 00:00:00 2001 From: wangfengming Date: Wed, 15 Jul 2020 14:10:37 +0800 Subject: [PATCH 085/147] :feat: refined defaults --- src/file/styles/defaults/document-defaults.ts | 25 +++++++++++++++++ src/file/styles/defaults/index.ts | 28 ++----------------- src/file/styles/defaults/run-properties.ts | 13 --------- 3 files changed, 28 insertions(+), 38 deletions(-) create mode 100644 src/file/styles/defaults/document-defaults.ts diff --git a/src/file/styles/defaults/document-defaults.ts b/src/file/styles/defaults/document-defaults.ts new file mode 100644 index 0000000000..1f97bb2b07 --- /dev/null +++ b/src/file/styles/defaults/document-defaults.ts @@ -0,0 +1,25 @@ +import { IParagraphStylePropertiesOptions } from "file/paragraph/properties"; +import { IRunStylePropertiesOptions } from "file/paragraph/run/properties"; +import { XmlComponent } from "file/xml-components"; +import { ParagraphPropertiesDefaults } from "./paragraph-properties"; +import { RunPropertiesDefaults } from "./run-properties"; + +export interface IDocumentDefaultsOptions { + readonly paragraph?: IParagraphStylePropertiesOptions; + readonly run?: IRunStylePropertiesOptions; +} + +export class DocumentDefaults extends XmlComponent { + private readonly runPropertiesDefaults: RunPropertiesDefaults; + private readonly paragraphPropertiesDefaults: ParagraphPropertiesDefaults; + + constructor(options?: IDocumentDefaultsOptions) { + super("w:docDefaults"); + + this.runPropertiesDefaults = new RunPropertiesDefaults(options && options.run); + this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(options && options.paragraph); + + this.root.push(this.runPropertiesDefaults); + this.root.push(this.paragraphPropertiesDefaults); + } +} diff --git a/src/file/styles/defaults/index.ts b/src/file/styles/defaults/index.ts index 1f97bb2b07..986aa6194d 100644 --- a/src/file/styles/defaults/index.ts +++ b/src/file/styles/defaults/index.ts @@ -1,25 +1,3 @@ -import { IParagraphStylePropertiesOptions } from "file/paragraph/properties"; -import { IRunStylePropertiesOptions } from "file/paragraph/run/properties"; -import { XmlComponent } from "file/xml-components"; -import { ParagraphPropertiesDefaults } from "./paragraph-properties"; -import { RunPropertiesDefaults } from "./run-properties"; - -export interface IDocumentDefaultsOptions { - readonly paragraph?: IParagraphStylePropertiesOptions; - readonly run?: IRunStylePropertiesOptions; -} - -export class DocumentDefaults extends XmlComponent { - private readonly runPropertiesDefaults: RunPropertiesDefaults; - private readonly paragraphPropertiesDefaults: ParagraphPropertiesDefaults; - - constructor(options?: IDocumentDefaultsOptions) { - super("w:docDefaults"); - - this.runPropertiesDefaults = new RunPropertiesDefaults(options && options.run); - this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(options && options.paragraph); - - this.root.push(this.runPropertiesDefaults); - this.root.push(this.paragraphPropertiesDefaults); - } -} +export * from "./paragraph-properties"; +export * from "./run-properties"; +export * from "./document-defaults"; diff --git a/src/file/styles/defaults/run-properties.ts b/src/file/styles/defaults/run-properties.ts index 7852306faa..f4e594ab99 100644 --- a/src/file/styles/defaults/run-properties.ts +++ b/src/file/styles/defaults/run-properties.ts @@ -1,6 +1,4 @@ -import { Size, SizeComplexScript } from "file/paragraph/run/formatting"; import { IRunStylePropertiesOptions, RunProperties } from "file/paragraph/run/properties"; -import { IFontAttributesProperties, RunFonts } from "file/paragraph/run/run-fonts"; import { XmlComponent } from "file/xml-components"; export class RunPropertiesDefaults extends XmlComponent { @@ -11,15 +9,4 @@ export class RunPropertiesDefaults extends XmlComponent { this.properties = new RunProperties(options); this.root.push(this.properties); } - - public size(size: number): RunPropertiesDefaults { - this.properties.push(new Size(size)); - this.properties.push(new SizeComplexScript(size)); - return this; - } - - public font(font: string | IFontAttributesProperties): RunPropertiesDefaults { - this.properties.push(new RunFonts(font)); - return this; - } } From 3f7ca6bbffdffe631ea3348591d04570b20905a4 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Wed, 15 Jul 2020 14:11:26 +0800 Subject: [PATCH 086/147] :test: document defaults & numbering suffix --- src/file/numbering/abstract-numbering.spec.ts | 15 +++++++ .../styles/defaults/document-defaults.spec.ts | 45 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/file/styles/defaults/document-defaults.spec.ts diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index 49eae73577..ef1df0de4c 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -7,6 +7,7 @@ import { AlignmentType, EmphasisMarkType, TabStopPosition } from "../paragraph"; import { UnderlineType } from "../paragraph/run/underline"; import { ShadingType } from "../table"; import { AbstractNumbering } from "./abstract-numbering"; +import { LevelSuffix } from "./level"; describe("AbstractNumbering", () => { it("stores its ID at its .id property", () => { @@ -48,6 +49,20 @@ describe("AbstractNumbering", () => { expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); }); + it("has suffix", () => { + const abstractNumbering = new AbstractNumbering(1, [ + { + level: 3, + format: "lowerLetter", + text: "%1)", + alignment: AlignmentType.END, + suffix: LevelSuffix.SPACE, + }, + ]); + const tree = new Formatter().format(abstractNumbering); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:suff": { _attr: { "w:val": "space" } } }); + }); + describe("formatting methods: paragraph properties", () => { it("#indent", () => { const abstractNumbering = new AbstractNumbering(1, [ diff --git a/src/file/styles/defaults/document-defaults.spec.ts b/src/file/styles/defaults/document-defaults.spec.ts new file mode 100644 index 0000000000..79ca9cccf7 --- /dev/null +++ b/src/file/styles/defaults/document-defaults.spec.ts @@ -0,0 +1,45 @@ +import { expect } from "chai"; + +import { DocumentDefaults } from "./document-defaults"; + +import { Formatter } from "export/formatter"; + +describe("DocumentDefaults", () => { + it("#constructor", () => { + const defaults = new DocumentDefaults({ + paragraph: { spacing: { line: 240 } }, + run: { color: "808080" }, + }); + const tree = new Formatter().format(defaults); + expect(tree).to.deep.equal({ + "w:docDefaults": [ + { + "w:rPrDefault": [ + { + "w:rPr": [ + { + "w:color": { _attr: { "w:val": "808080" } }, + }, + ], + }, + ], + }, + { + "w:pPrDefault": [ + { + "w:pPr": [ + { + "w:spacing": { + _attr: { + "w:line": 240, + }, + }, + }, + ], + }, + ], + }, + ], + }); + }); +}); From 7baa696a763c9133b42b3fd3b842231bfd367860 Mon Sep 17 00:00:00 2001 From: wangfengming Date: Wed, 15 Jul 2020 14:11:59 +0800 Subject: [PATCH 087/147] :feat: coverage ignore file `src/import-dotx/import-dotx.ts` --- .nycrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.nycrc b/.nycrc index 41a461385e..2c14e11a79 100644 --- a/.nycrc +++ b/.nycrc @@ -8,7 +8,8 @@ "src/**/*.ts" ], "exclude": [ - "src/**/*.spec.ts" + "src/**/*.spec.ts", + "src/import-dotx/import-dotx.ts" ], "reporter": [ "lcov", From 445a2896d25f59c89818e14b38cb90db55f764d0 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 16 Jul 2020 12:35:47 +0100 Subject: [PATCH 088/147] Add React example --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index be6eca6898..894cd2c7d2 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ Here is an example of `docx` working in `Angular`: * https://stackblitz.com/edit/angular-afvxtz +Here is an example of `docx` working in `React`: + +* https://stackblitz.com/edit/react-ts-qq25sp + ## Node Press `endpoint` on the `RunKit` website: From 04619075337a9a6caaed5eff5aefa0ba57afc050 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 16 Jul 2020 14:13:55 +0100 Subject: [PATCH 089/147] Add VueJS example --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 894cd2c7d2..5773bff3b7 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ Here is an example of `docx` working in `React`: * https://stackblitz.com/edit/react-ts-qq25sp +Here is an example of `docx` working in `VueJS`: + +* https://stackblitz.com/edit/vuejs-docx + ## Node Press `endpoint` on the `RunKit` website: From 9202524d838fb263e41a68fdd96b4c5bd4ce433f Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 16 Jul 2020 14:15:47 +0100 Subject: [PATCH 090/147] Fix Vue.js stylistics --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5773bff3b7..2c4d10ab3e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Here is an example of `docx` working in `React`: * https://stackblitz.com/edit/react-ts-qq25sp -Here is an example of `docx` working in `VueJS`: +Here is an example of `docx` working in `Vue.js`: * https://stackblitz.com/edit/vuejs-docx From edec2eca7a8e0935e2e8fd300800ba0c105f784e Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 16 Jul 2020 16:08:50 +0100 Subject: [PATCH 091/147] Add another React example --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2c4d10ab3e..c366a1f922 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Here is an example of `docx` working in `Angular`: Here is an example of `docx` working in `React`: * https://stackblitz.com/edit/react-ts-qq25sp +* https://stackblitz.com/edit/react-ts-qdqu7z (adding images to Word Document) Here is an example of `docx` working in `Vue.js`: From 96f08482dacc1f5a575a2b9d52b974aab8306822 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2020 20:24:56 +0000 Subject: [PATCH 092/147] Bump @types/node from 14.0.5 to 14.0.23 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.0.5 to 14.0.23. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 50 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78bcd81aee..06072e7b89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -319,9 +319,9 @@ "dev": true }, "@types/node": { - "version": "14.0.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz", - "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==" + "version": "14.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.23.tgz", + "integrity": "sha512-Z4U8yDAl5TFkmYsZdFPdjeMa57NOvnaf1tljHzhouaPEp7LCj2JKkejpI1ODviIAQuW4CcQmxkQ77rnLsOOoKw==" }, "@types/request": { "version": "2.48.1", @@ -702,7 +702,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +731,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -799,7 +799,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1507,7 +1507,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2586,7 +2586,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4351,7 +4351,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4483,7 +4483,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4812,7 +4812,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5518,7 +5518,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5695,7 +5695,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5766,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7034,7 +7034,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7482,7 +7482,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7586,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8015,7 +8015,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8231,13 +8231,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8257,7 +8257,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8391,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8435,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 437de27ed8d293dab42d9703fcf1e09c8a970cb1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2020 20:25:17 +0000 Subject: [PATCH 093/147] [Security] Bump handlebars from 4.5.3 to 4.7.6 Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.5.3 to 4.7.6. **This update includes a security fix.** - [Release notes](https://github.com/wycats/handlebars.js/releases) - [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md) - [Commits](https://github.com/wycats/handlebars.js/compare/v4.5.3...v4.7.6) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 93 +++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78bcd81aee..d62783f526 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -702,7 +702,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +731,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -799,7 +799,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1507,7 +1507,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2586,7 +2586,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -3573,15 +3573,30 @@ "dev": true }, "handlebars": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", - "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==", + "version": "4.7.6", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", + "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", "dev": true, "requires": { + "minimist": "^1.2.5", "neo-async": "^2.6.0", - "optimist": "^0.6.1", "source-map": "^0.6.1", - "uglify-js": "^3.1.4" + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } } }, "har-schema": { @@ -4351,7 +4366,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4483,7 +4498,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4812,7 +4827,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5474,24 +5489,6 @@ "pinkie-promise": "^2.0.0" } }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - } - } - }, "options": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", @@ -5518,7 +5515,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5695,7 +5692,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5763,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7034,7 +7031,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7482,7 +7479,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7583,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8015,7 +8012,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8231,13 +8228,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8249,15 +8246,9 @@ } } }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8382,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8426,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 1834cd86da738a056ef47f69048d18d24440fc44 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2020 20:25:38 +0000 Subject: [PATCH 094/147] Bump jszip from 3.2.2 to 3.5.0 Bumps [jszip](https://github.com/Stuk/jszip) from 3.2.2 to 3.5.0. - [Release notes](https://github.com/Stuk/jszip/releases) - [Changelog](https://github.com/Stuk/jszip/blob/master/CHANGES.md) - [Commits](https://github.com/Stuk/jszip/compare/v3.2.2...v3.5.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 81 +++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78bcd81aee..59569e5fe1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -702,7 +702,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +731,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -799,7 +799,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1507,7 +1507,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -1612,7 +1612,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cp-file": { "version": "4.2.0", @@ -2586,7 +2587,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -3785,7 +3786,8 @@ "immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", + "dev": true }, "import-lazy": { "version": "2.1.0", @@ -3812,7 +3814,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "ini": { "version": "1.3.5", @@ -4160,7 +4163,8 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isexe": { "version": "2.0.0", @@ -4351,7 +4355,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4416,9 +4420,10 @@ } }, "jszip": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.2.2.tgz", - "integrity": "sha512-NmKajvAFQpbg3taXQXr/ccS2wcucR1AZ+NtyWp2Nq7HHVsXhcJFR8p0Baf32C2yVvBylFWVeKf+WI2AnvlPhpA==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.5.0.tgz", + "integrity": "sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA==", + "dev": true, "requires": { "lie": "~3.3.0", "pako": "~1.0.2", @@ -4466,6 +4471,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, "requires": { "immediate": "~3.0.5" } @@ -4483,7 +4489,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4812,7 +4818,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5518,7 +5524,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5606,7 +5612,8 @@ "pako": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", - "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" + "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==", + "dev": true }, "parent-require": { "version": "1.0.0", @@ -5695,7 +5702,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5773,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -5864,7 +5871,8 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "progress": { "version": "2.0.3", @@ -6042,6 +6050,7 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -6463,7 +6472,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "safe-regex": { "version": "1.1.0", @@ -6572,7 +6582,8 @@ "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true }, "set-value": { "version": "2.0.1", @@ -7028,13 +7039,14 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, "requires": { "safe-buffer": "~5.1.0" } }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7482,7 +7494,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7598,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -7775,7 +7787,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "utile": { "version": "0.3.0", @@ -8015,7 +8028,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8231,13 +8244,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8257,7 +8270,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8404,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8448,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From a8993f14d690b88a6d0b2d6696f3ce47efeb12ac Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2020 20:26:36 +0000 Subject: [PATCH 095/147] Bump @types/mocha from 2.2.48 to 8.0.0 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 2.2.48 to 8.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 50 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78bcd81aee..6445565caa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -313,9 +313,9 @@ "dev": true }, "@types/mocha": { - "version": "2.2.48", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.48.tgz", - "integrity": "sha512-nlK/iyETgafGli8Zh9zJVCTicvU3iajSkRwOh3Hhiva598CMqNJ4NcVCGMTGKpGpTYj/9R8RLzS9NAykSSCqGw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.0.tgz", + "integrity": "sha512-jWeYcTo3sCH/rMgsdYXDTO85GNRyTCII5dayMIu/ZO4zbEot1E3iNGaOwpLReLUHjeNQFkgeNNVYlY4dX6azQQ==", "dev": true }, "@types/node": { @@ -702,7 +702,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +731,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -799,7 +799,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1507,7 +1507,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2586,7 +2586,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4351,7 +4351,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4483,7 +4483,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4812,7 +4812,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5518,7 +5518,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5695,7 +5695,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5766,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7034,7 +7034,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7482,7 +7482,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7586,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8015,7 +8015,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8231,13 +8231,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8257,7 +8257,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8391,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8435,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { diff --git a/package.json b/package.json index d88a3731f6..62e810a418 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "homepage": "https://github.com/dolanmiu/docx#readme", "devDependencies": { "@types/chai": "^3.4.35", - "@types/mocha": "^2.2.39", + "@types/mocha": "^8.0.0", "@types/request-promise": "^4.1.42", "@types/shortid": "0.0.29", "@types/sinon": "^4.3.1", From 25a0212f4eabc6af5c424befb9257a35c9ed147b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 17 Jul 2020 08:41:22 +0000 Subject: [PATCH 096/147] [Security] Bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. **This update includes a security fix.** - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 50 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78bcd81aee..ab2d218959 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -702,7 +702,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +731,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -799,7 +799,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1507,7 +1507,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2586,7 +2586,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4351,7 +4351,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4483,7 +4483,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4530,9 +4530,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "lodash.assign": { @@ -4812,7 +4812,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5518,7 +5518,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5695,7 +5695,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5766,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7034,7 +7034,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7482,7 +7482,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7586,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8015,7 +8015,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8231,13 +8231,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8257,7 +8257,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8391,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8435,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From ab12ff12570c0de4849df8f070e1879332e09378 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 17 Jul 2020 08:42:58 +0000 Subject: [PATCH 097/147] Bump @types/sinon from 4.3.3 to 9.0.4 Bumps [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon) from 4.3.3 to 9.0.4. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 59 +++++++++++++++++++++++++++-------------------- package.json | 2 +- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78bcd81aee..ddd613ca1c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -362,9 +362,18 @@ "dev": true }, "@types/sinon": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.3.3.tgz", - "integrity": "sha512-Tt7w/ylBS/OEAlSCwzB0Db1KbxnkycP/1UkQpbvKFYoUuRn4uYsC3xh5TRPrOjTy0i8TIkSz1JdNL4GPVdf3KQ==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-9.0.4.tgz", + "integrity": "sha512-sJmb32asJZY6Z2u09bl0G2wglSxDlROlAejCjsnor+LzBMz17gu8IU7vKC/vWDnv9zEq2wqADHVXFjf4eE8Gdw==", + "dev": true, + "requires": { + "@types/sinonjs__fake-timers": "*" + } + }, + "@types/sinonjs__fake-timers": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.1.tgz", + "integrity": "sha512-yYezQwGWty8ziyYLdZjwxyMb0CZR49h8JALHGrxjQHWlqGgc8kLdHEgWrgL0uZ29DMvEVBDnHU2Wg36zKSIUtA==", "dev": true }, "@types/tapable": { @@ -702,7 +711,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +740,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -799,7 +808,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1507,7 +1516,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2586,7 +2595,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4351,7 +4360,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4483,7 +4492,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4812,7 +4821,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5518,7 +5527,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5695,7 +5704,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5775,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7034,7 +7043,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7482,7 +7491,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7595,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8015,7 +8024,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8231,13 +8240,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8257,7 +8266,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8400,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8444,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { diff --git a/package.json b/package.json index d88a3731f6..c05703c591 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@types/mocha": "^2.2.39", "@types/request-promise": "^4.1.42", "@types/shortid": "0.0.29", - "@types/sinon": "^4.3.1", + "@types/sinon": "^9.0.4", "@types/webpack": "^4.4.24", "awesome-typescript-loader": "^3.4.1", "chai": "^3.5.0", From e2d60978198e1d3ed7df01613148463612fe563e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 17 Jul 2020 08:43:39 +0000 Subject: [PATCH 098/147] Bump glob from 7.1.4 to 7.1.6 Bumps [glob](https://github.com/isaacs/node-glob) from 7.1.4 to 7.1.6. - [Release notes](https://github.com/isaacs/node-glob/releases) - [Changelog](https://github.com/isaacs/node-glob/blob/master/changelog.md) - [Commits](https://github.com/isaacs/node-glob/compare/v7.1.4...v7.1.6) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 50 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78bcd81aee..064553ba69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.1.1", + "version": "5.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -191,7 +191,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -702,7 +702,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -731,7 +731,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -799,7 +799,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1507,7 +1507,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2586,7 +2586,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -3425,9 +3425,9 @@ } }, "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -4351,7 +4351,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4483,7 +4483,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4812,7 +4812,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5518,7 +5518,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5695,7 +5695,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5766,7 +5766,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7034,7 +7034,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7482,7 +7482,7 @@ }, "typescript": { "version": "2.7.2", - "resolved": "http://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true } @@ -7586,7 +7586,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8015,7 +8015,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8231,13 +8231,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8257,7 +8257,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8391,7 +8391,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8435,7 +8435,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 1e8ca123b0efc52e56ecbf9097ad16379fc6ce7b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2020 08:57:50 +0000 Subject: [PATCH 099/147] Bump request-promise from 4.2.4 to 4.2.6 Bumps [request-promise](https://github.com/request/request-promise) from 4.2.4 to 4.2.6. - [Release notes](https://github.com/request/request-promise/releases) - [Commits](https://github.com/request/request-promise/compare/v4.2.4...v4.2.6) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 53 ++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3c8abe74ab..e04475323c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1026,9 +1026,9 @@ "dev": true }, "bluebird": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz", - "integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==", + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", "dev": true }, "bn.js": { @@ -1621,8 +1621,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cp-file": { "version": "4.2.0", @@ -3810,8 +3809,7 @@ "immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", - "dev": true + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" }, "import-lazy": { "version": "2.1.0", @@ -3838,8 +3836,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "1.3.5", @@ -4187,8 +4184,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -4447,7 +4443,6 @@ "version": "3.5.0", "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.5.0.tgz", "integrity": "sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA==", - "dev": true, "requires": { "lie": "~3.3.0", "pako": "~1.0.2", @@ -4495,7 +4490,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", - "dev": true, "requires": { "immediate": "~3.0.5" } @@ -5618,8 +5612,7 @@ "pako": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", - "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==", - "dev": true + "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" }, "parent-require": { "version": "1.0.0", @@ -5877,8 +5870,7 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "progress": { "version": "2.0.3", @@ -6056,7 +6048,6 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -6351,24 +6342,24 @@ } }, "request-promise": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.4.tgz", - "integrity": "sha512-8wgMrvE546PzbR5WbYxUQogUnUDfM0S7QIFZMID+J73vdFARkFy+HElj4T+MWYhpXwlLp0EQ8Zoj8xUA0he4Vg==", + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.6.tgz", + "integrity": "sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ==", "dev": true, "requires": { "bluebird": "^3.5.0", - "request-promise-core": "1.1.2", + "request-promise-core": "1.1.4", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" } }, "request-promise-core": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", - "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", + "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", "dev": true, "requires": { - "lodash": "^4.17.11" + "lodash": "^4.17.19" } }, "require-directory": { @@ -6478,8 +6469,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-regex": { "version": "1.1.0", @@ -6588,8 +6578,7 @@ "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", - "dev": true + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" }, "set-value": { "version": "2.0.1", @@ -7045,7 +7034,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -7793,8 +7781,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "utile": { "version": "0.3.0", From 84919c0cc07d5301995afba4fee85384320ec71e Mon Sep 17 00:00:00 2001 From: Dolan Date: Mon, 27 Jul 2020 09:56:30 +0100 Subject: [PATCH 100/147] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c366a1f922..9dd52e1a94 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Press `endpoint` on the `RunKit` website: * https://runkit.com/dolanmiu/docx-demo8 - Header and Footer * https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx** -More [here](https://docx.js.org/#/examples) and [here](https://github.com/dolanmiu/docx/tree/master/demo) +More [here](https://github.com/dolanmiu/docx/tree/master/demo) # How to use & Documentation From 901f10c38753b5d8c364f0daf58e23520a34a1cf Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2020 09:10:49 +0000 Subject: [PATCH 101/147] Bump request from 2.88.0 to 2.88.2 Bumps [request](https://github.com/request/request) from 2.88.0 to 2.88.2. - [Release notes](https://github.com/request/request/releases) - [Changelog](https://github.com/request/request/blob/master/CHANGELOG.md) - [Commits](https://github.com/request/request/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 56 ++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index e04475323c..14a6a3d0d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -784,9 +784,9 @@ "dev": true }, "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", + "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==", "dev": true }, "babel-code-frame": { @@ -3625,21 +3625,21 @@ }, "dependencies": { "ajv": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.1.tgz", - "integrity": "sha512-w1YQaVGNC6t2UCPjEawK/vo/dG8OOrVtUmhBT1uJJYxbl5kU2Tj3v6LGqBcsysN1yhuCStJCCA3GqdvKY8sqXQ==", + "version": "6.12.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", + "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", "dev": true, "requires": { - "fast-deep-equal": "^2.0.1", + "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "json-schema-traverse": { @@ -4766,18 +4766,18 @@ "dev": true }, "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", "dev": true }, "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", "dev": true, "requires": { - "mime-db": "1.40.0" + "mime-db": "1.44.0" } }, "mimic-fn": { @@ -6314,9 +6314,9 @@ } }, "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -6326,7 +6326,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.0", + "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", @@ -6336,9 +6336,21 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", + "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" + }, + "dependencies": { + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } } }, "request-promise": { From 5238c55bc243388fc1fbf533279b13b439e245d1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2020 09:10:52 +0000 Subject: [PATCH 102/147] Bump docsify-cli from 4.3.0 to 4.4.1 Bumps [docsify-cli](https://github.com/QingWei-Li/docsify-cli) from 4.3.0 to 4.4.1. - [Release notes](https://github.com/QingWei-Li/docsify-cli/releases) - [Changelog](https://github.com/docsifyjs/docsify-cli/blob/master/CHANGELOG.md) - [Commits](https://github.com/QingWei-Li/docsify-cli/compare/v4.3.0...v4.4.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 1196 +++++++++++++++++++++++++-------------------- 1 file changed, 673 insertions(+), 523 deletions(-) diff --git a/package-lock.json b/package-lock.json index e04475323c..0a07af73f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -172,6 +172,12 @@ } } }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, "@sinonjs/commons": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.4.0.tgz", @@ -215,6 +221,15 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, "@types/anymatch": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz", @@ -474,20 +489,42 @@ } }, "ansi-align": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", - "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", + "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", "dev": true, "requires": { - "string-width": "^2.0.0" + "string-width": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } } }, - "ansi-escapes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", - "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", - "dev": true - }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -750,6 +787,12 @@ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", "dev": true }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -860,17 +903,6 @@ "babel-runtime": "^6.22.0" } }, - "babel-polyfill": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.23.0.tgz", - "integrity": "sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "core-js": "^2.4.0", - "regenerator-runtime": "^0.10.0" - } - }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -1038,25 +1070,52 @@ "dev": true }, "boxen": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", - "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz", + "integrity": "sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A==", "dev": true, "requires": { - "ansi-align": "^2.0.0", - "camelcase": "^4.0.0", - "chalk": "^2.0.1", - "cli-boxes": "^1.0.0", - "string-width": "^2.0.0", + "ansi-align": "^3.0.0", + "camelcase": "^5.3.1", + "chalk": "^2.4.2", + "cli-boxes": "^2.2.0", + "string-width": "^3.0.0", "term-size": "^1.2.0", + "type-fest": "^0.3.0", "widest-line": "^2.0.0" }, "dependencies": { - "camelcase": { + "ansi-regex": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, @@ -1234,6 +1293,38 @@ "unset-value": "^1.0.0" } }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, "caching-transform": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-3.0.2.tgz", @@ -1270,12 +1361,6 @@ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", "dev": true }, - "capture-stack-trace": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", - "integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw==", - "dev": true - }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -1314,12 +1399,6 @@ "supports-color": "^5.3.0" } }, - "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", - "dev": true - }, "chokidar": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", @@ -1358,9 +1437,9 @@ } }, "ci-info": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", - "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, "cipher-base": { @@ -1397,30 +1476,15 @@ } }, "cli-boxes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", - "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", - "dev": true - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-width": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", + "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", "dev": true }, "clipboard": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz", - "integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz", + "integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==", "dev": true, "optional": true, "requires": { @@ -1462,6 +1526,15 @@ } } }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -1551,9 +1624,9 @@ } }, "configstore": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", - "integrity": "sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", + "integrity": "sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ==", "dev": true, "requires": { "dot-prop": "^4.1.0", @@ -1562,6 +1635,23 @@ "unique-string": "^1.0.0", "write-file-atomic": "^2.0.0", "xdg-basedir": "^3.0.0" + }, + "dependencies": { + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } } }, "connect": { @@ -1624,16 +1714,15 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cp-file": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-4.2.0.tgz", - "integrity": "sha1-cVNhZjtx7eC23dvDyA4roC5yXsM=", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-7.0.0.tgz", + "integrity": "sha512-0Cbj7gyvFVApzpK/uhCtQ/9kE9UnYpxMzaq5nQQC/Dh4iaj5fxp7iEFIullrYwzj8nf0qnsI1Qsx34hAeAebvw==", "dev": true, "requires": { "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", + "make-dir": "^3.0.0", "nested-error-stacks": "^2.0.0", - "pify": "^2.3.0", - "safe-buffer": "^5.0.1" + "p-event": "^4.1.0" } }, "create-ecdh": { @@ -1646,15 +1735,6 @@ "elliptic": "^6.0.0" } }, - "create-error-class": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", - "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", - "dev": true, - "requires": { - "capture-stack-trace": "^1.0.0" - } - }, "create-hash": { "version": "1.2.0", "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", @@ -1770,6 +1850,15 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "deep-eql": { "version": "0.1.3", "resolved": "http://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", @@ -1816,6 +1905,12 @@ } } }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -1919,168 +2014,215 @@ } }, "docsify": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/docsify/-/docsify-4.9.4.tgz", - "integrity": "sha512-Xtm6sfrNU7cqOViWMewDhscn0cySF60q2KTKok9OaPmzt6nRkTAIvYU4dj916IT21o/b336Or3vO2hsvmaQzxg==", + "version": "4.11.4", + "resolved": "https://registry.npmjs.org/docsify/-/docsify-4.11.4.tgz", + "integrity": "sha512-Qwt98y6ddM2Wb46gRH/zQpEAvw70AlIpzVlB9Wi2u2T2REg9O+bXMpJ27F5TaRTn2bD6SF1VyZYNUfimpihZwQ==", "dev": true, "requires": { - "marked": "^0.5.1", - "medium-zoom": "^0.4.0", - "opencollective": "^1.0.3", - "prismjs": "^1.15.0", + "dompurify": "^2.0.8", + "marked": "^0.7.0", + "medium-zoom": "^1.0.5", + "opencollective-postinstall": "^2.0.2", + "prismjs": "^1.19.0", + "strip-indent": "^3.0.0", "tinydate": "^1.0.0", "tweezer.js": "^1.4.0" } }, "docsify-cli": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/docsify-cli/-/docsify-cli-4.3.0.tgz", - "integrity": "sha512-88O1sMeoZv4lb5GPSJzDtOAv2KzBjpQaSqVlVqY+6hGJfb2wpz9PvlUhvlgPq54zu4kPDeCCyUYgqa/llhKg3w==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/docsify-cli/-/docsify-cli-4.4.1.tgz", + "integrity": "sha512-M5VU/8UCILz87D519KnURH3LA+A3RAAqj7ifDv4xOUf4c32QDkWSETS3yLmXlTNdxhATVi5P1fVklnvVW4uOyw==", "dev": true, "requires": { - "chalk": "^1.1.3", + "chalk": "^2.4.2", "connect": "^3.6.0", "connect-livereload": "^0.6.0", - "cp-file": "^4.1.1", - "docsify": ">=3", + "cp-file": "^7.0.0", + "docsify": "^4.10.2", "docsify-server-renderer": ">=4", - "fs-extra": "^2.1.2", - "livereload": "^0.7.0", - "lru-cache": "^4.1.1", - "opn": "^5.3.0", + "fs-extra": "^8.1.0", + "get-port": "^5.0.0", + "livereload": "^0.9.1", + "lru-cache": "^5.1.1", + "open": "^6.4.0", "serve-static": "^1.12.1", - "update-notifier": "^2.1.0", - "y18n": "^3.2.1", + "update-notifier": "^3.0.1", "yargonaut": "^1.1.2", - "yargs": "^7.0.2" + "yargs": "^14.2.0" }, "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" } }, "fs-extra": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz", - "integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0" + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" } }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "yallist": "^3.0.2" } }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "opn": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/opn/-/opn-5.5.0.tgz", - "integrity": "sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA==", - "dev": true, - "requires": { - "is-wsl": "^1.1.0" - } + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true }, "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" } }, - "supports-color": { + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "which-module": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, "yargs": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", - "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", + "integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==", "dev": true, "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", + "cliui": "^5.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", + "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^5.0.0" + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^15.0.1" } }, "yargs-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", - "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz", + "integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==", "dev": true, "requires": { - "camelcase": "^3.0.0" + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } }, "docsify-server-renderer": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/docsify-server-renderer/-/docsify-server-renderer-4.9.1.tgz", - "integrity": "sha512-JERMD3yEJq38nSim/o1VGBoyqxsRo1VRscafpkx3mT7g07orOg5UARUgztKQNmv+0xnkWsmu+BMr9nsurXmBMQ==", + "version": "4.11.4", + "resolved": "https://registry.npmjs.org/docsify-server-renderer/-/docsify-server-renderer-4.11.4.tgz", + "integrity": "sha512-TxOxqX/fwBFLHz788PtB0OeVis1EDWCVK8CEE/fvxTzQqsgZNTw2UO1wEg1qt/uuldJps3G+DPv/FN9xIeQgcg==", "dev": true, "requires": { - "debug": "^2.6.8", - "docsify": "^4.8.0", - "node-fetch": "^1.7.0", - "resolve-pathname": "^2.1.0" + "debug": "^4.1.1", + "docsify": "^4.11.2", + "dompurify": "^2.0.8", + "node-fetch": "^2.6.0", + "resolve-pathname": "^3.0.0" }, "dependencies": { - "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" + "ms": "^2.1.1" } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true } } }, @@ -2090,6 +2232,12 @@ "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", "dev": true }, + "dompurify": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.12.tgz", + "integrity": "sha512-Fl8KseK1imyhErHypFPA8qpq9gPzlsJ/EukA6yk9o0gX23p1TzC+rh9LqNg1qvErRTc0UNMYlKxEGSfSh43NDg==", + "dev": true + }, "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", @@ -2154,15 +2302,6 @@ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", "dev": true }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "dev": true, - "requires": { - "iconv-lite": "~0.4.13" - } - }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -2505,17 +2644,6 @@ } } }, - "external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", - "dev": true, - "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", - "tmp": "^0.0.33" - } - }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -2606,20 +2734,11 @@ "dev": true }, "figlet": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.2.3.tgz", - "integrity": "sha512-+F5zdvZ66j77b8x2KCPvWUHC0UCKUMWrewxmewgPlagp3wmDpcrHMbyv/ygq/6xoxBPGQA+UJU3SMoBzKoROQQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.5.0.tgz", + "integrity": "sha512-ZQJM4aifMpz6H19AW1VqvZ7l4pOE9p7i/3LyxgO2kp+PO/VcDYNqIHEMtkccqIhTXMKci4kjueJr/iCQEaT/Ww==", "dev": true }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -3409,6 +3528,12 @@ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, + "get-port": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", + "integrity": "sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==", + "dev": true + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -3543,30 +3668,22 @@ } }, "got": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", - "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", "dev": true, "requires": { - "create-error-class": "^3.0.0", + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-redirect": "^1.0.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "lowercase-keys": "^1.0.0", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "unzip-response": "^2.0.1", - "url-parse-lax": "^1.0.0" - }, - "dependencies": { - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - } + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" } }, "graceful-fs": { @@ -3697,6 +3814,12 @@ } } }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true + }, "hash-base": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", @@ -3755,6 +3878,12 @@ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, "http-errors": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", @@ -3791,15 +3920,6 @@ "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=", "dev": true }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", @@ -3844,54 +3964,6 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, - "inquirer": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.0.6.tgz", - "integrity": "sha1-4EqqnQW3o8ubD0B9BDdfBEcZA0c=", - "dev": true, - "requires": { - "ansi-escapes": "^1.1.0", - "chalk": "^1.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^2.0.1", - "figures": "^2.0.0", - "lodash": "^4.3.0", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rx": "^4.1.0", - "string-width": "^2.0.0", - "strip-ansi": "^3.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, "interpret": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", @@ -3955,12 +4027,12 @@ "dev": true }, "is-ci": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", - "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", "dev": true, "requires": { - "ci-info": "^1.5.0" + "ci-info": "^2.0.0" } }, "is-data-descriptor": { @@ -4072,9 +4144,9 @@ } }, "is-npm": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", - "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-3.0.0.tgz", + "integrity": "sha512-wsigDr1Kkschp2opC4G3yA6r9EgVA6NjRpWzIi9axXqeIaAATPRJc4uLujXe3Nd9uO8KoDyA4MD6aZSeXTADhA==", "dev": true }, "is-number": { @@ -4133,24 +4205,6 @@ "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", "dev": true }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-redirect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", - "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", - "dev": true - }, - "is-retry-allowed": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", - "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", - "dev": true - }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -4181,6 +4235,12 @@ "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", "dev": true }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -4379,6 +4439,12 @@ "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, "json-loader": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", @@ -4456,6 +4522,15 @@ "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", "dev": true }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", @@ -4463,12 +4538,12 @@ "dev": true }, "latest-version": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", - "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", "dev": true, "requires": { - "package-json": "^4.0.0" + "package-json": "^6.3.0" } }, "lazy-cache": { @@ -4495,16 +4570,130 @@ } }, "livereload": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/livereload/-/livereload-0.7.0.tgz", - "integrity": "sha512-PHnIGczQEvmCctDvRTWylA+1wSwE0/eFm+LkNhlmlAFus/aCRlVE97UOLOf6TUGLmZyfg7z7twG37ZiOgNJAyQ==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/livereload/-/livereload-0.9.1.tgz", + "integrity": "sha512-9g7sua11kkyZNo2hLRCG3LuZZwqexoyEyecSlV8cAsfAVVCZqLzVir6XDqmH0r+Vzgnd5LrdHDMyjtFnJQLAYw==", "dev": true, "requires": { - "chokidar": "^1.7.0", + "chokidar": "^3.3.0", + "livereload-js": "^3.1.0", "opts": ">= 1.2.0", - "ws": "^1.1.5" + "ws": "^6.2.1" + }, + "dependencies": { + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "dev": true + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz", + "integrity": "sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.4.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "readdirp": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", + "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } } }, + "livereload-js": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-3.2.4.tgz", + "integrity": "sha512-kgTCrrYAfwnb5469+7bB2hxIct8Giq0RemDnxOESIzyRwRqYGGMZh5VIveYqJiDvpglH0dpd074BU1zJj4NaNw==", + "dev": true + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -4615,18 +4804,18 @@ } }, "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, "requires": { - "pify": "^3.0.0" + "semver": "^6.0.0" }, "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -4662,9 +4851,9 @@ } }, "marked": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.5.2.tgz", - "integrity": "sha512-fdZvBa7/vSQIZCi4uuwo2N3q+7jJURpMVCcbaX0S1Mg65WZ5ilXvC67MviJAsdjqqgD+CEq4RKo5AYGgINkVAA==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz", + "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", "dev": true }, "math-random": { @@ -4685,9 +4874,9 @@ } }, "medium-zoom": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/medium-zoom/-/medium-zoom-0.4.0.tgz", - "integrity": "sha512-0z7yMfd6I1BTCAa8QaR4cp5AqDkQD571GzhHIbbfefKEssGLSvs+4Xai/itOAncm4FBlF5gUoMQ22yW9/f8Sig==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/medium-zoom/-/medium-zoom-1.0.6.tgz", + "integrity": "sha512-UdiUWfvz9fZMg1pzf4dcuqA0W079o0mpqbTnOz5ip4VGYX96QjmbM+OgOU/0uOzAytxC0Ny4z+VcYQnhdifimg==", "dev": true }, "mem": { @@ -4786,6 +4975,18 @@ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -5051,14 +5252,10 @@ } }, "node-fetch": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.6.3.tgz", - "integrity": "sha1-3CNO3WSJmC1Y6PDbT2lQKavNjAQ=", - "dev": true, - "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" - } + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "dev": true }, "node-libs-browser": { "version": "2.2.1", @@ -5126,6 +5323,12 @@ "remove-trailing-separator": "^1.0.1" } }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "dev": true + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -5438,76 +5641,25 @@ "wrappy": "1" } }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "open": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-6.4.0.tgz", + "integrity": "sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==", "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "is-wsl": "^1.1.0" } }, - "opencollective": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/opencollective/-/opencollective-1.0.3.tgz", - "integrity": "sha1-ruY3K8KBRFg2kMPKja7PwSDdDvE=", - "dev": true, - "requires": { - "babel-polyfill": "6.23.0", - "chalk": "1.1.3", - "inquirer": "3.0.6", - "minimist": "1.2.0", - "node-fetch": "1.6.3", - "opn": "4.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "opn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/opn/-/opn-4.0.2.tgz", - "integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=", - "dev": true, - "requires": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - } - }, - "options": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", - "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=", + "opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", "dev": true }, "opts": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/opts/-/opts-1.2.6.tgz", - "integrity": "sha1-0YXAQlz9652h0YKQi2W1wCOP67M=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/opts/-/opts-2.0.0.tgz", + "integrity": "sha512-rPleeyX48sBEc4aj7rAok5dCbvRdYpdbIdSRR4gnIK98a7Rvd4l3wlv4YHQr2mwPQTpKQiw8uipi/WoyItDINg==", "dev": true }, "os-browserify": { @@ -5537,10 +5689,10 @@ "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", "dev": true }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "dev": true }, "p-defer": { @@ -5549,6 +5701,15 @@ "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", "dev": true }, + "p-event": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-4.2.0.tgz", + "integrity": "sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==", + "dev": true, + "requires": { + "p-timeout": "^3.1.0" + } + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -5579,6 +5740,15 @@ "p-limit": "^2.0.0" } }, + "p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -5598,15 +5768,23 @@ } }, "package-json": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", - "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", "dev": true, "requires": { - "got": "^6.7.1", - "registry-auth-token": "^3.0.1", - "registry-url": "^3.0.3", - "semver": "^5.1.0" + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, "pako": { @@ -5770,6 +5948,12 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -5835,9 +6019,9 @@ } }, "prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", "dev": true }, "preserve": { @@ -5853,9 +6037,9 @@ "dev": true }, "prismjs": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.16.0.tgz", - "integrity": "sha512-OA4MKxjFZHSvZcisLGe14THYsug/nF6O1f0pAJc0KN0wTyAcLqmsbE+lTGKSpyh+9pEW57+k6pg2AfYR+coyHA==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.20.0.tgz", + "integrity": "sha512-AEDjSrVNkynnw6A+B1DsFkd6AVdTnp+/WoUixFRULlCLZVRZlVQMVWio/16jv7G1FscUxQxOQhWwApgbnxr6kQ==", "dev": true, "requires": { "clipboard": "^2.0.0" @@ -6078,12 +6262,6 @@ "resolve": "^1.1.6" } }, - "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", - "dev": true - }, "regex-cache": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", @@ -6104,22 +6282,21 @@ } }, "registry-auth-token": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.4.0.tgz", - "integrity": "sha512-4LM6Fw8eBQdwMYcES4yTnn2TqIasbXuwDx3um+QRs7S55aMKCBKBxvPXl2RiUjHwuJLTyYfxSpmfSAjQpcuP+A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz", + "integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==", "dev": true, "requires": { - "rc": "^1.1.6", - "safe-buffer": "^5.0.1" + "rc": "^1.2.8" } }, "registry-url": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", - "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", "dev": true, "requires": { - "rc": "^1.0.1" + "rc": "^1.2.8" } }, "release-zalgo": { @@ -6390,9 +6567,9 @@ "dev": true }, "resolve-pathname": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", - "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", + "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==", "dev": true }, "resolve-url": { @@ -6401,14 +6578,13 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", "dev": true, "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" + "lowercase-keys": "^1.0.0" } }, "ret": { @@ -6451,21 +6627,6 @@ "inherits": "^2.0.1" } }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "^2.1.0" - } - }, - "rx": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz", - "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=", - "dev": true - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -7062,6 +7223,15 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, + "strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "requires": { + "min-indent": "^1.0.0" + } + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -7208,18 +7378,6 @@ } } }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", - "dev": true - }, "timers-browserify": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", @@ -7237,20 +7395,11 @@ "optional": true }, "tinydate": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/tinydate/-/tinydate-1.1.0.tgz", - "integrity": "sha512-YF6YTOyBRHX4b3EtEI0W/mROcv82Gt6VccmVuSAkRV3FNORug2457wSGvT2cThbfuctQvVSmC5GobGheScxtIw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tinydate/-/tinydate-1.3.0.tgz", + "integrity": "sha512-7cR8rLy2QhYHpsBDBVYnnWXm8uRTr38RoZakFSW7Bs7PzfMPNZthuMLkwqZv7MTu8lhQ91cOFYS5a7iFj2oR3w==", "dev": true }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", @@ -7283,6 +7432,12 @@ } } }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + }, "to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", @@ -7438,6 +7593,12 @@ "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", "dev": true }, + "type-fest": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "dev": true + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -7604,12 +7765,6 @@ } } }, - "ultron": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", - "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=", - "dev": true - }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -7683,12 +7838,6 @@ } } }, - "unzip-response": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", - "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", - "dev": true - }, "upath": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.2.tgz", @@ -7696,19 +7845,21 @@ "dev": true }, "update-notifier": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.5.0.tgz", - "integrity": "sha512-gwMdhgJHGuj/+wHJJs9e6PcCszpxR1b236igrOkUofGhqJuG+amlIKwApH1IW1WWl7ovZxsX49lMBWLxSdm5Dw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-3.0.1.tgz", + "integrity": "sha512-grrmrB6Zb8DUiyDIaeRTBCkgISYUgETNe7NglEbVsrLWXeESnlCSP50WfRSj/GmzMPl6Uchj24S/p80nP/ZQrQ==", "dev": true, "requires": { - "boxen": "^1.2.1", + "boxen": "^3.0.0", "chalk": "^2.0.1", - "configstore": "^3.0.0", + "configstore": "^4.0.0", + "has-yarn": "^2.1.0", "import-lazy": "^2.1.0", - "is-ci": "^1.0.10", + "is-ci": "^2.0.0", "is-installed-globally": "^0.1.0", - "is-npm": "^1.0.0", - "latest-version": "^3.0.0", + "is-npm": "^3.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.0.0", "semver-diff": "^2.0.0", "xdg-basedir": "^3.0.0" } @@ -7747,12 +7898,12 @@ } }, "url-parse-lax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", - "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", "dev": true, "requires": { - "prepend-http": "^1.0.1" + "prepend-http": "^2.0.0" } }, "use": { @@ -8305,13 +8456,12 @@ } }, "ws": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.5.tgz", - "integrity": "sha512-o3KqipXNUdS7wpQzBHSe180lBGO60SoK0yVo3CYJgb2MkobuWuBX6dhkYP5ORCLd55y+SaflMOV5fqAB53ux4w==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", "dev": true, "requires": { - "options": ">=0.0.5", - "ultron": "1.0.x" + "async-limiter": "~1.0.0" } }, "xdg-basedir": { From 1b9bc8eb1d25fa0bedc2f54ae951b2a750d45ecf Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 28 Jul 2020 08:43:10 +0000 Subject: [PATCH 103/147] Bump typedoc from 0.11.1 to 0.16.11 Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.11.1 to 0.16.11. - [Release notes](https://github.com/TypeStrong/TypeDoc/releases) - [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.11.1...v0.16.11) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 163 ++++++++++++++++++---------------------------- package.json | 2 +- 2 files changed, 66 insertions(+), 99 deletions(-) diff --git a/package-lock.json b/package-lock.json index 523ed9ecd4..f5e5a9c315 100644 --- a/package-lock.json +++ b/package-lock.json @@ -254,12 +254,6 @@ "integrity": "sha1-wRzSgX06QBt7oPWkIPNcVhObHB4=", "dev": true }, - "@types/events": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", - "dev": true - }, "@types/form-data": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", @@ -269,38 +263,6 @@ "@types/node": "*" } }, - "@types/fs-extra": { - "version": "5.0.1", - "resolved": "http://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.1.tgz", - "integrity": "sha512-h3wnflb+jMTipvbbZnClgA2BexrT4w0GcfoCz5qyxd0IRsbqhLSyesM6mqZTAnhbVmhyTm5tuxfRu9R+8l+lGw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", - "dev": true, - "requires": { - "@types/events": "*", - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/handlebars": { - "version": "4.0.36", - "resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.36.tgz", - "integrity": "sha512-LjNiTX7TY7wtuC6y3QwC93hKMuqYhgV9A1uXBKNvZtVC8ZvyWAjZkJ5BvT0K7RKqORRYRLMrqCxpw5RgS+MdrQ==", - "dev": true - }, - "@types/highlight.js": { - "version": "9.12.2", - "resolved": "https://registry.npmjs.org/@types/highlight.js/-/highlight.js-9.12.2.tgz", - "integrity": "sha512-y5x0XD/WXDaGSyiTaTcKS4FurULJtSiYbGTeQd0m2LYZGBcZZ/7fM6t5H/DzeUF+kv8y6UfmF6yJABQsHcp9VQ==", - "dev": true - }, "@types/jszip": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.1.6.tgz", @@ -309,18 +271,6 @@ "@types/node": "*" } }, - "@types/lodash": { - "version": "4.14.104", - "resolved": "http://registry.npmjs.org/@types/lodash/-/lodash-4.14.104.tgz", - "integrity": "sha512-ufQcVg4daO8xQ5kopxRHanqFdL4AI7ondQkV+2f+7mz3gvp0LkBx2zBRC6hfs3T87mzQFmf5Fck7Fi145Ul6NQ==", - "dev": true - }, - "@types/marked": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@types/marked/-/marked-0.3.0.tgz", - "integrity": "sha512-CSf9YWJdX1DkTNu9zcNtdCcn6hkRtB5ILjbhRId4ZOQqx30fXmdecuaXhugQL6eyrhuXtaHJ7PHI+Vm7k9ZJjg==", - "dev": true - }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -360,16 +310,6 @@ "@types/request": "*" } }, - "@types/shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha512-M2giRw93PxKS7YjU6GZjtdV9HASdB7TWqizBXe4Ju7AqbKlWvTr0gNO92XH56D/gMxqD/jNHLNfC5hA34yGqrQ==", - "dev": true, - "requires": { - "@types/glob": "*", - "@types/node": "*" - } - }, "@types/shortid": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/shortid/-/shortid-0.0.29.tgz", @@ -969,6 +909,15 @@ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, + "backbone": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/backbone/-/backbone-1.4.0.tgz", + "integrity": "sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ==", + "dev": true, + "requires": { + "underscore": ">=1.8.3" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -2892,12 +2841,12 @@ "dev": true }, "fs-extra": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", - "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } @@ -3856,9 +3805,9 @@ "dev": true }, "highlight.js": { - "version": "9.15.8", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.15.8.tgz", - "integrity": "sha512-RrapkKQWwE+wKdF73VsOa2RQdIoO3mxwJ4P8mhbI6KYJUraUHRKM5w5zQQKXNk0xNL4UVRdulV9SBJcmzJNzVA==", + "version": "9.18.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz", + "integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg==", "dev": true }, "hmac-drbg": { @@ -4411,6 +4360,12 @@ "handlebars": "^4.1.2" } }, + "jquery": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", + "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==", + "dev": true + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -4803,6 +4758,12 @@ "yallist": "^2.1.2" } }, + "lunr": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz", + "integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==", + "dev": true + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -7618,40 +7579,34 @@ "dev": true }, "typedoc": { - "version": "0.11.1", - "resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.11.1.tgz", - "integrity": "sha512-jdNIoHm5wkZqxQTe/g9AQ3LKnZyrzHXqu6A/c9GUOeJyBWLxNr7/Dm3rwFvLksuxRNwTvY/0HRDU9sJTa9WQSg==", + "version": "0.16.11", + "resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.16.11.tgz", + "integrity": "sha512-YEa5i0/n0yYmLJISJ5+po6seYfJQJ5lQYcHCPF9ffTF92DB/TAZO/QrazX5skPHNPtmlIht5FdTXCM2kC7jQFQ==", "dev": true, "requires": { - "@types/fs-extra": "5.0.1", - "@types/handlebars": "4.0.36", - "@types/highlight.js": "9.12.2", - "@types/lodash": "4.14.104", - "@types/marked": "0.3.0", "@types/minimatch": "3.0.3", - "@types/shelljs": "0.7.8", - "fs-extra": "^5.0.0", - "handlebars": "^4.0.6", - "highlight.js": "^9.0.0", - "lodash": "^4.17.5", - "marked": "^0.3.17", + "fs-extra": "^8.1.0", + "handlebars": "^4.7.2", + "highlight.js": "^9.17.1", + "lodash": "^4.17.15", + "marked": "^0.8.0", "minimatch": "^3.0.0", - "progress": "^2.0.0", - "shelljs": "^0.8.1", - "typedoc-default-themes": "^0.5.0", - "typescript": "2.7.2" + "progress": "^2.0.3", + "shelljs": "^0.8.3", + "typedoc-default-themes": "^0.7.2", + "typescript": "3.7.x" }, "dependencies": { "marked": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", - "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.2.tgz", + "integrity": "sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==", "dev": true }, "shelljs": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", - "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", + "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", "dev": true, "requires": { "glob": "^7.0.0", @@ -7660,18 +7615,24 @@ } }, "typescript": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", - "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", + "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "dev": true } } }, "typedoc-default-themes": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz", - "integrity": "sha1-bcJDPnjti+qOiHo6zeLzF4W9Yic=", - "dev": true + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.7.2.tgz", + "integrity": "sha512-fiFKlFO6VTqjcno8w6WpTsbCgXmfPHVjnLfYkmByZE7moaz+E2DSpAT+oHtDHv7E0BM5kAhPrHJELP2J2Y2T9A==", + "dev": true, + "requires": { + "backbone": "^1.4.0", + "jquery": "^3.4.1", + "lunr": "^2.3.8", + "underscore": "^1.9.1" + } }, "typescript": { "version": "2.9.2", @@ -7777,6 +7738,12 @@ } } }, + "underscore": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.10.2.tgz", + "integrity": "sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==", + "dev": true + }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", diff --git a/package.json b/package.json index ddb25e9ceb..1a10150b60 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "ts-node": "^7.0.1", "tslint": "^5.11.0", "tslint-immutable": "^4.9.0", - "typedoc": "^0.11.1", + "typedoc": "^0.16.11", "typescript": "2.9.2", "webpack": "^3.10.0" }, From 3213c4838defec26d5be2462663d728a9b5ddb30 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 28 Jul 2020 08:43:57 +0000 Subject: [PATCH 104/147] Bump shelljs from 0.7.8 to 0.8.4 Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.7.8 to 0.8.4. - [Release notes](https://github.com/shelljs/shelljs/releases) - [Changelog](https://github.com/shelljs/shelljs/blob/master/CHANGELOG.md) - [Commits](https://github.com/shelljs/shelljs/compare/v0.7.8...v0.8.4) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 523ed9ecd4..227b7190e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6814,9 +6814,9 @@ "dev": true }, "shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", + "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", "dev": true, "requires": { "glob": "^7.0.0", diff --git a/package.json b/package.json index ddb25e9ceb..1ddb90bbea 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "request": "^2.88.0", "request-promise": "^4.2.2", "rimraf": "^2.5.2", - "shelljs": "^0.7.7", + "shelljs": "^0.8.4", "sinon": "^5.0.7", "ts-node": "^7.0.1", "tslint": "^5.11.0", From 784de3e430393472eecd8cc44b7d43934d8ac5dd Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jul 2020 21:32:19 +0000 Subject: [PATCH 105/147] [Security] Bump elliptic from 6.5.0 to 6.5.3 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.0 to 6.5.3. **This update includes a security fix.** - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.0...v6.5.3) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 523ed9ecd4..5566080ec4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2270,9 +2270,9 @@ "dev": true }, "elliptic": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.0.tgz", - "integrity": "sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", "dev": true, "requires": { "bn.js": "^4.4.0", From 21d53c41d0cbc3f0370b18c46d6e53a9138e3e87 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2020 01:44:26 +0000 Subject: [PATCH 106/147] Bump @types/request-promise from 4.1.44 to 4.1.46 Bumps [@types/request-promise](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/request-promise) from 4.1.44 to 4.1.46. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/request-promise) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 50 +++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 701119df79..404d511acb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -237,9 +237,9 @@ "dev": true }, "@types/bluebird": { - "version": "3.5.27", - "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.27.tgz", - "integrity": "sha512-6BmYWSBea18+tSjjSC3QIyV93ZKAeNWGM7R6aYt1ryTZXrlHF+QLV0G2yV0viEGVyRkyQsWfMoJ0k/YghBX5sQ==", + "version": "3.5.32", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.32.tgz", + "integrity": "sha512-dIOxFfI0C+jz89g6lQ+TqhGgPQ0MxSnh/E4xuC0blhFtyW269+mPG5QeLgbdwst/LvdP8o1y0o/Gz5EHXLec/g==", "dev": true }, "@types/caseless": { @@ -254,15 +254,6 @@ "integrity": "sha1-wRzSgX06QBt7oPWkIPNcVhObHB4=", "dev": true }, - "@types/form-data": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", - "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/jszip": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.1.6.tgz", @@ -289,21 +280,34 @@ "integrity": "sha512-Z4U8yDAl5TFkmYsZdFPdjeMa57NOvnaf1tljHzhouaPEp7LCj2JKkejpI1ODviIAQuW4CcQmxkQ77rnLsOOoKw==" }, "@types/request": { - "version": "2.48.1", - "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.1.tgz", - "integrity": "sha512-ZgEZ1TiD+KGA9LiAAPPJL68Id2UWfeSO62ijSXZjFJArVV+2pKcsVHmrcu+1oiE3q6eDGiFiSolRc4JHoerBBg==", + "version": "2.48.5", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.5.tgz", + "integrity": "sha512-/LO7xRVnL3DxJ1WkPGDQrp4VTV1reX9RkC85mJ+Qzykj2Bdw+mG15aAfDahc76HtknjzE16SX/Yddn6MxVbmGQ==", "dev": true, "requires": { "@types/caseless": "*", - "@types/form-data": "*", "@types/node": "*", - "@types/tough-cookie": "*" + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + }, + "dependencies": { + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } } }, "@types/request-promise": { - "version": "4.1.44", - "resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.44.tgz", - "integrity": "sha512-RId7eFsUKxfal1LirDDIcOp9u3MM3NXFDBcC3sqIMcmu7f4U6DsCEMD8RbLZtnPrQlN5Jc79di/WPsIEDO4keg==", + "version": "4.1.46", + "resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.46.tgz", + "integrity": "sha512-3Thpj2Va5m0ji3spaCk8YKrjkZyZc6RqUVOphA0n/Xet66AW/AiOAs5vfXhQIL5NmkaO7Jnun7Nl9NEjJ2zBaw==", "dev": true, "requires": { "@types/bluebird": "*", @@ -338,9 +342,9 @@ "dev": true }, "@types/tough-cookie": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.5.tgz", - "integrity": "sha512-SCcK7mvGi3+ZNz833RRjFIxrn4gI1PPR3NtuIS+6vMkvmsGjosqTJwRt5bAEFLRz+wtJMWv8+uOnZf2hi2QXTg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.0.tgz", + "integrity": "sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A==", "dev": true }, "@types/uglify-js": { From b2280f64a109cc77d4650a0770a378e1c8fb56a0 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2020 08:48:47 +0000 Subject: [PATCH 107/147] Bump @types/jszip from 3.1.6 to 3.4.1 Bumps [@types/jszip](https://github.com/Stuk/jszip) from 3.1.6 to 3.4.1. - [Release notes](https://github.com/Stuk/jszip/releases) - [Changelog](https://github.com/Stuk/jszip/blob/master/CHANGES.md) - [Commits](https://github.com/Stuk/jszip/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 701119df79..801d8aaac1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -264,11 +264,11 @@ } }, "@types/jszip": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.1.6.tgz", - "integrity": "sha512-m8uFcI+O2EupCfbEVQWsBM/4nhbegjOHL7cQgBpM95FeF98kdFJXzy9/8yhx4b3lCRl/gMBhcvyh30Qt3X+XPQ==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.4.1.tgz", + "integrity": "sha512-TezXjmf3lj+zQ651r6hPqvSScqBLvyPI9FxdXBqpEwBijNGQ2NXpaFW/7joGzveYkKQUil7iiDHLo6LV71Pc0A==", "requires": { - "@types/node": "*" + "jszip": "*" } }, "@types/minimatch": { From fff62445973d7a0d34428d46f6a4844ca28b30fc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2020 08:49:24 +0000 Subject: [PATCH 108/147] Bump @types/node from 14.0.23 to 14.0.27 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.0.23 to 14.0.27. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 701119df79..ea51a0a4dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -284,9 +284,9 @@ "dev": true }, "@types/node": { - "version": "14.0.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.23.tgz", - "integrity": "sha512-Z4U8yDAl5TFkmYsZdFPdjeMa57NOvnaf1tljHzhouaPEp7LCj2JKkejpI1ODviIAQuW4CcQmxkQ77rnLsOOoKw==" + "version": "14.0.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz", + "integrity": "sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g==" }, "@types/request": { "version": "2.48.1", From 839661e5f87d793d6fecb4c547b96c606cd68ee0 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2020 08:50:39 +0000 Subject: [PATCH 109/147] Bump @types/webpack from 4.4.34 to 4.41.21 Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.4.34 to 4.41.21. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 701119df79..32b835a8bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -331,10 +331,16 @@ "integrity": "sha512-yYezQwGWty8ziyYLdZjwxyMb0CZR49h8JALHGrxjQHWlqGgc8kLdHEgWrgL0uZ29DMvEVBDnHU2Wg36zKSIUtA==", "dev": true }, + "@types/source-list-map": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz", + "integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==", + "dev": true + }, "@types/tapable": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.4.tgz", - "integrity": "sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.6.tgz", + "integrity": "sha512-W+bw9ds02rAQaMvaLYxAbJ6cvguW/iJXNT6lTssS1ps6QdrMKttqEAMEG/b5CR8TZl3/L7/lH0ZV5nNR1LXikA==", "dev": true }, "@types/tough-cookie": { @@ -344,27 +350,47 @@ "dev": true }, "@types/uglify-js": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.0.4.tgz", - "integrity": "sha512-SudIN9TRJ+v8g5pTG8RRCqfqTMNqgWCKKd3vtynhGzkIIjxaicNAMuY5TRadJ6tzDu3Dotf3ngaMILtmOdmWEQ==", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.9.3.tgz", + "integrity": "sha512-KswB5C7Kwduwjj04Ykz+AjvPcfgv/37Za24O2EDzYNbwyzOo8+ydtvzUfZ5UMguiVu29Gx44l1A6VsPPcmYu9w==", "dev": true, "requires": { "source-map": "^0.6.1" } }, "@types/webpack": { - "version": "4.4.34", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.4.34.tgz", - "integrity": "sha512-GnEBgjHsfO1M7DIQ0dAupSofcmDItE3Zsu3reK8SQpl/6N0rtUQxUmQzVFAS5ou/FGjsYKjXAWfItLZ0kNFTfQ==", + "version": "4.41.21", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.21.tgz", + "integrity": "sha512-2j9WVnNrr/8PLAB5csW44xzQSJwS26aOnICsP3pSGCEdsu6KYtfQ6QJsVUKHWRnm1bL7HziJsfh5fHqth87yKA==", "dev": true, "requires": { "@types/anymatch": "*", "@types/node": "*", "@types/tapable": "*", "@types/uglify-js": "*", + "@types/webpack-sources": "*", "source-map": "^0.6.0" } }, + "@types/webpack-sources": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-1.4.2.tgz", + "integrity": "sha512-77T++JyKow4BQB/m9O96n9d/UUHWLQHlcqXb9Vsf4F1+wKNrrlWNFPDLKNT92RJnCSL6CieTc+NDXtCVZswdTw==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } + } + }, "acorn": { "version": "5.7.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", From 41acb475a9da9ff0f5619446fe4197abcb42e708 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 30 Jul 2020 11:42:55 +0100 Subject: [PATCH 110/147] Update documentation --- docs/README.md | 16 --- docs/_coverpage.md | 10 ++ docs/_sidebar.md | 2 +- docs/contribution-guidelines.md | 137 ++++++-------------- docs/examples.md | 219 -------------------------------- docs/index.html | 68 +++++----- docs/usage/packers.md | 120 +---------------- package-lock.json | 40 +++--- 8 files changed, 105 insertions(+), 507 deletions(-) create mode 100644 docs/_coverpage.md delete mode 100644 docs/examples.md diff --git a/docs/README.md b/docs/README.md index dae964d87a..28781012fe 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,13 +1,3 @@ -

- clippy the assistant -

- -

- Easily generate .docx files with JS/TS. Works for Node and on the Browser. :100: -

- ---- - # Welcome ## Installation @@ -66,12 +56,6 @@ Packer.toBuffer(doc).then((buffer) => { // Done! A file called 'My First Document.docx' will be in your file system. ``` -## Honoured Mentions - -[@felipeochoa](https://github.com/felipeochoa) - -[@h4buli](https://github.com/h4buli) -

clippy the assistant

diff --git a/docs/_coverpage.md b/docs/_coverpage.md new file mode 100644 index 0000000000..adfd37471e --- /dev/null +++ b/docs/_coverpage.md @@ -0,0 +1,10 @@ +drawing + +> Easily generate .docx files with JS/TS. Works for Node and on the Browser. :100: + +- Simple, declarative API +- 50+ usage examples +- Battle tested, mature, 95%+ coverage + +[GitHub](https://github.com/dolanmiu/docx) +[Get Started](#Welcome) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 9e329b6448..a63970dff9 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,6 +1,6 @@ * [Getting Started](/) -* [Examples](examples.md) +* [Examples](https://github.com/dolanmiu/docx/tree/master/demo) * API diff --git a/docs/contribution-guidelines.md b/docs/contribution-guidelines.md index 1305c4c4bd..f9963bd644 100644 --- a/docs/contribution-guidelines.md +++ b/docs/contribution-guidelines.md @@ -1,25 +1,23 @@ # Contribution Guidelines -* Include documentation reference(s) at the top of each file: +- Include documentation reference(s) at the top of each file: ```ts // http://officeopenxml.com/WPdocument.php ``` -* Follow Prettier standards, and consider using the [Prettier VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) plugin. +- Follow Prettier standards, and consider using the [Prettier VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) plugin. -* Follow the `TSLint` rules +- Follow the `TSLint` rules ## Always think about the user -The number one pillar for contribution to `docx` is to **ALWAYS** think about how the user will use `docx`. - Put yourself in their position, and imagine how they would feel about your feature you wrote. 1. Is it easy to use? 2. Has it been documented well? 3. Is it intuitive? -4. Is it consistent with the rest of the API? +4. Is it declarative? 5. Is it fun to use? ## Good Commit Names @@ -27,6 +25,7 @@ Put yourself in their position, and imagine how they would feel about your featu Please write good commit messages when making a commit: https://chris.beams.io/posts/git-commit/ **Do not:** + ``` c // What? rtl // Adding acryonyms without explaining anything else is not helpful @@ -35,34 +34,6 @@ demo updated // Getting better, but capitalize the first letter Unesesary coment removed // Make sure to use correct spelling ``` -## No leaky components in API interface - -> This mainly applies to the API the end user will consume. - -Try to make method parameters of the outside API accept primitives, or `json` objects, so that child components are created **inside** the component, rather than being **injected** in. - -This is so that: - -1. Imports are much cleaner for the end user, no need for: - ```ts - import { ChildComponent } from "./my-feature/sub-component/deeper/.../my-deep.component"; - ``` - -2. This is what I consider "leakage". The code is aware of the underlying implementation of the component. -3. It means the end user does not need to import and create the child component to be injected. - -**Do not** - -`TableFloatProperties` is a class. The outside world would have to `new` up the object, and inject it in like so: - -```ts - public float(tableFloatProperties: TableFloatProperties): Table -``` - -```ts - table.float(new TableFloatProperties(...)); -``` - **Do** `ITableFloatOptions` is an interface for a JSON of primitives. The end user would need to pass in a json object and not need to worry about the internals: @@ -71,31 +42,29 @@ This is so that: public float(tableFloatOptions: ITableFloatOptions): Table ``` +## Delcariative API + +Make sure the API is declarative, so no _method calling_ or _mutation_. This is a design decision, consistent with the rest of the project. There are benefits to delcariative code over other styles of code, explained here: https://dzone.com/articles/why-declarative-coding-makes-you-a-better-programm + +**Do not:** + ```ts - table.float({...}); +const paragraph = doc.createParagraph(); +const text = paragraph.createText(); +text.contents = "Hello World"; ``` -## Add vs Create +**Do** -This is just a guideline, and the rules can sometimes be broken. - -* Use `create` if the method `new`'s up an element inside: - - ```ts - public createParagraph() { - const paragraph = new Paragraph(); - this.root.push(paragraph); - } - ``` - -* Use `add` if you add the element into the method as a parameter. - *Note:* This may look like its breaking the previous guideline, but it has semantically different meanings. The previous one is using data to construct an object, whereas this one is simply adding elements into the document: - - ```ts - public add(paragraph: Paragraph) { - this.root.push(paragraph); - } - ``` +```ts +doc.addSection({ + children: [ + new Paragraph({ + children: [new TextRun("Hello World")], + }), + ], +}); +``` ## Getters and Setters @@ -107,7 +76,7 @@ public get Level() { } ``` -There is no performance advantage by doing this. It means we don't need to prefix all private variables with the ugly `_`: +This is the convention of this project. There is no performance advantage by doing this. It means we don't need to prefix all private variables with `_`: **Do not:** @@ -121,30 +90,6 @@ private get _level: string; private get level: string; ``` -## Temporal Methods - -Some methods are `non-temporal`, which means regardless of when you call the method, it will have the same affect on the document. For example, setting the width of a table at the end of the document will have the same effect as setting the width at the start: - -```ts -table.setWidth(1000); // now removed as of version 5.0.0 -``` - -Whereas some methods are `temporal`, which means depending on the time-frame they are called, it would produce a difference result. For example, moving `createParagraph()` around your code will physically alter the document. - -```ts -doc.createParagraph("hello"); -``` - -If a method is `non-temporal`, put it in the objects `constructor`. For example: - -```ts -const table = new Table(width: number); -``` - -`Non-temporal` methods are usually methods which can only be used one time and one time only. For example, `.float()`. It does not make sense to call `.float()` again if its already floating. - -I am not sure what the real term is, but this will do. - ## Interfaces over type alias Do not use `type`, but rather use `Interfaces`. `type` cannot be extended, and a class cannot implement it. @@ -152,14 +97,14 @@ Do not use `type`, but rather use `Interfaces`. `type` cannot be extended, and a > "In general, use what you want ( type alias / interface ) just be consistent" > "always use interface for public API's definition when authoring a library or 3rd party ambient type definitions" > -> * https://medium.com/@martin_hotell/interface-vs-type-alias-in-typescript-2-7-2a8f1777af4c +> - https://medium.com/@martin_hotell/interface-vs-type-alias-in-typescript-2-7-2a8f1777af4c `Interface` is generally preferred over `type`: https://stackoverflow.com/questions/37233735/typescript-interfaces-vs-types **Do not:** ```ts -type RelationshipFileInfo = { id: number, target: string }; +type RelationshipFileInfo = { id: number; target: string }; ``` **Do:** @@ -193,26 +138,26 @@ enum WeaponType = { ## Spell correctly, in full and in American English -I am not sure where these habits in software development come from, but I do not believe it is beneficial: - **Do not:** + ```ts -readdy // misspelling -perm // abbreviation -conf // abbreviation -cnty // abbreviation -relationFile // abbreviation -colour // U.K. English +readdy; // misspelling +perm; // abbreviation +conf; // abbreviation +cnty; // abbreviation +relationFile; // abbreviation +colour; // U.K. English ``` **Do:** + ```ts -ready -permission -config -country -relationshipFile -color +ready; +permission; +config; +country; +relationshipFile; +color; ``` ## Keep files small (within reason) diff --git a/docs/examples.md b/docs/examples.md deleted file mode 100644 index f638e1aa25..0000000000 --- a/docs/examples.md +++ /dev/null @@ -1,219 +0,0 @@ -# Examples - -> All examples can run independently and can be found in the `/demo` folder of the project - -All the examples below can be ran locally, to do so, run the following command: - -```sh -npm run demo -``` - -This command will run the `demo selector app` in the `/demo` folder. It will prompt you to select a demo number, which will run a demo from that folder. - -## Simple - -A simple hello world of the `docx` library: - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo1.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo1.ts_ - -## Styles - -### Styling with JS - -This example shows how to customise the look and feel of a document using JS configuration - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo2.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo2.ts_ - -### Styling with XML - -This example shows how to customise the look and feel of a document using XML configuration - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo13.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo13.ts_ - -## Numbering - -This example shows many levels of numbering - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo3.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo3.ts_ - -## Table - -Example of simple table - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo4.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo4.ts_ - -### Styling table borders - -Styling the borders of a table - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo20.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.ts_ - -## Images - -### Add image to the document - -Importing Images from file system path - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo5.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo5.ts_ - -### Add images to header and footer - -Example showing how to add image to headers and footers - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo9.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo9.ts_ - -### Scaling images - -Example showing how to scale images - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo12.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo12.ts_ - -### Add Image to media before adding to document - -This is the best way to add an image to a document because you can add the same image in two locations without increasing document size by re-using the same image - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo23.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo23.ts_ - -### Add image to table - -As before, to add an image to a table, you would need to add it to the `Media` object first - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo24.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo24.ts_ - -### Images using Base64 URI - -If you want to use a Base64 image instead - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo18.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo18.ts_ - -## Margins - -Example showing how to set custom margins - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo6.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo6.ts_ - -## Orientation - -Example showing how to set the document to `landscape` or `portrait` - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo7.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo7.ts_ - -## Headers & Footers - -Example showing how to add headers and footers - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo8.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo8.ts_ - -## Multiple headers and footers - -Check out `Sections` for this feature - -## Page Breaks - -### Normal page breaks - -Example showing how to page break - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo14.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo14.ts_ - -### Page break before - -Example showing how to page break before like in Word - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo15.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo15.ts_ - -## Sections - -Example of how sections work. Sections allow multiple headers and footers, and `landscape`/`portrait` inside the same document. -Also you can have different page number formats and starts for different sections. - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo16.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo16.ts_ - -## Footnotes - -Example of how to add footnotes. Good for references - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo17.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo17.ts_ - -## Packers - -## Buffer output - -Example showing how to use the Buffer packer and then write that buffer to the file system - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo19.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo19.ts_ - - -## Bookmarks - -Example showing how to make bookmarks to make internal hyperlinks within the document - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo21.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo21.ts_ - -## Bidirectional text - -Example showing how to use bidirectional text for certain languages such as Hebrew - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo22.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo22.ts_ - -## Showcase - -### My CV - -Example showing how to add headers and footers - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo10.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo10.ts_ - -### Style and Images - -This example shows how to customise the look and feel of a document and add images - -[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo11.ts ':include') - -_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo11.ts_ diff --git a/docs/index.html b/docs/index.html index 29ab70ff59..13c52ae6da 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,40 +1,36 @@ + + + docx - Generate .docx documents with JavaScript + + + + + - - - docx - Generate .docx documents with JavaScript - - - - - - - -
- - - - - - - - - + +
+ + + + + + + + diff --git a/docs/usage/packers.md b/docs/usage/packers.md index e9b3626015..236494bf96 100644 --- a/docs/usage/packers.md +++ b/docs/usage/packers.md @@ -2,11 +2,7 @@ > Packers are the way in which `docx` turns your code into `.docx` format. It is completely decoupled from the `docx.Document`. -Packers in `version 4` and above are now one single `Packer`. It works in both a node and browser environment (Angular etc). Now, the packer returns a `Buffer`, `Blob` or `base64 string`. It is up to you to take that and persist it with node's `fs`, send it down as a downloadable file, or anything else you wish. As of version 4, this library will not have options to export to PDF. - -## Version 5 - -Packers in `version 5` and above are now static methods on `Packer`. +Packers works in both a node and browser environment (Angular etc). Now, the packer returns a `Buffer`, `Blob` or `base64 string`. It is up to you to take that and persist it with node's `fs`, send it down as a downloadable file, or anything else you wish. As of `version 4+`, this library will not have options to export to PDF. ### Export as Buffer @@ -36,117 +32,3 @@ Packer.toBlob(doc).then((blob) => { saveAs(blob, "example.docx"); }); ``` - -## Version 4 - -The `Packer` in `version 4` requires an instance of `Packer`, so be sure to `new` it. - -### Export as Buffer - -This will return a NodeJS `Buffer`. If this is used in the browser, it will return a `UInt8Array` instead. - -```ts -const packer = new docx.Packer(); - -packer.toBuffer(doc).then((buffer) => { - fs.writeFileSync("My Document.docx", buffer); -}); -``` - -### Export as a `base64` string - -```ts -const packer = new docx.Packer(); - -packer.toBase64String(doc).then((string) => { - console.log(string); -}); -``` - -### Export as Blob - -This is useful if you want to send it as an downloadable in a browser environment. - -```ts -const packer = new docx.Packer(); - -packer.toBlob(doc).then((blob) => { - // saveAs from FileSaver will download the file - saveAs(blob, "example.docx"); -}); -``` - -## Version 3 and below - -### File System Packer - -```ts -const docx = require("docx"); - -const doc = new docx.Document(); -const exporter = new docx.LocalPacker(doc); -exporter.pack("My Document"); -// Word Document is in file system -``` - -### Buffer Packer - -```ts -const docx = require("docx"); - -const doc = new docx.Document(); -const exporter = new docx.BufferPacker(doc); -const buffer = exporter.pack(); -``` - -### Stream Packer - -Creates a `node` `Readable` stream - -```ts -const docx = require("docx"); - -const doc = new docx.Document(); -const exporter = new docx.StreamPacker(doc); -const stream = exporter.pack(); -``` - -### Express Packer - -The old express packer is now deprecated and may disappear soon, so you should upgrade. - -The reason for this is because it means this project needs to know about and use `express`, which for a Word document generator, does not sound right. Seperation of concerns. - -It will still be usable (for now), but it is ill advised. - -I used the express exporter in my [website](http://www.dolan.bio). - -The recommended way is to use the `StreamPacker` and handle the `express` magic outside of the library: - -```ts -const docx = require("docx"); - -const doc = new docx.Document(); -const exporter = new docx.StreamPacker(doc); - -const stream = exporter.pack(); - -// Express' response object -res.attachment("yourfile.xlsx"); -stream.pipe(res); -``` - -where `res` is the response object obtained through the Express router. It is that simple. The file will begin downloading in the browser. - -### PDF Exporting - -You can export your word document as a PDF file like so: - -```ts -const exporter = new docx.LocalPacker(doc); -exporter.packPdf("My Document"); - -// Express -const exporter = new docx.ExpressPacker(doc, res); -exporter.packPdf("My Document"); -``` diff --git a/package-lock.json b/package-lock.json index 9f5915a5b7..c148694cb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -197,7 +197,7 @@ }, "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -718,7 +718,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -747,7 +747,7 @@ }, "async": { "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -821,7 +821,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1568,7 +1568,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2702,7 +2702,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4420,7 +4420,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4681,7 +4681,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -5028,7 +5028,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5667,7 +5667,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5870,7 +5870,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5947,7 +5947,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7204,7 +7204,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7756,7 +7756,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8181,7 +8181,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8397,13 +8397,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8417,7 +8417,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8550,7 +8550,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8594,7 +8594,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 01e34c1b28e14415ab391258bbd6ae4dc0aeff25 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2020 10:48:07 +0000 Subject: [PATCH 111/147] Bump sinon from 5.1.1 to 9.0.2 Bumps [sinon](https://github.com/sinonjs/sinon) from 5.1.1 to 9.0.2. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/compare/v5.1.1...v9.0.2) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 185 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 92 insertions(+), 95 deletions(-) diff --git a/package-lock.json b/package-lock.json index c148694cb5..644d69b255 100644 --- a/package-lock.json +++ b/package-lock.json @@ -179,9 +179,9 @@ "dev": true }, "@sinonjs/commons": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.4.0.tgz", - "integrity": "sha512-9jHK3YF/8HtJ9wCAbG+j8cD0i0+ATS9A7gXFqS36TblLPNy6rEEc+SB0imo91eCboGaBYGV/MT1/br/J+EE7Tw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz", + "integrity": "sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw==", "dev": true, "requires": { "type-detect": "4.0.8" @@ -195,24 +195,42 @@ } } }, - "@sinonjs/formatio": { - "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", - "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", + "@sinonjs/fake-timers": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz", + "integrity": "sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==", "dev": true, "requires": { - "samsam": "1.3.0" + "@sinonjs/commons": "^1.7.0" + } + }, + "@sinonjs/formatio": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-5.0.1.tgz", + "integrity": "sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1", + "@sinonjs/samsam": "^5.0.2" } }, "@sinonjs/samsam": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.2.tgz", - "integrity": "sha512-ILO/rR8LfAb60Y1Yfp9vxfYAASK43NFC2mLzpvLUbCQY/Qu8YwReboseu8aheCEkyElZF2L2T9mHcR2bgdvZyA==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.0.3.tgz", + "integrity": "sha512-QucHkc2uMJ0pFGjJUDP3F9dq5dx8QIaqISl9QgwLOh6P9yv877uONPGXh/OH/0zmM3tW1JjuJltAZV2l7zU+uQ==", "dev": true, "requires": { - "@sinonjs/commons": "^1.0.2", - "array-from": "^2.1.1", - "lodash": "^4.17.11" + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + }, + "dependencies": { + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + } } }, "@sinonjs/text-encoding": { @@ -647,12 +665,6 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, - "array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", - "dev": true - }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -718,7 +730,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -747,7 +759,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -821,7 +833,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1568,7 +1580,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -2702,7 +2714,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4420,7 +4432,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -4502,9 +4514,9 @@ } }, "just-extend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", - "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz", + "integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==", "dev": true }, "keyv": { @@ -4681,7 +4693,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -4751,12 +4763,6 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, - "lolex": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", - "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", - "dev": true - }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -5028,7 +5034,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -5212,34 +5218,16 @@ "dev": true }, "nise": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.0.tgz", - "integrity": "sha512-Z3sfYEkLFzFmL8KY6xnSJLRxwQwYBjOXi/24lb62ZnZiGA0JUzGGTI6TBIgfCSMIDl9Jlu8SRmHNACLTemDHww==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/nise/-/nise-4.0.4.tgz", + "integrity": "sha512-bTTRUNlemx6deJa+ZyoCUTRvH3liK5+N6VQZ4NIw90AgDXY6iPnsqplNFf6STcj+ePk0H/xqxnP75Lr0J0Fq3A==", "dev": true, "requires": { - "@sinonjs/formatio": "^3.1.0", + "@sinonjs/commons": "^1.7.0", + "@sinonjs/fake-timers": "^6.0.0", "@sinonjs/text-encoding": "^0.7.1", "just-extend": "^4.0.2", - "lolex": "^4.1.0", "path-to-regexp": "^1.7.0" - }, - "dependencies": { - "@sinonjs/formatio": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.1.tgz", - "integrity": "sha512-tsHvOB24rvyvV2+zKMmPkZ7dXX6LSLKZ7aOtXY6Edklp0uRcgGpOsQTTGTcWViFyx4uhWc6GV8QdnALbIbIdeQ==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" - } - }, - "lolex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.1.0.tgz", - "integrity": "sha512-BYxIEXiVq5lGIXeVHnsFzqa1TxN5acnKnPCdlZSpzm8viNEOhiigupA4vTQ9HEFQ6nLTQ9wQOgBknJgzUYQ9Aw==", - "dev": true - } } }, "node-fetch": { @@ -5667,7 +5655,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -5870,7 +5858,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5893,9 +5881,9 @@ "dev": true }, "path-to-regexp": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", "dev": true, "requires": { "isarray": "0.0.1" @@ -5947,7 +5935,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -6650,12 +6638,6 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "samsam": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", - "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", - "dev": true - }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -6830,25 +6812,40 @@ "dev": true }, "sinon": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-5.1.1.tgz", - "integrity": "sha512-h/3uHscbt5pQNxkf7Y/Lb9/OM44YNCicHakcq73ncbrIS8lXg+ZGOZbtuU+/km4YnyiCYfQQEwANaReJz7KDfw==", + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.2.tgz", + "integrity": "sha512-0uF8Q/QHkizNUmbK3LRFqx5cpTttEVXudywY9Uwzy8bTfZUhljZ7ARzSxnRHWYWtVTeh4Cw+tTb3iU21FQVO9A==", "dev": true, "requires": { - "@sinonjs/formatio": "^2.0.0", - "diff": "^3.5.0", - "lodash.get": "^4.4.2", - "lolex": "^2.4.2", - "nise": "^1.3.3", - "supports-color": "^5.4.0", - "type-detect": "^4.0.8" + "@sinonjs/commons": "^1.7.2", + "@sinonjs/fake-timers": "^6.0.1", + "@sinonjs/formatio": "^5.0.1", + "@sinonjs/samsam": "^5.0.3", + "diff": "^4.0.2", + "nise": "^4.0.1", + "supports-color": "^7.1.0" }, "dependencies": { - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, @@ -7204,7 +7201,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -7756,7 +7753,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8181,7 +8178,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8397,13 +8394,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8417,7 +8414,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8550,7 +8547,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -8594,7 +8591,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { diff --git a/package.json b/package.json index 8c225c60a0..7de0a6d25f 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "request-promise": "^4.2.2", "rimraf": "^2.5.2", "shelljs": "^0.8.4", - "sinon": "^5.0.7", + "sinon": "^9.0.2", "ts-node": "^7.0.1", "tslint": "^5.11.0", "tslint-immutable": "^4.9.0", From 858af64dc3afb0f3b99a47d822138a2d1c6aa46e Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 30 Jul 2020 13:07:48 +0100 Subject: [PATCH 112/147] Improve coverage threshold --- .nycrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.nycrc b/.nycrc index 2c14e11a79..25c38c14ad 100644 --- a/.nycrc +++ b/.nycrc @@ -1,9 +1,9 @@ { "check-coverage": true, - "lines": 93.53, - "functions": 89.63, - "branches": 88.57, - "statements": 93.34, + "lines": 96.81, + "functions": 93.80, + "branches": 92.63, + "statements": 96.80, "include": [ "src/**/*.ts" ], From f0ad1e91948fbc55b943cdf94ed7ca4fab17854c Mon Sep 17 00:00:00 2001 From: "haruyama.makoto" Date: Fri, 31 Jul 2020 16:36:56 +0900 Subject: [PATCH 113/147] feat: Add decimalFullWidth numbering type --- .../document/body/section-properties/page-number/page-number.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/file/document/body/section-properties/page-number/page-number.ts b/src/file/document/body/section-properties/page-number/page-number.ts index d876c265af..b6bd5a6e86 100644 --- a/src/file/document/body/section-properties/page-number/page-number.ts +++ b/src/file/document/body/section-properties/page-number/page-number.ts @@ -14,6 +14,7 @@ export enum PageNumberFormat { ORDINAL_TEXT = "ordinalText", UPPER_LETTER = "upperLetter", UPPER_ROMAN = "upperRoman", + DECIMAL_FULL_WIDTH = "decimalFullWidth", } export interface IPageNumberTypeAttributes { From 61cbee829deea91be4cf6cc837b4997e362f6cf2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2020 09:06:34 +0000 Subject: [PATCH 114/147] build(deps-dev): bump ts-node from 7.0.1 to 8.10.2 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 7.0.1 to 8.10.2. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v7.0.1...v8.10.2) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 59 +++++++++++++++++++++++++++++------------------ package.json | 2 +- 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 644d69b255..9337f6788f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -638,6 +638,12 @@ "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", "dev": true }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -686,12 +692,6 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -4818,9 +4818,9 @@ } }, "make-error": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", - "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, "map-age-cleaner": { @@ -7497,19 +7497,34 @@ "dev": true }, "ts-node": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", - "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", "dev": true, "requires": { - "arrify": "^1.0.0", - "buffer-from": "^1.1.0", - "diff": "^3.1.0", + "arg": "^4.1.0", + "diff": "^4.0.1", "make-error": "^1.1.1", - "minimist": "^1.2.0", - "mkdirp": "^0.5.1", - "source-map-support": "^0.5.6", - "yn": "^2.0.0" + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + } } }, "tslib": { @@ -8600,9 +8615,9 @@ } }, "yn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", - "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true } } diff --git a/package.json b/package.json index 7de0a6d25f..adec66a7b5 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "rimraf": "^2.5.2", "shelljs": "^0.8.4", "sinon": "^9.0.2", - "ts-node": "^7.0.1", + "ts-node": "^8.10.2", "tslint": "^5.11.0", "tslint-immutable": "^4.9.0", "typedoc": "^0.16.11", From 827c46cf4708659c2dfd101027a886810f3770fd Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2020 09:08:10 +0000 Subject: [PATCH 115/147] build(deps-dev): bump nyc from 14.1.1 to 15.1.0 Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.1.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.1.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 1275 ++++++++++++++++++++++++++++++--------------- package.json | 2 +- 2 files changed, 852 insertions(+), 425 deletions(-) diff --git a/package-lock.json b/package-lock.json index 644d69b255..53ff79d986 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,15 +13,111 @@ "@babel/highlight": "^7.0.0" } }, - "@babel/generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.6.4.tgz", - "integrity": "sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w==", + "@babel/core": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.0.tgz", + "integrity": "sha512-mkLq8nwaXmDtFmRkQ8ED/eA2CnVw4zr7dCztKalZXBvdK5EeNUAesrrwUqjQEzFgomJssayzB0aqlOsP1vGLqg==", "dev": true, "requires": { - "@babel/types": "^7.6.3", + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.11.0", + "@babel/helper-module-transforms": "^7.11.0", + "@babel/helpers": "^7.10.4", + "@babel/parser": "^7.11.0", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.11.0", + "@babel/types": "^7.11.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "json5": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.0.tgz", + "integrity": "sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ==", + "dev": true, + "requires": { + "@babel/types": "^7.11.0", "jsesc": "^2.5.1", - "lodash": "^4.17.13", "source-map": "^0.5.0" }, "dependencies": { @@ -40,32 +136,113 @@ } }, "@babel/helper-function-name": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", - "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", + "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-get-function-arity": "^7.10.4", + "@babel/template": "^7.10.4", + "@babel/types": "^7.10.4" } }, "@babel/helper-get-function-arity": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", - "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", + "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", "dev": true, "requires": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.10.4" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz", + "integrity": "sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q==", + "dev": true, + "requires": { + "@babel/types": "^7.11.0" + } + }, + "@babel/helper-module-imports": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz", + "integrity": "sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==", + "dev": true, + "requires": { + "@babel/types": "^7.10.4" + } + }, + "@babel/helper-module-transforms": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz", + "integrity": "sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.10.4", + "@babel/helper-replace-supers": "^7.10.4", + "@babel/helper-simple-access": "^7.10.4", + "@babel/helper-split-export-declaration": "^7.11.0", + "@babel/template": "^7.10.4", + "@babel/types": "^7.11.0", + "lodash": "^4.17.19" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz", + "integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==", + "dev": true, + "requires": { + "@babel/types": "^7.10.4" + } + }, + "@babel/helper-replace-supers": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz", + "integrity": "sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.10.4", + "@babel/helper-optimise-call-expression": "^7.10.4", + "@babel/traverse": "^7.10.4", + "@babel/types": "^7.10.4" + } + }, + "@babel/helper-simple-access": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz", + "integrity": "sha512-0fMy72ej/VEvF8ULmX6yb5MtHG4uH4Dbd6I/aHDb/JVg0bbivwt9Wg+h3uMvX+QSFtwr5MeItvazbrc4jtRAXw==", + "dev": true, + "requires": { + "@babel/template": "^7.10.4", + "@babel/types": "^7.10.4" } }, "@babel/helper-split-export-declaration": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", - "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", + "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", "dev": true, "requires": { - "@babel/types": "^7.4.4" + "@babel/types": "^7.11.0" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, + "@babel/helpers": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.10.4.tgz", + "integrity": "sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA==", + "dev": true, + "requires": { + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.10.4", + "@babel/types": "^7.10.4" } }, "@babel/highlight": { @@ -88,46 +265,85 @@ } }, "@babel/parser": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.4.tgz", - "integrity": "sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.0.tgz", + "integrity": "sha512-qvRvi4oI8xii8NllyEc4MDJjuZiNaRzyb7Y7lup1NqJV8TZHF4O27CcP+72WPn/k1zkgJ6WJfnIbk4jTsVAZHw==", "dev": true }, "@babel/template": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.6.0.tgz", - "integrity": "sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", + "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", "dev": true, "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.6.0", - "@babel/types": "^7.6.0" - } - }, - "@babel/traverse": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.6.3.tgz", - "integrity": "sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.6.3", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.6.3", - "@babel/types": "^7.6.3", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" + "@babel/code-frame": "^7.10.4", + "@babel/parser": "^7.10.4", + "@babel/types": "^7.10.4" }, "dependencies": { "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", "dev": true, "requires": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.10.4" + } + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + } + } + }, + "@babel/traverse": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.0.tgz", + "integrity": "sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.11.0", + "@babel/helper-function-name": "^7.10.4", + "@babel/helper-split-export-declaration": "^7.11.0", + "@babel/parser": "^7.11.0", + "@babel/types": "^7.11.0", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.19" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" } }, "debug": { @@ -145,6 +361,12 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -154,13 +376,13 @@ } }, "@babel/types": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.3.tgz", - "integrity": "sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", + "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", "dev": true, "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.13", + "@babel/helper-validator-identifier": "^7.10.4", + "lodash": "^4.17.19", "to-fast-properties": "^2.0.0" }, "dependencies": { @@ -172,6 +394,67 @@ } } }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } + } + }, + "@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "dev": true + }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -272,6 +555,12 @@ "integrity": "sha1-wRzSgX06QBt7oPWkIPNcVhObHB4=", "dev": true }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, "@types/jszip": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.4.1.tgz", @@ -436,6 +725,16 @@ } } }, + "aggregate-error": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", + "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -624,12 +923,12 @@ } }, "append-transform": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-1.0.0.tgz", - "integrity": "sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", "dev": true, "requires": { - "default-require-extensions": "^2.0.0" + "default-require-extensions": "^3.0.0" } }, "archy": { @@ -1317,32 +1616,28 @@ } }, "caching-transform": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-3.0.2.tgz", - "integrity": "sha512-Mtgcv3lh3U0zRii/6qVgQODdPA4G3zhG+jtbCWj39RXuUFTMzH0vcdMtaJS1jPowd+It2Pqr6y3NJMQqOqCE2w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", "dev": true, "requires": { - "hasha": "^3.0.0", - "make-dir": "^2.0.0", - "package-hash": "^3.0.0", - "write-file-atomic": "^2.4.2" + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" }, "dependencies": { - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true } } }, @@ -1466,6 +1761,12 @@ } } }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "cli-boxes": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", @@ -1880,18 +2181,18 @@ "dev": true }, "default-require-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz", - "integrity": "sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", + "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", "dev": true, "requires": { - "strip-bom": "^3.0.0" + "strip-bom": "^4.0.0" }, "dependencies": { "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true } } @@ -2775,32 +3076,14 @@ } }, "find-cache-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", - "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", + "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", "dev": true, "requires": { "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - }, - "dependencies": { - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - } + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" } }, "find-up": { @@ -2829,23 +3112,54 @@ } }, "foreground-child": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", - "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", "dev": true, "requires": { - "cross-spawn": "^4", - "signal-exit": "^3.0.0" + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" }, "dependencies": { "cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" } } } @@ -2882,6 +3196,12 @@ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", "dev": true }, + "fromentries": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.2.1.tgz", + "integrity": "sha512-Xu2Qh8yqYuDhQGOhD5iJGninErSfI9A3FrriD3tjUgV5VbJFeH8vfgZ9HnC6jWN80QDVNQK5vmxRAmEAp7Mevw==", + "dev": true + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -3513,12 +3833,24 @@ } } }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true + }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, "get-port": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", @@ -3832,12 +4164,27 @@ } }, "hasha": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-3.0.0.tgz", - "integrity": "sha1-UqMvq4Vp1BymmmH/GiFPjrfIvTk=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.0.tgz", + "integrity": "sha512-2W+jKdQbAdSIrggA8Q35Br8qKadTrqCTC8+XZvBWepKDK6m9XkX6Iz1a2yh2KP01kzAR/dpuMeUnocoLYDcskw==", "dev": true, "requires": { - "is-stream": "^1.0.1" + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + }, + "dependencies": { + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } } }, "he": { @@ -3869,6 +4216,12 @@ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", @@ -3934,6 +4287,12 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -4274,12 +4633,12 @@ "dev": true }, "istanbul-lib-hook": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-2.0.7.tgz", - "integrity": "sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", "dev": true, "requires": { - "append-transform": "^1.0.0" + "append-transform": "^2.0.0" } }, "istanbul-lib-instrument": { @@ -4297,60 +4656,127 @@ "semver": "^5.3.0" } }, - "istanbul-lib-report": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", - "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "istanbul-lib-processinfo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", + "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", "dev": true, "requires": { - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "supports-color": "^6.1.0" + "archy": "^1.0.0", + "cross-spawn": "^7.0.0", + "istanbul-lib-coverage": "^3.0.0-alpha.1", + "make-dir": "^3.0.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^3.3.3" }, "dependencies": { - "istanbul-lib-coverage": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", - "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", - "dev": true - }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "istanbul-lib-coverage": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", "dev": true }, "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } } } }, "istanbul-lib-source-maps": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", - "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", + "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", "dev": true, "requires": { "debug": "^4.1.1", - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "rimraf": "^2.6.3", + "istanbul-lib-coverage": "^3.0.0", "source-map": "^0.6.1" }, "dependencies": { @@ -4364,42 +4790,27 @@ } }, "istanbul-lib-coverage": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", - "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", "dev": true }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true } } }, "istanbul-reports": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz", - "integrity": "sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", + "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", "dev": true, "requires": { - "handlebars": "^4.1.2" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" } }, "jquery": { @@ -4448,12 +4859,6 @@ "integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==", "dev": true }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -4905,15 +5310,6 @@ "readable-stream": "^2.0.1" } }, - "merge-source-map": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", - "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - } - }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -5275,6 +5671,15 @@ } } }, + "node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", + "dev": true, + "requires": { + "process-on-spawn": "^1.0.0" + } + }, "nodent-runtime": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/nodent-runtime/-/nodent-runtime-3.2.1.tgz", @@ -5324,44 +5729,56 @@ "dev": true }, "nyc": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-14.1.1.tgz", - "integrity": "sha512-OI0vm6ZGUnoGZv/tLdZ2esSVzDwUC88SNs+6JoSOMVxA+gKMB8Tk7jBwgemLx4O40lhhvZCVw1C+OYLOBOPXWw==", + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", "dev": true, "requires": { - "archy": "^1.0.0", - "caching-transform": "^3.0.2", - "convert-source-map": "^1.6.0", - "cp-file": "^6.2.0", - "find-cache-dir": "^2.1.0", - "find-up": "^3.0.0", - "foreground-child": "^1.5.6", - "glob": "^7.1.3", - "istanbul-lib-coverage": "^2.0.5", - "istanbul-lib-hook": "^2.0.7", - "istanbul-lib-instrument": "^3.3.0", - "istanbul-lib-report": "^2.0.8", - "istanbul-lib-source-maps": "^3.0.6", - "istanbul-reports": "^2.2.4", - "js-yaml": "^3.13.1", - "make-dir": "^2.1.0", - "merge-source-map": "^1.1.0", - "resolve-from": "^4.0.0", - "rimraf": "^2.6.3", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", "signal-exit": "^3.0.2", - "spawn-wrap": "^1.4.2", - "test-exclude": "^5.2.3", - "uuid": "^3.3.2", - "yargs": "^13.2.2", - "yargs-parser": "^13.0.0" + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -5369,36 +5786,54 @@ "dev": true }, "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", "dev": true, "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" } }, - "cp-file": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-6.2.0.tgz", - "integrity": "sha512-fmvV4caBnofhPe8kOcitBwSn2f39QLjnAnGq3gO9dfd75mUytzKNZB1hde6QHunW2Rt+OwuBOMc3i1tNElbszA==", + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "make-dir": "^2.0.0", - "nested-error-stacks": "^2.0.0", - "pify": "^4.0.1", - "safe-buffer": "^5.0.1" + "color-name": "~1.1.4" } }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" } }, "get-caller-file": { @@ -5407,49 +5842,52 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, "istanbul-lib-coverage": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", - "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", "dev": true }, "istanbul-lib-instrument": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", - "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", + "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", "dev": true, "requires": { - "@babel/generator": "^7.4.0", - "@babel/parser": "^7.4.3", - "@babel/template": "^7.4.0", - "@babel/traverse": "^7.4.3", - "@babel/types": "^7.4.0", - "istanbul-lib-coverage": "^2.0.5", - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" } }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" + "p-locate": "^4.1.0" } }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, "require-main-filename": { @@ -5458,24 +5896,39 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "glob": "^7.1.3" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" } }, "which-module": { @@ -5485,14 +5938,14 @@ "dev": true }, "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dev": true, "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" } }, "y18n": { @@ -5502,27 +5955,28 @@ "dev": true }, "yargs": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", - "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", "dev": true, "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", - "string-width": "^3.0.0", + "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.1.1" + "yargs-parser": "^18.1.2" } }, "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -5647,12 +6101,6 @@ "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", "dev": true }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, "os-locale": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", @@ -5719,6 +6167,15 @@ "p-limit": "^2.0.0" } }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, "p-timeout": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", @@ -5735,13 +6192,13 @@ "dev": true }, "package-hash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-3.0.0.tgz", - "integrity": "sha512-lOtmukMDVvtkL84rJHI7dpTYq+0rli8N2wlnqUcBuDWCfVhRUfOmnR9SsoHFMLpACvEV60dX7rd0rFaYDZI+FA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", "dev": true, "requires": { "graceful-fs": "^4.1.15", - "hasha": "^3.0.0", + "hasha": "^5.0.0", "lodash.flattendeep": "^4.4.0", "release-zalgo": "^1.0.0" } @@ -5955,22 +6412,47 @@ } }, "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "requires": { - "find-up": "^3.0.0" + "find-up": "^4.0.0" }, "dependencies": { "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true } } }, @@ -6035,6 +6517,15 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, + "process-on-spawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", + "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", + "dev": true, + "requires": { + "fromentries": "^1.2.0" + } + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -6552,9 +7043,9 @@ } }, "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, "resolve-pathname": { @@ -7014,23 +7505,32 @@ } }, "spawn-wrap": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.3.tgz", - "integrity": "sha512-IgB8md0QW/+tWqcavuFgKYR/qIRvJkRLPJDFaoXtLLUaVcCDK0+HeFTkmQHj3eprcYhc+gOl0aEA1w7qZlYezw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", "dev": true, "requires": { - "foreground-child": "^1.5.6", - "mkdirp": "^0.5.0", - "os-homedir": "^1.0.1", - "rimraf": "^2.6.2", + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", "signal-exit": "^3.0.2", - "which": "^1.3.0" + "which": "^2.0.1" }, "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -7286,96 +7786,14 @@ } }, "test-exclude": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", - "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, "requires": { - "glob": "^7.1.3", - "minimatch": "^3.0.4", - "read-pkg-up": "^4.0.0", - "require-main-filename": "^2.0.0" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - } - }, - "read-pkg-up": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", - "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", - "dev": true, - "requires": { - "find-up": "^3.0.0", - "read-pkg": "^3.0.0" - } - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - } + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" } }, "timers-browserify": { @@ -7605,6 +8023,15 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, "typedoc": { "version": "0.16.11", "resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.16.11.tgz", diff --git a/package.json b/package.json index 7de0a6d25f..6eff0f5b9a 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "jszip": "^3.1.5", "mocha": "^5.2.0", "mocha-webpack": "^1.0.1", - "nyc": "^14.1.1", + "nyc": "^15.1.0", "pre-commit": "^1.2.2", "prettier": "^1.15.2", "prompt": "^1.0.0", From f955a189361f724f6387f23c50098ecea6a1d3ce Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2020 01:59:37 +0000 Subject: [PATCH 116/147] build(deps-dev): bump rimraf from 2.6.3 to 3.0.2 Bumps [rimraf](https://github.com/isaacs/rimraf) from 2.6.3 to 3.0.2. - [Release notes](https://github.com/isaacs/rimraf/releases) - [Changelog](https://github.com/isaacs/rimraf/blob/master/CHANGELOG.md) - [Commits](https://github.com/isaacs/rimraf/compare/v2.6.3...v3.0.2) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 17 ++++++++++++++--- package.json | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 53ff79d986..2f74bf000b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7091,9 +7091,9 @@ } }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { "glob": "^7.1.3" @@ -8379,6 +8379,17 @@ "mkdirp": "0.x.x", "ncp": "1.0.x", "rimraf": "2.x.x" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "utils-merge": { diff --git a/package.json b/package.json index 6eff0f5b9a..834d10093d 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "replace-in-file": "^3.1.0", "request": "^2.88.0", "request-promise": "^4.2.2", - "rimraf": "^2.5.2", + "rimraf": "^3.0.2", "shelljs": "^0.8.4", "sinon": "^9.0.2", "ts-node": "^7.0.1", From 8b78f2d2006ba1fe82b33cd663bc27f670e55a89 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 1 Aug 2020 17:28:11 +0100 Subject: [PATCH 117/147] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be4f711bfb..a772332568 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.2.2", + "version": "5.3.0", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From 4f6a9f734c6f9f0c1e9a53756bb5bcdcc0fbb416 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 1 Aug 2020 17:40:57 +0100 Subject: [PATCH 118/147] Update prettier --- package-lock.json | 46 ++++++++++++------------- package.json | 2 +- src/export/packer/next-compiler.spec.ts | 4 +-- src/export/packer/packer.spec.ts | 4 +-- src/file/media/media.ts | 9 +---- src/file/paragraph/paragraph.spec.ts | 40 +++++---------------- src/file/table/table.spec.ts | 28 ++++----------- 7 files changed, 43 insertions(+), 90 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0cf0860d28..878af22c12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.2.2", + "version": "5.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1029,7 +1029,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1058,7 +1058,7 @@ }, "async": { "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -1132,7 +1132,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1881,7 +1881,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -3015,7 +3015,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4843,7 +4843,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -5098,7 +5098,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -5430,7 +5430,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -6103,7 +6103,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -6315,7 +6315,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -6392,7 +6392,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -6492,9 +6492,9 @@ "dev": true }, "prettier": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", - "integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", "dev": true }, "prismjs": { @@ -7701,7 +7701,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -8195,7 +8195,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8620,7 +8620,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8836,13 +8836,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8856,7 +8856,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -8989,7 +8989,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -9033,7 +9033,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { diff --git a/package.json b/package.json index a772332568..f00c621bad 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "mocha-webpack": "^1.0.1", "nyc": "^15.1.0", "pre-commit": "^1.2.2", - "prettier": "^1.15.2", + "prettier": "^2.0.5", "prompt": "^1.0.0", "replace-in-file": "^3.1.0", "request": "^2.88.0", diff --git a/src/export/packer/next-compiler.spec.ts b/src/export/packer/next-compiler.spec.ts index 7c48569793..7c9bcda904 100644 --- a/src/export/packer/next-compiler.spec.ts +++ b/src/export/packer/next-compiler.spec.ts @@ -16,7 +16,7 @@ describe("Compiler", () => { }); describe("#compile()", () => { - it("should pack all the content", async function() { + it("should pack all the content", async function () { this.timeout(99999999); const zipFile = compiler.compile(file); const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name); @@ -35,7 +35,7 @@ describe("Compiler", () => { expect(fileNames).to.include("_rels/.rels"); }); - it("should pack all additional headers and footers", async function() { + it("should pack all additional headers and footers", async function () { file.addSection({ headers: { default: new Header(), diff --git a/src/export/packer/packer.spec.ts b/src/export/packer/packer.spec.ts index 8235649f15..18ae459b49 100644 --- a/src/export/packer/packer.spec.ts +++ b/src/export/packer/packer.spec.ts @@ -36,7 +36,7 @@ describe("Packer", () => { }); describe("#toBuffer()", () => { - it("should create a standard docx file", async function() { + it("should create a standard docx file", async function () { this.timeout(99999999); const buffer = await Packer.toBuffer(file); @@ -61,7 +61,7 @@ describe("Packer", () => { }); describe("#toBase64String()", () => { - it("should create a standard docx file", async function() { + it("should create a standard docx file", async function () { this.timeout(99999999); const str = await Packer.toBase64String(file); diff --git a/src/file/media/media.ts b/src/file/media/media.ts index 0d062c6d64..71e7c6f60e 100644 --- a/src/file/media/media.ts +++ b/src/file/media/media.ts @@ -21,14 +21,7 @@ export class Media { private static generateId(): string { // https://gist.github.com/6174/6062387 - return ( - Math.random() - .toString(36) - .substring(2, 15) + - Math.random() - .toString(36) - .substring(2, 15) - ); + return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); } private readonly map: Map; diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index cdbe99c7d8..04cc8af8e4 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -542,14 +542,8 @@ describe("Paragraph", () => { }, }); const tree = new Formatter().format(paragraph); - expect(tree) - .to.have.property("w:p") - .which.is.an("array") - .which.has.length.at.least(1); - expect(tree["w:p"][0]) - .to.have.property("w:pPr") - .which.is.an("array") - .which.has.length.at.least(1); + expect(tree).to.have.property("w:p").which.is.an("array").which.has.length.at.least(1); + expect(tree["w:p"][0]).to.have.property("w:pPr").which.is.an("array").which.has.length.at.least(1); expect(tree["w:p"][0]["w:pPr"][0]).to.deep.equal({ "w:pStyle": { _attr: { "w:val": "ListParagraph" } }, }); @@ -562,14 +556,8 @@ describe("Paragraph", () => { }, }); const tree = new Formatter().format(paragraph); - expect(tree) - .to.have.property("w:p") - .which.is.an("array") - .which.has.length.at.least(1); - expect(tree["w:p"][0]) - .to.have.property("w:pPr") - .which.is.an("array") - .which.has.length.at.least(1); + expect(tree).to.have.property("w:p").which.is.an("array").which.has.length.at.least(1); + expect(tree["w:p"][0]).to.have.property("w:pPr").which.is.an("array").which.has.length.at.least(1); expect(tree["w:p"][0]["w:pPr"][0]).to.deep.equal({ "w:pStyle": { _attr: { "w:val": "ListParagraph" } }, }); @@ -582,14 +570,8 @@ describe("Paragraph", () => { }, }); const tree = new Formatter().format(paragraph); - expect(tree) - .to.have.property("w:p") - .which.is.an("array") - .which.has.length.at.least(1); - expect(tree["w:p"][0]) - .to.have.property("w:pPr") - .which.is.an("array") - .which.has.length.at.least(2); + expect(tree).to.have.property("w:p").which.is.an("array").which.has.length.at.least(1); + expect(tree["w:p"][0]).to.have.property("w:pPr").which.is.an("array").which.has.length.at.least(2); expect(tree["w:p"][0]["w:pPr"][1]).to.deep.equal({ "w:numPr": [{ "w:ilvl": { _attr: { "w:val": 1 } } }, { "w:numId": { _attr: { "w:val": 1 } } }], }); @@ -605,14 +587,8 @@ describe("Paragraph", () => { }, }); const tree = new Formatter().format(paragraph); - expect(tree) - .to.have.property("w:p") - .which.is.an("array") - .which.has.length.at.least(1); - expect(tree["w:p"][0]) - .to.have.property("w:pPr") - .which.is.an("array") - .which.has.length.at.least(1); + expect(tree).to.have.property("w:p").which.is.an("array").which.has.length.at.least(1); + expect(tree["w:p"][0]).to.have.property("w:pPr").which.is.an("array").which.has.length.at.least(1); expect(tree["w:p"][0]["w:pPr"][0]).to.deep.equal({ "w:pStyle": { _attr: { "w:val": "ListParagraph" } }, }); diff --git a/src/file/table/table.spec.ts b/src/file/table/table.spec.ts index 49eb7a3f46..3165330047 100644 --- a/src/file/table/table.spec.ts +++ b/src/file/table/table.spec.ts @@ -268,10 +268,7 @@ describe("Table", () => { layout: TableLayoutType.FIXED, }); const tree = new Formatter().format(table); - expect(tree) - .to.have.property("w:tbl") - .which.is.an("array") - .with.has.length.at.least(1); + expect(tree).to.have.property("w:tbl").which.is.an("array").with.has.length.at.least(1); expect(tree["w:tbl"][0]).to.deep.equal({ "w:tblPr": [DEFAULT_TABLE_PROPERTIES, BORDERS, WIDTHS, { "w:tblLayout": { _attr: { "w:type": "fixed" } } }], }); @@ -291,10 +288,7 @@ describe("Table", () => { alignment: AlignmentType.CENTER, }); const tree = new Formatter().format(table); - expect(tree) - .to.have.property("w:tbl") - .which.is.an("array") - .with.has.length.at.least(1); + expect(tree).to.have.property("w:tbl").which.is.an("array").with.has.length.at.least(1); expect(tree["w:tbl"][0]).to.deep.equal({ "w:tblPr": [DEFAULT_TABLE_PROPERTIES, BORDERS, WIDTHS, { "w:jc": { _attr: { "w:val": "center" } } }], }); @@ -318,10 +312,7 @@ describe("Table", () => { layout: TableLayoutType.FIXED, }); const tree = new Formatter().format(table); - expect(tree) - .to.have.property("w:tbl") - .which.is.an("array") - .with.has.length.at.least(1); + expect(tree).to.have.property("w:tbl").which.is.an("array").with.has.length.at.least(1); expect(tree["w:tbl"][0]).to.deep.equal({ "w:tblPr": [ DEFAULT_TABLE_PROPERTIES, @@ -355,14 +346,10 @@ describe("Table", () => { ], }); const tree = new Formatter().format(table); - expect(tree) - .to.have.property("w:tbl") - .which.is.an("array"); + expect(tree).to.have.property("w:tbl").which.is.an("array"); const row = tree["w:tbl"].find((x) => x["w:tr"]); expect(row).not.to.be.undefined; - expect(row["w:tr"]) - .to.be.an("array") - .which.has.length.at.least(1); + expect(row["w:tr"]).to.be.an("array").which.has.length.at.least(1); expect(row["w:tr"].find((x) => x["w:tc"])).to.deep.equal({ "w:tc": [ { @@ -487,10 +474,7 @@ describe("Table", () => { }, }); const tree = new Formatter().format(table); - expect(tree) - .to.have.property("w:tbl") - .which.is.an("array") - .with.has.length.at.least(1); + expect(tree).to.have.property("w:tbl").which.is.an("array").with.has.length.at.least(1); expect(tree["w:tbl"][0]).to.deep.equal({ "w:tblPr": [ DEFAULT_TABLE_PROPERTIES, From 69adbbc1c16565577ac42b0965ca477b2cd228f3 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 1 Aug 2020 17:49:25 +0100 Subject: [PATCH 119/147] Bump node version --- .nvmrc | 2 +- .travis.yml | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.nvmrc b/.nvmrc index 469d080845..e338b86593 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v8 \ No newline at end of file +v10 diff --git a/.travis.yml b/.travis.yml index d27f452f86..3d4166c482 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - 9 + - 10 install: - npm install - npm install -g codecov diff --git a/package.json b/package.json index f00c621bad..9e3756fcd6 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,6 @@ "webpack": "^3.10.0" }, "engines": { - "node": ">=8" + "node": ">=10" } } From d18cfbc26f78d7f6a07f0b3e0e3c27516e66d610 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 1 Aug 2020 17:58:16 +0100 Subject: [PATCH 120/147] Update tslint to v6 --- package-lock.json | 57 +++++++++++++++++------- package.json | 2 +- src/file/file.ts | 2 +- src/file/header.ts | 2 +- src/file/numbering/numbering.ts | 4 +- src/file/paragraph/paragraph.ts | 13 ++++-- src/file/paragraph/properties.ts | 4 +- src/file/paragraph/run/run.ts | 2 +- src/file/styles/styles.ts | 2 +- src/file/table/table-cell/table-cell.ts | 2 +- src/file/xml-components/xml-component.ts | 2 +- src/import-dotx/import-dotx.ts | 8 ++-- 12 files changed, 65 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index 878af22c12..942a9ddcf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,12 +5,12 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", - "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", "dev": true, "requires": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.10.4" } }, "@babel/core": { @@ -246,13 +246,13 @@ } }, "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", "dev": true, "requires": { + "@babel/helper-validator-identifier": "^7.10.4", "chalk": "^2.0.0", - "esutils": "^2.0.2", "js-tokens": "^4.0.0" }, "dependencies": { @@ -7946,30 +7946,53 @@ } }, "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", "dev": true }, "tslint": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.18.0.tgz", - "integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", + "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", - "diff": "^3.2.0", + "diff": "^4.0.1", "glob": "^7.1.1", "js-yaml": "^3.13.1", "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", + "mkdirp": "^0.5.3", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.8.0", + "tslib": "^1.13.0", "tsutils": "^2.29.0" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } } }, "tslint-immutable": { diff --git a/package.json b/package.json index 9e3756fcd6..32f24f72f8 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "shelljs": "^0.8.4", "sinon": "^9.0.2", "ts-node": "^8.10.2", - "tslint": "^5.11.0", + "tslint": "^6.1.3", "tslint-immutable": "^4.9.0", "typedoc": "^0.16.11", "typescript": "2.9.2", diff --git a/src/file/file.ts b/src/file/file.ts index 59af9fa7f7..270714ed17 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -41,7 +41,7 @@ export interface ISectionOptions { readonly size?: IPageSizeAttributes; readonly margins?: IPageMarginAttributes; readonly properties?: SectionPropertiesOptions; - readonly children: Array; + readonly children: (Paragraph | Table | TableOfContents | HyperlinkRef)[]; } export class File { diff --git a/src/file/header.ts b/src/file/header.ts index 05e227d9f8..5f59ae2bec 100644 --- a/src/file/header.ts +++ b/src/file/header.ts @@ -2,7 +2,7 @@ import { Paragraph } from "./paragraph"; import { Table } from "./table"; export interface IHeaderOptions { - readonly children: Array; + readonly children: (Paragraph | Table)[]; } export class Header { diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index b8747991d0..a02caf6bef 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -8,10 +8,10 @@ import { ILevelsOptions } from "./level"; import { ConcreteNumbering } from "./num"; export interface INumberingOptions { - readonly config: Array<{ + readonly config: { readonly levels: ILevelsOptions[]; readonly reference: string; - }>; + }[]; } export class Numbering extends XmlComponent { diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index a593f6f0ab..e1db0ec910 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -10,9 +10,16 @@ import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run export interface IParagraphOptions extends IParagraphPropertiesOptions { readonly text?: string; - readonly children?: Array< - TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef - >; + readonly children?: ( + | TextRun + | PictureRun + | SymbolRun + | Bookmark + | PageBreak + | SequentialIdentifier + | FootnoteReferenceRun + | HyperlinkRef + )[]; } export class Paragraph extends XmlComponent { diff --git a/src/file/paragraph/properties.ts b/src/file/paragraph/properties.ts index 52afbd1dd8..af97e2c684 100644 --- a/src/file/paragraph/properties.ts +++ b/src/file/paragraph/properties.ts @@ -30,11 +30,11 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp readonly heading?: HeadingLevel; readonly bidirectional?: boolean; readonly pageBreakBefore?: boolean; - readonly tabStops?: Array<{ + readonly tabStops?: { readonly position: number | TabStopPosition; readonly type: TabStopType; readonly leader?: LeaderType; - }>; + }[]; readonly style?: string; readonly bullet?: { readonly level: number; diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index 8b5fb0ddd3..bf7903e35e 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -10,7 +10,7 @@ import { IRunPropertiesOptions, RunProperties } from "./properties"; import { Text } from "./run-components/text"; export interface IRunOptions extends IRunPropertiesOptions { - readonly children?: Array; + readonly children?: (Begin | FieldInstruction | Separate | End | PageNumber | FootnoteReferenceRun | string)[]; readonly text?: string; } diff --git a/src/file/styles/styles.ts b/src/file/styles/styles.ts index 064411e419..45efe9f784 100644 --- a/src/file/styles/styles.ts +++ b/src/file/styles/styles.ts @@ -9,7 +9,7 @@ export interface IStylesOptions { readonly initialStyles?: BaseXmlComponent; readonly paragraphStyles?: IParagraphStyleOptions[]; readonly characterStyles?: ICharacterStyleOptions[]; - readonly importedStyles?: Array; + readonly importedStyles?: (XmlComponent | ParagraphStyle | CharacterStyle | ImportedXmlComponent)[]; } export class Styles extends XmlComponent { diff --git a/src/file/table/table-cell/table-cell.ts b/src/file/table/table-cell/table-cell.ts index babd0031ff..6fbd748cf5 100644 --- a/src/file/table/table-cell/table-cell.ts +++ b/src/file/table/table-cell/table-cell.ts @@ -44,7 +44,7 @@ export interface ITableCellOptions { readonly color: string; }; }; - readonly children: Array; + readonly children: (Paragraph | Table)[]; } export class TableCell extends XmlComponent { diff --git a/src/file/xml-components/xml-component.ts b/src/file/xml-components/xml-component.ts index dfe3800b96..b06f73b930 100644 --- a/src/file/xml-components/xml-component.ts +++ b/src/file/xml-components/xml-component.ts @@ -6,7 +6,7 @@ export const EMPTY_OBJECT = Object.seal({}); export abstract class XmlComponent extends BaseXmlComponent { // tslint:disable-next-line:readonly-keyword no-any - protected root: Array; + protected root: (BaseXmlComponent | string | any)[]; constructor(rootKey: string) { super(rootKey); diff --git a/src/import-dotx/import-dotx.ts b/src/import-dotx/import-dotx.ts index 2b1261efe7..d8d5d1190c 100644 --- a/src/import-dotx/import-dotx.ts +++ b/src/import-dotx/import-dotx.ts @@ -17,8 +17,8 @@ const schemeToType = { }; interface IDocumentRefs { - readonly headers: Array<{ readonly id: number; readonly type: HeaderReferenceType }>; - readonly footers: Array<{ readonly id: number; readonly type: FooterReferenceType }>; + readonly headers: { readonly id: number; readonly type: HeaderReferenceType }[]; + readonly footers: { readonly id: number; readonly type: FooterReferenceType }[]; } enum RelationshipType { @@ -99,7 +99,7 @@ export class ImportDotx { return { type: reference.type, footer: wrapper }; }) - .filter((x) => !!x) as Array>; + .filter((x) => !!x) as Promise[]; return Promise.all(result); } @@ -134,7 +134,7 @@ export class ImportDotx { return { type: reference.type, header: wrapper }; }) - .filter((x) => !!x) as Array>; + .filter((x) => !!x) as Promise[]; return Promise.all(result); } From ee435852107593385ed1a9112d76a594cd8ed94d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2020 09:48:31 +0000 Subject: [PATCH 121/147] build(deps-dev): bump @types/mocha from 8.0.0 to 8.0.1 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5174555098..c727674b25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.0.tgz", - "integrity": "sha512-jWeYcTo3sCH/rMgsdYXDTO85GNRyTCII5dayMIu/ZO4zbEot1E3iNGaOwpLReLUHjeNQFkgeNNVYlY4dX6azQQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.1.tgz", + "integrity": "sha512-TBZ6YdX7IZz4U9/mBoB8zCMRN1vXw8QdihRcZxD3I0Cv/r8XF8RggZ8WiXFws4aj5atzRR5hJrYer7g8nXwpnQ==", "dev": true }, "@types/node": { @@ -1029,7 +1029,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1058,7 +1058,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -1132,7 +1132,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1881,7 +1881,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -3015,7 +3015,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4843,7 +4843,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -5430,7 +5430,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -6103,7 +6103,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -6315,7 +6315,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -6392,7 +6392,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7701,7 +7701,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -8218,7 +8218,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8870,13 +8870,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8890,7 +8890,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -9023,7 +9023,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -9067,7 +9067,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 05dda37b710ccdf9b68820f94c988c30c8f36833 Mon Sep 17 00:00:00 2001 From: Jan Marten <546795+LeovR@users.noreply.github.com> Date: Thu, 6 Aug 2020 08:56:02 +0000 Subject: [PATCH 122/147] Fix comment regarding output file name --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 28781012fe..f48a42ecf6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -53,7 +53,7 @@ Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); }); -// Done! A file called 'My First Document.docx' will be in your file system. +// Done! A file called 'My Document.docx' will be in your file system. ```

From 7a48da440b0d2a6d3b9efdf89c0347dfd9730e57 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2020 22:43:32 +0000 Subject: [PATCH 123/147] build(deps): [security] bump prismjs from 1.20.0 to 1.21.0 Bumps [prismjs](https://github.com/PrismJS/prism) from 1.20.0 to 1.21.0. **This update includes a security fix.** - [Release notes](https://github.com/PrismJS/prism/releases) - [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md) - [Commits](https://github.com/PrismJS/prism/compare/v1.20.0...v1.21.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5174555098..a569f2b171 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1029,7 +1029,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1058,7 +1058,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -1132,7 +1132,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1881,7 +1881,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -3015,7 +3015,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4843,7 +4843,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -5430,7 +5430,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -6103,7 +6103,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -6315,7 +6315,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -6392,7 +6392,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -6498,9 +6498,9 @@ "dev": true }, "prismjs": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.20.0.tgz", - "integrity": "sha512-AEDjSrVNkynnw6A+B1DsFkd6AVdTnp+/WoUixFRULlCLZVRZlVQMVWio/16jv7G1FscUxQxOQhWwApgbnxr6kQ==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.21.0.tgz", + "integrity": "sha512-uGdSIu1nk3kej2iZsLyDoJ7e9bnPzIgY0naW/HdknGj61zScaprVEVGHrPoXqI+M9sP0NDnTK2jpkvmldpuqDw==", "dev": true, "requires": { "clipboard": "^2.0.0" @@ -7701,7 +7701,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -8218,7 +8218,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8870,13 +8870,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8890,7 +8890,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -9023,7 +9023,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -9067,7 +9067,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 08f9926e600a2b9f334283949f9eb22fb3a50c9c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2020 08:38:15 +0000 Subject: [PATCH 124/147] build(deps-dev): bump sinon from 9.0.2 to 9.0.3 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.0.2 to 9.0.3. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e544100c5..658a46b4ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -498,9 +498,9 @@ } }, "@sinonjs/samsam": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.0.3.tgz", - "integrity": "sha512-QucHkc2uMJ0pFGjJUDP3F9dq5dx8QIaqISl9QgwLOh6P9yv877uONPGXh/OH/0zmM3tW1JjuJltAZV2l7zU+uQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.1.0.tgz", + "integrity": "sha512-42nyaQOVunX5Pm6GRJobmzbS7iLI+fhERITnETXzzwDZh+TtDr/Au3yAvXVjFmZ4wEUaE4Y3NFZfKv0bV0cbtg==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -7303,17 +7303,17 @@ "dev": true }, "sinon": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.2.tgz", - "integrity": "sha512-0uF8Q/QHkizNUmbK3LRFqx5cpTttEVXudywY9Uwzy8bTfZUhljZ7ARzSxnRHWYWtVTeh4Cw+tTb3iU21FQVO9A==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.3.tgz", + "integrity": "sha512-IKo9MIM111+smz9JGwLmw5U1075n1YXeAq8YeSFlndCLhAL5KGn6bLgu7b/4AYHTV/LcEMcRm2wU2YiL55/6Pg==", "dev": true, "requires": { "@sinonjs/commons": "^1.7.2", "@sinonjs/fake-timers": "^6.0.1", "@sinonjs/formatio": "^5.0.1", - "@sinonjs/samsam": "^5.0.3", + "@sinonjs/samsam": "^5.1.0", "diff": "^4.0.2", - "nise": "^4.0.1", + "nise": "^4.0.4", "supports-color": "^7.1.0" }, "dependencies": { From c91f135c2848b0394aa2cc80d5d8c8ca539a7b76 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2020 08:37:49 +0000 Subject: [PATCH 125/147] build(deps-dev): bump @types/mocha from 8.0.1 to 8.0.2 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.1 to 8.0.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e544100c5..94a8bdd92e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.1.tgz", - "integrity": "sha512-TBZ6YdX7IZz4U9/mBoB8zCMRN1vXw8QdihRcZxD3I0Cv/r8XF8RggZ8WiXFws4aj5atzRR5hJrYer7g8nXwpnQ==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.2.tgz", + "integrity": "sha512-5cv8rmqT3KX9XtWDvSgGYfS4OwrKM2eei90GWLnTYz+AXRiBv5uYcKBjnkQ4katNvfYk3+o2bHGZUsDhdcoUyg==", "dev": true }, "@types/node": { From 8a189161f230b1c1c8acb3ef599dd595cc2a403e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2020 08:28:30 +0000 Subject: [PATCH 126/147] build(deps): [security] bump dot-prop from 4.2.0 to 4.2.1 Bumps [dot-prop](https://github.com/sindresorhus/dot-prop) from 4.2.0 to 4.2.1. **This update includes a security fix.** - [Release notes](https://github.com/sindresorhus/dot-prop/releases) - [Commits](https://github.com/sindresorhus/dot-prop/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index df2c8be0ca..9b967d2e20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2531,9 +2531,9 @@ "dev": true }, "dot-prop": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz", + "integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==", "dev": true, "requires": { "is-obj": "^1.0.0" From dc1f3aebe9bd3559ced112c8bd32d2200a96ff50 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2020 08:29:38 +0000 Subject: [PATCH 127/147] build(deps): bump @types/node from 14.0.27 to 14.6.0 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.0.27 to 14.6.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index df2c8be0ca..8024348871 100644 --- a/package-lock.json +++ b/package-lock.json @@ -582,9 +582,9 @@ "dev": true }, "@types/node": { - "version": "14.0.27", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz", - "integrity": "sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g==" + "version": "14.6.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", + "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" }, "@types/request": { "version": "2.48.5", From 58fae6b201cc838a6566bb67cdfd06074aa11c9e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2020 08:30:15 +0000 Subject: [PATCH 128/147] build(deps-dev): bump @types/mocha from 8.0.2 to 8.0.3 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.2 to 8.0.3. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index df2c8be0ca..158af12419 100644 --- a/package-lock.json +++ b/package-lock.json @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.2.tgz", - "integrity": "sha512-5cv8rmqT3KX9XtWDvSgGYfS4OwrKM2eei90GWLnTYz+AXRiBv5uYcKBjnkQ4katNvfYk3+o2bHGZUsDhdcoUyg==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.3.tgz", + "integrity": "sha512-vyxR57nv8NfcU0GZu8EUXZLTbCMupIUwy95LJ6lllN+JRPG25CwMHoB1q5xKh8YKhQnHYRAn4yW2yuHbf/5xgg==", "dev": true }, "@types/node": { From 1285304f974a356729b0686d253452c0e8dd3809 Mon Sep 17 00:00:00 2001 From: Raymond Berger Date: Wed, 19 Aug 2020 10:54:27 -1000 Subject: [PATCH 129/147] remove broken examples link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9dd52e1a94..84469fa454 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Please refer to the [documentation at https://docx.js.org/](https://docx.js.org/ # Examples -Check the `examples` section in the [documentation](https://docx.js.org/#/examples) and the [demo folder](https://github.com/dolanmiu/docx/tree/master/demo) for examples. +Check the [demo folder](https://github.com/dolanmiu/docx/tree/master/demo) for examples. # Contributing From 364ce6d85664a8b7a149aed258fea97386fa2e41 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 18:35:48 +0000 Subject: [PATCH 130/147] build(deps-dev): bump ts-node from 8.10.2 to 9.0.0 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.10.2 to 9.0.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v8.10.2...v9.0.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 841f8d4763..b917352c3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7915,9 +7915,9 @@ "dev": true }, "ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", + "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", "dev": true, "requires": { "arg": "^4.1.0", diff --git a/package.json b/package.json index 9edda454f0..51e1b246c3 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "rimraf": "^3.0.2", "shelljs": "^0.8.4", "sinon": "^9.0.2", - "ts-node": "^8.10.2", + "ts-node": "^9.0.0", "tslint": "^6.1.3", "tslint-immutable": "^4.9.0", "typedoc": "^0.16.11", From 491c7abd1cf6ba0fe1f1439100f713a91b6227a9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 18:36:24 +0000 Subject: [PATCH 131/147] build(deps-dev): bump prettier from 2.0.5 to 2.1.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.0.5 to 2.1.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.0.5...2.1.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 841f8d4763..182c107308 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6492,9 +6492,9 @@ "dev": true }, "prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.0.tgz", + "integrity": "sha512-lz28cCbA1cDFHVuY8vvj6QuqOwIpyIfPUYkSl8AZ/vxH8qBXMMjE2knfLHCrZCmUsK/H1bg1P0tOo0dJkTJHvw==", "dev": true }, "prismjs": { From a576098639de279d24f5d824ece63121ef866840 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 19:36:39 +0000 Subject: [PATCH 132/147] build(deps-dev): bump prettier from 2.1.0 to 2.1.1 Bumps [prettier](https://github.com/prettier/prettier) from 2.1.0 to 2.1.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.0...2.1.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb7f22ddb9..f5f162c321 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6492,9 +6492,9 @@ "dev": true }, "prettier": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.0.tgz", - "integrity": "sha512-lz28cCbA1cDFHVuY8vvj6QuqOwIpyIfPUYkSl8AZ/vxH8qBXMMjE2knfLHCrZCmUsK/H1bg1P0tOo0dJkTJHvw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz", + "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==", "dev": true }, "prismjs": { From 37251c84f8ae5849573457db2a5dd03415c8f62f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 19:37:11 +0000 Subject: [PATCH 133/147] build(deps): bump @types/node from 14.6.0 to 14.6.2 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.6.0 to 14.6.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb7f22ddb9..3c691f6b58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -582,9 +582,9 @@ "dev": true }, "@types/node": { - "version": "14.6.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", - "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" + "version": "14.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.2.tgz", + "integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A==" }, "@types/request": { "version": "2.48.5", From e196d9d917c621c8a9622b2033f6b23b65007f21 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 5 Sep 2020 18:40:40 +0100 Subject: [PATCH 134/147] Add Clippy the mascot --- docs/clippy.png | Bin 0 -> 30632 bytes docs/clippy.psd | Bin 0 -> 153099 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/clippy.png create mode 100644 docs/clippy.psd diff --git a/docs/clippy.png b/docs/clippy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|69P(pYAVC7+_8+CSm8+zm*xK|5J|g}KLbndYAWVn01V&PV9#3~vZ810# z#@4UHkqcJhLrPnE-cD%Nzr|zB9a4x-@2jb@ts9h@(4b8{)j&h}ZUkUaFgV?Qe}H0$u3Tha^LbOOa0$ zN;cxj%&hQ7Rp7{oJKx&vQ>@)y>qt5{_!bFa$x;EC`rUn6Wo5AqhvnL0xM5T6YBmyb zy9le-oTXwHS&ACoo1WYFRLHo)y>uN_iol?yT3H;QQe|~?pkr5$a|yk@#rN@+wCeJF ztrsdpo0h6aFE(6!ZulED#m98u?Yc2$36Fq${oO)VX{d1|juiZ3I8vZ^*H)1NH%C|bt{z7-`jZ_;5VD|-Lf|jrk0$nS1jGQvHde$_gRJSI)$dPo4k%_n4zyKQ5x1k_wpx&og5!} zkXuE$jgwM@sCm+e=g$T9?ve|-cO{BXK7=ur(hu$gk52cu!~%N1Ug!uj)T8{%pA-Gl gyI4@_&K@H~Z*y#>1}RdX|1VupAxXh(el7R^2QQ4WkN^Mx literal 0 HcmV?d00001 diff --git a/docs/clippy.psd b/docs/clippy.psd new file mode 100644 index 0000000000000000000000000000000000000000..5193c920e65585a3b5eca7903fa57af7302ee932 GIT binary patch literal 153099 zcmeEv30xFM_J0pI3Mk%ZG)7~LK?S_PAVy-0F{lyoHUwb?4QDvS=ps2bm_s9K95YcD zjOVBm;&?_y(RfAM7!SY$Vl;`Pcn~9q49wL3`>K0}!DGW_cYpug{lH9jS69FH>eZ`P zud2JhQ}iD^Dnw8S(w_qkH?SE67r|c23TxMY@UUQqF8r*qlvlIo*E-X=|LW%hXC{P4 zL@Sd!PE|%tj|=Ejx_e)zj?*IpI*scS+$%UCNI7l#%d--dA+tt|iI^1~;TPE{aA1Sy zXZp{KO^8({hj*MA8xxo0KQo|Hcx3!kr9aY?-Lq3iPLdoQ(CG!b&~be5sE$GLiOP*@b>NBv7cWL?>>J0eR@CF(WjSp-=4kvdV2Tv>gDa<%g?`;cSrfJ)4&EuJ)an< z@*n-;OLB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 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index f48a42ecf6..9d2150a441 100644 --- a/docs/README.md +++ b/docs/README.md @@ -57,7 +57,7 @@ Packer.toBuffer(doc).then((buffer) => { ```

- clippy the assistant + clippy the assistant

--- From 93a7d607b241f4c833301a2419cd42e03c9ddc95 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 5 Sep 2020 18:51:50 +0100 Subject: [PATCH 136/147] Update PSD --- docs/clippy.psd | Bin 153099 -> 153099 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/docs/clippy.psd b/docs/clippy.psd index 5193c920e65585a3b5eca7903fa57af7302ee932..0d32ab12d06bab589658c43e5d024830bb338a83 100644 GIT binary patch delta 331 zcmeBP!`Z!tbAt;rtEr)tk?CYlW=ANipLw%xnvtQ2ftiV^u2GtiiLSAkiKT9mfoYO% zvav-NX=j4qXBAc68cC)GwqiymE4hN`BZ#hnHF5Zuq5*Z8`(ioB%bQw~CbRvVn tWP?oO$?TZ|a22LNRmMQIa23r4ncEFA8Lf?ZQOunzmnyY=(j3Ohod80aT}1!@ delta 330 zcmeBP!`Z!tbAt;rtFfV#p~YlRW=ANipLw&cQL3Rys-a=Bu4$5miEf&)Ns?}ofhmx% zOg1$&H#0ReN=&oSugER%^|kVxypcm>b2H0sRuy8jOK(6KHL&+wL8bF23HyA9OJbeRld{P(~ zm@5i$l6@F}3>C|y#3VDzBs1OAG|QCDa;bBfB`q0}7!rZli~+_EQzjc^ m8c$}=6hKp9icryPkh$F;lhN9k7scGka;Z|=C(U83+z9}TkYh~% From 0c068bb03b941bebe7eaba0b225f0287e347ea59 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2020 18:39:58 +0000 Subject: [PATCH 137/147] build(deps-dev): bump @types/webpack from 4.41.21 to 4.41.22 Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.41.21 to 4.41.22. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 281094bd8d..e5cdbb79a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -670,9 +670,9 @@ } }, "@types/webpack": { - "version": "4.41.21", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.21.tgz", - "integrity": "sha512-2j9WVnNrr/8PLAB5csW44xzQSJwS26aOnICsP3pSGCEdsu6KYtfQ6QJsVUKHWRnm1bL7HziJsfh5fHqth87yKA==", + "version": "4.41.22", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.22.tgz", + "integrity": "sha512-JQDJK6pj8OMV9gWOnN1dcLCyU9Hzs6lux0wBO4lr1+gyEhIBR9U3FMrz12t2GPkg110XAxEAw2WHF6g7nZIbRQ==", "dev": true, "requires": { "@types/anymatch": "*", From 57c480a6c60b07d60df5ac4ec3bd5d452e22277f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2020 16:44:55 +0000 Subject: [PATCH 138/147] build(deps): [security] bump node-fetch from 2.6.0 to 2.6.1 Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. **This update includes a security fix.** - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5cdbb79a5..316cb7c06c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5627,9 +5627,9 @@ } }, "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "dev": true }, "node-libs-browser": { From af0bf5ced5ac07f5ebaaefd5e4e3922969a5a8c5 Mon Sep 17 00:00:00 2001 From: Matt Walsh <51417385+netbymatt@users.noreply.github.com> Date: Fri, 11 Sep 2020 21:10:10 -0500 Subject: [PATCH 139/147] Fix row height option --- docs/usage/tables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/tables.md b/docs/usage/tables.md index a8e41de58a..38a74f8ba7 100644 --- a/docs/usage/tables.md +++ b/docs/usage/tables.md @@ -103,7 +103,7 @@ Here is a list of options you can add to the `table row`: | children | `Array` | Required | | cantSplit | `boolean` | Optional | | tableHeader | `boolean` | Optional | -| height | `{ value: number, rule: HeightRule }` | Optional | +| height | `{ height: number, rule: HeightRule }` | Optional | ### Repeat row From 38079b61718a0339e12e3c3414bca1c36b255201 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2020 18:43:32 +0000 Subject: [PATCH 140/147] build(deps-dev): bump prettier from 2.1.1 to 2.1.2 Bumps [prettier](https://github.com/prettier/prettier) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.1...2.1.2) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 316cb7c06c..ab66a41a83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6492,9 +6492,9 @@ "dev": true }, "prettier": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz", - "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz", + "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", "dev": true }, "prismjs": { From 5125e774314cf6664e8a3b3ff546aacc09bd9ded Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2020 19:38:42 +0000 Subject: [PATCH 141/147] build(deps-dev): bump sinon from 9.0.3 to 9.1.0 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.0.3 to 9.1.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/compare/v9.0.3...v9.1.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index ab66a41a83..196fc1b90f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4919,9 +4919,9 @@ } }, "just-extend": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz", - "integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.1.tgz", + "integrity": "sha512-aWgeGFW67BP3e5181Ep1Fv2v8z//iBJfrvyTnq8wG86vEESwmonn1zPBJ0VfmT9CJq2FIT0VsETtrNFm2a+SHA==", "dev": true }, "keyv": { @@ -7303,9 +7303,9 @@ "dev": true }, "sinon": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.3.tgz", - "integrity": "sha512-IKo9MIM111+smz9JGwLmw5U1075n1YXeAq8YeSFlndCLhAL5KGn6bLgu7b/4AYHTV/LcEMcRm2wU2YiL55/6Pg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.1.0.tgz", + "integrity": "sha512-9zQShgaeylYH6qtsnNXlTvv0FGTTckuDfHBi+qhgj5PvW2r2WslHZpgc3uy3e/ZAoPkqaOASPi+juU6EdYRYxA==", "dev": true, "requires": { "@sinonjs/commons": "^1.7.2", @@ -7330,9 +7330,9 @@ "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" From 6cbe40cecb79ea4ff12a8544e947c0e6bc77e245 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Wed, 23 Sep 2020 11:23:00 +0200 Subject: [PATCH 142/147] add settings option to add trackRevisions --- src/file/settings/settings.ts | 11 +++++++++++ src/file/settings/track-revisions.spec.ts | 16 ++++++++++++++++ src/file/settings/track-revisions.ts | 7 +++++++ 3 files changed, 34 insertions(+) create mode 100644 src/file/settings/track-revisions.spec.ts create mode 100644 src/file/settings/track-revisions.ts diff --git a/src/file/settings/settings.ts b/src/file/settings/settings.ts index abae0e61d4..2fa4a27f0a 100644 --- a/src/file/settings/settings.ts +++ b/src/file/settings/settings.ts @@ -1,6 +1,7 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { Compatibility } from "./compatibility"; import { UpdateFields } from "./update-fields"; +import { TrackRevisions } from "./track-revisions"; export interface ISettingsAttributesProperties { readonly wpc?: string; @@ -46,6 +47,7 @@ export class SettingsAttributes extends XmlAttributeComponent child instanceof TrackRevisions)) { + this.addChildElement(this.trackRevisions); + } + + return this.trackRevisions; + } } diff --git a/src/file/settings/track-revisions.spec.ts b/src/file/settings/track-revisions.spec.ts new file mode 100644 index 0000000000..3875d51f0a --- /dev/null +++ b/src/file/settings/track-revisions.spec.ts @@ -0,0 +1,16 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { TrackRevisions } from "file/settings/track-revisions"; + +import { EMPTY_OBJECT } from "file/xml-components"; + +describe("TrackRevisions", () => { + describe("#constructor", () => { + it("creates an initially empty property object", () => { + const trackRevisions = new TrackRevisions(); + + const tree = new Formatter().format(trackRevisions); + expect(tree).to.deep.equal({ "w:trackRevisions": EMPTY_OBJECT }); + }); + }); +}); diff --git a/src/file/settings/track-revisions.ts b/src/file/settings/track-revisions.ts new file mode 100644 index 0000000000..2da692827e --- /dev/null +++ b/src/file/settings/track-revisions.ts @@ -0,0 +1,7 @@ +import { XmlComponent } from "file/xml-components"; + +export class TrackRevisions extends XmlComponent { + constructor() { + super("w:trackRevisions"); + } +} From 2adfe532dde74234e1f6665f85da4ae18f2775fb Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Wed, 23 Sep 2020 12:59:55 +0200 Subject: [PATCH 143/147] add more unit tests for trackRevision settings --- src/file/settings/settings.spec.ts | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/file/settings/settings.spec.ts b/src/file/settings/settings.spec.ts index 1e34c781c2..9be90669aa 100644 --- a/src/file/settings/settings.spec.ts +++ b/src/file/settings/settings.spec.ts @@ -79,4 +79,47 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:compat"); }); }); + describe("#addTrackRevisions", () => { + it("should add an empty Track Revisions", () => { + const settings = new Settings(); + settings.addTrackRevisions(); + + const tree = new Formatter().format(settings); + let keys: string[] = Object.keys(tree); + expect(keys[0]).to.be.equal("w:settings"); + const rootArray = tree["w:settings"]; + expect(rootArray).is.an.instanceof(Array); + expect(rootArray).has.length(2); + keys = Object.keys(rootArray[0]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("_attr"); + keys = Object.keys(rootArray[1]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("w:trackRevisions"); + }); + }); + describe("#addTrackRevisionsTwice", () => { + it("should add an empty Track Revisions if called twice", () => { + const settings = new Settings(); + settings.addTrackRevisions(); + settings.addTrackRevisions(); + + const tree = new Formatter().format(settings); + let keys: string[] = Object.keys(tree); + expect(keys[0]).to.be.equal("w:settings"); + const rootArray = tree["w:settings"]; + expect(rootArray).is.an.instanceof(Array); + expect(rootArray).has.length(2); + keys = Object.keys(rootArray[0]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("_attr"); + keys = Object.keys(rootArray[1]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("w:trackRevisions"); + }); + }); }); From 09db2c528a15a5442967e7633cfd2fd7b425f7c5 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Thu, 24 Sep 2020 10:24:00 +0200 Subject: [PATCH 144/147] added InsertedTextRun and DeletedTextRun for Revision Tracking --- src/file/index.ts | 1 + src/file/paragraph/paragraph.ts | 3 + src/file/track-revision/index.ts | 1 + .../track-revision/track-revision.spec.ts | 81 +++++++++++++++++++ src/file/track-revision/track-revision.ts | 72 +++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 src/file/track-revision/index.ts create mode 100644 src/file/track-revision/track-revision.spec.ts create mode 100644 src/file/track-revision/track-revision.ts diff --git a/src/file/index.ts b/src/file/index.ts index c4ce99e345..62e7e647ac 100644 --- a/src/file/index.ts +++ b/src/file/index.ts @@ -13,3 +13,4 @@ export * from "./header-wrapper"; export * from "./footer-wrapper"; export * from "./header"; export * from "./footnotes"; +export * from "./track-revision" diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index e1db0ec910..856c34aacf 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -3,6 +3,7 @@ import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run" import { IXmlableObject, XmlComponent } from "file/xml-components"; import { File } from "../file"; +import { InsertedTextRun, DeletedTextRun } from "../track-revision"; import { PageBreak } from "./formatting/page-break"; import { Bookmark, HyperlinkRef } from "./links"; import { IParagraphPropertiesOptions, ParagraphProperties } from "./properties"; @@ -19,6 +20,8 @@ export interface IParagraphOptions extends IParagraphPropertiesOptions { | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef + | InsertedTextRun + | DeletedTextRun )[]; } diff --git a/src/file/track-revision/index.ts b/src/file/track-revision/index.ts new file mode 100644 index 0000000000..20bb87a229 --- /dev/null +++ b/src/file/track-revision/index.ts @@ -0,0 +1 @@ +export * from "./track-revision"; diff --git a/src/file/track-revision/track-revision.spec.ts b/src/file/track-revision/track-revision.spec.ts new file mode 100644 index 0000000000..faa4d5a565 --- /dev/null +++ b/src/file/track-revision/track-revision.spec.ts @@ -0,0 +1,81 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { InsertedTextRun, DeletedTextRun } from "./track-revision"; +import { TextRun } from "../paragraph"; + +describe("InsertedTestRun", () => { + describe("#constructor", () => { + it("should create a inserted text run", () => { + const textRun = new TextRun({ + text: "some text" + }); + const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }) + const tree = new Formatter().format(insertedTextRun); + expect(tree).to.deep.equal({ + "w:ins": [ + { + "_attr": + { + "w:author": "Author", + "w:date": "123", + "w:id": 0 + } + }, + { + "w:r": [ + { + "w:t": [ + { + "_attr": + { + "xml:space": "preserve" + } + }, + "some text" + ] + } + ], + } + ] + }); + }); + }); +}); +describe("DeletedTestRun", () => { + describe("#constructor", () => { + it("should create a deleted text run", () => { + + const insertedParagraph = new DeletedTextRun({ text: 'some text', id: 0, date: "123", author: "Author" }) + const tree = new Formatter().format(insertedParagraph); + expect(tree).to.deep.equal({ + "w:del": [ + { + "_attr": + { + "w:author": "Author", + "w:date": "123", + "w:id": 0 + } + }, + { + "w:r": [ + { + "w:delText": [ + { + "_attr": + { + "xml:space": "preserve" + } + }, + "some text" + ] + } + ], + } + ] + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision.ts b/src/file/track-revision/track-revision.ts new file mode 100644 index 0000000000..1af9e7dba3 --- /dev/null +++ b/src/file/track-revision/track-revision.ts @@ -0,0 +1,72 @@ +import { SpaceType } from "file/space-type"; +import { XmlComponent, XmlAttributeComponent } from "file/xml-components"; +import { TextRun } from "../index"; + +export interface ITrackRevisionAttributesProperties { + readonly id: number; + readonly author: string; + readonly date: string; +} + +export class TrackRevisionAttributes extends XmlAttributeComponent { + protected readonly xmlKeys = { + id: "w:id", + author: "w:author", + date: "w:date", + }; +} + +export interface IInsertedTextRunOptions extends ITrackRevisionAttributesProperties { + readonly child: TextRun +} + +export interface IDeletedTextRunOptions extends ITrackRevisionAttributesProperties { + readonly text: string +} + +export class InsertedTextRun extends XmlComponent { + constructor(options: IInsertedTextRunOptions) { + super("w:ins"); + this.root.push( + new TrackRevisionAttributes({ + id: options.id, + author: options.author, + date: options.date, + }) + ); + this.addChildElement(options.child); + } +} + +export class DeletedTextRunWrapper extends XmlComponent { + constructor(text: string) { + super("w:r"); + this.root.push(new DeletedText(text)); + } +} + +class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { + protected readonly xmlKeys = { space: "xml:space" }; +} + +export class DeletedText extends XmlComponent { + constructor(text: string) { + super("w:delText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push(text); + } +} + +export class DeletedTextRun extends XmlComponent { + constructor(options: IDeletedTextRunOptions) { + super("w:del"); + this.root.push( + new TrackRevisionAttributes({ + id: options.id, + author: options.author, + date: options.date, + }) + ); + this.addChildElement(new DeletedTextRunWrapper(options.text)); + } +} From 065c17de741cb5b79245781cd3dabf164d8afc35 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Thu, 24 Sep 2020 10:43:15 +0200 Subject: [PATCH 145/147] style fixes --- src/file/index.ts | 2 +- .../track-revision/track-revision.spec.ts | 59 +++++++++---------- src/file/track-revision/track-revision.ts | 8 +-- 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/src/file/index.ts b/src/file/index.ts index 62e7e647ac..18f0a595e4 100644 --- a/src/file/index.ts +++ b/src/file/index.ts @@ -13,4 +13,4 @@ export * from "./header-wrapper"; export * from "./footer-wrapper"; export * from "./header"; export * from "./footnotes"; -export * from "./track-revision" +export * from "./track-revision"; diff --git a/src/file/track-revision/track-revision.spec.ts b/src/file/track-revision/track-revision.spec.ts index faa4d5a565..30a684fe9c 100644 --- a/src/file/track-revision/track-revision.spec.ts +++ b/src/file/track-revision/track-revision.spec.ts @@ -9,36 +9,34 @@ describe("InsertedTestRun", () => { describe("#constructor", () => { it("should create a inserted text run", () => { const textRun = new TextRun({ - text: "some text" + text: "some text", }); - const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }) + const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }); const tree = new Formatter().format(insertedTextRun); expect(tree).to.deep.equal({ "w:ins": [ { - "_attr": - { + _attr: { "w:author": "Author", - "w:date": "123", - "w:id": 0 - } + "w:date": "123", + "w:id": 0, + }, }, { "w:r": [ { "w:t": [ { - "_attr": - { - "xml:space": "preserve" - } + _attr: { + "xml:space": "preserve", + }, }, - "some text" - ] - } + "some text", + ], + }, ], - } - ] + }, + ], }); }); }); @@ -46,35 +44,32 @@ describe("InsertedTestRun", () => { describe("DeletedTestRun", () => { describe("#constructor", () => { it("should create a deleted text run", () => { - - const insertedParagraph = new DeletedTextRun({ text: 'some text', id: 0, date: "123", author: "Author" }) + const insertedParagraph = new DeletedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); const tree = new Formatter().format(insertedParagraph); expect(tree).to.deep.equal({ "w:del": [ { - "_attr": - { + _attr: { "w:author": "Author", - "w:date": "123", - "w:id": 0 - } + "w:date": "123", + "w:id": 0, + }, }, { "w:r": [ { "w:delText": [ { - "_attr": - { - "xml:space": "preserve" - } + _attr: { + "xml:space": "preserve", + }, }, - "some text" - ] - } + "some text", + ], + }, ], - } - ] + }, + ], }); }); }); diff --git a/src/file/track-revision/track-revision.ts b/src/file/track-revision/track-revision.ts index 1af9e7dba3..052c7e29ea 100644 --- a/src/file/track-revision/track-revision.ts +++ b/src/file/track-revision/track-revision.ts @@ -17,11 +17,11 @@ export class TrackRevisionAttributes extends XmlAttributeComponent Date: Wed, 7 Oct 2020 08:55:47 +0000 Subject: [PATCH 146/147] build(deps-dev): bump sinon from 9.1.0 to 9.2.0 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.1.0 to 9.2.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/compare/v9.1.0...v9.2.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 196fc1b90f..d73f9f5d71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -498,9 +498,9 @@ } }, "@sinonjs/samsam": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.1.0.tgz", - "integrity": "sha512-42nyaQOVunX5Pm6GRJobmzbS7iLI+fhERITnETXzzwDZh+TtDr/Au3yAvXVjFmZ4wEUaE4Y3NFZfKv0bV0cbtg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.2.0.tgz", + "integrity": "sha512-CaIcyX5cDsjcW/ab7HposFWzV1kC++4HNsfnEdFJa7cP1QIuILAKV+BgfeqRXhcnSAc76r/Rh/O5C+300BwUIw==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -7303,15 +7303,15 @@ "dev": true }, "sinon": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.1.0.tgz", - "integrity": "sha512-9zQShgaeylYH6qtsnNXlTvv0FGTTckuDfHBi+qhgj5PvW2r2WslHZpgc3uy3e/ZAoPkqaOASPi+juU6EdYRYxA==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.0.tgz", + "integrity": "sha512-eSNXz1XMcGEMHw08NJXSyTHIu6qTCOiN8x9ODACmZpNQpr0aXTBXBnI4xTzQzR+TEpOmLiKowGf9flCuKIzsbw==", "dev": true, "requires": { - "@sinonjs/commons": "^1.7.2", + "@sinonjs/commons": "^1.8.1", "@sinonjs/fake-timers": "^6.0.1", "@sinonjs/formatio": "^5.0.1", - "@sinonjs/samsam": "^5.1.0", + "@sinonjs/samsam": "^5.2.0", "diff": "^4.0.2", "nise": "^4.0.4", "supports-color": "^7.1.0" From cae6405d9a534afba21115988371c0fe05bc8204 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Wed, 7 Oct 2020 11:44:23 +0200 Subject: [PATCH 147/147] improved signature for deleted text runs, added demo 54 and added documentation for change tracking --- demo/54-track-revisions.ts | 132 +++++++ docs/_sidebar.md | 2 +- docs/usage/change-tracking.md | 58 +++ src/file/track-revision/index.ts | 3 +- .../deleted-page-number.spec.ts | 30 ++ .../deleted-page-number.ts | 30 ++ .../deleted-text-run.spec.ts | 371 ++++++++++++++++++ .../deleted-text-run.ts | 83 ++++ .../deleted-text.spec.ts | 15 + .../track-revision-components/deleted-text.ts | 15 + .../inserted-text-run.spec.ts | 37 ++ .../inserted-text-run.ts | 19 + .../track-revision/track-revision.spec.ts | 76 ---- src/file/track-revision/track-revision.ts | 63 +-- 14 files changed, 796 insertions(+), 138 deletions(-) create mode 100644 demo/54-track-revisions.ts create mode 100644 docs/usage/change-tracking.md create mode 100644 src/file/track-revision/track-revision-components/deleted-page-number.spec.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-page-number.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text-run.spec.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text-run.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text.spec.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text.ts create mode 100644 src/file/track-revision/track-revision-components/inserted-text-run.spec.ts create mode 100644 src/file/track-revision/track-revision-components/inserted-text-run.ts delete mode 100644 src/file/track-revision/track-revision.spec.ts diff --git a/demo/54-track-revisions.ts b/demo/54-track-revisions.ts new file mode 100644 index 0000000000..01d96082b8 --- /dev/null +++ b/demo/54-track-revisions.ts @@ -0,0 +1,132 @@ +// Track Revisions aka. "Track Changes" +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, Packer, Paragraph, TextRun, ShadingType, DeletedTextRun, InsertedTextRun, Footer, PageNumber, AlignmentType, FootnoteReferenceRun } from "../build"; + +/* + For reference, see + - https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.insertedrun + - https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.deletedrun + + The method `addTrackRevisions()` adds an element `` to the `settings.xml` file. This specifies that the application shall track *new* revisions made to the existing document. + See also https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.trackrevisions + + Note that this setting enables to track *new changes* after teh file is generated, so this example will still show inserted and deleted text runs when you remove it. +*/ + +const doc = new Document({ + footnotes: [ + new Paragraph({ + children:[ + new TextRun("This is a footnote"), + new DeletedTextRun({ + text: " with some extra text which was deleted", + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + new InsertedTextRun({ + text: " and new content", + id: 1, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }) + ] + }), + ], +}); + +doc.Settings.addTrackRevisions() + +const paragraph = new Paragraph({ + children: [ + new TextRun("This is a simple demo "), + new TextRun({ + text: "on how to " + }), + new InsertedTextRun({ + text: "mark a text as an insertion ", + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }), + new DeletedTextRun({ + text: "or a deletion.", + id: 1, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }) + ], +}); + +doc.addSection({ + properties: {}, + children: [ + paragraph, + new Paragraph({ + children: [ + new TextRun("This is a demo "), + new DeletedTextRun({ + text: "in order", + color: "red", + bold: true, + size: 24, + font: { + name: "Garamond", + }, + shading: { + type: ShadingType.REVERSE_DIAGONAL_STRIPE, + color: "00FFFF", + fill: "FF0000", + }, + id: 2, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }).break(), + new InsertedTextRun({ + text: "to show how to ", + bold: false, + id: 3, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + new TextRun({ + bold: true, + children: [ "\tuse Inserted and Deleted TextRuns.", new FootnoteReferenceRun(1) ], + }), + ], + }), + ], + footers: { + default: new Footer({ + children: [ + new Paragraph({ + alignment: AlignmentType.CENTER, + children: [ + new TextRun("Awesome LLC"), + new TextRun({ + children: ["Page Number: ", PageNumber.CURRENT], + }), + new DeletedTextRun({ + children: [" to ", PageNumber.TOTAL_PAGES], + id: 4, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + new InsertedTextRun({ + children: [" from ", PageNumber.TOTAL_PAGES], + bold: true, + id: 5, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + ], + }), + ], + }), + }, +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/docs/_sidebar.md b/docs/_sidebar.md index a63970dff9..5d2ba31551 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -20,6 +20,7 @@ * [Tab Stops](usage/tab-stops.md) * [Table of Contents](usage/table-of-contents.md) * [Page Numbers](usage/page-numbers.md) + * [Change Tracking](usage/change-tracking.md) * Styling * [Styling with JS](usage/styling-with-js.md) * [Styling with XML](usage/styling-with-xml.md) @@ -28,4 +29,3 @@ * [Packers](usage/packers.md) * [Contribution Guidelines](contribution-guidelines.md) - diff --git a/docs/usage/change-tracking.md b/docs/usage/change-tracking.md new file mode 100644 index 0000000000..6f81e4d0d7 --- /dev/null +++ b/docs/usage/change-tracking.md @@ -0,0 +1,58 @@ +# Change Tracking + +> Instead of adding a `TextRun` into a `Paragraph`, you can also add an `InsertedTextRun` or `DeletedTextRun` where you need to supply an `id`, `author` and `date` for the change. + +```ts +import { Paragraph, TextRun, InsertedTextRun, DeletedTextRun } from "docx"; + +const paragraph = new Paragraph({ + children: [ + new TextRun("This is a simple demo "), + new TextRun({ + text: "on how to " + }), + new InsertedTextRun({ + text: "mark a text as an insertion ", + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }), + new DeletedTextRun({ + text: "or a deletion.", + id: 1, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }) + ], +}); +``` + +Note that for a `InsertedTextRun` and `DeletedTextRun`, it is not possible to simply call it with only a text as in `new TextRun("some text")`, since the additonal fields for change tracking need to be provided. Similar to a normal `TextRun` you can add additional text properties. + +```ts +import { Paragraph, TextRun, InsertedTextRun, DeletedTextRun } from "docx"; + +const paragraph = new Paragraph({ + children: [ + new TextRun("This is a simple demo"), + new DeletedTextRun({ + text: "with a deletion.", + color: "red", + bold: true, + size: 24, + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }) + ], +}); +``` + +In addtion to marking text as inserted or deleted, change tracking can also be added via the document settings. This will enable new changes to be tracked as well. + +```ts +import { Document } from "docx"; + +const doc = new Document({}); +doc.Settings.addTrackRevisions() +``` \ No newline at end of file diff --git a/src/file/track-revision/index.ts b/src/file/track-revision/index.ts index 20bb87a229..eb2465d8fe 100644 --- a/src/file/track-revision/index.ts +++ b/src/file/track-revision/index.ts @@ -1 +1,2 @@ -export * from "./track-revision"; +export * from "./track-revision-components/inserted-text-run"; +export * from "./track-revision-components/deleted-text-run"; diff --git a/src/file/track-revision/track-revision-components/deleted-page-number.spec.ts b/src/file/track-revision/track-revision-components/deleted-page-number.spec.ts new file mode 100644 index 0000000000..5e0238da96 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-page-number.spec.ts @@ -0,0 +1,30 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { DeletedNumberOfPages, DeletedNumberOfPagesSection, DeletedPage } from "./deleted-page-number"; + +describe("Deleted Page", () => { + describe("#constructor()", () => { + it("uses the font name for both ascii and hAnsi", () => { + const tree = new Formatter().format(new DeletedPage()); + expect(tree).to.deep.equal({ "w:delInstrText": [{ _attr: { "xml:space": "preserve" } }, "PAGE"] }); + }); + }); +}); + +describe("Delted NumberOfPages", () => { + describe("#constructor()", () => { + it("uses the font name for both ascii and hAnsi", () => { + const tree = new Formatter().format(new DeletedNumberOfPages()); + expect(tree).to.deep.equal({ "w:delInstrText": [{ _attr: { "xml:space": "preserve" } }, "NUMPAGES"] }); + }); + }); +}); + +describe("Deleted NumberOfPagesSection", () => { + describe("#constructor()", () => { + it("uses the font name for both ascii and hAnsi", () => { + const tree = new Formatter().format(new DeletedNumberOfPagesSection()); + expect(tree).to.deep.equal({ "w:delInstrText": [{ _attr: { "xml:space": "preserve" } }, "SECTIONPAGES"] }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/deleted-page-number.ts b/src/file/track-revision/track-revision-components/deleted-page-number.ts new file mode 100644 index 0000000000..6ce6266f13 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-page-number.ts @@ -0,0 +1,30 @@ +import { SpaceType } from "file/space-type"; +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { + protected readonly xmlKeys = { space: "xml:space" }; +} + +export class DeletedPage extends XmlComponent { + constructor() { + super("w:delInstrText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push("PAGE"); + } +} + +export class DeletedNumberOfPages extends XmlComponent { + constructor() { + super("w:delInstrText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push("NUMPAGES"); + } +} + +export class DeletedNumberOfPagesSection extends XmlComponent { + constructor() { + super("w:delInstrText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push("SECTIONPAGES"); + } +} diff --git a/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts b/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts new file mode 100644 index 0000000000..7931e50406 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts @@ -0,0 +1,371 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { DeletedTextRun } from "./deleted-text-run"; +import { FootnoteReferenceRun, PageNumber } from "../../index"; + +describe("DeletedTextRun", () => { + describe("#constructor", () => { + it("should create a deleted text run", () => { + const deletedTextRun = new DeletedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); + + describe("#constructor with formatting", () => { + it("should create a deleted text run", () => { + const deletedTextRun = new DeletedTextRun({ text: "some text", bold: true, id: 0, date: "123", author: "Author" }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:rPr": [ + { + "w:b": { + _attr: { + "w:val": true, + }, + }, + }, + { + "w:bCs": { + _attr: { + "w:val": true, + }, + }, + }, + ], + }, + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); + + describe("#break()", () => { + it("should add a break", () => { + const deletedTextRun = new DeletedTextRun({ + children: ["some text"], + id: 0, + date: "123", + author: "Author", + }).break(); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:br": {}, + }, + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); + + describe("page numbering", () => { + it("should be able to delete the total pages", () => { + const deletedTextRun = new DeletedTextRun({ + children: [" to ", PageNumber.TOTAL_PAGES], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + " to ", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "begin", + }, + }, + }, + { + "w:delInstrText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "NUMPAGES", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "separate", + }, + }, + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "end", + }, + }, + }, + ], + }, + ], + }); + }); + + it("should be able to delete the total pages in section", () => { + const deletedTextRun = new DeletedTextRun({ + children: [" to ", PageNumber.TOTAL_PAGES_IN_SECTION], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + " to ", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "begin", + }, + }, + }, + { + "w:delInstrText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "SECTIONPAGES", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "separate", + }, + }, + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "end", + }, + }, + }, + ], + }, + ], + }); + }); + + it("should be able to delete the current page", () => { + const deletedTextRun = new DeletedTextRun({ + children: [" to ", PageNumber.CURRENT], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + " to ", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "begin", + }, + }, + }, + { + "w:delInstrText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "PAGE", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "separate", + }, + }, + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "end", + }, + }, + }, + ], + }, + ], + }); + }); + }); + + describe("footnote references", () => { + it("should add a valid footnote reference", () => { + const deletedTextRun = new DeletedTextRun({ + children: ["some text", new FootnoteReferenceRun(1)], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + { + "w:r": [ + { "w:rPr": [{ "w:rStyle": { _attr: { "w:val": "FootnoteReference" } } }] }, + { "w:footnoteReference": { _attr: { "w:id": 1 } } }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/deleted-text-run.ts b/src/file/track-revision/track-revision-components/deleted-text-run.ts new file mode 100644 index 0000000000..2342f70104 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text-run.ts @@ -0,0 +1,83 @@ +import { IChangedAttributesProperties, ChangeAttributes } from "../track-revision"; +import { XmlComponent } from "file/xml-components"; +import { IRunOptions, RunProperties, IRunPropertiesOptions, FootnoteReferenceRun } from "../../index"; + +import { Break } from "../../paragraph/run/break"; +import { Begin, Separate, End } from "../../paragraph/run/field"; +import { PageNumber } from "../../paragraph/run/run"; + +import { DeletedPage, DeletedNumberOfPages, DeletedNumberOfPagesSection } from "./deleted-page-number"; +import { DeletedText } from "./deleted-text"; + +interface IDeletedRunOptions extends IRunPropertiesOptions, IChangedAttributesProperties { + readonly children?: (Begin | Separate | End | PageNumber | FootnoteReferenceRun | string)[]; + readonly text?: string; +} + +export class DeletedTextRun extends XmlComponent { + protected readonly deletedTextRunWrapper: DeletedTextRunWrapper; + + constructor(options: IDeletedRunOptions) { + super("w:del"); + this.root.push( + new ChangeAttributes({ + id: options.id, + author: options.author, + date: options.date, + }), + ); + this.deletedTextRunWrapper = new DeletedTextRunWrapper(options as IRunOptions); + this.addChildElement(this.deletedTextRunWrapper); + } + + public break(): DeletedTextRun { + this.deletedTextRunWrapper.break(); + return this; + } +} + +class DeletedTextRunWrapper extends XmlComponent { + constructor(options: IRunOptions) { + super("w:r"); + this.root.push(new RunProperties(options)); + + if (options.children) { + for (const child of options.children) { + if (typeof child === "string") { + switch (child) { + case PageNumber.CURRENT: + this.root.push(new Begin()); + this.root.push(new DeletedPage()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + case PageNumber.TOTAL_PAGES: + this.root.push(new Begin()); + this.root.push(new DeletedNumberOfPages()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + case PageNumber.TOTAL_PAGES_IN_SECTION: + this.root.push(new Begin()); + this.root.push(new DeletedNumberOfPagesSection()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + default: + this.root.push(new DeletedText(child)); + break; + } + continue; + } + + this.root.push(child); + } + } else if (options.text) { + this.root.push(new DeletedText(options.text)); + } + } + + public break(): void { + this.root.splice(1, 0, new Break()); + } +} diff --git a/src/file/track-revision/track-revision-components/deleted-text.spec.ts b/src/file/track-revision/track-revision-components/deleted-text.spec.ts new file mode 100644 index 0000000000..d9c8de46bf --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text.spec.ts @@ -0,0 +1,15 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { DeletedText } from "./deleted-text"; + +describe("Deleted Text", () => { + describe("#constructor", () => { + it("adds the passed in text to the component", () => { + const t = new DeletedText(" this is\n text"); + const f = new Formatter().format(t); + expect(f).to.deep.equal({ + "w:delText": [{ _attr: { "xml:space": "preserve" } }, " this is\n text"], + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/deleted-text.ts b/src/file/track-revision/track-revision-components/deleted-text.ts new file mode 100644 index 0000000000..408b47304d --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text.ts @@ -0,0 +1,15 @@ +import { SpaceType } from "file/space-type"; +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { + protected readonly xmlKeys = { space: "xml:space" }; +} + +export class DeletedText extends XmlComponent { + constructor(text: string) { + super("w:delText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + + this.root.push(text); + } +} diff --git a/src/file/track-revision/track-revision-components/inserted-text-run.spec.ts b/src/file/track-revision/track-revision-components/inserted-text-run.spec.ts new file mode 100644 index 0000000000..c23069fbba --- /dev/null +++ b/src/file/track-revision/track-revision-components/inserted-text-run.spec.ts @@ -0,0 +1,37 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { InsertedTextRun } from "./inserted-text-run"; + +describe("InsertedTextRun", () => { + describe("#constructor", () => { + it("should create a inserted text run", () => { + const insertedTextRun = new InsertedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); + const tree = new Formatter().format(insertedTextRun); + expect(tree).to.deep.equal({ + "w:ins": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:t": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/inserted-text-run.ts b/src/file/track-revision/track-revision-components/inserted-text-run.ts new file mode 100644 index 0000000000..49bd7f53ae --- /dev/null +++ b/src/file/track-revision/track-revision-components/inserted-text-run.ts @@ -0,0 +1,19 @@ +import { IChangedAttributesProperties, ChangeAttributes } from "../track-revision"; +import { XmlComponent } from "file/xml-components"; +import { TextRun, IRunOptions } from "../../index"; + +interface IInsertedRunOptions extends IChangedAttributesProperties, IRunOptions {} + +export class InsertedTextRun extends XmlComponent { + constructor(options: IInsertedRunOptions) { + super("w:ins"); + this.root.push( + new ChangeAttributes({ + id: options.id, + author: options.author, + date: options.date, + }), + ); + this.addChildElement(new TextRun(options as IRunOptions)); + } +} diff --git a/src/file/track-revision/track-revision.spec.ts b/src/file/track-revision/track-revision.spec.ts deleted file mode 100644 index 30a684fe9c..0000000000 --- a/src/file/track-revision/track-revision.spec.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { expect } from "chai"; - -import { Formatter } from "export/formatter"; - -import { InsertedTextRun, DeletedTextRun } from "./track-revision"; -import { TextRun } from "../paragraph"; - -describe("InsertedTestRun", () => { - describe("#constructor", () => { - it("should create a inserted text run", () => { - const textRun = new TextRun({ - text: "some text", - }); - const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }); - const tree = new Formatter().format(insertedTextRun); - expect(tree).to.deep.equal({ - "w:ins": [ - { - _attr: { - "w:author": "Author", - "w:date": "123", - "w:id": 0, - }, - }, - { - "w:r": [ - { - "w:t": [ - { - _attr: { - "xml:space": "preserve", - }, - }, - "some text", - ], - }, - ], - }, - ], - }); - }); - }); -}); -describe("DeletedTestRun", () => { - describe("#constructor", () => { - it("should create a deleted text run", () => { - const insertedParagraph = new DeletedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); - const tree = new Formatter().format(insertedParagraph); - expect(tree).to.deep.equal({ - "w:del": [ - { - _attr: { - "w:author": "Author", - "w:date": "123", - "w:id": 0, - }, - }, - { - "w:r": [ - { - "w:delText": [ - { - _attr: { - "xml:space": "preserve", - }, - }, - "some text", - ], - }, - ], - }, - ], - }); - }); - }); -}); diff --git a/src/file/track-revision/track-revision.ts b/src/file/track-revision/track-revision.ts index 052c7e29ea..4318e9a468 100644 --- a/src/file/track-revision/track-revision.ts +++ b/src/file/track-revision/track-revision.ts @@ -1,72 +1,15 @@ -import { SpaceType } from "file/space-type"; -import { XmlComponent, XmlAttributeComponent } from "file/xml-components"; -import { TextRun } from "../index"; +import { XmlAttributeComponent } from "file/xml-components"; -export interface ITrackRevisionAttributesProperties { +export interface IChangedAttributesProperties { readonly id: number; readonly author: string; readonly date: string; } -export class TrackRevisionAttributes extends XmlAttributeComponent { +export class ChangeAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { id: "w:id", author: "w:author", date: "w:date", }; } - -export interface IInsertedTextRunOptions extends ITrackRevisionAttributesProperties { - readonly child: TextRun; -} - -export interface IDeletedTextRunOptions extends ITrackRevisionAttributesProperties { - readonly text: string; -} - -export class InsertedTextRun extends XmlComponent { - constructor(options: IInsertedTextRunOptions) { - super("w:ins"); - this.root.push( - new TrackRevisionAttributes({ - id: options.id, - author: options.author, - date: options.date, - }), - ); - this.addChildElement(options.child); - } -} - -export class DeletedTextRunWrapper extends XmlComponent { - constructor(text: string) { - super("w:r"); - this.root.push(new DeletedText(text)); - } -} - -class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { - protected readonly xmlKeys = { space: "xml:space" }; -} - -export class DeletedText extends XmlComponent { - constructor(text: string) { - super("w:delText"); - this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); - this.root.push(text); - } -} - -export class DeletedTextRun extends XmlComponent { - constructor(options: IDeletedTextRunOptions) { - super("w:del"); - this.root.push( - new TrackRevisionAttributes({ - id: options.id, - author: options.author, - date: options.date, - }), - ); - this.addChildElement(new DeletedTextRunWrapper(options.text)); - } -}