@stll/folio-core 0.45.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 (451) hide show
  1. package/dist/ai-edits/apply.js +85 -43
  2. package/dist/ai-edits/headless.js +2 -2
  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/compare.js +2 -5
  10. package/dist/compare/content-alignment.js +108 -12
  11. package/dist/compare/content-types.d.ts +8 -2
  12. package/dist/compare/content.js +2 -11
  13. package/dist/compare/plan.js +7 -4
  14. package/dist/compare/scenario.js +2 -5
  15. package/dist/compare/section-boundary-properties.js +1 -2
  16. package/dist/compare/types.d.ts +9 -1
  17. package/dist/compare/types.js +12 -1
  18. package/dist/compat/eigenpal.d.ts +2 -1
  19. package/dist/compat/eigenpal.js +2 -1
  20. package/dist/content-controls/checkboxDisplay.d.ts +17 -0
  21. package/dist/content-controls/checkboxDisplay.js +46 -0
  22. package/dist/content-controls/findContentControls.js +3 -1
  23. package/dist/content-controls/mutateContentControls.js +57 -43
  24. package/dist/controller/contentControlWidgetController.d.ts +1 -0
  25. package/dist/controller/contentControlWidgetController.js +3 -0
  26. package/dist/controller/hiddenEditorApi.js +3 -1
  27. package/dist/controller/hiddenEditorManager.d.ts +1 -1
  28. package/dist/controller/hiddenEditorManager.js +6 -3
  29. package/dist/controller/layoutPipeline.js +8 -3
  30. package/dist/display-list/build/buildDisplayList.js +20 -1
  31. package/dist/display-list/build/imagePrimitives.d.ts +4 -4
  32. package/dist/display-list/build/imagePrimitives.js +38 -18
  33. package/dist/display-list/build/pageBorderPrimitives.js +2 -1
  34. package/dist/display-list/build/paragraphPrimitives.js +113 -14
  35. package/dist/display-list/build/previewPrimitives.d.ts +10 -0
  36. package/dist/display-list/build/previewPrimitives.js +89 -0
  37. package/dist/display-list/build/strokes.d.ts +177 -8
  38. package/dist/display-list/build/strokes.js +167 -47
  39. package/dist/display-list/build/tablePrimitives.js +4 -2
  40. package/dist/display-list/build/textBoxPrimitives.js +6 -4
  41. package/dist/display-list/build/textDecorations.d.ts +15 -1
  42. package/dist/display-list/build/textDecorations.js +15 -1
  43. package/dist/display-list/dom/renderDisplayListToDom.js +11 -21
  44. package/dist/display-list/primitives.d.ts +13 -2
  45. package/dist/display-list/primitives.js +36 -1
  46. package/dist/display-list/types.d.ts +17 -0
  47. package/dist/document-operations.js +2 -1
  48. package/dist/docx/attributeRemainder.d.ts +76 -0
  49. package/dist/docx/attributeRemainder.js +111 -0
  50. package/dist/docx/blockContentParser.d.ts +3 -1
  51. package/dist/docx/blockContentParser.js +102 -106
  52. package/dist/docx/blockPlainText.d.ts +3 -4
  53. package/dist/docx/blockPlainText.js +3 -0
  54. package/dist/docx/borderParser.js +26 -11
  55. package/dist/docx/builtInStyles.d.ts +8 -16
  56. package/dist/docx/builtInStyles.js +54 -17
  57. package/dist/docx/commentAnchorIndex.d.ts +30 -0
  58. package/dist/docx/commentAnchorIndex.js +50 -0
  59. package/dist/docx/commentParser.d.ts +1 -1
  60. package/dist/docx/commentParser.js +56 -39
  61. package/dist/docx/commentRangeIntegrity.d.ts +16 -1
  62. package/dist/docx/commentRangeIntegrity.js +42 -1
  63. package/dist/docx/commentRangeJoin.d.ts +9 -0
  64. package/dist/docx/commentRangeJoin.js +33 -0
  65. package/dist/docx/commentReferenceCompletion.d.ts +9 -0
  66. package/dist/docx/commentReferenceCompletion.js +47 -0
  67. package/dist/docx/commentReferenceNormalization.js +3 -1
  68. package/dist/docx/commentReplyMarkers.js +11 -19
  69. package/dist/docx/compatibility.js +56 -41
  70. package/dist/docx/containerChildren.d.ts +208 -0
  71. package/dist/docx/containerChildren.gen.d.ts +43 -0
  72. package/dist/docx/containerChildren.gen.js +263 -0
  73. package/dist/docx/containerChildren.js +153 -0
  74. package/dist/docx/diagramPreview.d.ts +14 -2
  75. package/dist/docx/diagramPreview.js +81 -169
  76. package/dist/docx/documentParser.d.ts +1 -1
  77. package/dist/docx/documentParser.js +7 -4
  78. package/dist/docx/drawingAnchor.d.ts +87 -0
  79. package/dist/docx/drawingAnchor.js +201 -0
  80. package/dist/docx/drawingUtils.d.ts +43 -38
  81. package/dist/docx/drawingUtils.js +205 -118
  82. package/dist/docx/ensureParaIds.js +17 -7
  83. package/dist/docx/fieldParser.d.ts +1 -1
  84. package/dist/docx/fieldParser.js +4 -4
  85. package/dist/docx/fieldState.d.ts +26 -0
  86. package/dist/docx/fieldState.js +53 -0
  87. package/dist/docx/fontTableParser.js +102 -41
  88. package/dist/docx/footnoteParser.d.ts +1 -1
  89. package/dist/docx/footnoteParser.js +10 -6
  90. package/dist/docx/graphicFrameLocks.d.ts +16 -4
  91. package/dist/docx/graphicFrameLocks.js +19 -6
  92. package/dist/docx/groupDrawingParser.js +4 -3
  93. package/dist/docx/headerFooterParser.js +1 -1
  94. package/dist/docx/headerFooterReferenceNormalization.js +1 -0
  95. package/dist/docx/hyperlinkParser.d.ts +66 -9
  96. package/dist/docx/hyperlinkParser.js +153 -26
  97. package/dist/docx/imageParser.js +160 -115
  98. package/dist/docx/index.d.ts +2 -1
  99. package/dist/docx/index.js +2 -1
  100. package/dist/docx/inlineContentRemovals.d.ts +28 -0
  101. package/dist/docx/inlineContentRemovals.js +46 -0
  102. package/dist/docx/inlineWrapperContent.d.ts +166 -0
  103. package/dist/docx/inlineWrapperContent.js +165 -0
  104. package/dist/docx/inlineWrapperParser.d.ts +11 -0
  105. package/dist/docx/inlineWrapperParser.js +60 -0
  106. package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
  107. package/dist/docx/normalizeBaseDirection.js +12 -1
  108. package/dist/docx/numberingParser.d.ts +25 -2
  109. package/dist/docx/numberingParser.js +264 -361
  110. package/dist/docx/numberingReference.d.ts +9 -16
  111. package/dist/docx/numberingReference.js +17 -16
  112. package/dist/docx/numberingReferenceNormalization.js +7 -7
  113. package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
  114. package/dist/docx/ooxmlCounterFormatter.js +4 -1
  115. package/dist/docx/paraIdAttribute.d.ts +111 -0
  116. package/dist/docx/paraIdAttribute.js +142 -0
  117. package/dist/docx/paragraphParser.d.ts +10 -25
  118. package/dist/docx/paragraphParser.js +421 -496
  119. package/dist/docx/paragraphProperties.d.ts +23 -0
  120. package/dist/docx/paragraphProperties.js +279 -0
  121. package/dist/docx/paragraphPropertySource.js +7 -1
  122. package/dist/docx/paragraphTextBoxEnrichment.d.ts +3 -2
  123. package/dist/docx/paragraphTextBoxEnrichment.js +20 -59
  124. package/dist/docx/paragraphTraversal.d.ts +14 -10
  125. package/dist/docx/paragraphTraversal.js +53 -52
  126. package/dist/docx/parseWarningMessage.js +5 -1
  127. package/dist/docx/parserEnums.d.ts +6 -8
  128. package/dist/docx/parserEnums.js +4 -6
  129. package/dist/docx/preservedRunContent.d.ts +32 -0
  130. package/dist/docx/preservedRunContent.js +96 -0
  131. package/dist/docx/previewBudget.d.ts +44 -23
  132. package/dist/docx/previewBudget.js +61 -30
  133. package/dist/docx/propertyElementAttributes.d.ts +178 -0
  134. package/dist/docx/propertyElementAttributes.js +114 -0
  135. package/dist/docx/renderedPageBreakNormalization.js +4 -6
  136. package/dist/docx/rezip.d.ts +28 -2
  137. package/dist/docx/rezip.js +152 -27
  138. package/dist/docx/runConsolidator.d.ts +42 -2
  139. package/dist/docx/runConsolidator.js +60 -6
  140. package/dist/docx/runParser.d.ts +55 -19
  141. package/dist/docx/runParser.js +394 -306
  142. package/dist/docx/runPayload.d.ts +5 -0
  143. package/dist/docx/runPayload.js +4 -0
  144. package/dist/docx/sdtProperties.d.ts +39 -5
  145. package/dist/docx/sdtProperties.js +205 -84
  146. package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
  147. package/dist/docx/sdtPropertiesPatch.js +68 -112
  148. package/dist/docx/sectionParser.d.ts +1 -2
  149. package/dist/docx/sectionParser.js +241 -238
  150. package/dist/docx/selectiveSave.js +3 -2
  151. package/dist/docx/selectiveXmlPatch.d.ts +66 -3
  152. package/dist/docx/selectiveXmlPatch.js +276 -133
  153. package/dist/docx/serializer/blockSdtSerializer.js +2 -96
  154. package/dist/docx/serializer/borderSerializer.d.ts +5 -5
  155. package/dist/docx/serializer/borderSerializer.js +12 -10
  156. package/dist/docx/serializer/commentSerializer.js +5 -7
  157. package/dist/docx/serializer/documentSerializer.js +11 -11
  158. package/dist/docx/serializer/fontTableSerializer.js +31 -3
  159. package/dist/docx/serializer/headerFooterSerializer.js +10 -9
  160. package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
  161. package/dist/docx/serializer/markupRangeAttributes.js +9 -1
  162. package/dist/docx/serializer/noteSerializer.js +11 -8
  163. package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
  164. package/dist/docx/serializer/numberingSerializer.js +81 -79
  165. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
  166. package/dist/docx/serializer/paragraphSerializer.js +156 -236
  167. package/dist/docx/serializer/runSerializer.d.ts +1 -5
  168. package/dist/docx/serializer/runSerializer.js +134 -75
  169. package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
  170. package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
  171. package/dist/docx/serializer/sectionPropertiesSerializer.js +42 -49
  172. package/dist/docx/serializer/settingsSerializer.js +6 -4
  173. package/dist/docx/serializer/stylesSerializer.js +8 -11
  174. package/dist/docx/serializer/tableSerializer.js +283 -105
  175. package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
  176. package/dist/docx/serializer/textFormattingSerializer.js +111 -101
  177. package/dist/docx/serializer/xmlUtils.d.ts +1 -1
  178. package/dist/docx/serializer/xmlUtils.js +1 -1
  179. package/dist/docx/server/createBilingualDocument.js +20 -16
  180. package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
  181. package/dist/docx/server/materializeYjsDocx.js +9 -1
  182. package/dist/docx/server/migrateYjsAttrSchema.d.ts +55 -0
  183. package/dist/docx/server/migrateYjsAttrSchema.js +95 -0
  184. package/dist/docx/settingsParser.js +7 -4
  185. package/dist/docx/shadingParser.d.ts +2 -1
  186. package/dist/docx/shadingParser.js +43 -7
  187. package/dist/docx/shapeParser.js +13 -8
  188. package/dist/docx/strictNames.d.ts +11 -0
  189. package/dist/docx/strictNames.gen.d.ts +45 -0
  190. package/dist/docx/strictNames.gen.js +50 -0
  191. package/dist/docx/strictNames.js +43 -0
  192. package/dist/docx/strictValueEncodings.gen.js +133 -131
  193. package/dist/docx/styleParser.js +17 -349
  194. package/dist/docx/tableParser.d.ts +11 -2
  195. package/dist/docx/tableParser.js +665 -220
  196. package/dist/docx/textBoxParser.d.ts +28 -3
  197. package/dist/docx/textBoxParser.js +69 -9
  198. package/dist/docx/themeColorAttribute.d.ts +13 -0
  199. package/dist/docx/themeColorAttribute.js +24 -0
  200. package/dist/docx/trackedMoveRangeNormalization.js +2 -1
  201. package/dist/docx/unzip.js +5 -4
  202. package/dist/docx/vmlImageParser.d.ts +30 -5
  203. package/dist/docx/vmlImageParser.js +91 -32
  204. package/dist/docx/vmlPreview.js +2 -2
  205. package/dist/docx/wrapPolygon.d.ts +30 -0
  206. package/dist/docx/wrapPolygon.js +70 -0
  207. package/dist/docx/xmlEncoding.d.ts +5 -0
  208. package/dist/docx/xmlEncoding.js +12 -0
  209. package/dist/docx/xmlParser.d.ts +23 -1
  210. package/dist/docx/xmlParser.js +31 -2
  211. package/dist/fonts/embeddedFonts.js +3 -3
  212. package/dist/headless-layout.js +12 -1
  213. package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
  214. package/dist/i18n/messages/catalogs.gen.js +102 -34
  215. package/dist/i18n/messages/messages.gen.d.ts +4 -0
  216. package/dist/index.d.ts +2 -1
  217. package/dist/index.js +2 -1
  218. package/dist/internal/headlessRevisionResolution.js +9 -0
  219. package/dist/internal/pageBreakRunSourceDescendantIndex.js +7 -2
  220. package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
  221. package/dist/internal/paragraphFormattingSerialization.js +118 -83
  222. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  223. package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
  224. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  225. package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
  226. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
  227. package/dist/layout-bridge/convert/toFlowBlocks.js +267 -101
  228. package/dist/layout-engine/index.d.ts +2 -2
  229. package/dist/layout-engine/index.js +53 -17
  230. package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
  231. package/dist/layout-engine/measure/measureBlocks.js +6 -10
  232. package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
  233. package/dist/layout-engine/measure/tableCellFloating.js +2 -0
  234. package/dist/layout-engine/measure/tableCellGrid.js +2 -1
  235. package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
  236. package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
  237. package/dist/layout-engine/paragraphSequence.js +3 -2
  238. package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
  239. package/dist/layout-engine/section-breaks.d.ts +49 -2
  240. package/dist/layout-engine/section-breaks.js +55 -4
  241. package/dist/layout-engine/types.d.ts +69 -17
  242. package/dist/layout-engine/types.js +16 -1
  243. package/dist/layout-painter/borderStroke.d.ts +18 -4
  244. package/dist/layout-painter/renderImage.d.ts +5 -1
  245. package/dist/layout-painter/renderImage.js +10 -3
  246. package/dist/layout-painter/renderPage.d.ts +2 -0
  247. package/dist/layout-painter/renderPage.js +10 -4
  248. package/dist/layout-painter/renderParagraph.d.ts +14 -1
  249. package/dist/layout-painter/renderParagraph.js +34 -28
  250. package/dist/layout-painter/renderTable.d.ts +4 -1
  251. package/dist/layout-painter/renderTable.js +22 -22
  252. package/dist/layout-painter/renderTextBox.js +5 -3
  253. package/dist/managers/autoSaveCodec.d.ts +9 -1
  254. package/dist/managers/autoSaveCodec.js +12 -4
  255. package/dist/markdown/renderBlock.js +3 -0
  256. package/dist/markdown/renderRuns.d.ts +1 -1
  257. package/dist/markdown/renderRuns.js +34 -6
  258. package/dist/markdown/renderTable.js +24 -6
  259. package/dist/markdown/trailers.js +4 -1
  260. package/dist/model.d.ts +3 -3
  261. package/dist/model.js +2 -2
  262. package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
  263. package/dist/paged-layout/sectionBlockWidths.js +26 -4
  264. package/dist/pdf/images.js +142 -6
  265. package/dist/prosemirror/attrs/index.d.ts +34 -5
  266. package/dist/prosemirror/attrs/index.js +639 -48
  267. package/dist/prosemirror/authoredTransformAttrs.d.ts +28 -0
  268. package/dist/prosemirror/authoredTransformAttrs.js +64 -0
  269. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
  270. package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
  271. package/dist/prosemirror/commands/comments.js +68 -53
  272. package/dist/prosemirror/commands/contentControls.js +33 -20
  273. package/dist/prosemirror/commands/image.d.ts +10 -3
  274. package/dist/prosemirror/commands/image.js +46 -29
  275. package/dist/prosemirror/commands/pageBreak.js +1 -1
  276. package/dist/prosemirror/commands/paragraph.d.ts +2 -1
  277. package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
  278. package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
  279. package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
  280. package/dist/prosemirror/commands/sectionBreak.js +187 -11
  281. package/dist/prosemirror/commentReferenceAttrs.d.ts +8 -0
  282. package/dist/prosemirror/commentReferenceAttrs.js +33 -0
  283. package/dist/prosemirror/commentReferenceIntegrity.d.ts +47 -0
  284. package/dist/prosemirror/commentReferenceIntegrity.js +43 -0
  285. package/dist/prosemirror/conversion/fromProseDoc.d.ts +17 -12
  286. package/dist/prosemirror/conversion/fromProseDoc.js +553 -207
  287. package/dist/prosemirror/conversion/index.d.ts +2 -2
  288. package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
  289. package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
  290. package/dist/prosemirror/conversion/runShadingMark.js +14 -1
  291. package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
  292. package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
  293. package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -9
  294. package/dist/prosemirror/conversion/toProseDoc.js +801 -411
  295. package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
  296. package/dist/prosemirror/emptyRangeAnchor.js +158 -0
  297. package/dist/prosemirror/extensions/StarterKit.js +14 -58
  298. package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
  299. package/dist/prosemirror/extensions/core/ParagraphExtension.js +21 -16
  300. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +48 -29
  301. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -1
  302. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +5 -3
  303. package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
  304. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -0
  305. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
  306. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
  307. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
  308. package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
  309. package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
  310. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
  311. package/dist/prosemirror/extensions/markRegistry.d.ts +65 -0
  312. package/dist/prosemirror/extensions/markRegistry.js +138 -0
  313. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +18 -0
  314. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +77 -0
  315. package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
  316. package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
  317. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
  318. package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
  319. package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
  320. package/dist/prosemirror/extensions/marks/markUtils.js +49 -5
  321. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
  322. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
  323. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
  324. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
  325. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
  326. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.d.ts +11 -0
  327. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +97 -0
  328. package/dist/prosemirror/extensions/nodes/FieldExtension.js +9 -7
  329. package/dist/prosemirror/extensions/nodes/ImageExtension.js +24 -1
  330. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
  331. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
  332. package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +32 -0
  333. package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +67 -0
  334. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +16 -0
  335. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +60 -0
  336. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
  337. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
  338. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
  339. package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
  340. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +7 -0
  341. package/dist/prosemirror/extensions/nodes/TableExtension.js +142 -123
  342. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +9 -1
  343. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
  344. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
  345. package/dist/prosemirror/extensions/types.d.ts +12 -3
  346. package/dist/prosemirror/index.d.ts +4 -2
  347. package/dist/prosemirror/index.js +2 -1
  348. package/dist/prosemirror/inlineWrapperStack.d.ts +39 -0
  349. package/dist/prosemirror/inlineWrapperStack.js +92 -0
  350. package/dist/prosemirror/listMarker.d.ts +2 -2
  351. package/dist/prosemirror/listMarker.js +7 -8
  352. package/dist/prosemirror/listRenderingAttrs.js +11 -1
  353. package/dist/prosemirror/listState.d.ts +62 -0
  354. package/dist/prosemirror/listState.js +49 -0
  355. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
  356. package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
  357. package/dist/prosemirror/numberedRefFields.js +4 -4
  358. package/dist/prosemirror/numberingAttr.d.ts +55 -0
  359. package/dist/prosemirror/numberingAttr.js +74 -0
  360. package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
  361. package/dist/prosemirror/outlineLevelAttr.js +42 -0
  362. package/dist/prosemirror/pageBreakRunProjection.d.ts +17 -7
  363. package/dist/prosemirror/pageBreakRunProjection.js +19 -9
  364. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
  365. package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
  366. package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
  367. package/dist/prosemirror/plugins/selectionTracker.js +3 -10
  368. package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
  369. package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
  370. package/dist/prosemirror/replacedAnnotations.d.ts +59 -0
  371. package/dist/prosemirror/replacedAnnotations.js +183 -0
  372. package/dist/prosemirror/revisionCarriers.d.ts +86 -2
  373. package/dist/prosemirror/revisionCarriers.js +86 -60
  374. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +5 -1
  375. package/dist/prosemirror/runFormattingInlineCarriers.js +7 -1
  376. package/dist/prosemirror/runIdentity.d.ts +28 -0
  377. package/dist/prosemirror/runIdentity.js +36 -0
  378. package/dist/prosemirror/runStyleFormatting.js +1 -1
  379. package/dist/prosemirror/schema/index.d.ts +3 -3
  380. package/dist/prosemirror/schema/marks.d.ts +47 -4
  381. package/dist/prosemirror/schema/nodes.d.ts +309 -26
  382. package/dist/prosemirror/schema/nodes.js +16 -1
  383. package/dist/prosemirror/sectionCarrier.d.ts +37 -0
  384. package/dist/prosemirror/sectionCarrier.js +40 -0
  385. package/dist/prosemirror/selectionState.d.ts +3 -0
  386. package/dist/prosemirror/selectionState.js +4 -1
  387. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
  388. package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
  389. package/dist/prosemirror/tableResize.js +5 -6
  390. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +4 -0
  391. package/dist/prosemirror/trackedRunInlineAtoms.js +4 -0
  392. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
  393. package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
  394. package/dist/prosemirror/validation.js +31 -6
  395. package/dist/prosemirror/yjsDocumentMetadata.d.ts +73 -0
  396. package/dist/prosemirror/yjsDocumentMetadata.js +592 -0
  397. package/dist/prosemirror/zeroWidthAnchors.js +6 -0
  398. package/dist/render-dom/commentAnchorAttributes.d.ts +37 -0
  399. package/dist/render-dom/commentAnchorAttributes.js +54 -0
  400. package/dist/server.d.ts +3 -1
  401. package/dist/server.js +3 -1
  402. package/dist/style-sets/extract.js +4 -4
  403. package/dist/style-sets/stellaStyle.js +36 -23
  404. package/dist/types/colors.d.ts +2 -2
  405. package/dist/types/content.d.ts +2 -2
  406. package/dist/types/documentEnumValues.d.ts +53 -26
  407. package/dist/types/documentEnumValues.js +72 -174
  408. package/dist/types/formatting.d.ts +2 -2
  409. package/dist/types/index.d.ts +9 -2
  410. package/dist/utils/borderCss.d.ts +246 -0
  411. package/dist/utils/borderCss.js +325 -0
  412. package/dist/utils/clipboard.d.ts +9 -1
  413. package/dist/utils/clipboard.js +27 -1
  414. package/dist/utils/colorResolver.d.ts +4 -3
  415. package/dist/utils/colorResolver.js +45 -76
  416. package/dist/utils/createDocument.js +24 -6
  417. package/dist/utils/findReplace.js +52 -10
  418. package/dist/utils/formatToStyle.d.ts +84 -2
  419. package/dist/utils/formatToStyle.js +133 -52
  420. package/dist/utils/headingCollector.js +3 -2
  421. package/dist/utils/imageLuminance.d.ts +15 -0
  422. package/dist/utils/imageLuminance.js +32 -0
  423. package/dist/utils/mergeDocumentContent.js +12 -20
  424. package/dist/utils/paragraphFormattingMerge.js +27 -6
  425. package/dist/utils/replaceText.js +1 -0
  426. package/dist/utils/tableOperations.d.ts +5 -3
  427. package/dist/utils/tableOperations.js +14 -1
  428. package/dist/utils/tablePlacement.d.ts +7 -0
  429. package/dist/utils/tablePlacement.js +14 -0
  430. package/dist/utils/textDirectionFlow.d.ts +15 -0
  431. package/dist/utils/textDirectionFlow.js +38 -0
  432. package/dist/utils/textFormattingMerge.js +16 -4
  433. package/package.json +10 -10
  434. package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
  435. package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
  436. package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
  437. package/dist/compare/__fixtures__/body-sequence.js +0 -225
  438. package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
  439. package/dist/compare/__fixtures__/nested-table.js +0 -50
  440. package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
  441. package/dist/compare/__fixtures__/numbered-list.js +0 -85
  442. package/dist/docx/blockRangeMarkers.d.ts +0 -36
  443. package/dist/docx/blockRangeMarkers.js +0 -59
  444. package/dist/docx/bookmarkPlacement.d.ts +0 -9
  445. package/dist/docx/bookmarkPlacement.js +0 -50
  446. package/dist/fonts/embeddedFontTable.d.ts +0 -45
  447. package/dist/fonts/embeddedFontTable.js +0 -80
  448. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
  449. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
  450. package/dist/prosemirror/yjsParagraphSourceContract.d.ts +0 -9
  451. package/dist/prosemirror/yjsParagraphSourceContract.js +0 -26
