superdoc 2.2.1 → 2.3.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 (687) hide show
  1. package/AGENTS.md +337 -0
  2. package/LICENSE +661 -0
  3. package/NOTICE +8 -0
  4. package/README.md +107 -0
  5. package/dist/chunks/FindReplaceSurface-BEW-1NhM.es.js +344 -0
  6. package/dist/chunks/FindReplaceSurface-DLxnCQOB.cjs +346 -0
  7. package/dist/chunks/PasswordPromptSurface-BA6HHqEa.es.js +111 -0
  8. package/dist/chunks/PasswordPromptSurface-DMbfDvpQ.cjs +113 -0
  9. package/dist/chunks/PdfViewer-CNOtyS-I.es.js +531 -0
  10. package/dist/chunks/PdfViewer-CoFiGAhm.cjs +535 -0
  11. package/dist/chunks/_plugin-vue_export-helper-BTwbGDKw.cjs +11 -0
  12. package/dist/chunks/_plugin-vue_export-helper-CInC0bKI.es.js +6 -0
  13. package/dist/chunks/blank-docx-CJAXnJKp.es.js +2 -0
  14. package/dist/chunks/blank-docx-DA-G-3VB.cjs +7 -0
  15. package/dist/chunks/constants-CY3R3_kF.es.js +3 -0
  16. package/dist/chunks/constants-sbCZ2O_A.cjs +14 -0
  17. package/dist/chunks/create-super-doc-ui-CXCqHc2m.cjs +9451 -0
  18. package/dist/chunks/create-super-doc-ui-fxF2Q8Ib.es.js +9188 -0
  19. package/dist/chunks/eventemitter3-B60Fsz-a.es.js +131 -0
  20. package/dist/chunks/eventemitter3-DCfwFVNn.cjs +137 -0
  21. package/dist/chunks/jszip-BdUBlUeG.cjs +4679 -0
  22. package/dist/chunks/jszip-DzmwAHr3.es.js +4650 -0
  23. package/dist/chunks/rolldown-runtime-BJVcqBbz.es.js +43 -0
  24. package/dist/chunks/rolldown-runtime-_dR15c8t.cjs +68 -0
  25. package/dist/chunks/uuid-B2Sqk-3p.es.js +32 -0
  26. package/dist/chunks/uuid-CFp0WGVU.cjs +38 -0
  27. package/dist/collaboration-upgrade-engine.cjs +37 -0
  28. package/dist/collaboration-upgrade-engine.es.js +30 -0
  29. package/dist/document-api/src/authorities/authorities.d.ts +29 -0
  30. package/dist/document-api/src/authorities/authorities.types.d.ts +113 -0
  31. package/dist/document-api/src/blocks/blocks.d.ts +29 -0
  32. package/dist/document-api/src/bookmarks/bookmarks.d.ts +15 -0
  33. package/dist/document-api/src/bookmarks/bookmarks.types.d.ts +82 -0
  34. package/dist/document-api/src/capabilities/capabilities.d.ts +82 -0
  35. package/dist/document-api/src/captions/captions.d.ts +17 -0
  36. package/dist/document-api/src/captions/captions.types.d.ts +61 -0
  37. package/dist/document-api/src/citations/citations.d.ts +39 -0
  38. package/dist/document-api/src/citations/citations.types.d.ts +151 -0
  39. package/dist/document-api/src/clear-content/clear-content.d.ts +25 -0
  40. package/dist/document-api/src/clipboard/clipboard.d.ts +11 -0
  41. package/dist/document-api/src/comments/comments.d.ts +222 -0
  42. package/dist/document-api/src/comments/comments.types.d.ts +227 -0
  43. package/dist/document-api/src/content-controls/content-controls.d.ts +136 -0
  44. package/dist/document-api/src/content-controls/content-controls.types.d.ts +453 -0
  45. package/dist/document-api/src/contract/command-catalog.d.ts +17 -0
  46. package/dist/document-api/src/contract/index.d.ts +9 -0
  47. package/dist/document-api/src/contract/metadata-types.d.ts +30 -0
  48. package/dist/document-api/src/contract/operation-definitions.d.ts +3645 -0
  49. package/dist/document-api/src/contract/operation-map.d.ts +5 -0
  50. package/dist/document-api/src/contract/operation-registry.d.ts +2002 -0
  51. package/dist/document-api/src/contract/reference-aliases.d.ts +19 -0
  52. package/dist/document-api/src/contract/reference-doc-map.d.ts +12 -0
  53. package/dist/document-api/src/contract/schemas.d.ts +35 -0
  54. package/dist/document-api/src/contract/step-op-catalog.d.ts +26 -0
  55. package/dist/document-api/src/contract/types.d.ts +31 -0
  56. package/dist/document-api/src/create/create.d.ts +27 -0
  57. package/dist/document-api/src/cross-refs/cross-refs.d.ts +15 -0
  58. package/dist/document-api/src/cross-refs/cross-refs.types.d.ts +68 -0
  59. package/dist/document-api/src/customXml/customXml.d.ts +19 -0
  60. package/dist/document-api/src/customXml/customXml.types.d.ts +148 -0
  61. package/dist/document-api/src/delete/delete.d.ts +20 -0
  62. package/dist/document-api/src/diff/diff.d.ts +14 -0
  63. package/dist/document-api/src/diff/diff.types.d.ts +83 -0
  64. package/dist/document-api/src/diff/index.d.ts +3 -0
  65. package/dist/document-api/src/errors.d.ts +11 -0
  66. package/dist/document-api/src/export/export.d.ts +10 -0
  67. package/dist/document-api/src/export/export.types.d.ts +40 -0
  68. package/dist/document-api/src/extract/extract.d.ts +15 -0
  69. package/dist/document-api/src/fields/fields.d.ts +15 -0
  70. package/dist/document-api/src/fields/fields.types.d.ts +90 -0
  71. package/dist/document-api/src/find/find.d.ts +52 -0
  72. package/dist/document-api/src/footnotes/footnotes.d.ts +17 -0
  73. package/dist/document-api/src/footnotes/footnotes.types.d.ts +104 -0
  74. package/dist/document-api/src/format/format.d.ts +92 -0
  75. package/dist/document-api/src/format/inline-run-patch.d.ts +138 -0
  76. package/dist/document-api/src/get/get.d.ts +19 -0
  77. package/dist/document-api/src/get-html/get-html.d.ts +27 -0
  78. package/dist/document-api/src/get-markdown/get-markdown.d.ts +22 -0
  79. package/dist/document-api/src/get-node/get-node.d.ts +46 -0
  80. package/dist/document-api/src/get-text/get-text.d.ts +22 -0
  81. package/dist/document-api/src/header-footers/header-footers.d.ts +37 -0
  82. package/dist/document-api/src/header-footers/header-footers.types.d.ts +116 -0
  83. package/dist/document-api/src/history/history.d.ts +38 -0
  84. package/dist/document-api/src/history/history.types.d.ts +100 -0
  85. package/dist/document-api/src/hyperlinks/hyperlinks.d.ts +17 -0
  86. package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +112 -0
  87. package/dist/document-api/src/images/images.d.ts +63 -0
  88. package/dist/document-api/src/images/images.types.d.ts +209 -0
  89. package/dist/document-api/src/images/z-order.d.ts +10 -0
  90. package/dist/document-api/src/index/index.d.ts +29 -0
  91. package/dist/document-api/src/index/index.types.d.ts +125 -0
  92. package/dist/document-api/src/index.d.ts +560 -0
  93. package/dist/document-api/src/info/info.d.ts +19 -0
  94. package/dist/document-api/src/inline-semantics/directives.d.ts +95 -0
  95. package/dist/document-api/src/inline-semantics/error-types.d.ts +68 -0
  96. package/dist/document-api/src/inline-semantics/index.d.ts +20 -0
  97. package/dist/document-api/src/inline-semantics/property-ids.d.ts +24 -0
  98. package/dist/document-api/src/inline-semantics/token-parsers.d.ts +59 -0
  99. package/dist/document-api/src/inline-semantics/token-sets.d.ts +34 -0
  100. package/dist/document-api/src/insert/insert.d.ts +65 -0
  101. package/dist/document-api/src/invoke/invoke.d.ts +17 -0
  102. package/dist/document-api/src/lists/lists.d.ts +100 -0
  103. package/dist/document-api/src/lists/lists.types.d.ts +499 -0
  104. package/dist/document-api/src/markdown-to-fragment/markdown-to-fragment.d.ts +15 -0
  105. package/dist/document-api/src/metadata/anchored-metadata.d.ts +33 -0
  106. package/dist/document-api/src/metadata/anchored-metadata.types.d.ts +175 -0
  107. package/dist/document-api/src/paragraphs/paragraphs.d.ts +84 -0
  108. package/dist/document-api/src/paragraphs/paragraphs.types.d.ts +214 -0
  109. package/dist/document-api/src/permission-ranges/permission-ranges.d.ts +15 -0
  110. package/dist/document-api/src/permission-ranges/permission-ranges.types.d.ts +49 -0
  111. package/dist/document-api/src/plan/plan.d.ts +73 -0
  112. package/dist/document-api/src/protection/protection.d.ts +11 -0
  113. package/dist/document-api/src/protection/protection.types.d.ts +47 -0
  114. package/dist/document-api/src/ranges/index.d.ts +2 -0
  115. package/dist/document-api/src/ranges/ranges.types.d.ts +121 -0
  116. package/dist/document-api/src/ranges/resolve.d.ts +2 -0
  117. package/dist/document-api/src/receipt-bridge.d.ts +30 -0
  118. package/dist/document-api/src/replace/replace.d.ts +24 -0
  119. package/dist/document-api/src/sections/sections.d.ts +42 -0
  120. package/dist/document-api/src/sections/sections.types.d.ts +236 -0
  121. package/dist/document-api/src/selection/selection.d.ts +23 -0
  122. package/dist/document-api/src/selection/selection.types.d.ts +85 -0
  123. package/dist/document-api/src/selection-mutation.d.ts +46 -0
  124. package/dist/document-api/src/styles/apply.d.ts +142 -0
  125. package/dist/document-api/src/styles/catalog.d.ts +154 -0
  126. package/dist/document-api/src/styles/index.d.ts +14 -0
  127. package/dist/document-api/src/styles/registry.d.ts +43 -0
  128. package/dist/document-api/src/styles/schema.d.ts +9 -0
  129. package/dist/document-api/src/styles/validation.d.ts +38 -0
  130. package/dist/document-api/src/tables/color-formats.d.ts +12 -0
  131. package/dist/document-api/src/tables/tables.d.ts +83 -0
  132. package/dist/document-api/src/templates/apply.d.ts +160 -0
  133. package/dist/document-api/src/templates/index.d.ts +7 -0
  134. package/dist/document-api/src/toc/toc.d.ts +25 -0
  135. package/dist/document-api/src/toc/toc.types.d.ts +247 -0
  136. package/dist/document-api/src/track-changes/track-changes.d.ts +177 -0
  137. package/dist/document-api/src/types/adapter-result.d.ts +10 -0
  138. package/dist/document-api/src/types/address.d.ts +169 -0
  139. package/dist/document-api/src/types/base.d.ts +89 -0
  140. package/dist/document-api/src/types/blocks.types.d.ts +190 -0
  141. package/dist/document-api/src/types/clipboard.d.ts +216 -0
  142. package/dist/document-api/src/types/comments.types.d.ts +17 -0
  143. package/dist/document-api/src/types/create.types.d.ts +56 -0
  144. package/dist/document-api/src/types/discovery.d.ts +99 -0
  145. package/dist/document-api/src/types/extract.types.d.ts +163 -0
  146. package/dist/document-api/src/types/fragment.d.ts +29 -0
  147. package/dist/document-api/src/types/index.d.ts +30 -0
  148. package/dist/document-api/src/types/info.types.d.ts +109 -0
  149. package/dist/document-api/src/types/inline.types.d.ts +28 -0
  150. package/dist/document-api/src/types/media.types.d.ts +72 -0
  151. package/dist/document-api/src/types/mutation-plan.types.d.ts +264 -0
  152. package/dist/document-api/src/types/node.d.ts +9 -0
  153. package/dist/document-api/src/types/paragraph.types.d.ts +61 -0
  154. package/dist/document-api/src/types/placement.d.ts +24 -0
  155. package/dist/document-api/src/types/query-match.types.d.ts +212 -0
  156. package/dist/document-api/src/types/query.d.ts +133 -0
  157. package/dist/document-api/src/types/receipt.d.ts +191 -0
  158. package/dist/document-api/src/types/references.types.d.ts +9 -0
  159. package/dist/document-api/src/types/sd-contract.d.ts +54 -0
  160. package/dist/document-api/src/types/sd-envelope.d.ts +59 -0
  161. package/dist/document-api/src/types/sd-nodes.d.ts +375 -0
  162. package/dist/document-api/src/types/sd-objects.d.ts +144 -0
  163. package/dist/document-api/src/types/sd-props.d.ts +240 -0
  164. package/dist/document-api/src/types/sd-sections.d.ts +126 -0
  165. package/dist/document-api/src/types/sd-styles.d.ts +36 -0
  166. package/dist/document-api/src/types/step-manifest.types.d.ts +30 -0
  167. package/dist/document-api/src/types/story.types.d.ts +123 -0
  168. package/dist/document-api/src/types/structural-input.d.ts +40 -0
  169. package/dist/document-api/src/types/structured.types.d.ts +21 -0
  170. package/dist/document-api/src/types/style-policy.types.d.ts +49 -0
  171. package/dist/document-api/src/types/table-operations.types.d.ts +618 -0
  172. package/dist/document-api/src/types/tables.types.d.ts +43 -0
  173. package/dist/document-api/src/types/toc.types.d.ts +1 -0
  174. package/dist/document-api/src/types/track-changes.types.d.ts +703 -0
  175. package/dist/document-api/src/validation/create-location-validator.d.ts +2 -0
  176. package/dist/document-api/src/validation/fragment-validator.d.ts +13 -0
  177. package/dist/document-api/src/validation/selection-target-validator.d.ts +7 -0
  178. package/dist/document-api/src/validation/story-validator.d.ts +12 -0
  179. package/dist/document-api/src/validation-primitives.d.ts +29 -0
  180. package/dist/document-api/src/write/locator.d.ts +24 -0
  181. package/dist/document-api/src/write/write.d.ts +73 -0
  182. package/dist/images/altText_add.svg +3 -0
  183. package/dist/images/altText_disclaimer.svg +3 -0
  184. package/dist/images/altText_done.svg +3 -0
  185. package/dist/images/altText_spinner.svg +30 -0
  186. package/dist/images/altText_warning.svg +3 -0
  187. package/dist/images/annotation-check.svg +11 -0
  188. package/dist/images/annotation-comment.svg +16 -0
  189. package/dist/images/annotation-help.svg +26 -0
  190. package/dist/images/annotation-insert.svg +10 -0
  191. package/dist/images/annotation-key.svg +11 -0
  192. package/dist/images/annotation-newparagraph.svg +11 -0
  193. package/dist/images/annotation-noicon.svg +7 -0
  194. package/dist/images/annotation-note.svg +42 -0
  195. package/dist/images/annotation-paperclip.svg +6 -0
  196. package/dist/images/annotation-paragraph.svg +16 -0
  197. package/dist/images/annotation-pushpin.svg +7 -0
  198. package/dist/images/checkmark.svg +5 -0
  199. package/dist/images/comment-actionsButton.svg +3 -0
  200. package/dist/images/comment-closeButton.svg +3 -0
  201. package/dist/images/comment-editButton.svg +8 -0
  202. package/dist/images/comment-popup-editButton.svg +5 -0
  203. package/dist/images/cursor-editorFreeHighlight.svg +6 -0
  204. package/dist/images/cursor-editorFreeText.svg +3 -0
  205. package/dist/images/cursor-editorInk.svg +4 -0
  206. package/dist/images/cursor-editorTextHighlight.svg +8 -0
  207. package/dist/images/editor-toolbar-delete.svg +5 -0
  208. package/dist/images/editor-toolbar-edit.svg +3 -0
  209. package/dist/images/findbarButton-next.svg +3 -0
  210. package/dist/images/findbarButton-previous.svg +3 -0
  211. package/dist/images/gv-toolbarButton-download.svg +3 -0
  212. package/dist/images/loading-icon.gif +0 -0
  213. package/dist/images/loading.svg +1 -0
  214. package/dist/images/messageBar_closingButton.svg +3 -0
  215. package/dist/images/messageBar_info.svg +3 -0
  216. package/dist/images/messageBar_warning.svg +3 -0
  217. package/dist/images/pages_closeButton.svg +3 -0
  218. package/dist/images/pages_selected.svg +7 -0
  219. package/dist/images/pages_viewArrow.svg +3 -0
  220. package/dist/images/pages_viewButton.svg +3 -0
  221. package/dist/images/secondaryToolbarButton-documentProperties.svg +3 -0
  222. package/dist/images/secondaryToolbarButton-firstPage.svg +3 -0
  223. package/dist/images/secondaryToolbarButton-handTool.svg +3 -0
  224. package/dist/images/secondaryToolbarButton-lastPage.svg +3 -0
  225. package/dist/images/secondaryToolbarButton-rotateCcw.svg +3 -0
  226. package/dist/images/secondaryToolbarButton-rotateCw.svg +3 -0
  227. package/dist/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
  228. package/dist/images/secondaryToolbarButton-scrollPage.svg +3 -0
  229. package/dist/images/secondaryToolbarButton-scrollVertical.svg +3 -0
  230. package/dist/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
  231. package/dist/images/secondaryToolbarButton-selectTool.svg +3 -0
  232. package/dist/images/secondaryToolbarButton-spreadEven.svg +3 -0
  233. package/dist/images/secondaryToolbarButton-spreadNone.svg +3 -0
  234. package/dist/images/secondaryToolbarButton-spreadOdd.svg +3 -0
  235. package/dist/images/toolbarButton-bookmark.svg +3 -0
  236. package/dist/images/toolbarButton-currentOutlineItem.svg +3 -0
  237. package/dist/images/toolbarButton-download.svg +4 -0
  238. package/dist/images/toolbarButton-editorFreeText.svg +5 -0
  239. package/dist/images/toolbarButton-editorHighlight.svg +6 -0
  240. package/dist/images/toolbarButton-editorInk.svg +4 -0
  241. package/dist/images/toolbarButton-editorSignature.svg +6 -0
  242. package/dist/images/toolbarButton-editorStamp.svg +8 -0
  243. package/dist/images/toolbarButton-menuArrow.svg +3 -0
  244. package/dist/images/toolbarButton-openFile.svg +3 -0
  245. package/dist/images/toolbarButton-pageDown.svg +3 -0
  246. package/dist/images/toolbarButton-pageUp.svg +3 -0
  247. package/dist/images/toolbarButton-presentationMode.svg +3 -0
  248. package/dist/images/toolbarButton-print.svg +3 -0
  249. package/dist/images/toolbarButton-search.svg +3 -0
  250. package/dist/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
  251. package/dist/images/toolbarButton-viewAttachments.svg +3 -0
  252. package/dist/images/toolbarButton-viewLayers.svg +3 -0
  253. package/dist/images/toolbarButton-viewOutline.svg +3 -0
  254. package/dist/images/toolbarButton-viewThumbnail.svg +3 -0
  255. package/dist/images/toolbarButton-viewsManagerToggle.svg +3 -0
  256. package/dist/images/toolbarButton-zoomIn.svg +3 -0
  257. package/dist/images/toolbarButton-zoomOut.svg +3 -0
  258. package/dist/images/treeitem-collapsed.svg +1 -0
  259. package/dist/images/treeitem-expanded.svg +1 -0
  260. package/dist/layout-engine/contracts/src/author-colors.d.ts +56 -0
  261. package/dist/layout-engine/contracts/src/cell-spacing.d.ts +12 -0
  262. package/dist/layout-engine/contracts/src/clip-path-inset.d.ts +27 -0
  263. package/dist/layout-engine/contracts/src/column-layout.d.ts +79 -0
  264. package/dist/layout-engine/contracts/src/direction-context.d.ts +219 -0
  265. package/dist/layout-engine/contracts/src/drawing-taxonomy.d.ts +126 -0
  266. package/dist/layout-engine/contracts/src/engines/image-wrap.d.ts +54 -0
  267. package/dist/layout-engine/contracts/src/engines/index.d.ts +17 -0
  268. package/dist/layout-engine/contracts/src/engines/lists.d.ts +57 -0
  269. package/dist/layout-engine/contracts/src/engines/paragraph.d.ts +59 -0
  270. package/dist/layout-engine/contracts/src/engines/tables.d.ts +89 -0
  271. package/dist/layout-engine/contracts/src/engines/tabs.d.ts +117 -0
  272. package/dist/layout-engine/contracts/src/graphic-placement.d.ts +76 -0
  273. package/dist/layout-engine/contracts/src/header-footer-inheritance.d.ts +22 -0
  274. package/dist/layout-engine/contracts/src/header-footer-resolution.d.ts +28 -0
  275. package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +10 -0
  276. package/dist/layout-engine/contracts/src/index.d.ts +2459 -0
  277. package/dist/layout-engine/contracts/src/justify-utils.d.ts +98 -0
  278. package/dist/layout-engine/contracts/src/layout-identity.d.ts +136 -0
  279. package/dist/layout-engine/contracts/src/ooxml-z-index.d.ts +46 -0
  280. package/dist/layout-engine/contracts/src/page-number-formatting.d.ts +26 -0
  281. package/dist/layout-engine/contracts/src/page-ref-anchor.d.ts +2 -0
  282. package/dist/layout-engine/contracts/src/pm-range.d.ts +45 -0
  283. package/dist/layout-engine/contracts/src/resolved-layout.d.ts +541 -0
  284. package/dist/layout-engine/contracts/src/run-helpers.d.ts +23 -0
  285. package/dist/layout-engine/contracts/src/sdt-container.d.ts +13 -0
  286. package/dist/layout-engine/contracts/src/segment-geometry.d.ts +192 -0
  287. package/dist/layout-engine/contracts/src/semantic-colors.d.ts +150 -0
  288. package/dist/layout-engine/contracts/src/table-cell-spacing.d.ts +12 -0
  289. package/dist/layout-engine/contracts/src/table-column-rescale.d.ts +13 -0
  290. package/dist/layout-engine/contracts/src/vertical-text.d.ts +43 -0
  291. package/dist/layout-engine/dom-contract/src/class-names.d.ts +62 -0
  292. package/dist/layout-engine/dom-contract/src/data-attrs.d.ts +103 -0
  293. package/dist/layout-engine/dom-contract/src/index.d.ts +18 -0
  294. package/dist/layout-engine/dom-contract/src/selectors.d.ts +47 -0
  295. package/dist/layout-engine/layout-bridge/src/cache-warmer.d.ts +73 -0
  296. package/dist/layout-engine/layout-bridge/src/cache.d.ts +143 -0
  297. package/dist/layout-engine/layout-bridge/src/cacheInvalidation.d.ts +117 -0
  298. package/dist/layout-engine/layout-bridge/src/cursor-renderer.d.ts +201 -0
  299. package/dist/layout-engine/layout-bridge/src/debounced-passes.d.ts +130 -0
  300. package/dist/layout-engine/layout-bridge/src/diff.d.ts +36 -0
  301. package/dist/layout-engine/layout-bridge/src/dirty-tracker.d.ts +128 -0
  302. package/dist/layout-engine/layout-bridge/src/dom-mapping.d.ts +80 -0
  303. package/dist/layout-engine/layout-bridge/src/featureFlags.d.ts +95 -0
  304. package/dist/layout-engine/layout-bridge/src/field-annotation-key.d.ts +2 -0
  305. package/dist/layout-engine/layout-bridge/src/focus-watchdog.d.ts +170 -0
  306. package/dist/layout-engine/layout-bridge/src/font-metrics-cache.d.ts +164 -0
  307. package/dist/layout-engine/layout-bridge/src/footnote-scorer.d.ts +63 -0
  308. package/dist/layout-engine/layout-bridge/src/headerFooterUtils.d.ts +218 -0
  309. package/dist/layout-engine/layout-bridge/src/ime-handler.d.ts +81 -0
  310. package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +390 -0
  311. package/dist/layout-engine/layout-bridge/src/index.d.ts +211 -0
  312. package/dist/layout-engine/layout-bridge/src/instrumentation.d.ts +245 -0
  313. package/dist/layout-engine/layout-bridge/src/layoutHeaderFooter.d.ts +123 -0
  314. package/dist/layout-engine/layout-bridge/src/list-indent-utils.d.ts +205 -0
  315. package/dist/layout-engine/layout-bridge/src/local-paragraph-layout.d.ts +93 -0
  316. package/dist/layout-engine/layout-bridge/src/neutral-hit.d.ts +142 -0
  317. package/dist/layout-engine/layout-bridge/src/neutral-segment-geometry.d.ts +32 -0
  318. package/dist/layout-engine/layout-bridge/src/page-geometry-helper.d.ts +197 -0
  319. package/dist/layout-engine/layout-bridge/src/paragraph-hash-utils.d.ts +126 -0
  320. package/dist/layout-engine/layout-bridge/src/paragraph-line-cache.d.ts +152 -0
  321. package/dist/layout-engine/layout-bridge/src/performance-metrics.d.ts +249 -0
  322. package/dist/layout-engine/layout-bridge/src/pm-dom-fallback.d.ts +188 -0
  323. package/dist/layout-engine/layout-bridge/src/pm-position-validator.d.ts +100 -0
  324. package/dist/layout-engine/layout-bridge/src/position-hit.d.ts +167 -0
  325. package/dist/layout-engine/layout-bridge/src/remeasure.d.ts +75 -0
  326. package/dist/layout-engine/layout-bridge/src/resolveHeaderFooterTokens.d.ts +76 -0
  327. package/dist/layout-engine/layout-bridge/src/rtl-text-geometry.d.ts +34 -0
  328. package/dist/layout-engine/layout-bridge/src/run-visual-marks.d.ts +12 -0
  329. package/dist/layout-engine/layout-bridge/src/safety-net.d.ts +234 -0
  330. package/dist/layout-engine/layout-bridge/src/sectionAwareHeaderFooter.d.ts +15 -0
  331. package/dist/layout-engine/layout-bridge/src/table-handler.d.ts +86 -0
  332. package/dist/layout-engine/layout-bridge/src/text-boundaries.d.ts +17 -0
  333. package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +69 -0
  334. package/dist/layout-engine/layout-bridge/src/track-changes-handler.d.ts +90 -0
  335. package/dist/layout-engine/layout-bridge/src/tracked-changes-utils.d.ts +41 -0
  336. package/dist/layout-engine/layout-engine/src/anchors.d.ts +52 -0
  337. package/dist/layout-engine/layout-engine/src/column-balancing.d.ts +255 -0
  338. package/dist/layout-engine/layout-engine/src/column-utils.d.ts +1 -0
  339. package/dist/layout-engine/layout-engine/src/floating-objects.d.ts +60 -0
  340. package/dist/layout-engine/layout-engine/src/floating-table-anchor.d.ts +21 -0
  341. package/dist/layout-engine/layout-engine/src/index.d.ts +349 -0
  342. package/dist/layout-engine/layout-engine/src/layout-drawing.d.ts +60 -0
  343. package/dist/layout-engine/layout-engine/src/layout-image.d.ts +16 -0
  344. package/dist/layout-engine/layout-engine/src/layout-paragraph.d.ts +101 -0
  345. package/dist/layout-engine/layout-engine/src/layout-table.d.ts +71 -0
  346. package/dist/layout-engine/layout-engine/src/layout-textbox.d.ts +4 -0
  347. package/dist/layout-engine/layout-engine/src/layout-utils.d.ts +104 -0
  348. package/dist/layout-engine/layout-engine/src/normalize-header-footer-fragments.d.ts +45 -0
  349. package/dist/layout-engine/layout-engine/src/pageNumbering.d.ts +73 -0
  350. package/dist/layout-engine/layout-engine/src/paginator.d.ts +131 -0
  351. package/dist/layout-engine/layout-engine/src/paragraph-layout-eligibility.d.ts +1 -0
  352. package/dist/layout-engine/layout-engine/src/resolvePageRefs.d.ts +31 -0
  353. package/dist/layout-engine/layout-engine/src/resolvePageTokens.d.ts +82 -0
  354. package/dist/layout-engine/layout-engine/src/section-breaks.d.ts +98 -0
  355. package/dist/layout-engine/layout-engine/src/section-props.d.ts +65 -0
  356. package/dist/layout-engine/layout-engine/src/table-cell-slice.d.ts +98 -0
  357. package/dist/layout-engine/painters/dom/src/_test-utils.d.ts +21 -0
  358. package/dist/layout-engine/painters/dom/src/chart-renderer.d.ts +13 -0
  359. package/dist/layout-engine/painters/dom/src/constants.d.ts +10 -0
  360. package/dist/layout-engine/painters/dom/src/css-token.d.ts +10 -0
  361. package/dist/layout-engine/painters/dom/src/features/feature-registry.d.ts +41 -0
  362. package/dist/layout-engine/painters/dom/src/features/inline-direction/index.d.ts +22 -0
  363. package/dist/layout-engine/painters/dom/src/features/inline-direction/rtl-styles.d.ts +27 -0
  364. package/dist/layout-engine/painters/dom/src/features/inline-direction/run-direction.d.ts +75 -0
  365. package/dist/layout-engine/painters/dom/src/features/math/converters/accent.d.ts +25 -0
  366. package/dist/layout-engine/painters/dom/src/features/math/converters/bar.d.ts +16 -0
  367. package/dist/layout-engine/painters/dom/src/features/math/converters/box.d.ts +38 -0
  368. package/dist/layout-engine/painters/dom/src/features/math/converters/delimiter.d.ts +13 -0
  369. package/dist/layout-engine/painters/dom/src/features/math/converters/equation-array.d.ts +19 -0
  370. package/dist/layout-engine/painters/dom/src/features/math/converters/fraction.d.ts +13 -0
  371. package/dist/layout-engine/painters/dom/src/features/math/converters/function.d.ts +16 -0
  372. package/dist/layout-engine/painters/dom/src/features/math/converters/group-character.d.ts +26 -0
  373. package/dist/layout-engine/painters/dom/src/features/math/converters/index.d.ts +27 -0
  374. package/dist/layout-engine/painters/dom/src/features/math/converters/lower-limit.d.ts +13 -0
  375. package/dist/layout-engine/painters/dom/src/features/math/converters/math-run.d.ts +47 -0
  376. package/dist/layout-engine/painters/dom/src/features/math/converters/matrix.d.ts +23 -0
  377. package/dist/layout-engine/painters/dom/src/features/math/converters/nary.d.ts +23 -0
  378. package/dist/layout-engine/painters/dom/src/features/math/converters/phantom.d.ts +17 -0
  379. package/dist/layout-engine/painters/dom/src/features/math/converters/pre-sub-superscript.d.ts +25 -0
  380. package/dist/layout-engine/painters/dom/src/features/math/converters/radical.d.ts +14 -0
  381. package/dist/layout-engine/painters/dom/src/features/math/converters/sub-superscript.d.ts +13 -0
  382. package/dist/layout-engine/painters/dom/src/features/math/converters/subscript.d.ts +13 -0
  383. package/dist/layout-engine/painters/dom/src/features/math/converters/superscript.d.ts +13 -0
  384. package/dist/layout-engine/painters/dom/src/features/math/converters/upper-limit.d.ts +13 -0
  385. package/dist/layout-engine/painters/dom/src/features/math/index.d.ts +14 -0
  386. package/dist/layout-engine/painters/dom/src/features/math/omml-to-mathml.d.ts +18 -0
  387. package/dist/layout-engine/painters/dom/src/features/math/types.d.ts +41 -0
  388. package/dist/layout-engine/painters/dom/src/images/drawing-image.d.ts +5 -0
  389. package/dist/layout-engine/painters/dom/src/images/hyperlink.d.ts +2 -0
  390. package/dist/layout-engine/painters/dom/src/images/image-block.d.ts +15 -0
  391. package/dist/layout-engine/painters/dom/src/images/image-clip-path.d.ts +17 -0
  392. package/dist/layout-engine/painters/dom/src/images/image-fragment.d.ts +34 -0
  393. package/dist/layout-engine/painters/dom/src/images/image-selectors.d.ts +9 -0
  394. package/dist/layout-engine/painters/dom/src/images/types.d.ts +2 -0
  395. package/dist/layout-engine/painters/dom/src/index.d.ts +125 -0
  396. package/dist/layout-engine/painters/dom/src/page-content.d.ts +209 -0
  397. package/dist/layout-engine/painters/dom/src/paragraph/block-version.d.ts +8 -0
  398. package/dist/layout-engine/painters/dom/src/paragraph/borders/border-layer.d.ts +59 -0
  399. package/dist/layout-engine/painters/dom/src/paragraph/borders/group-analysis.d.ts +38 -0
  400. package/dist/layout-engine/painters/dom/src/paragraph/borders/index.d.ts +18 -0
  401. package/dist/layout-engine/painters/dom/src/paragraph/frame.d.ts +3 -0
  402. package/dist/layout-engine/painters/dom/src/paragraph/indentation.d.ts +25 -0
  403. package/dist/layout-engine/painters/dom/src/paragraph/list-marker.d.ts +51 -0
  404. package/dist/layout-engine/painters/dom/src/paragraph/marker-tracked-change.d.ts +34 -0
  405. package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphContent.d.ts +87 -0
  406. package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphFragment.d.ts +33 -0
  407. package/dist/layout-engine/painters/dom/src/paragraph/styles.d.ts +3 -0
  408. package/dist/layout-engine/painters/dom/src/paragraph-hash-utils.d.ts +13 -0
  409. package/dist/layout-engine/painters/dom/src/pm-position-validation.d.ts +149 -0
  410. package/dist/layout-engine/painters/dom/src/renderer.d.ts +681 -0
  411. package/dist/layout-engine/painters/dom/src/ruler/index.d.ts +41 -0
  412. package/dist/layout-engine/painters/dom/src/ruler/ruler-core.d.ts +195 -0
  413. package/dist/layout-engine/painters/dom/src/ruler/ruler-renderer.d.ts +97 -0
  414. package/dist/layout-engine/painters/dom/src/ruler/ruler-styles.d.ts +31 -0
  415. package/dist/layout-engine/painters/dom/src/runs/field-annotation-run.d.ts +14 -0
  416. package/dist/layout-engine/painters/dom/src/runs/font-synthesis.d.ts +1 -0
  417. package/dist/layout-engine/painters/dom/src/runs/formatting-marks.d.ts +3 -0
  418. package/dist/layout-engine/painters/dom/src/runs/hash.d.ts +82 -0
  419. package/dist/layout-engine/painters/dom/src/runs/image-run.d.ts +37 -0
  420. package/dist/layout-engine/painters/dom/src/runs/index.d.ts +13 -0
  421. package/dist/layout-engine/painters/dom/src/runs/links.d.ts +58 -0
  422. package/dist/layout-engine/painters/dom/src/runs/math-run.d.ts +7 -0
  423. package/dist/layout-engine/painters/dom/src/runs/render-line.d.ts +2 -0
  424. package/dist/layout-engine/painters/dom/src/runs/render-run.d.ts +12 -0
  425. package/dist/layout-engine/painters/dom/src/runs/tab-run.d.ts +66 -0
  426. package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +35 -0
  427. package/dist/layout-engine/painters/dom/src/runs/tracked-changes.d.ts +90 -0
  428. package/dist/layout-engine/painters/dom/src/runs/types.d.ts +67 -0
  429. package/dist/layout-engine/painters/dom/src/sdt/boundaries.d.ts +16 -0
  430. package/dist/layout-engine/painters/dom/src/sdt/container.d.ts +32 -0
  431. package/dist/layout-engine/painters/dom/src/sdt/dataset.d.ts +7 -0
  432. package/dist/layout-engine/painters/dom/src/sdt/inline.d.ts +9 -0
  433. package/dist/layout-engine/painters/dom/src/sdt/snapshot.d.ts +29 -0
  434. package/dist/layout-engine/painters/dom/src/styles.d.ts +71 -0
  435. package/dist/layout-engine/painters/dom/src/svg-utils.d.ts +101 -0
  436. package/dist/layout-engine/painters/dom/src/table/border-utils.d.ts +185 -0
  437. package/dist/layout-engine/painters/dom/src/table/grid-geometry.d.ts +69 -0
  438. package/dist/layout-engine/painters/dom/src/table/renderTableCell.d.ts +170 -0
  439. package/dist/layout-engine/painters/dom/src/table/renderTableFragment.d.ts +132 -0
  440. package/dist/layout-engine/painters/dom/src/table/renderTableRow.d.ts +146 -0
  441. package/dist/layout-engine/painters/dom/src/test-utils/normalize-line.d.ts +39 -0
  442. package/dist/layout-engine/painters/dom/src/utils/anchor-helpers.d.ts +3 -0
  443. package/dist/layout-engine/painters/dom/src/utils/apply-styles.d.ts +1 -0
  444. package/dist/layout-engine/painters/dom/src/utils/layout-identity.d.ts +9 -0
  445. package/dist/layout-engine/painters/dom/src/utils/source-anchor.d.ts +2 -0
  446. package/dist/layout-engine/style-engine/src/bench/resolveSdtMetadata.bench.d.ts +1 -0
  447. package/dist/layout-engine/style-engine/src/cascade.d.ts +43 -0
  448. package/dist/layout-engine/style-engine/src/index.d.ts +121 -0
  449. package/dist/layout-engine/style-engine/src/normalize/colors.d.ts +13 -0
  450. package/dist/layout-engine/style-engine/src/normalize/index.d.ts +13 -0
  451. package/dist/layout-engine/style-engine/src/normalize/paragraph-attrs.d.ts +3 -0
  452. package/dist/layout-engine/style-engine/src/normalize/run-attrs.d.ts +17 -0
  453. package/dist/layout-engine/style-engine/src/normalize/types.d.ts +36 -0
  454. package/dist/layout-engine/style-engine/src/normalize/units.d.ts +13 -0
  455. package/dist/layout-engine/style-engine/src/ooxml/index.d.ts +64 -0
  456. package/dist/layout-engine/style-engine/src/ooxml/numbering-types.d.ts +126 -0
  457. package/dist/layout-engine/style-engine/src/ooxml/styles-types.d.ts +363 -0
  458. package/dist/layout-engine/style-engine/src/ooxml/table-style-selection.d.ts +86 -0
  459. package/dist/layout-engine/style-engine/src/ooxml/types.d.ts +459 -0
  460. package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-theme.d.ts +33 -0
  461. package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-xml.d.ts +29 -0
  462. package/dist/public/ui-react.cjs +175 -0
  463. package/dist/public/ui-react.es.js +159 -0
  464. package/dist/public/ui.cjs +5 -0
  465. package/dist/public/ui.es.js +2 -0
  466. package/dist/shared/common/comments-types.d.ts +102 -0
  467. package/dist/shared/common/layout-constants.d.ts +7 -0
  468. package/dist/shared/common/list-marker-utils.d.ts +186 -0
  469. package/dist/shared/common/list-numbering/index.d.ts +16 -0
  470. package/dist/shared/font-system/src/activation.d.ts +64 -0
  471. package/dist/shared/font-system/src/bundled-manifest.d.ts +32 -0
  472. package/dist/shared/font-system/src/bundled.d.ts +41 -0
  473. package/dist/shared/font-system/src/document-font-options.d.ts +53 -0
  474. package/dist/shared/font-system/src/epoch.d.ts +6 -0
  475. package/dist/shared/font-system/src/font-offerings.d.ts +120 -0
  476. package/dist/shared/font-system/src/index.d.ts +35 -0
  477. package/dist/shared/font-system/src/os2.d.ts +30 -0
  478. package/dist/shared/font-system/src/registry.d.ts +188 -0
  479. package/dist/shared/font-system/src/report.d.ts +98 -0
  480. package/dist/shared/font-system/src/resolver.d.ts +215 -0
  481. package/dist/shared/font-system/src/substitution-evidence.d.ts +103 -0
  482. package/dist/shared/font-system/src/types.d.ts +128 -0
  483. package/dist/style.css +3316 -0
  484. package/dist/style.layered.css +3316 -0
  485. package/dist/superdoc/src/SuperDoc.vue.d.ts +88 -0
  486. package/dist/superdoc/src/cdn-entry.d.ts +2 -0
  487. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +62 -0
  488. package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +26 -0
  489. package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +19 -0
  490. package/dist/superdoc/src/components/CommentsLayer/CommentsDropdown.vue.d.ts +30 -0
  491. package/dist/superdoc/src/components/CommentsLayer/InternalDropdown.vue.d.ts +10 -0
  492. package/dist/superdoc/src/components/CommentsLayer/collect-removed-comment-ids.d.ts +1 -0
  493. package/dist/superdoc/src/components/CommentsLayer/collect-tracked-change-thread.d.ts +6 -0
  494. package/dist/superdoc/src/components/CommentsLayer/comment-schemas.d.ts +18 -0
  495. package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +9 -0
  496. package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +21 -0
  497. package/dist/superdoc/src/components/CommentsLayer/floating-comment-positioning.d.ts +28 -0
  498. package/dist/superdoc/src/components/CommentsLayer/helpers.d.ts +7 -0
  499. package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +2 -0
  500. package/dist/superdoc/src/components/CommentsLayer/types.d.ts +3 -0
  501. package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +8 -0
  502. package/dist/superdoc/src/components/CommentsLayer/use-conversation.d.ts +22 -0
  503. package/dist/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts +11 -0
  504. package/dist/superdoc/src/components/HtmlViewer/HtmlViewer.vue.d.ts +10 -0
  505. package/dist/superdoc/src/components/PdfViewer/PdfViewer.vue.d.ts +61 -0
  506. package/dist/superdoc/src/components/PdfViewer/PdfViewerDocument.vue.d.ts +21 -0
  507. package/dist/superdoc/src/components/PdfViewer/PdfViewerPage.vue.d.ts +24 -0
  508. package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +19 -0
  509. package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +17 -0
  510. package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +18 -0
  511. package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +19 -0
  512. package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +17 -0
  513. package/dist/superdoc/src/components/surfaces/SurfaceDialog.vue.d.ts +12 -0
  514. package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +19 -0
  515. package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +10 -0
  516. package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +31 -0
  517. package/dist/superdoc/src/components/surfaces/focusable-selector.d.ts +5 -0
  518. package/dist/superdoc/src/composables/find-shortcut-owner.d.ts +32 -0
  519. package/dist/superdoc/src/composables/replace-continuation.d.ts +37 -0
  520. package/dist/superdoc/src/composables/use-ai.d.ts +10 -0
  521. package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +10 -0
  522. package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +21 -0
  523. package/dist/superdoc/src/composables/use-document.d.ts +34 -0
  524. package/dist/superdoc/src/composables/use-field.d.ts +33 -0
  525. package/dist/superdoc/src/composables/use-find-replace.d.ts +83 -0
  526. package/dist/superdoc/src/composables/use-high-contrast-mode.d.ts +4 -0
  527. package/dist/superdoc/src/composables/use-link-popover.d.ts +221 -0
  528. package/dist/superdoc/src/composables/use-password-prompt.d.ts +33 -0
  529. package/dist/superdoc/src/composables/use-selected-text.d.ts +16 -0
  530. package/dist/superdoc/src/composables/use-viewport-fit.d.ts +50 -0
  531. package/dist/superdoc/src/composables/useUiFontFamily.d.ts +24 -0
  532. package/dist/superdoc/src/core/EventEmitter.d.ts +55 -0
  533. package/dist/superdoc/src/core/SuperDoc.d.ts +775 -0
  534. package/dist/superdoc/src/core/collaboration/collaboration-comments.d.ts +4 -0
  535. package/dist/superdoc/src/core/collaboration/collaboration.d.ts +28 -0
  536. package/dist/superdoc/src/core/collaboration/helpers.d.ts +8 -0
  537. package/dist/superdoc/src/core/collaboration/permissions.d.ts +19 -0
  538. package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +99 -0
  539. package/dist/superdoc/src/core/collaboration/room-overwrite.d.ts +22 -0
  540. package/dist/superdoc/src/core/collaboration/v2-awareness-bridge.d.ts +57 -0
  541. package/dist/superdoc/src/core/config/merge-defined.d.ts +35 -0
  542. package/dist/superdoc/src/core/config/normalize-interaction-config.d.ts +15 -0
  543. package/dist/superdoc/src/core/config/normalize-surfaces-config.d.ts +23 -0
  544. package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +62 -0
  545. package/dist/superdoc/src/core/create-app.d.ts +32 -0
  546. package/dist/superdoc/src/core/editor-runtime/conformance/fake-v2-runtime.d.ts +9 -0
  547. package/dist/superdoc/src/core/editor-runtime/editor-runtime-registry.d.ts +117 -0
  548. package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -0
  549. package/dist/superdoc/src/core/editor-runtime/root-marker.d.ts +33 -0
  550. package/dist/superdoc/src/core/editor-runtime/types.d.ts +405 -0
  551. package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +185 -0
  552. package/dist/superdoc/src/core/editor-runtime/v2/v2-session-shortcut-routes.d.ts +47 -0
  553. package/dist/superdoc/src/core/extensions/define.d.ts +56 -0
  554. package/dist/superdoc/src/core/extensions/index.d.ts +2 -0
  555. package/dist/superdoc/src/core/extensions/types.d.ts +519 -0
  556. package/dist/superdoc/src/core/helpers/export.d.ts +2 -0
  557. package/dist/superdoc/src/core/helpers/file.d.ts +43 -0
  558. package/dist/superdoc/src/core/helpers/normalize-track-changes-config.d.ts +60 -0
  559. package/dist/superdoc/src/core/helpers/normalize-user.d.ts +13 -0
  560. package/dist/superdoc/src/core/index.d.ts +1 -0
  561. package/dist/superdoc/src/core/pdf/helpers/constants.d.ts +2 -0
  562. package/dist/superdoc/src/core/pdf/helpers/floor.d.ts +1 -0
  563. package/dist/superdoc/src/core/pdf/helpers/range.d.ts +1 -0
  564. package/dist/superdoc/src/core/pdf/helpers/read-file.d.ts +1 -0
  565. package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +66 -0
  566. package/dist/superdoc/src/core/surface-manager.d.ts +90 -0
  567. package/dist/superdoc/src/core/theme/create-theme.d.ts +82 -0
  568. package/dist/superdoc/src/core/types/index.d.ts +3006 -0
  569. package/dist/superdoc/src/core/v2-integration/browser-peer-runtime.d.ts +3 -0
  570. package/dist/superdoc/src/core/v2-integration/cdn-engine-loader.d.ts +16 -0
  571. package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +97 -0
  572. package/dist/superdoc/src/core/whiteboard/Whiteboard.d.ts +247 -0
  573. package/dist/superdoc/src/core/whiteboard/WhiteboardPage.d.ts +251 -0
  574. package/dist/superdoc/src/core/whiteboard/WhiteboardRenderer.d.ts +2 -0
  575. package/dist/superdoc/src/core/whiteboard/helpers/createTextarea.d.ts +1 -0
  576. package/dist/superdoc/src/core/whiteboard/helpers/flattenPoints.d.ts +1 -0
  577. package/dist/superdoc/src/core/whiteboard/helpers/getRandomId.d.ts +1 -0
  578. package/dist/superdoc/src/helpers/collect-touched-tracked-change-ids.d.ts +11 -0
  579. package/dist/superdoc/src/helpers/comment-focus.d.ts +4 -0
  580. package/dist/superdoc/src/helpers/comment-small-screen.d.ts +14 -0
  581. package/dist/superdoc/src/helpers/deprecation.d.ts +26 -0
  582. package/dist/superdoc/src/helpers/floor.d.ts +1 -0
  583. package/dist/superdoc/src/helpers/group-changes.d.ts +1 -0
  584. package/dist/superdoc/src/helpers/interaction-trace.d.ts +26 -0
  585. package/dist/superdoc/src/helpers/selection-source.d.ts +1 -0
  586. package/dist/superdoc/src/helpers/transaction-touches-structural-change.d.ts +19 -0
  587. package/dist/superdoc/src/helpers/use-selection.d.ts +17 -0
  588. package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +22 -0
  589. package/dist/superdoc/src/helpers/v2-remote-review-hydration.d.ts +12 -0
  590. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +15 -0
  591. package/dist/superdoc/src/helpers/v2-review-mutation-reconciler.d.ts +19 -0
  592. package/dist/superdoc/src/helpers/v2-review-target.d.ts +7 -0
  593. package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +12 -0
  594. package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +5 -0
  595. package/dist/superdoc/src/icons.d.ts +11 -0
  596. package/dist/superdoc/src/index.d.cts +13 -0
  597. package/dist/superdoc/src/index.d.ts +11 -0
  598. package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +21 -0
  599. package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +6 -0
  600. package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +10 -0
  601. package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +10 -0
  602. package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +10 -0
  603. package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +10 -0
  604. package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +14 -0
  605. package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +13 -0
  606. package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +37 -0
  607. package/dist/superdoc/src/internal/toolbar/built-in/LinkedStyle.vue.d.ts +12 -0
  608. package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +10 -0
  609. package/dist/superdoc/src/internal/toolbar/built-in/SdTooltip.vue.d.ts +34 -0
  610. package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +14 -0
  611. package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +8 -0
  612. package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +6 -0
  613. package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +4 -0
  614. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +24 -0
  615. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButtonIcon.vue.d.ts +11 -0
  616. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +18 -0
  617. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +38 -0
  618. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +8 -0
  619. package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +24 -0
  620. package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +102 -0
  621. package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +17 -0
  622. package/dist/superdoc/src/internal/toolbar/built-in/font-options.d.ts +1 -0
  623. package/dist/superdoc/src/internal/toolbar/built-in/font-typeahead.d.ts +11 -0
  624. package/dist/superdoc/src/internal/toolbar/built-in/format-negation.d.ts +5 -0
  625. package/dist/superdoc/src/internal/toolbar/built-in/general.d.ts +1 -0
  626. package/dist/superdoc/src/internal/toolbar/built-in/helpers.d.ts +5 -0
  627. package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +10 -0
  628. package/dist/superdoc/src/internal/toolbar/built-in/scroll-helpers.d.ts +4 -0
  629. package/dist/superdoc/src/internal/toolbar/built-in/toolbar-focus-helpers.d.ts +1 -0
  630. package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +76 -0
  631. package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +58 -0
  632. package/dist/superdoc/src/internal/toolbar/built-in/url-safety.d.ts +8 -0
  633. package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +48 -0
  634. package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +237 -0
  635. package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +59 -0
  636. package/dist/superdoc/src/internal/toolbar/image-upload.d.ts +63 -0
  637. package/dist/superdoc/src/internal/toolbar/index.d.ts +10 -0
  638. package/dist/superdoc/src/main.d.ts +1 -0
  639. package/dist/superdoc/src/public/browser-document-api.d.ts +53 -0
  640. package/dist/superdoc/src/public/collaboration-upgrade-engine.d.cts +26 -0
  641. package/dist/superdoc/src/public/collaboration-upgrade-engine.d.ts +130 -0
  642. package/dist/superdoc/src/public/index.d.cts +359 -0
  643. package/dist/superdoc/src/public/index.d.ts +179 -0
  644. package/dist/superdoc/src/public/ui/commands.d.ts +249 -0
  645. package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +18 -0
  646. package/dist/superdoc/src/public/ui/entity-at.d.ts +29 -0
  647. package/dist/superdoc/src/public/ui/equality.d.ts +10 -0
  648. package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +36 -0
  649. package/dist/superdoc/src/public/ui/react.d.ts +81 -0
  650. package/dist/superdoc/src/public/ui/reasons.d.ts +99 -0
  651. package/dist/superdoc/src/public/ui/types.d.ts +1425 -0
  652. package/dist/superdoc/src/public/ui-react.d.cts +20 -0
  653. package/dist/superdoc/src/public/ui-react.d.ts +20 -0
  654. package/dist/superdoc/src/public/ui.d.cts +194 -0
  655. package/dist/superdoc/src/public/ui.d.ts +29 -0
  656. package/dist/superdoc/src/stores/comments-store.d.ts +676 -0
  657. package/dist/superdoc/src/stores/helpers/floating-comment-instances.d.ts +14 -0
  658. package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +14 -0
  659. package/dist/superdoc/src/stores/hrbr-fields-store.d.ts +43 -0
  660. package/dist/superdoc/src/stores/superdoc-store.d.ts +2182 -0
  661. package/dist/superdoc.cjs +36521 -0
  662. package/dist/superdoc.es.js +36449 -0
  663. package/dist/word-layout/src/index.d.ts +64 -0
  664. package/dist/word-layout/src/list-marker.d.ts +68 -0
  665. package/dist/word-layout/src/marker-utils.d.ts +20 -0
  666. package/dist/word-layout/src/numbering-manager.d.ts +85 -0
  667. package/dist/word-layout/src/tab-layout.d.ts +193 -0
  668. package/dist/word-layout/src/types.d.ts +106 -0
  669. package/dist/word-layout/src/unit-conversions.d.ts +120 -0
  670. package/dist-cdn/style.layered.css +2 -0
  671. package/dist-cdn/superdoc.min.css +2 -0
  672. package/dist-cdn/superdoc.min.js +108 -0
  673. package/package.json +137 -24
  674. package/.npmignore +0 -4
  675. package/data.json +0 -17
  676. package/index.js +0 -2
  677. package/lib/Augmenter.js +0 -27
  678. package/lib/Runner.js +0 -80
  679. package/lib/Stopper.js +0 -71
  680. package/test/superdoc.js +0 -126
  681. package/utils/app.js +0 -18
  682. package/utils/server.js +0 -2
  683. package/web/index.js +0 -54
  684. package/web/public/style.css +0 -76
  685. package/web/views/index.ejs +0 -53
  686. package/web/views/layout.ejs +0 -13
  687. package/web/views/method.ejs +0 -59
@@ -0,0 +1,3006 @@
1
+ import { Doc as YDoc } from 'yjs';
2
+ import { HocuspocusProviderWebsocket } from '@hocuspocus/provider';
3
+ import { Ref, ComputedRef } from 'vue';
4
+ import { DocumentFontOption, FontAssetUrlResolver, FontFamilyOption, FontLoadSummary, FontResolutionRecord } from '../../../../shared/font-system/src/index.js';
5
+ import { SuperDoc as SuperDocClass } from '../SuperDoc.js';
6
+ import { SuperDocActiveEditorExtensions, SuperDocExtension } from '../extensions/index.js';
7
+ import { BrowserDocumentApi } from '../../public/browser-document-api.js';
8
+ export type { DocumentFontOption, FontAssetUrlContext, FontAssetUrlResolver, FontFaceSlot, FontFamilyOption, FontLoadResult, FontLoadStatus, FontLoadSummary, FontResolutionReason, FontResolutionRecord, GlyphException, ResolvedFontEvidence, SubstitutePolicyAction, SubstituteVerdict, } from '../../../../shared/font-system/src/index.js';
9
+ export type SuperDoc = SuperDocClass;
10
+ export type { BrowserDocumentApi } from '../../public/browser-document-api.js';
11
+ export type V2AuthoringSelectionCollapse = 'start' | 'end' | null;
12
+ export type V2AuthoringResult = {
13
+ ok: true;
14
+ mode?: 'collapsed' | 'range';
15
+ [key: string]: unknown;
16
+ } | {
17
+ ok: false;
18
+ reason: string;
19
+ detail?: string;
20
+ };
21
+ /**
22
+ * Narrow v2 browser-authoring bridge for shell/proof setup code. This surface
23
+ * does not expose v1 ProseMirror `view` / `state` / `commands`; it resolves
24
+ * public Document API selection targets and asks the v2 host to apply them to
25
+ * the live editable selection.
26
+ */
27
+ export interface V2AuthoringFacade {
28
+ setSelectionByText(input: {
29
+ text: string;
30
+ occurrence?: number;
31
+ collapse?: V2AuthoringSelectionCollapse;
32
+ focus?: boolean;
33
+ }): Promise<V2AuthoringResult>;
34
+ setSelectionTarget(input: {
35
+ target: unknown;
36
+ collapse?: V2AuthoringSelectionCollapse;
37
+ focus?: boolean;
38
+ }): Promise<V2AuthoringResult>;
39
+ focusEditable(): unknown;
40
+ readBlocks?(input?: Record<string, unknown>): unknown;
41
+ replaceTextByText?(input: {
42
+ findText: string;
43
+ replacement: string;
44
+ occurrence?: number;
45
+ mode?: 'direct' | 'tracked';
46
+ }): Promise<V2AuthoringResult>;
47
+ replaceSelection?(input: {
48
+ target: unknown;
49
+ replacement?: string;
50
+ mode?: 'direct' | 'tracked';
51
+ }): Promise<V2AuthoringResult>;
52
+ serializeSelectionToClipboard?(input?: {
53
+ includeHtml?: boolean;
54
+ }): Promise<V2AuthoringResult>;
55
+ pasteClipboardPayload?(input: {
56
+ payload: unknown;
57
+ target?: unknown;
58
+ mode?: 'direct' | 'tracked';
59
+ fallback?: unknown;
60
+ }): Promise<V2AuthoringResult>;
61
+ pastePlainText?(input: {
62
+ text: string;
63
+ target?: unknown;
64
+ mode?: 'direct' | 'tracked';
65
+ }): Promise<V2AuthoringResult>;
66
+ }
67
+ /**
68
+ * The current user of this superdoc.
69
+ *
70
+ * Every field is optional on input. `SuperDoc.#init` normalizes a
71
+ * missing or partial `user` by spreading `DEFAULT_USER` over consumer
72
+ * input, so `name` and `email` always have a value at runtime even
73
+ * when the consumer omits them.
74
+ *
75
+ * `User` does NOT carry the collab-awareness `color` field; that is on
76
+ * the internal `AwarenessUser` (see below), assigned by SuperDoc's
77
+ * `#assignUserColor()` after `#init`.
78
+ */
79
+ export interface User {
80
+ id?: string | null;
81
+ name?: string | null;
82
+ email?: string | null;
83
+ image?: string | null;
84
+ [key: string]: unknown;
85
+ }
86
+ /** V2-neutral active editor facade exposed by legacy shell methods. */
87
+ export interface EditorCommands {
88
+ search?: (text: string | RegExp, options?: Record<string, unknown>) => SearchMatch[];
89
+ goToSearchResult?: (match: SearchMatch) => unknown;
90
+ [key: string]: unknown;
91
+ }
92
+ export interface Editor {
93
+ editorVersion?: 2;
94
+ options?: {
95
+ documentId?: string;
96
+ documentMode?: DocumentMode;
97
+ [key: string]: unknown;
98
+ };
99
+ /**
100
+ * The public, read-only-guarded browser Document API facade for the active
101
+ * editor (`superdoc.activeEditor.doc`). It exposes the supported browser
102
+ * Document API surface customers know (`doc.comments.*`,
103
+ * `doc.trackChanges.*`, `doc.history.*`, `doc.selection.current`,
104
+ * `doc.format.*`, `doc.query.*`, etc.), with read-only enforcement and
105
+ * mutation finalization owned by the v2 host facade. In browser mode this
106
+ * surface is async-capable and operations may return promises; SDK/headless
107
+ * document automation stays synchronous on its own surface.
108
+ */
109
+ doc?: BrowserDocumentApi | null;
110
+ authoring?: V2AuthoringFacade | null;
111
+ /**
112
+ * Command bag exposed by v1 editors (`null` on v2-shaped runtimes). Only the
113
+ * commands the shell dispatches directly are typed; everything else stays
114
+ * behind the index signature.
115
+ */
116
+ commands?: EditorCommands | null;
117
+ state?: unknown;
118
+ view?: unknown;
119
+ exportDocx?: (options?: Record<string, unknown>) => Promise<Blob | File | null | undefined>;
120
+ focus?: (options?: {
121
+ preventScroll?: boolean;
122
+ restoreSelection?: boolean;
123
+ }) => unknown;
124
+ setOptions?: (options: Record<string, unknown>) => unknown;
125
+ setDocumentMode?: (mode: DocumentMode) => unknown;
126
+ setHighContrastMode?: (isHighContrast: boolean) => unknown;
127
+ on?: (...args: unknown[]) => unknown;
128
+ off?: (...args: unknown[]) => unknown;
129
+ getHTML: (options?: Record<string, unknown>) => unknown;
130
+ getDocumentId?: () => string | null | undefined;
131
+ /**
132
+ * Narrow v2 extension facet for command execution and diagnostics, backed by
133
+ * the active document's extension manager. Present only when one or more
134
+ * `extensions` are registered on the active document; `null`/absent
135
+ * otherwise. Does not expose the raw private extension manager. See
136
+ * {@link SuperDocActiveEditorExtensions}.
137
+ */
138
+ extensions?: SuperDocActiveEditorExtensions | null;
139
+ [key: string]: unknown;
140
+ }
141
+ /**
142
+ * Presentation-editor capability bag retained for shell compatibility. The
143
+ * methods the shell dispatches to are typed; capabilities stay optional because
144
+ * JS composables assemble this bag incrementally.
145
+ */
146
+ export interface DocumentRendererRuntime {
147
+ getLastFontsChangedPayload?: () => FontsChangedPayload | null;
148
+ navigateTo?: (target: NavigableAddress) => unknown;
149
+ scrollToElement?: (elementId: string) => unknown;
150
+ setContextMenuDisabled?: (disabled: boolean) => unknown;
151
+ setShowBookmarks?: (show: boolean) => unknown;
152
+ setShowFormattingMarks?: (show: boolean) => unknown;
153
+ setDocumentMode?: (mode: DocumentMode) => unknown;
154
+ setTrackedChangesOverrides?: (preferences?: {
155
+ mode?: 'review' | 'original' | 'final' | 'off';
156
+ enabled?: boolean;
157
+ }) => unknown;
158
+ setViewingCommentOptions?: (options: Record<string, unknown>) => unknown;
159
+ [key: string]: unknown;
160
+ }
161
+ export type StoryLocator = string | Record<string, unknown>;
162
+ export type BookmarkAddress = string | Record<string, unknown>;
163
+ export type BlockNavigationAddress = string | Record<string, unknown>;
164
+ export type CommentAddress = string | Record<string, unknown>;
165
+ export type TrackedChangeAddress = string | Record<string, unknown>;
166
+ export type NavigableAddress = StoryLocator | BookmarkAddress | BlockNavigationAddress | CommentAddress | TrackedChangeAddress;
167
+ export interface CollaborationProvider {
168
+ awareness?: unknown;
169
+ document?: unknown;
170
+ synced?: boolean;
171
+ isSynced?: boolean;
172
+ on?: (...args: unknown[]) => unknown;
173
+ off?: (...args: unknown[]) => unknown;
174
+ disconnect?: () => unknown;
175
+ destroy?: () => unknown;
176
+ [key: string]: unknown;
177
+ }
178
+ /**
179
+ * Document-level v2 collaboration handoff.
180
+ *
181
+ * This is the public surface for SuperDoc v2's shipped real-time collaboration
182
+ * model. v2 collaboration is always single-doc: one `Y.Doc`, one provider
183
+ * session, and one awareness channel bound to one document/root identity. Set
184
+ * it on a `Document` entry to make that document collaborative under the v2
185
+ * runtime; SuperDoc forwards it into the v2 browser shell, which constructs the
186
+ * single-doc provider internally. One `documentId` maps to exactly one
187
+ * room/provider/root identity.
188
+ *
189
+ * SuperDoc v2 supports three first-class provider families through this field:
190
+ * y-websocket, Hocuspocus, and Liveblocks. The provider is selected with
191
+ * `providerType`; omitting it preserves the original y-websocket-only shape
192
+ * (`{ documentId, serverUrl, params? }`) for backward compatibility.
193
+ *
194
+ * This is intentionally distinct from the legacy provider-agnostic
195
+ * {@link CollaborationConfig} (`Config.modules.collaboration`): v2 owns its
196
+ * provider internally and does **not** accept an external Yjs `provider`/`ydoc`
197
+ * through this field. External `{ ydoc, provider }` remains a v1 /
198
+ * provider-compat concern only and is rejected as a v2 content driver.
199
+ */
200
+ export type V2CollaborationConfig = V2YWebsocketCollaborationConfig | V2HocuspocusCollaborationConfig | V2LiveblocksCollaborationConfig;
201
+ /**
202
+ * y-websocket single-doc provider config.
203
+ *
204
+ * `providerType` is optional: omitting it (the `{ documentId, serverUrl }`
205
+ * shape) is the backward-compatible default and resolves to y-websocket.
206
+ */
207
+ export interface V2YWebsocketCollaborationConfig {
208
+ /** Provider family selector. Optional; defaults to `'y-websocket'`. */
209
+ providerType?: 'y-websocket';
210
+ /**
211
+ * Stable shared document identity. Both actors that pass the same
212
+ * `documentId` join the same room and converge on the same root Y.Doc.
213
+ */
214
+ documentId: string;
215
+ /** WebSocket server URL for the single-doc y-websocket provider. */
216
+ serverUrl?: string;
217
+ /** Alias for {@link serverUrl}; `url` wins when both are present. */
218
+ url?: string;
219
+ /**
220
+ * Optional connection query params forwarded to the provider (for example
221
+ * an auth token). Values are strings.
222
+ */
223
+ params?: Record<string, string> | null;
224
+ /** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
225
+ roomMode?: 'join' | 'create';
226
+ }
227
+ /** Hocuspocus single-doc provider config. */
228
+ export interface V2HocuspocusCollaborationConfig {
229
+ providerType: 'hocuspocus';
230
+ /** Stable shared document identity (used as the v2 root/room identity). */
231
+ documentId: string;
232
+ /** Hocuspocus backend websocket URL. */
233
+ serverUrl?: string;
234
+ /** Alias for {@link serverUrl}; `url` wins when both are present. */
235
+ url?: string;
236
+ /** Optional connection params forwarded to the backend. */
237
+ params?: Record<string, string> | null;
238
+ /** Auth-message token forwarded to the Hocuspocus backend. */
239
+ token?: string;
240
+ /** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
241
+ roomMode?: 'join' | 'create';
242
+ }
243
+ /**
244
+ * Liveblocks single-doc provider config.
245
+ *
246
+ * Exactly one auth mode is supported: `publicApiKey` (anonymous) or
247
+ * `authEndpoint` (server-side token issuance).
248
+ */
249
+ export interface V2LiveblocksCollaborationConfig {
250
+ providerType: 'liveblocks';
251
+ /** Stable shared document/room identity. */
252
+ documentId?: string;
253
+ /** Alias for {@link documentId} (Liveblocks room naming). */
254
+ roomId?: string;
255
+ /** Liveblocks public API key (anonymous auth) — mutually exclusive with {@link authEndpoint}. */
256
+ publicApiKey?: string;
257
+ /**
258
+ * Liveblocks auth endpoint URL (server-side token) — mutually exclusive with
259
+ * {@link publicApiKey}. Browser-relative URLs resolve against the current
260
+ * page; non-browser SDK/CLI callers must use an absolute HTTP(S) URL.
261
+ */
262
+ authEndpoint?: string;
263
+ /** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
264
+ roomMode?: 'join' | 'create';
265
+ }
266
+ export interface Comment {
267
+ id?: string;
268
+ commentId?: string;
269
+ text?: string;
270
+ resolved?: boolean;
271
+ [key: string]: unknown;
272
+ }
273
+ export interface FontFaceConfig {
274
+ source?: string;
275
+ url?: string;
276
+ weight?: string | number;
277
+ style?: string;
278
+ display?: string;
279
+ [key: string]: unknown;
280
+ }
281
+ export interface FontFamilyConfig {
282
+ family: string;
283
+ faces?: FontFaceConfig[];
284
+ [key: string]: unknown;
285
+ }
286
+ export type FontConfig = FontFamilyConfig;
287
+ export interface FontsConfig {
288
+ bundled?: boolean | 'baseline' | 'full' | string[] | Record<string, unknown>;
289
+ families?: FontFamilyConfig[];
290
+ /**
291
+ * Base URL the bundled substitute pack (and curated faces) are fetched from, e.g. `'/fonts/'`.
292
+ * Canonical self-hosting field. When no pack is configured, SuperDoc fetches no bundled assets.
293
+ */
294
+ assetBaseUrl?: string;
295
+ /**
296
+ * Resolver for per-asset URLs (signed / versioned / CDN), called for each bundled face filename.
297
+ * Takes precedence over {@link assetBaseUrl} when present.
298
+ */
299
+ resolveAssetUrl?: FontAssetUrlResolver;
300
+ /** @deprecated Use {@link assetBaseUrl} (string) or {@link resolveAssetUrl} (function) instead. */
301
+ assetUrl?: string | FontAssetUrlResolver;
302
+ [key: string]: unknown;
303
+ }
304
+ export interface FontsResolvedPayload {
305
+ report?: FontResolutionRecord[];
306
+ missingFonts?: string[];
307
+ documentFonts?: string[];
308
+ documentFontOptions?: DocumentFontOption[];
309
+ [key: string]: unknown;
310
+ }
311
+ export interface FontsChangedPayload extends FontsResolvedPayload {
312
+ source?: string;
313
+ loadSummary?: FontLoadSummary | null;
314
+ }
315
+ export interface ListDefinitionsPayload {
316
+ [key: string]: unknown;
317
+ }
318
+ export type ProofingIssueKind = 'spelling' | 'grammar' | 'style';
319
+ export interface ProofingCapabilities {
320
+ issueKinds: ProofingIssueKind[];
321
+ supportsSuggestions?: boolean;
322
+ supportsMultipleLanguages?: boolean;
323
+ supportsBatching?: boolean;
324
+ requiresNetwork?: boolean;
325
+ }
326
+ export interface ProofingSegmentMetadata {
327
+ blockId?: string;
328
+ pageIndex?: number;
329
+ surface: 'body' | 'header' | 'footer' | 'table-cell' | 'other';
330
+ }
331
+ export interface ProofingSegment {
332
+ id: string;
333
+ text: string;
334
+ language?: string | null;
335
+ metadata: ProofingSegmentMetadata;
336
+ }
337
+ export interface ProofingCheckRequest {
338
+ documentId?: string | null;
339
+ defaultLanguage?: string | null;
340
+ maxSuggestions?: number;
341
+ segments: ProofingSegment[];
342
+ signal?: AbortSignal;
343
+ }
344
+ export interface ProofingIssue {
345
+ segmentId: string;
346
+ /** Zero-based start offset into the segment text (UTF-16 code units). */
347
+ start: number;
348
+ /** Zero-based end offset into the segment text (UTF-16 code units, exclusive). */
349
+ end: number;
350
+ kind: ProofingIssueKind;
351
+ message?: string;
352
+ replacements?: string[];
353
+ ruleId?: string;
354
+ providerMeta?: Record<string, unknown>;
355
+ }
356
+ export interface ProofingCheckResult {
357
+ issues: ProofingIssue[];
358
+ }
359
+ /**
360
+ * Provider-agnostic proofing engine. SuperDoc owns segment extraction,
361
+ * scheduling, and rendering; providers only inspect text and return ranges.
362
+ */
363
+ export interface ProofingProvider {
364
+ id: string;
365
+ getCapabilities?: () => Promise<ProofingCapabilities> | ProofingCapabilities;
366
+ check: (request: ProofingCheckRequest) => Promise<ProofingCheckResult>;
367
+ dispose?: () => Promise<void> | void;
368
+ }
369
+ export interface SelectionInfo {
370
+ [key: string]: unknown;
371
+ }
372
+ /**
373
+ * Font surface on a SuperDoc instance (`superdoc.fonts`). The substitution- and load-aware
374
+ * answer to "what fonts does this document use and did SuperDoc render them faithfully" -
375
+ * pulled on demand and streamed via the `fonts-changed` event - plus a per-document write
376
+ * surface: {@link map}/{@link unmap} override resolution, {@link add} registers custom faces,
377
+ * {@link preload} loads them. All reflect the ACTIVE editor: reads return empty arrays when no
378
+ * editor is active; writes throw. {@link getReport} and {@link getDocumentFonts} cover the
379
+ * document's DECLARED fonts (font table + theme + defaults), not only fonts visible on screen.
380
+ */
381
+ /** Public SuperDoc alias for the canonical font face config. */
382
+ export type SuperDocFontFace = FontFaceConfig;
383
+ /** Public SuperDoc alias for the canonical font family config. */
384
+ export type SuperDocFontFamily = FontFamilyConfig;
385
+ export interface SuperDocFontsApi {
386
+ /** Per-font report: requested logical family -> physical render family, reason, load status, export family, missing. */
387
+ getReport(): FontResolutionRecord[];
388
+ /** Declared families with no faithful render font loaded (the substitution-aware truth). */
389
+ getMissingFonts(): string[];
390
+ /** The document's declared logical font families, deduped. */
391
+ getDocumentFonts(): string[];
392
+ /**
393
+ * The document's own fonts as toolbar options: one per logical family the document renders, each with
394
+ * a preview family. Document fonts only - compose with the defaults.
395
+ */
396
+ getDocumentFontOptions(): DocumentFontOption[];
397
+ /**
398
+ * The complete font-family picker list for the active document: the bundled offerings gated on its
399
+ * font activation (baseline when no pack is configured, the curated rich set when it is, honoring
400
+ * include/exclude) unioned with the document's own fonts, sorted alphabetically. Drives the built-in
401
+ * toolbar font dropdown; ready to use, not just document fonts.
402
+ */
403
+ getFontFamilyOptions(): FontFamilyOption[];
404
+ /**
405
+ * Observe the font report: replays the current report immediately if one has already
406
+ * resolved, then invokes `callback` on every future change. Use this rather than
407
+ * `on('fonts-changed')` when you may subscribe after the report resolved. Note: right after
408
+ * a document swap, if the new active editor has not produced a report yet, nothing is
409
+ * delivered until it does (no stale prior-document report). Returns an unsubscribe function.
410
+ */
411
+ onReport(callback: (payload: FontsChangedPayload) => void): () => void;
412
+ /**
413
+ * Map logical families to physical render families for the ACTIVE document, overriding bundled
414
+ * defaults: `map({ Georgia: 'Gelasio', Arial: 'Liberation Sans' })`. Applies all entries, then
415
+ * re-measures and repaints once (a redundant map - a self-map, or a mapping identical to an
416
+ * already-stored override - does neither); observe via {@link onReport} / `fonts-changed` (`source:
417
+ * 'config-change'`). Mapping a family to its bundled clone (`map({ Calibri: 'Carlito' })`) is honored
418
+ * as an explicit PIN - stored so it outranks a registered real face for that family - not treated as
419
+ * a no-op. Each physical family must be loadable - a bundled substitute, or a face added via `add`.
420
+ * Per document: other editors on the page are unaffected. Render-only - export keeps the logical
421
+ * family name.
422
+ * @throws Error if no editor is active (a write needs a document; this fails loudly, not silently).
423
+ */
424
+ map(mappings: Record<string, string>): void;
425
+ /**
426
+ * Remove runtime mappings for the ACTIVE document; each family reverts to its bundled default
427
+ * (or its logical name). Accepts one family or several. Re-measures and repaints if anything
428
+ * changed.
429
+ * @throws Error if no editor is active.
430
+ */
431
+ unmap(families: string | string[]): void;
432
+ /**
433
+ * Register custom physical font faces (URL sources) for the ACTIVE document so they can be mapped
434
+ * to and loaded - e.g.
435
+ * `add({ family: 'Gelasio', faces: [{ source: '/fonts/Gelasio-Regular.woff2', weight: 400 }] })`.
436
+ * Registering does NOT map; pair with {@link map}. Re-adding the same source for a face is
437
+ * idempotent; a DIFFERENT source for the same family/weight/style throws. Reflows once if a
438
+ * registered face is one the document already uses.
439
+ * @throws Error if no editor is active, or if a conflicting source is registered.
440
+ */
441
+ add(families: SuperDocFontFamily | SuperDocFontFamily[]): void;
442
+ /**
443
+ * Proactively load the physical faces for the given LOGICAL families (resolved through the active
444
+ * document's mappings) so they are ready before use, avoiding a late-load reflow. Awaits the
445
+ * regular (400/normal) face via the registry.
446
+ * @throws Error if no editor is active.
447
+ */
448
+ preload(families: string[]): Promise<void>;
449
+ }
450
+ /**
451
+ * Internal post-`#init` shape of the active user. Extends the public
452
+ * `User` with the collab-awareness `color` field assigned by
453
+ * `SuperDoc.#assignUserColor()` and read by the presence system. Not
454
+ * part of the consumer-facing surface; consumers continue to pass
455
+ * `User` via `Config.user`, and SuperDoc widens to `AwarenessUser`
456
+ * internally once it has computed the color.
457
+ */
458
+ export interface AwarenessUser extends User {
459
+ /**
460
+ * Awareness color for collaborative cursors. Auto-assigned from the
461
+ * configured palette (or a default palette) by `#assignUserColor`,
462
+ * derived from a hash of the user's identity so the assignment is
463
+ * stable across reloads.
464
+ */
465
+ color?: string;
466
+ }
467
+ /**
468
+ * One entry in the `states` array delivered to
469
+ * {@link Config.onAwarenessUpdate}. SuperDoc emits an entry per remote
470
+ * client, derived from the underlying Yjs awareness states.
471
+ *
472
+ * The runtime helper `awarenessStatesToArray` spreads each remote user
473
+ * onto the top of the entry (`{ clientId, ...value.user, color }`), so
474
+ * `User` fields like `name`, `email`, `image` appear at the top level
475
+ * (not nested under a `user` property). Consumers should read `state.id`,
476
+ * `state.name`, and `state.email`, not `state.user.name`.
477
+ *
478
+ * Application-specific fields attached to the awareness state by the
479
+ * provider surface through the `[key: string]: unknown` index
480
+ * signature; consumers narrow before use.
481
+ */
482
+ export interface AwarenessState extends User {
483
+ /** Yjs client identifier for the remote peer. */
484
+ clientId?: number;
485
+ /**
486
+ * Color assigned by SuperDoc's presence system. Spread onto the
487
+ * awareness entry after the user fields, so it takes precedence
488
+ * over any color the awareness user carried in (see
489
+ * {@link AwarenessUser.color}). Used when the presence system
490
+ * computes a stable palette assignment for the remote peer.
491
+ */
492
+ color?: string;
493
+ /** Application-specific fields spread from the awareness provider. */
494
+ [key: string]: unknown;
495
+ }
496
+ export interface Document {
497
+ /** The ID of the document. */
498
+ id?: string;
499
+ /** The type of the document. */
500
+ type: string;
501
+ /** The initial data of the document (File, Blob, or null). */
502
+ data?: globalThis.File | globalThis.Blob | null;
503
+ /** The name of the document. */
504
+ name?: string;
505
+ /** The URL of the document. */
506
+ url?: string;
507
+ /** Whether the document is a new file. */
508
+ isNewFile?: boolean;
509
+ /** The Yjs document for collaboration. */
510
+ ydoc?: YDoc;
511
+ /**
512
+ * The provider for collaboration. Widened from `HocuspocusProvider` to
513
+ * `CollaborationProvider` to match the runtime, which stores whatever
514
+ * provider the consumer passed via `Config.modules.collaboration.provider`
515
+ * (HocuspocusProvider, LiveblocksYjsProvider, TiptapCollabProvider, etc.).
516
+ * Consumers needing Hocuspocus-specific members must narrow before use.
517
+ */
518
+ provider?: CollaborationProvider;
519
+ /**
520
+ * Document-level v2 collaboration handoff. When present, the v2 runtime
521
+ * makes this document collaborative through the shipped single-doc
522
+ * y-websocket provider (one room / Y.Doc / awareness channel per
523
+ * `documentId`). See {@link V2CollaborationConfig}. Ignored by the v1
524
+ * editor, which uses `Config.modules.collaboration` instead.
525
+ */
526
+ v2Collaboration?: V2CollaborationConfig | null;
527
+ }
528
+ /**
529
+ * Public snapshot shape returned by `SuperDoc#state`. Always reflects
530
+ * the most recent values from the Pinia store; consumers must re-read
531
+ * on change rather than caching.
532
+ *
533
+ * `documents` is typed as the public `Document[]` view. Internally the
534
+ * runtime tracks `RuntimeDocument`, which adds runtime-only fields
535
+ * (editor/renderer accessors, `restoreComments`, etc.) for
536
+ * SuperDoc's own lifecycle plumbing. Those fields are not part of the
537
+ * supported surface; consumers using `state.documents` should treat
538
+ * each entry as `Document` and not rely on the richer runtime shape.
539
+ */
540
+ export interface SuperDocState {
541
+ /** Documents tracked by the instance, in consumer-provided order. */
542
+ documents: Document[];
543
+ /** Shared users (drives presence + "@"-mention surfaces). */
544
+ users: User[];
545
+ }
546
+ /**
547
+ * External collaboration provider interface. Accepts any Yjs-compatible
548
+ * provider (HocuspocusProvider, LiveblocksYjsProvider, TiptapCollabProvider,
549
+ * etc.). The v2 branch exposes a structural provider type so public
550
+ * declarations do not depend on the v1 editor package.
551
+ */
552
+ /**
553
+ * Internal augmentation of `Document` for runtime-only fields that the
554
+ * SuperDoc instance attaches to each document during initialization. The
555
+ * public `Document` interface above is what consumers pass in via
556
+ * `Config.documents`; this type adds the fields SuperDoc itself sets and
557
+ * reads internally (per-document `role` propagation, the live editor and
558
+ * renderer accessors that the surface manager and
559
+ * mode-switch helpers walk).
560
+ *
561
+ * Internal use only: not part of any public typedef. Consumers cannot
562
+ * import this through `superdoc` and should not pass any of these fields
563
+ * into `Config.documents` from outside.
564
+ */
565
+ export interface RuntimeDocument extends Document {
566
+ /**
567
+ * Per-document role. `useDocument()` reads `params.role` from the input
568
+ * config and exposes it on the smart-doc object; once collaboration
569
+ * setup runs, SuperDoc unconditionally writes `doc.role = config.role`,
570
+ * silently replacing whatever was passed. SD-2872 removed this from
571
+ * the public `Document` interface so consumers stop trying to use it
572
+ * as a stable per-document override; it lives on `RuntimeDocument`
573
+ * only so internal SuperDoc callsites can type the assignment.
574
+ */
575
+ role?: 'editor' | 'viewer' | 'suggester';
576
+ /**
577
+ * Returns the body Editor for this document, when the runtime has
578
+ * created one. Set by the editor-create lifecycle.
579
+ *
580
+ * @deprecated Direct editor access will be removed in a future version.
581
+ * Use the Document API (`editor.doc`) instead. This typedef carries the
582
+ * deprecation marker forward from the source accessor in
583
+ * `packages/superdoc/src/composables/use-document.js`.
584
+ */
585
+ getEditor?: () => Editor | null | undefined;
586
+ /**
587
+ * Returns the DocumentRendererRuntime for this document, when the runtime
588
+ * has created one. Set by the editor-create lifecycle.
589
+ *
590
+ * @deprecated Direct editor access will be removed in a future version.
591
+ * Use the Document API (`editor.doc`) instead.
592
+ */
593
+ getDocumentRuntime?: () => DocumentRendererRuntime | null | undefined;
594
+ /**
595
+ * Runtime-only flag mirrored from `Config.rulers` per document by the
596
+ * Pinia store. SuperDoc writes this on each document during the
597
+ * setShowRulers flow; not part of consumer-supplied `Document`.
598
+ */
599
+ rulers?: boolean;
600
+ /**
601
+ * Runtime-only method attached by the comments composable on each
602
+ * document. Set after the comments store is ready; called during
603
+ * mode switches. Not part of consumer-supplied `Document`.
604
+ */
605
+ restoreComments?: () => void;
606
+ /**
607
+ * Runtime-only method attached by the comments composable on each
608
+ * document. Set after the comments store is ready; called during
609
+ * DOCX export when comments should be stripped. Not part of
610
+ * consumer-supplied `Document`.
611
+ */
612
+ removeComments?: () => void;
613
+ }
614
+ /** Collaboration module configuration. */
615
+ export interface CollaborationConfig {
616
+ /** External Yjs document (provider-agnostic mode). */
617
+ ydoc?: YDoc;
618
+ /** External collaboration provider (provider-agnostic mode). */
619
+ provider?: CollaborationProvider;
620
+ /** Internal provider type (deprecated). */
621
+ providerType?: 'hocuspocus' | 'superdoc';
622
+ /** WebSocket URL for internal provider (deprecated). */
623
+ url?: string;
624
+ /** Authentication token for internal provider (deprecated). */
625
+ token?: string;
626
+ /** Additional params for internal provider (deprecated). */
627
+ params?: object;
628
+ }
629
+ /**
630
+ * Options for `upgradeToCollaboration()`.
631
+ *
632
+ * v2 promotes a local single-DOCX editor into the shipped single-doc
633
+ * y-websocket room described by {@link V2CollaborationConfig}. Pass a
634
+ * `v2Collaboration` target to promote into a supported v2 room.
635
+ *
636
+ * The legacy `ydoc` / `provider` fields remain accepted for source
637
+ * compatibility with v1-shaped callers, but v2 does **not** drive document
638
+ * content from an arbitrary external `{ ydoc, provider }` pair: a v2 upgrade
639
+ * resolves to a supported v2 target through the shell's collaboration target
640
+ * resolver, or fails closed with a named, redacted diagnostic. The legacy
641
+ * fields are therefore optional and only honored when they resolve to a
642
+ * supported v2 room.
643
+ *
644
+ * @see {@link V2CollaborationConfig}
645
+ */
646
+ export interface UpgradeToCollaborationOptions {
647
+ /**
648
+ * Canonical supported v2 promotion target: the single-doc y-websocket room
649
+ * ({ documentId, serverUrl, params? }) to create from the current document.
650
+ * Promotion fails if the v2 room already exists.
651
+ */
652
+ v2Collaboration?: V2CollaborationConfig;
653
+ /**
654
+ * Legacy external Yjs document. Accepted for v1 source compatibility; not a
655
+ * supported v2 content source on its own.
656
+ */
657
+ ydoc?: YDoc;
658
+ /**
659
+ * Legacy external collaboration provider. Accepted for v1 source
660
+ * compatibility; not a supported v2 content source on its own.
661
+ */
662
+ provider?: CollaborationProvider;
663
+ }
664
+ /** Context passed to a link popover resolver when a link is clicked. */
665
+ export interface LinkPopoverContext {
666
+ /** The editor instance. */
667
+ editor: Editor;
668
+ /** The href attribute of the clicked link. */
669
+ href: string;
670
+ /** The target attribute of the clicked link. */
671
+ target: string | null;
672
+ /** The rel attribute of the clicked link. */
673
+ rel: string | null;
674
+ /** The title/tooltip attribute of the clicked link. */
675
+ tooltip: string | null;
676
+ /** The clicked anchor DOM element. */
677
+ element: HTMLAnchorElement;
678
+ /** X coordinate of the click. */
679
+ clientX: number;
680
+ /** Y coordinate of the click. */
681
+ clientY: number;
682
+ /** Whether this is an anchor link (href starts with #). */
683
+ isAnchorLink: boolean;
684
+ /** Current document mode ('editing', 'viewing', 'suggesting'). */
685
+ documentMode: DocumentMode;
686
+ /** Computed popover position relative to editor surface. */
687
+ position: {
688
+ left: string;
689
+ top: string;
690
+ };
691
+ /** Close the popover programmatically. */
692
+ closePopover: () => void;
693
+ }
694
+ /** Context passed to an external (framework-agnostic) popover renderer. */
695
+ export interface ExternalPopoverRenderContext {
696
+ /** Empty DOM container positioned where the popover should appear. */
697
+ container: HTMLElement;
698
+ /** Call to close the popover and clean up. */
699
+ closePopover: () => void;
700
+ /** The editor instance. */
701
+ editor: Editor;
702
+ /** The href of the clicked link. */
703
+ href: string;
704
+ }
705
+ /** Resolution returned by a link popover resolver. */
706
+ export type LinkPopoverResolution = {
707
+ type: 'default';
708
+ } | {
709
+ type: 'none';
710
+ } | {
711
+ type: 'custom';
712
+ component: unknown;
713
+ props?: Record<string, unknown>;
714
+ } | {
715
+ type: 'external';
716
+ render: (ctx: ExternalPopoverRenderContext) => {
717
+ destroy?: () => void;
718
+ } | void;
719
+ };
720
+ /**
721
+ * Resolver function for customizing the link click popover. Must be
722
+ * synchronous; do not return a Promise. Return null/undefined to use the
723
+ * default popover.
724
+ */
725
+ export type LinkPopoverResolver = (ctx: LinkPopoverContext) => LinkPopoverResolution | null | undefined;
726
+ /** Context object passed to context menu callbacks (showWhen, render, action, menuProvider). */
727
+ export interface ContextMenuContext {
728
+ /** The editor instance. */
729
+ editor: Editor;
730
+ /** Currently selected text (empty string if no selection). */
731
+ selectedText: string;
732
+ /** Whether there is an expanded selection. */
733
+ hasSelection: boolean;
734
+ /** ProseMirror start position of the selection. */
735
+ selectionStart: number;
736
+ /** ProseMirror end position of the selection. */
737
+ selectionEnd: number;
738
+ /** How the menu was opened. */
739
+ trigger: 'click' | 'slash';
740
+ /** Whether the cursor is inside a table. */
741
+ isInTable: boolean;
742
+ /** Whether the cursor is inside a list. */
743
+ isInList: boolean;
744
+ /** Whether the cursor is inside a document section. */
745
+ isInSectionNode: boolean;
746
+ /** Whether a table cell selection is active. */
747
+ isCellSelection: boolean;
748
+ /** Kind of table selection (row, column, etc.). */
749
+ tableSelectionKind: string | null;
750
+ /** ProseMirror node type name at the cursor. */
751
+ currentNodeType: string | null;
752
+ /** Names of marks active at the cursor. */
753
+ activeMarks: string[];
754
+ /** Whether the cursor is on a tracked change. */
755
+ isTrackedChange: boolean;
756
+ /** ID of the tracked change at the cursor. */
757
+ trackedChangeId: string | null;
758
+ /** Current document mode (editing, viewing, suggesting). */
759
+ documentMode: string;
760
+ /** Whether undo is available. */
761
+ canUndo: boolean;
762
+ /** Whether redo is available. */
763
+ canRedo: boolean;
764
+ /** Whether the editor is editable. */
765
+ isEditable: boolean;
766
+ /** Screen coordinates of the cursor. */
767
+ cursorPosition: {
768
+ x: number;
769
+ y: number;
770
+ } | null;
771
+ }
772
+ /** A single item inside a context menu section. */
773
+ export interface ContextMenuItem {
774
+ /** Unique identifier for the menu item. */
775
+ id: string;
776
+ /** Display text. */
777
+ label: string;
778
+ /** Icon identifier. */
779
+ icon?: string;
780
+ /** Custom Vue component to render this item. */
781
+ component?: unknown;
782
+ /** Callback invoked when the item is clicked. */
783
+ action?: (editor: Editor, context: ContextMenuContext) => void;
784
+ /** Predicate controlling visibility. */
785
+ showWhen?: (context: ContextMenuContext) => boolean;
786
+ /** Custom renderer returning an HTML element. */
787
+ render?: (context: ContextMenuContext) => HTMLElement;
788
+ /** Keyboard shortcut label displayed beside the item. */
789
+ shortcut?: string;
790
+ }
791
+ /** A section (group) of items in the context menu. */
792
+ export interface ContextMenuSection {
793
+ /** Unique identifier for the section. */
794
+ id: string;
795
+ /** Menu items in this section. */
796
+ items: ContextMenuItem[];
797
+ }
798
+ /** Configuration for the context menu module. */
799
+ export interface ContextMenuConfig {
800
+ /** Custom menu sections appended (or merged by id) to the default menu. */
801
+ customItems?: ContextMenuSection[];
802
+ /**
803
+ * Advanced: transform the final section list before render. Return
804
+ * null/undefined to keep the original sections.
805
+ */
806
+ menuProvider?: (context: ContextMenuContext, sections: ContextMenuSection[]) => ContextMenuSection[] | null | undefined;
807
+ /** Whether to include default menu items (default: true). */
808
+ includeDefaultItems?: boolean;
809
+ }
810
+ /** Surface presentation mode. */
811
+ export type SurfaceMode = 'dialog' | 'floating';
812
+ export type SurfaceFloatingPlacement = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
813
+ /** Per-request floating-mode overrides. */
814
+ interface FloatingRequestOptions {
815
+ /** Position preset (default: 'top-right'). Ignored when explicit insets are provided. */
816
+ placement?: SurfaceFloatingPlacement;
817
+ /** Exact top inset (overrides placement). */
818
+ top?: string | number;
819
+ /** Exact right inset (overrides placement). */
820
+ right?: string | number;
821
+ /** Exact bottom inset (overrides placement). */
822
+ bottom?: string | number;
823
+ /** Exact left inset (overrides placement). */
824
+ left?: string | number;
825
+ /** Surface width. */
826
+ width?: string | number;
827
+ /** Max width. */
828
+ maxWidth?: string | number;
829
+ /** Max height. */
830
+ maxHeight?: string | number;
831
+ /** Move focus into first focusable child on open (default: true). */
832
+ autoFocus?: boolean;
833
+ /** Close when pointer down outside the surface (default: false). */
834
+ closeOnOutsidePointerDown?: boolean;
835
+ }
836
+ /** Intent-based surface request — resolved by the resolver or built-in registry. */
837
+ export interface IntentSurfaceRequest {
838
+ /** Optional surface id (auto-generated if omitted). */
839
+ id?: string;
840
+ /** Opaque intent identifier used by the resolver. */
841
+ kind: string;
842
+ /** Presentation mode. */
843
+ mode: SurfaceMode;
844
+ /** Optional title rendered in the surface chrome. */
845
+ title?: string;
846
+ /**
847
+ * Accessible name for the surface when no visible title is provided. Used as
848
+ * aria-label fallback when neither title nor ariaLabelledBy is set.
849
+ */
850
+ ariaLabel?: string;
851
+ /**
852
+ * ID of the element that labels the surface. Takes precedence over
853
+ * ariaLabel. Use this when the content component renders its own heading
854
+ * that should serve as the accessible name.
855
+ */
856
+ ariaLabelledBy?: string;
857
+ /**
858
+ * Whether Escape closes the surface (default: true). Set at the request top
859
+ * level — the runtime does not read `floating.closeOnEscape` on a per-request
860
+ * basis.
861
+ */
862
+ closeOnEscape?: boolean;
863
+ /** Whether backdrop click closes a dialog (default: true). */
864
+ closeOnBackdrop?: boolean;
865
+ /** Dialog-specific overrides. */
866
+ dialog?: {
867
+ maxWidth?: string | number;
868
+ };
869
+ /** Floating-specific overrides. */
870
+ floating?: FloatingRequestOptions;
871
+ /** Arbitrary data for the resolver or content. */
872
+ payload?: Record<string, unknown>;
873
+ }
874
+ /** Direct-render surface request — provides its own component or external renderer. */
875
+ export interface DirectSurfaceRequest {
876
+ /** Optional surface id (auto-generated if omitted). */
877
+ id?: string;
878
+ /** Presentation mode. */
879
+ mode: SurfaceMode;
880
+ /** Optional title rendered in the surface chrome. */
881
+ title?: string;
882
+ /**
883
+ * Accessible name for the surface when no visible title is provided. Used as
884
+ * aria-label fallback when neither title nor ariaLabelledBy is set.
885
+ */
886
+ ariaLabel?: string;
887
+ /**
888
+ * ID of the element that labels the surface. Takes precedence over
889
+ * ariaLabel. Use this when the content component renders its own heading
890
+ * that should serve as the accessible name.
891
+ */
892
+ ariaLabelledBy?: string;
893
+ /**
894
+ * Whether Escape closes the surface (default: true). Set at the request top
895
+ * level — the runtime does not read `floating.closeOnEscape` on a per-request
896
+ * basis.
897
+ */
898
+ closeOnEscape?: boolean;
899
+ /** Whether backdrop click closes a dialog (default: true). */
900
+ closeOnBackdrop?: boolean;
901
+ /** Dialog-specific overrides. */
902
+ dialog?: {
903
+ maxWidth?: string | number;
904
+ };
905
+ /** Floating-specific overrides. */
906
+ floating?: FloatingRequestOptions;
907
+ /** Vue component to render as the surface content. */
908
+ component?: unknown;
909
+ /** Extra props passed to the Vue component. */
910
+ props?: Record<string, unknown>;
911
+ /** External (framework-agnostic) renderer function. */
912
+ render?: (ctx: ExternalSurfaceRenderContext) => {
913
+ destroy?: () => void;
914
+ } | void;
915
+ }
916
+ /** Combined surface request type (intent-based or direct-render). */
917
+ export type SurfaceRequest = IntentSurfaceRequest | DirectSurfaceRequest;
918
+ /** Resolution returned by a surface resolver. */
919
+ export type SurfaceResolution = {
920
+ type: 'none';
921
+ } | {
922
+ type: 'custom';
923
+ component: unknown;
924
+ props?: Record<string, unknown>;
925
+ } | {
926
+ type: 'external';
927
+ render: (ctx: ExternalSurfaceRenderContext) => {
928
+ destroy?: () => void;
929
+ } | void;
930
+ };
931
+ /**
932
+ * Resolver function for customizing surface rendering. Must be synchronous;
933
+ * do not return a Promise. Return null/undefined to fall through to built-in
934
+ * handling. Return `{ type: 'none' }` to explicitly suppress the surface.
935
+ */
936
+ export type SurfaceResolver = (request: SurfaceRequest) => SurfaceResolution | null | undefined;
937
+ /**
938
+ * Outcome of a surface lifecycle. The handle.result promise always resolves
939
+ * with one of these — it never rejects for normal lifecycle events.
940
+ */
941
+ export interface SurfaceOutcome<TResult = unknown> {
942
+ status: 'submitted' | 'closed' | 'replaced' | 'destroyed';
943
+ /** Present when status is 'submitted'. */
944
+ data?: TResult;
945
+ /** Present when status is 'closed'. */
946
+ reason?: unknown;
947
+ /** Present when status is 'replaced'. */
948
+ replacedBy?: string;
949
+ }
950
+ /**
951
+ * Handle returned by openSurface(). Callers use this to await the outcome or
952
+ * close the surface programmatically.
953
+ */
954
+ export interface SurfaceHandle<TResult = unknown> {
955
+ /** Resolved surface id. */
956
+ id: string;
957
+ /** Presentation mode. */
958
+ mode: SurfaceMode;
959
+ /** Close this surface programmatically. */
960
+ close: (reason?: unknown) => void;
961
+ /** Resolves when the surface settles. */
962
+ result: Promise<SurfaceOutcome<TResult>>;
963
+ }
964
+ /**
965
+ * Props passed to a custom Vue component rendered inside a surface shell.
966
+ * Reserved props (surfaceId, mode, request, resolve, close) always win over
967
+ * caller-provided props to prevent accidental lifecycle override.
968
+ */
969
+ export interface SurfaceComponentProps {
970
+ /** The surface id. */
971
+ surfaceId: string;
972
+ /** Presentation mode. */
973
+ mode: SurfaceMode;
974
+ /** The original (normalized) request. */
975
+ request: SurfaceRequest;
976
+ /** Resolves the handle with `{ status: 'submitted', data }`. */
977
+ resolve: (data?: unknown) => void;
978
+ /** Resolves the handle with `{ status: 'closed', reason }`. */
979
+ close: (reason?: unknown) => void;
980
+ }
981
+ /** Context passed to an external (framework-agnostic) surface renderer. */
982
+ export interface ExternalSurfaceRenderContext {
983
+ /** Empty DOM container to render into. */
984
+ container: HTMLElement;
985
+ /** The surface id. */
986
+ surfaceId: string;
987
+ /** Presentation mode. */
988
+ mode: SurfaceMode;
989
+ /** The original (normalized) request. */
990
+ request: SurfaceRequest;
991
+ /** Resolves the handle with `{ status: 'submitted', data }`. */
992
+ resolve: (data?: unknown) => void;
993
+ /** Resolves the handle with `{ status: 'closed', reason }`. */
994
+ close: (reason?: unknown) => void;
995
+ }
996
+ /** Module-level configuration for the surface system. */
997
+ export interface SurfacesModuleConfig {
998
+ /**
999
+ * Global surface resolver.
1000
+ *
1001
+ * `null` is the resolved "no resolver" value the normalizer produces after
1002
+ * rejecting a non-function; SurfaceManager guards with `typeof === 'function'`
1003
+ * either way.
1004
+ */
1005
+ resolver?: SurfaceResolver | null;
1006
+ /** Default dialog options. */
1007
+ dialog?: {
1008
+ /** Default escape behavior for dialogs (default: true). */
1009
+ closeOnEscape?: boolean;
1010
+ /** Default backdrop-click behavior for dialogs (default: true). */
1011
+ closeOnBackdrop?: boolean;
1012
+ /** Default dialog max-width. */
1013
+ maxWidth?: string | number;
1014
+ };
1015
+ /** Default floating options. */
1016
+ floating?: {
1017
+ /** Default placement preset (default: 'top-right'). */
1018
+ placement?: SurfaceFloatingPlacement;
1019
+ /** Default floating width. */
1020
+ width?: string | number;
1021
+ /** Default floating max-width. */
1022
+ maxWidth?: string | number;
1023
+ /** Default floating max-height. */
1024
+ maxHeight?: string | number;
1025
+ /** Default escape behavior for floating surfaces (default: true). */
1026
+ closeOnEscape?: boolean;
1027
+ /** Default outside-pointer behavior (default: false). */
1028
+ closeOnOutsidePointerDown?: boolean;
1029
+ /** Default auto-focus behavior (default: true). */
1030
+ autoFocus?: boolean;
1031
+ };
1032
+ /**
1033
+ * Built-in find/replace popover for editor-backed documents. Disabled by
1034
+ * default. Set to `true` to intercept Cmd+F / Ctrl+F inside SuperDoc and
1035
+ * open the built-in UI. When an object, allows text customization, custom
1036
+ * components, resolvers, and replace-disabling.
1037
+ */
1038
+ findReplace?: boolean | FindReplaceConfig;
1039
+ /**
1040
+ * Built-in password prompt dialog for encrypted DOCX files. Enabled by
1041
+ * default when omitted. Set to `false` to disable. When `true`, uses
1042
+ * default titles/labels. When an object, allows custom titles and labels.
1043
+ */
1044
+ passwordPrompt?: boolean | PasswordPromptConfig;
1045
+ }
1046
+ /** All customizable text strings for the password prompt, resolved with defaults. */
1047
+ export interface ResolvedPasswordPromptTexts {
1048
+ /** Dialog title for first attempt. */
1049
+ title: string;
1050
+ /** Dialog title after wrong password. */
1051
+ invalidTitle: string;
1052
+ /** Explanatory text shown below the title. */
1053
+ description: string;
1054
+ /** Input placeholder text. */
1055
+ placeholder: string;
1056
+ /** Accessible label for the password input. */
1057
+ inputAriaLabel: string;
1058
+ /** Submit button text. */
1059
+ submitLabel: string;
1060
+ /** Cancel button text. */
1061
+ cancelLabel: string;
1062
+ /** Submit button text while decrypting. */
1063
+ busyLabel: string;
1064
+ /** Error message for wrong password. */
1065
+ invalidMessage: string;
1066
+ /** Error message for decryption timeout. */
1067
+ timeoutMessage: string;
1068
+ /** Error message for other failures. */
1069
+ genericErrorMessage: string;
1070
+ }
1071
+ /** Result of a password attempt via the `attemptPassword` function. */
1072
+ export interface PasswordPromptAttemptResult {
1073
+ /** Whether the password was accepted. */
1074
+ success: boolean;
1075
+ /** Error code when success is false (e.g. 'DOCX_PASSWORD_INVALID', 'timeout'). */
1076
+ errorCode?: string;
1077
+ }
1078
+ /**
1079
+ * Handle object injected into custom password prompt UIs as the
1080
+ * `passwordPrompt` prop/context field. Provides document metadata, resolved
1081
+ * texts, and the retry function.
1082
+ */
1083
+ export interface PasswordPromptHandle {
1084
+ /** The document ID requiring a password. */
1085
+ documentId: string;
1086
+ /** The current error code (e.g. 'DOCX_PASSWORD_REQUIRED', 'DOCX_PASSWORD_INVALID'). */
1087
+ errorCode: string;
1088
+ /** All text strings resolved with defaults. */
1089
+ texts: ResolvedPasswordPromptTexts;
1090
+ /**
1091
+ * Submit a password attempt. Returns the outcome; do not mutate document
1092
+ * state directly.
1093
+ */
1094
+ attemptPassword: (password: string) => Promise<PasswordPromptAttemptResult>;
1095
+ }
1096
+ /**
1097
+ * Read-only context passed to a password prompt resolver to decide how to
1098
+ * render. Does NOT include `attemptPassword` — the resolver decides, it does
1099
+ * not act.
1100
+ */
1101
+ export interface PasswordPromptContext {
1102
+ /** The document ID requiring a password. */
1103
+ documentId: string;
1104
+ /** The current error code. */
1105
+ errorCode: string;
1106
+ /** Resolved text strings. */
1107
+ texts: ResolvedPasswordPromptTexts;
1108
+ }
1109
+ /** Context passed to an external (framework-agnostic) password prompt renderer. */
1110
+ export interface PasswordPromptRenderContext {
1111
+ /** Empty DOM container to render into. */
1112
+ container: HTMLElement;
1113
+ /** The password prompt handle. */
1114
+ passwordPrompt: PasswordPromptHandle;
1115
+ /** Resolves the surface with `{ status: 'submitted', data }`. */
1116
+ resolve: (data?: unknown) => void;
1117
+ /** Resolves the surface with `{ status: 'closed', reason }`. */
1118
+ close: (reason?: unknown) => void;
1119
+ /** The surface id. */
1120
+ surfaceId: string;
1121
+ /** Presentation mode. */
1122
+ mode: SurfaceMode;
1123
+ }
1124
+ /** Resolution returned by a password prompt resolver. */
1125
+ export type PasswordPromptResolution = {
1126
+ type: 'default';
1127
+ } | {
1128
+ type: 'none';
1129
+ } | {
1130
+ type: 'custom';
1131
+ component: unknown;
1132
+ props?: Record<string, unknown>;
1133
+ } | {
1134
+ type: 'external';
1135
+ render: (ctx: PasswordPromptRenderContext) => {
1136
+ destroy?: () => void;
1137
+ } | void;
1138
+ };
1139
+ /** Configuration for the password prompt surface. */
1140
+ export interface PasswordPromptConfig {
1141
+ /** Dialog title for first attempt (default: 'Password Required'). */
1142
+ title?: string;
1143
+ /** Dialog title after wrong password (default: 'Incorrect Password'). */
1144
+ invalidTitle?: string;
1145
+ /** Explanatory text (default: 'This document is password protected. Enter the password to open it.'). */
1146
+ description?: string;
1147
+ /** Input placeholder (default: 'Enter password'). */
1148
+ placeholder?: string;
1149
+ /** Accessible label for the input (default: 'Document password'). */
1150
+ inputAriaLabel?: string;
1151
+ /** Submit button text (default: 'Open'). */
1152
+ submitLabel?: string;
1153
+ /** Cancel button text (default: 'Cancel'). */
1154
+ cancelLabel?: string;
1155
+ /** Submit button text while decrypting (default: 'Decrypting…'). */
1156
+ busyLabel?: string;
1157
+ /** Error for wrong password (default: 'Incorrect password. Please try again.'). */
1158
+ invalidMessage?: string;
1159
+ /** Error for timeout (default: 'Timed out while decrypting. Please try again.'). */
1160
+ timeoutMessage?: string;
1161
+ /** Error for other failures (default: 'Unable to decrypt this document.'). */
1162
+ genericErrorMessage?: string;
1163
+ /** Vue component to render as custom password prompt content. Mutually exclusive with `render`. */
1164
+ component?: unknown;
1165
+ /** Extra props passed to the custom Vue component. Component-only; ignored for `render`. */
1166
+ props?: Record<string, unknown>;
1167
+ /** External (framework-agnostic) renderer. Mutually exclusive with `component`. */
1168
+ render?: (ctx: PasswordPromptRenderContext) => {
1169
+ destroy?: () => void;
1170
+ } | void;
1171
+ /** Conditional resolver for per-document customization. Can coexist with `component`/`render`. */
1172
+ resolver?: (ctx: PasswordPromptContext) => PasswordPromptResolution | null | undefined;
1173
+ }
1174
+ /** All customizable text strings for the find/replace surface, resolved with defaults. */
1175
+ export interface ResolvedFindReplaceTexts {
1176
+ /** Input placeholder for the find field. */
1177
+ findPlaceholder: string;
1178
+ /** Accessible label for the find input. */
1179
+ findAriaLabel: string;
1180
+ /** Input placeholder for the replace field. */
1181
+ replacePlaceholder: string;
1182
+ /** Accessible label for the replace input. */
1183
+ replaceAriaLabel: string;
1184
+ /** Text shown when there are no matches. */
1185
+ noResultsLabel: string;
1186
+ /** Button label / title for previous match. */
1187
+ previousMatchLabel: string;
1188
+ /** Accessible label for previous match button. */
1189
+ previousMatchAriaLabel: string;
1190
+ /** Button label / title for next match. */
1191
+ nextMatchLabel: string;
1192
+ /** Accessible label for next match button. */
1193
+ nextMatchAriaLabel: string;
1194
+ /** Button label / title for close. */
1195
+ closeLabel: string;
1196
+ /** Accessible label for close button. */
1197
+ closeAriaLabel: string;
1198
+ /** Replace button text. */
1199
+ replaceLabel: string;
1200
+ /** Replace-all button text. */
1201
+ replaceAllLabel: string;
1202
+ /** Toggle replace row label. */
1203
+ toggleReplaceLabel: string;
1204
+ /** Accessible label for toggle replace button. */
1205
+ toggleReplaceAriaLabel: string;
1206
+ /** Match case toggle text. */
1207
+ matchCaseLabel: string;
1208
+ /** Accessible label for match case toggle. */
1209
+ matchCaseAriaLabel: string;
1210
+ /** Ignore diacritics toggle text. */
1211
+ ignoreDiacriticsLabel: string;
1212
+ /** Accessible label for ignore diacritics toggle. */
1213
+ ignoreDiacriticsAriaLabel: string;
1214
+ /** Regex toggle text. */
1215
+ regexLabel: string;
1216
+ /** Accessible label for the regex toggle. */
1217
+ regexAriaLabel: string;
1218
+ /** Inline error shown when the regex pattern is invalid or unsafe. */
1219
+ invalidPatternLabel: string;
1220
+ }
1221
+ /**
1222
+ * A document position range, in ProseMirror coordinates.
1223
+ *
1224
+ * SD-2828: Surfaced on the public type contract so consumers can
1225
+ * destructure `SearchMatch.ranges` without falling back to `any`. Mirrors
1226
+ * the private `DocRange` typedef in the search extension; keep them in
1227
+ * sync. Pure data, no methods.
1228
+ */
1229
+ export interface DocRange {
1230
+ /** Start position in the document. */
1231
+ from: number;
1232
+ /** End position in the document. */
1233
+ to: number;
1234
+ }
1235
+ /**
1236
+ * One match returned by `SuperDoc.search()` (and consumed by
1237
+ * `SuperDoc.goToSearchResult()`).
1238
+ *
1239
+ * SD-2828: Promoted from the private search-extension typedef to a
1240
+ * public contract so consumers get real types instead of `any` on the
1241
+ * search return value, and so `goToSearchResult` can declare the input
1242
+ * shape it expects rather than accepting an opaque `Object`. Match
1243
+ * instances are produced by the runtime; consumers should treat them as
1244
+ * read-only and pass them back unchanged.
1245
+ */
1246
+ export interface SearchMatch {
1247
+ /** Combined match text across all ranges. */
1248
+ text: string;
1249
+ /** Start position of the first range. */
1250
+ from: number;
1251
+ /** End position of the last range. */
1252
+ to: number;
1253
+ /**
1254
+ * Stable match identifier. For single-range matches this is the
1255
+ * position-tracker id; for multi-range (cross-paragraph) matches it is
1256
+ * the first tracker id. Use as the dedupe / equality key when wiring a
1257
+ * custom navigator.
1258
+ */
1259
+ id: string;
1260
+ /**
1261
+ * Document ranges for the match. Present for multi-range matches
1262
+ * (cross-paragraph), and may also be populated for single-range
1263
+ * matches by the search runtime; consumers should not assume length 1.
1264
+ */
1265
+ ranges?: DocRange[];
1266
+ /** Position-tracker ids, one per range in `ranges`. */
1267
+ trackerIds?: string[];
1268
+ }
1269
+ /**
1270
+ * Handle object injected into find/replace UIs as the `findReplace`
1271
+ * prop/context field. Provides reactive search state and all action functions.
1272
+ */
1273
+ export interface FindReplaceHandle {
1274
+ /** Current search query. */
1275
+ findQuery: Ref<string>;
1276
+ /** Current replacement text. */
1277
+ replaceText: Ref<string>;
1278
+ /** Case-sensitive toggle. */
1279
+ caseSensitive: Ref<boolean>;
1280
+ /** Ignore diacritics toggle. */
1281
+ ignoreDiacritics: Ref<boolean>;
1282
+ /** Whether replace row is expanded. */
1283
+ showReplace: Ref<boolean>;
1284
+ /** Total match count (read-only by convention). */
1285
+ matchCount: Ref<number>;
1286
+ /** Active match index, -1 when none (read-only by convention). */
1287
+ activeMatchIndex: Ref<number>;
1288
+ /** Formatted match label e.g. "3 of 12" or "No results". */
1289
+ matchLabel: ComputedRef<string>;
1290
+ /** Whether there are any matches. */
1291
+ hasMatches: ComputedRef<boolean>;
1292
+ /**
1293
+ * Whether the replace controls should be enabled right now: there are
1294
+ * matches, no replace is in flight, and the active session permits mutation
1295
+ * (V2 read-only/viewing mode disables replace; V1 stays enabled).
1296
+ */
1297
+ canReplace: ComputedRef<boolean>;
1298
+ /** Whether a replace mutation is currently in flight (re-entrancy guard). */
1299
+ replacePending: Ref<boolean>;
1300
+ /**
1301
+ * Runtime mutability of the active session (false in viewing/read-only
1302
+ * mode). Surfaces hide replace controls on this; `canReplace` additionally
1303
+ * requires matches and gates the actions.
1304
+ */
1305
+ replaceCanMutate: Ref<boolean>;
1306
+ /**
1307
+ * Whether the active driver supports the ignore-diacritics toggle. V1
1308
+ * supports it; the V2 Document API query path does not, so the toggle is
1309
+ * hidden rather than shipped as a no-op.
1310
+ */
1311
+ ignoreDiacriticsSupported: Ref<boolean>;
1312
+ /**
1313
+ * Whether the active driver supports regex search. The V2 (`ui.search`)
1314
+ * driver supports it; V1 hides the toggle.
1315
+ */
1316
+ regexSupported: Ref<boolean>;
1317
+ /** Whether the current query is treated as a regular expression. */
1318
+ regex: Ref<boolean>;
1319
+ /** Inline error label when the regex pattern is invalid/unsafe, else null. */
1320
+ searchError: Ref<string | null>;
1321
+ /** Whether replace actions are available (false for find-only mode). */
1322
+ replaceEnabled: boolean;
1323
+ /** All text strings resolved with defaults. */
1324
+ texts: ResolvedFindReplaceTexts;
1325
+ /** Navigate to the next match. */
1326
+ goNext: () => void;
1327
+ /** Navigate to the previous match. */
1328
+ goPrev: () => void;
1329
+ /** Replace the active match. */
1330
+ replaceCurrent: () => void;
1331
+ /** Replace all matches. */
1332
+ replaceAll: () => void;
1333
+ /** Register a function the composable calls to refocus the find input. */
1334
+ registerFocusFn: (fn: () => void) => void;
1335
+ /** Close the find/replace surface. */
1336
+ close: (reason?: unknown) => void;
1337
+ }
1338
+ /**
1339
+ * Read-only context passed to a find/replace resolver to decide how to
1340
+ * render. Does NOT include action functions — the resolver decides, it does
1341
+ * not act.
1342
+ */
1343
+ export interface FindReplaceContext {
1344
+ /** Resolved text strings. */
1345
+ texts: ResolvedFindReplaceTexts;
1346
+ /** Whether replace is available. */
1347
+ replaceEnabled: boolean;
1348
+ }
1349
+ /**
1350
+ * Context passed to an external (framework-agnostic) find/replace renderer.
1351
+ * Vue refs are unwrapped as getter/setter properties for framework neutrality.
1352
+ */
1353
+ export interface FindReplaceRenderContext {
1354
+ /** Empty DOM container to render into. */
1355
+ container: HTMLElement;
1356
+ /** The find/replace handle with getters/setters instead of Vue refs. */
1357
+ findReplace: object;
1358
+ /** Resolves the surface with `{ status: 'submitted', data }`. */
1359
+ resolve: (data?: unknown) => void;
1360
+ /** Resolves the surface with `{ status: 'closed', reason }`. */
1361
+ close: (reason?: unknown) => void;
1362
+ /** The surface id. */
1363
+ surfaceId: string;
1364
+ /** Presentation mode. */
1365
+ mode: SurfaceMode;
1366
+ }
1367
+ /** Resolution returned by a find/replace resolver. */
1368
+ export type FindReplaceResolution = {
1369
+ type: 'default';
1370
+ } | {
1371
+ type: 'none';
1372
+ } | {
1373
+ type: 'custom';
1374
+ component: unknown;
1375
+ props?: Record<string, unknown>;
1376
+ } | {
1377
+ type: 'external';
1378
+ render: (ctx: FindReplaceRenderContext) => {
1379
+ destroy?: () => void;
1380
+ } | void;
1381
+ };
1382
+ /** Configuration for the find/replace surface. */
1383
+ export interface FindReplaceConfig {
1384
+ /** Override find placeholder text. */
1385
+ findPlaceholder?: string;
1386
+ /** Override find input aria-label. */
1387
+ findAriaLabel?: string;
1388
+ /** Override replace placeholder text. */
1389
+ replacePlaceholder?: string;
1390
+ /** Override replace input aria-label. */
1391
+ replaceAriaLabel?: string;
1392
+ /** Override "No results" text. */
1393
+ noResultsLabel?: string;
1394
+ /** Override previous match button title. */
1395
+ previousMatchLabel?: string;
1396
+ /** Override previous match aria-label. */
1397
+ previousMatchAriaLabel?: string;
1398
+ /** Override next match button title. */
1399
+ nextMatchLabel?: string;
1400
+ /** Override next match aria-label. */
1401
+ nextMatchAriaLabel?: string;
1402
+ /** Override close button title. */
1403
+ closeLabel?: string;
1404
+ /** Override close button aria-label. */
1405
+ closeAriaLabel?: string;
1406
+ /** Override replace button text. */
1407
+ replaceLabel?: string;
1408
+ /** Override replace-all button text. */
1409
+ replaceAllLabel?: string;
1410
+ /** Override toggle replace button title. */
1411
+ toggleReplaceLabel?: string;
1412
+ /** Override toggle replace aria-label. */
1413
+ toggleReplaceAriaLabel?: string;
1414
+ /** Override match case toggle text. */
1415
+ matchCaseLabel?: string;
1416
+ /** Override match case aria-label. */
1417
+ matchCaseAriaLabel?: string;
1418
+ /** Override ignore diacritics toggle text. */
1419
+ ignoreDiacriticsLabel?: string;
1420
+ /** Override ignore diacritics aria-label. */
1421
+ ignoreDiacriticsAriaLabel?: string;
1422
+ /** Override regex toggle text. */
1423
+ regexLabel?: string;
1424
+ /** Override regex toggle aria-label. */
1425
+ regexAriaLabel?: string;
1426
+ /** Override the inline invalid-pattern error text. */
1427
+ invalidPatternLabel?: string;
1428
+ /** Whether replace is available (default: true). */
1429
+ replaceEnabled?: boolean;
1430
+ /** When true, search includes text from pending tracked deletions. Defaults to false. */
1431
+ includeDeletedText?: boolean;
1432
+ /** Vue component to render as custom find/replace content. Mutually exclusive with `render`. */
1433
+ component?: unknown;
1434
+ /** Extra props passed to the custom Vue component. */
1435
+ props?: Record<string, unknown>;
1436
+ /** External (framework-agnostic) renderer. Mutually exclusive with `component`. */
1437
+ render?: (ctx: FindReplaceRenderContext) => {
1438
+ destroy?: () => void;
1439
+ } | void;
1440
+ /** Conditional resolver. Can coexist with `component`/`render`. */
1441
+ resolver?: (ctx: FindReplaceContext) => FindReplaceResolution | null | undefined;
1442
+ /**
1443
+ * Where the floating find/replace bar is pinned, so it can be moved clear of
1444
+ * the document. `placement` is a corner/edge preset; explicit insets
1445
+ * (`top`/`right`/`bottom`/`left`, a px number or CSS length) override it.
1446
+ * Defaults to `{ placement: 'top-right' }`.
1447
+ */
1448
+ floating?: {
1449
+ placement?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
1450
+ top?: number | string;
1451
+ right?: number | string;
1452
+ bottom?: number | string;
1453
+ left?: number | string;
1454
+ width?: number | string;
1455
+ maxWidth?: number | string;
1456
+ maxHeight?: number | string;
1457
+ };
1458
+ }
1459
+ /**
1460
+ * Payload passed to a permission resolver callback. SuperDoc invokes
1461
+ * the resolver when a consumer registers one via
1462
+ * `Config.permissionResolver` or `Modules.comments.permissionResolver`,
1463
+ * forwarding the in-flight check so the resolver can decide whether
1464
+ * to override the built-in policy.
1465
+ *
1466
+ * Returning `boolean` from the resolver overrides the default;
1467
+ * returning `undefined` (or any non-boolean) falls through to
1468
+ * `defaultDecision`, which the resolver receives so it can mirror or
1469
+ * branch off the built-in policy without re-deriving it.
1470
+ *
1471
+ * `comment` and `trackedChange` are typed as `object | null` because
1472
+ * consumer comment / tracked-change shapes vary; resolvers that read
1473
+ * fields on those payloads should narrow before use.
1474
+ *
1475
+ * Distinct from `CanPerformPermissionParams`, which is the input
1476
+ * shape consumers pass _to_ `SuperDoc#canPerformPermission`. That
1477
+ * input becomes part of this resolver payload after SuperDoc resolves
1478
+ * `currentUser`, `superdoc`, and `defaultDecision`.
1479
+ */
1480
+ export interface PermissionResolverParams {
1481
+ /** The permission key being checked (e.g. `'comment.create'`). */
1482
+ permission: string;
1483
+ /**
1484
+ * The effective role (consumer-supplied or falling back to
1485
+ * `Config.role`). The key is always present on the payload; the
1486
+ * value is `undefined` when `Config.role` was never set.
1487
+ */
1488
+ role: string | undefined;
1489
+ /**
1490
+ * The effective internal/external flag (consumer-supplied or
1491
+ * `Config.isInternal`). The key is always present; the value is
1492
+ * `undefined` when `Config.isInternal` was never set.
1493
+ */
1494
+ isInternal: boolean | undefined;
1495
+ /**
1496
+ * What the built-in policy would return if the resolver does not
1497
+ * override. Resolvers can return this value to defer to the
1498
+ * default, or branch off it.
1499
+ */
1500
+ defaultDecision: boolean;
1501
+ /** The comment object being acted on, if any. Shape is consumer-defined. */
1502
+ comment: object | null;
1503
+ /** The tracked-change payload (as emitted by the editor) being acted on, if any. */
1504
+ trackedChange: object | null;
1505
+ /** The active user performing the action; resolved from `Config.user`. */
1506
+ currentUser: User | null;
1507
+ /** The SuperDoc instance the check ran against. */
1508
+ superdoc: SuperDoc | null;
1509
+ }
1510
+ /**
1511
+ * Input shape for `SuperDoc#canPerformPermission`. All fields are
1512
+ * optional; an empty payload short-circuits to `false`. `role` and
1513
+ * `isInternal` fall back to `Config.role` / `Config.isInternal` when
1514
+ * omitted. `comment` and `trackedChange` carry open index signatures
1515
+ * because the runtime forwards the full payload to the resolver
1516
+ * context, and consumer comment / tracked-change shapes vary; the
1517
+ * named fields below are the ones the method itself reads. Distinct
1518
+ * from `PermissionResolverParams`, which is the exported resolver
1519
+ * callback payload SuperDoc passes to configured permission resolvers
1520
+ * (with resolved `currentUser`, `superdoc`, and `defaultDecision`
1521
+ * context attached).
1522
+ */
1523
+ export interface CanPerformPermissionParams {
1524
+ /** The permission key to check (e.g. `'comment.create'`). Required at runtime; omitting returns `false`. */
1525
+ permission?: string;
1526
+ /** Override `Config.role` for this check. */
1527
+ role?: string;
1528
+ /** Override `Config.isInternal` for this check. */
1529
+ isInternal?: boolean;
1530
+ /** The comment object being acted on, if any. */
1531
+ comment?: (object & Record<string, unknown>) | null;
1532
+ /** The tracked-change payload (as emitted by the editor) being acted on, if any. */
1533
+ trackedChange?: ({
1534
+ id?: string;
1535
+ commentId?: string;
1536
+ comment?: unknown;
1537
+ } & Record<string, unknown>) | null;
1538
+ }
1539
+ /** Modules registered with the SuperDoc instance. */
1540
+ export interface Modules {
1541
+ /** Content controls module configuration. */
1542
+ contentControls?: {
1543
+ /** Built-in SDT chrome rendering mode. */
1544
+ chrome?: 'default' | 'none';
1545
+ };
1546
+ /**
1547
+ * Comments module configuration (false to disable). The named fields below
1548
+ * are typed for IDE help; the runtime spreads the entire object through the
1549
+ * comments store and accepts additional keys (`useInternalExternalComments`,
1550
+ * `suppressInternalExternalComments`, etc.), so the type intersects with an
1551
+ * open index signature to keep pass-through configs compiling.
1552
+ */
1553
+ comments?: false | ({
1554
+ /** Custom permission resolver for comment actions. */
1555
+ permissionResolver?: (params: PermissionResolverParams) => boolean | undefined;
1556
+ /** Hide and reject every comment and tracked-change mutation affordance. */
1557
+ readOnly?: boolean;
1558
+ /** Show ordinary comment resolve/reopen actions when writable (default: true). */
1559
+ allowResolve?: boolean;
1560
+ /** Comment highlight colors (internal/external and active overrides). */
1561
+ highlightColors?: {
1562
+ /** Base highlight color for internal comments. */
1563
+ internal?: string;
1564
+ /** Base highlight color for external comments. */
1565
+ external?: string;
1566
+ /** Active highlight color override for internal comments. */
1567
+ activeInternal?: string;
1568
+ /** Active highlight color override for external comments. */
1569
+ activeExternal?: string;
1570
+ };
1571
+ /** Comment highlight opacity values (0-1). */
1572
+ highlightOpacity?: {
1573
+ /** Opacity for active comment highlight. */
1574
+ active?: number;
1575
+ /** Opacity for inactive comment highlight. */
1576
+ inactive?: number;
1577
+ };
1578
+ /** Hover highlight color for comment marks. */
1579
+ highlightHoverColor?: string;
1580
+ /** Track change highlight colors. */
1581
+ trackChangeHighlightColors?: {
1582
+ /** Border color for inserted text highlight. */
1583
+ insertBorder?: string;
1584
+ /** Background color for inserted text highlight. */
1585
+ insertBackground?: string;
1586
+ /** Border color for deleted text highlight. */
1587
+ deleteBorder?: string;
1588
+ /** Background color for deleted text highlight. */
1589
+ deleteBackground?: string;
1590
+ /** Border color for format change highlight. */
1591
+ formatBorder?: string;
1592
+ };
1593
+ /** Active track change highlight colors (defaults to trackChangeHighlightColors). */
1594
+ trackChangeActiveHighlightColors?: {
1595
+ /** Active border color for inserted text highlight. */
1596
+ insertBorder?: string;
1597
+ /** Active background color for inserted text highlight. */
1598
+ insertBackground?: string;
1599
+ /** Active border color for deleted text highlight. */
1600
+ deleteBorder?: string;
1601
+ /** Active background color for deleted text highlight. */
1602
+ deleteBackground?: string;
1603
+ /** Active border color for format change highlight. */
1604
+ formatBorder?: string;
1605
+ };
1606
+ /** Comments/track-changes UI display policy for responsive comment surfaces. */
1607
+ displayMode?: 'auto' | 'sidebar' | 'inline';
1608
+ /** CSS selector for an explicit width measurement target in auto mode. */
1609
+ compactMeasurementSelector?: string;
1610
+ /** Optional fixed compact-mode breakpoint override in pixels. */
1611
+ compactBreakpointPx?: number;
1612
+ } & Record<string, unknown>);
1613
+ /** AI module configuration. */
1614
+ ai?: {
1615
+ /** Harbour API key for AI features. */
1616
+ apiKey?: string;
1617
+ /** Custom endpoint URL for AI services. */
1618
+ endpoint?: string;
1619
+ } & Record<string, unknown>;
1620
+ /** PDF module configuration. */
1621
+ pdf?: {
1622
+ /** Preloaded pdf.js library instance. */
1623
+ pdfLib: object;
1624
+ /** PDF.js worker source URL (falls back to CDN when omitted). */
1625
+ workerSrc?: string;
1626
+ /** Whether to auto-configure pdf.js worker. */
1627
+ setWorker?: boolean;
1628
+ /** Enable text layer rendering (default: false). */
1629
+ textLayer?: boolean;
1630
+ /** Canvas render scale (quality). */
1631
+ outputScale?: number;
1632
+ } & Record<string, unknown>;
1633
+ /** Collaboration module configuration. */
1634
+ collaboration?: CollaborationConfig;
1635
+ /**
1636
+ * Toolbar module configuration. Pass `true` to configure the toolbar with
1637
+ * defaults (equivalent to an empty object).
1638
+ *
1639
+ * This field configures the toolbar's contents and behavior; it does not by
1640
+ * itself provide a place to render it. A toolbar is only rendered once a
1641
+ * mount target resolves, from either `selector` here or the top-level
1642
+ * `Config.toolbar`. Without one, SuperDoc still creates the
1643
+ * `superdoc.toolbar` handle (item lookup and command routing keep working)
1644
+ * but renders no toolbar UI.
1645
+ *
1646
+ * Fallbacks to the top-level aliases are per field: `selector` falls back to
1647
+ * `Config.toolbar`, `icons` to `Config.toolbarIcons`, and `texts` to
1648
+ * `Config.toolbarTexts`. `Config.toolbarGroups` supplies the group ordering,
1649
+ * not `groups`: the two are different settings. `groups` maps group ids to
1650
+ * item ids (composition) and has no top-level alias, so omitting it uses the
1651
+ * built-in composition. Supplying it also replaces the group ordering with
1652
+ * its own keys.
1653
+ */
1654
+ toolbar?: boolean | ({
1655
+ /**
1656
+ * Selector for the DOM element to render the toolbar into: an id
1657
+ * selector (`#toolbar`), a class selector (`.toolbar`), or a bare
1658
+ * element id (`toolbar`). Must be a string, not an `HTMLElement`
1659
+ * reference — pass an element through the top-level `Config.toolbar`.
1660
+ * Falls back to `Config.toolbar` if omitted.
1661
+ */
1662
+ selector?: string;
1663
+ /** Toolbar item ids to hide from the default set. */
1664
+ excludeItems?: string[];
1665
+ /**
1666
+ * Object map of group id to item ids
1667
+ * (`{ left: [...], center: [...], right: [...] }`) that overrides the
1668
+ * default group composition. Default group ids are
1669
+ * `'left' | 'center' | 'right'`. To pass an ordered group-id array
1670
+ * (`['left', 'center', 'right']`) use the top-level `Config.toolbarGroups`
1671
+ * instead — the array form is not accepted here.
1672
+ */
1673
+ groups?: Record<string, string[]>;
1674
+ /** Icon overrides keyed by toolbar item id. Falls back to `Config.toolbarIcons`. */
1675
+ icons?: Record<string, unknown>;
1676
+ /** Text/label overrides keyed by toolbar item id. Falls back to `Config.toolbarTexts`. */
1677
+ texts?: Record<string, string>;
1678
+ /** Custom font list rendered in the font-family dropdown. */
1679
+ fonts?: FontConfig[];
1680
+ /** Hide buttons that overflow the available width (default: true). */
1681
+ hideButtons?: boolean;
1682
+ /** Recompute the visible toolbar item set on container resize (default: false). */
1683
+ responsiveToContainer?: boolean;
1684
+ /**
1685
+ * Custom toolbar buttons appended to the default item set. Each entry is
1686
+ * a `ToolbarItem`-shaped object (see the consumer-facing toolbar docs for
1687
+ * the full shape). The internal `ToolbarItem` type is not yet on the
1688
+ * public surface; this typedef accepts the structural shape consumers
1689
+ * already pass through `modules.toolbar.customButtons`.
1690
+ */
1691
+ customButtons?: Array<Record<string, unknown>>;
1692
+ /**
1693
+ * Show the formatting marks (pilcrow) button in the toolbar. Off by
1694
+ * default. Distinct from `layoutEngineOptions.showFormattingMarks`, which
1695
+ * controls whether the marks render in the document.
1696
+ */
1697
+ showFormattingMarksButton?: boolean;
1698
+ /**
1699
+ * Show the table of contents insert button in the toolbar. Off by default.
1700
+ */
1701
+ showTableOfContentsButton?: boolean;
1702
+ } & Record<string, unknown>);
1703
+ /** Link click popover configuration. */
1704
+ links?: {
1705
+ /** Custom resolver for the link click popover. */
1706
+ popoverResolver?: LinkPopoverResolver;
1707
+ } & Record<string, unknown>;
1708
+ /** Context menu module configuration. */
1709
+ contextMenu?: ContextMenuConfig;
1710
+ /** Deprecated. Use `contextMenu` instead. */
1711
+ slashMenu?: object;
1712
+ /** Surface system configuration. */
1713
+ surfaces?: SurfacesModuleConfig;
1714
+ /** Track changes module configuration. */
1715
+ trackChanges?: TrackChangesModuleConfig;
1716
+ /**
1717
+ * Whiteboard module configuration. Pass `false` to disable the module
1718
+ * entirely; pass an object to opt in (with `enabled: true`) or to keep it
1719
+ * registered but inert (`enabled: false`, the default when no field is set).
1720
+ */
1721
+ whiteboard?: false | {
1722
+ enabled?: boolean;
1723
+ };
1724
+ }
1725
+ /**
1726
+ * Canonical configuration for the track-changes module. Supersedes the
1727
+ * top-level `config.trackChanges` and `config.layoutEngineOptions.trackedChanges`
1728
+ * keys, which remain supported as deprecated aliases.
1729
+ */
1730
+ /**
1731
+ * Identity of a tracked-change author, passed to a per-author color
1732
+ * {@link TrackChangesAuthorColorsConfig.resolve | resolver}. Mirrors the
1733
+ * author metadata SuperDoc carries on each tracked change.
1734
+ */
1735
+ export interface TrackChangeAuthor {
1736
+ /** Author display name (from the OOXML `w:author` attribute). */
1737
+ name?: string;
1738
+ /** Author email, when available. */
1739
+ email?: string;
1740
+ /** Author avatar image URL, when available. */
1741
+ image?: string;
1742
+ }
1743
+ /**
1744
+ * Per-author tracked-change color configuration. Lets hosts assign a color
1745
+ * per author without injecting CSS `!important` rules against
1746
+ * `[data-track-change-author]` or reaching into private editor internals.
1747
+ *
1748
+ * Resolution order per author: `overrides` by identity (email first, then
1749
+ * name; exact match) → `resolve(author)` → a deterministic fallback color
1750
+ * derived from the author identity. The fallback guarantees imported /
1751
+ * discovered authors the host did not configure ahead of time still receive
1752
+ * a stable, distinct color.
1753
+ */
1754
+ export interface TrackChangesAuthorColorsConfig {
1755
+ /** When `false`, per-author colors are not applied. Defaults to enabled. */
1756
+ enabled?: boolean;
1757
+ /**
1758
+ * Color overrides keyed by author identity. Both `email` and `name` keys
1759
+ * are supported (email is checked first); matching is exact.
1760
+ */
1761
+ overrides?: Record<string, string>;
1762
+ /**
1763
+ * Resolver consulted after `overrides`. Return a CSS color string, or
1764
+ * `undefined` to fall through to the deterministic fallback.
1765
+ */
1766
+ resolve?: (author: TrackChangeAuthor) => string | undefined;
1767
+ }
1768
+ /**
1769
+ * Semantic tracked-change color categories configurable through
1770
+ * {@link TrackChangesSemanticColorsConfig}. These color review roles: inserted
1771
+ * text, deleted text, moved-from/-to text, table cell insertion/deletion, cell
1772
+ * merge, and cell split, not authors. The same author can therefore receive
1773
+ * different colors for different review roles, which the author-identity path
1774
+ * cannot express.
1775
+ *
1776
+ * Whole-table, table-row, and table-split changes are NOT part of this config
1777
+ * surface: their paint colors are themed via the
1778
+ * `--sd-tracked-changes-table-*` CSS variables instead.
1779
+ *
1780
+ * Declared locally (mirroring the {@link TrackChangeAuthor} pattern) so the
1781
+ * published `superdoc` type graph never depends on the private
1782
+ * `@superdoc/contracts` specifier. Mirrors the
1783
+ * `TrackedChangeConfigurableSemanticColorKey` union in `@superdoc/contracts`.
1784
+ */
1785
+ export type TrackedChangeSemanticColorKey = 'insertion' | 'deletion' | 'move' | 'move-from' | 'move-to' | 'table-cell-insertion' | 'table-cell-deletion' | 'cell-merge' | 'cell-split';
1786
+ /**
1787
+ * Input passed to a semantic tracked-change color
1788
+ * {@link TrackChangesSemanticColorsConfig.resolve | resolver} for a single
1789
+ * review role. `key` is always present; the remaining fields describe the
1790
+ * change being colored when SuperDoc knows them.
1791
+ */
1792
+ export interface TrackedChangeSemanticColorResolverInput {
1793
+ /** Semantic category being colored. */
1794
+ key: TrackedChangeSemanticColorKey;
1795
+ /** Author identity, when known. Semantic colors are not author-derived. */
1796
+ author?: TrackChangeAuthor;
1797
+ /** Raw tracked-change type, when known. */
1798
+ type?: string;
1799
+ /** Logical subtype, when known. */
1800
+ subtype?: string;
1801
+ /** Target kind (e.g. text/cell/row/table), when known. */
1802
+ targetKind?: string;
1803
+ /** Scope of the semantic paint anchor, when known. */
1804
+ semanticAnchorScope?: string;
1805
+ }
1806
+ /**
1807
+ * Semantic tracked-change color configuration. The second
1808
+ * tracked-change color axis alongside {@link TrackChangesAuthorColorsConfig}:
1809
+ * `authorColors` colors by author identity, `semanticColors` colors review
1810
+ * roles (inserted text, deleted text, moved text, table cell
1811
+ * insertion/deletion, cell merge, cell split).
1812
+ *
1813
+ * Supported semantic colors are active by default. Word-like defaults apply with
1814
+ * no configuration: insertion blue, deletion red, and moved text green.
1815
+ * Resolution order per key: `overrides` by semantic key, `overrides.move` for
1816
+ * `move-from` / `move-to`, then `resolve(input)`, then the built-in default for
1817
+ * that key. Set `enabled: false` to suppress semantic colors and fall back to
1818
+ * existing author/broad defaults.
1819
+ *
1820
+ * Whole-table, table-row, and table-split paint colors are themed through the
1821
+ * `--sd-tracked-changes-table-*` CSS variables, not this config.
1822
+ *
1823
+ * This is separate from `modules.comments.trackChangeHighlightColors`, the
1824
+ * older broad insert/delete/format CSS-variable surface.
1825
+ */
1826
+ export interface TrackChangesSemanticColorsConfig {
1827
+ /** When `false`, semantic colors are not applied. Defaults to enabled. */
1828
+ enabled?: boolean;
1829
+ /**
1830
+ * Color overrides keyed by semantic category (`'insertion'`, `'deletion'`,
1831
+ * `'move'`, `'move-from'`, `'move-to'`, `'table-cell-insertion'`,
1832
+ * `'table-cell-deletion'`, `'cell-merge'`, `'cell-split'`). `move` applies
1833
+ * to both move sides unless a side-specific override exists.
1834
+ */
1835
+ overrides?: Partial<Record<TrackedChangeSemanticColorKey, string>>;
1836
+ /**
1837
+ * Resolver consulted after `overrides`. Return a CSS color string, or
1838
+ * `undefined` to fall through to the built-in default for the key.
1839
+ */
1840
+ resolve?: (input: TrackedChangeSemanticColorResolverInput) => string | undefined;
1841
+ }
1842
+ export interface TrackChangesModuleConfig {
1843
+ /** Whether tracked-change indicators are shown in viewing mode. */
1844
+ visible?: boolean;
1845
+ /**
1846
+ * Rendering mode for tracked changes (see `TrackedChangesMode` in
1847
+ * `@superdoc/contracts`).
1848
+ * - 'review': show insertions and deletions inline (default for editing/suggesting)
1849
+ * - 'original': show the document as it existed before tracked changes (default for viewing when `visible` is false)
1850
+ * - 'final': show the document with changes applied
1851
+ * - 'off': disable tracked-change rendering
1852
+ */
1853
+ mode?: 'review' | 'original' | 'final' | 'off';
1854
+ /** Whether the layout engine treats tracked changes as active. */
1855
+ enabled?: boolean;
1856
+ /**
1857
+ * How a tracked replacement (adjacent insertion + deletion created by typing
1858
+ * over selected text) surfaces in the UI and API.
1859
+ * - `'paired'` (default, Google Docs model): the two halves share one id
1860
+ * and resolve together with a single accept/reject click.
1861
+ * - `'independent'` (Microsoft Word / ECMA-376 §17.13.5 model): each
1862
+ * insertion and each deletion has its own id, is addressable on its own,
1863
+ * and resolves independently.
1864
+ */
1865
+ replacements?: 'paired' | 'independent';
1866
+ /**
1867
+ * Per-author tracked-change colors. When configured, insert/delete/format
1868
+ * tracked-change highlights are tinted per author through the
1869
+ * `--sd-tracked-changes-*` CSS variable surface, and
1870
+ * `ui.trackChanges.getSnapshot()` exposes the resolved author colors.
1871
+ */
1872
+ authorColors?: TrackChangesAuthorColorsConfig;
1873
+ /**
1874
+ * Semantic (structural) tracked-change colors. Colors structural change
1875
+ * subtypes: moved text, table cell insertion/deletion, cell merge, and cell
1876
+ * split, independently of {@link authorColors}. Supported keys are active by
1877
+ * default; set `enabled: false` to fall back to existing author/broad
1878
+ * defaults. Separate from `modules.comments.trackChangeHighlightColors`.
1879
+ */
1880
+ semanticColors?: TrackChangesSemanticColorsConfig;
1881
+ }
1882
+ export type DocumentMode = 'editing' | 'viewing' | 'suggesting';
1883
+ export type ExportType = 'docx' | 'pdf' | 'html';
1884
+ /**
1885
+ * - 'external': Include only external comments (default)
1886
+ * - 'clean': Export without any comments
1887
+ */
1888
+ export type CommentsType = 'external' | 'clean';
1889
+ /**
1890
+ * Document view layout values — mirrors OOXML ST_View (ECMA-376 §17.18.102).
1891
+ * - 'print': Print Layout View — displays document as it prints (default)
1892
+ * - 'web': Web Page View — content reflows to fit container (mobile/accessibility)
1893
+ */
1894
+ export type ViewLayout = 'print' | 'web';
1895
+ /**
1896
+ * Document view options for controlling how the document is displayed.
1897
+ * Mirrors OOXML document view settings.
1898
+ */
1899
+ export interface ViewOptions {
1900
+ /** Document view layout (OOXML ST_View compatible). */
1901
+ layout?: ViewLayout;
1902
+ }
1903
+ export interface ExportParams {
1904
+ /** File formats to export. */
1905
+ exportType?: ExportType[];
1906
+ /** How to handle comments. */
1907
+ commentsType?: CommentsType;
1908
+ /** Custom filename (without extension). */
1909
+ exportedName?: string;
1910
+ /** Extra files to include in the export zip. */
1911
+ additionalFiles?: globalThis.Blob[];
1912
+ /** Filenames for the additional files. */
1913
+ additionalFileNames?: string[];
1914
+ /** Whether this is a final document export. */
1915
+ isFinalDoc?: boolean;
1916
+ /** Auto-download or return blob. */
1917
+ triggerDownload?: boolean;
1918
+ /**
1919
+ * Color for field highlights. The runtime defaults to `null` when no
1920
+ * value is supplied (and forwards `null` through to the underlying
1921
+ * editor export, which accepts `string | null`); the typedef accepts
1922
+ * `null` explicitly so consumers can pass an explicit "no highlight"
1923
+ * value without a typecheck failure.
1924
+ */
1925
+ fieldsHighlightColor?: string | null;
1926
+ }
1927
+ /** Surface where the edit originated. */
1928
+ export type EditorSurface = 'body' | 'header' | 'footer';
1929
+ export interface EditorUpdateEvent {
1930
+ /**
1931
+ * The primary editor associated with the update. For header/footer
1932
+ * edits, this is the main body editor. Optional because the runtime
1933
+ * payload builder falls back to `sourceEditor` and emits `undefined`
1934
+ * when neither is present (defensive in test/stub paths); consumers
1935
+ * should narrow before use.
1936
+ */
1937
+ editor?: Editor;
1938
+ /** The editor instance that emitted the update. For body edits, this matches `editor`. */
1939
+ sourceEditor?: Editor;
1940
+ /** The surface where the edit originated. */
1941
+ surface: EditorSurface;
1942
+ /**
1943
+ * Relationship ID for header/footer edits. Always present (the
1944
+ * runtime payload builder defaults to `null`); may be `null` for
1945
+ * body edits.
1946
+ */
1947
+ headerId: string | null;
1948
+ /**
1949
+ * Header/footer variant (`default`, `first`, `even`, `odd`) when
1950
+ * available. Always present (defaults to `null`); may be `null`.
1951
+ */
1952
+ sectionType: string | null;
1953
+ }
1954
+ /**
1955
+ * Payload emitted with the `ready` event and passed to `Config.onReady`.
1956
+ * Carries the live SuperDoc instance.
1957
+ */
1958
+ export interface SuperDocReadyPayload {
1959
+ superdoc: SuperDoc;
1960
+ }
1961
+ /**
1962
+ * Payload emitted with the `editorCreate` / `editorBeforeCreate` /
1963
+ * `collaboration-ready` events and passed to the matching `Config.onX`
1964
+ * callbacks. The runtime always wraps the editor in this shape; bare
1965
+ * `Editor` references in earlier callback typings were incorrect.
1966
+ */
1967
+ export interface SuperDocEditorPayload {
1968
+ editor: Editor;
1969
+ }
1970
+ /**
1971
+ * Payload emitted with `document-replaced`.
1972
+ *
1973
+ * `editor` is the editor whose replacement completed, not necessarily the one
1974
+ * active when the event is received: a replace is asynchronous, so the active
1975
+ * editor can move while it is in flight. A consumer must compare this against
1976
+ * the editor it is bound to and ignore anything else.
1977
+ *
1978
+ * Typed `unknown` rather than `Editor`: the active editor can be a v2 facade
1979
+ * that does not satisfy `Editor` (`getHTML` is required there and absent on the
1980
+ * facade), so annotating it as `Editor` would promise methods that are not
1981
+ * present. It is an identity token to compare, not an object to call.
1982
+ */
1983
+ export interface SuperDocDocumentReplacedPayload {
1984
+ editor: unknown;
1985
+ /**
1986
+ * The host that rendered the replaced document.
1987
+ *
1988
+ * Carried because `editor` alone cannot be matched in the V2 browser path: a
1989
+ * successful replace emits its ready payload before `replaceFile()` resolves,
1990
+ * so the shell has already installed a NEW facade by the time this event
1991
+ * fires, and the captured facade is one the controller no longer holds. The
1992
+ * host survives that swap, so it is the identity that still lines up.
1993
+ */
1994
+ host: unknown;
1995
+ }
1996
+ /**
1997
+ * Payload emitted with the `locked` event and passed to
1998
+ * `Config.onLocked`. `lockedBy` is non-optional because the runtime
1999
+ * always includes the key (`lockSuperdoc` defaults `lockedBy` to
2000
+ * `null`); the value may be `User | null` because unlocking and
2001
+ * unattributed locks both pass `null`.
2002
+ */
2003
+ export interface SuperDocLockedPayload {
2004
+ isLocked: boolean;
2005
+ lockedBy: User | null;
2006
+ }
2007
+ /**
2008
+ * Payload emitted with the `awareness-update` event and passed to
2009
+ * `Config.onAwarenessUpdate`. Field set differs from older inline
2010
+ * declarations: the runtime emits `superdoc` (not `context`) and
2011
+ * includes `added` / `removed` client-id arrays alongside `states`.
2012
+ */
2013
+ export interface SuperDocAwarenessUpdatePayload {
2014
+ states: AwarenessState[];
2015
+ added: number[];
2016
+ removed: number[];
2017
+ superdoc: SuperDoc;
2018
+ }
2019
+ /**
2020
+ * Payload emitted with the `comments-update` event and passed to
2021
+ * `Config.onCommentsUpdate`. Field set differs from older inline
2022
+ * declarations: the runtime emits `comment?` and `changes?` (never a
2023
+ * `data` field).
2024
+ */
2025
+ export interface SuperDocCommentsUpdatePayload {
2026
+ /** Update kind (e.g. `'created'`, `'updated'`, `'deleted'`); set by the comments store. */
2027
+ type: string;
2028
+ /** The comment object the update refers to, when applicable. */
2029
+ comment?: Comment;
2030
+ /** Per-field change set when the update is a mutation. */
2031
+ changes?: Array<{
2032
+ key: string;
2033
+ commentId: string;
2034
+ fileId?: string | null;
2035
+ }>;
2036
+ /**
2037
+ * The Document API selection snapshot captured at the moment a
2038
+ * `'pending'` comment was started, before the pending mark is
2039
+ * inserted (which clears the live DOM selection). Present only on the
2040
+ * `'pending'` event. When it has a `target`, forward it straight to
2041
+ * `ui.comments.createFromCapture(pendingSelection, { text })` to build
2042
+ * the comment from a custom composer without tracking the selection
2043
+ * yourself ahead of the floating-bubble click.
2044
+ *
2045
+ * `null` means the pending comment did not start from an addressable
2046
+ * SuperDoc editor text selection, or the active editor/selection API was
2047
+ * unavailable. PDF and other non-SuperDoc editor selections emit `null`.
2048
+ * Empty SuperDoc editor selections can still yield a `SelectionInfo` with
2049
+ * `target: null`.
2050
+ */
2051
+ pendingSelection?: SelectionInfo | null;
2052
+ }
2053
+ export interface EditorTransactionLike {
2054
+ readonly docChanged?: boolean;
2055
+ readonly doc?: {
2056
+ readonly content?: {
2057
+ readonly size?: number;
2058
+ };
2059
+ nodesBetween?: (from: number, to: number, callback: (node: {
2060
+ readonly type?: {
2061
+ readonly name?: string;
2062
+ };
2063
+ readonly attrs?: Record<string, unknown>;
2064
+ readonly marks?: ReadonlyArray<{
2065
+ readonly type?: {
2066
+ readonly name?: string;
2067
+ };
2068
+ readonly attrs?: Record<string, unknown>;
2069
+ }>;
2070
+ }) => false | void | undefined) => void;
2071
+ };
2072
+ readonly mapping?: {
2073
+ readonly maps?: ReadonlyArray<{
2074
+ forEach(callback: (oldStart: number, oldEnd: number, newStart: number, newEnd: number) => void): void;
2075
+ }>;
2076
+ slice?(from: number): {
2077
+ map(position: number, assoc?: number): number;
2078
+ };
2079
+ };
2080
+ getMeta?(key: unknown): unknown;
2081
+ }
2082
+ export interface EditorTransactionEvent {
2083
+ /** The primary editor associated with the transaction. For header/footer edits, this is the main body editor. */
2084
+ editor: Editor;
2085
+ /** The editor instance that emitted the transaction. For body edits, this matches `editor`. */
2086
+ sourceEditor: Editor;
2087
+ /** The editor transaction emitted by the source editor. */
2088
+ transaction: EditorTransactionLike;
2089
+ /** Time spent applying the transaction, in milliseconds. */
2090
+ duration?: number;
2091
+ /** The surface where the transaction originated. */
2092
+ surface: EditorSurface;
2093
+ /** Relationship ID for header/footer edits. */
2094
+ headerId?: string | null;
2095
+ /** Header/footer variant (`default`, `first`, `even`, `odd`) when available. */
2096
+ sectionType?: string | null;
2097
+ }
2098
+ export interface SdtRef {
2099
+ id: string;
2100
+ tag?: string;
2101
+ alias?: string;
2102
+ controlType: string;
2103
+ scope: 'inline' | 'block';
2104
+ }
2105
+ export interface ContentControlActiveChangePayload {
2106
+ active: SdtRef | null;
2107
+ previous: SdtRef | null;
2108
+ /**
2109
+ * Active content-control stack for the new selection, innermost first
2110
+ * (matches `ui.contentControls` activeIds). `active` is `activePath[0]`.
2111
+ * Empty when the selection is not inside any control. Lets nested-aware
2112
+ * custom UI read the surrounding controls without combining with observe().
2113
+ */
2114
+ activePath: SdtRef[];
2115
+ source: 'keyboard' | 'pointer';
2116
+ }
2117
+ export interface ContentControlClickPayload {
2118
+ target: SdtRef;
2119
+ source: 'pointer';
2120
+ }
2121
+ export interface SuperDocLayoutEngineOptions {
2122
+ /**
2123
+ * Layout engine flow mode.
2124
+ * - 'paginated': standard page-first layout (default)
2125
+ * - 'semantic': continuous semantic flow without visible pagination boundaries
2126
+ */
2127
+ flowMode?: 'paginated' | 'semantic';
2128
+ /**
2129
+ * Deprecated. Use `modules.trackChanges` instead. Optional override for
2130
+ * paginated track-changes rendering (e.g., `{ mode: 'original' }` or
2131
+ * `{ enabled: false }`).
2132
+ */
2133
+ trackedChanges?: object;
2134
+ /**
2135
+ * Page virtualization options for paginated layout. Defaults to
2136
+ * `{ enabled: true, window: 5, overscan: 1 }` to render only the visible
2137
+ * window of pages plus a small overscan buffer.
2138
+ */
2139
+ virtualization?: {
2140
+ /** Whether virtualization is active (default: true). */
2141
+ enabled?: boolean;
2142
+ /** Number of pages kept rendered around the active page (default: 5). */
2143
+ window?: number;
2144
+ /** Extra pages rendered outside the active window for smoother scrolling (default: 1). */
2145
+ overscan?: number;
2146
+ };
2147
+ /**
2148
+ * Whether bookmark indicators are shown in the rendered layout. Toggleable
2149
+ * at runtime via `superdoc.setShowBookmarks()`.
2150
+ */
2151
+ showBookmarks?: boolean;
2152
+ /**
2153
+ * Whether nonprinting formatting marks are shown in the rendered layout.
2154
+ * Toggleable at runtime via `superdoc.setShowFormattingMarks()`.
2155
+ */
2156
+ showFormattingMarks?: boolean;
2157
+ /**
2158
+ * Whether the V2 mounted body paints progressively from an initial window.
2159
+ * Defaults to `true`.
2160
+ *
2161
+ * @experimental Diagnostic posture, not a supported product mode and not a
2162
+ * pipeline bypass: both settings route through the same canonical
2163
+ * render-pipeline engine. `true` (default) paints an initial window and
2164
+ * appends as source streams in (the open-first-window and append engine
2165
+ * passes); `false` makes EVERY mounted repaint wait for complete source
2166
+ * coverage and materialize the full body before painting — not only the
2167
+ * first paint — via the exact-complete engine pass, which can be much
2168
+ * slower than progressive streaming on large documents. Failures fail
2169
+ * closed: the mount/repaint promise rejects with a named
2170
+ * `render.complete-before-first-paint-*` error and the host records a
2171
+ * render-readiness diagnostic. The render surface has no independent
2172
+ * first-paint timeout; callers and harnesses must provide their own.
2173
+ */
2174
+ progressiveBodyStreaming?: boolean;
2175
+ /**
2176
+ * P6a: per-paint work-counter HUD (console table +
2177
+ * `data-v2-paint-hud-recent`) and the dark reuse-collapse tripwire for the
2178
+ * windowed paint owner (since P7, vertical-paginated flow's only paint
2179
+ * path — no flag needed).
2180
+ *
2181
+ * @experimental Dev/verification instrument.
2182
+ */
2183
+ paintHud?: boolean;
2184
+ }
2185
+ export interface ViewingVisibilityConfig {
2186
+ visible?: boolean;
2187
+ }
2188
+ export interface SuperDocTelemetryConfig {
2189
+ enabled: boolean;
2190
+ endpoint?: string;
2191
+ metadata?: Record<string, unknown>;
2192
+ licenseKey?: string;
2193
+ }
2194
+ /**
2195
+ * Exception payload raised by the SuperDoc store during document
2196
+ * initialization (empty entry, init failure, normalization error).
2197
+ * Always carries `stage: 'document-init'` and the offending document
2198
+ * config (`null`/`undefined` when the entry itself was empty).
2199
+ *
2200
+ * `error` is `unknown` because the catch path in `initializeDocuments`
2201
+ * forwards the raw caught value (`catch (e) { emitException({ error: e,
2202
+ * ... }) }`) and thrown values can be anything in JS. The other two
2203
+ * emit sites construct `new Error(...)`, but consumers must narrow
2204
+ * before reading `.message`.
2205
+ */
2206
+ export interface SuperDocExceptionStorePayload {
2207
+ error: unknown;
2208
+ stage: 'document-init';
2209
+ document: Document | null | undefined;
2210
+ }
2211
+ /**
2212
+ * Exception payload raised when restoring SuperDoc state from a
2213
+ * persisted source fails. Carries the document the runtime tried to
2214
+ * restore.
2215
+ */
2216
+ export interface SuperDocExceptionRestorePayload {
2217
+ error: unknown;
2218
+ document: Document;
2219
+ }
2220
+ /**
2221
+ * Exception payload raised by the underlying editor lifecycle (load,
2222
+ * encryption-prompt, command failures, etc.). `code` is set when the
2223
+ * editor maps the failure to a known kind (e.g. `'password-required'`).
2224
+ * `editor` is `Editor | null | undefined` because the password-prompt
2225
+ * re-emit path forwards `originalException?.editor ?? null`, so
2226
+ * consumers may receive `null` (not just `undefined`).
2227
+ */
2228
+ export interface SuperDocExceptionEditorPayload {
2229
+ error: unknown;
2230
+ editor?: Editor | null;
2231
+ code?: string;
2232
+ documentId?: string | null;
2233
+ }
2234
+ /**
2235
+ * Union of all `exception` event payloads SuperDoc emits at runtime.
2236
+ * Consumers can narrow with `'stage' in payload` (store init) or
2237
+ * `'code' in payload` (editor lifecycle).
2238
+ *
2239
+ * The union exists today because three independent emit sites
2240
+ * (`initializeDocuments`, the restore path, and the editor lifecycle)
2241
+ * pre-date a shared error contract. Normalizing them to a single
2242
+ * payload shape is a separate follow-up; consumers can narrow with
2243
+ * the `in` checks above in the meantime.
2244
+ */
2245
+ export type SuperDocExceptionPayload = SuperDocExceptionStorePayload | SuperDocExceptionRestorePayload | SuperDocExceptionEditorPayload;
2246
+ /**
2247
+ * Zoom mode. `manual` holds whatever value was last set; `fit-width`
2248
+ * continuously recomputes the zoom that fits the page width into the
2249
+ * available container width. Calling `setZoom()` switches to
2250
+ * `manual`; `setZoomMode('fit-width')` re-enters fitting.
2251
+ */
2252
+ export type SuperDocZoomMode = 'manual' | 'fit-width';
2253
+ /**
2254
+ * Measurement unit for rulers and measurement fields (Word's "measurement
2255
+ * units" preference). `in` = inches, `cm` = centimetres. Set the starting unit
2256
+ * with `Config.measurementUnit`; change it at runtime with `setMeasurementUnit()`.
2257
+ */
2258
+ export type SuperDocMeasurementUnit = 'in' | 'cm';
2259
+ /**
2260
+ * Payload emitted with the `measurement-unit-change` event. Fires when
2261
+ * `setMeasurementUnit()` changes the document-wide ruler/measurement unit.
2262
+ */
2263
+ export interface SuperDocMeasurementUnitChangePayload {
2264
+ /** The measurement unit now in effect. */
2265
+ unit: SuperDocMeasurementUnit;
2266
+ }
2267
+ /**
2268
+ * Payload emitted with the `zoomChange` event and passed to
2269
+ * `Config.onZoomChange`. Fires for every zoom source: `setZoom()`,
2270
+ * the toolbar zoom control, and fit-width adjustments.
2271
+ */
2272
+ export interface SuperDocZoomPayload {
2273
+ /** The zoom level as a percentage (e.g. 100, 150). */
2274
+ zoom: number;
2275
+ /** The zoom mode that produced this value. */
2276
+ mode: SuperDocZoomMode;
2277
+ }
2278
+ /**
2279
+ * Payload emitted with the `viewport-change` event and passed to
2280
+ * `Config.onViewportChange`. The event fires when the implied fit
2281
+ * changes: the rounded `fitZoom` or the rounded base page width.
2282
+ * Pixel-level `availableWidth` movement that cannot change any fit
2283
+ * decision does not emit; read `getViewportMetrics()` for the
2284
+ * always-latest measurements. These are pure measurements:
2285
+ * `zoom.fitWidth` policy options (`min`, `max`, `padding`) do not
2286
+ * affect them. For the common case, prefer `zoom.mode: 'fit-width'`,
2287
+ * which applies a clamped fit automatically.
2288
+ */
2289
+ export interface SuperDocViewportChangePayload {
2290
+ /**
2291
+ * Width available to the document in pixels: the measured container
2292
+ * width minus the comments sidebar when it is visible.
2293
+ */
2294
+ availableWidth: number;
2295
+ /** Widest document page width in pixels at 100% zoom. */
2296
+ documentWidth: number;
2297
+ /** Zoom percentage that fits the document in the available width (unclamped, padding-free). Clamp before applying. */
2298
+ fitZoom: number;
2299
+ }
2300
+ /**
2301
+ * Latest viewport measurements, readable at any time via
2302
+ * `superdoc.getViewportMetrics()`. Same shape as the
2303
+ * `viewport-change` payload and refreshed on every measurement
2304
+ * (including pixel-level changes the deduped event skips); `null`
2305
+ * until the first measurement (editors still mounting).
2306
+ */
2307
+ export type SuperDocViewportMetrics = SuperDocViewportChangePayload;
2308
+ /**
2309
+ * Options for the `fit-width` zoom mode. `min`/`max` clamp the
2310
+ * applied zoom percentage; `padding` reserves horizontal space
2311
+ * inside the available width before computing the applied fit.
2312
+ * These shape the applied policy only, never the reported metrics.
2313
+ */
2314
+ export interface SuperDocFitWidthOptions {
2315
+ /** Lower bound for the applied zoom percentage (default: 10). */
2316
+ min?: number;
2317
+ /**
2318
+ * Upper bound for the applied zoom percentage (default: 100, so
2319
+ * fitting never enlarges the document past its natural size; raise
2320
+ * it to let wide containers scale the page up).
2321
+ */
2322
+ max?: number;
2323
+ /** Horizontal padding in pixels reserved inside the available width before computing the fit (default: 0). */
2324
+ padding?: number;
2325
+ }
2326
+ /**
2327
+ * Snapshot of the current zoom state, readable via
2328
+ * `superdoc.getZoomState()`.
2329
+ */
2330
+ export interface SuperDocZoomState {
2331
+ /** Current zoom mode. */
2332
+ mode: SuperDocZoomMode;
2333
+ /** Current zoom value as a percentage. */
2334
+ value: number;
2335
+ /** Latest computed fit zoom (unclamped), or `null` before the first viewport measurement. */
2336
+ fitZoom: number | null;
2337
+ /** Effective lower bound the fit policy applies (config or default). */
2338
+ min: number;
2339
+ /** Effective upper bound the fit policy applies (config or default). */
2340
+ max: number;
2341
+ }
2342
+ /**
2343
+ * Options for `Config.zoom`: the initial zoom level, the starting
2344
+ * mode, and the fit-width policy bounds. Runtime control stays on
2345
+ * the instance: `setZoom()` (switches to manual), `setZoomMode()`,
2346
+ * `getZoomState()`, `getViewportMetrics()`, and the `zoomChange` /
2347
+ * `viewport-change` events.
2348
+ */
2349
+ export interface SuperDocZoomConfig {
2350
+ /**
2351
+ * Initial zoom level as a percentage (default: 100). Applied before
2352
+ * the first paint, so the document renders directly at this zoom
2353
+ * with no visible jump. In `fit-width` mode this is the paint zoom
2354
+ * until the first fit computes. Invalid values (non-finite or <= 0)
2355
+ * are ignored with a console warning.
2356
+ */
2357
+ initial?: number;
2358
+ /**
2359
+ * Starting zoom mode (default: `'manual'`). In `'fit-width'` the
2360
+ * document continuously re-fits to the available container width;
2361
+ * the fit is applied through the normal zoom pipeline, so
2362
+ * `zoomChange` fires for every adjustment.
2363
+ */
2364
+ mode?: SuperDocZoomMode;
2365
+ /** Bounds and padding for the `fit-width` policy. */
2366
+ fitWidth?: SuperDocFitWidthOptions;
2367
+ }
2368
+ /**
2369
+ * Per-surface built-in UI configuration. Every field is optional; an omitted
2370
+ * field keeps that surface's historical default rather than inheriting from
2371
+ * its siblings, so a partial config only changes what it names.
2372
+ *
2373
+ * `false` disables a surface, `true` enables it with defaults, and an options
2374
+ * object both enables and configures it.
2375
+ *
2376
+ * @see {@link Config.ui}
2377
+ */
2378
+ export interface UIConfig {
2379
+ /**
2380
+ * Built-in toolbar. Enabled by default, but a toolbar only appears once
2381
+ * `container` resolves to an element — enabling it without one creates the
2382
+ * `superdoc.toolbar` handle and renders nothing.
2383
+ */
2384
+ toolbar?: boolean | {
2385
+ /**
2386
+ * Where to render the toolbar: an element, an id selector
2387
+ * (`#toolbar`), a class selector (`.toolbar`), or a bare element id.
2388
+ * Other CSS selector syntax resolves to nothing.
2389
+ */
2390
+ container?: string | HTMLElement;
2391
+ /**
2392
+ * Which groups render, or what goes in them. The shape decides which
2393
+ * of the two it means, so both v1 spellings have somewhere to land.
2394
+ *
2395
+ * An array selects which groups render, e.g.
2396
+ * `['left', 'center', 'right']`. This is where `Config.toolbarGroups`
2397
+ * moves to. It is a membership list, not a sort order: the built-in
2398
+ * toolbar lays groups out left, center, right, and renders center
2399
+ * whether or not it is listed.
2400
+ *
2401
+ * An object is composition: a group id mapped to the item ids inside
2402
+ * it, e.g. `{ right: ['bold'] }`. This is where
2403
+ * `modules.toolbar.groups` moves to. Supplying both an ordering array
2404
+ * here and a legacy composition map keeps the composition and applies
2405
+ * the ordering as a filter.
2406
+ */
2407
+ groups?: string[] | Record<string, string[]>;
2408
+ /** Toolbar item ids to hide from the default set. */
2409
+ excludeItems?: string[];
2410
+ /** Icon overrides, merged over the built-in set. */
2411
+ icons?: Record<string, unknown>;
2412
+ /** Text overrides, merged over the built-in set. */
2413
+ texts?: Record<string, unknown>;
2414
+ /** Size the toolbar to its container rather than the viewport. */
2415
+ responsiveToContainer?: boolean;
2416
+ };
2417
+ /** Built-in comments UI. Enabled by default. */
2418
+ comments?: boolean | Record<string, unknown>;
2419
+ /** Built-in right-click and slash context menu. Enabled by default. */
2420
+ contextMenu?: boolean | Record<string, unknown>;
2421
+ /**
2422
+ * Built-in find/replace surface. Disabled by default. Enabling it lets
2423
+ * SuperDoc intercept Cmd+F / Ctrl+F; `editor.ui.search` stays available to
2424
+ * custom UI either way.
2425
+ */
2426
+ search?: boolean | Record<string, unknown>;
2427
+ /** Built-in popover shown when a link is selected. Disabled by default. */
2428
+ linkPopover?: boolean | Record<string, unknown>;
2429
+ /** Built-in ruler. Disabled by default. */
2430
+ ruler?: boolean | {
2431
+ /** Element or selector to render the ruler into. */
2432
+ container?: string | HTMLElement;
2433
+ };
2434
+ /** Built-in chrome drawn around content controls. Enabled by default. */
2435
+ contentControls?: boolean | Record<string, unknown>;
2436
+ }
2437
+ /**
2438
+ * What the user is permitted to do, as distinct from what SuperDoc draws.
2439
+ *
2440
+ * Policy outlives presentation: `ui: false` removes the built-in comment
2441
+ * dialog, but an application rendering its own still needs `readOnly`
2442
+ * enforced. Keeping the two apart means a custom UI does not have to hold a
2443
+ * `modules.comments` object alive purely to carry policy.
2444
+ */
2445
+ export interface InteractionConfig {
2446
+ /** Comment and tracked-change interaction policy. */
2447
+ comments?: {
2448
+ /** Reject every comment and tracked-change mutation (default: false). */
2449
+ readOnly?: boolean;
2450
+ /** Offer resolve/reopen actions when writable (default: true). */
2451
+ allowResolve?: boolean;
2452
+ };
2453
+ }
2454
+ /**
2455
+ * Shared plumbing for dialogs and floating overlays, including surfaces the
2456
+ * application opens itself through `superdoc.openSurface()`.
2457
+ *
2458
+ * Unaffected by `ui: false`: turning off SuperDoc's own surfaces does not
2459
+ * disable the mechanism an application uses to render its own.
2460
+ */
2461
+ export interface SurfacesConfig {
2462
+ /**
2463
+ * Resolver for intent-based surface requests.
2464
+ *
2465
+ * `null` explicitly clears a resolver inherited from the legacy
2466
+ * `modules.surfaces.resolver`, which omitting the key does not do.
2467
+ */
2468
+ resolver?: SurfaceResolver | null;
2469
+ /** Defaults applied to dialog surfaces. */
2470
+ dialog?: {
2471
+ /** Close on Escape (default: true). */
2472
+ closeOnEscape?: boolean;
2473
+ /** Close on backdrop click (default: true). */
2474
+ closeOnBackdrop?: boolean;
2475
+ /** Default max width. */
2476
+ maxWidth?: string | number;
2477
+ };
2478
+ /** Defaults applied to floating surfaces. */
2479
+ floating?: {
2480
+ /** Placement preset (default: 'top-right'). */
2481
+ placement?: SurfaceFloatingPlacement;
2482
+ /** Default width. */
2483
+ width?: string | number;
2484
+ /** Default max width. */
2485
+ maxWidth?: string | number;
2486
+ /** Default max height. */
2487
+ maxHeight?: string | number;
2488
+ /** Close on Escape (default: true). */
2489
+ closeOnEscape?: boolean;
2490
+ /** Close on outside pointer down (default: false). */
2491
+ closeOnOutsidePointerDown?: boolean;
2492
+ /** Focus the surface on open (default: true). */
2493
+ autoFocus?: boolean;
2494
+ };
2495
+ }
2496
+ export interface Config {
2497
+ /** The ID of the SuperDoc. */
2498
+ superdocId?: string;
2499
+ /** The selector or element to mount the SuperDoc into. */
2500
+ selector: string | HTMLElement;
2501
+ /** The mode of the document (default: 'editing'). */
2502
+ documentMode?: DocumentMode;
2503
+ /**
2504
+ * When `documentMode` is `'viewing'`, allow the user to make text
2505
+ * selections even though editing is disabled. Defaults to `false`.
2506
+ * Forwarded to the underlying editor as `options.allowSelectionInViewMode`.
2507
+ */
2508
+ allowSelectionInViewMode?: boolean;
2509
+ /** The role of the user in this SuperDoc. */
2510
+ role?: 'editor' | 'viewer' | 'suggester';
2511
+ /**
2512
+ * The document to load. If a string, it will be treated as a URL. If a File
2513
+ * or Blob, it will be used directly. For a v2 collaboration room, pass a
2514
+ * structured document carrying `v2Collaboration`.
2515
+ *
2516
+ * Omitting this field and `documents` mounts a blank DOCX, so the Editor
2517
+ * opens a real document rather than an empty surface. The blank document is
2518
+ * a supported v2 source; it is seeded before mount and behaves like any
2519
+ * other opened DOCX, including export.
2520
+ *
2521
+ * Setting the v1 `modules.collaboration` field also suppresses that seeding,
2522
+ * but it is not a supported v2 path: the runtime fails closed with
2523
+ * `collaboration-v1-config-unsupported` and mounts only enough state to
2524
+ * report that error.
2525
+ */
2526
+ document?: object | string | globalThis.File | globalThis.Blob;
2527
+ /** Password for encrypted DOCX files. Forwarded during document load. */
2528
+ password?: string;
2529
+ /** The documents to load → soon to be deprecated. */
2530
+ documents?: Document[];
2531
+ /**
2532
+ * The current user of this SuperDoc. Typed as `AwarenessUser` (an
2533
+ * extension of `User` with the optional `color` field) so consumers
2534
+ * can pass an explicit awareness color and have the runtime honor it
2535
+ * as an override - `SuperDoc#assignUserColor()` skips its hash-based
2536
+ * assignment when `user.color` is already set.
2537
+ */
2538
+ user?: AwarenessUser;
2539
+ /** All users of this SuperDoc (can be used for "@"-mentions). */
2540
+ users?: User[];
2541
+ /** Colors to use for user awareness. */
2542
+ colors?: string[];
2543
+ /**
2544
+ * Which built-in interface SuperDoc renders.
2545
+ *
2546
+ * Omit it to keep SuperDoc's historical rendering: comments, the context
2547
+ * menu, and content-control chrome are on; search, the link popover, and
2548
+ * the ruler are opt-in; and the toolbar renders once it has somewhere to
2549
+ * mount. That profile is not symmetrical, and omitting this field
2550
+ * reproduces it exactly.
2551
+ *
2552
+ * Pass `false` when the application owns the interface. SuperDoc then
2553
+ * renders no controls, chrome, dialogs, or popovers, while the document,
2554
+ * the Document API, and `editor.ui` keep working — so a custom UI drives
2555
+ * the same commands the built-in one would have.
2556
+ *
2557
+ * Pass an object to choose per surface. An omitted key keeps that
2558
+ * surface's default rather than following its siblings, so
2559
+ * `{ comments: false }` disables comments and changes nothing else.
2560
+ *
2561
+ * @example
2562
+ * // Application owns the interface.
2563
+ * new SuperDoc({ selector: '#editor', document: file, ui: false });
2564
+ *
2565
+ * @example
2566
+ * // Built-in toolbar and search, no comments or context menu.
2567
+ * new SuperDoc({
2568
+ * selector: '#editor',
2569
+ * document: file,
2570
+ * ui: {
2571
+ * toolbar: { container: '#toolbar' },
2572
+ * search: true,
2573
+ * comments: false,
2574
+ * contextMenu: false,
2575
+ * },
2576
+ * });
2577
+ */
2578
+ ui?: false | UIConfig;
2579
+ /**
2580
+ * What the user is permitted to do. Independent of {@link Config.ui}: a
2581
+ * `readOnly` policy still applies when the application renders its own
2582
+ * comment UI.
2583
+ */
2584
+ interaction?: InteractionConfig;
2585
+ /**
2586
+ * Shared configuration for dialogs and floating overlays, including ones
2587
+ * opened through `superdoc.openSurface()`. Stays active under `ui: false`.
2588
+ */
2589
+ surfaces?: SurfacesConfig;
2590
+ /** Modules to load. */
2591
+ modules?: Modules;
2592
+ /** Top-level override for permission checks. */
2593
+ permissionResolver?: (params: PermissionResolverParams) => boolean | undefined;
2594
+ /**
2595
+ * Where to render the built-in toolbar. Either an `HTMLElement`, or a
2596
+ * selector string in one of the supported forms: an id selector (`#toolbar`),
2597
+ * a class selector (`.toolbar`), or a bare element id (`toolbar`). Other CSS
2598
+ * selector syntax is not supported — an attribute or descendant selector such
2599
+ * as `[data-toolbar]` resolves to nothing and leaves the toolbar unrendered.
2600
+ *
2601
+ * SuperDoc renders into the resolved element but does not manage its
2602
+ * placement, and never includes it in the `contained` layout calculation.
2603
+ * Where the application puts it therefore decides the space it needs: a
2604
+ * sibling of a 400px `contained` Editor adds its own height alongside it,
2605
+ * while a toolbar placed inside that host consumes part of the 400px and can
2606
+ * overflow it.
2607
+ *
2608
+ * Omitting this field (and `modules.toolbar.selector`) renders no toolbar.
2609
+ * `modules.toolbar: true` on its own does not render one either — it creates
2610
+ * the `superdoc.toolbar` handle without a mount target. See
2611
+ * {@link Modules.toolbar}.
2612
+ */
2613
+ toolbar?: string | HTMLElement;
2614
+ /** Toolbar groups to show. */
2615
+ toolbarGroups?: string[];
2616
+ /** Icons to show in the toolbar. */
2617
+ toolbarIcons?: object;
2618
+ /** Texts to override in the toolbar. */
2619
+ toolbarTexts?: object;
2620
+ /**
2621
+ * The font-family to use for all SuperDoc UI surfaces (toolbar, comments
2622
+ * UI, dropdowns, tooltips, etc.). This ensures consistent typography across
2623
+ * the entire application and helps match your application's design system.
2624
+ * The value should be a valid CSS font-family string.
2625
+ *
2626
+ * Example (system fonts):
2627
+ * uiDisplayFallbackFont: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
2628
+ *
2629
+ * Example (custom font):
2630
+ * uiDisplayFallbackFont: '"Inter", Arial, sans-serif'
2631
+ */
2632
+ uiDisplayFallbackFont?: string;
2633
+ /** Whether the SuperDoc is in development mode. */
2634
+ isDev?: boolean;
2635
+ /**
2636
+ * Disable Pinia/Vue devtools plugin setup for this SuperDoc instance
2637
+ * (useful in non-Vue hosts).
2638
+ */
2639
+ disablePiniaDevtools?: boolean;
2640
+ /**
2641
+ * Layout engine overrides passed through to DocumentRendererRuntime (page size,
2642
+ * margins, virtualization, zoom, debug label, etc.).
2643
+ */
2644
+ layoutEngineOptions?: SuperDocLayoutEngineOptions;
2645
+ /**
2646
+ * Advanced DocumentRendererRuntime feature toggles. `unifiedHistory` is enabled
2647
+ * by default; set it to `false` to force legacy active-surface undo
2648
+ * routing. `v2Host` enables the experimental mode-aware v2 DOCX shell path.
2649
+ */
2650
+ experimental?: {
2651
+ unifiedHistory?: boolean;
2652
+ v2Host?: boolean;
2653
+ /**
2654
+ * Derived-invalidation deferral for direct single-paragraph edits (v2
2655
+ * engine only). Field display text settles off the keystroke path under
2656
+ * the engine's settlement contract. DEFAULT TRUE — this is the engine's
2657
+ * standard behavior; set `false` only as an emergency kill switch.
2658
+ */
2659
+ deferDerivedInvalidations?: boolean;
2660
+ };
2661
+ /** Callback before an editor is created. Receives a wrapper carrying the editor. */
2662
+ onEditorBeforeCreate?: (params: SuperDocEditorPayload) => void;
2663
+ /** Callback after an editor is created. Receives a wrapper carrying the editor. */
2664
+ onEditorCreate?: (params: SuperDocEditorPayload) => void;
2665
+ /** Callback when the v2 document source reaches source-complete posture and diff.capture is safe to call. */
2666
+ onSourceComplete?: () => void;
2667
+ /** Callback when v2 source signals finish building (fires after onSourceComplete; diff.capture is synchronously safe). */
2668
+ onSourceSignalsComplete?: () => void;
2669
+ /** Callback when a transaction is made. */
2670
+ onTransaction?: (params: EditorTransactionEvent) => void;
2671
+ /** Callback after an editor is destroyed. */
2672
+ onEditorDestroy?: () => void;
2673
+ /**
2674
+ * Callback when an editor reports a content error (parse failure, doc
2675
+ * import error, etc.). `error` is widened to `unknown` because the
2676
+ * document editor side mostly normalizes to `Error` but some emitters
2677
+ * (e.g. `insertContentAt`) forward the original caught value. `file`
2678
+ * matches `Document.data` (`File | Blob | null | undefined`) since
2679
+ * the document can be loaded from any of those shapes. `documentId`
2680
+ * is guaranteed at runtime by `#initDocuments`.
2681
+ */
2682
+ onContentError?: (params: {
2683
+ error: unknown;
2684
+ editor: Editor;
2685
+ documentId: string;
2686
+ file: globalThis.File | globalThis.Blob | null | undefined;
2687
+ }) => void;
2688
+ /** Callback when the SuperDoc is ready. Receives a wrapper carrying the live SuperDoc instance. */
2689
+ onReady?: (params: SuperDocReadyPayload) => void;
2690
+ /** Callback when comments are updated. */
2691
+ onCommentsUpdate?: (params: SuperDocCommentsUpdatePayload) => void;
2692
+ /** Callback when active content control changes. */
2693
+ onContentControlActiveChange?: (params: ContentControlActiveChangePayload) => void;
2694
+ /** Callback when user clicks inside a content control. */
2695
+ onContentControlClick?: (params: ContentControlClickPayload) => void;
2696
+ /** Callback when awareness is updated. */
2697
+ onAwarenessUpdate?: (params: SuperDocAwarenessUpdatePayload) => void;
2698
+ /** Callback when the SuperDoc is locked or unlocked. */
2699
+ onLocked?: (params: SuperDocLockedPayload) => void;
2700
+ /** Callback when the PDF document is ready. */
2701
+ onPdfDocumentReady?: () => void;
2702
+ /** Callback when the sidebar is toggled. */
2703
+ onSidebarToggle?: (isOpened: boolean) => void;
2704
+ /** Callback when collaboration is ready. Receives a wrapper carrying the editor. */
2705
+ onCollaborationReady?: (params: SuperDocEditorPayload) => void;
2706
+ /** Callback when document is updated. */
2707
+ onEditorUpdate?: (params: EditorUpdateEvent) => void;
2708
+ /**
2709
+ * Callback when SuperDoc emits an `exception` event. The payload is a
2710
+ * union of three runtime shapes (store init, restore failure, editor
2711
+ * lifecycle). Narrow with `'stage' in params` (store init) or `'code'
2712
+ * in params` (editor) before reading shape-specific fields.
2713
+ */
2714
+ onException?: (params: SuperDocExceptionPayload) => void;
2715
+ /** Callback when the comments list is rendered. */
2716
+ onCommentsListChange?: (params: {
2717
+ isRendered: boolean;
2718
+ }) => void;
2719
+ /**
2720
+ * Callback when pagination layout updates (fires after each layout pass
2721
+ * with the current page count).
2722
+ */
2723
+ onPaginationUpdate?: (params: {
2724
+ totalPages: number;
2725
+ superdoc: SuperDoc;
2726
+ }) => void;
2727
+ /** Callback when the list definitions change. */
2728
+ onListDefinitionsChange?: (params: ListDefinitionsPayload) => void;
2729
+ /**
2730
+ * Callback when the zoom level changes. Fires for every zoom source:
2731
+ * `setZoom()`, the toolbar zoom control, and fit-width
2732
+ * adjustments.
2733
+ */
2734
+ onZoomChange?: (params: SuperDocZoomPayload) => void;
2735
+ /**
2736
+ * Callback when the implied fit changes (rounded fit zoom or base
2737
+ * page width); pixel-level width jitter does not fire it, and
2738
+ * `getViewportMetrics()` always reads latest. Registered before the
2739
+ * first emit.
2740
+ */
2741
+ onViewportChange?: (params: SuperDocViewportChangePayload) => void;
2742
+ /** The format of the document (docx, pdf, html). */
2743
+ format?: string;
2744
+ /**
2745
+ * Legacy v1 ProseMirror extensions. `editorExtensions` is a v1/ProseMirror
2746
+ * concept and is IGNORED by `superdoc@2`: these objects are never loaded into
2747
+ * the v2 runtime. Passing `editorExtensions` records a clear console
2748
+ * diagnostic at construction. For v2, use {@link Config.extensions} with
2749
+ * `defineSuperDocExtension`; the two are not interchangeable.
2750
+ */
2751
+ editorExtensions?: object[];
2752
+ /**
2753
+ * v2 SuperDoc extensions, created with `defineSuperDocExtension`. `superdoc@2`
2754
+ * IS the v2 editor, so these activate unconditionally — there is no
2755
+ * `editorVersion` / `editorIntegration` selector. Each extension owns
2756
+ * isolated storage, named events, commands, anchors, and render-only
2757
+ * decorations, and mutates the document exclusively through the guarded
2758
+ * Document API (`ctx.doc.*`). This is the v2 replacement for the
2759
+ * v1/ProseMirror `editorExtensions` path; the two are not interchangeable.
2760
+ * Extension arrays are mount-time config: changing the array reference
2761
+ * requires a remount to take effect.
2762
+ */
2763
+ extensions?: SuperDocExtension[];
2764
+ /** Whether the SuperDoc is internal. */
2765
+ isInternal?: boolean;
2766
+ /** The title of the SuperDoc. */
2767
+ title?: string;
2768
+ /** The conversations to load. */
2769
+ conversations?: object[];
2770
+ /** Toggle comment visibility when `documentMode` is `viewing` (default: false). */
2771
+ comments?: ViewingVisibilityConfig;
2772
+ /**
2773
+ * Deprecated. Use `modules.trackChanges.visible` instead. Toggle
2774
+ * tracked-change visibility when `documentMode` is `viewing` (default:
2775
+ * false).
2776
+ */
2777
+ trackChanges?: ViewingVisibilityConfig;
2778
+ /** Whether the SuperDoc is locked. */
2779
+ isLocked?: boolean;
2780
+ /** The function to handle image uploads. */
2781
+ handleImageUpload?: (file: globalThis.File) => Promise<string>;
2782
+ /** The user who locked the SuperDoc. */
2783
+ lockedBy?: User;
2784
+ /** Whether to show the ruler in the editor. */
2785
+ rulers?: boolean;
2786
+ /** Whether to suppress default styles in docx mode. */
2787
+ suppressDefaultDocxStyles?: boolean;
2788
+ /** Provided JSON to override content with. */
2789
+ jsonOverride?: object;
2790
+ /** Whether to disable slash / right-click custom context menu. */
2791
+ disableContextMenu?: boolean;
2792
+ /** HTML content to initialize the editor with. */
2793
+ html?: string;
2794
+ /** Markdown content to initialize the editor with. */
2795
+ markdown?: string;
2796
+ /**
2797
+ * Callback invoked with unsupported HTML elements dropped during import.
2798
+ * When provided, console.warn is NOT emitted.
2799
+ */
2800
+ onUnsupportedContent?: ((items: Array<{
2801
+ tagName: string;
2802
+ outerHTML: string;
2803
+ count: number;
2804
+ }>) => void) | null;
2805
+ /**
2806
+ * When true and no onUnsupportedContent callback is provided, emits a
2807
+ * console.warn with unsupported items.
2808
+ */
2809
+ warnOnUnsupportedContent?: boolean;
2810
+ /** Whether to enable debug mode. */
2811
+ isDebug?: boolean;
2812
+ /** Document view options (OOXML ST_View compatible). */
2813
+ viewOptions?: ViewOptions;
2814
+ /**
2815
+ * Enable contained mode for fixed-height container embedding.
2816
+ *
2817
+ * SuperDoc supports two layout modes, and the host element's height
2818
+ * requirement differs between them:
2819
+ *
2820
+ * - Natural (default, `false`): the Editor grows to the document's full
2821
+ * height and the page scrolls. The host needs no height. Setting one does
2822
+ * not constrain the document or enable internal scrolling, because
2823
+ * SuperDoc leaves overflow visible in this mode, though application CSS
2824
+ * on the host can still clip what is drawn.
2825
+ * - Contained (`true`): SuperDoc propagates `height: 100%` through its DOM
2826
+ * tree and scrolls the document internally, so multi-page documents stay
2827
+ * inside the host. This mode requires the host to have a definite height
2828
+ * (for example `height: 400px`); without one there is nothing for the
2829
+ * percentage heights to resolve against.
2830
+ *
2831
+ * A toolbar mounted through `Config.toolbar` or `modules.toolbar.selector` is
2832
+ * never part of this calculation. Placed as a sibling of the host, its height
2833
+ * adds to the host's: a 400px host with a 40px toolbar occupies 440px in
2834
+ * total. Placed inside the host, it consumes part of the 400px instead.
2835
+ */
2836
+ contained?: boolean;
2837
+ /** Content Security Policy nonce for dynamically injected styles. */
2838
+ cspNonce?: string;
2839
+ /** License key for organization identification. */
2840
+ licenseKey?: string;
2841
+ /** Telemetry configuration. */
2842
+ telemetry?: SuperDocTelemetryConfig;
2843
+ /** Proofing / spellcheck configuration. */
2844
+ proofing?: ProofingConfig;
2845
+ /**
2846
+ * Font system configuration. The reviewed fallback pack ships in the optional
2847
+ * `@superdoc-dev/fonts` package: pass `superdocFonts` (bundler) or the `SuperDocFonts`
2848
+ * global from its `superdoc-fonts.min.js` browser build (CDN). To self-host, set
2849
+ * `fonts.assetBaseUrl` (e.g. `/fonts/` or a CDN URL) or `fonts.resolveAssetUrl` for
2850
+ * signed/versioned hosting. SuperDoc core ships no fonts; with none configured the
2851
+ * toolbar shows the baseline and documents render with system fonts.
2852
+ */
2853
+ fonts?: FontsConfig;
2854
+ /**
2855
+ * Opt-in toggle for the layout engine. Auto-disabled when web layout is
2856
+ * requested without `layoutEngineOptions.flowMode === 'semantic'`; the
2857
+ * loader logs a warning and falls back to the legacy ProseMirror render
2858
+ * path in that case.
2859
+ */
2860
+ useLayoutEngine?: boolean;
2861
+ /**
2862
+ * Zoom behavior: the initial zoom level and optional fit-width
2863
+ * policy. See `SuperDocZoomConfig`.
2864
+ */
2865
+ zoom?: SuperDocZoomConfig;
2866
+ /**
2867
+ * Starting measurement unit for rulers and measurement fields (Word's
2868
+ * "measurement units" preference). Defaults to `'in'` (Word's en-US default).
2869
+ * Change it at runtime with `setMeasurementUnit()`. See `SuperDocMeasurementUnit`.
2870
+ */
2871
+ measurementUnit?: SuperDocMeasurementUnit;
2872
+ /**
2873
+ * Callback fired after the editor reports `fonts-resolved`. The payload
2874
+ * contains `documentFonts` and `unsupportedFonts` arrays so hosts can fall
2875
+ * back, warn, or block printing on unsupported faces.
2876
+ *
2877
+ * LEGACY/EARLY: this fires once before fonts load and is not substitution-aware
2878
+ * (`unsupportedFonts` over-reports families that render via a bundled substitute).
2879
+ * For the authoritative, load-settled picture use {@link onFontsChanged}.
2880
+ */
2881
+ onFontsResolved?: (payload: FontsResolvedPayload) => void;
2882
+ /**
2883
+ * Painter plan P7 §1 (@experimental): fires when the paginated page count
2884
+ * changes, at layout-end — before resolve or paint, so page counters and
2885
+ * minimaps can trust the number as soon as it is knowable. The payload's
2886
+ * `generation` identifies the announcing layout pass (informational; the
2887
+ * event is keyed on page-count changes, not generations). v2 vertical
2888
+ * pagination only; semantic "web layout" surfaces never fire it.
2889
+ */
2890
+ onPageCountKnown?: (payload: {
2891
+ pageCount: number;
2892
+ generation: number;
2893
+ }) => void;
2894
+ /**
2895
+ * Callback fired with the authoritative substitution + load-aware font report: once
2896
+ * after the load-before-measure gate settles (`source: 'initial'`), again when a face
2897
+ * arrives after a timed-out first paint (`'late-load'`). Each payload carries the full
2898
+ * per-font `resolutions`, the genuinely `missingFonts`, and a `loadSummary`. Also
2899
+ * available to pull on demand via `superdoc.fonts.getReport()`.
2900
+ */
2901
+ onFontsChanged?: (payload: FontsChangedPayload) => void;
2902
+ }
2903
+ /**
2904
+ * Internal augmentation of `Config` for runtime-only fields and tightened
2905
+ * invariants that must not appear on the published consumer surface. The
2906
+ * `Config` interface above is the public contract; this type adds the
2907
+ * fields SuperDoc sets/reads internally so the implementation can be
2908
+ * type-checked without leaking the fields into customer IDE autocomplete.
2909
+ *
2910
+ * The four overrides below mark fields that `Config` exposes as optional
2911
+ * but `SuperDoc.#init` always normalizes to a populated shape. Internal
2912
+ * call sites cast `this.config` to this type so they can access these
2913
+ * invariants without per-site null guards.
2914
+ *
2915
+ * Use this from internal SuperDoc callsites that need the augmented
2916
+ * shape, e.g. `(this.config as InternalConfig).socket = ...`.
2917
+ */
2918
+ export interface InternalConfig extends Config {
2919
+ /**
2920
+ * Internal v2 boot gate set when a consumer supplies the removed v1
2921
+ * `modules.collaboration` API. The shell surfaces this without ever
2922
+ * attaching the supplied Y.Doc/provider.
2923
+ */
2924
+ v2CollaborationPreflightFailure?: {
2925
+ readonly code: 'collaboration-v1-config-unsupported';
2926
+ readonly message: string;
2927
+ };
2928
+ /**
2929
+ * The shared websocket instance created by SuperDoc when
2930
+ * `modules.collaboration.providerType === 'hocuspocus'`. Set automatically;
2931
+ * not part of the public Config surface.
2932
+ */
2933
+ socket?: HocuspocusProviderWebsocket;
2934
+ /**
2935
+ * Normalized to `[]` by `#init` if the consumer passes nothing or
2936
+ * `undefined`. Narrowed to `RuntimeDocument[]` because once `#init`
2937
+ * runs, each entry has been augmented with the runtime-only fields
2938
+ * (`role`, editor/renderer accessors, etc.). Consumers
2939
+ * still pass `Document[]` via the public `Config` interface; this
2940
+ * override only describes the post-init shape internal callsites see.
2941
+ */
2942
+ documents: RuntimeDocument[];
2943
+ /** Normalized to `{}` by `#init` if the consumer passes nothing or `undefined`. */
2944
+ modules: Modules;
2945
+ /**
2946
+ * Spread of `DEFAULT_USER` over consumer input by `#init`; `name`
2947
+ * always present. Widened to `AwarenessUser` because `#assignUserColor`
2948
+ * runs synchronously during init and writes `color` into this object.
2949
+ */
2950
+ user: AwarenessUser;
2951
+ /** Normalized to `{}` by `#init` if the consumer passes nothing or `undefined`. */
2952
+ layoutEngineOptions: SuperDocLayoutEngineOptions;
2953
+ }
2954
+ /**
2955
+ * Internal augmentation of `SuperDocLayoutEngineOptions` for unstable tuning
2956
+ * fields. The public `SuperDocLayoutEngineOptions` interface above is the
2957
+ * customer-facing contract; this type adds fields the implementation may
2958
+ * read but that are intentionally not part of the v1 stable API.
2959
+ */
2960
+ export interface InternalSuperDocLayoutEngineOptions extends SuperDocLayoutEngineOptions {
2961
+ /**
2962
+ * Internal-only semantic mode tuning options. Shape may change without
2963
+ * notice; not part of the public surface.
2964
+ */
2965
+ semanticOptions?: object;
2966
+ }
2967
+ export type ProofingStatus = 'idle' | 'checking' | 'disabled' | 'degraded';
2968
+ export interface ProofingError {
2969
+ kind: 'provider-error' | 'validation-error' | 'timeout';
2970
+ message: string;
2971
+ segmentIds?: string[];
2972
+ /**
2973
+ * Underlying error (genuinely opaque: whatever the proofing provider
2974
+ * threw). Use `unknown` per Error-cause convention; consumers narrow
2975
+ * with `instanceof` or shape checks before reading fields.
2976
+ */
2977
+ cause?: unknown;
2978
+ }
2979
+ export interface ProofingConfig {
2980
+ /** Enable or disable proofing (default: false). */
2981
+ enabled?: boolean;
2982
+ /** Provider instance. */
2983
+ provider?: ProofingProvider | null;
2984
+ /** Fallback language for segments without a resolved language. */
2985
+ defaultLanguage?: string | null;
2986
+ /** Debounce delay after edits before rechecking (default: 500). */
2987
+ debounceMs?: number;
2988
+ /** Maximum replacement suggestions per issue. */
2989
+ maxSuggestions?: number;
2990
+ /** Prioritize checking visible pages first (default: true). */
2991
+ visibleFirst?: boolean;
2992
+ /** Show "Ignore" in context menu (default: true). */
2993
+ allowIgnoreWord?: boolean;
2994
+ /** Words to suppress from proofing results. */
2995
+ ignoredWords?: string[];
2996
+ /** Provider call timeout in milliseconds (default: 10000). */
2997
+ timeoutMs?: number;
2998
+ /** Max concurrent provider requests (default: 2). */
2999
+ maxConcurrentRequests?: number;
3000
+ /** Max segments per provider call (default: 20). */
3001
+ maxSegmentsPerBatch?: number;
3002
+ /** Error callback for provider failures. */
3003
+ onProofingError?: (error: ProofingError) => void;
3004
+ /** Status change callback. */
3005
+ onStatusChange?: (status: ProofingStatus) => void;
3006
+ }