@stll/folio-core 0.33.1 → 0.33.2
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/ai-edits/apply.d.ts +15 -0
- package/dist/ai-edits/apply.js +134 -25
- package/dist/ai-edits/headless.d.ts +47 -3
- package/dist/ai-edits/headless.js +53 -3
- package/dist/ai-edits/index.d.ts +1 -1
- package/dist/ai-edits/snapshot.d.ts +19 -1
- package/dist/ai-edits/snapshot.js +25 -3
- package/dist/ai-edits/table-geometry.d.ts +56 -0
- package/dist/ai-edits/table-geometry.js +217 -0
- package/dist/ai-edits/table-row-column-mutations.d.ts +34 -16
- package/dist/ai-edits/table-row-column-mutations.js +12 -4
- package/dist/ai-edits/table-template.d.ts +60 -0
- package/dist/ai-edits/table-template.js +176 -0
- package/dist/ai-edits/types.d.ts +7 -0
- package/dist/compare/__fixtures__/body-sequence.d.ts +61 -2
- package/dist/compare/__fixtures__/body-sequence.js +94 -6
- package/dist/compare/compare.d.ts +14 -7
- package/dist/compare/compare.js +136 -38
- package/dist/compare/plan.d.ts +31 -1
- package/dist/compare/plan.js +233 -66
- package/dist/compare/types.d.ts +9 -7
- package/dist/compare/types.js +7 -5
- package/dist/compare/verification.d.ts +31 -12
- package/dist/compare/verification.js +88 -17
- package/dist/compat/eigenpal.d.ts +4 -4
- package/dist/compat/eigenpal.js +2 -2
- package/dist/display-list/primitives.d.ts +1 -1
- package/dist/document-operations.d.ts +10 -1
- package/dist/document-operations.js +3 -2
- package/dist/docx/appVersionNormalization.d.ts +49 -0
- package/dist/docx/appVersionNormalization.js +74 -0
- package/dist/docx/blockContentParser.js +3 -2
- package/dist/docx/drawingUtils.js +4 -3
- package/dist/docx/paragraphParser.js +3 -2
- package/dist/docx/rezip.d.ts +10 -4
- package/dist/docx/rezip.js +54 -18
- package/dist/docx/runParser.js +9 -8
- package/dist/docx/sdtProperties.js +4 -3
- package/dist/docx/selectiveSave.js +7 -6
- package/dist/docx/serializer/commentSerializer.d.ts +1 -1
- package/dist/docx/serializer/commentSerializer.js +43 -19
- package/dist/docx/serializer/documentSerializer.d.ts +3 -1
- package/dist/docx/serializer/documentSerializer.js +42 -78
- package/dist/docx/serializer/fontTableSerializer.js +8 -5
- package/dist/docx/serializer/headerFooterSerializer.d.ts +4 -1
- package/dist/docx/serializer/headerFooterSerializer.js +34 -29
- package/dist/docx/serializer/noteSerializer.js +34 -30
- package/dist/docx/serializer/numberingSerializer.js +8 -4
- package/dist/docx/serializer/paragraphSerializer.js +3 -3
- package/dist/docx/serializer/partNamespaces.d.ts +78 -0
- package/dist/docx/serializer/partNamespaces.js +324 -0
- package/dist/docx/serializer/runSerializer.js +1 -1
- package/dist/docx/serializer/settingsSerializer.js +8 -2
- package/dist/docx/serializer/stylesSerializer.js +8 -5
- package/dist/docx/serializer/tableSerializer.js +83 -18
- package/dist/docx/serializer/themeSerializer.js +10 -2
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/docx/strictValueEncodings.gen.d.ts +15 -0
- package/dist/docx/strictValueEncodings.gen.js +275 -0
- package/dist/docx/tableParser.d.ts +0 -6
- package/dist/docx/tableParser.js +52 -7
- package/dist/docx/transitionalSpelling.d.ts +23 -0
- package/dist/docx/transitionalSpelling.js +36 -0
- package/dist/docx/universalMeasure.d.ts +20 -0
- package/dist/docx/universalMeasure.js +32 -0
- package/dist/docx/verbatimCapture.d.ts +20 -0
- package/dist/docx/verbatimCapture.js +131 -0
- package/dist/docx/vmlImageParser.js +4 -3
- package/dist/docx/watermarkParser.js +4 -3
- package/dist/docx/xmlParser.d.ts +23 -2
- package/dist/docx/xmlParser.js +43 -11
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/prosemirror/commands/comments.js +2 -1
- package/dist/prosemirror/containerFinalParagraph.d.ts +47 -0
- package/dist/prosemirror/containerFinalParagraph.js +92 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +8 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +15 -4
- package/dist/prosemirror/conversion/toProseDoc.js +12 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +5 -0
- package/dist/prosemirror/schema/marks.d.ts +1 -1
- package/dist/prosemirror/schema/nodes.d.ts +22 -0
- package/dist/server.d.ts +1 -1
- package/dist/types/block-id.d.ts +12 -1
- package/dist/types/block-id.js +17 -1
- package/dist/utils/canonicalJson.d.ts +14 -0
- package/dist/utils/canonicalJson.js +19 -0
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { serializePartElement } from "./partNamespaces.js";
|
|
1
2
|
import { escapeXml, intAttr } from "./xmlUtils.js";
|
|
2
3
|
//#region src/docx/serializer/settingsSerializer.ts
|
|
3
|
-
const W_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
4
4
|
const serializeSettingsXml = (settings) => {
|
|
5
5
|
const parts = [`<w:defaultTabStop w:val="${intAttr(settings.defaultTabStop)}"/>`];
|
|
6
6
|
if (settings.evenAndOddHeaders) parts.push("<w:evenAndOddHeaders/>");
|
|
@@ -11,7 +11,13 @@ const serializeSettingsXml = (settings) => {
|
|
|
11
11
|
if (settings.themeFontLang.bidi) attrs.push(`w:bidi="${escapeXml(settings.themeFontLang.bidi)}"`);
|
|
12
12
|
if (attrs.length > 0) parts.push(`<w:themeFontLang ${attrs.join(" ")}/>`);
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + serializePartElement({
|
|
15
|
+
partPath: "word/settings.xml",
|
|
16
|
+
rootName: "w:settings",
|
|
17
|
+
baselinePrefixes: ["w"],
|
|
18
|
+
sourceBindings: void 0,
|
|
19
|
+
body: parts.join("")
|
|
20
|
+
});
|
|
15
21
|
};
|
|
16
22
|
//#endregion
|
|
17
23
|
export { serializeSettingsXml };
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { serializeParagraphFormatting } from "./paragraphSerializer.js";
|
|
2
|
+
import { serializePartElement } from "./partNamespaces.js";
|
|
2
3
|
import { serializeTextFormatting } from "./runSerializer.js";
|
|
3
4
|
import { serializeTableCellFormatting, serializeTableFormatting, serializeTableRowFormatting } from "./tableSerializer.js";
|
|
4
5
|
import { escapeXml } from "./xmlUtils.js";
|
|
5
6
|
//#region src/docx/serializer/stylesSerializer.ts
|
|
6
|
-
const W_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
7
7
|
const serializeStylesXml = (definitions) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + serializePartElement({
|
|
9
|
+
partPath: "word/styles.xml",
|
|
10
|
+
rootName: "w:styles",
|
|
11
|
+
baselinePrefixes: ["w"],
|
|
12
|
+
sourceBindings: void 0,
|
|
13
|
+
body: `${serializeDocumentDefaults(definitions)}${serializeLatentStyles(definitions)}${definitions.styles.map(serializeStyle).join("")}`
|
|
14
|
+
});
|
|
12
15
|
};
|
|
13
16
|
const serializeDocumentDefaults = (definitions) => {
|
|
14
17
|
return `<w:docDefaults><w:rPrDefault>${serializeTextFormatting(definitions.docDefaults?.rPr) || "<w:rPr/>"}</w:rPrDefault><w:pPrDefault>${serializeParagraphFormatting(definitions.docDefaults?.pPr) || "<w:pPr/>"}</w:pPrDefault></w:docDefaults>`;
|
|
@@ -1,8 +1,74 @@
|
|
|
1
|
+
import { canonicalJson } from "../../utils/canonicalJson.js";
|
|
1
2
|
import { isValidHexColor } from "../../utils/colorResolver.js";
|
|
3
|
+
import { parseTableCellProperties, parseTableGrid, parseTableProperties, parseTableRowProperties } from "../tableParser.js";
|
|
4
|
+
import { OOXML_NAMESPACE_SCOPE, parseXml } from "../xmlParser.js";
|
|
2
5
|
import { serializeBorder } from "./borderSerializer.js";
|
|
3
6
|
import { escapeXml, intAttr } from "./xmlUtils.js";
|
|
4
7
|
import { normalizeRevisionId } from "@stll/docx-core/model";
|
|
5
8
|
//#region src/docx/serializer/tableSerializer.ts
|
|
9
|
+
/**
|
|
10
|
+
* The captured element with the revision children written back into it.
|
|
11
|
+
*
|
|
12
|
+
* The capture holds properties only, so a revision the model carries — a row
|
|
13
|
+
* marked inserted, a `w:tcPrChange` — is appended here rather than forcing the
|
|
14
|
+
* whole element to be rebuilt and losing everything the model does not cover.
|
|
15
|
+
*/
|
|
16
|
+
const withRevisionChildren = (sourceXml, revisions) => {
|
|
17
|
+
const written = revisions.join("");
|
|
18
|
+
if (written.length === 0) return sourceXml;
|
|
19
|
+
if (sourceXml.endsWith("/>")) {
|
|
20
|
+
const name = sourceXml.slice(1, sourceXml.length - 2).split(/[\s/]/u)[0] ?? "";
|
|
21
|
+
return `${sourceXml.slice(0, -2)}>${written}</${name}>`;
|
|
22
|
+
}
|
|
23
|
+
const close = sourceXml.lastIndexOf("</");
|
|
24
|
+
return close === -1 ? sourceXml : `${sourceXml.slice(0, close)}${written}${sourceXml.slice(close)}`;
|
|
25
|
+
};
|
|
26
|
+
/** `w:trPr/w:ins` | `w:trPr/w:del`, the row's own structural revision. */
|
|
27
|
+
const rowStructuralChangeXml = (change) => {
|
|
28
|
+
if (change?.type === "tableRowInsertion") return [`<w:ins ${serializeTrackedChangeAttributes(change.info)}/>`];
|
|
29
|
+
if (change?.type === "tableRowDeletion") return [`<w:del ${serializeTrackedChangeAttributes(change.info)}/>`];
|
|
30
|
+
return [];
|
|
31
|
+
};
|
|
32
|
+
/** `w:tcPr/w:cellIns` | `w:cellDel` | `w:cellMerge`, the cell's own. */
|
|
33
|
+
const cellStructuralChangeXml = (change) => {
|
|
34
|
+
if (change?.type === "tableCellInsertion") return [`<w:cellIns ${serializeTrackedChangeAttributes(change.info)}/>`];
|
|
35
|
+
if (change?.type === "tableCellDeletion") return [`<w:cellDel ${serializeTrackedChangeAttributes(change.info)}/>`];
|
|
36
|
+
if (change?.type !== "tableCellMerge") return [];
|
|
37
|
+
const attrs = [serializeTrackedChangeAttributes(change.info)];
|
|
38
|
+
if (change.verticalMerge) attrs.push(`w:vMerge="${change.verticalMerge === "continue" ? "cont" : "rest"}"`);
|
|
39
|
+
if (change.verticalMergeOriginal) attrs.push(`w:vMergeOrig="${change.verticalMergeOriginal === "continue" ? "cont" : "rest"}"`);
|
|
40
|
+
return [`<w:cellMerge ${attrs.join(" ")}/>`];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A property set without the elements kept beside it. Only the typed values
|
|
44
|
+
* decide whether a capture still describes the node; the captures themselves
|
|
45
|
+
* are what is being decided about.
|
|
46
|
+
*/
|
|
47
|
+
const withoutCaptures = (formatting) => {
|
|
48
|
+
const { sourceXml: _source, gridSourceXml: _grid, ...rest } = formatting ?? {};
|
|
49
|
+
return rest;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The element a formatting object was parsed from, when it still describes it.
|
|
53
|
+
*
|
|
54
|
+
* `sourceXml` is only usable while the typed values around it are the ones it
|
|
55
|
+
* was parsed into. Anything may edit a `Document` in place — a host building
|
|
56
|
+
* one by hand, a migration, a test — and a capture written back over a changed
|
|
57
|
+
* model would silently discard the change. So the capture is re-parsed and
|
|
58
|
+
* checked rather than trusted: it is written only when parsing it reproduces
|
|
59
|
+
* the formatting it sits on.
|
|
60
|
+
*
|
|
61
|
+
* The re-parse runs under {@link OOXML_NAMESPACE_SCOPE} because a captured
|
|
62
|
+
* fragment carries no `xmlns` of its own. A document that binds the
|
|
63
|
+
* WordprocessingML prefix differently fails the check and is rebuilt from the
|
|
64
|
+
* model, which is what happened to every document before the capture existed.
|
|
65
|
+
*/
|
|
66
|
+
const verifiedSourceXml = (formatting, parse) => {
|
|
67
|
+
if (formatting === void 0 || formatting.sourceXml === void 0) return null;
|
|
68
|
+
const { sourceXml } = formatting;
|
|
69
|
+
const reparsed = parse(parseXml(sourceXml, OOXML_NAMESPACE_SCOPE).elements?.[0] ?? null);
|
|
70
|
+
return canonicalJson(withoutCaptures(reparsed)) === canonicalJson(withoutCaptures(formatting)) ? sourceXml : null;
|
|
71
|
+
};
|
|
6
72
|
function normalizeTrackedChangeInfo(info) {
|
|
7
73
|
const normalizedId = normalizeRevisionId(info.id);
|
|
8
74
|
const authorCandidate = typeof info.author === "string" ? info.author.trim() : "";
|
|
@@ -18,6 +84,7 @@ function serializeTrackedChangeAttributes(info, rsid) {
|
|
|
18
84
|
const normalized = normalizeTrackedChangeInfo(info);
|
|
19
85
|
const attrs = [`w:id="${normalized.id}"`, `w:author="${escapeXml(normalized.author)}"`];
|
|
20
86
|
if (normalized.date) attrs.push(`w:date="${escapeXml(normalized.date)}"`);
|
|
87
|
+
if (info.utcDate) attrs.push(`${info.utcDate.attribute}="${escapeXml(info.utcDate.value)}"`);
|
|
21
88
|
if (rsid && rsid.trim().length > 0) attrs.push(`w:rsid="${escapeXml(rsid.trim())}"`);
|
|
22
89
|
return attrs.join(" ");
|
|
23
90
|
}
|
|
@@ -129,11 +196,14 @@ function serializeFloatingTableProperties(floating) {
|
|
|
129
196
|
* Serialize table formatting properties (w:tblPr)
|
|
130
197
|
*/
|
|
131
198
|
function serializeTableFormatting(formatting, propertyChanges) {
|
|
199
|
+
const tableSource = verifiedSourceXml(formatting, parseTableProperties);
|
|
200
|
+
if (tableSource !== null) return withRevisionChildren(tableSource, (propertyChanges ?? []).map((change) => serializeTablePropertyChange(change)));
|
|
132
201
|
const parts = [];
|
|
133
202
|
if (formatting) {
|
|
134
203
|
if (formatting.styleId) parts.push(`<w:tblStyle w:val="${escapeXml(formatting.styleId)}"/>`);
|
|
135
204
|
const floatingXml = serializeFloatingTableProperties(formatting.floating);
|
|
136
205
|
if (floatingXml) parts.push(floatingXml);
|
|
206
|
+
if (formatting.overlap) parts.push(`<w:tblOverlap w:val="${formatting.overlap}"/>`);
|
|
137
207
|
if (formatting.bidi !== void 0) parts.push(formatting.bidi ? "<w:bidiVisual/>" : "<w:bidiVisual w:val=\"0\"/>");
|
|
138
208
|
const widthXml = serializeMeasurement(formatting.width, "tblW");
|
|
139
209
|
if (widthXml) parts.push(widthXml);
|
|
@@ -144,14 +214,13 @@ function serializeTableFormatting(formatting, propertyChanges) {
|
|
|
144
214
|
if (indentXml) parts.push(indentXml);
|
|
145
215
|
const bordersXml = serializeTableBorders(formatting.borders, "tblBorders");
|
|
146
216
|
if (bordersXml) parts.push(bordersXml);
|
|
147
|
-
const marginsXml = serializeCellMargins(formatting.cellMargins, "tblCellMar");
|
|
148
|
-
if (marginsXml) parts.push(marginsXml);
|
|
149
|
-
if (formatting.layout) parts.push(`<w:tblLayout w:type="${formatting.layout}"/>`);
|
|
150
217
|
const shadingXml = serializeShading(formatting.shading);
|
|
151
218
|
if (shadingXml) parts.push(shadingXml);
|
|
219
|
+
if (formatting.layout) parts.push(`<w:tblLayout w:type="${formatting.layout}"/>`);
|
|
220
|
+
const marginsXml = serializeCellMargins(formatting.cellMargins, "tblCellMar");
|
|
221
|
+
if (marginsXml) parts.push(marginsXml);
|
|
152
222
|
const lookXml = serializeTableLook(formatting.look);
|
|
153
223
|
if (lookXml) parts.push(lookXml);
|
|
154
|
-
if (formatting.overlap) parts.push(`<w:tblOverlap w:val="${formatting.overlap}"/>`);
|
|
155
224
|
}
|
|
156
225
|
if (propertyChanges && propertyChanges.length > 0) parts.push(...propertyChanges.map((change) => serializeTablePropertyChange(change)));
|
|
157
226
|
if (parts.length === 0) return "";
|
|
@@ -170,6 +239,8 @@ function serializeTablePropertyChange(change) {
|
|
|
170
239
|
* Serialize table row formatting properties (w:trPr)
|
|
171
240
|
*/
|
|
172
241
|
function serializeTableRowFormatting(formatting, propertyChanges, structuralChange) {
|
|
242
|
+
const rowSource = verifiedSourceXml(formatting, parseTableRowProperties);
|
|
243
|
+
if (rowSource !== null) return withRevisionChildren(rowSource, [...rowStructuralChangeXml(structuralChange), ...(propertyChanges ?? []).map((change) => serializeTableRowPropertyChange(change))]);
|
|
173
244
|
const parts = [];
|
|
174
245
|
if (formatting) {
|
|
175
246
|
const cnfStyleXml = serializeConditionalFormatStyle(formatting.conditionalFormat);
|
|
@@ -188,10 +259,7 @@ function serializeTableRowFormatting(formatting, propertyChanges, structuralChan
|
|
|
188
259
|
if (formatting.justification) parts.push(`<w:jc w:val="${formatting.justification}"/>`);
|
|
189
260
|
if (formatting.hidden) parts.push("<w:hidden/>");
|
|
190
261
|
}
|
|
191
|
-
|
|
192
|
-
if (structuralChange.type === "tableRowInsertion") parts.push(`<w:ins ${serializeTrackedChangeAttributes(structuralChange.info)}/>`);
|
|
193
|
-
else if (structuralChange.type === "tableRowDeletion") parts.push(`<w:del ${serializeTrackedChangeAttributes(structuralChange.info)}/>`);
|
|
194
|
-
}
|
|
262
|
+
parts.push(...rowStructuralChangeXml(structuralChange));
|
|
195
263
|
if (propertyChanges && propertyChanges.length > 0) parts.push(...propertyChanges.map((change) => serializeTableRowPropertyChange(change)));
|
|
196
264
|
if (parts.length === 0) return "";
|
|
197
265
|
return `<w:trPr>${parts.join("")}</w:trPr>`;
|
|
@@ -231,6 +299,8 @@ function serializeConditionalFormatStyle(style) {
|
|
|
231
299
|
* Serialize table cell formatting properties (w:tcPr)
|
|
232
300
|
*/
|
|
233
301
|
function serializeTableCellFormatting(formatting, propertyChanges, structuralChange) {
|
|
302
|
+
const cellSource = verifiedSourceXml(formatting, parseTableCellProperties);
|
|
303
|
+
if (cellSource !== null) return withRevisionChildren(cellSource, [...cellStructuralChangeXml(structuralChange), ...(propertyChanges ?? []).map((change) => serializeTableCellPropertyChange(change))]);
|
|
234
304
|
const parts = [];
|
|
235
305
|
if (formatting) {
|
|
236
306
|
const cnfStyleXml = serializeConditionalFormatStyle(formatting.conditionalFormat);
|
|
@@ -253,16 +323,7 @@ function serializeTableCellFormatting(formatting, propertyChanges, structuralCha
|
|
|
253
323
|
if (formatting.hideMark === true) parts.push("<w:hideMark/>");
|
|
254
324
|
else if (formatting.hideMark === false) parts.push("<w:hideMark w:val=\"off\"/>");
|
|
255
325
|
}
|
|
256
|
-
|
|
257
|
-
if (structuralChange.type === "tableCellInsertion") parts.push(`<w:cellIns ${serializeTrackedChangeAttributes(structuralChange.info)}/>`);
|
|
258
|
-
else if (structuralChange.type === "tableCellDeletion") parts.push(`<w:cellDel ${serializeTrackedChangeAttributes(structuralChange.info)}/>`);
|
|
259
|
-
else if (structuralChange.type === "tableCellMerge") {
|
|
260
|
-
const attrs = [serializeTrackedChangeAttributes(structuralChange.info)];
|
|
261
|
-
if (structuralChange.verticalMerge) attrs.push(`w:vMerge="${structuralChange.verticalMerge === "continue" ? "cont" : "rest"}"`);
|
|
262
|
-
if (structuralChange.verticalMergeOriginal) attrs.push(`w:vMergeOrig="${structuralChange.verticalMergeOriginal === "continue" ? "cont" : "rest"}"`);
|
|
263
|
-
parts.push(`<w:cellMerge ${attrs.join(" ")}/>`);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
326
|
+
parts.push(...cellStructuralChangeXml(structuralChange));
|
|
266
327
|
if (propertyChanges && propertyChanges.length > 0) parts.push(...propertyChanges.map((change) => serializeTableCellPropertyChange(change)));
|
|
267
328
|
if (parts.length === 0) return "";
|
|
268
329
|
return `<w:tcPr>${parts.join("")}</w:tcPr>`;
|
|
@@ -298,6 +359,10 @@ function gridColumnCount(table) {
|
|
|
298
359
|
*/
|
|
299
360
|
function serializeTableGrid(table) {
|
|
300
361
|
const columnWidths = table.columnWidths;
|
|
362
|
+
const gridSourceXml = table.formatting?.gridSourceXml;
|
|
363
|
+
if (gridSourceXml !== void 0) {
|
|
364
|
+
if (canonicalJson(parseTableGrid(parseXml(gridSourceXml, OOXML_NAMESPACE_SCOPE).elements?.[0] ?? null)) === canonicalJson(columnWidths)) return gridSourceXml;
|
|
365
|
+
}
|
|
301
366
|
if (columnWidths && columnWidths.length > 0) return `<w:tblGrid>${columnWidths.map((w) => `<w:gridCol w:w="${intAttr(w)}"/>`).join("")}</w:tblGrid>`;
|
|
302
367
|
const columns = gridColumnCount(table);
|
|
303
368
|
return columns === 0 ? "<w:tblGrid/>" : `<w:tblGrid>${"<w:gridCol/>".repeat(columns)}</w:tblGrid>`;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { serializePartElement } from "./partNamespaces.js";
|
|
1
2
|
import { escapeXml } from "./xmlUtils.js";
|
|
2
3
|
//#region src/docx/serializer/themeSerializer.ts
|
|
3
|
-
const A_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
4
4
|
const serializeThemeXml = (theme) => {
|
|
5
5
|
const name = escapeXml(theme.name ?? "Folio Theme");
|
|
6
|
-
|
|
6
|
+
const elements = `${serializeColorScheme(theme.colorScheme)}${serializeFontScheme(theme)}${serializeFormatScheme(theme)}`;
|
|
7
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + serializePartElement({
|
|
8
|
+
partPath: "word/theme/theme1.xml",
|
|
9
|
+
rootName: "a:theme",
|
|
10
|
+
rootAttributes: `name="${name}"`,
|
|
11
|
+
baselinePrefixes: ["a"],
|
|
12
|
+
sourceBindings: void 0,
|
|
13
|
+
body: `<a:themeElements>${elements}</a:themeElements>`
|
|
14
|
+
});
|
|
7
15
|
};
|
|
8
16
|
const serializeColorScheme = (colors) => {
|
|
9
17
|
const values = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { document_d_exports } from "../../types/document.js";
|
|
2
1
|
import { ShadingProperties } from "../../types/colors.js";
|
|
2
|
+
import { document_d_exports } from "../../types/document.js";
|
|
3
3
|
import { Hyperlink, Paragraph, ParagraphContent, Run, Table } from "../../types/content.js";
|
|
4
4
|
import { ParagraphFormatting, TextFormatting } from "../../types/formatting.js";
|
|
5
5
|
//#region src/docx/server/build.d.ts
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MeasureUnit } from "./universalMeasure.js";
|
|
2
|
+
//#region src/docx/strictValueEncodings.gen.d.ts
|
|
3
|
+
/** The fraction of a percent a Transitional attribute's number counts. */
|
|
4
|
+
type PercentUnit = "fiftiethPercent" | "thousandthPercent" | "wholePercent";
|
|
5
|
+
/** The number a slot's dual-spelling type accepts in place of a Strict string. */
|
|
6
|
+
type SlotEncoding = {
|
|
7
|
+
readonly measure?: MeasureUnit;
|
|
8
|
+
readonly percent?: PercentUnit;
|
|
9
|
+
};
|
|
10
|
+
/** Slots whose Transitional type spells one value two ways. */
|
|
11
|
+
declare const TRANSITIONAL_SLOT_ENCODINGS: ReadonlyMap<string, SlotEncoding>;
|
|
12
|
+
/** Every Strict namespace URI a WordprocessingML part can carry, and its Transitional pair. */
|
|
13
|
+
declare const TRANSITIONAL_NAMESPACE_BY_STRICT_URI: ReadonlyMap<string, string>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PercentUnit, SlotEncoding, TRANSITIONAL_NAMESPACE_BY_STRICT_URI, TRANSITIONAL_SLOT_ENCODINGS };
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
//#region src/docx/strictValueEncodings.gen.ts
|
|
2
|
+
const MEASURE_UNITS = {
|
|
3
|
+
emu: "emu",
|
|
4
|
+
halfPoints: "halfPoints",
|
|
5
|
+
hundredthPoints: "hundredthPoints",
|
|
6
|
+
twips: "twips"
|
|
7
|
+
};
|
|
8
|
+
const PERCENT_UNITS = {
|
|
9
|
+
fiftiethPercent: "fiftiethPercent",
|
|
10
|
+
thousandthPercent: "thousandthPercent",
|
|
11
|
+
wholePercent: "wholePercent"
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* One slot per line: the slot, a tab, its measure unit, a tab, its percent unit.
|
|
15
|
+
*
|
|
16
|
+
* Text rather than object literals because every package that depends on
|
|
17
|
+
* `@stll/folio-core` pays this file's inference cost, and a few hundred
|
|
18
|
+
* literals breach the repository's compiler-workload budget on their own.
|
|
19
|
+
* The slot is `"<namespace URI> <element local name>"` for element text and
|
|
20
|
+
* `"<namespace URI> <element local name> @<attribute local name>"` for an
|
|
21
|
+
* attribute; an empty column means the type has no spelling of that kind.
|
|
22
|
+
*/
|
|
23
|
+
const SLOT_TABLE = `http://schemas.openxmlformats.org/drawingml/2006/main ahPolar @maxR emu
|
|
24
|
+
http://schemas.openxmlformats.org/drawingml/2006/main ahPolar @minR emu
|
|
25
|
+
http://schemas.openxmlformats.org/drawingml/2006/main ahXY @maxX emu
|
|
26
|
+
http://schemas.openxmlformats.org/drawingml/2006/main ahXY @maxY emu
|
|
27
|
+
http://schemas.openxmlformats.org/drawingml/2006/main ahXY @minX emu
|
|
28
|
+
http://schemas.openxmlformats.org/drawingml/2006/main ahXY @minY emu
|
|
29
|
+
http://schemas.openxmlformats.org/drawingml/2006/main alpha @val thousandthPercent
|
|
30
|
+
http://schemas.openxmlformats.org/drawingml/2006/main alphaBiLevel @thresh thousandthPercent
|
|
31
|
+
http://schemas.openxmlformats.org/drawingml/2006/main alphaMod @val thousandthPercent
|
|
32
|
+
http://schemas.openxmlformats.org/drawingml/2006/main alphaModFix @amt thousandthPercent
|
|
33
|
+
http://schemas.openxmlformats.org/drawingml/2006/main alphaOff @val thousandthPercent
|
|
34
|
+
http://schemas.openxmlformats.org/drawingml/2006/main alphaOutset @rad emu
|
|
35
|
+
http://schemas.openxmlformats.org/drawingml/2006/main alphaRepl @a thousandthPercent
|
|
36
|
+
http://schemas.openxmlformats.org/drawingml/2006/main anchor @x emu
|
|
37
|
+
http://schemas.openxmlformats.org/drawingml/2006/main anchor @y emu
|
|
38
|
+
http://schemas.openxmlformats.org/drawingml/2006/main anchor @z emu
|
|
39
|
+
http://schemas.openxmlformats.org/drawingml/2006/main arcTo @hR emu
|
|
40
|
+
http://schemas.openxmlformats.org/drawingml/2006/main arcTo @wR emu
|
|
41
|
+
http://schemas.openxmlformats.org/drawingml/2006/main biLevel @thresh thousandthPercent
|
|
42
|
+
http://schemas.openxmlformats.org/drawingml/2006/main blue @val thousandthPercent
|
|
43
|
+
http://schemas.openxmlformats.org/drawingml/2006/main blueMod @val thousandthPercent
|
|
44
|
+
http://schemas.openxmlformats.org/drawingml/2006/main blueOff @val thousandthPercent
|
|
45
|
+
http://schemas.openxmlformats.org/drawingml/2006/main bodyPr @bIns emu
|
|
46
|
+
http://schemas.openxmlformats.org/drawingml/2006/main bodyPr @lIns emu
|
|
47
|
+
http://schemas.openxmlformats.org/drawingml/2006/main bodyPr @rIns emu
|
|
48
|
+
http://schemas.openxmlformats.org/drawingml/2006/main bodyPr @tIns emu
|
|
49
|
+
http://schemas.openxmlformats.org/drawingml/2006/main camera @zoom thousandthPercent
|
|
50
|
+
http://schemas.openxmlformats.org/drawingml/2006/main chOff @x emu
|
|
51
|
+
http://schemas.openxmlformats.org/drawingml/2006/main chOff @y emu
|
|
52
|
+
http://schemas.openxmlformats.org/drawingml/2006/main defPPr @defTabSz emu
|
|
53
|
+
http://schemas.openxmlformats.org/drawingml/2006/main defRPr @baseline thousandthPercent
|
|
54
|
+
http://schemas.openxmlformats.org/drawingml/2006/main defRPr @spc hundredthPoints
|
|
55
|
+
http://schemas.openxmlformats.org/drawingml/2006/main ds @d thousandthPercent
|
|
56
|
+
http://schemas.openxmlformats.org/drawingml/2006/main ds @sp thousandthPercent
|
|
57
|
+
http://schemas.openxmlformats.org/drawingml/2006/main endParaRPr @baseline thousandthPercent
|
|
58
|
+
http://schemas.openxmlformats.org/drawingml/2006/main endParaRPr @spc hundredthPoints
|
|
59
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillRect @b thousandthPercent
|
|
60
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillRect @l thousandthPercent
|
|
61
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillRect @r thousandthPercent
|
|
62
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillRect @t thousandthPercent
|
|
63
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillToRect @b thousandthPercent
|
|
64
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillToRect @l thousandthPercent
|
|
65
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillToRect @r thousandthPercent
|
|
66
|
+
http://schemas.openxmlformats.org/drawingml/2006/main fillToRect @t thousandthPercent
|
|
67
|
+
http://schemas.openxmlformats.org/drawingml/2006/main flatTx @z emu
|
|
68
|
+
http://schemas.openxmlformats.org/drawingml/2006/main green @val thousandthPercent
|
|
69
|
+
http://schemas.openxmlformats.org/drawingml/2006/main greenMod @val thousandthPercent
|
|
70
|
+
http://schemas.openxmlformats.org/drawingml/2006/main greenOff @val thousandthPercent
|
|
71
|
+
http://schemas.openxmlformats.org/drawingml/2006/main gridCol @w emu
|
|
72
|
+
http://schemas.openxmlformats.org/drawingml/2006/main gs @pos thousandthPercent
|
|
73
|
+
http://schemas.openxmlformats.org/drawingml/2006/main hsl @lum thousandthPercent
|
|
74
|
+
http://schemas.openxmlformats.org/drawingml/2006/main hsl @sat thousandthPercent
|
|
75
|
+
http://schemas.openxmlformats.org/drawingml/2006/main hslClr @lum thousandthPercent
|
|
76
|
+
http://schemas.openxmlformats.org/drawingml/2006/main hslClr @sat thousandthPercent
|
|
77
|
+
http://schemas.openxmlformats.org/drawingml/2006/main hueMod @val thousandthPercent
|
|
78
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lum @bright thousandthPercent
|
|
79
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lum @contrast thousandthPercent
|
|
80
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lum @val thousandthPercent
|
|
81
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lumMod @val thousandthPercent
|
|
82
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lumOff @val thousandthPercent
|
|
83
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl1pPr @defTabSz emu
|
|
84
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl2pPr @defTabSz emu
|
|
85
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl3pPr @defTabSz emu
|
|
86
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl4pPr @defTabSz emu
|
|
87
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl5pPr @defTabSz emu
|
|
88
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl6pPr @defTabSz emu
|
|
89
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl7pPr @defTabSz emu
|
|
90
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl8pPr @defTabSz emu
|
|
91
|
+
http://schemas.openxmlformats.org/drawingml/2006/main lvl9pPr @defTabSz emu
|
|
92
|
+
http://schemas.openxmlformats.org/drawingml/2006/main miter @lim thousandthPercent
|
|
93
|
+
http://schemas.openxmlformats.org/drawingml/2006/main norm @dx emu
|
|
94
|
+
http://schemas.openxmlformats.org/drawingml/2006/main norm @dy emu
|
|
95
|
+
http://schemas.openxmlformats.org/drawingml/2006/main norm @dz emu
|
|
96
|
+
http://schemas.openxmlformats.org/drawingml/2006/main normAutofit @fontScale thousandthPercent
|
|
97
|
+
http://schemas.openxmlformats.org/drawingml/2006/main normAutofit @lnSpcReduction thousandthPercent
|
|
98
|
+
http://schemas.openxmlformats.org/drawingml/2006/main off @x emu
|
|
99
|
+
http://schemas.openxmlformats.org/drawingml/2006/main off @y emu
|
|
100
|
+
http://schemas.openxmlformats.org/drawingml/2006/main outerShdw @sx thousandthPercent
|
|
101
|
+
http://schemas.openxmlformats.org/drawingml/2006/main outerShdw @sy thousandthPercent
|
|
102
|
+
http://schemas.openxmlformats.org/drawingml/2006/main pPr @defTabSz emu
|
|
103
|
+
http://schemas.openxmlformats.org/drawingml/2006/main pos @x emu
|
|
104
|
+
http://schemas.openxmlformats.org/drawingml/2006/main pos @y emu
|
|
105
|
+
http://schemas.openxmlformats.org/drawingml/2006/main pt @x emu
|
|
106
|
+
http://schemas.openxmlformats.org/drawingml/2006/main pt @y emu
|
|
107
|
+
http://schemas.openxmlformats.org/drawingml/2006/main rPr @baseline thousandthPercent
|
|
108
|
+
http://schemas.openxmlformats.org/drawingml/2006/main rPr @spc hundredthPoints
|
|
109
|
+
http://schemas.openxmlformats.org/drawingml/2006/main rect @b emu
|
|
110
|
+
http://schemas.openxmlformats.org/drawingml/2006/main rect @l emu
|
|
111
|
+
http://schemas.openxmlformats.org/drawingml/2006/main rect @r emu
|
|
112
|
+
http://schemas.openxmlformats.org/drawingml/2006/main rect @t emu
|
|
113
|
+
http://schemas.openxmlformats.org/drawingml/2006/main red @val thousandthPercent
|
|
114
|
+
http://schemas.openxmlformats.org/drawingml/2006/main redMod @val thousandthPercent
|
|
115
|
+
http://schemas.openxmlformats.org/drawingml/2006/main redOff @val thousandthPercent
|
|
116
|
+
http://schemas.openxmlformats.org/drawingml/2006/main reflection @endA thousandthPercent
|
|
117
|
+
http://schemas.openxmlformats.org/drawingml/2006/main reflection @endPos thousandthPercent
|
|
118
|
+
http://schemas.openxmlformats.org/drawingml/2006/main reflection @stA thousandthPercent
|
|
119
|
+
http://schemas.openxmlformats.org/drawingml/2006/main reflection @stPos thousandthPercent
|
|
120
|
+
http://schemas.openxmlformats.org/drawingml/2006/main reflection @sx thousandthPercent
|
|
121
|
+
http://schemas.openxmlformats.org/drawingml/2006/main reflection @sy thousandthPercent
|
|
122
|
+
http://schemas.openxmlformats.org/drawingml/2006/main relOff @tx thousandthPercent
|
|
123
|
+
http://schemas.openxmlformats.org/drawingml/2006/main relOff @ty thousandthPercent
|
|
124
|
+
http://schemas.openxmlformats.org/drawingml/2006/main sat @val thousandthPercent
|
|
125
|
+
http://schemas.openxmlformats.org/drawingml/2006/main satMod @val thousandthPercent
|
|
126
|
+
http://schemas.openxmlformats.org/drawingml/2006/main satOff @val thousandthPercent
|
|
127
|
+
http://schemas.openxmlformats.org/drawingml/2006/main scrgbClr @b thousandthPercent
|
|
128
|
+
http://schemas.openxmlformats.org/drawingml/2006/main scrgbClr @g thousandthPercent
|
|
129
|
+
http://schemas.openxmlformats.org/drawingml/2006/main scrgbClr @r thousandthPercent
|
|
130
|
+
http://schemas.openxmlformats.org/drawingml/2006/main shade @val thousandthPercent
|
|
131
|
+
http://schemas.openxmlformats.org/drawingml/2006/main sp3d @z emu
|
|
132
|
+
http://schemas.openxmlformats.org/drawingml/2006/main spcPct @val thousandthPercent
|
|
133
|
+
http://schemas.openxmlformats.org/drawingml/2006/main srcRect @b thousandthPercent
|
|
134
|
+
http://schemas.openxmlformats.org/drawingml/2006/main srcRect @l thousandthPercent
|
|
135
|
+
http://schemas.openxmlformats.org/drawingml/2006/main srcRect @r thousandthPercent
|
|
136
|
+
http://schemas.openxmlformats.org/drawingml/2006/main srcRect @t thousandthPercent
|
|
137
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tab @pos emu
|
|
138
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tcPr @marB emu
|
|
139
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tcPr @marL emu
|
|
140
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tcPr @marR emu
|
|
141
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tcPr @marT emu
|
|
142
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tile @sx thousandthPercent
|
|
143
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tile @sy thousandthPercent
|
|
144
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tile @tx emu
|
|
145
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tile @ty emu
|
|
146
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tileRect @b thousandthPercent
|
|
147
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tileRect @l thousandthPercent
|
|
148
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tileRect @r thousandthPercent
|
|
149
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tileRect @t thousandthPercent
|
|
150
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tint @amt thousandthPercent
|
|
151
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tint @val thousandthPercent
|
|
152
|
+
http://schemas.openxmlformats.org/drawingml/2006/main tr @h emu
|
|
153
|
+
http://schemas.openxmlformats.org/drawingml/2006/main up @dx emu
|
|
154
|
+
http://schemas.openxmlformats.org/drawingml/2006/main up @dy emu
|
|
155
|
+
http://schemas.openxmlformats.org/drawingml/2006/main up @dz emu
|
|
156
|
+
http://schemas.openxmlformats.org/drawingml/2006/main xfrm @sx thousandthPercent
|
|
157
|
+
http://schemas.openxmlformats.org/drawingml/2006/main xfrm @sy thousandthPercent
|
|
158
|
+
http://schemas.openxmlformats.org/drawingml/2006/main xfrm @tx emu
|
|
159
|
+
http://schemas.openxmlformats.org/drawingml/2006/main xfrm @ty emu
|
|
160
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing bodyPr @bIns emu
|
|
161
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing bodyPr @lIns emu
|
|
162
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing bodyPr @rIns emu
|
|
163
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing bodyPr @tIns emu
|
|
164
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing effectExtent @b emu
|
|
165
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing effectExtent @l emu
|
|
166
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing effectExtent @r emu
|
|
167
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing effectExtent @t emu
|
|
168
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing lineTo @x emu
|
|
169
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing lineTo @y emu
|
|
170
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing simplePos @x emu
|
|
171
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing simplePos @y emu
|
|
172
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing start @x emu
|
|
173
|
+
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing start @y emu
|
|
174
|
+
http://schemas.openxmlformats.org/officeDocument/2006/math interSp @val twips
|
|
175
|
+
http://schemas.openxmlformats.org/officeDocument/2006/math intraSp @val twips
|
|
176
|
+
http://schemas.openxmlformats.org/officeDocument/2006/math lMargin @val twips
|
|
177
|
+
http://schemas.openxmlformats.org/officeDocument/2006/math postSp @val twips
|
|
178
|
+
http://schemas.openxmlformats.org/officeDocument/2006/math preSp @val twips
|
|
179
|
+
http://schemas.openxmlformats.org/officeDocument/2006/math rMargin @val twips
|
|
180
|
+
http://schemas.openxmlformats.org/officeDocument/2006/math wrapIndent @val twips
|
|
181
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main bottom @w twips fiftiethPercent
|
|
182
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main col @space twips
|
|
183
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main col @w twips
|
|
184
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main cols @space twips
|
|
185
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main end @w twips fiftiethPercent
|
|
186
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main fitText @val twips
|
|
187
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main framePr @h twips
|
|
188
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main framePr @hSpace twips
|
|
189
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main framePr @vSpace twips
|
|
190
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main framePr @w twips
|
|
191
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main framePr @x twips
|
|
192
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main framePr @y twips
|
|
193
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main gridCol @w twips
|
|
194
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main hps @val halfPoints
|
|
195
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main hpsBaseText @val halfPoints
|
|
196
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main hpsRaise @val halfPoints
|
|
197
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main ind @end twips
|
|
198
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main ind @firstLine twips
|
|
199
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main ind @hanging twips
|
|
200
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main ind @left twips
|
|
201
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main ind @right twips
|
|
202
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main ind @start twips
|
|
203
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main kern @val halfPoints
|
|
204
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main left @w twips fiftiethPercent
|
|
205
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main lnNumType @distance twips
|
|
206
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main object @dxaOrig twips
|
|
207
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main object @dyaOrig twips
|
|
208
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgMar @bottom twips
|
|
209
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgMar @footer twips
|
|
210
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgMar @gutter twips
|
|
211
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgMar @header twips
|
|
212
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgMar @left twips
|
|
213
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgMar @right twips
|
|
214
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgMar @top twips
|
|
215
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgSz @h twips
|
|
216
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main pgSz @w twips
|
|
217
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main position @val halfPoints
|
|
218
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main right @w twips fiftiethPercent
|
|
219
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main size @val halfPoints
|
|
220
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main spacing @after twips
|
|
221
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main spacing @before twips
|
|
222
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main spacing @line twips
|
|
223
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main spacing @val twips
|
|
224
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main start @w twips fiftiethPercent
|
|
225
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main sz @val halfPoints
|
|
226
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main szCs @val halfPoints
|
|
227
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tab @pos twips
|
|
228
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblCellSpacing @w twips fiftiethPercent
|
|
229
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblInd @w twips fiftiethPercent
|
|
230
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblW @w twips fiftiethPercent
|
|
231
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblpPr @bottomFromText twips
|
|
232
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblpPr @leftFromText twips
|
|
233
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblpPr @rightFromText twips
|
|
234
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblpPr @tblpX twips
|
|
235
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblpPr @tblpY twips
|
|
236
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tblpPr @topFromText twips
|
|
237
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main tcW @w twips fiftiethPercent
|
|
238
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main top @w twips fiftiethPercent
|
|
239
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main trHeight @val twips
|
|
240
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main w @val wholePercent
|
|
241
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main wAfter @w twips fiftiethPercent
|
|
242
|
+
http://schemas.openxmlformats.org/wordprocessingml/2006/main wBefore @w twips fiftiethPercent`;
|
|
243
|
+
const readSlotTable = () => {
|
|
244
|
+
const slots = /* @__PURE__ */ new Map();
|
|
245
|
+
for (const line of SLOT_TABLE.split("\n")) {
|
|
246
|
+
const [slot, measure, percent] = line.split(" ");
|
|
247
|
+
if (slot === void 0) continue;
|
|
248
|
+
const measureUnit = measure === void 0 ? void 0 : MEASURE_UNITS[measure];
|
|
249
|
+
const percentUnit = percent === void 0 ? void 0 : PERCENT_UNITS[percent];
|
|
250
|
+
slots.set(slot, {
|
|
251
|
+
...measureUnit === void 0 ? {} : { measure: measureUnit },
|
|
252
|
+
...percentUnit === void 0 ? {} : { percent: percentUnit }
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
return slots;
|
|
256
|
+
};
|
|
257
|
+
/** Slots whose Transitional type spells one value two ways. */
|
|
258
|
+
const TRANSITIONAL_SLOT_ENCODINGS = readSlotTable();
|
|
259
|
+
/** Every Strict namespace URI a WordprocessingML part can carry, and its Transitional pair. */
|
|
260
|
+
const TRANSITIONAL_NAMESPACE_BY_STRICT_URI = /* @__PURE__ */ new Map([
|
|
261
|
+
["http://purl.oclc.org/ooxml/drawingml/chart", "http://schemas.openxmlformats.org/drawingml/2006/chart"],
|
|
262
|
+
["http://purl.oclc.org/ooxml/drawingml/chartDrawing", "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"],
|
|
263
|
+
["http://purl.oclc.org/ooxml/drawingml/diagram", "http://schemas.openxmlformats.org/drawingml/2006/diagram"],
|
|
264
|
+
["http://purl.oclc.org/ooxml/drawingml/lockedCanvas", "http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"],
|
|
265
|
+
["http://purl.oclc.org/ooxml/drawingml/main", "http://schemas.openxmlformats.org/drawingml/2006/main"],
|
|
266
|
+
["http://purl.oclc.org/ooxml/drawingml/picture", "http://schemas.openxmlformats.org/drawingml/2006/picture"],
|
|
267
|
+
["http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"],
|
|
268
|
+
["http://purl.oclc.org/ooxml/officeDocument/math", "http://schemas.openxmlformats.org/officeDocument/2006/math"],
|
|
269
|
+
["http://purl.oclc.org/ooxml/officeDocument/relationships", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"],
|
|
270
|
+
["http://purl.oclc.org/ooxml/officeDocument/sharedTypes", "http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"],
|
|
271
|
+
["http://purl.oclc.org/ooxml/schemaLibrary/main", "http://schemas.openxmlformats.org/schemaLibrary/2006/main"],
|
|
272
|
+
["http://purl.oclc.org/ooxml/wordprocessingml/main", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"]
|
|
273
|
+
]);
|
|
274
|
+
//#endregion
|
|
275
|
+
export { TRANSITIONAL_NAMESPACE_BY_STRICT_URI, TRANSITIONAL_SLOT_ENCODINGS };
|
|
@@ -59,12 +59,6 @@ declare function parseTableLook(lookElement: XmlElement | null): document_d_expo
|
|
|
59
59
|
* @returns Parsed floating properties or undefined
|
|
60
60
|
*/
|
|
61
61
|
declare function parseFloatingTableProperties(tblpPrElement: XmlElement | null): document_d_exports.FloatingTableProperties | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Parse table properties (w:tblPr)
|
|
64
|
-
*
|
|
65
|
-
* @param tblPrElement - The w:tblPr element
|
|
66
|
-
* @returns Parsed table formatting
|
|
67
|
-
*/
|
|
68
62
|
declare function parseTableProperties(tblPrElement: XmlElement | null): document_d_exports.TableFormatting | undefined;
|
|
69
63
|
/**
|
|
70
64
|
* Parse table row properties (w:trPr)
|