superdoc 2.24.0-next.1 → 2.24.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 (52) hide show
  1. package/dist/chunks/{create-super-doc-ui-DFNXiKvQ.es.js → create-super-doc-ui-8UTu16Lw.es.js} +229 -82
  2. package/dist/chunks/{create-super-doc-ui-D_FbXpOQ.cjs → create-super-doc-ui-bTFGKVRb.cjs} +229 -82
  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/authorities/authorities.types.d.ts +2 -0
  6. package/dist/document-api/src/bookmarks/bookmarks.types.d.ts +1 -0
  7. package/dist/document-api/src/capabilities/html-markdown-support.d.ts +2 -4
  8. package/dist/document-api/src/captions/captions.types.d.ts +1 -0
  9. package/dist/document-api/src/citations/citations.types.d.ts +2 -0
  10. package/dist/document-api/src/content-controls/content-controls.types.d.ts +1 -0
  11. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  12. package/dist/document-api/src/contract/operation-definitions.d.ts +15 -5
  13. package/dist/document-api/src/cross-refs/cross-refs.types.d.ts +1 -0
  14. package/dist/document-api/src/fields/fields.types.d.ts +1 -0
  15. package/dist/document-api/src/footnotes/footnotes.types.d.ts +2 -0
  16. package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +1 -0
  17. package/dist/document-api/src/images/images.types.d.ts +2 -0
  18. package/dist/document-api/src/index/index.types.d.ts +2 -0
  19. package/dist/document-api/src/index.d.ts +6 -6
  20. package/dist/document-api/src/insert/insert.d.ts +7 -1
  21. package/dist/document-api/src/lists/lists.types.d.ts +10 -0
  22. package/dist/document-api/src/paragraphs/paragraphs.types.d.ts +3 -0
  23. package/dist/document-api/src/receipt-bridge.d.ts +1 -0
  24. package/dist/document-api/src/replace/replace.d.ts +31 -4
  25. package/dist/document-api/src/sections/sections.types.d.ts +4 -1
  26. package/dist/document-api/src/selection/selection.d.ts +9 -2
  27. package/dist/document-api/src/selection/selection.types.d.ts +57 -8
  28. package/dist/document-api/src/toc/toc.types.d.ts +3 -0
  29. package/dist/document-api/src/types/blocks.types.d.ts +6 -1
  30. package/dist/document-api/src/types/create.types.d.ts +3 -1
  31. package/dist/document-api/src/types/mutation-plan.types.d.ts +4 -0
  32. package/dist/document-api/src/types/receipt.d.ts +8 -0
  33. package/dist/document-api/src/types/sd-contract.d.ts +2 -0
  34. package/dist/document-api/src/types/table-operations.types.d.ts +2 -0
  35. package/dist/document-api/src/write/write.d.ts +4 -2
  36. package/dist/public/ui-react.cjs +1 -1
  37. package/dist/public/ui-react.es.js +1 -1
  38. package/dist/public/ui-vue.cjs +1 -1
  39. package/dist/public/ui-vue.es.js +1 -1
  40. package/dist/public/ui.cjs +1 -1
  41. package/dist/public/ui.es.js +1 -1
  42. package/dist/style.css +65 -65
  43. package/dist/style.layered.css +65 -65
  44. package/dist/superdoc/src/public/ui/types.d.ts +22 -0
  45. package/dist/superdoc/src/public/ui.d.cts +4 -0
  46. package/dist/superdoc/src/public/ui.d.ts +1 -1
  47. package/dist/superdoc.cjs +101 -43
  48. package/dist/superdoc.es.js +101 -43
  49. package/dist-cdn/style.layered.css +1 -1
  50. package/dist-cdn/superdoc.min.css +1 -1
  51. package/dist-cdn/superdoc.min.js +42 -42
  52. package/package.json +2 -2
@@ -28,7 +28,7 @@ export interface IntentGroupMeta {
28
28
  */
29
29
  inputExamples?: Record<string, unknown>[];
30
30
  }
31
- export declare const V1_RUNTIME_UNAVAILABLE_OPERATION_IDS: readonly ["blocks.split", "blocks.merge", "blocks.move", "lists.getState", "lists.apply", "lists.continue", "lists.restart", "lists.remove", "format.paragraph.setMarkRunProps", "tables.moveRow", "tables.moveColumn"];
31
+ export declare const V1_RUNTIME_UNAVAILABLE_OPERATION_IDS: readonly ["selection.releaseSnapshot", "blocks.split", "blocks.merge", "blocks.move", "lists.getState", "lists.apply", "lists.continue", "lists.restart", "lists.remove", "format.paragraph.setMarkRunProps", "tables.moveRow", "tables.moveColumn"];
32
32
  export declare const INTENT_GROUP_META: Record<string, IntentGroupMeta>;
