@stll/folio-core 0.46.0 → 0.47.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 (366) hide show
  1. package/dist/ai-edits/apply.js +26 -24
  2. package/dist/ai-edits/headless.js +1 -1
  3. package/dist/ai-edits/read.d.ts +1 -0
  4. package/dist/ai-edits/read.js +1 -0
  5. package/dist/ai-edits/snapshot.js +32 -27
  6. package/dist/ai-edits/table-cell-mutations.js +15 -7
  7. package/dist/ai-edits/table-geometry.js +21 -18
  8. package/dist/ai-edits/table-template.js +2 -2
  9. package/dist/compare/content-alignment.js +108 -12
  10. package/dist/compare/content-types.d.ts +8 -2
  11. package/dist/compare/content.js +2 -11
  12. package/dist/compare/plan.js +7 -4
  13. package/dist/compare/section-boundary-properties.js +1 -2
  14. package/dist/content-controls/checkboxDisplay.d.ts +8 -2
  15. package/dist/content-controls/checkboxDisplay.js +11 -5
  16. package/dist/content-controls/mutateContentControls.js +41 -42
  17. package/dist/controller/layoutPipeline.js +8 -3
  18. package/dist/display-list/build/buildDisplayList.js +7 -7
  19. package/dist/display-list/build/imagePrimitives.d.ts +4 -4
  20. package/dist/display-list/build/imagePrimitives.js +38 -20
  21. package/dist/display-list/build/pageBorderPrimitives.js +2 -1
  22. package/dist/display-list/build/paragraphPrimitives.js +93 -13
  23. package/dist/display-list/build/previewPrimitives.d.ts +10 -0
  24. package/dist/display-list/build/previewPrimitives.js +89 -0
  25. package/dist/display-list/build/strokes.d.ts +177 -8
  26. package/dist/display-list/build/strokes.js +167 -47
  27. package/dist/display-list/build/tablePrimitives.js +4 -2
  28. package/dist/display-list/build/textBoxPrimitives.js +6 -4
  29. package/dist/display-list/build/textDecorations.d.ts +15 -1
  30. package/dist/display-list/build/textDecorations.js +15 -1
  31. package/dist/display-list/dom/renderDisplayListToDom.js +1 -19
  32. package/dist/display-list/primitives.d.ts +13 -2
  33. package/dist/display-list/primitives.js +36 -1
  34. package/dist/document-operations.js +2 -1
  35. package/dist/docx/attributeRemainder.d.ts +34 -1
  36. package/dist/docx/attributeRemainder.js +49 -3
  37. package/dist/docx/blockContentParser.d.ts +2 -0
  38. package/dist/docx/blockContentParser.js +39 -67
  39. package/dist/docx/blockPlainText.js +3 -1
  40. package/dist/docx/borderParser.js +26 -11
  41. package/dist/docx/builtInStyles.d.ts +8 -16
  42. package/dist/docx/builtInStyles.js +54 -17
  43. package/dist/docx/commentAnchorIndex.js +1 -1
  44. package/dist/docx/commentParser.js +3 -3
  45. package/dist/docx/commentRangeIntegrity.js +1 -1
  46. package/dist/docx/commentRangeJoin.js +1 -1
  47. package/dist/docx/commentReferenceNormalization.js +3 -2
  48. package/dist/docx/commentReplyMarkers.js +1 -1
  49. package/dist/docx/compatibility.js +56 -42
  50. package/dist/docx/containerChildren.d.ts +110 -13
  51. package/dist/docx/containerChildren.gen.d.ts +16 -1
  52. package/dist/docx/containerChildren.gen.js +18 -1
  53. package/dist/docx/containerChildren.js +63 -13
  54. package/dist/docx/diagramPreview.d.ts +14 -2
  55. package/dist/docx/diagramPreview.js +81 -169
  56. package/dist/docx/documentParser.js +4 -1
  57. package/dist/docx/drawingAnchor.d.ts +87 -0
  58. package/dist/docx/drawingAnchor.js +201 -0
  59. package/dist/docx/drawingUtils.d.ts +43 -38
  60. package/dist/docx/drawingUtils.js +205 -118
  61. package/dist/docx/fontTableParser.js +102 -41
  62. package/dist/docx/footnoteParser.js +10 -6
  63. package/dist/docx/groupDrawingParser.js +4 -3
  64. package/dist/docx/headerFooterReferenceNormalization.js +1 -1
  65. package/dist/docx/hyperlinkParser.d.ts +45 -7
  66. package/dist/docx/hyperlinkParser.js +126 -57
  67. package/dist/docx/imageParser.js +127 -107
  68. package/dist/docx/index.d.ts +2 -1
  69. package/dist/docx/index.js +2 -1
  70. package/dist/docx/inlineContentRemovals.d.ts +28 -0
  71. package/dist/docx/inlineContentRemovals.js +46 -0
  72. package/dist/docx/inlineWrapperContent.d.ts +84 -3
  73. package/dist/docx/inlineWrapperContent.js +85 -4
  74. package/dist/docx/inlineWrapperParser.d.ts +11 -0
  75. package/dist/docx/inlineWrapperParser.js +60 -0
  76. package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
  77. package/dist/docx/normalizeBaseDirection.js +4 -2
  78. package/dist/docx/numberingParser.d.ts +25 -2
  79. package/dist/docx/numberingParser.js +264 -361
  80. package/dist/docx/numberingReference.d.ts +9 -16
  81. package/dist/docx/numberingReference.js +17 -16
  82. package/dist/docx/numberingReferenceNormalization.js +7 -7
  83. package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
  84. package/dist/docx/ooxmlCounterFormatter.js +4 -1
  85. package/dist/docx/paraIdAttribute.d.ts +91 -1
  86. package/dist/docx/paraIdAttribute.js +79 -1
  87. package/dist/docx/paragraphParser.d.ts +9 -24
  88. package/dist/docx/paragraphParser.js +212 -396
  89. package/dist/docx/paragraphProperties.d.ts +23 -0
  90. package/dist/docx/paragraphProperties.js +279 -0
  91. package/dist/docx/paragraphPropertySource.js +2 -0
  92. package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
  93. package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
  94. package/dist/docx/paragraphTraversal.d.ts +14 -10
  95. package/dist/docx/paragraphTraversal.js +47 -49
  96. package/dist/docx/parseWarningMessage.js +3 -0
  97. package/dist/docx/parserEnums.d.ts +6 -8
  98. package/dist/docx/parserEnums.js +4 -6
  99. package/dist/docx/preservedRunContent.js +16 -6
  100. package/dist/docx/previewBudget.d.ts +44 -23
  101. package/dist/docx/previewBudget.js +61 -30
  102. package/dist/docx/propertyElementAttributes.d.ts +178 -0
  103. package/dist/docx/propertyElementAttributes.js +114 -0
  104. package/dist/docx/renderedPageBreakNormalization.js +2 -2
  105. package/dist/docx/rezip.d.ts +28 -2
  106. package/dist/docx/rezip.js +78 -9
  107. package/dist/docx/runConsolidator.d.ts +42 -2
  108. package/dist/docx/runConsolidator.js +60 -6
  109. package/dist/docx/runParser.d.ts +54 -18
  110. package/dist/docx/runParser.js +379 -295
  111. package/dist/docx/runPayload.d.ts +5 -0
  112. package/dist/docx/runPayload.js +4 -0
  113. package/dist/docx/sdtProperties.d.ts +39 -5
  114. package/dist/docx/sdtProperties.js +205 -84
  115. package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
  116. package/dist/docx/sdtPropertiesPatch.js +68 -112
  117. package/dist/docx/sectionParser.d.ts +1 -2
  118. package/dist/docx/sectionParser.js +236 -240
  119. package/dist/docx/selectiveSave.js +3 -2
  120. package/dist/docx/selectiveXmlPatch.d.ts +21 -2
  121. package/dist/docx/selectiveXmlPatch.js +195 -99
  122. package/dist/docx/serializer/blockSdtSerializer.js +2 -96
  123. package/dist/docx/serializer/borderSerializer.d.ts +5 -5
  124. package/dist/docx/serializer/borderSerializer.js +10 -8
  125. package/dist/docx/serializer/documentSerializer.js +3 -0
  126. package/dist/docx/serializer/fontTableSerializer.js +31 -3
  127. package/dist/docx/serializer/headerFooterSerializer.js +3 -0
  128. package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
  129. package/dist/docx/serializer/markupRangeAttributes.js +9 -1
  130. package/dist/docx/serializer/noteSerializer.js +3 -0
  131. package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
  132. package/dist/docx/serializer/numberingSerializer.js +81 -79
  133. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
  134. package/dist/docx/serializer/paragraphSerializer.js +88 -188
  135. package/dist/docx/serializer/runSerializer.d.ts +1 -5
  136. package/dist/docx/serializer/runSerializer.js +109 -59
  137. package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
  138. package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
  139. package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
  140. package/dist/docx/serializer/settingsSerializer.js +6 -4
  141. package/dist/docx/serializer/stylesSerializer.js +8 -11
  142. package/dist/docx/serializer/tableSerializer.js +268 -100
  143. package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
  144. package/dist/docx/serializer/textFormattingSerializer.js +111 -101
  145. package/dist/docx/serializer/xmlUtils.d.ts +1 -1
  146. package/dist/docx/serializer/xmlUtils.js +1 -1
  147. package/dist/docx/server/createBilingualDocument.js +18 -16
  148. package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
  149. package/dist/docx/settingsParser.js +7 -4
  150. package/dist/docx/shadingParser.d.ts +2 -1
  151. package/dist/docx/shadingParser.js +43 -7
  152. package/dist/docx/shapeParser.js +8 -3
  153. package/dist/docx/strictNames.d.ts +11 -0
  154. package/dist/docx/strictNames.gen.d.ts +45 -0
  155. package/dist/docx/strictNames.gen.js +50 -0
  156. package/dist/docx/strictNames.js +43 -0
  157. package/dist/docx/strictValueEncodings.gen.js +133 -131
  158. package/dist/docx/styleParser.js +17 -349
  159. package/dist/docx/tableParser.d.ts +10 -1
  160. package/dist/docx/tableParser.js +505 -181
  161. package/dist/docx/textBoxParser.d.ts +3 -1
  162. package/dist/docx/textBoxParser.js +18 -8
  163. package/dist/docx/themeColorAttribute.d.ts +13 -0
  164. package/dist/docx/themeColorAttribute.js +24 -0
  165. package/dist/docx/trackedMoveRangeNormalization.js +2 -1
  166. package/dist/docx/vmlImageParser.d.ts +13 -4
  167. package/dist/docx/vmlImageParser.js +74 -31
  168. package/dist/docx/vmlPreview.js +2 -2
  169. package/dist/docx/wrapPolygon.d.ts +30 -0
  170. package/dist/docx/wrapPolygon.js +70 -0
  171. package/dist/docx/xmlParser.d.ts +14 -1
  172. package/dist/docx/xmlParser.js +18 -2
  173. package/dist/fonts/embeddedFonts.js +3 -3
  174. package/dist/headless-layout.js +2 -0
  175. package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
  176. package/dist/i18n/messages/catalogs.gen.js +102 -34
  177. package/dist/i18n/messages/messages.gen.d.ts +4 -0
  178. package/dist/internal/headlessRevisionResolution.js +9 -0
  179. package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
  180. package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
  181. package/dist/internal/paragraphFormattingSerialization.js +118 -83
  182. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  183. package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
  184. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  185. package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
  186. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
  187. package/dist/layout-bridge/convert/toFlowBlocks.js +177 -101
  188. package/dist/layout-engine/index.d.ts +2 -2
  189. package/dist/layout-engine/index.js +53 -17
  190. package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
  191. package/dist/layout-engine/measure/measureBlocks.js +6 -10
  192. package/dist/layout-engine/measure/tableCellGrid.js +2 -1
  193. package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
  194. package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
  195. package/dist/layout-engine/paragraphSequence.js +3 -2
  196. package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
  197. package/dist/layout-engine/section-breaks.d.ts +49 -2
  198. package/dist/layout-engine/section-breaks.js +55 -4
  199. package/dist/layout-engine/types.d.ts +47 -17
  200. package/dist/layout-engine/types.js +16 -1
  201. package/dist/layout-painter/borderStroke.d.ts +18 -4
  202. package/dist/layout-painter/renderPage.js +6 -4
  203. package/dist/layout-painter/renderParagraph.d.ts +2 -1
  204. package/dist/layout-painter/renderParagraph.js +13 -26
  205. package/dist/layout-painter/renderTable.d.ts +4 -1
  206. package/dist/layout-painter/renderTable.js +22 -22
  207. package/dist/layout-painter/renderTextBox.js +5 -3
  208. package/dist/markdown/renderBlock.js +3 -1
  209. package/dist/markdown/renderRuns.js +7 -2
  210. package/dist/markdown/renderTable.js +2 -1
  211. package/dist/model.d.ts +3 -3
  212. package/dist/model.js +2 -2
  213. package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
  214. package/dist/paged-layout/sectionBlockWidths.js +26 -4
  215. package/dist/prosemirror/attrs/index.d.ts +22 -4
  216. package/dist/prosemirror/attrs/index.js +498 -60
  217. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
  218. package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
  219. package/dist/prosemirror/commands/comments.js +68 -53
  220. package/dist/prosemirror/commands/contentControls.js +24 -19
  221. package/dist/prosemirror/commands/image.d.ts +1 -1
  222. package/dist/prosemirror/commands/image.js +4 -1
  223. package/dist/prosemirror/commands/paragraph.d.ts +2 -1
  224. package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
  225. package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
  226. package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
  227. package/dist/prosemirror/commands/sectionBreak.js +187 -11
  228. package/dist/prosemirror/conversion/fromProseDoc.d.ts +18 -2
  229. package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
  230. package/dist/prosemirror/conversion/index.d.ts +2 -2
  231. package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
  232. package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
  233. package/dist/prosemirror/conversion/runShadingMark.js +14 -1
  234. package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
  235. package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
  236. package/dist/prosemirror/conversion/toProseDoc.js +371 -141
  237. package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
  238. package/dist/prosemirror/emptyRangeAnchor.js +158 -0
  239. package/dist/prosemirror/extensions/StarterKit.js +8 -2
  240. package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
  241. package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
  242. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
  243. package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
  244. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
  245. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
  246. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
  247. package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
  248. package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
  249. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
  250. package/dist/prosemirror/extensions/markRegistry.d.ts +26 -2
  251. package/dist/prosemirror/extensions/markRegistry.js +73 -10
  252. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
  253. package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
  254. package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
  255. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
  256. package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
  257. package/dist/prosemirror/extensions/marks/markUtils.js +2 -1
  258. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
  259. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
  260. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
  261. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
  262. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
  263. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +10 -0
  264. package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
  265. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
  266. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
  267. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
  268. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
  269. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
  270. package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
  271. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +4 -0
  272. package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
  273. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
  274. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
  275. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
  276. package/dist/prosemirror/extensions/types.d.ts +12 -3
  277. package/dist/prosemirror/index.d.ts +4 -2
  278. package/dist/prosemirror/index.js +2 -1
  279. package/dist/prosemirror/inlineWrapperStack.js +20 -3
  280. package/dist/prosemirror/listMarker.d.ts +2 -2
  281. package/dist/prosemirror/listMarker.js +7 -8
  282. package/dist/prosemirror/listRenderingAttrs.js +11 -1
  283. package/dist/prosemirror/listState.d.ts +62 -0
  284. package/dist/prosemirror/listState.js +49 -0
  285. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
  286. package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
  287. package/dist/prosemirror/numberedRefFields.js +4 -4
  288. package/dist/prosemirror/numberingAttr.d.ts +55 -0
  289. package/dist/prosemirror/numberingAttr.js +74 -0
  290. package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
  291. package/dist/prosemirror/outlineLevelAttr.js +42 -0
  292. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
  293. package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
  294. package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
  295. package/dist/prosemirror/plugins/selectionTracker.js +3 -10
  296. package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
  297. package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
  298. package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
  299. package/dist/prosemirror/replacedAnnotations.js +24 -6
  300. package/dist/prosemirror/revisionCarriers.d.ts +86 -2
  301. package/dist/prosemirror/revisionCarriers.js +86 -60
  302. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
  303. package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
  304. package/dist/prosemirror/runIdentity.d.ts +28 -0
  305. package/dist/prosemirror/runIdentity.js +36 -0
  306. package/dist/prosemirror/runStyleFormatting.js +1 -1
  307. package/dist/prosemirror/schema/index.d.ts +2 -2
  308. package/dist/prosemirror/schema/marks.d.ts +23 -4
  309. package/dist/prosemirror/schema/nodes.d.ts +220 -24
  310. package/dist/prosemirror/sectionCarrier.d.ts +37 -0
  311. package/dist/prosemirror/sectionCarrier.js +40 -0
  312. package/dist/prosemirror/selectionState.d.ts +3 -0
  313. package/dist/prosemirror/selectionState.js +4 -1
  314. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
  315. package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
  316. package/dist/prosemirror/tableResize.js +5 -6
  317. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
  318. package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
  319. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
  320. package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
  321. package/dist/prosemirror/validation.js +17 -6
  322. package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
  323. package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
  324. package/dist/prosemirror/zeroWidthAnchors.js +4 -0
  325. package/dist/style-sets/extract.js +4 -4
  326. package/dist/style-sets/stellaStyle.js +36 -23
  327. package/dist/types/colors.d.ts +2 -2
  328. package/dist/types/content.d.ts +2 -2
  329. package/dist/types/documentEnumValues.d.ts +53 -26
  330. package/dist/types/documentEnumValues.js +72 -174
  331. package/dist/types/formatting.d.ts +2 -2
  332. package/dist/types/index.d.ts +9 -2
  333. package/dist/utils/borderCss.d.ts +246 -0
  334. package/dist/utils/borderCss.js +325 -0
  335. package/dist/utils/colorResolver.d.ts +4 -3
  336. package/dist/utils/colorResolver.js +45 -76
  337. package/dist/utils/createDocument.js +24 -6
  338. package/dist/utils/findReplace.js +52 -10
  339. package/dist/utils/formatToStyle.d.ts +84 -2
  340. package/dist/utils/formatToStyle.js +133 -52
  341. package/dist/utils/headingCollector.js +3 -2
  342. package/dist/utils/mergeDocumentContent.js +5 -3
  343. package/dist/utils/paragraphFormattingMerge.js +27 -6
  344. package/dist/utils/replaceText.js +1 -1
  345. package/dist/utils/tableOperations.d.ts +5 -3
  346. package/dist/utils/tableOperations.js +14 -1
  347. package/dist/utils/tablePlacement.d.ts +7 -0
  348. package/dist/utils/tablePlacement.js +14 -0
  349. package/dist/utils/textDirectionFlow.d.ts +15 -0
  350. package/dist/utils/textDirectionFlow.js +38 -0
  351. package/dist/utils/textFormattingMerge.js +16 -4
  352. package/package.json +10 -10
  353. package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
  354. package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
  355. package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
  356. package/dist/compare/__fixtures__/body-sequence.js +0 -225
  357. package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
  358. package/dist/compare/__fixtures__/nested-table.js +0 -50
  359. package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
  360. package/dist/compare/__fixtures__/numbered-list.js +0 -85
  361. package/dist/docx/bookmarkPlacement.d.ts +0 -9
  362. package/dist/docx/bookmarkPlacement.js +0 -52
  363. package/dist/fonts/embeddedFontTable.d.ts +0 -45
  364. package/dist/fonts/embeddedFontTable.js +0 -80
  365. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
  366. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
@@ -0,0 +1,36 @@
1
+ //#region src/prosemirror/runIdentity.ts
2
+ /** The DOM attribute that carries a run's identity through copy and paste. */
3
+ const RUN_IDENTITY_ATTRIBUTE = "data-docx-run-identity";
4
+ /** The schema name of the mark these attrs belong to. */
5
+ const RUN_IDENTITY_MARK_NAME = "runIdentity";
6
+ /** One remainder entry with its keys in canonical order. */
7
+ const preservedAttribute = ({ namespace, name, value }) => namespace === void 0 ? {
8
+ name,
9
+ value
10
+ } : {
11
+ namespace,
12
+ name,
13
+ value
14
+ };
15
+ /** The property-set sink with its keys in canonical order. */
16
+ const preservedMarkup = ({ children }) => ({ children: (children ?? []).map(({ index, xml }) => ({
17
+ index,
18
+ xml
19
+ })) });
20
+ /** A run identity's attrs in canonical form. */
21
+ const runIdentityAttrs = (id, { preservedAttributes, preserved } = {}) => {
22
+ const attrs = { id };
23
+ if (preservedAttributes && preservedAttributes.length > 0) attrs.preservedAttributes = preservedAttributes.map(preservedAttribute);
24
+ if (preserved && (preserved.children?.length ?? 0) > 0) attrs.preserved = preservedMarkup(preserved);
25
+ return attrs;
26
+ };
27
+ /**
28
+ * Whether a run holds markup the mark exists to carry.
29
+ *
30
+ * The mint condition, minus the page break: a run with neither remainder nor
31
+ * sink and no break to rejoin its leaves across needs no identity, and 57.5%
32
+ * of corpus files hold none.
33
+ */
34
+ const hasRunIdentityPayload = ({ preservedAttributes, preserved }) => (preservedAttributes?.length ?? 0) > 0 || (preserved?.children?.length ?? 0) > 0;
35
+ //#endregion
36
+ export { RUN_IDENTITY_ATTRIBUTE, RUN_IDENTITY_MARK_NAME, hasRunIdentityPayload, runIdentityAttrs };
@@ -21,7 +21,7 @@ const hasDirectRunFormatting = (formatting) => {
21
21
  return Object.entries(formatting).some(([property, value]) => property !== "styleId" && value !== void 0);
22
22
  };
