@stll/folio-core 0.11.0 → 0.13.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 (263) hide show
  1. package/dist/ai-edits/apply.d.ts +2 -1
  2. package/dist/ai-edits/apply.js +693 -63
  3. package/dist/ai-edits/block-identity.d.ts +4 -0
  4. package/dist/ai-edits/block-identity.js +9 -0
  5. package/dist/ai-edits/blockRange.d.ts +28 -1
  6. package/dist/ai-edits/blockRange.js +68 -2
  7. package/dist/ai-edits/clean-text.js +2 -1
  8. package/dist/ai-edits/headless.d.ts +4 -4
  9. package/dist/ai-edits/headless.js +9 -9
  10. package/dist/ai-edits/index.d.ts +2 -2
  11. package/dist/ai-edits/index.js +2 -2
  12. package/dist/ai-edits/read.d.ts +7 -7
  13. package/dist/ai-edits/read.js +110 -3
  14. package/dist/ai-edits/snapshot.js +21 -3
  15. package/dist/ai-edits/table-cell-mutations.d.ts +48 -0
  16. package/dist/ai-edits/table-cell-mutations.js +238 -0
  17. package/dist/ai-edits/table-mutation-plan.d.ts +38 -0
  18. package/dist/ai-edits/table-mutation-plan.js +90 -0
  19. package/dist/ai-edits/table-row-column-mutations.d.ts +108 -0
  20. package/dist/ai-edits/table-row-column-mutations.js +300 -0
  21. package/dist/ai-edits/table-targets.d.ts +32 -0
  22. package/dist/ai-edits/table-targets.js +70 -0
  23. package/dist/ai-edits/types.d.ts +62 -1
  24. package/dist/ai-edits/word-diff.js +21 -0
  25. package/dist/compat/eigenpal.d.ts +3 -3
  26. package/dist/compat/eigenpal.js +3 -3
  27. package/dist/content-controls/mutateContentControls.js +1 -1
  28. package/dist/controller/activeEditorStory.d.ts +36 -0
  29. package/dist/controller/activeEditorStory.js +30 -0
  30. package/dist/controller/contentControlWidgetController.d.ts +55 -0
  31. package/dist/controller/contentControlWidgetController.js +141 -0
  32. package/dist/controller/fontReadiness.js +2 -0
  33. package/dist/controller/headerFooterEditorManager.js +2 -2
  34. package/dist/controller/hiddenEditorApi.js +2 -2
  35. package/dist/controller/hiddenEditorManager.d.ts +12 -1
  36. package/dist/controller/hiddenEditorManager.js +44 -12
  37. package/dist/controller/layoutPipeline.d.ts +2 -0
  38. package/dist/controller/layoutPipeline.js +17 -2
  39. package/dist/controller/noteEditorManager.d.ts +36 -0
  40. package/dist/controller/noteEditorManager.js +210 -0
  41. package/dist/document-operations.d.ts +43 -11
  42. package/dist/document-operations.js +186 -18
  43. package/dist/docx/blockContentParser.js +21 -7
  44. package/dist/docx/commentParser.js +6 -1
  45. package/dist/docx/commentRangeIntegrity.d.ts +6 -0
  46. package/dist/docx/commentRangeIntegrity.js +186 -0
  47. package/dist/docx/conformance.js +62 -1
  48. package/dist/docx/documentGrid.d.ts +8 -0
  49. package/dist/docx/documentGrid.js +8 -0
  50. package/dist/docx/drawingUtils.js +1 -1
  51. package/dist/docx/encryption/agileDecryption.js +12 -2
  52. package/dist/docx/encryption/compoundFile.js +6 -1
  53. package/dist/docx/encryption/encryptionInfo.d.ts +9 -1
  54. package/dist/docx/encryption/encryptionInfo.js +18 -2
  55. package/dist/docx/encryption/openEncryptedDocx.js +1 -1
  56. package/dist/docx/ensureParaIds.js +8 -7
  57. package/dist/docx/fieldParser.js +1 -1
  58. package/dist/docx/groupDrawingParser.js +10 -5
  59. package/dist/docx/hyperlinkParser.js +1 -1
  60. package/dist/docx/imageParser.js +10 -6
  61. package/dist/docx/metadataPrivacy.js +17 -3
  62. package/dist/docx/notePropertiesParser.js +1 -1
  63. package/dist/docx/numberingParser.js +1 -1
  64. package/dist/docx/paragraphParser.js +70 -61
  65. package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
  66. package/dist/docx/paragraphTextBoxEnrichment.js +67 -13
  67. package/dist/docx/paragraphTraversal.js +1 -1
  68. package/dist/docx/parser.js +3 -3
  69. package/dist/docx/rezip.js +20 -9
  70. package/dist/docx/runParser.js +17 -6
  71. package/dist/docx/sdtProperties.js +1 -1
  72. package/dist/docx/sectionParser.js +18 -5
  73. package/dist/docx/selectiveSave.js +5 -1
  74. package/dist/docx/selectiveXmlPatch.d.ts +22 -1
  75. package/dist/docx/selectiveXmlPatch.js +61 -1
  76. package/dist/docx/serializer/blockSdtSerializer.js +3 -2
  77. package/dist/docx/serializer/commentSerializer.js +5 -6
  78. package/dist/docx/serializer/documentSerializer.js +2 -2
  79. package/dist/docx/serializer/headerFooterSerializer.js +2 -2
  80. package/dist/docx/serializer/noteSerializer.js +2 -2
  81. package/dist/docx/serializer/paragraphSerializer.js +23 -15
  82. package/dist/docx/serializer/runSerializer.js +25 -21
  83. package/dist/docx/serializer/sectionPropertiesSerializer.js +2 -1
  84. package/dist/docx/serializer/stylesSerializer.js +1 -1
  85. package/dist/docx/serializer/tableSerializer.d.ts +5 -4
  86. package/dist/docx/serializer/tableSerializer.js +26 -20
  87. package/dist/docx/serializer/xmlUtils.d.ts +13 -1
  88. package/dist/docx/serializer/xmlUtils.js +27 -1
  89. package/dist/docx/server/applyDocxXmlPatchProposal.d.ts +87 -0
  90. package/dist/docx/server/applyDocxXmlPatchProposal.js +204 -0
  91. package/dist/docx/server/boundedArchive.d.ts +14 -3
  92. package/dist/docx/server/boundedArchive.js +56 -11
  93. package/dist/docx/server/evaluateDocxXmlPatchProposal.d.ts +85 -0
  94. package/dist/docx/server/evaluateDocxXmlPatchProposal.js +361 -0
  95. package/dist/docx/server/extractDocxText.js +55 -8
  96. package/dist/docx/server/inspectDocxPackage.d.ts +70 -0
  97. package/dist/docx/server/inspectDocxPackage.js +217 -0
  98. package/dist/docx/server/validateDocxConformance.d.ts +41 -0
  99. package/dist/docx/server/validateDocxConformance.js +336 -0
  100. package/dist/docx/settingsParser.js +26 -3
  101. package/dist/docx/shapeParser.js +1 -1
  102. package/dist/docx/styleParser.js +4 -2
  103. package/dist/docx/tableParser.d.ts +8 -1
  104. package/dist/docx/tableParser.js +31 -10
  105. package/dist/docx/textBoxParser.d.ts +3 -3
  106. package/dist/docx/textBoxParser.js +16 -12
  107. package/dist/docx/unzip.js +1 -0
  108. package/dist/docx/vmlImageParser.js +11 -3
  109. package/dist/docx/xmlParser.js +11 -1
  110. package/dist/docx/xmlSafety.d.ts +5 -0
  111. package/dist/docx/xmlSafety.js +9 -0
  112. package/dist/fields/resolveFieldValues.js +1 -3
  113. package/dist/fonts/embeddedFonts.d.ts +33 -5
  114. package/dist/fonts/embeddedFonts.js +37 -8
  115. package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
  116. package/dist/i18n/messages/catalogs.gen.js +17 -0
  117. package/dist/i18n/messages/messages.gen.d.ts +1 -0
  118. package/dist/index.d.ts +3 -3
  119. package/dist/index.js +3 -3
  120. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  121. package/dist/layout-bridge/convert/footnoteLayout.js +47 -40
  122. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  123. package/dist/layout-bridge/convert/headerFooterLayout.js +3 -0
  124. package/dist/layout-bridge/convert/templatePreviewFlow.js +3 -3
  125. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +4 -2
  126. package/dist/layout-bridge/convert/toFlowBlocks.js +151 -20
  127. package/dist/layout-bridge/dom/noteStoryDom.d.ts +6 -0
  128. package/dist/layout-bridge/dom/noteStoryDom.js +17 -0
  129. package/dist/layout-bridge/engine/clickToPosition.js +2 -2
  130. package/dist/layout-engine/index.d.ts +2 -2
  131. package/dist/layout-engine/index.js +58 -30
  132. package/dist/layout-engine/justificationCompatibility.d.ts +6 -0
  133. package/dist/layout-engine/justificationCompatibility.js +8 -0
  134. package/dist/layout-engine/keep-together.js +11 -1
  135. package/dist/layout-engine/measure/cache.js +23 -5
  136. package/dist/layout-engine/measure/effectiveLineBreakPolicy.js +8 -2
  137. package/dist/layout-engine/measure/lineBreakProvider.d.ts +2 -2
  138. package/dist/layout-engine/measure/lineBreakProvider.js +56 -37
  139. package/dist/layout-engine/measure/measureBlocks.js +15 -4
  140. package/dist/layout-engine/measure/measureContainer.js +1 -1
  141. package/dist/layout-engine/measure/measureHelpers.d.ts +11 -2
  142. package/dist/layout-engine/measure/measureHelpers.js +15 -4
  143. package/dist/layout-engine/measure/measureParagraph.js +85 -25
  144. package/dist/layout-engine/measure/measureProvider.js +4 -3
  145. package/dist/layout-engine/measure/tableCellFlow.js +5 -2
  146. package/dist/layout-engine/measure/textBoxParagraphLayout.d.ts +9 -7
  147. package/dist/layout-engine/measure/textBoxParagraphLayout.js +22 -6
  148. package/dist/layout-engine/measure/textMeasurementPolicy.d.ts +3 -1
  149. package/dist/layout-engine/measure/textMeasurementPolicy.js +7 -1
  150. package/dist/layout-engine/paginator.js +5 -1
  151. package/dist/layout-engine/paragraphSpacing.d.ts +28 -4
  152. package/dist/layout-engine/paragraphSpacing.js +107 -13
  153. package/dist/layout-engine/renderedBreakReconciliation.js +1 -1
  154. package/dist/layout-engine/types.d.ts +48 -15
  155. package/dist/layout-painter/registry/modules/textBox.js +5 -1
  156. package/dist/layout-painter/renderImage.d.ts +12 -1
  157. package/dist/layout-painter/renderImage.js +21 -4
  158. package/dist/layout-painter/renderPage.d.ts +5 -2
  159. package/dist/layout-painter/renderPage.js +59 -14
  160. package/dist/layout-painter/renderParagraph.js +55 -15
  161. package/dist/layout-painter/renderTable.d.ts +5 -1
  162. package/dist/layout-painter/renderTable.js +7 -3
  163. package/dist/layout-painter/renderTextBox.d.ts +2 -1
  164. package/dist/layout-painter/renderTextBox.js +25 -14
  165. package/dist/layout-painter/renderWatermark.d.ts +1 -1
  166. package/dist/layout-painter/renderWatermark.js +2 -1
  167. package/dist/managers/DocumentLoaderManager.js +1 -1
  168. package/dist/markdown/fromMarkdown.js +1 -1
  169. package/dist/model.js +1 -1
  170. package/dist/prosemirror/attrs/index.d.ts +4 -2
  171. package/dist/prosemirror/attrs/index.js +175 -18
  172. package/dist/prosemirror/commands/comments.d.ts +79 -4
  173. package/dist/prosemirror/commands/comments.js +622 -13
  174. package/dist/prosemirror/commands/contentControls.js +1 -1
  175. package/dist/prosemirror/commands/hyperlink.js +15 -1
  176. package/dist/prosemirror/commands/image.js +7 -1
  177. package/dist/prosemirror/commands/index.d.ts +2 -2
  178. package/dist/prosemirror/commands/index.js +2 -2
  179. package/dist/prosemirror/commands/pageBreak.js +1 -1
  180. package/dist/prosemirror/commands/propertyChangeScope.d.ts +2 -2
  181. package/dist/prosemirror/commands/propertyChangeScope.js +3 -2
  182. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +9 -0
  183. package/dist/prosemirror/commands/tableCellMergeResolution.js +181 -0
  184. package/dist/prosemirror/commentIdAllocator.js +13 -3
  185. package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -1
  186. package/dist/prosemirror/conversion/fromProseDoc.js +404 -62
  187. package/dist/prosemirror/conversion/index.js +1 -1
  188. package/dist/prosemirror/conversion/sdtAttrs.d.ts +9 -0
  189. package/dist/prosemirror/conversion/sdtAttrs.js +49 -0
  190. package/dist/prosemirror/conversion/toProseDoc.d.ts +2 -1
  191. package/dist/prosemirror/conversion/toProseDoc.js +364 -103
  192. package/dist/prosemirror/extensions/ExtensionManager.js +1 -1
  193. package/dist/prosemirror/extensions/StarterKit.js +6 -1
  194. package/dist/prosemirror/extensions/core/ParagraphExtension.js +6 -2
  195. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -0
  196. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +10 -2
  197. package/dist/prosemirror/extensions/features/ListExtension.js +1 -1
  198. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +10 -1
  199. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +93 -2
  200. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +2 -1
  201. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +6 -2
  202. package/dist/prosemirror/extensions/features/pasteCleanup.js +15 -2
  203. package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.js +1 -1
  204. package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +30 -4
  205. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +9 -1
  206. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +70 -11
  207. package/dist/prosemirror/extensions/nodes/FieldExtension.js +1 -1
  208. package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +7 -0
  209. package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.js +22 -0
  210. package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
  211. package/dist/prosemirror/extensions/nodes/TableExtension.js +14 -6
  212. package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +13 -0
  213. package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.js +41 -0
  214. package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +5 -2
  215. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -1
  216. package/dist/prosemirror/index.d.ts +1 -1
  217. package/dist/prosemirror/index.js +1 -1
  218. package/dist/prosemirror/plugins/contentControlWidgets.d.ts +36 -10
  219. package/dist/prosemirror/plugins/contentControlWidgets.js +128 -94
  220. package/dist/prosemirror/plugins/revisionIds.d.ts +23 -0
  221. package/dist/prosemirror/plugins/revisionIds.js +57 -0
  222. package/dist/prosemirror/plugins/selectionTracker.js +1 -0
  223. package/dist/prosemirror/plugins/suggestionMode.js +5 -4
  224. package/dist/prosemirror/runFormattingMarkNames.d.ts +14 -0
  225. package/dist/prosemirror/runFormattingMarkNames.js +40 -0
  226. package/dist/prosemirror/schema/index.d.ts +2 -2
  227. package/dist/prosemirror/schema/marks.d.ts +30 -3
  228. package/dist/prosemirror/schema/marks.js +15 -0
  229. package/dist/prosemirror/schema/nodes.d.ts +111 -6
  230. package/dist/prosemirror/selectionState.js +1 -0
  231. package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
  232. package/dist/prosemirror/tableCellMergeRevision.d.ts +9 -0
  233. package/dist/prosemirror/tableCellMergeRevision.js +22 -0
  234. package/dist/prosemirror/textBoxAnchorAttrs.d.ts +9 -0
  235. package/dist/prosemirror/textBoxAnchorAttrs.js +33 -0
  236. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +1 -1
  237. package/dist/prosemirror/utils/extractTrackedChanges.js +62 -14
  238. package/dist/prosemirror/validation.js +9 -1
  239. package/dist/render-dom/RemoteSelectionOverlay.js +2 -2
  240. package/dist/server.d.ts +7 -3
  241. package/dist/server.js +7 -3
  242. package/dist/utils/clipboard.d.ts +10 -1
  243. package/dist/utils/clipboard.js +33 -6
  244. package/dist/utils/colorResolver.d.ts +8 -1
  245. package/dist/utils/colorResolver.js +35 -5
  246. package/dist/utils/fontFamilyMerge.js +9 -11
  247. package/dist/utils/fontLoader.js +3 -2
  248. package/dist/utils/fontResolver.d.ts +2 -1
  249. package/dist/utils/fontResolver.js +31 -7
  250. package/dist/utils/fontWeights.d.ts +1 -1
  251. package/dist/utils/fontWeights.js +1 -1
  252. package/dist/utils/hexId.d.ts +11 -1
  253. package/dist/utils/hexId.js +11 -1
  254. package/dist/utils/paragraphFormattingMerge.js +1 -0
  255. package/dist/utils/sanitizeImageSrc.d.ts +21 -0
  256. package/dist/utils/sanitizeImageSrc.js +30 -0
  257. package/dist/utils/stripXmlDeclarations.d.ts +11 -0
  258. package/dist/utils/stripXmlDeclarations.js +35 -0
  259. package/dist/version-comparison.d.ts +22 -2
  260. package/dist/version-comparison.js +41 -12
  261. package/dist/watermark/index.d.ts +11 -1
  262. package/dist/watermark/index.js +22 -1
  263. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