33
33
  export declare const OPERATION_DEFINITIONS: {
34
34
  readonly 'styles.apply': {
@@ -1031,9 +1031,19 @@ export declare const OPERATION_DEFINITIONS: {
1031
1031
  readonly referenceDocPath: "selection/current.mdx";
1032
1032
  readonly referenceGroup: "selection";
1033
1033
  };
1034
+ readonly 'selection.releaseSnapshot': {
1035
+ readonly memberPath: "selection.releaseSnapshot";
1036
+ readonly description: string;
1037
+ readonly expectedResult: "Returns released=true when a same-session handle was removed; otherwise false.";
1038
+ readonly requiresDocumentContext: true;
1039
+ readonly metadata: CommandStaticMetadata;
1040
+ readonly referenceDocPath: "selection/release-snapshot.mdx";
1041
+ readonly referenceGroup: "selection";
1042
+ readonly batchable: false;
1043
+ };
1034
1044
  readonly 'selection.extractOoxml': {
1035
1045
  readonly memberPath: "selection.extractOoxml";
1036
- readonly description: "Capture a nonempty current or addressed selection as OOXML with its structure, context, and package dependencies.";
1046
+ readonly description: "Capture a nonempty current or addressed selection as portable OOXML with native dependencies. Optional retain:true keeps an exact same-session restoration handle for one complete standalone body paragraph; release it when unused. Unsupported retained contexts and collaboration reject.";
1037
1047
  readonly expectedResult: "Returns the selected OOXML, structural placement, source provenance, and required relationships and parts without changing the document.";
1038
1048
  readonly requiresDocumentContext: true;
1039
1049
  readonly metadata: CommandStaticMetadata;
@@ -3580,9 +3590,6 @@ export declare const OPERATION_DEFINITIONS: {
3580
3590
  readonly "format.border": OperationDefinitionEntry & {
3581
3591
  memberPath: "format.border";
3582
3592
  };
3583
- readonly "format.fitText": OperationDefinitionEntry & {
3584
- memberPath: "format.fitText";
3585
- };
3586
3593
  readonly "format.dstrike": OperationDefinitionEntry & {
3587
3594
  memberPath: "format.dstrike";
3588
3595
  };
@@ -3610,6 +3617,9 @@ export declare const OPERATION_DEFINITIONS: {
3610
3617
  readonly "format.kerning": OperationDefinitionEntry & {
3611
3618
  memberPath: "format.kerning";
3612
3619
  };
3620
+ readonly "format.fitText": OperationDefinitionEntry & {
3621
+ memberPath: "format.fitText";
3622
+ };
3613
3623
  readonly "format.rStyle": OperationDefinitionEntry & {
3614
3624
  memberPath: "format.rStyle";
3615
3625
  };
@@ -62,6 +62,7 @@ export interface CrossRefDomain {
62
62
  }
63
63
  export interface CrossRefMutationSuccess {
64
64
  success: true;
65
+ appliedChangeMode?: 'direct' | 'tracked';
65
66
  crossRef: CrossRefAddress;
66
67
  }
67
68
  export type CrossRefMutationResult = CrossRefMutationSuccess | AdapterMutationFailure;
@@ -84,6 +84,7 @@ export interface FieldDomain {
84
84
  }
85
85
  export interface FieldMutationSuccess {
86
86
  success: true;
87
+ appliedChangeMode?: 'direct' | 'tracked';
87
88
  field: FieldAddress;
88
89
  }
89
90
  export type FieldMutationResult = FieldMutationSuccess | AdapterMutationFailure;
@@ -94,11 +94,13 @@ export interface FootnoteDomain {
94
94
  }
95
95
  export interface FootnoteMutationSuccess {
96
96
  success: true;
97
+ appliedChangeMode?: 'direct' | 'tracked';
97
98
  footnote: FootnoteAddress;
98
99
  }
99
100
  export type FootnoteMutationResult = FootnoteMutationSuccess | AdapterMutationFailure;
100
101
  export interface FootnoteConfigSuccess {
101
102
  success: true;
103
+ appliedChangeMode?: 'direct' | 'tracked';
102
104
  }
103
105
  export type FootnoteConfigResult = FootnoteConfigSuccess | AdapterMutationFailure;
104
106
  export type FootnotesListResult = DiscoveryOutput<FootnoteDomain>;
@@ -76,6 +76,7 @@ export interface HyperlinkInfo {
76
76
  }
77
77
  export interface HyperlinkMutationSuccess {
78
78
  success: true;
79
+ appliedChangeMode?: 'direct' | 'tracked';
79
80
  hyperlink: HyperlinkTarget;
80
81
  }
81
82
  export interface HyperlinkMutationFailure {
@@ -188,6 +188,7 @@ export interface SetZOrderInput {
188
188
  }
189
189
  export interface CreateImageSuccessResult {
190
190
  success: true;
191
+ appliedChangeMode?: 'direct' | 'tracked';
191
192
  image: ImageAddress;
192
193
  trackedChangeRefs?: ReceiptInsert[];
193
194
  /** Commit id for the insertion, including its alt text when that was set in the same call. */
@@ -207,6 +208,7 @@ export interface ImagesListResult {
207
208
  }
208
209
  export interface ImagesMutationSuccessResult {
209
210
  success: true;
211
+ appliedChangeMode?: 'direct' | 'tracked';
210
212
  image: ImageAddress;
211
213
  trackedChangeRefs?: ReceiptInsert[];
212
214
  }
@@ -113,11 +113,13 @@ export interface IndexEntryDomain {
113
113
  }
114
114
  export interface IndexMutationSuccess {
115
115
  success: true;
116
+ appliedChangeMode?: 'direct' | 'tracked';
116
117
  index: IndexAddress;
117
118
  }
118
119
  export type IndexMutationResult = IndexMutationSuccess | AdapterMutationFailure;
119
120
  export interface IndexEntryMutationSuccess {
120
121
  success: true;
122
+ appliedChangeMode?: 'direct' | 'tracked';
121
123
  entry: IndexEntryAddress;
122
124
  }
123
125
  export type IndexEntryMutationResult = IndexEntryMutationSuccess | AdapterMutationFailure;
@@ -25,7 +25,7 @@ import { InsertInput } from './insert/insert.js';
25
25
  import { ResolveRangeInput, ResolveRangeOutput } from './ranges/ranges.types.js';
26
26
  import { SelectionApi, SelectionAdapter } from './selection/selection.js';
27
27
  import { ListsAdapter, ListsApi } from './lists/lists.js';
28
- import { ReplaceInput } from './replace/replace.js';
28
+ import { ReplaceInput, ReplaceMutationOptions } from './replace/replace.js';
29
29
  import { CreateAdapter, CreateApi } from './create/create.js';
30
30
  import { BlocksAdapter, BlocksApi } from './blocks/blocks.js';
31
31
  import { TableLocator, TableMutationResult, TablesConvertFromTextInput, TablesMoveInput, TablesSplitInput, TablesConvertToTextInput, TablesSetLayoutInput, TablesInsertRowInput, TablesDeleteRowInput, TablesMoveRowInput, TablesSetRowHeightInput, TablesDistributeRowsInput, TablesSetRowOptionsInput, TablesInsertColumnInput, TablesDeleteColumnInput, TablesMoveColumnInput, TablesSetColumnWidthInput, TablesDistributeColumnsInput, TablesInsertCellInput, TablesDeleteCellInput, TablesMergeCellsInput, TablesUnmergeCellsInput, TablesSplitCellInput, TablesSetCellPropertiesInput, TablesSetCellTextInput, TablesSortInput, TablesSetAltTextInput, TablesSetStyleInput, TablesClearStyleInput, TablesSetStyleOptionInput, TablesSetBorderInput, TablesClearBorderInput, TablesApplyBorderPresetInput, TablesSetShadingInput, TablesClearShadingInput, TablesSetTablePaddingInput, TablesSetCellPaddingInput, TablesSetCellSpacingInput, TablesClearCellSpacingInput, TablesApplyStyleInput, TablesSetBordersInput, TablesSetTableOptionsInput, TablesApplyPresetInput, TablesGetInput, TablesGetOutput, TablesGetCellsInput, TablesGetCellsOutput, TablesGetPropertiesInput, TablesGetPropertiesOutput, TablesGetStylesInput, TablesGetStylesOutput, TablesSetDefaultStyleInput, TablesClearDefaultStyleInput } from './types/table-operations.types.js';
@@ -77,8 +77,8 @@ export * from './export/export.types.js';
77
77
  export type { SelectionMutationAdapter, SelectionMutationRequest, SelectionInsertRequest, } from './selection-mutation.js';
78
78
  export type { RangeAnchor, DocumentEdgeAnchor, PointAnchor, RefBoundaryAnchor, ResolveRangeInput, ResolveRangeOutput, RangeBlockPreview, RangePreview, RangeResolverAdapter, ScrollIntoViewInput, ScrollIntoViewOutput, } from './ranges/index.js';
79
79
  export { executeResolveRange } from './ranges/index.js';
80
- export type { SelectionApi, SelectionAdapter, SelectionCurrentInput, SelectionExtractOoxmlInput, SelectionExtractOoxmlResult, SelectionOoxmlDependency, SelectionTableCellsTarget, TableSelectionInfo, SelectionInfo, } from './selection/selection.js';
81
- export { executeSelectionCurrent, executeSelectionExtractOoxml } from './selection/selection.js';
80
+ export type { SelectionApi, SelectionAdapter, SelectionCurrentInput, SelectionExtractOoxmlInput, SelectionExtractOoxmlResult, SelectionOoxmlDependency, OoxmlContentSource, SelectionReleaseSnapshotInput, SelectionReleaseSnapshotResult, SelectionTableCellsTarget, TableSelectionInfo, SelectionInfo, } from './selection/selection.js';
81
+ export { executeSelectionCurrent, executeSelectionExtractOoxml, executeSelectionReleaseSnapshot, } from './selection/selection.js';
82
82
  export type { HeaderFootersAdapter, HeaderFootersApi } from './header-footers/header-footers.js';
83
83
  export * from './header-footers/header-footers.types.js';
84
84
  export type { WatermarksAdapter, WatermarksApi } from './watermarks/watermarks.js';
@@ -175,9 +175,9 @@ export { DocumentApiValidationError } from './errors.js';
175
175
  export { textReceiptToSDReceipt, buildStructuralReceipt } from './receipt-bridge.js';
176
176
  export type { MutationReceiptBridgeContext, StructuralReceiptParams } from './receipt-bridge.js';
177
177
  export { isBlockNodeAddress } from './validation-primitives.js';
178
- export type { InsertInput, InsertContentType, TextInsertInput, PlainTextInsertInput, RichContentInsertInput, LegacyInsertInput, } from './insert/insert.js';
178
+ export type { InsertInput, InsertContentType, TextInsertInput, PlainTextInsertInput, RichContentInsertInput, NativeOoxmlInsertInput, LegacyInsertInput, } from './insert/insert.js';
179
179
  export { isStructuralInsertInput } from './insert/insert.js';
180
- export type { ReplaceInput, TextReplaceInput, RichContentReplaceInput } from './replace/replace.js';
180
+ export type { ReplaceInput, TextReplaceInput, RichContentReplaceInput, ReplaceMutationOptions, NativeOoxmlReplaceInput, SnapshotReplaceInput, ParagraphTextReplaceInput, } from './replace/replace.js';
181
181
  export { executeReplace, isStructuralReplaceInput, isRichContentReplaceInput } from './replace/replace.js';
182
182
  export { executeFind } from './find/find.js';
183
183
  export { validateDocumentFragment, validateSDFragment } from './validation/fragment-validator.js';
@@ -353,7 +353,7 @@ export interface DocumentApiSurface {
353
353
  replace(input: Exclude<import('./replace/replace.js').TextReplaceInput, {
354
354
  target: import('./types/story.types.js').BodyStoryLocator;
355
355
  }>, options: TrackedTextMutationOptions): SDMutationReceipt;
356
- replace(input: ReplaceInput, options?: RichContentMutationOptions): SDMutationReceipt;
356
+ replace(input: ReplaceInput, options?: ReplaceMutationOptions): SDMutationReceipt;
357
357
  /**
358
358
  * Delete text at a target range.
359
359
  */
@@ -1,3 +1,4 @@
1
+ import { OoxmlContentSource } from '../selection/selection.types.js';
1
2
  import { RichContentMutationOptions, TextMutationOptions, WriteAdapter } from '../write/write.js';
2
3
  import { SelectionTarget, TargetLocator, SDMutationReceipt } from '../types/index.js';
3
4
  import { SDInsertInput } from '../types/structural-input.js';
@@ -45,7 +46,12 @@ export type LegacyInsertInput = TextInsertInput;
45
46
  * Discrimination: presence of `content` (structural) vs `value` (text string).
46
47
  * These are mutually exclusive: providing both is an error.
47
48
  */
48
- export type InsertInput = TextInsertInput | RichContentInsertInput | SDInsertInput;
49
+ export type NativeOoxmlInsertInput = OoxmlContentSource & {
50
+ target?: SelectionTarget | BlockNodeAddress;
51
+ placement?: Placement;
52
+ in?: StoryLocator;
53
+ };
54
+ export type InsertInput = TextInsertInput | RichContentInsertInput | SDInsertInput | NativeOoxmlInsertInput;
49
55
  export type PlainTextInsertInput = TextInsertInput & {
50
56
  type?: 'text';
51
57
  };
@@ -358,12 +358,14 @@ export interface ListsCaptureTemplateSuccessResult {
358
358
  export type ListsCaptureTemplateResult = ListsCaptureTemplateSuccessResult | ListsFailureResult;
359
359
  export interface ListsInsertSuccessResult {
360
360
  success: true;
361
+ appliedChangeMode?: 'direct' | 'tracked';
361
362
  item: ListItemAddress;
362
363
  insertionPoint: TextAddress;
363
364
  trackedChangeRefs?: ReceiptInsert[];
364
365
  }
365
366
  export interface ListsMutateItemSuccessResult {
366
367
  success: true;
368
+ appliedChangeMode?: 'direct' | 'tracked';
367
369
  item: ListItemAddress;
368
370
  /** Tracked changes authored by this mutation when `changeMode` is tracked. */
369
371
  trackedChangeRefs?: ReceiptInsert[];
@@ -375,32 +377,38 @@ export interface ListsMutateItemSuccessResult {
375
377
  }
376
378
  export interface ListsCreateSuccessResult {
377
379
  success: true;
380
+ appliedChangeMode?: 'direct' | 'tracked';
378
381
  listId: string;
379
382
  item: ListItemAddress;
380
383
  }
381
384
  export interface ListsJoinSuccessResult {
382
385
  success: true;
386
+ appliedChangeMode?: 'direct' | 'tracked';
383
387
  listId: string;
384
388
  }
385
389
  export interface ListsSeparateSuccessResult {
386
390
  success: true;
391
+ appliedChangeMode?: 'direct' | 'tracked';
387
392
  listId: string;
388
393
  numId: number;
389
394
  }
390
395
  export interface ListsMergeSuccessResult {
391
396
  success: true;
397
+ appliedChangeMode?: 'direct' | 'tracked';
392
398
  listId: string;
393
399
  absorbedCount: number;
394
400
  removedEmptyBlocks: number;
395
401
  }
396
402
  export interface ListsSplitSuccessResult {
397
403
  success: true;
404
+ appliedChangeMode?: 'direct' | 'tracked';
398
405
  listId: string;
399
406
  numId: number;
400
407
  restartedAt: number | null;
401
408
  }
402
409
  export interface ListsDetachSuccessResult {
403
410
  success: true;
411
+ appliedChangeMode?: 'direct' | 'tracked';
404
412
  paragraph: {
405
413
  kind: 'block';
406
414
  nodeType: 'paragraph';
@@ -409,6 +417,7 @@ export interface ListsDetachSuccessResult {
409
417
  }
410
418
  export interface ListsConvertToTextSuccessResult {
411
419
  success: true;
420
+ appliedChangeMode?: 'direct' | 'tracked';
412
421
  paragraph: {
413
422
  kind: 'block';
414
423
  nodeType: 'paragraph';
@@ -440,6 +449,7 @@ export type ListsDetachResult = ListsDetachSuccessResult | ListsFailureResult;
440
449
  export type ListsConvertToTextResult = ListsConvertToTextSuccessResult | ListsFailureResult;
441
450
  export interface ListsDeleteSuccessResult {
442
451
  success: true;
452
+ appliedChangeMode?: 'direct' | 'tracked';
443
453
  /** Number of list items removed. */
444
454
  deletedCount: number;
445
455
  }
@@ -1,6 +1,7 @@
1
1
  import { BlockNodeAddress } from '../types/base.js';
2
2
  import { ReceiptFailure, ReceiptInsert } from '../types/receipt.js';
3
3
  import { SDRunProps } from '../types/sd-props.js';
4
+ import { ChangeMode } from '../write/write.js';
4
5
  export type ParagraphBlockType = 'paragraph' | 'heading' | 'listItem';
5
6
  export type ParagraphTarget = BlockNodeAddress & {
6
7
  nodeType: ParagraphBlockType;
@@ -12,6 +13,8 @@ export interface ParagraphMutationSuccess {
12
13
  success: true;
13
14
  target: ParagraphTarget;
14
15
  resolution: MutationResolution;
16
+ /** Mode applied to committed paragraph content; omitted when no content was committed. */
17
+ appliedChangeMode?: ChangeMode;
15
18
  /** Logical tracked-change entities created or revised by this mutation. */
16
19
  trackedChangeRefs?: ReceiptInsert[];
17
20
  }
@@ -7,6 +7,7 @@ export interface MutationReceiptBridgeContext {
7
7
  conversion?: SDMutationConversionReport;
8
8
  }
9
9
  interface CanonicalSuccessMetadata {
10
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
10
11
  id?: ReceiptSuccess['id'];
11
12
  inserted?: ReceiptSuccess['inserted'];
12
13
  updated?: ReceiptSuccess['updated'];
@@ -1,3 +1,4 @@
1
+ import { OoxmlContentSource } from '../selection/selection.types.js';
1
2
  import { RichContentMutationOptions, TextMutationOptions, WriteAdapter } from '../write/write.js';
2
3
  import { SelectionTarget } from '../types/address.js';
3
4
  import { SDMutationReceipt } from '../types/sd-contract.js';
@@ -47,11 +48,37 @@ export type RichContentReplaceInput = {
47
48
  /**
48
49
  * Input payload for the `doc.replace` operation.
49
50
  *
50
- * Discrimination: `text` (plain), `value` (HTML/Markdown), or `content` (SDFragment).
51
+ * Discrimination: `text`, typed `value`, `content`, portable `capture`, or retained `snapshotId`.
51
52
  */
52
- export type ReplaceInput = TextReplaceInput | RichContentReplaceInput | SDReplaceInput;
53
+ export type NativeOoxmlReplaceInput = OoxmlContentSource & {
54
+ target: SelectionTarget | BlockNodeAddress;
55
+ in?: StoryLocator;
56
+ nestingPolicy?: NestingPolicy;
57
+ };
58
+ export type SnapshotReplaceInput = {
59
+ target: BlockNodeAddress;
60
+ snapshotId: string;
61
+ in?: never;
62
+ };
63
+ export type ParagraphTextReplaceInput = {
64
+ target: BlockNodeAddress;
65
+ text: string;
66
+ in?: never;
67
+ };
68
+ export interface ReplaceMutationOptions extends RichContentMutationOptions {
69
+ /** Replace one paragraph's contents, retaining its identity and exact paragraph properties. */
70
+ replaceMode?: 'contents';
71
+ /** Compare the addressed paragraph with an unchanged retained snapshot before committing. */
72
+ expectedSnapshotId?: string;
73
+ }
74
+ type ReplaceExecutionOptions = ReplaceMutationOptions | (TextMutationOptions & {
75
+ replaceMode?: never;
76
+ expectedSnapshotId?: never;
77
+ });
78
+ export type ReplaceInput = TextReplaceInput | RichContentReplaceInput | SDReplaceInput | NativeOoxmlReplaceInput | SnapshotReplaceInput | ParagraphTextReplaceInput;
53
79
  /** Returns true when the input uses the structural SDFragment shape. */
54
80
  export declare function isStructuralReplaceInput(input: ReplaceInput): input is SDReplaceInput;
55
81
  export declare function isRichContentReplaceInput(input: ReplaceInput): input is RichContentReplaceInput;
56
- export declare function validateReplaceInput(input: unknown): asserts input is ReplaceInput;
57
- export declare function executeReplace(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: ReplaceInput, options?: RichContentMutationOptions | TextMutationOptions): SDMutationReceipt;
82
+ export declare function validateReplaceInput(input: unknown, options?: ReplaceExecutionOptions): asserts input is ReplaceInput;
83
+ export declare function executeReplace(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: ReplaceInput, options?: ReplaceExecutionOptions): SDMutationReceipt;
84
+ export {};
@@ -1,4 +1,4 @@
1
- import { BlockNodeAddress, ReceiptFailure } from '../types/index.js';
1
+ import { BlockNodeAddress, ChangeMode, ReceiptFailure } from '../types/index.js';
2
2
  import { DiscoveryOutput } from '../types/discovery.js';
3
3
  export type SectionAddress = {
4
4
  kind: 'section';
@@ -112,6 +112,8 @@ export type SectionsListResult = DiscoveryOutput<SectionDomain>;
112
112
  export interface SectionMutationSuccessResult {
113
113
  success: true;
114
114
  section: SectionAddress;
115
+ /** Committed review-aware content mode; omitted for dry runs, no-ops and non-reviewable settings. */
116
+ appliedChangeMode?: ChangeMode;
115
117
  }
116
118
  export interface SectionMutationFailureResult {
117
119
  success: false;
@@ -128,6 +130,7 @@ export interface DocumentMutationSuccessResult {
128
130
  export type DocumentMutationResult = DocumentMutationSuccessResult | SectionMutationFailureResult;
129
131
  export interface CreateSectionBreakSuccessResult {
130
132
  success: true;
133
+ appliedChangeMode?: 'direct' | 'tracked';
131
134
  section: SectionAddress;
132
135
  /**
133
136
  * Present only when the break is represented as a dedicated paragraph.
@@ -1,12 +1,14 @@
1
- import { SelectionCurrentInput, SelectionExtractOoxmlInput, SelectionExtractOoxmlResult, SelectionInfo } from './selection.types.js';
2
- export type { SelectionCurrentInput, SelectionExtractOoxmlInput, SelectionExtractOoxmlResult, SelectionOoxmlDependency, SelectionTableCellsTarget, TableSelectionInfo, SelectionInfo, } from './selection.types.js';
1
+ import { SelectionCurrentInput, SelectionExtractOoxmlInput, SelectionExtractOoxmlResult, SelectionInfo, SelectionReleaseSnapshotInput, SelectionReleaseSnapshotResult, OoxmlContentSource } from './selection.types.js';
2
+ export type { SelectionCurrentInput, SelectionExtractOoxmlInput, SelectionExtractOoxmlResult, SelectionOoxmlDependency, SelectionTableCellsTarget, TableSelectionInfo, SelectionInfo, SelectionReleaseSnapshotInput, SelectionReleaseSnapshotResult, OoxmlContentSource, } from './selection.types.js';
3
3
  /**
4
4
  * Engine-specific adapter for the selection API.
5
5
  */
6
6
  export interface SelectionAdapter {
7
+ readonly supportsRetainedOoxml?: boolean;
7
8
  /** Read the editor's current selection. */
8
9
  current(input: SelectionCurrentInput): SelectionInfo;
9
10
  extractOoxml(input: SelectionExtractOoxmlInput): SelectionExtractOoxmlResult;
11
+ releaseSnapshot?(input: SelectionReleaseSnapshotInput): SelectionReleaseSnapshotResult;
10
12
  }
11
13
  /**
12
14
  * Public selection API exposed on `editor.doc.selection`.
@@ -22,6 +24,11 @@ export interface SelectionApi {
22
24
  current(input?: SelectionCurrentInput): SelectionInfo;
23
25
  /** Capture the addressed selected OOXML and its package dependencies. */
24
26
  extractOoxml(input: SelectionExtractOoxmlInput): SelectionExtractOoxmlResult;
27
+ /** Release an exact restoration handle without changing document or history. */
28
+ releaseSnapshot(input: SelectionReleaseSnapshotInput): SelectionReleaseSnapshotResult;
25
29
  }
26
30
  export declare function executeSelectionExtractOoxml(adapter: SelectionAdapter, input: SelectionExtractOoxmlInput): SelectionExtractOoxmlResult;
27
31
  export declare function executeSelectionCurrent(adapter: SelectionAdapter, input?: SelectionCurrentInput): SelectionInfo;
32
+ export declare function executeSelectionReleaseSnapshot(adapter: SelectionAdapter, input: SelectionReleaseSnapshotInput): SelectionReleaseSnapshotResult;
33
+ export declare function isOoxmlContentSource<T>(input: T): input is T & OoxmlContentSource;
34
+ export declare function validateOoxmlContentSource(input: Record<string, unknown>): void;
@@ -1,6 +1,8 @@
1
1
  import { SelectionTarget, TextTarget } from '../types/address.js';
2
2
  export interface SelectionTableCellsTarget {
3
3
  kind: 'tableCells';
4
+ selectionMode?: 'cells';
5
+ isRectangular?: true;
4
6
  tableId: string;
5
7
  start: {
6
8
  rowIndex: number;
@@ -12,23 +14,43 @@ export interface SelectionTableCellsTarget {
12
14
  };
13
15
  story?: SelectionTarget['story'];
14
16
  }
15
- /** Table identity for a caret, rectangular cell selection, or whole-grid selection. */
16
- export interface TableSelectionInfo extends SelectionTableCellsTarget {
17
- /** `cell` includes a caret or text range contained in one cell. */
17
+ /** Table/cell context for the selection; bounds alone are not an editing target. */
18
+ export interface TableSelectionInfo {
19
+ kind: 'tableCells';
20
+ tableId: string;
21
+ story?: SelectionTarget['story'];
22
+ /** Inclusive logical bounds, including each selected owner's span. */
23
+ start: {
24
+ rowIndex: number;
25
+ columnIndex: number;
26
+ };
27
+ end: {
28
+ rowIndex: number;
29
+ columnIndex: number;
30
+ };
31
+ /** Whole-table identity requires whole-cell selection intent. */
18
32
  type: 'table' | 'cell' | 'cells';
19
- /** Selected cells in row-major order, using opaque Document API node IDs. */
33
+ /** Text context preserves exact character targets; cells denotes whole-cell intent. */
34
+ selectionMode: 'text' | 'cells';
35
+ /** Whether the exact cells fill the bounding rectangle without holes. */
36
+ isRectangular: boolean;
37
+ /** Exact logical owners in row-major order; vertical continuations are deduplicated. */
20
38
  cells: {
21
39
  nodeId: string;
22
40
  rowIndex: number;
23
41
  columnIndex: number;
42
+ rowspan: number;
43
+ colspan: number;
24
44
  }[];
25
45
  }
26
46
  export type SelectionExtractOoxmlInput = {
27
47
  at: SelectionTarget | SelectionTableCellsTarget;
28
48
  selection?: never;
49
+ retain?: boolean;
29
50
  } | {
30
51
  selection: 'current';
31
52
  at?: never;
53
+ retain?: boolean;
32
54
  };
33
55
  export interface SelectionOoxmlDependency {
34
56
  sourcePartUri: string;
@@ -43,6 +65,8 @@ export interface SelectionOoxmlDependency {
43
65
  export interface SelectionExtractOoxmlResult {
44
66
  /** Version of the serialized selection-capture manifest. */
45
67
  formatVersion: 1;
68
+ /** Same-session exact restoration handle, present only for retain:true. Release when unused. */
69
+ snapshotId?: string;
46
70
  at: SelectionTarget | SelectionTableCellsTarget;
47
71
  /** Source revision for provenance, never a read precondition. */
48
72
  evaluatedRevision: string;
@@ -68,6 +92,8 @@ export interface SelectionExtractOoxmlResult {
68
92
  story: SelectionTarget['story'] | null;
69
93
  partUri: string;
70
94
  paragraphStyleId: string | null;
95
+ /** Exact opaque package coordinate for a retained capture, for pairing with committed review UI. */
96
+ packageRevision?: string;
71
97
  };
72
98
  /** Source structure outside the selected visible content needed to interpret it. */
73
99
  context: {
@@ -123,6 +149,12 @@ export interface SelectionInfo {
123
149
  * full selection.
124
150
  */
125
151
  target: TextTarget | null;
152
+ /** Deletion-inclusive multi-block text coverage for range review decisions, when resolvable. */
153
+ trackedTarget?: TextTarget | null;
154
+ /** Whether this exact text range supports tracked-change decisions; excludes permissions. */
155
+ trackedChangeRangeDecisionSupported?: boolean;
156
+ /** Whether the selection covers every tracked-text fragment of each active change. */
157
+ trackedChangesWhollySelected?: boolean;
126
158
  /**
127
159
  * Explicit selection envelope for the current live selection, or `null` when
128
160
  * the runtime cannot project one truthfully.
@@ -132,10 +164,11 @@ export interface SelectionInfo {
132
164
  */
133
165
  selectionTarget?: SelectionTarget | null;
134
166
  /**
135
- * V2 browser table selection with inclusive, zero-based grid coordinates.
136
- * Rectangles in unmerged tables clear `target` and `selectionTarget`.
137
- * Rectangles in tables containing merged cells return null and empty text.
138
- * A single-cell caret/text range preserves its text targets and `empty` value.
167
+ * V2 browser cell context with inclusive, zero-based logical bounds.
168
+ * Whole-cell selections clear text targets. Character selections preserve
169
+ * their targets and include the containing cells, including endpoint cells.
170
+ * Exact cell IDs and spans describe merged or nonrectangular selections;
171
+ * only rectangular whole-cell metadata can become a table-cells target.
139
172
  */
140
173
  tableSelection?: TableSelectionInfo | null;
141
174
  /**
@@ -176,3 +209,19 @@ export interface SelectionInfo {
176
209
  */
177
210
  text?: string;
178
211
  }
212
+ /** Native source shared by insert and replace; portable captures copy with fresh identities. */
213
+ export type OoxmlContentSource = {
214
+ type: 'ooxml';
215
+ value: string;
216
+ namespaces: Record<string, string>;
217
+ dependencies?: SelectionOoxmlDependency[];
218
+ sourcePartUri?: string;
219
+ } | {
220
+ capture: SelectionExtractOoxmlResult;
221
+ };
222
+ export interface SelectionReleaseSnapshotInput {
223
+ snapshotId: string;
224
+ }
225
+ export interface SelectionReleaseSnapshotResult {
226
+ released: boolean;
227
+ }
@@ -116,6 +116,7 @@ export interface TocRemoveInput {
116
116
  }
117
117
  export interface TocMutationSuccess {
118
118
  success: true;
119
+ appliedChangeMode?: 'direct' | 'tracked';
119
120
  toc: TocAddress;
120
121
  }
121
122
  export interface TocMutationFailure {
@@ -147,6 +148,7 @@ export interface CreateTableOfContentsInput {
147
148
  }
148
149
  export interface CreateTableOfContentsSuccess {
149
150
  success: true;
151
+ appliedChangeMode?: 'direct' | 'tracked';
150
152
  toc: TocAddress;
151
153
  }
152
154
  export interface CreateTableOfContentsFailure {
@@ -238,6 +240,7 @@ export interface TocEntryDomain {
238
240
  export type TocListEntriesResult = DiscoveryOutput<TocEntryDomain>;
239
241
  export interface TocEntryMutationSuccess {
240
242
  success: true;
243
+ appliedChangeMode?: 'direct' | 'tracked';
241
244
  entry: TocEntryAddress;
242
245
  }
243
246
  export interface TocEntryMutationFailure {
@@ -1,5 +1,5 @@
1
1
  import { BlockNodeType, BlockNodeAddress, DeletableBlockNodeAddress } from './base.js';
2
- import { AffectedRef, AffectedRefRemapping, Receipt, ReceiptFailure, ReceiptInsert, TextRangeShift } from './receipt.js';
2
+ import { AffectedRef, AffectedRefRemapping, Receipt, ReceiptFailure, ReceiptInsert, ReceiptSuccess, TextRangeShift } from './receipt.js';
3
3
  import { StoryLocator } from './story.types.js';
4
4
  import { ParagraphNumbering } from './paragraph.types.js';
5
5
  import { SDProjectionReviewMode } from './content-projection.js';
@@ -117,6 +117,7 @@ export interface BlocksDeleteInput {
117
117
  }
118
118
  export interface BlocksDeleteResult {
119
119
  success: true;
120
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
120
121
  deleted: DeletableBlockNodeAddress;
121
122
  deletedBlock?: DeletedBlockSummary;
122
123
  trackedChangeRefs?: ReceiptInsert[];
@@ -145,6 +146,7 @@ export interface BlocksSplitInput {
145
146
  }
146
147
  export interface BlocksSplitSuccessResult {
147
148
  success: true;
149
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
148
150
  /** Address of the new paragraph created by the split (the tail). */
149
151
  inserted: BlockNodeAddress;
150
152
  /**
@@ -173,6 +175,7 @@ export interface BlocksMergeInput {
173
175
  }
174
176
  export interface BlocksMergeSuccessResult {
175
177
  success: true;
178
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
176
179
  /** Address of the paragraph that was removed (the second paragraph). */
177
180
  removed: BlockNodeAddress;
178
181
  /**
@@ -208,6 +211,7 @@ export interface BlocksMoveInput {
208
211
  }
209
212
  export interface BlocksMoveSuccessResult {
210
213
  success: true;
214
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
211
215
  /** Same `source` paragraph, now relocated. */
212
216
  moved: BlockNodeAddress;
213
217
  remappedRefs?: AffectedRefRemapping[];
@@ -229,6 +233,7 @@ export type BlocksMoveResult = BlocksMoveSuccessResult | BlocksMoveFailureResult
229
233
  export type { Receipt };
230
234
  export interface BlocksDeleteRangeResult {
231
235
  success: true;
236
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
232
237
  deletedCount: number;
233
238
  deletedBlocks: DeletedBlockSummary[];
234
239
  revision: {
@@ -1,7 +1,7 @@
1
1
  import { TextAddress } from './address.js';
2
2
  import { BlockNodeAddress } from './base.js';
3
3
  import { ResolvedHandle } from './discovery.js';
4
- import { ReceiptFailure, ReceiptInsert } from './receipt.js';
4
+ import { ReceiptFailure, ReceiptInsert, ReceiptSuccess } from './receipt.js';
5
5
  import { StoryLocator } from './story.types.js';
6
6
  export type ParagraphCreateLocation = {
7
7
  kind: 'documentStart';
@@ -29,6 +29,7 @@ export interface CreateParagraphInput {
29
29
  }
30
30
  export interface CreateParagraphSuccessResult {
31
31
  success: true;
32
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
32
33
  paragraph: BlockNodeAddress;
33
34
  insertionPoint: TextAddress;
34
35
  trackedChangeRefs?: ReceiptInsert[];
@@ -95,6 +96,7 @@ export interface CreateHeadingInput {
95
96
  }
96
97
  export interface CreateHeadingSuccessResult {
97
98
  success: true;
99
+ appliedChangeMode?: ReceiptSuccess['appliedChangeMode'];
98
100
  heading: BlockNodeAddress;
99
101
  insertionPoint: TextAddress;
100
102
  trackedChangeRefs?: ReceiptInsert[];
@@ -233,6 +233,8 @@ export type StructuralStepData = {
233
233
  export type StepOutcomeData = TextStepData | AssertStepData | DomainStepData | TableStepData | StructuralStepData;
234
234
  export type StepOutcome = {
235
235
  stepId: string;
236
+ /** Effective mode when all committed requests in this step used the same mode. */
237
+ appliedChangeMode?: ChangeMode;
236
238
  op: string;
237
239
  effect: StepEffect;
238
240
  matchCount: number;
@@ -241,6 +243,8 @@ export type StepOutcome = {
241
243
  };
242
244
  export type PlanReceipt = {
243
245
  success: true;
246
+ /** Effective mode when every committed step used the same mode. */
247
+ appliedChangeMode?: ChangeMode;
244
248
  revision: {
245
249
  before: string;
246
250
  after: string;
@@ -2,6 +2,7 @@ import { BlockNavigationAddress, EntityAddress, SelectionTarget, TextAddress, Tr
2
2
  import { BlockNodeAddress } from './base.js';
3
3
  import { BookmarkAddress } from '../bookmarks/bookmarks.types.js';
4
4
  import { StoryLocator } from './story.types.js';
5
+ import { ChangeMode } from '../write/write.js';
5
6
  export type ReceiptInsert = TrackedChangeAddress;
6
7
  export type ReceiptEntity = EntityAddress;
7
8
  export type AffectedRef = TextAddress | BookmarkAddress | EntityAddress | BlockNavigationAddress;
@@ -109,6 +110,13 @@ export interface ReceiptEffects {
109
110
  }
110
111
  export type ReceiptSuccess = {
111
112
  success: true;
113
+ /**
114
+ * Mode in which this call's document content was committed. An edit folded
115
+ * into the author's existing insertion is tracked; auxiliary style and
116
+ * numbering definition writes do not change the content mode. Omitted for
117
+ * dry runs, no-ops, and operations that do not author reviewable content.
118
+ */
119
+ appliedChangeMode?: ChangeMode;
112
120
  /**
113
121
  * Convenience id for operations that create exactly one primary durable entity.
114
122
  * Generic consumers should prefer `inserted`; this field exists for simple