@stll/folio-core 0.75.0 → 0.77.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.
Files changed (143) hide show
  1. package/dist/ai-edits/headless.d.ts +8 -5
  2. package/dist/ai-edits/headless.js +49 -26
  3. package/dist/ai-edits/pending-suggestions.d.ts +9 -0
  4. package/dist/ai-edits/pending-suggestions.js +13 -3
  5. package/dist/ai-edits/read.js +33 -4
  6. package/dist/ai-edits/table-geometry.js +12 -4
  7. package/dist/ai-edits/types.d.ts +9 -4
  8. package/dist/canonical/batchCommentReferences.js +2 -1
  9. package/dist/canonical/canonicalBatchReview.js +5 -8
  10. package/dist/canonical/canonicalComments.js +8 -2
  11. package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
  12. package/dist/canonical/canonicalCompilerRefusal.js +20 -14
  13. package/dist/canonical/canonicalInlineProjection.d.ts +2 -2
  14. package/dist/canonical/canonicalInlineProjection.js +2 -2
  15. package/dist/canonical/canonicalProjectionBlocks.d.ts +10 -1
  16. package/dist/canonical/canonicalPublicOperations.js +214 -107
  17. package/dist/canonical/canonicalSeedContent.d.ts +18 -3
  18. package/dist/canonical/canonicalSeedContent.js +28 -15
  19. package/dist/canonical/canonicalSession.d.ts +22 -12
  20. package/dist/canonical/canonicalSession.js +181 -187
  21. package/dist/controller/canonicalClipboard.d.ts +3 -2
  22. package/dist/controller/canonicalClipboard.js +377 -58
  23. package/dist/controller/canonicalComposition.js +67 -14
  24. package/dist/controller/canonicalContentControlValue.js +7 -7
  25. package/dist/controller/canonicalReview.d.ts +21 -0
  26. package/dist/controller/canonicalReview.js +44 -9
  27. package/dist/controller/canonicalStoryEditor.js +2 -0
  28. package/dist/controller/canonicalStructure.d.ts +1 -2
  29. package/dist/controller/canonicalStructure.js +51 -24
  30. package/dist/controller/fontReadiness.js +50 -23
  31. package/dist/controller/hiddenEditorManager.js +7 -20
  32. package/dist/docx/bulletMarkers.d.ts +8 -0
  33. package/dist/docx/bulletMarkers.js +9 -1
  34. package/dist/docx/canonicalSessionInput.js +25 -11
  35. package/dist/docx/ensureParaIds.d.ts +31 -0
  36. package/dist/docx/ensureParaIds.js +57 -32
  37. package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
  38. package/dist/docx/ensureUniqueControlIds.js +47 -29
  39. package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
  40. package/dist/docx/ensureUniqueRevisionIds.js +52 -29
  41. package/dist/docx/importedIdCollisions.js +29 -4
  42. package/dist/docx/server/templatePlan/apply.js +108 -9
  43. package/dist/docx/server/templatePlan/blocks.d.ts +77 -5
  44. package/dist/docx/server/templatePlan/blocks.js +281 -14
  45. package/dist/docx/server/templatePlan/builders.d.ts +22 -1
  46. package/dist/docx/server/templatePlan/builders.js +37 -3
  47. package/dist/docx/server/templatePlan/effects.d.ts +27 -0
  48. package/dist/docx/server/templatePlan/effects.js +188 -0
  49. package/dist/docx/server/templatePlan/emit.d.ts +4 -1
  50. package/dist/docx/server/templatePlan/emit.js +152 -8
  51. package/dist/docx/server/templatePlan/inspect.js +21 -1
  52. package/dist/docx/server/templatePlan/labels.js +16 -1
  53. package/dist/docx/server/templatePlan/plan.d.ts +35 -3
  54. package/dist/docx/server/templatePlan/plan.js +197 -20
  55. package/dist/docx/server/templatePlan/planShape.js +58 -22
  56. package/dist/docx/server/templatePlan/revisions.d.ts +101 -0
  57. package/dist/docx/server/templatePlan/revisions.js +681 -0
  58. package/dist/docx/server/templatePlan/story.d.ts +61 -2
  59. package/dist/docx/server/templatePlan/story.js +175 -13
  60. package/dist/docx/server/templatePlan/types.d.ts +313 -1
  61. package/dist/docx/server/templatePlan/verify.js +175 -12
  62. package/dist/docx/server/templatePlan/xml.d.ts +3 -0
  63. package/dist/docx/server/templatePlan/xml.js +4 -1
  64. package/dist/docx/settingsHeaderFooterUpdate.d.ts +1 -1
  65. package/dist/docx/tableGridXml.d.ts +3 -7
  66. package/dist/docx/tableGridXml.js +5 -13
  67. package/dist/layout-bridge/convert/footnoteLayout.js +34 -8
  68. package/dist/prosemirror/canonicalMarkupDocument.d.ts +20 -0
  69. package/dist/prosemirror/canonicalMarkupDocument.js +73 -0
  70. package/dist/prosemirror/canonicalTableCommands.d.ts +1 -1
  71. package/dist/prosemirror/canonicalTableCommands.js +1 -3
  72. package/dist/prosemirror/commands/comments.d.ts +6 -234
  73. package/dist/prosemirror/commands/comments.js +5 -2464
  74. package/dist/prosemirror/commands/index.d.ts +4 -2
  75. package/dist/prosemirror/commands/index.js +4 -2
  76. package/dist/prosemirror/conversion/markupViewSource.d.ts +17 -0
  77. package/dist/prosemirror/conversion/markupViewSource.js +11 -0
  78. package/dist/prosemirror/conversion/toProseDoc.d.ts +3 -0
  79. package/dist/prosemirror/conversion/toProseDoc.js +31 -14
  80. package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
  81. package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
  82. package/dist/prosemirror/hyperlinkRemoval.js +24 -15
  83. package/dist/prosemirror/independentMarkupProjection.d.ts +27 -0
  84. package/dist/prosemirror/independentMarkupProjection.js +147 -0
  85. package/dist/prosemirror/markupViewNotes.d.ts +1 -1
  86. package/dist/prosemirror/markupViewNotes.js +24 -27
  87. package/dist/prosemirror/markupViewPositionMap.d.ts +16 -0
  88. package/dist/prosemirror/markupViewPositionMap.js +316 -0
  89. package/dist/prosemirror/markupViewProjection.d.ts +3 -46
  90. package/dist/prosemirror/markupViewProjection.js +90 -17
  91. package/dist/prosemirror/paraIds.d.ts +1 -14
  92. package/dist/prosemirror/paraIds.js +1 -14
  93. package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
  94. package/dist/prosemirror/paragraphMarkJoin.js +3 -46
  95. package/dist/prosemirror/projectionReview.d.ts +49 -0
  96. package/dist/prosemirror/projectionReview.js +292 -0
  97. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
  98. package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
  99. package/dist/prosemirror/replacedAnnotations.d.ts +6 -83
  100. package/dist/prosemirror/replacedAnnotations.js +11 -203
  101. package/dist/prosemirror/revisionCarriers.d.ts +9 -1
  102. package/dist/prosemirror/revisionCarriers.js +15 -1
  103. package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
  104. package/dist/prosemirror/revisionRangeQueries.js +76 -0
  105. package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
  106. package/dist/prosemirror/runFormattingMarkNames.js +1 -1
  107. package/dist/prosemirror/styles/styleResolver.d.ts +1 -0
  108. package/dist/prosemirror/styles/styleResolver.js +4 -1
  109. package/dist/prosemirror/suggestionQueries.d.ts +114 -0
  110. package/dist/prosemirror/suggestionQueries.js +320 -0
  111. package/dist/prosemirror/tableGridMutation.d.ts +1 -16
  112. package/dist/prosemirror/tableGridMutation.js +1 -78
  113. package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
  114. package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
  115. package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
  116. package/dist/server.d.ts +2 -2
  117. package/dist/types/canonicalCapabilities.d.ts +4 -35
  118. package/dist/types/canonicalCapabilities.js +4 -33
  119. package/package.json +2 -2
  120. package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
  121. package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
  122. package/dist/internal/revisionResolutionEdits.d.ts +0 -11
  123. package/dist/internal/revisionResolutionEdits.js +0 -18
  124. package/dist/internal/revisionResolutionInline.d.ts +0 -24
  125. package/dist/internal/revisionResolutionInline.js +0 -302
  126. package/dist/internal/revisionResolutionStep.d.ts +0 -32
  127. package/dist/internal/revisionResolutionStep.js +0 -282
  128. package/dist/internal/revisionResolutionTracking.d.ts +0 -9
  129. package/dist/internal/revisionResolutionTracking.js +0 -124
  130. package/dist/internal/wholeStoryRevisionResolution.d.ts +0 -56
  131. package/dist/internal/wholeStoryRevisionResolution.js +0 -783
  132. package/dist/prosemirror/commands/resolveAllTableChanges.d.ts +0 -38
  133. package/dist/prosemirror/commands/resolveAllTableChanges.js +0 -642
  134. package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.d.ts +0 -13
  135. package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.js +0 -45
  136. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +0 -18
  137. package/dist/prosemirror/commands/tableCellMergeResolution.js +0 -207
  138. package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +0 -60
  139. package/dist/prosemirror/commands/tableMergeFoldDecisions.js +0 -78
  140. package/dist/prosemirror/rejoinRunCarriers.d.ts +0 -42
  141. package/dist/prosemirror/rejoinRunCarriers.js +0 -65
  142. package/dist/prosemirror/runPropertyChangeResolution.d.ts +0 -15
  143. package/dist/prosemirror/runPropertyChangeResolution.js +0 -34
