@stll/docx-core 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-CKwRw-01.js +153 -0
- package/dist/{document-Bu82QPAC.d.ts → document-o2RiAASq.d.ts} +292 -38
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/index.d.ts +77 -2
- package/dist/index.js +202 -39
- package/dist/model/document.d.ts +2 -2
- package/dist/model/document.js +2 -2
- package/package.json +1 -1
- package/dist/document-D6wZrAko.js +0 -66
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as BreakContent, Ft as Paragraph, G as DocumentBody, Gt as Run, It as ParagraphContent, Kt as RunContent, Pn as NumberingDefinitions, Vt as PositionalTab, Zt as SectionProperties, a as DocxPackage, dn as Table, fn as TableCell, hn as TableRow, i as DocxConformanceClass, k as BlockContent, m as Style, n as Document, t as DOCX_CONFORMANCE_CLASSES, yn as TextContent } from "./document-o2RiAASq.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
//#region src/legal-source/types.d.ts
|
|
4
4
|
type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other";
|
|
@@ -150,6 +150,81 @@ type SerializeDocumentOptions = {
|
|
|
150
150
|
};
|
|
151
151
|
declare const serializeDocumentToDocx: (document: Document, options?: SerializeDocumentOptions) => Promise<ArrayBuffer>;
|
|
152
152
|
//#endregion
|
|
153
|
+
//#region src/serialize/xmlEscape.d.ts
|
|
154
|
+
/**
|
|
155
|
+
* The one owner of XML character escaping for every part folio writes.
|
|
156
|
+
*
|
|
157
|
+
* Two contexts, two functions. A value going into element content takes
|
|
158
|
+
* {@link escapeXmlText}; a value going between the quotes of an attribute
|
|
159
|
+
* takes {@link escapeXmlAttribute}. Nothing else escapes XML by hand: a
|
|
160
|
+
* second escaper always ends up disagreeing with this one about some
|
|
161
|
+
* character, and the disagreement is a package Word refuses to open.
|
|
162
|
+
*
|
|
163
|
+
* Both functions guarantee the same contract: **the result is always legal
|
|
164
|
+
* XML 1.0 character data.** That is what makes the contract checkable — a
|
|
165
|
+
* caller cannot produce a corrupt part by forgetting something.
|
|
166
|
+
*
|
|
167
|
+
* XML 1.0 §2.2 `Char` admits tab, LF, CR, `#x20`-`#xD7FF`, `#xE000`-`#xFFFD`
|
|
168
|
+
* and the astral planes. Everything else — the rest of C0, `#xFFFE`,
|
|
169
|
+
* `#xFFFF`, an unpaired surrogate — cannot appear in a document at all, and
|
|
170
|
+
* cannot be escaped into one either: `�` is as illegal as a raw NUL
|
|
171
|
+
* (§4.1 requires a character reference to refer to a legal `Char`). The only
|
|
172
|
+
* output that is well-formed is one without them, so they are dropped here.
|
|
173
|
+
* Callers that own an input boundary sanitise before this point, with
|
|
174
|
+
* `sanitizeXmlCharacters`, so a user-visible value loses its illegal
|
|
175
|
+
* characters where something can still report it; the drop below is the last
|
|
176
|
+
* line of defence for a boundary nobody has covered yet.
|
|
177
|
+
*
|
|
178
|
+
* The whitespace rules are where the two contexts part:
|
|
179
|
+
*
|
|
180
|
+
* - §3.3.3 normalises tab, LF and CR in an **attribute value** to a space in
|
|
181
|
+
* every conformant parser, so a literal one does not survive a save. They
|
|
182
|
+
* are written as character references, which the same step leaves alone.
|
|
183
|
+
* - §2.11 normalises a literal CR (and CRLF) in **content** to LF on read, so
|
|
184
|
+
* CR is written as a reference there too. Tab and LF survive as themselves.
|
|
185
|
+
*
|
|
186
|
+
* Both contexts escape all five of `& < > " '`. Only `&` and `<` must be
|
|
187
|
+
* escaped in content, but folio has always written the full set, `>` closes
|
|
188
|
+
* the `]]>` hazard of §2.4 without a special case, and one lexical form
|
|
189
|
+
* across every writer is worth more than the bytes it costs. Every spelling
|
|
190
|
+
* here reads back as the character it stands for, so the rule preserves the
|
|
191
|
+
* value whichever context it lands in.
|
|
192
|
+
*/
|
|
193
|
+
/** Escape a value for XML element content. Tab and LF survive as themselves. */
|
|
194
|
+
declare const escapeXmlText: (value: string) => string;
|
|
195
|
+
/**
|
|
196
|
+
* Escape a value for an XML attribute value, of either quoting. Tab, LF and CR
|
|
197
|
+
* become character references so attribute-value normalisation cannot flatten
|
|
198
|
+
* them to spaces.
|
|
199
|
+
*/
|
|
200
|
+
declare const escapeXmlAttribute: (value: string) => string;
|
|
201
|
+
/** Whether `value` holds a character XML 1.0 cannot represent at all. */
|
|
202
|
+
declare const hasIllegalXmlCharacters: (value: string) => boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Make a value from outside folio representable in XML: an unpaired surrogate
|
|
205
|
+
* becomes U+FFFD, every other character XML cannot hold is dropped.
|
|
206
|
+
*
|
|
207
|
+
* This is the rule for an input boundary — paste, a document operation, a
|
|
208
|
+
* markdown or legal-source compile, a template fill — where the value is still
|
|
209
|
+
* attached to the request that carried it and a warning still has somewhere to
|
|
210
|
+
* go. `escapeXmlText` and `escapeXmlAttribute` apply the same rule again
|
|
211
|
+
* further down, but by then nobody can say which input lost a character.
|
|
212
|
+
*/
|
|
213
|
+
declare const sanitizeXmlCharacters: (value: string) => string;
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/serialize/textWhitespace.d.ts
|
|
216
|
+
/**
|
|
217
|
+
* Whether `<w:t>` needs `xml:space="preserve"` to render the text as written.
|
|
218
|
+
*
|
|
219
|
+
* Without the attribute an XML reader trims leading and trailing spaces and
|
|
220
|
+
* collapses runs of them, so the attribute is a pure function of the text: it
|
|
221
|
+
* is needed exactly when that normalisation would change what the reader sees.
|
|
222
|
+
* The model therefore keeps no flag of its own — a stored copy of a derived
|
|
223
|
+
* fact only drifts, and it did: the editor round trip dropped it whenever two
|
|
224
|
+
* runs merged, because ProseMirror has nowhere to carry it.
|
|
225
|
+
*/
|
|
226
|
+
declare const requiresXmlSpacePreserve: (text: string) => boolean;
|
|
227
|
+
//#endregion
|
|
153
228
|
//#region src/validate/docx.d.ts
|
|
154
229
|
declare const DOCX_PACKAGE_ISSUE_CODES: {
|
|
155
230
|
readonly ArchiveBoundsExceeded: "archive_bounds_exceeded";
|
|
@@ -179,4 +254,4 @@ declare const validateDocxPackage: (buffer: ArrayBuffer | Uint8Array) => Promise
|
|
|
179
254
|
declare const validateDocumentModel: (document: Document) => ValidateDocumentModelResult;
|
|
180
255
|
declare const assertValidDocumentModel: (document: Document) => void;
|
|
181
256
|
//#endregion
|
|
182
|
-
export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, type Document, type DocumentBody, type DocxConformanceClass, type DocxPackage, type DocxPackageIssueCode, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type MarkdownContent, type Paragraph, type ParagraphContent, type PositionalTab, type Run, type RunContent, type SectionProperties, type Style, type Table, type TableCell, type TableRow, type TextContent, type ValidateDocumentModelIssue, type ValidateDocumentModelResult, type ValidateDocxPackageResult, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, compileMarkdownToContent, parseLegalSource, sanitizeExternalUrl, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
|
|
257
|
+
export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, type Document, type DocumentBody, type DocxConformanceClass, type DocxPackage, type DocxPackageIssueCode, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type MarkdownContent, type Paragraph, type ParagraphContent, type PositionalTab, type Run, type RunContent, type SectionProperties, type Style, type Table, type TableCell, type TableRow, type TextContent, type ValidateDocumentModelIssue, type ValidateDocumentModelResult, type ValidateDocxPackageResult, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, compileMarkdownToContent, escapeXmlAttribute, escapeXmlText, hasIllegalXmlCharacters, parseLegalSource, requiresXmlSpacePreserve, sanitizeExternalUrl, sanitizeXmlCharacters, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,114 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as isOoxmlSymbolCharacter, t as DOCX_CONFORMANCE_CLASSES } from "./document-CKwRw-01.js";
|
|
2
2
|
import JSZip from "jszip";
|
|
3
3
|
import { panic } from "better-result";
|
|
4
4
|
import { XMLParser, XMLValidator } from "fast-xml-parser";
|
|
5
5
|
import { Marked } from "marked";
|
|
6
|
+
//#region src/serialize/textWhitespace.ts
|
|
7
|
+
/**
|
|
8
|
+
* Whether `<w:t>` needs `xml:space="preserve"` to render the text as written.
|
|
9
|
+
*
|
|
10
|
+
* Without the attribute an XML reader trims leading and trailing spaces and
|
|
11
|
+
* collapses runs of them, so the attribute is a pure function of the text: it
|
|
12
|
+
* is needed exactly when that normalisation would change what the reader sees.
|
|
13
|
+
* The model therefore keeps no flag of its own — a stored copy of a derived
|
|
14
|
+
* fact only drifts, and it did: the editor round trip dropped it whenever two
|
|
15
|
+
* runs merged, because ProseMirror has nowhere to carry it.
|
|
16
|
+
*/
|
|
17
|
+
const requiresXmlSpacePreserve = (text) => text.startsWith(" ") || text.endsWith(" ") || text.includes(" ");
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/serialize/xmlEscape.ts
|
|
20
|
+
/**
|
|
21
|
+
* The one owner of XML character escaping for every part folio writes.
|
|
22
|
+
*
|
|
23
|
+
* Two contexts, two functions. A value going into element content takes
|
|
24
|
+
* {@link escapeXmlText}; a value going between the quotes of an attribute
|
|
25
|
+
* takes {@link escapeXmlAttribute}. Nothing else escapes XML by hand: a
|
|
26
|
+
* second escaper always ends up disagreeing with this one about some
|
|
27
|
+
* character, and the disagreement is a package Word refuses to open.
|
|
28
|
+
*
|
|
29
|
+
* Both functions guarantee the same contract: **the result is always legal
|
|
30
|
+
* XML 1.0 character data.** That is what makes the contract checkable — a
|
|
31
|
+
* caller cannot produce a corrupt part by forgetting something.
|
|
32
|
+
*
|
|
33
|
+
* XML 1.0 §2.2 `Char` admits tab, LF, CR, `#x20`-`#xD7FF`, `#xE000`-`#xFFFD`
|
|
34
|
+
* and the astral planes. Everything else — the rest of C0, `#xFFFE`,
|
|
35
|
+
* `#xFFFF`, an unpaired surrogate — cannot appear in a document at all, and
|
|
36
|
+
* cannot be escaped into one either: `�` is as illegal as a raw NUL
|
|
37
|
+
* (§4.1 requires a character reference to refer to a legal `Char`). The only
|
|
38
|
+
* output that is well-formed is one without them, so they are dropped here.
|
|
39
|
+
* Callers that own an input boundary sanitise before this point, with
|
|
40
|
+
* `sanitizeXmlCharacters`, so a user-visible value loses its illegal
|
|
41
|
+
* characters where something can still report it; the drop below is the last
|
|
42
|
+
* line of defence for a boundary nobody has covered yet.
|
|
43
|
+
*
|
|
44
|
+
* The whitespace rules are where the two contexts part:
|
|
45
|
+
*
|
|
46
|
+
* - §3.3.3 normalises tab, LF and CR in an **attribute value** to a space in
|
|
47
|
+
* every conformant parser, so a literal one does not survive a save. They
|
|
48
|
+
* are written as character references, which the same step leaves alone.
|
|
49
|
+
* - §2.11 normalises a literal CR (and CRLF) in **content** to LF on read, so
|
|
50
|
+
* CR is written as a reference there too. Tab and LF survive as themselves.
|
|
51
|
+
*
|
|
52
|
+
* Both contexts escape all five of `& < > " '`. Only `&` and `<` must be
|
|
53
|
+
* escaped in content, but folio has always written the full set, `>` closes
|
|
54
|
+
* the `]]>` hazard of §2.4 without a special case, and one lexical form
|
|
55
|
+
* across every writer is worth more than the bytes it costs. Every spelling
|
|
56
|
+
* here reads back as the character it stands for, so the rule preserves the
|
|
57
|
+
* value whichever context it lands in.
|
|
58
|
+
*/
|
|
59
|
+
/** XML 1.0 §2.2 `Char`, negated: the characters no XML document may contain. */
|
|
60
|
+
const ILLEGAL_XML_CHARACTER_CLASS = "[^\\u0009\\u000A\\u000D\\u0020-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]";
|
|
61
|
+
/**
|
|
62
|
+
* Unicode-mode classes match code points, so a well-formed surrogate pair is a
|
|
63
|
+
* single astral code point and cannot match a BMP class: this matches exactly
|
|
64
|
+
* the unpaired surrogates.
|
|
65
|
+
*/
|
|
66
|
+
const LONE_SURROGATE_PATTERN = /[\uD800-\uDFFF]/gu;
|
|
67
|
+
const ILLEGAL_XML_CHARACTER_PATTERN = new RegExp(ILLEGAL_XML_CHARACTER_CLASS, "gu");
|
|
68
|
+
const ILLEGAL_XML_CHARACTER_PROBE = new RegExp(ILLEGAL_XML_CHARACTER_CLASS, "u");
|
|
69
|
+
/** What an unpaired surrogate becomes at an input boundary: U+FFFD. */
|
|
70
|
+
const REPLACEMENT_CHARACTER = "�";
|
|
71
|
+
const TEXT_ESCAPES = {
|
|
72
|
+
"&": "&",
|
|
73
|
+
"<": "<",
|
|
74
|
+
">": ">",
|
|
75
|
+
"\"": """,
|
|
76
|
+
"'": "'",
|
|
77
|
+
"\r": " "
|
|
78
|
+
};
|
|
79
|
+
const ATTRIBUTE_ESCAPES = {
|
|
80
|
+
...TEXT_ESCAPES,
|
|
81
|
+
" ": "	",
|
|
82
|
+
"\n": " "
|
|
83
|
+
};
|
|
84
|
+
const TEXT_PROBE = new RegExp(`[&<>"'\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "u");
|
|
85
|
+
const TEXT_PATTERN = new RegExp(`[&<>"'\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "gu");
|
|
86
|
+
const ATTRIBUTE_PROBE = new RegExp(`[&<>"'\\t\\n\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "u");
|
|
87
|
+
const ATTRIBUTE_PATTERN = new RegExp(`[&<>"'\\t\\n\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "gu");
|
|
88
|
+
/** Escape a value for XML element content. Tab and LF survive as themselves. */
|
|
89
|
+
const escapeXmlText = (value) => TEXT_PROBE.test(value) ? value.replace(TEXT_PATTERN, (character) => TEXT_ESCAPES[character] ?? "") : value;
|
|
90
|
+
/**
|
|
91
|
+
* Escape a value for an XML attribute value, of either quoting. Tab, LF and CR
|
|
92
|
+
* become character references so attribute-value normalisation cannot flatten
|
|
93
|
+
* them to spaces.
|
|
94
|
+
*/
|
|
95
|
+
const escapeXmlAttribute = (value) => ATTRIBUTE_PROBE.test(value) ? value.replace(ATTRIBUTE_PATTERN, (character) => ATTRIBUTE_ESCAPES[character] ?? "") : value;
|
|
96
|
+
/** Whether `value` holds a character XML 1.0 cannot represent at all. */
|
|
97
|
+
const hasIllegalXmlCharacters = (value) => ILLEGAL_XML_CHARACTER_PROBE.test(value);
|
|
98
|
+
/**
|
|
99
|
+
* Make a value from outside folio representable in XML: an unpaired surrogate
|
|
100
|
+
* becomes U+FFFD, every other character XML cannot hold is dropped.
|
|
101
|
+
*
|
|
102
|
+
* This is the rule for an input boundary — paste, a document operation, a
|
|
103
|
+
* markdown or legal-source compile, a template fill — where the value is still
|
|
104
|
+
* attached to the request that carried it and a warning still has somewhere to
|
|
105
|
+
* go. `escapeXmlText` and `escapeXmlAttribute` apply the same rule again
|
|
106
|
+
* further down, but by then nobody can say which input lost a character.
|
|
107
|
+
*/
|
|
108
|
+
const sanitizeXmlCharacters = (value) => hasIllegalXmlCharacters(value) ? value.replace(LONE_SURROGATE_PATTERN, REPLACEMENT_CHARACTER).replace(ILLEGAL_XML_CHARACTER_PATTERN, "") : value;
|
|
109
|
+
//#endregion
|
|
6
110
|
//#region src/serialize/xml.ts
|
|
7
|
-
const
|
|
8
|
-
const stripIllegalXmlChars = (value) => value.replace(ILLEGAL_XML_CHARS_RE, "");
|
|
9
|
-
const escapeXml = (value) => stripIllegalXmlChars(value).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
10
|
-
const attr = (name, value) => value === void 0 ? "" : ` ${name}="${escapeXml(String(value))}"`;
|
|
111
|
+
const attr = (name, value) => value === void 0 ? "" : ` ${name}="${escapeXmlAttribute(String(value))}"`;
|
|
11
112
|
//#endregion
|
|
12
113
|
//#region src/serialize/docx.ts
|
|
13
114
|
const DEFAULT_FOOTER_REL_ID = "rId10";
|
|
@@ -66,7 +167,7 @@ const resolveFooterLabels = (language) => {
|
|
|
66
167
|
};
|
|
67
168
|
const buildFooterXml = (language) => {
|
|
68
169
|
const { page, of } = resolveFooterLabels(language);
|
|
69
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:ftr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:p><w:pPr><w:pStyle w:val="Footer"/><w:jc w:val="center"/></w:pPr><w:r><w:rPr><w:sz w:val="18"/></w:rPr><w:t xml:space="preserve">${
|
|
170
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:ftr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:p><w:pPr><w:pStyle w:val="Footer"/><w:jc w:val="center"/></w:pPr><w:r><w:rPr><w:sz w:val="18"/></w:rPr><w:t xml:space="preserve">${escapeXmlText(page)} </w:t></w:r><w:fldSimple w:instr="PAGE \\* MERGEFORMAT"><w:r><w:rPr><w:sz w:val="18"/></w:rPr><w:t>1</w:t></w:r></w:fldSimple><w:r><w:rPr><w:sz w:val="18"/></w:rPr><w:t xml:space="preserve"> ${escapeXmlText(of)} </w:t></w:r><w:fldSimple w:instr="NUMPAGES \\* MERGEFORMAT"><w:r><w:rPr><w:sz w:val="18"/></w:rPr><w:t>1</w:t></w:r></w:fldSimple></w:p></w:ftr>`;
|
|
70
171
|
};
|
|
71
172
|
const contentTypesXml = (hasNumbering) => [
|
|
72
173
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>",
|
|
@@ -130,7 +231,7 @@ const serializeParagraphProperties = (paragraph) => {
|
|
|
130
231
|
const formatting = paragraph.formatting;
|
|
131
232
|
if (!formatting && !paragraph.sectionProperties) return "";
|
|
132
233
|
const parts = [];
|
|
133
|
-
if (formatting?.styleId) parts.push(`<w:pStyle w:val="${
|
|
234
|
+
if (formatting?.styleId) parts.push(`<w:pStyle w:val="${escapeXmlAttribute(formatting.styleId)}"/>`);
|
|
134
235
|
if (formatting?.keepNext) parts.push("<w:keepNext/>");
|
|
135
236
|
if (formatting?.keepLines) parts.push("<w:keepLines/>");
|
|
136
237
|
if (formatting?.pageBreakBefore) parts.push("<w:pageBreakBefore/>");
|
|
@@ -161,6 +262,7 @@ const serializeParagraphContent = (content) => {
|
|
|
161
262
|
case "moveFromRangeEnd":
|
|
162
263
|
case "moveToRangeStart":
|
|
163
264
|
case "moveToRangeEnd":
|
|
265
|
+
case "bidiWrapper":
|
|
164
266
|
case "mathEquation": return "";
|
|
165
267
|
default: return "";
|
|
166
268
|
}
|
|
@@ -171,7 +273,7 @@ const serializeRun = (run) => {
|
|
|
171
273
|
const serializeRunProperties = (formatting) => {
|
|
172
274
|
if (!formatting) return "";
|
|
173
275
|
const parts = [];
|
|
174
|
-
if (formatting.styleId) parts.push(`<w:rStyle w:val="${
|
|
276
|
+
if (formatting.styleId) parts.push(`<w:rStyle w:val="${escapeXmlAttribute(formatting.styleId)}"/>`);
|
|
175
277
|
if (formatting.bold === true) parts.push("<w:b/>");
|
|
176
278
|
else if (formatting.bold === false) parts.push("<w:b w:val=\"0\"/>");
|
|
177
279
|
if (formatting.boldCs === true) parts.push("<w:bCs/>");
|
|
@@ -192,13 +294,13 @@ const serializeRunProperties = (formatting) => {
|
|
|
192
294
|
};
|
|
193
295
|
const serializeRunContent = (content) => {
|
|
194
296
|
switch (content.type) {
|
|
195
|
-
case "text": return `<w:t${content.
|
|
297
|
+
case "text": return `<w:t${requiresXmlSpacePreserve(content.text) ? " xml:space=\"preserve\"" : ""}>${escapeXmlText(content.text)}</w:t>`;
|
|
196
298
|
case "tab":
|
|
197
299
|
if (!content.positional) return "<w:tab/>";
|
|
198
300
|
return `<w:ptab${attr("w:relativeTo", content.positional.relativeTo)}${attr("w:alignment", content.positional.alignment)}${attr("w:leader", content.positional.leader)}/>`;
|
|
199
301
|
case "break": return `<w:br${attr("w:type", content.breakType)}/>`;
|
|
200
302
|
case "renderedPageBreak": return "<w:lastRenderedPageBreak/>";
|
|
201
|
-
case "symbol": return `<w:sym w:font="${
|
|
303
|
+
case "symbol": return `<w:sym w:font="${escapeXmlAttribute(content.font)}" w:char="${escapeXmlAttribute(content.char)}"/>`;
|
|
202
304
|
case "footnoteRef": return `<w:footnoteReference w:id="${content.id}"/>`;
|
|
203
305
|
case "endnoteRef": return `<w:endnoteReference w:id="${content.id}"/>`;
|
|
204
306
|
case "fieldChar":
|
|
@@ -228,7 +330,7 @@ const serializeTable = (table) => {
|
|
|
228
330
|
};
|
|
229
331
|
const renderTableBorders = (table) => {
|
|
230
332
|
const borders = table.formatting?.borders;
|
|
231
|
-
if (!borders) return
|
|
333
|
+
if (!borders) return authoredTableGridXml();
|
|
232
334
|
return [
|
|
233
335
|
borderEdgeXml("w:top", borders.top),
|
|
234
336
|
borderEdgeXml("w:left", borders.left),
|
|
@@ -240,7 +342,7 @@ const renderTableBorders = (table) => {
|
|
|
240
342
|
};
|
|
241
343
|
const renderCellBorders = (table) => {
|
|
242
344
|
const borders = table.formatting?.borders;
|
|
243
|
-
if (!borders) return
|
|
345
|
+
if (!borders) return authoredTableGridXml();
|
|
244
346
|
return [
|
|
245
347
|
borderEdgeXml("w:top", borders.top),
|
|
246
348
|
borderEdgeXml("w:left", borders.left),
|
|
@@ -250,12 +352,36 @@ const renderCellBorders = (table) => {
|
|
|
250
352
|
};
|
|
251
353
|
const borderEdgeXml = (tag, spec) => {
|
|
252
354
|
if (!spec) return `<${tag} w:val="nil"/>`;
|
|
253
|
-
if (spec.style === "none" || spec.style === "nil") return `<${tag} w:val="
|
|
355
|
+
if (spec.style === "none" || spec.style === "nil") return `<${tag} w:val="${escapeXmlAttribute(spec.style)}"/>`;
|
|
254
356
|
const sz = spec.size ?? 4;
|
|
255
357
|
const color = spec.color?.rgb ?? "CCCCCC";
|
|
256
|
-
return `<${tag} w:val="${
|
|
358
|
+
return `<${tag} w:val="${escapeXmlAttribute(spec.style)}" w:sz="${sz}" w:space="0" w:color="${escapeXmlAttribute(color)}"/>`;
|
|
257
359
|
};
|
|
258
|
-
|
|
360
|
+
/**
|
|
361
|
+
* The grid this generator gives a table that declares no borders of its own.
|
|
362
|
+
*
|
|
363
|
+
* This is an authoring choice, not a round trip: `serializeDocumentToDocx`
|
|
364
|
+
* builds a package from a model assembled here (the legal-source compiler and
|
|
365
|
+
* markdown), where a table with no `formatting.borders` means "the author did
|
|
366
|
+
* not say", and a borderless table reads as a layout accident. A package parsed
|
|
367
|
+
* from a real DOCX never reaches this generator; it is re-serialized by
|
|
368
|
+
* `@stll/folio-core`, which writes back exactly the borders it read.
|
|
369
|
+
*/
|
|
370
|
+
const AUTHORED_TABLE_GRID_EDGE = {
|
|
371
|
+
style: "single",
|
|
372
|
+
size: 4,
|
|
373
|
+
space: 0,
|
|
374
|
+
color: { rgb: "CCCCCC" }
|
|
375
|
+
};
|
|
376
|
+
const AUTHORED_TABLE_GRID_EDGES = [
|
|
377
|
+
"w:top",
|
|
378
|
+
"w:left",
|
|
379
|
+
"w:bottom",
|
|
380
|
+
"w:right",
|
|
381
|
+
"w:insideH",
|
|
382
|
+
"w:insideV"
|
|
383
|
+
];
|
|
384
|
+
const authoredTableGridXml = () => AUTHORED_TABLE_GRID_EDGES.map((tag) => borderEdgeXml(tag, AUTHORED_TABLE_GRID_EDGE)).join("");
|
|
259
385
|
const serializeSectionProperties = (properties) => `<w:sectPr><w:footerReference w:type="default" r:id="${DEFAULT_FOOTER_REL_ID}"/><w:pgSz${attr("w:w", properties.pageWidth)}${attr("w:h", properties.pageHeight)}${attr("w:orient", properties.orientation === "landscape" ? "landscape" : void 0)}/><w:pgMar${attr("w:top", properties.marginTop)}${attr("w:right", properties.marginRight)}${attr("w:bottom", properties.marginBottom)}${attr("w:left", properties.marginLeft)}${attr("w:header", properties.headerDistance)}${attr("w:footer", properties.footerDistance)}${attr("w:gutter", properties.gutter ?? 0)}/></w:sectPr>`;
|
|
260
386
|
const serializeStyles = (styles) => {
|
|
261
387
|
const styleDefinitions = styles ?? { styles: [] };
|
|
@@ -282,10 +408,10 @@ const serializeStyle = (style) => {
|
|
|
282
408
|
}).replace(/^<w:pPr>|<\/w:pPr>$/gu, "") : "";
|
|
283
409
|
const rPr = serializeRunProperties(style.rPr);
|
|
284
410
|
return [
|
|
285
|
-
`<w:style w:type="${style.type}" w:styleId="${
|
|
286
|
-
`<w:name w:val="${
|
|
287
|
-
style.basedOn ? `<w:basedOn w:val="${
|
|
288
|
-
style.next ? `<w:next w:val="${
|
|
411
|
+
`<w:style w:type="${style.type}" w:styleId="${escapeXmlAttribute(style.styleId)}"${style.default ? " w:default=\"1\"" : ""}>`,
|
|
412
|
+
`<w:name w:val="${escapeXmlAttribute(style.name ?? style.styleId)}"/>`,
|
|
413
|
+
style.basedOn ? `<w:basedOn w:val="${escapeXmlAttribute(style.basedOn)}"/>` : "",
|
|
414
|
+
style.next ? `<w:next w:val="${escapeXmlAttribute(style.next)}"/>` : "",
|
|
289
415
|
style.qFormat ? "<w:qFormat/>" : "",
|
|
290
416
|
pPr ? `<w:pPr>${pPr}</w:pPr>` : "",
|
|
291
417
|
rPr,
|
|
@@ -311,7 +437,7 @@ const serializeNumberingLevel = (level) => [
|
|
|
311
437
|
`<w:numFmt w:val="${level.numFmt}"/>`,
|
|
312
438
|
level.isLgl ? "<w:isLgl/>" : "",
|
|
313
439
|
level.suffix ? `<w:suff w:val="${level.suffix}"/>` : "",
|
|
314
|
-
`<w:lvlText w:val="${
|
|
440
|
+
`<w:lvlText w:val="${escapeXmlAttribute(level.lvlText)}"/>`,
|
|
315
441
|
`<w:lvlJc w:val="${level.lvlJc ?? "left"}"/>`,
|
|
316
442
|
level.pPr ? serializeParagraphProperties({
|
|
317
443
|
type: "paragraph",
|
|
@@ -329,7 +455,7 @@ const serializeCoreProperties = (document) => {
|
|
|
329
455
|
const creator = properties?.creator ?? "Stella";
|
|
330
456
|
const created = properties?.created?.toISOString() ?? now;
|
|
331
457
|
const modified = properties?.modified?.toISOString() ?? now;
|
|
332
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>${
|
|
458
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>${escapeXmlText(title)}</dc:title><dc:creator>${escapeXmlText(creator)}</dc:creator><cp:lastModifiedBy>${escapeXmlText(creator)}</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">${created}</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">${modified}</dcterms:modified></cp:coreProperties>`;
|
|
333
459
|
};
|
|
334
460
|
//#endregion
|
|
335
461
|
//#region src/validate/docx.ts
|
|
@@ -653,6 +779,10 @@ const validateParagraphContent = (content, path, ctx) => {
|
|
|
653
779
|
increment(ctx.moveToEnds, content.id);
|
|
654
780
|
return;
|
|
655
781
|
}
|
|
782
|
+
if (content.type === "bidiWrapper") {
|
|
783
|
+
for (const [index, child] of content.content.entries()) validateParagraphContent(child, `${path}.content[${index}]`, ctx);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
656
786
|
if (content.ommlXml.trim() === "") addError(ctx, `${path}.ommlXml`, "Math equation must preserve OMML XML.");
|
|
657
787
|
};
|
|
658
788
|
const validateFieldChild = (child, path, ctx) => {
|
|
@@ -669,6 +799,10 @@ const validateRun = (run, path, ctx) => {
|
|
|
669
799
|
for (const [index, content] of run.content.entries()) validateRunContent(content, `${path}.content[${index}]`, ctx);
|
|
670
800
|
};
|
|
671
801
|
const validateRunContent = (content, path, ctx) => {
|
|
802
|
+
if (content.type === "text") {
|
|
803
|
+
if (hasIllegalXmlCharacters(content.text)) addWarning(ctx, `${path}.text`, "Text holds characters XML 1.0 cannot represent; they will be dropped on save.");
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
672
806
|
if (content.type === "drawing") {
|
|
673
807
|
validateImage(content.image, `${path}.image`, ctx, { hasPreservedRawDrawing: content.rawXml?.trim() !== "" });
|
|
674
808
|
return;
|
|
@@ -683,8 +817,7 @@ const validateRunContent = (content, path, ctx) => {
|
|
|
683
817
|
return;
|
|
684
818
|
}
|
|
685
819
|
if (content.type === "symbol") {
|
|
686
|
-
if (content.
|
|
687
|
-
if (!isOoxmlSymbolCharacter(content.char)) addError(ctx, `${path}.char`, "Symbol character must be exactly four hexadecimal digits.");
|
|
820
|
+
if (content.char !== "" && !isOoxmlSymbolCharacter(content.char)) addError(ctx, `${path}.char`, "Symbol character must be exactly four hexadecimal digits.");
|
|
688
821
|
}
|
|
689
822
|
};
|
|
690
823
|
const validateHyperlink = (hyperlink, path, ctx) => {
|
|
@@ -980,14 +1113,12 @@ const textRun = (text, format = {}) => {
|
|
|
980
1113
|
if (index > 0) content.push({ type: "break" });
|
|
981
1114
|
if (segment.length > 0) content.push({
|
|
982
1115
|
type: "text",
|
|
983
|
-
text: segment
|
|
984
|
-
preserveSpace: true
|
|
1116
|
+
text: segment
|
|
985
1117
|
});
|
|
986
1118
|
}
|
|
987
1119
|
if (content.length === 0) content.push({
|
|
988
1120
|
type: "text",
|
|
989
|
-
text: ""
|
|
990
|
-
preserveSpace: true
|
|
1121
|
+
text: ""
|
|
991
1122
|
});
|
|
992
1123
|
return {
|
|
993
1124
|
type: "run",
|
|
@@ -1142,9 +1273,14 @@ const countNewlines = (text) => {
|
|
|
1142
1273
|
/** A token that starts a new structural block, so no body may run past it. */
|
|
1143
1274
|
const startsStructure = (token) => isLegalDirectiveToken(token) || isTokenType(token, "heading");
|
|
1144
1275
|
const parseLegalSource = (source, options = {}) => {
|
|
1276
|
+
const sanitizedSource = sanitizeXmlCharacters(source);
|
|
1145
1277
|
const state = {
|
|
1146
1278
|
blocks: [],
|
|
1147
|
-
diagnostics: [
|
|
1279
|
+
diagnostics: hasIllegalXmlCharacters(source) ? [{
|
|
1280
|
+
code: "illegal-xml-characters-dropped",
|
|
1281
|
+
message: "The source held characters XML 1.0 cannot represent; they were dropped. An unpaired surrogate became U+FFFD.",
|
|
1282
|
+
severity: "warning"
|
|
1283
|
+
}] : [],
|
|
1148
1284
|
fixes: [],
|
|
1149
1285
|
meta: {
|
|
1150
1286
|
kind: DEFAULT_KIND,
|
|
@@ -1156,7 +1292,7 @@ const parseLegalSource = (source, options = {}) => {
|
|
|
1156
1292
|
},
|
|
1157
1293
|
title: null
|
|
1158
1294
|
},
|
|
1159
|
-
cursor: new TokenCursor(lexLegalSource(
|
|
1295
|
+
cursor: new TokenCursor(lexLegalSource(sanitizedSource))
|
|
1160
1296
|
};
|
|
1161
1297
|
for (;;) {
|
|
1162
1298
|
const token = state.cursor.current;
|
|
@@ -2104,7 +2240,8 @@ const createStyleDefinitions = () => ({
|
|
|
2104
2240
|
pPr: {
|
|
2105
2241
|
keepNext: true,
|
|
2106
2242
|
spaceBefore: 360,
|
|
2107
|
-
spaceAfter: 160
|
|
2243
|
+
spaceAfter: 160,
|
|
2244
|
+
outlineLevel: 0
|
|
2108
2245
|
}
|
|
2109
2246
|
},
|
|
2110
2247
|
{
|
|
@@ -2121,7 +2258,8 @@ const createStyleDefinitions = () => ({
|
|
|
2121
2258
|
pPr: {
|
|
2122
2259
|
keepNext: true,
|
|
2123
2260
|
spaceBefore: 240,
|
|
2124
|
-
spaceAfter: 120
|
|
2261
|
+
spaceAfter: 120,
|
|
2262
|
+
outlineLevel: 1
|
|
2125
2263
|
}
|
|
2126
2264
|
},
|
|
2127
2265
|
{
|
|
@@ -2135,7 +2273,8 @@ const createStyleDefinitions = () => ({
|
|
|
2135
2273
|
pPr: {
|
|
2136
2274
|
keepNext: true,
|
|
2137
2275
|
spaceBefore: 160,
|
|
2138
|
-
spaceAfter: 120
|
|
2276
|
+
spaceAfter: 120,
|
|
2277
|
+
outlineLevel: 2
|
|
2139
2278
|
}
|
|
2140
2279
|
},
|
|
2141
2280
|
{
|
|
@@ -2450,13 +2589,37 @@ const listBlocks = (list, level, parentNumId, numIds) => {
|
|
|
2450
2589
|
}
|
|
2451
2590
|
return out;
|
|
2452
2591
|
};
|
|
2592
|
+
/**
|
|
2593
|
+
* The deepest heading the built-in style sets define, so a `#####` compiles to
|
|
2594
|
+
* a style the document actually has.
|
|
2595
|
+
*/
|
|
2453
2596
|
const MAX_HEADING_LEVEL = 4;
|
|
2597
|
+
/**
|
|
2598
|
+
* The style id for a markdown heading, plus the outline level it stands for.
|
|
2599
|
+
*
|
|
2600
|
+
* The id is English because the document this content lands in is one folio
|
|
2601
|
+
* created, and folio's style sets define `Heading1`…`HeadingN` under the
|
|
2602
|
+
* built-in name. The outline level is what makes the classification survive
|
|
2603
|
+
* anyway: a consumer reads `w:outlineLvl` first (see
|
|
2604
|
+
* `@stll/folio-core/docx/builtInStyles`), so the paragraph stays a heading
|
|
2605
|
+
* even when merged into a document whose own heading styles are localized and
|
|
2606
|
+
* this id resolves to nothing.
|
|
2607
|
+
*/
|
|
2608
|
+
const headingParagraph = (runs, depth) => {
|
|
2609
|
+
const level = Math.min(Math.max(depth, 1), MAX_HEADING_LEVEL);
|
|
2610
|
+
const paragraph = para(runs, `Heading${level}`);
|
|
2611
|
+
paragraph.formatting = {
|
|
2612
|
+
...paragraph.formatting,
|
|
2613
|
+
outlineLevel: level - 1
|
|
2614
|
+
};
|
|
2615
|
+
return paragraph;
|
|
2616
|
+
};
|
|
2617
|
+
/** The built-in a markdown blockquote compiles to. */
|
|
2618
|
+
const QUOTE_STYLE_ID = "Quote";
|
|
2454
2619
|
const blocksFromTokens = (tokens, numIds) => {
|
|
2455
2620
|
const blocks = [];
|
|
2456
|
-
for (const token of tokens ?? []) if (isTokenType(token, "heading"))
|
|
2457
|
-
|
|
2458
|
-
blocks.push(para(inlineTokensToRuns(token.tokens, token.text), `Heading${level}`));
|
|
2459
|
-
} else if (isTokenType(token, "paragraph")) blocks.push(para(inlineTokensToRuns(token.tokens, token.text)));
|
|
2621
|
+
for (const token of tokens ?? []) if (isTokenType(token, "heading")) blocks.push(headingParagraph(inlineTokensToRuns(token.tokens, token.text), token.depth));
|
|
2622
|
+
else if (isTokenType(token, "paragraph")) blocks.push(para(inlineTokensToRuns(token.tokens, token.text)));
|
|
2460
2623
|
else if (isTokenType(token, "list")) {
|
|
2461
2624
|
const numId = numIds.next++;
|
|
2462
2625
|
numIds.levels.set(numId, /* @__PURE__ */ new Map());
|
|
@@ -2468,7 +2631,7 @@ const blocksFromTokens = (tokens, numIds) => {
|
|
|
2468
2631
|
...inner,
|
|
2469
2632
|
formatting: {
|
|
2470
2633
|
...inner.formatting,
|
|
2471
|
-
styleId:
|
|
2634
|
+
styleId: QUOTE_STYLE_ID
|
|
2472
2635
|
}
|
|
2473
2636
|
} : inner;
|
|
2474
2637
|
blocks.push(styled);
|
|
@@ -2508,9 +2671,9 @@ const compileMarkdownToContent = (markdown) => {
|
|
|
2508
2671
|
levels: /* @__PURE__ */ new Map()
|
|
2509
2672
|
};
|
|
2510
2673
|
return {
|
|
2511
|
-
content: blocksFromTokens(lexMarkdown(markdown), numIds),
|
|
2674
|
+
content: blocksFromTokens(lexMarkdown(sanitizeXmlCharacters(markdown)), numIds),
|
|
2512
2675
|
...numIds.levels.size > 0 && { numbering: buildNumbering(numIds.levels) }
|
|
2513
2676
|
};
|
|
2514
2677
|
};
|
|
2515
2678
|
//#endregion
|
|
2516
|
-
export { DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, compileMarkdownToContent, parseLegalSource, sanitizeExternalUrl, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
|
|
2679
|
+
export { DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, compileMarkdownToContent, escapeXmlAttribute, escapeXmlText, hasIllegalXmlCharacters, parseLegalSource, requiresXmlSpacePreserve, sanitizeExternalUrl, sanitizeXmlCharacters, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
|
package/dist/model/document.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { type AbstractNumbering, type BlockContent, type BlockSdt, type BookmarkEnd, type BookmarkStart, type BorderSpec, type BreakContent, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, DOCX_CONFORMANCE_CLASSES, DRAWING_RAW_XML_MODES, type Deletion, type DocDefaults, Document, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingContent, type DrawingRawXmlMode, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type Hyperlink, type Image, type ImageCrop, type ImageFrameLocks, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type InlineSdt, type Insertion, type InstrTextContent, type KnownBorderStyle, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListMarkerFormatting, type ListRendering, MAX_REVISION_ID, type MathEquation, type MediaFile, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, type NoBreakHyphenContent, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, PARAGRAPH_MARK_CHANGE_KINDS, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphMarkChangeKind, type ParagraphPropertyChange, type PictureWatermark, type PositionalTab, type PropertyChangeInfo, REVIEW_CARRIERS, type Relationship, type RelationshipMap, type RelationshipType, type ReviewCarrier, type Run, type RunContent, type RunPropertyChange, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeGeometryAdjustment, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableBorders, type TableCell, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableLook, type TableMeasurement, type TablePropertyChange, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColorScheme, type ThemeColorSlot, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type TrackedRunContent, type UnderlineStyle, type VerticalAlign, type Watermark, isOoxmlSymbolCharacter, normalizeRevisionId };
|
|
1
|
+
import { $ as FieldType, $n as TableRowFormatting, $t as SectionStart, A as BlockRangeMarkerCapture, An as ListLevel, At as NoBreakHyphenContent, B as CommentReference, Bn as LineSpacingRule, Bt as PictureWatermark, C as ParseWarning, Cn as TrackedRunContent, Ct as MoveBookmarkMarker, D as BidiControl, Dn as normalizeRevisionId, Dt as MoveTo, E as BIDI_CONTROLS, En as isOoxmlSymbolCharacter, Et as MoveFromRangeStart, F as BreakContent, Fn as NumberingInstance, Ft as Paragraph, G as DocumentBody, Gn as TabStop, Gt as Run, H as DRAWING_RAW_XML_MODES, Hn as ParagraphFormatting, Ht as PropertyChangeInfo, I as Column, In as CellMargins, It as ParagraphContent, J as Endnote, Jn as TableCellBorders, Jt as SdtProperties, K as DrawingContent, Kn as TabStopAlignment, Kt as RunContent, L as Comment, Ln as ConditionalFormatStyle, Lt as ParagraphMarkChange, M as BookmarkEnd, Mn as ListRendering, Mt as NoteReferenceContent, N as BookmarkRangeMarker, Nn as NumberFormat, Nt as PARAGRAPH_MARK_CHANGE_KINDS, O as BidiWrapper, On as AbstractNumbering, Ot as MoveToRangeEnd, P as BookmarkStart, Pn as NumberingDefinitions, Pt as PageOrientation, Q as FieldCharContent, Qn as TableMeasurement, Qt as SectionPropertyChange, R as CommentRangeEnd, Rn as EmphasisMark, Rt as ParagraphMarkChangeKind, S as PARSE_WARNING_CODES, Sn as TrackedRunChange, St as MathEquation, T as ParseWarningLocation, Tn as Watermark, Tt as MoveFromRangeEnd, U as Deletion, Un as SpacingExplicit, Ut as REVIEW_CARRIERS, V as ComplexField, Vn as ParagraphAlignment, Vt as PositionalTab, W as DisplacedByCustomXml, Wn as TabLeader, Wt as ReviewCarrier, X as EndnoteProperties, Xn as TableFormatting, Xt as Section, Y as EndnotePosition, Yn as TableCellFormatting, Yt as SdtType, Z as Field, Zn as TableLook, Zt as SectionProperties, _ as Theme, _n as TableStructuralChangeInfo, _t as Insertion, a as DocxPackage, an as ShapeTextBody, ar as ColorValue, at as HeaderFooterType, b as ThemeFontScheme, bn as TextWatermark, bt as MAX_REVISION_ID, c as FontInfo, cn as SoftHyphenContent, cr as ThemeColorSlot, ct as Image, d as Relationship, dn as Table, dt as ImagePadding, en as Shape, er as TableWidthType, et as FooterReference, f as RelationshipMap, fn as TableCell, ft as ImagePosition, g as StyleType, gn as TableRowPropertyChange, gt as InlineSdt, h as StyleDefinitions, hn as TableRow, ht as ImageWrap, i as DocxConformanceClass, in as ShapeOutline, ir as BorderSpec, it as HeaderFooter, j as BlockSdt, jn as ListMarkerFormatting, jt as NoteNumberRestart, k as BlockContent, kn as LevelSuffix, kt as MoveToRangeStart, l as FontTable, ln as SymbolContent, lt as ImageCrop, m as Style, mn as TablePropertyChange, mt as ImageTransform, n as Document, nn as ShapeFill, nr as TextFormatting, nt as FootnotePosition, o as ExhaustiveFields, on as ShapeType, or as KnownBorderStyle, ot as HeaderReference, p as RelationshipType, pn as TableCellPropertyChange, pt as ImageSize, q as DrawingRawXmlMode, qn as TableBorders, qt as RunPropertyChange, r as DocumentSettings, rn as ShapeGeometryAdjustment, rr as UnderlineStyle, rt as FootnoteProperties, s as DocDefaults, sn as SimpleField, sr as ShadingProperties, st as Hyperlink, t as DOCX_CONFORMANCE_CLASSES, tn as ShapeContent, tr as TextEffect, tt as Footnote, u as MediaFile, un as TabContent, ut as ImageFrameLocks, v as ThemeColorScheme, vn as TextBox, vt as InstrTextContent, w as ParseWarningCode, wn as VerticalAlign, wt as MoveFrom, x as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, xn as TrackedChangeInfo, xt as MarkupRangeMarker, y as ThemeFont, yn as TextContent, yt as LineNumberRestart, z as CommentRangeStart, zn as FloatingTableProperties, zt as ParagraphPropertyChange } from "../document-o2RiAASq.js";
|
|
2
|
+
export { type AbstractNumbering, BIDI_CONTROLS, type BidiControl, type BidiWrapper, type BlockContent, type BlockRangeMarkerCapture, type BlockSdt, type BookmarkEnd, type BookmarkRangeMarker, type BookmarkStart, type BorderSpec, type BreakContent, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, DOCX_CONFORMANCE_CLASSES, DRAWING_RAW_XML_MODES, type Deletion, type DisplacedByCustomXml, type DocDefaults, Document, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingContent, type DrawingRawXmlMode, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type ExhaustiveFields, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type Hyperlink, type Image, type ImageCrop, type ImageFrameLocks, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type InlineSdt, type Insertion, type InstrTextContent, type KnownBorderStyle, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListMarkerFormatting, type ListRendering, MAX_RETAINED_PARSE_WARNINGS_PER_CODE, MAX_REVISION_ID, type MarkupRangeMarker, type MathEquation, type MediaFile, type MoveBookmarkMarker, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, type NoBreakHyphenContent, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, PARAGRAPH_MARK_CHANGE_KINDS, PARSE_WARNING_CODES, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphMarkChangeKind, type ParagraphPropertyChange, type ParseWarning, type ParseWarningCode, type ParseWarningLocation, type PictureWatermark, type PositionalTab, type PropertyChangeInfo, REVIEW_CARRIERS, type Relationship, type RelationshipMap, type RelationshipType, type ReviewCarrier, type Run, type RunContent, type RunPropertyChange, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeGeometryAdjustment, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableBorders, type TableCell, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableLook, type TableMeasurement, type TablePropertyChange, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColorScheme, type ThemeColorSlot, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type TrackedRunContent, type UnderlineStyle, type VerticalAlign, type Watermark, isOoxmlSymbolCharacter, normalizeRevisionId };
|
package/dist/model/document.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { DOCX_CONFORMANCE_CLASSES, DRAWING_RAW_XML_MODES, MAX_REVISION_ID, PARAGRAPH_MARK_CHANGE_KINDS, REVIEW_CARRIERS, isOoxmlSymbolCharacter, normalizeRevisionId };
|
|
1
|
+
import { a as PARAGRAPH_MARK_CHANGE_KINDS, c as normalizeRevisionId, i as MAX_REVISION_ID, l as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, n as BIDI_CONTROLS, o as REVIEW_CARRIERS, r as DRAWING_RAW_XML_MODES, s as isOoxmlSymbolCharacter, t as DOCX_CONFORMANCE_CLASSES, u as PARSE_WARNING_CODES } from "../document-CKwRw-01.js";
|
|
2
|
+
export { BIDI_CONTROLS, DOCX_CONFORMANCE_CLASSES, DRAWING_RAW_XML_MODES, MAX_RETAINED_PARSE_WARNINGS_PER_CODE, MAX_REVISION_ID, PARAGRAPH_MARK_CHANGE_KINDS, PARSE_WARNING_CODES, REVIEW_CARRIERS, isOoxmlSymbolCharacter, normalizeRevisionId };
|
package/package.json
CHANGED