@stll/folio-core 0.46.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/dist/ai-edits/apply.js +26 -24
  2. package/dist/ai-edits/headless.js +1 -1
  3. package/dist/ai-edits/read.d.ts +1 -0
  4. package/dist/ai-edits/read.js +1 -0
  5. package/dist/ai-edits/snapshot.js +32 -27
  6. package/dist/ai-edits/table-cell-mutations.js +15 -7
  7. package/dist/ai-edits/table-geometry.js +21 -18
  8. package/dist/ai-edits/table-template.js +2 -2
  9. package/dist/compare/content-alignment.js +108 -12
  10. package/dist/compare/content-types.d.ts +8 -2
  11. package/dist/compare/content.js +2 -11
  12. package/dist/compare/plan.js +7 -4
  13. package/dist/compare/section-boundary-properties.js +1 -2
  14. package/dist/content-controls/checkboxDisplay.d.ts +8 -2
  15. package/dist/content-controls/checkboxDisplay.js +11 -5
  16. package/dist/content-controls/mutateContentControls.js +41 -42
  17. package/dist/controller/layoutPipeline.js +8 -3
  18. package/dist/display-list/build/buildDisplayList.js +7 -7
  19. package/dist/display-list/build/imagePrimitives.d.ts +4 -4
  20. package/dist/display-list/build/imagePrimitives.js +38 -20
  21. package/dist/display-list/build/pageBorderPrimitives.js +2 -1
  22. package/dist/display-list/build/paragraphPrimitives.js +93 -13
  23. package/dist/display-list/build/previewPrimitives.d.ts +10 -0
  24. package/dist/display-list/build/previewPrimitives.js +89 -0
  25. package/dist/display-list/build/strokes.d.ts +177 -8
  26. package/dist/display-list/build/strokes.js +167 -47
  27. package/dist/display-list/build/tablePrimitives.js +4 -2
  28. package/dist/display-list/build/textBoxPrimitives.js +6 -4
  29. package/dist/display-list/build/textDecorations.d.ts +15 -1
  30. package/dist/display-list/build/textDecorations.js +15 -1
  31. package/dist/display-list/dom/renderDisplayListToDom.js +1 -19
  32. package/dist/display-list/primitives.d.ts +13 -2
  33. package/dist/display-list/primitives.js +36 -1
  34. package/dist/document-operations.js +2 -1
  35. package/dist/docx/attributeRemainder.d.ts +34 -1
  36. package/dist/docx/attributeRemainder.js +49 -3
  37. package/dist/docx/blockContentParser.d.ts +2 -0
  38. package/dist/docx/blockContentParser.js +39 -67
  39. package/dist/docx/blockPlainText.js +3 -1
  40. package/dist/docx/borderParser.js +26 -11
  41. package/dist/docx/builtInStyles.d.ts +8 -16
  42. package/dist/docx/builtInStyles.js +54 -17
  43. package/dist/docx/commentAnchorIndex.js +1 -1
  44. package/dist/docx/commentParser.js +3 -3
  45. package/dist/docx/commentRangeIntegrity.js +1 -1
  46. package/dist/docx/commentRangeJoin.js +1 -1
  47. package/dist/docx/commentReferenceNormalization.js +3 -2
  48. package/dist/docx/commentReplyMarkers.js +1 -1
  49. package/dist/docx/compatibility.js +56 -42
  50. package/dist/docx/containerChildren.d.ts +110 -13
  51. package/dist/docx/containerChildren.gen.d.ts +16 -1
  52. package/dist/docx/containerChildren.gen.js +18 -1
  53. package/dist/docx/containerChildren.js +63 -13
  54. package/dist/docx/diagramPreview.d.ts +14 -2
  55. package/dist/docx/diagramPreview.js +81 -169
  56. package/dist/docx/documentParser.js +4 -1
  57. package/dist/docx/drawingAnchor.d.ts +87 -0
  58. package/dist/docx/drawingAnchor.js +201 -0
  59. package/dist/docx/drawingUtils.d.ts +43 -38
  60. package/dist/docx/drawingUtils.js +205 -118
  61. package/dist/docx/fontTableParser.js +102 -41
  62. package/dist/docx/footnoteParser.js +10 -6
  63. package/dist/docx/groupDrawingParser.js +4 -3
  64. package/dist/docx/headerFooterReferenceNormalization.js +1 -1
  65. package/dist/docx/hyperlinkParser.d.ts +45 -7
  66. package/dist/docx/hyperlinkParser.js +126 -57
  67. package/dist/docx/imageParser.js +127 -107
  68. package/dist/docx/index.d.ts +2 -1
  69. package/dist/docx/index.js +2 -1
  70. package/dist/docx/inlineContentRemovals.d.ts +28 -0
  71. package/dist/docx/inlineContentRemovals.js +46 -0
  72. package/dist/docx/inlineWrapperContent.d.ts +84 -3
  73. package/dist/docx/inlineWrapperContent.js +85 -4
  74. package/dist/docx/inlineWrapperParser.d.ts +11 -0
  75. package/dist/docx/inlineWrapperParser.js +60 -0
  76. package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
  77. package/dist/docx/normalizeBaseDirection.js +4 -2
  78. package/dist/docx/numberingParser.d.ts +25 -2
  79. package/dist/docx/numberingParser.js +264 -361
  80. package/dist/docx/numberingReference.d.ts +9 -16
  81. package/dist/docx/numberingReference.js +17 -16
  82. package/dist/docx/numberingReferenceNormalization.js +7 -7
  83. package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
  84. package/dist/docx/ooxmlCounterFormatter.js +4 -1
  85. package/dist/docx/paraIdAttribute.d.ts +91 -1
  86. package/dist/docx/paraIdAttribute.js +79 -1
  87. package/dist/docx/paragraphParser.d.ts +9 -24
  88. package/dist/docx/paragraphParser.js +212 -396
  89. package/dist/docx/paragraphProperties.d.ts +23 -0
  90. package/dist/docx/paragraphProperties.js +279 -0
  91. package/dist/docx/paragraphPropertySource.js +2 -0
  92. package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
  93. package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
  94. package/dist/docx/paragraphTraversal.d.ts +14 -10
  95. package/dist/docx/paragraphTraversal.js +47 -49
  96. package/dist/docx/parseWarningMessage.js +3 -0
  97. package/dist/docx/parserEnums.d.ts +6 -8
  98. package/dist/docx/parserEnums.js +4 -6
  99. package/dist/docx/preservedRunContent.js +16 -6
  100. package/dist/docx/previewBudget.d.ts +44 -23
  101. package/dist/docx/previewBudget.js +61 -30
  102. package/dist/docx/propertyElementAttributes.d.ts +178 -0
  103. package/dist/docx/propertyElementAttributes.js +114 -0
  104. package/dist/docx/renderedPageBreakNormalization.js +2 -2
  105. package/dist/docx/rezip.d.ts +28 -2
  106. package/dist/docx/rezip.js +78 -9
  107. package/dist/docx/runConsolidator.d.ts +42 -2
  108. package/dist/docx/runConsolidator.js +60 -6
  109. package/dist/docx/runParser.d.ts +54 -18
  110. package/dist/docx/runParser.js +379 -295
  111. package/dist/docx/runPayload.d.ts +5 -0
  112. package/dist/docx/runPayload.js +4 -0
  113. package/dist/docx/sdtProperties.d.ts +39 -5
  114. package/dist/docx/sdtProperties.js +205 -84
  115. package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
  116. package/dist/docx/sdtPropertiesPatch.js +68 -112
  117. package/dist/docx/sectionParser.d.ts +1 -2
  118. package/dist/docx/sectionParser.js +236 -240
  119. package/dist/docx/selectiveSave.js +3 -2
  120. package/dist/docx/selectiveXmlPatch.d.ts +21 -2
  121. package/dist/docx/selectiveXmlPatch.js +195 -99
  122. package/dist/docx/serializer/blockSdtSerializer.js +2 -96
  123. package/dist/docx/serializer/borderSerializer.d.ts +5 -5
  124. package/dist/docx/serializer/borderSerializer.js +10 -8
  125. package/dist/docx/serializer/documentSerializer.js +3 -0
  126. package/dist/docx/serializer/fontTableSerializer.js +31 -3
  127. package/dist/docx/serializer/headerFooterSerializer.js +3 -0
  128. package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
  129. package/dist/docx/serializer/markupRangeAttributes.js +9 -1
  130. package/dist/docx/serializer/noteSerializer.js +3 -0
  131. package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
  132. package/dist/docx/serializer/numberingSerializer.js +81 -79
  133. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
  134. package/dist/docx/serializer/paragraphSerializer.js +88 -188
  135. package/dist/docx/serializer/runSerializer.d.ts +1 -5
  136. package/dist/docx/serializer/runSerializer.js +109 -59
  137. package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
  138. package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
  139. package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
  140. package/dist/docx/serializer/settingsSerializer.js +6 -4
  141. package/dist/docx/serializer/stylesSerializer.js +8 -11
  142. package/dist/docx/serializer/tableSerializer.js +268 -100
  143. package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
  144. package/dist/docx/serializer/textFormattingSerializer.js +111 -101
  145. package/dist/docx/serializer/xmlUtils.d.ts +1 -1
  146. package/dist/docx/serializer/xmlUtils.js +1 -1
  147. package/dist/docx/server/createBilingualDocument.js +18 -16
  148. package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
  149. package/dist/docx/settingsParser.js +7 -4
  150. package/dist/docx/shadingParser.d.ts +2 -1
  151. package/dist/docx/shadingParser.js +43 -7
  152. package/dist/docx/shapeParser.js +8 -3
  153. package/dist/docx/strictNames.d.ts +11 -0
  154. package/dist/docx/strictNames.gen.d.ts +45 -0
  155. package/dist/docx/strictNames.gen.js +50 -0
  156. package/dist/docx/strictNames.js +43 -0
  157. package/dist/docx/strictValueEncodings.gen.js +133 -131
  158. package/dist/docx/styleParser.js +17 -349
  159. package/dist/docx/tableParser.d.ts +10 -1
  160. package/dist/docx/tableParser.js +505 -181
  161. package/dist/docx/textBoxParser.d.ts +3 -1
  162. package/dist/docx/textBoxParser.js +18 -8
  163. package/dist/docx/themeColorAttribute.d.ts +13 -0
  164. package/dist/docx/themeColorAttribute.js +24 -0
  165. package/dist/docx/trackedMoveRangeNormalization.js +2 -1
  166. package/dist/docx/vmlImageParser.d.ts +13 -4
  167. package/dist/docx/vmlImageParser.js +74 -31
  168. package/dist/docx/vmlPreview.js +2 -2
  169. package/dist/docx/wrapPolygon.d.ts +30 -0
  170. package/dist/docx/wrapPolygon.js +70 -0
  171. package/dist/docx/xmlParser.d.ts +14 -1
  172. package/dist/docx/xmlParser.js +18 -2
  173. package/dist/fonts/embeddedFonts.js +3 -3
  174. package/dist/headless-layout.js +2 -0
  175. package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
  176. package/dist/i18n/messages/catalogs.gen.js +102 -34
  177. package/dist/i18n/messages/messages.gen.d.ts +4 -0
  178. package/dist/internal/headlessRevisionResolution.js +9 -0
  179. package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
  180. package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
  181. package/dist/internal/paragraphFormattingSerialization.js +118 -83
  182. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  183. package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
  184. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  185. package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
  186. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
  187. package/dist/layout-bridge/convert/toFlowBlocks.js +177 -101
  188. package/dist/layout-engine/index.d.ts +2 -2
  189. package/dist/layout-engine/index.js +53 -17
  190. package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
  191. package/dist/layout-engine/measure/measureBlocks.js +6 -10
  192. package/dist/layout-engine/measure/tableCellGrid.js +2 -1
  193. package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
  194. package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
  195. package/dist/layout-engine/paragraphSequence.js +3 -2
  196. package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
  197. package/dist/layout-engine/section-breaks.d.ts +49 -2
  198. package/dist/layout-engine/section-breaks.js +55 -4
  199. package/dist/layout-engine/types.d.ts +47 -17
  200. package/dist/layout-engine/types.js +16 -1
  201. package/dist/layout-painter/borderStroke.d.ts +18 -4
  202. package/dist/layout-painter/renderPage.js +6 -4
  203. package/dist/layout-painter/renderParagraph.d.ts +2 -1
  204. package/dist/layout-painter/renderParagraph.js +13 -26
  205. package/dist/layout-painter/renderTable.d.ts +4 -1
  206. package/dist/layout-painter/renderTable.js +22 -22
  207. package/dist/layout-painter/renderTextBox.js +5 -3
  208. package/dist/markdown/renderBlock.js +3 -1
  209. package/dist/markdown/renderRuns.js +7 -2
  210. package/dist/markdown/renderTable.js +2 -1
  211. package/dist/model.d.ts +3 -3
  212. package/dist/model.js +2 -2
  213. package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
  214. package/dist/paged-layout/sectionBlockWidths.js +26 -4
  215. package/dist/prosemirror/attrs/index.d.ts +22 -4
  216. package/dist/prosemirror/attrs/index.js +498 -60
  217. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
  218. package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
  219. package/dist/prosemirror/commands/comments.js +68 -53
  220. package/dist/prosemirror/commands/contentControls.js +24 -19
  221. package/dist/prosemirror/commands/image.d.ts +1 -1
  222. package/dist/prosemirror/commands/image.js +4 -1
  223. package/dist/prosemirror/commands/paragraph.d.ts +2 -1
  224. package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
  225. package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
  226. package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
  227. package/dist/prosemirror/commands/sectionBreak.js +187 -11
  228. package/dist/prosemirror/conversion/fromProseDoc.d.ts +18 -2
  229. package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
  230. package/dist/prosemirror/conversion/index.d.ts +2 -2
  231. package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
  232. package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
  233. package/dist/prosemirror/conversion/runShadingMark.js +14 -1
  234. package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
  235. package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
  236. package/dist/prosemirror/conversion/toProseDoc.js +371 -141
  237. package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
  238. package/dist/prosemirror/emptyRangeAnchor.js +158 -0
  239. package/dist/prosemirror/extensions/StarterKit.js +8 -2
  240. package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
  241. package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
  242. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
  243. package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
  244. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
  245. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
  246. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
  247. package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
  248. package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
  249. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
  250. package/dist/prosemirror/extensions/markRegistry.d.ts +26 -2
  251. package/dist/prosemirror/extensions/markRegistry.js +73 -10
  252. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
  253. package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
  254. package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
  255. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
  256. package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
  257. package/dist/prosemirror/extensions/marks/markUtils.js +2 -1
  258. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
  259. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
  260. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
  261. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
  262. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
  263. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +10 -0
  264. package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
  265. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
  266. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
  267. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
  268. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
  269. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
  270. package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
  271. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +4 -0
  272. package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
  273. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
  274. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
  275. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
  276. package/dist/prosemirror/extensions/types.d.ts +12 -3
  277. package/dist/prosemirror/index.d.ts +4 -2
  278. package/dist/prosemirror/index.js +2 -1
  279. package/dist/prosemirror/inlineWrapperStack.js +20 -3
  280. package/dist/prosemirror/listMarker.d.ts +2 -2
  281. package/dist/prosemirror/listMarker.js +7 -8
  282. package/dist/prosemirror/listRenderingAttrs.js +11 -1
  283. package/dist/prosemirror/listState.d.ts +62 -0
  284. package/dist/prosemirror/listState.js +49 -0
  285. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
  286. package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
  287. package/dist/prosemirror/numberedRefFields.js +4 -4
  288. package/dist/prosemirror/numberingAttr.d.ts +55 -0
  289. package/dist/prosemirror/numberingAttr.js +74 -0
  290. package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
  291. package/dist/prosemirror/outlineLevelAttr.js +42 -0
  292. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
  293. package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
  294. package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
  295. package/dist/prosemirror/plugins/selectionTracker.js +3 -10
  296. package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
  297. package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
  298. package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
  299. package/dist/prosemirror/replacedAnnotations.js +24 -6
  300. package/dist/prosemirror/revisionCarriers.d.ts +86 -2
  301. package/dist/prosemirror/revisionCarriers.js +86 -60
  302. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
  303. package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
  304. package/dist/prosemirror/runIdentity.d.ts +28 -0
  305. package/dist/prosemirror/runIdentity.js +36 -0
  306. package/dist/prosemirror/runStyleFormatting.js +1 -1
  307. package/dist/prosemirror/schema/index.d.ts +2 -2
  308. package/dist/prosemirror/schema/marks.d.ts +23 -4
  309. package/dist/prosemirror/schema/nodes.d.ts +220 -24
  310. package/dist/prosemirror/sectionCarrier.d.ts +37 -0
  311. package/dist/prosemirror/sectionCarrier.js +40 -0
  312. package/dist/prosemirror/selectionState.d.ts +3 -0
  313. package/dist/prosemirror/selectionState.js +4 -1
  314. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
  315. package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
  316. package/dist/prosemirror/tableResize.js +5 -6
  317. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
  318. package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
  319. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
  320. package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
  321. package/dist/prosemirror/validation.js +17 -6
  322. package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
  323. package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
  324. package/dist/prosemirror/zeroWidthAnchors.js +4 -0
  325. package/dist/style-sets/extract.js +4 -4
  326. package/dist/style-sets/stellaStyle.js +36 -23
  327. package/dist/types/colors.d.ts +2 -2
  328. package/dist/types/content.d.ts +2 -2
  329. package/dist/types/documentEnumValues.d.ts +53 -26
  330. package/dist/types/documentEnumValues.js +72 -174
  331. package/dist/types/formatting.d.ts +2 -2
  332. package/dist/types/index.d.ts +9 -2
  333. package/dist/utils/borderCss.d.ts +246 -0
  334. package/dist/utils/borderCss.js +325 -0
  335. package/dist/utils/colorResolver.d.ts +4 -3
  336. package/dist/utils/colorResolver.js +45 -76
  337. package/dist/utils/createDocument.js +24 -6
  338. package/dist/utils/findReplace.js +52 -10
  339. package/dist/utils/formatToStyle.d.ts +84 -2
  340. package/dist/utils/formatToStyle.js +133 -52
  341. package/dist/utils/headingCollector.js +3 -2
  342. package/dist/utils/mergeDocumentContent.js +5 -3
  343. package/dist/utils/paragraphFormattingMerge.js +27 -6
  344. package/dist/utils/replaceText.js +1 -1
  345. package/dist/utils/tableOperations.d.ts +5 -3
  346. package/dist/utils/tableOperations.js +14 -1
  347. package/dist/utils/tablePlacement.d.ts +7 -0
  348. package/dist/utils/tablePlacement.js +14 -0
  349. package/dist/utils/textDirectionFlow.d.ts +15 -0
  350. package/dist/utils/textDirectionFlow.js +38 -0
  351. package/dist/utils/textFormattingMerge.js +16 -4
  352. package/package.json +10 -10
  353. package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
  354. package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
  355. package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
  356. package/dist/compare/__fixtures__/body-sequence.js +0 -225
  357. package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
  358. package/dist/compare/__fixtures__/nested-table.js +0 -50
  359. package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
  360. package/dist/compare/__fixtures__/numbered-list.js +0 -85
  361. package/dist/docx/bookmarkPlacement.d.ts +0 -9
  362. package/dist/docx/bookmarkPlacement.js +0 -52
  363. package/dist/fonts/embeddedFontTable.d.ts +0 -45
  364. package/dist/fonts/embeddedFontTable.js +0 -80
  365. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
  366. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
@@ -1,19 +1,188 @@
1
- import { BorderStyle } from "../../layout-engine/types.js";
1
+ import { CssBorderStyle } from "../../utils/borderCss.js";
2
2
  import { DisplayStroke, DisplayStrokePattern } from "../types.js";
3
+ import { PresetLineDashVal, UnderlineStyle } from "@stll/docx-core/model";
3
4
  //#region src/display-list/build/strokes.d.ts
4
- type BorderInput = Pick<BorderStyle, "color" | "style" | "width">;
5
+ /** A pattern, or the absence of a line: an edge that paints nothing. */
6
+ type StrokePattern = DisplayStrokePattern | "none";
7
+ type BorderInput = {
8
+ color?: string | undefined;
9
+ style?: CssBorderStyle | undefined;
10
+ width?: number | undefined;
11
+ };
12
+ /**
13
+ * Every CSS `border-style` folio paints, as a display-list pattern.
14
+ *
15
+ * The bevelled keywords have no display-list pattern, and Word draws
16
+ * `threeDEmboss`/`threeDEngrave` as a plain line where the shading is
17
+ * unavailable, so they stroke solid.
18
+ */
19
+ declare const CSS_BORDER_STROKE_PATTERNS: {
20
+ readonly none: "none";
21
+ readonly solid: "solid";
22
+ readonly double: "double";
23
+ readonly dotted: "dotted";
24
+ readonly dashed: "dashed";
25
+ readonly groove: "solid";
26
+ readonly ridge: "solid";
27
+ readonly inset: "solid";
28
+ readonly outset: "solid";
29
+ };
30
+ /**
31
+ * Every `ST_PresetLineDashVal` member, as a display-list pattern.
32
+ *
33
+ * DrawingML distinguishes dash length (`lgDash`) and the system patterns
34
+ * (`sysDash`) from the plain ones; a display list has three periodic patterns,
35
+ * so the distinction collapses to dotted or dashed. It collapses here, once,
36
+ * rather than at whichever consumer happened to know the spelling.
37
+ */
38
+ declare const PRESET_DASH_STROKE_PATTERNS: {
39
+ readonly solid: "solid";
40
+ readonly dot: "dotted";
41
+ readonly dash: "dashed";
42
+ readonly lgDash: "dashed";
43
+ readonly dashDot: "dashed";
44
+ readonly lgDashDot: "dashed";
45
+ readonly lgDashDotDot: "dashed";
46
+ readonly sysDash: "dashed";
47
+ readonly sysDot: "dotted";
48
+ readonly sysDashDot: "dashed";
49
+ readonly sysDashDotDot: "dashed";
50
+ };
51
+ /**
52
+ * Every `ST_Underline` member the model carries, one row per member.
53
+ *
54
+ * The three fields are one decision and belong on one line: `wavyDouble` is
55
+ * Word's two waves, which is the `wavy` pattern drawn twice rather than the
56
+ * `double` pattern, so a reader who has the pattern without the count has half
57
+ * the member. `double` is one stroke, because the display list's `double`
58
+ * pattern already carries the second rule and the gap between them. CSS can
59
+ * draw neither two waves nor `words`, so the editor approximates them; the page
60
+ * and the PDF do not have to.
61
+ *
62
+ * Word draws `thick` and the seven `*Heavy` members at twice the rule the font
63
+ * asks for, and the rest at the plain rule. Without the weight the display list
64
+ * strokes every member at the plain thickness, so `dottedHeavy` and `dotted`
65
+ * come out as the same line on the page and in the PDF while the editor draws
66
+ * them apart. The DOM spells this same weight as a
67
+ * `text-decoration-thickness` length (`utils/formatToStyle.ts`), so which
68
+ * members are heavy is decided here and nowhere else.
69
+ *
70
+ * `none` states no decoration: a run whose underline says so paints nothing,
71
+ * and its weight and stroke count are the plain ones by default rather than by
72
+ * decision.
73
+ */
74
+ declare const UNDERLINE_STROKES: {
75
+ readonly none: {
76
+ readonly pattern: "none";
77
+ readonly weight: 1;
78
+ readonly strokes: 1;
79
+ };
80
+ readonly single: {
81
+ readonly pattern: "solid";
82
+ readonly weight: 1;
83
+ readonly strokes: 1;
84
+ };
85
+ readonly words: {
86
+ readonly pattern: "solid";
87
+ readonly weight: 1;
88
+ readonly strokes: 1;
89
+ };
90
+ readonly double: {
91
+ readonly pattern: "double";
92
+ readonly weight: 1;
93
+ readonly strokes: 1;
94
+ };
95
+ readonly thick: {
96
+ readonly pattern: "solid";
97
+ readonly weight: 2;
98
+ readonly strokes: 1;
99
+ };
100
+ readonly dotted: {
101
+ readonly pattern: "dotted";
102
+ readonly weight: 1;
103
+ readonly strokes: 1;
104
+ };
105
+ readonly dottedHeavy: {
106
+ readonly pattern: "dotted";
107
+ readonly weight: 2;
108
+ readonly strokes: 1;
109
+ };
110
+ readonly dash: {
111
+ readonly pattern: "dashed";
112
+ readonly weight: 1;
113
+ readonly strokes: 1;
114
+ };
115
+ readonly dashedHeavy: {
116
+ readonly pattern: "dashed";
117
+ readonly weight: 2;
118
+ readonly strokes: 1;
119
+ };
120
+ readonly dashLong: {
121
+ readonly pattern: "dashed";
122
+ readonly weight: 1;
123
+ readonly strokes: 1;
124
+ };
125
+ readonly dashLongHeavy: {
126
+ readonly pattern: "dashed";
127
+ readonly weight: 2;
128
+ readonly strokes: 1;
129
+ };
130
+ readonly dotDash: {
131
+ readonly pattern: "dashed";
132
+ readonly weight: 1;
133
+ readonly strokes: 1;
134
+ };
135
+ readonly dashDotHeavy: {
136
+ readonly pattern: "dashed";
137
+ readonly weight: 2;
138
+ readonly strokes: 1;
139
+ };
140
+ readonly dotDotDash: {
141
+ readonly pattern: "dashed";
142
+ readonly weight: 1;
143
+ readonly strokes: 1;
144
+ };
145
+ readonly dashDotDotHeavy: {
146
+ readonly pattern: "dashed";
147
+ readonly weight: 2;
148
+ readonly strokes: 1;
149
+ };
150
+ readonly wave: {
151
+ readonly pattern: "wavy";
152
+ readonly weight: 1;
153
+ readonly strokes: 1;
154
+ };
155
+ readonly wavyHeavy: {
156
+ readonly pattern: "wavy";
157
+ readonly weight: 2;
158
+ readonly strokes: 1;
159
+ };
160
+ readonly wavyDouble: {
161
+ readonly pattern: "wavy";
162
+ readonly weight: 1;
163
+ readonly strokes: 2;
164
+ };
165
+ };
5
166
  type ResolveStrokeResult = {
6
167
  readonly stroke?: DisplayStroke;
7
168
  /** The authored colour, when it could not be parsed. Report it, do not paint. */
8
169
  readonly unresolvedColor?: string;
9
170
  };
10
171
  /**
11
- * Turn an authored border into a paintable stroke. `undefined` stroke means
12
- * "draw nothing": an explicit `none`/`nil` style, a non-positive width, or a
13
- * colour this producer cannot resolve.
172
+ * Turn an authored CSS border into a paintable stroke. `undefined` stroke means
173
+ * "draw nothing": an explicit `none` style, a non-positive width, or a colour
174
+ * this producer cannot resolve.
14
175
  */
15
176
  declare const resolveBorderStroke: (border: BorderInput) => ResolveStrokeResult;
16
- /** CSS `text-decoration-style` → the display list's stroke patterns. */
17
- declare const decorationPatternForStyle: (style: string | undefined) => DisplayStrokePattern;
177
+ type OutlineInput = {
178
+ color?: string;
179
+ dash?: PresetLineDashVal;
180
+ width?: number;
181
+ };
182
+ /** Turn a shape or text-box outline into a paintable stroke. */
183
+ declare const resolveOutlineStroke: (outline: OutlineInput) => ResolveStrokeResult;
184
+ declare const underlinePattern: (style: UnderlineStyle | undefined) => StrokePattern;
185
+ declare const underlineWeight: (style: UnderlineStyle | undefined) => number;
186
+ declare const underlineStrokeCount: (style: UnderlineStyle | undefined) => number;
18
187
  //#endregion
19
- export { ResolveStrokeResult, decorationPatternForStyle, resolveBorderStroke };
188
+ export { CSS_BORDER_STROKE_PATTERNS, PRESET_DASH_STROKE_PATTERNS, ResolveStrokeResult, UNDERLINE_STROKES, resolveBorderStroke, resolveOutlineStroke, underlinePattern, underlineStrokeCount, underlineWeight };
@@ -1,58 +1,164 @@
1
1
  import { resolveCssBorderStroke } from "../../layout-painter/borderStroke.js";
2
2
  import { parseDisplayColor } from "./colors.js";
3
+ import "./textDecorations.js";
3
4
  //#region src/display-list/build/strokes.ts
4
5
  /**
5
- * Border and rule strokes.
6
+ * Every CSS `border-style` folio paints, as a display-list pattern.
6
7
  *
7
- * One deliberate divergence from `layout-painter/borderStroke.ts`: that helper
8
- * encodes a sub-pixel border width as a `color-mix` alpha because CSS quantizes
9
- * a fractional border to one device pixel. A display list has no device pixel,
10
- * and a PDF strokes 0.4pt natively, so the authored fractional width and the
11
- * plain colour survive here. Everything else (colour/style/width defaults) is
12
- * taken from the painter's helper so the two cannot drift.
8
+ * The bevelled keywords have no display-list pattern, and Word draws
9
+ * `threeDEmboss`/`threeDEngrave` as a plain line where the shading is
10
+ * unavailable, so they stroke solid.
13
11
  */
14
- /**
15
- * CSS `border-style` and the raw OOXML `w:val` names both reach
16
- * `BorderStyle.style` (the bridge maps most, `renderParagraph` maps the rest),
17
- * so both vocabularies are resolved here. Everything decorative that folio does
18
- * not draw degrades to a plain line, matching how Word degrades on a platform
19
- * without the specialised glyphs.
20
- */
21
- const STROKE_PATTERN_BY_STYLE = {
12
+ const CSS_BORDER_STROKE_PATTERNS = {
22
13
  none: "none",
23
- nil: "none",
24
- hidden: "none",
25
14
  solid: "solid",
26
- single: "solid",
27
- thick: "solid",
28
- inset: "solid",
29
- outset: "solid",
30
- ridge: "solid",
31
- groove: "solid",
32
15
  double: "double",
33
16
  dotted: "dotted",
34
- dotdash: "dashed",
35
- dotdotdash: "dashed",
36
17
  dashed: "dashed",
37
- dash: "dashed",
38
- dashsmallgap: "dashed",
39
- dashlong: "dashed",
40
- wavy: "wavy",
41
- wave: "wavy",
42
- wavydouble: "double"
18
+ groove: "solid",
19
+ ridge: "solid",
20
+ inset: "solid",
21
+ outset: "solid"
43
22
  };
44
- const DEFAULT_PATTERN = "solid";
45
- const strokePatternForStyle = (style) => {
46
- if (style === void 0) return DEFAULT_PATTERN;
47
- return STROKE_PATTERN_BY_STYLE[style.trim().toLowerCase()] ?? DEFAULT_PATTERN;
23
+ /**
24
+ * Every `ST_PresetLineDashVal` member, as a display-list pattern.
25
+ *
26
+ * DrawingML distinguishes dash length (`lgDash`) and the system patterns
27
+ * (`sysDash`) from the plain ones; a display list has three periodic patterns,
28
+ * so the distinction collapses to dotted or dashed. It collapses here, once,
29
+ * rather than at whichever consumer happened to know the spelling.
30
+ */
31
+ const PRESET_DASH_STROKE_PATTERNS = {
32
+ solid: "solid",
33
+ dot: "dotted",
34
+ dash: "dashed",
35
+ lgDash: "dashed",
36
+ dashDot: "dashed",
37
+ lgDashDot: "dashed",
38
+ lgDashDotDot: "dashed",
39
+ sysDash: "dashed",
40
+ sysDot: "dotted",
41
+ sysDashDot: "dashed",
42
+ sysDashDotDot: "dashed"
48
43
  };
49
44
  /**
50
- * Turn an authored border into a paintable stroke. `undefined` stroke means
51
- * "draw nothing": an explicit `none`/`nil` style, a non-positive width, or a
52
- * colour this producer cannot resolve.
45
+ * Every `ST_Underline` member the model carries, one row per member.
46
+ *
47
+ * The three fields are one decision and belong on one line: `wavyDouble` is
48
+ * Word's two waves, which is the `wavy` pattern drawn twice rather than the
49
+ * `double` pattern, so a reader who has the pattern without the count has half
50
+ * the member. `double` is one stroke, because the display list's `double`
51
+ * pattern already carries the second rule and the gap between them. CSS can
52
+ * draw neither two waves nor `words`, so the editor approximates them; the page
53
+ * and the PDF do not have to.
54
+ *
55
+ * Word draws `thick` and the seven `*Heavy` members at twice the rule the font
56
+ * asks for, and the rest at the plain rule. Without the weight the display list
57
+ * strokes every member at the plain thickness, so `dottedHeavy` and `dotted`
58
+ * come out as the same line on the page and in the PDF while the editor draws
59
+ * them apart. The DOM spells this same weight as a
60
+ * `text-decoration-thickness` length (`utils/formatToStyle.ts`), so which
61
+ * members are heavy is decided here and nowhere else.
62
+ *
63
+ * `none` states no decoration: a run whose underline says so paints nothing,
64
+ * and its weight and stroke count are the plain ones by default rather than by
65
+ * decision.
53
66
  */
54
- const resolveBorderStroke = (border) => {
55
- const pattern = strokePatternForStyle(border.style);
67
+ const UNDERLINE_STROKES = {
68
+ none: {
69
+ pattern: "none",
70
+ weight: 1,
71
+ strokes: 1
72
+ },
73
+ single: {
74
+ pattern: "solid",
75
+ weight: 1,
76
+ strokes: 1
77
+ },
78
+ words: {
79
+ pattern: "solid",
80
+ weight: 1,
81
+ strokes: 1
82
+ },
83
+ double: {
84
+ pattern: "double",
85
+ weight: 1,
86
+ strokes: 1
87
+ },
88
+ thick: {
89
+ pattern: "solid",
90
+ weight: 2,
91
+ strokes: 1
92
+ },
93
+ dotted: {
94
+ pattern: "dotted",
95
+ weight: 1,
96
+ strokes: 1
97
+ },
98
+ dottedHeavy: {
99
+ pattern: "dotted",
100
+ weight: 2,
101
+ strokes: 1
102
+ },
103
+ dash: {
104
+ pattern: "dashed",
105
+ weight: 1,
106
+ strokes: 1
107
+ },
108
+ dashedHeavy: {
109
+ pattern: "dashed",
110
+ weight: 2,
111
+ strokes: 1
112
+ },
113
+ dashLong: {
114
+ pattern: "dashed",
115
+ weight: 1,
116
+ strokes: 1
117
+ },
118
+ dashLongHeavy: {
119
+ pattern: "dashed",
120
+ weight: 2,
121
+ strokes: 1
122
+ },
123
+ dotDash: {
124
+ pattern: "dashed",
125
+ weight: 1,
126
+ strokes: 1
127
+ },
128
+ dashDotHeavy: {
129
+ pattern: "dashed",
130
+ weight: 2,
131
+ strokes: 1
132
+ },
133
+ dotDotDash: {
134
+ pattern: "dashed",
135
+ weight: 1,
136
+ strokes: 1
137
+ },
138
+ dashDotDotHeavy: {
139
+ pattern: "dashed",
140
+ weight: 2,
141
+ strokes: 1
142
+ },
143
+ wave: {
144
+ pattern: "wavy",
145
+ weight: 1,
146
+ strokes: 1
147
+ },
148
+ wavyHeavy: {
149
+ pattern: "wavy",
150
+ weight: 2,
151
+ strokes: 1
152
+ },
153
+ wavyDouble: {
154
+ pattern: "wavy",
155
+ weight: 1,
156
+ strokes: 2
157
+ }
158
+ };
159
+ /** What a border with a width but no style paints: the CSS initial. */
160
+ const DEFAULT_PATTERN = "solid";
161
+ const strokeWith = (border, pattern) => {
56
162
  if (pattern === "none") return {};
57
163
  const css = resolveCssBorderStroke(border);
58
164
  const isSubPixelEncoded = css.color.startsWith("color-mix");
@@ -68,11 +174,25 @@ const resolveBorderStroke = (border) => {
68
174
  pattern
69
175
  } };
70
176
  };
71
- /** CSS `text-decoration-style` → the display list's stroke patterns. */
72
- const decorationPatternForStyle = (style) => {
73
- if (style === void 0) return DEFAULT_PATTERN;
74
- const pattern = STROKE_PATTERN_BY_STYLE[style.trim().toLowerCase()];
75
- return pattern === void 0 || pattern === "none" ? DEFAULT_PATTERN : pattern;
76
- };
177
+ /**
178
+ * Turn an authored CSS border into a paintable stroke. `undefined` stroke means
179
+ * "draw nothing": an explicit `none` style, a non-positive width, or a colour
180
+ * this producer cannot resolve.
181
+ */
182
+ const resolveBorderStroke = (border) => strokeWith(border, border.style === void 0 ? DEFAULT_PATTERN : CSS_BORDER_STROKE_PATTERNS[border.style]);
183
+ /** Turn a shape or text-box outline into a paintable stroke. */
184
+ const resolveOutlineStroke = (outline) => strokeWith({
185
+ color: outline.color,
186
+ width: outline.width
187
+ }, outline.dash === void 0 ? DEFAULT_PATTERN : PRESET_DASH_STROKE_PATTERNS[outline.dash]);
188
+ /**
189
+ * An authored underline's row. An undefined member is a `w:u` with no `w:val`,
190
+ * which Word draws as the plain single rule, so it resolves to that member's
191
+ * row rather than to a default per field.
192
+ */
193
+ const underlineStrokes = (style) => style === void 0 ? UNDERLINE_STROKES.single : UNDERLINE_STROKES[style];
194
+ const underlinePattern = (style) => underlineStrokes(style).pattern;
195
+ const underlineWeight = (style) => underlineStrokes(style).weight;
196
+ const underlineStrokeCount = (style) => underlineStrokes(style).strokes;
77
197
  //#endregion
78
- export { decorationPatternForStyle, resolveBorderStroke };
198
+ export { CSS_BORDER_STROKE_PATTERNS, PRESET_DASH_STROKE_PATTERNS, UNDERLINE_STROKES, resolveBorderStroke, resolveOutlineStroke, underlinePattern, underlineStrokeCount, underlineWeight };
@@ -2,6 +2,8 @@ import { createTableCellFlowState, placeTableCellBlock } from "../../layout-engi
2
2
  import { buildTableCellGrid, buildTableCellPlacements, getSourceCellAt } from "../../layout-engine/measure/tableCellGrid.js";
3
3
  import { tableFragmentBottomBorders } from "../../layout-engine/measure/tableFragmentBorderGeometry.js";
4
4
  import { resolveTableCellPadding } from "../../layout-engine/types.js";
5
+ import { cellTextRotationDegrees } from "../../layout-painter/renderTable.js";
6
+ import { paintsCssBorder } from "../../utils/borderCss.js";
5
7
  import { HIT_REGION_KINDS } from "../primitives.js";
6
8
  import { parseDisplayColor } from "./colors.js";
7
9
  import { paintImageFragment } from "./imagePrimitives.js";
@@ -25,7 +27,7 @@ import { UNSUPPORTED_CONSTRUCT } from "./unsupported.js";
25
27
  * engineering a gradient.
26
28
  */
27
29
  /** A cell edge is "visible" for collapse purposes on style alone, as the painter decides it. */
28
- const hasVisibleBorder = (border) => border !== void 0 && border.style !== "none" && border.style !== "nil";
30
+ const hasVisibleBorder = (border) => border !== void 0 && paintsCssBorder(border.style);
29
31
  const strokeFor = (border, context, label) => {
30
32
  if (!hasVisibleBorder(border) || !border) return;
31
33
  const { stroke, unresolvedColor } = resolveBorderStroke(border);
@@ -97,7 +99,7 @@ const paintCell = ({ composer, cell, cellMeasure, box, context, paintTextBox, si
97
99
  const contentXPx = box.xPx + widths.left + padding.left;
98
100
  const contentYPx = box.yPx + widths.top + padding.top;
99
101
  const contentWidthPx = Math.max(0, cellMeasure.width - padding.left - padding.right);
100
- if (cell.textDirection === "btLr" || cell.textDirection === "tbRl") context.unsupported.report(UNSUPPORTED_CONSTRUCT.verticalCellText, context.pageIndex, `w:textDirection ${cell.textDirection} paints horizontally`);
102
+ if (cellTextRotationDegrees(cell.textDirection) !== 0) context.unsupported.report(UNSUPPORTED_CONSTRUCT.verticalCellText, context.pageIndex, `w:textDirection ${cell.textDirection} paints horizontally`);
101
103
  composer.push(primitives);
102
104
  primitives.length = 0;
103
105
  paintCellBlocks({
@@ -1,11 +1,12 @@
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";
3
4
  import { hasHorizontalFlip, hasVerticalFlip, parseRotationDegrees } from "../../utils/rotationBoundingBox.js";
4
5
  import { HIT_REGION_KINDS } from "../primitives.js";
5
6
  import { parseDisplayColor } from "./colors.js";
6
7
  import { paintParagraphFragment } from "./paragraphPrimitives.js";
7
8
  import { blockRegion, createPageComposer } from "./regions.js";
8
- import { resolveBorderStroke } from "./strokes.js";
9
+ import { resolveOutlineStroke } from "./strokes.js";
9
10
  import { paintTableBlock } from "./tablePrimitives.js";
10
11
  import { UNSUPPORTED_CONSTRUCT } from "./unsupported.js";
11
12
  //#region src/display-list/build/textBoxPrimitives.ts
@@ -65,10 +66,11 @@ const paintUnrotatedTextBoxFragment = ({ composer, fragment, block, measure, con
65
66
  else context.unsupported.report(UNSUPPORTED_CONSTRUCT.unresolvedColor, context.pageIndex, `text box fill ${block.fillColor}`);
66
67
  }
67
68
  let outlineWidthPx = 0;
68
- if (block.outlineWidth !== void 0 && block.outlineWidth > 0) {
69
- const { stroke, unresolvedColor } = resolveBorderStroke({
69
+ const outlineDash = presetDashForOutlineAttr(block.outlineStyle) ?? "solid";
70
+ if (block.outlineWidth !== void 0 && block.outlineWidth > 0 && outlineDash !== "none") {
71
+ const { stroke, unresolvedColor } = resolveOutlineStroke({
70
72
  width: block.outlineWidth,
71
- style: block.outlineStyle ?? "solid",
73
+ dash: outlineDash,
72
74
  color: block.outlineColor ?? "#000000"
73
75
  });
74
76
  if (unresolvedColor !== void 0) context.unsupported.report(UNSUPPORTED_CONSTRUCT.unresolvedColor, context.pageIndex, `text box outline ${unresolvedColor}`);
@@ -20,10 +20,24 @@ declare const UNDERLINE_OFFSET_RATIO = 0.1;
20
20
  /** Underline thickness as a fraction of the em, floored so a hairline stays visible. */
21
21
  declare const UNDERLINE_THICKNESS_RATIO: number;
22
22
  declare const MIN_DECORATION_THICKNESS_PX = 1;
23
+ /**
24
+ * What an underline member's thickness is a multiple of the plain one.
25
+ *
26
+ * `thick` and the `*Heavy` members differ from their plain counterparts in
27
+ * weight only, and Word draws that weight as twice the plain rule. The number
28
+ * lives here rather than at either renderer because both read it: a member's
29
+ * row states it (`strokes.ts:UNDERLINE_STROKES`), the display list multiplies
30
+ * the stroke by it and the DOM spells the same row's weight as a
31
+ * `text-decoration-thickness` length
32
+ * (`formatToStyle.ts:underlineDecorationCss`). Two copies would let the page
33
+ * and the editor draw the same member at two weights.
34
+ */
35
+ declare const PLAIN_UNDERLINE_WEIGHT = 1;
36
+ declare const HEAVY_UNDERLINE_WEIGHT = 2;
23
37
  /** Distance above the baseline to the centre of the strikethrough, as a fraction of the em. */
24
38
  declare const STRIKETHROUGH_OFFSET_RATIO = 0.28;
25
39
  declare const underlineThicknessPx: (fontSizePx: number) => number;
26
40
  declare const underlineCenterYPx: (baselineYPx: number, fontSizePx: number) => number;
27
41
  declare const strikethroughCenterYPx: (baselineYPx: number, fontSizePx: number) => number;
28
42
  //#endregion
29
- export { MIN_DECORATION_THICKNESS_PX, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
43
+ export { HEAVY_UNDERLINE_WEIGHT, MIN_DECORATION_THICKNESS_PX, PLAIN_UNDERLINE_WEIGHT, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
@@ -20,10 +20,24 @@ const UNDERLINE_OFFSET_RATIO = .1;
20
20
  /** Underline thickness as a fraction of the em, floored so a hairline stays visible. */
21
21
  const UNDERLINE_THICKNESS_RATIO = 1 / 14;
22
22
  const MIN_DECORATION_THICKNESS_PX = 1;
23
+ /**
24
+ * What an underline member's thickness is a multiple of the plain one.
25
+ *
26
+ * `thick` and the `*Heavy` members differ from their plain counterparts in
27
+ * weight only, and Word draws that weight as twice the plain rule. The number
28
+ * lives here rather than at either renderer because both read it: a member's
29
+ * row states it (`strokes.ts:UNDERLINE_STROKES`), the display list multiplies
30
+ * the stroke by it and the DOM spells the same row's weight as a
31
+ * `text-decoration-thickness` length
32
+ * (`formatToStyle.ts:underlineDecorationCss`). Two copies would let the page
33
+ * and the editor draw the same member at two weights.
34
+ */
35
+ const PLAIN_UNDERLINE_WEIGHT = 1;
36
+ const HEAVY_UNDERLINE_WEIGHT = 2;
23
37
  /** Distance above the baseline to the centre of the strikethrough, as a fraction of the em. */
24
38
  const STRIKETHROUGH_OFFSET_RATIO = .28;
25
39
  const underlineThicknessPx = (fontSizePx) => Math.max(1, fontSizePx * UNDERLINE_THICKNESS_RATIO);
26
40
  const underlineCenterYPx = (baselineYPx, fontSizePx) => baselineYPx + fontSizePx * UNDERLINE_OFFSET_RATIO;
27
41
  const strikethroughCenterYPx = (baselineYPx, fontSizePx) => baselineYPx - fontSizePx * STRIKETHROUGH_OFFSET_RATIO;
28
42
  //#endregion
29
- export { MIN_DECORATION_THICKNESS_PX, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
43
+ export { HEAVY_UNDERLINE_WEIGHT, MIN_DECORATION_THICKNESS_PX, PLAIN_UNDERLINE_WEIGHT, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
@@ -2,7 +2,7 @@ import { writeCommentAnchorIds } from "../../render-dom/commentAnchorAttributes.
2
2
  import { bytesToDataUrl } from "../../utils/base64.js";
3
3
  import { imageLuminanceFilter } from "../../utils/imageLuminance.js";
4
4
  import { anchorTargetAttrs } from "../../utils/urlSecurity.js";
5
- import { STROKE_DASH_FACTORS, walkRegions } from "../primitives.js";
5
+ import { STROKE_DASH_FACTORS, strokeCrossExtentPx, walkRegions } from "../primitives.js";
6
6
  import { panic } from "better-result";
7
7
  //#region src/display-list/dom/renderDisplayListToDom.ts
8
8
  /**
@@ -162,24 +162,6 @@ const VERTICAL_BAR_AXES = {
162
162
  main: "to bottom",
163
163
  cross: "to right"
164
164
  };
165
- /**
166
- * How far a stroke reaches across its path. A dash pattern stays within the
167
- * thickness; `double` spans two lines plus the shared gap, and `wavy` the peak
168
- * to peak amplitude plus the thickness the curve itself is drawn with.
169
- */
170
- const strokeCrossExtentPx = (stroke) => {
171
- switch (stroke.pattern) {
172
- case "solid":
173
- case "dashed":
174
- case "dotted": return stroke.thicknessPx;
175
- case "double": return stroke.thicknessPx * 3;
176
- case "wavy": return stroke.thicknessPx * 3;
177
- default: {
178
- const unreachable = stroke.pattern;
179
- panic(`renderDisplayListToDom: unhandled stroke pattern ${JSON.stringify(unreachable)}`);
180
- }
181
- }
182
- };
183
165
  const repeatingBars = (color, axis, barPx, gapPx) => `repeating-linear-gradient(${axis}, ${color} 0px, ${color} ${barPx}px, transparent ${barPx}px, transparent ${barPx + gapPx}px)`;
184
166
  const strokeBackground = (stroke, axes) => {
185
167
  const color = cssColor(stroke.color);
@@ -1,4 +1,4 @@
1
- import { DisplayColor, DisplayGlyphRun, DisplayHitRegion, DisplayPrimitive } from "./types.js";
1
+ import { DisplayColor, DisplayGlyphRun, DisplayHitRegion, DisplayPrimitive, DisplayStroke } from "./types.js";
2
2
  import { hasCursiveLetter, joinsAcrossBoundary } from "../utils/cursiveJoining.js";
3
3
  import { hasComplexScript, isComplexScriptCodePoint } from "../utils/scriptSegments.js";
4
4
  //#region src/display-list/primitives.d.ts
@@ -56,6 +56,17 @@ declare const DOUBLE_STROKE_GAP_FACTOR = 1;
56
56
  */
57
57
  declare const WAVY_STROKE_PERIOD_FACTOR = 6;
58
58
  declare const WAVY_STROKE_AMPLITUDE_FACTOR = 2;
59
+ /**
60
+ * How far a stroke reaches across its path: the band it occupies, centred on
61
+ * the path. A dash pattern stays within the thickness; `double` spans two rules
62
+ * plus the gap between them, and `wavy` the peak-to-peak amplitude plus the
63
+ * thickness the curve itself is drawn with.
64
+ *
65
+ * The DOM backend sizes an element with it and the producer stacks `wavyDouble`
66
+ * with it, so two strokes meant to clear each other are pushed apart by exactly
67
+ * the band the backend then paints.
68
+ */
69
+ declare const strokeCrossExtentPx: (stroke: DisplayStroke) => number;
59
70
  declare const BLACK: DisplayColor;
60
71
  declare const WHITE: DisplayColor;
61
72
  /**
@@ -93,4 +104,4 @@ type RegionVisitor = {
93
104
  };
94
105
  declare const walkRegions: (primitives: readonly DisplayPrimitive[], regions: readonly DisplayHitRegion[], visitor: RegionVisitor) => void;
95
106
  //#endregion
96
- export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, RegionVisitor, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, walkRegions };
107
+ export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, RegionVisitor, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, strokeCrossExtentPx, walkRegions };
@@ -1,7 +1,19 @@
1
1
  import { hasCursiveLetter, joinsAcrossBoundary } from "../utils/cursiveJoining.js";
2
2
  import { hasComplexScript, isComplexScriptCodePoint } from "../utils/scriptSegments.js";
3
+ import { panic } from "better-result";
3
4
  //#region src/display-list/primitives.ts
4
5
  /**
6
+ * Runtime companions of the paint IR.
7
+ *
8
+ * `types.ts` is pure data by rule, so what a backend needs at runtime lives
9
+ * here instead: the discriminator list a coverage test enumerates, the two
10
+ * colours every producer resolves a theme variable to, the stroke geometry
11
+ * both backends draw from, and the rule that turns a run's advances into a
12
+ * position per code point. A rule two backends must agree on belongs in one
13
+ * module, not in one copy each. Nothing here carries a layout fact, which is
14
+ * why a backend may take a runtime edge to it and not to `types.ts`.
15
+ */
16
+ /**
5
17
  * Left edge of every code point of a run, as an offset from the run's `xPx`.
6
18
  *
7
19
  * One implementation for both backends. The ordering rule is prose in
@@ -71,6 +83,29 @@ const DOUBLE_STROKE_GAP_FACTOR = 1;
71
83
  */
72
84
  const WAVY_STROKE_PERIOD_FACTOR = 6;
73
85
  const WAVY_STROKE_AMPLITUDE_FACTOR = 2;
86
+ /**
87
+ * How far a stroke reaches across its path: the band it occupies, centred on
88
+ * the path. A dash pattern stays within the thickness; `double` spans two rules
89
+ * plus the gap between them, and `wavy` the peak-to-peak amplitude plus the
90
+ * thickness the curve itself is drawn with.
91
+ *
92
+ * The DOM backend sizes an element with it and the producer stacks `wavyDouble`
93
+ * with it, so two strokes meant to clear each other are pushed apart by exactly
94
+ * the band the backend then paints.
95
+ */
96
+ const strokeCrossExtentPx = (stroke) => {
97
+ switch (stroke.pattern) {
98
+ case "solid":
99
+ case "dashed":
100
+ case "dotted": return stroke.thicknessPx;
101
+ case "double": return stroke.thicknessPx * 3;
102
+ case "wavy": return stroke.thicknessPx * 3;
103
+ default: {
104
+ const unreachable = stroke.pattern;
105
+ panic(`strokeCrossExtentPx: unhandled stroke pattern ${JSON.stringify(unreachable)}`);
106
+ }
107
+ }
108
+ };
74
109
  const BLACK = {
75
110
  r: 0,
76
111
  g: 0,
@@ -124,4 +159,4 @@ const walkRegions = (primitives, regions, visitor) => {
124
159
  visit(0, primitives.length, regions);
125
160
  };
126
161
  //#endregion
127
- export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, walkRegions };
162
+ export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, strokeCrossExtentPx, walkRegions };