@@ -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;
@@ -24,6 +35,22 @@ export type DocxTableCell = {
24
35
  /** Ids of the blocks directly inside the cell, in order. */
25
36
  blockIds: string[];
26
37
  };
38
+ /**
39
+ * A tracked change inside a paragraph, by where it sits in the paragraph's
40
+ * `text`. An insertion spans the text it added. A deletion takes no place
41
+ * in a text read with the changes accepted: its `start` and `end` are the
42
+ * one offset it was made at. A change of the paragraph mark sits at the
43
+ * offset the mark stands or stood at.
44
+ */
45
+ export type DocxBlockRevision = {
46
+ kind: "insertion" | "deletion";
47
+ start: number;
48
+ end: number;
49
+ author: string;
50
+ date: string | null;
51
+ /** The change is of a paragraph mark, not of text. */
52
+ paragraphMark?: true;
53
+ };
27
54
  /**
28
55
  * One block of the main story. `text` is the visible text: `\t` for a tab,
29
56
  * `\n` for a line break, U+FFFC for a footnote or endnote reference mark;
@@ -55,6 +82,20 @@ export type DocxBlock = {
55
82
  * without text can hold one: it is then all that starts the next page.
56
83
  */
57
84
  pageBreaks?: number;
85
+ /**
86
+ * Offsets in `text` at which the paragraph holds a field that numbers
87
+ * itself (`AUTONUM`, `AUTONUMLGL`, `AUTONUMOUT`), when it holds any. The
88
+ * number such a field prints is in no text: `Annex - Summary` with one at
89
+ * offset 6 reads `Annex 1 - Summary` on the page.
90
+ */
91
+ selfNumbers?: number[];
92
+ /**
93
+ * The tracked changes the paragraph holds, in a manifest read with the
94
+ * changes kept (`trackedChanges: "keep"`), in the order they stand. A
95
+ * plan takes care around them: a label is not stripped across one and a
96
+ * reference is not placed on one.
97
+ */
98
+ revisions?: DocxBlockRevision[];
58
99
  /**
59
100
  * The paragraph starts on a new page by its own formatting or its
60
101
  * style's (`w:pageBreakBefore`). A plan carries it over with an item's
@@ -73,6 +114,26 @@ export type DocxBlock = {
73
114
  * Absent when neither states one.
74
115
  */
