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.
- package/AGENTS.md +337 -0
- package/LICENSE +661 -0
- package/NOTICE +8 -0
- package/README.md +107 -0
- package/dist/chunks/FindReplaceSurface-BEW-1NhM.es.js +344 -0
- package/dist/chunks/FindReplaceSurface-DLxnCQOB.cjs +346 -0
- package/dist/chunks/PasswordPromptSurface-BA6HHqEa.es.js +111 -0
- package/dist/chunks/PasswordPromptSurface-DMbfDvpQ.cjs +113 -0
- package/dist/chunks/PdfViewer-CNOtyS-I.es.js +531 -0
- package/dist/chunks/PdfViewer-CoFiGAhm.cjs +535 -0
- package/dist/chunks/_plugin-vue_export-helper-BTwbGDKw.cjs +11 -0
- package/dist/chunks/_plugin-vue_export-helper-CInC0bKI.es.js +6 -0
- package/dist/chunks/blank-docx-CJAXnJKp.es.js +2 -0
- package/dist/chunks/blank-docx-DA-G-3VB.cjs +7 -0
- package/dist/chunks/constants-CY3R3_kF.es.js +3 -0
- package/dist/chunks/constants-sbCZ2O_A.cjs +14 -0
- package/dist/chunks/create-super-doc-ui-CXCqHc2m.cjs +9451 -0
- package/dist/chunks/create-super-doc-ui-fxF2Q8Ib.es.js +9188 -0
- package/dist/chunks/eventemitter3-B60Fsz-a.es.js +131 -0
- package/dist/chunks/eventemitter3-DCfwFVNn.cjs +137 -0
- package/dist/chunks/jszip-BdUBlUeG.cjs +4679 -0
- package/dist/chunks/jszip-DzmwAHr3.es.js +4650 -0
- package/dist/chunks/rolldown-runtime-BJVcqBbz.es.js +43 -0
- package/dist/chunks/rolldown-runtime-_dR15c8t.cjs +68 -0
- package/dist/chunks/uuid-B2Sqk-3p.es.js +32 -0
- package/dist/chunks/uuid-CFp0WGVU.cjs +38 -0
- package/dist/collaboration-upgrade-engine.cjs +37 -0
- package/dist/collaboration-upgrade-engine.es.js +30 -0
- package/dist/document-api/src/authorities/authorities.d.ts +29 -0
- package/dist/document-api/src/authorities/authorities.types.d.ts +113 -0
- package/dist/document-api/src/blocks/blocks.d.ts +29 -0
- package/dist/document-api/src/bookmarks/bookmarks.d.ts +15 -0
- package/dist/document-api/src/bookmarks/bookmarks.types.d.ts +82 -0
- package/dist/document-api/src/capabilities/capabilities.d.ts +82 -0
- package/dist/document-api/src/captions/captions.d.ts +17 -0
- package/dist/document-api/src/captions/captions.types.d.ts +61 -0
- package/dist/document-api/src/citations/citations.d.ts +39 -0
- package/dist/document-api/src/citations/citations.types.d.ts +151 -0
- package/dist/document-api/src/clear-content/clear-content.d.ts +25 -0
- package/dist/document-api/src/clipboard/clipboard.d.ts +11 -0
- package/dist/document-api/src/comments/comments.d.ts +222 -0
- package/dist/document-api/src/comments/comments.types.d.ts +227 -0
- package/dist/document-api/src/content-controls/content-controls.d.ts +136 -0
- package/dist/document-api/src/content-controls/content-controls.types.d.ts +453 -0
- package/dist/document-api/src/contract/command-catalog.d.ts +17 -0
- package/dist/document-api/src/contract/index.d.ts +9 -0
- package/dist/document-api/src/contract/metadata-types.d.ts +30 -0
- package/dist/document-api/src/contract/operation-definitions.d.ts +3645 -0
- package/dist/document-api/src/contract/operation-map.d.ts +5 -0
- package/dist/document-api/src/contract/operation-registry.d.ts +2002 -0
- package/dist/document-api/src/contract/reference-aliases.d.ts +19 -0
- package/dist/document-api/src/contract/reference-doc-map.d.ts +12 -0
- package/dist/document-api/src/contract/schemas.d.ts +35 -0
- package/dist/document-api/src/contract/step-op-catalog.d.ts +26 -0
- package/dist/document-api/src/contract/types.d.ts +31 -0
- package/dist/document-api/src/create/create.d.ts +27 -0
- package/dist/document-api/src/cross-refs/cross-refs.d.ts +15 -0
- package/dist/document-api/src/cross-refs/cross-refs.types.d.ts +68 -0
- package/dist/document-api/src/customXml/customXml.d.ts +19 -0
- package/dist/document-api/src/customXml/customXml.types.d.ts +148 -0
- package/dist/document-api/src/delete/delete.d.ts +20 -0
- package/dist/document-api/src/diff/diff.d.ts +14 -0
- package/dist/document-api/src/diff/diff.types.d.ts +83 -0
- package/dist/document-api/src/diff/index.d.ts +3 -0
- package/dist/document-api/src/errors.d.ts +11 -0
- package/dist/document-api/src/export/export.d.ts +10 -0
- package/dist/document-api/src/export/export.types.d.ts +40 -0
- package/dist/document-api/src/extract/extract.d.ts +15 -0
- package/dist/document-api/src/fields/fields.d.ts +15 -0
- package/dist/document-api/src/fields/fields.types.d.ts +90 -0
- package/dist/document-api/src/find/find.d.ts +52 -0
- package/dist/document-api/src/footnotes/footnotes.d.ts +17 -0
- package/dist/document-api/src/footnotes/footnotes.types.d.ts +104 -0
- package/dist/document-api/src/format/format.d.ts +92 -0
- package/dist/document-api/src/format/inline-run-patch.d.ts +138 -0
- package/dist/document-api/src/get/get.d.ts +19 -0
- package/dist/document-api/src/get-html/get-html.d.ts +27 -0
- package/dist/document-api/src/get-markdown/get-markdown.d.ts +22 -0
- package/dist/document-api/src/get-node/get-node.d.ts +46 -0
- package/dist/document-api/src/get-text/get-text.d.ts +22 -0
- package/dist/document-api/src/header-footers/header-footers.d.ts +37 -0
- package/dist/document-api/src/header-footers/header-footers.types.d.ts +116 -0
- package/dist/document-api/src/history/history.d.ts +38 -0
- package/dist/document-api/src/history/history.types.d.ts +100 -0
- package/dist/document-api/src/hyperlinks/hyperlinks.d.ts +17 -0
- package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +112 -0
- package/dist/document-api/src/images/images.d.ts +63 -0
- package/dist/document-api/src/images/images.types.d.ts +209 -0
- package/dist/document-api/src/images/z-order.d.ts +10 -0
- package/dist/document-api/src/index/index.d.ts +29 -0
- package/dist/document-api/src/index/index.types.d.ts +125 -0
- package/dist/document-api/src/index.d.ts +560 -0
- package/dist/document-api/src/info/info.d.ts +19 -0
- package/dist/document-api/src/inline-semantics/directives.d.ts +95 -0
- package/dist/document-api/src/inline-semantics/error-types.d.ts +68 -0
- package/dist/document-api/src/inline-semantics/index.d.ts +20 -0
- package/dist/document-api/src/inline-semantics/property-ids.d.ts +24 -0
- package/dist/document-api/src/inline-semantics/token-parsers.d.ts +59 -0
- package/dist/document-api/src/inline-semantics/token-sets.d.ts +34 -0
- package/dist/document-api/src/insert/insert.d.ts +65 -0
- package/dist/document-api/src/invoke/invoke.d.ts +17 -0
- package/dist/document-api/src/lists/lists.d.ts +100 -0
- package/dist/document-api/src/lists/lists.types.d.ts +499 -0
- package/dist/document-api/src/markdown-to-fragment/markdown-to-fragment.d.ts +15 -0
- package/dist/document-api/src/metadata/anchored-metadata.d.ts +33 -0
- package/dist/document-api/src/metadata/anchored-metadata.types.d.ts +175 -0
- package/dist/document-api/src/paragraphs/paragraphs.d.ts +84 -0
- package/dist/document-api/src/paragraphs/paragraphs.types.d.ts +214 -0
- package/dist/document-api/src/permission-ranges/permission-ranges.d.ts +15 -0
- package/dist/document-api/src/permission-ranges/permission-ranges.types.d.ts +49 -0
- package/dist/document-api/src/plan/plan.d.ts +73 -0
- package/dist/document-api/src/protection/protection.d.ts +11 -0
- package/dist/document-api/src/protection/protection.types.d.ts +47 -0
- package/dist/document-api/src/ranges/index.d.ts +2 -0
- package/dist/document-api/src/ranges/ranges.types.d.ts +121 -0
- package/dist/document-api/src/ranges/resolve.d.ts +2 -0
- package/dist/document-api/src/receipt-bridge.d.ts +30 -0
- package/dist/document-api/src/replace/replace.d.ts +24 -0
- package/dist/document-api/src/sections/sections.d.ts +42 -0
- package/dist/document-api/src/sections/sections.types.d.ts +236 -0
- package/dist/document-api/src/selection/selection.d.ts +23 -0
- package/dist/document-api/src/selection/selection.types.d.ts +85 -0
- package/dist/document-api/src/selection-mutation.d.ts +46 -0
- package/dist/document-api/src/styles/apply.d.ts +142 -0
- package/dist/document-api/src/styles/catalog.d.ts +154 -0
- package/dist/document-api/src/styles/index.d.ts +14 -0
- package/dist/document-api/src/styles/registry.d.ts +43 -0
- package/dist/document-api/src/styles/schema.d.ts +9 -0
- package/dist/document-api/src/styles/validation.d.ts +38 -0
- package/dist/document-api/src/tables/color-formats.d.ts +12 -0
- package/dist/document-api/src/tables/tables.d.ts +83 -0
- package/dist/document-api/src/templates/apply.d.ts +160 -0
- package/dist/document-api/src/templates/index.d.ts +7 -0
- package/dist/document-api/src/toc/toc.d.ts +25 -0
- package/dist/document-api/src/toc/toc.types.d.ts +247 -0
- package/dist/document-api/src/track-changes/track-changes.d.ts +177 -0
- package/dist/document-api/src/types/adapter-result.d.ts +10 -0
- package/dist/document-api/src/types/address.d.ts +169 -0
- package/dist/document-api/src/types/base.d.ts +89 -0
- package/dist/document-api/src/types/blocks.types.d.ts +190 -0
- package/dist/document-api/src/types/clipboard.d.ts +216 -0
- package/dist/document-api/src/types/comments.types.d.ts +17 -0
- package/dist/document-api/src/types/create.types.d.ts +56 -0
- package/dist/document-api/src/types/discovery.d.ts +99 -0
- package/dist/document-api/src/types/extract.types.d.ts +163 -0
- package/dist/document-api/src/types/fragment.d.ts +29 -0
- package/dist/document-api/src/types/index.d.ts +30 -0
- package/dist/document-api/src/types/info.types.d.ts +109 -0
- package/dist/document-api/src/types/inline.types.d.ts +28 -0
- package/dist/document-api/src/types/media.types.d.ts +72 -0
- package/dist/document-api/src/types/mutation-plan.types.d.ts +264 -0
- package/dist/document-api/src/types/node.d.ts +9 -0
- package/dist/document-api/src/types/paragraph.types.d.ts +61 -0
- package/dist/document-api/src/types/placement.d.ts +24 -0
- package/dist/document-api/src/types/query-match.types.d.ts +212 -0
- package/dist/document-api/src/types/query.d.ts +133 -0
- package/dist/document-api/src/types/receipt.d.ts +191 -0
- package/dist/document-api/src/types/references.types.d.ts +9 -0
- package/dist/document-api/src/types/sd-contract.d.ts +54 -0
- package/dist/document-api/src/types/sd-envelope.d.ts +59 -0
- package/dist/document-api/src/types/sd-nodes.d.ts +375 -0
- package/dist/document-api/src/types/sd-objects.d.ts +144 -0
- package/dist/document-api/src/types/sd-props.d.ts +240 -0
- package/dist/document-api/src/types/sd-sections.d.ts +126 -0
- package/dist/document-api/src/types/sd-styles.d.ts +36 -0
- package/dist/document-api/src/types/step-manifest.types.d.ts +30 -0
- package/dist/document-api/src/types/story.types.d.ts +123 -0
- package/dist/document-api/src/types/structural-input.d.ts +40 -0
- package/dist/document-api/src/types/structured.types.d.ts +21 -0
- package/dist/document-api/src/types/style-policy.types.d.ts +49 -0
- package/dist/document-api/src/types/table-operations.types.d.ts +618 -0
- package/dist/document-api/src/types/tables.types.d.ts +43 -0
- package/dist/document-api/src/types/toc.types.d.ts +1 -0
- package/dist/document-api/src/types/track-changes.types.d.ts +703 -0
- package/dist/document-api/src/validation/create-location-validator.d.ts +2 -0
- package/dist/document-api/src/validation/fragment-validator.d.ts +13 -0
- package/dist/document-api/src/validation/selection-target-validator.d.ts +7 -0
- package/dist/document-api/src/validation/story-validator.d.ts +12 -0
- package/dist/document-api/src/validation-primitives.d.ts +29 -0
- package/dist/document-api/src/write/locator.d.ts +24 -0
- package/dist/document-api/src/write/write.d.ts +73 -0
- package/dist/images/altText_add.svg +3 -0
- package/dist/images/altText_disclaimer.svg +3 -0
- package/dist/images/altText_done.svg +3 -0
- package/dist/images/altText_spinner.svg +30 -0
- package/dist/images/altText_warning.svg +3 -0
- package/dist/images/annotation-check.svg +11 -0
- package/dist/images/annotation-comment.svg +16 -0
- package/dist/images/annotation-help.svg +26 -0
- package/dist/images/annotation-insert.svg +10 -0
- package/dist/images/annotation-key.svg +11 -0
- package/dist/images/annotation-newparagraph.svg +11 -0
- package/dist/images/annotation-noicon.svg +7 -0
- package/dist/images/annotation-note.svg +42 -0
- package/dist/images/annotation-paperclip.svg +6 -0
- package/dist/images/annotation-paragraph.svg +16 -0
- package/dist/images/annotation-pushpin.svg +7 -0
- package/dist/images/checkmark.svg +5 -0
- package/dist/images/comment-actionsButton.svg +3 -0
- package/dist/images/comment-closeButton.svg +3 -0
- package/dist/images/comment-editButton.svg +8 -0
- package/dist/images/comment-popup-editButton.svg +5 -0
- package/dist/images/cursor-editorFreeHighlight.svg +6 -0
- package/dist/images/cursor-editorFreeText.svg +3 -0
- package/dist/images/cursor-editorInk.svg +4 -0
- package/dist/images/cursor-editorTextHighlight.svg +8 -0
- package/dist/images/editor-toolbar-delete.svg +5 -0
- package/dist/images/editor-toolbar-edit.svg +3 -0
- package/dist/images/findbarButton-next.svg +3 -0
- package/dist/images/findbarButton-previous.svg +3 -0
- package/dist/images/gv-toolbarButton-download.svg +3 -0
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/loading.svg +1 -0
- package/dist/images/messageBar_closingButton.svg +3 -0
- package/dist/images/messageBar_info.svg +3 -0
- package/dist/images/messageBar_warning.svg +3 -0
- package/dist/images/pages_closeButton.svg +3 -0
- package/dist/images/pages_selected.svg +7 -0
- package/dist/images/pages_viewArrow.svg +3 -0
- package/dist/images/pages_viewButton.svg +3 -0
- package/dist/images/secondaryToolbarButton-documentProperties.svg +3 -0
- package/dist/images/secondaryToolbarButton-firstPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-handTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-lastPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCcw.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCw.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollVertical.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
- package/dist/images/secondaryToolbarButton-selectTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadEven.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadNone.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadOdd.svg +3 -0
- package/dist/images/toolbarButton-bookmark.svg +3 -0
- package/dist/images/toolbarButton-currentOutlineItem.svg +3 -0
- package/dist/images/toolbarButton-download.svg +4 -0
- package/dist/images/toolbarButton-editorFreeText.svg +5 -0
- package/dist/images/toolbarButton-editorHighlight.svg +6 -0
- package/dist/images/toolbarButton-editorInk.svg +4 -0
- package/dist/images/toolbarButton-editorSignature.svg +6 -0
- package/dist/images/toolbarButton-editorStamp.svg +8 -0
- package/dist/images/toolbarButton-menuArrow.svg +3 -0
- package/dist/images/toolbarButton-openFile.svg +3 -0
- package/dist/images/toolbarButton-pageDown.svg +3 -0
- package/dist/images/toolbarButton-pageUp.svg +3 -0
- package/dist/images/toolbarButton-presentationMode.svg +3 -0
- package/dist/images/toolbarButton-print.svg +3 -0
- package/dist/images/toolbarButton-search.svg +3 -0
- package/dist/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
- package/dist/images/toolbarButton-viewAttachments.svg +3 -0
- package/dist/images/toolbarButton-viewLayers.svg +3 -0
- package/dist/images/toolbarButton-viewOutline.svg +3 -0
- package/dist/images/toolbarButton-viewThumbnail.svg +3 -0
- package/dist/images/toolbarButton-viewsManagerToggle.svg +3 -0
- package/dist/images/toolbarButton-zoomIn.svg +3 -0
- package/dist/images/toolbarButton-zoomOut.svg +3 -0
- package/dist/images/treeitem-collapsed.svg +1 -0
- package/dist/images/treeitem-expanded.svg +1 -0
- package/dist/layout-engine/contracts/src/author-colors.d.ts +56 -0
- package/dist/layout-engine/contracts/src/cell-spacing.d.ts +12 -0
- package/dist/layout-engine/contracts/src/clip-path-inset.d.ts +27 -0
- package/dist/layout-engine/contracts/src/column-layout.d.ts +79 -0
- package/dist/layout-engine/contracts/src/direction-context.d.ts +219 -0
- package/dist/layout-engine/contracts/src/drawing-taxonomy.d.ts +126 -0
- package/dist/layout-engine/contracts/src/engines/image-wrap.d.ts +54 -0
- package/dist/layout-engine/contracts/src/engines/index.d.ts +17 -0
- package/dist/layout-engine/contracts/src/engines/lists.d.ts +57 -0
- package/dist/layout-engine/contracts/src/engines/paragraph.d.ts +59 -0
- package/dist/layout-engine/contracts/src/engines/tables.d.ts +89 -0
- package/dist/layout-engine/contracts/src/engines/tabs.d.ts +117 -0
- package/dist/layout-engine/contracts/src/graphic-placement.d.ts +76 -0
- package/dist/layout-engine/contracts/src/header-footer-inheritance.d.ts +22 -0
- package/dist/layout-engine/contracts/src/header-footer-resolution.d.ts +28 -0
- package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +10 -0
- package/dist/layout-engine/contracts/src/index.d.ts +2459 -0
- package/dist/layout-engine/contracts/src/justify-utils.d.ts +98 -0
- package/dist/layout-engine/contracts/src/layout-identity.d.ts +136 -0
- package/dist/layout-engine/contracts/src/ooxml-z-index.d.ts +46 -0
- package/dist/layout-engine/contracts/src/page-number-formatting.d.ts +26 -0
- package/dist/layout-engine/contracts/src/page-ref-anchor.d.ts +2 -0
- package/dist/layout-engine/contracts/src/pm-range.d.ts +45 -0
- package/dist/layout-engine/contracts/src/resolved-layout.d.ts +541 -0
- package/dist/layout-engine/contracts/src/run-helpers.d.ts +23 -0
- package/dist/layout-engine/contracts/src/sdt-container.d.ts +13 -0
- package/dist/layout-engine/contracts/src/segment-geometry.d.ts +192 -0
- package/dist/layout-engine/contracts/src/semantic-colors.d.ts +150 -0
- package/dist/layout-engine/contracts/src/table-cell-spacing.d.ts +12 -0
- package/dist/layout-engine/contracts/src/table-column-rescale.d.ts +13 -0
- package/dist/layout-engine/contracts/src/vertical-text.d.ts +43 -0
- package/dist/layout-engine/dom-contract/src/class-names.d.ts +62 -0
- package/dist/layout-engine/dom-contract/src/data-attrs.d.ts +103 -0
- package/dist/layout-engine/dom-contract/src/index.d.ts +18 -0
- package/dist/layout-engine/dom-contract/src/selectors.d.ts +47 -0
- package/dist/layout-engine/layout-bridge/src/cache-warmer.d.ts +73 -0
- package/dist/layout-engine/layout-bridge/src/cache.d.ts +143 -0
- package/dist/layout-engine/layout-bridge/src/cacheInvalidation.d.ts +117 -0
- package/dist/layout-engine/layout-bridge/src/cursor-renderer.d.ts +201 -0
- package/dist/layout-engine/layout-bridge/src/debounced-passes.d.ts +130 -0
- package/dist/layout-engine/layout-bridge/src/diff.d.ts +36 -0
- package/dist/layout-engine/layout-bridge/src/dirty-tracker.d.ts +128 -0
- package/dist/layout-engine/layout-bridge/src/dom-mapping.d.ts +80 -0
- package/dist/layout-engine/layout-bridge/src/featureFlags.d.ts +95 -0
- package/dist/layout-engine/layout-bridge/src/field-annotation-key.d.ts +2 -0
- package/dist/layout-engine/layout-bridge/src/focus-watchdog.d.ts +170 -0
- package/dist/layout-engine/layout-bridge/src/font-metrics-cache.d.ts +164 -0
- package/dist/layout-engine/layout-bridge/src/footnote-scorer.d.ts +63 -0
- package/dist/layout-engine/layout-bridge/src/headerFooterUtils.d.ts +218 -0
- package/dist/layout-engine/layout-bridge/src/ime-handler.d.ts +81 -0
- package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +390 -0
- package/dist/layout-engine/layout-bridge/src/index.d.ts +211 -0
- package/dist/layout-engine/layout-bridge/src/instrumentation.d.ts +245 -0
- package/dist/layout-engine/layout-bridge/src/layoutHeaderFooter.d.ts +123 -0
- package/dist/layout-engine/layout-bridge/src/list-indent-utils.d.ts +205 -0
- package/dist/layout-engine/layout-bridge/src/local-paragraph-layout.d.ts +93 -0
- package/dist/layout-engine/layout-bridge/src/neutral-hit.d.ts +142 -0
- package/dist/layout-engine/layout-bridge/src/neutral-segment-geometry.d.ts +32 -0
- package/dist/layout-engine/layout-bridge/src/page-geometry-helper.d.ts +197 -0
- package/dist/layout-engine/layout-bridge/src/paragraph-hash-utils.d.ts +126 -0
- package/dist/layout-engine/layout-bridge/src/paragraph-line-cache.d.ts +152 -0
- package/dist/layout-engine/layout-bridge/src/performance-metrics.d.ts +249 -0
- package/dist/layout-engine/layout-bridge/src/pm-dom-fallback.d.ts +188 -0
- package/dist/layout-engine/layout-bridge/src/pm-position-validator.d.ts +100 -0
- package/dist/layout-engine/layout-bridge/src/position-hit.d.ts +167 -0
- package/dist/layout-engine/layout-bridge/src/remeasure.d.ts +75 -0
- package/dist/layout-engine/layout-bridge/src/resolveHeaderFooterTokens.d.ts +76 -0
- package/dist/layout-engine/layout-bridge/src/rtl-text-geometry.d.ts +34 -0
- package/dist/layout-engine/layout-bridge/src/run-visual-marks.d.ts +12 -0
- package/dist/layout-engine/layout-bridge/src/safety-net.d.ts +234 -0
- package/dist/layout-engine/layout-bridge/src/sectionAwareHeaderFooter.d.ts +15 -0
- package/dist/layout-engine/layout-bridge/src/table-handler.d.ts +86 -0
- package/dist/layout-engine/layout-bridge/src/text-boundaries.d.ts +17 -0
- package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +69 -0
- package/dist/layout-engine/layout-bridge/src/track-changes-handler.d.ts +90 -0
- package/dist/layout-engine/layout-bridge/src/tracked-changes-utils.d.ts +41 -0
- package/dist/layout-engine/layout-engine/src/anchors.d.ts +52 -0
- package/dist/layout-engine/layout-engine/src/column-balancing.d.ts +255 -0
- package/dist/layout-engine/layout-engine/src/column-utils.d.ts +1 -0
- package/dist/layout-engine/layout-engine/src/floating-objects.d.ts +60 -0
- package/dist/layout-engine/layout-engine/src/floating-table-anchor.d.ts +21 -0
- package/dist/layout-engine/layout-engine/src/index.d.ts +349 -0
- package/dist/layout-engine/layout-engine/src/layout-drawing.d.ts +60 -0
- package/dist/layout-engine/layout-engine/src/layout-image.d.ts +16 -0
- package/dist/layout-engine/layout-engine/src/layout-paragraph.d.ts +101 -0
- package/dist/layout-engine/layout-engine/src/layout-table.d.ts +71 -0
- package/dist/layout-engine/layout-engine/src/layout-textbox.d.ts +4 -0
- package/dist/layout-engine/layout-engine/src/layout-utils.d.ts +104 -0
- package/dist/layout-engine/layout-engine/src/normalize-header-footer-fragments.d.ts +45 -0
- package/dist/layout-engine/layout-engine/src/pageNumbering.d.ts +73 -0
- package/dist/layout-engine/layout-engine/src/paginator.d.ts +131 -0
- package/dist/layout-engine/layout-engine/src/paragraph-layout-eligibility.d.ts +1 -0
- package/dist/layout-engine/layout-engine/src/resolvePageRefs.d.ts +31 -0
- package/dist/layout-engine/layout-engine/src/resolvePageTokens.d.ts +82 -0
- package/dist/layout-engine/layout-engine/src/section-breaks.d.ts +98 -0
- package/dist/layout-engine/layout-engine/src/section-props.d.ts +65 -0
- package/dist/layout-engine/layout-engine/src/table-cell-slice.d.ts +98 -0
- package/dist/layout-engine/painters/dom/src/_test-utils.d.ts +21 -0
- package/dist/layout-engine/painters/dom/src/chart-renderer.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/constants.d.ts +10 -0
- package/dist/layout-engine/painters/dom/src/css-token.d.ts +10 -0
- package/dist/layout-engine/painters/dom/src/features/feature-registry.d.ts +41 -0
- package/dist/layout-engine/painters/dom/src/features/inline-direction/index.d.ts +22 -0
- package/dist/layout-engine/painters/dom/src/features/inline-direction/rtl-styles.d.ts +27 -0
- package/dist/layout-engine/painters/dom/src/features/inline-direction/run-direction.d.ts +75 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/accent.d.ts +25 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/bar.d.ts +16 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/box.d.ts +38 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/delimiter.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/equation-array.d.ts +19 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/fraction.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/function.d.ts +16 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/group-character.d.ts +26 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/index.d.ts +27 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/lower-limit.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/math-run.d.ts +47 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/matrix.d.ts +23 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/nary.d.ts +23 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/phantom.d.ts +17 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/pre-sub-superscript.d.ts +25 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/radical.d.ts +14 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/sub-superscript.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/subscript.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/superscript.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/upper-limit.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/index.d.ts +14 -0
- package/dist/layout-engine/painters/dom/src/features/math/omml-to-mathml.d.ts +18 -0
- package/dist/layout-engine/painters/dom/src/features/math/types.d.ts +41 -0
- package/dist/layout-engine/painters/dom/src/images/drawing-image.d.ts +5 -0
- package/dist/layout-engine/painters/dom/src/images/hyperlink.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/images/image-block.d.ts +15 -0
- package/dist/layout-engine/painters/dom/src/images/image-clip-path.d.ts +17 -0
- package/dist/layout-engine/painters/dom/src/images/image-fragment.d.ts +34 -0
- package/dist/layout-engine/painters/dom/src/images/image-selectors.d.ts +9 -0
- package/dist/layout-engine/painters/dom/src/images/types.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/index.d.ts +125 -0
- package/dist/layout-engine/painters/dom/src/page-content.d.ts +209 -0
- package/dist/layout-engine/painters/dom/src/paragraph/block-version.d.ts +8 -0
- package/dist/layout-engine/painters/dom/src/paragraph/borders/border-layer.d.ts +59 -0
- package/dist/layout-engine/painters/dom/src/paragraph/borders/group-analysis.d.ts +38 -0
- package/dist/layout-engine/painters/dom/src/paragraph/borders/index.d.ts +18 -0
- package/dist/layout-engine/painters/dom/src/paragraph/frame.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/paragraph/indentation.d.ts +25 -0
- package/dist/layout-engine/painters/dom/src/paragraph/list-marker.d.ts +51 -0
- package/dist/layout-engine/painters/dom/src/paragraph/marker-tracked-change.d.ts +34 -0
- package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphContent.d.ts +87 -0
- package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphFragment.d.ts +33 -0
- package/dist/layout-engine/painters/dom/src/paragraph/styles.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/paragraph-hash-utils.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/pm-position-validation.d.ts +149 -0
- package/dist/layout-engine/painters/dom/src/renderer.d.ts +681 -0
- package/dist/layout-engine/painters/dom/src/ruler/index.d.ts +41 -0
- package/dist/layout-engine/painters/dom/src/ruler/ruler-core.d.ts +195 -0
- package/dist/layout-engine/painters/dom/src/ruler/ruler-renderer.d.ts +97 -0
- package/dist/layout-engine/painters/dom/src/ruler/ruler-styles.d.ts +31 -0
- package/dist/layout-engine/painters/dom/src/runs/field-annotation-run.d.ts +14 -0
- package/dist/layout-engine/painters/dom/src/runs/font-synthesis.d.ts +1 -0
- package/dist/layout-engine/painters/dom/src/runs/formatting-marks.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/runs/hash.d.ts +82 -0
- package/dist/layout-engine/painters/dom/src/runs/image-run.d.ts +37 -0
- package/dist/layout-engine/painters/dom/src/runs/index.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/runs/links.d.ts +58 -0
- package/dist/layout-engine/painters/dom/src/runs/math-run.d.ts +7 -0
- package/dist/layout-engine/painters/dom/src/runs/render-line.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/runs/render-run.d.ts +12 -0
- package/dist/layout-engine/painters/dom/src/runs/tab-run.d.ts +66 -0
- package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +35 -0
- package/dist/layout-engine/painters/dom/src/runs/tracked-changes.d.ts +90 -0
- package/dist/layout-engine/painters/dom/src/runs/types.d.ts +67 -0
- package/dist/layout-engine/painters/dom/src/sdt/boundaries.d.ts +16 -0
- package/dist/layout-engine/painters/dom/src/sdt/container.d.ts +32 -0
- package/dist/layout-engine/painters/dom/src/sdt/dataset.d.ts +7 -0
- package/dist/layout-engine/painters/dom/src/sdt/inline.d.ts +9 -0
- package/dist/layout-engine/painters/dom/src/sdt/snapshot.d.ts +29 -0
- package/dist/layout-engine/painters/dom/src/styles.d.ts +71 -0
- package/dist/layout-engine/painters/dom/src/svg-utils.d.ts +101 -0
- package/dist/layout-engine/painters/dom/src/table/border-utils.d.ts +185 -0
- package/dist/layout-engine/painters/dom/src/table/grid-geometry.d.ts +69 -0
- package/dist/layout-engine/painters/dom/src/table/renderTableCell.d.ts +170 -0
- package/dist/layout-engine/painters/dom/src/table/renderTableFragment.d.ts +132 -0
- package/dist/layout-engine/painters/dom/src/table/renderTableRow.d.ts +146 -0
- package/dist/layout-engine/painters/dom/src/test-utils/normalize-line.d.ts +39 -0
- package/dist/layout-engine/painters/dom/src/utils/anchor-helpers.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/utils/apply-styles.d.ts +1 -0
- package/dist/layout-engine/painters/dom/src/utils/layout-identity.d.ts +9 -0
- package/dist/layout-engine/painters/dom/src/utils/source-anchor.d.ts +2 -0
- package/dist/layout-engine/style-engine/src/bench/resolveSdtMetadata.bench.d.ts +1 -0
- package/dist/layout-engine/style-engine/src/cascade.d.ts +43 -0
- package/dist/layout-engine/style-engine/src/index.d.ts +121 -0
- package/dist/layout-engine/style-engine/src/normalize/colors.d.ts +13 -0
- package/dist/layout-engine/style-engine/src/normalize/index.d.ts +13 -0
- package/dist/layout-engine/style-engine/src/normalize/paragraph-attrs.d.ts +3 -0
- package/dist/layout-engine/style-engine/src/normalize/run-attrs.d.ts +17 -0
- package/dist/layout-engine/style-engine/src/normalize/types.d.ts +36 -0
- package/dist/layout-engine/style-engine/src/normalize/units.d.ts +13 -0
- package/dist/layout-engine/style-engine/src/ooxml/index.d.ts +64 -0
- package/dist/layout-engine/style-engine/src/ooxml/numbering-types.d.ts +126 -0
- package/dist/layout-engine/style-engine/src/ooxml/styles-types.d.ts +363 -0
- package/dist/layout-engine/style-engine/src/ooxml/table-style-selection.d.ts +86 -0
- package/dist/layout-engine/style-engine/src/ooxml/types.d.ts +459 -0
- package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-theme.d.ts +33 -0
- package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-xml.d.ts +29 -0
- package/dist/public/ui-react.cjs +175 -0
- package/dist/public/ui-react.es.js +159 -0
- package/dist/public/ui.cjs +5 -0
- package/dist/public/ui.es.js +2 -0
- package/dist/shared/common/comments-types.d.ts +102 -0
- package/dist/shared/common/layout-constants.d.ts +7 -0
- package/dist/shared/common/list-marker-utils.d.ts +186 -0
- package/dist/shared/common/list-numbering/index.d.ts +16 -0
- package/dist/shared/font-system/src/activation.d.ts +64 -0
- package/dist/shared/font-system/src/bundled-manifest.d.ts +32 -0
- package/dist/shared/font-system/src/bundled.d.ts +41 -0
- package/dist/shared/font-system/src/document-font-options.d.ts +53 -0
- package/dist/shared/font-system/src/epoch.d.ts +6 -0
- package/dist/shared/font-system/src/font-offerings.d.ts +120 -0
- package/dist/shared/font-system/src/index.d.ts +35 -0
- package/dist/shared/font-system/src/os2.d.ts +30 -0
- package/dist/shared/font-system/src/registry.d.ts +188 -0
- package/dist/shared/font-system/src/report.d.ts +98 -0
- package/dist/shared/font-system/src/resolver.d.ts +215 -0
- package/dist/shared/font-system/src/substitution-evidence.d.ts +103 -0
- package/dist/shared/font-system/src/types.d.ts +128 -0
- package/dist/style.css +3316 -0
- package/dist/style.layered.css +3316 -0
- package/dist/superdoc/src/SuperDoc.vue.d.ts +88 -0
- package/dist/superdoc/src/cdn-entry.d.ts +2 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +62 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +26 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +19 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentsDropdown.vue.d.ts +30 -0
- package/dist/superdoc/src/components/CommentsLayer/InternalDropdown.vue.d.ts +10 -0
- package/dist/superdoc/src/components/CommentsLayer/collect-removed-comment-ids.d.ts +1 -0
- package/dist/superdoc/src/components/CommentsLayer/collect-tracked-change-thread.d.ts +6 -0
- package/dist/superdoc/src/components/CommentsLayer/comment-schemas.d.ts +18 -0
- package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +9 -0
- package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +21 -0
- package/dist/superdoc/src/components/CommentsLayer/floating-comment-positioning.d.ts +28 -0
- package/dist/superdoc/src/components/CommentsLayer/helpers.d.ts +7 -0
- package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +2 -0
- package/dist/superdoc/src/components/CommentsLayer/types.d.ts +3 -0
- package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +8 -0
- package/dist/superdoc/src/components/CommentsLayer/use-conversation.d.ts +22 -0
- package/dist/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts +11 -0
- package/dist/superdoc/src/components/HtmlViewer/HtmlViewer.vue.d.ts +10 -0
- package/dist/superdoc/src/components/PdfViewer/PdfViewer.vue.d.ts +61 -0
- package/dist/superdoc/src/components/PdfViewer/PdfViewerDocument.vue.d.ts +21 -0
- package/dist/superdoc/src/components/PdfViewer/PdfViewerPage.vue.d.ts +24 -0
- package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +19 -0
- package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +17 -0
- package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +18 -0
- package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +19 -0
- package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +17 -0
- package/dist/superdoc/src/components/surfaces/SurfaceDialog.vue.d.ts +12 -0
- package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +19 -0
- package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +10 -0
- package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +31 -0
- package/dist/superdoc/src/components/surfaces/focusable-selector.d.ts +5 -0
- package/dist/superdoc/src/composables/find-shortcut-owner.d.ts +32 -0
- package/dist/superdoc/src/composables/replace-continuation.d.ts +37 -0
- package/dist/superdoc/src/composables/use-ai.d.ts +10 -0
- package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +10 -0
- package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +21 -0
- package/dist/superdoc/src/composables/use-document.d.ts +34 -0
- package/dist/superdoc/src/composables/use-field.d.ts +33 -0
- package/dist/superdoc/src/composables/use-find-replace.d.ts +83 -0
- package/dist/superdoc/src/composables/use-high-contrast-mode.d.ts +4 -0
- package/dist/superdoc/src/composables/use-link-popover.d.ts +221 -0
- package/dist/superdoc/src/composables/use-password-prompt.d.ts +33 -0
- package/dist/superdoc/src/composables/use-selected-text.d.ts +16 -0
- package/dist/superdoc/src/composables/use-viewport-fit.d.ts +50 -0
- package/dist/superdoc/src/composables/useUiFontFamily.d.ts +24 -0
- package/dist/superdoc/src/core/EventEmitter.d.ts +55 -0
- package/dist/superdoc/src/core/SuperDoc.d.ts +775 -0
- package/dist/superdoc/src/core/collaboration/collaboration-comments.d.ts +4 -0
- package/dist/superdoc/src/core/collaboration/collaboration.d.ts +28 -0
- package/dist/superdoc/src/core/collaboration/helpers.d.ts +8 -0
- package/dist/superdoc/src/core/collaboration/permissions.d.ts +19 -0
- package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +99 -0
- package/dist/superdoc/src/core/collaboration/room-overwrite.d.ts +22 -0
- package/dist/superdoc/src/core/collaboration/v2-awareness-bridge.d.ts +57 -0
- package/dist/superdoc/src/core/config/merge-defined.d.ts +35 -0
- package/dist/superdoc/src/core/config/normalize-interaction-config.d.ts +15 -0
- package/dist/superdoc/src/core/config/normalize-surfaces-config.d.ts +23 -0
- package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +62 -0
- package/dist/superdoc/src/core/create-app.d.ts +32 -0
- package/dist/superdoc/src/core/editor-runtime/conformance/fake-v2-runtime.d.ts +9 -0
- package/dist/superdoc/src/core/editor-runtime/editor-runtime-registry.d.ts +117 -0
- package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -0
- package/dist/superdoc/src/core/editor-runtime/root-marker.d.ts +33 -0
- package/dist/superdoc/src/core/editor-runtime/types.d.ts +405 -0
- package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +185 -0
- package/dist/superdoc/src/core/editor-runtime/v2/v2-session-shortcut-routes.d.ts +47 -0
- package/dist/superdoc/src/core/extensions/define.d.ts +56 -0
- package/dist/superdoc/src/core/extensions/index.d.ts +2 -0
- package/dist/superdoc/src/core/extensions/types.d.ts +519 -0
- package/dist/superdoc/src/core/helpers/export.d.ts +2 -0
- package/dist/superdoc/src/core/helpers/file.d.ts +43 -0
- package/dist/superdoc/src/core/helpers/normalize-track-changes-config.d.ts +60 -0
- package/dist/superdoc/src/core/helpers/normalize-user.d.ts +13 -0
- package/dist/superdoc/src/core/index.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/helpers/constants.d.ts +2 -0
- package/dist/superdoc/src/core/pdf/helpers/floor.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/helpers/range.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/helpers/read-file.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +66 -0
- package/dist/superdoc/src/core/surface-manager.d.ts +90 -0
- package/dist/superdoc/src/core/theme/create-theme.d.ts +82 -0
- package/dist/superdoc/src/core/types/index.d.ts +3006 -0
- package/dist/superdoc/src/core/v2-integration/browser-peer-runtime.d.ts +3 -0
- package/dist/superdoc/src/core/v2-integration/cdn-engine-loader.d.ts +16 -0
- package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +97 -0
- package/dist/superdoc/src/core/whiteboard/Whiteboard.d.ts +247 -0
- package/dist/superdoc/src/core/whiteboard/WhiteboardPage.d.ts +251 -0
- package/dist/superdoc/src/core/whiteboard/WhiteboardRenderer.d.ts +2 -0
- package/dist/superdoc/src/core/whiteboard/helpers/createTextarea.d.ts +1 -0
- package/dist/superdoc/src/core/whiteboard/helpers/flattenPoints.d.ts +1 -0
- package/dist/superdoc/src/core/whiteboard/helpers/getRandomId.d.ts +1 -0
- package/dist/superdoc/src/helpers/collect-touched-tracked-change-ids.d.ts +11 -0
- package/dist/superdoc/src/helpers/comment-focus.d.ts +4 -0
- package/dist/superdoc/src/helpers/comment-small-screen.d.ts +14 -0
- package/dist/superdoc/src/helpers/deprecation.d.ts +26 -0
- package/dist/superdoc/src/helpers/floor.d.ts +1 -0
- package/dist/superdoc/src/helpers/group-changes.d.ts +1 -0
- package/dist/superdoc/src/helpers/interaction-trace.d.ts +26 -0
- package/dist/superdoc/src/helpers/selection-source.d.ts +1 -0
- package/dist/superdoc/src/helpers/transaction-touches-structural-change.d.ts +19 -0
- package/dist/superdoc/src/helpers/use-selection.d.ts +17 -0
- package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +22 -0
- package/dist/superdoc/src/helpers/v2-remote-review-hydration.d.ts +12 -0
- package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +15 -0
- package/dist/superdoc/src/helpers/v2-review-mutation-reconciler.d.ts +19 -0
- package/dist/superdoc/src/helpers/v2-review-target.d.ts +7 -0
- package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +12 -0
- package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +5 -0
- package/dist/superdoc/src/icons.d.ts +11 -0
- package/dist/superdoc/src/index.d.cts +13 -0
- package/dist/superdoc/src/index.d.ts +11 -0
- package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +21 -0
- package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +6 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +14 -0
- package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +13 -0
- package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +37 -0
- package/dist/superdoc/src/internal/toolbar/built-in/LinkedStyle.vue.d.ts +12 -0
- package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/SdTooltip.vue.d.ts +34 -0
- package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +14 -0
- package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +8 -0
- package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +6 -0
- package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +4 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +24 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButtonIcon.vue.d.ts +11 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +18 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +38 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +8 -0
- package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +24 -0
- package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +102 -0
- package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +17 -0
- package/dist/superdoc/src/internal/toolbar/built-in/font-options.d.ts +1 -0
- package/dist/superdoc/src/internal/toolbar/built-in/font-typeahead.d.ts +11 -0
- package/dist/superdoc/src/internal/toolbar/built-in/format-negation.d.ts +5 -0
- package/dist/superdoc/src/internal/toolbar/built-in/general.d.ts +1 -0
- package/dist/superdoc/src/internal/toolbar/built-in/helpers.d.ts +5 -0
- package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/scroll-helpers.d.ts +4 -0
- package/dist/superdoc/src/internal/toolbar/built-in/toolbar-focus-helpers.d.ts +1 -0
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +76 -0
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +58 -0
- package/dist/superdoc/src/internal/toolbar/built-in/url-safety.d.ts +8 -0
- package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +48 -0
- package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +237 -0
- package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +59 -0
- package/dist/superdoc/src/internal/toolbar/image-upload.d.ts +63 -0
- package/dist/superdoc/src/internal/toolbar/index.d.ts +10 -0
- package/dist/superdoc/src/main.d.ts +1 -0
- package/dist/superdoc/src/public/browser-document-api.d.ts +53 -0
- package/dist/superdoc/src/public/collaboration-upgrade-engine.d.cts +26 -0
- package/dist/superdoc/src/public/collaboration-upgrade-engine.d.ts +130 -0
- package/dist/superdoc/src/public/index.d.cts +359 -0
- package/dist/superdoc/src/public/index.d.ts +179 -0
- package/dist/superdoc/src/public/ui/commands.d.ts +249 -0
- package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +18 -0
- package/dist/superdoc/src/public/ui/entity-at.d.ts +29 -0
- package/dist/superdoc/src/public/ui/equality.d.ts +10 -0
- package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +36 -0
- package/dist/superdoc/src/public/ui/react.d.ts +81 -0
- package/dist/superdoc/src/public/ui/reasons.d.ts +99 -0
- package/dist/superdoc/src/public/ui/types.d.ts +1425 -0
- package/dist/superdoc/src/public/ui-react.d.cts +20 -0
- package/dist/superdoc/src/public/ui-react.d.ts +20 -0
- package/dist/superdoc/src/public/ui.d.cts +194 -0
- package/dist/superdoc/src/public/ui.d.ts +29 -0
- package/dist/superdoc/src/stores/comments-store.d.ts +676 -0
- package/dist/superdoc/src/stores/helpers/floating-comment-instances.d.ts +14 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +14 -0
- package/dist/superdoc/src/stores/hrbr-fields-store.d.ts +43 -0
- package/dist/superdoc/src/stores/superdoc-store.d.ts +2182 -0
- package/dist/superdoc.cjs +36521 -0
- package/dist/superdoc.es.js +36449 -0
- package/dist/word-layout/src/index.d.ts +64 -0
- package/dist/word-layout/src/list-marker.d.ts +68 -0
- package/dist/word-layout/src/marker-utils.d.ts +20 -0
- package/dist/word-layout/src/numbering-manager.d.ts +85 -0
- package/dist/word-layout/src/tab-layout.d.ts +193 -0
- package/dist/word-layout/src/types.d.ts +106 -0
- package/dist/word-layout/src/unit-conversions.d.ts +120 -0
- package/dist-cdn/style.layered.css +2 -0
- package/dist-cdn/superdoc.min.css +2 -0
- package/dist-cdn/superdoc.min.js +108 -0
- package/package.json +137 -24
- package/.npmignore +0 -4
- package/data.json +0 -17
- package/index.js +0 -2
- package/lib/Augmenter.js +0 -27
- package/lib/Runner.js +0 -80
- package/lib/Stopper.js +0 -71
- package/test/superdoc.js +0 -126
- package/utils/app.js +0 -18
- package/utils/server.js +0 -2
- package/web/index.js +0 -54
- package/web/public/style.css +0 -76
- package/web/views/index.ejs +0 -53
- package/web/views/layout.ejs +0 -13
- package/web/views/method.ejs +0 -59
|
@@ -0,0 +1,1425 @@
|
|
|
1
|
+
import { CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, EntityAddress, TextAddress, TextTarget, ScrollIntoViewInput, ScrollIntoViewOutput, SelectionInfo, SelectionTarget, Receipt, ReceiptFailureCode, ContentControlInfo, StyleCatalogItem, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult } from '../../../../document-api/src/index.js';
|
|
2
|
+
import { PartialBrowserDocumentApi } from '../browser-document-api.js';
|
|
3
|
+
import { SuperDocUIReason } from './reasons.js';
|
|
4
|
+
/**
|
|
5
|
+
* v2-native `superdoc/ui` controller types.
|
|
6
|
+
*
|
|
7
|
+
* This is the public type surface for the browser-only UI controller
|
|
8
|
+
* (`createSuperDocUI`) and its React bindings. It is deliberately
|
|
9
|
+
* SELF-CONTAINED: it imports nothing from the v1 editor surface and nothing
|
|
10
|
+
* from the private v2 runtime packages (the v2 host / editor-core / browser
|
|
11
|
+
* shell). The controller is a thin, duck-typed layer over:
|
|
12
|
+
*
|
|
13
|
+
* - `superdoc.activeEditor` (the public v2 active-editor facade),
|
|
14
|
+
* - `activeEditor.doc` (the public, read-only-guarded Document API facade),
|
|
15
|
+
* - SuperDoc lifecycle events (`editorCreate`, `document-mode-change`,
|
|
16
|
+
* `zoomChange`, `viewport-change`),
|
|
17
|
+
* - public SuperDoc instance methods (`export`, `setDocumentMode`, zoom).
|
|
18
|
+
*
|
|
19
|
+
* `activeEditor.doc` is the browser-facing Document API facade. Browser reads
|
|
20
|
+
* and mutations may settle asynchronously there; SDK/headless document
|
|
21
|
+
* automation remains synchronous on its own surface.
|
|
22
|
+
*
|
|
23
|
+
* The only `@superdoc/*` import is `@superdoc/document-api`, whose public
|
|
24
|
+
* Document API shapes are surfaced to consumers directly so they don't have to
|
|
25
|
+
* reach into that package themselves. The published-declaration pipeline
|
|
26
|
+
* relocates `@superdoc/document-api` into superdoc's own dist tree
|
|
27
|
+
* (`scripts/ensure-types.cjs` `rewriteDocApiPaths`), so no bare private
|
|
28
|
+
* specifier leaks into the emitted `.d.ts`.
|
|
29
|
+
*/
|
|
30
|
+
export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, } from '../../../../document-api/src/index.js';
|
|
31
|
+
export type { StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, } from '../../../../document-api/src/index.js';
|
|
32
|
+
export type { ListPresetId } from '../../../../document-api/src/index.js';
|
|
33
|
+
export type { BrowserDocumentApi, PartialBrowserDocumentApi } from '../browser-document-api.js';
|
|
34
|
+
export type { SuperDocUIReason } from './reasons.js';
|
|
35
|
+
/** Equality predicate used to suppress redundant slice notifications. */
|
|
36
|
+
export type EqualityFn<T> = (a: T, b: T) => boolean;
|
|
37
|
+
/** Pure projection from controller state to a derived slice. */
|
|
38
|
+
export type SelectorFn<TState, TSlice> = (state: TState) => TSlice;
|
|
39
|
+
/**
|
|
40
|
+
* Minimal observable contract returned by `ui.select(...)` and by each
|
|
41
|
+
* domain handle's slice subscriptions. Reading is synchronous; `subscribe`
|
|
42
|
+
* returns an unsubscribe function.
|
|
43
|
+
*/
|
|
44
|
+
export interface Subscribable<T> {
|
|
45
|
+
/** Current value. */
|
|
46
|
+
get(): T;
|
|
47
|
+
/** Subscribe to value changes; returns an unsubscribe function. */
|
|
48
|
+
subscribe(listener: (value: T) => void): () => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Snapshot-shaped subscription contract shared by every customer-facing domain
|
|
52
|
+
* handle (`ui.selection`, `ui.comments`, `ui.trackChanges`, ...). Mirrors the
|
|
53
|
+
* main SuperDoc surface so custom-UI code written against main runs unchanged:
|
|
54
|
+
*
|
|
55
|
+
* - `getSnapshot()` reads the current slice synchronously.
|
|
56
|
+
* - `observe(listener)` fires once immediately with the current snapshot, then
|
|
57
|
+
* again on each change. The listener receives the snapshot value directly.
|
|
58
|
+
* - `subscribe(listener)` is the event-shaped alias of `observe`: the listener
|
|
59
|
+
* receives `{ snapshot }` and likewise fires immediately then on change.
|
|
60
|
+
*
|
|
61
|
+
* The generic `ui.select(selector)` substrate keeps its raw-value
|
|
62
|
+
* {@link Subscribable} shape; only the domain handles use this contract.
|
|
63
|
+
*/
|
|
64
|
+
export interface SnapshotSubscribable<T> {
|
|
65
|
+
/** Read the current snapshot synchronously. */
|
|
66
|
+
getSnapshot(): T;
|
|
67
|
+
/**
|
|
68
|
+
* Undocumented retained alias of {@link getSnapshot}, kept so existing v2
|
|
69
|
+
* callers using `handle.get()` keep working; `getSnapshot()` is the canonical,
|
|
70
|
+
* main-compatible name.
|
|
71
|
+
*/
|
|
72
|
+
get(): T;
|
|
73
|
+
/**
|
|
74
|
+
* Subscribe to snapshot changes. The listener fires once immediately with the
|
|
75
|
+
* current snapshot wrapped as `{ snapshot }`, then again on each change.
|
|
76
|
+
* Returns an unsubscribe function.
|
|
77
|
+
*/
|
|
78
|
+
subscribe(listener: (event: {
|
|
79
|
+
snapshot: T;
|
|
80
|
+
}) => void): () => void;
|
|
81
|
+
/**
|
|
82
|
+
* Value-shaped alias of {@link subscribe}: the listener receives the snapshot
|
|
83
|
+
* directly, firing once immediately then on each change. Returns an
|
|
84
|
+
* unsubscribe function.
|
|
85
|
+
*/
|
|
86
|
+
observe(listener: (snapshot: T) => void): () => void;
|
|
87
|
+
}
|
|
88
|
+
/** Address of a comment thread anchor. */
|
|
89
|
+
export type CommentAddress = {
|
|
90
|
+
kind: 'comment';
|
|
91
|
+
commentId: string;
|
|
92
|
+
};
|
|
93
|
+
/** Address of a tracked change. */
|
|
94
|
+
export type TrackedChangeAddress = {
|
|
95
|
+
kind: 'trackedChange';
|
|
96
|
+
changeId: string;
|
|
97
|
+
};
|
|
98
|
+
/** Address of a content control, as exposed to viewport lookups. */
|
|
99
|
+
export type ContentControlViewportAddress = {
|
|
100
|
+
kind: 'contentControl';
|
|
101
|
+
/** Stable content-control id. */
|
|
102
|
+
id: string;
|
|
103
|
+
/** Optional internal node id, when the control is also addressable by node. */
|
|
104
|
+
internalId?: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Anything the viewport layer can resolve to a painted rectangle: a raw
|
|
108
|
+
* Document API entity address, or a content-control address.
|
|
109
|
+
*/
|
|
110
|
+
export type ViewportEntityAddress = EntityAddress | ContentControlViewportAddress;
|
|
111
|
+
/** A single comment, as returned by the Document API comments list. */
|
|
112
|
+
export type CommentInfo = CommentsListResult['items'][number];
|
|
113
|
+
/** A single tracked change, as returned by the Document API list. */
|
|
114
|
+
export type TrackChangeInfo = TrackChangesListResult['items'][number];
|
|
115
|
+
/**
|
|
116
|
+
* UI-facing tracked-change list row.
|
|
117
|
+
*
|
|
118
|
+
* The flat fields mirror the Document API list item while `change` preserves
|
|
119
|
+
* the v1 custom-UI row contract. New consumers can read the flat row; existing
|
|
120
|
+
* custom UI code can continue to pass `row.change` to detail renderers.
|
|
121
|
+
*/
|
|
122
|
+
export type TrackChangesItem = TrackChangeInfo & {
|
|
123
|
+
change: TrackChangeInfo;
|
|
124
|
+
};
|
|
125
|
+
/** A point hit-test result mapping a viewport point to a tracked-change row. */
|
|
126
|
+
export interface TrackChangePointHit {
|
|
127
|
+
/** Public tracked-change id of the resolved occurrence. */
|
|
128
|
+
id: string;
|
|
129
|
+
/** The matching tracked-change item. */
|
|
130
|
+
item: TrackChangesItem;
|
|
131
|
+
/**
|
|
132
|
+
* Painted story locator of the occurrence under the point, mirroring
|
|
133
|
+
* {@link ViewportEntityHit.story}: present for a story-scoped occurrence
|
|
134
|
+
* (footnote, endnote, header/footer, textbox), absent for body / story-less
|
|
135
|
+
* hits. `id` alone already identifies this exact occurrence; `story` is
|
|
136
|
+
* informational and can be passed through `setActive`/`accept`/`reject` for
|
|
137
|
+
* convenience.
|
|
138
|
+
*/
|
|
139
|
+
story?: unknown;
|
|
140
|
+
}
|
|
141
|
+
/** Filter/query options accepted by the Document API comments list surface. */
|
|
142
|
+
export type CommentsListQuery = DocumentApiCommentsListQuery;
|
|
143
|
+
/** A selectable font family option for a font picker UI. */
|
|
144
|
+
export interface FontFamilyOption {
|
|
145
|
+
/** Stable value forwarded to the formatting command. */
|
|
146
|
+
value: string;
|
|
147
|
+
/** Human-readable label. */
|
|
148
|
+
label: string;
|
|
149
|
+
/** Optional CSS font-family preview value. */
|
|
150
|
+
previewFamily?: string;
|
|
151
|
+
}
|
|
152
|
+
/** A selectable font-size option for a font-size picker UI. */
|
|
153
|
+
export interface FontSizeOption {
|
|
154
|
+
/** Stable value forwarded to the formatting command. */
|
|
155
|
+
value: string;
|
|
156
|
+
/** Human-readable label. */
|
|
157
|
+
label: string;
|
|
158
|
+
}
|
|
159
|
+
/** Observable enable/active state for a toolbar-style command. */
|
|
160
|
+
export interface CommandState {
|
|
161
|
+
/** The command can run against the current selection / mode. */
|
|
162
|
+
enabled: boolean;
|
|
163
|
+
/** Compatibility inverse of `enabled` for demo code that models commands as disabled. */
|
|
164
|
+
disabled?: boolean;
|
|
165
|
+
/** The command's formatting is currently applied at the selection. */
|
|
166
|
+
active: boolean;
|
|
167
|
+
/** The controller recognizes this command id and can route it. */
|
|
168
|
+
supported: boolean;
|
|
169
|
+
/** Optional command value, such as a selected font family. */
|
|
170
|
+
value?: unknown;
|
|
171
|
+
/** Whether this state comes from a built-in, custom, or unsupported command. */
|
|
172
|
+
source?: 'builtin' | 'custom' | 'unsupported';
|
|
173
|
+
/**
|
|
174
|
+
* Stable public reason explaining why the command is disabled / unsupported.
|
|
175
|
+
* Present only when the command cannot run (`enabled === false`); omitted when
|
|
176
|
+
* the command is enabled. Lets consumers distinguish unsupported-by-v2,
|
|
177
|
+
* deferred-by-product, not-ready, read-only, and missing-context cases instead
|
|
178
|
+
* of treating every disabled command as opaque.
|
|
179
|
+
*
|
|
180
|
+
* Host/lower-level reason strings are normalized into this stable public
|
|
181
|
+
* taxonomy before reaching consumers.
|
|
182
|
+
*/
|
|
183
|
+
reason?: SuperDocUIReason;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Failure code carried by a receipt that the UI controller mints itself
|
|
187
|
+
* (rather than relaying from the Document API). Extends the Document API's
|
|
188
|
+
* {@link ReceiptFailureCode} vocabulary with the controller-level failure
|
|
189
|
+
* modes that have no Document API equivalent:
|
|
190
|
+
*
|
|
191
|
+
* - `DOCUMENT_READONLY` — a mutating workflow was invoked while the
|
|
192
|
+
* document is in viewing / read-only mode;
|
|
193
|
+
* - `NO_SELECTION` — a selection-scoped workflow (e.g.
|
|
194
|
+
* `comments.createFromSelection`) ran with no range selection;
|
|
195
|
+
* - `PARTIAL_LINK_EDIT` — a combined link edit updated the hyperlink
|
|
196
|
+
* target but failed to replace the display text (see
|
|
197
|
+
* {@link PartialLinkEditReceipt}).
|
|
198
|
+
*/
|
|
199
|
+
export type SuperDocUIReceiptFailureCode = ReceiptFailureCode | 'DOCUMENT_READONLY' | 'NO_SELECTION' | 'PARTIAL_LINK_EDIT';
|
|
200
|
+
/**
|
|
201
|
+
* Failure receipt minted by the UI controller itself. Shaped exactly like the
|
|
202
|
+
* Document API's failure receipt so consumers can branch on
|
|
203
|
+
* `receipt.failure.code` uniformly, but with the controller-level
|
|
204
|
+
* {@link SuperDocUIReceiptFailureCode} vocabulary.
|
|
205
|
+
*
|
|
206
|
+
* `PARTIAL_LINK_EDIT` is excluded here because that failure always carries
|
|
207
|
+
* the richer {@link PartialLinkEditReceipt} shape; keeping the codes disjoint
|
|
208
|
+
* lets `receipt.failure.code === 'PARTIAL_LINK_EDIT'` narrow a
|
|
209
|
+
* {@link SuperDocUIReceipt} to {@link PartialLinkEditReceipt}.
|
|
210
|
+
*/
|
|
211
|
+
export interface SuperDocUIFailureReceipt {
|
|
212
|
+
success: false;
|
|
213
|
+
failure: {
|
|
214
|
+
code: Exclude<SuperDocUIReceiptFailureCode, 'PARTIAL_LINK_EDIT'>;
|
|
215
|
+
message: string;
|
|
216
|
+
details?: unknown;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Failure receipt for a combined link edit (`link` command with both a target
|
|
221
|
+
* and display text) where the hyperlink target was updated but the display
|
|
222
|
+
* text replacement failed. Carries per-part context so consumers can tell
|
|
223
|
+
* which half applied and why the other failed.
|
|
224
|
+
*
|
|
225
|
+
* Deliberately does not extend {@link SuperDocUIFailureReceipt}: that shape
|
|
226
|
+
* excludes the `PARTIAL_LINK_EDIT` code so the two receipt kinds stay
|
|
227
|
+
* discriminable by `failure.code` within {@link SuperDocUIReceipt}.
|
|
228
|
+
*
|
|
229
|
+
* TypeScript does not narrow a parent union from a nested discriminant, so
|
|
230
|
+
* `receipt.failure.code === 'PARTIAL_LINK_EDIT'` alone narrows only
|
|
231
|
+
* `receipt.failure`. To reach `applied` / `hyperlinkResult` / `textResult`,
|
|
232
|
+
* narrow the receipt itself:
|
|
233
|
+
*
|
|
234
|
+
* ```ts
|
|
235
|
+
* if (!receipt.success && 'applied' in receipt) {
|
|
236
|
+
* receipt; // PartialLinkEditReceipt
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
export interface PartialLinkEditReceipt {
|
|
241
|
+
success: false;
|
|
242
|
+
failure: {
|
|
243
|
+
code: 'PARTIAL_LINK_EDIT';
|
|
244
|
+
message: string;
|
|
245
|
+
details?: unknown;
|
|
246
|
+
};
|
|
247
|
+
/** Which halves of the combined edit were applied. */
|
|
248
|
+
applied: {
|
|
249
|
+
href: boolean;
|
|
250
|
+
text: boolean;
|
|
251
|
+
};
|
|
252
|
+
/** Result of the hyperlink-target half of the edit. */
|
|
253
|
+
hyperlinkResult: CommandExecutionResult;
|
|
254
|
+
/** Result of the display-text half of the edit. */
|
|
255
|
+
textResult: CommandExecutionResult;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* A receipt surfaced by the UI controller: a Document API {@link Receipt}
|
|
259
|
+
* relayed as-is, a controller-minted {@link SuperDocUIFailureReceipt} for
|
|
260
|
+
* failures the controller detects before (or while) routing to the Document
|
|
261
|
+
* API, or a {@link PartialLinkEditReceipt} for half-applied combined link
|
|
262
|
+
* edits.
|
|
263
|
+
*/
|
|
264
|
+
export type SuperDocUIReceipt = Receipt | SuperDocUIFailureReceipt | PartialLinkEditReceipt;
|
|
265
|
+
/**
|
|
266
|
+
* Result returned by command execution.
|
|
267
|
+
*
|
|
268
|
+
* `false` means the controller could not route the command. A receipt
|
|
269
|
+
* preserves the public Document API facade result (or a controller-minted
|
|
270
|
+
* failure), including read-only / unsupported failures and mutation effects.
|
|
271
|
+
* `true` is returned for legacy command handlers that do not produce a
|
|
272
|
+
* structured result, or when the host reports only that an async browser
|
|
273
|
+
* operation was scheduled. Use `executeAsync(...)` to await the settled result
|
|
274
|
+
* when the browser Document API / host runs asynchronously.
|
|
275
|
+
*/
|
|
276
|
+
export type CommandExecutionResult = boolean | SuperDocUIReceipt;
|
|
277
|
+
/**
|
|
278
|
+
* Direct workflow helpers return the Document API receipt (or a
|
|
279
|
+
* controller-minted failure receipt). Browser `activeEditor.doc` facades
|
|
280
|
+
* settle those operations asynchronously by contract; SDK/headless
|
|
281
|
+
* document-automation facades may still return the receipt synchronously.
|
|
282
|
+
*/
|
|
283
|
+
export type WorkflowReceipt = SuperDocUIReceipt | Promise<SuperDocUIReceipt>;
|
|
284
|
+
/**
|
|
285
|
+
* Result of a best-effort workflow action that either performs real
|
|
286
|
+
* public-surface behavior (`ok: true`) or fails closed (`ok: false`) carrying a
|
|
287
|
+
* stable {@link SuperDocUIReason}. Returned by scroll/focus helpers that route
|
|
288
|
+
* through host-owned navigation. Never throws and never silently no-ops.
|
|
289
|
+
*/
|
|
290
|
+
export interface WorkflowActionResult {
|
|
291
|
+
/** The action reached and ran a public host/Document API surface. */
|
|
292
|
+
ok: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Stable reason when `ok` is false. Omitted on success. Host/lower-level
|
|
295
|
+
* reason strings are normalized into this stable public taxonomy before
|
|
296
|
+
* reaching consumers.
|
|
297
|
+
*/
|
|
298
|
+
reason?: SuperDocUIReason;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Scroll helpers keep the v1/main `{ success }` shape while retaining v2's
|
|
302
|
+
* fail-closed `{ ok, reason }` details for existing v2 consumers.
|
|
303
|
+
*/
|
|
304
|
+
export type WorkflowScrollResult = ScrollIntoViewOutput & WorkflowActionResult;
|
|
305
|
+
/**
|
|
306
|
+
* `selection.restore` keeps the v1/main `{ success }` shape while retaining
|
|
307
|
+
* v2's fail-closed `{ ok, reason }` details for existing v2 consumers.
|
|
308
|
+
* `success` always mirrors `ok`.
|
|
309
|
+
*/
|
|
310
|
+
export type SelectionRestoreResult = {
|
|
311
|
+
success: boolean;
|
|
312
|
+
} & WorkflowActionResult;
|
|
313
|
+
/**
|
|
314
|
+
* Handle for a single command id. `execute` routes through the public
|
|
315
|
+
* Document API / SuperDoc instance; `getState` reflects the live enable/active
|
|
316
|
+
* snapshot; `observe` notifies on state change.
|
|
317
|
+
*/
|
|
318
|
+
export interface CommandHandle<Id extends string = string> {
|
|
319
|
+
/** The command id this handle wraps. */
|
|
320
|
+
readonly id: Id;
|
|
321
|
+
/** Current enable/active state. */
|
|
322
|
+
getState(): CommandState;
|
|
323
|
+
/** Subscribe to state changes; returns an unsubscribe function. */
|
|
324
|
+
observe(listener: (state: CommandState) => void): () => void;
|
|
325
|
+
/**
|
|
326
|
+
* Run the command. Returns the Document API receipt when the host facade
|
|
327
|
+
* provides one, or `false` for unsupported / disabled commands rather than
|
|
328
|
+
* throwing. When the browser operation settles asynchronously this returns
|
|
329
|
+
* the immediate routed result (`true` or a sync receipt); use
|
|
330
|
+
* `executeAsync(...)` to await settlement.
|
|
331
|
+
*/
|
|
332
|
+
execute(payload?: unknown): CommandExecutionResult;
|
|
333
|
+
/**
|
|
334
|
+
* Run the command and resolve once the routed operation has settled. On
|
|
335
|
+
* browser-backed hosts this includes the post-mutation paint observation
|
|
336
|
+
* boundary when available.
|
|
337
|
+
*/
|
|
338
|
+
executeAsync(payload?: unknown): Promise<CommandExecutionResult>;
|
|
339
|
+
}
|
|
340
|
+
/** Registration descriptor for a consumer-defined command. */
|
|
341
|
+
export interface CustomCommandHandleState<TValue = unknown> extends CommandState {
|
|
342
|
+
disabled: boolean;
|
|
343
|
+
value: TValue | undefined;
|
|
344
|
+
source: 'builtin' | 'custom' | 'unsupported';
|
|
345
|
+
}
|
|
346
|
+
export interface ContextMenuItem {
|
|
347
|
+
id: string;
|
|
348
|
+
label: string;
|
|
349
|
+
group?: string;
|
|
350
|
+
order?: number;
|
|
351
|
+
/**
|
|
352
|
+
* Invoke the contributed command. Returns the immediate routed result for the
|
|
353
|
+
* synchronous menu-click path; the command's document work still settles
|
|
354
|
+
* asynchronously and refreshes controller slices.
|
|
355
|
+
*/
|
|
356
|
+
invoke(): CommandExecutionResult;
|
|
357
|
+
}
|
|
358
|
+
export interface ViewportEntityHit {
|
|
359
|
+
type: string;
|
|
360
|
+
id: string;
|
|
361
|
+
tag?: string;
|
|
362
|
+
scope?: 'block' | 'inline';
|
|
363
|
+
/**
|
|
364
|
+
* Painted story locator for a tracked-change hit. Meaningful only for
|
|
365
|
+
* `type: 'trackedChange'`; absent for body-only content and for comment /
|
|
366
|
+
* content-control hits. Lets point hit-testing disambiguate a tracked-change
|
|
367
|
+
* id that repeats across stories (body, footnote, header/footer, textbox) by
|
|
368
|
+
* resolving to the occurrence actually under the point.
|
|
369
|
+
*/
|
|
370
|
+
story?: unknown;
|
|
371
|
+
}
|
|
372
|
+
export interface ViewportContext {
|
|
373
|
+
/**
|
|
374
|
+
* The viewport-relative coordinate the consumer asked about. Echoed back so
|
|
375
|
+
* handlers that anchor floating UI to the click point don't have to remember
|
|
376
|
+
* it separately. Optional/additive: the producer (`contextAt`) always sets it,
|
|
377
|
+
* but it stays optional so consumer-constructed `ViewportContext` values built
|
|
378
|
+
* against the older shape (without `point`) keep type-checking.
|
|
379
|
+
*/
|
|
380
|
+
point?: {
|
|
381
|
+
x: number;
|
|
382
|
+
y: number;
|
|
383
|
+
};
|
|
384
|
+
entities: readonly ViewportEntityHit[];
|
|
385
|
+
selection: SelectionSlice;
|
|
386
|
+
position: {
|
|
387
|
+
target: SelectionTarget | null;
|
|
388
|
+
} | null;
|
|
389
|
+
insideSelection: boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Shared, V2-truthful execution context handed to a custom command / custom
|
|
393
|
+
* toolbar button callback.
|
|
394
|
+
*
|
|
395
|
+
* This is the single callback contract both the built-in toolbar shell and
|
|
396
|
+
* custom UIs use. It deliberately does NOT expose `superdoc.activeEditor.commands`
|
|
397
|
+
* (which is `null` on v2). Instead it routes everything through public surfaces:
|
|
398
|
+
*
|
|
399
|
+
* - `execute` / `executeAsync` run any catalog command id through the shared
|
|
400
|
+
* controller (the same command-state truth the toolbar uses);
|
|
401
|
+
* - `ui` is the live controller, so a callback can read slices or drive any
|
|
402
|
+
* handle (`ui.comments`, `ui.trackChanges`, `ui.zoom`, `ui.search`, ...);
|
|
403
|
+
* - `doc` is the public Document API facade (read-only-guarded,
|
|
404
|
+
* async-capable in browser), the sanctioned mutation surface, or `null`
|
|
405
|
+
* when unavailable;
|
|
406
|
+
* - `insertText` is a narrow insertion helper routed through the Document API;
|
|
407
|
+
* - `selection` and `documentMode` are read-only document context;
|
|
408
|
+
* - `superdoc` and `editor` remain available for public instance methods.
|
|
409
|
+
*
|
|
410
|
+
* Callback failures are caught by the controller / built-in toolbar authority
|
|
411
|
+
* and surfaced through the toolbar exception channel rather than throwing.
|
|
412
|
+
*/
|
|
413
|
+
export interface CustomCommandContext<TPayload = unknown> {
|
|
414
|
+
payload?: TPayload;
|
|
415
|
+
state: SuperDocUIState;
|
|
416
|
+
editor: SuperDocEditorLike | null;
|
|
417
|
+
superdoc: SuperDocLike;
|
|
418
|
+
context?: ViewportContext;
|
|
419
|
+
/**
|
|
420
|
+
* The live UI controller (shared command-state truth).
|
|
421
|
+
*
|
|
422
|
+
* Borrowed: a custom command runs against whichever controller invoked it,
|
|
423
|
+
* which for `superdoc.ui.commands.register(...)` is the instance-owned
|
|
424
|
+
* singleton the built-in toolbar also reads. Typing this as the owned form
|
|
425
|
+
* would let a command callback destroy it, which is the hole the borrowed
|
|
426
|
+
* handle exists to close.
|
|
427
|
+
*
|
|
428
|
+
* Borrowed unconditionally, including for a controller you built with
|
|
429
|
+
* `createSuperDocUI()`. That costs an owner nothing: you necessarily hold the
|
|
430
|
+
* owned reference already, since you called `.commands.register(...)` on it,
|
|
431
|
+
* so tear it down through that instead of through the context. Varying this
|
|
432
|
+
* by ownership would mean `SuperDocUI` and {@link BorrowedSuperDocUI} needing
|
|
433
|
+
* different `commands` handles, and the borrowed form is derived from the
|
|
434
|
+
* owned one precisely so the two cannot drift.
|
|
435
|
+
*/
|
|
436
|
+
ui: BorrowedSuperDocUI;
|
|
437
|
+
/** Run a catalog command id through the shared controller. */
|
|
438
|
+
execute(id: string, payload?: unknown): CommandExecutionResult;
|
|
439
|
+
/** Run a catalog command id and await its settled result. */
|
|
440
|
+
executeAsync(id: string, payload?: unknown): Promise<CommandExecutionResult>;
|
|
441
|
+
/**
|
|
442
|
+
* The host's browser Document API facade (read-only-guarded, async-capable),
|
|
443
|
+
* or `null` when unavailable.
|
|
444
|
+
*
|
|
445
|
+
* Partial for the same reason {@link SuperDocEditorLike.doc} is: this is the
|
|
446
|
+
* host's own object handed straight through, and a duck-typed host is only
|
|
447
|
+
* required to carry the operations it implements. Typing it as the complete
|
|
448
|
+
* facade would promise operations a custom adapter or stub never defines.
|
|
449
|
+
*
|
|
450
|
+
* Prefer {@link CustomCommandContext.execute}, `executeAsync`, and
|
|
451
|
+
* `insertText` where they cover the work: those route through the controller
|
|
452
|
+
* and fail closed with a reason or a receipt when an operation is missing.
|
|
453
|
+
* Reach for `doc` when you need an operation the controller does not route,
|
|
454
|
+
* and guard the call.
|
|
455
|
+
*/
|
|
456
|
+
doc: PartialBrowserDocumentApi | null;
|
|
457
|
+
/** Read-only selection snapshot at invocation time. */
|
|
458
|
+
selection: SelectionSlice;
|
|
459
|
+
/** Current document mode. */
|
|
460
|
+
documentMode: 'editing' | 'suggesting' | 'viewing' | null;
|
|
461
|
+
/**
|
|
462
|
+
* Insert plain text through the public Document API (a narrow built-in/custom
|
|
463
|
+
* insertion helper). Fails closed with a failure receipt when the Document API
|
|
464
|
+
* is unavailable or the document is read-only.
|
|
465
|
+
*/
|
|
466
|
+
insertText(text: string): WorkflowReceipt;
|
|
467
|
+
}
|
|
468
|
+
export interface CustomCommandRegistration<TPayload = unknown, TValue = unknown> {
|
|
469
|
+
/** Unique command id. */
|
|
470
|
+
id: string;
|
|
471
|
+
/** Implementation invoked when the command runs. */
|
|
472
|
+
execute(context: CustomCommandContext<TPayload>): unknown;
|
|
473
|
+
/** Optional live-state provider. */
|
|
474
|
+
getState?(context: CustomCommandContext<TPayload>): Partial<CustomCommandHandleState<TValue>>;
|
|
475
|
+
/** Optional keyboard shortcut metadata for consumer UIs. */
|
|
476
|
+
shortcut?: string;
|
|
477
|
+
/** Optional context-menu contribution metadata. */
|
|
478
|
+
contextMenu?: {
|
|
479
|
+
label: string;
|
|
480
|
+
group?: string;
|
|
481
|
+
order?: number;
|
|
482
|
+
when?(context: ViewportContext): boolean;
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
export interface CustomCommandHandle<TPayload = unknown, TValue = unknown> extends Omit<CommandHandle<string>, 'execute' | 'executeAsync' | 'getState' | 'observe'> {
|
|
486
|
+
/** Current custom-command state. */
|
|
487
|
+
getState(): CustomCommandHandleState<TValue>;
|
|
488
|
+
/** Subscribe to custom-command state changes; returns an unsubscribe function. */
|
|
489
|
+
observe(listener: (state: CustomCommandHandleState<TValue>) => void): () => void;
|
|
490
|
+
/** Run the custom command with its payload shape. */
|
|
491
|
+
execute(payload?: TPayload): CommandExecutionResult;
|
|
492
|
+
/** Await the custom command's settled result. */
|
|
493
|
+
executeAsync(payload?: TPayload): Promise<CommandExecutionResult>;
|
|
494
|
+
}
|
|
495
|
+
export type CustomCommandRegistrationResult<TPayload = unknown, TValue = unknown> = (() => void) & {
|
|
496
|
+
handle: CustomCommandHandle<TPayload, TValue>;
|
|
497
|
+
unregister(): void;
|
|
498
|
+
};
|
|
499
|
+
/** Aggregate command surface. */
|
|
500
|
+
export interface CommandsHandle {
|
|
501
|
+
/** All known command ids (built-in plus registered). */
|
|
502
|
+
readonly ids: readonly string[];
|
|
503
|
+
/** Whether a command id is known to the controller. */
|
|
504
|
+
has(id: string): boolean;
|
|
505
|
+
/** Resolve a handle for a command id. */
|
|
506
|
+
get<Id extends string = string>(id: Id): CommandHandle<Id>;
|
|
507
|
+
/** Execute a command by id. */
|
|
508
|
+
execute(id: string, payload?: unknown): CommandExecutionResult;
|
|
509
|
+
/** Execute a command by id and resolve once the routed work has settled. */
|
|
510
|
+
executeAsync(id: string, payload?: unknown): Promise<CommandExecutionResult>;
|
|
511
|
+
/** Register a consumer-defined command; returns an unregister function. */
|
|
512
|
+
register<TPayload = unknown, TValue = unknown>(registration: CustomCommandRegistration<TPayload, TValue>): CustomCommandRegistrationResult<TPayload, TValue>;
|
|
513
|
+
/** Resolve context-menu contributions for a viewport context. */
|
|
514
|
+
getContextMenuItems(context: ViewportContext): readonly ContextMenuItem[];
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Readiness of an async-backed slice. The browser Document API settles reads
|
|
518
|
+
* asynchronously, so the reactive store distinguishes three cases that an
|
|
519
|
+
* `empty` list alone cannot:
|
|
520
|
+
*
|
|
521
|
+
* - `ready` — the underlying read has settled; the slice reflects live truth
|
|
522
|
+
* (an empty list here means genuinely empty);
|
|
523
|
+
* - `pending` — no value has settled yet for the current editor/selection, so
|
|
524
|
+
* the slice is showing its initial empty default while a read is in flight;
|
|
525
|
+
* - `stale` — a previously settled value is being shown while a refresh runs
|
|
526
|
+
* (selection moved or the document mutated); the data is best-known, not
|
|
527
|
+
* current.
|
|
528
|
+
*
|
|
529
|
+
* The same vocabulary is used across every async-backed slice for consistency.
|
|
530
|
+
*/
|
|
531
|
+
export type SliceStatus = 'ready' | 'pending' | 'stale';
|
|
532
|
+
/** Selection state slice. */
|
|
533
|
+
export interface SelectionSlice {
|
|
534
|
+
/**
|
|
535
|
+
* Readiness of the underlying async selection read. `ready` once the browser
|
|
536
|
+
* selection read has settled; `pending` before the first settle; `stale`
|
|
537
|
+
* while a re-read is in flight after a selection/document change.
|
|
538
|
+
*/
|
|
539
|
+
status: SliceStatus;
|
|
540
|
+
/** No selection / collapsed-empty. */
|
|
541
|
+
empty: boolean;
|
|
542
|
+
/** Resolved text target for the selection, when available. */
|
|
543
|
+
target: TextTarget | null;
|
|
544
|
+
/** Explicit start/end selection target, when available. */
|
|
545
|
+
selectionTarget: SelectionTarget | null;
|
|
546
|
+
/** Marks currently active at the selection. */
|
|
547
|
+
activeMarks: readonly string[];
|
|
548
|
+
/** Comment ids overlapping the selection. */
|
|
549
|
+
activeCommentIds: readonly string[];
|
|
550
|
+
/** Tracked-change ids overlapping the selection. */
|
|
551
|
+
activeChangeIds: readonly string[];
|
|
552
|
+
/** Plain-text of the current selection. */
|
|
553
|
+
quotedText: string;
|
|
554
|
+
}
|
|
555
|
+
/** Toolbar snapshot slice. */
|
|
556
|
+
export interface ToolbarSnapshotSlice {
|
|
557
|
+
/** Document mode context the toolbar should reflect. */
|
|
558
|
+
context: 'editing' | 'suggesting' | 'viewing' | null;
|
|
559
|
+
/** Per-command enable/active state keyed by command id. */
|
|
560
|
+
commands: Readonly<Record<string, CommandState>>;
|
|
561
|
+
/** True when the format-painter is armed (single or persistent mode). */
|
|
562
|
+
copyFormatActive: boolean;
|
|
563
|
+
}
|
|
564
|
+
/** Format-painter controller surface exposed on {@link SuperDocUI}. */
|
|
565
|
+
export interface FormatPainterHandle {
|
|
566
|
+
/** Notify the controller that a pointer-drag selection has started. */
|
|
567
|
+
setPointerSelecting(flag: boolean): void;
|
|
568
|
+
/** Notify the controller that the pointer was released; triggers apply if a non-source selection exists. */
|
|
569
|
+
notifyPointerUp(): void;
|
|
570
|
+
/** Notify the controller that a keyboard selection key is held. */
|
|
571
|
+
setKeyboardSelecting(flag: boolean): void;
|
|
572
|
+
/** Notify the controller that the keyboard selection key was released; triggers apply. */
|
|
573
|
+
notifyKeyUp(): void;
|
|
574
|
+
/** Cancel an active painter (Esc or programmatic cancel). */
|
|
575
|
+
cancel(): void;
|
|
576
|
+
/** Subscribe to painter mode changes. Returns a detach function. */
|
|
577
|
+
onModeChange(cb: (mode: 'idle' | 'armed' | 'persistent') => void): () => void;
|
|
578
|
+
}
|
|
579
|
+
/** Comments slice. */
|
|
580
|
+
export interface CommentsSlice {
|
|
581
|
+
/**
|
|
582
|
+
* Readiness of the underlying async comments read, combined with the live
|
|
583
|
+
* selection read ({@link SliceStatus}). Checks that only need the comment
|
|
584
|
+
* list itself (e.g. `setActive`'s membership check) should gate on
|
|
585
|
+
* {@link listStatus} instead, since an unrelated selection re-read can hold
|
|
586
|
+
* this combined status at `pending`/`stale` even though the list is ready.
|
|
587
|
+
*/
|
|
588
|
+
status: SliceStatus;
|
|
589
|
+
/** Readiness of the comment list read alone, independent of selection. */
|
|
590
|
+
listStatus: SliceStatus;
|
|
591
|
+
/** All comments currently loaded. */
|
|
592
|
+
items: readonly CommentInfo[];
|
|
593
|
+
/** Total comment count. */
|
|
594
|
+
total: number;
|
|
595
|
+
/** Comment ids active at the current selection. */
|
|
596
|
+
activeIds: readonly string[];
|
|
597
|
+
/**
|
|
598
|
+
* The single comment a consumer UI should treat as focused: an explicit
|
|
599
|
+
* `setActive(id)` when set, otherwise the first comment overlapping the live
|
|
600
|
+
* selection. `null` when neither is present.
|
|
601
|
+
*/
|
|
602
|
+
activeId: string | null;
|
|
603
|
+
}
|
|
604
|
+
/** Track-changes slice. */
|
|
605
|
+
export interface TrackChangesSlice {
|
|
606
|
+
/** Readiness of the underlying async tracked-change read ({@link SliceStatus}). */
|
|
607
|
+
status: SliceStatus;
|
|
608
|
+
/** All tracked changes currently loaded. */
|
|
609
|
+
items: readonly TrackChangesItem[];
|
|
610
|
+
/** Total tracked-change count. */
|
|
611
|
+
total: number;
|
|
612
|
+
/** Tracked-change id active at the current selection, if any. */
|
|
613
|
+
activeId: string | null;
|
|
614
|
+
/** Distinct authors across the loaded changes. */
|
|
615
|
+
authors: readonly string[];
|
|
616
|
+
}
|
|
617
|
+
/** Content-controls slice. */
|
|
618
|
+
export interface ContentControlsSlice {
|
|
619
|
+
/** Readiness of the underlying async content-control read ({@link SliceStatus}). */
|
|
620
|
+
status: SliceStatus;
|
|
621
|
+
/** All content controls currently loaded. */
|
|
622
|
+
items: readonly ContentControlInfo[];
|
|
623
|
+
/** Total content-control count. */
|
|
624
|
+
total: number;
|
|
625
|
+
/** First content-control id active at the current selection, if any. */
|
|
626
|
+
activeId: string | null;
|
|
627
|
+
/** Content-control ids active at the current selection. */
|
|
628
|
+
activeIds: readonly string[];
|
|
629
|
+
}
|
|
630
|
+
/** Font picker slice. */
|
|
631
|
+
export interface FontsSlice {
|
|
632
|
+
/** Font family options. */
|
|
633
|
+
options: readonly FontFamilyOption[];
|
|
634
|
+
/** Font size options. */
|
|
635
|
+
sizeOptions: readonly FontSizeOption[];
|
|
636
|
+
}
|
|
637
|
+
/** Zoom slice. */
|
|
638
|
+
export interface ZoomSlice {
|
|
639
|
+
/** Current zoom mode. */
|
|
640
|
+
mode: 'manual' | 'fit-width' | null;
|
|
641
|
+
/** Current zoom value as a percentage (100 = 100%). */
|
|
642
|
+
value: number;
|
|
643
|
+
/** Minimum allowed zoom percentage. */
|
|
644
|
+
min: number;
|
|
645
|
+
/** Maximum allowed zoom percentage. */
|
|
646
|
+
max: number;
|
|
647
|
+
}
|
|
648
|
+
/** Document-level state slice. */
|
|
649
|
+
export interface DocumentSlice {
|
|
650
|
+
/** The active editor is ready. */
|
|
651
|
+
ready: boolean;
|
|
652
|
+
/** Current document mode. */
|
|
653
|
+
mode: 'editing' | 'suggesting' | 'viewing' | null;
|
|
654
|
+
/** The document has unsaved changes. */
|
|
655
|
+
dirty: boolean;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Style-catalogue state slice.
|
|
659
|
+
*
|
|
660
|
+
* A truthful, fail-closed projection of the public Document API style
|
|
661
|
+
* catalogue (`doc.styles.getCatalog`) plus the active paragraph style derived
|
|
662
|
+
* from the current selection's block reads. When the catalogue surface is
|
|
663
|
+
* unreachable (viewing mode, worker-backed editor, pre-ready editor) the slice
|
|
664
|
+
* degrades to empty lists / null fields and carries diagnostics rather than
|
|
665
|
+
* guessing.
|
|
666
|
+
*/
|
|
667
|
+
export interface StylesSlice {
|
|
668
|
+
/** The active editor is ready and the styles surface was queried. */
|
|
669
|
+
ready: boolean;
|
|
670
|
+
/**
|
|
671
|
+
* Readiness of the underlying async catalogue / active-style reads
|
|
672
|
+
* ({@link SliceStatus}). `pending` before the first settle, `stale` while a
|
|
673
|
+
* refresh is in flight, `ready` once settled. Distinct from {@link ready},
|
|
674
|
+
* which only reports whether an editor is mounted.
|
|
675
|
+
*/
|
|
676
|
+
status: SliceStatus;
|
|
677
|
+
/** Opaque catalogue revision token, or null when unavailable. */
|
|
678
|
+
catalogRevision: string | null;
|
|
679
|
+
/** Word-style quick gallery items (ordered), or empty when unavailable. */
|
|
680
|
+
quickGallery: readonly StyleCatalogItem[];
|
|
681
|
+
/**
|
|
682
|
+
* Stable style id active across the selected paragraph(s): the uniform
|
|
683
|
+
* explicit style, or the document default paragraph style when no explicit
|
|
684
|
+
* style is set. `null` for a mixed selection or when block reads fail closed.
|
|
685
|
+
*/
|
|
686
|
+
activeParagraphStyleId: string | null;
|
|
687
|
+
/** Display name for {@link activeParagraphStyleId}, when resolvable from the catalogue. */
|
|
688
|
+
activeParagraphStyleName: string | null;
|
|
689
|
+
/** The selection spans paragraphs with more than one distinct style. */
|
|
690
|
+
mixedSelection: boolean;
|
|
691
|
+
/** Per-source status from the catalogue, or null when the catalogue is unavailable. */
|
|
692
|
+
sourceStatus: StyleCatalogSourceStatus | null;
|
|
693
|
+
/** Catalogue and active-style diagnostics (fallbacks, missing parts, fail-closed reads). */
|
|
694
|
+
diagnostics: readonly StyleCatalogDiagnostic[];
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* The active paragraph style resolved from the current selection. `styleId` is
|
|
698
|
+
* the uniform style across the selected paragraphs (or the document default
|
|
699
|
+
* when none is set); `mixed` is true when the selection spans multiple styles;
|
|
700
|
+
* both `styleId` and `styleName` are null when reads fail closed, in which case
|
|
701
|
+
* `diagnostics` explains why.
|
|
702
|
+
*/
|
|
703
|
+
export interface ActiveParagraphStyle {
|
|
704
|
+
/** Uniform / default style id, or null for mixed / unavailable. */
|
|
705
|
+
styleId: string | null;
|
|
706
|
+
/** Display name for {@link styleId}, when resolvable. */
|
|
707
|
+
styleName: string | null;
|
|
708
|
+
/** The selection spans more than one distinct paragraph style. */
|
|
709
|
+
mixed: boolean;
|
|
710
|
+
/** Diagnostics explaining a fail-closed or partial active-style read. */
|
|
711
|
+
diagnostics: readonly StyleCatalogDiagnostic[];
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Styles surface shared by the built-in toolbar (WS5) and custom UIs. Reads the
|
|
715
|
+
* public Document API style catalogue and the active paragraph style; it never
|
|
716
|
+
* imports private v2 runtime/style-model packages.
|
|
717
|
+
*/
|
|
718
|
+
export interface StylesHandle extends SnapshotSubscribable<StylesSlice> {
|
|
719
|
+
/** Read the current styles snapshot. */
|
|
720
|
+
getSnapshot(): StylesSlice;
|
|
721
|
+
/**
|
|
722
|
+
* Read the style catalogue through the public Document API, with optional
|
|
723
|
+
* view / type / visibility filters. Returns `null` (fail-closed) when the
|
|
724
|
+
* catalogue surface is unreachable or no best-known value has settled yet.
|
|
725
|
+
*/
|
|
726
|
+
getCatalog(options?: StylesGetCatalogInput): StylesGetCatalogResult | null;
|
|
727
|
+
/** Read the current Word-style quick gallery (ordered), or empty when unavailable. */
|
|
728
|
+
getQuickGallery(): readonly StyleCatalogItem[];
|
|
729
|
+
/** Resolve the active paragraph style for the current selection. */
|
|
730
|
+
getActiveParagraphStyle(): ActiveParagraphStyle;
|
|
731
|
+
}
|
|
732
|
+
/** A painted rectangle in viewport coordinates. */
|
|
733
|
+
export interface ViewportRect {
|
|
734
|
+
/** Zero-based page index the rect belongs to. */
|
|
735
|
+
pageIndex: number;
|
|
736
|
+
/** Left edge in pixels. */
|
|
737
|
+
left: number;
|
|
738
|
+
/** Right edge in pixels. */
|
|
739
|
+
right: number;
|
|
740
|
+
/** Top edge in pixels. */
|
|
741
|
+
top: number;
|
|
742
|
+
/** Bottom edge in pixels. */
|
|
743
|
+
bottom: number;
|
|
744
|
+
/** Width in pixels. */
|
|
745
|
+
width: number;
|
|
746
|
+
/** Height in pixels. */
|
|
747
|
+
height: number;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Address the viewport layer can resolve to painted geometry: a v2 text /
|
|
751
|
+
* selection target (resolved through the v2 host geometry surface), or an
|
|
752
|
+
* entity / content-control address (legacy entity-rect path).
|
|
753
|
+
*/
|
|
754
|
+
export type ViewportGetRectTarget = SelectionTarget | TextAddress | TextTarget | ViewportEntityAddress;
|
|
755
|
+
/** Input to `ui.viewport.getRect`. */
|
|
756
|
+
export interface ViewportGetRectInput {
|
|
757
|
+
/** Target to resolve to painted geometry. */
|
|
758
|
+
target: ViewportGetRectTarget;
|
|
759
|
+
/** Optional element to anchor returned coordinates against. */
|
|
760
|
+
relativeTo?: HTMLElement;
|
|
761
|
+
}
|
|
762
|
+
/** Result of `ui.viewport.getRect`. */
|
|
763
|
+
export interface ViewportRectResult {
|
|
764
|
+
/** Whether the target resolved to any painted geometry. */
|
|
765
|
+
found: boolean;
|
|
766
|
+
/** Compatibility alias for `found`. */
|
|
767
|
+
success?: boolean;
|
|
768
|
+
/** Resolved rectangles (one per painted line/fragment). */
|
|
769
|
+
rects: readonly ViewportRect[];
|
|
770
|
+
/** First resolved rectangle, when present. */
|
|
771
|
+
rect?: ViewportRect;
|
|
772
|
+
/**
|
|
773
|
+
* Stable fail-closed reason when `found` is false (e.g. `not-mounted`,
|
|
774
|
+
* `unresolved`, `invalid-target`, `not-ready`, `unavailable`). Omitted on
|
|
775
|
+
* success.
|
|
776
|
+
*/
|
|
777
|
+
reason?: string;
|
|
778
|
+
}
|
|
779
|
+
/** Selection handle. */
|
|
780
|
+
export interface SelectionHandle extends SnapshotSubscribable<SelectionSlice> {
|
|
781
|
+
/** Read the current selection snapshot. */
|
|
782
|
+
getSnapshot(): SelectionSlice;
|
|
783
|
+
/**
|
|
784
|
+
* Read the best-known Document API selection, when the editor exposes it.
|
|
785
|
+
* Returns `null` before the first async browser read settles.
|
|
786
|
+
*/
|
|
787
|
+
current(): SelectionInfo | null;
|
|
788
|
+
/** Freeze the current selection for later comment/format actions. */
|
|
789
|
+
capture(): SelectionCapture | null;
|
|
790
|
+
/**
|
|
791
|
+
* Restore a previously captured selection, best-effort. Never throws;
|
|
792
|
+
* failures are reported through the result instead: `not-ready` (no editor
|
|
793
|
+
* mounted), `target-unresolved` (the capture carries no usable target),
|
|
794
|
+
* `host-capability-unavailable` (the host does not expose the selection
|
|
795
|
+
* apply helper), or the host apply helper's own failure reason.
|
|
796
|
+
*/
|
|
797
|
+
restore(capture: SelectionCapture): SelectionRestoreResult;
|
|
798
|
+
/**
|
|
799
|
+
* Apply a public selection target through the host-owned selection helper.
|
|
800
|
+
* Fails closed with a stable reason when the host cannot honor the target.
|
|
801
|
+
*/
|
|
802
|
+
apply(target: SelectionTarget): WorkflowActionResult;
|
|
803
|
+
/** Resolve a painted anchor rect for the current selection, when available. */
|
|
804
|
+
getAnchorRect(input?: {
|
|
805
|
+
placement?: 'start' | 'end' | 'center';
|
|
806
|
+
}): ViewportRect | null;
|
|
807
|
+
/**
|
|
808
|
+
* Resolve every painted rectangle covering the current selection (one per
|
|
809
|
+
* line/fragment) through the host geometry surface. Returns an empty array
|
|
810
|
+
* when geometry is host-unavailable or the selection has no painted target —
|
|
811
|
+
* it never fabricates rectangles.
|
|
812
|
+
*/
|
|
813
|
+
getRects(input?: {
|
|
814
|
+
relativeTo?: HTMLElement;
|
|
815
|
+
}): readonly ViewportRect[];
|
|
816
|
+
}
|
|
817
|
+
export interface SelectionCapture extends SelectionSlice {
|
|
818
|
+
capturedAt: number;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Minimal anchor `ui.comments.createFromCapture` needs. A full
|
|
822
|
+
* {@link SelectionCapture} works, but callers can also pass the v1/main shape
|
|
823
|
+
* carrying only a captured target.
|
|
824
|
+
*/
|
|
825
|
+
export type CommentAnchorCapture = {
|
|
826
|
+
target: TextTarget | SelectionTarget | null;
|
|
827
|
+
selectionTarget?: SelectionTarget | null;
|
|
828
|
+
} | {
|
|
829
|
+
target?: TextTarget | SelectionTarget | null;
|
|
830
|
+
selectionTarget: SelectionTarget | null;
|
|
831
|
+
};
|
|
832
|
+
/** Comments handle. */
|
|
833
|
+
export interface CommentsHandle extends SnapshotSubscribable<CommentsSlice> {
|
|
834
|
+
/** Read the current comments snapshot. */
|
|
835
|
+
getSnapshot(): CommentsSlice;
|
|
836
|
+
/** List comments through the best-known controller/Document API state. */
|
|
837
|
+
list(query?: CommentsListQuery): readonly CommentInfo[];
|
|
838
|
+
/** Resolve a single comment by id from the best-known loaded state. */
|
|
839
|
+
getById(commentId: string): CommentInfo | null;
|
|
840
|
+
/** Create a comment from a frozen selection capture. */
|
|
841
|
+
createFromCapture(capture: CommentAnchorCapture, input: {
|
|
842
|
+
text: string;
|
|
843
|
+
}): WorkflowReceipt;
|
|
844
|
+
/**
|
|
845
|
+
* Create a comment anchored to the live selection. Fails closed with a
|
|
846
|
+
* failure receipt when there is no range selection or the Document API
|
|
847
|
+
* comments surface is unavailable.
|
|
848
|
+
*/
|
|
849
|
+
createFromSelection(input: {
|
|
850
|
+
text: string;
|
|
851
|
+
}): WorkflowReceipt;
|
|
852
|
+
/** Reply to a comment thread, when supported by the Document API. */
|
|
853
|
+
reply(commentId: string, input: {
|
|
854
|
+
text: string;
|
|
855
|
+
}): WorkflowReceipt;
|
|
856
|
+
/** Mark a comment resolved. */
|
|
857
|
+
resolve(commentId: string): WorkflowReceipt;
|
|
858
|
+
/** Reopen a resolved comment. */
|
|
859
|
+
reopen(commentId: string): WorkflowReceipt;
|
|
860
|
+
/**
|
|
861
|
+
* Delete a comment (and its replies) through the Document API. Fails closed
|
|
862
|
+
* with a failure receipt when deletion is unavailable / blocked.
|
|
863
|
+
*/
|
|
864
|
+
delete(commentId: string): WorkflowReceipt;
|
|
865
|
+
/**
|
|
866
|
+
* Mark a comment focused in consumer UI; reflected by `activeId`. Accepts a
|
|
867
|
+
* bare id, an `importedId` alias, or a reply's id - all resolve to the
|
|
868
|
+
* thread-root comment, which becomes `activeId`. Returns `true` when the
|
|
869
|
+
* activation request was accepted (including an idempotent re-activation
|
|
870
|
+
* of the already-active id), or `false` when no editor is mounted / not
|
|
871
|
+
* ready or the id matches no current comment under any alias. `null`
|
|
872
|
+
* clears and is always accepted.
|
|
873
|
+
*/
|
|
874
|
+
setActive(commentId: string | null): boolean;
|
|
875
|
+
/**
|
|
876
|
+
* Scroll the comment anchor into view through the host navigation surface.
|
|
877
|
+
* Resolves with both v1/main `{ success }` and v2 `{ ok, reason? }` fields
|
|
878
|
+
* so copied custom-UI code can use either shape. Never silently no-ops.
|
|
879
|
+
*/
|
|
880
|
+
scrollTo(commentId: string): Promise<WorkflowScrollResult>;
|
|
881
|
+
}
|
|
882
|
+
/** Track-changes handle. */
|
|
883
|
+
export interface TrackChangesHandle extends SnapshotSubscribable<TrackChangesSlice> {
|
|
884
|
+
/** Read the current track-changes snapshot. */
|
|
885
|
+
getSnapshot(): TrackChangesSlice;
|
|
886
|
+
/** List tracked changes through the best-known controller state. */
|
|
887
|
+
list(): readonly TrackChangesItem[];
|
|
888
|
+
/**
|
|
889
|
+
* Accept a change. The id is sufficient on its own (a tracked-change id
|
|
890
|
+
* already identifies one occurrence, anywhere in the document). A
|
|
891
|
+
* `{ id, story }` record (e.g. a {@link getAt}/{@link setActive} hit) is
|
|
892
|
+
* also accepted for convenience, so a hit can be passed straight through.
|
|
893
|
+
* Structured failure receipt or `false` if unsupported.
|
|
894
|
+
*/
|
|
895
|
+
accept(changeId: string | {
|
|
896
|
+
id: string;
|
|
897
|
+
story?: unknown;
|
|
898
|
+
}): CommandExecutionResult;
|
|
899
|
+
/**
|
|
900
|
+
* Reject a change. The id is sufficient on its own (a tracked-change id
|
|
901
|
+
* already identifies one occurrence, anywhere in the document). A
|
|
902
|
+
* `{ id, story }` record (e.g. a {@link getAt}/{@link setActive} hit) is
|
|
903
|
+
* also accepted for convenience, so a hit can be passed straight through.
|
|
904
|
+
* Structured failure receipt or `false` if unsupported.
|
|
905
|
+
*/
|
|
906
|
+
reject(changeId: string | {
|
|
907
|
+
id: string;
|
|
908
|
+
story?: unknown;
|
|
909
|
+
}): CommandExecutionResult;
|
|
910
|
+
/**
|
|
911
|
+
* Accept every active tracked change. Returns the Document API receipt, or
|
|
912
|
+
* `false` when bulk decisions are unavailable / disabled on the host.
|
|
913
|
+
*/
|
|
914
|
+
acceptAll(): CommandExecutionResult;
|
|
915
|
+
/**
|
|
916
|
+
* Reject every active tracked change. Returns the Document API receipt, or
|
|
917
|
+
* `false` when bulk decisions are unavailable / disabled on the host.
|
|
918
|
+
*/
|
|
919
|
+
rejectAll(): CommandExecutionResult;
|
|
920
|
+
/**
|
|
921
|
+
* Move focus to the next tracked change in document order (relative to the
|
|
922
|
+
* active change). Returns the id that became active, or `null` when there are
|
|
923
|
+
* no tracked changes.
|
|
924
|
+
*/
|
|
925
|
+
next(): string | null;
|
|
926
|
+
/**
|
|
927
|
+
* Move focus to the previous tracked change in document order. Returns the id
|
|
928
|
+
* that became active, or `null` when there are no tracked changes.
|
|
929
|
+
*/
|
|
930
|
+
previous(): string | null;
|
|
931
|
+
/**
|
|
932
|
+
* Atomically move `activeId` to the next tracked change (as {@link next})
|
|
933
|
+
* and await viewport navigation to it, scrolling instantly. Resolves
|
|
934
|
+
* `{ success: false }` when there are no tracked changes; if the target
|
|
935
|
+
* can't be resolved or the scroll can't be routed, the `activeId` move
|
|
936
|
+
* rolls back before resolving `{ success: false }`. If the target resolves
|
|
937
|
+
* but cannot be made visible, `activeId` stays on the requested change.
|
|
938
|
+
*/
|
|
939
|
+
navigateNext(): Promise<ScrollIntoViewOutput>;
|
|
940
|
+
/**
|
|
941
|
+
* Atomically move `activeId` to the previous tracked change (as
|
|
942
|
+
* {@link previous}) and await viewport navigation to it, scrolling
|
|
943
|
+
* instantly. Resolves `{ success: false }` when there are no tracked
|
|
944
|
+
* changes; if the target can't be resolved or the scroll can't be routed,
|
|
945
|
+
* the `activeId` move rolls back before resolving `{ success: false }`. If
|
|
946
|
+
* the target resolves but cannot be made visible, `activeId` stays on the
|
|
947
|
+
* requested change.
|
|
948
|
+
*/
|
|
949
|
+
navigatePrevious(): Promise<ScrollIntoViewOutput>;
|
|
950
|
+
/**
|
|
951
|
+
* Resolve the tracked change under viewport coordinates into the matching
|
|
952
|
+
* public track-changes item. Coordinates are `MouseEvent` clientX/clientY
|
|
953
|
+
* space. Resolves a tracked change wherever it is painted — body, footnotes,
|
|
954
|
+
* or headers/footers — returning the occurrence under the point. Returns
|
|
955
|
+
* `null` for invalid input, no editor, a point outside this controller's
|
|
956
|
+
* host, no tracked change, or a change that no longer exists.
|
|
957
|
+
*/
|
|
958
|
+
getAt(input: {
|
|
959
|
+
x: number;
|
|
960
|
+
y: number;
|
|
961
|
+
}): TrackChangePointHit | null;
|
|
962
|
+
/**
|
|
963
|
+
* Mark a tracked change focused in consumer UI; reflected by `activeId`.
|
|
964
|
+
* The id is sufficient on its own; a `{ id, story }` record (e.g. a
|
|
965
|
+
* {@link getAt} hit) is also accepted for convenience, so a hit can be
|
|
966
|
+
* passed straight through. `null` clears; `activeId` stays the simple id.
|
|
967
|
+
* Returns `true` when the activation request was accepted (including an
|
|
968
|
+
* idempotent re-activation of the already-active id), or `false` when no
|
|
969
|
+
* editor is mounted / not ready or a non-null id matches no current item.
|
|
970
|
+
*/
|
|
971
|
+
setActive(input: string | {
|
|
972
|
+
id: string;
|
|
973
|
+
story?: unknown;
|
|
974
|
+
} | null): boolean;
|
|
975
|
+
/**
|
|
976
|
+
* Scroll the tracked-change anchor into view through the host navigation
|
|
977
|
+
* surface. Resolves with both v1/main `{ success }` and v2 `{ ok, reason? }`
|
|
978
|
+
* fields.
|
|
979
|
+
*/
|
|
980
|
+
scrollTo(changeId: string): Promise<WorkflowScrollResult>;
|
|
981
|
+
}
|
|
982
|
+
/** Content-controls handle. */
|
|
983
|
+
export interface ContentControlsHandle extends SnapshotSubscribable<ContentControlsSlice> {
|
|
984
|
+
/** Read the current content-controls snapshot. */
|
|
985
|
+
getSnapshot(): ContentControlsSlice;
|
|
986
|
+
/** Read the current content-controls snapshot. */
|
|
987
|
+
get(): ContentControlsSlice;
|
|
988
|
+
/** Resolve a single content control by id from the loaded list. */
|
|
989
|
+
get(input: {
|
|
990
|
+
id: string;
|
|
991
|
+
}): ContentControlInfo | null;
|
|
992
|
+
/** List content controls through the best-known controller state. */
|
|
993
|
+
list(): readonly ContentControlInfo[];
|
|
994
|
+
/**
|
|
995
|
+
* Resolve a single content control by id from the loaded list. v1/main code
|
|
996
|
+
* should prefer `get({ id })`; `getById(id)` is kept for existing v2 callers.
|
|
997
|
+
*/
|
|
998
|
+
getById(id: string): ContentControlInfo | null;
|
|
999
|
+
/**
|
|
1000
|
+
* Resolve the control's painted geometry through its public `selectionTarget`
|
|
1001
|
+
* when the runtime exposes one. Unknown controls fail closed with
|
|
1002
|
+
* `unresolved`; loaded controls without a resolvable selection target fail
|
|
1003
|
+
* closed with geometry reason `unavailable`.
|
|
1004
|
+
*/
|
|
1005
|
+
getRect(input: {
|
|
1006
|
+
id: string;
|
|
1007
|
+
}): ViewportRectResult;
|
|
1008
|
+
/**
|
|
1009
|
+
* Scroll the control into view through its public `selectionTarget` when the
|
|
1010
|
+
* runtime exposes one. `block` defaults to `'center'`, `behavior` to
|
|
1011
|
+
* `'smooth'`. Unknown controls resolve `{ success: false }`; loaded controls
|
|
1012
|
+
* without a resolvable selection target or host scroll capability resolve
|
|
1013
|
+
* `{ success: false }` the same way.
|
|
1014
|
+
*/
|
|
1015
|
+
scrollIntoView(input: {
|
|
1016
|
+
id: string;
|
|
1017
|
+
block?: ScrollIntoViewInput['block'];
|
|
1018
|
+
behavior?: ScrollIntoViewInput['behavior'];
|
|
1019
|
+
}): Promise<ScrollIntoViewOutput>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Focus the control identified by `id`: place the caret inside it (best
|
|
1022
|
+
* effort, via the same selection-application surface as `ui.selection.apply`)
|
|
1023
|
+
* and scroll it into view - the "take me there and let me edit" counterpart
|
|
1024
|
+
* to {@link scrollIntoView} (which is scroll-only). `block` defaults to
|
|
1025
|
+
* `'center'`, `behavior` to `'smooth'`.
|
|
1026
|
+
*
|
|
1027
|
+
* Resolves to `{ success: false, reason }` only for real navigation
|
|
1028
|
+
* problems - `'invalid-id'` (empty id), `'not-ready'` (no editor mounted),
|
|
1029
|
+
* `'not-found'` (no such control in the loaded list), or `'not-reachable'`
|
|
1030
|
+
* (found, but its page couldn't be scrolled into view). Lock mode and
|
|
1031
|
+
* viewing mode never make it fail - placing the caret is selection, not
|
|
1032
|
+
* mutation.
|
|
1033
|
+
*/
|
|
1034
|
+
focus(input: {
|
|
1035
|
+
id: string;
|
|
1036
|
+
block?: ScrollIntoViewInput['block'];
|
|
1037
|
+
behavior?: ScrollIntoViewInput['behavior'];
|
|
1038
|
+
}): Promise<ContentControlFocusResult>;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Result of {@link ContentControlsHandle.focus}. Fails only for real
|
|
1042
|
+
* navigation problems, never for lock mode or viewing mode (focus is
|
|
1043
|
+
* selection, not mutation).
|
|
1044
|
+
*/
|
|
1045
|
+
export type ContentControlFocusResult = {
|
|
1046
|
+
success: true;
|
|
1047
|
+
} | {
|
|
1048
|
+
success: false;
|
|
1049
|
+
reason: 'invalid-id' | 'not-ready' | 'not-found' | 'not-reachable';
|
|
1050
|
+
};
|
|
1051
|
+
/** Font picker handle. */
|
|
1052
|
+
export interface FontsHandle extends SnapshotSubscribable<FontsSlice> {
|
|
1053
|
+
/** Available font family options. */
|
|
1054
|
+
getFamilyOptions(): readonly FontFamilyOption[];
|
|
1055
|
+
/** Available font size options. */
|
|
1056
|
+
getSizeOptions(): readonly FontSizeOption[];
|
|
1057
|
+
}
|
|
1058
|
+
/** Toolbar handle. */
|
|
1059
|
+
export interface ToolbarHandle extends SnapshotSubscribable<ToolbarSnapshotSlice> {
|
|
1060
|
+
/** Read the current toolbar snapshot. */
|
|
1061
|
+
getSnapshot(): ToolbarSnapshotSlice;
|
|
1062
|
+
/** Execute a toolbar command by id. */
|
|
1063
|
+
execute(id: string, payload?: unknown): CommandExecutionResult;
|
|
1064
|
+
/** Execute a toolbar command by id and await its settled result. */
|
|
1065
|
+
executeAsync(id: string, payload?: unknown): Promise<CommandExecutionResult>;
|
|
1066
|
+
}
|
|
1067
|
+
/** Zoom handle. */
|
|
1068
|
+
export interface ZoomHandle extends SnapshotSubscribable<ZoomSlice> {
|
|
1069
|
+
/** Set an absolute zoom percentage (100 = 100%). */
|
|
1070
|
+
set(value: number): void;
|
|
1071
|
+
/** Set a zoom mode. */
|
|
1072
|
+
setMode(mode: 'manual' | 'fit-width'): void;
|
|
1073
|
+
}
|
|
1074
|
+
/** Document handle. */
|
|
1075
|
+
export interface DocumentHandle extends SnapshotSubscribable<DocumentSlice> {
|
|
1076
|
+
/** Read the current document snapshot. */
|
|
1077
|
+
getSnapshot(): DocumentSlice;
|
|
1078
|
+
/** Set the document mode (editing / suggesting / viewing). */
|
|
1079
|
+
setMode(mode: 'editing' | 'suggesting' | 'viewing'): void;
|
|
1080
|
+
/** Export the document; returns the SuperDoc export promise when available. */
|
|
1081
|
+
export(input?: unknown): Promise<unknown> | undefined;
|
|
1082
|
+
/** Read text through the Document API; `null` when unavailable. */
|
|
1083
|
+
getText(): string | null;
|
|
1084
|
+
/** Replace the active document file, when supported by the host. */
|
|
1085
|
+
replaceFile(file: File | Blob | ArrayBuffer | Uint8Array): Promise<unknown> | undefined;
|
|
1086
|
+
}
|
|
1087
|
+
/** Viewport handle. */
|
|
1088
|
+
export interface ViewportHandle {
|
|
1089
|
+
/** Resolve painted geometry for an entity / content-control address. */
|
|
1090
|
+
getRect(input: ViewportGetRectInput): ViewportRectResult;
|
|
1091
|
+
/** Subscribe to viewport/geometry invalidation. */
|
|
1092
|
+
observe(listener: () => void): () => void;
|
|
1093
|
+
/** Painted editor host element, when available. */
|
|
1094
|
+
getHost(): HTMLElement | null;
|
|
1095
|
+
/**
|
|
1096
|
+
* Legacy positional form. Fails closed (returns `null`) because the entity
|
|
1097
|
+
* addresses it would produce are not resolvable by `getRect`; prefer the
|
|
1098
|
+
* object form below.
|
|
1099
|
+
*/
|
|
1100
|
+
entityAt(x: number, y: number): ViewportEntityAddress | null;
|
|
1101
|
+
/**
|
|
1102
|
+
* Resolve the public entities painted under a viewport point, innermost
|
|
1103
|
+
* first. Coordinates are `MouseEvent` clientX/clientY space. This object form
|
|
1104
|
+
* is the supported point-lookup: switch on the returned `ViewportEntityHit[]`
|
|
1105
|
+
* (and use `trackChanges.getAt` when you need the full tracked-change row).
|
|
1106
|
+
*/
|
|
1107
|
+
entityAt(input: {
|
|
1108
|
+
x: number;
|
|
1109
|
+
y: number;
|
|
1110
|
+
}): readonly ViewportEntityHit[];
|
|
1111
|
+
/** Resolve context at a viewport point for context menus. */
|
|
1112
|
+
contextAt(input: {
|
|
1113
|
+
x: number;
|
|
1114
|
+
y: number;
|
|
1115
|
+
}): ViewportContext;
|
|
1116
|
+
/** Scroll the viewport so a document target is visible */
|
|
1117
|
+
scrollIntoView(input: ScrollIntoViewInput): Promise<ScrollIntoViewOutput>;
|
|
1118
|
+
}
|
|
1119
|
+
export interface MetadataHandle {
|
|
1120
|
+
getRect(input: {
|
|
1121
|
+
id: string;
|
|
1122
|
+
}): ViewportRectResult & {
|
|
1123
|
+
success: boolean;
|
|
1124
|
+
rect?: ViewportRect;
|
|
1125
|
+
};
|
|
1126
|
+
/**
|
|
1127
|
+
* Scroll the viewport to the anchored span identified by metadata `id`.
|
|
1128
|
+
* `block` defaults to `'center'`, `behavior` to `'smooth'`. Resolves
|
|
1129
|
+
* `{ success: false }` for an unknown id or when the host can't route the
|
|
1130
|
+
* scroll, rather than silently no-oping.
|
|
1131
|
+
*/
|
|
1132
|
+
scrollIntoView(input: {
|
|
1133
|
+
id: string;
|
|
1134
|
+
block?: ScrollIntoViewInput['block'];
|
|
1135
|
+
behavior?: ScrollIntoViewInput['behavior'];
|
|
1136
|
+
}): Promise<ScrollIntoViewOutput>;
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* The current selection's table context, resolved from the V2 host
|
|
1140
|
+
* table-context facade. `inTable` is false (and the rest `null`) when the caret
|
|
1141
|
+
* is not inside a table, the host does not expose the facade, or the context is
|
|
1142
|
+
* incomplete. This is the shared surface the `table-*` command family routes
|
|
1143
|
+
* through; custom UIs read it to enable / label their own table controls.
|
|
1144
|
+
*/
|
|
1145
|
+
export interface TableContextInfo {
|
|
1146
|
+
/** Whether the current selection is inside a table. */
|
|
1147
|
+
inTable: boolean;
|
|
1148
|
+
/** Stable node id of the enclosing table, when resolved. */
|
|
1149
|
+
tableNodeId: string | null;
|
|
1150
|
+
/** Zero-based row index of the current cell, when resolved. */
|
|
1151
|
+
rowIndex: number | null;
|
|
1152
|
+
/** Zero-based column index of the current cell, when resolved. */
|
|
1153
|
+
columnIndex: number | null;
|
|
1154
|
+
/** Stable node id of the current cell, when resolved. */
|
|
1155
|
+
cellNodeId: string | null;
|
|
1156
|
+
/** Row count of the enclosing table, when the host projects it. */
|
|
1157
|
+
rows: number | null;
|
|
1158
|
+
/** Column count of the enclosing table, when the host projects it. */
|
|
1159
|
+
columns: number | null;
|
|
1160
|
+
}
|
|
1161
|
+
/** Table-context surface shared by the built-in toolbar and custom UIs. */
|
|
1162
|
+
export interface TablesHandle {
|
|
1163
|
+
/** Read the current table context snapshot. */
|
|
1164
|
+
getContext(): TableContextInfo;
|
|
1165
|
+
/** Convenience: whether the current selection is inside a table. */
|
|
1166
|
+
isInTable(): boolean;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Shared search/find state. This is the single surface the built-in toolbar
|
|
1170
|
+
* search control and custom UIs read and drive.
|
|
1171
|
+
*
|
|
1172
|
+
* Parity posture: full find/replace. `query`, match `total`, the `activeIndex`,
|
|
1173
|
+
* open/closed state, and `search` / `next` / `previous` / `clear` drive
|
|
1174
|
+
* navigation; `replace` / `replaceAll` mutate the document through the single
|
|
1175
|
+
* V2 host search session (`host.search`) and fail closed in viewing/read-only
|
|
1176
|
+
* mode (`document-readonly`) or when replace is unavailable
|
|
1177
|
+
* (`operation-unavailable`). When the host does not expose a search facade the
|
|
1178
|
+
* whole surface is `available: false` and every action fails closed with
|
|
1179
|
+
* `search-unavailable` rather than fabricating matches.
|
|
1180
|
+
*/
|
|
1181
|
+
export interface SearchSlice {
|
|
1182
|
+
/** Current query string. */
|
|
1183
|
+
query: string;
|
|
1184
|
+
/** Total match count for the current query. */
|
|
1185
|
+
total: number;
|
|
1186
|
+
/** Zero-based index of the active match, or -1 when none. */
|
|
1187
|
+
activeIndex: number;
|
|
1188
|
+
/** Whether a search session is open. */
|
|
1189
|
+
open: boolean;
|
|
1190
|
+
/** Whether the host exposes a usable search facade. */
|
|
1191
|
+
available: boolean;
|
|
1192
|
+
/** Whether the query is case-sensitive. */
|
|
1193
|
+
caseSensitive: boolean;
|
|
1194
|
+
/** Whether the session includes pending tracked deletions in match discovery. */
|
|
1195
|
+
includeDeletedText: boolean;
|
|
1196
|
+
/** Whether the query is a regular expression (V2 runtime only). */
|
|
1197
|
+
regex: boolean;
|
|
1198
|
+
/**
|
|
1199
|
+
* Whether replace / replaceAll can mutate right now. False in viewing /
|
|
1200
|
+
* read-only mode, when replace is host-unavailable, or when the match set is
|
|
1201
|
+
* truncated and cannot be fully enumerated.
|
|
1202
|
+
*/
|
|
1203
|
+
canReplace: boolean;
|
|
1204
|
+
/** Stable reason when the surface (or an action) is unavailable. */
|
|
1205
|
+
reason?: SuperDocUIReason;
|
|
1206
|
+
}
|
|
1207
|
+
/** Search/find surface shared by the built-in toolbar and custom UIs. */
|
|
1208
|
+
export interface SearchHandle extends SnapshotSubscribable<SearchSlice> {
|
|
1209
|
+
/** Read the current search snapshot. */
|
|
1210
|
+
getSnapshot(): SearchSlice;
|
|
1211
|
+
/** Open a search session. Fails closed when search is host-unavailable. */
|
|
1212
|
+
open(): WorkflowActionResult;
|
|
1213
|
+
/** Close the current search session and clear highlights. */
|
|
1214
|
+
close(): void;
|
|
1215
|
+
/**
|
|
1216
|
+
* Run a search for `query`. Returns the updated snapshot (with `total` and
|
|
1217
|
+
* `activeIndex`). Fails closed (`available: false`, `search-unavailable`) when
|
|
1218
|
+
* the host does not expose search.
|
|
1219
|
+
*/
|
|
1220
|
+
search(query: string, options?: {
|
|
1221
|
+
caseSensitive?: boolean;
|
|
1222
|
+
includeDeletedText?: boolean;
|
|
1223
|
+
regex?: boolean;
|
|
1224
|
+
}): SearchSlice;
|
|
1225
|
+
/** Move to the next match. Fails closed when search is unavailable / empty. */
|
|
1226
|
+
next(): WorkflowActionResult;
|
|
1227
|
+
/** Move to the previous match. Fails closed when search is unavailable / empty. */
|
|
1228
|
+
previous(): WorkflowActionResult;
|
|
1229
|
+
/** Clear the current query and matches. */
|
|
1230
|
+
clear(): void;
|
|
1231
|
+
/**
|
|
1232
|
+
* Replace the active match through the host search session, then re-query.
|
|
1233
|
+
* Fails closed with `document-readonly` in viewing mode, `search-unavailable`
|
|
1234
|
+
* when the host exposes no search facade, and `operation-unavailable` when
|
|
1235
|
+
* there is no active match / replace cannot be applied.
|
|
1236
|
+
*
|
|
1237
|
+
* Worker-backed (async Document API) sessions return a promise that resolves
|
|
1238
|
+
* with the settled outcome once the mutation lands; hold any pending UI state
|
|
1239
|
+
* until it resolves.
|
|
1240
|
+
*/
|
|
1241
|
+
replace(replacement: string): WorkflowActionResult | Promise<WorkflowActionResult>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Replace every current match exactly once through the host search session.
|
|
1244
|
+
* Fails closed with `document-readonly` in viewing mode, `search-unavailable`
|
|
1245
|
+
* when unavailable, and `operation-unavailable` when the full match set
|
|
1246
|
+
* cannot be enumerated (truncated) or replace cannot be applied.
|
|
1247
|
+
*
|
|
1248
|
+
* Worker-backed (async Document API) sessions return a promise that resolves
|
|
1249
|
+
* with the settled outcome once the mutation lands; hold any pending UI state
|
|
1250
|
+
* until it resolves.
|
|
1251
|
+
*/
|
|
1252
|
+
replaceAll(replacement: string): WorkflowActionResult | Promise<WorkflowActionResult>;
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Structural shape of the active editor the controller reads. Every member is
|
|
1256
|
+
* optional so a non-browser / pre-ready stub still satisfies it. The
|
|
1257
|
+
* controller reads `doc` (the public Document API facade) and a few public
|
|
1258
|
+
* instance methods; it never imports a concrete editor class.
|
|
1259
|
+
*/
|
|
1260
|
+
export interface SuperDocEditorLike {
|
|
1261
|
+
/** Runtime evidence of the bundled v2 editor. */
|
|
1262
|
+
editorVersion?: number;
|
|
1263
|
+
/**
|
|
1264
|
+
* Public, read-only-guarded browser Document API facade (async-capable in
|
|
1265
|
+
* browser). Partial by design: this is what a host supplies, and a stub or
|
|
1266
|
+
* custom adapter carries only the operations it implements.
|
|
1267
|
+
*
|
|
1268
|
+
* `CustomCommandContext.doc` is the same partial type, because the controller
|
|
1269
|
+
* passes this object straight through and can promise no more than the host
|
|
1270
|
+
* does. {@link BrowserDocumentApi}, the complete facade, is the type of
|
|
1271
|
+
* `activeEditor.doc` on a real `Editor`.
|
|
1272
|
+
*/
|
|
1273
|
+
doc?: PartialBrowserDocumentApi | null;
|
|
1274
|
+
/** Stable reason the Document API is unavailable. */
|
|
1275
|
+
documentApiUnavailableReason?: string | null;
|
|
1276
|
+
/** Editor-scoped event subscription. */
|
|
1277
|
+
on?(event: string, handler: (...args: unknown[]) => void): unknown;
|
|
1278
|
+
/** Editor-scoped event unsubscription. */
|
|
1279
|
+
off?(event: string, handler: (...args: unknown[]) => void): unknown;
|
|
1280
|
+
/** Export the active editor's document. */
|
|
1281
|
+
exportDocx?(...args: unknown[]): Promise<unknown>;
|
|
1282
|
+
/** Save the active editor's document. */
|
|
1283
|
+
save?(...args: unknown[]): Promise<unknown>;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Structural shape of the SuperDoc instance (or host stub) the controller
|
|
1287
|
+
* binds to. `on`/`off` are declared as methods so a host typed to the exact
|
|
1288
|
+
* event union the controller subscribes to, the closed `SuperDocEventMap`-typed
|
|
1289
|
+
* SuperDoc instance, and a broad `(event: string, ...)` stub are all
|
|
1290
|
+
* assignable.
|
|
1291
|
+
*/
|
|
1292
|
+
export interface SuperDocLike {
|
|
1293
|
+
/** The routed active editor, when one is mounted. */
|
|
1294
|
+
activeEditor?: SuperDocEditorLike | null;
|
|
1295
|
+
/**
|
|
1296
|
+
* The host-owned UI controller. A real `SuperDoc` instance always exposes
|
|
1297
|
+
* one and owns its lifecycle; bare structural stubs may not, which is why
|
|
1298
|
+
* this is optional. Consumers should read it rather than build their own.
|
|
1299
|
+
*
|
|
1300
|
+
* Borrowed, not owned: the host tears this down, so the type omits
|
|
1301
|
+
* `destroy()` and a reader cannot call it.
|
|
1302
|
+
*/
|
|
1303
|
+
ui?: BorrowedSuperDocUI;
|
|
1304
|
+
/** Lifecycle event subscription. */
|
|
1305
|
+
on?(event: string, handler: (...args: unknown[]) => void): unknown;
|
|
1306
|
+
/** Lifecycle event unsubscription. */
|
|
1307
|
+
off?(event: string, handler: (...args: unknown[]) => void): unknown;
|
|
1308
|
+
/** Set the document mode across the instance. */
|
|
1309
|
+
setDocumentMode?(mode: string): unknown;
|
|
1310
|
+
/** Export the active document. */
|
|
1311
|
+
export?(...args: unknown[]): Promise<unknown> | unknown;
|
|
1312
|
+
/** Set an absolute zoom value. */
|
|
1313
|
+
setZoom?(value: number): unknown;
|
|
1314
|
+
/** Set a zoom mode. */
|
|
1315
|
+
setZoomMode?(mode: 'manual' | 'fit-width'): unknown;
|
|
1316
|
+
/** Read the current zoom state. */
|
|
1317
|
+
getZoomState?(): unknown;
|
|
1318
|
+
/** Instance-level config bag; the controller reads it defensively. */
|
|
1319
|
+
config?: unknown;
|
|
1320
|
+
}
|
|
1321
|
+
/** Aggregate controller state; the source for every derived slice. */
|
|
1322
|
+
export interface SuperDocUIState {
|
|
1323
|
+
/** The active editor is ready. */
|
|
1324
|
+
ready: boolean;
|
|
1325
|
+
/** Current document mode. */
|
|
1326
|
+
documentMode: 'editing' | 'suggesting' | 'viewing' | null;
|
|
1327
|
+
/** Document-level slice. */
|
|
1328
|
+
document: DocumentSlice;
|
|
1329
|
+
/** Selection slice. */
|
|
1330
|
+
selection: SelectionSlice;
|
|
1331
|
+
/** Toolbar snapshot slice. */
|
|
1332
|
+
toolbar: ToolbarSnapshotSlice;
|
|
1333
|
+
/** Comments slice. */
|
|
1334
|
+
comments: CommentsSlice;
|
|
1335
|
+
/** Track-changes slice. */
|
|
1336
|
+
trackChanges: TrackChangesSlice;
|
|
1337
|
+
/** Content-controls slice. */
|
|
1338
|
+
contentControls: ContentControlsSlice;
|
|
1339
|
+
/** Zoom slice. */
|
|
1340
|
+
zoom: ZoomSlice;
|
|
1341
|
+
/** Fonts slice. */
|
|
1342
|
+
fonts: FontsSlice;
|
|
1343
|
+
/** Styles slice (read-only catalogue + active paragraph style). */
|
|
1344
|
+
styles: StylesSlice;
|
|
1345
|
+
}
|
|
1346
|
+
/** Options accepted by {@link createSuperDocUI}. */
|
|
1347
|
+
export interface SuperDocUIOptions {
|
|
1348
|
+
/** The SuperDoc instance (or structural host) to bind to. */
|
|
1349
|
+
superdoc: SuperDocLike;
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* A disposable subscription scope. Subscriptions created inside the scope are
|
|
1353
|
+
* released together when the scope is disposed.
|
|
1354
|
+
*/
|
|
1355
|
+
export interface SuperDocUIScope {
|
|
1356
|
+
/** Subscribe within the scope. */
|
|
1357
|
+
select<TSlice>(selector: SelectorFn<SuperDocUIState, TSlice>, equality?: EqualityFn<TSlice>): Subscribable<TSlice>;
|
|
1358
|
+
/** Dispose every subscription created within the scope. */
|
|
1359
|
+
dispose(): void;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* The browser-only UI controller. A small, truthful, v2-native layer over the
|
|
1363
|
+
* public active-editor / Document API facade and SuperDoc events. Supported
|
|
1364
|
+
* operations call public v2-backed surfaces; unsupported operations are
|
|
1365
|
+
* disabled or return stable failure / noop results.
|
|
1366
|
+
*/
|
|
1367
|
+
export interface SuperDocUI {
|
|
1368
|
+
/** Subscribe to a derived slice of controller state. */
|
|
1369
|
+
select<TSlice>(selector: SelectorFn<SuperDocUIState, TSlice>, equality?: EqualityFn<TSlice>): Subscribable<TSlice>;
|
|
1370
|
+
/** Read the current aggregate state. */
|
|
1371
|
+
readonly state: SuperDocUIState;
|
|
1372
|
+
/** Selection surface. */
|
|
1373
|
+
readonly selection: SelectionHandle;
|
|
1374
|
+
/** Command surface. */
|
|
1375
|
+
readonly commands: CommandsHandle;
|
|
1376
|
+
/** Toolbar surface. */
|
|
1377
|
+
readonly toolbar: ToolbarHandle;
|
|
1378
|
+
/** Comments surface. */
|
|
1379
|
+
readonly comments: CommentsHandle;
|
|
1380
|
+
/** Track-changes surface. */
|
|
1381
|
+
readonly trackChanges: TrackChangesHandle;
|
|
1382
|
+
/** Content-controls surface. */
|
|
1383
|
+
readonly contentControls: ContentControlsHandle;
|
|
1384
|
+
/** Fonts surface. */
|
|
1385
|
+
readonly fonts: FontsHandle;
|
|
1386
|
+
/** Zoom surface. */
|
|
1387
|
+
readonly zoom: ZoomHandle;
|
|
1388
|
+
/** Document surface. */
|
|
1389
|
+
readonly document: DocumentHandle;
|
|
1390
|
+
/** Viewport / geometry surface. */
|
|
1391
|
+
readonly viewport: ViewportHandle;
|
|
1392
|
+
/** Metadata geometry/navigation convenience surface. */
|
|
1393
|
+
readonly metadata: MetadataHandle;
|
|
1394
|
+
/** Table-context surface (shared `table-*` routing truth). */
|
|
1395
|
+
readonly tables: TablesHandle;
|
|
1396
|
+
/** Search / find surface (shared search truth). */
|
|
1397
|
+
readonly search: SearchHandle;
|
|
1398
|
+
/** Styles surface (read-only catalogue + active paragraph style). */
|
|
1399
|
+
readonly styles: StylesHandle;
|
|
1400
|
+
/** Format-painter surface (DOM listener coordination). */
|
|
1401
|
+
readonly formatPainter: FormatPainterHandle;
|
|
1402
|
+
/** Create a disposable subscription scope. */
|
|
1403
|
+
createScope(): SuperDocUIScope;
|
|
1404
|
+
/**
|
|
1405
|
+
* Tear down all subscriptions and detach from the host.
|
|
1406
|
+
*
|
|
1407
|
+
* Only the owner calls this. A controller obtained from `createSuperDocUI()`
|
|
1408
|
+
* is owned by its caller. The one at `superdoc.ui` is owned by the instance
|
|
1409
|
+
* and is typed {@link BorrowedSuperDocUI}, which does not carry this method.
|
|
1410
|
+
*/
|
|
1411
|
+
destroy(): void;
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* The controller as a *consumer* sees it: everything except `destroy()`.
|
|
1415
|
+
*
|
|
1416
|
+
* This is what `superdoc.ui` and the React hooks return. The instance owns that
|
|
1417
|
+
* controller and tears it down in `superdoc.destroy()`, so a consumer calling
|
|
1418
|
+
* `destroy()` would freeze command state for the built-in toolbar and every
|
|
1419
|
+
* other reader of the same instance. Omitting the method makes that a compile
|
|
1420
|
+
* error rather than a documented convention nobody reads.
|
|
1421
|
+
*
|
|
1422
|
+
* Derived from {@link SuperDocUI} rather than declared separately so the two
|
|
1423
|
+
* cannot drift: every handle added there appears here automatically.
|
|
1424
|
+
*/
|
|
1425
|
+
export type BorrowedSuperDocUI = Omit<SuperDocUI, 'destroy'>;
|