@stll/folio-core 0.45.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/dist/ai-edits/apply.js +85 -43
  2. package/dist/ai-edits/headless.js +2 -2
  3. package/dist/ai-edits/read.d.ts +1 -0
  4. package/dist/ai-edits/read.js +1 -0
  5. package/dist/ai-edits/snapshot.js +32 -27
  6. package/dist/ai-edits/table-cell-mutations.js +15 -7
  7. package/dist/ai-edits/table-geometry.js +21 -18
  8. package/dist/ai-edits/table-template.js +2 -2
  9. package/dist/compare/compare.js +2 -5
  10. package/dist/compare/content-alignment.js +108 -12
  11. package/dist/compare/content-types.d.ts +8 -2
  12. package/dist/compare/content.js +2 -11
  13. package/dist/compare/plan.js +7 -4
  14. package/dist/compare/scenario.js +2 -5
  15. package/dist/compare/section-boundary-properties.js +1 -2
  16. package/dist/compare/types.d.ts +9 -1
  17. package/dist/compare/types.js +12 -1
  18. package/dist/compat/eigenpal.d.ts +2 -1
  19. package/dist/compat/eigenpal.js +2 -1
  20. package/dist/content-controls/checkboxDisplay.d.ts +17 -0
  21. package/dist/content-controls/checkboxDisplay.js +46 -0
  22. package/dist/content-controls/findContentControls.js +3 -1
  23. package/dist/content-controls/mutateContentControls.js +57 -43
  24. package/dist/controller/contentControlWidgetController.d.ts +1 -0
  25. package/dist/controller/contentControlWidgetController.js +3 -0
  26. package/dist/controller/hiddenEditorApi.js +3 -1
  27. package/dist/controller/hiddenEditorManager.d.ts +1 -1
  28. package/dist/controller/hiddenEditorManager.js +6 -3
  29. package/dist/controller/layoutPipeline.js +8 -3
  30. package/dist/display-list/build/buildDisplayList.js +20 -1
  31. package/dist/display-list/build/imagePrimitives.d.ts +4 -4
  32. package/dist/display-list/build/imagePrimitives.js +38 -18
  33. package/dist/display-list/build/pageBorderPrimitives.js +2 -1
  34. package/dist/display-list/build/paragraphPrimitives.js +113 -14
  35. package/dist/display-list/build/previewPrimitives.d.ts +10 -0
  36. package/dist/display-list/build/previewPrimitives.js +89 -0
  37. package/dist/display-list/build/strokes.d.ts +177 -8
  38. package/dist/display-list/build/strokes.js +167 -47
  39. package/dist/display-list/build/tablePrimitives.js +4 -2
  40. package/dist/display-list/build/textBoxPrimitives.js +6 -4
  41. package/dist/display-list/build/textDecorations.d.ts +15 -1
  42. package/dist/display-list/build/textDecorations.js +15 -1
  43. package/dist/display-list/dom/renderDisplayListToDom.js +11 -21
  44. package/dist/display-list/primitives.d.ts +13 -2
  45. package/dist/display-list/primitives.js +36 -1
  46. package/dist/display-list/types.d.ts +17 -0
  47. package/dist/document-operations.js +2 -1
  48. package/dist/docx/attributeRemainder.d.ts +76 -0
  49. package/dist/docx/attributeRemainder.js +111 -0
  50. package/dist/docx/blockContentParser.d.ts +3 -1
  51. package/dist/docx/blockContentParser.js +102 -106
  52. package/dist/docx/blockPlainText.d.ts +3 -4
  53. package/dist/docx/blockPlainText.js +3 -0
  54. package/dist/docx/borderParser.js +26 -11
  55. package/dist/docx/builtInStyles.d.ts +8 -16
  56. package/dist/docx/builtInStyles.js +54 -17
  57. package/dist/docx/commentAnchorIndex.d.ts +30 -0
  58. package/dist/docx/commentAnchorIndex.js +50 -0
  59. package/dist/docx/commentParser.d.ts +1 -1
  60. package/dist/docx/commentParser.js +56 -39
  61. package/dist/docx/commentRangeIntegrity.d.ts +16 -1
  62. package/dist/docx/commentRangeIntegrity.js +42 -1
  63. package/dist/docx/commentRangeJoin.d.ts +9 -0
  64. package/dist/docx/commentRangeJoin.js +33 -0
  65. package/dist/docx/commentReferenceCompletion.d.ts +9 -0
  66. package/dist/docx/commentReferenceCompletion.js +47 -0
  67. package/dist/docx/commentReferenceNormalization.js +3 -1
  68. package/dist/docx/commentReplyMarkers.js +11 -19
  69. package/dist/docx/compatibility.js +56 -41
  70. package/dist/docx/containerChildren.d.ts +208 -0
  71. package/dist/docx/containerChildren.gen.d.ts +43 -0
  72. package/dist/docx/containerChildren.gen.js +263 -0
  73. package/dist/docx/containerChildren.js +153 -0
  74. package/dist/docx/diagramPreview.d.ts +14 -2
  75. package/dist/docx/diagramPreview.js +81 -169
  76. package/dist/docx/documentParser.d.ts +1 -1
  77. package/dist/docx/documentParser.js +7 -4
  78. package/dist/docx/drawingAnchor.d.ts +87 -0
  79. package/dist/docx/drawingAnchor.js +201 -0
  80. package/dist/docx/drawingUtils.d.ts +43 -38
  81. package/dist/docx/drawingUtils.js +205 -118
  82. package/dist/docx/ensureParaIds.js +17 -7
  83. package/dist/docx/fieldParser.d.ts +1 -1
  84. package/dist/docx/fieldParser.js +4 -4
  85. package/dist/docx/fieldState.d.ts +26 -0
  86. package/dist/docx/fieldState.js +53 -0
  87. package/dist/docx/fontTableParser.js +102 -41
  88. package/dist/docx/footnoteParser.d.ts +1 -1
  89. package/dist/docx/footnoteParser.js +10 -6
  90. package/dist/docx/graphicFrameLocks.d.ts +16 -4
  91. package/dist/docx/graphicFrameLocks.js +19 -6
  92. package/dist/docx/groupDrawingParser.js +4 -3
  93. package/dist/docx/headerFooterParser.js +1 -1
  94. package/dist/docx/headerFooterReferenceNormalization.js +1 -0
  95. package/dist/docx/hyperlinkParser.d.ts +66 -9
  96. package/dist/docx/hyperlinkParser.js +153 -26
  97. package/dist/docx/imageParser.js +160 -115
  98. package/dist/docx/index.d.ts +2 -1
  99. package/dist/docx/index.js +2 -1
  100. package/dist/docx/inlineContentRemovals.d.ts +28 -0
  101. package/dist/docx/inlineContentRemovals.js +46 -0
  102. package/dist/docx/inlineWrapperContent.d.ts +166 -0
  103. package/dist/docx/inlineWrapperContent.js +165 -0
  104. package/dist/docx/inlineWrapperParser.d.ts +11 -0
  105. package/dist/docx/inlineWrapperParser.js +60 -0
  106. package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
  107. package/dist/docx/normalizeBaseDirection.js +12 -1
  108. package/dist/docx/numberingParser.d.ts +25 -2
  109. package/dist/docx/numberingParser.js +264 -361
  110. package/dist/docx/numberingReference.d.ts +9 -16
  111. package/dist/docx/numberingReference.js +17 -16
  112. package/dist/docx/numberingReferenceNormalization.js +7 -7
  113. package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
  114. package/dist/docx/ooxmlCounterFormatter.js +4 -1
  115. package/dist/docx/paraIdAttribute.d.ts +111 -0
  116. package/dist/docx/paraIdAttribute.js +142 -0
  117. package/dist/docx/paragraphParser.d.ts +10 -25
  118. package/dist/docx/paragraphParser.js +421 -496
  119. package/dist/docx/paragraphProperties.d.ts +23 -0
  120. package/dist/docx/paragraphProperties.js +279 -0
  121. package/dist/docx/paragraphPropertySource.js +7 -1
  122. package/dist/docx/paragraphTextBoxEnrichment.d.ts +3 -2
  123. package/dist/docx/paragraphTextBoxEnrichment.js +20 -59
  124. package/dist/docx/paragraphTraversal.d.ts +14 -10
  125. package/dist/docx/paragraphTraversal.js +53 -52
  126. package/dist/docx/parseWarningMessage.js +5 -1
  127. package/dist/docx/parserEnums.d.ts +6 -8
  128. package/dist/docx/parserEnums.js +4 -6
  129. package/dist/docx/preservedRunContent.d.ts +32 -0
  130. package/dist/docx/preservedRunContent.js +96 -0
  131. package/dist/docx/previewBudget.d.ts +44 -23
  132. package/dist/docx/previewBudget.js +61 -30
  133. package/dist/docx/propertyElementAttributes.d.ts +178 -0
  134. package/dist/docx/propertyElementAttributes.js +114 -0
  135. package/dist/docx/renderedPageBreakNormalization.js +4 -6
  136. package/dist/docx/rezip.d.ts +28 -2
  137. package/dist/docx/rezip.js +152 -27
  138. package/dist/docx/runConsolidator.d.ts +42 -2
  139. package/dist/docx/runConsolidator.js +60 -6
  140. package/dist/docx/runParser.d.ts +55 -19
  141. package/dist/docx/runParser.js +394 -306
  142. package/dist/docx/runPayload.d.ts +5 -0
  143. package/dist/docx/runPayload.js +4 -0
  144. package/dist/docx/sdtProperties.d.ts +39 -5
  145. package/dist/docx/sdtProperties.js +205 -84
  146. package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
  147. package/dist/docx/sdtPropertiesPatch.js +68 -112
  148. package/dist/docx/sectionParser.d.ts +1 -2
  149. package/dist/docx/sectionParser.js +241 -238
  150. package/dist/docx/selectiveSave.js +3 -2
  151. package/dist/docx/selectiveXmlPatch.d.ts +66 -3
  152. package/dist/docx/selectiveXmlPatch.js +276 -133
  153. package/dist/docx/serializer/blockSdtSerializer.js +2 -96
  154. package/dist/docx/serializer/borderSerializer.d.ts +5 -5
  155. package/dist/docx/serializer/borderSerializer.js +12 -10
  156. package/dist/docx/serializer/commentSerializer.js +5 -7
  157. package/dist/docx/serializer/documentSerializer.js +11 -11
  158. package/dist/docx/serializer/fontTableSerializer.js +31 -3
  159. package/dist/docx/serializer/headerFooterSerializer.js +10 -9
  160. package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
  161. package/dist/docx/serializer/markupRangeAttributes.js +9 -1
  162. package/dist/docx/serializer/noteSerializer.js +11 -8
  163. package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
  164. package/dist/docx/serializer/numberingSerializer.js +81 -79
  165. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
  166. package/dist/docx/serializer/paragraphSerializer.js +156 -236
  167. package/dist/docx/serializer/runSerializer.d.ts +1 -5
  168. package/dist/docx/serializer/runSerializer.js +134 -75
  169. package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
  170. package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
  171. package/dist/docx/serializer/sectionPropertiesSerializer.js +42 -49
  172. package/dist/docx/serializer/settingsSerializer.js +6 -4
  173. package/dist/docx/serializer/stylesSerializer.js +8 -11
  174. package/dist/docx/serializer/tableSerializer.js +283 -105
  175. package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
  176. package/dist/docx/serializer/textFormattingSerializer.js +111 -101
  177. package/dist/docx/serializer/xmlUtils.d.ts +1 -1
  178. package/dist/docx/serializer/xmlUtils.js +1 -1
  179. package/dist/docx/server/createBilingualDocument.js +20 -16
  180. package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
  181. package/dist/docx/server/materializeYjsDocx.js +9 -1
  182. package/dist/docx/server/migrateYjsAttrSchema.d.ts +55 -0
  183. package/dist/docx/server/migrateYjsAttrSchema.js +95 -0
  184. package/dist/docx/settingsParser.js +7 -4
  185. package/dist/docx/shadingParser.d.ts +2 -1
  186. package/dist/docx/shadingParser.js +43 -7
  187. package/dist/docx/shapeParser.js +13 -8
  188. package/dist/docx/strictNames.d.ts +11 -0
  189. package/dist/docx/strictNames.gen.d.ts +45 -0
  190. package/dist/docx/strictNames.gen.js +50 -0
  191. package/dist/docx/strictNames.js +43 -0
  192. package/dist/docx/strictValueEncodings.gen.js +133 -131
  193. package/dist/docx/styleParser.js +17 -349
  194. package/dist/docx/tableParser.d.ts +11 -2
  195. package/dist/docx/tableParser.js +665 -220
  196. package/dist/docx/textBoxParser.d.ts +28 -3
  197. package/dist/docx/textBoxParser.js +69 -9
  198. package/dist/docx/themeColorAttribute.d.ts +13 -0
  199. package/dist/docx/themeColorAttribute.js +24 -0
  200. package/dist/docx/trackedMoveRangeNormalization.js +2 -1
  201. package/dist/docx/unzip.js +5 -4
  202. package/dist/docx/vmlImageParser.d.ts +30 -5
  203. package/dist/docx/vmlImageParser.js +91 -32
  204. package/dist/docx/vmlPreview.js +2 -2
  205. package/dist/docx/wrapPolygon.d.ts +30 -0
  206. package/dist/docx/wrapPolygon.js +70 -0
  207. package/dist/docx/xmlEncoding.d.ts +5 -0
  208. package/dist/docx/xmlEncoding.js +12 -0
  209. package/dist/docx/xmlParser.d.ts +23 -1
  210. package/dist/docx/xmlParser.js +31 -2
  211. package/dist/fonts/embeddedFonts.js +3 -3
  212. package/dist/headless-layout.js +12 -1
  213. package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
  214. package/dist/i18n/messages/catalogs.gen.js +102 -34
  215. package/dist/i18n/messages/messages.gen.d.ts +4 -0
  216. package/dist/index.d.ts +2 -1
  217. package/dist/index.js +2 -1
  218. package/dist/internal/headlessRevisionResolution.js +9 -0
  219. package/dist/internal/pageBreakRunSourceDescendantIndex.js +7 -2
  220. package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
  221. package/dist/internal/paragraphFormattingSerialization.js +118 -83
  222. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  223. package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
  224. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  225. package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
  226. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
  227. package/dist/layout-bridge/convert/toFlowBlocks.js +267 -101
  228. package/dist/layout-engine/index.d.ts +2 -2
  229. package/dist/layout-engine/index.js +53 -17
  230. package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
  231. package/dist/layout-engine/measure/measureBlocks.js +6 -10
  232. package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
  233. package/dist/layout-engine/measure/tableCellFloating.js +2 -0
  234. package/dist/layout-engine/measure/tableCellGrid.js +2 -1
  235. package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
  236. package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
  237. package/dist/layout-engine/paragraphSequence.js +3 -2
  238. package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
  239. package/dist/layout-engine/section-breaks.d.ts +49 -2
  240. package/dist/layout-engine/section-breaks.js +55 -4
  241. package/dist/layout-engine/types.d.ts +69 -17
  242. package/dist/layout-engine/types.js +16 -1
  243. package/dist/layout-painter/borderStroke.d.ts +18 -4
  244. package/dist/layout-painter/renderImage.d.ts +5 -1
  245. package/dist/layout-painter/renderImage.js +10 -3
  246. package/dist/layout-painter/renderPage.d.ts +2 -0
  247. package/dist/layout-painter/renderPage.js +10 -4
  248. package/dist/layout-painter/renderParagraph.d.ts +14 -1
  249. package/dist/layout-painter/renderParagraph.js +34 -28
  250. package/dist/layout-painter/renderTable.d.ts +4 -1
  251. package/dist/layout-painter/renderTable.js +22 -22
  252. package/dist/layout-painter/renderTextBox.js +5 -3
  253. package/dist/managers/autoSaveCodec.d.ts +9 -1
  254. package/dist/managers/autoSaveCodec.js +12 -4
  255. package/dist/markdown/renderBlock.js +3 -0
  256. package/dist/markdown/renderRuns.d.ts +1 -1
  257. package/dist/markdown/renderRuns.js +34 -6
  258. package/dist/markdown/renderTable.js +24 -6
  259. package/dist/markdown/trailers.js +4 -1
  260. package/dist/model.d.ts +3 -3
  261. package/dist/model.js +2 -2
  262. package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
  263. package/dist/paged-layout/sectionBlockWidths.js +26 -4
  264. package/dist/pdf/images.js +142 -6
  265. package/dist/prosemirror/attrs/index.d.ts +34 -5
  266. package/dist/prosemirror/attrs/index.js +639 -48
  267. package/dist/prosemirror/authoredTransformAttrs.d.ts +28 -0
  268. package/dist/prosemirror/authoredTransformAttrs.js +64 -0
  269. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
  270. package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
  271. package/dist/prosemirror/commands/comments.js +68 -53
  272. package/dist/prosemirror/commands/contentControls.js +33 -20
  273. package/dist/prosemirror/commands/image.d.ts +10 -3
  274. package/dist/prosemirror/commands/image.js +46 -29
  275. package/dist/prosemirror/commands/pageBreak.js +1 -1
  276. package/dist/prosemirror/commands/paragraph.d.ts +2 -1
  277. package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
  278. package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
  279. package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
  280. package/dist/prosemirror/commands/sectionBreak.js +187 -11
  281. package/dist/prosemirror/commentReferenceAttrs.d.ts +8 -0
  282. package/dist/prosemirror/commentReferenceAttrs.js +33 -0
  283. package/dist/prosemirror/commentReferenceIntegrity.d.ts +47 -0
  284. package/dist/prosemirror/commentReferenceIntegrity.js +43 -0
  285. package/dist/prosemirror/conversion/fromProseDoc.d.ts +17 -12
  286. package/dist/prosemirror/conversion/fromProseDoc.js +553 -207
  287. package/dist/prosemirror/conversion/index.d.ts +2 -2
  288. package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
  289. package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
  290. package/dist/prosemirror/conversion/runShadingMark.js +14 -1
  291. package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
  292. package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
  293. package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -9
  294. package/dist/prosemirror/conversion/toProseDoc.js +801 -411
  295. package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
  296. package/dist/prosemirror/emptyRangeAnchor.js +158 -0
  297. package/dist/prosemirror/extensions/StarterKit.js +14 -58
  298. package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
  299. package/dist/prosemirror/extensions/core/ParagraphExtension.js +21 -16
  300. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +48 -29
  301. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -1
  302. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +5 -3
  303. package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
  304. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -0
  305. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
  306. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
  307. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
  308. package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
  309. package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
  310. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
  311. package/dist/prosemirror/extensions/markRegistry.d.ts +65 -0
  312. package/dist/prosemirror/extensions/markRegistry.js +138 -0
  313. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +18 -0
  314. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +77 -0
  315. package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
  316. package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
  317. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
  318. package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
  319. package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
  320. package/dist/prosemirror/extensions/marks/markUtils.js +49 -5
  321. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
  322. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
  323. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
  324. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
  325. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
  326. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.d.ts +11 -0
  327. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +97 -0
  328. package/dist/prosemirror/extensions/nodes/FieldExtension.js +9 -7
  329. package/dist/prosemirror/extensions/nodes/ImageExtension.js +24 -1
  330. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
  331. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
  332. package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +32 -0
  333. package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +67 -0
  334. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +16 -0
  335. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +60 -0
  336. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
  337. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
  338. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
  339. package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
  340. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +7 -0
  341. package/dist/prosemirror/extensions/nodes/TableExtension.js +142 -123
  342. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +9 -1
  343. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
  344. package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
  345. package/dist/prosemirror/extensions/types.d.ts +12 -3
  346. package/dist/prosemirror/index.d.ts +4 -2
  347. package/dist/prosemirror/index.js +2 -1
  348. package/dist/prosemirror/inlineWrapperStack.d.ts +39 -0
  349. package/dist/prosemirror/inlineWrapperStack.js +92 -0
  350. package/dist/prosemirror/listMarker.d.ts +2 -2
  351. package/dist/prosemirror/listMarker.js +7 -8
  352. package/dist/prosemirror/listRenderingAttrs.js +11 -1
  353. package/dist/prosemirror/listState.d.ts +62 -0
  354. package/dist/prosemirror/listState.js +49 -0
  355. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
  356. package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
  357. package/dist/prosemirror/numberedRefFields.js +4 -4
  358. package/dist/prosemirror/numberingAttr.d.ts +55 -0
  359. package/dist/prosemirror/numberingAttr.js +74 -0
  360. package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
  361. package/dist/prosemirror/outlineLevelAttr.js +42 -0
  362. package/dist/prosemirror/pageBreakRunProjection.d.ts +17 -7
  363. package/dist/prosemirror/pageBreakRunProjection.js +19 -9
  364. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
  365. package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
  366. package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
  367. package/dist/prosemirror/plugins/selectionTracker.js +3 -10
  368. package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
  369. package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
  370. package/dist/prosemirror/replacedAnnotations.d.ts +59 -0
  371. package/dist/prosemirror/replacedAnnotations.js +183 -0
  372. package/dist/prosemirror/revisionCarriers.d.ts +86 -2
  373. package/dist/prosemirror/revisionCarriers.js +86 -60
  374. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +5 -1
  375. package/dist/prosemirror/runFormattingInlineCarriers.js +7 -1
  376. package/dist/prosemirror/runIdentity.d.ts +28 -0
  377. package/dist/prosemirror/runIdentity.js +36 -0
  378. package/dist/prosemirror/runStyleFormatting.js +1 -1
  379. package/dist/prosemirror/schema/index.d.ts +3 -3
  380. package/dist/prosemirror/schema/marks.d.ts +47 -4
  381. package/dist/prosemirror/schema/nodes.d.ts +309 -26
  382. package/dist/prosemirror/schema/nodes.js +16 -1
  383. package/dist/prosemirror/sectionCarrier.d.ts +37 -0
  384. package/dist/prosemirror/sectionCarrier.js +40 -0
  385. package/dist/prosemirror/selectionState.d.ts +3 -0
  386. package/dist/prosemirror/selectionState.js +4 -1
  387. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
  388. package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
  389. package/dist/prosemirror/tableResize.js +5 -6
  390. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +4 -0
  391. package/dist/prosemirror/trackedRunInlineAtoms.js +4 -0
  392. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
  393. package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
  394. package/dist/prosemirror/validation.js +31 -6
  395. package/dist/prosemirror/yjsDocumentMetadata.d.ts +73 -0
  396. package/dist/prosemirror/yjsDocumentMetadata.js +592 -0
  397. package/dist/prosemirror/zeroWidthAnchors.js +6 -0
  398. package/dist/render-dom/commentAnchorAttributes.d.ts +37 -0
  399. package/dist/render-dom/commentAnchorAttributes.js +54 -0
  400. package/dist/server.d.ts +3 -1
  401. package/dist/server.js +3 -1
  402. package/dist/style-sets/extract.js +4 -4
  403. package/dist/style-sets/stellaStyle.js +36 -23
  404. package/dist/types/colors.d.ts +2 -2
  405. package/dist/types/content.d.ts +2 -2
  406. package/dist/types/documentEnumValues.d.ts +53 -26
  407. package/dist/types/documentEnumValues.js +72 -174
  408. package/dist/types/formatting.d.ts +2 -2
  409. package/dist/types/index.d.ts +9 -2
  410. package/dist/utils/borderCss.d.ts +246 -0
  411. package/dist/utils/borderCss.js +325 -0
  412. package/dist/utils/clipboard.d.ts +9 -1
  413. package/dist/utils/clipboard.js +27 -1
  414. package/dist/utils/colorResolver.d.ts +4 -3
  415. package/dist/utils/colorResolver.js +45 -76
  416. package/dist/utils/createDocument.js +24 -6
  417. package/dist/utils/findReplace.js +52 -10
  418. package/dist/utils/formatToStyle.d.ts +84 -2
  419. package/dist/utils/formatToStyle.js +133 -52
  420. package/dist/utils/headingCollector.js +3 -2
  421. package/dist/utils/imageLuminance.d.ts +15 -0
  422. package/dist/utils/imageLuminance.js +32 -0
  423. package/dist/utils/mergeDocumentContent.js +12 -20
  424. package/dist/utils/paragraphFormattingMerge.js +27 -6
  425. package/dist/utils/replaceText.js +1 -0
  426. package/dist/utils/tableOperations.d.ts +5 -3
  427. package/dist/utils/tableOperations.js +14 -1
  428. package/dist/utils/tablePlacement.d.ts +7 -0
  429. package/dist/utils/tablePlacement.js +14 -0
  430. package/dist/utils/textDirectionFlow.d.ts +15 -0
  431. package/dist/utils/textDirectionFlow.js +38 -0
  432. package/dist/utils/textFormattingMerge.js +16 -4
  433. package/package.json +10 -10
  434. package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
  435. package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
  436. package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
  437. package/dist/compare/__fixtures__/body-sequence.js +0 -225
  438. package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
  439. package/dist/compare/__fixtures__/nested-table.js +0 -50
  440. package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
  441. package/dist/compare/__fixtures__/numbered-list.js +0 -85
  442. package/dist/docx/blockRangeMarkers.d.ts +0 -36
  443. package/dist/docx/blockRangeMarkers.js +0 -59
  444. package/dist/docx/bookmarkPlacement.d.ts +0 -9
  445. package/dist/docx/bookmarkPlacement.js +0 -50
  446. package/dist/fonts/embeddedFontTable.d.ts +0 -45
  447. package/dist/fonts/embeddedFontTable.js +0 -80
  448. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
  449. package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
  450. package/dist/prosemirror/yjsParagraphSourceContract.d.ts +0 -9
  451. package/dist/prosemirror/yjsParagraphSourceContract.js +0 -26
@@ -0,0 +1,166 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ //#region src/docx/inlineWrapperContent.d.ts
3
+ /**
4
+ * What a run-level tracked-change wrapper keeps inside itself (CT_RunTrackChange).
5
+ *
6
+ * Runs, links, fields, bookmark boundaries, equations, nested revisions and
7
+ * markup folio does not model.
8
+ *
9
+ * The transparent wrappers are admitted too: `w:bdo` / `w:dir` state how their
10
+ * content is laid out, and `w:sdt` states what the content is bound to.
11
+ * Neither says anything about the revision, so lifting one out of a revision
12
+ * takes its text out of the revision with it.
13
+ *
14
+ * The range markers are not: a `w:commentRangeStart` or `w:moveFromRangeStart`
15
+ * inside a revision is a marker the revision does not own, and the pairing
16
+ * passes read it as a paragraph-level sibling.
17
+ */
18
+ declare const TRACKED_CHANGE_WRAPPER_CONTENT: {
19
+ readonly inlineWrapper: true;
20
+ readonly bookmarkEnd: true;
21
+ readonly bookmarkStart: true;
22
+ readonly complexField: true;
23
+ readonly deletion: true;
24
+ readonly hyperlink: true;
25
+ readonly inlineSdt: true;
26
+ readonly insertion: true;
27
+ readonly mathEquation: true;
28
+ readonly moveFrom: true;
29
+ readonly moveTo: true;
30
+ readonly preservedInline: true;
31
+ readonly run: true;
32
+ readonly simpleField: true;
33
+ readonly commentRangeEnd: false;
34
+ readonly commentRangeStart: false;
35
+ readonly commentReference: false;
36
+ readonly moveFromRangeEnd: false;
37
+ readonly moveFromRangeStart: false;
38
+ readonly moveToRangeEnd: false;
39
+ readonly moveToRangeStart: false;
40
+ };
41
+ /**
42
+ * What an inline content control keeps inside `<w:sdtContent>`.
43
+ *
44
+ * Mirror of upstream eigenpal/docx-editor PR #482 (commit 29f95751d), plus
45
+ * the bidirectional wrapper: OOXML allows runs, hyperlinks, simple/complex
46
+ * fields, nested SDTs, tracked insertions/deletions/moves, math, markup folio
47
+ * does not model, and the bidirectional controls directly inside
48
+ * `<w:sdtContent>`.
49
+ *
50
+ * The bookmark boundaries are admitted for the reason the revision wrapper
51
+ * admits them: `CT_SdtContentRun` reaches `EG_RangeMarkupElements` through
52
+ * `EG_RunLevelElts`, so the marker is valid where Word wrote it, and lifting
53
+ * it out changes what the bookmark covers. A range whose extent was the
54
+ * control's content comes back covering the control plus whatever follows, so
55
+ * a `REF` field or a link to it resolves to the wrong text.
56
+ *
57
+ * The other range markers are not: a `w:commentRangeStart` or a
58
+ * `w:moveFromRangeStart` inside the control is a marker the control does not
59
+ * own, and the pairing passes read it as a paragraph-level sibling.
60
+ */
61
+ declare const INLINE_SDT_CONTENT: {
62
+ readonly inlineWrapper: true;
63
+ readonly bookmarkEnd: true;
64
+ readonly bookmarkStart: true;
65
+ readonly complexField: true;
66
+ readonly deletion: true;
67
+ readonly hyperlink: true;
68
+ readonly inlineSdt: true;
69
+ readonly insertion: true;
70
+ readonly mathEquation: true;
71
+ readonly moveFrom: true;
72
+ readonly moveTo: true;
73
+ readonly preservedInline: true;
74
+ readonly run: true;
75
+ readonly simpleField: true;
76
+ readonly commentRangeEnd: false;
77
+ readonly commentRangeStart: false;
78
+ readonly commentReference: false;
79
+ readonly moveFromRangeEnd: false;
80
+ readonly moveFromRangeStart: false;
81
+ readonly moveToRangeEnd: false;
82
+ readonly moveToRangeStart: false;
83
+ };
84
+ /**
85
+ * What a `w:hyperlink` keeps inside itself (CT_Hyperlink).
86
+ *
87
+ * Runs, the bookmark boundaries a link's target sits on, markup folio does not
88
+ * model, and the four transparent wrappers: `CT_Hyperlink` is `EG_PContent`,
89
+ * which declares `w:bdo`, `w:dir`, `w:smartTag` and the run-level
90
+ * `w:customXml`, so `w:hyperlink > w:bdo > w:r` is a link an author may write
91
+ * and folio reads it as authored.
92
+ *
93
+ * A revision is not admitted, and the exclusion is the model's, not the
94
+ * schema's: OOXML nests `w:ins` inside `w:hyperlink` and folio nests the link
95
+ * inside the revision, so the paragraph parser hoists one around the link.
96
+ */
97
+ declare const HYPERLINK_CONTENT: {
98
+ readonly bookmarkEnd: true;
99
+ readonly bookmarkStart: true;
100
+ readonly inlineWrapper: true;
101
+ readonly preservedInline: true;
102
+ readonly run: true;
103
+ readonly commentRangeEnd: false;
104
+ readonly commentRangeStart: false;
105
+ readonly commentReference: false;
106
+ readonly complexField: false;
107
+ readonly deletion: false;
108
+ readonly hyperlink: false;
109
+ readonly inlineSdt: false;
110
+ readonly insertion: false;
111
+ readonly mathEquation: false;
112
+ readonly moveFrom: false;
113
+ readonly moveFromRangeEnd: false;
114
+ readonly moveFromRangeStart: false;
115
+ readonly moveTo: false;
116
+ readonly moveToRangeEnd: false;
117
+ readonly moveToRangeStart: false;
118
+ readonly simpleField: false;
119
+ };
120
+ /**
121
+ * What a `w:fldSimple` keeps inside itself (CT_SimpleField).
122
+ *
123
+ * The cached result's runs and the link one may carry, the same four
124
+ * transparent wrappers `EG_PContent` declares, and markup folio does not
125
+ * model. `w:fldData` is the field's own child rather than its content, so it
126
+ * rides `dispatchChildren`'s sink like any other capture.
127
+ */
128
+ declare const SIMPLE_FIELD_CONTENT: {
129
+ readonly hyperlink: true;
130
+ readonly inlineWrapper: true;
131
+ readonly preservedInline: true;
132
+ readonly run: true;
133
+ readonly bookmarkEnd: false;
134
+ readonly bookmarkStart: false;
135
+ readonly commentRangeEnd: false;
136
+ readonly commentRangeStart: false;
137
+ readonly commentReference: false;
138
+ readonly complexField: false;
139
+ readonly deletion: false;
140
+ readonly inlineSdt: false;
141
+ readonly insertion: false;
142
+ readonly mathEquation: false;
143
+ readonly moveFrom: false;
144
+ readonly moveFromRangeEnd: false;
145
+ readonly moveFromRangeStart: false;
146
+ readonly moveTo: false;
147
+ readonly moveToRangeEnd: false;
148
+ readonly moveToRangeStart: false;
149
+ readonly simpleField: false;
150
+ };
151
+ /**
152
+ * Whether a revision wrapper keeps this content inside itself.
153
+ *
154
+ * Generic in the input so a caller that has already narrowed its content
155
+ * keeps that narrowing: filtering a list the bidirectional wrappers are
156
+ * already flattened out of must not put one back into the result type.
157
+ */
158
+ declare const isTrackedChangeWrapperChild: <Content extends document_d_exports.ParagraphContent>(content: Content) => content is Extract<Content, document_d_exports.TrackedRunContent>;
159
+ /** Whether an inline content control keeps this content inside `<w:sdtContent>`. */
160
+ declare const isInlineSdtContent: <Content extends document_d_exports.ParagraphContent>(content: Content) => content is Extract<Content, document_d_exports.InlineSdt["content"][number]>;
161
+ /** Whether a `w:hyperlink` keeps this content inside itself. */
162
+ declare const isHyperlinkContent: <Content extends document_d_exports.ParagraphContent>(content: Content) => content is Extract<Content, document_d_exports.Hyperlink["children"][number]>;
163
+ /** Whether a `w:fldSimple` keeps this content inside itself. */
164
+ declare const isSimpleFieldContent: <Content extends document_d_exports.ParagraphContent>(content: Content) => content is Extract<Content, document_d_exports.SimpleField["content"][number]>;
165
+ //#endregion
166
+ export { HYPERLINK_CONTENT, INLINE_SDT_CONTENT, SIMPLE_FIELD_CONTENT, TRACKED_CHANGE_WRAPPER_CONTENT, isHyperlinkContent, isInlineSdtContent, isSimpleFieldContent, isTrackedChangeWrapperChild };
@@ -0,0 +1,165 @@
1
+ //#region src/docx/inlineWrapperContent.ts
2
+ /**
3
+ * What a run-level tracked-change wrapper keeps inside itself (CT_RunTrackChange).
4
+ *
5
+ * Runs, links, fields, bookmark boundaries, equations, nested revisions and
6
+ * markup folio does not model.
7
+ *
8
+ * The transparent wrappers are admitted too: `w:bdo` / `w:dir` state how their
9
+ * content is laid out, and `w:sdt` states what the content is bound to.
10
+ * Neither says anything about the revision, so lifting one out of a revision
11
+ * takes its text out of the revision with it.
12
+ *
13
+ * The range markers are not: a `w:commentRangeStart` or `w:moveFromRangeStart`
14
+ * inside a revision is a marker the revision does not own, and the pairing
15
+ * passes read it as a paragraph-level sibling.
16
+ */
17
+ const TRACKED_CHANGE_WRAPPER_CONTENT = {
18
+ inlineWrapper: true,
19
+ bookmarkEnd: true,
20
+ bookmarkStart: true,
21
+ complexField: true,
22
+ deletion: true,
23
+ hyperlink: true,
24
+ inlineSdt: true,
25
+ insertion: true,
26
+ mathEquation: true,
27
+ moveFrom: true,
28
+ moveTo: true,
29
+ preservedInline: true,
30
+ run: true,
31
+ simpleField: true,
32
+ commentRangeEnd: false,
33
+ commentRangeStart: false,
34
+ commentReference: false,
35
+ moveFromRangeEnd: false,
36
+ moveFromRangeStart: false,
37
+ moveToRangeEnd: false,
38
+ moveToRangeStart: false
39
+ };
40
+ /**
41
+ * What an inline content control keeps inside `<w:sdtContent>`.
42
+ *
43
+ * Mirror of upstream eigenpal/docx-editor PR #482 (commit 29f95751d), plus
44
+ * the bidirectional wrapper: OOXML allows runs, hyperlinks, simple/complex
45
+ * fields, nested SDTs, tracked insertions/deletions/moves, math, markup folio
46
+ * does not model, and the bidirectional controls directly inside
47
+ * `<w:sdtContent>`.
48
+ *
49
+ * The bookmark boundaries are admitted for the reason the revision wrapper
50
+ * admits them: `CT_SdtContentRun` reaches `EG_RangeMarkupElements` through
51
+ * `EG_RunLevelElts`, so the marker is valid where Word wrote it, and lifting
52
+ * it out changes what the bookmark covers. A range whose extent was the
53
+ * control's content comes back covering the control plus whatever follows, so
54
+ * a `REF` field or a link to it resolves to the wrong text.
55
+ *
56
+ * The other range markers are not: a `w:commentRangeStart` or a
57
+ * `w:moveFromRangeStart` inside the control is a marker the control does not
58
+ * own, and the pairing passes read it as a paragraph-level sibling.
59
+ */
60
+ const INLINE_SDT_CONTENT = {
61
+ inlineWrapper: true,
62
+ bookmarkEnd: true,
63
+ bookmarkStart: true,
64
+ complexField: true,
65
+ deletion: true,
66
+ hyperlink: true,
67
+ inlineSdt: true,
68
+ insertion: true,
69
+ mathEquation: true,
70
+ moveFrom: true,
71
+ moveTo: true,
72
+ preservedInline: true,
73
+ run: true,
74
+ simpleField: true,
75
+ commentRangeEnd: false,
76
+ commentRangeStart: false,
77
+ commentReference: false,
78
+ moveFromRangeEnd: false,
79
+ moveFromRangeStart: false,
80
+ moveToRangeEnd: false,
81
+ moveToRangeStart: false
82
+ };
83
+ /**
84
+ * What a `w:hyperlink` keeps inside itself (CT_Hyperlink).
85
+ *
86
+ * Runs, the bookmark boundaries a link's target sits on, markup folio does not
87
+ * model, and the four transparent wrappers: `CT_Hyperlink` is `EG_PContent`,
88
+ * which declares `w:bdo`, `w:dir`, `w:smartTag` and the run-level
89
+ * `w:customXml`, so `w:hyperlink > w:bdo > w:r` is a link an author may write
90
+ * and folio reads it as authored.
91
+ *
92
+ * A revision is not admitted, and the exclusion is the model's, not the
93
+ * schema's: OOXML nests `w:ins` inside `w:hyperlink` and folio nests the link
94
+ * inside the revision, so the paragraph parser hoists one around the link.
95
+ */
96
+ const HYPERLINK_CONTENT = {
97
+ bookmarkEnd: true,
98
+ bookmarkStart: true,
99
+ inlineWrapper: true,
100
+ preservedInline: true,
101
+ run: true,
102
+ commentRangeEnd: false,
103
+ commentRangeStart: false,
104
+ commentReference: false,
105
+ complexField: false,
106
+ deletion: false,
107
+ hyperlink: false,
108
+ inlineSdt: false,
109
+ insertion: false,
110
+ mathEquation: false,
111
+ moveFrom: false,
112
+ moveFromRangeEnd: false,
113
+ moveFromRangeStart: false,
114
+ moveTo: false,
115
+ moveToRangeEnd: false,
116
+ moveToRangeStart: false,
117
+ simpleField: false
118
+ };
119
+ /**
120
+ * What a `w:fldSimple` keeps inside itself (CT_SimpleField).
121
+ *
122
+ * The cached result's runs and the link one may carry, the same four
123
+ * transparent wrappers `EG_PContent` declares, and markup folio does not
124
+ * model. `w:fldData` is the field's own child rather than its content, so it
125
+ * rides `dispatchChildren`'s sink like any other capture.
126
+ */
127
+ const SIMPLE_FIELD_CONTENT = {
128
+ hyperlink: true,
129
+ inlineWrapper: true,
130
+ preservedInline: true,
131
+ run: true,
132
+ bookmarkEnd: false,
133
+ bookmarkStart: false,
134
+ commentRangeEnd: false,
135
+ commentRangeStart: false,
136
+ commentReference: false,
137
+ complexField: false,
138
+ deletion: false,
139
+ inlineSdt: false,
140
+ insertion: false,
141
+ mathEquation: false,
142
+ moveFrom: false,
143
+ moveFromRangeEnd: false,
144
+ moveFromRangeStart: false,
145
+ moveTo: false,
146
+ moveToRangeEnd: false,
147
+ moveToRangeStart: false,
148
+ simpleField: false
149
+ };
150
+ /**
151
+ * Whether a revision wrapper keeps this content inside itself.
152
+ *
153
+ * Generic in the input so a caller that has already narrowed its content
154
+ * keeps that narrowing: filtering a list the bidirectional wrappers are
155
+ * already flattened out of must not put one back into the result type.
156
+ */
157
+ const isTrackedChangeWrapperChild = (content) => TRACKED_CHANGE_WRAPPER_CONTENT[content.type];
158
+ /** Whether an inline content control keeps this content inside `<w:sdtContent>`. */
159
+ const isInlineSdtContent = (content) => INLINE_SDT_CONTENT[content.type];
160
+ /** Whether a `w:hyperlink` keeps this content inside itself. */
161
+ const isHyperlinkContent = (content) => HYPERLINK_CONTENT[content.type];
162
+ /** Whether a `w:fldSimple` keeps this content inside itself. */
163
+ const isSimpleFieldContent = (content) => SIMPLE_FIELD_CONTENT[content.type];
164
+ //#endregion
165
+ export { HYPERLINK_CONTENT, INLINE_SDT_CONTENT, SIMPLE_FIELD_CONTENT, TRACKED_CHANGE_WRAPPER_CONTENT, isHyperlinkContent, isInlineSdtContent, isSimpleFieldContent, isTrackedChangeWrapperChild };
@@ -0,0 +1,11 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ import { XmlElement } from "./xmlParser.js";
3
+ //#region src/docx/inlineWrapperParser.d.ts
4
+ /** The elements that spell a transparent inline wrapper. */
5
+ declare const INLINE_WRAPPER_ELEMENTS: readonly ["bdo", "dir", "smartTag", "customXml"];
6
+ /** One of them, as the child dispatcher names it. */
7
+ type InlineWrapperElement = (typeof INLINE_WRAPPER_ELEMENTS)[number];
8
+ /** The wrapper `element` spells, around content the caller has already read. */
9
+ declare const inlineWrapperOf: (element: InlineWrapperElement, node: XmlElement, content: document_d_exports.ParagraphContent[]) => document_d_exports.InlineWrapper;
10
+ //#endregion
11
+ export { INLINE_WRAPPER_ELEMENTS, InlineWrapperElement, inlineWrapperOf };
@@ -0,0 +1,60 @@
1
+ import { captureVerbatimXml } from "./verbatimCapture.js";
2
+ import { findChild, getAttribute } from "./xmlParser.js";
3
+ import { BIDI_CONTROLS } from "@stll/docx-core/model";
4
+ //#region src/docx/inlineWrapperParser.ts
5
+ /** The elements that spell a transparent inline wrapper. */
6
+ const INLINE_WRAPPER_ELEMENTS = [
7
+ "bdo",
8
+ "dir",
9
+ "smartTag",
10
+ "customXml"
11
+ ];
12
+ /**
13
+ * A `w:bdo` or `w:dir`: a bidirectional override or embedding. Both hold
14
+ * inline content and change only how it is laid out, so the wrapper carries
15
+ * its direction and nothing else.
16
+ */
17
+ const bidiWrapper = (node, control, content) => {
18
+ const wrapper = {
19
+ type: "inlineWrapper",
20
+ kind: "bidi",
21
+ control,
22
+ content
23
+ };
24
+ const direction = getAttribute(node, "w", "val");
25
+ if (direction === "ltr" || direction === "rtl") wrapper.direction = direction;
26
+ return wrapper;
27
+ };
28
+ /**
29
+ * A `w:smartTag` or a run-level `w:customXml`. Both name an element in another
30
+ * vocabulary around content that is ordinary inline content; what the wrapper
31
+ * adds is its name, its namespace and a properties bag folio replays rather
32
+ * than reads. The `w:element` attribute is required by both content models,
33
+ * and a tag without one names nothing, so it is read as the empty string
34
+ * rather than refused: the content is what matters.
35
+ */
36
+ const taggedWrapper = (node, kind, content) => {
37
+ const wrapper = {
38
+ type: "inlineWrapper",
39
+ kind,
40
+ element: getAttribute(node, "w", "element") ?? "",
41
+ content
42
+ };
43
+ const uri = getAttribute(node, "w", "uri");
44
+ if (uri !== null) wrapper.uri = uri;
45
+ const properties = findChild(node, "w", kind === "smartTag" ? "smartTagPr" : "customXmlPr");
46
+ if (properties) wrapper.propertiesXml = captureVerbatimXml(properties);
47
+ return wrapper;
48
+ };
49
+ /** The wrapper `element` spells, around content the caller has already read. */
50
+ const inlineWrapperOf = (element, node, content) => {
51
+ switch (element) {
52
+ case "bdo": return bidiWrapper(node, BIDI_CONTROLS.override, content);
53
+ case "dir": return bidiWrapper(node, BIDI_CONTROLS.embedding, content);
54
+ case "smartTag": return taggedWrapper(node, "smartTag", content);
55
+ case "customXml": return taggedWrapper(node, "customXml", content);
56
+ default: return element;
57
+ }
58
+ };
59
+ //#endregion
60
+ export { INLINE_WRAPPER_ELEMENTS, inlineWrapperOf };
@@ -1,14 +1,6 @@
1
+ import { document_d_exports } from "../types/document.js";
1
2
  import { XmlElement } from "./xmlParser.js";
2
3
  //#region src/docx/nonVisualDrawingProps.d.ts
3
- /** The authored name, alt text and title of a drawing object. */
4
- type NonVisualDrawingNames = {
5
- /** `@name`, schema-required, so `""` means the object was never named. */
6
- name?: string;
7
- /** `@descr`: alt text, accessibility content. */
8
- alt?: string;
9
- /** `@title`. */
10
- title?: string;
11
- };
12
4
  /**
13
5
  * Read `@name`, `@descr` and `@title` off a `CT_NonVisualDrawingProps` element.
14
6
  *
@@ -19,7 +11,7 @@ type NonVisualDrawingNames = {
19
11
  * tell the two apart. `@descr` and `@title` are optional and written only when
20
12
  * authored, so `""` in either is a string someone wrote.
21
13
  */
22
- declare const parseNonVisualDrawingNames: (element: XmlElement | null | undefined) => NonVisualDrawingNames;
14
+ declare const parseNonVisualDrawingNames: (element: XmlElement | null | undefined) => document_d_exports.NonVisualDrawingNames;
23
15
  /**
24
16
  * The `name`, `descr` and `title` attributes of a `CT_NonVisualDrawingProps`
25
17
  * element, leading space included.
@@ -29,6 +21,6 @@ declare const parseNonVisualDrawingNames: (element: XmlElement | null | undefine
29
21
  * "Shape 3" would overwrite the author's own name for every drawing whose
30
22
  * name did not survive the model, and read back as authored content.
31
23
  */
32
- declare const serializeNonVisualDrawingNames: (names: NonVisualDrawingNames) => string;
33
- //#endregion
34
- export { NonVisualDrawingNames, parseNonVisualDrawingNames, serializeNonVisualDrawingNames };
24
+ declare const serializeNonVisualDrawingNames: (names: document_d_exports.NonVisualDrawingNames) => string;
25
+ type NonVisualDrawingNames = document_d_exports.NonVisualDrawingNames;
26
+ export { type NonVisualDrawingNames, parseNonVisualDrawingNames, serializeNonVisualDrawingNames };
@@ -44,13 +44,24 @@ const normalizeTable = (table, styles) => ({
44
44
  ...row,
45
45
  cells: row.cells.map((cell) => ({
46
46
  ...cell,
47
- content: cell.content.map((block) => block.type === "paragraph" ? normalizeParagraph(block, styles) : normalizeTable(block, styles))
47
+ content: cell.content.map((block) => normalizeCellBlock(block, styles))
48
48
  }))
49
49
  }))
50
50
  });
51
+ const normalizeCellBlock = (block, styles) => {
52
+ switch (block.type) {
53
+ case "paragraph": return normalizeParagraph(block, styles);
54
+ case "table": return normalizeTable(block, styles);
55
+ case "preservedBlock":
56
+ case "bookmarkStart":
57
+ case "bookmarkEnd": return block;
58
+ default: return block;
59
+ }
60
+ };
51
61
  const normalizeBlocks = (blocks, styles) => blocks.map((block) => {
52
62
  if (block.type === "paragraph") return normalizeParagraph(block, styles);
53
63
  if (block.type === "table") return normalizeTable(block, styles);
64
+ if (block.type === "preservedBlock" || block.type === "bookmarkStart" || block.type === "bookmarkEnd") return block;
54
65
  return {
55
66
  ...block,
56
67
  content: normalizeBlocks(block.content, styles)
@@ -24,6 +24,29 @@ type NumberingMap = {
24
24
  * @returns NumberingMap with definitions and helper functions
25
25
  */
26
26
  declare function parseNumbering(numberingXml: string | null): NumberingMap;
27
+ /** A `w:numFmt` as the model holds it: the token, plus what `custom` defers to. */
28
+ type ResolvedNumFmt = Pick<document_d_exports.ListLevel, "numFmt" | "numFmtFormat">;
29
+ /**
30
+ * The width a `custom` format's zero-padded first token counts to, or
31
+ * `undefined` for a pattern folio does not render.
32
+ *
33
+ * ECMA-376 §17.9.17: `@w:format` is an XSLT token list like
34
+ * "0001, 0002, 0003, ...". Word only emits zero-padded decimal customs this
35
+ * way; the width is the digit count of the first token, clamped to five.
36
+ */
37
+ declare const customNumberFormatPadWidth: (format: string | undefined) => number | undefined;
38
+ /**
39
+ * The `@w:format` a level's `w:numFmt` writes, which only `custom` carries.
40
+ *
41
+ * `custom` is the reserved member that defers to another attribute, so the
42
+ * comparison lives here, in the module the reserved-value registry names as
43
+ * its owner, rather than in the serializer that needs the answer.
44
+ */
45
+ declare const customNumberFormatOf: (level: ResolvedNumFmt) => string | undefined;
46
+ /** What the marker renderer counts a level in; `custom` decides by pad width. */
47
+ declare const counterFormatOf: (level: ResolvedNumFmt) => document_d_exports.CounterFormat;
48
+ /** {@link MARKER_ALIGNMENT} for a level that may not state a justification. */
49
+ declare const markerAlignmentForLevel: (lvlJc: document_d_exports.ParagraphAlignment | undefined) => document_d_exports.ListRendering["markerAlignment"];
27
50
  declare const markerFormattingFromLevel: (formatting: document_d_exports.TextFormatting | undefined) => document_d_exports.ListMarkerFormatting | undefined;
28
51
  declare function getCachedNumberingMap(definitions: document_d_exports.NumberingDefinitions): NumberingMap;
29
52
  /**
@@ -54,7 +77,7 @@ declare function computeListRendering(numPr: {
54
77
  * @param formats - Array of number formats for each level
55
78
  * @returns Rendered marker text
56
79
  */
57
- declare function renderListMarker(lvlText: string, counters: number[], formats: document_d_exports.NumberFormat[]): string;
80
+ declare function renderListMarker(lvlText: string, counters: number[], formats: document_d_exports.CounterFormat[]): string;
58
81
  /**
59
82
  * Get the bullet character for a bullet list level
60
83
  *
@@ -69,4 +92,4 @@ declare function isBulletLevel(level: document_d_exports.ListLevel): boolean;
69
92
  /** Whether a numbering level reserves horizontal space for a visible marker. */
70
93
  declare const numberingLevelHasMarkerSlot: (level: Pick<document_d_exports.ListLevel, "numFmt">) => boolean;
71
94
  //#endregion
72
- export { NumberingMap, computeListRendering, createNumberingMap, formatOoxmlCounter as formatNumber, getBulletCharacter, getCachedNumberingMap, isBulletLevel, markerFormattingFromLevel, numberingLevelHasMarkerSlot, padDecimal, parseNumbering, renderListMarker };
95
+ export { NumberingMap, computeListRendering, counterFormatOf, createNumberingMap, customNumberFormatOf, customNumberFormatPadWidth, formatOoxmlCounter as formatNumber, getBulletCharacter, getCachedNumberingMap, isBulletLevel, markerAlignmentForLevel, markerFormattingFromLevel, numberingLevelHasMarkerSlot, padDecimal, parseNumbering, renderListMarker };