75
116
  alignment?: string;
117
+ /**
118
+ * The space the paragraph states for itself in front of and behind it
119
+ * (`w:spacing`, `before` and `after`), in twentieths of a point. A side
120
+ * it does not state is left out; absent when it states neither. What its
121
+ * style gives is not here: this is what the document set by hand.
122
+ */
123
+ spacing?: TemplatePlanSpacing;
124
+ /**
125
+ * The paragraph's indent in effect, in twentieths of a point: `left` is
126
+ * where its lines start, `firstLine` what its first line adds to that
127
+ * (negative for a hanging indent). Each side is the paragraph's own, else
128
+ * its list level's and its style's with inheritance resolved: the
129
+ * level's first where the paragraph names its list itself, the style's
130
+ * first where the style brings the list. Absent when none of them states
131
+ * an indent.
132
+ */
133
+ indent?: {
134
+ left: number;
135
+ firstLine: number;
136
+ };
76
137
  /** Table only: its cells in row order. */
77
138
  cells?: DocxTableCell[];
78
139
  /** Table only: every block inside the table in document order. */
@@ -131,8 +192,59 @@ export type DocxBlockManifest = {
131
192
  comments: number;
132
193
  /** Tracked insertions, deletions and moves in the main story and its notes. */
133
194
  trackedChanges: number;
195
+ /**
196
+ * What the document tracks, when it tracks anything: for a caller that
197
+ * has to choose a view. Absent from a manifest read in a chosen view,
198
+ * which tracks nothing any more.
199
+ */
200
+ revisions?: DocxTrackedChanges;
201
+ /**
202
+ * The view the manifest was read in and what was resolved for it, when
203
+ * the caller chose one: every block, label and hash is that view's.
204
+ */
205
+ trackedChangesResolved?: DocxTrackedChanges & {
206
+ view: TemplatePlanTrackedView;
207
+ };
208
+ /**
209
+ * What the document tracks, on a manifest read for a plan that keeps its
210
+ * tracked changes: the blocks are the accepted view's.
211
+ */
212
+ trackedChangesKept?: DocxTrackedChanges;
134
213
  warnings: string[];
135
214
  };
