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/.nycrc b/.nycrc
index d5f12ccbc3..25c38c14ad 100644
--- a/.nycrc
+++ b/.nycrc
@@ -1,14 +1,15 @@
{
"check-coverage": true,
- "lines": 92.35,
- "functions": 88.28,
- "branches": 84.64,
- "statements": 92.16,
+ "lines": 96.81,
+ "functions": 93.80,
+ "branches": 92.63,
+ "statements": 96.80,
"include": [
"src/**/*.ts"
],
"exclude": [
- "src/**/*.spec.ts"
+ "src/**/*.spec.ts",
+ "src/import-dotx/import-dotx.ts"
],
"reporter": [
"lcov",
diff --git a/.travis.yml b/.travis.yml
index 3bf1b47690..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
@@ -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
diff --git a/README.md b/README.md
index 7cb5c93879..84469fa454 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@
[![codecov][codecov-image]][codecov-url]
-
+
# Demo
@@ -27,13 +27,22 @@
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://codepen.io/dolanmiu/pen/RwNeObg
+* https://jsfiddle.net/dolanmiu/kqxrj35u/1/
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
+* https://stackblitz.com/edit/react-ts-qdqu7z (adding images to Word Document)
+
+Here is an example of `docx` working in `Vue.js`:
+
+* https://stackblitz.com/edit/vuejs-docx
+
## Node
Press `endpoint` on the `RunKit` website:
@@ -50,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
@@ -58,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
@@ -73,6 +82,10 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide
[ ](https://www.dabblewriter.com/)
[ ](https://turbopatent.com/)
[ ](http://www.madisoncres.com/)
+[ ](https://www.beekast.com/)
+[ ](https://herraizsoto.com/)
+[ ](http://www.ativer.com.br/)
+
...and many more!
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/14-page-numbers.ts b/demo/14-page-numbers.ts
index ae34300b5c..00b77cfe31 100644
--- a/demo/14-page-numbers.ts
+++ b/demo/14-page-numbers.ts
@@ -1,7 +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 { AlignmentType, Document, Header, Packer, PageBreak, PageNumber, Paragraph, TextRun } from "../build";
const doc = new Document();
@@ -11,7 +11,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 +24,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/17-footnotes.ts b/demo/17-footnotes.ts
index bf3f11eb91..a41f84a3c8 100644
--- a/demo/17-footnotes.ts
+++ b/demo/17-footnotes.ts
@@ -1,22 +1,54 @@
// 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, 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: [
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({
+ children: [new TextRun("Hello World"), new FootnoteReferenceRun(3)],
}),
- new Paragraph("Hello World").referenceFootnote(3),
],
});
-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/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/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts
index 34d7e19e70..c34eae9628 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,
},
}),
@@ -153,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.",
}),
diff --git a/demo/21-bookmarks.ts b/demo/21-bookmarks.ts
index cc0bac5517..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, 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.";
@@ -10,19 +10,19 @@ 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!`);
-
doc.addSection({
children: [
new Paragraph({
heading: HeadingLevel.HEADING_1,
- children: [bookmark],
+ children: [new Bookmark("myAnchorId", "Lorem Ipsum")],
}),
new Paragraph("\n"),
new Paragraph(LOREM_IPSUM),
@@ -30,7 +30,7 @@ doc.addSection({
children: [new PageBreak()],
}),
new Paragraph({
- children: [hyperlink],
+ children: [new HyperlinkRef("myAnchorId")],
}),
],
});
diff --git a/demo/29-numbered-lists.ts b/demo/29-numbered-lists.ts
index 740320e5f8..5cd3966015 100644
--- a/demo/29-numbered-lists.ts
+++ b/demo/29-numbered-lists.ts
@@ -1,23 +1,53 @@
// 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",
+ },
+ {
+ levels: [
+ {
+ level: 0,
+ format: "decimal",
+ text: "%1",
+ alignment: AlignmentType.START,
+ style: {
+ paragraph: {
+ indent: { left: 720, hanging: 260 },
+ },
+ },
+ },
+ ],
+ reference: "my-number-numbering-reference",
+ },
+ ],
+ },
+});
doc.addSection({
children: [
new Paragraph({
text: "line with contextual spacing",
numbering: {
- num: concrete,
+ reference: "my-crazy-reference",
level: 0,
},
contextualSpacing: true,
@@ -28,7 +58,7 @@ doc.addSection({
new Paragraph({
text: "line with contextual spacing",
numbering: {
- num: concrete,
+ reference: "my-crazy-reference",
level: 0,
},
contextualSpacing: true,
@@ -39,7 +69,7 @@ doc.addSection({
new Paragraph({
text: "line without contextual spacing",
numbering: {
- num: concrete,
+ reference: "my-crazy-reference",
level: 0,
},
contextualSpacing: false,
@@ -50,7 +80,7 @@ doc.addSection({
new Paragraph({
text: "line without contextual spacing",
numbering: {
- num: concrete,
+ reference: "my-crazy-reference",
level: 0,
},
contextualSpacing: false,
@@ -58,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,
+ },
+ }),
],
});
diff --git a/demo/3-numbering-and-bullet-points.ts b/demo/3-numbering-and-bullet-points.ts
index e87e6616d2..58c0a4f5a6 100644
--- a/demo/3-numbering-and-bullet-points.ts
+++ b/demo/3-numbering-and-bullet-points.ts
@@ -1,46 +1,91 @@
// 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 },
+ },
+ },
+ },
+ {
+ level: 3,
+ format: "upperLetter",
+ text: "%4)",
+ alignment: AlignmentType.START,
+ style: {
+ paragraph: {
+ indent: { left: 2880, hanging: 2420 },
+ },
+ },
+ },
+ ],
+ },
+ ],
+ },
+});
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,
},
}),
@@ -68,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,
+ },
+ }),
],
});
diff --git a/demo/31-tables.ts b/demo/31-tables.ts
index 7daec1506d..24fc6030f8 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.BOTTOM_TO_TOP_LEFT_TO_RIGHT,
+ }),
+ new TableCell({
+ children: [new Paragraph({ text: "top to bottom" }), new Paragraph({})],
+ textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT,
+ }),
],
}),
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/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts
index 77d6815d1e..f12350988e 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, BorderStyle, 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: [
@@ -181,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")],
@@ -192,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")],
}),
],
}),
@@ -206,6 +209,163 @@ 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({
+ borders,
+ children: [new Paragraph("0,0")],
+ rowSpan: 2,
+ }),
+ new TableCell({
+ borders,
+ children: [new Paragraph("0,1")],
+ }),
+ ],
+ }),
+ new TableRow({
+ children: [
+ new TableCell({
+ borders,
+ children: [new Paragraph("1,1")],
+ rowSpan: 2,
+ }),
+ ],
+ }),
+ new TableRow({
+ children: [
+ new TableCell({
+ borders,
+ 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")],
+ rowSpan: 3,
+ }),
+ ],
+ }),
+ new TableRow({
+ children: [
+ new TableCell({
+ children: [new Paragraph("1,0")],
+ columnSpan: 2,
+ }),
+ ],
+ }),
+ new TableRow({
+ children: [
+ new TableCell({
+ children: [new Paragraph("2,0")],
+ columnSpan: 2,
+ }),
+ new TableCell({
+ children: [new Paragraph("2,2")],
+ rowSpan: 2,
+ }),
+ ],
+ }),
+ new TableRow({
+ children: [
+ new TableCell({
+ children: [new Paragraph("3,0")],
+ }),
+ new TableCell({
+ children: [new Paragraph("3,1")],
+ }),
+ new TableCell({
+ children: [new Paragraph("3,3")],
+ }),
+ ],
+ }),
+ ],
+ width: {
+ size: 100,
+ type: WidthType.PERCENTAGE,
+ },
+});
+
+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,
@@ -219,10 +379,16 @@ 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("Merging columns 3"),
+ table6,
+ new Paragraph("Merging columns 4"),
+ table7,
+ new Paragraph("Merging columns 5"),
+ table8,
],
});
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/demo/35-hyperlinks.ts b/demo/35-hyperlinks.ts
index 6392299b84..65ed9390d4 100644
--- a/demo/35-hyperlinks.ts
+++ b/demo/35-hyperlinks.ts
@@ -1,15 +1,32 @@
// 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, HyperlinkType, Packer, Paragraph, Media } 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",
+ 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: [link],
+ children: [new HyperlinkRef("myCoolLink")],
+ }),
+ new Paragraph({
+ children: [image1, new HyperlinkRef("myOtherLink")],
}),
],
});
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/47-number-of-total-pages-section.ts b/demo/47-number-of-total-pages-section.ts
index 988206e524..7e8cf91b2c 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,8 +10,12 @@ const header = new Header({
new Paragraph({
children: [
new TextRun("Header on another page"),
- new TextRun("Page Number: ").pageNumber(),
- new TextRun(" to ").numberOfTotalPagesSection(),
+ new TextRun({
+ children: ["Page number: ", PageNumber.CURRENT],
+ }),
+ new TextRun({
+ children: [" to ", PageNumber.TOTAL_PAGES_IN_SECTION],
+ }),
],
alignment: AlignmentType.CENTER,
}),
diff --git a/demo/48-vertical-align.ts b/demo/48-vertical-align.ts
new file mode 100644
index 0000000000..35181d271c
--- /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: {
+ verticalAlign: SectionVerticalAlignValue.CENTER,
+ },
+ children: [
+ new Paragraph({
+ children: [
+ new TextRun("Hello World"),
+ new TextRun({
+ text: "Foo Bar",
+ bold: true,
+ }),
+ new TextRun({
+ text: "\tGithub is the best",
+ bold: true,
+ }),
+ ],
+ }),
+ ],
+});
+
+Packer.toBuffer(doc).then((buffer) => {
+ fs.writeFileSync("My Document.docx", buffer);
+});
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/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);
+});
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);
+});
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);
+});
diff --git a/demo/53-chinese.ts b/demo/53-chinese.ts
new file mode 100644
index 0000000000..eee6eb9032
--- /dev/null
+++ b/demo/53-chinese.ts
@@ -0,0 +1,55 @@
+// 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 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";
+import { Document, HeadingLevel, Packer, Paragraph, TextRun } 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",
+ }),
+ 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
+ }),
+ ],
+ }),
+ ],
+});
+
+Packer.toBuffer(doc).then((buffer) => {
+ fs.writeFileSync("My Document.docx", buffer);
+});
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/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..9d2150a441 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,13 +1,3 @@
-
-
-
-
-
- Easily generate .docx files with JS/TS. Works for Node and on the Browser. :100:
-
-
----
-
# Welcome
## Installation
@@ -50,9 +40,9 @@ doc.addSection({
bold: true,
}),
new TextRun({
- text: "Github is the best",
+ text: "\tGithub is the best",
bold: true,
- }).tab(),
+ }),
],
}),
],
@@ -63,17 +53,11 @@ 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.
```
-## Honoured Mentions
-
-[@felipeochoa](https://github.com/felipeochoa)
-
-[@h4buli](https://github.com/h4buli)
-
-
+
---
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 @@
+
+
+> 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..5d2ba31551 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
@@ -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/clippy.png b/docs/clippy.png
new file mode 100644
index 0000000000..97bd4af2df
Binary files /dev/null and b/docs/clippy.png differ
diff --git a/docs/clippy.psd b/docs/clippy.psd
new file mode 100644
index 0000000000..0d32ab12d0
Binary files /dev/null and b/docs/clippy.psd differ
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 9af955e10e..13c52ae6da 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,31 +1,36 @@
+
+
+ docx - Generate .docx documents with JavaScript
+
+
+
+
+
-
-
- docx - Generate .docx documents with JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
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/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/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/docs/usage/styling-with-js.md b/docs/usage/styling-with-js.md
index 26d294c942..0dafac2904 100644
--- a/docs/usage/styling-with-js.md
+++ b/docs/usage/styling-with-js.md
@@ -22,10 +22,11 @@ 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
+- `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)
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/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
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
diff --git a/package-lock.json b/package-lock.json
index 90cf8f386f..d73f9f5d71 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,27 +1,123 @@
{
"name": "docx",
- "version": "5.0.0-rc7",
+ "version": "5.3.0",
"lockfileVersion": 1,
"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": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.0.tgz",
+ "integrity": "sha512-mkLq8nwaXmDtFmRkQ8ED/eA2CnVw4zr7dCztKalZXBvdK5EeNUAesrrwUqjQEzFgomJssayzB0aqlOsP1vGLqg==",
+ "dev": true,
+ "requires": {
+ "@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.6.4",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.6.4.tgz",
- "integrity": "sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w==",
+ "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.6.3",
+ "@babel/types": "^7.11.0",
"jsesc": "^2.5.1",
- "lodash": "^4.17.13",
"source-map": "^0.5.0"
},
"dependencies": {
@@ -31,12 +127,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",
@@ -46,42 +136,123 @@
}
},
"@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": {
- "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": {
@@ -94,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": {
@@ -151,10 +361,10 @@
"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==",
+ "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": {
@@ -166,22 +376,16 @@
}
},
"@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": {
- "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",
@@ -190,10 +394,77 @@
}
}
},
+ "@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",
+ "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",
- "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"
@@ -207,24 +478,42 @@
}
}
},
- "@sinonjs/formatio": {
- "version": "2.0.0",
- "resolved": "https://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.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.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": {
@@ -233,6 +522,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",
@@ -240,9 +538,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": {
@@ -257,73 +555,20 @@
"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",
- "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==",
- "dev": true,
- "requires": {
- "@types/node": "*"
- }
- },
- "@types/fs-extra": {
- "version": "5.0.1",
- "resolved": "https://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==",
+ "@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.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/lodash": {
- "version": "4.14.104",
- "resolved": "https://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",
@@ -331,88 +576,132 @@
"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.3",
+ "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.3.tgz",
+ "integrity": "sha512-vyxR57nv8NfcU0GZu8EUXZLTbCMupIUwy95LJ6lllN+JRPG25CwMHoB1q5xKh8YKhQnHYRAn4yW2yuHbf/5xgg==",
"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": "14.6.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.2.tgz",
+ "integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A=="
},
"@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": "*",
"@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",
+ "integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=",
+ "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/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": {
- "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": {
- "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.22",
+ "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.22.tgz",
+ "integrity": "sha512-JQDJK6pj8OMV9gWOnN1dcLCyU9Hzs6lux0wBO4lr1+gyEhIBR9U3FMrz12t2GPkg110XAxEAw2WHF6g7nZIbRQ==",
"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",
@@ -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",
@@ -477,20 +776,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",
@@ -602,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": {
@@ -616,6 +937,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",
@@ -643,12 +970,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",
@@ -670,12 +991,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",
@@ -753,6 +1068,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",
@@ -767,7 +1088,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": {
@@ -787,9 +1108,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": {
@@ -863,17 +1184,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",
@@ -940,6 +1250,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",
@@ -1029,9 +1348,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": {
@@ -1041,25 +1360,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"
+ }
}
}
},
@@ -1116,7 +1462,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": {
@@ -1153,7 +1499,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": {
@@ -1187,7 +1533,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": {
@@ -1237,48 +1583,70 @@
"unset-value": "^1.0.0"
}
},
- "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==",
+ "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": {
- "hasha": "^3.0.0",
- "make-dir": "^2.0.0",
- "package-hash": "^3.0.0",
- "write-file-atomic": "^2.4.2"
+ "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": {
- "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==",
+ "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": {
- "pify": "^4.0.1",
- "semver": "^5.6.0"
+ "pump": "^3.0.0"
}
},
- "pify": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
- "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
+ "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": "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": "^5.0.0",
+ "make-dir": "^3.0.0",
+ "package-hash": "^4.0.0",
+ "write-file-atomic": "^3.0.0"
+ },
+ "dependencies": {
+ "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": {
+ "imurmurhash": "^0.1.4",
+ "is-typedarray": "^1.0.0",
+ "signal-exit": "^3.0.2",
+ "typedarray-to-buffer": "^3.1.5"
+ }
+ }
+ }
+ },
"camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"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",
@@ -1297,7 +1665,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": {
@@ -1317,12 +1685,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",
@@ -1361,9 +1723,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": {
@@ -1399,31 +1761,22 @@
}
}
},
- "cli-boxes": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz",
- "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=",
+ "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-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": {
+ "cli-boxes": {
"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": {
@@ -1465,6 +1818,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",
@@ -1554,9 +1916,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",
@@ -1565,6 +1927,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": {
@@ -1627,16 +2006,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": {
@@ -1649,18 +2027,9 @@
"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": "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": {
@@ -1673,7 +2042,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": {
@@ -1773,9 +2142,18 @@
"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": "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": {
@@ -1803,22 +2181,28 @@
"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
}
}
},
+ "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",
@@ -1912,7 +2296,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": {
@@ -1922,168 +2306,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
}
}
},
@@ -2093,10 +2524,16 @@
"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",
- "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"
@@ -2125,9 +2562,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",
@@ -2157,15 +2594,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",
@@ -2508,17 +2936,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",
@@ -2609,20 +3026,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",
@@ -2668,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": {
@@ -2722,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"
}
}
}
@@ -2775,13 +3196,19 @@
"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": "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"
}
@@ -3406,12 +3833,30 @@
}
}
},
+ "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",
+ "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",
@@ -3437,9 +3882,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",
@@ -3546,30 +3991,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": {
@@ -3585,15 +4022,30 @@
"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.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": {
@@ -3613,21 +4065,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": {
@@ -3685,6 +4137,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",
@@ -3706,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": {
@@ -3721,9 +4194,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": {
@@ -3743,6 +4216,18 @@
"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",
+ "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",
@@ -3779,15 +4264,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",
@@ -3811,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",
@@ -3832,54 +4314,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",
@@ -3943,12 +4377,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": {
@@ -4060,9 +4494,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": {
@@ -4121,24 +4555,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",
@@ -4169,6 +4585,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",
@@ -4211,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": {
@@ -4234,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": {
@@ -4301,44 +4790,35 @@
}
},
"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": {
+ "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",
@@ -4367,18 +4847,18 @@
"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",
"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",
@@ -4428,9 +4908,9 @@
}
},
"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==",
"requires": {
"lie": "~3.3.0",
"pako": "~1.0.2",
@@ -4439,11 +4919,20 @@
}
},
"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.1",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.1.tgz",
+ "integrity": "sha512-aWgeGFW67BP3e5181Ep1Fv2v8z//iBJfrvyTnq8wG86vEESwmonn1zPBJ0VfmT9CJq2FIT0VsETtrNFm2a+SHA==",
"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",
@@ -4451,12 +4940,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": {
@@ -4483,19 +4972,133 @@
}
},
"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",
+ "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"dev": true,
"requires": {
@@ -4542,9 +5145,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.19",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
+ "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"dev": true
},
"lodash.assign": {
@@ -4565,12 +5168,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",
@@ -4602,27 +5199,33 @@
"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": "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
}
}
},
"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": {
@@ -4650,9 +5253,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": {
@@ -4673,9 +5276,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": {
@@ -4707,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",
@@ -4754,18 +5348,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": {
@@ -4774,6 +5368,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",
@@ -4953,6 +5559,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",
@@ -4974,7 +5585,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
},
@@ -4992,7 +5603,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
},
@@ -5003,45 +5614,23 @@
"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": {
- "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.1",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
+ "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
+ "dev": true
},
"node-libs-browser": {
"version": "2.2.1",
@@ -5082,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",
@@ -5109,6 +5707,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",
@@ -5125,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",
@@ -5170,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": {
@@ -5208,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": {
@@ -5259,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": {
@@ -5286,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": {
@@ -5303,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",
@@ -5421,94 +6074,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"
- }
- },
- "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",
- "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": {
@@ -5517,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",
@@ -5538,10 +6116,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": {
@@ -5550,6 +6128,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",
@@ -5580,6 +6167,24 @@
"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",
+ "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",
@@ -5587,27 +6192,35 @@
"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"
}
},
"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": {
@@ -5725,9 +6338,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"
@@ -5771,6 +6384,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",
@@ -5793,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
}
}
},
@@ -5836,9 +6480,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": {
@@ -5848,15 +6492,15 @@
"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.1.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz",
+ "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==",
"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.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"
@@ -5873,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",
@@ -6079,12 +6732,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",
@@ -6105,22 +6752,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": {
@@ -6315,9 +6961,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",
@@ -6327,7 +6973,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",
@@ -6337,30 +6983,42 @@
"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": {
- "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": {
@@ -6385,15 +7043,15 @@
}
},
"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": {
- "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": {
@@ -6402,14 +7060,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": {
@@ -6434,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"
@@ -6452,21 +7109,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",
@@ -6474,7 +7116,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": {
@@ -6487,12 +7129,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",
@@ -6618,7 +7254,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": {
@@ -6642,9 +7278,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",
@@ -6652,6 +7288,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",
@@ -6659,25 +7303,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.2.0",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.0.tgz",
+ "integrity": "sha512-eSNXz1XMcGEMHw08NJXSyTHIu6qTCOiN8x9ODACmZpNQpr0aXTBXBnI4xTzQzR+TEpOmLiKowGf9flCuKIzsbw==",
"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.8.1",
+ "@sinonjs/fake-timers": "^6.0.1",
+ "@sinonjs/formatio": "^5.0.1",
+ "@sinonjs/samsam": "^5.2.0",
+ "diff": "^4.0.2",
+ "nise": "^4.0.4",
+ "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.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"
+ }
}
}
},
@@ -6846,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"
@@ -7051,10 +7719,19 @@
},
"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
},
+ "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",
@@ -7109,110 +7786,16 @@
}
},
"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"
}
},
- "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",
@@ -7230,20 +7813,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",
@@ -7276,6 +7850,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",
@@ -7335,46 +7915,84 @@
"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": "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": {
- "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": {
- "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": {
@@ -7431,47 +8049,56 @@
"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",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
- "typedoc": {
- "version": "0.11.1",
- "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.11.1.tgz",
- "integrity": "sha512-jdNIoHm5wkZqxQTe/g9AQ3LKnZyrzHXqu6A/c9GUOeJyBWLxNr7/Dm3rwFvLksuxRNwTvY/0HRDU9sJTa9WQSg==",
+ "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",
+ "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",
@@ -7480,18 +8107,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",
@@ -7597,10 +8230,10 @@
}
}
},
- "ultron": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz",
- "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=",
+ "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": {
@@ -7676,12 +8309,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",
@@ -7689,19 +8316,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"
}
@@ -7740,12 +8369,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": {
@@ -7788,6 +8417,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": {
@@ -8014,7 +8654,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": {
@@ -8215,7 +8855,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": {
@@ -8248,12 +8888,6 @@
}
}
},
- "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": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
@@ -8304,13 +8938,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": {
@@ -8443,9 +9076,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 976e4d23f3..51e1b246c3 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)",
+ "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": {
"pretest": "rimraf ./build",
@@ -50,7 +50,9 @@
"types": "./build/index.d.ts",
"dependencies": {
"@types/jszip": "^3.1.4",
+ "@types/node": "^14.0.5",
"jszip": "^3.1.5",
+ "shortid": "^2.2.15",
"xml": "^1.0.1",
"xml-js": "^1.6.8"
},
@@ -62,9 +64,10 @@
"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/sinon": "^4.3.1",
+ "@types/shortid": "0.0.29",
+ "@types/sinon": "^9.0.4",
"@types/webpack": "^4.4.24",
"awesome-typescript-loader": "^3.4.1",
"chai": "^3.5.0",
@@ -74,24 +77,24 @@
"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",
+ "prettier": "^2.0.5",
"prompt": "^1.0.0",
"replace-in-file": "^3.1.0",
"request": "^2.88.0",
"request-promise": "^4.2.2",
- "rimraf": "^2.5.2",
- "shelljs": "^0.7.7",
- "sinon": "^5.0.7",
- "ts-node": "^7.0.1",
- "tslint": "^5.11.0",
+ "rimraf": "^3.0.2",
+ "shelljs": "^0.8.4",
+ "sinon": "^9.0.2",
+ "ts-node": "^9.0.0",
+ "tslint": "^6.1.3",
"tslint-immutable": "^4.9.0",
- "typedoc": "^0.11.1",
+ "typedoc": "^0.16.11",
"typescript": "2.9.2",
"webpack": "^3.10.0"
},
"engines": {
- "node": ">=8"
+ "node": ">=10"
}
}
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.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/next-compiler.ts b/src/export/packer/next-compiler.ts
index 6a3e752098..a7b5fb617e 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 {
@@ -68,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 {
@@ -82,24 +85,25 @@ 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",
},
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",
},
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",
@@ -108,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) => {
@@ -128,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) => {
@@ -145,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);
@@ -161,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);
@@ -172,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/export/packer/numbering-replacer.ts b/src/export/packer/numbering-replacer.ts
new file mode 100644
index 0000000000..4ac5dcbf1d
--- /dev/null
+++ 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/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/core-properties/properties.ts b/src/file/core-properties/properties.ts
index a99c74d98f..ceddff39e0 100644
--- a/src/file/core-properties/properties.ts
+++ b/src/file/core-properties/properties.ts
@@ -1,9 +1,22 @@
import { XmlComponent } from "file/xml-components";
import { DocumentAttributes } from "../document/document-attributes";
+import { INumberingOptions } from "../numbering";
+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;
@@ -14,6 +27,11 @@ export interface IPropertiesOptions {
readonly revision?: string;
readonly externalStyles?: string;
readonly styles?: IStylesOptions;
+ readonly numbering?: INumberingOptions;
+ readonly footnotes?: Paragraph[];
+ readonly hyperlinks?: {
+ readonly [key: string]: IInternalHyperlinkDefinition | IExternalHyperlinkDefinition;
+ };
}
export class CoreProperties extends XmlComponent {
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..ea0d24a448 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,13 @@ 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.splice(0, 1);
this.root.push(this.sections.pop() as SectionProperties);
}
- return super.prepForXml();
+ return super.prepForXml(file);
}
public push(component: XmlComponent): void {
@@ -43,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/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/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 {
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"]);
diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts
index 072f68acca..37e09e4498 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,
+ verticalAlign,
} = options;
this.options = options;
@@ -121,6 +124,10 @@ export class SectionProperties extends XmlComponent {
if (titlePage) {
this.root.push(new TitlePage());
}
+
+ if (verticalAlign) {
+ this.root.push(new SectionVerticalAlign(verticalAlign));
+ }
}
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..fa09712a00
--- /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 verticalAlign?: SectionVerticalAlignValue;
+}
+
+export class SectionVerticalAlignAttributes extends XmlAttributeComponent {
+ protected readonly xmlKeys = {
+ 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
new file mode 100644
index 0000000000..b025059d16
--- /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({ verticalAlign: value }));
+ }
+}
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.spec.ts b/src/file/file.spec.ts
index b82748ca54..6ec30e1be9 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";
@@ -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,98 @@ 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");
+ });
+
+ 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: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({});
});
});
@@ -102,6 +187,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");
@@ -148,13 +243,196 @@ 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(""));
+ describe("#HyperlinkCache", () => {
+ it("should initially have empty hyperlink cache", () => {
+ const file = new File();
- expect(spy.called).to.equal(true);
+ expect(file.HyperlinkCache).to.deep.equal({});
+ });
+ });
+
+ describe("#createFootnote", () => {
+ it("should create footnote", () => {
+ const wrapper = new File({
+ footnotes: [new Paragraph("hello")],
+ });
+
+ 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 ccf5fe374c..270714ed17 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";
@@ -16,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 { Hyperlink, HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph";
import { Relationships } from "./relationships";
import { TargetModeType } from "./relationships/relationship/relationship";
import { Settings } from "./settings";
@@ -40,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 {
@@ -60,6 +61,7 @@ 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 = {
@@ -71,7 +73,13 @@ export class File {
sections: ISectionOptions[] = [],
) {
this.coreProperties = new CoreProperties(options);
- this.numbering = new Numbering();
+ this.numbering = new Numbering(
+ options.numbering
+ ? options.numbering
+ : {
+ config: [],
+ },
+ );
this.docRelationships = new Relationships();
this.fileRelationships = new Relationships();
this.appProperties = new AppProperties();
@@ -126,33 +134,42 @@ 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);
}
}
- }
- public createHyperlink(link: string, text?: string): Hyperlink {
- const newText = text === undefined ? link : text;
- const hyperlink = new Hyperlink(newText, this.docRelationships.RelationshipCount);
- this.docRelationships.createRelationship(
- hyperlink.linkId,
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
- link,
- TargetModeType.EXTERNAL,
- );
- return hyperlink;
- }
+ if (options.footnotes) {
+ for (const paragraph of options.footnotes) {
+ this.footNotes.createFootNote(paragraph);
+ }
+ }
- public createInternalHyperLink(anchor: string, text?: string): Hyperlink {
- const newText = text === undefined ? anchor : text;
- const hyperlink = new Hyperlink(newText, this.docRelationships.RelationshipCount, anchor);
- // NOTE: unlike File#createHyperlink(), since the link is to an internal bookmark
- // we don't need to create a new relationship.
- return hyperlink;
- }
+ if (options.hyperlinks) {
+ const cache = {};
- public createBookmark(name: string, text: string = name): Bookmark {
- return new Bookmark(name, text, this.docRelationships.RelationshipCount);
+ for (const key in options.hyperlinks) {
+ if (!options.hyperlinks[key]) {
+ continue;
+ }
+
+ 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;
+ }
+
+ this.hyperlinkCache = cache;
+ }
}
public addSection({
@@ -180,20 +197,40 @@ 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);
}
}
- public createFootnote(paragraph: Paragraph): void {
- this.footNotes.createFootNote(paragraph);
- }
-
public verifyUpdateFields(): void {
if (this.document.getTablesOfContents().length) {
this.settings.addUpdateFields();
}
}
+ 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",
+ link,
+ TargetModeType.EXTERNAL,
+ );
+ 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++);
@@ -326,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/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/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/index.ts b/src/file/index.ts
index d14d4d9b1a..18f0a595e4 100644
--- a/src/file/index.ts
+++ b/src/file/index.ts
@@ -12,3 +12,5 @@ export * from "./xml-components";
export * from "./header-wrapper";
export * from "./footer-wrapper";
export * from "./header";
+export * from "./footnotes";
+export * from "./track-revision";
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/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts
new file mode 100644
index 0000000000..ef1df0de4c
--- /dev/null
+++ b/src/file/numbering/abstract-numbering.spec.ts
@@ -0,0 +1,823 @@
+import { expect } from "chai";
+
+import { Formatter } from "export/formatter";
+import { EMPTY_OBJECT } from "file/xml-components";
+
+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", () => {
+ 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, [
+ {
+ 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 } } });
+ 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", () => {
+ 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 } } });
+ 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)" } } });
+ });
+
+ 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, [
+ {
+ 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 } } }],
+ });
+ });
+
+ it("#spacing", () => {
+ 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 } } }],
+ });
+ });
+
+ it("#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" } } }],
+ });
+ });
+
+ it("#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" } } }],
+ });
+ });
+
+ it("#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" } } }],
+ });
+ });
+
+ it("#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" } } }],
+ });
+ });
+
+ it("#thematicBreak", () => {
+ 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": [
+ {
+ "w:pBdr": [
+ {
+ "w:bottom": {
+ _attr: {
+ "w:color": "auto",
+ "w:space": 1,
+ "w:val": "single",
+ "w:sz": 6,
+ },
+ },
+ },
+ ],
+ },
+ ],
+ });
+ });
+
+ it("#leftTabStop", () => {
+ 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": [
+ {
+ "w:tabs": [{ "w:tab": { _attr: { "w:val": "left", "w:pos": 1200 } } }],
+ },
+ ],
+ });
+ });
+
+ it("#maxRightTabStop", () => {
+ 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": [
+ {
+ "w:tabs": [{ "w:tab": { _attr: { "w:val": "right", "w:pos": 9026 } } }],
+ },
+ ],
+ });
+ });
+
+ it("#keepLines", () => {
+ 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 }],
+ });
+ });
+
+ it("#keepNext", () => {
+ 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 }],
+ });
+ });
+ });
+
+ describe("formatting methods: run properties", () => {
+ 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": expected });
+ });
+ });
+
+ it("#smallCaps", () => {
+ 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 } } }],
+ });
+ });
+
+ it("#allCaps", () => {
+ 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 } } }],
+ });
+ });
+
+ it("#strike", () => {
+ 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({
+ "w:rPr": [{ "w:strike": { _attr: { "w:val": true } } }],
+ });
+ });
+
+ it("#doubleStrike", () => {
+ 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 } } }],
+ });
+ });
+
+ it("#subScript", () => {
+ 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" } } }],
+ });
+ });
+
+ it("#superScript", () => {
+ 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" } } }],
+ });
+ });
+
+ it("#font by name", () => {
+ 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": [
+ {
+ "w:rFonts": {
+ _attr: {
+ "w:ascii": "Times",
+ "w:cs": "Times",
+ "w:eastAsia": "Times",
+ "w:hAnsi": "Times",
+ },
+ },
+ },
+ ],
+ });
+ });
+
+ 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",
+ },
+ },
+ },
+ ],
+ });
+ });
+
+ 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": expected });
+ });
+ });
+
+ 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": expected });
+ });
+ });
+
+ 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": expected });
+ });
+ });
+
+ 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": expected });
+ });
+ });
+
+ describe("#underline", () => {
+ it("should set underline to 'single' if no arguments are given", () => {
+ 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" } } }],
+ });
+ });
+
+ it("should set the style if given", () => {
+ 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" } } }],
+ });
+ });
+
+ it("should set the style and color if given", () => {
+ 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" } } }],
+ });
+ });
+ });
+
+ 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, [
+ {
+ 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 e42e2e4fc8..2eed73fe39 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 {
@@ -17,7 +18,7 @@ class AbstractNumberingAttributes extends XmlAttributeComponent {
+ describe("#overrideLevel", () => {
+ let concreteNumbering: 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 } },
+ { "w:start": { _attr: { "w:val": 1 } } },
+ { "w:lvlJc": { _attr: { "w:val": "start" } } },
+ ],
+ },
+ ],
+ });
+ });
+
+ 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 } },
+ { "w:start": { _attr: { "w:val": 1 } } },
+ { "w:lvlJc": { _attr: { "w:val": "start" } } },
+ ],
+ },
+ ],
+ });
+ });
+
+ 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: { "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 bdc65fbba4..6a68f0712f 100644
--- a/src/file/numbering/level.ts
+++ b/src/file/numbering/level.ts
@@ -1,21 +1,7 @@
import { Attributes, XmlAttributeComponent, XmlComponent } from "file/xml-components";
-import {
- Alignment,
- AlignmentType,
- IIndentAttributesProperties,
- Indent,
- ISpacingProperties,
- 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 { UnderlineType } from "../paragraph/run/underline";
+import { AlignmentType } from "../paragraph/formatting";
+import { IParagraphStylePropertiesOptions, ParagraphProperties } from "../paragraph/properties";
+import { IRunStylePropertiesOptions, RunProperties } from "../paragraph/run/properties";
interface ILevelAttributesProperties {
readonly ilvl?: number;
@@ -63,7 +49,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 +65,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?: IRunStylePropertiesOptions;
+ readonly paragraph?: IParagraphStylePropertiesOptions;
+ };
+}
+
class Suffix extends XmlComponent {
constructor(value: LevelSuffix) {
super("w:suff");
@@ -94,7 +93,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 +102,34 @@ 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 LevelJc(alignment));
+
+ if (format) {
+ this.root.push(new NumberFormat(format));
}
- this.paragraphProperties = new ParagraphProperties({});
- this.runProperties = new RunProperties();
+ if (text) {
+ this.root.push(new LevelText(text));
+ }
+
+ this.paragraphProperties = new ParagraphProperties(style && style.paragraph);
+ this.runProperties = new RunProperties(style && style.run);
this.root.push(this.paragraphProperties);
this.root.push(this.runProperties);
- }
- public setSuffix(value: LevelSuffix): LevelBase {
- this.root.push(new Suffix(value));
- return this;
- }
-
- public addParagraphProperty(property: XmlComponent): Level {
- this.paragraphProperties.push(property);
- return this;
- }
-
- public addRunProperty(property: XmlComponent): Level {
- this.runProperties.push(property);
- return this;
- }
-
- // ---------- Run formatting ---------------------- //
-
- public size(twips: number): Level {
- this.addRunProperty(new formatting.Size(twips));
- return this;
- }
-
- public bold(): Level {
- this.addRunProperty(new formatting.Bold());
- return this;
- }
-
- public italics(): Level {
- this.addRunProperty(new formatting.Italics());
- return this;
- }
-
- public smallCaps(): Level {
- this.addRunProperty(new formatting.SmallCaps());
- return this;
- }
-
- public allCaps(): Level {
- this.addRunProperty(new formatting.Caps());
- return this;
- }
-
- public strike(): Level {
- this.addRunProperty(new formatting.Strike());
- return this;
- }
-
- public doubleStrike(): Level {
- this.addRunProperty(new formatting.DoubleStrike());
- return this;
- }
-
- public subScript(): Level {
- this.addRunProperty(new formatting.SubScript());
- return this;
- }
-
- public superScript(): Level {
- this.addRunProperty(new formatting.SuperScript());
- return this;
- }
-
- public underline(underlineType?: UnderlineType, color?: string): Level {
- this.addRunProperty(new formatting.Underline(underlineType, color));
- return this;
- }
-
- public color(color: string): Level {
- this.addRunProperty(new formatting.Color(color));
- return this;
- }
-
- public font(fontName: string): Level {
- this.addRunProperty(new formatting.RunFonts(fontName));
- return this;
- }
-
- public highlight(color: string): Level {
- this.addRunProperty(new formatting.Highlight(color));
- return this;
- }
-
- public shadow(value: string, fill: string, color: string): Level {
- this.addRunProperty(new formatting.Shading(value, fill, color));
- return this;
- }
- // --------------------- Paragraph formatting ------------------------ //
-
- public center(): Level {
- this.addParagraphProperty(new Alignment(AlignmentType.CENTER));
- return this;
- }
-
- public left(): Level {
- this.addParagraphProperty(new Alignment(AlignmentType.LEFT));
- return this;
- }
-
- public right(): Level {
- this.addParagraphProperty(new Alignment(AlignmentType.RIGHT));
- return this;
- }
-
- public justified(): Level {
- this.addParagraphProperty(new Alignment(AlignmentType.BOTH));
- return this;
- }
-
- 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 (suffix) {
+ this.root.push(new Suffix(suffix));
+ }
}
}
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..e459b03d11 100644
--- a/src/file/numbering/num.ts
+++ b/src/file/numbering/num.ts
@@ -20,10 +20,10 @@ 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) {
+ constructor(numId: number, abstractNumId: number, public readonly reference?: string) {
super("w:num");
this.root.push(
new NumAttributes({
@@ -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/numbering/numbering.spec.ts b/src/file/numbering/numbering.spec.ts
index d5f2f9e168..79a824b67a 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({
+ config: [],
+ });
+
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..a02caf6bef 100644
--- a/src/file/numbering/numbering.ts
+++ b/src/file/numbering/numbering.ts
@@ -1,17 +1,27 @@
-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 { ILevelsOptions } from "./level";
+import { ConcreteNumbering } from "./num";
+
+export interface INumberingOptions {
+ readonly config: {
+ 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() {
+ constructor(options: INumberingOptions) {
super("w:numbering");
this.root.push(
new DocumentAttributes({
@@ -37,39 +47,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([
+ {
+ 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;
+ for (const con of options.config) {
+ const currentAbstractNumbering = this.createAbstractNumbering(con.levels);
+ this.createConcreteNumbering(currentAbstractNumbering, con.reference);
+ }
}
public prepForXml(): IXmlableObject | undefined {
@@ -77,4 +162,20 @@ export class Numbering extends XmlComponent {
this.concreteNumbering.forEach((x) => this.root.push(x));
return super.prepForXml();
}
+
+ 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: 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/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/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 {
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 c8c339e578..261a756864 100644
--- a/src/file/paragraph/links/bookmark.ts
+++ b/src/file/paragraph/links/bookmark.ts
@@ -1,49 +1,41 @@
// 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";
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);
}
diff --git a/src/file/paragraph/links/hyperlink.spec.ts b/src/file/paragraph/links/hyperlink.spec.ts
index 09dd07b86f..4b06a933f5 100644
--- a/src/file/paragraph/links/hyperlink.spec.ts
+++ b/src/file/paragraph/links/hyperlink.spec.ts
@@ -3,12 +3,13 @@ import { expect } from "chai";
import { Formatter } from "export/formatter";
import { Hyperlink } from "./";
+import { HyperlinkRef } from "./hyperlink";
describe("Hyperlink", () => {
let hyperlink: Hyperlink;
beforeEach(() => {
- hyperlink = new Hyperlink("https://example.com", 0);
+ hyperlink = new Hyperlink("https://example.com", "superid");
});
describe("#constructor()", () => {
@@ -19,7 +20,7 @@ describe("Hyperlink", () => {
{
_attr: {
"w:history": 1,
- "r:id": "rId1",
+ "r:id": "rIdsuperid",
},
},
{
@@ -34,7 +35,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", () => {
@@ -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/links/hyperlink.ts b/src/file/paragraph/links/hyperlink.ts
index b41980ed77..302acfd603 100644
--- a/src/file/paragraph/links/hyperlink.ts
+++ b/src/file/paragraph/links/hyperlink.ts
@@ -3,14 +3,23 @@ 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) {}
+}
+
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/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts
index e8e5f6c8c9..04cc8af8e4 100644
--- a/src/file/paragraph/paragraph.spec.ts
+++ b/src/file/paragraph/paragraph.spec.ts
@@ -1,10 +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 { Numbering } from "../numbering";
import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting";
+import { Bookmark } from "./links";
import { Paragraph } from "./paragraph";
describe("Paragraph", () => {
@@ -540,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" } },
});
@@ -560,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" } },
});
@@ -580,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 } } }],
});
@@ -596,40 +580,24 @@ 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 paragraph = new Paragraph({
numbering: {
- num: letterNumbering,
+ reference: "test id",
level: 0,
},
});
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" } },
});
});
it("it should add numbered properties", () => {
- const numbering = new Numbering();
- const numberedAbstract = numbering.createAbstractNumbering();
- numberedAbstract.createLevel(0, "lowerLetter", "%1)", "start");
- const letterNumbering = numbering.createConcreteNumbering(numberedAbstract);
-
const paragraph = new Paragraph({
numbering: {
- num: letterNumbering,
+ reference: "test id",
level: 0,
},
});
@@ -640,10 +608,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}" } } }],
},
],
},
@@ -652,6 +617,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({
diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts
index 9fc0f99167..68fa7d00d4 100644
--- a/src/file/paragraph/paragraph.ts
+++ b/src/file/paragraph/paragraph.ts
@@ -1,52 +1,30 @@
// http://officeopenxml.com/WPparagraph.php
import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run";
-import { Num } from "file/numbering/num";
-import { XmlComponent } from "file/xml-components";
+import { IXmlableObject, XmlComponent } from "file/xml-components";
-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, Hyperlink, OutlineLevel } from "./links";
+import { PageBreak } from "./formatting/page-break";
+import { Bookmark, HyperlinkRef } from "./links";
import { Math } from "./math";
-import { ParagraphProperties } from "./properties";
+import { File } from "../file";
+import { InsertedTextRun, DeletedTextRun } from "../track-revision";
+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 num: Num;
- readonly level: number;
- readonly custom?: boolean;
- };
- readonly children?: Array;
+ readonly children?: (
+ | TextRun
+ | PictureRun
+ | SymbolRun
+ | Bookmark
+ | PageBreak
+ | SequentialIdentifier
+ | FootnoteReferenceRun
+ | HyperlinkRef
+ | InsertedTextRun
+ | DeletedTextRun
+ | Math
+ )[];
}
export class Paragraph extends XmlComponent {
@@ -69,9 +47,7 @@ export class Paragraph extends XmlComponent {
return;
}
- this.properties = new ParagraphProperties({
- border: options.border,
- });
+ this.properties = new ParagraphProperties(options);
this.root.push(this.properties);
@@ -79,72 +55,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.num.id, options.numbering.level));
- }
-
if (options.children) {
for (const child of options.children) {
if (child instanceof Bookmark) {
@@ -159,9 +69,15 @@ export class Paragraph extends XmlComponent {
}
}
- public referenceFootnote(id: number): Paragraph {
- this.root.push(new FootnoteReferenceRun(id));
- return this;
+ 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 {
diff --git a/src/file/paragraph/properties.ts b/src/file/paragraph/properties.ts
index 35836ce30e..af97e2c684 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?: {
+ 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/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..3ef041d7d9 100644
--- a/src/file/paragraph/run/formatting.ts
+++ b/src/file/paragraph/run/formatting.ts
@@ -1,7 +1,9 @@
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() {
@@ -113,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 353e794c06..3bf62d66cf 100644
--- a/src/file/paragraph/run/index.ts
+++ b/src/file/paragraph/run/index.ts
@@ -1,7 +1,10 @@
export * from "./run";
+export * from "./properties";
export * from "./text-run";
export * from "./symbol-run";
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/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/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-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-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-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 {
@@ -82,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({
@@ -89,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 } } }] }],
});
});
});
@@ -101,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 } } }] }],
});
});
});
@@ -130,6 +157,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({
@@ -197,17 +248,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({
@@ -220,7 +260,42 @@ 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",
+ },
+ },
+ },
+ ],
+ },
+ ],
+ });
+ });
+
+ 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",
+ },
+ },
+ },
],
},
],
@@ -270,8 +345,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 +363,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 +381,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..bf7903e35e 100644
--- a/src/file/paragraph/run/run.ts
+++ b/src/file/paragraph/run/run.ts
@@ -1,63 +1,23 @@
// 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 { 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 { RunFonts } from "./run-fonts";
-import { SubScript, SuperScript } from "./script";
-import { Style } from "./style";
-import { Tab } from "./tab";
-import { Underline, UnderlineType } from "./underline";
+import { IRunPropertiesOptions, RunProperties } from "./properties";
+import { Text } from "./run-components/text";
-export interface IRunOptions {
- readonly bold?: true;
- readonly italics?: true;
- readonly underline?: {
- readonly color?: string;
- readonly type?: UnderlineType;
- };
- 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?: {
- readonly name: string;
- readonly hint?: string;
- };
- readonly highlight?: string;
- readonly shading?: {
- readonly type: ShadingType;
- readonly fill: string;
- readonly color: string;
- };
- readonly children?: Array;
+export interface IRunOptions extends IRunPropertiesOptions {
+ readonly children?: (Begin | FieldInstruction | Separate | End | PageNumber | FootnoteReferenceRun | string)[];
+ 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 {
@@ -65,82 +25,42 @@ 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.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) {
- this.properties.push(new RunFonts(options.font.name, options.font.hint));
- }
-
- 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") {
+ 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 +68,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/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/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;
}
}
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);
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");
+ });
+ });
});
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");
+ }
+}
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,
+ },
+ },
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ });
+ });
+});
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 2b6c49e299..986aa6194d 100644
--- a/src/file/styles/defaults/index.ts
+++ b/src/file/styles/defaults/index.ts
@@ -1,16 +1,3 @@
-import { XmlComponent } from "file/xml-components";
-import { ParagraphPropertiesDefaults } from "./paragraph-properties";
-import { RunPropertiesDefaults } from "./run-properties";
-
-export class DocumentDefaults extends XmlComponent {
- private readonly runPropertiesDefaults: RunPropertiesDefaults;
- private readonly paragraphPropertiesDefaults: ParagraphPropertiesDefaults;
-
- constructor() {
- super("w:docDefaults");
- this.runPropertiesDefaults = new RunPropertiesDefaults();
- this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults();
- 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/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 1ab8f5752c..f4e594ab99 100644
--- a/src/file/styles/defaults/run-properties.ts
+++ b/src/file/styles/defaults/run-properties.ts
@@ -1,25 +1,12 @@
-import { Size, SizeComplexScript } from "file/paragraph/run/formatting";
-import { RunProperties } from "file/paragraph/run/properties";
-import { RunFonts } from "file/paragraph/run/run-fonts";
+import { IRunStylePropertiesOptions, RunProperties } from "file/paragraph/run/properties";
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);
}
-
- public size(size: number): RunPropertiesDefaults {
- this.properties.push(new Size(size));
- this.properties.push(new SizeComplexScript(size));
- return this;
- }
-
- public font(fontName: string): RunPropertiesDefaults {
- this.properties.push(new RunFonts(fontName));
- return this;
- }
}
diff --git a/src/file/styles/index.ts b/src/file/styles/index.ts
index 144bbcb1fd..e18813fbb8 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 "./defaults";
diff --git a/src/file/styles/style/character-style.spec.ts b/src/file/styles/style/character-style.spec.ts
index fe269bfceb..2fddce1c1b 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";
@@ -201,7 +202,7 @@ describe("CharacterStyle", () => {
});
});
- it("should add font", () => {
+ it("should add font by name", () => {
const style = new CharacterStyle({
id: "myStyleId",
run: {
@@ -240,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",
@@ -293,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,
+ },
+ ],
+ });
});
});
@@ -412,6 +474,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",
@@ -476,59 +598,91 @@ describe("CharacterStyle", () => {
});
});
- it("#bold", () => {
- const style = new CharacterStyle({
- id: "myStyleId",
- run: {
- bold: true,
- },
- });
- 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,
- },
- });
- 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,
+ },
+ ],
+ });
});
});
@@ -572,63 +726,141 @@ describe("CharacterStyle", () => {
});
});
- it("#highlight", () => {
- const style = new CharacterStyle({
- id: "myStyleId",
- run: {
- highlight: "005599",
- },
- });
- 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",
- },
+ 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" } } }],
- },
- {
- "w:uiPriority": {
- _attr: {
- "w:val": 99,
+ 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:unhideWhenUsed": EMPTY_OBJECT,
- },
- ],
+ {
+ "w:unhideWhenUsed": EMPTY_OBJECT,
+ },
+ ],
+ });
});
});
});
diff --git a/src/file/styles/style/character-style.ts b/src/file/styles/style/character-style.ts
index 32ff4b6b69..0191a0460e 100644
--- a/src/file/styles/style/character-style.ts
+++ b/src/file/styles/style/character-style.ts
@@ -1,6 +1,4 @@
-import * as formatting from "file/paragraph/run/formatting";
-import { RunProperties } from "file/paragraph/run/properties";
-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";
@@ -9,30 +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 color?: string;
- readonly font?: string;
- 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 {
@@ -45,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());
@@ -61,68 +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.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 93b0c6777c..92b798f862 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 },
+ ],
});
});
@@ -220,6 +228,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",
@@ -273,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 }] },
+ ],
});
});
@@ -286,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 }] },
+ ],
});
});
@@ -308,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 }],
+ });
});
});
@@ -434,7 +500,7 @@ describe("ParagraphStyle", () => {
});
});
- it("#font", () => {
+ it("#font by name", () => {
const style = new ParagraphStyle({
id: "myStyleId",
run: {
@@ -447,18 +513,30 @@ 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",
+ },
+ },
+ },
],
},
],
});
});
- it("#bold", () => {
+ it("#font for ascii and eastAsia", () => {
const style = new ParagraphStyle({
id: "myStyleId",
run: {
- bold: true,
+ font: {
+ ascii: "Times",
+ eastAsia: "KaiTi",
+ },
},
});
const tree = new Formatter().format(style);
@@ -466,67 +544,184 @@ describe("ParagraphStyle", () => {
"w:style": [
{ _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } },
{
- "w:rPr": [{ "w:b": { _attr: { "w:val": true } } }],
+ "w:rPr": [
+ {
+ "w:rFonts": {
+ _attr: {
+ "w:ascii": "Times",
+ "w:eastAsia": "KaiTi",
+ },
+ },
+ },
+ ],
},
],
});
});
- it("#italics", () => {
- const style = new ParagraphStyle({
- id: "myStyleId",
- run: {
- italics: true,
- },
- });
- 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 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("#highlight", () => {
- const style = new ParagraphStyle({
- id: "myStyleId",
- run: {
- highlight: "005599",
- },
- });
- 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 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("#shadow", () => {
- const style = new ParagraphStyle({
- id: "myStyleId",
- run: {
- shadow: {
- type: ShadingType.PERCENT_10,
- fill: "00FFFF",
- color: "FF0000",
- },
- },
+ 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 }],
+ });
});
- 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" } } }],
- },
+ });
+
+ 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 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 }],
+ });
});
});
@@ -591,6 +786,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",
@@ -613,7 +848,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" } } },
+ ],
});
});
@@ -621,7 +864,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 },
+ ],
});
});
@@ -646,7 +897,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 ab592a9fc6..635e7b7e2f 100644
--- a/src/file/styles/style/paragraph-style.ts
+++ b/src/file/styles/style/paragraph-style.ts
@@ -1,20 +1,5 @@
-import {
- Alignment,
- AlignmentType,
- Indent,
- ISpacingProperties,
- KeepLines,
- KeepNext,
- OutlineLevel,
- ParagraphProperties,
- Spacing,
- ThematicBreak,
-} from "file/paragraph";
-import { IIndentAttributesProperties, 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 { UnderlineType } from "file/paragraph/run/underline";
-import { ShadingType } from "file/table";
import { BasedOn, Link, Next, QuickFormat, SemiHidden, UiPriority, UnhideWhenUsed } from "./components";
import { Style } from "./style";
@@ -27,55 +12,25 @@ 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 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);
@@ -106,106 +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.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.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));
- }
- }
}
}
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-components.ts b/src/file/table/table-cell/table-cell-components.ts
index e16c2f6885..f3ebe570e9 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 {
+ 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 }> {
+ 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..2ba34bc9d4 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.BOTTOM_TO_TOP_LEFT_TO_RIGHT,
+ });
+
+ 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 469331bc08..6fbd748cf5 100644
--- a/src/file/table/table-cell/table-cell.ts
+++ b/src/file/table/table-cell/table-cell.ts
@@ -3,16 +3,18 @@ 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";
-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;
@@ -42,7 +44,7 @@ export interface ITableCellOptions {
readonly color: string;
};
};
- readonly children: Array;
+ readonly children: (Paragraph | Table)[];
}
export class TableCell extends XmlComponent {
@@ -62,8 +64,15 @@ 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);
+ } 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) {
@@ -78,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);
}
@@ -110,11 +115,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/table/table-properties/index.ts b/src/file/table/table-properties/index.ts
index dde973ee7a..c5b5935d7f 100644
--- a/src/file/table/table-properties/index.ts
+++ b/src/file/table/table-properties/index.ts
@@ -1,3 +1,5 @@
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-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 204bccf496..7c7ac96ca9 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, options.right.size, 0, options.right.color));
+ } 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-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.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 fd1f844978..8a7d000d5b 100644
--- a/src/file/table/table-properties/table-properties.ts
+++ b/src/file/table/table-properties/table-properties.ts
@@ -1,8 +1,10 @@
+// http://officeopenxml.com/WPtableProperties.php
import { IgnoreIfEmptyXmlComponent } from "file/xml-components";
+import { Alignment, AlignmentType } from "../../paragraph";
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 +29,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;
}
@@ -46,4 +48,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-row/table-row.spec.ts b/src/file/table/table-row/table-row.spec.ts
index e013153cd8..90f6ad4937 100644
--- a/src/file/table/table-row/table-row.spec.ts
+++ b/src/file/table/table-row/table-row.spec.ts
@@ -182,4 +182,97 @@ 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);
+
+ 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`);
+ });
+ });
+
+ 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);
+
+ 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", () => {
+ 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, true)).to.equal(5);
+ // 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 466b7eb320..11ea0bb2e2 100644
--- a/src/file/table/table-row/table-row.ts
+++ b/src/file/table/table-row/table-row.ts
@@ -46,8 +46,56 @@ 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);
}
+
+ 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;
+ while (colIdx <= columnIndex) {
+ if (rootIdx >= this.root.length) {
+ if (allowEndNewCell) {
+ // 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}`);
+ }
+ }
+ 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.spec.ts b/src/file/table/table.spec.ts
index d2aec26051..3165330047 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";
@@ -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: [
@@ -202,15 +268,32 @@ 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" } } }],
});
});
+ 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: [
@@ -229,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,
@@ -266,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": [
{
@@ -398,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,
diff --git a/src/file/table/table.ts b/src/file/table/table.ts
index 08bd47eda2..69b3c0f775 100644
--- a/src/file/table/table.ts
+++ b/src/file/table/table.ts
@@ -1,8 +1,10 @@
// 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 { 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 +34,8 @@ export interface ITableOptions {
};
readonly float?: ITableFloatOptions;
readonly layout?: TableLayoutType;
+ readonly borders?: ITableBordersOptions;
+ readonly alignment?: AlignmentType;
}
export class Table extends XmlComponent {
@@ -44,11 +48,18 @@ 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,
+ alignment,
}: 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);
@@ -67,27 +78,29 @@ 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) => {
+ 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 thisCellsColumnIndex = column.indexOf(cell);
- const endColumnIndex = thisCellsColumnIndex + (cell.options.rowSpan - 1);
-
- for (let i = thisCellsColumnIndex + 1; i <= endColumnIndex; i++) {
- rows[i].addCellToIndex(
- new TableCell({
- children: [],
- verticalMerge: VerticalMergeType.CONTINUE,
- }),
- i,
- );
- }
+ 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;
});
- }
+ });
if (float) {
this.properties.setTableFloatProperties(float);
@@ -96,5 +109,9 @@ export class Table extends XmlComponent {
if (layout) {
this.properties.setLayout(layout);
}
+
+ if (alignment) {
+ this.properties.setAlignment(alignment);
+ }
}
}
diff --git a/src/file/track-revision/index.ts b/src/file/track-revision/index.ts
new file mode 100644
index 0000000000..eb2465d8fe
--- /dev/null
+++ b/src/file/track-revision/index.ts
@@ -0,0 +1,2 @@
+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.ts b/src/file/track-revision/track-revision.ts
new file mode 100644
index 0000000000..4318e9a468
--- /dev/null
+++ b/src/file/track-revision/track-revision.ts
@@ -0,0 +1,15 @@
+import { XmlAttributeComponent } from "file/xml-components";
+
+export interface IChangedAttributesProperties {
+ readonly id: number;
+ readonly author: string;
+ readonly date: string;
+}
+
+export class ChangeAttributes extends XmlAttributeComponent {
+ protected readonly xmlKeys = {
+ id: "w:id",
+ author: "w:author",
+ date: "w:date",
+ };
+}
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..b06f73b930 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: (BaseXmlComponent | string | any)[];
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;
})
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);
}