@stll/folio-core 0.10.0 → 0.12.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 (217) hide show
  1. package/dist/ai-edits/apply.js +602 -50
  2. package/dist/ai-edits/block-identity.d.ts +4 -0
  3. package/dist/ai-edits/block-identity.js +9 -0
  4. package/dist/ai-edits/blockRange.d.ts +28 -1
  5. package/dist/ai-edits/blockRange.js +67 -1
  6. package/dist/ai-edits/headless.d.ts +4 -4
  7. package/dist/ai-edits/headless.js +9 -9
  8. package/dist/ai-edits/index.d.ts +2 -2
  9. package/dist/ai-edits/index.js +2 -2
  10. package/dist/ai-edits/read.d.ts +7 -7
  11. package/dist/ai-edits/read.js +110 -3
  12. package/dist/ai-edits/table-cell-mutations.d.ts +48 -0
  13. package/dist/ai-edits/table-cell-mutations.js +237 -0
  14. package/dist/ai-edits/table-mutation-plan.d.ts +38 -0
  15. package/dist/ai-edits/table-mutation-plan.js +90 -0
  16. package/dist/ai-edits/table-row-column-mutations.d.ts +100 -0
  17. package/dist/ai-edits/table-row-column-mutations.js +300 -0
  18. package/dist/ai-edits/table-targets.d.ts +32 -0
  19. package/dist/ai-edits/table-targets.js +70 -0
  20. package/dist/ai-edits/types.d.ts +34 -0
  21. package/dist/compat/eigenpal.js +1 -1
  22. package/dist/content-controls/mutateContentControls.js +1 -1
  23. package/dist/controller/activeEditorStory.d.ts +36 -0
  24. package/dist/controller/activeEditorStory.js +30 -0
  25. package/dist/controller/collaborationModules.d.ts +7 -0
  26. package/dist/controller/collaborationModules.js +15 -0
  27. package/dist/controller/contentControlWidgetController.d.ts +55 -0
  28. package/dist/controller/contentControlWidgetController.js +141 -0
  29. package/dist/controller/folioEditor.d.ts +1 -1
  30. package/dist/controller/fontReadiness.js +2 -0
  31. package/dist/controller/headerFooterEditorManager.d.ts +41 -0
  32. package/dist/controller/headerFooterEditorManager.js +182 -0
  33. package/dist/controller/hiddenEditorApi.js +2 -2
  34. package/dist/controller/hiddenEditorManager.d.ts +13 -2
  35. package/dist/controller/hiddenEditorManager.js +32 -11
  36. package/dist/controller/layoutPipeline.d.ts +2 -0
  37. package/dist/controller/layoutPipeline.js +16 -1
  38. package/dist/controller/noteEditorManager.d.ts +36 -0
  39. package/dist/controller/noteEditorManager.js +210 -0
  40. package/dist/document-operations.d.ts +35 -3
  41. package/dist/document-operations.js +161 -3
  42. package/dist/docx/blockContentParser.js +2 -2
  43. package/dist/docx/commentParser.js +6 -1
  44. package/dist/docx/conformance.js +8 -1
  45. package/dist/docx/documentGrid.d.ts +8 -0
  46. package/dist/docx/documentGrid.js +8 -0
  47. package/dist/docx/drawingUtils.js +1 -1
  48. package/dist/docx/ensureParaIds.js +1 -1
  49. package/dist/docx/fieldParser.js +1 -1
  50. package/dist/docx/notePropertiesParser.js +1 -1
  51. package/dist/docx/numberingParser.js +1 -1
  52. package/dist/docx/paragraphParser.js +63 -58
  53. package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
  54. package/dist/docx/paragraphTextBoxEnrichment.js +67 -13
  55. package/dist/docx/paragraphTraversal.js +1 -1
  56. package/dist/docx/parser.js +3 -3
  57. package/dist/docx/rezip.js +1 -1
  58. package/dist/docx/runParser.js +4 -2
  59. package/dist/docx/sdtProperties.js +1 -1
  60. package/dist/docx/sectionParser.js +1 -1
  61. package/dist/docx/selectiveSave.js +1 -1
  62. package/dist/docx/serializer/commentSerializer.js +1 -2
  63. package/dist/docx/serializer/documentSerializer.js +2 -2
  64. package/dist/docx/serializer/headerFooterSerializer.js +2 -2
  65. package/dist/docx/serializer/noteSerializer.js +2 -2
  66. package/dist/docx/serializer/paragraphSerializer.js +7 -1
  67. package/dist/docx/serializer/runSerializer.js +4 -2
  68. package/dist/docx/serializer/stylesSerializer.js +1 -1
  69. package/dist/docx/serializer/tableSerializer.d.ts +5 -4
  70. package/dist/docx/serializer/tableSerializer.js +17 -13
  71. package/dist/docx/server/applyDocxXmlPatchProposal.d.ts +87 -0
  72. package/dist/docx/server/applyDocxXmlPatchProposal.js +204 -0
  73. package/dist/docx/server/boundedArchive.d.ts +14 -3
  74. package/dist/docx/server/boundedArchive.js +56 -11
  75. package/dist/docx/server/evaluateDocxXmlPatchProposal.d.ts +85 -0
  76. package/dist/docx/server/evaluateDocxXmlPatchProposal.js +361 -0
  77. package/dist/docx/server/inspectDocxPackage.d.ts +70 -0
  78. package/dist/docx/server/inspectDocxPackage.js +217 -0
  79. package/dist/docx/server/validateDocxConformance.d.ts +41 -0
  80. package/dist/docx/server/validateDocxConformance.js +336 -0
  81. package/dist/docx/settingsParser.js +11 -1
  82. package/dist/docx/shapeParser.js +1 -1
  83. package/dist/docx/styleParser.js +4 -2
  84. package/dist/docx/tableParser.js +18 -7
  85. package/dist/docx/textBoxParser.d.ts +3 -3
  86. package/dist/docx/textBoxParser.js +16 -12
  87. package/dist/docx/xmlSafety.d.ts +5 -0
  88. package/dist/docx/xmlSafety.js +9 -0
  89. package/dist/fields/resolveFieldValues.js +1 -3
  90. package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
  91. package/dist/i18n/messages/catalogs.gen.js +17 -0
  92. package/dist/i18n/messages/messages.gen.d.ts +1 -0
  93. package/dist/index.js +1 -1
  94. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  95. package/dist/layout-bridge/convert/footnoteLayout.js +47 -40
  96. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  97. package/dist/layout-bridge/convert/headerFooterLayout.js +3 -0
  98. package/dist/layout-bridge/convert/templatePreviewFlow.js +3 -3
  99. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +4 -2
  100. package/dist/layout-bridge/convert/toFlowBlocks.js +136 -20
  101. package/dist/layout-bridge/dom/noteStoryDom.d.ts +6 -0
  102. package/dist/layout-bridge/dom/noteStoryDom.js +17 -0
  103. package/dist/layout-bridge/engine/clickToPosition.js +2 -2
  104. package/dist/layout-engine/index.d.ts +2 -2
  105. package/dist/layout-engine/index.js +43 -28
  106. package/dist/layout-engine/justificationCompatibility.d.ts +6 -0
  107. package/dist/layout-engine/justificationCompatibility.js +8 -0
  108. package/dist/layout-engine/keep-together.js +11 -1
  109. package/dist/layout-engine/measure/cache.js +21 -5
  110. package/dist/layout-engine/measure/lineBreakProvider.js +53 -34
  111. package/dist/layout-engine/measure/measureBlocks.js +6 -3
  112. package/dist/layout-engine/measure/measureContainer.js +1 -1
  113. package/dist/layout-engine/measure/measureHelpers.d.ts +1 -1
  114. package/dist/layout-engine/measure/measureHelpers.js +3 -3
  115. package/dist/layout-engine/measure/measureParagraph.js +69 -25
  116. package/dist/layout-engine/measure/measureProvider.js +4 -3
  117. package/dist/layout-engine/measure/tableCellFlow.js +5 -2
  118. package/dist/layout-engine/measure/textBoxParagraphLayout.d.ts +9 -7
  119. package/dist/layout-engine/measure/textBoxParagraphLayout.js +22 -6
  120. package/dist/layout-engine/measure/textMeasurementPolicy.d.ts +3 -1
  121. package/dist/layout-engine/measure/textMeasurementPolicy.js +7 -1
  122. package/dist/layout-engine/paginator.js +5 -1
  123. package/dist/layout-engine/paragraphSpacing.d.ts +28 -4
  124. package/dist/layout-engine/paragraphSpacing.js +107 -13
  125. package/dist/layout-engine/renderedBreakReconciliation.js +1 -1
  126. package/dist/layout-engine/types.d.ts +26 -13
  127. package/dist/layout-painter/registry/modules/textBox.js +5 -1
  128. package/dist/layout-painter/renderPage.d.ts +5 -2
  129. package/dist/layout-painter/renderPage.js +56 -12
  130. package/dist/layout-painter/renderParagraph.js +22 -6
  131. package/dist/layout-painter/renderTable.d.ts +5 -1
  132. package/dist/layout-painter/renderTable.js +5 -2
  133. package/dist/layout-painter/renderTextBox.d.ts +2 -1
  134. package/dist/layout-painter/renderTextBox.js +25 -14
  135. package/dist/managers/DocumentLoaderManager.js +1 -1
  136. package/dist/managers/FindReplaceManager.d.ts +8 -0
  137. package/dist/managers/FindReplaceManager.js +18 -0
  138. package/dist/managers/TableSelectionManager.d.ts +6 -0
  139. package/dist/managers/TableSelectionManager.js +14 -0
  140. package/dist/model.js +1 -1
  141. package/dist/prosemirror/attrs/index.d.ts +4 -2
  142. package/dist/prosemirror/attrs/index.js +154 -18
  143. package/dist/prosemirror/commands/comments.d.ts +3 -3
  144. package/dist/prosemirror/commands/comments.js +248 -12
  145. package/dist/prosemirror/commands/contentControls.js +1 -1
  146. package/dist/prosemirror/commands/index.js +1 -1
  147. package/dist/prosemirror/commands/pageBreak.js +1 -1
  148. package/dist/prosemirror/commands/propertyChangeScope.d.ts +2 -2
  149. package/dist/prosemirror/commands/propertyChangeScope.js +3 -2
  150. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +9 -0
  151. package/dist/prosemirror/commands/tableCellMergeResolution.js +181 -0
  152. package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -1
  153. package/dist/prosemirror/conversion/fromProseDoc.js +286 -61
  154. package/dist/prosemirror/conversion/sdtAttrs.d.ts +9 -0
  155. package/dist/prosemirror/conversion/sdtAttrs.js +49 -0
  156. package/dist/prosemirror/conversion/toProseDoc.d.ts +2 -1
  157. package/dist/prosemirror/conversion/toProseDoc.js +347 -98
  158. package/dist/prosemirror/extensions/ExtensionManager.js +1 -1
  159. package/dist/prosemirror/extensions/StarterKit.js +6 -1
  160. package/dist/prosemirror/extensions/core/ParagraphExtension.js +4 -1
  161. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -0
  162. package/dist/prosemirror/extensions/features/ListExtension.js +1 -1
  163. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +10 -1
  164. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +93 -2
  165. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +2 -1
  166. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +6 -2
  167. package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.js +1 -1
  168. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +9 -1
  169. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +24 -1
  170. package/dist/prosemirror/extensions/nodes/FieldExtension.js +1 -1
  171. package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +7 -0
  172. package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.js +22 -0
  173. package/dist/prosemirror/extensions/nodes/TableExtension.js +9 -3
  174. package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +13 -0
  175. package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.js +41 -0
  176. package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +5 -2
  177. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -1
  178. package/dist/prosemirror/findReplaceSelection.d.ts +6 -1
  179. package/dist/prosemirror/findReplaceSelection.js +57 -13
  180. package/dist/prosemirror/plugins/contentControlWidgets.d.ts +34 -8
  181. package/dist/prosemirror/plugins/contentControlWidgets.js +125 -91
  182. package/dist/prosemirror/plugins/selectionTracker.js +1 -0
  183. package/dist/prosemirror/plugins/suggestionMode.js +1 -1
  184. package/dist/prosemirror/schema/index.d.ts +2 -2
  185. package/dist/prosemirror/schema/marks.d.ts +5 -1
  186. package/dist/prosemirror/schema/nodes.d.ts +64 -7
  187. package/dist/prosemirror/selectionState.js +1 -0
  188. package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
  189. package/dist/prosemirror/tableCellMergeRevision.d.ts +9 -0
  190. package/dist/prosemirror/tableCellMergeRevision.js +22 -0
  191. package/dist/prosemirror/textBoxAnchorAttrs.d.ts +9 -0
  192. package/dist/prosemirror/textBoxAnchorAttrs.js +33 -0
  193. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +1 -1
  194. package/dist/prosemirror/utils/extractTrackedChanges.js +62 -14
  195. package/dist/prosemirror/validation.js +9 -1
  196. package/dist/render-dom/BodySelectionOverlay.d.ts +31 -0
  197. package/dist/render-dom/BodySelectionOverlay.js +76 -0
  198. package/dist/render-dom/HeaderFooterSelectionOverlay.d.ts +28 -0
  199. package/dist/render-dom/HeaderFooterSelectionOverlay.js +121 -0
  200. package/dist/render-dom/RemoteSelectionOverlay.d.ts +30 -0
  201. package/dist/render-dom/RemoteSelectionOverlay.js +67 -0
  202. package/dist/render-dom/RenderedDomContext.d.ts +40 -0
  203. package/dist/render-dom/RenderedDomContext.js +126 -0
  204. package/dist/render-dom/resolveSidebarItemPositions.d.ts +33 -0
  205. package/dist/render-dom/resolveSidebarItemPositions.js +45 -0
  206. package/dist/server.d.ts +6 -2
  207. package/dist/server.js +5 -1
  208. package/dist/utils/findReplace.d.ts +32 -0
  209. package/dist/utils/findReplace.js +118 -0
  210. package/dist/utils/fontFamilyMerge.js +9 -11
  211. package/dist/utils/fontLoader.js +3 -2
  212. package/dist/utils/fontResolver.js +22 -4
  213. package/dist/utils/fontWeights.d.ts +1 -1
  214. package/dist/utils/fontWeights.js +1 -1
  215. package/dist/utils/headerFooter.js +24 -1
  216. package/dist/utils/paragraphFormattingMerge.js +1 -0
  217. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { DEFAULT_TEXTBOX_MARGINS } from "../layout-engine/types.js";
2
2
  import { renderParagraphFragment } from "./renderParagraph.js";
3
- import { layoutTextBoxParagraphs } from "../layout-engine/measure/textBoxParagraphLayout.js";
3
+ import { layoutTextBoxContent } from "../layout-engine/measure/textBoxParagraphLayout.js";
4
+ import { panic } from "better-result";
4
5
  //#region src/layout-painter/renderTextBox.ts
5
6
  /**
6
7
  * Text Box Renderer
@@ -9,7 +10,7 @@ import { layoutTextBoxParagraphs } from "../layout-engine/measure/textBoxParagra
9
10
  * - Background fill color
10
11
  * - Border/outline
11
12
  * - Internal padding (margins)
12
- * - Paragraph content inside the box (using pre-measured data)
13
+ * - Block content inside the box (using pre-measured data)
13
14
  */
14
15
  /**
15
16
  * CSS class names for text box elements
@@ -39,27 +40,37 @@ function renderTextBoxFragment(fragment, block, measure, context, options = {})
39
40
  if (fragment.pmStart !== void 0) containerEl.dataset["pmStart"] = String(fragment.pmStart);
40
41
  if (fragment.pmEnd !== void 0) containerEl.dataset["pmEnd"] = String(fragment.pmEnd);
41
42
  const innerWidth = fragment.width - margins.left - margins.right;
42
- const paragraphLayout = layoutTextBoxParagraphs(block.content, measure.innerMeasures);
43
+ const contentLayout = layoutTextBoxContent(block.content, measure.innerMeasures);
43
44
  for (let i = 0; i < block.content.length; i++) {
44
- const paraBlock = block.content[i];
45
- const paraMeasure = measure.innerMeasures[i];
46
- const placement = paragraphLayout.placements[i];
47
- if (!paraBlock || !paraMeasure || !placement) continue;
45
+ const contentBlock = block.content[i];
46
+ const contentMeasure = measure.innerMeasures[i];
47
+ const placement = contentLayout.placements[i];
48
+ if (!contentBlock || !contentMeasure || !placement) continue;
49
+ if (contentBlock.kind === "table" && contentMeasure.kind === "table") {
50
+ if (!options.renderTable) panic("renderTextBoxFragment: a nested table renderer is required for table content");
51
+ const tableEl = options.renderTable(contentBlock, contentMeasure, context, doc);
52
+ tableEl.style.marginTop = `${placement.leadingSpacing}px`;
53
+ containerEl.append(tableEl);
54
+ continue;
55
+ }
56
+ if (contentBlock.kind !== "paragraph" || contentMeasure.kind !== "paragraph") continue;
48
57
  const paraFragment = {
49
58
  kind: "paragraph",
50
- blockId: paraBlock.id,
59
+ blockId: contentBlock.id,
51
60
  x: 0,
52
61
  y: 0,
53
62
  width: innerWidth,
54
63
  height: placement.contentHeight,
55
- ...paraBlock.pmStart !== void 0 ? { pmStart: paraBlock.pmStart } : {},
56
- ...paraBlock.pmEnd !== void 0 ? { pmEnd: paraBlock.pmEnd } : {},
64
+ ...contentBlock.pmStart !== void 0 ? { pmStart: contentBlock.pmStart } : {},
65
+ ...contentBlock.pmEnd !== void 0 ? { pmEnd: contentBlock.pmEnd } : {},
57
66
  fromLine: 0,
58
- toLine: paraMeasure.lines.length
67
+ toLine: contentMeasure.lines.length
59
68
  };
60
- const prevBorders = block.content[i - 1]?.attrs?.borders;
61
- const nextBorders = block.content[i + 1]?.attrs?.borders;
62
- const paraEl = renderParagraphFragment(paraFragment, paraBlock, paraMeasure, context, {
69
+ const previousBlock = block.content[i - 1];
70
+ const nextBlock = block.content[i + 1];
71
+ const prevBorders = previousBlock?.kind === "paragraph" ? previousBlock.attrs?.borders : void 0;
72
+ const nextBorders = nextBlock?.kind === "paragraph" ? nextBlock.attrs?.borders : void 0;
73
+ const paraEl = renderParagraphFragment(paraFragment, contentBlock, contentMeasure, context, {
63
74
  document: doc,
64
75
  ...prevBorders !== void 0 ? { prevBorders } : {},
65
76
  ...nextBorders !== void 0 ? { nextBorders } : {}
@@ -1,7 +1,7 @@
1
+ import { resetAuthorColors } from "../utils/authorColors.js";
1
2
  import { loadFontsWithMapping } from "../utils/fontLoader.js";
2
3
  import { parseDocx } from "../docx/parser.js";
3
4
  import { inspectDocxCompatibility } from "../docx/compatibility.js";
4
- import { resetAuthorColors } from "../utils/authorColors.js";
5
5
  import { recordDocumentLoadPhase } from "../layout-engine/layoutInstrumentation.js";
6
6
  //#region src/managers/DocumentLoaderManager.ts
7
7
  /**
@@ -37,6 +37,14 @@ declare class FindReplaceManager<TMatch extends FindMatchPosition> {
37
37
  match: TMatch;
38
38
  index: number;
39
39
  } | null;
40
+ /**
41
+ * Move the cursor to an explicit match index. Returns the selected match, or
42
+ * null when there is no active result or the index is out of bounds.
43
+ */
44
+ goTo(index: number): {
45
+ match: TMatch;
46
+ index: number;
47
+ } | null;
40
48
  /**
41
49
  * Replace the current match's text. Returns the new document, or null when
42
50
  * there is no current match or the replace fails.
@@ -61,6 +61,24 @@ var FindReplaceManager = class {
61
61
  } : null;
62
62
  }
63
63
  /**
64
+ * Move the cursor to an explicit match index. Returns the selected match, or
65
+ * null when there is no active result or the index is out of bounds.
66
+ */
67
+ goTo(index) {
68
+ const result = this.result;
69
+ if (!result || index < 0 || index >= result.matches.length) return null;
70
+ const match = result.matches.at(index);
71
+ if (!match) return null;
72
+ this.result = {
73
+ ...result,
74
+ currentIndex: index
75
+ };
76
+ return {
77
+ match,
78
+ index
79
+ };
80
+ }
81
+ /**
64
82
  * Replace the current match's text. Returns the new document, or null when
65
83
  * there is no current match or the replace fails.
66
84
  */
@@ -52,6 +52,12 @@ type TableActionResult = {
52
52
  };
53
53
  declare class TableSelectionManager extends Subscribable<TableSelectionState> {
54
54
  constructor();
55
+ /**
56
+ * Track cell coordinates before a document model is available. This supports
57
+ * adapter pointer state without fabricating a table context; callers that
58
+ * need structural operations should use {@link selectCell} with a document.
59
+ */
60
+ selectCellCoordinates(coords: CellCoordinates): void;
55
61
  /**
56
62
  * Select a cell within `doc`. Resolves the table at `coords.tableIndex` and
57
63
  * derives the full {@link TableContext}. Returns the context, or `null` (and
@@ -107,6 +107,20 @@ var TableSelectionManager = class extends Subscribable {
107
107
  super(EMPTY_SELECTION);
108
108
  }
109
109
  /**
110
+ * Track cell coordinates before a document model is available. This supports
111
+ * adapter pointer state without fabricating a table context; callers that
112
+ * need structural operations should use {@link selectCell} with a document.
113
+ */
114
+ selectCellCoordinates(coords) {
115
+ this.setSnapshot({
116
+ context: null,
117
+ table: null,
118
+ tableIndex: coords.tableIndex,
119
+ rowIndex: coords.rowIndex,
120
+ columnIndex: coords.columnIndex
121
+ });
122
+ }
123
+ /**
110
124
  * Select a cell within `doc`. Resolves the table at `coords.tableIndex` and
111
125
  * derives the full {@link TableContext}. Returns the context, or `null` (and
112
126
  * clears the selection) when that table no longer exists.
package/dist/model.js CHANGED
@@ -1,4 +1,4 @@
1
- import { deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
2
1
  import { BORDER_STYLE_VALUES, CONDITIONAL_STYLE_TYPE_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIASES, OUTLINE_STYLE_CSS_ALIAS_VALUES, PARAGRAPH_ALIGNMENT_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_OUTLINE_STYLE_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES } from "./types/documentEnumValues.js";
2
+ import { deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
3
3
  import { types_exports } from "./layout-engine/types.js";
4
4
  export { BORDER_STYLE_VALUES, CONDITIONAL_STYLE_TYPE_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, types_exports as Layout, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIASES, OUTLINE_STYLE_CSS_ALIAS_VALUES, PARAGRAPH_ALIGNMENT_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_OUTLINE_STYLE_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isFolioBlockId, isSequentialFolioBlockId };
@@ -1,5 +1,5 @@
1
1
  import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "../schema/nodes.js";
2
- import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
2
+ import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
3
3
  import { Mark, Node } from "prosemirror-model";
4
4
 
5
5
  //#region src/prosemirror/attrs/index.d.ts
@@ -68,6 +68,8 @@ declare const readCommentMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<C
68
68
  declare const expectCommentMarkAttrs: (mark: Mark) => CommentAttrs;
69
69
  declare const readTrackedChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<TrackedChangeMarkAttrs>;
70
70
  declare const expectTrackedChangeMarkAttrs: (mark: Mark) => TrackedChangeMarkAttrs;
71
+ declare const readRunPropertyChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunPropertyChangeMarkAttrs>;
72
+ declare const expectRunPropertyChangeMarkAttrs: (mark: Mark) => RunPropertyChangeMarkAttrs;
71
73
  declare const readRunFormattingOverrideMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunFormattingOverrideAttrs>;
72
74
  declare const expectRunFormattingOverrideMarkAttrs: (mark: Mark) => RunFormattingOverrideAttrs;
73
75
  declare const readHyperlinkMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<HyperlinkAttrs>;
@@ -79,4 +81,4 @@ declare const mergeTableAttrs: (node: Node, patch: NodeAttrPatch<TableAttrs>) =>
79
81
  declare const mergeTableRowAttrs: (node: Node, patch: NodeAttrPatch<TableRowAttrs>) => TableRowAttrs;
80
82
  declare const mergeTableCellAttrs: (node: Node, patch: NodeAttrPatch<TableCellAttrs>) => TableCellAttrs;
81
83
  //#endregion
82
- export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
84
+ export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
@@ -67,6 +67,12 @@ const NOTE_TYPES = ["footnote", "endnote"];
67
67
  const NOTE_REF_VERT_ALIGNS = ["baseline", "superscript"];
68
68
  const TEXT_BOX_DOCX_PLACEMENTS = ["standalone", "inlineWithPrevious"];
69
69
  const TRACKED_CHANGE_MOVE_KINDS = ["moveTo", "moveFrom"];
70
+ const TEXT_BOX_TRACKED_CHANGE_TYPES = [
71
+ "insertion",
72
+ "deletion",
73
+ "moveFrom",
74
+ "moveTo"
75
+ ];
70
76
  const HARD_BREAK_TYPES = ["column"];
71
77
  const RUN_FORMATTING_OVERRIDE_FALSE_KEYS = [
72
78
  "bold",
@@ -136,6 +142,7 @@ const textEffectAttrsCache = /* @__PURE__ */ new WeakMap();
136
142
  const footnoteRefAttrsCache = /* @__PURE__ */ new WeakMap();
137
143
  const commentAttrsCache = /* @__PURE__ */ new WeakMap();
138
144
  const trackedChangeAttrsCache = /* @__PURE__ */ new WeakMap();
145
+ const runPropertyChangeAttrsCache = /* @__PURE__ */ new WeakMap();
139
146
  const runFormattingOverrideAttrsCache = /* @__PURE__ */ new WeakMap();
140
147
  const hyperlinkAttrsCache = /* @__PURE__ */ new WeakMap();
141
148
  const readParagraphAttrs = (node) => {
@@ -152,6 +159,7 @@ const readParagraphAttrs = (node) => {
152
159
  optionalNumber(attrs, "spaceBefore", "paragraph.attrs.spaceBefore", issues);
153
160
  optionalNumber(attrs, "spaceAfter", "paragraph.attrs.spaceAfter", issues);
154
161
  optionalNumber(attrs, "lineSpacing", "paragraph.attrs.lineSpacing", issues);
162
+ optionalBoolean(attrs, "snapToGrid", "paragraph.attrs.snapToGrid", issues);
155
163
  optionalOneOf(attrs, "lineSpacingRule", "paragraph.attrs.lineSpacingRule", issues, LINE_SPACING_RULE_VALUES);
156
164
  optionalNumber(attrs, "indentLeft", "paragraph.attrs.indentLeft", issues);
157
165
  optionalNumber(attrs, "indentRight", "paragraph.attrs.indentRight", issues);
@@ -178,6 +186,7 @@ const readParagraphAttrs = (node) => {
178
186
  optionalNumber(attrs, "listStartOverride", "paragraph.attrs.listStartOverride", issues);
179
187
  optionalBoolean(attrs, "pageBreakBefore", "paragraph.attrs.pageBreakBefore", issues);
180
188
  optionalBoolean(attrs, "renderedPageBreakBefore", "paragraph.attrs.renderedPageBreakBefore", issues);
189
+ optionalBoolean(attrs, "_trailingPageBreak", "paragraph.attrs._trailingPageBreak", issues);
181
190
  optionalBoolean(attrs, "runInWithNext", "paragraph.attrs.runInWithNext", issues);
182
191
  optionalBoolean(attrs, "keepNext", "paragraph.attrs.keepNext", issues);
183
192
  optionalBoolean(attrs, "keepLines", "paragraph.attrs.keepLines", issues);
@@ -203,6 +212,7 @@ const readParagraphAttrs = (node) => {
203
212
  optionalTabStops(attrs, "tabs", "paragraph.attrs.tabs", issues);
204
213
  optionalRecord(attrs, "spacingExplicit", "paragraph.attrs.spacingExplicit", issues);
205
214
  optionalRecord(attrs, "spacingFromDocDefaults", "paragraph.attrs.spacingFromDocDefaults", issues);
215
+ optionalRecord(attrs, "spacingFromImplicitDefaultStyle", "paragraph.attrs.spacingFromImplicitDefaultStyle", issues);
206
216
  optionalTextFormatting(attrs, "defaultTextFormatting", "paragraph.attrs.defaultTextFormatting", issues);
207
217
  optionalRecord(attrs, "numPr", "paragraph.attrs.numPr", issues);
208
218
  validateNumPr(attrs["numPr"], issues);
@@ -255,6 +265,12 @@ const readTableRowAttrs = (node) => {
255
265
  optionalBoolean(attrs, "isHeader", "tableRow.attrs.isHeader", issues);
256
266
  optionalBoolean(attrs, "hidden", "tableRow.attrs.hidden", issues);
257
267
  optionalRecord(attrs, "_originalFormatting", "tableRow.attrs._originalFormatting", issues);
268
+ optionalTableRowRevision(attrs, "trIns", issues);
269
+ optionalTableRowRevision(attrs, "trDel", issues);
270
+ if (attrs["trIns"] != null && attrs["trDel"] != null) issues.push({
271
+ path: "tableRow.attrs",
272
+ message: "Expected at most one structural revision marker."
273
+ });
258
274
  return attrsResult(attrs, issues);
259
275
  };
260
276
  const expectTableRowAttrs = (node) => expectCachedNodeAttrs(node, tableRowAttrsCache, readTableRowAttrs, "table row attrs");
@@ -272,6 +288,7 @@ const readTableCellAttrs = (node) => {
272
288
  optionalString(attrs, "_resolvedBackgroundColor", "tableCell.attrs._resolvedBackgroundColor", issues);
273
289
  optionalOneOf(attrs, "textDirection", "tableCell.attrs.textDirection", issues, TABLE_CELL_TEXT_DIRECTION_VALUES);
274
290
  optionalBoolean(attrs, "noWrap", "tableCell.attrs.noWrap", issues);
291
+ optionalBoolean(attrs, "hideMark", "tableCell.attrs.hideMark", issues);
275
292
  optionalBorderMap(attrs, "borders", "tableCell.attrs.borders", issues, [
276
293
  "top",
277
294
  "bottom",
@@ -282,6 +299,7 @@ const readTableCellAttrs = (node) => {
282
299
  ]);
283
300
  optionalInsetMap(attrs, "margins", "tableCell.attrs.margins", issues);
284
301
  optionalRecord(attrs, "_originalFormatting", "tableCell.attrs._originalFormatting", issues);
302
+ optionalTableCellRevision(attrs, issues);
285
303
  optionalBoolean(attrs, "_preserveVMergeRestart", "tableCell.attrs._preserveVMergeRestart", issues);
286
304
  optionalArray(attrs, "_docxVMergeContinuationCells", "tableCell.attrs._docxVMergeContinuationCells", issues);
287
305
  return attrsResult(attrs, issues);
@@ -344,20 +362,7 @@ const readSdtAttrs = (node) => {
344
362
  const attrs = attrsRecord(node.attrs);
345
363
  const issues = [];
346
364
  expectNodeType(node, "sdt", issues);
347
- requiredOneOf(attrs, "sdtType", "sdt.attrs.sdtType", issues, SDT_TYPE_VALUES);
348
- optionalString(attrs, "alias", "sdt.attrs.alias", issues);
349
- optionalString(attrs, "tag", "sdt.attrs.tag", issues);
350
- optionalNumber(attrs, "id", "sdt.attrs.id", issues);
351
- optionalOneOf(attrs, "lock", "sdt.attrs.lock", issues, SDT_LOCK_VALUES);
352
- optionalString(attrs, "placeholder", "sdt.attrs.placeholder", issues);
353
- optionalBoolean(attrs, "showingPlaceholder", "sdt.attrs.showingPlaceholder", issues);
354
- optionalString(attrs, "dateFormat", "sdt.attrs.dateFormat", issues);
355
- optionalString(attrs, "dateValueISO", "sdt.attrs.dateValueISO", issues);
356
- optionalSdtListItems(attrs, "listItems", "sdt.attrs.listItems", issues);
357
- optionalString(attrs, "dropdownLastValue", "sdt.attrs.dropdownLastValue", issues);
358
- optionalBoolean(attrs, "checked", "sdt.attrs.checked", issues);
359
- optionalString(attrs, "rawPropertiesXml", "sdt.attrs.rawPropertiesXml", issues);
360
- optionalString(attrs, "rawEndPropertiesXml", "sdt.attrs.rawEndPropertiesXml", issues);
365
+ validateSdtAttrsRecord(attrs, "sdt.attrs", issues);
361
366
  return attrsResult(attrs, issues);
362
367
  };
363
368
  const expectSdtAttrs = (node) => expectCachedNodeAttrs(node, sdtAttrsCache, readSdtAttrs, "sdt attrs");
@@ -452,6 +457,9 @@ const readTextBoxAttrs = (node) => {
452
457
  optionalImagePosition(attrs, "position", "textBox.attrs.position", issues);
453
458
  optionalOneOf(attrs, "_docxPlacement", "textBox.attrs._docxPlacement", issues, TEXT_BOX_DOCX_PLACEMENTS);
454
459
  optionalString(attrs, "_docxGroupId", "textBox.attrs._docxGroupId", issues);
460
+ optionalString(attrs, "_docxAnchorId", "textBox.attrs._docxAnchorId", issues);
461
+ optionalTextBoxTrackedChange(attrs, issues);
462
+ optionalTextBoxInlineSdts(attrs, issues);
455
463
  return attrsResult(attrs, issues);
456
464
  };
457
465
  const expectTextBoxAttrs = (node) => expectCachedNodeAttrs(node, textBoxAttrsCache, readTextBoxAttrs, "text box attrs");
@@ -596,6 +604,14 @@ const readTrackedChangeMarkAttrs = (mark) => {
596
604
  return attrsResult(attrs, issues);
597
605
  };
598
606
  const expectTrackedChangeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, trackedChangeAttrsCache, readTrackedChangeMarkAttrs, "tracked change attrs");
607
+ const readRunPropertyChangeMarkAttrs = (mark) => {
608
+ const attrs = attrsRecord(mark.attrs);
609
+ const issues = [];
610
+ expectMarkType(mark, "runPropertyChange", issues);
611
+ optionalPropertyChanges(attrs, "changes", "runPropertyChange.attrs.changes", issues, ["runPropertyChange"]);
612
+ return attrsResult(attrs, issues);
613
+ };
614
+ const expectRunPropertyChangeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, runPropertyChangeAttrsCache, readRunPropertyChangeMarkAttrs, "run property change attrs");
599
615
  const readRunFormattingOverrideMarkAttrs = (mark) => {
600
616
  const attrs = attrsRecord(mark.attrs);
601
617
  const issues = [];
@@ -640,11 +656,23 @@ const attrsResult = (attrs, issues) => {
640
656
  ok: false,
641
657
  issues
642
658
  };
643
- const normalizedAttrs = {};
644
- for (const [key, value] of Object.entries(attrs)) if (value !== null) normalizedAttrs[key] = value;
659
+ let normalizedAttrs;
645
660
  return {
646
661
  ok: true,
647
- value: normalizedAttrs
662
+ get value() {
663
+ if (normalizedAttrs !== void 0) return normalizedAttrs;
664
+ const presentAttrs = {};
665
+ for (const key in attrs) {
666
+ if (!Object.hasOwn(attrs, key)) continue;
667
+ const value = attrs[key];
668
+ if (value !== null) presentAttrs[key] = value;
669
+ }
670
+ normalizedAttrs = presentAttrs;
671
+ return normalizedAttrs;
672
+ },
673
+ set value(value) {
674
+ normalizedAttrs = value;
675
+ }
648
676
  };
649
677
  };
650
678
  const expectAttrs = (result, label) => {
@@ -892,6 +920,114 @@ const optionalRecord = (attrs, key, path, issues) => {
892
920
  message: "Expected an object."
893
921
  });
894
922
  };
923
+ const optionalTableRowRevision = (attrs, key, issues) => {
924
+ const value = attrs[key];
925
+ if (value === void 0 || value === null) return;
926
+ const path = `tableRow.attrs.${key}`;
927
+ if (!isRecord(value)) {
928
+ issues.push({
929
+ path,
930
+ message: "Expected an object."
931
+ });
932
+ return;
933
+ }
934
+ requiredNumber(value, "revisionId", `${path}.revisionId`, issues);
935
+ requiredString(value, "author", `${path}.author`, issues);
936
+ optionalString(value, "date", `${path}.date`, issues);
937
+ };
938
+ const optionalTableCellRevision = (attrs, issues) => {
939
+ const value = attrs["cellMarker"];
940
+ if (value === void 0 || value === null) return;
941
+ const path = "tableCell.attrs.cellMarker";
942
+ if (!isRecord(value)) {
943
+ issues.push({
944
+ path,
945
+ message: "Expected an object."
946
+ });
947
+ return;
948
+ }
949
+ requiredOneOf(value, "kind", `${path}.kind`, issues, [
950
+ "ins",
951
+ "del",
952
+ "merge"
953
+ ]);
954
+ const info = value["info"];
955
+ if (!isRecord(info)) {
956
+ issues.push({
957
+ path: `${path}.info`,
958
+ message: "Expected an object."
959
+ });
960
+ return;
961
+ }
962
+ requiredNumber(info, "revisionId", `${path}.info.revisionId`, issues);
963
+ requiredString(info, "author", `${path}.info.author`, issues);
964
+ optionalString(info, "date", `${path}.info.date`, issues);
965
+ if (value["kind"] === "merge") {
966
+ optionalOneOf(value, "verticalMerge", `${path}.verticalMerge`, issues, ["continue", "rest"]);
967
+ optionalOneOf(value, "verticalMergeOriginal", `${path}.verticalMergeOriginal`, issues, ["continue", "rest"]);
968
+ }
969
+ };
970
+ const optionalTextBoxTrackedChange = (attrs, issues) => {
971
+ const value = attrs["_docxTrackedChange"];
972
+ if (value === void 0 || value === null) return;
973
+ if (!isRecord(value)) {
974
+ issues.push({
975
+ path: "textBox.attrs._docxTrackedChange",
976
+ message: "Expected an object."
977
+ });
978
+ return;
979
+ }
980
+ requiredOneOf(value, "type", "textBox.attrs._docxTrackedChange.type", issues, TEXT_BOX_TRACKED_CHANGE_TYPES);
981
+ const info = value["info"];
982
+ if (!isRecord(info)) {
983
+ issues.push({
984
+ path: "textBox.attrs._docxTrackedChange.info",
985
+ message: "Expected an object."
986
+ });
987
+ return;
988
+ }
989
+ requiredNumber(info, "id", "textBox.attrs._docxTrackedChange.info.id", issues);
990
+ requiredString(info, "author", "textBox.attrs._docxTrackedChange.info.author", issues);
991
+ optionalString(info, "date", "textBox.attrs._docxTrackedChange.info.date", issues);
992
+ };
993
+ const optionalTextBoxInlineSdts = (attrs, issues) => {
994
+ const value = attrs["_docxInlineSdts"];
995
+ if (value === void 0 || value === null) return;
996
+ if (!Array.isArray(value)) {
997
+ issues.push({
998
+ path: "textBox.attrs._docxInlineSdts",
999
+ message: "Expected an array."
1000
+ });
1001
+ return;
1002
+ }
1003
+ for (const [index, item] of value.entries()) {
1004
+ const path = `textBox.attrs._docxInlineSdts[${index}]`;
1005
+ if (!isRecord(item)) {
1006
+ issues.push({
1007
+ path,
1008
+ message: "Expected an object."
1009
+ });
1010
+ continue;
1011
+ }
1012
+ validateSdtAttrsRecord(item, path, issues);
1013
+ }
1014
+ };
1015
+ const validateSdtAttrsRecord = (attrs, path, issues) => {
1016
+ requiredOneOf(attrs, "sdtType", `${path}.sdtType`, issues, SDT_TYPE_VALUES);
1017
+ optionalString(attrs, "alias", `${path}.alias`, issues);
1018
+ optionalString(attrs, "tag", `${path}.tag`, issues);
1019
+ optionalNumber(attrs, "id", `${path}.id`, issues);
1020
+ optionalOneOf(attrs, "lock", `${path}.lock`, issues, SDT_LOCK_VALUES);
1021
+ optionalString(attrs, "placeholder", `${path}.placeholder`, issues);
1022
+ optionalBoolean(attrs, "showingPlaceholder", `${path}.showingPlaceholder`, issues);
1023
+ optionalString(attrs, "dateFormat", `${path}.dateFormat`, issues);
1024
+ optionalString(attrs, "dateValueISO", `${path}.dateValueISO`, issues);
1025
+ optionalSdtListItems(attrs, "listItems", `${path}.listItems`, issues);
1026
+ optionalString(attrs, "dropdownLastValue", `${path}.dropdownLastValue`, issues);
1027
+ optionalBoolean(attrs, "checked", `${path}.checked`, issues);
1028
+ optionalString(attrs, "rawPropertiesXml", `${path}.rawPropertiesXml`, issues);
1029
+ optionalString(attrs, "rawEndPropertiesXml", `${path}.rawEndPropertiesXml`, issues);
1030
+ };
895
1031
  const optionalAutospacingBase = (attrs, issues) => {
896
1032
  const value = attrs["_autospacingBase"];
897
1033
  if (value === void 0 || value === null) return;
@@ -1249,4 +1385,4 @@ const optionalEmptyHyperlinkArray = (value, issues) => {
1249
1385
  }
1250
1386
  };
1251
1387
  //#endregion
1252
- export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
1388
+ export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
@@ -39,12 +39,12 @@ declare function acceptAllChanges(): Command;
39
39
  */
40
40
  declare function rejectAllChanges(): Command;
41
41
  /**
42
- * Find the document range covered by all insertion/deletion marks
42
+ * Find the document range covered by all inline revision marks
43
43
  * carrying any of the given AI-edit `revisionIds`. Returns null when
44
44
  * none of those marks are present (already accepted/rejected, or
45
45
  * never existed). A replace operation typically passes two ids (one
46
46
  * for its deletion side, one for its insertion side); inserts and
47
- * standalone deletions pass a single id.
47
+ * standalone deletions and formatting changes pass a single id.
48
48
  */
49
49
  declare function findAIEditRevisionRange(state: EditorState, revisionIds: number | readonly number[]): {
50
50
  from: number;
@@ -52,7 +52,7 @@ declare function findAIEditRevisionRange(state: EditorState, revisionIds: number
52
52
  } | null;
53
53
  /**
54
54
  * Accept the tracked-change marks belonging to an AI-edit operation.
55
- * Pass a single revisionId for inserts/standalone deletions, or the
55
+ * Pass a single revisionId for inserts, standalone deletions, or formatting changes; or the
56
56
  * full id list for a replace (one id per side). Returns false when
57
57
  * none of the ids match anything in the doc.
58
58
  */