@stll/folio-core 0.46.0 → 0.47.1

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 (370) hide show
  1. package/dist/ai-edits/apply.d.ts +17 -1
  2. package/dist/ai-edits/apply.js +31 -27
  3. package/dist/ai-edits/headless.d.ts +9 -2
  4. package/dist/ai-edits/headless.js +5 -3
  5. package/dist/ai-edits/read.d.ts +1 -0
  6. package/dist/ai-edits/read.js +1 -0
  7. package/dist/ai-edits/snapshot.js +32 -27
  8. package/dist/ai-edits/table-cell-mutations.js +15 -7
  9. package/dist/ai-edits/table-geometry.js +21 -18
  10. package/dist/ai-edits/table-template.js +2 -2
  11. package/dist/compare/compare.js +2 -1
  12. package/dist/compare/content-alignment.js +192 -46
  13. package/dist/compare/content-types.d.ts +8 -2
  14. package/dist/compare/content.js +2 -11
  15. package/dist/compare/plan.js +7 -4
  16. package/dist/compare/section-boundary-properties.js +1 -2
  17. package/dist/content-controls/checkboxDisplay.d.ts +8 -2
  18. package/dist/content-controls/checkboxDisplay.js +11 -5
  19. package/dist/content-controls/mutateContentControls.js +41 -42
  20. package/dist/controller/layoutPipeline.js +8 -3
  21. package/dist/display-list/build/buildDisplayList.js +7 -7
  22. package/dist/display-list/build/imagePrimitives.d.ts +4 -4
  23. package/dist/display-list/build/imagePrimitives.js +38 -20
  24. package/dist/display-list/build/pageBorderPrimitives.js +2 -1
  25. package/dist/display-list/build/paragraphPrimitives.js +93 -13
  26. package/dist/display-list/build/previewPrimitives.d.ts +10 -0
  27. package/dist/display-list/build/previewPrimitives.js +89 -0
  28. package/dist/display-list/build/strokes.d.ts +177 -8
  29. package/dist/display-list/build/strokes.js +167 -47
  30. package/dist/display-list/build/tablePrimitives.js +4 -2
  31. package/dist/display-list/build/textBoxPrimitives.js +6 -4
  32. package/dist/display-list/build/textDecorations.d.ts +15 -1
  33. package/dist/display-list/build/textDecorations.js +15 -1
  34. package/dist/display-list/dom/renderDisplayListToDom.js +1 -19
  35. package/dist/display-list/primitives.d.ts +13 -2
  36. package/dist/display-list/primitives.js +36 -1
  37. package/dist/document-operations.d.ts +9 -2
  38. package/dist/document-operations.js +5 -3
  39. package/dist/docx/attributeRemainder.d.ts +34 -1
  40. package/dist/docx/attributeRemainder.js +49 -3
  41. package/dist/docx/blockContentParser.d.ts +2 -0
  42. package/dist/docx/blockContentParser.js +39 -67
  43. package/dist/docx/blockPlainText.js +3 -1
  44. package/dist/docx/borderParser.js +26 -11
  45. package/dist/docx/builtInStyles.d.ts +8 -16
  46. package/dist/docx/builtInStyles.js +54 -17
  47. package/dist/docx/commentAnchorIndex.js +1 -1
  48. package/dist/docx/commentParser.js +3 -3
  49. package/dist/docx/commentRangeIntegrity.js +1 -1
  50. package/dist/docx/commentRangeJoin.js +1 -1
  51. package/dist/docx/commentReferenceNormalization.js +3 -2
  52. package/dist/docx/commentReplyMarkers.js +1 -1
  53. package/dist/docx/compatibility.js +56 -42
  54. package/dist/docx/containerChildren.d.ts +110 -13
  55. package/dist/docx/containerChildren.gen.d.ts +16 -1
  56. package/dist/docx/containerChildren.gen.js +18 -1
  57. package/dist/docx/containerChildren.js +63 -13
  58. package/dist/docx/diagramPreview.d.ts +14 -2
  59. package/dist/docx/diagramPreview.js +81 -169
  60. package/dist/docx/documentParser.js +4 -1
  61. package/dist/docx/drawingAnchor.d.ts +87 -0
  62. package/dist/docx/drawingAnchor.js +201 -0
  63. package/dist/docx/drawingUtils.d.ts +43 -38
  64. package/dist/docx/drawingUtils.js +205 -118
  65. package/dist/docx/fontTableParser.js +102 -41
  66. package/dist/docx/footnoteParser.js +10 -6
  67. package/dist/docx/groupDrawingParser.js +4 -3
  68. package/dist/docx/headerFooterReferenceNormalization.js +1 -1
  69. package/dist/docx/hyperlinkParser.d.ts +45 -7
  70. package/dist/docx/hyperlinkParser.js +126 -57
  71. package/dist/docx/imageParser.js +127 -107
  72. package/dist/docx/index.d.ts +2 -1
  73. package/dist/docx/index.js +2 -1
  74. package/dist/docx/inlineContentRemovals.d.ts +28 -0
  75. package/dist/docx/inlineContentRemovals.js +46 -0
  76. package/dist/docx/inlineWrapperContent.d.ts +84 -3
  77. package/dist/docx/inlineWrapperContent.js +85 -4
  78. package/dist/docx/inlineWrapperParser.d.ts +11 -0
  79. package/dist/docx/inlineWrapperParser.js +60 -0
  80. package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
  81. package/dist/docx/normalizeBaseDirection.js +4 -2
  82. package/dist/docx/numberingParser.d.ts +25 -2
  83. package/dist/docx/numberingParser.js +264 -361
  84. package/dist/docx/numberingReference.d.ts +9 -16
  85. package/dist/docx/numberingReference.js +17 -16
  86. package/dist/docx/numberingReferenceNormalization.js +7 -7
  87. package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
  88. package/dist/docx/ooxmlCounterFormatter.js +4 -1
  89. package/dist/docx/paraIdAttribute.d.ts +91 -1
  90. package/dist/docx/paraIdAttribute.js +79 -1
  91. package/dist/docx/paragraphParser.d.ts +9 -24
  92. package/dist/docx/paragraphParser.js +212 -396
  93. package/dist/docx/paragraphProperties.d.ts +23 -0
  94. package/dist/docx/paragraphProperties.js +279 -0
  95. package/dist/docx/paragraphPropertySource.js +2 -0
  96. package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
  97. package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
  98. package/dist/docx/paragraphTraversal.d.ts +14 -10
  99. package/dist/docx/paragraphTraversal.js +47 -49
  100. package/dist/docx/parseWarningMessage.js +3 -0
  101. package/dist/docx/parserEnums.d.ts +6 -8
  102. package/dist/docx/parserEnums.js +4 -6
  103. package/dist/docx/preservedRunContent.js +16 -6
  104. package/dist/docx/previewBudget.d.ts +44 -23
  105. package/dist/docx/previewBudget.js +61 -30
  106. package/dist/docx/propertyElementAttributes.d.ts +178 -0
  107. package/dist/docx/propertyElementAttributes.js +114 -0
  108. package/dist/docx/renderedPageBreakNormalization.js +2 -2
  109. package/dist/docx/rezip.d.ts +28 -2
  110. package/dist/docx/rezip.js +78 -9
  111. package/dist/docx/runConsolidator.d.ts +42 -2
  112. package/dist/docx/runConsolidator.js +60 -6
  113. package/dist/docx/runParser.d.ts +54 -18
  114. package/dist/docx/runParser.js +379 -295
  115. package/dist/docx/runPayload.d.ts +5 -0
  116. package/dist/docx/runPayload.js +4 -0
  117. package/dist/docx/sdtProperties.d.ts +39 -5
  118. package/dist/docx/sdtProperties.js +205 -84
  119. package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
  120. package/dist/docx/sdtPropertiesPatch.js +68 -112
  121. package/dist/docx/sectionParser.d.ts +1 -2
  122. package/dist/docx/sectionParser.js +236 -240
  123. package/dist/docx/selectiveSave.js +3 -2
  124. package/dist/docx/selectiveXmlPatch.d.ts +21 -2
  125. package/dist/docx/selectiveXmlPatch.js +195 -99
  126. package/dist/docx/serializer/blockSdtSerializer.js +2 -96
  127. package/dist/docx/serializer/borderSerializer.d.ts +5 -5
  128. package/dist/docx/serializer/borderSerializer.js +10 -8
  129. package/dist/docx/serializer/documentSerializer.js +3 -0
  130. package/dist/docx/serializer/fontTableSerializer.js +31 -3
  131. package/dist/docx/serializer/headerFooterSerializer.js +3 -0
  132. package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
  133. package/dist/docx/serializer/markupRangeAttributes.js +9 -1
  134. package/dist/docx/serializer/noteSerializer.js +3 -0
  135. package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
  136. package/dist/docx/serializer/numberingSerializer.js +81 -79
  137. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
  138. package/dist/docx/serializer/paragraphSerializer.js +88 -188
  139. package/dist/docx/serializer/runSerializer.d.ts +1 -5
  140. package/dist/docx/serializer/runSerializer.js +109 -59
  141. package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
  142. package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
  143. package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
  144. package/dist/docx/serializer/settingsSerializer.js +6 -4
  145. package/dist/docx/serializer/stylesSerializer.js +8 -11
  146. package/dist/docx/serializer/tableSerializer.js +268 -100
  147. package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
  148. package/dist/docx/serializer/textFormattingSerializer.js +111 -101
  149. package/dist/docx/serializer/xmlUtils.d.ts +1 -1
  150. package/dist/docx/serializer/xmlUtils.js +1 -1
  151. package/dist/docx/server/createBilingualDocument.js +18 -16
  152. package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
  153. package/dist/docx/settingsParser.js +7 -4
  154. package/dist/docx/shadingParser.d.ts +2 -1
  155. package/dist/docx/shadingParser.js +43 -7
  156. package/dist/docx/shapeParser.js +8 -3
  157. package/dist/docx/strictNames.d.ts +11 -0
  158. package/dist/docx/strictNames.gen.d.ts +45 -0
  159. package/dist/docx/strictNames.gen.js +50 -0
  160. package/dist/docx/strictNames.js +43 -0
  161. package/dist/docx/strictValueEncodings.gen.js +133 -131
  162. package/dist/docx/styleParser.js +17 -349
  163. package/dist/docx/tableParser.d.ts +10 -1
  164. package/dist/docx/tableParser.js +505 -181
  165. package/dist/docx/textBoxParser.d.ts +3 -1
  166. package/dist/docx/textBoxParser.js +18 -8
  167. package/dist/docx/themeColorAttribute.d.ts +13 -0
  168. package/dist/docx/themeColorAttribute.js +24 -0
  169. package/dist/docx/trackedMoveRangeNormalization.js +2 -1
  170. package/dist/docx/vmlImageParser.d.ts +13 -4
  171. package/dist/docx/vmlImageParser.js +74 -31
  172. package/dist/docx/vmlPreview.js +2 -2
  173. package/dist/docx/wrapPolygon.d.ts +30 -0
  174. package/dist/docx/wrapPolygon.js +70 -0
  175. package/dist/docx/xmlParser.d.ts +14 -1
  176. package/dist/docx/xmlParser.js +18 -2
  177. package/dist/fonts/embeddedFonts.js +3 -3
  178. package/dist/headless-layout.js +2 -0
  179. package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
  180. package/dist/i18n/messages/catalogs.gen.js +102 -34
  181. package/dist/i18n/messages/messages.gen.d.ts +4 -0
  182. package/dist/internal/headlessRevisionResolution.js +9 -0
  183. package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
  184. package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
  185. package/dist/internal/paragraphFormattingSerialization.js +118 -83
  186. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  187. package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
  188. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  189. package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
  190. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
  191. package/dist/layout-bridge/convert/toFlowBlocks.js +177 -101
  192. package/dist/layout-engine/index.d.ts +2 -2
  193. package/dist/layout-engine/index.js +53 -17
  194. package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
  195. package/dist/layout-engine/measure/measureBlocks.js +6 -10
  196. package/dist/layout-engine/measure/tableCellGrid.js +2 -1
  197. package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
  198. package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
  199. package/dist/layout-engine/paragraphSequence.js +3 -2
  200. package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
  201. package/dist/layout-engine/section-breaks.d.ts +49 -2
  202. package/dist/layout-engine/section-breaks.js +55 -4
  203. package/dist/layout-engine/types.d.ts +47 -17
  204. package/dist/layout-engine/types.js +16 -1
  205. package/dist/layout-painter/borderStroke.d.ts +18 -4
  206. package/dist/layout-painter/renderPage.js +6 -4
  207. package/dist/layout-painter/renderParagraph.d.ts +2 -1
  208. package/dist/layout-painter/renderParagraph.js +13 -26
  209. package/dist/layout-painter/renderTable.d.ts +4 -1
  210. package/dist/layout-painter/renderTable.js +22 -22
  211. package/dist/layout-painter/renderTextBox.js +5 -3
  212. package/dist/markdown/renderBlock.js +3 -1
  213. package/dist/markdown/renderRuns.js +7 -2
  214. package/dist/markdown/renderTable.js +2 -1
  215. package/dist/model.d.ts +3 -3
  216. package/dist/model.js +2 -2
  217. package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
  218. package/dist/paged-layout/sectionBlockWidths.js +26 -4
  219. package/dist/prosemirror/attrs/index.d.ts +22 -4
  220. package/dist/prosemirror/attrs/index.js +498 -60
  221. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
  222. package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
  223. package/dist/prosemirror/commands/comments.js +68 -53
  224. package/dist/prosemirror/commands/contentControls.js +24 -19
  225. package/dist/prosemirror/commands/image.d.ts +1 -1
  226. package/dist/prosemirror/commands/image.js +4 -1
  227. package/dist/prosemirror/commands/paragraph.d.ts +2 -1
  228. package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
  229. package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
  230. package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
  231. package/dist/prosemirror/commands/sectionBreak.js +187 -11
  232. package/dist/prosemirror/conversion/fromProseDoc.d.ts +18 -2
  233. package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
  234. package/dist/prosemirror/conversion/index.d.ts +2 -2
  235. package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
  236. package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
  237. package/dist/prosemirror/conversion/runShadingMark.js +14 -1
  238. package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
  239. package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
  240. package/dist/prosemirror/conversion/toProseDoc.js +371 -141
  241. package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
  242. package/dist/prosemirror/emptyRangeAnchor.js +158 -0
  243. package/dist/prosemirror/extensions/StarterKit.js +8 -2
  244. package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
  245. package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
  246. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
  247. package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
  248. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
  249. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
  250. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
  251. package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
  252. package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
  253. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
  254. package/dist/prosemirror/extensions/markRegistry.d.ts +26 -2
  255. package/dist/prosemirror/extensions/markRegistry.js +73 -10
  256. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
  257. package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
  258. package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
  259. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
  260. package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
  261. package/dist/prosemirror/extensions/marks/markUtils.js +2 -1
  262. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
  263. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
  264. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
  265. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
  266. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
  267. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +10 -0
  268. package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
  269. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
  270. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
  271. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
  272. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
  273. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
  274. package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
  275. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +4 -0
  276. package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
  277. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
  278. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
  279. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
  280. package/dist/prosemirror/extensions/types.d.ts +12 -3
  281. package/dist/prosemirror/index.d.ts +4 -2
  282. package/dist/prosemirror/index.js +2 -1
  283. package/dist/prosemirror/inlineWrapperStack.js +20 -3
  284. package/dist/prosemirror/listMarker.d.ts +2 -2
  285. package/dist/prosemirror/listMarker.js +7 -8
  286. package/dist/prosemirror/listRenderingAttrs.js +11 -1
  287. package/dist/prosemirror/listState.d.ts +62 -0
  288. package/dist/prosemirror/listState.js +49 -0
  289. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
  290. package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
  291. package/dist/prosemirror/numberedRefFields.js +4 -4
  292. package/dist/prosemirror/numberingAttr.d.ts +55 -0
  293. package/dist/prosemirror/numberingAttr.js +74 -0
  294. package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
  295. package/dist/prosemirror/outlineLevelAttr.js +42 -0
  296. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
  297. package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
  298. package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
  299. package/dist/prosemirror/plugins/selectionTracker.js +3 -10
  300. package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
  301. package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
  302. package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
  303. package/dist/prosemirror/replacedAnnotations.js +24 -6
  304. package/dist/prosemirror/revisionCarriers.d.ts +86 -2
  305. package/dist/prosemirror/revisionCarriers.js +86 -60
  306. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
  307. package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
  308. package/dist/prosemirror/runIdentity.d.ts +28 -0
  309. package/dist/prosemirror/runIdentity.js +36 -0
  310. package/dist/prosemirror/runStyleFormatting.js +1 -1
  311. package/dist/prosemirror/schema/index.d.ts +2 -2
  312. package/dist/prosemirror/schema/marks.d.ts +23 -4
  313. package/dist/prosemirror/schema/nodes.d.ts +220 -24
  314. package/dist/prosemirror/sectionCarrier.d.ts +37 -0
  315. package/dist/prosemirror/sectionCarrier.js +40 -0
  316. package/dist/prosemirror/selectionState.d.ts +3 -0
  317. package/dist/prosemirror/selectionState.js +4 -1
  318. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
  319. package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
  320. package/dist/prosemirror/tableResize.js +5 -6
  321. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
  322. package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
  323. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
  324. package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
  325. package/dist/prosemirror/validation.js +17 -6
  326. package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
  327. package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
  328. package/dist/prosemirror/zeroWidthAnchors.js +4 -0
  329. package/dist/style-sets/extract.js +4 -4
  330. package/dist/style-sets/stellaStyle.js +36 -23
  331. package/dist/types/colors.d.ts +2 -2
  332. package/dist/types/content.d.ts +2 -2
  333. package/dist/types/documentEnumValues.d.ts +53 -26
  334. package/dist/types/documentEnumValues.js +72 -174
  335. package/dist/types/formatting.d.ts +2 -2
  336. package/dist/types/index.d.ts +9 -2
  337. package/dist/utils/borderCss.d.ts +246 -0
  338. package/dist/utils/borderCss.js +325 -0
  339. package/dist/utils/colorResolver.d.ts +4 -3
  340. package/dist/utils/colorResolver.js +45 -76
  341. package/dist/utils/createDocument.js +24 -6
  342. package/dist/utils/findReplace.js +52 -10
  343. package/dist/utils/formatToStyle.d.ts +84 -2
  344. package/dist/utils/formatToStyle.js +133 -52
  345. package/dist/utils/headingCollector.js +3 -2
  346. package/dist/utils/mergeDocumentContent.js +5 -3
  347. package/dist/utils/paragraphFormattingMerge.js +27 -6
  348. package/dist/utils/replaceText.js +1 -1
  349. package/dist/utils/tableOperations.d.ts +5 -3
  350. package/dist/utils/tableOperations.js +14 -1
  351. package/dist/utils/tablePlacement.d.ts +7 -0
  352. package/dist/utils/tablePlacement.js +14 -0
  353. package/dist/utils/textDirectionFlow.d.ts +15 -0
  354. package/dist/utils/textDirectionFlow.js +38 -0
  355. package/dist/utils/textFormattingMerge.js +16 -4
  356. package/package.json +10 -10
  357. package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
  358. package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
  359. package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
  360. package/dist/compare/__fixtures__/body-sequence.js +0 -225
  361. package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
  362. package/dist/compare/__fixtures__/nested-table.js +0 -50
  363. package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
  364. package/dist/compare/__fixtures__/numbered-list.js +0 -85
  365. package/dist/docx/bookmarkPlacement.d.ts +0 -9
  366. package/dist/docx/bookmarkPlacement.js +0 -52
  367. package/dist/fonts/embeddedFontTable.d.ts +0 -45
  368. package/dist/fonts/embeddedFontTable.js +0 -80
  369. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
  370. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
@@ -3,6 +3,7 @@ import { rectsToFloatingZones } from "../layout-engine/measure/floatingZones.js"
3
3
  import { measureParagraph } from "../layout-engine/measure/measureParagraph.js";
4
4
  import { resolveTableInlineOffset } from "../layout-engine/measure/tableInlinePlacement.js";
5
5
  import { floatingTextBoxReservesBand, floatingTextBoxWrapsText, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun } from "../layout-engine/types.js";
6
+ import { cssBorderStyle } from "../utils/borderCss.js";
6
7
  import { resolveFontFamily } from "../utils/fontResolver.js";
7
8
  import { borderToStyle } from "../utils/formatToStyle.js";
8
9
  import { normalizeHorizontalScalePercent } from "../utils/horizontalScale.js";
@@ -17,6 +18,7 @@ import { renderTextBoxFragment } from "./renderTextBox.js";
17
18
  import { emuToPixels } from "./renderUtils.js";
18
19
  import { renderWatermarkLayer } from "./renderWatermark.js";
19
20
  import { panic } from "better-result";
21
+ import { statesNoBorder } from "@stll/docx-core/model";
20
22
  //#region src/layout-painter/renderPage.ts
21
23
  /**
22
24
  * Page Renderer
@@ -76,13 +78,13 @@ function pageBorderSpacePx(border) {
76
78
  * exact stroke they will see on screen.
77
79
  */
