@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
@@ -1,39 +1,23 @@
1
+ import { serializePreservedAttributes } from "../docx/attributeRemainder.js";
1
2
  import { serializeBorder } from "../docx/serializer/borderSerializer.js";
2
3
  import { serializeShading, serializeTextFormatting } from "../docx/serializer/textFormattingSerializer.js";
3
4
  import { intAttr } from "../docx/serializer/xmlUtils.js";
5
+ import { TRANSITIONAL_NAME_BY_STRICT_NAME } from "../docx/strictNames.gen.js";
4
6
  import { sanitizeCapturedXmlElement } from "../docx/verbatimCapture.js";
5
7
  import { NAMESPACES, OOXML_NAMESPACE_SCOPE } from "../docx/xmlParser.js";
6
- import { escapeXmlAttribute } from "@stll/docx-core";
8
+ import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
9
+ import { outlineLevelStatedValue, paragraphNumberingSlots, sameEffectiveParagraphNumbering } from "@stll/docx-core/model";
10
+ import { serializeSequenceChildren } from "@stll/docx-core/schema";
7
11
  //#region src/internal/paragraphFormattingSerialization.ts
8
- const modelParagraphNumberingReference = (reference) => {
9
- if (!reference) return null;
10
- const { numId, ilvl } = reference;
11
- return {
12
- ...numId !== void 0 ? { numId } : {},
13
- ...ilvl !== void 0 ? { ilvl } : {}
14
- };
15
- };
16
- /** Compare numbering references by their emitted id and effective level. */
17
- const paragraphNumberingReferencesEqual = (left, right) => {
18
- const modeledLeft = modelParagraphNumberingReference(left);
19
- const modeledRight = modelParagraphNumberingReference(right);
20
- if (modeledLeft === null || modeledRight === null) return modeledLeft === null && modeledRight === null;
21
- return modeledLeft.numId === modeledRight.numId && (modeledLeft.ilvl ?? 0) === (modeledRight.ilvl ?? 0);
22
- };
23
- /** Compare the authored `w:numPr` attributes, including an absent `w:ilvl`. */
24
- const sameAuthoredParagraphNumberingReference = (left, right) => {
25
- const modeledLeft = modelParagraphNumberingReference(left);
26
- const modeledRight = modelParagraphNumberingReference(right);
27
- if (modeledLeft === null || modeledRight === null) return modeledLeft === null && modeledRight === null;
28
- return modeledLeft.numId === modeledRight.numId && modeledLeft.ilvl === modeledRight.ilvl;
29
- };
30
- /** Whether resolved numbering still belongs to the paragraph's style tier. */
31
- const isStyleSourcedParagraphNumbering = (numPr, numPrFromStyle) => numPr != null && numPrFromStyle != null && paragraphNumberingReferencesEqual(numPr, numPrFromStyle);
32
- const serializeToggle = (name, value) => {
33
- if (value === true) return `<w:${name}/>`;
34
- if (value === false) return `<w:${name} w:val="0"/>`;
35
- return "";
36
- };
12
+ /**
13
+ * Whether resolved numbering still belongs to the paragraph's style tier.
14
+ *
15
+ * Effective equality, not stated: the resolved field carries the level the
16
+ * cascade supplied even where the style stated none, and a paragraph whose
17
+ * numbering came wholly from its style must still not emit a direct
18
+ * `<w:numPr>`.
19
+ */
20
+ const isStyleSourcedParagraphNumbering = (numPr, numPrFromStyle) => numPr != null && numPrFromStyle != null && sameEffectiveParagraphNumbering(numPr, numPrFromStyle);
37
21
  const serializeParagraphBorders = (borders) => {
38
22
  if (!borders) return "";
39
23
  const { top, left, bottom, right, between, bar } = borders;
@@ -50,10 +34,10 @@ const serializeParagraphBorders = (borders) => {
50
34
  const serializeTabStops = (tabs) => {
51
35
  if (!tabs || tabs.length === 0) return "";
52
36
  return `<w:tabs>${tabs.map((tab) => {
53
- const { alignment, position, leader } = tab;
37
+ const { alignment, position, leader, preservedAttributes } = tab;
54
38
  const attrs = [`w:val="${alignment}"`, `w:pos="${intAttr(position)}"`];
55
39
  if (leader && leader !== "none") attrs.push(`w:leader="${leader}"`);
56
- return `<w:tab ${attrs.join(" ")}/>`;
40
+ return `<w:tab ${serializePreservedAttributes(attrs, preservedAttributes).join(" ")}/>`;
57
41
  }).join("")}</w:tabs>`;
58
42
  };
59
43
  const serializeSpacing = (formatting) => {
@@ -64,18 +48,29 @@ const serializeSpacing = (formatting) => {
64
48
  if (formatting.lineSpacingRule) attrs.push(`w:lineRule="${formatting.lineSpacingRule}"`);
65
49
  if (formatting.beforeAutospacing !== void 0) attrs.push(`w:beforeAutospacing="${formatting.beforeAutospacing ? "1" : "0"}"`);
66
50
  if (formatting.afterAutospacing !== void 0) attrs.push(`w:afterAutospacing="${formatting.afterAutospacing ? "1" : "0"}"`);
67
- return attrs.length === 0 ? "" : `<w:spacing ${attrs.join(" ")}/>`;
51
+ const written = serializePreservedAttributes(attrs, formatting.spacingPreservedAttributes);
52
+ return written.length === 0 ? "" : `<w:spacing ${written.join(" ")}/>`;
68
53
  };
54
+ /**
55
+ * The edge names folio writes, from the table the census reads.
56
+ *
57
+ * A Strict producer spells these `@w:start` and `@w:end`; folio writes one
58
+ * spelling, and taking it from the generated table is what keeps the writer and
59
+ * the survival law's equivalence from drifting apart.
60
+ */
61
+ const INDENT_LEFT = TRANSITIONAL_NAME_BY_STRICT_NAME["CT_Ind @start"];
62
+ const INDENT_RIGHT = TRANSITIONAL_NAME_BY_STRICT_NAME["CT_Ind @end"];
69
63
  const serializeIndentation = (formatting) => {
70
64
  const attrs = [];
71
- if (formatting.indentLeft !== void 0) attrs.push(`w:left="${intAttr(formatting.indentLeft)}"`);
72
- if (formatting.indentRight !== void 0) attrs.push(`w:right="${intAttr(formatting.indentRight)}"`);
65
+ if (formatting.indentLeft !== void 0) attrs.push(`w:${INDENT_LEFT}="${intAttr(formatting.indentLeft)}"`);
66
+ if (formatting.indentRight !== void 0) attrs.push(`w:${INDENT_RIGHT}="${intAttr(formatting.indentRight)}"`);
73
67
  if (formatting.indentFirstLine !== void 0) {
74
68
  const attribute = formatting.hangingIndent ? "hanging" : "firstLine";
75
69
  const value = formatting.hangingIndent ? Math.abs(formatting.indentFirstLine) : formatting.indentFirstLine;
76
70
  attrs.push(`w:${attribute}="${intAttr(value)}"`);
77
71
  }
78
- return attrs.length === 0 ? "" : `<w:ind ${attrs.join(" ")}/>`;
72
+ const written = serializePreservedAttributes(attrs, formatting.indentPreservedAttributes);
73
+ return written.length === 0 ? "" : `<w:ind ${written.join(" ")}/>`;
79
74
  };
80
75
  /**
81
76
  * `w:numPr`, with the tracked record of the numbering it replaced.
@@ -88,10 +83,10 @@ const serializeIndentation = (formatting) => {
88
83
  * it last in `CT_NumPr`, after `w:ilvl` and `w:numId`.
89
84
  */
90
85
  const serializeNumbering = (numPr, numberingChangeXml) => {
91
- const modeled = modelParagraphNumberingReference(numPr ?? null);
86
+ const slots = numPr === void 0 ? {} : paragraphNumberingSlots(numPr);
92
87
  const parts = [];
93
- if (modeled?.ilvl !== void 0) parts.push(`<w:ilvl w:val="${intAttr(modeled.ilvl)}"/>`);
94
- if (modeled?.numId !== void 0) parts.push(`<w:numId w:val="${intAttr(modeled.numId)}"/>`);
88
+ if (slots.ilvl !== void 0) parts.push(`<w:ilvl w:val="${intAttr(slots.ilvl)}"/>`);
89
+ if (slots.numId !== void 0) parts.push(`<w:numId w:val="${intAttr(slots.numId)}"/>`);
95
90
  const change = replayableNumberingChangeXml(numberingChangeXml);
96
91
  if (change !== null) parts.push(change);
97
92
  return parts.length === 0 ? "" : `<w:numPr>${parts.join("")}</w:numPr>`;
@@ -105,7 +100,7 @@ const replayableNumberingChangeXml = (numberingChangeXml) => sanitizeCapturedXml
105
100
  });
106
101
  const serializeFrameProperties = (frame) => {
107
102
  if (!frame) return "";
108
- const { dropCap, lines, width, height, hSpace, vSpace, hAnchor, vAnchor, x, y, xAlign, yAlign, wrap } = frame;
103
+ const { dropCap, lines, width, height, hSpace, vSpace, hAnchor, vAnchor, x, y, xAlign, yAlign, wrap, preservedAttributes } = frame;
109
104
  const attrs = [];
110
105
  if (dropCap) attrs.push(`w:dropCap="${dropCap}"`);
111
106
  if (lines !== void 0) attrs.push(`w:lines="${intAttr(lines)}"`);
@@ -120,16 +115,35 @@ const serializeFrameProperties = (frame) => {
120
115
  if (xAlign) attrs.push(`w:xAlign="${xAlign}"`);
121
116
  if (yAlign) attrs.push(`w:yAlign="${yAlign}"`);
122
117
  if (wrap) attrs.push(`w:wrap="${wrap}"`);
123
- return attrs.length === 0 ? "" : `<w:framePr ${attrs.join(" ")}/>`;
118
+ const written = serializePreservedAttributes(attrs, preservedAttributes);
119
+ return written.length === 0 ? "" : `<w:framePr ${written.join(" ")}/>`;
124
120
  };
125
121
  const modelSpacingProvenance = (spacingExplicit) => {
126
122
  if (spacingExplicit) {
127
123
  const { before: _before, after: _after } = spacingExplicit;
128
124
  }
129
125
  };
130
- const extractRunPropertiesInnerXml = (runPropertiesXml) => {
131
- if (!runPropertiesXml.startsWith("<w:rPr>") || !runPropertiesXml.endsWith("</w:rPr>")) return "";
132
- return runPropertiesXml.slice(7, -8);
126
+ const MARK_PROPERTIES_EMPTY = "<w:rPr/>";
127
+ /**
128
+ * The paragraph mark's `w:rPr`, without its element, as the one `w:rPr` writer
129
+ * composes it.
130
+ *
131
+ * Three answers rather than two: `undefined` when the mark carried no property
132
+ * set, `""` when it carried an empty one, and the inner markup otherwise.
133
+ * Collapsing the middle case onto the first is what dropped `<w:rPr/>`: the
134
+ * element is optional, so writing one is not the same as writing none, and on
135
+ * the paragraph mark it is the slot a revision on the mark lives in.
136
+ *
137
+ * The caller re-wraps it with the mark's own revision in front, so this side
138
+ * hands back the inner markup rather than the element. `w:specVanish` travels
139
+ * as an owned child instead of being appended, because `EG_RPrBase` declares
140
+ * it between `w:eastAsianLayout` and `w:oMath` rather than last.
141
+ */
142
+ const paragraphMarkPropertiesInner = (runProperties, runInWithNext) => {
143
+ const xml = serializeTextFormatting(runProperties, runInWithNext === void 0 ? [] : [["specVanish", serializeOnOffElement(runInWithNext, "specVanish")]]);
144
+ if (xml === "") return;
145
+ if (xml === MARK_PROPERTIES_EMPTY) return "";
146
+ return xml.slice(7, -8);
133
147
  };
134
148
  /**
135
149
  * Resolve paragraph formatting into its exact fallback `w:pPr` instructions.
@@ -138,48 +152,69 @@ const extractRunPropertiesInnerXml = (runPropertiesXml) => {
138
152
  */
139
153
  const modelParagraphFormattingEmission = (input) => {
140
154
  if (!input) return {};
141
- const { alignment, bidi, kinsoku, overflowPunctuation, spaceBefore, spaceAfter, lineSpacing, lineSpacingRule, snapToGrid, beforeAutospacing, afterAutospacing, spacingExplicit, indentLeft, indentRight, indentFirstLine, hangingIndent, borders, shading, tabs, keepNext, keepLines, widowControl, pageBreakBefore, contextualSpacing, numPr, numPrFromStyle, numberingChangeXml, outlineLevel, styleId, frame, suppressLineNumbers, suppressAutoHyphens, runProperties, runInWithNext } = input;
155
+ const { alignment, bidi, kinsoku, overflowPunctuation, spaceBefore, spaceAfter, lineSpacing, lineSpacingRule, snapToGrid, beforeAutospacing, afterAutospacing, spacingExplicit, spacingPreservedAttributes, indentLeft, indentRight, indentFirstLine, hangingIndent, indentPreservedAttributes, borders, shading, tabs, keepNext, keepLines, widowControl, pageBreakBefore, contextualSpacing, numPr, numPrFromStyle, numberingChangeXml, outlineLevel, styleId, frame, suppressLineNumbers, suppressAutoHyphens, runProperties, runInWithNext, preserved } = input;
142
156
  modelSpacingProvenance(spacingExplicit);
143
- const propertiesXml = [
144
- styleId ? `<w:pStyle w:val="${escapeXmlAttribute(styleId)}"/>` : "",
145
- serializeToggle("keepNext", keepNext),
146
- serializeToggle("keepLines", keepLines),
147
- serializeToggle("pageBreakBefore", pageBreakBefore),
148
- serializeFrameProperties(frame),
149
- serializeToggle("widowControl", widowControl),
150
- isStyleSourcedParagraphNumbering(numPr, numPrFromStyle) ? serializeNumbering(void 0, numberingChangeXml) : serializeNumbering(numPr, numberingChangeXml),
151
- serializeToggle("suppressLineNumbers", suppressLineNumbers),
152
- serializeParagraphBorders(borders),
153
- serializeShading(shading),
154
- serializeTabStops(tabs),
155
- serializeToggle("suppressAutoHyphens", suppressAutoHyphens),
156
- serializeToggle("kinsoku", kinsoku),
157
- serializeToggle("overflowPunct", overflowPunctuation),
158
- serializeToggle("bidi", bidi),
159
- serializeToggle("snapToGrid", snapToGrid),
160
- serializeSpacing({
161
- spaceBefore,
162
- spaceAfter,
163
- lineSpacing,
164
- lineSpacingRule,
165
- beforeAutospacing,
166
- afterAutospacing
167
- }),
168
- serializeIndentation({
169
- indentLeft,
170
- indentRight,
171
- indentFirstLine,
172
- hangingIndent
173
- }),
174
- serializeToggle("contextualSpacing", contextualSpacing),
175
- alignment ? `<w:jc w:val="${alignment}"/>` : "",
176
- outlineLevel !== void 0 ? `<w:outlineLvl w:val="${outlineLevel}"/>` : ""
177
- ].join("");
178
- const paragraphMarkPropertiesInnerXml = `${extractRunPropertiesInnerXml(serializeTextFormatting(runProperties))}${runInWithNext === true ? "<w:specVanish/>" : ""}`;
157
+ const propertiesXml = serializeSequenceChildren({
158
+ container: "paragraph-properties",
159
+ preserved,
160
+ modelled: [
161
+ ["pStyle", styleId ? `<w:pStyle w:val="${escapeXmlAttribute(styleId)}"/>` : ""],
162
+ ["keepNext", serializeOnOffElement(keepNext, "keepNext")],
163
+ ["keepLines", serializeOnOffElement(keepLines, "keepLines")],
164
+ ["pageBreakBefore", serializeOnOffElement(pageBreakBefore, "pageBreakBefore")],
165
+ ["framePr", serializeFrameProperties(frame)],
166
+ ["widowControl", serializeOnOffElement(widowControl, "widowControl")],
167
+ ["numPr", isStyleSourcedParagraphNumbering(numPr, numPrFromStyle) ? serializeNumbering(void 0, numberingChangeXml) : serializeNumbering(numPr, numberingChangeXml)],
168
+ ["suppressLineNumbers", serializeOnOffElement(suppressLineNumbers, "suppressLineNumbers")],
169
+ ["pBdr", serializeParagraphBorders(borders)],
170
+ ["shd", serializeShading(shading)],
171
+ ["tabs", serializeTabStops(tabs)],
172
+ ["suppressAutoHyphens", serializeOnOffElement(suppressAutoHyphens, "suppressAutoHyphens")],
173
+ ["kinsoku", serializeOnOffElement(kinsoku, "kinsoku")],
174
+ ["overflowPunct", serializeOnOffElement(overflowPunctuation, "overflowPunct")],
175
+ ["bidi", serializeOnOffElement(bidi, "bidi")],
176
+ ["snapToGrid", serializeOnOffElement(snapToGrid, "snapToGrid")],
177
+ ["spacing", serializeSpacing({
178
+ spaceBefore,
179
+ spaceAfter,
180
+ lineSpacing,
181
+ lineSpacingRule,
182
+ beforeAutospacing,
183
+ afterAutospacing,
184
+ spacingPreservedAttributes
185
+ })],
186
+ ["ind", serializeIndentation({
187
+ indentLeft,
188
+ indentRight,
189
+ indentFirstLine,
190
+ hangingIndent,
191
+ indentPreservedAttributes
192
+ })],
193
+ ["contextualSpacing", serializeOnOffElement(contextualSpacing, "contextualSpacing")],
194
+ ["jc", alignment ? `<w:jc w:val="${alignment}"/>` : ""],
195
+ ["outlineLvl", outlineLevel === void 0 ? "" : `<w:outlineLvl w:val="${outlineLevelStatedValue(outlineLevel)}"/>`]
196
+ ]
197
+ }).join("");
198
+ const paragraphMarkPropertiesInnerXml = paragraphMarkPropertiesInner(runProperties, runInWithNext);
179
199
  const emission = {};
180
200
  if (propertiesXml) emission.propertiesXml = propertiesXml;
181
- if (paragraphMarkPropertiesInnerXml) emission.paragraphMarkPropertiesInnerXml = paragraphMarkPropertiesInnerXml;
201
+ if (paragraphMarkPropertiesInnerXml !== void 0) emission.paragraphMarkPropertiesInnerXml = paragraphMarkPropertiesInnerXml;
182
202
  return emission;
183
203
  };
204
+ /** Serialize the shared `w:pPr` shape in schema order for all four owners. */
205
+ const serializeParagraphPropertySet = ({ formatting, markPropertiesPrefixXml = "", sectionPropertiesXml = "", propertyChangesXml = [] }) => {
206
+ const modeled = modelParagraphFormattingEmission(formatting);
207
+ const markProperties = modeled.paragraphMarkPropertiesInnerXml;
208
+ const markInner = `${markPropertiesPrefixXml}${markProperties ?? ""}`;
209
+ let markXml = "";
210
+ if (markPropertiesPrefixXml !== "" || markProperties !== void 0) markXml = markInner === "" ? "<w:rPr/>" : `<w:rPr>${markInner}</w:rPr>`;
211
+ const inner = [
212
+ modeled.propertiesXml ?? "",
213
+ markXml,
214
+ sectionPropertiesXml,
215
+ ...propertyChangesXml
216
+ ].join("");
217
+ return inner === "" ? "" : `<w:pPr>${inner}</w:pPr>`;
218
+ };
184
219
  //#endregion
185
- export { isStyleSourcedParagraphNumbering, modelParagraphFormattingEmission, paragraphNumberingReferencesEqual, sameAuthoredParagraphNumberingReference };
220
+ export { isStyleSourcedParagraphNumbering, modelParagraphFormattingEmission, serializeParagraphPropertySet };
@@ -6,6 +6,7 @@ type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number) => Measure[];
6
6
  type ConvertFootnoteOptions = {
7
7
  styles?: document_d_exports.StyleDefinitions | null;
8
8
  theme?: document_d_exports.Theme | null;
9
+ defaultSize?: number;
9
10
  fontAlternates?: ToFlowBlocksOptions["fontAlternates"];
10
11
  measureBlocks?: MeasureBlocksFn;
11
12
  /** Document-wide `w:defaultTabStop` in twips — forwarded to toFlowBlocks. */
@@ -197,6 +197,7 @@ function convertFootnoteToContent(footnote, displayNumber, contentWidth, options
197
197
  if (options.theme !== void 0) proseOptions.theme = options.theme;
198
198
  const pmDoc = footnoteToProseDoc(footnote.content, proseOptions);
199
199
  const flowOptions = {};
200
+ if (options.defaultSize !== void 0) flowOptions.defaultSize = options.defaultSize;
200
201
  if (options.styles) flowOptions.styles = options.styles;
201
202
  if (options.theme !== void 0) flowOptions.theme = options.theme;
202
203
  if (options.fontAlternates !== void 0) flowOptions.fontAlternates = options.fontAlternates;
@@ -47,6 +47,7 @@ declare function calculateHeaderFooterBodyTopClearance(blocks: FlowBlock[], flow
47
47
  type ConvertHeaderFooterOptions = {
48
48
  styles?: document_d_exports.StyleDefinitions | null;
49
49
  theme?: document_d_exports.Theme | null;
50
+ defaultSize?: number;
50
51
  fontAlternates?: ToFlowBlocksOptions["fontAlternates"];
51
52
  measureBlocks: MeasureBlocksFn;
52
53
  /** Document-wide `w:defaultTabStop` in twips — forwarded to toFlowBlocks. */
@@ -359,6 +359,7 @@ function convertHeaderFooterToContent(headerFooter, contentWidth, metrics, optio
359
359
  if (options.theme !== void 0) proseDocOptions.theme = options.theme;
360
360
  const pmDoc = headerFooter.watermarkBlockIndex === void 0 ? headerFooterToProseDoc(headerFooter.content, proseDocOptions) : headerFooterToProseDocWithDetachedWatermarkHost(headerFooter, proseDocOptions);
361
361
  const flowOptions = {};
362
+ if (options.defaultSize !== void 0) flowOptions.defaultSize = options.defaultSize;
362
363
  if (options.styles) flowOptions.styles = options.styles;
363
364
  if (options.theme !== void 0) flowOptions.theme = options.theme;
364
365
  if (options.fontAlternates !== void 0) flowOptions.fontAlternates = options.fontAlternates;
@@ -383,6 +384,7 @@ function convertHeaderFooterToContent(headerFooter, contentWidth, metrics, optio
383
384
  function convertHeaderFooterPmDocToContent(pmDoc, contentWidth, metrics, options) {
384
385
  if (!pmDoc || pmDoc.content.size === 0) return;
385
386
  const flowOptions = {};
387
+ if (options.defaultSize !== void 0) flowOptions.defaultSize = options.defaultSize;
386
388
  if (options.styles) flowOptions.styles = options.styles;
387
389
  if (options.theme !== void 0) flowOptions.theme = options.theme;
388
390
  if (options.fontAlternates !== void 0) flowOptions.fontAlternates = options.fontAlternates;
@@ -69,25 +69,30 @@ type ToFlowBlocksOptions = {
69
69
  /** Line pitch for the final body section, whose properties live outside the PM body. */
70
70
  finalSectionDocumentGridLinePitchTwips?: number;
71
71
  };
72
+ /**
73
+ * Word's layout fallback when an imported OOXML style hierarchy never supplies
74
+ * `w:sz`. ECMA-376 deliberately leaves that terminal fallback to the consumer;
75
+ * this value matches Word and is therefore applied by the DOCX composition
76
+ * roots, while standalone ProseMirror documents keep the layout engine's 11pt
77
+ * default.
78
+ */
79
+ declare const WORD_UNSPECIFIED_FONT_SIZE = 10;
72
80
  /**
73
81
  * Reset the block ID counter (useful for testing).
74
82
  */
75
83
  declare function resetBlockIdCounter(): void;
84
+ /** A parsed border, or the same shape read off ProseMirror attributes. */
85
+ type ConvertibleBorder = {
86
+ style?: document_d_exports.BorderStyleValue;
87
+ size?: number;
88
+ space?: number;
89
+ color?: document_d_exports.ColorValue;
90
+ };
76
91
  /**
77
92
  * Convert an OOXML BorderSpec to a layout-engine BorderStyle.
78
93
  * Shared by paragraph borders, cell borders, and header/footer borders.
79
94
  */
80
- declare function convertBorderSpecToLayout(border: {
81
- style?: string;
82
- size?: number;
83
- space?: number;
84
- color?: {
85
- rgb?: string;
86
- themeColor?: string;
87
- themeTint?: string;
88
- themeShade?: string;
89
- };
90
- }, theme?: document_d_exports.Theme | null): BorderStyle | undefined;
95
+ declare function convertBorderSpecToLayout(border: ConvertibleBorder, theme?: document_d_exports.Theme | null): BorderStyle | undefined;
91
96
  /**
92
97
  * Convert a ProseMirror document to FlowBlock array.
93
98
  *
@@ -96,4 +101,4 @@ declare function convertBorderSpecToLayout(border: {
96
101
  */
97
102
  declare function toFlowBlocks(doc: Node, options?: ToFlowBlocksOptions): FlowBlock[];
98
103
  //#endregion
99
- export { ToFlowBlocksOptions, convertBorderSpecToLayout, formatCounter, resetBlockIdCounter, resolveListTemplate, toFlowBlocks };
104
+ export { ToFlowBlocksOptions, WORD_UNSPECIFIED_FONT_SIZE, convertBorderSpecToLayout, formatCounter, resetBlockIdCounter, resolveListTemplate, toFlowBlocks };