@stll/folio-core 0.46.0 → 0.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/dist/ai-edits/apply.d.ts +17 -1
  2. package/dist/ai-edits/apply.js +31 -27
  3. package/dist/ai-edits/headless.d.ts +9 -2
  4. package/dist/ai-edits/headless.js +5 -3
  5. package/dist/ai-edits/read.d.ts +1 -0
  6. package/dist/ai-edits/read.js +1 -0
  7. package/dist/ai-edits/snapshot.js +32 -27
  8. package/dist/ai-edits/table-cell-mutations.js +15 -7
  9. package/dist/ai-edits/table-geometry.js +21 -18
  10. package/dist/ai-edits/table-template.js +2 -2
  11. package/dist/compare/compare.js +2 -1
  12. package/dist/compare/content-alignment.js +192 -46
  13. package/dist/compare/content-types.d.ts +8 -2
  14. package/dist/compare/content.js +2 -11
  15. package/dist/compare/plan.js +7 -4
  16. package/dist/compare/section-boundary-properties.js +1 -2
  17. package/dist/content-controls/checkboxDisplay.d.ts +8 -2
  18. package/dist/content-controls/checkboxDisplay.js +11 -5
  19. package/dist/content-controls/mutateContentControls.js +41 -42
  20. package/dist/controller/layoutPipeline.js +8 -3
  21. package/dist/display-list/build/buildDisplayList.js +7 -7
  22. package/dist/display-list/build/imagePrimitives.d.ts +4 -4
  23. package/dist/display-list/build/imagePrimitives.js +38 -20
  24. package/dist/display-list/build/pageBorderPrimitives.js +2 -1
  25. package/dist/display-list/build/paragraphPrimitives.js +93 -13
  26. package/dist/display-list/build/previewPrimitives.d.ts +10 -0
  27. package/dist/display-list/build/previewPrimitives.js +89 -0
  28. package/dist/display-list/build/strokes.d.ts +177 -8
  29. package/dist/display-list/build/strokes.js +167 -47
  30. package/dist/display-list/build/tablePrimitives.js +4 -2
  31. package/dist/display-list/build/textBoxPrimitives.js +6 -4
  32. package/dist/display-list/build/textDecorations.d.ts +15 -1
  33. package/dist/display-list/build/textDecorations.js +15 -1
  34. package/dist/display-list/dom/renderDisplayListToDom.js +1 -19
  35. package/dist/display-list/primitives.d.ts +13 -2
  36. package/dist/display-list/primitives.js +36 -1
  37. package/dist/document-operations.d.ts +9 -2
  38. package/dist/document-operations.js +5 -3
  39. package/dist/docx/attributeRemainder.d.ts +34 -1
  40. package/dist/docx/attributeRemainder.js +49 -3
  41. package/dist/docx/blockContentParser.d.ts +2 -0
  42. package/dist/docx/blockContentParser.js +39 -67
  43. package/dist/docx/blockPlainText.js +3 -1
  44. package/dist/docx/borderParser.js +26 -11
  45. package/dist/docx/builtInStyles.d.ts +8 -16
  46. package/dist/docx/builtInStyles.js +54 -17
  47. package/dist/docx/commentAnchorIndex.js +1 -1
  48. package/dist/docx/commentParser.js +3 -3
  49. package/dist/docx/commentRangeIntegrity.js +1 -1
  50. package/dist/docx/commentRangeJoin.js +1 -1
  51. package/dist/docx/commentReferenceNormalization.js +3 -2
  52. package/dist/docx/commentReplyMarkers.js +1 -1
  53. package/dist/docx/compatibility.js +56 -42
  54. package/dist/docx/containerChildren.d.ts +110 -13
  55. package/dist/docx/containerChildren.gen.d.ts +16 -1
  56. package/dist/docx/containerChildren.gen.js +18 -1
  57. package/dist/docx/containerChildren.js +63 -13
  58. package/dist/docx/diagramPreview.d.ts +14 -2
  59. package/dist/docx/diagramPreview.js +81 -169
  60. package/dist/docx/documentParser.js +4 -1
  61. package/dist/docx/drawingAnchor.d.ts +87 -0
  62. package/dist/docx/drawingAnchor.js +201 -0
  63. package/dist/docx/drawingUtils.d.ts +43 -38
  64. package/dist/docx/drawingUtils.js +205 -118
  65. package/dist/docx/fontTableParser.js +102 -41
  66. package/dist/docx/footnoteParser.js +10 -6
  67. package/dist/docx/groupDrawingParser.js +4 -3
  68. package/dist/docx/headerFooterReferenceNormalization.js +1 -1
  69. package/dist/docx/hyperlinkParser.d.ts +45 -7
  70. package/dist/docx/hyperlinkParser.js +126 -57
  71. package/dist/docx/imageParser.js +127 -107
  72. package/dist/docx/index.d.ts +2 -1
  73. package/dist/docx/index.js +2 -1
  74. package/dist/docx/inlineContentRemovals.d.ts +28 -0
  75. package/dist/docx/inlineContentRemovals.js +46 -0
  76. package/dist/docx/inlineWrapperContent.d.ts +84 -3
  77. package/dist/docx/inlineWrapperContent.js +85 -4
  78. package/dist/docx/inlineWrapperParser.d.ts +11 -0
  79. package/dist/docx/inlineWrapperParser.js +60 -0
  80. package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
  81. package/dist/docx/normalizeBaseDirection.js +4 -2
  82. package/dist/docx/numberingParser.d.ts +25 -2
  83. package/dist/docx/numberingParser.js +264 -361
  84. package/dist/docx/numberingReference.d.ts +9 -16
  85. package/dist/docx/numberingReference.js +17 -16
  86. package/dist/docx/numberingReferenceNormalization.js +7 -7
  87. package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
  88. package/dist/docx/ooxmlCounterFormatter.js +4 -1
  89. package/dist/docx/paraIdAttribute.d.ts +91 -1
  90. package/dist/docx/paraIdAttribute.js +79 -1
  91. package/dist/docx/paragraphParser.d.ts +9 -24
  92. package/dist/docx/paragraphParser.js +212 -396
  93. package/dist/docx/paragraphProperties.d.ts +23 -0
  94. package/dist/docx/paragraphProperties.js +279 -0
  95. package/dist/docx/paragraphPropertySource.js +2 -0
  96. package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
  97. package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
  98. package/dist/docx/paragraphTraversal.d.ts +14 -10
  99. package/dist/docx/paragraphTraversal.js +47 -49
  100. package/dist/docx/parseWarningMessage.js +3 -0
  101. package/dist/docx/parserEnums.d.ts +6 -8
  102. package/dist/docx/parserEnums.js +4 -6
  103. package/dist/docx/preservedRunContent.js +16 -6
  104. package/dist/docx/previewBudget.d.ts +44 -23
  105. package/dist/docx/previewBudget.js +61 -30
  106. package/dist/docx/propertyElementAttributes.d.ts +178 -0
  107. package/dist/docx/propertyElementAttributes.js +114 -0
  108. package/dist/docx/renderedPageBreakNormalization.js +2 -2
  109. package/dist/docx/rezip.d.ts +28 -2
  110. package/dist/docx/rezip.js +78 -9
  111. package/dist/docx/runConsolidator.d.ts +42 -2
  112. package/dist/docx/runConsolidator.js +60 -6
  113. package/dist/docx/runParser.d.ts +54 -18
  114. package/dist/docx/runParser.js +379 -295
  115. package/dist/docx/runPayload.d.ts +5 -0
  116. package/dist/docx/runPayload.js +4 -0
  117. package/dist/docx/sdtProperties.d.ts +39 -5
  118. package/dist/docx/sdtProperties.js +205 -84
  119. package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
  120. package/dist/docx/sdtPropertiesPatch.js +68 -112
  121. package/dist/docx/sectionParser.d.ts +1 -2
  122. package/dist/docx/sectionParser.js +236 -240
  123. package/dist/docx/selectiveSave.js +3 -2
  124. package/dist/docx/selectiveXmlPatch.d.ts +21 -2
  125. package/dist/docx/selectiveXmlPatch.js +195 -99
  126. package/dist/docx/serializer/blockSdtSerializer.js +2 -96
  127. package/dist/docx/serializer/borderSerializer.d.ts +5 -5
  128. package/dist/docx/serializer/borderSerializer.js +10 -8
  129. package/dist/docx/serializer/documentSerializer.js +3 -0
  130. package/dist/docx/serializer/fontTableSerializer.js +31 -3
  131. package/dist/docx/serializer/headerFooterSerializer.js +3 -0
  132. package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
  133. package/dist/docx/serializer/markupRangeAttributes.js +9 -1
  134. package/dist/docx/serializer/noteSerializer.js +3 -0
  135. package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
  136. package/dist/docx/serializer/numberingSerializer.js +81 -79
  137. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
  138. package/dist/docx/serializer/paragraphSerializer.js +88 -188
  139. package/dist/docx/serializer/runSerializer.d.ts +1 -5
  140. package/dist/docx/serializer/runSerializer.js +109 -59
  141. package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
  142. package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
  143. package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
  144. package/dist/docx/serializer/settingsSerializer.js +6 -4
  145. package/dist/docx/serializer/stylesSerializer.js +8 -11
  146. package/dist/docx/serializer/tableSerializer.js +268 -100
  147. package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
  148. package/dist/docx/serializer/textFormattingSerializer.js +111 -101
  149. package/dist/docx/serializer/xmlUtils.d.ts +1 -1
  150. package/dist/docx/serializer/xmlUtils.js +1 -1
  151. package/dist/docx/server/createBilingualDocument.js +18 -16
  152. package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
  153. package/dist/docx/settingsParser.js +7 -4
  154. package/dist/docx/shadingParser.d.ts +2 -1
  155. package/dist/docx/shadingParser.js +43 -7
  156. package/dist/docx/shapeParser.js +8 -3
  157. package/dist/docx/strictNames.d.ts +11 -0
  158. package/dist/docx/strictNames.gen.d.ts +45 -0
  159. package/dist/docx/strictNames.gen.js +50 -0
  160. package/dist/docx/strictNames.js +43 -0
  161. package/dist/docx/strictValueEncodings.gen.js +133 -131
  162. package/dist/docx/styleParser.js +17 -349
  163. package/dist/docx/tableParser.d.ts +10 -1
  164. package/dist/docx/tableParser.js +505 -181
  165. package/dist/docx/textBoxParser.d.ts +3 -1
  166. package/dist/docx/textBoxParser.js +18 -8
  167. package/dist/docx/themeColorAttribute.d.ts +13 -0
  168. package/dist/docx/themeColorAttribute.js +24 -0
  169. package/dist/docx/trackedMoveRangeNormalization.js +2 -1
  170. package/dist/docx/vmlImageParser.d.ts +13 -4
  171. package/dist/docx/vmlImageParser.js +74 -31
  172. package/dist/docx/vmlPreview.js +2 -2
  173. package/dist/docx/wrapPolygon.d.ts +30 -0
  174. package/dist/docx/wrapPolygon.js +70 -0
  175. package/dist/docx/xmlParser.d.ts +14 -1
  176. package/dist/docx/xmlParser.js +18 -2
  177. package/dist/fonts/embeddedFonts.js +3 -3
  178. package/dist/headless-layout.js +2 -0
  179. package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
  180. package/dist/i18n/messages/catalogs.gen.js +102 -34
  181. package/dist/i18n/messages/messages.gen.d.ts +4 -0
  182. package/dist/internal/headlessRevisionResolution.js +9 -0
  183. package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
  184. package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
  185. package/dist/internal/paragraphFormattingSerialization.js +118 -83
  186. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  187. package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
  188. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  189. package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
  190. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
  191. package/dist/layout-bridge/convert/toFlowBlocks.js +177 -101
  192. package/dist/layout-engine/index.d.ts +2 -2
  193. package/dist/layout-engine/index.js +53 -17
  194. package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
  195. package/dist/layout-engine/measure/measureBlocks.js +6 -10
  196. package/dist/layout-engine/measure/tableCellGrid.js +2 -1
  197. package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
  198. package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
  199. package/dist/layout-engine/paragraphSequence.js +3 -2
  200. package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
  201. package/dist/layout-engine/section-breaks.d.ts +49 -2
  202. package/dist/layout-engine/section-breaks.js +55 -4
  203. package/dist/layout-engine/types.d.ts +47 -17
  204. package/dist/layout-engine/types.js +16 -1
  205. package/dist/layout-painter/borderStroke.d.ts +18 -4
  206. package/dist/layout-painter/renderPage.js +6 -4
  207. package/dist/layout-painter/renderParagraph.d.ts +2 -1
  208. package/dist/layout-painter/renderParagraph.js +13 -26
  209. package/dist/layout-painter/renderTable.d.ts +4 -1
  210. package/dist/layout-painter/renderTable.js +22 -22
  211. package/dist/layout-painter/renderTextBox.js +5 -3
  212. package/dist/markdown/renderBlock.js +3 -1
  213. package/dist/markdown/renderRuns.js +7 -2
  214. package/dist/markdown/renderTable.js +2 -1
  215. package/dist/model.d.ts +3 -3
  216. package/dist/model.js +2 -2
  217. package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
  218. package/dist/paged-layout/sectionBlockWidths.js +26 -4
  219. package/dist/prosemirror/attrs/index.d.ts +22 -4
  220. package/dist/prosemirror/attrs/index.js +498 -60
  221. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
  222. package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
  223. package/dist/prosemirror/commands/comments.js +68 -53
  224. package/dist/prosemirror/commands/contentControls.js +24 -19
  225. package/dist/prosemirror/commands/image.d.ts +1 -1
  226. package/dist/prosemirror/commands/image.js +4 -1
  227. package/dist/prosemirror/commands/paragraph.d.ts +2 -1
  228. package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
  229. package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
  230. package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
  231. package/dist/prosemirror/commands/sectionBreak.js +187 -11
  232. package/dist/prosemirror/conversion/fromProseDoc.d.ts +18 -2
  233. package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
  234. package/dist/prosemirror/conversion/index.d.ts +2 -2
  235. package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
  236. package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
  237. package/dist/prosemirror/conversion/runShadingMark.js +14 -1
  238. package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
  239. package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
  240. package/dist/prosemirror/conversion/toProseDoc.js +371 -141
  241. package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
  242. package/dist/prosemirror/emptyRangeAnchor.js +158 -0
  243. package/dist/prosemirror/extensions/StarterKit.js +8 -2
  244. package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
  245. package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
  246. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
  247. package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
  248. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
  249. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
  250. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
  251. package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
  252. package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
  253. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
  254. package/dist/prosemirror/extensions/markRegistry.d.ts +26 -2
  255. package/dist/prosemirror/extensions/markRegistry.js +73 -10
  256. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
  257. package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
  258. package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
  259. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
  260. package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
  261. package/dist/prosemirror/extensions/marks/markUtils.js +2 -1
  262. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
  263. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
  264. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
  265. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
  266. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
  267. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +10 -0
  268. package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
  269. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
  270. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
  271. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
  272. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
  273. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
  274. package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
  275. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +4 -0
  276. package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
  277. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
  278. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
  279. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
  280. package/dist/prosemirror/extensions/types.d.ts +12 -3
  281. package/dist/prosemirror/index.d.ts +4 -2
  282. package/dist/prosemirror/index.js +2 -1
  283. package/dist/prosemirror/inlineWrapperStack.js +20 -3
  284. package/dist/prosemirror/listMarker.d.ts +2 -2
  285. package/dist/prosemirror/listMarker.js +7 -8
  286. package/dist/prosemirror/listRenderingAttrs.js +11 -1
  287. package/dist/prosemirror/listState.d.ts +62 -0
  288. package/dist/prosemirror/listState.js +49 -0
  289. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
  290. package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
  291. package/dist/prosemirror/numberedRefFields.js +4 -4
  292. package/dist/prosemirror/numberingAttr.d.ts +55 -0
  293. package/dist/prosemirror/numberingAttr.js +74 -0
  294. package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
  295. package/dist/prosemirror/outlineLevelAttr.js +42 -0
  296. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
  297. package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
  298. package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
  299. package/dist/prosemirror/plugins/selectionTracker.js +3 -10
  300. package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
  301. package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
  302. package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
  303. package/dist/prosemirror/replacedAnnotations.js +24 -6
  304. package/dist/prosemirror/revisionCarriers.d.ts +86 -2
  305. package/dist/prosemirror/revisionCarriers.js +86 -60
  306. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
  307. package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
  308. package/dist/prosemirror/runIdentity.d.ts +28 -0
  309. package/dist/prosemirror/runIdentity.js +36 -0
  310. package/dist/prosemirror/runStyleFormatting.js +1 -1
  311. package/dist/prosemirror/schema/index.d.ts +2 -2
  312. package/dist/prosemirror/schema/marks.d.ts +23 -4
  313. package/dist/prosemirror/schema/nodes.d.ts +220 -24
  314. package/dist/prosemirror/sectionCarrier.d.ts +37 -0
  315. package/dist/prosemirror/sectionCarrier.js +40 -0
  316. package/dist/prosemirror/selectionState.d.ts +3 -0
  317. package/dist/prosemirror/selectionState.js +4 -1
  318. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
  319. package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
  320. package/dist/prosemirror/tableResize.js +5 -6
  321. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
  322. package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
  323. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
  324. package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
  325. package/dist/prosemirror/validation.js +17 -6
  326. package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
  327. package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
  328. package/dist/prosemirror/zeroWidthAnchors.js +4 -0
  329. package/dist/style-sets/extract.js +4 -4
  330. package/dist/style-sets/stellaStyle.js +36 -23
  331. package/dist/types/colors.d.ts +2 -2
  332. package/dist/types/content.d.ts +2 -2
  333. package/dist/types/documentEnumValues.d.ts +53 -26
  334. package/dist/types/documentEnumValues.js +72 -174
  335. package/dist/types/formatting.d.ts +2 -2
  336. package/dist/types/index.d.ts +9 -2
  337. package/dist/utils/borderCss.d.ts +246 -0
  338. package/dist/utils/borderCss.js +325 -0
  339. package/dist/utils/colorResolver.d.ts +4 -3
  340. package/dist/utils/colorResolver.js +45 -76
  341. package/dist/utils/createDocument.js +24 -6
  342. package/dist/utils/findReplace.js +52 -10
  343. package/dist/utils/formatToStyle.d.ts +84 -2
  344. package/dist/utils/formatToStyle.js +133 -52
  345. package/dist/utils/headingCollector.js +3 -2
  346. package/dist/utils/mergeDocumentContent.js +5 -3
  347. package/dist/utils/paragraphFormattingMerge.js +27 -6
  348. package/dist/utils/replaceText.js +1 -1
  349. package/dist/utils/tableOperations.d.ts +5 -3
  350. package/dist/utils/tableOperations.js +14 -1
  351. package/dist/utils/tablePlacement.d.ts +7 -0
  352. package/dist/utils/tablePlacement.js +14 -0
  353. package/dist/utils/textDirectionFlow.d.ts +15 -0
  354. package/dist/utils/textDirectionFlow.js +38 -0
  355. package/dist/utils/textFormattingMerge.js +16 -4
  356. package/package.json +10 -10
  357. package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
  358. package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
  359. package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
  360. package/dist/compare/__fixtures__/body-sequence.js +0 -225
  361. package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
  362. package/dist/compare/__fixtures__/nested-table.js +0 -50
  363. package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
  364. package/dist/compare/__fixtures__/numbered-list.js +0 -85
  365. package/dist/docx/bookmarkPlacement.d.ts +0 -9
  366. package/dist/docx/bookmarkPlacement.js +0 -52
  367. package/dist/fonts/embeddedFontTable.d.ts +0 -45
  368. package/dist/fonts/embeddedFontTable.js +0 -80
  369. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
  370. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
@@ -1,18 +1,33 @@
1
+ import { serializePreservedAttributes } from "../attributeRemainder.js";
2
+ import { serializeWithPreservedChildren } from "../containerChildren.js";
1
3
  import { serializePartElement } from "./partNamespaces.js";
2
4
  import { escapeXmlAttribute } from "@stll/docx-core";
3
5
  //#region src/docx/serializer/fontTableSerializer.ts
4
6
  const serializeFontTableXml = (fontTable) => "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + serializePartElement({
5
7
  partPath: "word/fontTable.xml",
6
8
  rootName: "w:fonts",
9
+ rootAttributes: serializePreservedAttributes([], fontTable.preservedAttributes).join(" "),
7
10
  baselinePrefixes: ["w"],
8
11
  sourceBindings: void 0,
9
- body: fontTable.fonts.map(serializeFont).join("")
12
+ body: serializeWithPreservedChildren(fontTable.fonts.map(serializeFont), fontTable.preserved)
10
13
  });
14
+ /**
15
+ * One `w:font`, with its children in the order `CT_Font` declares them.
16
+ *
17
+ * The order is what makes the sink's index mean something: a capture recorded
18
+ * after the third field the reader kept goes back after the third field this
19
+ * writes, so unmodelled markup keeps the neighbours it was authored between.
20
+ */
11
21
  const serializeFont = (font) => {
12
22
  const parts = [];
13
23
  if (font.altName) parts.push(`<w:altName w:val="${escapeXmlAttribute(font.altName)}"/>`);
14
24
  if (font.panose1) parts.push(`<w:panose1 w:val="${escapeXmlAttribute(font.panose1)}"/>`);
15
- if (font.charset) parts.push(`<w:charset w:val="${escapeXmlAttribute(font.charset)}"/>`);
25
+ if (font.charset) {
26
+ const attributes = [];
27
+ if (font.charset.val !== void 0) attributes.push(`w:val="${escapeXmlAttribute(font.charset.val)}"`);
28
+ if (font.charset.characterSet !== void 0) attributes.push(`w:characterSet="${escapeXmlAttribute(font.charset.characterSet)}"`);
29
+ parts.push(attributes.length === 0 ? "<w:charset/>" : `<w:charset ${attributes.join(" ")}/>`);
30
+ }
16
31
  if (font.family) parts.push(`<w:family w:val="${font.family}"/>`);
17
32
  if (font.pitch) parts.push(`<w:pitch w:val="${font.pitch}"/>`);
18
33
  if (font.sig) {
@@ -23,7 +38,20 @@ const serializeFont = (font) => {
23
38
  }
24
39
  if (attrs.length > 0) parts.push(`<w:sig ${attrs.join(" ")}/>`);
25
40
  }
26
- return `<w:font w:name="${escapeXmlAttribute(font.name)}">${parts.join("")}</w:font>`;
41
+ pushEmbed(parts, "embedRegular", font.embedRegular);
42
+ pushEmbed(parts, "embedBold", font.embedBold);
43
+ pushEmbed(parts, "embedItalic", font.embedItalic);
44
+ pushEmbed(parts, "embedBoldItalic", font.embedBoldItalic);
45
+ const attributes = serializePreservedAttributes([`w:name="${escapeXmlAttribute(font.name)}"`], font.preservedAttributes);
46
+ const body = serializeWithPreservedChildren(parts, font.preserved);
47
+ return `<w:font ${attributes.join(" ")}>${body}</w:font>`;
48
+ };
49
+ const pushEmbed = (parts, element, embed) => {
50
+ if (embed === void 0) return;
51
+ const attributes = [`r:id="${escapeXmlAttribute(embed.id)}"`];
52
+ if (embed.fontKey !== void 0) attributes.push(`w:fontKey="${escapeXmlAttribute(embed.fontKey)}"`);
53
+ if (embed.subsetted !== void 0) attributes.push(`w:subsetted="${embed.subsetted ? "1" : "0"}"`);
54
+ parts.push(`<w:${element} ${attributes.join(" ")}/>`);
27
55
  };
28
56
  //#endregion
29
57
  export { serializeFontTableXml };
@@ -3,6 +3,7 @@ import { isEmptyParagraph } from "../paragraphParser.js";
3
3
  import { captureVerbatimXml } from "../verbatimCapture.js";
4
4
  import { getLocalName, parseXmlDocument } from "../xmlParser.js";
5
5
  import { serializeBlockSdt } from "./blockSdtSerializer.js";
6
+ import { serializeBookmarkMarker } from "./markupRangeAttributes.js";
6
7
  import { serializeParagraph } from "./paragraphSerializer.js";
7
8
  import { serializePartElement } from "./partNamespaces.js";
8
9
  import { serializeTable } from "./tableSerializer.js";
@@ -41,6 +42,8 @@ function serializeBlock(block) {
41
42
  case "table": return serializeTable(block, serializeParagraph);
42
43
  case "blockSdt": return serializeBlockSdt(block, serializeBlock);
43
44
  case "preservedBlock": return block.xml;
45
+ case "bookmarkStart":
46
+ case "bookmarkEnd": return serializeBookmarkMarker(block);
44
47
  default: return block;
45
48
  }
46
49
  }
@@ -2,7 +2,15 @@ import { document_d_exports } from "../../types/document.js";
2
2
  //#region src/docx/serializer/markupRangeAttributes.d.ts
3
3
  declare const markupRangeAttributes: (marker: document_d_exports.MarkupRangeMarker) => string[];
4
4
  declare const bookmarkRangeAttributes: (marker: document_d_exports.BookmarkRangeMarker) => string[];
5
+ /**
6
+ * One bookmark marker, wherever it stands.
7
+ *
8
+ * The same element is a paragraph child, a block, a child of `w:tr` and a
9
+ * child of `w:tbl`, so the four serializers share one writer: an attribute
10
+ * added to `CT_Bookmark` reaches every level at once.
11
+ */
12
+ declare const serializeBookmarkMarker: (marker: document_d_exports.BookmarkStart | document_d_exports.BookmarkEnd) => string;
5
13
  /** `w:author` is required, so it is always written; `w:date` only when known. */
6
14
  declare const moveBookmarkAttributes: (marker: document_d_exports.MoveBookmarkMarker) => string[];
7
15
  //#endregion
8
- export { bookmarkRangeAttributes, markupRangeAttributes, moveBookmarkAttributes };
16
+ export { bookmarkRangeAttributes, markupRangeAttributes, moveBookmarkAttributes, serializeBookmarkMarker };
@@ -13,6 +13,14 @@ const bookmarkRangeAttributes = (marker) => {
13
13
  attributes.push(attribute("w:name", marker.name));
14
14
  return attributes;
15
15
  };
16
+ /**
17
+ * One bookmark marker, wherever it stands.
18
+ *
19
+ * The same element is a paragraph child, a block, a child of `w:tr` and a
20
+ * child of `w:tbl`, so the four serializers share one writer: an attribute
21
+ * added to `CT_Bookmark` reaches every level at once.
22
+ */
23
+ const serializeBookmarkMarker = (marker) => marker.type === "bookmarkStart" ? `<w:bookmarkStart ${bookmarkRangeAttributes(marker).join(" ")}/>` : `<w:bookmarkEnd ${markupRangeAttributes(marker).join(" ")}/>`;
16
24
  /** `w:author` is required, so it is always written; `w:date` only when known. */
17
25
  const moveBookmarkAttributes = (marker) => {
18
26
  const attributes = bookmarkRangeAttributes(marker);
@@ -21,4 +29,4 @@ const moveBookmarkAttributes = (marker) => {
21
29
  return attributes;
22
30
  };
23
31
  //#endregion
24
- export { bookmarkRangeAttributes, markupRangeAttributes, moveBookmarkAttributes };
32
+ export { bookmarkRangeAttributes, markupRangeAttributes, moveBookmarkAttributes, serializeBookmarkMarker };
@@ -1,4 +1,5 @@
1
1
  import { serializeBlockSdt } from "./blockSdtSerializer.js";
2
+ import { serializeBookmarkMarker } from "./markupRangeAttributes.js";
2
3
  import { serializeParagraph } from "./paragraphSerializer.js";
3
4
  import { serializePartElement } from "./partNamespaces.js";
4
5
  import { serializeTable } from "./tableSerializer.js";
@@ -43,6 +44,8 @@ function serializeBlock(block) {
43
44
  case "table": return serializeTable(block, serializeParagraph);
44
45
  case "blockSdt": return serializeBlockSdt(block, serializeBlock);
45
46
  case "preservedBlock": return block.xml;
47
+ case "bookmarkStart":
48
+ case "bookmarkEnd": return serializeBookmarkMarker(block);
46
49
  default: return block;
47
50
  }
48
51
  }
@@ -1,11 +1,6 @@
1
1
  import { document_d_exports } from "../../types/document.js";
2
2
  //#region src/docx/serializer/numberingSerializer.d.ts
3
- /**
4
- * Serialize {@link NumberingDefinitions} to a complete `word/numbering.xml`
5
- * string. `w:abstractNum` elements precede `w:num` elements as ECMA-376 §17.9
6
- * requires. See the module note: this whole-part output is used only for
7
- * change detection and per-definition splicing, never to overwrite the part.
8
- */
3
+ /** Serialize a complete `word/numbering.xml` part. */
9
4
  declare function serializeNumberingXml(numbering: document_d_exports.NumberingDefinitions): string;
10
5
  //#endregion
11
6
  export { serializeNumberingXml };
@@ -1,99 +1,101 @@
1
+ import { serializeParagraphPropertySet } from "../../internal/paragraphFormattingSerialization.js";
2
+ import { serializePreservedAttributes } from "../attributeRemainder.js";
3
+ import { customNumberFormatOf } from "../numberingParser.js";
1
4
  import { serializePartElement } from "./partNamespaces.js";
2
5
  import { serializeTextFormatting } from "./textFormattingSerializer.js";
3
6
  import { intAttr } from "./xmlUtils.js";
4
- import { escapeXmlAttribute } from "@stll/docx-core";
7
+ import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
8
+ import { serializeSequenceChildren } from "@stll/docx-core/schema";
5
9
  //#region src/docx/serializer/numberingSerializer.ts
6
- /**
7
- * Serialize a level's paragraph properties — the modeled subset is indentation
8
- * plus tab stops (see `parseLevelParagraphProps`). Returns "" when neither is
9
- * present so an empty `<w:pPr/>` is not emitted.
10
- */
11
- function serializeLevelParagraphProps(pPr) {
12
- const indAttrs = [];
13
- if (pPr.indentLeft !== void 0) indAttrs.push(`w:left="${intAttr(pPr.indentLeft)}"`);
14
- if (pPr.indentRight !== void 0) indAttrs.push(`w:right="${intAttr(pPr.indentRight)}"`);
15
- if (pPr.indentFirstLine !== void 0) {
16
- if (pPr.hangingIndent) indAttrs.push(`w:hanging="${intAttr(Math.abs(pPr.indentFirstLine))}"`);
17
- else if (pPr.indentFirstLine !== 0) indAttrs.push(`w:firstLine="${intAttr(pPr.indentFirstLine)}"`);
18
- }
19
- const parts = [];
20
- if (pPr.tabs && pPr.tabs.length > 0) {
21
- const tabs = pPr.tabs.map((tab) => {
22
- const attrs = [`w:val="${tab.alignment}"`, `w:pos="${intAttr(tab.position)}"`];
23
- if (tab.leader) attrs.push(`w:leader="${tab.leader}"`);
24
- return `<w:tab ${attrs.join(" ")}/>`;
25
- }).join("");
26
- parts.push(`<w:tabs>${tabs}</w:tabs>`);
27
- }
28
- if (indAttrs.length > 0) parts.push(`<w:ind ${indAttrs.join(" ")}/>`);
29
- if (parts.length === 0) return "";
30
- return `<w:pPr>${parts.join("")}</w:pPr>`;
31
- }
32
- /**
33
- * Serialize one `w:lvl`. Children follow the ECMA-376 §17.9.6 CT_Lvl order
34
- * (start, numFmt, lvlRestart, isLgl, suff, lvlText, legacy, lvlJc, pPr, rPr) so
35
- * a re-emitted level parses back into an equivalent model.
36
- */
10
+ /** Serialize one `w:lvl`. */
37
11
  function serializeLevel(level) {
38
- const parts = [];
39
- if (level.start !== void 0) parts.push(`<w:start w:val="${intAttr(level.start)}"/>`);
40
- parts.push(`<w:numFmt w:val="${escapeXmlAttribute(level.numFmt)}"/>`);
41
- if (level.lvlRestart !== void 0) parts.push(`<w:lvlRestart w:val="${intAttr(level.lvlRestart)}"/>`);
42
- if (level.isLgl) parts.push("<w:isLgl/>");
43
- if (level.suffix) parts.push(`<w:suff w:val="${level.suffix}"/>`);
44
- parts.push(`<w:lvlText w:val="${escapeXmlAttribute(level.lvlText)}"/>`);
45
- if (level.legacy) {
46
- const legacyAttrs = [`w:legacy="${level.legacy.legacy ? 1 : 0}"`];
47
- if (level.legacy.legacySpace !== void 0) legacyAttrs.push(`w:legacySpace="${intAttr(level.legacy.legacySpace)}"`);
48
- if (level.legacy.legacyIndent !== void 0) legacyAttrs.push(`w:legacyIndent="${intAttr(level.legacy.legacyIndent)}"`);
49
- parts.push(`<w:legacy ${legacyAttrs.join(" ")}/>`);
12
+ const customFormat = customNumberFormatOf(level);
13
+ const numFmtFormat = customFormat === void 0 ? "" : ` w:format="${escapeXmlAttribute(customFormat)}"`;
14
+ const pPr = level.pPr === void 0 ? "" : serializeParagraphPropertySet({ formatting: level.pPr }) || "<w:pPr/>";
15
+ const rPr = level.rPr === void 0 ? "" : serializeTextFormatting(level.rPr) || "<w:rPr/>";
16
+ const lvlTextAttrs = [`w:val="${escapeXmlAttribute(level.lvlText)}"`];
17
+ if (level.lvlTextNull !== void 0) lvlTextAttrs.push(`w:null="${level.lvlTextNull ? 1 : 0}"`);
18
+ let legacy = "";
19
+ if (level.legacy !== void 0) {
20
+ const attributes = [];
21
+ if (level.legacy.legacy !== void 0) attributes.push(`w:legacy="${level.legacy.legacy ? 1 : 0}"`);
22
+ if (level.legacy.legacySpace !== void 0) attributes.push(`w:legacySpace="${intAttr(level.legacy.legacySpace)}"`);
23
+ if (level.legacy.legacyIndent !== void 0) attributes.push(`w:legacyIndent="${intAttr(level.legacy.legacyIndent)}"`);
24
+ legacy = attributes.length === 0 ? "<w:legacy/>" : `<w:legacy ${attributes.join(" ")}/>`;
50
25
  }
51
- if (level.lvlJc) parts.push(`<w:lvlJc w:val="${level.lvlJc}"/>`);
52
- if (level.pPr) parts.push(serializeLevelParagraphProps(level.pPr));
53
- parts.push(serializeTextFormatting(level.rPr));
54
- return `<w:lvl w:ilvl="${intAttr(level.ilvl)}">${parts.join("")}</w:lvl>`;
26
+ const children = serializeSequenceChildren({
27
+ container: "w:lvl",
28
+ modelled: [
29
+ ["start", level.start === void 0 ? "" : `<w:start w:val="${intAttr(level.start)}"/>`],
30
+ ["numFmt", `<w:numFmt w:val="${escapeXmlAttribute(level.numFmt)}"${numFmtFormat}/>`],
31
+ ["lvlRestart", level.lvlRestart === void 0 ? "" : `<w:lvlRestart w:val="${intAttr(level.lvlRestart)}"/>`],
32
+ ["pStyle", level.pStyle === void 0 ? "" : `<w:pStyle w:val="${escapeXmlAttribute(level.pStyle)}"/>`],
33
+ ["isLgl", serializeOnOffElement(level.isLgl, "isLgl")],
34
+ ["suff", level.suffix === void 0 ? "" : `<w:suff w:val="${escapeXmlAttribute(level.suffix)}"/>`],
35
+ ["lvlText", `<w:lvlText ${lvlTextAttrs.join(" ")}/>`],
36
+ ["lvlPicBulletId", level.lvlPicBulletId === void 0 ? "" : `<w:lvlPicBulletId w:val="${intAttr(level.lvlPicBulletId)}"/>`],
37
+ ["legacy", legacy],
38
+ ["lvlJc", level.lvlJc === void 0 ? "" : `<w:lvlJc w:val="${escapeXmlAttribute(level.lvlJc)}"/>`],
39
+ ["pPr", pPr],
40
+ ["rPr", rPr]
41
+ ],
42
+ preserved: level.preserved
43
+ });
44
+ const attributes = [`w:ilvl="${intAttr(level.ilvl)}"`];
45
+ if (level.tplc !== void 0) attributes.push(`w:tplc="${escapeXmlAttribute(level.tplc)}"`);
46
+ if (level.tentative !== void 0) attributes.push(`w:tentative="${level.tentative ? 1 : 0}"`);
47
+ return `<w:lvl ${serializePreservedAttributes(attributes, level.preservedAttributes).join(" ")}>${children.join("")}</w:lvl>`;
55
48
  }
56
- /**
57
- * Serialize one `w:abstractNum` (the reusable list template). Children follow
58
- * ECMA-376 §17.9.1 CT_AbstractNum order for the modeled subset (multiLevelType,
59
- * name, styleLink, numStyleLink, lvl+); `w:nsid` / `w:tmpl` are not modeled.
60
- */
49
+ /** Serialize one reusable `w:abstractNum` list template. */
61
50
  function serializeAbstractNum(abstractNum) {
62
- const parts = [];
63
- if (abstractNum.multiLevelType) parts.push(`<w:multiLevelType w:val="${abstractNum.multiLevelType}"/>`);
64
- if (abstractNum.name !== void 0) parts.push(`<w:name w:val="${escapeXmlAttribute(abstractNum.name)}"/>`);
65
- if (abstractNum.styleLink !== void 0) parts.push(`<w:styleLink w:val="${escapeXmlAttribute(abstractNum.styleLink)}"/>`);
66
- if (abstractNum.numStyleLink !== void 0) parts.push(`<w:numStyleLink w:val="${escapeXmlAttribute(abstractNum.numStyleLink)}"/>`);
67
- const levels = [...abstractNum.levels].sort((a, b) => a.ilvl - b.ilvl);
68
- for (const level of levels) parts.push(serializeLevel(level));
69
- return `<w:abstractNum w:abstractNumId="${intAttr(abstractNum.abstractNumId)}">${parts.join("")}</w:abstractNum>`;
51
+ const levels = [...abstractNum.levels].sort((left, right) => left.ilvl - right.ilvl);
52
+ const children = serializeSequenceChildren({
53
+ container: "w:abstractNum",
54
+ modelled: [
55
+ ["nsid", abstractNum.nsid === void 0 ? "" : `<w:nsid w:val="${escapeXmlAttribute(abstractNum.nsid)}"/>`],
56
+ ["multiLevelType", abstractNum.multiLevelType === void 0 ? "" : `<w:multiLevelType w:val="${escapeXmlAttribute(abstractNum.multiLevelType)}"/>`],
57
+ ["tmpl", abstractNum.tmpl === void 0 ? "" : `<w:tmpl w:val="${escapeXmlAttribute(abstractNum.tmpl)}"/>`],
58
+ ["name", abstractNum.name === void 0 ? "" : `<w:name w:val="${escapeXmlAttribute(abstractNum.name)}"/>`],
59
+ ["styleLink", abstractNum.styleLink === void 0 ? "" : `<w:styleLink w:val="${escapeXmlAttribute(abstractNum.styleLink)}"/>`],
60
+ ["numStyleLink", abstractNum.numStyleLink === void 0 ? "" : `<w:numStyleLink w:val="${escapeXmlAttribute(abstractNum.numStyleLink)}"/>`],
61
+ ["lvl", levels.map(serializeLevel).join("")]
62
+ ],
63
+ preserved: abstractNum.preserved
64
+ });
65
+ return `<w:abstractNum ${serializePreservedAttributes([`w:abstractNumId="${intAttr(abstractNum.abstractNumId)}"`], abstractNum.preservedAttributes).join(" ")}>${children.join("")}</w:abstractNum>`;
70
66
  }
71
- /**
72
- * Serialize one `w:num` (a concrete numbering instance referenced by `numId`).
73
- */
67
+ /** Serialize one concrete instance's per-level override. */
68
+ function serializeLevelOverride(override) {
69
+ const children = serializeSequenceChildren({
70
+ container: "w:lvlOverride",
71
+ modelled: [["startOverride", override.startOverride === void 0 ? "" : `<w:startOverride w:val="${intAttr(override.startOverride)}"/>`], ["lvl", override.lvl === void 0 ? "" : serializeLevel(override.lvl)]],
72
+ preserved: override.preserved
73
+ });
74
+ return `<w:lvlOverride ${serializePreservedAttributes([`w:ilvl="${intAttr(override.ilvl)}"`], override.preservedAttributes).join(" ")}>${children.join("")}</w:lvlOverride>`;
75
+ }
76
+ /** Serialize one concrete `w:num` numbering instance. */
74
77
  function serializeNum(instance) {
75
- const parts = [`<w:abstractNumId w:val="${intAttr(instance.abstractNumId)}"/>`];
76
- for (const override of instance.levelOverrides ?? []) {
77
- const overrideParts = [];
78
- if (override.startOverride !== void 0) overrideParts.push(`<w:startOverride w:val="${intAttr(override.startOverride)}"/>`);
79
- if (override.lvl) overrideParts.push(serializeLevel(override.lvl));
80
- parts.push(`<w:lvlOverride w:ilvl="${intAttr(override.ilvl)}">${overrideParts.join("")}</w:lvlOverride>`);
81
- }
82
- return `<w:num w:numId="${intAttr(instance.numId)}">${parts.join("")}</w:num>`;
78
+ const children = serializeSequenceChildren({
79
+ container: "w:num",
80
+ modelled: [["abstractNumId", `<w:abstractNumId w:val="${intAttr(instance.abstractNumId)}"/>`], ["lvlOverride", (instance.levelOverrides ?? []).map(serializeLevelOverride).join("")]],
81
+ preserved: instance.preserved
82
+ });
83
+ return `<w:num ${serializePreservedAttributes([`w:numId="${intAttr(instance.numId)}"`], instance.preservedAttributes).join(" ")}>${children.join("")}</w:num>`;
83
84
  }
84
- /**
85
- * Serialize {@link NumberingDefinitions} to a complete `word/numbering.xml`
86
- * string. `w:abstractNum` elements precede `w:num` elements as ECMA-376 §17.9
87
- * requires. See the module note: this whole-part output is used only for
88
- * change detection and per-definition splicing, never to overwrite the part.
89
- */
85
+ /** Serialize a complete `word/numbering.xml` part. */
90
86
  function serializeNumberingXml(numbering) {
87
+ const children = serializeSequenceChildren({
88
+ container: "w:numbering",
89
+ modelled: [["abstractNum", numbering.abstractNums.map(serializeAbstractNum).join("")], ["num", numbering.nums.map(serializeNum).join("")]],
90
+ preserved: numbering.preserved
91
+ });
91
92
  return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + serializePartElement({
92
93
  partPath: "word/numbering.xml",
93
94
  rootName: "w:numbering",
95
+ rootAttributes: serializePreservedAttributes([], numbering.preservedAttributes).join(" "),
94
96
  baselinePrefixes: ["w"],
95
97
  sourceBindings: void 0,
96
- body: `${numbering.abstractNums.map(serializeAbstractNum).join("")}${numbering.nums.map(serializeNum).join("")}`
98
+ body: children.join("")
97
99
  });
98
100
  }
99
101
  //#endregion
@@ -31,13 +31,5 @@ declare function createEmptyParagraph(formatting?: document_d_exports.ParagraphF
31
31
  * Create a paragraph with a single text run
32
32
  */
33
33
  declare function createTextParagraph(text: string, paragraphFormatting?: document_d_exports.ParagraphFormatting, textFormatting?: document_d_exports.TextFormatting): document_d_exports.Paragraph;
34
- /**
35
- * Check if paragraph is a list item
36
- */
37
- declare function isListParagraph(paragraph: document_d_exports.Paragraph): boolean;
38
- /**
39
- * Get list level of a paragraph (0-8, or -1 if not a list)
40
- */
41
- declare function getListLevel(paragraph: document_d_exports.Paragraph): number;
42
34
  //#endregion
43
- export { createEmptyParagraph, createTextParagraph, getListLevel, hasParagraphContent, hasParagraphFormatting, isListParagraph, serializeParagraph, serializeParagraphFormatting, serializeParagraphs };
35
+ export { createEmptyParagraph, createTextParagraph, hasParagraphContent, hasParagraphFormatting, serializeParagraph, serializeParagraphFormatting, serializeParagraphs };