78
80
  function pageBorderWidthPx(border) {
79
- if (!border || border.style === "none" || border.style === "nil") return 0;
81
+ if (!border || statesNoBorder(border.style)) return 0;
80
82
  const widthPx = border.size !== void 0 && border.size !== 0 ? eighthsToPixels(border.size) : 1;
81
83
  const floored = Math.max(1, widthPx);
82
- return border.style === "double" ? Math.max(3, floored) : floored;
84
+ return cssBorderStyle(border.style) === "double" ? Math.max(3, floored) : floored;
83
85
  }
84
86
  function applyPageBorderSide(element, border, side, theme) {
85
- if (!border || border.style === "none" || border.style === "nil") return;
87
+ if (!border || statesNoBorder(border.style)) return;
86
88
  const styles = borderToStyle(border, side, theme);
87
89
  for (const [key, value] of Object.entries(styles)) element.style[key] = String(value);
88
90
  const styleKey = `border${side}Style`;
@@ -100,7 +102,7 @@ function renderPageBorderOverlay(page, options, doc) {
100
102
  pb.bottom,
101
103
  pb.left,
102
104
  pb.right
103
- ].some((border) => border && border.style !== "none" && border.style !== "nil")) return null;
105
+ ].some((border) => border !== void 0 && !statesNoBorder(border.style))) return null;
104
106
  const offsetFrom = pb.offsetFrom ?? "text";
105
107
  const topOffset = pageBorderSpacePx(pb.top);
106
108
  const rightOffset = pageBorderSpacePx(pb.right);
@@ -134,6 +134,7 @@ type RenderLineOptions = {
134
134
  * @returns The line DOM element
135
135
  */
136
136
  declare function renderLine(block: ParagraphBlock, line: MeasuredLine, alignment: "left" | "center" | "right" | "justify" | undefined, doc: Document, options?: RenderLineOptions): HTMLElement;
137
+ declare const paragraphHasTrackedChanges: (block: ParagraphBlock) => boolean;
137
138
  /**
138
139
  * Render a paragraph fragment
139
140
  *
@@ -146,4 +147,4 @@ declare function renderLine(block: ParagraphBlock, line: MeasuredLine, alignment
146
147
  */
147
148
  declare function renderParagraphFragment(fragment: ParagraphFragment, block: ParagraphBlock, measure: ParagraphMeasure, context: RenderContext, options?: RenderParagraphOptions): HTMLElement;
148
149
  //#endregion
149
- export { PARAGRAPH_CLASS_NAMES, RenderParagraphOptions, UNICODE_BIDI_BY_WRAPPER_CONTROL, getLeaderChar, getRenderableTextColor, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
150
+ export { PARAGRAPH_CLASS_NAMES, RenderParagraphOptions, UNICODE_BIDI_BY_WRAPPER_CONTROL, getLeaderChar, getRenderableTextColor, paragraphHasTrackedChanges, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
@@ -12,6 +12,7 @@ import { writeCommentAnchorIds } from "../render-dom/commentAnchorAttributes.js"
12
12
  import { AUTHOR_COLORS, getAuthorColorIdx } from "../utils/authorColors.js";
13
13
  import { resolveFontFamily } from "../utils/fontResolver.js";
14
14
  import "../utils/fontWeights.js";
15
+ import { underlineDecorationCss } from "../utils/formatToStyle.js";
15
16
  import { getHorizontalScaleFactor } from "../utils/horizontalScale.js";
16
17
  import { resolvePhysicalParagraphInlineLayout } from "../utils/paragraphInlineLayout.js";
17
18
  import { inlineImageBoundingBox, parseRotationDegrees, rotatedBoundingBox } from "../utils/rotationBoundingBox.js";
@@ -238,14 +239,15 @@ function applyRunStyles(element, run) {
238
239
  const decorations = [];
239
240
  let explicitDecorationStyle = false;
240
241
  if (run.underline) {
241
- if (!isNoteReferenceRun(run)) decorations.push("underline");
242
- if (typeof run.underline === "object") {
243
- if (run.underline.style) {
244
- element.style.textDecorationStyle = run.underline.style;
245
- explicitDecorationStyle = true;
246
- }
247
- if (run.underline.color) element.style.textDecorationColor = run.underline.color;
242
+ const authored = typeof run.underline === "object" ? run.underline.style : void 0;
243
+ const underline = authored === void 0 ? void 0 : underlineDecorationCss(authored);
244
+ if ((underline === void 0 || underline.decorationStyle !== void 0) && !isNoteReferenceRun(run)) decorations.push("underline");
245
+ if (underline?.decorationStyle !== void 0) {
246
+ element.style.textDecorationStyle = underline.decorationStyle;
247
+ explicitDecorationStyle = true;
248
248
  }
249
+ if (underline?.decorationThickness !== void 0) element.style.textDecorationThickness = underline.decorationThickness;
250
+ if (typeof run.underline === "object" && run.underline.color) element.style.textDecorationColor = run.underline.color;
249
251
  }
250
252
  if (run.strike) decorations.push("line-through");
251
253
  if (run.hidden) {
@@ -1451,6 +1453,7 @@ function bordersFormGroup(a, b) {
1451
1453
  if (!a || !b) return false;
1452
1454
  return bordersEqual(a.top, b.top) && bordersEqual(a.bottom, b.bottom) && bordersEqual(a.left, b.left) && bordersEqual(a.right, b.right) && bordersEqual(a.between, b.between);
1453
1455
  }
1456
+ const paragraphHasTrackedChanges = (block) => block.attrs?.listMarkerRevision !== void 0 || block.runs.some((run) => run.kind !== "lineBreak" && (run.isInsertion === true || run.isDeletion === true));
1454
1457
  /**
1455
1458
  * Render a paragraph fragment
1456
1459
  *
@@ -1470,6 +1473,7 @@ function renderParagraphFragment(fragment, block, measure, context, options = {}
1470
1473
  if (block.paraId) fragmentEl.dataset["paraId"] = block.paraId;
1471
1474
  fragmentEl.dataset["fromLine"] = String(fragment.fromLine);
1472
1475
  fragmentEl.dataset["toLine"] = String(fragment.toLine);
1476
+ if (paragraphHasTrackedChanges(block)) fragmentEl.dataset["trackedChanges"] = "true";
1473
1477
  applyPmPositions(fragmentEl, fragment.pmStart, fragment.pmEnd);
1474
1478
  applySdtDataAttrs(fragmentEl, fragment.sdtGroups);
1475
1479
  if (fragment.continuesFromPrev) fragmentEl.dataset["continuesFromPrev"] = "true";
@@ -1486,25 +1490,8 @@ function renderParagraphFragment(fragment, block, measure, context, options = {}
1486
1490
  const indent = block.attrs?.indent;
1487
1491
  const borders = block.attrs?.borders;
1488
1492
  if (borders) {
1489
- const borderStyleToCss = (style) => {
1490
- switch (style) {
1491
- case "single": return "solid";
1492
- case "double": return "double";
1493
- case "dotted": return "dotted";
1494
- case "dashed": return "dashed";
1495
- case "thick": return "solid";
1496
- case "wave": return "wavy";
1497
- case "dashSmallGap": return "dashed";
1498
- case "nil":
1499
- case "none": return "none";
1500
- default: return "solid";
1501
- }
1502
- };
1503
1493
  fragmentEl.style.boxSizing = "border-box";
1504
- const borderToCss = (border) => borderStrokeToCss({
1505
- ...border,
1506
- style: borderStyleToCss(border.style)
1507
- });
1494
+ const borderToCss = (border) => borderStrokeToCss(border);
1508
1495
  const groupedWithPrev = bordersFormGroup(options.prevBorders, borders);
1509
1496
  const groupedWithNext = bordersFormGroup(borders, options.nextBorders);
1510
1497
  const renderedTopBorder = groupedWithPrev ? borders.between : borders.top;
@@ -1686,4 +1673,4 @@ function renderListMarker({ marker, inlineWidth, visualOffset, doc, formatting,
1686
1673
  return span;
1687
1674
  }
1688
1675
  //#endregion
1689
- export { PARAGRAPH_CLASS_NAMES, UNICODE_BIDI_BY_WRAPPER_CONTROL, getLeaderChar, getRenderableTextColor, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
1676
+ export { PARAGRAPH_CLASS_NAMES, UNICODE_BIDI_BY_WRAPPER_CONTROL, getLeaderChar, getRenderableTextColor, paragraphHasTrackedChanges, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
@@ -1,6 +1,7 @@
1
1
  import { TableBlock, TableFragment, TableMeasure } from "../layout-engine/types.js";
2
2
  import { RenderContext } from "./renderUtils.js";
3
3
  import { PageGeometry } from "./anchoredImagePosition.js";
4
+ import { TextDirection } from "@stll/docx-core/model";
4
5
  //#region src/layout-painter/renderTable.d.ts
5
6
  /**
6
7
  * CSS class names for table elements
@@ -15,6 +16,8 @@ declare const TABLE_CLASS_NAMES: {
15
16
  tableEdgeHandleBottom: string;
16
17
  tableEdgeHandleRight: string;
17
18
  };
19
+ /** The quarter turn a cell's `w:textDirection` puts on its content. */
20
+ declare const cellTextRotationDegrees: (direction: TextDirection | undefined) => number;
18
21
  /**
19
22
  * Options for rendering a table fragment
20
23
  */
@@ -38,4 +41,4 @@ declare function renderNestedTable(block: TableBlock, measure: TableMeasure, con
38
41
  */
39
42
  declare function renderTableFragment(fragment: TableFragment, block: TableBlock, measure: TableMeasure, context: RenderContext, options?: RenderTableFragmentOptions): HTMLElement;
40
43
  //#endregion
41
- export { RenderTableFragmentOptions, TABLE_CLASS_NAMES, renderNestedTable, renderTableFragment };
44
+ export { RenderTableFragmentOptions, TABLE_CLASS_NAMES, cellTextRotationDegrees, renderNestedTable, renderTableFragment };
@@ -5,6 +5,7 @@ import { buildTableCellGrid, buildTableCellPlacements, getSourceCellAt } from ".
5
5
  import { tableFragmentBottomBorders } from "../layout-engine/measure/tableFragmentBorderGeometry.js";
6
6
  import { resolveTableInlineOffset, resolveTableInlinePlacement } from "../layout-engine/measure/tableInlinePlacement.js";
7
7
  import { isFloatingImageRun, isFloatingTextBoxBlock, resolveTableCellPadding, tableColumnsArePinned } from "../layout-engine/types.js";
8
+ import { paintsCssBorder } from "../utils/borderCss.js";
8
9
  import { applySanitizedImageSrc } from "../utils/sanitizeImageSrc.js";
9
10
  import { emuToPixels } from "../utils/units.js";
10
11
  import { resolveAnchoredImagePosition } from "./anchoredImagePosition.js";
@@ -14,6 +15,7 @@ import { applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs } from "./rend
14
15
  import { renderParagraphFragment } from "./renderParagraph.js";
15
16
  import { renderTextBoxFragment } from "./renderTextBox.js";
16
17
  import { ownedRowBottomBorderOffsets } from "./tableRowPaintGeometry.js";
18
+ import { TEXT_DIRECTION_FLOW_BY_TOKEN } from "@stll/docx-core/model";
17
19
  //#region src/layout-painter/renderTable.ts
18
20
  /**
19
21
  * Table Renderer
@@ -40,29 +42,27 @@ const TABLE_CLASS_NAMES = {
40
42
  const CELL_DIAGONAL_BORDER_CLASS = "layout-table-cell-diagonal-border";
41
43
  const CELL_BOTTOM_BORDER_CLASS = "layout-table-cell-bottom-border";
42
44
  /**
43
- * Quarter turn a `w:textDirection` puts on cell content (§17.18.93, plus the
44
- * short spellings Word also writes).
45
+ * Quarter turn a text flow puts on cell content.
45
46
  *
46
- * `btLr` runs bottom-to-top up the left edge, so it turns counter-clockwise;
47
- * every top-to-bottom direction runs down the right edge and turns clockwise.
48
- * The horizontal directions are the identity — `rl` is bidi, not rotation.
49
- * Only `btLr` was handled, so a rotated header cell (the common `tbRl` shape)
50
- * painted horizontally and overflowed its column.
47
+ * Keyed by flow, not by token: `ST_TextDirection` spells each of these six
48
+ * flows twice, and the two spellings have to turn the same way. `lr` runs
49
+ * bottom-to-top up the left edge, so it turns counter-clockwise; `rl` and
50
+ * `lrV` run down the right edge and turn clockwise. `tb` and `tbV` are the
51
+ * horizontal flows and do not turn at all.
51
52
  *
52
- * Total over the union on purpose: a new direction has to state its turn here
53
- * rather than silently falling back to horizontal.
53
+ * Total over the flows on purpose: a flow nobody mapped has to state its turn
54
+ * here rather than silently falling back to horizontal.
54
55
  */
55
56
  const CELL_TEXT_ROTATION_DEGREES = {
56
- lr: 0,
57
- lrV: 0,
58
- rl: 0,
59
- rlV: 0,
60
- tb: 90,
61
- tbV: 90,
62
- tbRl: 90,
63
- tbRlV: 90,
64
- btLr: -90
57
+ tb: 0,
58
+ tbV: 0,
59
+ rl: 90,
60
+ rlV: 90,
61
+ lrV: 90,
62
+ lr: -90
65
63
  };
64
+ /** The quarter turn a cell's `w:textDirection` puts on its content. */
65
+ const cellTextRotationDegrees = (direction) => direction === void 0 ? 0 : CELL_TEXT_ROTATION_DEGREES[TEXT_DIRECTION_FLOW_BY_TOKEN[direction]];
66
66
  function renderCellContent({ cell, cellMeasure, context, doc, contentWidthOverride, pageContentPosition }) {
67
67
  const contentEl = doc.createElement("div");
68
68
  contentEl.className = TABLE_CLASS_NAMES.cellContent;
@@ -336,7 +336,7 @@ function renderNestedTable(block, measure, context, doc, frameWidth = context.co
336
336
  */
337
337
  function applyBorder(el, side, border) {
338
338
  const styleProp = `border${side.charAt(0).toUpperCase() + side.slice(1)}`;
339
- if (!border || border.style === "none" || border.style === "nil") el.style[styleProp] = "none";
339
+ if (!border || !paintsCssBorder(border.style)) el.style[styleProp] = "none";
340
340
  else el.style[styleProp] = borderStrokeToCss(border);
341
341
  }
342
342
  function renderCellDiagonalBorder({ border, direction, cellWidth, cellHeight, doc }) {
@@ -415,7 +415,7 @@ function renderTableCell({ cell, cellMeasure, x, width, rowHeight, borderFlags,
415
415
  default: break;
416
416
  }
417
417
  }
418
- const cellTextRotation = cell.textDirection ? CELL_TEXT_ROTATION_DEGREES[cell.textDirection] : 0;
418
+ const cellTextRotation = cellTextRotationDegrees(cell.textDirection);
419
419
  const contentWidthOverride = cellTextRotation === 0 ? void 0 : Math.max(1, rowHeight - padTop - padBottom);
420
420
  const renderedContent = renderCellContent({
421
421
  cell,
@@ -479,7 +479,7 @@ function renderTableCell({ cell, cellMeasure, x, width, rowHeight, borderFlags,
479
479
  }
480
480
  return cellEl;
481
481
  }
482
- const hasVisibleBorder = (border) => border !== void 0 && border.style !== "none" && border.style !== "nil";
482
+ const hasVisibleBorder = (border) => border !== void 0 && paintsCssBorder(border.style);
483
483
  const isMinimumHeightRow = (row) => row?.height !== void 0 && row.heightRule !== "exact";
484
484
  const rowHasVerticalMerge = (row) => row?.cells.some((cell) => (cell.rowSpan ?? 1) > 1) === true;
485
485
  const continuationRowBottomBorderOffsets = (fragment, block, measure, cellGrid) => {
@@ -803,4 +803,4 @@ function renderTableFragment(fragment, block, measure, context, options = {}) {
803
803
  return tableEl;
804
804
  }
805
805
  //#endregion
806
- export { TABLE_CLASS_NAMES, renderNestedTable, renderTableFragment };
806
+ export { TABLE_CLASS_NAMES, cellTextRotationDegrees, renderNestedTable, renderTableFragment };
@@ -1,5 +1,7 @@
1
1
  import { layoutTextBoxContent } from "../layout-engine/measure/textBoxParagraphLayout.js";
2
2
  import { DEFAULT_TEXTBOX_MARGINS } from "../layout-engine/types.js";
3
+ import { presetDashForOutlineAttr } from "../types/documentEnumValues.js";
4
+ import { cssBorderStyleForDash } from "../utils/borderCss.js";
3
5
  import { setAuthoredBackgroundColor } from "./documentColors.js";
4
6
  import { renderParagraphFragment } from "./renderParagraph.js";
5
7
  import { panic } from "better-result";
@@ -30,10 +32,10 @@ function renderTextBoxFragment(fragment, block, measure, context, options = {})
30
32
  containerEl.style.overflow = block.textWrap === "none" ? "visible" : "hidden";
31
33
  containerEl.style.boxSizing = "border-box";
32
34
  if (block.fillColor) setAuthoredBackgroundColor(containerEl.style, block.fillColor);
33
- if (block.outlineWidth && block.outlineWidth > 0) {
34
- const style = block.outlineStyle || "solid";
35
+ const outlineDash = presetDashForOutlineAttr(block.outlineStyle) ?? "solid";
36
+ if (block.outlineWidth && block.outlineWidth > 0 && outlineDash !== "none") {
35
37
  const color = block.outlineColor || "#000000";
36
- containerEl.style.border = `${block.outlineWidth}px ${style} ${color}`;
38
+ containerEl.style.border = `${block.outlineWidth}px ${cssBorderStyleForDash(outlineDash)} ${color}`;
37
39
  }
38
40
  const margins = block.margins ?? DEFAULT_TEXTBOX_MARGINS;
39
41
  containerEl.style.padding = `${margins.top}px ${margins.right}px ${margins.bottom}px ${margins.left}px`;
@@ -71,7 +71,9 @@ function renderBlocks(ctx, pkg, blocks) {
71
71
  }
72
72
  break;
73
73
  }
74
- case "preservedBlock": break;
74
+ case "preservedBlock":
75
+ case "bookmarkStart":
76
+ case "bookmarkEnd": break;
75
77
  default: panic(`Unsupported block content in markdown: ${JSON.stringify(block)}`);
76
78
  }
77
79
  return out.join("\n");
@@ -1,3 +1,4 @@
1
+ import { getHyperlinkRuns } from "../docx/hyperlinkParser.js";
1
2
  import { RELATIONSHIP_TYPES, resolveRelationshipIdOfType } from "../docx/relsParser.js";
2
3
  import { decodeOoxmlSymbolCharacter } from "../utils/ooxmlSymbol.js";
3
4
  import { wrapComment, wrapDeletion, wrapInsertion, wrapMoveFrom, wrapMoveTo } from "./annotations.js";
@@ -131,7 +132,7 @@ function renderRun(ctx, pkg, run, paraId) {
131
132
  return `${lead}${applyMarks(core, marksFor(run))}${trail}`;
132
133
  }
133
134
  function renderHyperlink(ctx, pkg, link, paraId) {
134
- const inner = link.children.map((child) => child.type === "run" ? renderRun(ctx, pkg, child, paraId) : "").join("");
135
+ const inner = getHyperlinkRuns(link).map((run) => renderRun(ctx, pkg, run, paraId)).join("");
135
136
  if (!inner) return "";
136
137
  const href = link.href ?? (link.anchor ? `#${link.anchor}` : "");
137
138
  if (!href) {
@@ -217,7 +218,11 @@ function renderParagraphInline(ctx, pkg, content, paraId) {
217
218
  out += renderRun(ctx, pkg, child, paraId);
218
219
  continue;
219
220
  }
220
- out += child.type === "hyperlink" ? renderHyperlink(ctx, pkg, child, paraId) : child.text;
221
+ if (child.type === "hyperlink") {
222
+ out += renderHyperlink(ctx, pkg, child, paraId);
223
+ continue;
224
+ }
225
+ out += child.type === "inlineWrapper" ? renderParagraphInline(ctx, pkg, child.content, paraId) : child.text;
221
226
  }
222
227
  break;
223
228
  }
@@ -1,3 +1,4 @@
1
+ import { getHyperlinkRuns } from "../docx/hyperlinkParser.js";
1
2
  import { RELATIONSHIP_TYPES, resolveRelationshipIdOfType } from "../docx/relsParser.js";
2
3
  import { decodeOoxmlSymbolCharacter } from "../utils/ooxmlSymbol.js";
3
4
  import { escapeTableCell } from "./escape.js";
@@ -243,7 +244,7 @@ function renderHtmlRun(ctx, pkg, run, paraId) {
243
244
  return text;
244
245
  }
245
246
  function renderHtmlHyperlink(ctx, pkg, link, paraId) {
246
- const inner = link.children.filter((c) => c.type === "run").map((r) => renderHtmlRun(ctx, pkg, r, paraId)).join("");
247
+ const inner = getHyperlinkRuns(link).map((run) => renderHtmlRun(ctx, pkg, run, paraId)).join("");
247
248
  if (!inner) return "";
248
249
  const href = link.href ?? (link.anchor ? `#${link.anchor}` : "");
249
250
  if (!href) return inner;
package/dist/model.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { document_d_exports } from "./types/document.js";
2
- import { BORDER_STYLE_VALUES, CONDITIONAL_STYLE_TYPE_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIASES, OUTLINE_STYLE_CSS_ALIAS_VALUES, OutlineStyleAttr, OutlineStyleCssAlias, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_OUTLINE_STYLE_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES, normalizeShapeTextAnchor } from "./types/documentEnumValues.js";
2
+ import { CONDITIONAL_STYLE_TYPE_VALUES, COUNTER_FORMAT_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIAS_VALUES, OutlineStyleAttr, OutlineStyleCssAlias, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_DIRECTION_VALUES, TEXT_EFFECT_VALUES, UNDERLINE_STYLE_VALUES, normalizeShapeTextAnchor, outlineAttrForDash, presetDashForOutlineAttr } from "./types/documentEnumValues.js";
3
3
  import { DeriveBlockIdInput, FolioBlockId, currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
4
4
  import { types_d_exports } from "./layout-engine/types.js";
5
5
  import { measureTypes_d_exports } from "./layout-engine/measure/measureTypes.js";
6
6
  export * from "@stll/docx-core/model";
7
7
  declare namespace model_d_exports {
8
- export { BORDER_STYLE_VALUES, CONDITIONAL_STYLE_TYPE_VALUES, DeriveBlockIdInput, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, FolioBlockId, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, types_d_exports as Layout, measureTypes_d_exports as Measure, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIASES, OUTLINE_STYLE_CSS_ALIAS_VALUES, OutlineStyleAttr, OutlineStyleCssAlias, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_OUTLINE_STYLE_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES, currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId, normalizeShapeTextAnchor };
8
+ export { CONDITIONAL_STYLE_TYPE_VALUES, COUNTER_FORMAT_VALUES, DeriveBlockIdInput, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, FolioBlockId, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, types_d_exports as Layout, measureTypes_d_exports as Measure, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIAS_VALUES, OutlineStyleAttr, OutlineStyleCssAlias, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_DIRECTION_VALUES, TEXT_EFFECT_VALUES, UNDERLINE_STYLE_VALUES, currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId, normalizeShapeTextAnchor, outlineAttrForDash, presetDashForOutlineAttr };
9
9
  }
10
10
  //#endregion
11
- export { BORDER_STYLE_VALUES, CONDITIONAL_STYLE_TYPE_VALUES, DeriveBlockIdInput, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, FolioBlockId, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, types_d_exports as Layout, type measureTypes_d_exports as Measure, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIASES, OUTLINE_STYLE_CSS_ALIAS_VALUES, OutlineStyleAttr, OutlineStyleCssAlias, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_OUTLINE_STYLE_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES, currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId, normalizeShapeTextAnchor };
11
+ export { CONDITIONAL_STYLE_TYPE_VALUES, COUNTER_FORMAT_VALUES, DeriveBlockIdInput, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, FolioBlockId, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, types_d_exports as Layout, type measureTypes_d_exports as Measure, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIAS_VALUES, OutlineStyleAttr, OutlineStyleCssAlias, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_DIRECTION_VALUES, TEXT_EFFECT_VALUES, UNDERLINE_STYLE_VALUES, currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId, normalizeShapeTextAnchor, outlineAttrForDash, presetDashForOutlineAttr };
package/dist/model.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { types_exports } from "./layout-engine/types.js";
2
2
  import { currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
3
- import { BORDER_STYLE_VALUES, CONDITIONAL_STYLE_TYPE_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIASES, OUTLINE_STYLE_CSS_ALIAS_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_OUTLINE_STYLE_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES, normalizeShapeTextAnchor } from "./types/documentEnumValues.js";
4
- export { BORDER_STYLE_VALUES, CONDITIONAL_STYLE_TYPE_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, types_exports as Layout, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIASES, OUTLINE_STYLE_CSS_ALIAS_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_OUTLINE_STYLE_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES, currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId, normalizeShapeTextAnchor };
3
+ import { CONDITIONAL_STYLE_TYPE_VALUES, COUNTER_FORMAT_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIAS_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_DIRECTION_VALUES, TEXT_EFFECT_VALUES, UNDERLINE_STYLE_VALUES, normalizeShapeTextAnchor, outlineAttrForDash, presetDashForOutlineAttr } from "./types/documentEnumValues.js";
4
+ export { CONDITIONAL_STYLE_TYPE_VALUES, COUNTER_FORMAT_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, types_exports as Layout, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, OUTLINE_STYLE_CSS_ALIAS_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, SHAPE_TEXT_ANCHOR_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_DIRECTION_VALUES, TEXT_EFFECT_VALUES, UNDERLINE_STYLE_VALUES, currentFolioBlockId, deriveBlankBlockId, deriveBlockId, getFolioParaIdFromBlockId, getSequentialFolioBlockIdIndex, isBlankFolioBlockId, isFolioBlockId, isSequentialFolioBlockId, normalizeShapeTextAnchor, outlineAttrForDash, presetDashForOutlineAttr };
@@ -1,4 +1,5 @@
1
1
  import { FlowBlock } from "../layout-engine/types.js";
2
+ import { SectionStartAdvance } from "../layout-engine/section-breaks.js";
2
3
  import { SectionLayoutConfig } from "../layout-engine/index.js";
3
4
  //#region src/paged-layout/sectionBlockWidths.d.ts
4
5
  type ComputePerBlockMeasureInput = {
@@ -27,6 +28,8 @@ type PerBlockMeasureInputs = {
27
28
  contentLefts: number[];
28
29
  columnIndices: number[];
29
30
  columnCounts: number[];
31
+ /** Resolved paginator transition at each section-break block. */
32
+ sectionAdvances: (SectionStartAdvance | undefined)[];
30
33
  physicalPageGeometry: PerBlockPhysicalPageGeometry;
31
34
  };
32
35
  /**
@@ -1,7 +1,7 @@
1
1
  import { collectSectionConfigs } from "../layout-engine/index.js";
2
2
  import { hasPageBreakBefore } from "../layout-engine/keep-together.js";
3
3
  import { calculateColumnLefts, calculateColumnWidths } from "../layout-engine/paginator.js";
4
- import { normalizeSectionBreakType } from "../layout-engine/section-breaks.js";
4
+ import { physicalColumnRegionIsShared, sectionStartAdvanceOf } from "../layout-engine/section-breaks.js";
5
5
  //#region src/paged-layout/sectionBlockWidths.ts
6
6
  function resolvePreBlockPageTransition(block, config) {
7
7
  if (!hasPageBreakBefore(block)) return { type: "none" };
@@ -57,11 +57,13 @@ function computePerBlockMeasureInputs({ blocks, bodyConfig, finalConfig }) {
57
57
  const contentLefts = [];
58
58
  const columnIndices = [];
59
59
  const columnCounts = [];
60
+ const sectionAdvances = [];
60
61
  const initialConfig = sectionConfigs[0] ?? finalConfig;
61
62
  let physicalPageGeometry = {
62
63
  pageSize: initialConfig.pageSize,
63
64
  margins: initialConfig.margins
64
65
  };
66
+ let hasPhysicalPage = false;
65
67
  let hasPhysicalPageContent = false;
66
68
  for (let i = 0; i < blocks.length; i++) {
67
69
  const config = sectionConfigs[sectionIdx] ?? finalConfig;
@@ -70,6 +72,7 @@ function computePerBlockMeasureInputs({ blocks, bodyConfig, finalConfig }) {
70
72
  switch (preBlockTransition.type) {
71
73
  case "physicalPage":
72
74
  physicalPageGeometry = preBlockTransition.geometry;
75
+ hasPhysicalPage = true;
73
76
  hasPhysicalPageContent = false;
74
77
  columnGeometryDirty = true;
75
78
  columnIndex = 0;
@@ -88,6 +91,7 @@ function computePerBlockMeasureInputs({ blocks, bodyConfig, finalConfig }) {
88
91
  contentLefts.push(activeContentLefts[columnIndex] ?? physicalPageGeometry.margins.left);
89
92
  columnIndices.push(columnIndex);
90
93
  columnCounts.push(activeColumns.count);
94
+ sectionAdvances.push(void 0);
91
95
  marginTops.push(config.margins.top);
92
96
  physicalMarginTops.push(physicalPageGeometry.margins.top);
93
97
  pageHeights.push(config.pageSize.h);
@@ -103,21 +107,34 @@ function computePerBlockMeasureInputs({ blocks, bodyConfig, finalConfig }) {
103
107
  if (sectionIdx < breakIndices.length && i === breakIndices[sectionIdx]) {
104
108
  const sectionBreak = block;
105
109
  const nextConfig = sectionConfigs[sectionIdx + 1] ?? finalConfig;
106
- if (!(sectionBreak?.kind === "sectionBreak" && normalizeSectionBreakType(sectionBreak.type) === "continuous" && hasPhysicalPageContent && Math.round(nextConfig.pageSize.w) === Math.round(physicalPageGeometry.pageSize.w) && Math.round(nextConfig.pageSize.h) === Math.round(physicalPageGeometry.pageSize.h))) {
110
+ const advance = sectionBreak?.kind === "sectionBreak" ? sectionStartAdvanceOf(sectionBreak.type) : "page";
111
+ const sharesColumnRegion = hasPhysicalPage && advance === "column" && physicalColumnRegionIsShared({
112
+ ...physicalPageGeometry,
113
+ columns: activeColumns
114
+ }, nextConfig);
115
+ const continuesInNextColumn = sharesColumnRegion && columnIndex + 1 < activeColumns.count;
116
+ const pageSizeIsShared = Math.round(nextConfig.pageSize.w) === Math.round(physicalPageGeometry.pageSize.w) && Math.round(nextConfig.pageSize.h) === Math.round(physicalPageGeometry.pageSize.h);
117
+ let sectionAdvance = "region";
118
+ if (advance === "page" || !pageSizeIsShared || sharesColumnRegion && !continuesInNextColumn) sectionAdvance = "page";
119
+ else if (continuesInNextColumn) sectionAdvance = "column";
120
+ sectionAdvances[i] = sectionAdvance;
121
+ if (!(sectionAdvance === "column" || sectionAdvance === "region" && hasPhysicalPageContent)) {
107
122
  physicalPageGeometry = {
108
123
  pageSize: nextConfig.pageSize,
109
124
  margins: nextConfig.margins
110
125
  };
111
126
  hasPhysicalPageContent = false;
112
127
  }
128
+ if (sectionAdvance === "page") hasPhysicalPage = true;
113
129
  columnGeometryDirty = true;
114
130
  sectionIdx++;
115
- columnIndex = 0;
131
+ columnIndex = sectionAdvance === "column" ? columnIndex + 1 : 0;
116
132
  } else if (block.kind === "pageBreak") {
117
133
  physicalPageGeometry = {
118
134
  pageSize: config.pageSize,
119
135
  margins: config.margins
120
136
  };
137
+ hasPhysicalPage = true;
121
138
  hasPhysicalPageContent = false;
122
139
  columnGeometryDirty = true;
123
140
  columnIndex = 0;
@@ -130,8 +147,12 @@ function computePerBlockMeasureInputs({ blocks, bodyConfig, finalConfig }) {
130
147
  hasPhysicalPageContent = false;
131
148
  columnGeometryDirty = true;
132
149
  }
150
+ hasPhysicalPage = true;
133
151
  columnIndex = (columnIndex + 1) % activeColumns.count;
134
- } else hasPhysicalPageContent = true;
152
+ } else {
153
+ hasPhysicalPage = true;
154
+ hasPhysicalPageContent = true;
155
+ }
135
156
  }
136
157
  return {
137
158
  widths,
@@ -144,6 +165,7 @@ function computePerBlockMeasureInputs({ blocks, bodyConfig, finalConfig }) {
144
165
  contentLefts,
145
166
  columnIndices,
146
167
  columnCounts,
168
+ sectionAdvances,
147
169
  physicalPageGeometry: {
148
170
  pageHeights: physicalPageHeights,
149
171
  pageWidths: physicalPageWidths,
@@ -1,4 +1,4 @@
1
- import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperLayer, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
1
+ import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperLayer, LanguageAttrs, RunFormattingOverrideAttrs, RunIdentityMarkAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
2
2
  import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, MathAttrs, PageBreakRunAttrs, ParagraphAttrs, PreservedBlockAttrs, PreservedXmlAttrs, SdtAttrs, ShapeAttrs, SymbolAttrs, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "../schema/nodes.js";
3
3
  import "../schema/index.js";
4
4
  import { Mark, Node } from "prosemirror-model";
@@ -80,8 +80,17 @@ declare const readTrackedChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsRe
80
80
  declare const expectTrackedChangeMarkAttrs: (mark: Mark) => TrackedChangeMarkAttrs;
81
81
  declare const readRunPropertyChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunPropertyChangeMarkAttrs>;
82
82
  declare const expectRunPropertyChangeMarkAttrs: (mark: Mark) => RunPropertyChangeMarkAttrs;
83
- declare const readPageBreakRunOwnerMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<PageBreakRunOwnerMarkAttrs>;
84
- declare const expectPageBreakRunOwnerMarkAttrs: (mark: Mark) => PageBreakRunOwnerMarkAttrs;
83
+ /**
84
+ * The identity mark's payload, field by field.
85
+ *
86
+ * Every field is read strictly because the mark reaches this build from three
87
+ * places it does not control: a paste, a collaboration snapshot written by
88
+ * another build, and a host that edited the document through the public API.
89
+ * A remainder entry that is not a resolved name and a string value would be
90
+ * written straight back into a `w:r` start tag.
91
+ */
92
+ declare const readRunIdentityMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunIdentityMarkAttrs>;
93
+ declare const expectRunIdentityMarkAttrs: (mark: Mark) => RunIdentityMarkAttrs;
85
94
  /**
86
95
  * A wrapper stack read from outside the editor — the DOM on paste, a stored
87
96
  * snapshot — validated layer by layer.
@@ -98,6 +107,15 @@ declare const mergeImageAttrs: (node: Node, patch: NodeAttrPatch<ImageAttrs>) =>
98
107
  declare const mergeParagraphAttrs: (node: Node, patch: NodeAttrPatch<ParagraphAttrs>) => ParagraphAttrs;
99
108
  declare const mergeTableAttrs: (node: Node, patch: NodeAttrPatch<TableAttrs>) => TableAttrs;
100
109
  declare const mergeTableRowAttrs: (node: Node, patch: NodeAttrPatch<TableRowAttrs>) => TableRowAttrs;
110
+ /**
111
+ * A command that moves a cell's width states one.
112
+ *
113
+ * `width` is also where the table's resolved grid width lands for a cell that
114
+ * declares no `w:tcW`, so the save leg reads `_authoredWidth` instead. Deriving
115
+ * it here rather than at each command keeps the two from drifting: a command
116
+ * cannot set a width without recording that the cell now states it, and one
117
+ * that clears the width clears the record with it.
118
+ */
101
119
  declare const mergeTableCellAttrs: (node: Node, patch: NodeAttrPatch<TableCellAttrs>) => TableCellAttrs;
102
120
  //#endregion
103
- export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectInlineWrapperMarkAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectPageBreakRunAttrs, expectPageBreakRunOwnerMarkAttrs, expectParagraphAttrs, expectPreservedBlockAttrs, expectPreservedXmlAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectSymbolAttrs, expectTabAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readInlineWrapperMarkAttrs, readInlineWrapperStack, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readPageBreakRunOwnerMarkAttrs, readParagraphAttrs, readPreservedBlockAttrs, readPreservedXmlAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
121
+ export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectInlineWrapperMarkAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectPageBreakRunAttrs, expectParagraphAttrs, expectPreservedBlockAttrs, expectPreservedXmlAttrs, expectRunFormattingOverrideMarkAttrs, expectRunIdentityMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectSymbolAttrs, expectTabAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readInlineWrapperMarkAttrs, readInlineWrapperStack, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readParagraphAttrs, readPreservedBlockAttrs, readPreservedXmlAttrs, readRunFormattingOverrideMarkAttrs, readRunIdentityMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };