superdoc 2.7.0-next.1 → 2.7.0-next.11

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 (49) 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/capabilities/capabilities.d.ts +3 -0
  6. package/dist/document-api/src/capabilities/html-markdown-support.d.ts +66 -0
  7. package/dist/document-api/src/content-projection/validation.d.ts +3 -0
  8. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  9. package/dist/document-api/src/contract/operation-definitions.d.ts +33 -0
  10. package/dist/document-api/src/contract/operation-registry.d.ts +20 -3
  11. package/dist/document-api/src/get-html/get-html.d.ts +6 -6
  12. package/dist/document-api/src/get-markdown/get-markdown.d.ts +2 -4
  13. package/dist/document-api/src/index.d.ts +18 -4
  14. package/dist/document-api/src/insert/insert.d.ts +12 -2
  15. package/dist/document-api/src/project-html/project-html.d.ts +5 -0
  16. package/dist/document-api/src/project-markdown/project-markdown.d.ts +5 -0
  17. package/dist/document-api/src/ranges/ranges.types.d.ts +5 -2
  18. package/dist/document-api/src/replace/replace.d.ts +18 -6
  19. package/dist/document-api/src/types/address.d.ts +2 -0
  20. package/dist/document-api/src/types/content-projection.d.ts +129 -0
  21. package/dist/document-api/src/types/index.d.ts +1 -0
  22. package/dist/document-api/src/types/mutation-plan.types.d.ts +4 -1
  23. package/dist/document-api/src/types/receipt.d.ts +1 -1
  24. package/dist/document-api/src/types/sd-contract.d.ts +9 -3
  25. package/dist/document-api/src/types/structural-input.d.ts +18 -3
  26. package/dist/document-api/src/write/write.d.ts +8 -3
  27. package/dist/layout-engine/painters/dom/src/index.d.ts +2 -0
  28. package/dist/layout-engine/painters/dom/src/web-flow/index.d.ts +3 -0
  29. package/dist/layout-engine/painters/dom/src/web-flow/painter.d.ts +2 -0
  30. package/dist/layout-engine/painters/dom/src/web-flow/render.d.ts +8 -0
  31. package/dist/layout-engine/painters/dom/src/web-flow/styles.d.ts +10 -0
  32. package/dist/layout-engine/painters/dom/src/web-flow/types.d.ts +77 -0
  33. package/dist/public/ui-react.cjs +1 -1
  34. package/dist/public/ui-react.es.js +1 -1
  35. package/dist/public/ui.cjs +1 -1
  36. package/dist/public/ui.es.js +1 -1
  37. package/dist/superdoc/src/composables/use-link-popover.d.ts +3 -14
  38. package/dist/superdoc/src/core/types/index.d.ts +12 -5
  39. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +2 -3
  40. package/dist/superdoc/src/public/ui/types.d.ts +1 -1
  41. package/dist/superdoc/src/public/ui.d.cts +4 -0
  42. package/dist/superdoc/src/public/ui.d.ts +1 -1
  43. package/dist/superdoc.cjs +36 -128
  44. package/dist/superdoc.es.js +36 -128
  45. package/dist/word-layout/src/index.d.ts +2 -0
  46. package/dist/word-layout/src/list-marker.d.ts +8 -0
  47. package/dist/word-layout/src/review-aware-numbering.d.ts +41 -0
  48. package/dist-cdn/superdoc.min.js +37 -37
  49. package/package.json +2 -2
@@ -0,0 +1,129 @@
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, SDHtmlMarkdownOutcome } 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
+ /** Fidelity outcome derived from the complete projection diagnostics. */
116
+ outcome: SDHtmlMarkdownOutcome;
117
+ reviewMode: SDProjectionReviewMode;
118
+ evaluatedRevision: string;
119
+ story: StoryLocator;
120
+ scope: SDResolvedProjectionScope;
121
+ lossy: boolean;
122
+ diagnostics: SDProjectionDiagnostic[];
123
+ blocks: SDProjectionBlockMapEntry[];
124
+ annotations: SDProjectionAnnotation[];
125
+ sourceMap?: SDProjectionSourceMap;
126
+ }
127
+ export declare function deriveSDHtmlMarkdownOutcome(diagnostics: readonly Pick<SDDiagnostic, 'severity' | 'lossy'>[]): SDHtmlMarkdownOutcome;
128
+ export declare function deriveSDProjectionStatus(diagnostics: readonly Pick<SDProjectionDiagnostic, 'severity' | 'lossy'>[]): SDProjectionStatus;
129
+ 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
  };
@@ -261,4 +264,4 @@ export type PlanExecutionError = {
261
264
  stepId?: string;
262
265
  details?: unknown;
263
266
  };
264
- 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;
@@ -1,13 +1,16 @@
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
- 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';
4
+ import { BodyStoryLocator } from './story.types.js';
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];
5
8
  export interface SDError {
6
9
  code: SDErrorCode;
7
10
  message: string;
8
11
  path?: Array<string | number>;
9
12
  /** The target that caused the error, when available. */
10
- target?: BlockNodeAddress | TextAddress | SelectionTarget;
13
+ target?: BlockNodeAddress | TextAddress | SelectionTarget | BodyStoryLocator;
11
14
  details?: Record<string, unknown>;
12
15
  }
13
16
  /**
@@ -15,10 +18,13 @@ export interface SDError {
15
18
  *
16
19
  * - `TextAddress` (`kind: 'text'`): text-level insert/replace with block-relative offsets.
17
20
  * - `BlockNodeAddress` (`kind: 'block'`): structural insert/replace targeting a whole block.
21
+ * - `BodyStoryLocator` (`kind: 'story'`): explicit complete-main-body replacement.
18
22
  */
19
- export type MutationResolutionTarget = TextAddress | BlockNodeAddress;
23
+ export type MutationResolutionTarget = TextAddress | BlockNodeAddress | BodyStoryLocator;
20
24
  export interface SDMutationReceipt {
21
25
  success: boolean;
26
+ /** Rich HTML/Markdown fidelity outcome, when this receipt came from a rich write. */
27
+ outcome?: SDHtmlMarkdownOutcome;
22
28
  failure?: SDError;
23
29
  evaluatedRevision?: {
24
30
  before: string;
@@ -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 {};
@@ -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;
@@ -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;
@@ -0,0 +1,77 @@
1
+ import { FlowBlock, LayoutSourceIdentity } from '../../../../contracts/src/index.js';
2
+ /** Opaque adapter-issued identity. The painter never derives this value from DOM or block ids. */
3
+ export type WebFlowStableDomKey = string;
4
+ export interface WebFlowPaintItem {
5
+ readonly stableDomKey: WebFlowStableDomKey;
6
+ readonly renderFingerprint: string;
7
+ readonly block: FlowBlock;
8
+ readonly layoutEpoch?: number;
9
+ readonly layoutIdentities?: readonly LayoutSourceIdentity[];
10
+ readonly editable?: boolean;
11
+ }
12
+ export type WebFlowPaintCommand = {
13
+ readonly kind: 'replace-all';
14
+ readonly epoch: number;
15
+ readonly items: readonly WebFlowPaintItem[];
16
+ } | {
17
+ readonly kind: 'splice';
18
+ readonly expectedBaseEpoch: number;
19
+ readonly epoch: number;
20
+ readonly storyKey: string;
21
+ readonly expectedRemovedKeys: readonly WebFlowStableDomKey[];
22
+ readonly expectedLeftKey: WebFlowStableDomKey | null;
23
+ readonly expectedRightKey: WebFlowStableDomKey | null;
24
+ readonly items: readonly WebFlowPaintItem[];
25
+ /** Identity-only updates for retained nodes downstream of a structural splice. */
26
+ readonly retainedRebases?: readonly WebFlowPaintItem[];
27
+ };
28
+ export interface WebFlowPaintWorkSummary {
29
+ readonly kind: WebFlowPaintCommand['kind'];
30
+ readonly retainedNodes: number;
31
+ readonly createdNodes: number;
32
+ readonly removedNodes: number;
33
+ readonly rebasedNodes: number;
34
+ readonly touchedItems: number;
35
+ }
36
+ export interface WebFlowDomBinding {
37
+ readonly key: WebFlowStableDomKey;
38
+ readonly renderFingerprint: string;
39
+ readonly blockId: string;
40
+ readonly node: HTMLElement;
41
+ }
42
+ export interface WebFlowPaintSnapshot {
43
+ readonly epoch: number | null;
44
+ readonly version: number;
45
+ readonly bindings: readonly WebFlowDomBinding[];
46
+ }
47
+ export interface WebFlowAppliedPaint {
48
+ readonly work: WebFlowPaintWorkSummary;
49
+ /** Bindings directly owned by this command; localized splices never scan the retained root. */
50
+ readonly touchedBindings: readonly WebFlowDomBinding[];
51
+ /** Bindings whose DOM node or retained identity changed in this command. */
52
+ readonly changedBindings: readonly WebFlowDomBinding[];
53
+ }
54
+ export interface WebFlowPaintTransaction {
55
+ readonly command: WebFlowPaintCommand;
56
+ /** Installs the candidate synchronously. The caller must then finalize or roll it back. */
57
+ apply(): WebFlowAppliedPaint;
58
+ /** Publishes the applied state and releases the rollback journal. */
59
+ finalize(): WebFlowAppliedPaint;
60
+ /** Restores the exact pre-apply DOM and retained state. */
61
+ rollback(): void;
62
+ }
63
+ export interface WebFlowPainterHandle {
64
+ prepare(command: WebFlowPaintCommand): WebFlowPaintTransaction;
65
+ snapshot(): WebFlowPaintSnapshot;
66
+ /** Rebuilds the last committed derived DOM after an externally owned mutation. */
67
+ restoreCommittedDomAfterUnownedMutation(): WebFlowPaintSnapshot;
68
+ dispose(): void;
69
+ }
70
+ export interface WebFlowPainterOptions {
71
+ readonly resolvePhysical?: (cssFontFamily: string, face: {
72
+ weight: '400' | '700';
73
+ style: 'normal' | 'italic';
74
+ }) => string;
75
+ /** Fires synchronously when the mutation observer first detects unowned DOM. */
76
+ readonly onUnownedMutation?: (kind: 'text' | 'dom') => void;
77
+ }
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CwCvqMOa.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
3
3
  let react = require("react");
4
4
  //#region src/public/ui/react.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DCjm-_Xo.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  //#region src/public/ui/react.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CwCvqMOa.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-DCjm-_Xo.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
@@ -127,10 +127,9 @@ export type HyperlinkGetResult = {
127
127
  };
128
128
  /**
129
129
  * Result of `doc.bookmarks.get()` as read here (Document API `BookmarkInfo`).
130
- * `range.from.blockId` is the bookmark's `w14:paraId`, used to find/reveal
131
- * the target paragraph. `address.story` is populated for non-body
132
- * bookmarks (omitted for body) — used to scope this fix to body targets,
133
- * since `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
130
+ * `range.from.blockId` identifies the model paragraph sent to the viewport.
131
+ * `address.story` is populated for non-body bookmarks (omitted for body),
132
+ * which keeps anchor navigation scoped to body targets.
134
133
  */
135
134
  export type BookmarkGetResult = {
136
135
  address?: {
@@ -184,16 +183,6 @@ export type LinkPopoverDocumentApi = {
184
183
  }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined;
185
184
  } | null | undefined;
186
185
  };
187
- /**
188
- * Result of `activeEditor.pageMetrics.revealBodyTarget()` as read here
189
- * (`V2EditorHostRevealBodyTargetResult`). Only available in editing/
190
- * suggesting mode — the host rejects with `editing-not-mounted` in
191
- * viewing mode.
192
- */
193
- export type RevealBodyTargetResult = {
194
- status?: "rejected" | "revealed" | undefined;
195
- reason?: string | undefined;
196
- };
197
186
  /**
198
187
  * The `v2-link-click` payload the shell relays from the v2 host's
199
188
  * `onLinkClick` callback.
@@ -2543,7 +2543,11 @@ export type ViewLayout = 'print' | 'web';
2543
2543
  * Mirrors OOXML document view settings.
2544
2544
  */
2545
2545
  export interface ViewOptions {
2546
- /** Document view layout (OOXML ST_View compatible). */
2546
+ /**
2547
+ * Document view layout (OOXML ST_View compatible). In the browser editor,
2548
+ * `'web'` selects the retained semantic DOM surface. Browser normal flow
2549
+ * rewraps content as the editor container changes width.
2550
+ */
2547
2551
  layout?: ViewLayout;
2548
2552
  }
2549
2553
  export interface ExportParams {
@@ -3378,6 +3382,11 @@ export interface Config {
3378
3382
  experimental?: {
3379
3383
  unifiedHistory?: boolean;
3380
3384
  v2Host?: boolean;
3385
+ /**
3386
+ * Temporary V2 web-surface rollout control. The value is snapshotted at
3387
+ * mount and changing it requires a remount. This is not a stable renderer API.
3388
+ */
3389
+ v2WebSurface?: 'dense-control' | 'retained-dom';
3381
3390
  /**
3382
3391
  * Derived-invalidation deferral for direct single-paragraph edits (v2
3383
3392
  * engine only). Field display text settles off the keystroke path under
@@ -3605,10 +3614,8 @@ export interface Config {
3605
3614
  */
3606
3615
  workerStartupTimeoutMs?: number;
3607
3616
  /**
3608
- * Opt-in toggle for the layout engine. Auto-disabled when web layout is
3609
- * requested without `layoutEngineOptions.flowMode === 'semantic'`; the
3610
- * loader logs a warning and falls back to the legacy ProseMirror render
3611
- * path in that case.
3617
+ * Compatibility toggle retained for existing configurations. V2 always
3618
+ * uses the OOXML kernel; `viewOptions.layout` selects the mounted renderer.
3612
3619
  */
3613
3620
  useLayoutEngine?: boolean;
3614
3621
  /**
@@ -2,9 +2,8 @@
2
2
  * Classify the tracked-change identities carried by a v2 mutation event.
3
3
  *
4
4
  * Receipt entities are the durable invalidation contract between the document
5
- * kernel and derived review UI. Consumers apply removals/remaps locally; the
6
- * next committed window supplies surviving or restored rows. History follows
7
- * the same bounded path and never enumerates invisible review identities.
5
+ * kernel and derived review UI. Direct receipts carry entity refs; mutation
6
+ * plans carry the same identities through `trackedChanges` and per-step ids.
8
7
  */
9
8
  export function getV2TrackedChangeMutationImpact(event: any): {
10
9
  allResolved?: any;
@@ -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';