superdoc 2.7.0-next.10 → 2.7.0-next.12

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.
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.7.0-next.10",
22
+ superdocVersion: "2.7.0-next.12",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.7.0-next.10",
21
+ superdocVersion: "2.7.0-next.12",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1,5 +1,6 @@
1
1
  import { OperationId } from '../contract/types.js';
2
2
  import { InlinePropertyStorage, InlinePropertyType, InlineRunPatchKey } from '../format/inline-run-patch.js';
3
+ import { SDHtmlMarkdownSupportCheckInput, SDHtmlMarkdownSupportCheckResult } from './html-markdown-support.js';
3
4
  export declare const CAPABILITY_REASON_CODES: readonly ["COMMAND_UNAVAILABLE", "HELPER_UNAVAILABLE", "OPERATION_UNAVAILABLE", "TRACKED_MODE_UNAVAILABLE", "DRY_RUN_UNAVAILABLE", "NAMESPACE_UNAVAILABLE", "STYLES_PART_MISSING", "COLLABORATION_ACTIVE"];
4
5
  export type CapabilityReasonCode = (typeof CAPABILITY_REASON_CODES)[number];
5
6
  /**
@@ -72,6 +73,7 @@ export interface DocumentApiCapabilities {
72
73
  /** Engine-specific adapter that resolves runtime capabilities for the current editor instance. */
73
74
  export interface CapabilitiesAdapter {
74
75
  get(): DocumentApiCapabilities;
76
+ check?(input: SDHtmlMarkdownSupportCheckInput): Promise<SDHtmlMarkdownSupportCheckResult>;
75
77
  }
76
78
  /**
77
79
  * Delegates to the capabilities adapter to retrieve the current capability snapshot.
@@ -80,3 +82,4 @@ export interface CapabilitiesAdapter {
80
82
  * @returns The resolved capabilities for this editor instance.
81
83
  */
82
84
  export declare function executeCapabilities(adapter: CapabilitiesAdapter): DocumentApiCapabilities;
85
+ export declare function executeCapabilitiesCheck(adapter: CapabilitiesAdapter, input: SDHtmlMarkdownSupportCheckInput): Promise<SDHtmlMarkdownSupportCheckResult>;
@@ -0,0 +1,66 @@
1
+ import { RichContentInsertInput } from '../insert/insert.js';
2
+ import { RichContentReplaceInput } from '../replace/replace.js';
3
+ import { ChangeMode } from '../write/write.js';
4
+ import { ProjectHtmlInput, ProjectMarkdownInput, SDContentProjectionResult, SDProjectionReviewMode, SDResolvedProjectionScope } from '../types/content-projection.js';
5
+ import { SDFragment } from '../types/fragment.js';
6
+ import { SDError, SDHtmlMarkdownOutcome, SDMutationConversionReport, SDMutationReceipt } from '../types/sd-contract.js';
7
+ import { StoryLocator } from '../types/story.types.js';
8
+ export interface SDHtmlMarkdownCheckGuard {
9
+ version: 'sd-html-markdown-check/1';
10
+ operation: 'insert' | 'replace';
11
+ evaluatedRevision: string;
12
+ requestSha256: string;
13
+ analysisSha256: string;
14
+ }
15
+ export type SDHtmlMarkdownSupportCheckInput = {
16
+ operation: 'insert';
17
+ input: RichContentInsertInput;
18
+ options?: {
19
+ changeMode?: ChangeMode;
20
+ };
21
+ } | {
22
+ operation: 'replace';
23
+ input: RichContentReplaceInput;
24
+ options?: {
25
+ changeMode?: ChangeMode;
26
+ };
27
+ } | {
28
+ operation: 'projectHtml';
29
+ input?: ProjectHtmlInput;
30
+ } | {
31
+ operation: 'projectMarkdown';
32
+ input?: ProjectMarkdownInput;
33
+ };
34
+ interface SDHtmlMarkdownCheckCommon {
35
+ operation: SDHtmlMarkdownSupportCheckInput['operation'];
36
+ format: 'html' | 'markdown';
37
+ supported: boolean;
38
+ outcome: SDHtmlMarkdownOutcome;
39
+ evaluatedRevision: string;
40
+ failure?: SDError;
41
+ }
42
+ export interface SDHtmlMarkdownWriteCheckResult extends SDHtmlMarkdownCheckCommon {
43
+ operation: 'insert' | 'replace';
44
+ wouldChange: boolean;
45
+ conversion: SDMutationConversionReport;
46
+ plan?: {
47
+ fragment: SDFragment;
48
+ resolution: NonNullable<SDMutationReceipt['resolution']>;
49
+ changeMode: ChangeMode;
50
+ atomic: true;
51
+ };
52
+ guard?: SDHtmlMarkdownCheckGuard;
53
+ }
54
+ export interface SDHtmlMarkdownProjectionCheckResult extends SDHtmlMarkdownCheckCommon {
55
+ operation: 'projectHtml' | 'projectMarkdown';
56
+ plan?: {
57
+ reviewMode: SDProjectionReviewMode;
58
+ story: StoryLocator;
59
+ scope: SDResolvedProjectionScope;
60
+ includeSourceMap: boolean;
61
+ };
62
+ projection?: SDContentProjectionResult<'html' | 'markdown'>;
63
+ }
64
+ export type SDHtmlMarkdownSupportCheckResult = SDHtmlMarkdownWriteCheckResult | SDHtmlMarkdownProjectionCheckResult;
65
+ export declare function validateSDHtmlMarkdownSupportCheckInput(input: unknown): asserts input is SDHtmlMarkdownSupportCheckInput;
66
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { CommandCatalog, CommandStaticMetadata, OperationId } from './types.js';
2
2
  export declare const COMMAND_CATALOG: CommandCatalog;
3
3
  /** Operation IDs whose catalog entry has `mutates: true`. */