@@ -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`;
@@ -1,6 +1,14 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
2
  //#region src/managers/autoSaveCodec.d.ts
3
- declare const AUTOSAVE_FORMAT_VERSION = 2;
3
+ /**
4
+ * Version 3 renamed the model's `bidiWrapper` to `inlineWrapper` and gave it a
5
+ * `kind`. The codec serialises the model itself, so a version-2 envelope holds
6
+ * paragraph content under the old discriminator: the model validator would
7
+ * reject it, and a reader that did not validate would drop the wrapper. The
8
+ * envelope is a local draft of one editing session, so it is refused and
9
+ * re-taken rather than migrated.
10
+ */
11
+ declare const AUTOSAVE_FORMAT_VERSION = 3;
4
12
  type DecodedAutoSave = {
5
13
  document: document_d_exports.Document;
6
14
  savedAt: string;
@@ -1,7 +1,15 @@
1
1
  import { validateFolioDocumentModel } from "../docx/modelValidation.js";
2
2
  import { bytesToBase64 } from "../utils/base64.js";
3
3
  //#region src/managers/autoSaveCodec.ts
4
- const AUTOSAVE_FORMAT_VERSION = 2;
4
+ /**
5
+ * Version 3 renamed the model's `bidiWrapper` to `inlineWrapper` and gave it a
6
+ * `kind`. The codec serialises the model itself, so a version-2 envelope holds
7
+ * paragraph content under the old discriminator: the model validator would
8
+ * reject it, and a reader that did not validate would drop the wrapper. The
9
+ * envelope is a local draft of one editing session, so it is refused and
10
+ * re-taken rather than migrated.
11
+ */
12
+ const AUTOSAVE_FORMAT_VERSION = 3;
5
13
  const decodeBase64 = (value) => {
6
14
  const binary = atob(value);
7
15
  const bytes = new Uint8Array(binary.length);
@@ -80,20 +88,20 @@ const encodeAutoSaveDocument = (document) => {
80
88
  };
81
89
  return { json: JSON.stringify(encodeValue(snapshot)) };
82
90
  };
83
- const encodeAutoSaveEnvelopeFromDocument = (document, savedAt) => `{"document":${document.json},"savedAt":${JSON.stringify(savedAt)},"version":2}`;
91
+ const encodeAutoSaveEnvelopeFromDocument = (document, savedAt) => `{"document":${document.json},"savedAt":${JSON.stringify(savedAt)},"version":3}`;
84
92
  const encodeAutoSaveEnvelope = (document, savedAt) => encodeAutoSaveEnvelopeFromDocument(encodeAutoSaveDocument(document), savedAt);
85
93
  const decodeAutoSaveEnvelope = (json) => {
86
94
  try {
87
95
  const parsed = JSON.parse(json);
88
96
  if (typeof parsed !== "object" || !parsed || !("document" in parsed) || !("savedAt" in parsed) || !("version" in parsed)) return null;
89
- if (parsed.version !== 2 || typeof parsed.savedAt !== "string" || !Number.isFinite(Date.parse(parsed.savedAt))) return null;
97
+ if (parsed.version !== 3 || typeof parsed.savedAt !== "string" || !Number.isFinite(Date.parse(parsed.savedAt))) return null;
90
98
  const document = decodeValue(parsed.document);
91
99
  if (typeof document !== "object" || !document) return null;
92
100
  if (!validateFolioDocumentModel(document).valid) return null;
93
101
  return {
94
102
  document,
95
103
  savedAt: parsed.savedAt,
96
- version: 2
104
+ version: 3
97
105
  };
98
106
  } catch {
99
107
  return null;
@@ -71,6 +71,9 @@ function renderBlocks(ctx, pkg, blocks) {
71
71
  }
72
72
  break;
73
73
  }
74
+ case "preservedBlock":
75
+ case "bookmarkStart":
76
+ case "bookmarkEnd": break;
74
77
  default: panic(`Unsupported block content in markdown: ${JSON.stringify(block)}`);
75
78
  }
76
79
  return out.join("\n");
@@ -5,6 +5,6 @@ import { RenderContext } from "./types.js";
5
5
  * Render the full inline content of a paragraph, tracking comment-range
6
6
  * boundaries to apply the configured wrapper.
7
7
  */
8
- declare function renderParagraphInline(ctx: RenderContext, pkg: document_d_exports.DocxPackage | undefined, content: document_d_exports.ParagraphContent[], paraId: string | undefined): string;
8
+ declare function renderParagraphInline(ctx: RenderContext, pkg: document_d_exports.DocxPackage | undefined, content: readonly document_d_exports.ParagraphContent[], paraId: string | undefined): string;
9
9
  //#endregion
10
10
  export { renderParagraphInline };
@@ -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";
@@ -76,6 +77,9 @@ function renderRunContent(ctx, pkg, content, paraId) {
76
77
  case "noBreakHyphen":
77
78
  out += "‑";
78
79
  break;
80
+ case "preservedXml":
81
+ out += escapeInline(item.text);
82
+ break;
79
83
  case "footnoteRef":
80
84
  case "endnoteRef": {
81
85
  if (ctx.opts.footnotes === "strip") break;
@@ -128,7 +132,7 @@ function renderRun(ctx, pkg, run, paraId) {
128
132
  return `${lead}${applyMarks(core, marksFor(run))}${trail}`;
129
133
  }
130
134
  function renderHyperlink(ctx, pkg, link, paraId) {
131
- 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("");
132
136
  if (!inner) return "";
133
137
  const href = link.href ?? (link.anchor ? `#${link.anchor}` : "");
134
138
  if (!href) {
@@ -147,10 +151,23 @@ function renderHyperlink(ctx, pkg, link, paraId) {
147
151
  }
148
152
  function renderTrackedWrapper(ctx, pkg, wrapper, paraId) {
149
153
  const renderChild = (child) => {
150
- if (child.type === "run") return renderRun(ctx, pkg, child, paraId);
151
- if (child.type === "hyperlink") return renderHyperlink(ctx, pkg, child, paraId);
152
- if (child.type === "mathEquation") return child.plainText ? escapeInline(child.plainText) : "";
153
- return "";
154
+ switch (child.type) {
155
+ case "run": return renderRun(ctx, pkg, child, paraId);
156
+ case "hyperlink": return renderHyperlink(ctx, pkg, child, paraId);
157
+ case "mathEquation": return child.plainText ? escapeInline(child.plainText) : "";
158
+ case "inlineWrapper":
159
+ case "inlineSdt": return renderParagraphInline(ctx, pkg, child.content, paraId);
160
+ case "insertion":
161
+ case "deletion":
162
+ case "moveFrom":
163
+ case "moveTo": return renderTrackedWrapper(ctx, pkg, child, paraId);
164
+ case "simpleField":
165
+ case "complexField": return renderParagraphInline(ctx, pkg, [child], paraId);
166
+ case "bookmarkStart":
167
+ case "bookmarkEnd":
168
+ case "preservedInline": return "";
169
+ default: return child;
170
+ }
154
171
  };
155
172
  if (ctx.opts.trackedChanges === "clean") {
156
173
  if (wrapper.type === "insertion" || wrapper.type === "moveTo") return wrapper.content.map(renderChild).join("");
@@ -196,10 +213,21 @@ function renderParagraphInline(ctx, pkg, content, paraId) {
196
213
  case "simpleField":
197
214
  case "complexField": {
198
215
  const runs = item.type === "simpleField" ? item.content : item.fieldResult;
199
- for (const child of runs) out += child.type === "run" ? renderRun(ctx, pkg, child, paraId) : renderHyperlink(ctx, pkg, child, paraId);
216
+ for (const child of runs) {
217
+ if (child.type === "run") {
218
+ out += renderRun(ctx, pkg, child, paraId);
219
+ continue;
220
+ }
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;
226
+ }
200
227
  break;
201
228
  }
202
229
  case "inlineSdt":
230
+ case "inlineWrapper":
203
231
  out += renderParagraphInline(ctx, pkg, item.content, paraId);
204
232
  break;
205
233
  case "mathEquation":
@@ -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";
@@ -113,7 +114,7 @@ function renderHtmlCell(ctx, pkg, cell) {
113
114
  for (const item of cell.content) if (item.type === "paragraph") {
114
115
  const inner = renderHtmlInline(ctx, pkg, item.content, item.paraId);
115
116
  if (inner) parts.push(inner);
116
- } else {
117
+ } else if (item.type === "table") {
117
118
  const nested = renderHtmlTable(ctx, pkg, item.rows, true);
118
119
  if (nested) parts.push(nested);
119
120
  }
@@ -148,6 +149,7 @@ function renderHtmlInline(ctx, pkg, content, paraId) {
148
149
  break;
149
150
  }
150
151
  case "inlineSdt":
152
+ case "inlineWrapper":
151
153
  out += renderHtmlInline(ctx, pkg, item.content, paraId);
152
154
  break;
153
155
  case "mathEquation":
@@ -159,10 +161,23 @@ function renderHtmlInline(ctx, pkg, content, paraId) {
159
161
  }
160
162
  function renderHtmlChildren(ctx, pkg, children, paraId) {
161
163
  return children.map((child) => {
162
- if (child.type === "run") return renderHtmlRun(ctx, pkg, child, paraId);
163
- if (child.type === "hyperlink") return renderHtmlHyperlink(ctx, pkg, child, paraId);
164
- if (child.type === "mathEquation") return child.plainText ? escapeHtml(child.plainText) : "";
165
- return "";
164
+ switch (child.type) {
165
+ case "run": return renderHtmlRun(ctx, pkg, child, paraId);
166
+ case "hyperlink": return renderHtmlHyperlink(ctx, pkg, child, paraId);
167
+ case "mathEquation": return child.plainText ? escapeHtml(child.plainText) : "";
168
+ case "inlineWrapper":
169
+ case "inlineSdt":
170
+ case "simpleField":
171
+ case "complexField":
172
+ case "insertion":
173
+ case "deletion":
174
+ case "moveFrom":
175
+ case "moveTo": return renderHtmlInline(ctx, pkg, [child], paraId);
176
+ case "bookmarkStart":
177
+ case "bookmarkEnd":
178
+ case "preservedInline": return "";
179
+ default: return child;
180
+ }
166
181
  }).join("");
167
182
  }
168
183
  function renderHtmlRun(ctx, pkg, run, paraId) {
@@ -184,6 +199,9 @@ function renderHtmlRun(ctx, pkg, run, paraId) {
184
199
  case "noBreakHyphen":
185
200
  text += "‑";
186
201
  break;
202
+ case "preservedXml":
203
+ text += escapeHtml(item.text);
204
+ break;
187
205
  case "softHyphen": break;
188
206
  case "drawing": {
189
207
  const ref = resolveRelationshipIdOfType(pkg?.relationships, item.image.rId, RELATIONSHIP_TYPES.image);
@@ -226,7 +244,7 @@ function renderHtmlRun(ctx, pkg, run, paraId) {
226
244
  return text;
227
245
  }
228
246
  function renderHtmlHyperlink(ctx, pkg, link, paraId) {
229
- 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("");
230
248
  if (!inner) return "";
231
249
  const href = link.href ?? (link.anchor ? `#${link.anchor}` : "");
232
250
  if (!href) return inner;
@@ -65,12 +65,15 @@ function inlineText(content) {
65
65
  case "moveFrom":
66
66
  case "moveTo":
67
67
  case "inlineSdt":
68
- case "bidiWrapper":
68
+ case "inlineWrapper":
69
69
  out += inlineText(item.content);
70
70
  break;
71
71
  case "mathEquation":
72
72
  out += item.plainText ?? "";
73
73
  break;
74
+ case "preservedInline":
75
+ out += item.text;
76
+ break;
74
77
  case "bookmarkStart":
75
78
  case "bookmarkEnd":
76
79
  case "commentRangeStart":
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,