215
+ /**
216
+ * One of the two texts a document with tracked changes holds: with every
217
+ * change accepted, or with every change rejected.
218
+ */
219
+ export type TemplatePlanTrackedView = "accept" | "reject";
220
+ /**
221
+ * What a plan does with the tracked changes of its source: formats one view
222
+ * of them, or keeps them (`keep`). A plan that keeps them is made for the
223
+ * accepted view's blocks; the output shows the same insertions and
224
+ * deletions, by the same authors, and tracks nothing new. So far only
225
+ * changes inside paragraphs are kept: a source with an inserted or deleted
226
+ * paragraph mark, table row or cell, or a move, is refused as
227
+ * `tracked-changes`.
228
+ */
229
+ export type TemplatePlanTrackedChanges = TemplatePlanTrackedView | "keep";
230
+ /** The tracked changes of a document's main story and notes, by kind. */
231
+ export type DocxTrackedChanges = {
232
+ insertions: number;
233
+ deletions: number;
234
+ /** Move sources and destinations. */
235
+ moves: number;
236
+ /** Paragraph marks the chosen view removes, each joining two paragraphs;
237
+ * counted for the accepted view where none was chosen. */
238
+ paragraphMarks: number;
239
+ /** Table rows the view removes. */
240
+ tableRows: number;
241
+ /** Recorded changes of formatting. */
242
+ formattingChanges: number;
243
+ authors: string[];
244
+ /** The earliest and the latest date a change states, as written. */
245
+ first: string | null;
246
+ last: string | null;
247
+ };
136
248
  export type DocxTemplateStyle = {
137
249
  styleId: string;
138
250
  name: string | null;
@@ -149,6 +261,29 @@ export type DocxTemplateStyle = {
149
261
  * null when neither the style nor one it is based on states one.
150
262
  */
151
263
  alignment: string | null;
264
+ /**
265
+ * Whether the style sets its text in bold (`w:b`), inheritance and the
266
+ * document's defaults resolved.
267
+ */
268
+ bold: boolean;
269
+ /**
270
+ * The font size the style gives its text, in half-points (`w:sz`),
271
+ * inheritance and the document's defaults resolved; null when none of
272
+ * them states one.
273
+ */
274
+ size: number | null;
275
+ /**
276
+ * Whether the style keeps its paragraph on the page of the next one
277
+ * (`w:keepNext`), inheritance and the document's defaults resolved.
278
+ */
279
+ keepNext: boolean;
280
+ /**
281
+ * The left indent the style gives its paragraphs, in twentieths of a
282
+ * point (`w:ind`), inheritance and the document's defaults resolved; null
283
+ * when none of them states one. A style bound to a list takes the indent
284
+ * of its level where it states none itself.
285
+ */
286
+ indentLeft: number | null;
152
287
  isDefault: boolean;
153
288
  };
154
289
  export type DocxTemplateNumberingLevel = {
@@ -206,6 +341,31 @@ export type DocxTemplateSection = DocxSection & {
206
341
  part: string | null;
207
342
  }[];
208
343
  };
344
+ /**
345
+ * A text effect of the `w14` extension. One whose values show nothing can still change
346
+ * how a consumer treats the text: a run with a 3-D scene, even the default
347
+ * one, is drawn as a picture.
348
+ */
349
+ export type DocxTextEffect = "glow" | "shadow" | "reflection" | "textOutline" | "textFill" | "scene3d" | "props3d";
350
+ /** What the run properties an effect stands in belong to. */
351
+ export type DocxTextEffectOwner = {
352
+ kind: "level";
353
+ abstractNumId: number | null;
354
+ ilvl: number | null;
355
+ } | {
356
+ kind: "style";
357
+ styleId: string | null;
358
+ } | {
359
+ kind: "defaults";
360
+ } | {
361
+ kind: "text";
362
+ };
363
+ /** A text effect of a template whose values show nothing. */
364
+ export type DocxTemplateInvisibleEffect = {
365
+ part: string;
366
+ effect: DocxTextEffect;
367
+ owner: DocxTextEffectOwner;
368
+ };
209
369
  export type DocxTemplateBookmark = {
210
370
  name: string;
211
371
  id: string;
@@ -217,6 +377,12 @@ export type DocxTemplateInspection = Omit<DocxBlockManifest, "sections"> & {
217
377
  fields: DocxTemplateField[];
218
378
  sections: DocxTemplateSection[];
219
379
  bookmarks: DocxTemplateBookmark[];
380
+ /**
381
+ * Text effects that show nothing, in the document, its numbering, its
382
+ * styles, its headers and its footers. A plan's output is written without
383
+ * them unless the plan says otherwise.
384
+ */
385
+ invisibleEffects: DocxTemplateInvisibleEffect[];
220
386
  };
221
387
  export type TemplatePlanOmitReason = "empty" | "sourceToc" | "pageArtifact" | "duplicateLabel";
222
388
  /**
@@ -235,6 +401,16 @@ export type TemplatePlanNumbering = {
235
401
  group?: string;
236
402
  };
237
403
  export type TemplatePlanMerge = "lineBreak" | "space" | "none";
404
+ /**
405
+ * A paragraph's own indent, in twentieths of a point (`w:ind`). A side left
406
+ * out stays what the style or the list level gives; a hanging indent and a
407
+ * first-line indent exclude each other.
408
+ */
409
+ export type TemplatePlanIndent = {
410
+ left?: number;
411
+ hanging?: number;
412
+ firstLine?: number;
413
+ };
238
414
  export type TemplatePlanNestedParagraph = {
239
415
  blockId: string;
240
416
  styleId?: string;
@@ -242,6 +418,26 @@ export type TemplatePlanNestedParagraph = {
242
418
  stripLabel?: string;
243
419
  /** As on a source item. */
244
420
  labelAsText?: boolean;
421
+ /** As on a source item. */
422
+ keepNext?: boolean;
423
+ /** As on a source item. */
424
+ indent?: TemplatePlanIndent;
425
+ /** As on a source item. */
426
+ tabStops?: number[];
427
+ /** As on a source item. */
428
+ alignment?: TemplatePlanAlignment;
429
+ /** As on a source item. */
430
+ spacing?: TemplatePlanSpacing;
431
+ };
432
+ /** How a paragraph's lines are set between the margins (`w:jc`). */
433
+ export type TemplatePlanAlignment = "left" | "center" | "right" | "both";
434
+ /**
435
+ * The space in front of a paragraph and behind it (`w:spacing`), in
436
+ * twentieths of a point: at least one side. A side left out is the style's.
437
+ */
438
+ export type TemplatePlanSpacing = {
439
+ before?: number;
440
+ after?: number;
245
441
  };
246
442
  /** A page other than the template's, in twentieths of a point. */
247
443
  export type TemplatePlanSectionPage = {
@@ -280,6 +476,14 @@ export type TemplatePlanSourceItem = {
280
476
  numbering?: TemplatePlanNumbering | null;
281
477
  /** The manual label at the start of the block to remove, with the space after it. */
282
478
  stripLabel?: string;
479
+ /**
480
+ * With `stripLabel`: a line break that follows the label goes with it,
481
+ * and the space around that break. For a heading the source breaks behind
482
+ * its number where the template sets number and title on one line: the
483
+ * list then parts the two as its level says. Left out, a line break
484
+ * behind the label stays the first character of the paragraph.
485
+ */
486
+ stripLabelBreak?: boolean;
283
487
  /**
284
488
  * Write the block's automatic label as text at the start of its text, with
285
489
  * the tab or space its list puts after it: for a label no list of the
@@ -302,6 +506,40 @@ export type TemplatePlanSourceItem = {
302
506
  * Verification compares what the paragraph states for itself.
303
507
  */
304
508
  pageBreakBefore?: boolean;
509
+ /**
510
+ * Keep the paragraph on the page of the one after it (`w:keepNext`): for
511
+ * a line that heads what follows in a style that does not say so. Not
512
+ * for a table, and not for a block that joins the paragraph before it.
513
+ * `false` is the same as leaving it out.
514
+ */
515
+ keepNext?: boolean;
516
+ /**
517
+ * The paragraph's own indent, over its style's and its list level's:
518
+ * for a number written as text that hangs the way the list's would. Not
519
+ * for a table, and not for a block that joins the paragraph before it.
520
+ */
521
+ indent?: TemplatePlanIndent;
522
+ /**
523
+ * The paragraph's own left tab stops, in twentieths of a point from the
524
+ * left margin and in ascending order (`w:tabs`): for a line of a label, a
525
+ * tab and a value whose values are to start at one position. They are
526
+ * added to the stops of the paragraph's style, as tab stops are in the
527
+ * format: a stop the style sets in front of them still ends a tab. Not
528
+ * for a table.
529
+ */
530
+ tabStops?: number[];
531
+ /**
532
+ * The paragraph's own alignment (`w:jc`), over the one its style states:
533
+ * for a line the document sets by itself, such as the text of a table
534
+ * cell or a centred line under a title. Not for a table.
535
+ */
536
+ alignment?: TemplatePlanAlignment;
537
+ /**
538
+ * The paragraph's own space in front of it and behind it (`w:spacing`),
539
+ * over what its style states: for a line the document sets tight or
540
+ * apart by itself, such as the rows of a table. Not for a table.
541
+ */
542
+ spacing?: TemplatePlanSpacing;
305
543
  /**
306
544
  * The paragraph is the last of a section, described here: for a part of
307
545
  * the document whose page is another than the template's, such as a
@@ -322,6 +560,20 @@ export type TemplatePlanItem = {
322
560
  kind: "slot";
323
561
  templateBlockId: string;
324
562
  sourceBlockIds: string[];
563
+ /**
564
+ * A lead of the first source block that the slot does not take: the
565
+ * name of a field the template shows itself (`To:` in front of an
566
+ * addressee, where the template has a cell that says so). The block
567
+ * must start with `text`. It and the blanks behind it are dropped;
568
+ * what follows is placed word for word and must be something.
569
+ * `shownByTemplateBlockId` names the paragraph of the template that
570
+ * shows the field: one the plan keeps as it is, with text. The report
571
+ * names every lead dropped.
572
+ */
573
+ dropLead?: {
574
+ text: string;
575
+ shownByTemplateBlockId: string;
576
+ };
325
577
  };
326
578
  export type TemplatePlanNumberingPatch = {
327
579
  abstractNumId: number;
@@ -330,6 +582,11 @@ export type TemplatePlanNumberingPatch = {
330
582
  lvlText?: string;
331
583
  start?: number;
332
584
  suff?: "tab" | "space" | "nothing";
585
+ /**
586
+ * The face the level's label is set in. Whatever else the level's run
587
+ * properties state is kept.
588
+ */
589
+ font?: string;
333
590
  /**
334
591
  * The paragraph indent the level gives, in twentieths of a point. A value
335
592
  * left out keeps what the level states; `hanging` and `firstLine` exclude
@@ -393,6 +650,35 @@ export type TemplatePlan = {
393
650
  * stands.
394
651
  */
395
652
  lastSection?: TemplatePlanSection;
653
+ /**
654
+ * Paragraphs inside kept template tables that are written without their
655
+ * text: a sample line of a header cell the document has nothing for (the
656
+ * third line of an address). The paragraph keeps its place and its
657
+ * properties. Each is a paragraph nested in a table the plan keeps, and
658
+ * none is filled by a slot.
659
+ */
660
+ emptyTemplateBlockIds?: string[];
661
+ /**
662
+ * The view of a source with tracked changes the plan is made for: its
663
+ * text with every change accepted, or with every change rejected. The
664
+ * blocks and hashes the plan names are that view's, the output carries
665
+ * no revision, and verification holds it to that view. Left out, a
666
+ * source with tracked changes is refused.
667
+ */
668
+ trackedChanges?: TemplatePlanTrackedChanges;
669
+ /**
670
+ * What becomes of text effects whose values show nothing, in the parts
671
+ * the output takes from the template: its document, numbering, styles,
672
+ * headers and footers. `normalize`, the default, leaves them out, so text
673
+ * that looked plain is written as text everywhere; an effect that shows
674
+ * anything is never touched. `keep` writes those parts as they are.
675
+ */
676
+ textEffects?: "normalize" | "keep";
677
+ };
678
+ export type TemplatePlanEffectCount = {
679
+ part: string;
680
+ effect: DocxTextEffect;
681
+ count: number;
396
682
  };
397
683
  export type TemplatePlanBlockResult = {
398
684
  /** The source block. */
@@ -404,6 +690,14 @@ export type TemplatePlanBlockResult = {
404
690
  emphasis: "identical" | "mismatch" | "omitted";
405
691
  /** What `stripLabel` removed, the following space included. */
406
692
  strippedPrefix?: string;
693
+ /**
694
+ * The lead a slot's `dropLead` took off the block, the blanks behind it
695
+ * included, and the kept paragraph of the template that shows the field.
696
+ */
697
+ droppedLead?: {
698
+ text: string;
699
+ shownByTemplateBlockId: string;
700
+ };
407
701
  /** The automatic label `labelAsText` wrote as text, without what follows it. */
408
702
  labelAsText?: string;
409
703
  /** The label the source showed: its automatic label, else the stripped one. */
@@ -453,7 +747,7 @@ export type TemplatePlanFieldLeftover = {
453
747
  count: number;
454
748
  };
455
749
  export type TemplatePlanIssue = {
456
- 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" | "section-mismatch" | "template-mismatch" | "prompting-field-left" | "field-not-frozen" | "update-fields-mismatch" | "compat-mismatch" | "conformance";
750
+ 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";
457
751
  message: string;
458
752
  blockId?: string;
459
753
  part?: string;
@@ -465,6 +759,16 @@ export type TemplatePlanReport = {
465
759
  sourceSha256: string;
466
760
  templateSha256: string;
467
761
  outputSha256: string;
762
+ /** The view the plan chose of a source with tracked changes, and what
763
+ * was resolved for it. */
764
+ trackedChanges?: DocxTrackedChanges & {
765
+ view: TemplatePlanTrackedView;
766
+ };
767
+ /**
768
+ * What the source tracks, when the plan kept its tracked changes: the
769
+ * output shows the same insertions and deletions by the same authors.
770
+ */
771
+ trackedChangesKept?: DocxTrackedChanges;
468
772
  /** One entry per block of the source, nested ones included, in document order. */
469
773
  blocks: TemplatePlanBlockResult[];
470
774
  counts: {
@@ -530,6 +834,14 @@ export type TemplatePlanReport = {
530
834
  internalHyperlinks: number;
531
835
  sectionBreaks: number;
532
836
  };
837
+ /**
838
+ * Text effects that show nothing: those of the template the output does
839
+ * not carry, and those it still does.
840
+ */
841
+ textEffects: {
842
+ removed: TemplatePlanEffectCount[];
843
+ left: TemplatePlanEffectCount[];
844
+ };
533
845
  updateFields: "set" | "cleared" | "unchanged";
534
846
  conformance: {
535
847
  status: "conformant" | "invalid" | "indeterminate";