4
- export declare const MUTATING_OPERATION_IDS: ("replace" | "find" | "delete" | "get" | "insert" | "info" | "format.apply" | "blocks.split" | "blocks.merge" | "blocks.move" | "lists.getState" | "lists.apply" | "lists.continue" | "lists.restart" | "lists.remove" | "format.paragraph.setMarkRunProps" | "tables.moveRow" | "format.bold" | "format.strike" | "format.color" | "format.italic" | "format.rtl" | "format.cs" | "format.shading" | "format.fontFamily" | "format.lang" | "format.fontSize" | "format.fontSizeCs" | "format.highlight" | "format.underline" | "format.caps" | "format.smallCaps" | "format.outline" | "format.shadow" | "format.emboss" | "format.imprint" | "format.vanish" | "format.webHidden" | "format.specVanish" | "format.border" | "format.fitText" | "format.dstrike" | "format.vertAlign" | "format.position" | "format.bCs" | "format.iCs" | "format.snapToGrid" | "format.oMath" | "format.letterSpacing" | "format.charScale" | "format.kerning" | "format.rStyle" | "format.rFonts" | "format.eastAsianLayout" | "format.em" | "format.ligatures" | "format.numForm" | "format.numSpacing" | "format.stylisticSets" | "format.contextualAlternates" | "getNode" | "getNodeById" | "getText" | "getMarkdown" | "getHtml" | "projectMarkdown" | "projectHtml" | "markdownToFragment" | "htmlToFragment" | "extract" | "clearContent" | "formatRange" | "blocks.list" | "blocks.delete" | "blocks.deleteRange" | "styles.apply" | "styles.getCatalog" | "templates.apply" | "create.paragraph" | "create.heading" | "create.sectionBreak" | "sections.list" | "sections.get" | "sections.setBreakType" | "sections.setPageMargins" | "sections.setHeaderFooterMargins" | "sections.setPageSetup" | "sections.setColumns" | "sections.setLineNumbering" | "sections.setPageNumbering" | "sections.setTitlePage" | "sections.setOddEvenHeadersFooters" | "sections.setVerticalAlign" | "sections.setSectionDirection" | "sections.setHeaderFooterRef" | "sections.clearHeaderFooterRef" | "sections.setLinkToPrevious" | "sections.setPageBorders" | "sections.clearPageBorders" | "styles.paragraph.setStyle" | "styles.paragraph.setStyleRef" | "styles.paragraph.clearStyle" | "format.paragraph.resetDirectFormatting" | "format.paragraph.setAlignment" | "format.paragraph.clearAlignment" | "format.paragraph.setIndentation" | "format.paragraph.clearIndentation" | "format.paragraph.setSpacing" | "format.paragraph.clearSpacing" | "format.paragraph.setKeepOptions" | "format.paragraph.setOutlineLevel" | "format.paragraph.setFlowOptions" | "format.paragraph.setTabStop" | "format.paragraph.clearTabStop" | "format.paragraph.clearAllTabStops" | "format.paragraph.setBorder" | "format.paragraph.clearBorder" | "format.paragraph.setShading" | "format.paragraph.clearShading" | "format.paragraph.setDirection" | "format.paragraph.clearDirection" | "format.paragraph.setNumbering" | "lists.list" | "lists.get" | "lists.insert" | "lists.create" | "lists.attach" | "lists.detach" | "lists.delete" | "lists.indent" | "lists.outdent" | "lists.join" | "lists.canJoin" | "lists.separate" | "lists.merge" | "lists.split" | "lists.setLevel" | "lists.setValue" | "lists.continuePrevious" | "lists.canContinuePrevious" | "lists.setLevelRestart" | "lists.convertToText" | "lists.applyTemplate" | "lists.applyPreset" | "lists.setType" | "lists.captureTemplate" | "lists.setLevelNumbering" | "lists.setLevelBullet" | "lists.setLevelPictureBullet" | "lists.setLevelAlignment" | "lists.setLevelIndents" | "lists.setLevelTrailingCharacter" | "lists.setLevelMarkerFont" | "lists.clearLevelOverrides" | "lists.getStyle" | "lists.applyStyle" | "lists.restartAt" | "lists.setLevelNumberStyle" | "lists.setLevelText" | "lists.setLevelStart" | "lists.setLevelLayout" | "comments.create" | "comments.patch" | "comments.delete" | "comments.get" | "comments.list" | "trackChanges.list" | "trackChanges.get" | "trackChanges.decide" | "query.match" | "ranges.resolve" | "selection.current" | "mutations.preview" | "mutations.apply" | "plan.execute" | "capabilities.get" | "create.table" | "tables.convertFromText" | "tables.delete" | "tables.clearContents" | "tables.move" | "tables.split" | "tables.convertToText" | "tables.setLayout" | "tables.insertRow" | "tables.deleteRow" | "tables.setRowHeight" | "tables.distributeRows" | "tables.setRowOptions" | "tables.insertColumn" | "tables.deleteColumn" | "tables.setColumnWidth" | "tables.distributeColumns" | "tables.insertCell" | "tables.deleteCell" | "tables.mergeCells" | "tables.unmergeCells" | "tables.splitCell" | "tables.setCellProperties" | "tables.setCellText" | "tables.sort" | "tables.setAltText" | "tables.setStyle" | "tables.clearStyle" | "tables.setStyleOption" | "tables.setBorder" | "tables.clearBorder" | "tables.applyBorderPreset" | "tables.setShading" | "tables.clearShading" | "tables.setTablePadding" | "tables.setCellPadding" | "tables.setCellSpacing" | "tables.clearCellSpacing" | "tables.applyStyle" | "tables.setBorders" | "tables.setTableOptions" | "tables.applyPreset" | "tables.get" | "tables.getCells" | "tables.getProperties" | "tables.getStyles" | "tables.setDefaultStyle" | "tables.clearDefaultStyle" | "create.tableOfContents" | "toc.list" | "toc.get" | "toc.configure" | "toc.update" | "toc.remove" | "toc.markEntry" | "toc.unmarkEntry" | "toc.listEntries" | "toc.getEntry" | "toc.editEntry" | "history.get" | "history.undo" | "history.redo" | "create.image" | "images.list" | "images.get" | "images.delete" | "images.move" | "images.convertToInline" | "images.convertToFloating" | "images.setSize" | "images.setWrapType" | "images.setWrapSide" | "images.setWrapDistances" | "images.setPosition" | "images.setAnchorOptions" | "images.setZOrder" | "images.scale" | "images.setLockAspectRatio" | "images.rotate" | "images.flip" | "images.crop" | "images.resetCrop" | "images.replaceSource" | "images.setAltText" | "images.setDecorative" | "images.setName" | "images.setHyperlink" | "images.insertCaption" | "images.updateCaption" | "images.removeCaption" | "hyperlinks.list" | "hyperlinks.get" | "hyperlinks.wrap" | "hyperlinks.insert" | "hyperlinks.patch" | "hyperlinks.remove" | "headerFooters.list" | "headerFooters.get" | "headerFooters.resolve" | "headerFooters.refs.set" | "headerFooters.refs.clear" | "headerFooters.refs.setLinkedToPrevious" | "headerFooters.parts.list" | "headerFooters.parts.create" | "headerFooters.parts.delete" | "create.contentControl" | "contentControls.list" | "contentControls.get" | "contentControls.listInRange" | "contentControls.selectByTag" | "contentControls.selectByTitle" | "contentControls.listChildren" | "contentControls.getParent" | "contentControls.wrap" | "contentControls.unwrap" | "contentControls.delete" | "contentControls.copy" | "contentControls.move" | "contentControls.patch" | "contentControls.setLockMode" | "contentControls.setType" | "contentControls.getContent" | "contentControls.replaceContent" | "contentControls.clearContent" | "contentControls.appendContent" | "contentControls.prependContent" | "contentControls.insertBefore" | "contentControls.insertAfter" | "contentControls.getBinding" | "contentControls.setBinding" | "contentControls.clearBinding" | "contentControls.getRawProperties" | "contentControls.patchRawProperties" | "contentControls.validateWordCompatibility" | "contentControls.normalizeWordCompatibility" | "contentControls.normalizeTagPayload" | "contentControls.text.setMultiline" | "contentControls.text.setValue" | "contentControls.text.clearValue" | "contentControls.date.setValue" | "contentControls.date.clearValue" | "contentControls.date.setDisplayFormat" | "contentControls.date.setDisplayLocale" | "contentControls.date.setStorageFormat" | "contentControls.date.setCalendar" | "contentControls.checkbox.getState" | "contentControls.checkbox.setState" | "contentControls.checkbox.toggle" | "contentControls.checkbox.setSymbolPair" | "contentControls.choiceList.getItems" | "contentControls.choiceList.setItems" | "contentControls.choiceList.setSelected" | "contentControls.repeatingSection.listItems" | "contentControls.repeatingSection.insertItemBefore" | "contentControls.repeatingSection.insertItemAfter" | "contentControls.repeatingSection.cloneItem" | "contentControls.repeatingSection.deleteItem" | "contentControls.repeatingSection.setAllowInsertDelete" | "contentControls.group.wrap" | "contentControls.group.ungroup" | "bookmarks.list" | "bookmarks.get" | "bookmarks.insert" | "bookmarks.rename" | "bookmarks.remove" | "footnotes.list" | "footnotes.get" | "footnotes.insert" | "footnotes.update" | "footnotes.remove" | "footnotes.configure" | "clipboard.parse" | "clipboard.insert" | "clipboard.serializeSelection" | "crossRefs.list" | "crossRefs.get" | "crossRefs.insert" | "crossRefs.rebuild" | "crossRefs.remove" | "index.list" | "index.get" | "index.insert" | "index.configure" | "index.rebuild" | "index.remove" | "index.entries.list" | "index.entries.get" | "index.entries.insert" | "index.entries.update" | "index.entries.remove" | "captions.list" | "captions.get" | "captions.insert" | "captions.update" | "captions.remove" | "captions.configure" | "fields.list" | "fields.get" | "fields.insert" | "fields.rebuild" | "fields.remove" | "citations.list" | "citations.get" | "citations.insert" | "citations.update" | "citations.remove" | "citations.sources.list" | "citations.sources.get" | "citations.sources.insert" | "citations.sources.update" | "citations.sources.remove" | "citations.bibliography.get" | "citations.bibliography.insert" | "citations.bibliography.rebuild" | "citations.bibliography.configure" | "citations.bibliography.remove" | "authorities.list" | "authorities.get" | "authorities.insert" | "authorities.configure" | "authorities.rebuild" | "authorities.remove" | "authorities.entries.list" | "authorities.entries.get" | "authorities.entries.insert" | "authorities.entries.update" | "authorities.entries.remove" | "diff.capture" | "diff.compare" | "diff.apply" | "export.toDocx" | "protection.get" | "protection.setEditingRestriction" | "protection.clearEditingRestriction" | "permissionRanges.list" | "permissionRanges.get" | "permissionRanges.create" | "permissionRanges.remove" | "permissionRanges.updatePrincipal" | "customXml.parts.list" | "customXml.parts.get" | "customXml.parts.create" | "customXml.parts.patch" | "customXml.parts.remove" | "metadata.attach" | "metadata.list" | "metadata.get" | "metadata.update" | "metadata.remove" | "metadata.resolve")[];
4
+ export declare const MUTATING_OPERATION_IDS: ("replace" | "find" | "delete" | "get" | "insert" | "info" | "projectHtml" | "projectMarkdown" | "capabilities.check" | "format.apply" | "blocks.split" | "blocks.merge" | "blocks.move" | "lists.getState" | "lists.apply" | "lists.continue" | "lists.restart" | "lists.remove" | "format.paragraph.setMarkRunProps" | "tables.moveRow" | "format.bold" | "format.strike" | "format.color" | "format.italic" | "format.rtl" | "format.cs" | "format.shading" | "format.fontFamily" | "format.lang" | "format.fontSize" | "format.fontSizeCs" | "format.highlight" | "format.underline" | "format.caps" | "format.smallCaps" | "format.outline" | "format.shadow" | "format.emboss" | "format.imprint" | "format.vanish" | "format.webHidden" | "format.specVanish" | "format.border" | "format.fitText" | "format.dstrike" | "format.vertAlign" | "format.position" | "format.bCs" | "format.iCs" | "format.snapToGrid" | "format.oMath" | "format.letterSpacing" | "format.charScale" | "format.kerning" | "format.rStyle" | "format.rFonts" | "format.eastAsianLayout" | "format.em" | "format.ligatures" | "format.numForm" | "format.numSpacing" | "format.stylisticSets" | "format.contextualAlternates" | "getNode" | "getNodeById" | "getText" | "getMarkdown" | "getHtml" | "markdownToFragment" | "htmlToFragment" | "extract" | "clearContent" | "formatRange" | "blocks.list" | "blocks.delete" | "blocks.deleteRange" | "styles.apply" | "styles.getCatalog" | "templates.apply" | "create.paragraph" | "create.heading" | "create.sectionBreak" | "sections.list" | "sections.get" | "sections.setBreakType" | "sections.setPageMargins" | "sections.setHeaderFooterMargins" | "sections.setPageSetup" | "sections.setColumns" | "sections.setLineNumbering" | "sections.setPageNumbering" | "sections.setTitlePage" | "sections.setOddEvenHeadersFooters" | "sections.setVerticalAlign" | "sections.setSectionDirection" | "sections.setHeaderFooterRef" | "sections.clearHeaderFooterRef" | "sections.setLinkToPrevious" | "sections.setPageBorders" | "sections.clearPageBorders" | "styles.paragraph.setStyle" | "styles.paragraph.setStyleRef" | "styles.paragraph.clearStyle" | "format.paragraph.resetDirectFormatting" | "format.paragraph.setAlignment" | "format.paragraph.clearAlignment" | "format.paragraph.setIndentation" | "format.paragraph.clearIndentation" | "format.paragraph.setSpacing" | "format.paragraph.clearSpacing" | "format.paragraph.setKeepOptions" | "format.paragraph.setOutlineLevel" | "format.paragraph.setFlowOptions" | "format.paragraph.setTabStop" | "format.paragraph.clearTabStop" | "format.paragraph.clearAllTabStops" | "format.paragraph.setBorder" | "format.paragraph.clearBorder" | "format.paragraph.setShading" | "format.paragraph.clearShading" | "format.paragraph.setDirection" | "format.paragraph.clearDirection" | "format.paragraph.setNumbering" | "lists.list" | "lists.get" | "lists.insert" | "lists.create" | "lists.attach" | "lists.detach" | "lists.delete" | "lists.indent" | "lists.outdent" | "lists.join" | "lists.canJoin" | "lists.separate" | "lists.merge" | "lists.split" | "lists.setLevel" | "lists.setValue" | "lists.continuePrevious" | "lists.canContinuePrevious" | "lists.setLevelRestart" | "lists.convertToText" | "lists.applyTemplate" | "lists.applyPreset" | "lists.setType" | "lists.captureTemplate" | "lists.setLevelNumbering" | "lists.setLevelBullet" | "lists.setLevelPictureBullet" | "lists.setLevelAlignment" | "lists.setLevelIndents" | "lists.setLevelTrailingCharacter" | "lists.setLevelMarkerFont" | "lists.clearLevelOverrides" | "lists.getStyle" | "lists.applyStyle" | "lists.restartAt" | "lists.setLevelNumberStyle" | "lists.setLevelText" | "lists.setLevelStart" | "lists.setLevelLayout" | "comments.create" | "comments.patch" | "comments.delete" | "comments.get" | "comments.list" | "trackChanges.list" | "trackChanges.get" | "trackChanges.decide" | "query.match" | "ranges.resolve" | "selection.current" | "mutations.preview" | "mutations.apply" | "plan.execute" | "capabilities.get" | "create.table" | "tables.convertFromText" | "tables.delete" | "tables.clearContents" | "tables.move" | "tables.split" | "tables.convertToText" | "tables.setLayout" | "tables.insertRow" | "tables.deleteRow" | "tables.setRowHeight" | "tables.distributeRows" | "tables.setRowOptions" | "tables.insertColumn" | "tables.deleteColumn" | "tables.setColumnWidth" | "tables.distributeColumns" | "tables.insertCell" | "tables.deleteCell" | "tables.mergeCells" | "tables.unmergeCells" | "tables.splitCell" | "tables.setCellProperties" | "tables.setCellText" | "tables.sort" | "tables.setAltText" | "tables.setStyle" | "tables.clearStyle" | "tables.setStyleOption" | "tables.setBorder" | "tables.clearBorder" | "tables.applyBorderPreset" | "tables.setShading" | "tables.clearShading" | "tables.setTablePadding" | "tables.setCellPadding" | "tables.setCellSpacing" | "tables.clearCellSpacing" | "tables.applyStyle" | "tables.setBorders" | "tables.setTableOptions" | "tables.applyPreset" | "tables.get" | "tables.getCells" | "tables.getProperties" | "tables.getStyles" | "tables.setDefaultStyle" | "tables.clearDefaultStyle" | "create.tableOfContents" | "toc.list" | "toc.get" | "toc.configure" | "toc.update" | "toc.remove" | "toc.markEntry" | "toc.unmarkEntry" | "toc.listEntries" | "toc.getEntry" | "toc.editEntry" | "history.get" | "history.undo" | "history.redo" | "create.image" | "images.list" | "images.get" | "images.delete" | "images.move" | "images.convertToInline" | "images.convertToFloating" | "images.setSize" | "images.setWrapType" | "images.setWrapSide" | "images.setWrapDistances" | "images.setPosition" | "images.setAnchorOptions" | "images.setZOrder" | "images.scale" | "images.setLockAspectRatio" | "images.rotate" | "images.flip" | "images.crop" | "images.resetCrop" | "images.replaceSource" | "images.setAltText" | "images.setDecorative" | "images.setName" | "images.setHyperlink" | "images.insertCaption" | "images.updateCaption" | "images.removeCaption" | "hyperlinks.list" | "hyperlinks.get" | "hyperlinks.wrap" | "hyperlinks.insert" | "hyperlinks.patch" | "hyperlinks.remove" | "headerFooters.list" | "headerFooters.get" | "headerFooters.resolve" | "headerFooters.refs.set" | "headerFooters.refs.clear" | "headerFooters.refs.setLinkedToPrevious" | "headerFooters.parts.list" | "headerFooters.parts.create" | "headerFooters.parts.delete" | "create.contentControl" | "contentControls.list" | "contentControls.get" | "contentControls.listInRange" | "contentControls.selectByTag" | "contentControls.selectByTitle" | "contentControls.listChildren" | "contentControls.getParent" | "contentControls.wrap" | "contentControls.unwrap" | "contentControls.delete" | "contentControls.copy" | "contentControls.move" | "contentControls.patch" | "contentControls.setLockMode" | "contentControls.setType" | "contentControls.getContent" | "contentControls.replaceContent" | "contentControls.clearContent" | "contentControls.appendContent" | "contentControls.prependContent" | "contentControls.insertBefore" | "contentControls.insertAfter" | "contentControls.getBinding" | "contentControls.setBinding" | "contentControls.clearBinding" | "contentControls.getRawProperties" | "contentControls.patchRawProperties" | "contentControls.validateWordCompatibility" | "contentControls.normalizeWordCompatibility" | "contentControls.normalizeTagPayload" | "contentControls.text.setMultiline" | "contentControls.text.setValue" | "contentControls.text.clearValue" | "contentControls.date.setValue" | "contentControls.date.clearValue" | "contentControls.date.setDisplayFormat" | "contentControls.date.setDisplayLocale" | "contentControls.date.setStorageFormat" | "contentControls.date.setCalendar" | "contentControls.checkbox.getState" | "contentControls.checkbox.setState" | "contentControls.checkbox.toggle" | "contentControls.checkbox.setSymbolPair" | "contentControls.choiceList.getItems" | "contentControls.choiceList.setItems" | "contentControls.choiceList.setSelected" | "contentControls.repeatingSection.listItems" | "contentControls.repeatingSection.insertItemBefore" | "contentControls.repeatingSection.insertItemAfter" | "contentControls.repeatingSection.cloneItem" | "contentControls.repeatingSection.deleteItem" | "contentControls.repeatingSection.setAllowInsertDelete" | "contentControls.group.wrap" | "contentControls.group.ungroup" | "bookmarks.list" | "bookmarks.get" | "bookmarks.insert" | "bookmarks.rename" | "bookmarks.remove" | "footnotes.list" | "footnotes.get" | "footnotes.insert" | "footnotes.update" | "footnotes.remove" | "footnotes.configure" | "clipboard.parse" | "clipboard.insert" | "clipboard.serializeSelection" | "crossRefs.list" | "crossRefs.get" | "crossRefs.insert" | "crossRefs.rebuild" | "crossRefs.remove" | "index.list" | "index.get" | "index.insert" | "index.configure" | "index.rebuild" | "index.remove" | "index.entries.list" | "index.entries.get" | "index.entries.insert" | "index.entries.update" | "index.entries.remove" | "captions.list" | "captions.get" | "captions.insert" | "captions.update" | "captions.remove" | "captions.configure" | "fields.list" | "fields.get" | "fields.insert" | "fields.rebuild" | "fields.remove" | "citations.list" | "citations.get" | "citations.insert" | "citations.update" | "citations.remove" | "citations.sources.list" | "citations.sources.get" | "citations.sources.insert" | "citations.sources.update" | "citations.sources.remove" | "citations.bibliography.get" | "citations.bibliography.insert" | "citations.bibliography.rebuild" | "citations.bibliography.configure" | "citations.bibliography.remove" | "authorities.list" | "authorities.get" | "authorities.insert" | "authorities.configure" | "authorities.rebuild" | "authorities.remove" | "authorities.entries.list" | "authorities.entries.get" | "authorities.entries.insert" | "authorities.entries.update" | "authorities.entries.remove" | "diff.capture" | "diff.compare" | "diff.apply" | "export.toDocx" | "protection.get" | "protection.setEditingRestriction" | "protection.clearEditingRestriction" | "permissionRanges.list" | "permissionRanges.get" | "permissionRanges.create" | "permissionRanges.remove" | "permissionRanges.updatePrincipal" | "customXml.parts.list" | "customXml.parts.get" | "customXml.parts.create" | "customXml.parts.patch" | "customXml.parts.remove" | "metadata.attach" | "metadata.list" | "metadata.get" | "metadata.update" | "metadata.remove" | "metadata.resolve")[];
5
5
  /** Maps each operation to its human-readable description. */