+ import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
1
2
  import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "../schema/nodes.js";
2
- import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
3
3
  import { Mark, Node } from "prosemirror-model";
4
4
 
5
5
  //#region src/prosemirror/attrs/index.d.ts
@@ -68,6 +68,8 @@ declare const readCommentMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<C
68
68
  declare const expectCommentMarkAttrs: (mark: Mark) => CommentAttrs;
69
69
  declare const readTrackedChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<TrackedChangeMarkAttrs>;
70
70
  declare const expectTrackedChangeMarkAttrs: (mark: Mark) => TrackedChangeMarkAttrs;
71
+ declare const readRunPropertyChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunPropertyChangeMarkAttrs>;
72
+ declare const expectRunPropertyChangeMarkAttrs: (mark: Mark) => RunPropertyChangeMarkAttrs;
71
73
  declare const readRunFormattingOverrideMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunFormattingOverrideAttrs>;
72
74
  declare const expectRunFormattingOverrideMarkAttrs: (mark: Mark) => RunFormattingOverrideAttrs;
73
75
  declare const readHyperlinkMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<HyperlinkAttrs>;
@@ -79,4 +81,4 @@ declare const mergeTableAttrs: (node: Node, patch: NodeAttrPatch<TableAttrs>) =>
79
81
  declare const mergeTableRowAttrs: (node: Node, patch: NodeAttrPatch<TableRowAttrs>) => TableRowAttrs;
80
82
  declare const mergeTableCellAttrs: (node: Node, patch: NodeAttrPatch<TableCellAttrs>) => TableCellAttrs;
81
83
  //#endregion
82
- export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
84
+ export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
@@ -1,5 +1,6 @@
1
1
  import { FIELD_TYPE_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LINE_SPACING_RULE_VALUES, OUTLINE_STYLE_ATTR_VALUES, PARAGRAPH_ALIGNMENT_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES } from "../../types/documentEnumValues.js";
2
2
  import { isParagraphDirection } from "../paragraphDirection.js";
3
+ import { TRACKED_CHANGE_PROVENANCE_VALUES } from "../schema/marks.js";
3
4
  import { panic } from "better-result";
4
5
  //#region src/prosemirror/attrs/index.ts
5
6
  const SECTION_BREAK_TYPES = [
@@ -67,6 +68,12 @@ const NOTE_TYPES = ["footnote", "endnote"];
67
68
  const NOTE_REF_VERT_ALIGNS = ["baseline", "superscript"];
68
69
  const TEXT_BOX_DOCX_PLACEMENTS = ["standalone", "inlineWithPrevious"];
69
70
  const TRACKED_CHANGE_MOVE_KINDS = ["moveTo", "moveFrom"];
71
+ const TEXT_BOX_TRACKED_CHANGE_TYPES = [
72
+ "insertion",
73
+ "deletion",
74
+ "moveFrom",
75
+ "moveTo"
76
+ ];
70
77
  const HARD_BREAK_TYPES = ["column"];
71
78
  const RUN_FORMATTING_OVERRIDE_FALSE_KEYS = [
72
79
  "bold",
@@ -136,6 +143,7 @@ const textEffectAttrsCache = /* @__PURE__ */ new WeakMap();
136
143
  const footnoteRefAttrsCache = /* @__PURE__ */ new WeakMap();
137
144
  const commentAttrsCache = /* @__PURE__ */ new WeakMap();
138
145
  const trackedChangeAttrsCache = /* @__PURE__ */ new WeakMap();
146
+ const runPropertyChangeAttrsCache = /* @__PURE__ */ new WeakMap();
139
147
  const runFormattingOverrideAttrsCache = /* @__PURE__ */ new WeakMap();
140
148
  const hyperlinkAttrsCache = /* @__PURE__ */ new WeakMap();
141
149
  const readParagraphAttrs = (node) => {
@@ -152,6 +160,7 @@ const readParagraphAttrs = (node) => {
152
160
  optionalNumber(attrs, "spaceBefore", "paragraph.attrs.spaceBefore", issues);
153
161
  optionalNumber(attrs, "spaceAfter", "paragraph.attrs.spaceAfter", issues);
154
162
  optionalNumber(attrs, "lineSpacing", "paragraph.attrs.lineSpacing", issues);
163
+ optionalBoolean(attrs, "snapToGrid", "paragraph.attrs.snapToGrid", issues);
155
164
  optionalOneOf(attrs, "lineSpacingRule", "paragraph.attrs.lineSpacingRule", issues, LINE_SPACING_RULE_VALUES);
156
165
  optionalNumber(attrs, "indentLeft", "paragraph.attrs.indentLeft", issues);
157
166
  optionalNumber(attrs, "indentRight", "paragraph.attrs.indentRight", issues);
@@ -178,6 +187,7 @@ const readParagraphAttrs = (node) => {
178
187
  optionalNumber(attrs, "listStartOverride", "paragraph.attrs.listStartOverride", issues);
179
188
  optionalBoolean(attrs, "pageBreakBefore", "paragraph.attrs.pageBreakBefore", issues);
180
189
  optionalBoolean(attrs, "renderedPageBreakBefore", "paragraph.attrs.renderedPageBreakBefore", issues);
190
+ optionalBoolean(attrs, "_trailingPageBreak", "paragraph.attrs._trailingPageBreak", issues);
181
191
  optionalBoolean(attrs, "runInWithNext", "paragraph.attrs.runInWithNext", issues);
182
192
  optionalBoolean(attrs, "keepNext", "paragraph.attrs.keepNext", issues);
183
193
  optionalBoolean(attrs, "keepLines", "paragraph.attrs.keepLines", issues);
@@ -203,6 +213,7 @@ const readParagraphAttrs = (node) => {
203
213
  optionalTabStops(attrs, "tabs", "paragraph.attrs.tabs", issues);
204
214
  optionalRecord(attrs, "spacingExplicit", "paragraph.attrs.spacingExplicit", issues);
205
215
  optionalRecord(attrs, "spacingFromDocDefaults", "paragraph.attrs.spacingFromDocDefaults", issues);
216
+ optionalRecord(attrs, "spacingFromImplicitDefaultStyle", "paragraph.attrs.spacingFromImplicitDefaultStyle", issues);
206
217
  optionalTextFormatting(attrs, "defaultTextFormatting", "paragraph.attrs.defaultTextFormatting", issues);
207
218
  optionalRecord(attrs, "numPr", "paragraph.attrs.numPr", issues);
208
219
  validateNumPr(attrs["numPr"], issues);
@@ -255,6 +266,12 @@ const readTableRowAttrs = (node) => {
255
266
  optionalBoolean(attrs, "isHeader", "tableRow.attrs.isHeader", issues);
256
267
  optionalBoolean(attrs, "hidden", "tableRow.attrs.hidden", issues);
257
268
  optionalRecord(attrs, "_originalFormatting", "tableRow.attrs._originalFormatting", issues);
269
+ optionalTableRowRevision(attrs, "trIns", issues);
270
+ optionalTableRowRevision(attrs, "trDel", issues);
271
+ if (attrs["trIns"] != null && attrs["trDel"] != null) issues.push({
272
+ path: "tableRow.attrs",
273
+ message: "Expected at most one structural revision marker."
274
+ });
258
275
  return attrsResult(attrs, issues);
259
276
  };
260
277
  const expectTableRowAttrs = (node) => expectCachedNodeAttrs(node, tableRowAttrsCache, readTableRowAttrs, "table row attrs");
@@ -272,6 +289,7 @@ const readTableCellAttrs = (node) => {
272
289
  optionalString(attrs, "_resolvedBackgroundColor", "tableCell.attrs._resolvedBackgroundColor", issues);
273
290
  optionalOneOf(attrs, "textDirection", "tableCell.attrs.textDirection", issues, TABLE_CELL_TEXT_DIRECTION_VALUES);
274
291
  optionalBoolean(attrs, "noWrap", "tableCell.attrs.noWrap", issues);
292
+ optionalBoolean(attrs, "hideMark", "tableCell.attrs.hideMark", issues);
275
293
  optionalBorderMap(attrs, "borders", "tableCell.attrs.borders", issues, [
276
294
  "top",
277
295
  "bottom",
@@ -282,6 +300,7 @@ const readTableCellAttrs = (node) => {
282
300
  ]);
283
301
  optionalInsetMap(attrs, "margins", "tableCell.attrs.margins", issues);
284
302
  optionalRecord(attrs, "_originalFormatting", "tableCell.attrs._originalFormatting", issues);
303
+ optionalTableCellRevision(attrs, issues);
285
304
  optionalBoolean(attrs, "_preserveVMergeRestart", "tableCell.attrs._preserveVMergeRestart", issues);
286
305
  optionalArray(attrs, "_docxVMergeContinuationCells", "tableCell.attrs._docxVMergeContinuationCells", issues);
287
306
  return attrsResult(attrs, issues);
@@ -344,20 +363,7 @@ const readSdtAttrs = (node) => {
344
363
  const attrs = attrsRecord(node.attrs);
345
364
  const issues = [];
346
365
  expectNodeType(node, "sdt", issues);
347
- requiredOneOf(attrs, "sdtType", "sdt.attrs.sdtType", issues, SDT_TYPE_VALUES);
348
- optionalString(attrs, "alias", "sdt.attrs.alias", issues);
349
- optionalString(attrs, "tag", "sdt.attrs.tag", issues);
350
- optionalNumber(attrs, "id", "sdt.attrs.id", issues);
351
- optionalOneOf(attrs, "lock", "sdt.attrs.lock", issues, SDT_LOCK_VALUES);
352
- optionalString(attrs, "placeholder", "sdt.attrs.placeholder", issues);
353
- optionalBoolean(attrs, "showingPlaceholder", "sdt.attrs.showingPlaceholder", issues);
354
- optionalString(attrs, "dateFormat", "sdt.attrs.dateFormat", issues);
355
- optionalString(attrs, "dateValueISO", "sdt.attrs.dateValueISO", issues);
356
- optionalSdtListItems(attrs, "listItems", "sdt.attrs.listItems", issues);
357
- optionalString(attrs, "dropdownLastValue", "sdt.attrs.dropdownLastValue", issues);
358
- optionalBoolean(attrs, "checked", "sdt.attrs.checked", issues);
359
- optionalString(attrs, "rawPropertiesXml", "sdt.attrs.rawPropertiesXml", issues);
360
- optionalString(attrs, "rawEndPropertiesXml", "sdt.attrs.rawEndPropertiesXml", issues);
366
+ validateSdtAttrsRecord(attrs, "sdt.attrs", issues);
361
367
  return attrsResult(attrs, issues);
362
368
  };
363
369
  const expectSdtAttrs = (node) => expectCachedNodeAttrs(node, sdtAttrsCache, readSdtAttrs, "sdt attrs");
@@ -452,6 +458,9 @@ const readTextBoxAttrs = (node) => {
452
458
  optionalImagePosition(attrs, "position", "textBox.attrs.position", issues);
453
459
  optionalOneOf(attrs, "_docxPlacement", "textBox.attrs._docxPlacement", issues, TEXT_BOX_DOCX_PLACEMENTS);
454
460
  optionalString(attrs, "_docxGroupId", "textBox.attrs._docxGroupId", issues);
461
+ optionalString(attrs, "_docxAnchorId", "textBox.attrs._docxAnchorId", issues);
462
+ optionalTextBoxTrackedChange(attrs, issues);
463
+ optionalTextBoxInlineSdts(attrs, issues);
455
464
  return attrsResult(attrs, issues);
456
465
  };
457
466
  const expectTextBoxAttrs = (node) => expectCachedNodeAttrs(node, textBoxAttrsCache, readTextBoxAttrs, "text box attrs");
@@ -592,10 +601,23 @@ const readTrackedChangeMarkAttrs = (mark) => {
592
601
  requiredNumber(attrs, "revisionId", `${mark.type.name}.attrs.revisionId`, issues);
593
602
  requiredString(attrs, "author", `${mark.type.name}.attrs.author`, issues);
594
603
  optionalString(attrs, "date", `${mark.type.name}.attrs.date`, issues);
604
+ optionalString(attrs, "initials", `${mark.type.name}.attrs.initials`, issues);
595
605
  optionalOneOf(attrs, "moveKind", `${mark.type.name}.attrs.moveKind`, issues, TRACKED_CHANGE_MOVE_KINDS);
606
+ optionalOneOf(attrs, "provenance", `${mark.type.name}.attrs.provenance`, issues, TRACKED_CHANGE_PROVENANCE_VALUES);
607
+ optionalString(attrs, "suggestionId", `${mark.type.name}.attrs.suggestionId`, issues);
596
608
  return attrsResult(attrs, issues);
597
609
  };
598
610
  const expectTrackedChangeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, trackedChangeAttrsCache, readTrackedChangeMarkAttrs, "tracked change attrs");
611
+ const readRunPropertyChangeMarkAttrs = (mark) => {
612
+ const attrs = attrsRecord(mark.attrs);
613
+ const issues = [];
614
+ expectMarkType(mark, "runPropertyChange", issues);
615
+ optionalPropertyChanges(attrs, "changes", "runPropertyChange.attrs.changes", issues, ["runPropertyChange"]);
616
+ optionalOneOf(attrs, "provenance", "runPropertyChange.attrs.provenance", issues, TRACKED_CHANGE_PROVENANCE_VALUES);
617
+ optionalString(attrs, "suggestionId", "runPropertyChange.attrs.suggestionId", issues);
618
+ return attrsResult(attrs, issues);
619
+ };
620
+ const expectRunPropertyChangeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, runPropertyChangeAttrsCache, readRunPropertyChangeMarkAttrs, "run property change attrs");
599
621
  const readRunFormattingOverrideMarkAttrs = (mark) => {
600
622
  const attrs = attrsRecord(mark.attrs);
601
623
  const issues = [];
@@ -640,11 +662,23 @@ const attrsResult = (attrs, issues) => {
640
662
  ok: false,
641
663
  issues
642
664
  };
643
- const normalizedAttrs = {};
644
- for (const [key, value] of Object.entries(attrs)) if (value !== null) normalizedAttrs[key] = value;
665
+ let normalizedAttrs;
645
666
  return {
646
667
  ok: true,
647
- value: normalizedAttrs
668
+ get value() {
669
+ if (normalizedAttrs !== void 0) return normalizedAttrs;
670
+ const presentAttrs = {};
671
+ for (const key in attrs) {
672
+ if (!Object.hasOwn(attrs, key)) continue;
673
+ const value = attrs[key];
674
+ if (value !== null) presentAttrs[key] = value;
675
+ }
676
+ normalizedAttrs = presentAttrs;
677
+ return normalizedAttrs;
678
+ },
679
+ set value(value) {
680
+ normalizedAttrs = value;
681
+ }
648
682
  };
649
683
  };
650
684
  const expectAttrs = (result, label) => {
@@ -892,6 +926,129 @@ const optionalRecord = (attrs, key, path, issues) => {
892
926
  message: "Expected an object."
893
927
  });
894
928
  };
929
+ const optionalTableRowRevision = (attrs, key, issues) => {
930
+ const value = attrs[key];
931
+ if (value === void 0 || value === null) return;
932
+ const path = `tableRow.attrs.${key}`;
933
+ if (!isRecord(value)) {
934
+ issues.push({
935
+ path,
936
+ message: "Expected an object."
937
+ });
938
+ return;
939
+ }
940
+ requiredNumber(value, "revisionId", `${path}.revisionId`, issues);
941
+ requiredString(value, "author", `${path}.author`, issues);
942
+ optionalString(value, "date", `${path}.date`, issues);
943
+ optionalString(value, "initials", `${path}.initials`, issues);
944
+ optionalOneOf(value, "provenance", `${path}.provenance`, issues, TRACKED_CHANGE_PROVENANCE_VALUES);
945
+ optionalString(value, "suggestionId", `${path}.suggestionId`, issues);
946
+ };
947
+ const optionalTableCellRevision = (attrs, issues) => {
948
+ const value = attrs["cellMarker"];
949
+ if (value === void 0 || value === null) return;
950
+ const path = "tableCell.attrs.cellMarker";
951
+ if (!isRecord(value)) {
952
+ issues.push({
953
+ path,
954
+ message: "Expected an object."
955
+ });
956
+ return;
957
+ }
958
+ requiredOneOf(value, "kind", `${path}.kind`, issues, [
959
+ "ins",
960
+ "del",
961
+ "merge"
962
+ ]);
963
+ const info = value["info"];
964
+ if (!isRecord(info)) {
965
+ issues.push({
966
+ path: `${path}.info`,
967
+ message: "Expected an object."
968
+ });
969
+ return;
970
+ }
971
+ requiredNumber(info, "revisionId", `${path}.info.revisionId`, issues);
972
+ requiredString(info, "author", `${path}.info.author`, issues);
973
+ optionalString(info, "date", `${path}.info.date`, issues);
974
+ optionalString(info, "initials", `${path}.info.initials`, issues);
975
+ if (value["kind"] === "merge") {
976
+ if (info["provenance"] !== void 0) issues.push({
977
+ path: `${path}.info.provenance`,
978
+ message: "Not allowed on a merge marker."
979
+ });
980
+ if (info["suggestionId"] !== void 0) issues.push({
981
+ path: `${path}.info.suggestionId`,
982
+ message: "Not allowed on a merge marker."
983
+ });
984
+ optionalOneOf(value, "verticalMerge", `${path}.verticalMerge`, issues, ["continue", "rest"]);
985
+ optionalOneOf(value, "verticalMergeOriginal", `${path}.verticalMergeOriginal`, issues, ["continue", "rest"]);
986
+ } else {
987
+ optionalOneOf(info, "provenance", `${path}.info.provenance`, issues, TRACKED_CHANGE_PROVENANCE_VALUES);
988
+ optionalString(info, "suggestionId", `${path}.info.suggestionId`, issues);
989
+ }
990
+ };
991
+ const optionalTextBoxTrackedChange = (attrs, issues) => {
992
+ const value = attrs["_docxTrackedChange"];
993
+ if (value === void 0 || value === null) return;
994
+ if (!isRecord(value)) {
995
+ issues.push({
996
+ path: "textBox.attrs._docxTrackedChange",
997
+ message: "Expected an object."
998
+ });
999
+ return;
1000
+ }
1001
+ requiredOneOf(value, "type", "textBox.attrs._docxTrackedChange.type", issues, TEXT_BOX_TRACKED_CHANGE_TYPES);
1002
+ const info = value["info"];
1003
+ if (!isRecord(info)) {
1004
+ issues.push({
1005
+ path: "textBox.attrs._docxTrackedChange.info",
1006
+ message: "Expected an object."
1007
+ });
1008
+ return;
1009
+ }
1010
+ requiredNumber(info, "id", "textBox.attrs._docxTrackedChange.info.id", issues);
1011
+ requiredString(info, "author", "textBox.attrs._docxTrackedChange.info.author", issues);
1012
+ optionalString(info, "date", "textBox.attrs._docxTrackedChange.info.date", issues);
1013
+ };
1014
+ const optionalTextBoxInlineSdts = (attrs, issues) => {
1015
+ const value = attrs["_docxInlineSdts"];
1016
+ if (value === void 0 || value === null) return;
1017
+ if (!Array.isArray(value)) {
1018
+ issues.push({
1019
+ path: "textBox.attrs._docxInlineSdts",
1020
+ message: "Expected an array."
1021
+ });
1022
+ return;
1023
+ }
1024
+ for (const [index, item] of value.entries()) {
1025
+ const path = `textBox.attrs._docxInlineSdts[${index}]`;
1026
+ if (!isRecord(item)) {
1027
+ issues.push({
1028
+ path,
1029
+ message: "Expected an object."
1030
+ });
1031
+ continue;
1032
+ }
1033
+ validateSdtAttrsRecord(item, path, issues);
1034
+ }
1035
+ };
1036
+ const validateSdtAttrsRecord = (attrs, path, issues) => {
1037
+ requiredOneOf(attrs, "sdtType", `${path}.sdtType`, issues, SDT_TYPE_VALUES);
1038
+ optionalString(attrs, "alias", `${path}.alias`, issues);
1039
+ optionalString(attrs, "tag", `${path}.tag`, issues);
1040
+ optionalNumber(attrs, "id", `${path}.id`, issues);
1041
+ optionalOneOf(attrs, "lock", `${path}.lock`, issues, SDT_LOCK_VALUES);
1042
+ optionalString(attrs, "placeholder", `${path}.placeholder`, issues);
1043
+ optionalBoolean(attrs, "showingPlaceholder", `${path}.showingPlaceholder`, issues);
1044
+ optionalString(attrs, "dateFormat", `${path}.dateFormat`, issues);
1045
+ optionalString(attrs, "dateValueISO", `${path}.dateValueISO`, issues);
1046
+ optionalSdtListItems(attrs, "listItems", `${path}.listItems`, issues);
1047
+ optionalString(attrs, "dropdownLastValue", `${path}.dropdownLastValue`, issues);
1048
+ optionalBoolean(attrs, "checked", `${path}.checked`, issues);
1049
+ optionalString(attrs, "rawPropertiesXml", `${path}.rawPropertiesXml`, issues);
1050
+ optionalString(attrs, "rawEndPropertiesXml", `${path}.rawEndPropertiesXml`, issues);
1051
+ };
895
1052
  const optionalAutospacingBase = (attrs, issues) => {
896
1053
  const value = attrs["_autospacingBase"];
897
1054
  if (value === void 0 || value === null) return;
@@ -1249,4 +1406,4 @@ const optionalEmptyHyperlinkArray = (value, issues) => {
1249
1406
  }
1250
1407
  };
1251
1408
  //#endregion
1252
- export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
1409
+ export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
@@ -39,12 +39,12 @@ declare function acceptAllChanges(): Command;
39
39
  */
40
40
  declare function rejectAllChanges(): Command;
41
41
  /**
42
- * Find the document range covered by all insertion/deletion marks
42
+ * Find the document range covered by all inline revision marks
43
43
  * carrying any of the given AI-edit `revisionIds`. Returns null when
44
44
  * none of those marks are present (already accepted/rejected, or
45
45
  * never existed). A replace operation typically passes two ids (one
46
46
  * for its deletion side, one for its insertion side); inserts and
47
- * standalone deletions pass a single id.
47
+ * standalone deletions and formatting changes pass a single id.
48
48
  */
49
49
  declare function findAIEditRevisionRange(state: EditorState, revisionIds: number | readonly number[]): {
50
50
  from: number;
@@ -52,7 +52,7 @@ declare function findAIEditRevisionRange(state: EditorState, revisionIds: number
52
52
  } | null;
53
53
  /**
54
54
  * Accept the tracked-change marks belonging to an AI-edit operation.
55
- * Pass a single revisionId for inserts/standalone deletions, or the
55
+ * Pass a single revisionId for inserts, standalone deletions, or formatting changes; or the
56
56
  * full id list for a replace (one id per side). Returns false when
57
57
  * none of the ids match anything in the doc.
58
58
  */
@@ -62,6 +62,81 @@ declare function acceptAIEditRevision(revisionIds: number | readonly number[]):
62
62
  * See {@link acceptAIEditRevision} for the id semantics.
63
63
  */
64
64
  declare function rejectAIEditRevision(revisionIds: number | readonly number[]): Command;
65
+ type SuggestionKind = "insertion" | "deletion" | "formatting" | "insertBlock" | "insertTable" | "insertRow" | "deleteRow" | "insertColumn" | "deleteColumn";
66
+ /**
67
+ * How a suggestion is applied when accepted:
68
+ * - `"tracked"` — converts to a normal OOXML tracked change (`w:ins`/`w:del`,
69
+ * paragraph-mark `w:ins`, row/cell `w:ins`/`w:del`);
70
+ * - `"direct"` — no OOXML tracked representation exists (a whole inserted
71
+ * table), so accepting applies it directly;
72
+ * - `"mixed"` — a heterogeneous group (one `suggestionId` spanning a whole
73
+ * inserted table AND other edits) whose parts apply both ways. Accept still
74
+ * resolves the whole group in one transaction; this flag lets the host
75
+ * message that some parts landed directly.
76
+ */
77
+ type SuggestionAppliedAs = "tracked" | "direct" | "mixed";
78
+ type FolioSuggestion = {
79
+ suggestionId: string; /** Contiguous document ranges the suggestion covers, in document order. */
80
+ ranges: readonly {
81
+ from: number;
82
+ to: number;
83
+ }[]; /** Which kinds of change the suggestion contains (deduped, in a stable order). */
84
+ kinds: readonly SuggestionKind[]; /** How accepting this suggestion applies it (see {@link SuggestionAppliedAs}). */
85
+ appliedAs: SuggestionAppliedAs;
86
+ };
87
+ /**
88
+ * List every suggestion in the document for host consumption: its id, the
89
+ * contiguous ranges it covers, which kinds of change it contains, and how
90
+ * accepting it applies (tracked vs direct).
91
+ */
92
+ declare function getSuggestions(state: EditorState): FolioSuggestion[];
93
+ /**
94
+ * The document range covering every mark belonging to `suggestionId`, plus the
95
+ * revision ids those marks carry. Returns null when the suggestion is absent
96
+ * (already accepted/rejected, or never existed).
97
+ */
98
+ declare function findSuggestionRange(state: EditorState, suggestionId: string): {
99
+ from: number;
100
+ to: number;
101
+ revisionIds: number[];
102
+ } | null;
103
+ type AcceptSuggestionOptions = {
104
+ author: string;
105
+ /**
106
+ * Date stamped on the resulting user tracked change (serialized as `w:date`);
107
+ * defaults to now. A malformed / non-parseable value is normalized to now, and
108
+ * a valid value is canonicalized to ISO 8601, so an invalid date can never be
109
+ * written into the document.
110
+ */
111
+ date?: string;
112
+ };
113
+ /**
114
+ * Accept one suggestion: convert its inline marks and block/table node
115
+ * revisions into normal tracked changes authored by `author`, keeping revision
116
+ * ids. A whole inserted table (which OOXML cannot track) is applied directly;
117
+ * everything else becomes a tracked change. See {@link getSuggestions} for the
118
+ * per-suggestion `appliedAs`.
119
+ */
120
+ declare function acceptSuggestion(suggestionId: string, options: AcceptSuggestionOptions): Command;
121
+ /** Accept every suggestion in the document. */
122
+ declare function acceptAllSuggestions(options: AcceptSuggestionOptions): Command;
123
+ /**
124
+ * Reject one suggestion: inverse-apply it in a single transaction. Runs BOTH
125
+ * phases so a heterogeneous group (one `suggestionId` spanning whole-node
126
+ * inserts AND other edits) is fully resolved:
127
+ * 1. inline marks and suggested `trIns`/`trDel`/`cellMarker` revisions are
128
+ * inverse-applied through {@link resolveChange} (delete suggested-inserted
129
+ * text/rows/cells, drop suggested deletions/formatting);
130
+ * 2. any remaining whole-node inserts (paragraph/table) are then deleted,
131
+ * mapped through the accumulated transaction so positions stay valid.
132
+ *
133
+ * A paragraph whole-node insert carries inline marks with the same revision id,
134
+ * so phase 1 empties its text and phase 2 removes the now-empty node; a whole
135
+ * inserted table has no matching revision, so only phase 2 removes it.
136
+ */
137
+ declare function rejectSuggestion(suggestionId: string): Command;
138
+ /** Reject every suggestion in the document. */
139
+ declare function rejectAllSuggestions(): Command;
65
140
  type ChangeRange = {
66
141
  from: number;
67
142
  to: number;
@@ -90,4 +165,4 @@ declare function findNextChange(state: EditorState, startPos: number): ChangeRan
90
165
  */
91
166
  declare function findPreviousChange(state: EditorState, startPos: number): ChangeRange | null;
92
167
  //#endregion
93
- export { ParagraphBoundaryChange, acceptAIEditRevision, acceptAllChanges, acceptChange, addCommentMark, findAIEditRevisionRange, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, rejectAIEditRevision, rejectAllChanges, rejectChange, removeCommentMark };
168
+ export { AcceptSuggestionOptions, FolioSuggestion, ParagraphBoundaryChange, SuggestionAppliedAs, SuggestionKind, acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addCommentMark, findAIEditRevisionRange, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark };