superdoc 2.7.0-next.1 → 2.7.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/chunks/{create-super-doc-ui-DCjm-_Xo.es.js → create-super-doc-ui-BTNVc3UD.es.js} +7 -3
  2. package/dist/chunks/{create-super-doc-ui-CwCvqMOa.cjs → create-super-doc-ui-C44xPZxz.cjs} +7 -3
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/content-projection/validation.d.ts +3 -0
  6. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  7. package/dist/document-api/src/contract/operation-definitions.d.ts +22 -0
  8. package/dist/document-api/src/contract/operation-registry.d.ts +11 -0
  9. package/dist/document-api/src/get-html/get-html.d.ts +6 -6
  10. package/dist/document-api/src/get-markdown/get-markdown.d.ts +2 -4
  11. package/dist/document-api/src/index.d.ts +11 -0
  12. package/dist/document-api/src/project-html/project-html.d.ts +5 -0
  13. package/dist/document-api/src/project-markdown/project-markdown.d.ts +5 -0
  14. package/dist/document-api/src/ranges/ranges.types.d.ts +5 -2
  15. package/dist/document-api/src/replace/replace.d.ts +15 -3
  16. package/dist/document-api/src/types/address.d.ts +2 -0
  17. package/dist/document-api/src/types/content-projection.d.ts +126 -0
  18. package/dist/document-api/src/types/index.d.ts +1 -0
  19. package/dist/document-api/src/types/mutation-plan.types.d.ts +3 -0
  20. package/dist/document-api/src/types/sd-contract.d.ts +4 -2
  21. package/dist/document-api/src/types/structural-input.d.ts +18 -3
  22. package/dist/layout-engine/painters/dom/src/index.d.ts +2 -0
  23. package/dist/layout-engine/painters/dom/src/web-flow/index.d.ts +3 -0
  24. package/dist/layout-engine/painters/dom/src/web-flow/painter.d.ts +2 -0
  25. package/dist/layout-engine/painters/dom/src/web-flow/render.d.ts +8 -0
  26. package/dist/layout-engine/painters/dom/src/web-flow/styles.d.ts +10 -0
  27. package/dist/layout-engine/painters/dom/src/web-flow/types.d.ts +77 -0
  28. package/dist/public/ui-react.cjs +1 -1
  29. package/dist/public/ui-react.es.js +1 -1
  30. package/dist/public/ui.cjs +1 -1
  31. package/dist/public/ui.es.js +1 -1
  32. package/dist/superdoc/src/composables/use-link-popover.d.ts +3 -14
  33. package/dist/superdoc/src/core/types/index.d.ts +12 -5
  34. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +2 -3
  35. package/dist/superdoc.cjs +36 -128
  36. package/dist/superdoc.es.js +36 -128
  37. package/dist/word-layout/src/index.d.ts +2 -0
  38. package/dist/word-layout/src/list-marker.d.ts +8 -0
  39. package/dist/word-layout/src/review-aware-numbering.d.ts +41 -0
  40. package/dist-cdn/superdoc.min.js +37 -37
  41. package/package.json +2 -2
@@ -438,9 +438,8 @@ Object.freeze([
438
438
  * Classify the tracked-change identities carried by a v2 mutation event.
439
439
  *
440
440
  * Receipt entities are the durable invalidation contract between the document
441
- * kernel and derived review UI. Consumers apply removals/remaps locally; the
442
- * next committed window supplies surviving or restored rows. History follows
443
- * the same bounded path and never enumerates invisible review identities.
441
+ * kernel and derived review UI. Direct receipts carry entity refs; mutation
442
+ * plans carry the same identities through `trackedChanges` and per-step ids.
444
443
  */
445
444
  function getV2TrackedChangeMutationImpact(event) {
446
445
  if (event?.type !== "mutation:committed") return null;
@@ -461,6 +460,11 @@ function getV2TrackedChangeMutationImpact(event) {
461
460
  if (Array.isArray(payload.inserted)) payload.inserted.forEach((entry) => collectEntity(entry, upsertIds));
462
461
  if (Array.isArray(payload.updated)) payload.updated.forEach((entry) => collectEntity(entry, upsertIds));
463
462
  if (Array.isArray(payload.trackedChangeRefs)) payload.trackedChangeRefs.forEach((entry) => collectEntity(entry, upsertIds));
463
+ if (Array.isArray(payload.trackedChanges)) payload.trackedChanges.forEach((entry) => collectEntity(entry, upsertIds));
464
+ if (Array.isArray(payload.steps)) for (const step of payload.steps) {
465
+ if (!Array.isArray(step?.trackedChangeIds)) continue;
466
+ for (const id of step.trackedChangeIds) if (typeof id === "string" && id.length > 0) upsertIds.add(id);
467
+ }
464
468
  if (Array.isArray(payload.removed)) payload.removed.forEach((entry) => collectEntity(entry, removedIds));
465
469
  if (Array.isArray(payload.invalidatedRefs)) payload.invalidatedRefs.forEach((entry) => collectEntity(entry, removedIds));
466
470
  if (Array.isArray(payload.remappedRefs)) for (const mapping of payload.remappedRefs) {
@@ -438,9 +438,8 @@ Object.freeze([
438
438
  * Classify the tracked-change identities carried by a v2 mutation event.
439
439
  *
440
440
  * Receipt entities are the durable invalidation contract between the document
441
- * kernel and derived review UI. Consumers apply removals/remaps locally; the
442
- * next committed window supplies surviving or restored rows. History follows
443
- * the same bounded path and never enumerates invisible review identities.
441
+ * kernel and derived review UI. Direct receipts carry entity refs; mutation
442
+ * plans carry the same identities through `trackedChanges` and per-step ids.
444
443
  */
445
444
  function getV2TrackedChangeMutationImpact(event) {
446
445
  if (event?.type !== "mutation:committed") return null;
@@ -461,6 +460,11 @@ function getV2TrackedChangeMutationImpact(event) {
461
460
  if (Array.isArray(payload.inserted)) payload.inserted.forEach((entry) => collectEntity(entry, upsertIds));
462
461
  if (Array.isArray(payload.updated)) payload.updated.forEach((entry) => collectEntity(entry, upsertIds));
463
462
  if (Array.isArray(payload.trackedChangeRefs)) payload.trackedChangeRefs.forEach((entry) => collectEntity(entry, upsertIds));
463
+ if (Array.isArray(payload.trackedChanges)) payload.trackedChanges.forEach((entry) => collectEntity(entry, upsertIds));
464
+ if (Array.isArray(payload.steps)) for (const step of payload.steps) {
465
+ if (!Array.isArray(step?.trackedChangeIds)) continue;
466
+ for (const id of step.trackedChangeIds) if (typeof id === "string" && id.length > 0) upsertIds.add(id);
467
+ }
464
468
  if (Array.isArray(payload.removed)) payload.removed.forEach((entry) => collectEntity(entry, removedIds));
465
469
  if (Array.isArray(payload.invalidatedRefs)) payload.invalidatedRefs.forEach((entry) => collectEntity(entry, removedIds));
466
470
  if (Array.isArray(payload.remappedRefs)) for (const mapping of payload.remappedRefs) {
@@ -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.1",
22
+ superdocVersion: "2.7.0-next.10",
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.1",
21
+ superdocVersion: "2.7.0-next.10",
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
@@ -0,0 +1,3 @@
1
+ import { SDProjectionReadInput } from '../types/content-projection.js';
2
+ export declare function validateProjectionReadInput(input: unknown, operationName: string, allowedFields: ReadonlySet<string>): asserts input is SDProjectionReadInput;
3
+ export declare function validateOptionalBoolean(value: unknown, field: string, operationName: string): void;
@@ -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" | "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" | "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")[];
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. */
@@ -3481,6 +3481,28 @@ export declare const OPERATION_DEFINITIONS: {
3481
3481
  readonly intentGroup: "get_content";
3482
3482
  readonly intentAction: "html";
3483
3483
  };
3484
+ readonly projectMarkdown: {
3485
+ readonly memberPath: "projectMarkdown";
3486
+ readonly description: "Project document content as Markdown with review, scope, diagnostics, and provenance metadata.";
3487
+ readonly expectedResult: "Returns a Promise resolving to a detailed Markdown content projection result.";
3488
+ readonly requiresDocumentContext: true;
3489
+ readonly metadata: CommandStaticMetadata;
3490
+ readonly referenceDocPath: "project-markdown.mdx";
3491
+ readonly referenceGroup: "core";
3492
+ readonly intentGroup: "get_content";
3493
+ readonly intentAction: "markdown_projection";
3494
+ };
3495
+ readonly projectHtml: {
3496
+ readonly memberPath: "projectHtml";
3497
+ readonly description: "Project document content as HTML with review, scope, diagnostics, and provenance metadata.";
3498
+ readonly expectedResult: "Returns a Promise resolving to a detailed HTML content projection result.";
3499
+ readonly requiresDocumentContext: true;
3500
+ readonly metadata: CommandStaticMetadata;
3501
+ readonly referenceDocPath: "project-html.mdx";
3502
+ readonly referenceGroup: "core";
3503
+ readonly intentGroup: "get_content";
3504
+ readonly intentAction: "html_projection";
3505
+ };
3484
3506
  readonly markdownToFragment: {
3485
3507
  readonly memberPath: "markdownToFragment";
3486
3508
  readonly description: "Convert a Markdown string into an SDM/1 structural fragment.";
@@ -11,6 +11,7 @@ import { GetNodeByIdInput } from '../get-node/get-node.js';
11
11
  import { GetTextInput } from '../get-text/get-text.js';
12
12
  import { GetMarkdownInput } from '../get-markdown/get-markdown.js';
13
13
  import { GetHtmlInput } from '../get-html/get-html.js';
14
+ import { ProjectHtmlInput, ProjectMarkdownInput, SDContentProjectionResult } from '../types/content-projection.js';
14
15
  import { MarkdownToFragmentInput } from '../markdown-to-fragment/markdown-to-fragment.js';
15
16
  import { HtmlToFragmentInput } from '../html-to-fragment/html-to-fragment.js';
16
17
  import { InfoInput } from '../info/info.js';
@@ -103,6 +104,16 @@ export interface OperationRegistry extends FormatInlineAliasOperationRegistry {
103
104
  options: never;
104
105
  output: string;
105
106
  };
107
+ projectMarkdown: {
108
+ input: ProjectMarkdownInput;
109
+ options: never;
110
+ output: Promise<SDContentProjectionResult<'markdown'>>;
111
+ };
112
+ projectHtml: {
113
+ input: ProjectHtmlInput;
114
+ options: never;
115
+ output: Promise<SDContentProjectionResult<'html'>>;
116
+ };
106
117
  markdownToFragment: {
107
118
  input: MarkdownToFragmentInput;
108
119
  options: never;
@@ -1,10 +1,10 @@
1
- import { StoryLocator } from '../types/story.types.js';
2
- export interface GetHtmlInput {
3
- /** Restrict the read to a specific story. Omit for body (backward compatible). */
4
- in?: StoryLocator;
1
+ import { SDProjectionReadInput } from '../types/content-projection.js';
2
+ export interface GetHtmlInput extends SDProjectionReadInput {
5
3
  /**
6
- * Convert SuperDoc's internal flat-list representation to proper nested
7
- * `<ol>`/`<ul>` HTML. Defaults to `true`.
4
+ * Accepted for compatibility and ignored by V2. V2 always emits canonical
5
+ * nested semantic lists.
6
+ *
7
+ * @deprecated replaceWith=canonical nested V2 output compat-indefinitely=existing callers may keep passing the option
8
8
  */
9
9
  unflattenLists?: boolean;
10
10
  }
@@ -1,7 +1,5 @@
1
- import { StoryLocator } from '../types/story.types.js';
2
- export interface GetMarkdownInput {
3
- /** Restrict the read to a specific story. Omit for body (backward compatible). */
4
- in?: StoryLocator;
1
+ import { SDProjectionReadInput } from '../types/content-projection.js';
2
+ export interface GetMarkdownInput extends SDProjectionReadInput {
5
3
  }
6
4
  /**
7
5
  * Engine-specific adapter that the getMarkdown API delegates to.
@@ -12,6 +12,9 @@ import { SDDocument } from './types/fragment.js';
12
12
  import { GetTextAdapter, GetTextInput } from './get-text/get-text.js';
13
13
  import { GetMarkdownAdapter, GetMarkdownInput } from './get-markdown/get-markdown.js';
14
14
  import { GetHtmlAdapter, GetHtmlInput } from './get-html/get-html.js';
15
+ import { ProjectHtmlAdapter } from './project-html/project-html.js';
16
+ import { ProjectMarkdownAdapter } from './project-markdown/project-markdown.js';
17
+ import { ProjectHtmlInput, ProjectMarkdownInput, SDContentProjectionResult } from './types/content-projection.js';
15
18
  import { MarkdownToFragmentAdapter, MarkdownToFragmentInput } from './markdown-to-fragment/markdown-to-fragment.js';
16
19
  import { HtmlToFragmentAdapter, HtmlToFragmentInput } from './html-to-fragment/html-to-fragment.js';
17
20
  import { SDHtmlToFragmentResult, SDMarkdownToFragmentResult } from './types/sd-contract.js';
@@ -79,6 +82,10 @@ export type { MarkdownToFragmentInput, MarkdownToFragmentAdapter, } from './mark
79
82
  export { executeMarkdownToFragment } from './markdown-to-fragment/markdown-to-fragment.js';
80
83
  export type { HtmlToFragmentInput, HtmlToFragmentAdapter } from './html-to-fragment/html-to-fragment.js';
81
84
  export { executeHtmlToFragment } from './html-to-fragment/html-to-fragment.js';
85
+ export type { ProjectHtmlAdapter } from './project-html/project-html.js';
86
+ export { executeProjectHtml } from './project-html/project-html.js';
87
+ export type { ProjectMarkdownAdapter } from './project-markdown/project-markdown.js';
88
+ export { executeProjectMarkdown } from './project-markdown/project-markdown.js';
82
89
  export type { HistoryState, HistoryActionResult, HistoryNoopReason, SDHistoryStatus, SDHistoryCollaborationMeta, } from './history/history.types.js';
83
90
  export { executeTrackChangesGet, executeTrackChangesList, executeTrackChangesDecide, } from './track-changes/track-changes.js';
84
91
  export { createPlanApi, type PlanApi, type PlanExecuteInput, type PlanExecuteEntry, type PlanExecuteEntryExpect, type PlanExecuteResult, type PlanEntryReceipt, type PlanEntryReceiptStatus, type PlanExecuteFailure, type PlanCaptureRefMarker, type PlanProjectTextOffsetMarker, } from './plan/plan.js';
@@ -287,6 +294,8 @@ export interface DocumentApi {
287
294
  * Return the full document content as an HTML string.
288
295
  */
289
296
  getHtml(input: GetHtmlInput): string;
297
+ projectHtml(input: ProjectHtmlInput): Promise<SDContentProjectionResult<'html'>>;
298
+ projectMarkdown(input: ProjectMarkdownInput): Promise<SDContentProjectionResult<'markdown'>>;
290
299
  /**
291
300
  * Convert a Markdown string into an SDM/1 structural fragment.
292
301
  */
@@ -509,6 +518,8 @@ export interface DocumentApiAdapters {
509
518
  getText: GetTextAdapter;
510
519
  getMarkdown: GetMarkdownAdapter;
511
520
  getHtml: GetHtmlAdapter;
521
+ projectHtml?: ProjectHtmlAdapter;
522
+ projectMarkdown?: ProjectMarkdownAdapter;
512
523
  markdownToFragment: MarkdownToFragmentAdapter;
513
524
  htmlToFragment?: HtmlToFragmentAdapter;
514
525
  info: InfoAdapter;
@@ -0,0 +1,5 @@
1
+ import { ProjectHtmlInput, SDContentProjectionResult } from '../types/content-projection.js';
2
+ export interface ProjectHtmlAdapter {
3
+ projectHtml(input: ProjectHtmlInput): Promise<SDContentProjectionResult<'html'>>;
4
+ }
5
+ export declare function executeProjectHtml(adapter: ProjectHtmlAdapter | undefined, input: ProjectHtmlInput): Promise<SDContentProjectionResult<'html'>>;
@@ -0,0 +1,5 @@
1
+ import { ProjectMarkdownInput, SDContentProjectionResult } from '../types/content-projection.js';
2
+ export interface ProjectMarkdownAdapter {
3
+ projectMarkdown(input: ProjectMarkdownInput): Promise<SDContentProjectionResult<'markdown'>>;
4
+ }
5
+ export declare function executeProjectMarkdown(adapter: ProjectMarkdownAdapter | undefined, input: ProjectMarkdownInput): Promise<SDContentProjectionResult<'markdown'>>;
@@ -108,8 +108,11 @@ export interface ScrollIntoViewInput {
108
108
  target: TextAddress | TextTarget | EntityAddress;
109
109
  /** Alignment within the viewport. Defaults to `'center'`. */
110
110
  block?: 'start' | 'center' | 'end' | 'nearest';
111
- /** Scroll behavior. Defaults to `'smooth'`. */
112
- behavior?: 'auto' | 'smooth';
111
+ /**
112
+ * Scroll behavior. Defaults to `'smooth'`. `'auto'` follows the computed
113
+ * CSS `scroll-behavior`; `'instant'` always moves without animation.
114
+ */
115
+ behavior?: 'auto' | 'instant' | 'smooth';
113
116
  }
114
117
  /**
115
118
  * Result of `ui.viewport.scrollIntoView`. `success: false` when the
@@ -2,18 +2,23 @@ import { MutationOptions } from '../types/mutation-plan.types.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';
5
- import { StoryLocator } from '../types/story.types.js';
5
+ 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
9
  import { WriteAdapter } from '../write/write.js';
10
- /** Text replacement input: uses SelectionTarget / ref. */
11
- export type TextReplaceInput = TargetLocator & {
10
+ /** Text replacement input: uses SelectionTarget / ref, or the complete main body. */
11
+ export type TextReplaceInput = (TargetLocator & {
12
12
  target?: SelectionTarget;
13
13
  ref?: string;
14
14
  text: string;
15
15
  /** Target a specific document story (body, header, footer, footnote, endnote). */
16
16
  in?: StoryLocator;
17
+ }) | {
18
+ target: BodyStoryLocator;
19
+ text: string;
20
+ ref?: never;
21
+ in?: never;
17
22
  };
18
23
  /** HTML or Markdown replacement input for conversion and structured application. */
19
24
  export type RichContentReplaceInput = {
@@ -23,6 +28,13 @@ export type RichContentReplaceInput = {
23
28
  ref?: string;
24
29
  in?: StoryLocator;
25
30
  nestingPolicy?: NestingPolicy;
31
+ } | {
32
+ value: string;
33
+ type: 'html' | 'markdown';
34
+ target: BodyStoryLocator;
35
+ ref?: never;
36
+ in?: never;
37
+ nestingPolicy?: never;
26
38
  };
27
39
  /**
28
40
  * Input payload for the `doc.replace` operation.
@@ -50,6 +50,8 @@ export type TextTarget = {
50
50
  segments: [TextSegment, ...TextSegment[]];
51
51
  /** Story containing this text target. Omit for body (backward compatible). */
52
52
  story?: StoryLocator;
53
+ /** Coordinate space for segment offsets. Omitted means `visible`. */
54
+ coordinateSpace?: TextCoordinateSpace;
53
55
  };
54
56
  /**
55
57
  * Block node types valid as `nodeEdge` selection anchors.
@@ -0,0 +1,126 @@
1
+ import { BlockNodeAddress, BlockNodeType } from './base.js';
2
+ import { Range, SelectionTarget, TextTarget } from './address.js';
3
+ import { StoryLocator } from './story.types.js';
4
+ import { SDDiagnostic } from './sd-contract.js';
5
+ export declare const SD_PROJECTION_FORMATS: readonly ["html", "markdown"];
6
+ export type SDProjectionFormat = (typeof SD_PROJECTION_FORMATS)[number];
7
+ export declare const SD_PROJECTION_REVIEW_MODES: readonly ["final", "original", "redline"];
8
+ export type SDProjectionReviewMode = (typeof SD_PROJECTION_REVIEW_MODES)[number];
9
+ export declare const SD_PROJECTION_STATUSES: readonly ["success", "warning", "failed"];
10
+ export type SDProjectionStatus = (typeof SD_PROJECTION_STATUSES)[number];
11
+ export declare const SD_PROJECTION_DIAGNOSTIC_CODES: readonly ["projection-normalized-construct", "projection-downgraded-construct", "projection-unsupported-construct", "projection-placeholder-emitted", "projection-annotation-omitted", "projection-numbering-unresolved", "projection-source-coverage-incomplete", "projection-scope-unsupported", "projection-limit-exceeded", "projection-revision-changed", "projection-malformed-source"];
12
+ export type SDProjectionDiagnosticCode = (typeof SD_PROJECTION_DIAGNOSTIC_CODES)[number];
13
+ export declare const SD_PROJECTION_CONSTRUCTS: readonly ["document", "source", "text", "paragraph", "emptyParagraph", "softBreak", "lineBreak", "heading", "bold", "italic", "underline", "strike", "hyperlink", "list", "listLabel", "table", "tableHeader", "tableRow", "tableCell", "colSpan", "rowSpan", "horizontalRule", "inlineCode", "codeBlock", "image", "field", "contentControl", "math", "drawing", "embeddedObject", "sectionBreak", "pageBreak", "columnBreak", "trackedChange", "comment", "scope", "placeholder"];
14
+ export type SDProjectionConstruct = (typeof SD_PROJECTION_CONSTRUCTS)[number];
15
+ export declare const SD_PROJECTION_DISPOSITIONS: readonly ["preserved", "normalized", "downgraded", "placeholder", "omitted", "rejected"];
16
+ export type SDProjectionDisposition = (typeof SD_PROJECTION_DISPOSITIONS)[number];
17
+ export type SDProjectionScope = BlockNodeAddress | SelectionTarget;
18
+ export interface SDProjectionReadInput {
19
+ in?: StoryLocator;
20
+ reviewMode?: SDProjectionReviewMode;
21
+ scope?: SDProjectionScope;
22
+ }
23
+ export interface ProjectHtmlInput extends SDProjectionReadInput {
24
+ includeSourceMap?: boolean;
25
+ }
26
+ export interface ProjectMarkdownInput extends SDProjectionReadInput {
27
+ includeSourceMap?: boolean;
28
+ }
29
+ export type SDResolvedProjectionScope = {
30
+ kind: 'story';
31
+ } | {
32
+ kind: 'block';
33
+ target: BlockNodeAddress;
34
+ } | {
35
+ kind: 'range';
36
+ target: SelectionTarget & {
37
+ coordinateSpace: 'tracked';
38
+ };
39
+ };
40
+ export type SDProjectionBlockMapEntry = {
41
+ nodeType: BlockNodeType;
42
+ output: Range;
43
+ parentBlockId?: string;
44
+ changeIds?: string[];
45
+ commentIds?: string[];
46
+ } & ({
47
+ identity: 'public';
48
+ blockId: string;
49
+ } | {
50
+ identity: 'unavailable';
51
+ identityUnavailableReason: 'positionDerivedFallback';
52
+ blockId?: never;
53
+ });
54
+ export type SDProjectionDiagnostic = Omit<SDDiagnostic, 'code' | 'construct' | 'disposition' | 'lossy' | 'source'> & {
55
+ code: SDProjectionDiagnosticCode;
56
+ construct: SDProjectionConstruct;
57
+ disposition: SDProjectionDisposition;
58
+ lossy: boolean;
59
+ source: {
60
+ story: StoryLocator;
61
+ blockId?: string;
62
+ range?: Range;
63
+ coordinateSpace?: 'tracked';
64
+ changeIds?: string[];
65
+ commentIds?: string[];
66
+ };
67
+ output?: {
68
+ format: SDProjectionFormat;
69
+ range?: Range;
70
+ };
71
+ };
72
+ export interface SDProjectionSourceMap {
73
+ version: 'sd-projection-source-map/1';
74
+ outputCoordinateSpace: 'utf16';
75
+ sourceCoordinateSpace: 'tracked';
76
+ entries: SDProjectionSourceMapEntry[];
77
+ }
78
+ export type SDProjectionSourceMapEntry = {
79
+ kind: 'text';
80
+ output: Range;
81
+ source: TextTarget & {
82
+ coordinateSpace: 'tracked';
83
+ };
84
+ blockId: string;
85
+ changeIds?: string[];
86
+ commentIds?: string[];
87
+ } | ({
88
+ kind: 'synthetic';
89
+ output: Range;
90
+ role: 'listLabel' | 'placeholder';
91
+ changeIds?: string[];
92
+ commentIds?: string[];
93
+ } & ({
94
+ identity: 'public';
95
+ blockId: string;
96
+ } | {
97
+ identity: 'unavailable';
98
+ identityUnavailableReason: 'positionDerivedFallback';
99
+ blockId?: never;
100
+ }));
101
+ export interface SDProjectionAnnotation {
102
+ kind: 'trackedChange' | 'comment';
103
+ id: string;
104
+ blockIds: string[];
105
+ sourceTarget?: TextTarget;
106
+ outputRanges: Range[];
107
+ status: 'emitted' | 'partiallyEmitted' | 'omitted';
108
+ omittedReason?: 'reviewMode' | 'unsupported';
109
+ side?: 'inserted' | 'deleted' | 'source' | 'destination' | 'formatting';
110
+ }
111
+ export interface SDContentProjectionResult<TFormat extends SDProjectionFormat = SDProjectionFormat> {
112
+ format: TFormat;
113
+ content: string;
114
+ status: SDProjectionStatus;
115
+ reviewMode: SDProjectionReviewMode;
116
+ evaluatedRevision: string;
117
+ story: StoryLocator;
118
+ scope: SDResolvedProjectionScope;
119
+ lossy: boolean;
120
+ diagnostics: SDProjectionDiagnostic[];
121
+ blocks: SDProjectionBlockMapEntry[];
122
+ annotations: SDProjectionAnnotation[];
123
+ sourceMap?: SDProjectionSourceMap;
124
+ }
125
+ export declare function deriveSDProjectionStatus(diagnostics: readonly Pick<SDProjectionDiagnostic, 'severity' | 'lossy'>[]): SDProjectionStatus;
126
+ export declare function validateSDProjectionSourceMap(sourceMap: SDProjectionSourceMap, contentLength: number): boolean;
@@ -29,3 +29,4 @@ export * from './adapter-result.js';
29
29
  export * from './structural-input.js';
30
30
  export * from './story.types.js';
31
31
  export * from './clipboard.js';
32
+ export * from './content-projection.js';
@@ -5,6 +5,7 @@ import { InsertStylePolicy, StylePolicy } from './style-policy.types.js';
5
5
  import { InlineRunPatch } from '../format/inline-run-patch.js';
6
6
  import { SDFragment } from './fragment.js';
7
7
  import { Placement, NestingPolicy } from './placement.js';
8
+ import { AffectedRef } from './receipt.js';
8
9
  import { ChangeMode } from '../write/write.js';
9
10
  import { StoryLocator } from './story.types.js';
10
11
  export type SelectWhere = {
@@ -229,6 +230,8 @@ export type PlanReceipt = {
229
230
  };
230
231
  steps: StepOutcome[];
231
232
  trackedChanges?: TrackedChangeAddress[];
233
+ /** Caller-held refs that no longer resolve after the plan. */
234
+ invalidatedRefs?: AffectedRef[];
232
235
  timing: {
233
236
  totalMs: number;
234
237
  };
@@ -1,13 +1,14 @@
1
1
  import { BlockNodeAddress } from './base.js';
2
2
  import { SelectionTarget, TextAddress } from './address.js';
3
3
  import { ReceiptEffects, ReceiptSuccess, TextMutationRange } from './receipt.js';
4
+ import { BodyStoryLocator } from './story.types.js';
4
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
6
  export interface SDError {
6
7
  code: SDErrorCode;
7
8
  message: string;
8
9
  path?: Array<string | number>;
9
10
  /** The target that caused the error, when available. */
10
- target?: BlockNodeAddress | TextAddress | SelectionTarget;
11
+ target?: BlockNodeAddress | TextAddress | SelectionTarget | BodyStoryLocator;
11
12
  details?: Record<string, unknown>;
12
13
  }
13
14
  /**
@@ -15,8 +16,9 @@ export interface SDError {
15
16
  *
16
17
  * - `TextAddress` (`kind: 'text'`): text-level insert/replace with block-relative offsets.
17
18
  * - `BlockNodeAddress` (`kind: 'block'`): structural insert/replace targeting a whole block.
19
+ * - `BodyStoryLocator` (`kind: 'story'`): explicit complete-main-body replacement.
18
20
  */
19
- export type MutationResolutionTarget = TextAddress | BlockNodeAddress;
21
+ export type MutationResolutionTarget = TextAddress | BlockNodeAddress | BodyStoryLocator;
20
22
  export interface SDMutationReceipt {
21
23
  success: boolean;
22
24
  failure?: SDError;
@@ -2,7 +2,7 @@ import { BlockNodeAddress } from './base.js';
2
2
  import { SelectionTarget } from './address.js';
3
3
  import { SDFragment } from './fragment.js';
4
4
  import { Placement, NestingPolicy } from './placement.js';
5
- import { StoryLocator } from './story.types.js';
5
+ import { BodyStoryLocator, StoryLocator } from './story.types.js';
6
6
  /** Structural shape for the insert operation. */
7
7
  export interface SDInsertInput {
8
8
  /** Optional insertion target. When omitted, inserts at the end of the document. */
@@ -27,14 +27,29 @@ type StructuralReplaceLocator = {
27
27
  ref: string;
28
28
  /** Target to replace. BlockNodeAddress replaces the entire block; SelectionTarget replaces a contiguous selection. */
29
29
  target?: undefined;
30
+ } | {
31
+ /** Replace the complete main body while preserving the destination DOCX package. */
32
+ target: BodyStoryLocator;
33
+ ref?: undefined;
30
34
  };
31
- /** Structural shape for the replace operation. */
32
- export type SDReplaceInput = StructuralReplaceLocator & {
35
+ type StructuralReplaceContent = {
33
36
  /** Structural content to replace with. */
34
37
  content: SDFragment;
38
+ };
39
+ /** Structural shape for the replace operation. */
40
+ export type SDReplaceInput = (Exclude<StructuralReplaceLocator, {
41
+ target: BodyStoryLocator;
42
+ }> & StructuralReplaceContent & {
35
43
  /** Target a specific document story (body, header, footer, footnote, endnote). */
36
44
  in?: StoryLocator;
37
45
  /** Nesting policy. Defaults to { tables: 'forbid' }. */
38
46
  nestingPolicy?: NestingPolicy;
47
+ }) | {
48
+ /** Replace the complete main body while preserving the destination DOCX package. */
49
+ target: BodyStoryLocator;
50
+ content: SDFragment;
51
+ ref?: never;
52
+ in?: never;
53
+ nestingPolicy?: never;
39
54
  };
40
55
  export {};
@@ -3,6 +3,8 @@ import { PageStyles } from './styles.js';
3
3
  import { PositionValidationOptions, PositionValidationSummary } from './pm-position-validation.js';
4
4
  import { DomPainterInput, PageDecorationProvider, PaintSnapshot, PositionMapping, FlowMode } from './renderer.js';
5
5
  import { DomPainterPersistentPageInput } from './persistent-page-surface.js';
6
+ export { createWebFlowPainter, ensureWebFlowStyles, WEB_FLOW_CLASS_NAMES } from './web-flow/index.js';
7
+ export type { WebFlowAppliedPaint, WebFlowDomBinding, WebFlowPaintCommand, WebFlowPaintItem, WebFlowPaintSnapshot, WebFlowPaintTransaction, WebFlowPainterHandle, WebFlowPainterOptions, WebFlowPaintWorkSummary, WebFlowStableDomKey, } from './web-flow/index.js';
6
8
  export { DOM_CLASS_NAMES } from './constants.js';
7
9
  export type { DomClassName } from './constants.js';
8
10
  export { ensureDocumentSurfaceStyles } from './styles.js';
@@ -0,0 +1,3 @@
1
+ export { createWebFlowPainter } from './painter.js';
2
+ export { ensureWebFlowStyles, WEB_FLOW_CLASS_NAMES } from './styles.js';
3
+ export type { WebFlowAppliedPaint, WebFlowDomBinding, WebFlowPaintCommand, WebFlowPaintItem, WebFlowPaintSnapshot, WebFlowPaintTransaction, WebFlowPainterHandle, WebFlowPainterOptions, WebFlowPaintWorkSummary, WebFlowStableDomKey, } from './types.js';
@@ -0,0 +1,2 @@
1
+ import { WebFlowPainterHandle, WebFlowPainterOptions } from './types.js';
2
+ export declare function createWebFlowPainter(mount: HTMLElement, options?: WebFlowPainterOptions): WebFlowPainterHandle;
@@ -0,0 +1,8 @@
1
+ import { FlowBlock } from '../../../../contracts/src/index.js';
2
+ import { WebFlowPaintItem, WebFlowPainterOptions } from './types.js';
3
+ export declare function doesWebFlowBlockProduceDom(block: FlowBlock): boolean;
4
+ export declare function renderWebFlowItem(item: WebFlowPaintItem, doc: Document, options: WebFlowPainterOptions): HTMLElement | null;
5
+ /** Identity-only signature for deciding whether a retained node needs dataset rebasing. */
6
+ export declare function webFlowItemIdentityFingerprint(item: WebFlowPaintItem): string;
7
+ /** Rebase canonical identity datasets without replacing an unchanged retained node. */
8
+ export declare function rebaseWebFlowItemNode(node: HTMLElement, previous: WebFlowPaintItem, next: WebFlowPaintItem): () => void;
@@ -0,0 +1,10 @@
1
+ export declare const WEB_FLOW_CLASS_NAMES: {
2
+ readonly root: "superdoc-web-flow";
3
+ readonly block: "superdoc-web-flow-block";
4
+ readonly paragraph: "superdoc-web-flow-paragraph";
5
+ readonly run: "superdoc-web-flow-run";
6
+ readonly listMarker: "superdoc-web-flow-list-marker";
7
+ readonly table: "superdoc-web-flow-table";
8
+ readonly diagnostic: "superdoc-web-flow-diagnostic";
9
+ };
10
+ export declare function ensureWebFlowStyles(doc: Document): void;