6
6
  export declare const OPERATION_DESCRIPTION_MAP: Record<OperationId, string>;
7
7
  /** Maps each operation to whether it requires an open document to execute. */
@@ -1055,6 +1055,17 @@ export declare const OPERATION_DEFINITIONS: {
1055
1055
  readonly referenceDocPath: "capabilities/get.mdx";
1056
1056
  readonly referenceGroup: "capabilities";
1057
1057
  };
1058
+ readonly 'capabilities.check': {
1059
+ readonly memberPath: "capabilities.check";
1060
+ readonly description: "Check an exact HTML or Markdown insert, replace, or detailed projection against the current document without mutating it.";
1061
+ readonly expectedResult: "Returns a Promise resolving to structured support, fidelity outcome, diagnostics, and a revision-bound guard for supported writes.";
1062
+ readonly requiresDocumentContext: true;
1063
+ readonly metadata: CommandStaticMetadata;
1064
+ readonly referenceDocPath: "capabilities/check.mdx";
1065
+ readonly referenceGroup: "capabilities";
1066
+ readonly intentGroup: "edit";
1067
+ readonly intentAction: "check_support";
1068
+ };
1058
1069
  readonly 'create.table': {
1059
1070
  readonly memberPath: "create.table";
1060
1071
  readonly description: "Create a new table at the target position.";
@@ -21,7 +21,7 @@ import { ClearContentInput } from '../clear-content/clear-content.js';
21
21
  import { InsertInput } from '../insert/insert.js';
22
22
  import { ReplaceInput } from '../replace/replace.js';
23
23
  import { DeleteInput } from '../delete/delete.js';
24
- import { MutationOptions, RevisionGuardOptions } from '../write/write.js';
24
+ import { MutationOptions, RevisionGuardOptions, RichContentMutationOptions } from '../write/write.js';
25
25
  import { FormatInlineAliasInput, FormatRangeInput, StyleApplyInput } from '../format/format.js';
26
26
  import { InlineRunPatchKey } from '../format/inline-run-patch.js';
27
27
  import { StylesApplyInput, StylesApplyOptions, StylesApplyReceipt, StylesGetCatalogInput, StylesGetCatalogResult } from '../styles/index.js';
@@ -31,6 +31,7 @@ import { CommentInfo, CommentsListQuery, CommentsListResult } from '../comments/
31
31
  import { TrackChangesListInput, TrackChangesGetInput, ReviewDecideInput } from '../track-changes/track-changes.js';
32
32
  import { TrackChangeInfo, TrackChangesListResult } from '../types/track-changes.types.js';
33
33
  import { DocumentApiCapabilities } from '../capabilities/capabilities.js';
34
+ import { SDHtmlMarkdownSupportCheckInput, SDHtmlMarkdownSupportCheckResult } from '../capabilities/html-markdown-support.js';
34
35
  import { HistoryState, HistoryActionResult } from '../history/history.types.js';
35
36
  import { DiffSnapshot, DiffPayload, DiffApplyResult, DiffCompareInput, DiffApplyInput, DiffApplyOptions } from '../diff/diff.types.js';
36
37
  import { ExportToDocxInput, ExportToDocxResult } from '../export/export.types.js';
@@ -141,12 +142,12 @@ export interface OperationRegistry extends FormatInlineAliasOperationRegistry {
141
142
  };
142
143
  insert: {
143
144
  input: InsertInput;
144
- options: MutationOptions;
145
+ options: RichContentMutationOptions;
145
146
  output: SDMutationReceipt;
146
147
  };
147
148
  replace: {
148
149
  input: ReplaceInput;
149
- options: MutationOptions;
150
+ options: RichContentMutationOptions;
150
151
  output: SDMutationReceipt;
151
152
  };
152
153
  delete: {
@@ -729,6 +730,11 @@ export interface OperationRegistry extends FormatInlineAliasOperationRegistry {
729
730
  options: never;
730
731
  output: DocumentApiCapabilities;
731
732
  };
733
+ 'capabilities.check': {
734
+ input: SDHtmlMarkdownSupportCheckInput;
735
+ options: never;
736
+ output: Promise<SDHtmlMarkdownSupportCheckResult>;
737
+ };
732
738
  'history.get': {
733
739
  input: undefined;
734
740
  options: never;
@@ -30,9 +30,10 @@ import { CreateAdapter, CreateApi } from './create/create.js';
30
30
  import { BlocksAdapter, BlocksApi } from './blocks/blocks.js';
31
31
  import { TableLocator, TableMutationResult, TablesConvertFromTextInput, TablesMoveInput, TablesSplitInput, TablesConvertToTextInput, TablesSetLayoutInput, TablesInsertRowInput, TablesDeleteRowInput, TablesMoveRowInput, TablesSetRowHeightInput, TablesDistributeRowsInput, TablesSetRowOptionsInput, TablesInsertColumnInput, TablesDeleteColumnInput, TablesSetColumnWidthInput, TablesDistributeColumnsInput, TablesInsertCellInput, TablesDeleteCellInput, TablesMergeCellsInput, TablesUnmergeCellsInput, TablesSplitCellInput, TablesSetCellPropertiesInput, TablesSetCellTextInput, TablesSortInput, TablesSetAltTextInput, TablesSetStyleInput, TablesClearStyleInput, TablesSetStyleOptionInput, TablesSetBorderInput, TablesClearBorderInput, TablesApplyBorderPresetInput, TablesSetShadingInput, TablesClearShadingInput, TablesSetTablePaddingInput, TablesSetCellPaddingInput, TablesSetCellSpacingInput, TablesClearCellSpacingInput, TablesApplyStyleInput, TablesSetBordersInput, TablesSetTableOptionsInput, TablesApplyPresetInput, TablesGetInput, TablesGetOutput, TablesGetCellsInput, TablesGetCellsOutput, TablesGetPropertiesInput, TablesGetPropertiesOutput, TablesGetStylesInput, TablesGetStylesOutput, TablesSetDefaultStyleInput, TablesClearDefaultStyleInput } from './types/table-operations.types.js';
32
32
  import { TrackChangesAdapter, TrackChangesApi } from './track-changes/track-changes.js';
33
- import { MutationOptions, RevisionGuardOptions, WriteAdapter } from './write/write.js';
33
+ import { MutationOptions, RevisionGuardOptions, RichContentMutationOptions, WriteAdapter } from './write/write.js';
34
34
  import { SelectionMutationAdapter } from './selection-mutation.js';
35
35
  import { CapabilitiesAdapter, DocumentApiCapabilities } from './capabilities/capabilities.js';
36
+ import { SDHtmlMarkdownSupportCheckInput, SDHtmlMarkdownSupportCheckResult } from './capabilities/html-markdown-support.js';
36
37
  import { OperationId } from './contract/types.js';
37
38
  import { DynamicInvokeRequest, InvokeRequest, InvokeResult } from './contract/operation-registry.js';
38
39
  import { PlanApi } from './plan/plan.js';
@@ -63,6 +64,7 @@ import { AuthoritiesApi, AuthoritiesAdapter } from './authorities/authorities.js
63
64
  export * from './types/index.js';
64
65
  export * from './contract/index.js';
65
66
  export * from './capabilities/capabilities.js';
67
+ export * from './capabilities/html-markdown-support.js';
66
68
  export * from './inline-semantics/index.js';
67
69
  export type { HistoryAdapter, HistoryApi } from './history/history.js';
68
70
  export { executeHistoryGet, executeHistoryUndo, executeHistoryRedo } from './history/history.js';
@@ -97,7 +99,7 @@ export type { GetMarkdownAdapter, GetMarkdownInput } from './get-markdown/get-ma
97
99
  export type { GetHtmlAdapter, GetHtmlInput } from './get-html/get-html.js';
98
100
  export type { InfoAdapter, InfoInput } from './info/info.js';
99
101
  export type { ExtractAdapter, ExtractInput } from './extract/extract.js';
100
- export type { WriteAdapter, WriteRequest } from './write/write.js';
102
+ export type { WriteAdapter, WriteRequest, RichContentMutationOptions } from './write/write.js';
101
103
  export type { FormatInlineAliasApi, FormatInlineAliasInput, FormatBoldInput, FormatItalicInput, FormatRangeInput, FormatUnderlineInput, FormatStrikethroughInput, StyleApplyInput, StyleApplyOptions, } from './format/format.js';
102
104
  export type { InlineRunPatch, InlineRunPatchKey, InlinePropertyStorage, InlinePropertyType, InlinePropertyCarrier, InlinePropertyRegistryEntry, UnderlinePatch, ShadingPatch, BorderPatch, FitTextPatch, LangPatch, RFontsPatch, EastAsianLayoutPatch, StylisticSetPatch, } from './format/inline-run-patch.js';
103
105
  export { INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, INLINE_PROPERTY_KEYS_BY_STORAGE, validateInlineRunPatch, buildInlineRunPatchSchema, } from './format/inline-run-patch.js';
@@ -232,6 +234,7 @@ export type TablesAdapter = Omit<TablesApi, 'moveRow'> & {
232
234
  export interface CapabilitiesApi {
233
235
  (): DocumentApiCapabilities;
234
236
  get(): DocumentApiCapabilities;
237
+ check(input: SDHtmlMarkdownSupportCheckInput): Promise<SDHtmlMarkdownSupportCheckResult>;
235
238
  }
236
239
  export interface QueryApi {
237
240
  /** Accepts canonical nested input or a selector shorthand normalized to `{ select: ... }` internally. */
@@ -325,11 +328,11 @@ export interface DocumentApi {
325
328
  * Insert content at a target location.
326
329
  * If target is omitted, inserts at the end of the document.
327
330
  */
328
- insert(input: InsertInput, options?: MutationOptions): SDMutationReceipt;
331
+ insert(input: InsertInput, options?: RichContentMutationOptions): SDMutationReceipt;
329
332
  /**
330
333
  * Replace text at a target range.
331
334
  */
332
- replace(input: ReplaceInput, options?: MutationOptions): SDMutationReceipt;
335
+ replace(input: ReplaceInput, options?: RichContentMutationOptions): SDMutationReceipt;
333
336
  /**
334
337
  * Delete text at a target range.
335
338
  */
@@ -1,4 +1,4 @@
1
- import { MutationOptions, WriteAdapter } from '../write/write.js';
1
+ import { RichContentMutationOptions, WriteAdapter } from '../write/write.js';
2
2
  import { SelectionTarget, TargetLocator, SDMutationReceipt } from '../types/index.js';
3
3
  import { SDInsertInput } from '../types/structural-input.js';
4
4
  import { StoryLocator } from '../types/story.types.js';
@@ -45,8 +45,18 @@ export type LegacyInsertInput = TextInsertInput;
45
45
  * These are mutually exclusive: providing both is an error.
46
46
  */
47
47
  export type InsertInput = TextInsertInput | RichContentInsertInput | SDInsertInput;
48
+ export declare function isRichContentInsertInput(input: InsertInput): input is RichContentInsertInput;
48
49
  /** Returns true when the input uses the structural SDFragment shape. */
49
50
  export declare function isStructuralInsertInput(input: InsertInput): input is SDInsertInput;
51
+ /**
52
+ * Validates InsertInput as either text or structural shape.
53
+ *
54
+ * Validation order:
55
+ * 0. Input shape guard (must be non-null plain object)
56
+ * 1. Union conflict detection (mutually exclusive discriminants)
57
+ * 2. Shape-specific field and type validation
58
+ */
59
+ export declare function validateInsertInput(input: unknown): asserts input is InsertInput;
50
60
  /**
51
61
  * Executes an insert operation, routing to the appropriate adapter path.
52
62
  *
@@ -60,5 +70,5 @@ export declare function isStructuralInsertInput(input: InsertInput): input is SD
60
70
  * @param options - Optional mutation options (changeMode, dryRun, expectedRevision).
61
71
  * @returns Receipt indicating success/failure and mutation metadata.
62
72
  */
63
- export declare function executeInsert(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: InsertInput, options?: MutationOptions): SDMutationReceipt;
73
+ export declare function executeInsert(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: InsertInput, options?: RichContentMutationOptions): SDMutationReceipt;
64
74
  export {};
@@ -1,4 +1,4 @@
1
- import { MutationOptions } from '../types/mutation-plan.types.js';
1
+ import { RichContentMutationOptions, WriteAdapter } from '../write/write.js';
2
2
  import { SelectionTarget, TargetLocator } from '../types/address.js';
3
3
  import { SDMutationReceipt } from '../types/sd-contract.js';
4
4
  import { SDReplaceInput } from '../types/structural-input.js';
@@ -6,7 +6,6 @@ import { BodyStoryLocator, StoryLocator } from '../types/story.types.js';
6
6
  import { BlockNodeAddress } from '../types/base.js';
7
7
  import { NestingPolicy } from '../types/placement.js';
8
8
  import { SelectionMutationAdapter } from '../selection-mutation.js';
9
- import { WriteAdapter } from '../write/write.js';
10
9
  /** Text replacement input: uses SelectionTarget / ref, or the complete main body. */
11
10
  export type TextReplaceInput = (TargetLocator & {
12
11
  target?: SelectionTarget;
@@ -45,4 +44,5 @@ export type ReplaceInput = TextReplaceInput | RichContentReplaceInput | SDReplac
45
44
  /** Returns true when the input uses the structural SDFragment shape. */
46
45
  export declare function isStructuralReplaceInput(input: ReplaceInput): input is SDReplaceInput;
47
46
  export declare function isRichContentReplaceInput(input: ReplaceInput): input is RichContentReplaceInput;
48
- export declare function executeReplace(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: ReplaceInput, options?: MutationOptions): SDMutationReceipt;
47
+ export declare function validateReplaceInput(input: unknown): asserts input is ReplaceInput;
48
+ export declare function executeReplace(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: ReplaceInput, options?: RichContentMutationOptions): SDMutationReceipt;
@@ -1,7 +1,7 @@
1
1
  import { BlockNodeAddress, BlockNodeType } from './base.js';
2
2
  import { Range, SelectionTarget, TextTarget } from './address.js';
3
3
  import { StoryLocator } from './story.types.js';
4
- import { SDDiagnostic } from './sd-contract.js';
4
+ import { SDDiagnostic, SDHtmlMarkdownOutcome } from './sd-contract.js';
5
5
  export declare const SD_PROJECTION_FORMATS: readonly ["html", "markdown"];
6
6
  export type SDProjectionFormat = (typeof SD_PROJECTION_FORMATS)[number];
7
7
  export declare const SD_PROJECTION_REVIEW_MODES: readonly ["final", "original", "redline"];
@@ -112,6 +112,8 @@ export interface SDContentProjectionResult<TFormat extends SDProjectionFormat =
112
112
  format: TFormat;
113
113
  content: string;
114
114
  status: SDProjectionStatus;
115
+ /** Fidelity outcome derived from the complete projection diagnostics. */
116
+ outcome: SDHtmlMarkdownOutcome;
115
117
  reviewMode: SDProjectionReviewMode;
116
118
  evaluatedRevision: string;
117
119
  story: StoryLocator;
@@ -122,5 +124,6 @@ export interface SDContentProjectionResult<TFormat extends SDProjectionFormat =
122
124
  annotations: SDProjectionAnnotation[];
123
125
  sourceMap?: SDProjectionSourceMap;
124
126
  }
127
+ export declare function deriveSDHtmlMarkdownOutcome(diagnostics: readonly Pick<SDDiagnostic, 'severity' | 'lossy'>[]): SDHtmlMarkdownOutcome;
125
128
  export declare function deriveSDProjectionStatus(diagnostics: readonly Pick<SDProjectionDiagnostic, 'severity' | 'lossy'>[]): SDProjectionStatus;
126
129
  export declare function validateSDProjectionSourceMap(sourceMap: SDProjectionSourceMap, contentLength: number): boolean;
@@ -264,4 +264,4 @@ export type PlanExecutionError = {
264
264
  stepId?: string;
265
265
  details?: unknown;
266
266
  };
267
- export type { RevisionGuardOptions, MutationOptions } from '../write/write.js';
267
+ export type { RevisionGuardOptions, MutationOptions, RichContentMutationOptions } from '../write/write.js';
@@ -9,7 +9,7 @@ export type AffectedRefRemapping = {
9
9
  from: AffectedRef;
10
10
  to: AffectedRef;
11
11
  };
12
- export type ReceiptFailureCode = 'NO_OP' | 'INVALID_TARGET' | 'TARGET_NOT_FOUND' | 'CAPABILITY_UNAVAILABLE' | 'PERMISSION_DENIED' | 'STALE_REVISION' | 'REVISION_MISMATCH' | 'MATCH_NOT_FOUND' | 'AMBIGUOUS_MATCH' | 'STYLE_CONFLICT' | 'PRECONDITION_FAILED' | 'COMMENT_CASCADE_PARTIAL' | 'INVALID_INPUT' | 'CROSS_BLOCK_MATCH' | 'SPAN_FRAGMENTED' | 'TARGET_MOVED' | 'PLAN_CONFLICT_OVERLAP' | 'INVALID_STEP_COMBINATION' | 'REVISION_CHANGED_SINCE_COMPILE' | 'INVALID_INSERTION_CONTEXT' | 'DOCUMENT_IDENTITY_CONFLICT' | 'UNSUPPORTED_ENVIRONMENT' | 'INTERNAL_ERROR' | 'PAGE_NUMBERS_NOT_MATERIALIZED' | 'INCOMPATIBLE_DEFINITIONS' | 'NO_COMPATIBLE_PREVIOUS' | 'ALREADY_CONTINUOUS' | 'NO_PREVIOUS_LIST' | 'NO_ADJACENT_SEQUENCE' | 'ALREADY_SAME_SEQUENCE' | 'LEVEL_OUT_OF_RANGE' | 'LEVEL_NOT_FOUND' | 'INVALID_NESTING' | 'INVALID_PLACEMENT' | 'EMPTY_FRAGMENT' | 'INVALID_FRAGMENT' | 'INVALID_PAYLOAD' | 'CAPABILITY_UNSUPPORTED' | 'ADDRESS_STALE' | 'DUPLICATE_ID' | 'INVALID_CONTEXT' | 'RAW_MODE_REQUIRED' | 'PRESERVE_ONLY_VIOLATION' | 'LOCK_VIOLATION' | 'TYPE_MISMATCH' | 'UNSUPPORTED_SOURCE' | 'INVALID_PACKAGE' | 'UNSUPPORTED_TEMPLATE_CONTENT';
12
+ export type ReceiptFailureCode = 'NO_OP' | 'INVALID_TARGET' | 'TARGET_NOT_FOUND' | 'CAPABILITY_UNAVAILABLE' | 'PERMISSION_DENIED' | 'STALE_REVISION' | 'REVISION_MISMATCH' | 'CHECK_MISMATCH' | 'MATCH_NOT_FOUND' | 'AMBIGUOUS_MATCH' | 'STYLE_CONFLICT' | 'PRECONDITION_FAILED' | 'COMMENT_CASCADE_PARTIAL' | 'INVALID_INPUT' | 'CROSS_BLOCK_MATCH' | 'SPAN_FRAGMENTED' | 'TARGET_MOVED' | 'PLAN_CONFLICT_OVERLAP' | 'INVALID_STEP_COMBINATION' | 'REVISION_CHANGED_SINCE_COMPILE' | 'INVALID_INSERTION_CONTEXT' | 'DOCUMENT_IDENTITY_CONFLICT' | 'UNSUPPORTED_ENVIRONMENT' | 'INTERNAL_ERROR' | 'PAGE_NUMBERS_NOT_MATERIALIZED' | 'INCOMPATIBLE_DEFINITIONS' | 'NO_COMPATIBLE_PREVIOUS' | 'ALREADY_CONTINUOUS' | 'NO_PREVIOUS_LIST' | 'NO_ADJACENT_SEQUENCE' | 'ALREADY_SAME_SEQUENCE' | 'LEVEL_OUT_OF_RANGE' | 'LEVEL_NOT_FOUND' | 'INVALID_NESTING' | 'INVALID_PLACEMENT' | 'EMPTY_FRAGMENT' | 'INVALID_FRAGMENT' | 'INVALID_PAYLOAD' | 'CAPABILITY_UNSUPPORTED' | 'ADDRESS_STALE' | 'DUPLICATE_ID' | 'INVALID_CONTEXT' | 'RAW_MODE_REQUIRED' | 'PRESERVE_ONLY_VIOLATION' | 'LOCK_VIOLATION' | 'TYPE_MISMATCH' | 'UNSUPPORTED_SOURCE' | 'INVALID_PACKAGE' | 'UNSUPPORTED_TEMPLATE_CONTENT';
13
13
  export type ReceiptFailure = {
14
14
  code: ReceiptFailureCode;
15
15
  message: string;
@@ -2,7 +2,9 @@ import { BlockNodeAddress } from './base.js';
2
2
  import { SelectionTarget, TextAddress } from './address.js';
3
3
  import { ReceiptEffects, ReceiptSuccess, TextMutationRange } from './receipt.js';
4
4
  import { BodyStoryLocator } from './story.types.js';
5
- export type SDErrorCode = 'INVALID_PAYLOAD' | 'INVALID_TARGET' | 'TARGET_NOT_FOUND' | 'ADDRESS_STALE' | 'PRECONDITION_FAILED' | 'REVISION_MISMATCH' | 'INVALID_CONTEXT' | 'INVALID_NESTING' | 'INVALID_PLACEMENT' | 'DUPLICATE_ID' | 'CAPABILITY_UNSUPPORTED' | 'RAW_MODE_REQUIRED' | 'PRESERVE_ONLY_VIOLATION' | 'NO_OP' | 'UNSUPPORTED_ENVIRONMENT' | 'INTERNAL_ERROR';
5
+ export type SDErrorCode = 'INVALID_PAYLOAD' | 'INVALID_TARGET' | 'TARGET_NOT_FOUND' | 'ADDRESS_STALE' | 'PRECONDITION_FAILED' | 'REVISION_MISMATCH' | 'CHECK_MISMATCH' | 'INVALID_CONTEXT' | 'INVALID_NESTING' | 'INVALID_PLACEMENT' | 'DUPLICATE_ID' | 'CAPABILITY_UNSUPPORTED' | 'RAW_MODE_REQUIRED' | 'PRESERVE_ONLY_VIOLATION' | 'NO_OP' | 'UNSUPPORTED_ENVIRONMENT' | 'INTERNAL_ERROR';
6
+ export declare const SD_HTML_MARKDOWN_OUTCOMES: readonly ["preserved", "preserved-with-warnings", "simplified", "rejected", "no-op", "invalid-target", "outdated"];
7
+ export type SDHtmlMarkdownOutcome = (typeof SD_HTML_MARKDOWN_OUTCOMES)[number];
6
8
  export interface SDError {
7
9
  code: SDErrorCode;
8
10
  message: string;
@@ -21,6 +23,8 @@ export interface SDError {
21
23
  export type MutationResolutionTarget = TextAddress | BlockNodeAddress | BodyStoryLocator;
22
24
  export interface SDMutationReceipt {
23
25
  success: boolean;
26
+ /** Rich HTML/Markdown fidelity outcome, when this receipt came from a rich write. */
27
+ outcome?: SDHtmlMarkdownOutcome;
24
28
  failure?: SDError;
25
29
  evaluatedRevision?: {
26
30
  before: string;
@@ -2,6 +2,7 @@ import { TextMutationReceipt, SDMutationReceipt } from '../types/index.js';
2
2
  import { InsertInput } from '../insert/insert.js';
3
3
  import { ReplaceInput } from '../replace/replace.js';
4
4
  import { StoryLocator } from '../types/story.types.js';
5
+ import { SDHtmlMarkdownCheckGuard } from '../capabilities/html-markdown-support.js';
5
6
  export type ChangeMode = 'direct' | 'tracked';
6
7
  /**
7
8
  * Shared semantic validation for the `changeMode` mutation option.
@@ -40,6 +41,10 @@ export interface MutationOptions extends RevisionGuardOptions {
40
41
  */
41
42
  dryRun?: boolean;
42
43
  }
44
+ export interface RichContentMutationOptions extends MutationOptions {
45
+ /** Guard returned by `doc.capabilities.check` for an exact rich write. */
46
+ supportCheck?: SDHtmlMarkdownCheckGuard;
47
+ }
43
48
  /**
44
49
  * Text insertion request: target-less insert at document end.
45
50
  *
@@ -65,9 +70,9 @@ export type WriteRequest = InsertWriteRequest;
65
70
  export interface WriteAdapter {
66
71
  write(request: InsertWriteRequest, options?: MutationOptions): TextMutationReceipt;
67
72
  /** Structured insert for SDFragment or markdown/html content. Returns SDMutationReceipt. */
68
- insertStructured(input: InsertInput, options?: MutationOptions): SDMutationReceipt;
73
+ insertStructured(input: InsertInput, options?: RichContentMutationOptions): SDMutationReceipt;
69
74
  /** Structured replace for SDFragment or markdown/html content. Returns SDMutationReceipt. */
70
- replaceStructured(input: ReplaceInput, options?: MutationOptions): SDMutationReceipt;
75
+ replaceStructured(input: ReplaceInput, options?: RichContentMutationOptions): SDMutationReceipt;
71
76
  }
72
- export declare function normalizeMutationOptions(options?: MutationOptions): MutationOptions;
77
+ export declare function normalizeMutationOptions(options?: MutationOptions | RichContentMutationOptions, supportCheckOperation?: 'insert' | 'replace'): RichContentMutationOptions;
73
78
  export declare function executeWrite(adapter: WriteAdapter, request: InsertWriteRequest, options?: MutationOptions): TextMutationReceipt;
@@ -27,7 +27,7 @@ import { SuperDocUIReason } from './reasons.js';
27
27
  * (`scripts/ensure-types.cjs` `rewriteDocApiPaths`), so no bare private
28
28
  * specifier leaks into the emitted `.d.ts`.
29
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';
30
+ export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, SDHtmlMarkdownSupportCheckResult, } from '../../../../document-api/src/index.js';
31
31
  export type { StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, } from '../../../../document-api/src/index.js';
32
32
  export type { ListPresetId } from '../../../../document-api/src/index.js';
33
33
  export type { BrowserDocumentApi, PartialBrowserDocumentApi } from '../browser-document-api.js';
@@ -37,8 +37,10 @@ import type { FontsSlice as __Cjs_FontsSlice } from './ui.js' with { "resolution
37
37
  import type { MetadataHandle as __Cjs_MetadataHandle } from './ui.js' with { "resolution-mode": "import" };
38
38
  import type { PartialBrowserDocumentApi as __Cjs_PartialBrowserDocumentApi } from './ui.js' with { "resolution-mode": "import" };
39
39
  import type { Receipt as __Cjs_Receipt } from './ui.js' with { "resolution-mode": "import" };
40
+ import type { RichContentInsertInput as __Cjs_RichContentInsertInput } from './ui.js' with { "resolution-mode": "import" };
40
41
  import type { ScrollIntoViewInput as __Cjs_ScrollIntoViewInput } from './ui.js' with { "resolution-mode": "import" };
41
42
  import type { ScrollIntoViewOutput as __Cjs_ScrollIntoViewOutput } from './ui.js' with { "resolution-mode": "import" };
43
+ import type { SDHtmlMarkdownSupportCheckResult as __Cjs_SDHtmlMarkdownSupportCheckResult } from './ui.js' with { "resolution-mode": "import" };
42
44
  import type { SelectionCapture as __Cjs_SelectionCapture } from './ui.js' with { "resolution-mode": "import" };
43
45
  import type { SelectionHandle as __Cjs_SelectionHandle } from './ui.js' with { "resolution-mode": "import" };
44
46
  import type { SelectionInfo as __Cjs_SelectionInfo } from './ui.js' with { "resolution-mode": "import" };
@@ -134,8 +136,10 @@ export type { __Cjs_FontsSlice as FontsSlice };
134
136
  export type { __Cjs_MetadataHandle as MetadataHandle };
135
137
  export type { __Cjs_PartialBrowserDocumentApi as PartialBrowserDocumentApi };
136
138
  export type { __Cjs_Receipt as Receipt };
139
+ export type { __Cjs_RichContentInsertInput as RichContentInsertInput };
137
140
  export type { __Cjs_ScrollIntoViewInput as ScrollIntoViewInput };
138
141
  export type { __Cjs_ScrollIntoViewOutput as ScrollIntoViewOutput };
142
+ export type { __Cjs_SDHtmlMarkdownSupportCheckResult as SDHtmlMarkdownSupportCheckResult };
139
143
  export type { __Cjs_SelectionCapture as SelectionCapture };
140
144
  export type { __Cjs_SelectionHandle as SelectionHandle };
141
145
  export type { __Cjs_SelectionInfo as SelectionInfo };
@@ -26,4 +26,4 @@
26
26
  export { createSuperDocUI } from './ui/create-super-doc-ui.js';
27
27
  export { shallowEqual } from './ui/equality.js';
28
28
  export { BUILT_IN_COMMAND_IDS } from './ui/commands.js';
29
- export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandsHandle, ContextMenuItem, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, FontsHandle, ZoomHandle, DocumentHandle, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, } from './ui/types.js';
29
+ export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandsHandle, ContextMenuItem, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, FontsHandle, ZoomHandle, DocumentHandle, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, SDHtmlMarkdownSupportCheckResult, } from './ui/types.js';
package/dist/superdoc.cjs CHANGED
@@ -43514,7 +43514,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43514
43514
  this.config.colors = shuffleArray(this.config.colors);
43515
43515
  this.userColorMap = /* @__PURE__ */ new Map();
43516
43516
  this.colorIndex = 0;
43517
- this.version = "2.7.0-next.10";
43517
+ this.version = "2.7.0-next.12";
43518
43518
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43519
43519
  this.superdocId = config.superdocId || require_uuid.v4();
43520
43520
  this.colors = this.config.colors ?? [];
@@ -43447,7 +43447,7 @@ var SuperDoc = class extends import_eventemitter3.default {
43447
43447
  this.config.colors = shuffleArray(this.config.colors);
43448
43448
  this.userColorMap = /* @__PURE__ */ new Map();
43449
43449
  this.colorIndex = 0;
43450
- this.version = "2.7.0-next.10";
43450
+ this.version = "2.7.0-next.12";
43451
43451
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43452
43452
  this.superdocId = config.superdocId || v4();
43453
43453
  this.colors = this.config.colors ?? [];