@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
@@ -6,7 +6,7 @@ import { document_d_exports } from "../../types/document.js";
6
6
  */
7
7
  type TextColorAttrs = {
8
8
  rgb?: string;
9
- themeColor?: document_d_exports.ThemeColorSlot;
9
+ themeColor?: document_d_exports.ThemeColor;
10
10
  themeTint?: string;
11
11
  themeShade?: string;
12
12
  };
@@ -115,6 +115,8 @@ type TrackedChangeMarkAttrs = {
115
115
  * `null` default is normalized to absent by the attrs reader).
116
116
  */
117
117
  suggestionId?: string;
118
+ /** Imported deleted content uses its pre-change formatting hierarchy. */
119
+ _historicalFormatting?: true;
118
120
  };
119
121
  /** Run-property revisions carried through the editable model. */
120
122
  type RunPropertyChangeMarkAttrs = {
@@ -123,9 +125,50 @@ type RunPropertyChangeMarkAttrs = {
123
125
  provenance: TrackedChangeProvenance;
124
126
  suggestionId?: string;
125
127
  };
126
- /** Editor-only identity for one authored run that contains an explicit page break. */
127
- type PageBreakRunOwnerMarkAttrs = {
128
+ /**
129
+ * Editor-side identity for one authored `w:r`, and everything about that
130
+ * element the model holds but no formatting mark carries.
131
+ *
132
+ * One mark rather than three, because all three payloads are facts about one
133
+ * element and the save leg asks that element a single question: where does
134
+ * this run begin and end. Two marks could give two answers to it, and nothing
135
+ * in the schema would force a resolution.
136
+ *
137
+ * Minted only when the run has something to carry — a page break, an
138
+ * attribute remainder, or a property-set remainder — so a document that
139
+ * carries none pays nothing.
140
+ */
141
+ type RunIdentityMarkAttrs = {
142
+ /** The authored run this leaf came from. Monotonic within one parse. */
128
143
  id: number;
144
+ /** `w:r`'s attribute remainder: resolved names, source order. */
145
+ preservedAttributes?: readonly document_d_exports.PreservedAttribute[];
146
+ /** The `w:rPr` children no reader took a value from, with their ordinals. */
147
+ preserved?: document_d_exports.PreservedMarkup;
148
+ };
149
+ /**
150
+ * One transparent wrapper a leaf sits inside, minus the content ProseMirror
151
+ * now holds instead.
152
+ *
153
+ * Distributed over the model's union rather than written out beside it: a
154
+ * wrapper kind exists in both places or in neither, and the fields a kind
155
+ * carries are stated once. A smart tag cannot gain a `control` this way, and
156
+ * a kind added to the model reaches the editor as a compile error at every
157
+ * site that decides per kind.
158
+ */
159
+ type WrapperLayer<Wrapper> = Wrapper extends unknown ? Omit<Wrapper, "type" | "content"> : never;
160
+ type InlineWrapperLayer = WrapperLayer<document_d_exports.InlineWrapper>;
161
+ type InlineWrapperKind = InlineWrapperLayer["kind"];
162
+ /**
163
+ * The wrappers a leaf sits inside, outermost first.
164
+ *
165
+ * Multiplicity lives here rather than in the mark set: ProseMirror marks are
166
+ * unordered across types and a mark excludes its own type, so nesting a
167
+ * wrapper inside another cannot be spelled as two marks. `null` is no
168
+ * wrapper; an empty stack is never stored.
169
+ */
170
+ type InlineWrapperAttrs = {
171
+ stack: readonly InlineWrapperLayer[];
129
172
  };
130
173
  declare const COMPLEX_SCRIPT_RUN_PROPERTY_KEYS: readonly ["boldCs", "italicCs", "fontSizeCs"];
131
174
  type ComplexScriptRunPropertyKey = (typeof COMPLEX_SCRIPT_RUN_PROPERTY_KEYS)[number];
@@ -231,4 +274,4 @@ type HyperlinkAttrs = {
231
274
  _docxHyperlinkIndex?: number;
232
275
  };
233
276
  //#endregion
234
- export { AuthoredRunFormattingValues, COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, ComplexScriptRunPropertyKey, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_PROPERTY_SPECS, RUN_FORMATTING_VALUE_PROPERTIES, RunFormattingBooleanProperty, RunFormattingOverrideAttrs, RunFormattingValueProperty, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TRACKED_CHANGE_PROVENANCE_VALUES, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, TrackedChangeProvenance, UnderlineAttrs };
277
+ export { AuthoredRunFormattingValues, COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, ComplexScriptRunPropertyKey, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_PROPERTY_SPECS, RUN_FORMATTING_VALUE_PROPERTIES, RunFormattingBooleanProperty, RunFormattingOverrideAttrs, RunFormattingValueProperty, RunIdentityMarkAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TRACKED_CHANGE_PROVENANCE_VALUES, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, TrackedChangeProvenance, UnderlineAttrs };
@@ -3,6 +3,7 @@ import { TrackedChangeProvenance } from "./marks.js";
3
3
  import "../../types/index.js";
4
4
  import { OutlineStyleAttr } from "../../types/documentEnumValues.js";
5
5
  import { SpacingExplicit } from "../../types/formatting.js";
6
+ import { ParagraphNumberingAttr } from "../numberingAttr.js";
6
7
  import { ParagraphDirection } from "../paragraphDirection.js";
7
8
  //#region src/prosemirror/schema/nodes.d.ts
8
9
  type HardBreakAttrs = {
@@ -21,6 +22,35 @@ type SymbolAttrs = {
21
22
  font: string;
22
23
  char: string;
23
24
  };
25
+ /** A run child folio does not model, carried through the editor untouched. */
26
+ /**
27
+ * Which container the captured markup came out of, and goes back into.
28
+ *
29
+ * `w:ruby` is a run child and has to be written back inside a `w:r`;
30
+ * `w:permStart` is a paragraph child and the schema admits none inside a run,
31
+ * so writing one there would produce a package Word repairs. One atom serves
32
+ * both because the editor treats them identically — opaque, zero-width unless
33
+ * the markup shows text, carrying whatever marks surround it — and only the
34
+ * save path has to tell them apart.
35
+ */
36
+ declare const PRESERVED_XML_LEVELS: {
37
+ readonly run: "run";
38
+ readonly inline: "inline";
39
+ };
40
+ type PreservedXmlLevel = (typeof PRESERVED_XML_LEVELS)[keyof typeof PRESERVED_XML_LEVELS];
41
+ /** A run or inline child folio does not model, carried through the editor untouched. */
42
+ type PreservedXmlAttrs = {
43
+ /** Replayable markup, as `captureVerbatimXml` wrote it. */
44
+ xml: string;
45
+ /** The visible text the markup puts on the line, empty when it shows none. */
46
+ text: string;
47
+ level: PreservedXmlLevel;
48
+ };
49
+ /** A block child folio does not model, carried through the editor untouched. */
50
+ type PreservedBlockAttrs = {
51
+ /** Replayable markup, as `captureVerbatimXml` wrote it. */
52
+ xml: string;
53
+ };
24
54
  type BookmarkBoundaryAttrs = {
25
55
  type: "start";
26
56
  id: number;
@@ -33,6 +63,14 @@ type BookmarkBoundaryAttrs = {
33
63
  id: number;
34
64
  displacedByCustomXml?: document_d_exports.DisplacedByCustomXml;
35
65
  };
66
+ /**
67
+ * The position of a comment's `w:commentReference`: the run that paints the
68
+ * visible comment mark. It is authored data, not a consequence of where the
69
+ * range ends, so the editor carries it as a node of its own.
70
+ */
71
+ type CommentReferenceAttrs = {
72
+ commentId: number;
73
+ };
36
74
  /**
37
75
  * Paragraph node attributes - maps to ParagraphFormatting
38
76
  */
@@ -69,10 +107,11 @@ type ParagraphAttrs = {
69
107
  indentRight?: number;
70
108
  indentFirstLine?: number;
71
109
  hangingIndent?: boolean;
72
- numPr?: {
73
- numId?: number;
74
- ilvl?: number;
75
- };
110
+ /**
111
+ * The stated `w:numPr` (17.3.1.19), as the model carries it. Minted by
112
+ * `paragraphNumberingAttr`, so a model value cannot land here unconverted.
113
+ */
114
+ numPr?: ParagraphNumberingAttr;
76
115
  /**
77
116
  * The style-sourced numPr value when `numPr` came from the paragraph
78
117
  * style rather than direct formatting. While `numPr` still equals this,
@@ -81,12 +120,9 @@ type ParagraphAttrs = {
81
120
  * commands that change `numPr` make the values diverge, which re-enables
82
121
  * direct serialization — no explicit clearing needed.
83
122
  */
84
- numPrFromStyle?: {
85
- numId?: number;
86
- ilvl?: number;
87
- };
123
+ numPrFromStyle?: ParagraphNumberingAttr;
88
124
  /** List number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling */
89
- listNumFmt?: document_d_exports.NumberFormat;
125
+ listNumFmt?: document_d_exports.CounterFormat;
90
126
  /** Whether this is a bullet list */
91
127
  listIsBullet?: boolean;
92
128
  /** Whether this level uses legal numbering (parent placeholders render decimal). */
@@ -122,7 +158,7 @@ type ParagraphAttrs = {
122
158
  */
123
159
  listMarkerSecondSlotOffsetTwips?: number;
124
160
  /** Number format for each level used by multi-level marker templates. */
125
- listLevelNumFmts?: document_d_exports.NumberFormat[];
161
+ listLevelNumFmts?: document_d_exports.CounterFormat[];
126
162
  /** Initial counter for each level used by multi-level marker templates. */
127
163
  listLevelStarts?: number[];
128
164
  /** Abstract numbering ID shared by numbering instances. */
@@ -157,7 +193,6 @@ type ParagraphAttrs = {
157
193
  defaultTextFormatting?: document_d_exports.TextFormatting;
158
194
  /** Internal table-style run overlay, used to resolve body-run provenance. */
159
195
  _tableRunFormatting?: document_d_exports.TextFormatting;
160
- sectionBreakType?: "nextPage" | "continuous" | "oddPage" | "evenPage";
161
196
  /**
162
197
  * Base text direction as a discriminated union (undecided when absent). Maps
163
198
  * to the serialized OOXML `w:bidi` tri-state via `directionToBidi`; the
@@ -165,7 +200,8 @@ type ParagraphAttrs = {
165
200
  * re-evaluable auto-detected one. See `paragraphDirection.ts`.
166
201
  */
167
202
  direction?: ParagraphDirection | null;
168
- outlineLevel?: number;
203
+ /** The stated `w:outlineLvl`, style-resolved: a heading level or body text. */
204
+ outlineLevel?: document_d_exports.OutlineLevel;
169
205
  bookmarks?: {
170
206
  id: number;
171
207
  name: string;
@@ -210,9 +246,27 @@ type ParagraphAttrs = {
210
246
  before?: number | null;
211
247
  after?: number | null;
212
248
  };
213
- /** Full section properties for paragraphs that end a section.
214
- * Used by layout engine for per-section column/page config and round-trip. */
249
+ /**
250
+ * The section that ends at this paragraph's mark, and the whole of that
251
+ * state: the break type is a field of the record, derived through
252
+ * `sectionBreakTypeOf`, never a second attr beside it.
253
+ *
254
+ * The record is shared by reference, never cloned. Among the paragraphs
255
+ * holding one object the from-leg writes only the last, which is how a split
256
+ * paragraph's two halves stay one section.
257
+ */
215
258
  _sectionProperties?: document_d_exports.SectionProperties;
259
+ /**
260
+ * Attributes the authored `w:p` carried and the model has no field for
261
+ * (`w:rsidR` and its family), carried opaquely so an edit does not rewrite
262
+ * the document's revision history.
263
+ *
264
+ * The remainder follows the record. ProseMirror copies a node's attrs to
265
+ * both halves of a split, so `fromProseDoc` gives it to the first paragraph
266
+ * that carries it and to no other: a paragraph the editor created never had
267
+ * those attributes and must not inherit them from a neighbour.
268
+ */
269
+ _preservedAttributes?: document_d_exports.PreservedAttribute[];
216
270
  /** Paragraph-property-change tracking entries (`w:pPrChange`).
217
271
  * Preserved opaquely through ProseMirror — the editor does not surface
218
272
  * them in UI today, but stripping them on every edit would corrupt the
@@ -233,6 +287,20 @@ type ParagraphAttrs = {
233
287
  */
234
288
  _suggestedInsert?: SuggestedStructuralMarker | null;
235
289
  };
290
+ /**
291
+ * A partial write over a paragraph's attrs: every key carries its own attr
292
+ * type, or the attr's absent state. Which spelling that is belongs to the
293
+ * node spec's per-attr `default` (`null` for most, `undefined` for a few,
294
+ * `alignmentFromStyle` among them), so both are admitted here.
295
+ *
296
+ * Derived from {@link ParagraphAttrs} rather than hand-listed, so an attr
297
+ * added to the node spec is writable without a second edit, and a producer
298
+ * that assembles a patch is held to each attr's type. `numPr` is the reason
299
+ * it exists: a patch typed `Record<string, unknown>` can store a raw
300
+ * `ParagraphNumberingOverride` there, which is exactly what the
301
+ * {@link ParagraphNumberingAttr} brand makes impossible.
302
+ */
303
+ type ParagraphAttrsPatch = { [K in keyof ParagraphAttrs]?: ParagraphAttrs[K] | null | undefined; };
236
304
  /**
237
305
  * ProseMirror property-change attrs may also carry the editor's list-marker
238
306
  * snapshot fields alongside the canonical paragraph formatting fields.
@@ -245,7 +313,7 @@ type ParagraphPropertyChangeAttrs = Omit<document_d_exports.ParagraphPropertyCha
245
313
  suggestionId?: string | null;
246
314
  };
247
315
  previousFormatting?: Omit<document_d_exports.ParagraphFormatting, "numPr"> & {
248
- numPr?: document_d_exports.ParagraphFormatting["numPr"] | null;
316
+ numPr?: ParagraphAttrs["numPr"] | null;
249
317
  } & Partial<Pick<ParagraphAttrs, "listIsBullet" | "listIsLegal" | "listNumFmt" | "listMarker" | "listMarkerTemplate" | "listMarkerHidden" | "listMarkerFormatting" | "listMarkerAlignment" | "listMarkerSuffix" | "listMarkerAllCaps" | "listImplicitChildLevelAdvances" | "listMarkerSecondSlotOffsetTwips" | "listLevelNumFmts" | "listLevelStarts" | "listAbstractNumId" | "listStartOverride" | "lineSpacingExplicit" | "direction" | "_autospacingBase">>;
250
318
  currentFormatting?: document_d_exports.ParagraphFormatting;
251
319
  };
@@ -288,6 +356,20 @@ type TextBoxMarginAttr = "marginTop" | "marginBottom" | "marginLeft" | "marginRi
288
356
  */
289
357
  type ImageAttrs = {
290
358
  src: string;
359
+ /**
360
+ * How to draw a drawing that carries no image data, set instead of `src`.
361
+ *
362
+ * Carried on the attr rather than in a side table so an editor state is
363
+ * still self-contained: a state that loses the table would lose the picture.
364
+ * It is shape geometry in a serialized attr, which is a real cost in a
365
+ * collaboration update, but the descriptor is bounded by the shape cap and
366
+ * is three orders of magnitude smaller than the base64 raster this attr used
367
+ * to hold for the same drawing.
368
+ *
369
+ * A state saved before this existed carries the raster in `src` and still
370
+ * paints from it, so nothing stored needs migrating.
371
+ */
372
+ preview?: document_d_exports.PreviewDescriptor;
291
373
  docPrName?: string;
292
374
  alt?: string;
293
375
  title?: string;
@@ -302,13 +384,23 @@ type ImageAttrs = {
302
384
  displayMode?: "inline" | "float" | "block";
303
385
  /** CSS float direction for floating images */
304
386
  cssFloat?: "left" | "right" | "none";
305
- /** CSS transform string (rotation, flip) */
387
+ /** CSS transform string, derived from the authored transform below. */
306
388
  transform?: string;
389
+ /** Authored `a:xfrm@rot` in degrees; `null` when the drawing states none. */
390
+ docxRotation?: number | null;
391
+ /** Authored `a:xfrm@flipH`; `null` when the drawing states none. */
392
+ docxFlipH?: boolean | null;
393
+ /** Authored `a:xfrm@flipV`; `null` when the drawing states none. */
394
+ docxFlipV?: boolean | null;
307
395
  /**
308
396
  * Opacity in [0, 1] from `<a:alphaModFix amt>`. Undefined / 1 means fully
309
397
  * opaque (no CSS `opacity` emitted). eigenpal #424.
310
398
  */
311
399
  opacity?: number;
400
+ /** DrawingML `a:lum@bright` as a signed percentage in [-100, 100]. */
401
+ brightness?: number;
402
+ /** DrawingML `a:lum@contrast` as a signed percentage in [-100, 100]. */
403
+ contrast?: number;
312
404
  /** Distance from text above (pixels) */
313
405
  distTop?: number;
314
406
  /** Distance from text below (pixels) */
@@ -337,8 +429,22 @@ type ImageAttrs = {
337
429
  paddingLeft?: number;
338
430
  /** Position for floating images (horizontal and vertical alignment) */
339
431
  position?: ImagePositionAttrs;
340
- /** Use the containing table cell as the anchor's positioning scope (the OOXML default). */
341
- layoutInCell?: boolean;
432
+ /** `wp:anchor`'s own attributes, carried whole so a rebuild can restate them. */
433
+ anchor?: document_d_exports.DrawingAnchor;
434
+ /**
435
+ * Which element stated each wrap inset. The insets above are the value in
436
+ * force; this is the slot each was authored on, without which a rebuild
437
+ * collects them all onto the drawing.
438
+ */
439
+ wrapDistanceSlots?: document_d_exports.WrapDistanceSlots;
440
+ /**
441
+ * Which element stated a `wp:effectExtent`. The drawing's is the reservation
442
+ * in force; the wrap child's is the one the text flow is computed against,
443
+ * and without the slots a rebuild writes neither back where it was authored.
444
+ */
445
+ wrapEffectExtentSlots?: document_d_exports.EffectExtentSlots;
446
+ /** `wp:wrapPolygon` as authored, in the path's own units. */
447
+ wrapPolygon?: document_d_exports.ImageWrapPolygon;
342
448
  /**
343
449
  * The image carries no information, so assistive technology skips it
344
450
  * (`wp:docPr`'s decorative extension). Not {@link hidden}: a decorative
@@ -369,6 +475,19 @@ type ImageAttrs = {
369
475
  hlinkHref?: string;
370
476
  /** DOCX relationship ID for the clickable image hyperlink */
371
477
  hlinkRId?: string;
478
+ /**
479
+ * `a:hlinkClick` as the source wrote it, and `a:hlinkHover` beside it. The
480
+ * model has a field for the click target and none for the tooltip, the target
481
+ * frame or the history flag, so an edit that did not touch the link has to
482
+ * hand the element's own bytes back for the rebuild to replay.
483
+ */
484
+ hlinkClickSource?: document_d_exports.ImageDocPrLink;
485
+ hlinkHoverXml?: string;
486
+ /**
487
+ * `wp:docPr@id`, the drawing's own identity. Without it a rebuilt drawing is
488
+ * renumbered from the serializer's counter on every edit.
489
+ */
490
+ docPrId?: string;
372
491
  /** Original OOXML for opaque/unsupported DOCX drawings. */
373
492
  _docxRawXml?: string;
374
493
  /** Raw XML preserved without an editable image projection. */
@@ -447,10 +566,21 @@ type SdtAttrs = {
447
566
  dropdownLastValue?: string;
448
567
  /** Checkbox checked state */
449
568
  checked?: boolean;
450
- /** Captured `<w:sdtPr>…</w:sdtPr>` for round-trip replay. */
451
- rawPropertiesXml?: string;
569
+ /**
570
+ * The `w:sdtPr` children folio does not model, at their schema ordinal.
571
+ *
572
+ * The control keeps its own bytes through the editor the way a paragraph
573
+ * keeps its attribute remainder: the serializer merges them back with the
574
+ * modelled children in `CT_SdtPr` order.
575
+ */
576
+ _preserved?: document_d_exports.PreservedMarkup;
452
577
  /** Captured `<w:sdtEndPr>…</w:sdtEndPr>` for round-trip replay. */
453
578
  rawEndPropertiesXml?: string;
579
+ /**
580
+ * `w:sdtEndPr` as a record, for a control the editor rebuilds and which has
581
+ * no captured bytes left to replay. See `SdtProperties.endProperties`.
582
+ */
583
+ endProperties?: document_d_exports.SdtEndProperties;
454
584
  };
455
585
  /**
456
586
  * Block-level structured document tag node attributes. Mirrors `SdtAttrs`
@@ -480,10 +610,18 @@ type BlockSdtAttrs = {
480
610
  * uses this flag to drop the filler instead of guessing from shape.
481
611
  */
482
612
  _originallyEmpty?: boolean;
483
- /** Captured `<w:sdtPr>…</w:sdtPr>` for round-trip replay. */
484
- rawPropertiesXml?: string;
613
+ /**
614
+ * The `w:sdtPr` children folio does not model, at their schema ordinal.
615
+ *
616
+ * The control keeps its own bytes through the editor the way a paragraph
617
+ * keeps its attribute remainder: the serializer merges them back with the
618
+ * modelled children in `CT_SdtPr` order.
619
+ */
620
+ _preserved?: document_d_exports.PreservedMarkup;
485
621
  /** Captured `<w:sdtEndPr>…</w:sdtEndPr>` for round-trip replay. */
486
622
  rawEndPropertiesXml?: string;
623
+ /** `w:sdtEndPr` as a record; see `SdtAttrs.endProperties`. */
624
+ endProperties?: document_d_exports.SdtEndProperties;
487
625
  /** Verbatim XML for sdt siblings before sdtContent (range markers). */
488
626
  rawSdtChildrenBeforeContent?: string;
489
627
  /** Verbatim XML for sdt siblings after sdtContent (range markers). */
@@ -537,8 +675,14 @@ type ShapeAttrs = {
537
675
  outlineHeadEnd?: NonNullable<document_d_exports.ShapeOutline["headEnd"]>;
538
676
  /** Tail arrow/end marker */
539
677
  outlineTailEnd?: NonNullable<document_d_exports.ShapeOutline["tailEnd"]>;
540
- /** CSS transform */
678
+ /** CSS transform, derived from the authored transform below. */
541
679
  transform?: string;
680
+ /** Authored `a:xfrm@rot` in degrees; `null` when the drawing states none. */
681
+ docxRotation?: number | null;
682
+ /** Authored `a:xfrm@flipH`; `null` when the drawing states none. */
683
+ docxFlipH?: boolean | null;
684
+ /** Authored `a:xfrm@flipV`; `null` when the drawing states none. */
685
+ docxFlipV?: boolean | null;
542
686
  /** Display mode */
543
687
  displayMode?: "inline" | "float" | "block";
544
688
  /** CSS float */
@@ -557,6 +701,22 @@ type ShapeAttrs = {
557
701
  distRight?: number;
558
702
  /** Position for floating shapes (horizontal and vertical alignment) */
559
703
  position?: ImagePositionAttrs;
704
+ /** `wp:anchor`'s own attributes, carried whole so a rebuild can restate them. */
705
+ anchor?: document_d_exports.DrawingAnchor;
706
+ /**
707
+ * Which element stated each wrap inset. The insets above are the value in
708
+ * force; this is the slot each was authored on, without which a rebuild
709
+ * collects them all onto the drawing.
710
+ */
711
+ wrapDistanceSlots?: document_d_exports.WrapDistanceSlots;
712
+ /**
713
+ * Which element stated a `wp:effectExtent`. The drawing's is the reservation
714
+ * in force; the wrap child's is the one the text flow is computed against,
715
+ * and without the slots a rebuild writes neither back where it was authored.
716
+ */
717
+ wrapEffectExtentSlots?: document_d_exports.EffectExtentSlots;
718
+ /** `wp:wrapPolygon` as authored, in the path's own units. */
719
+ wrapPolygon?: document_d_exports.ImageWrapPolygon;
560
720
  /** Shadow color as CSS color */
561
721
  shadowColor?: string;
562
722
  /** Shadow blur radius in pixels */
@@ -618,6 +778,12 @@ type TextBoxAttrs = {
618
778
  outlineStyle?: OutlineStyleAttr;
619
779
  /** DrawingML rotation and/or flips, serialized as CSS transform functions. */
620
780
  transform?: string;
781
+ /** Authored `a:xfrm@rot` in degrees; `null` when the drawing states none. */
782
+ docxRotation?: number | null;
783
+ /** Authored `a:xfrm@flipH`; `null` when the drawing states none. */
784
+ docxFlipH?: boolean | null;
785
+ /** Authored `a:xfrm@flipV`; `null` when the drawing states none. */
786
+ docxFlipV?: boolean | null;
621
787
  /** Internal margin top in pixels */
622
788
  marginTop?: number;
623
789
  /** Internal margin bottom in pixels */
@@ -646,6 +812,22 @@ type TextBoxAttrs = {
646
812
  distRight?: number;
647
813
  /** Position for floating/anchored text boxes */
648
814
  position?: ImagePositionAttrs;
815
+ /** `wp:anchor`'s own attributes, carried whole so a rebuild can restate them. */
816
+ anchor?: document_d_exports.DrawingAnchor;
817
+ /**
818
+ * Which element stated each wrap inset. The insets above are the value in
819
+ * force; this is the slot each was authored on, without which a rebuild
820
+ * collects them all onto the drawing.
821
+ */
822
+ wrapDistanceSlots?: document_d_exports.WrapDistanceSlots;
823
+ /**
824
+ * Which element stated a `wp:effectExtent`. The drawing's is the reservation
825
+ * in force; the wrap child's is the one the text flow is computed against,
826
+ * and without the slots a rebuild writes neither back where it was authored.
827
+ */
828
+ wrapEffectExtentSlots?: document_d_exports.EffectExtentSlots;
829
+ /** `wp:wrapPolygon` as authored, in the path's own units. */
830
+ wrapPolygon?: document_d_exports.ImageWrapPolygon;
649
831
  /** Original DOCX placement hint for save-path reconstruction. */
650
832
  _docxPlacement?: "standalone" | "inlineWithPrevious";
651
833
  /** Original DOCX paragraph group for standalone text-box reconstruction. */
@@ -674,6 +856,17 @@ type TextBoxAttrs = {
674
856
  };
675
857
  /** Original inline content-control ancestry for save-path reconstruction. */
676
858
  _docxInlineSdts?: SdtAttrs[];
859
+ /**
860
+ * The attribute remainder of the `w:p` this node was lifted out of.
861
+ *
862
+ * A paragraph whose only content was an anchored drawing has no paragraph
863
+ * node in the editor: this node stands in for it, so it carries the host's
864
+ * remainder the way `ParagraphAttrs._preservedAttributes` carries a
865
+ * paragraph's own. Only a `"standalone"` placement has a host to speak for;
866
+ * an `"inlineWithPrevious"` text box sits in a paragraph that is projected
867
+ * itself and keeps its own.
868
+ */
869
+ _preservedAttributes?: document_d_exports.PreservedAttribute[];
677
870
  };
678
871
  /** Internal inline position marker for an extracted text box block. */
679
872
  type TextBoxAnchorAttrs = {
@@ -689,8 +882,8 @@ type TableAttrs = {
689
882
  width?: number;
690
883
  /** Table width type ('auto', 'pct', 'dxa') */
691
884
  widthType?: document_d_exports.TableWidthType;
692
- /** Table justification/alignment */
693
- justification?: "left" | "center" | "right";
885
+ /** Table placement (`w:tblPr/w:jc`) */
886
+ justification?: NonNullable<document_d_exports.TableFormatting["justification"]>;
694
887
  /** Column widths (in twips) from w:tblGrid */
695
888
  columnWidths?: number[];
696
889
  /** Floating table properties (w:tblpPr) */
@@ -723,6 +916,27 @@ type TableAttrs = {
723
916
  _originalFormatting?: document_d_exports.TableFormatting;
724
917
  /** Tracked table property changes (w:tblPrChange) for round-trip + accept/reject */
725
918
  tblPrChange?: document_d_exports.TablePropertyChange[];
919
+ /**
920
+ * Bookmark markers the authored element held beside its own children, with
921
+ * the position each was read at.
922
+ *
923
+ * There is no node for a boundary between two rows or two cells — a row's
924
+ * children are cells — so the markers ride the record by reference, the way
925
+ * `_preservedAttributes` does and for the same reason: a copy the editor
926
+ * made shares the array, an authored record holds its own, and only the
927
+ * first in document order keeps it.
928
+ */
929
+ _bookmarks?: document_d_exports.PositionedBookmarkMarker[];
930
+ /**
931
+ * Markup the authored `w:tbl` carried beside its rows — a bookmark or
932
+ * permission boundary, a proofing error, a custom-XML revision range —
933
+ * with the row count that places it back between the same two rows.
934
+ *
935
+ * Carried by reference for the reason `_preservedAttributes` is: the sink
936
+ * follows the record it was authored on, so a table the editor created has
937
+ * none and a copy does not inherit one.
938
+ */
939
+ _preserved?: document_d_exports.TablePreservedMarkup;
726
940
  /**
727
941
  * Marks this whole table as a *suggested* insertion (AI proposal). The table
728
942
  * is dropped from serialized DOCX until accepted; because OOXML has no tracked
@@ -746,8 +960,51 @@ type TableRowAttrs = {
746
960
  _resolvedJustification?: NonNullable<document_d_exports.TableRowFormatting["justification"]>;
747
961
  /** Original row formatting from DOCX for lossless round-trip serialization */
748
962
  _originalFormatting?: document_d_exports.TableRowFormatting;
963
+ /**
964
+ * The table properties the authored row overrides (`w:tblPrEx`), carried
965
+ * whole for the reason `_originalFormatting` is: the editor surfaces none of
966
+ * them, and rebuilding the element from the handful of attrs it does surface
967
+ * would drop the rest.
968
+ */
969
+ _tablePropertyExceptions?: document_d_exports.TablePropertyExceptionFormatting;
749
970
  /** Tracked row property changes (w:trPrChange) for round-trip + accept/reject */
750
971
  trPrChange?: document_d_exports.TableRowPropertyChange[];
972
+ /** Tracked changes to the property exceptions (w:tblPrExChange), carried opaquely */
973
+ tblPrExChange?: document_d_exports.TablePropertyExceptionChange[];
974
+ /**
975
+ * Attributes the authored `w:tr` carried and the model has no field for
976
+ * (`w:rsidR`, `w:rsidDel`, `w:rsidTr`, `w:rsidRPr`), carried opaquely for
977
+ * the reason `ParagraphAttrs._preservedAttributes` gives.
978
+ */
979
+ _preservedAttributes?: document_d_exports.PreservedAttribute[];
980
+ /**
981
+ * Bookmark markers the authored element held beside its own children, with
982
+ * the position each was read at.
983
+ *
984
+ * There is no node for a boundary between two rows or two cells — a row's
985
+ * children are cells — so the markers ride the record by reference, the way
986
+ * `_preservedAttributes` does and for the same reason: a copy the editor
987
+ * made shares the array, an authored record holds its own, and only the
988
+ * first in document order keeps it.
989
+ */
990
+ _bookmarks?: document_d_exports.PositionedBookmarkMarker[];
991
+ /**
992
+ * The row-level content controls (`CT_SdtRow`) this row sits inside,
993
+ * outermost first.
994
+ *
995
+ * The record travels on the row because a table's children are rows and
996
+ * ProseMirror has no node to spare for a wrapper that is not one. Splitting
997
+ * or moving a row takes its controls with it, which an index between rows
998
+ * would not; the save re-opens one wrapper per run of consecutive rows that
999
+ * name the same control. See `TableRow.contentControls`.
1000
+ */
1001
+ contentControls?: document_d_exports.SdtProperties[];
1002
+ /**
1003
+ * Markup the authored `w:tr` carried beside its cells, with the cell count
1004
+ * that places it back between the same two cells. Follows the record the
1005
+ * same way `TableAttrs._preserved` does.
1006
+ */
1007
+ _preserved?: document_d_exports.TablePreservedMarkup;
751
1008
  } & ({
752
1009
  /**
753
1010
  * Tracked structural row insertion (w:trPr/w:ins). A `"suggested"`
@@ -803,12 +1060,33 @@ type TableCellAttrs = {
803
1060
  colspan: number;
804
1061
  /** Row span */
805
1062
  rowspan: number;
1063
+ /**
1064
+ * A non-authored cell which occupies a `w:gridBefore` or `w:gridAfter`
1065
+ * slot so ProseMirror can retain a rectangular table map. It is invisible
1066
+ * in the editor and omitted when projecting back to OOXML.
1067
+ */
1068
+ _omittedGridSlot?: "before" | "after";
806
1069
  /** Column widths for prosemirror-tables resizing (array of pixel widths) */
807
1070
  colwidth?: number[] | null;
808
1071
  /** Cell width (in twips) */
809
1072
  width?: number;
810
1073
  /** Cell width type */
811
1074
  widthType?: document_d_exports.TableWidthType;
1075
+ /**
1076
+ * The preferred width the cell itself states, absent when it states none.
1077
+ *
1078
+ * `width` is the width the cell *renders* at, which the table resolves from
1079
+ * its grid when the cell declares no `w:tcW`, so a save that read it would
1080
+ * give every cell in the document a preferred width its author never wrote.
1081
+ * The companion to `width` that `_resolvedBorders` is to `borders`, and the
1082
+ * one the save leg writes `w:tcW` from. A command that moves a cell's width
1083
+ * states one: `mergeTableCellAttrs` records it for every command that goes
1084
+ * through it.
1085
+ */
1086
+ _authoredWidth?: {
1087
+ value: number;
1088
+ type: document_d_exports.TableWidthType;
1089
+ };
812
1090
  /** Vertical alignment */
813
1091
  verticalAlign?: "top" | "center" | "bottom";
814
1092
  /** Background color (RGB hex) */
@@ -879,10 +1157,15 @@ type TableCellAttrs = {
879
1157
  verticalMerge?: "continue" | "rest";
880
1158
  verticalMergeOriginal?: "continue" | "rest";
881
1159
  };
1160
+ /**
1161
+ * The cell-level content controls (`CT_SdtCell`) this cell sits inside,
1162
+ * outermost first. The row's twin, one level down.
1163
+ */
1164
+ contentControls?: document_d_exports.SdtProperties[];
882
1165
  /** Preserve a DOCX vMerge restart even when PM cannot model it as a rowspan. */
883
1166
  _preserveVMergeRestart?: boolean;
884
1167
  /** Original DOCX vMerge continuation cells skipped into this PM rowspan. */
885
1168
  _docxVMergeContinuationCells?: unknown;
886
1169
  };
887
1170
  //#endregion
888
- export { AuthoredEmuAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PageBreakRunAttrs, ParagraphAttrs, ParagraphPropertyChangeAttrs, SdtAttrs, ShapeAttrs, SuggestedStructuralMarker, SymbolAttrs, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs, TextBoxTextBodyContentState };
1171
+ export { AuthoredEmuAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, CommentReferenceAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PRESERVED_XML_LEVELS, PageBreakRunAttrs, ParagraphAttrs, ParagraphAttrsPatch, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SuggestedStructuralMarker, SymbolAttrs, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs, TextBoxTextBodyContentState };
@@ -1,7 +1,22 @@
1
1
  //#region src/prosemirror/schema/nodes.ts
2
+ /** A run child folio does not model, carried through the editor untouched. */
3
+ /**
4
+ * Which container the captured markup came out of, and goes back into.
5
+ *
6
+ * `w:ruby` is a run child and has to be written back inside a `w:r`;
7
+ * `w:permStart` is a paragraph child and the schema admits none inside a run,
8
+ * so writing one there would produce a package Word repairs. One atom serves
9
+ * both because the editor treats them identically — opaque, zero-width unless
10
+ * the markup shows text, carrying whatever marks surround it — and only the
11
+ * save path has to tell them apart.
12
+ */
13
+ const PRESERVED_XML_LEVELS = {
14
+ run: "run",
15
+ inline: "inline"
16
+ };
2
17
  /**
3
18
  * Text box node attributes
4
19
  */
5
20
  const TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES = Object.freeze(["source-empty", "authored"]);
6
21
  //#endregion
7
- export { TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES };
22
+ export { PRESERVED_XML_LEVELS, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES };