@stll/folio-core 0.51.0 → 0.53.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 (316) hide show
  1. package/README.md +23 -0
  2. package/dist/ai-edits/apply.d.ts +26 -1
  3. package/dist/ai-edits/apply.js +1519 -105
  4. package/dist/ai-edits/batch-claims.d.ts +130 -0
  5. package/dist/ai-edits/batch-claims.js +244 -0
  6. package/dist/ai-edits/blockRange.js +9 -3
  7. package/dist/ai-edits/character-boundaries.d.ts +43 -0
  8. package/dist/ai-edits/character-boundaries.js +95 -0
  9. package/dist/ai-edits/clean-text.d.ts +33 -3
  10. package/dist/ai-edits/clean-text.js +52 -6
  11. package/dist/ai-edits/comment-lifecycle.d.ts +18 -0
  12. package/dist/ai-edits/comment-lifecycle.js +52 -0
  13. package/dist/ai-edits/headless.d.ts +71 -7
  14. package/dist/ai-edits/headless.js +381 -41
  15. package/dist/ai-edits/index.d.ts +2 -1
  16. package/dist/ai-edits/index.js +2 -1
  17. package/dist/ai-edits/minimal-replacement.d.ts +21 -6
  18. package/dist/ai-edits/minimal-replacement.js +134 -15
  19. package/dist/ai-edits/newListNumbering.d.ts +23 -0
  20. package/dist/ai-edits/newListNumbering.js +94 -0
  21. package/dist/ai-edits/note-references.d.ts +96 -0
  22. package/dist/ai-edits/note-references.js +139 -0
  23. package/dist/ai-edits/pending-suggestions.d.ts +79 -0
  24. package/dist/ai-edits/pending-suggestions.js +306 -0
  25. package/dist/ai-edits/read.d.ts +1 -1
  26. package/dist/ai-edits/read.js +56 -43
  27. package/dist/ai-edits/result-validation.d.ts +29 -0
  28. package/dist/ai-edits/result-validation.js +164 -0
  29. package/dist/ai-edits/snapshot.d.ts +36 -3
  30. package/dist/ai-edits/snapshot.js +177 -23
  31. package/dist/ai-edits/table-cell-mutations.d.ts +1 -1
  32. package/dist/ai-edits/table-cell-mutations.js +4 -1
  33. package/dist/ai-edits/table-geometry.d.ts +1 -1
  34. package/dist/ai-edits/table-row-column-mutations.d.ts +38 -16
  35. package/dist/ai-edits/table-row-column-mutations.js +61 -26
  36. package/dist/ai-edits/types.d.ts +155 -16
  37. package/dist/compare/compare.d.ts +1 -1
  38. package/dist/compare/compare.js +65 -16
  39. package/dist/compare/content-alignment.js +13 -2
  40. package/dist/compare/content-types.d.ts +7 -0
  41. package/dist/compare/content.d.ts +4 -1
  42. package/dist/compare/content.js +6 -1
  43. package/dist/compare/formatting.js +2 -1
  44. package/dist/compare/inline-atoms.d.ts +21 -4
  45. package/dist/compare/inline-atoms.js +138 -16
  46. package/dist/compare/inline-provenance.js +18 -22
  47. package/dist/compare/plan.js +10 -5
  48. package/dist/compare/scenario.js +14 -3
  49. package/dist/compare/section-boundary-properties.js +14 -1
  50. package/dist/compare/types.d.ts +4 -2
  51. package/dist/compare/types.js +2 -1
  52. package/dist/compare/verification.d.ts +1 -1
  53. package/dist/compare/verification.js +15 -3
  54. package/dist/controller/committedLayoutDiff.d.ts +25 -0
  55. package/dist/controller/committedLayoutDiff.js +71 -0
  56. package/dist/controller/contentControlWidgetController.d.ts +1 -1
  57. package/dist/controller/folioEditor.d.ts +1 -1
  58. package/dist/controller/fontReadiness.d.ts +70 -3
  59. package/dist/controller/fontReadiness.js +100 -10
  60. package/dist/controller/headerFooterEditorManager.js +6 -1
  61. package/dist/controller/layoutPipeline.d.ts +12 -10
  62. package/dist/controller/layoutPipeline.js +62 -9
  63. package/dist/controller/layoutRunOptions.d.ts +24 -0
  64. package/dist/controller/layoutRunOptions.js +17 -0
  65. package/dist/controller/layoutScheduler.d.ts +19 -14
  66. package/dist/controller/layoutScheduler.js +15 -12
  67. package/dist/controller/layoutSession.d.ts +26 -2
  68. package/dist/controller/layoutSession.js +1 -1
  69. package/dist/controller/noteEditorManager.js +8 -3
  70. package/dist/document-operations.d.ts +11 -2
  71. package/dist/document-operations.js +230 -21
  72. package/dist/docx/altChunk.d.ts +8 -0
  73. package/dist/docx/altChunk.js +17 -0
  74. package/dist/docx/attributeRemainder.d.ts +1 -1
  75. package/dist/docx/blockContentParser.d.ts +64 -1
  76. package/dist/docx/blockContentParser.js +17 -4
  77. package/dist/docx/blockCustomXmlShell.d.ts +7 -0
  78. package/dist/docx/blockCustomXmlShell.js +14 -0
  79. package/dist/docx/blockPlainText.js +7 -0
  80. package/dist/docx/commentAnchorIndex.js +1 -1
  81. package/dist/docx/commentRangeIntegrity.js +8 -3
  82. package/dist/docx/commentReferenceNormalization.js +1 -1
  83. package/dist/docx/commentReplyMarkers.js +20 -1
  84. package/dist/docx/compatibility.d.ts +1 -1
  85. package/dist/docx/compatibility.js +34 -13
  86. package/dist/docx/containerChildren.gen.d.ts +1 -1
  87. package/dist/docx/containerChildren.gen.js +1 -0
  88. package/dist/docx/documentParser.js +12 -12
  89. package/dist/docx/drawingIdNormalization.d.ts +3 -1
  90. package/dist/docx/drawingIdNormalization.js +6 -1
  91. package/dist/docx/ensureParaIds.js +119 -97
  92. package/dist/docx/footnoteParser.js +8 -4
  93. package/dist/docx/headerFooterParser.js +3 -3
  94. package/dist/docx/headerFooterReferenceNormalization.d.ts +20 -1
  95. package/dist/docx/headerFooterReferenceNormalization.js +52 -27
  96. package/dist/docx/hyperlinkParser.d.ts +1 -1
  97. package/dist/docx/index.d.ts +1 -1
  98. package/dist/docx/listNumberingInstances.d.ts +59 -0
  99. package/dist/docx/listNumberingInstances.js +249 -0
  100. package/dist/docx/normalizeBaseDirection.js +2 -1
  101. package/dist/docx/opaqueCarrier.d.ts +7 -0
  102. package/dist/docx/opaqueCarrier.js +38 -0
  103. package/dist/docx/packageParts.js +4 -1
  104. package/dist/docx/paragraphParser.js +91 -24
  105. package/dist/docx/paragraphPropertySource.d.ts +4 -2
  106. package/dist/docx/paragraphPropertySource.js +7 -1
  107. package/dist/docx/paragraphTraversal.js +1 -0
  108. package/dist/docx/parseWarningMessage.js +4 -1
  109. package/dist/docx/parser.js +173 -20
  110. package/dist/docx/rezip.js +27 -5
  111. package/dist/docx/sdtProperties.js +1 -1
  112. package/dist/docx/sdtPropertiesPatch.js +3 -0
  113. package/dist/docx/selectiveSave.js +16 -9
  114. package/dist/docx/selectiveXmlPatch.js +106 -37
  115. package/dist/docx/serializer/blockCustomXmlSerializer.d.ts +5 -0
  116. package/dist/docx/serializer/blockCustomXmlSerializer.js +4 -0
  117. package/dist/docx/serializer/documentSerializer.js +2 -0
  118. package/dist/docx/serializer/headerFooterSerializer.js +2 -0
  119. package/dist/docx/serializer/noteSerializer.js +3 -1
  120. package/dist/docx/serializer/paragraphSerializer.js +33 -9
  121. package/dist/docx/serializer/tableSerializer.js +25 -38
  122. package/dist/docx/server/createBilingualDocument.js +3 -3
  123. package/dist/docx/tableParser.d.ts +157 -1
  124. package/dist/docx/tableParser.js +89 -10
  125. package/dist/docx/textBoxParser.js +1 -1
  126. package/dist/docx/unzip.d.ts +2 -1
  127. package/dist/docx/unzip.js +1 -1
  128. package/dist/docx/wordprocessingPrefixes.d.ts +78 -0
  129. package/dist/docx/wordprocessingPrefixes.js +286 -0
  130. package/dist/generated/text_shaper.js +26 -0
  131. package/dist/generated/text_shaper_bg.wasm +0 -0
  132. package/dist/i18n/messages/catalogs.gen.d.ts +136 -0
  133. package/dist/i18n/messages/catalogs.gen.js +153 -17
  134. package/dist/i18n/messages/messages.gen.d.ts +8 -0
  135. package/dist/internal/compare/inline-presentation.d.ts +2 -1
  136. package/dist/internal/compare/inline-presentation.js +11 -10
  137. package/dist/internal/headlessRevisionResolutionGuard.d.ts +2 -8
  138. package/dist/internal/headlessRevisionResolutionGuard.js +2 -11
  139. package/dist/internal/indexedPositionMap.d.ts +11 -0
  140. package/dist/internal/indexedPositionMap.js +42 -0
  141. package/dist/internal/pageBreakRunSourceDescendantIndex.js +2 -1
  142. package/dist/internal/revisionResolutionEdits.d.ts +13 -0
  143. package/dist/internal/revisionResolutionEdits.js +19 -0
  144. package/dist/internal/revisionResolutionInline.d.ts +24 -0
  145. package/dist/internal/{headlessRevisionResolution.js → revisionResolutionInline.js} +61 -43
  146. package/dist/internal/revisionResolutionStep.d.ts +34 -0
  147. package/dist/internal/revisionResolutionStep.js +282 -0
  148. package/dist/internal/revisionResolutionTracking.d.ts +11 -0
  149. package/dist/internal/revisionResolutionTracking.js +124 -0
  150. package/dist/internal/wholeStoryRevisionResolution.d.ts +56 -0
  151. package/dist/internal/wholeStoryRevisionResolution.js +530 -0
  152. package/dist/layout-bridge/convert/markupViewFlow.d.ts +20 -0
  153. package/dist/layout-bridge/convert/markupViewFlow.js +123 -0
  154. package/dist/layout-bridge/convert/tableConversion.js +1 -1
  155. package/dist/layout-bridge/convert/toFlowBlocks.js +10 -1
  156. package/dist/layout-engine/layoutInstrumentation.d.ts +9 -1
  157. package/dist/layout-engine/layoutInstrumentation.js +4 -1
  158. package/dist/layout-engine/measure/cache.d.ts +18 -1
  159. package/dist/layout-engine/measure/cache.js +31 -1
  160. package/dist/layout-engine/measure/font-metrics.worker.js +3 -7
  161. package/dist/layout-engine/measure/measureContainer.js +7 -47
  162. package/dist/layout-engine/measure/measureHelpers.d.ts +6 -1
  163. package/dist/layout-engine/measure/measureHelpers.js +22 -2
  164. package/dist/layout-engine/measure/measureWorker.js +2 -3
  165. package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +6 -7
  166. package/dist/layout-engine/measure/measureWorkerProtocol.js +1 -2
  167. package/dist/layout-engine/types.d.ts +6 -0
  168. package/dist/layout-painter/renderPage.js +1 -0
  169. package/dist/layout-painter/renderParagraph.js +1 -1
  170. package/dist/managers/ContextMenuManager.js +5 -2
  171. package/dist/managers/types.d.ts +3 -0
  172. package/dist/markdown/fromMarkdown.js +2 -1
  173. package/dist/markdown/internals.d.ts +11 -1
  174. package/dist/markdown/internals.js +24 -3
  175. package/dist/markdown/renderBlock.js +39 -9
  176. package/dist/markdown/renderParagraph.d.ts +13 -1
  177. package/dist/markdown/renderParagraph.js +85 -38
  178. package/dist/markdown/renderRuns.js +3 -10
  179. package/dist/markdown/renderTable.js +24 -12
  180. package/dist/markdown/trailers.js +2 -2
  181. package/dist/markdown/types.d.ts +29 -7
  182. package/dist/paged-layout/incrementalMeasure.d.ts +1 -2
  183. package/dist/paged-layout/incrementalMeasure.js +1 -9
  184. package/dist/paged-layout/transactionDirtyRange.d.ts +1 -3
  185. package/dist/paged-layout/transactionDirtyRange.js +29 -41
  186. package/dist/panel-layout.d.ts +83 -0
  187. package/dist/panel-layout.js +96 -0
  188. package/dist/prosemirror/anchoredTextBoxes.d.ts +37 -0
  189. package/dist/prosemirror/anchoredTextBoxes.js +156 -0
  190. package/dist/prosemirror/attrs/index.d.ts +6 -2
  191. package/dist/prosemirror/attrs/index.js +172 -1
  192. package/dist/prosemirror/commands/comments.d.ts +7 -8
  193. package/dist/prosemirror/commands/comments.js +241 -207
  194. package/dist/prosemirror/commands/contentControls.d.ts +1 -1
  195. package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
  196. package/dist/prosemirror/commands/formatting.d.ts +1 -1
  197. package/dist/prosemirror/commands/index.d.ts +2 -2
  198. package/dist/prosemirror/commands/index.js +2 -2
  199. package/dist/prosemirror/commands/paragraph.d.ts +7 -1
  200. package/dist/prosemirror/commands/paragraph.js +9 -1
  201. package/dist/prosemirror/commands/paragraphBookmarkJoin.d.ts +13 -0
  202. package/dist/prosemirror/commands/paragraphBookmarkJoin.js +22 -0
  203. package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
  204. package/dist/prosemirror/commands/resolveAllTableChanges.d.ts +40 -0
  205. package/dist/prosemirror/commands/resolveAllTableChanges.js +615 -0
  206. package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.d.ts +15 -0
  207. package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.js +46 -0
  208. package/dist/prosemirror/commands/resolveParagraphProperties.d.ts +16 -0
  209. package/dist/prosemirror/commands/resolveParagraphProperties.js +59 -0
  210. package/dist/prosemirror/commands/sectionBreak.js +2 -1
  211. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +8 -2
  212. package/dist/prosemirror/commands/tableCellMergeResolution.js +1 -1
  213. package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
  214. package/dist/prosemirror/conversion/fromProseDoc.js +181 -31
  215. package/dist/prosemirror/conversion/toProseDoc.js +39 -4
  216. package/dist/prosemirror/emptyFieldResultRuns.d.ts +18 -0
  217. package/dist/prosemirror/emptyFieldResultRuns.js +33 -0
  218. package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
  219. package/dist/prosemirror/extensions/ExtensionManager.js +3 -1
  220. package/dist/prosemirror/extensions/StarterKit.js +3 -1
  221. package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
  222. package/dist/prosemirror/extensions/core/ParagraphExtension.js +12 -0
  223. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -0
  224. package/dist/prosemirror/extensions/features/ListExtension.js +161 -123
  225. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +19 -2
  226. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +33 -20
  227. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +31 -2
  228. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +270 -99
  229. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +3 -2
  230. package/dist/prosemirror/extensions/features/pasteCleanup.js +2 -1
  231. package/dist/prosemirror/extensions/features/pastedHtmlLists.d.ts +12 -0
  232. package/dist/prosemirror/extensions/features/pastedHtmlLists.js +126 -0
  233. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +21 -5
  234. package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +21 -18
  235. package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +37 -17
  236. package/dist/prosemirror/extensions/marks/markUtils.d.ts +7 -2
  237. package/dist/prosemirror/extensions/marks/markUtils.js +8 -2
  238. package/dist/prosemirror/extensions/marks/noteReferenceDeletion.d.ts +10 -0
  239. package/dist/prosemirror/extensions/marks/noteReferenceDeletion.js +35 -0
  240. package/dist/prosemirror/extensions/nodes/BlockCustomXmlExtension.d.ts +6 -0
  241. package/dist/prosemirror/extensions/nodes/BlockCustomXmlExtension.js +52 -0
  242. package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +3 -3
  243. package/dist/prosemirror/extensions/nodes/FieldExtension.js +50 -15
  244. package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +4 -1
  245. package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
  246. package/dist/prosemirror/extensions/nodes/TableExtension.js +19 -18
  247. package/dist/prosemirror/extensions/types.d.ts +4 -1
  248. package/dist/prosemirror/findReplaceSelection.js +1 -1
  249. package/dist/prosemirror/index.d.ts +3 -2
  250. package/dist/prosemirror/index.js +3 -2
  251. package/dist/prosemirror/indexedNodeLookup.d.ts +17 -0
  252. package/dist/prosemirror/indexedNodeLookup.js +103 -0
  253. package/dist/prosemirror/listAutoformatMarkers.d.ts +19 -0
  254. package/dist/prosemirror/listAutoformatMarkers.js +98 -0
  255. package/dist/prosemirror/listInstanceReferences.d.ts +12 -0
  256. package/dist/prosemirror/listInstanceReferences.js +72 -0
  257. package/dist/prosemirror/listLabels.d.ts +24 -0
  258. package/dist/prosemirror/listLabels.js +111 -0
  259. package/dist/prosemirror/listNumbering.d.ts +110 -0
  260. package/dist/prosemirror/listNumbering.js +345 -0
  261. package/dist/prosemirror/listRenderingAttrs.d.ts +11 -2
  262. package/dist/prosemirror/listRenderingAttrs.js +8 -1
  263. package/dist/prosemirror/markupViewProjection.d.ts +95 -0
  264. package/dist/prosemirror/markupViewProjection.js +83 -0
  265. package/dist/prosemirror/numberingAttr.d.ts +9 -1
  266. package/dist/prosemirror/numberingAttr.js +9 -1
  267. package/dist/prosemirror/outlineLevelAttr.js +1 -1
  268. package/dist/prosemirror/paragraphIndentation.d.ts +10 -1
  269. package/dist/prosemirror/paragraphIndentation.js +29 -7
  270. package/dist/prosemirror/paragraphMarkJoin.d.ts +19 -0
  271. package/dist/prosemirror/paragraphMarkJoin.js +24 -0
  272. package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
  273. package/dist/prosemirror/plugins/documentNumbering.d.ts +27 -1
  274. package/dist/prosemirror/plugins/documentNumbering.js +97 -11
  275. package/dist/prosemirror/plugins/documentStyles.d.ts +10 -1
  276. package/dist/prosemirror/plugins/documentStyles.js +14 -1
  277. package/dist/prosemirror/plugins/suggestionMode.d.ts +16 -2
  278. package/dist/prosemirror/plugins/suggestionMode.js +116 -52
  279. package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
  280. package/dist/prosemirror/plugins/transactionInvariants.d.ts +32 -0
  281. package/dist/prosemirror/plugins/transactionInvariants.js +86 -0
  282. package/dist/prosemirror/positionSweep.d.ts +24 -0
  283. package/dist/prosemirror/positionSweep.js +222 -0
  284. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -1
  285. package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
  286. package/dist/prosemirror/replacedAnnotations.d.ts +33 -1
  287. package/dist/prosemirror/replacedAnnotations.js +170 -1
  288. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
  289. package/dist/prosemirror/runStyleFormatting.d.ts +7 -1
  290. package/dist/prosemirror/runStyleFormatting.js +13 -7
  291. package/dist/prosemirror/schema/index.d.ts +2 -2
  292. package/dist/prosemirror/schema/index.js +3 -0
  293. package/dist/prosemirror/schema/nodes.d.ts +42 -11
  294. package/dist/prosemirror/sectionMarkEdits.d.ts +20 -0
  295. package/dist/prosemirror/sectionMarkEdits.js +59 -0
  296. package/dist/prosemirror/storyListNumbering.d.ts +17 -0
  297. package/dist/prosemirror/storyListNumbering.js +102 -0
  298. package/dist/prosemirror/tableGridMutation.d.ts +48 -2
  299. package/dist/prosemirror/tableGridMutation.js +106 -1
  300. package/dist/prosemirror/validation.js +5 -1
  301. package/dist/redline.js +93 -9
  302. package/dist/render-dom/BodySelectionOverlay.d.ts +4 -1
  303. package/dist/render-dom/BodySelectionOverlay.js +3 -2
  304. package/dist/shaping/shaper.d.ts +47 -4
  305. package/dist/shaping/shaper.js +46 -15
  306. package/dist/text-shaping.d.ts +4 -0
  307. package/dist/text-shaping.js +4 -0
  308. package/dist/utils/findReplace.js +2 -2
  309. package/dist/utils/mergeDocumentContent.js +1 -1
  310. package/dist/utils/noteReferenceLabels.d.ts +36 -0
  311. package/dist/utils/noteReferenceLabels.js +32 -0
  312. package/dist/utils/replaceText.js +1 -1
  313. package/dist/version-comparison.d.ts +1 -0
  314. package/dist/version-comparison.js +1 -0
  315. package/package.json +8 -2
  316. package/dist/internal/headlessRevisionResolution.d.ts +0 -23
@@ -56,6 +56,8 @@ type PreservedXmlAttrs = {
56
56
  type PreservedBlockAttrs = {
57
57
  /** Replayable markup, as `captureVerbatimXml` wrote it. */
58
58
  xml: string;
59
+ /** Plain text safely extracted from a related w:altChunk part, when available. */
60
+ readerText?: string;
59
61
  };
60
62
  type BookmarkBoundaryAttrs = {
61
63
  type: "start";
@@ -118,6 +120,13 @@ type ParagraphAttrs = {
118
120
  * `paragraphNumberingAttr`, so a model value cannot land here unconverted.
119
121
  */
120
122
  numPr?: ParagraphNumberingAttr;
123
+ /** Clipboard-only hint, replaced with a numbered paragraph before insertion. */
124
+ _pastedHtmlList?: {
125
+ group: number;
126
+ level: number;
127
+ kind: "bullet" | "numbered";
128
+ start?: number;
129
+ };
121
130
  /**
122
131
  * The style-sourced numPr value when `numPr` came from the paragraph
123
132
  * style rather than direct formatting. While `numPr` still equals this,
@@ -526,7 +535,7 @@ type ImageAttrs = {
526
535
  /**
527
536
  * Field node attributes
528
537
  */
529
- type FieldAttrs = {
538
+ type CommonFieldAttrs = {
530
539
  /** Field type: PAGE, NUMPAGES, DATE, MERGEFIELD, etc. */
531
540
  fieldType: document_d_exports.FieldType;
532
541
  /** Full field instruction (e.g. "PAGE \\* MERGEFORMAT") */
@@ -535,20 +544,30 @@ type FieldAttrs = {
535
544
  displayText: string;
536
545
  /** Imported cache that proved numbered REF resolution for this field. */
537
546
  _numberedRefBaseline?: string;
538
- /** Whether the field came from w:fldSimple or a complex fldChar range */
539
- fieldKind: "simple" | "complex";
540
547
  /** Field is locked */
541
548
  fldLock?: boolean;
542
549
  /** Field is dirty and should be recalculated by the host application */
543
550
  dirty?: boolean;
544
- /**
545
- * `displayText` is a rendering fallback folio synthesized (e.g. a legacy
546
- * `FORMCHECKBOX` with no cached result run), not authored content. A save
547
- * omits it from the field's result so an unedited field keeps its
548
- * original, resultless bytes. See `ComplexField.fieldResultIsFallback`.
549
- */
550
- fieldResultIsFallback?: boolean;
551
+ /** Authored empty result runs, which have no visible ProseMirror children. */
552
+ _docxEmptyResultRuns?: document_d_exports.Run[];
551
553
  };
554
+ type FieldAttrs = CommonFieldAttrs & ({
555
+ fieldKind: "simple";
556
+ fieldResultIsFallback?: never;
557
+ formFieldDataXml?: never;
558
+ _docxFieldCode?: never;
559
+ } | {
560
+ fieldKind: "complex";
561
+ /** Synthesized display text that must not become an authored result run. */
562
+ fieldResultIsFallback?: boolean;
563
+ /** Captured `w:ffData` on a complex field's begin character. */
564
+ formFieldDataXml?: string;
565
+ /** Source code runs; valid only while the instruction still matches. */
566
+ _docxFieldCode?: {
567
+ instruction: string;
568
+ runs: document_d_exports.Run[];
569
+ };
570
+ });
552
571
  /**
553
572
  * Math equation node attributes
554
573
  */
@@ -649,6 +668,12 @@ type BlockSdtAttrs = {
649
668
  /** Verbatim XML for sdt siblings after sdtContent (range markers). */
650
669
  rawSdtChildrenAfterContent?: string;
651
670
  };
671
+ /** Verbatim shell retained around editable block custom XML content. */
672
+ type BlockCustomXmlAttrs = {
673
+ openingXml: string;
674
+ closingXml: string;
675
+ _originallyEmpty: boolean;
676
+ };
652
677
  /**
653
678
  * The `mc:AlternateContent` a shape or text box was read from, with a
654
679
  * fingerprint of the node it was attached to. `fromProseDoc` hands the element
@@ -992,6 +1017,8 @@ type TableAttrs = {
992
1017
  * none and a copy does not inherit one.
993
1018
  */
994
1019
  _preserved?: document_d_exports.TablePreservedMarkup;
1020
+ /** Transparent table-level custom-XML wrappers, outermost first. */
1021
+ carrierStack?: document_d_exports.TableContentCarrier[];
995
1022
  /**
996
1023
  * Marks this whole table as a *suggested* insertion (AI proposal). The table
997
1024
  * is dropped from serialized DOCX until accepted; because OOXML has no tracked
@@ -1054,6 +1081,8 @@ type TableRowAttrs = {
1054
1081
  * name the same control. See `TableRow.contentControls`.
1055
1082
  */
1056
1083
  contentControls?: document_d_exports.SdtProperties[];
1084
+ /** Transparent row-level custom-XML wrappers, outermost first. */
1085
+ carrierStack?: document_d_exports.TableContentCarrier[];
1057
1086
  /**
1058
1087
  * Markup the authored `w:tr` carried beside its cells, with the cell count
1059
1088
  * that places it back between the same two cells. Follows the record the
@@ -1219,10 +1248,12 @@ type TableCellAttrs = {
1219
1248
  * outermost first. The row's twin, one level down.
1220
1249
  */
1221
1250
  contentControls?: document_d_exports.SdtProperties[];
1251
+ /** Transparent row-level custom-XML wrappers, outermost first. */
1252
+ carrierStack?: document_d_exports.TableContentCarrier[];
1222
1253
  /** Preserve a DOCX vMerge restart even when PM cannot model it as a rowspan. */
1223
1254
  _preserveVMergeRestart?: boolean;
1224
1255
  /** Original DOCX vMerge continuation cells skipped into this PM rowspan. */
1225
1256
  _docxVMergeContinuationCells?: unknown;
1226
1257
  };
1227
1258
  //#endregion
1228
- export { AlternateContentAttrs, AuthoredEmuAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, CommentReferenceAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PRESERVED_XML_LEVELS, PageBreakRunAttrs, ParagraphAttrs, ParagraphAttrsPatch, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SuggestedStructuralMarker, SymbolAttrs, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs, TextBoxTextBodyContentState };
1259
+ export { AlternateContentAttrs, AuthoredEmuAttrs, BlockCustomXmlAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, CommentReferenceAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PRESERVED_XML_LEVELS, PageBreakRunAttrs, ParagraphAttrs, ParagraphAttrsPatch, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SuggestedStructuralMarker, SymbolAttrs, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs, TextBoxTextBodyContentState };
@@ -0,0 +1,20 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ import { Node } from "prosemirror-model";
3
+ import { Transaction } from "prosemirror-state";
4
+ //#region src/prosemirror/sectionMarkEdits.d.ts
5
+ type SectionMarkEdits = {
6
+ /** Section records whose paragraph mark a replacement deleted. */
7
+ deletedMarks: ReadonlySet<document_d_exports.SectionProperties>;
8
+ /**
9
+ * Paragraphs of the final document, by position, and the section record
10
+ * each must hold because of the mark it now ends with.
11
+ */
12
+ carriers: readonly {
13
+ position: number;
14
+ record: document_d_exports.SectionProperties | null;
15
+ }[];
16
+ };
17
+ /** Read `transactions`, applied in order and ending at `finalDoc`. */
18
+ declare const sectionMarkEditsOf: (transactions: readonly Transaction[], finalDoc: Node) => SectionMarkEdits;
19
+ //#endregion
20
+ export { SectionMarkEdits, sectionMarkEditsOf };
@@ -0,0 +1,59 @@
1
+ import { sectionPropertiesOf } from "./sectionCarrier.js";
2
+ import { Mapping, ReplaceStep } from "prosemirror-transform";
3
+ //#region src/prosemirror/sectionMarkEdits.ts
4
+ const isParagraph = (node) => node.type.name === "paragraph";
5
+ /** Read `transactions`, applied in order and ending at `finalDoc`. */
6
+ const sectionMarkEditsOf = (transactions, finalDoc) => {
7
+ const deletedMarks = /* @__PURE__ */ new Set();
8
+ const carriers = [];
9
+ const replacements = [];
10
+ const mapping = new Mapping();
11
+ for (const transaction of transactions) for (const [index, step] of transaction.steps.entries()) {
12
+ const doc = transaction.docs[index];
13
+ if (step instanceof ReplaceStep && step.from < step.to && doc) replacements.push({
14
+ step,
15
+ doc,
16
+ mapIndex: mapping.maps.length
17
+ });
18
+ const map = transaction.mapping.maps[index];
19
+ if (map) mapping.appendMap(map);
20
+ }
21
+ for (const { step, doc, mapIndex } of replacements) {
22
+ const { from, to } = step;
23
+ doc.nodesBetween(from, to, (node, position) => {
24
+ if (!isParagraph(node)) return true;
25
+ const record = sectionPropertiesOf(node);
26
+ const markFrom = position + node.nodeSize - 1;
27
+ if (record && markFrom >= from && markFrom + 1 <= to) deletedMarks.add(record);
28
+ return false;
29
+ });
30
+ const $from = doc.resolve(from);
31
+ const $to = doc.resolve(to);
32
+ if (!isParagraph($from.parent) || !isParagraph($to.parent) || $from.start() === $to.start()) continue;
33
+ const leftRecord = sectionPropertiesOf($from.parent);
34
+ const rightRecord = sectionPropertiesOf($to.parent);
35
+ if (leftRecord === null && rightRecord === null) continue;
36
+ const after = mapping.slice(mapIndex);
37
+ const left = after.mapResult(from, -1);
38
+ const right = after.mapResult(to, 1);
39
+ if (right.deleted) continue;
40
+ const $right = finalDoc.resolve(right.pos);
41
+ if (!isParagraph($right.parent)) continue;
42
+ carriers.push({
43
+ position: $right.before(),
44
+ record: rightRecord
45
+ });
46
+ if (left.deleted) continue;
47
+ const $left = finalDoc.resolve(left.pos);
48
+ if (isParagraph($left.parent) && $left.start() !== $right.start()) carriers.push({
49
+ position: $left.before(),
50
+ record: null
51
+ });
52
+ }
53
+ return {
54
+ deletedMarks,
55
+ carriers
56
+ };
57
+ };
58
+ //#endregion
59
+ export { sectionMarkEditsOf };
@@ -0,0 +1,17 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ import { Node } from "prosemirror-model";
3
+ import { EditorState } from "prosemirror-state";
4
+ //#region src/prosemirror/storyListNumbering.d.ts
5
+ type StoryListNumbering = {
6
+ /** The story with every colliding list moved to its own ids. */
7
+ doc: Node;
8
+ /** `numbering` plus the lists the story defines. */
9
+ numbering: document_d_exports.NumberingDefinitions | undefined;
10
+ };
11
+ /**
12
+ * The story in `state` as it should be written into a package whose numbering
13
+ * is now `numbering`, and that numbering completed with the story's lists.
14
+ */
15
+ declare const storyListNumbering: (state: EditorState, numbering: document_d_exports.NumberingDefinitions | undefined) => StoryListNumbering;
16
+ //#endregion
17
+ export { storyListNumbering };
@@ -0,0 +1,102 @@
1
+ import { getCachedNumberingMap, isBulletLevel } from "../docx/numberingParser.js";
2
+ import { paragraphNumberingLevel, paragraphNumberingReference, paragraphNumberingReferenceId } from "../docx/numberingReference.js";
3
+ import { expectParagraphAttrs } from "./attrs/index.js";
4
+ import { completeNumberingForDoc, paragraphListReferences } from "./listInstanceReferences.js";
5
+ import { paragraphNumberingAttr } from "./numberingAttr.js";
6
+ import { getPackageNumberingDefinitions } from "./plugins/documentNumbering.js";
7
+ import { Transform } from "prosemirror-transform";
8
+ //#region src/prosemirror/storyListNumbering.ts
9
+ const remappedNumPr = (numPr, numIds) => {
10
+ const numId = paragraphNumberingReferenceId(numPr ?? void 0);
11
+ const next = numId === void 0 ? void 0 : numIds.get(numId);
12
+ if (next === void 0) return numPr;
13
+ const ilvl = paragraphNumberingLevel(numPr ?? void 0);
14
+ return paragraphNumberingAttr(paragraphNumberingReference(ilvl === void 0 ? { numId: next } : {
15
+ numId: next,
16
+ ilvl
17
+ }));
18
+ };
19
+ const remappedAbstractNumId = (abstractNumId, remap) => {
20
+ if (abstractNumId === null || abstractNumId === void 0 || remap.baseAbstractNumIds.has(abstractNumId)) return abstractNumId;
21
+ let next = remap.abstractNumIds.get(abstractNumId);
22
+ if (next === void 0) {
23
+ next = remap.nextAbstractNumId++;
24
+ remap.abstractNumIds.set(abstractNumId, next);
25
+ }
26
+ return next;
27
+ };
28
+ const maxOf = (ids, floor) => {
29
+ let max = floor;
30
+ for (const id of ids) max = Math.max(max, id);
31
+ return max;
32
+ };
33
+ /**
34
+ * The story in `state` as it should be written into a package whose numbering
35
+ * is now `numbering`, and that numbering completed with the story's lists.
36
+ */
37
+ const storyListNumbering = (state, numbering) => {
38
+ const packageDefinitions = getPackageNumberingDefinitions(state);
39
+ const storyBase = new Set((packageDefinitions?.nums ?? []).map(({ numId }) => numId));
40
+ const defined = new Set((numbering?.nums ?? []).map(({ numId }) => numId));
41
+ const definedMap = numbering ? getCachedNumberingMap(numbering) : null;
42
+ const referenced = /* @__PURE__ */ new Set();
43
+ const colliding = /* @__PURE__ */ new Set();
44
+ state.doc.descendants((node) => {
45
+ if (node.type.name !== "paragraph") return true;
46
+ for (const numId of paragraphListReferences(node)) referenced.add(numId);
47
+ const attrs = expectParagraphAttrs(node);
48
+ const numId = paragraphNumberingReferenceId(attrs.numPr);
49
+ if (numId !== void 0 && !storyBase.has(numId) && definedMap?.hasNumbering(numId)) {
50
+ const level = definedMap.getLevel(numId, paragraphNumberingLevel(attrs.numPr) ?? 0);
51
+ if (!(level !== null && isBulletLevel(level) === (attrs.listIsBullet === true) && (attrs.listAbstractNumId ?? void 0) === (definedMap.getAbstractNumId(numId) ?? void 0))) colliding.add(numId);
52
+ }
53
+ return false;
54
+ });
55
+ if (colliding.size === 0) return {
56
+ doc: state.doc,
57
+ numbering: completeNumberingForDoc(numbering, state.doc)
58
+ };
59
+ let nextNumId = maxOf([...defined, ...referenced], 0) + 1;
60
+ const remap = {
61
+ numIds: new Map([...colliding].map((numId) => [numId, nextNumId++])),
62
+ baseAbstractNumIds: new Set((packageDefinitions?.abstractNums ?? []).map(({ abstractNumId }) => abstractNumId)),
63
+ abstractNumIds: /* @__PURE__ */ new Map(),
64
+ nextAbstractNumId: maxOf((numbering?.abstractNums ?? []).map(({ abstractNumId }) => abstractNumId), -1) + 1
65
+ };
66
+ const tr = new Transform(state.doc);
67
+ state.doc.descendants((node, pos) => {
68
+ if (node.type.name !== "paragraph") return true;
69
+ const attrs = expectParagraphAttrs(node);
70
+ const numId = paragraphNumberingReferenceId(attrs.numPr);
71
+ const moves = numId !== void 0 && remap.numIds.has(numId);
72
+ const changes = attrs._propertyChanges?.map((change) => {
73
+ const previous = change.previousFormatting;
74
+ const previousNumId = paragraphNumberingReferenceId(previous?.numPr ?? void 0);
75
+ if (!previous || previousNumId === void 0 || !remap.numIds.has(previousNumId)) return change;
76
+ return {
77
+ ...change,
78
+ previousFormatting: {
79
+ ...previous,
80
+ numPr: remappedNumPr(previous.numPr, remap.numIds),
81
+ listAbstractNumId: remappedAbstractNumId(previous.listAbstractNumId, remap) ?? void 0
82
+ }
83
+ };
84
+ });
85
+ const changesMoved = changes?.some((change, index) => change !== attrs._propertyChanges?.[index]);
86
+ if (moves || changesMoved) tr.setNodeMarkup(pos, void 0, {
87
+ ...node.attrs,
88
+ ...moves ? {
89
+ numPr: remappedNumPr(attrs.numPr, remap.numIds),
90
+ listAbstractNumId: remappedAbstractNumId(attrs.listAbstractNumId, remap) ?? null
91
+ } : {},
92
+ ...changesMoved ? { _propertyChanges: changes } : {}
93
+ });
94
+ return false;
95
+ });
96
+ return {
97
+ doc: tr.doc,
98
+ numbering: completeNumberingForDoc(numbering, tr.doc)
99
+ };
100
+ };
101
+ //#endregion
102
+ export { storyListNumbering };
@@ -1,6 +1,38 @@
1
- import { Transaction } from "prosemirror-state";
2
1
  import { Node } from "prosemirror-model";
2
+ import { Transaction } from "prosemirror-state";
3
+ import { TableMap } from "prosemirror-tables";
3
4
  //#region src/prosemirror/tableGridMutation.d.ts
5
+ type RemoveTableRowOptions = {
6
+ map: TableMap;
7
+ table: Node;
8
+ tableStart: number;
9
+ };
10
+ /**
11
+ * Remove one row, keeping every vertical merge that touches it whole: a merge
12
+ * reaching through the row from above closes one row sooner, and a cell that
13
+ * starts in the row and spans down moves into the row below, one row shorter.
14
+ *
15
+ * `prosemirror-tables` exports the same operation as `removeRow`, but its walk
16
+ * across the row skips a cell's extra columns without moving its map index
17
+ * along with them, so after a cell wider than one column it reads the wrong
18
+ * slots: a merge reaching through the row further right is never shortened,
19
+ * and the table is left one row shorter than that merge.
20
+ */
21
+ declare const removeTableRow: (tr: Transaction, { map, table, tableStart }: RemoveTableRowOptions, row: number) => void;
22
+ /**
23
+ * Remove every row a structural edit left without a cell of its own, closing
24
+ * the vertical merges that reached through it over one row fewer.
25
+ *
26
+ * Deleting the only column a row still had a cell in, or merging whole rows
27
+ * together, leaves a row holding nothing but the merges from above. The
28
+ * editable model can carry such a row, but nothing else agrees with it: a
29
+ * package spells it as a row of `w:vMerge` continuations, which the reader
30
+ * gives a cell of its own by splitting the merge apart, so the reopened table
31
+ * differs from the one the operation reported. Accepting the same deletion
32
+ * tracked removes the cells one at a time and the row with its last one,
33
+ * which is this result; the two modes have to leave the same table.
34
+ */
35
+ declare const removeRowsWithoutCells: (tr: Transaction, tablePosition: number) => void;
4
36
  type ReconcileTableGridAfterColumnRemovalOptions = {
5
37
  tr: Transaction;
6
38
  tablePosition: number;
@@ -16,5 +48,19 @@ type ReconcileTableGridAfterColumnRemovalOptions = {
16
48
  * the old grid; reopening then has to interpret surviving cells as spans.
17
49
  */
18
50
  declare const reconcileTableGridAfterColumnRemoval: ({ tr, tablePosition, previousTable, removedColumn }: ReconcileTableGridAfterColumnRemovalOptions) => void;
51
+ type ReconcileTableGridAfterColumnInsertionOptions = {
52
+ tr: Transaction;
53
+ tablePosition: number;
54
+ previousTable: Node;
55
+ insertedColumn: number;
56
+ };
57
+ /**
58
+ * The same for a physical column insertion: the new grid column takes the
59
+ * width of the column beside it, and the table grows by it.
60
+ *
61
+ * Without it the table keeps the grid it had, so every row spans one column
62
+ * more than `w:tblGrid` declares.
63
+ */
64
+ declare const reconcileTableGridAfterColumnInsertion: ({ tr, tablePosition, previousTable, insertedColumn }: ReconcileTableGridAfterColumnInsertionOptions) => void;
19
65
  //#endregion
20
- export { reconcileTableGridAfterColumnRemoval };
66
+ export { reconcileTableGridAfterColumnInsertion, reconcileTableGridAfterColumnRemoval, removeRowsWithoutCells, removeTableRow };
@@ -2,6 +2,77 @@ import { expectTableAttrs, mergeTableAttrs } from "./attrs/index.js";
2
2
  import { TableMap } from "prosemirror-tables";
3
3
  //#region src/prosemirror/tableGridMutation.ts
4
4
  /**
5
+ * Remove one row, keeping every vertical merge that touches it whole: a merge
6
+ * reaching through the row from above closes one row sooner, and a cell that
7
+ * starts in the row and spans down moves into the row below, one row shorter.
8
+ *
9
+ * `prosemirror-tables` exports the same operation as `removeRow`, but its walk
10
+ * across the row skips a cell's extra columns without moving its map index
11
+ * along with them, so after a cell wider than one column it reads the wrong
12
+ * slots: a merge reaching through the row further right is never shortened,
13
+ * and the table is left one row shorter than that merge.
14
+ */
15
+ const removeTableRow = (tr, { map, table, tableStart }, row) => {
16
+ let rowPosition = 0;
17
+ for (let index = 0; index < row; index++) rowPosition += table.child(index).nodeSize;
18
+ const nextRow = rowPosition + table.child(row).nodeSize;
19
+ const mapFrom = tr.mapping.maps.length;
20
+ tr.delete(tableStart + rowPosition, tableStart + nextRow);
21
+ for (let column = 0; column < map.width;) {
22
+ const index = row * map.width + column;
23
+ const position = map.map[index];
24
+ const cell = position === void 0 ? null : table.nodeAt(position);
25
+ if (position === void 0 || !cell) {
26
+ column += 1;
27
+ continue;
28
+ }
29
+ const colspan = Math.max(1, Number(cell.attrs["colspan"]) || 1);
30
+ const rowspan = Math.max(1, Number(cell.attrs["rowspan"]) || 1);
31
+ if (row > 0 && position === map.map[index - map.width]) tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(tableStart + position), null, {
32
+ ...cell.attrs,
33
+ rowspan: rowspan - 1
34
+ });
35
+ else if (row + 1 < map.height && position === map.map[index + map.width]) {
36
+ const moved = cell.type.create({
37
+ ...cell.attrs,
38
+ rowspan: rowspan - 1
39
+ }, cell.content);
40
+ const below = map.positionAt(row + 1, column, table);
41
+ tr.insert(tr.mapping.slice(mapFrom).map(tableStart + below), moved);
42
+ }
43
+ column += colspan;
44
+ }
45
+ };
46
+ /**
47
+ * Remove every row a structural edit left without a cell of its own, closing
48
+ * the vertical merges that reached through it over one row fewer.
49
+ *
50
+ * Deleting the only column a row still had a cell in, or merging whole rows
51
+ * together, leaves a row holding nothing but the merges from above. The
52
+ * editable model can carry such a row, but nothing else agrees with it: a
53
+ * package spells it as a row of `w:vMerge` continuations, which the reader
54
+ * gives a cell of its own by splitting the merge apart, so the reopened table
55
+ * differs from the one the operation reported. Accepting the same deletion
56
+ * tracked removes the cells one at a time and the row with its last one,
57
+ * which is this result; the two modes have to leave the same table.
58
+ */
59
+ const removeRowsWithoutCells = (tr, tablePosition) => {
60
+ for (;;) {
61
+ const table = tr.doc.nodeAt(tablePosition);
62
+ if (!table || table.type.spec["tableRole"] !== "table" || table.childCount < 2) return;
63
+ let emptyRow = -1;
64
+ table.forEach((row, _offset, index) => {
65
+ if (emptyRow === -1 && row.childCount === 0) emptyRow = index;
66
+ });
67
+ if (emptyRow === -1) return;
68
+ removeTableRow(tr, {
69
+ map: TableMap.get(table),
70
+ table,
71
+ tableStart: tablePosition + 1
72
+ }, emptyRow);
73
+ }
74
+ };
75
+ /**
5
76
  * Keep the editable table grid aligned with a physical column removal.
6
77
  *
7
78
  * `prosemirror-tables` owns cell topology, but Folio separately retains the
@@ -18,6 +89,40 @@ const reconcileTableGridAfterColumnRemoval = ({ tr, tablePosition, previousTable
18
89
  const removedColumnCount = previousColumnCount - columnCount;
19
90
  const previousWidths = expectTableAttrs(previousTable).columnWidths;
20
91
  const columnWidths = previousWidths?.length === previousColumnCount ? previousWidths.toSpliced(removedColumn, removedColumnCount) : void 0;
92
+ setTableGrid({
93
+ tr,
94
+ tablePosition,
95
+ table,
96
+ columnWidths,
97
+ columnCount
98
+ });
99
+ };
100
+ /**
101
+ * The same for a physical column insertion: the new grid column takes the
102
+ * width of the column beside it, and the table grows by it.
103
+ *
104
+ * Without it the table keeps the grid it had, so every row spans one column
105
+ * more than `w:tblGrid` declares.
106
+ */
107
+ const reconcileTableGridAfterColumnInsertion = ({ tr, tablePosition, previousTable, insertedColumn }) => {
108
+ const previousColumnCount = TableMap.get(previousTable).width;
109
+ const table = tr.doc.nodeAt(tablePosition);
110
+ if (!table || table.type.spec["tableRole"] !== "table") return;
111
+ const columnCount = TableMap.get(table).width;
112
+ if (columnCount <= previousColumnCount) return;
113
+ const insertedColumnCount = columnCount - previousColumnCount;
114
+ const previousWidths = expectTableAttrs(previousTable).columnWidths;
115
+ const neighbourWidth = previousWidths?.[Math.max(0, Math.min(insertedColumn, previousColumnCount) - 1)] ?? previousWidths?.[0];
116
+ const columnWidths = previousWidths?.length === previousColumnCount && neighbourWidth !== void 0 ? previousWidths.toSpliced(insertedColumn, 0, ...Array.from({ length: insertedColumnCount }, () => neighbourWidth)) : void 0;
117
+ setTableGrid({
118
+ tr,
119
+ tablePosition,
120
+ table,
121
+ columnWidths,
122
+ columnCount
123
+ });
124
+ };
125
+ const setTableGrid = ({ tr, tablePosition, table, columnWidths, columnCount }) => {
21
126
  const formatting = expectTableAttrs(table)._originalFormatting;
22
127
  const originalFormatting = formatting ? { ...formatting } : void 0;
23
128
  if (originalFormatting) delete originalFormatting.gridSourceXml;
@@ -27,4 +132,4 @@ const reconcileTableGridAfterColumnRemoval = ({ tr, tablePosition, previousTable
27
132
  }));
28
133
  };
29
134
  //#endregion
30
- export { reconcileTableGridAfterColumnRemoval };
135
+ export { reconcileTableGridAfterColumnInsertion, reconcileTableGridAfterColumnRemoval, removeRowsWithoutCells, removeTableRow };
@@ -1,4 +1,4 @@
1
- import { readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readInlineWrapperMarkAttrs, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readParagraphAttrs, readPreservedBlockAttrs, readPreservedXmlAttrs, readRunFormattingOverrideMarkAttrs, readRunIdentityMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs } from "./attrs/index.js";
1
+ import { readBlockCustomXmlAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readInlineWrapperMarkAttrs, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readParagraphAttrs, readPreservedBlockAttrs, readPreservedXmlAttrs, readRunFormattingOverrideMarkAttrs, readRunIdentityMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs } from "./attrs/index.js";
2
2
  import { readBookmarkBoundaryAttrs } from "./bookmarkBoundaryAttrs.js";
3
3
  import { readCommentReferenceAttrs } from "./commentReferenceAttrs.js";
4
4
  import { INLINE_WRAPPER_MARK_NAME } from "./extensions/marks/InlineWrapperExtension.js";
@@ -288,6 +288,10 @@ const validateNodeAttrs = (node, path, issues) => {
288
288
  appendAttrIssues(path, readBlockSdtAttrs(node), issues);
289
289
  for (let i = 0; i < node.childCount; i += 1) validateNode(node.child(i), `${path}.content[${i}]`, issues);
290
290
  return;
291
+ case "blockCustomXml":
292
+ appendAttrIssues(path, readBlockCustomXmlAttrs(node), issues);
293
+ for (let i = 0; i < node.childCount; i += 1) validateNode(node.child(i), `${path}.content[${i}]`, issues);
294
+ return;
291
295
  case "shape":
292
296
  appendAttrIssues(path, readShapeAttrs(node), issues);
293
297
  return;