23
23
  const stripParagraphMarkOnlyFormatting = (formatting) => {
24
- const { allCaps: _allCaps, highlight: _highlight, shading: _shading, smallCaps: _smallCaps, vertAlign: _vertAlign, ...formattingForBody } = formatting;
24
+ const { allCaps: _allCaps, highlight: _highlight, shading: _shading, smallCaps: _smallCaps, vertAlign: _vertAlign, preserved: _preserved, ...formattingForBody } = formatting;
25
25
  return Object.keys(formattingForBody).length > 0 ? formattingForBody : void 0;
26
26
  };
27
27
  const stripParagraphMarkFormattingForBodyRuns = (formatting) => {
@@ -1,4 +1,4 @@
1
- import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "./marks.js";
1
+ import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, RunFormattingOverrideAttrs, RunIdentityMarkAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "./marks.js";
2
2
  import { BlockSdtAttrs, BookmarkBoundaryAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PageBreakRunAttrs, ParagraphAttrs, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SymbolAttrs, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "./nodes.js";
3
3
  import { ExtensionManager } from "../extensions/ExtensionManager.js";
4
4
  //#region src/prosemirror/schema/index.d.ts
@@ -11,4 +11,4 @@ type DocxSchema = typeof schema;
11
11
  type DocxNode = ReturnType<typeof schema.node>;
12
12
  type DocxMark = ReturnType<typeof schema.mark>;
13
13
  //#endregion
14
- export { type BlockSdtAttrs, type BookmarkBoundaryAttrs, type CharacterSpacingAttrs, type CharacterStyleAttrs, type CommentAttrs, DocxMark, DocxNode, DocxSchema, type EmphasisMarkAttrs, type FieldAttrs, type FontFamilyAttrs, type FontSizeAttrs, type FootnoteRefAttrs, type HardBreakAttrs, type HighlightAttrs, type HyperlinkAttrs, type ImageAttrs, type ImagePositionAttrs, type InlineWrapperAttrs, type InlineWrapperKind, type InlineWrapperLayer, type LanguageAttrs, type MathAttrs, type PageBreakRunAttrs, type PageBreakRunOwnerMarkAttrs, type ParagraphAttrs, type ParagraphPropertyChangeAttrs, type PreservedBlockAttrs, type PreservedXmlAttrs, type PreservedXmlLevel, type RunFormattingOverrideAttrs, type RunPropertyChangeMarkAttrs, type RunShadingAttrs, type SdtAttrs, type ShapeAttrs, type StrikeAttrs, type SymbolAttrs, type TabAttrs, type TableAttrs, type TableCellAttrs, type TableRowAttrs, type TextBoxAttrs, type TextColorAttrs, type TextEffectAttrs, type TrackedChangeMarkAttrs, type UnderlineAttrs, schema, singletonManager };
14
+ export { type BlockSdtAttrs, type BookmarkBoundaryAttrs, type CharacterSpacingAttrs, type CharacterStyleAttrs, type CommentAttrs, DocxMark, DocxNode, DocxSchema, type EmphasisMarkAttrs, type FieldAttrs, type FontFamilyAttrs, type FontSizeAttrs, type FootnoteRefAttrs, type HardBreakAttrs, type HighlightAttrs, type HyperlinkAttrs, type ImageAttrs, type ImagePositionAttrs, type InlineWrapperAttrs, type InlineWrapperKind, type InlineWrapperLayer, type LanguageAttrs, type MathAttrs, type PageBreakRunAttrs, type ParagraphAttrs, type ParagraphPropertyChangeAttrs, type PreservedBlockAttrs, type PreservedXmlAttrs, type PreservedXmlLevel, type RunFormattingOverrideAttrs, type RunIdentityMarkAttrs, type RunPropertyChangeMarkAttrs, type RunShadingAttrs, type SdtAttrs, type ShapeAttrs, type StrikeAttrs, type SymbolAttrs, type TabAttrs, type TableAttrs, type TableCellAttrs, type TableRowAttrs, type TextBoxAttrs, type TextColorAttrs, type TextEffectAttrs, type TrackedChangeMarkAttrs, type UnderlineAttrs, schema, singletonManager };
@@ -6,7 +6,7 @@ import { document_d_exports } from "../../types/document.js";
6
6
  */
7
7
  type TextColorAttrs = {
8
8
  rgb?: string;
9
- themeColor?: document_d_exports.ThemeColorSlot;
9
+ themeColor?: document_d_exports.ThemeColor;
10
10
  themeTint?: string;
11
11
  themeShade?: string;
12
12
  };
@@ -115,6 +115,8 @@ type TrackedChangeMarkAttrs = {
115
115
  * `null` default is normalized to absent by the attrs reader).
116
116
  */
117
117
  suggestionId?: string;
118
+ /** Imported deleted content uses its pre-change formatting hierarchy. */
119
+ _historicalFormatting?: true;
118
120
  };
119
121
  /** Run-property revisions carried through the editable model. */
120
122
  type RunPropertyChangeMarkAttrs = {
@@ -123,9 +125,26 @@ type RunPropertyChangeMarkAttrs = {
123
125
  provenance: TrackedChangeProvenance;
124
126
  suggestionId?: string;
125
127
  };
126
- /** Editor-only identity for one authored run that contains an explicit page break. */
127
- type PageBreakRunOwnerMarkAttrs = {
128
+ /**
129
+ * Editor-side identity for one authored `w:r`, and everything about that
130
+ * element the model holds but no formatting mark carries.
131
+ *
132
+ * One mark rather than three, because all three payloads are facts about one
133
+ * element and the save leg asks that element a single question: where does
134
+ * this run begin and end. Two marks could give two answers to it, and nothing
135
+ * in the schema would force a resolution.
136
+ *
137
+ * Minted only when the run has something to carry — a page break, an
138
+ * attribute remainder, or a property-set remainder — so a document that
139
+ * carries none pays nothing.
140
+ */
141
+ type RunIdentityMarkAttrs = {
142
+ /** The authored run this leaf came from. Monotonic within one parse. */
128
143
  id: number;
144
+ /** `w:r`'s attribute remainder: resolved names, source order. */
145
+ preservedAttributes?: readonly document_d_exports.PreservedAttribute[];
146
+ /** The `w:rPr` children no reader took a value from, with their ordinals. */
147
+ preserved?: document_d_exports.PreservedMarkup;
129
148
  };
130
149
  /**
131
150
  * One transparent wrapper a leaf sits inside, minus the content ProseMirror
@@ -255,4 +274,4 @@ type HyperlinkAttrs = {
255
274
  _docxHyperlinkIndex?: number;
256
275
  };
257
276
  //#endregion
258
- export { AuthoredRunFormattingValues, COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, ComplexScriptRunPropertyKey, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_PROPERTY_SPECS, RUN_FORMATTING_VALUE_PROPERTIES, RunFormattingBooleanProperty, RunFormattingOverrideAttrs, RunFormattingValueProperty, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TRACKED_CHANGE_PROVENANCE_VALUES, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, TrackedChangeProvenance, UnderlineAttrs };
277
+ export { AuthoredRunFormattingValues, COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, ComplexScriptRunPropertyKey, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_PROPERTY_SPECS, RUN_FORMATTING_VALUE_PROPERTIES, RunFormattingBooleanProperty, RunFormattingOverrideAttrs, RunFormattingValueProperty, RunIdentityMarkAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TRACKED_CHANGE_PROVENANCE_VALUES, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, TrackedChangeProvenance, UnderlineAttrs };
@@ -3,6 +3,7 @@ import { TrackedChangeProvenance } from "./marks.js";
3
3
  import "../../types/index.js";
4
4
  import { OutlineStyleAttr } from "../../types/documentEnumValues.js";
5
5
  import { SpacingExplicit } from "../../types/formatting.js";
6
+ import { ParagraphNumberingAttr } from "../numberingAttr.js";
6
7
  import { ParagraphDirection } from "../paragraphDirection.js";
7
8
  //#region src/prosemirror/schema/nodes.d.ts
8
9
  type HardBreakAttrs = {
@@ -106,10 +107,11 @@ type ParagraphAttrs = {
106
107
  indentRight?: number;
107
108
  indentFirstLine?: number;
108
109
  hangingIndent?: boolean;
109
- numPr?: {
110
- numId?: number;
111
- ilvl?: number;
112
- };
110
+ /**
111
+ * The stated `w:numPr` (17.3.1.19), as the model carries it. Minted by
112
+ * `paragraphNumberingAttr`, so a model value cannot land here unconverted.
113
+ */
114
+ numPr?: ParagraphNumberingAttr;
113
115
  /**
114
116
  * The style-sourced numPr value when `numPr` came from the paragraph
115
117
  * style rather than direct formatting. While `numPr` still equals this,
@@ -118,12 +120,9 @@ type ParagraphAttrs = {
118
120
  * commands that change `numPr` make the values diverge, which re-enables
119
121
  * direct serialization — no explicit clearing needed.
120
122
  */
121
- numPrFromStyle?: {
122
- numId?: number;
123
- ilvl?: number;
124
- };
123
+ numPrFromStyle?: ParagraphNumberingAttr;
125
124
  /** List number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling */
126
- listNumFmt?: document_d_exports.NumberFormat;
125
+ listNumFmt?: document_d_exports.CounterFormat;
127
126
  /** Whether this is a bullet list */
128
127
  listIsBullet?: boolean;
129
128
  /** Whether this level uses legal numbering (parent placeholders render decimal). */
@@ -159,7 +158,7 @@ type ParagraphAttrs = {
159
158
  */
160
159
  listMarkerSecondSlotOffsetTwips?: number;
161
160
  /** Number format for each level used by multi-level marker templates. */
162
- listLevelNumFmts?: document_d_exports.NumberFormat[];
161
+ listLevelNumFmts?: document_d_exports.CounterFormat[];
163
162
  /** Initial counter for each level used by multi-level marker templates. */
164
163
  listLevelStarts?: number[];
165
164
  /** Abstract numbering ID shared by numbering instances. */
@@ -194,7 +193,6 @@ type ParagraphAttrs = {
194
193
  defaultTextFormatting?: document_d_exports.TextFormatting;
195
194
  /** Internal table-style run overlay, used to resolve body-run provenance. */
196
195
  _tableRunFormatting?: document_d_exports.TextFormatting;
197
- sectionBreakType?: "nextPage" | "continuous" | "oddPage" | "evenPage";
198
196
  /**
199
197
  * Base text direction as a discriminated union (undecided when absent). Maps
200
198
  * to the serialized OOXML `w:bidi` tri-state via `directionToBidi`; the
@@ -202,7 +200,8 @@ type ParagraphAttrs = {
202
200
  * re-evaluable auto-detected one. See `paragraphDirection.ts`.
203
201
  */
204
202
  direction?: ParagraphDirection | null;
205
- outlineLevel?: number;
203
+ /** The stated `w:outlineLvl`, style-resolved: a heading level or body text. */
204
+ outlineLevel?: document_d_exports.OutlineLevel;
206
205
  bookmarks?: {
207
206
  id: number;
208
207
  name: string;
@@ -247,8 +246,15 @@ type ParagraphAttrs = {
247
246
  before?: number | null;
248
247
  after?: number | null;
249
248
  };
250
- /** Full section properties for paragraphs that end a section.
251
- * Used by layout engine for per-section column/page config and round-trip. */
249
+ /**
250
+ * The section that ends at this paragraph's mark, and the whole of that
251
+ * state: the break type is a field of the record, derived through
252
+ * `sectionBreakTypeOf`, never a second attr beside it.
253
+ *
254
+ * The record is shared by reference, never cloned. Among the paragraphs
255
+ * holding one object the from-leg writes only the last, which is how a split
256
+ * paragraph's two halves stay one section.
257
+ */
252
258
  _sectionProperties?: document_d_exports.SectionProperties;
253
259
  /**
254
260
  * Attributes the authored `w:p` carried and the model has no field for
@@ -281,6 +287,20 @@ type ParagraphAttrs = {
281
287
  */
282
288
  _suggestedInsert?: SuggestedStructuralMarker | null;
283
289
  };
290
+ /**
291
+ * A partial write over a paragraph's attrs: every key carries its own attr
292
+ * type, or the attr's absent state. Which spelling that is belongs to the
293
+ * node spec's per-attr `default` (`null` for most, `undefined` for a few,
294
+ * `alignmentFromStyle` among them), so both are admitted here.
295
+ *
296
+ * Derived from {@link ParagraphAttrs} rather than hand-listed, so an attr
297
+ * added to the node spec is writable without a second edit, and a producer
298
+ * that assembles a patch is held to each attr's type. `numPr` is the reason
299
+ * it exists: a patch typed `Record<string, unknown>` can store a raw
300
+ * `ParagraphNumberingOverride` there, which is exactly what the
301
+ * {@link ParagraphNumberingAttr} brand makes impossible.
302
+ */
303
+ type ParagraphAttrsPatch = { [K in keyof ParagraphAttrs]?: ParagraphAttrs[K] | null | undefined; };
284
304
  /**
285
305
  * ProseMirror property-change attrs may also carry the editor's list-marker
286
306
  * snapshot fields alongside the canonical paragraph formatting fields.
@@ -293,7 +313,7 @@ type ParagraphPropertyChangeAttrs = Omit<document_d_exports.ParagraphPropertyCha
293
313
  suggestionId?: string | null;
294
314
  };
295
315
  previousFormatting?: Omit<document_d_exports.ParagraphFormatting, "numPr"> & {
296
- numPr?: document_d_exports.ParagraphFormatting["numPr"] | null;
316
+ numPr?: ParagraphAttrs["numPr"] | null;
297
317
  } & Partial<Pick<ParagraphAttrs, "listIsBullet" | "listIsLegal" | "listNumFmt" | "listMarker" | "listMarkerTemplate" | "listMarkerHidden" | "listMarkerFormatting" | "listMarkerAlignment" | "listMarkerSuffix" | "listMarkerAllCaps" | "listImplicitChildLevelAdvances" | "listMarkerSecondSlotOffsetTwips" | "listLevelNumFmts" | "listLevelStarts" | "listAbstractNumId" | "listStartOverride" | "lineSpacingExplicit" | "direction" | "_autospacingBase">>;
298
318
  currentFormatting?: document_d_exports.ParagraphFormatting;
299
319
  };
@@ -336,6 +356,20 @@ type TextBoxMarginAttr = "marginTop" | "marginBottom" | "marginLeft" | "marginRi
336
356
  */
337
357
  type ImageAttrs = {
338
358
  src: string;
359
+ /**
360
+ * How to draw a drawing that carries no image data, set instead of `src`.
361
+ *
362
+ * Carried on the attr rather than in a side table so an editor state is
363
+ * still self-contained: a state that loses the table would lose the picture.
364
+ * It is shape geometry in a serialized attr, which is a real cost in a
365
+ * collaboration update, but the descriptor is bounded by the shape cap and
366
+ * is three orders of magnitude smaller than the base64 raster this attr used
367
+ * to hold for the same drawing.
368
+ *
369
+ * A state saved before this existed carries the raster in `src` and still
370
+ * paints from it, so nothing stored needs migrating.
371
+ */
372
+ preview?: document_d_exports.PreviewDescriptor;
339
373
  docPrName?: string;
340
374
  alt?: string;
341
375
  title?: string;
@@ -395,8 +429,22 @@ type ImageAttrs = {
395
429
  paddingLeft?: number;
396
430
  /** Position for floating images (horizontal and vertical alignment) */
397
431
  position?: ImagePositionAttrs;
398
- /** Use the containing table cell as the anchor's positioning scope (the OOXML default). */
399
- layoutInCell?: boolean;
432
+ /** `wp:anchor`'s own attributes, carried whole so a rebuild can restate them. */
433
+ anchor?: document_d_exports.DrawingAnchor;
434
+ /**
435
+ * Which element stated each wrap inset. The insets above are the value in
436
+ * force; this is the slot each was authored on, without which a rebuild
437
+ * collects them all onto the drawing.
438
+ */
439
+ wrapDistanceSlots?: document_d_exports.WrapDistanceSlots;
440
+ /**
441
+ * Which element stated a `wp:effectExtent`. The drawing's is the reservation
442
+ * in force; the wrap child's is the one the text flow is computed against,
443
+ * and without the slots a rebuild writes neither back where it was authored.
444
+ */
445
+ wrapEffectExtentSlots?: document_d_exports.EffectExtentSlots;
446
+ /** `wp:wrapPolygon` as authored, in the path's own units. */
447
+ wrapPolygon?: document_d_exports.ImageWrapPolygon;
400
448
  /**
401
449
  * The image carries no information, so assistive technology skips it
402
450
  * (`wp:docPr`'s decorative extension). Not {@link hidden}: a decorative
@@ -427,6 +475,19 @@ type ImageAttrs = {
427
475
  hlinkHref?: string;
428
476
  /** DOCX relationship ID for the clickable image hyperlink */
429
477
  hlinkRId?: string;
478
+ /**
479
+ * `a:hlinkClick` as the source wrote it, and `a:hlinkHover` beside it. The
480
+ * model has a field for the click target and none for the tooltip, the target
481
+ * frame or the history flag, so an edit that did not touch the link has to
482
+ * hand the element's own bytes back for the rebuild to replay.
483
+ */
484
+ hlinkClickSource?: document_d_exports.ImageDocPrLink;
485
+ hlinkHoverXml?: string;
486
+ /**
487
+ * `wp:docPr@id`, the drawing's own identity. Without it a rebuilt drawing is
488
+ * renumbered from the serializer's counter on every edit.
489
+ */
490
+ docPrId?: string;
430
491
  /** Original OOXML for opaque/unsupported DOCX drawings. */
431
492
  _docxRawXml?: string;
432
493
  /** Raw XML preserved without an editable image projection. */
@@ -505,10 +566,21 @@ type SdtAttrs = {
505
566
  dropdownLastValue?: string;
506
567
  /** Checkbox checked state */
507
568
  checked?: boolean;
508
- /** Captured `<w:sdtPr>…</w:sdtPr>` for round-trip replay. */
509
- rawPropertiesXml?: string;
569
+ /**
570
+ * The `w:sdtPr` children folio does not model, at their schema ordinal.
571
+ *
572
+ * The control keeps its own bytes through the editor the way a paragraph
573
+ * keeps its attribute remainder: the serializer merges them back with the
574
+ * modelled children in `CT_SdtPr` order.
575
+ */
576
+ _preserved?: document_d_exports.PreservedMarkup;
510
577
  /** Captured `<w:sdtEndPr>…</w:sdtEndPr>` for round-trip replay. */
511
578
  rawEndPropertiesXml?: string;
579
+ /**
580
+ * `w:sdtEndPr` as a record, for a control the editor rebuilds and which has
581
+ * no captured bytes left to replay. See `SdtProperties.endProperties`.
582
+ */
583
+ endProperties?: document_d_exports.SdtEndProperties;
512
584
  };
513
585
  /**
514
586
  * Block-level structured document tag node attributes. Mirrors `SdtAttrs`
@@ -538,10 +610,18 @@ type BlockSdtAttrs = {
538
610
  * uses this flag to drop the filler instead of guessing from shape.
539
611
  */
540
612
  _originallyEmpty?: boolean;
541
- /** Captured `<w:sdtPr>…</w:sdtPr>` for round-trip replay. */
542
- rawPropertiesXml?: string;
613
+ /**
614
+ * The `w:sdtPr` children folio does not model, at their schema ordinal.
615
+ *
616
+ * The control keeps its own bytes through the editor the way a paragraph
617
+ * keeps its attribute remainder: the serializer merges them back with the
618
+ * modelled children in `CT_SdtPr` order.
619
+ */
620
+ _preserved?: document_d_exports.PreservedMarkup;
543
621
  /** Captured `<w:sdtEndPr>…</w:sdtEndPr>` for round-trip replay. */
544
622
  rawEndPropertiesXml?: string;
623
+ /** `w:sdtEndPr` as a record; see `SdtAttrs.endProperties`. */
624
+ endProperties?: document_d_exports.SdtEndProperties;
545
625
  /** Verbatim XML for sdt siblings before sdtContent (range markers). */
546
626
  rawSdtChildrenBeforeContent?: string;
547
627
  /** Verbatim XML for sdt siblings after sdtContent (range markers). */
@@ -621,6 +701,22 @@ type ShapeAttrs = {
621
701
  distRight?: number;
622
702
  /** Position for floating shapes (horizontal and vertical alignment) */
623
703
  position?: ImagePositionAttrs;
704
+ /** `wp:anchor`'s own attributes, carried whole so a rebuild can restate them. */
705
+ anchor?: document_d_exports.DrawingAnchor;
706
+ /**
707
+ * Which element stated each wrap inset. The insets above are the value in
708
+ * force; this is the slot each was authored on, without which a rebuild
709
+ * collects them all onto the drawing.
710
+ */
711
+ wrapDistanceSlots?: document_d_exports.WrapDistanceSlots;
712
+ /**
713
+ * Which element stated a `wp:effectExtent`. The drawing's is the reservation
714
+ * in force; the wrap child's is the one the text flow is computed against,
715
+ * and without the slots a rebuild writes neither back where it was authored.
716
+ */
717
+ wrapEffectExtentSlots?: document_d_exports.EffectExtentSlots;
718
+ /** `wp:wrapPolygon` as authored, in the path's own units. */
719
+ wrapPolygon?: document_d_exports.ImageWrapPolygon;
624
720
  /** Shadow color as CSS color */
625
721
  shadowColor?: string;
626
722
  /** Shadow blur radius in pixels */
@@ -716,6 +812,22 @@ type TextBoxAttrs = {
716
812
  distRight?: number;
717
813
  /** Position for floating/anchored text boxes */
718
814
  position?: ImagePositionAttrs;
815
+ /** `wp:anchor`'s own attributes, carried whole so a rebuild can restate them. */
816
+ anchor?: document_d_exports.DrawingAnchor;
817
+ /**
818
+ * Which element stated each wrap inset. The insets above are the value in
819
+ * force; this is the slot each was authored on, without which a rebuild
820
+ * collects them all onto the drawing.
821
+ */
822
+ wrapDistanceSlots?: document_d_exports.WrapDistanceSlots;
823
+ /**
824
+ * Which element stated a `wp:effectExtent`. The drawing's is the reservation
825
+ * in force; the wrap child's is the one the text flow is computed against,
826
+ * and without the slots a rebuild writes neither back where it was authored.
827
+ */
828
+ wrapEffectExtentSlots?: document_d_exports.EffectExtentSlots;
829
+ /** `wp:wrapPolygon` as authored, in the path's own units. */
830
+ wrapPolygon?: document_d_exports.ImageWrapPolygon;
719
831
  /** Original DOCX placement hint for save-path reconstruction. */
720
832
  _docxPlacement?: "standalone" | "inlineWithPrevious";
721
833
  /** Original DOCX paragraph group for standalone text-box reconstruction. */
@@ -770,8 +882,8 @@ type TableAttrs = {
770
882
  width?: number;
771
883
  /** Table width type ('auto', 'pct', 'dxa') */
772
884
  widthType?: document_d_exports.TableWidthType;
773
- /** Table justification/alignment */
774
- justification?: "left" | "center" | "right";
885
+ /** Table placement (`w:tblPr/w:jc`) */
886
+ justification?: NonNullable<document_d_exports.TableFormatting["justification"]>;
775
887
  /** Column widths (in twips) from w:tblGrid */
776
888
  columnWidths?: number[];
777
889
  /** Floating table properties (w:tblpPr) */
@@ -804,6 +916,27 @@ type TableAttrs = {
804
916
  _originalFormatting?: document_d_exports.TableFormatting;
805
917
  /** Tracked table property changes (w:tblPrChange) for round-trip + accept/reject */
806
918
  tblPrChange?: document_d_exports.TablePropertyChange[];
919
+ /**
920
+ * Bookmark markers the authored element held beside its own children, with
921
+ * the position each was read at.
922
+ *
923
+ * There is no node for a boundary between two rows or two cells — a row's
924
+ * children are cells — so the markers ride the record by reference, the way
925
+ * `_preservedAttributes` does and for the same reason: a copy the editor
926
+ * made shares the array, an authored record holds its own, and only the
927
+ * first in document order keeps it.
928
+ */
929
+ _bookmarks?: document_d_exports.PositionedBookmarkMarker[];
930
+ /**
931
+ * Markup the authored `w:tbl` carried beside its rows — a bookmark or
932
+ * permission boundary, a proofing error, a custom-XML revision range —
933
+ * with the row count that places it back between the same two rows.
934
+ *
935
+ * Carried by reference for the reason `_preservedAttributes` is: the sink
936
+ * follows the record it was authored on, so a table the editor created has
937
+ * none and a copy does not inherit one.
938
+ */
939
+ _preserved?: document_d_exports.TablePreservedMarkup;
807
940
  /**
808
941
  * Marks this whole table as a *suggested* insertion (AI proposal). The table
809
942
  * is dropped from serialized DOCX until accepted; because OOXML has no tracked
@@ -827,14 +960,51 @@ type TableRowAttrs = {
827
960
  _resolvedJustification?: NonNullable<document_d_exports.TableRowFormatting["justification"]>;
828
961
  /** Original row formatting from DOCX for lossless round-trip serialization */
829
962
  _originalFormatting?: document_d_exports.TableRowFormatting;
963
+ /**
964
+ * The table properties the authored row overrides (`w:tblPrEx`), carried
965
+ * whole for the reason `_originalFormatting` is: the editor surfaces none of
966
+ * them, and rebuilding the element from the handful of attrs it does surface
967
+ * would drop the rest.
968
+ */
969
+ _tablePropertyExceptions?: document_d_exports.TablePropertyExceptionFormatting;
830
970
  /** Tracked row property changes (w:trPrChange) for round-trip + accept/reject */
831
971
  trPrChange?: document_d_exports.TableRowPropertyChange[];
972
+ /** Tracked changes to the property exceptions (w:tblPrExChange), carried opaquely */
973
+ tblPrExChange?: document_d_exports.TablePropertyExceptionChange[];
832
974
  /**
833
975
  * Attributes the authored `w:tr` carried and the model has no field for
834
976
  * (`w:rsidR`, `w:rsidDel`, `w:rsidTr`, `w:rsidRPr`), carried opaquely for
835
977
  * the reason `ParagraphAttrs._preservedAttributes` gives.
836
978
  */
837
979
  _preservedAttributes?: document_d_exports.PreservedAttribute[];
980
+ /**
981
+ * Bookmark markers the authored element held beside its own children, with
982
+ * the position each was read at.
983
+ *
984
+ * There is no node for a boundary between two rows or two cells — a row's
985
+ * children are cells — so the markers ride the record by reference, the way
986
+ * `_preservedAttributes` does and for the same reason: a copy the editor
987
+ * made shares the array, an authored record holds its own, and only the
988
+ * first in document order keeps it.
989
+ */
990
+ _bookmarks?: document_d_exports.PositionedBookmarkMarker[];
991
+ /**
992
+ * The row-level content controls (`CT_SdtRow`) this row sits inside,
993
+ * outermost first.
994
+ *
995
+ * The record travels on the row because a table's children are rows and
996
+ * ProseMirror has no node to spare for a wrapper that is not one. Splitting
997
+ * or moving a row takes its controls with it, which an index between rows
998
+ * would not; the save re-opens one wrapper per run of consecutive rows that
999
+ * name the same control. See `TableRow.contentControls`.
1000
+ */
1001
+ contentControls?: document_d_exports.SdtProperties[];
1002
+ /**
1003
+ * Markup the authored `w:tr` carried beside its cells, with the cell count
1004
+ * that places it back between the same two cells. Follows the record the
1005
+ * same way `TableAttrs._preserved` does.
1006
+ */
1007
+ _preserved?: document_d_exports.TablePreservedMarkup;
838
1008
  } & ({
839
1009
  /**
840
1010
  * Tracked structural row insertion (w:trPr/w:ins). A `"suggested"`
@@ -890,12 +1060,33 @@ type TableCellAttrs = {
890
1060
  colspan: number;
891
1061
  /** Row span */
892
1062
  rowspan: number;
1063
+ /**
1064
+ * A non-authored cell which occupies a `w:gridBefore` or `w:gridAfter`
1065
+ * slot so ProseMirror can retain a rectangular table map. It is invisible
1066
+ * in the editor and omitted when projecting back to OOXML.
1067
+ */
1068
+ _omittedGridSlot?: "before" | "after";
893
1069
  /** Column widths for prosemirror-tables resizing (array of pixel widths) */
894
1070
  colwidth?: number[] | null;
895
1071
  /** Cell width (in twips) */
896
1072
  width?: number;
897
1073
  /** Cell width type */
898
1074
  widthType?: document_d_exports.TableWidthType;
1075
+ /**
1076
+ * The preferred width the cell itself states, absent when it states none.
1077
+ *
1078
+ * `width` is the width the cell *renders* at, which the table resolves from
1079
+ * its grid when the cell declares no `w:tcW`, so a save that read it would
1080
+ * give every cell in the document a preferred width its author never wrote.
1081
+ * The companion to `width` that `_resolvedBorders` is to `borders`, and the
1082
+ * one the save leg writes `w:tcW` from. A command that moves a cell's width
1083
+ * states one: `mergeTableCellAttrs` records it for every command that goes
1084
+ * through it.
1085
+ */
1086
+ _authoredWidth?: {
1087
+ value: number;
1088
+ type: document_d_exports.TableWidthType;
1089
+ };
899
1090
  /** Vertical alignment */
900
1091
  verticalAlign?: "top" | "center" | "bottom";
901
1092
  /** Background color (RGB hex) */
@@ -966,10 +1157,15 @@ type TableCellAttrs = {
966
1157
  verticalMerge?: "continue" | "rest";
967
1158
  verticalMergeOriginal?: "continue" | "rest";
968
1159
  };
1160
+ /**
1161
+ * The cell-level content controls (`CT_SdtCell`) this cell sits inside,
1162
+ * outermost first. The row's twin, one level down.
1163
+ */
1164
+ contentControls?: document_d_exports.SdtProperties[];
969
1165
  /** Preserve a DOCX vMerge restart even when PM cannot model it as a rowspan. */
970
1166
  _preserveVMergeRestart?: boolean;
971
1167
  /** Original DOCX vMerge continuation cells skipped into this PM rowspan. */
972
1168
  _docxVMergeContinuationCells?: unknown;
973
1169
  };
974
1170
  //#endregion
975
- export { AuthoredEmuAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, CommentReferenceAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PRESERVED_XML_LEVELS, PageBreakRunAttrs, ParagraphAttrs, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SuggestedStructuralMarker, SymbolAttrs, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs, TextBoxTextBodyContentState };
1171
+ export { 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 };
@@ -0,0 +1,37 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ import { Node } from "prosemirror-model";
3
+ //#region src/prosemirror/sectionCarrier.d.ts
4
+ /**
5
+ * `ST_SectionMark` in full (§17.18.77). The list is total over the model union:
6
+ * `sectionBreakTypeOf` returns a record's `SectionStart` as a
7
+ * `SectionBreakType`, so a member missing here fails to compile rather than
8
+ * going typeless to every reader. Which members the *insert* commands offer is
9
+ * a separate, narrower question (`InsertableSectionBreak`).
10
+ */
11
+ declare const SECTION_BREAK_TYPES: readonly ["nextPage", "nextColumn", "continuous", "evenPage", "oddPage"];
12
+ /** A section start a `w:sectPr` can state. */
13
+ type SectionBreakType = (typeof SECTION_BREAK_TYPES)[number];
14
+ /** A break type read off an untrusted boundary (a `data-` attribute, a snapshot). */
15
+ declare const parseSectionBreakType: (value: unknown) => SectionBreakType | null;
16
+ /** The section record a paragraph holds, or `null` when it ends no section. */
17
+ declare const sectionPropertiesOf: (paragraph: Node) => document_d_exports.SectionProperties | null;
18
+ /**
19
+ * The break type a section record states, or `null` when it states none.
20
+ *
21
+ * The single derivation every reader goes through. Every producer of a record
22
+ * already validated `w:type` against the enumeration (the parser, the insert
23
+ * commands, the Yjs migration's `parseSectionBreakType`), so the field needs no
24
+ * second check here; declaring the narrower return type is what proves
25
+ * `SECTION_BREAK_TYPES` still covers the model union.
26
+ */
27
+ declare const sectionBreakTypeOf: (properties: document_d_exports.SectionProperties | null | undefined) => SectionBreakType | null;
28
+ /**
29
+ * Mint the one record a newly inserted break carries.
30
+ *
31
+ * A minted record states only its type: every other setting of the new section
32
+ * is inherited from the section that follows it, which is what a reader of the
33
+ * package does with a `w:sectPr` that omits them.
34
+ */
35
+ declare const mintSectionProperties: (breakType: SectionBreakType) => document_d_exports.SectionProperties;
36
+ //#endregion
37
+ export { SECTION_BREAK_TYPES, SectionBreakType, mintSectionProperties, parseSectionBreakType, sectionBreakTypeOf, sectionPropertiesOf };
@@ -0,0 +1,40 @@
1
+ //#region src/prosemirror/sectionCarrier.ts
2
+ /**
3
+ * `ST_SectionMark` in full (§17.18.77). The list is total over the model union:
4
+ * `sectionBreakTypeOf` returns a record's `SectionStart` as a
5
+ * `SectionBreakType`, so a member missing here fails to compile rather than
6
+ * going typeless to every reader. Which members the *insert* commands offer is
7
+ * a separate, narrower question (`InsertableSectionBreak`).
8
+ */
9
+ const SECTION_BREAK_TYPES = [
10
+ "nextPage",
11
+ "nextColumn",
12
+ "continuous",
13
+ "evenPage",
14
+ "oddPage"
15
+ ];
16
+ const isSectionBreakType = (value) => SECTION_BREAK_TYPES.some((type) => type === value);
17
+ /** A break type read off an untrusted boundary (a `data-` attribute, a snapshot). */
18
+ const parseSectionBreakType = (value) => isSectionBreakType(value) ? value : null;
19
+ /** The section record a paragraph holds, or `null` when it ends no section. */
20
+ const sectionPropertiesOf = (paragraph) => paragraph.attrs["_sectionProperties"] ?? null;
21
+ /**
22
+ * The break type a section record states, or `null` when it states none.
23
+ *
24
+ * The single derivation every reader goes through. Every producer of a record
25
+ * already validated `w:type` against the enumeration (the parser, the insert
26
+ * commands, the Yjs migration's `parseSectionBreakType`), so the field needs no
27
+ * second check here; declaring the narrower return type is what proves
28
+ * `SECTION_BREAK_TYPES` still covers the model union.
29
+ */
30
+ const sectionBreakTypeOf = (properties) => properties?.sectionStart ?? null;
31
+ /**
32
+ * Mint the one record a newly inserted break carries.
33
+ *
34
+ * A minted record states only its type: every other setting of the new section
35
+ * is inherited from the section that follows it, which is what a reader of the
36
+ * package does with a `w:sectPr` that omits them.
37
+ */
38
+ const mintSectionProperties = (breakType) => ({ sectionStart: breakType });
39
+ //#endregion
40
+ export { SECTION_BREAK_TYPES, mintSectionProperties, parseSectionBreakType, sectionBreakTypeOf, sectionPropertiesOf };
@@ -1,4 +1,5 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
+ import { ListState } from "./listState.js";
2
3
  import { EditorState } from "prosemirror-state";
3
4
  //#region src/prosemirror/selectionState.d.ts
4
5
  /**
@@ -21,6 +22,8 @@ type SelectionSnapshot = {
21
22
  startParagraphIndex: number;
22
23
  /** End paragraph index */
23
24
  endParagraphIndex: number;
25
+ /** Which list the selection is in, resolved against the numbering definitions. */
26
+ listState: ListState;
24
27
  };
25
28
  /** Compatibility name for the public toolbar selection contract. */
26
29
  type SelectionState = SelectionSnapshot;
@@ -1,6 +1,8 @@
1
1
  import { FONT_THEME_VALUES } from "../types/documentEnumValues.js";
2
2
  import { expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectHighlightMarkAttrs, expectParagraphAttrs, expectStrikeMarkAttrs, expectTextColorMarkAttrs, expectUnderlineMarkAttrs } from "./attrs/index.js";
3
+ import { resolveListState } from "./listState.js";
3
4
  import { directionIsRtl } from "./paragraphDirection.js";
5
+ import { getDocumentNumbering } from "./plugins/documentNumbering.js";
4
6
  import { collectMarksInRange } from "./selectionMarks.js";
5
7
  //#region src/prosemirror/selectionState.ts
6
8
  const isFontTheme = (value) => value !== void 0 && FONT_THEME_VALUES.some((theme) => theme === value);
@@ -43,7 +45,8 @@ function extractSelectionSnapshot(state) {
43
45
  paragraphFormatting,
44
46
  styleId,
45
47
  startParagraphIndex,
46
- endParagraphIndex
48
+ endParagraphIndex,
49
+ listState: resolveListState(getDocumentNumbering(state), paragraphFormatting.numPr)
47
50
  };
48
51
  }
49
52
  /** Compatibility entry point used by existing React and Vue integrations. */