@stll/folio-core 0.74.0 → 0.76.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/ai-edits/clean-text.d.ts +4 -1
- package/dist/ai-edits/clean-text.js +21 -7
- package/dist/ai-edits/headless.d.ts +7 -3
- package/dist/ai-edits/headless.js +36 -21
- package/dist/ai-edits/note-references.d.ts +1 -1
- package/dist/ai-edits/note-references.js +1 -1
- package/dist/ai-edits/pending-suggestions.d.ts +9 -7
- package/dist/ai-edits/pending-suggestions.js +135 -90
- package/dist/ai-edits/pendingJoin.d.ts +5 -1
- package/dist/ai-edits/pendingJoin.js +6 -2
- package/dist/ai-edits/read.js +9 -3
- package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
- package/dist/ai-edits/retired-comment-receipts.js +3 -18
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
- package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
- package/dist/ai-edits/types.d.ts +9 -4
- package/dist/canonical/batchCommentReferences.js +2 -1
- package/dist/canonical/canonicalBatchReview.d.ts +4 -1
- package/dist/canonical/canonicalBatchReview.js +37 -22
- package/dist/canonical/canonicalComments.d.ts +6 -2
- package/dist/canonical/canonicalComments.js +16 -6
- package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
- package/dist/canonical/canonicalCompilerRefusal.js +20 -14
- package/dist/canonical/canonicalPublicOperations.js +231 -79
- package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
- package/dist/canonical/canonicalRefusalGrounds.js +56 -0
- package/dist/canonical/canonicalSession.d.ts +12 -6
- package/dist/canonical/canonicalSession.js +119 -122
- package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
- package/dist/compare/inline-atoms.d.ts +35 -41
- package/dist/compare/inline-atoms.js +2 -465
- package/dist/compare/section-boundary-properties.d.ts +3 -30
- package/dist/compare/section-boundary-properties.js +4 -72
- package/dist/controller/canonicalClipboard.d.ts +1 -1
- package/dist/controller/canonicalClipboard.js +110 -55
- package/dist/controller/canonicalComposition.d.ts +1 -1
- package/dist/controller/canonicalComposition.js +5 -5
- package/dist/controller/canonicalContentControlValue.js +7 -7
- package/dist/controller/canonicalInput.d.ts +4 -2
- package/dist/controller/canonicalInput.js +33 -16
- package/dist/controller/canonicalReview.d.ts +21 -0
- package/dist/controller/canonicalReview.js +44 -9
- package/dist/controller/canonicalStoryEditor.d.ts +2 -3
- package/dist/controller/canonicalStoryEditor.js +43 -25
- package/dist/controller/canonicalStructure.d.ts +19 -3
- package/dist/controller/canonicalStructure.js +182 -58
- package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
- package/dist/controller/deferredDisplayListPainter.js +34 -0
- package/dist/controller/folioEditor.js +4 -2
- package/dist/controller/fontReadiness.js +50 -23
- package/dist/controller/headerFooterEditorManager.js +3 -17
- package/dist/controller/hiddenEditorApi.d.ts +24 -3
- package/dist/controller/hiddenEditorApi.js +2 -0
- package/dist/controller/hiddenEditorManager.js +135 -207
- package/dist/controller/layoutPipeline.d.ts +4 -86
- package/dist/controller/layoutPipeline.js +8 -727
- package/dist/controller/layoutPipelineExecution.d.ts +94 -0
- package/dist/controller/layoutPipelineExecution.js +730 -0
- package/dist/controller/noteEditorManager.js +3 -16
- package/dist/docx/blockContentParser.d.ts +1 -3
- package/dist/docx/blockContentParser.js +3 -10
- package/dist/docx/bulletMarkers.d.ts +8 -0
- package/dist/docx/bulletMarkers.js +9 -1
- package/dist/docx/canonicalSave.d.ts +4 -3
- package/dist/docx/canonicalSave.js +4 -3
- package/dist/docx/canonicalSessionInput.js +25 -11
- package/dist/docx/ensureParaIds.d.ts +31 -0
- package/dist/docx/ensureParaIds.js +57 -32
- package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
- package/dist/docx/ensureUniqueControlIds.js +47 -29
- package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
- package/dist/docx/ensureUniqueRevisionIds.js +52 -29
- package/dist/docx/listMarkerComputation.d.ts +24 -17
- package/dist/docx/listMarkerComputation.js +31 -60
- package/dist/docx/listModelNormalization.js +8 -15
- package/dist/docx/rezip.d.ts +16 -3
- package/dist/docx/rezip.js +35 -9
- package/dist/docx/selectiveSave.js +13 -5
- package/dist/docx/server/templatePlan/apply.js +96 -7
- package/dist/docx/server/templatePlan/blocks.d.ts +70 -3
- package/dist/docx/server/templatePlan/blocks.js +272 -10
- package/dist/docx/server/templatePlan/builders.d.ts +52 -2
- package/dist/docx/server/templatePlan/builders.js +224 -5
- package/dist/docx/server/templatePlan/effects.d.ts +27 -0
- package/dist/docx/server/templatePlan/effects.js +188 -0
- package/dist/docx/server/templatePlan/emit.d.ts +4 -1
- package/dist/docx/server/templatePlan/emit.js +46 -2
- package/dist/docx/server/templatePlan/inspect.js +39 -52
- package/dist/docx/server/templatePlan/labels.d.ts +7 -2
- package/dist/docx/server/templatePlan/labels.js +120 -23
- package/dist/docx/server/templatePlan/plan.d.ts +24 -3
- package/dist/docx/server/templatePlan/plan.js +54 -15
- package/dist/docx/server/templatePlan/planShape.js +76 -22
- package/dist/docx/server/templatePlan/revisions.d.ts +46 -0
- package/dist/docx/server/templatePlan/revisions.js +407 -0
- package/dist/docx/server/templatePlan/story.d.ts +23 -1
- package/dist/docx/server/templatePlan/story.js +60 -2
- package/dist/docx/server/templatePlan/types.d.ts +354 -16
- package/dist/docx/server/templatePlan/verify.js +164 -14
- package/dist/docx/server/templatePlan/xml.d.ts +3 -0
- package/dist/docx/server/templatePlan/xml.js +4 -1
- package/dist/i18n/messages/ar.gen.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
- package/dist/i18n/messages/catalogs.gen.js +17 -0
- package/dist/i18n/messages/cs.gen.js +1 -0
- package/dist/i18n/messages/de.gen.js +1 -0
- package/dist/i18n/messages/en.gen.js +1 -0
- package/dist/i18n/messages/es.gen.js +1 -0
- package/dist/i18n/messages/et.gen.js +1 -0
- package/dist/i18n/messages/fr.gen.js +1 -0
- package/dist/i18n/messages/he.gen.js +1 -0
- package/dist/i18n/messages/hi.gen.js +1 -0
- package/dist/i18n/messages/hu.gen.js +1 -0
- package/dist/i18n/messages/lt.gen.js +1 -0
- package/dist/i18n/messages/lv.gen.js +1 -0
- package/dist/i18n/messages/messages.gen.d.ts +1 -0
- package/dist/i18n/messages/pl.gen.js +1 -0
- package/dist/i18n/messages/pt-BR.gen.js +1 -0
- package/dist/i18n/messages/sk.gen.js +1 -0
- package/dist/i18n/messages/tr.gen.js +1 -0
- package/dist/i18n/messages/zh-CN.gen.js +1 -0
- package/dist/internal/revisionResolutionStep.d.ts +2 -31
- package/dist/internal/revisionResolutionStep.js +2 -171
- package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
- package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
- package/dist/prosemirror/commands/comments.d.ts +6 -234
- package/dist/prosemirror/commands/comments.js +5 -2464
- package/dist/prosemirror/commands/index.d.ts +4 -2
- package/dist/prosemirror/commands/index.js +4 -2
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -11
- package/dist/prosemirror/commands/tableCellMergeResolution.js +3 -154
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
- package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
- package/dist/prosemirror/hyperlinkRemoval.js +24 -15
- package/dist/prosemirror/listMarker.d.ts +1 -6
- package/dist/prosemirror/listMarker.js +4 -56
- package/dist/prosemirror/paraIds.d.ts +1 -14
- package/dist/prosemirror/paraIds.js +1 -14
- package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
- package/dist/prosemirror/paragraphMarkJoin.js +3 -46
- package/dist/prosemirror/projectionReview.d.ts +49 -0
- package/dist/prosemirror/projectionReview.js +292 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
- package/dist/prosemirror/replacedAnnotations.d.ts +2 -5
- package/dist/prosemirror/replacedAnnotations.js +1 -10
- package/dist/prosemirror/revisionCarriers.d.ts +9 -1
- package/dist/prosemirror/revisionCarriers.js +15 -1
- package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
- package/dist/prosemirror/revisionRangeQueries.js +76 -0
- package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
- package/dist/prosemirror/runFormattingMarkNames.js +1 -1
- package/dist/prosemirror/suggestionQueries.d.ts +114 -0
- package/dist/prosemirror/suggestionQueries.js +320 -0
- package/dist/prosemirror/tableGridMutation.d.ts +1 -16
- package/dist/prosemirror/tableGridMutation.js +1 -78
- package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
- package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
- package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
- package/dist/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +40 -69
- package/dist/types/canonicalCapabilities.js +51 -65
- package/dist/types/canonicalComments.d.ts +2 -2
- package/dist/types/canonicalSections.d.ts +2 -2
- package/dist/utils/clipboard.d.ts +2 -28
- package/dist/utils/clipboard.js +1 -96
- package/dist/utils/clipboardFiles.d.ts +27 -0
- package/dist/utils/clipboardFiles.js +98 -0
- package/dist/utils/rulerControl.d.ts +1 -0
- package/dist/utils/rulerControl.js +2 -1
- package/package.json +2 -2
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
- package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
|
@@ -2,10 +2,22 @@ import { parseFieldType } from "../../fieldParser.js";
|
|
|
2
2
|
import { readParagraphNumbering } from "../../numberingReference.js";
|
|
3
3
|
import { paraIdAttribute } from "../../paraIdAttribute.js";
|
|
4
4
|
import { getLocalName } from "../../xmlParser.js";
|
|
5
|
-
import { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, relationshipAttr, wAttr, wChild, wChildVal, wName } from "./xml.js";
|
|
5
|
+
import { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, relationshipAttr, twipsOrNull, wAttr, wChild, wChildVal, wName } from "./xml.js";
|
|
6
6
|
// src/docx/server/templatePlan/story.ts
|
|
7
7
|
/** The mark a footnote or endnote reference leaves in a block's text. */
|
|
8
8
|
const NOTE_REFERENCE_MARK = "";
|
|
9
|
+
/**
|
|
10
|
+
* Fields that print a number counted when the document is laid out and
|
|
11
|
+
* that hold no result: the number is text of the document that no cached
|
|
12
|
+
* text stands for, so the field itself is the content.
|
|
13
|
+
*/
|
|
14
|
+
const SELF_NUMBERING_FIELDS = /* @__PURE__ */ new Set([
|
|
15
|
+
"AUTONUM",
|
|
16
|
+
"AUTONUMLGL",
|
|
17
|
+
"AUTONUMOUT"
|
|
18
|
+
]);
|
|
19
|
+
/** Whether a field kind prints a number of its own and caches no text. */
|
|
20
|
+
const isSelfNumberingField = (kind) => SELF_NUMBERING_FIELDS.has(kind);
|
|
9
21
|
const createStoryState = () => ({
|
|
10
22
|
fields: [],
|
|
11
23
|
open: [],
|
|
@@ -24,6 +36,28 @@ const endStory = (state) => {
|
|
|
24
36
|
state.strayFieldEnds += state.open.length;
|
|
25
37
|
state.open = [];
|
|
26
38
|
};
|
|
39
|
+
/** The sides of `w:ind` that count in characters of the document grid. */
|
|
40
|
+
const CHARACTER_INDENTS = [
|
|
41
|
+
"leftChars",
|
|
42
|
+
"startChars",
|
|
43
|
+
"hangingChars",
|
|
44
|
+
"firstLineChars"
|
|
45
|
+
];
|
|
46
|
+
/** The sides a `w:ind` states; a hanging indent is a negative first line. */
|
|
47
|
+
const ownIndent = (indent) => {
|
|
48
|
+
const hanging = twipsOrNull(wAttr(indent, "hanging"));
|
|
49
|
+
return {
|
|
50
|
+
left: twipsOrNull(wAttr(indent, "left") ?? wAttr(indent, "start")),
|
|
51
|
+
firstLine: hanging === null ? twipsOrNull(wAttr(indent, "firstLine")) : -hanging
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const TOGGLE_OFF = /* @__PURE__ */ new Set([
|
|
55
|
+
"0",
|
|
56
|
+
"false",
|
|
57
|
+
"off"
|
|
58
|
+
]);
|
|
59
|
+
/** An on/off property as its element states it; null without the element. */
|
|
60
|
+
const toggleOf = (element) => element === null ? null : !TOGGLE_OFF.has(wAttr(element, "val") ?? "1");
|
|
27
61
|
const REVISION_INCLUDED = /* @__PURE__ */ new Set(["ins", "moveTo"]);
|
|
28
62
|
const REVISION_EXCLUDED = /* @__PURE__ */ new Set(["del", "moveFrom"]);
|
|
29
63
|
const TRANSPARENT_WRAPPERS = /* @__PURE__ */ new Set([
|
|
@@ -234,6 +268,14 @@ const readRun = (run, walk, { link }) => {
|
|
|
234
268
|
top.field.kind = fieldKindOf(top.field.instruction);
|
|
235
269
|
top.field.endParagraphOrdinal = read.ordinal;
|
|
236
270
|
top.field.closed = true;
|
|
271
|
+
if (top.phase === "code" && isSelfNumberingField(top.field.kind)) pushAtom(walk, {
|
|
272
|
+
kind: "selfNumber",
|
|
273
|
+
text: "",
|
|
274
|
+
runProperties,
|
|
275
|
+
link,
|
|
276
|
+
element: null,
|
|
277
|
+
instruction: top.field.instruction.trim()
|
|
278
|
+
});
|
|
237
279
|
}
|
|
238
280
|
}
|
|
239
281
|
break;
|
|
@@ -291,6 +333,14 @@ const readInline = (container, walk, context) => {
|
|
|
291
333
|
readInline(child, walk, context);
|
|
292
334
|
state.open.pop();
|
|
293
335
|
field.closed = true;
|
|
336
|
+
if (field.result === "" && isSelfNumberingField(field.kind)) pushAtom(walk, {
|
|
337
|
+
kind: "selfNumber",
|
|
338
|
+
text: "",
|
|
339
|
+
runProperties: null,
|
|
340
|
+
link: context.link,
|
|
341
|
+
element: null,
|
|
342
|
+
instruction: field.instruction.trim()
|
|
343
|
+
});
|
|
294
344
|
} else if (REVISION_INCLUDED.has(name)) {
|
|
295
345
|
state.trackedChanges += 1;
|
|
296
346
|
readInline(child, walk, context);
|
|
@@ -323,6 +373,7 @@ const readParagraph = (element, state) => {
|
|
|
323
373
|
element,
|
|
324
374
|
ordinal: state.paragraphOrdinal,
|
|
325
375
|
styleId: wChildVal(properties, "pStyle"),
|
|
376
|
+
language: wChildVal(wChild(properties, "rPr"), "lang"),
|
|
326
377
|
numPr: readParagraphNumbering(wChild(properties, "numPr")),
|
|
327
378
|
paraId: paraIdAttribute(element) ?? null,
|
|
328
379
|
outlineLevel: headingLevelOf(outline),
|
|
@@ -335,6 +386,13 @@ const readParagraph = (element, state) => {
|
|
|
335
386
|
inlineObjects: 0,
|
|
336
387
|
unsupported: [],
|
|
337
388
|
hasSectionBreak: wChild(properties, "sectPr") !== null,
|
|
389
|
+
pageBreakBefore: toggleOf(wChild(properties, "pageBreakBefore")),
|
|
390
|
+
alignment: wChildVal(properties, "jc"),
|
|
391
|
+
indent: ownIndent(wChild(properties, "ind")),
|
|
392
|
+
indentInCharacters: CHARACTER_INDENTS.some((name) => {
|
|
393
|
+
const value = wAttr(wChild(properties, "ind"), name);
|
|
394
|
+
return value !== null && !/^[+-]?0*$/u.test(value.trim());
|
|
395
|
+
}),
|
|
338
396
|
hasTrackedMark
|
|
339
397
|
};
|
|
340
398
|
state.paragraphOrdinal += 1;
|
|
@@ -437,4 +495,4 @@ const walkBlocks = (container, visitor, depth = 0) => {
|
|
|
437
495
|
} else if (name === null || !IGNORED_BLOCK_CHILDREN.has(name)) visitor.unread(child);
|
|
438
496
|
}
|
|
439
497
|
};
|
|
440
|
-
export { NOTE_REFERENCE_MARK, createStoryState, endStory, readParagraph, walkBlocks };
|
|
498
|
+
export { NOTE_REFERENCE_MARK, createStoryState, endStory, isSelfNumberingField, readParagraph, toggleOf, walkBlocks };
|
|
@@ -17,6 +17,17 @@ export type DocxBlockNumbering = {
|
|
|
17
17
|
numId: number;
|
|
18
18
|
ilvl: number;
|
|
19
19
|
abstractNumId: number;
|
|
20
|
+
/**
|
|
21
|
+
* The level prints a bullet: its label is a mark, whatever character
|
|
22
|
+
* stands for it (a font's `o` as much as a dot), and no designator.
|
|
23
|
+
*/
|
|
24
|
+
bullet?: true;
|
|
25
|
+
/**
|
|
26
|
+
* The text face a bullet's mark is a character of, when the level names
|
|
27
|
+
* one: set in another face the mark is another shape, so a level that
|
|
28
|
+
* prints it elsewhere needs the face too.
|
|
29
|
+
*/
|
|
30
|
+
bulletFont?: string;
|
|
20
31
|
};
|
|
21
32
|
export type DocxTableCell = {
|
|
22
33
|
row: number;
|
|
@@ -50,6 +61,49 @@ export type DocxBlock = {
|
|
|
50
61
|
paraId?: string;
|
|
51
62
|
/** Drawings, pictures, embedded objects and equations anchored in the block. */
|
|
52
63
|
inlineObjects: number;
|
|
64
|
+
/**
|
|
65
|
+
* Page breaks among the paragraph's runs, when it holds any. A paragraph
|
|
66
|
+
* without text can hold one: it is then all that starts the next page.
|
|
67
|
+
*/
|
|
68
|
+
pageBreaks?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Offsets in `text` at which the paragraph holds a field that numbers
|
|
71
|
+
* itself (`AUTONUM`, `AUTONUMLGL`, `AUTONUMOUT`), when it holds any. The
|
|
72
|
+
* number such a field prints is in no text: `Annex - Summary` with one at
|
|
73
|
+
* offset 6 reads `Annex 1 - Summary` on the page.
|
|
74
|
+
*/
|
|
75
|
+
selfNumbers?: number[];
|
|
76
|
+
/**
|
|
77
|
+
* The paragraph starts on a new page by its own formatting or its
|
|
78
|
+
* style's (`w:pageBreakBefore`). A plan carries it over with an item's
|
|
79
|
+
* `pageBreakBefore`; no other direct formatting of a paragraph comes along.
|
|
80
|
+
*/
|
|
81
|
+
pageBreakBefore?: true;
|
|
82
|
+
/**
|
|
83
|
+
* The paragraph is the last of its section: the block after it opens
|
|
84
|
+
* `sections[sectionIndex + 1]` of the manifest, whose `start` says whether
|
|
85
|
+
* on a new page.
|
|
86
|
+
*/
|
|
87
|
+
endsSection?: true;
|
|
88
|
+
/**
|
|
89
|
+
* The paragraph alignment in effect (`w:jc`, as written: `both`, `center`,
|
|
90
|
+
* ...): the paragraph's own, else its style's with inheritance resolved.
|
|
91
|
+
* Absent when neither states one.
|
|
92
|
+
*/
|
|
93
|
+
alignment?: string;
|
|
94
|
+
/**
|
|
95
|
+
* The paragraph's indent in effect, in twentieths of a point: `left` is
|
|
96
|
+
* where its lines start, `firstLine` what its first line adds to that
|
|
97
|
+
* (negative for a hanging indent). Each side is the paragraph's own, else
|
|
98
|
+
* its list level's and its style's with inheritance resolved: the
|
|
99
|
+
* level's first where the paragraph names its list itself, the style's
|
|
100
|
+
* first where the style brings the list. Absent when none of them states
|
|
101
|
+
* an indent.
|
|
102
|
+
*/
|
|
103
|
+
indent?: {
|
|
104
|
+
left: number;
|
|
105
|
+
firstLine: number;
|
|
106
|
+
};
|
|
53
107
|
/** Table only: its cells in row order. */
|
|
54
108
|
cells?: DocxTableCell[];
|
|
55
109
|
/** Table only: every block inside the table in document order. */
|
|
@@ -59,17 +113,93 @@ export type DocxNote = {
|
|
|
59
113
|
id: string;
|
|
60
114
|
text: string;
|
|
61
115
|
};
|
|
116
|
+
/** Compatibility settings of a document that change how its text is laid out. */
|
|
117
|
+
export type DocxCompat = {
|
|
118
|
+
/**
|
|
119
|
+
* `w:doNotExpandShiftReturn`: a justified line that ends in a manual line
|
|
120
|
+
* break keeps its spaces instead of being stretched to the margin.
|
|
121
|
+
*/
|
|
122
|
+
doNotExpandShiftReturn: boolean;
|
|
123
|
+
};
|
|
124
|
+
/** One section of a document's main story: its page, and how it begins. */
|
|
125
|
+
export type DocxSection = {
|
|
126
|
+
index: number;
|
|
127
|
+
/**
|
|
128
|
+
* How the section begins after the one before it: on the next page, an
|
|
129
|
+
* even or odd one, in the next column, or on the same page. The first
|
|
130
|
+
* section's value says nothing.
|
|
131
|
+
*/
|
|
132
|
+
start: "nextPage" | "evenPage" | "oddPage" | "nextColumn" | "continuous";
|
|
133
|
+
orientation: "portrait" | "landscape";
|
|
134
|
+
/** Page size and margins in twentieths of a point; null where unstated. */
|
|
135
|
+
size: {
|
|
136
|
+
width: number | null;
|
|
137
|
+
height: number | null;
|
|
138
|
+
};
|
|
139
|
+
margins: {
|
|
140
|
+
top: number | null;
|
|
141
|
+
right: number | null;
|
|
142
|
+
bottom: number | null;
|
|
143
|
+
left: number | null;
|
|
144
|
+
};
|
|
145
|
+
/** Text columns of the section. */
|
|
146
|
+
columns: number;
|
|
147
|
+
};
|
|
62
148
|
export type DocxBlockManifest = {
|
|
63
149
|
sha256: string;
|
|
64
150
|
/** Top-level blocks of the main story in document order; a table is one block. */
|
|
65
151
|
blocks: DocxBlock[];
|
|
152
|
+
/**
|
|
153
|
+
* The sections of the main story in order; a block names its own by
|
|
154
|
+
* `sectionIndex`. A body that states no section properties of its own
|
|
155
|
+
* still ends in a section: it is listed with the defaults, nothing stated.
|
|
156
|
+
*/
|
|
157
|
+
sections: DocxSection[];
|
|
158
|
+
/** Compatibility settings of the document that change how its text is laid out. */
|
|
159
|
+
compat: DocxCompat;
|
|
66
160
|
footnotes: DocxNote[];
|
|
67
161
|
endnotes: DocxNote[];
|
|
68
162
|
comments: number;
|
|
69
163
|
/** Tracked insertions, deletions and moves in the main story and its notes. */
|
|
70
164
|
trackedChanges: number;
|
|
165
|
+
/**
|
|
166
|
+
* What the document tracks, when it tracks anything: for a caller that
|
|
167
|
+
* has to choose a view. Absent from a manifest read in a chosen view,
|
|
168
|
+
* which tracks nothing any more.
|
|
169
|
+
*/
|
|
170
|
+
revisions?: DocxTrackedChanges;
|
|
171
|
+
/**
|
|
172
|
+
* The view the manifest was read in and what was resolved for it, when
|
|
173
|
+
* the caller chose one: every block, label and hash is that view's.
|
|
174
|
+
*/
|
|
175
|
+
trackedChangesResolved?: DocxTrackedChanges & {
|
|
176
|
+
view: TemplatePlanTrackedView;
|
|
177
|
+
};
|
|
71
178
|
warnings: string[];
|
|
72
179
|
};
|
|
180
|
+
/**
|
|
181
|
+
* One of the two texts a document with tracked changes holds: with every
|
|
182
|
+
* change accepted, or with every change rejected.
|
|
183
|
+
*/
|
|
184
|
+
export type TemplatePlanTrackedView = "accept" | "reject";
|
|
185
|
+
/** The tracked changes of a document's main story and notes, by kind. */
|
|
186
|
+
export type DocxTrackedChanges = {
|
|
187
|
+
insertions: number;
|
|
188
|
+
deletions: number;
|
|
189
|
+
/** Move sources and destinations. */
|
|
190
|
+
moves: number;
|
|
191
|
+
/** Paragraph marks the chosen view removes, each joining two paragraphs;
|
|
192
|
+
* counted for the accepted view where none was chosen. */
|
|
193
|
+
paragraphMarks: number;
|
|
194
|
+
/** Table rows the view removes. */
|
|
195
|
+
tableRows: number;
|
|
196
|
+
/** Recorded changes of formatting. */
|
|
197
|
+
formattingChanges: number;
|
|
198
|
+
authors: string[];
|
|
199
|
+
/** The earliest and the latest date a change states, as written. */
|
|
200
|
+
first: string | null;
|
|
201
|
+
last: string | null;
|
|
202
|
+
};
|
|
73
203
|
export type DocxTemplateStyle = {
|
|
74
204
|
styleId: string;
|
|
75
205
|
name: string | null;
|
|
@@ -86,6 +216,29 @@ export type DocxTemplateStyle = {
|
|
|
86
216
|
* null when neither the style nor one it is based on states one.
|
|
87
217
|
*/
|
|
88
218
|
alignment: string | null;
|
|
219
|
+
/**
|
|
220
|
+
* Whether the style sets its text in bold (`w:b`), inheritance and the
|
|
221
|
+
* document's defaults resolved.
|
|
222
|
+
*/
|
|
223
|
+
bold: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* The font size the style gives its text, in half-points (`w:sz`),
|
|
226
|
+
* inheritance and the document's defaults resolved; null when none of
|
|
227
|
+
* them states one.
|
|
228
|
+
*/
|
|
229
|
+
size: number | null;
|
|
230
|
+
/**
|
|
231
|
+
* Whether the style keeps its paragraph on the page of the next one
|
|
232
|
+
* (`w:keepNext`), inheritance and the document's defaults resolved.
|
|
233
|
+
*/
|
|
234
|
+
keepNext: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* The left indent the style gives its paragraphs, in twentieths of a
|
|
237
|
+
* point (`w:ind`), inheritance and the document's defaults resolved; null
|
|
238
|
+
* when none of them states one. A style bound to a list takes the indent
|
|
239
|
+
* of its level where it states none itself.
|
|
240
|
+
*/
|
|
241
|
+
indentLeft: number | null;
|
|
89
242
|
isDefault: boolean;
|
|
90
243
|
};
|
|
91
244
|
export type DocxTemplateNumberingLevel = {
|
|
@@ -132,20 +285,8 @@ export type DocxTemplateField = {
|
|
|
132
285
|
*/
|
|
133
286
|
endBlockId?: string;
|
|
134
287
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
orientation: "portrait" | "landscape";
|
|
138
|
-
/** Page size and margins in twentieths of a point. */
|
|
139
|
-
size: {
|
|
140
|
-
width: number | null;
|
|
141
|
-
height: number | null;
|
|
142
|
-
};
|
|
143
|
-
margins: {
|
|
144
|
-
top: number | null;
|
|
145
|
-
right: number | null;
|
|
146
|
-
bottom: number | null;
|
|
147
|
-
left: number | null;
|
|
148
|
-
};
|
|
288
|
+
/** A section of a template, with the header and footer parts it names. */
|
|
289
|
+
export type DocxTemplateSection = DocxSection & {
|
|
149
290
|
headers: {
|
|
150
291
|
type: string;
|
|
151
292
|
part: string | null;
|
|
@@ -155,17 +296,48 @@ export type DocxTemplateSection = {
|
|
|
155
296
|
part: string | null;
|
|
156
297
|
}[];
|
|
157
298
|
};
|
|
299
|
+
/**
|
|
300
|
+
* A text effect of the `w14` extension. One whose values show nothing can still change
|
|
301
|
+
* how a consumer treats the text: a run with a 3-D scene, even the default
|
|
302
|
+
* one, is drawn as a picture.
|
|
303
|
+
*/
|
|
304
|
+
export type DocxTextEffect = "glow" | "shadow" | "reflection" | "textOutline" | "textFill" | "scene3d" | "props3d";
|
|
305
|
+
/** What the run properties an effect stands in belong to. */
|
|
306
|
+
export type DocxTextEffectOwner = {
|
|
307
|
+
kind: "level";
|
|
308
|
+
abstractNumId: number | null;
|
|
309
|
+
ilvl: number | null;
|
|
310
|
+
} | {
|
|
311
|
+
kind: "style";
|
|
312
|
+
styleId: string | null;
|
|
313
|
+
} | {
|
|
314
|
+
kind: "defaults";
|
|
315
|
+
} | {
|
|
316
|
+
kind: "text";
|
|
317
|
+
};
|
|
318
|
+
/** A text effect of a template whose values show nothing. */
|
|
319
|
+
export type DocxTemplateInvisibleEffect = {
|
|
320
|
+
part: string;
|
|
321
|
+
effect: DocxTextEffect;
|
|
322
|
+
owner: DocxTextEffectOwner;
|
|
323
|
+
};
|
|
158
324
|
export type DocxTemplateBookmark = {
|
|
159
325
|
name: string;
|
|
160
326
|
id: string;
|
|
161
327
|
part: string;
|
|
162
328
|
};
|
|
163
|
-
export type DocxTemplateInspection = DocxBlockManifest & {
|
|
329
|
+
export type DocxTemplateInspection = Omit<DocxBlockManifest, "sections"> & {
|
|
164
330
|
styles: DocxTemplateStyle[];
|
|
165
331
|
numbering: DocxTemplateNumbering;
|
|
166
332
|
fields: DocxTemplateField[];
|
|
167
333
|
sections: DocxTemplateSection[];
|
|
168
334
|
bookmarks: DocxTemplateBookmark[];
|
|
335
|
+
/**
|
|
336
|
+
* Text effects that show nothing, in the document, its numbering, its
|
|
337
|
+
* styles, its headers and its footers. A plan's output is written without
|
|
338
|
+
* them unless the plan says otherwise.
|
|
339
|
+
*/
|
|
340
|
+
invisibleEffects: DocxTemplateInvisibleEffect[];
|
|
169
341
|
};
|
|
170
342
|
export type TemplatePlanOmitReason = "empty" | "sourceToc" | "pageArtifact" | "duplicateLabel";
|
|
171
343
|
/**
|
|
@@ -184,6 +356,16 @@ export type TemplatePlanNumbering = {
|
|
|
184
356
|
group?: string;
|
|
185
357
|
};
|
|
186
358
|
export type TemplatePlanMerge = "lineBreak" | "space" | "none";
|
|
359
|
+
/**
|
|
360
|
+
* A paragraph's own indent, in twentieths of a point (`w:ind`). A side left
|
|
361
|
+
* out stays what the style or the list level gives; a hanging indent and a
|
|
362
|
+
* first-line indent exclude each other.
|
|
363
|
+
*/
|
|
364
|
+
export type TemplatePlanIndent = {
|
|
365
|
+
left?: number;
|
|
366
|
+
hanging?: number;
|
|
367
|
+
firstLine?: number;
|
|
368
|
+
};
|
|
187
369
|
export type TemplatePlanNestedParagraph = {
|
|
188
370
|
blockId: string;
|
|
189
371
|
styleId?: string;
|
|
@@ -191,6 +373,43 @@ export type TemplatePlanNestedParagraph = {
|
|
|
191
373
|
stripLabel?: string;
|
|
192
374
|
/** As on a source item. */
|
|
193
375
|
labelAsText?: boolean;
|
|
376
|
+
/** As on a source item. */
|
|
377
|
+
keepNext?: boolean;
|
|
378
|
+
/** As on a source item. */
|
|
379
|
+
indent?: TemplatePlanIndent;
|
|
380
|
+
/** As on a source item. */
|
|
381
|
+
tabStops?: number[];
|
|
382
|
+
/** As on a source item. */
|
|
383
|
+
alignment?: TemplatePlanAlignment;
|
|
384
|
+
};
|
|
385
|
+
/** How a paragraph's lines are set between the margins (`w:jc`). */
|
|
386
|
+
export type TemplatePlanAlignment = "left" | "center" | "right" | "both";
|
|
387
|
+
/** A page other than the template's, in twentieths of a point. */
|
|
388
|
+
export type TemplatePlanSectionPage = {
|
|
389
|
+
orientation: "portrait" | "landscape";
|
|
390
|
+
width: number;
|
|
391
|
+
height: number;
|
|
392
|
+
/** Left out, the template's margins stay. */
|
|
393
|
+
margins?: {
|
|
394
|
+
top: number;
|
|
395
|
+
right: number;
|
|
396
|
+
bottom: number;
|
|
397
|
+
left: number;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* A section of the output. It is built from the template's last section:
|
|
402
|
+
* the same headers, footers and every other property, with only the page
|
|
403
|
+
* given here put in its place. The first-page header and a page-number
|
|
404
|
+
* start stay with the document's first section alone.
|
|
405
|
+
*/
|
|
406
|
+
export type TemplatePlanSection = {
|
|
407
|
+
page?: TemplatePlanSectionPage;
|
|
408
|
+
/**
|
|
409
|
+
* How the section begins after the one before it; `nextPage` when left
|
|
410
|
+
* out. The document's first section begins the document.
|
|
411
|
+
*/
|
|
412
|
+
start?: "nextPage" | "evenPage" | "oddPage";
|
|
194
413
|
};
|
|
195
414
|
export type TemplatePlanSourceItem = {
|
|
196
415
|
kind: "source";
|
|
@@ -202,6 +421,14 @@ export type TemplatePlanSourceItem = {
|
|
|
202
421
|
numbering?: TemplatePlanNumbering | null;
|
|
203
422
|
/** The manual label at the start of the block to remove, with the space after it. */
|
|
204
423
|
stripLabel?: string;
|
|
424
|
+
/**
|
|
425
|
+
* With `stripLabel`: a line break that follows the label goes with it,
|
|
426
|
+
* and the space around that break. For a heading the source breaks behind
|
|
427
|
+
* its number where the template sets number and title on one line: the
|
|
428
|
+
* list then parts the two as its level says. Left out, a line break
|
|
429
|
+
* behind the label stays the first character of the paragraph.
|
|
430
|
+
*/
|
|
431
|
+
stripLabelBreak?: boolean;
|
|
205
432
|
/**
|
|
206
433
|
* Write the block's automatic label as text at the start of its text, with
|
|
207
434
|
* the tab or space its list puts after it: for a label no list of the
|
|
@@ -213,6 +440,53 @@ export type TemplatePlanSourceItem = {
|
|
|
213
440
|
labelAsText?: boolean;
|
|
214
441
|
/** Join the next item of the plan, a source paragraph, into this paragraph. */
|
|
215
442
|
mergeNext?: TemplatePlanMerge;
|
|
443
|
+
/**
|
|
444
|
+
* Start the paragraph on a new page (`w:pageBreakBefore`): for a page the
|
|
445
|
+
* source began by a break the plan does not place, by the paragraph's own
|
|
446
|
+
* formatting, or by a section. Not for a table, and not for a block that
|
|
447
|
+
* joins the paragraph before it.
|
|
448
|
+
*
|
|
449
|
+
* `false` is the same as leaving it out: nothing is written, and a style
|
|
450
|
+
* of the template that starts its paragraphs on a new page still does.
|
|
451
|
+
* Verification compares what the paragraph states for itself.
|
|
452
|
+
*/
|
|
453
|
+
pageBreakBefore?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* Keep the paragraph on the page of the one after it (`w:keepNext`): for
|
|
456
|
+
* a line that heads what follows in a style that does not say so. Not
|
|
457
|
+
* for a table, and not for a block that joins the paragraph before it.
|
|
458
|
+
* `false` is the same as leaving it out.
|
|
459
|
+
*/
|
|
460
|
+
keepNext?: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* The paragraph's own indent, over its style's and its list level's:
|
|
463
|
+
* for a number written as text that hangs the way the list's would. Not
|
|
464
|
+
* for a table, and not for a block that joins the paragraph before it.
|
|
465
|
+
*/
|
|
466
|
+
indent?: TemplatePlanIndent;
|
|
467
|
+
/**
|
|
468
|
+
* The paragraph's own left tab stops, in twentieths of a point from the
|
|
469
|
+
* left margin and in ascending order (`w:tabs`): for a line of a label, a
|
|
470
|
+
* tab and a value whose values are to start at one position. They are
|
|
471
|
+
* added to the stops of the paragraph's style, as tab stops are in the
|
|
472
|
+
* format: a stop the style sets in front of them still ends a tab. Not
|
|
473
|
+
* for a table.
|
|
474
|
+
*/
|
|
475
|
+
tabStops?: number[];
|
|
476
|
+
/**
|
|
477
|
+
* The paragraph's own alignment (`w:jc`), over the one its style states:
|
|
478
|
+
* for a line the document sets by itself, such as the text of a table
|
|
479
|
+
* cell or a centred line under a title. Not for a table.
|
|
480
|
+
*/
|
|
481
|
+
alignment?: TemplatePlanAlignment;
|
|
482
|
+
/**
|
|
483
|
+
* The paragraph is the last of a section, described here: for a part of
|
|
484
|
+
* the document whose page is another than the template's, such as a
|
|
485
|
+
* landscape annex. Not for a table, a nested paragraph, or a block that
|
|
486
|
+
* joins the paragraph before it. The template needs a last section of
|
|
487
|
+
* its own to build from.
|
|
488
|
+
*/
|
|
489
|
+
endsSection?: TemplatePlanSection;
|
|
216
490
|
/** Table only: the paragraph style of its cells. */
|
|
217
491
|
cellStyleId?: string;
|
|
218
492
|
/** Table only: placement of single paragraphs inside it. */
|
|
@@ -233,6 +507,11 @@ export type TemplatePlanNumberingPatch = {
|
|
|
233
507
|
lvlText?: string;
|
|
234
508
|
start?: number;
|
|
235
509
|
suff?: "tab" | "space" | "nothing";
|
|
510
|
+
/**
|
|
511
|
+
* The face the level's label is set in. Whatever else the level's run
|
|
512
|
+
* properties state is kept.
|
|
513
|
+
*/
|
|
514
|
+
font?: string;
|
|
236
515
|
/**
|
|
237
516
|
* The paragraph indent the level gives, in twentieths of a point. A value
|
|
238
517
|
* left out keeps what the level states; `hanging` and `firstLine` exclude
|
|
@@ -281,6 +560,42 @@ export type TemplatePlan = {
|
|
|
281
560
|
freezeKinds?: string[];
|
|
282
561
|
updateOnOpen?: boolean;
|
|
283
562
|
};
|
|
563
|
+
/**
|
|
564
|
+
* Compatibility settings to switch on in the output's settings, which are
|
|
565
|
+
* otherwise the template's. `true` sets the setting at its place in the
|
|
566
|
+
* schema's order; nothing else of the settings changes, and a setting is
|
|
567
|
+
* never switched off.
|
|
568
|
+
*/
|
|
569
|
+
compat?: {
|
|
570
|
+
doNotExpandShiftReturn?: boolean;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* The section the body ends with, when its page is another than the
|
|
574
|
+
* template's. Left out, the template's last section closes the body as it
|
|
575
|
+
* stands.
|
|
576
|
+
*/
|
|
577
|
+
lastSection?: TemplatePlanSection;
|
|
578
|
+
/**
|
|
579
|
+
* The view of a source with tracked changes the plan is made for: its
|
|
580
|
+
* text with every change accepted, or with every change rejected. The
|
|
581
|
+
* blocks and hashes the plan names are that view's, the output carries
|
|
582
|
+
* no revision, and verification holds it to that view. Left out, a
|
|
583
|
+
* source with tracked changes is refused.
|
|
584
|
+
*/
|
|
585
|
+
trackedChanges?: TemplatePlanTrackedView;
|
|
586
|
+
/**
|
|
587
|
+
* What becomes of text effects whose values show nothing, in the parts
|
|
588
|
+
* the output takes from the template: its document, numbering, styles,
|
|
589
|
+
* headers and footers. `normalize`, the default, leaves them out, so text
|
|
590
|
+
* that looked plain is written as text everywhere; an effect that shows
|
|
591
|
+
* anything is never touched. `keep` writes those parts as they are.
|
|
592
|
+
*/
|
|
593
|
+
textEffects?: "normalize" | "keep";
|
|
594
|
+
};
|
|
595
|
+
export type TemplatePlanEffectCount = {
|
|
596
|
+
part: string;
|
|
597
|
+
effect: DocxTextEffect;
|
|
598
|
+
count: number;
|
|
284
599
|
};
|
|
285
600
|
export type TemplatePlanBlockResult = {
|
|
286
601
|
/** The source block. */
|
|
@@ -341,7 +656,7 @@ export type TemplatePlanFieldLeftover = {
|
|
|
341
656
|
count: number;
|
|
342
657
|
};
|
|
343
658
|
export type TemplatePlanIssue = {
|
|
344
|
-
code: "text-mismatch" | "emphasis-mismatch" | "note-mismatch" | "block-missing" | "reference-broken" | "bookmark-dangling" | "field-unbalanced" | "relationship-dangling" | "note-dangling" | "numbering-dangling" | "style-dangling" | "style-mismatch" | "numbering-mismatch" | "template-mismatch" | "prompting-field-left" | "field-not-frozen" | "update-fields-mismatch" | "conformance";
|
|
659
|
+
code: "text-mismatch" | "emphasis-mismatch" | "note-mismatch" | "block-missing" | "reference-broken" | "bookmark-dangling" | "field-unbalanced" | "relationship-dangling" | "note-dangling" | "numbering-dangling" | "style-dangling" | "style-mismatch" | "numbering-mismatch" | "page-start-mismatch" | "paragraph-format-mismatch" | "revision-left" | "section-mismatch" | "template-mismatch" | "prompting-field-left" | "field-not-frozen" | "update-fields-mismatch" | "compat-mismatch" | "conformance";
|
|
345
660
|
message: string;
|
|
346
661
|
blockId?: string;
|
|
347
662
|
part?: string;
|
|
@@ -353,6 +668,11 @@ export type TemplatePlanReport = {
|
|
|
353
668
|
sourceSha256: string;
|
|
354
669
|
templateSha256: string;
|
|
355
670
|
outputSha256: string;
|
|
671
|
+
/** The view the plan chose of a source with tracked changes, and what
|
|
672
|
+
* was resolved for it. */
|
|
673
|
+
trackedChanges?: DocxTrackedChanges & {
|
|
674
|
+
view: TemplatePlanTrackedView;
|
|
675
|
+
};
|
|
356
676
|
/** One entry per block of the source, nested ones included, in document order. */
|
|
357
677
|
blocks: TemplatePlanBlockResult[];
|
|
358
678
|
counts: {
|
|
@@ -370,6 +690,16 @@ export type TemplatePlanReport = {
|
|
|
370
690
|
labelLost: number;
|
|
371
691
|
/** Placed blocks whose automatic label is written as text. */
|
|
372
692
|
labelAsText: number;
|
|
693
|
+
/** Placed paragraphs the plan starts on a new page. */
|
|
694
|
+
pageStarts: number;
|
|
695
|
+
/** Placed paragraphs the plan ends a section with. */
|
|
696
|
+
sectionEnds: number;
|
|
697
|
+
/**
|
|
698
|
+
* Empty paragraphs written between two tables the plan puts next to each
|
|
699
|
+
* other, and after a table that ends the body: without one the tables
|
|
700
|
+
* are one table, and a body cannot end in a table.
|
|
701
|
+
*/
|
|
702
|
+
tableSeparators: number;
|
|
373
703
|
};
|
|
374
704
|
footnotes: TemplatePlanNoteCounts;
|
|
375
705
|
endnotes: TemplatePlanNoteCounts;
|
|
@@ -408,6 +738,14 @@ export type TemplatePlanReport = {
|
|
|
408
738
|
internalHyperlinks: number;
|
|
409
739
|
sectionBreaks: number;
|
|
410
740
|
};
|
|
741
|
+
/**
|
|
742
|
+
* Text effects that show nothing: those of the template the output does
|
|
743
|
+
* not carry, and those it still does.
|
|
744
|
+
*/
|
|
745
|
+
textEffects: {
|
|
746
|
+
removed: TemplatePlanEffectCount[];
|
|
747
|
+
left: TemplatePlanEffectCount[];
|
|
748
|
+
};
|
|
411
749
|
updateFields: "set" | "cleared" | "unchanged";
|
|
412
750
|
conformance: {
|
|
413
751
|
status: "conformant" | "invalid" | "indeterminate";
|