@beyondwork/docx-react-component 1.0.28 → 1.0.30

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 (92) hide show
  1. package/package.json +26 -37
  2. package/src/api/public-types.ts +531 -0
  3. package/src/api/session-state.ts +2 -0
  4. package/src/core/commands/index.ts +201 -79
  5. package/src/core/commands/table-structure-commands.ts +138 -5
  6. package/src/core/state/text-transaction.ts +370 -3
  7. package/src/index.ts +41 -0
  8. package/src/io/docx-session.ts +318 -25
  9. package/src/io/export/serialize-footnotes.ts +41 -46
  10. package/src/io/export/serialize-headers-footers.ts +36 -40
  11. package/src/io/export/serialize-main-document.ts +55 -89
  12. package/src/io/export/serialize-numbering.ts +104 -4
  13. package/src/io/export/serialize-runtime-revisions.ts +196 -2
  14. package/src/io/export/split-story-blocks-for-runtime-revisions.ts +252 -0
  15. package/src/io/export/table-properties-xml.ts +318 -0
  16. package/src/io/normalize/normalize-text.ts +34 -3
  17. package/src/io/ooxml/parse-comments.ts +6 -0
  18. package/src/io/ooxml/parse-footnotes.ts +69 -13
  19. package/src/io/ooxml/parse-headers-footers.ts +54 -11
  20. package/src/io/ooxml/parse-main-document.ts +112 -42
  21. package/src/io/ooxml/parse-numbering.ts +341 -26
  22. package/src/io/ooxml/parse-revisions.ts +118 -4
  23. package/src/io/ooxml/parse-styles.ts +176 -0
  24. package/src/io/ooxml/parse-tables.ts +34 -25
  25. package/src/io/ooxml/revision-boundaries.ts +127 -3
  26. package/src/io/ooxml/workflow-payload.ts +544 -0
  27. package/src/model/canonical-document.ts +91 -1
  28. package/src/model/snapshot.ts +112 -1
  29. package/src/preservation/store.ts +73 -3
  30. package/src/review/store/comment-store.ts +19 -1
  31. package/src/review/store/revision-actions.ts +29 -0
  32. package/src/review/store/revision-store.ts +12 -1
  33. package/src/review/store/revision-types.ts +11 -0
  34. package/src/runtime/context-analytics.ts +824 -0
  35. package/src/runtime/document-locations.ts +521 -0
  36. package/src/runtime/document-navigation.ts +14 -1
  37. package/src/runtime/document-outline.ts +440 -0
  38. package/src/runtime/document-runtime.ts +941 -45
  39. package/src/runtime/event-refresh-hints.ts +137 -0
  40. package/src/runtime/numbering-prefix.ts +67 -39
  41. package/src/runtime/page-layout-estimation.ts +100 -7
  42. package/src/runtime/resolved-numbering-geometry.ts +293 -0
  43. package/src/runtime/session-capabilities.ts +2 -2
  44. package/src/runtime/suggestions-snapshot.ts +137 -0
  45. package/src/runtime/surface-projection.ts +223 -27
  46. package/src/runtime/table-style-resolver.ts +409 -0
  47. package/src/runtime/view-state.ts +17 -1
  48. package/src/runtime/workflow-markup.ts +54 -14
  49. package/src/ui/WordReviewEditor.tsx +1269 -87
  50. package/src/ui/editor-command-bag.ts +7 -0
  51. package/src/ui/editor-runtime-boundary.ts +111 -10
  52. package/src/ui/editor-shell-view.tsx +17 -15
  53. package/src/ui/editor-surface-controller.tsx +5 -0
  54. package/src/ui/headless/selection-tool-context.ts +19 -0
  55. package/src/ui/headless/selection-tool-resolver.ts +752 -0
  56. package/src/ui/headless/selection-tool-types.ts +129 -0
  57. package/src/ui/headless/selection-toolbar-model.ts +10 -33
  58. package/src/ui/runtime-shortcut-dispatch.ts +365 -0
  59. package/src/ui-tailwind/chrome/chrome-preset-model.ts +107 -0
  60. package/src/ui-tailwind/chrome/chrome-preset-toolbar.tsx +15 -0
  61. package/src/ui-tailwind/chrome/review-queue-bar.tsx +97 -0
  62. package/src/ui-tailwind/chrome/tw-context-analytics-summary.tsx +122 -0
  63. package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +1 -9
  64. package/src/ui-tailwind/chrome/tw-object-context-toolbar.tsx +1 -5
  65. package/src/ui-tailwind/chrome/tw-page-ruler.tsx +8 -29
  66. package/src/ui-tailwind/chrome/tw-selection-tool-blocked.tsx +23 -0
  67. package/src/ui-tailwind/chrome/tw-selection-tool-comment.tsx +35 -0
  68. package/src/ui-tailwind/chrome/tw-selection-tool-formatting.tsx +37 -0
  69. package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +298 -0
  70. package/src/ui-tailwind/chrome/tw-selection-tool-structure.tsx +116 -0
  71. package/src/ui-tailwind/chrome/tw-selection-tool-suggestion.tsx +29 -0
  72. package/src/ui-tailwind/chrome/tw-selection-tool-workflow.tsx +27 -0
  73. package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +3 -3
  74. package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +3 -3
  75. package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +86 -14
  76. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +57 -52
  77. package/src/ui-tailwind/editor-surface/pm-decorations.ts +36 -52
  78. package/src/ui-tailwind/editor-surface/pm-schema.ts +56 -5
  79. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +87 -24
  80. package/src/ui-tailwind/editor-surface/surface-build-keys.ts +4 -0
  81. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +135 -32
  82. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +74 -7
  83. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +17 -17
  84. package/src/ui-tailwind/review/tw-review-rail.tsx +19 -17
  85. package/src/ui-tailwind/review/tw-revision-sidebar.tsx +10 -10
  86. package/src/ui-tailwind/status/tw-status-bar.tsx +10 -6
  87. package/src/ui-tailwind/theme/editor-theme.css +58 -40
  88. package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +4 -4
  89. package/src/ui-tailwind/toolbar/tw-toolbar.tsx +250 -181
  90. package/src/ui-tailwind/tw-review-workspace.tsx +323 -280
  91. package/src/validation/compatibility-engine.ts +246 -2
  92. package/src/validation/docx-comment-proof.ts +24 -11
@@ -224,6 +224,8 @@ export interface CommentSidebarThreadSnapshot {
224
224
  createdBy: string;
225
225
  warningCount: number;
226
226
  anchorLabel: string;
227
+ detachedReason?: "incomplete-markers" | "multi-paragraph" | "opaque-region" | "revision-overlap";
228
+ actionabilityNote?: string;
227
229
  isActive: boolean;
228
230
  resolvedAt?: string;
229
231
  resolvedBy?: string;
@@ -232,6 +234,18 @@ export interface CommentSidebarThreadSnapshot {
232
234
  export interface TrackedChangeEntrySnapshot {
233
235
  revisionId: string;
234
236
  kind: "insertion" | "deletion" | "formatting" | "move" | "property-change";
237
+ source?: "runtime" | "import";
238
+ suggestionId?: string;
239
+ semanticKind?:
240
+ | "insertion"
241
+ | "deletion"
242
+ | "replacement"
243
+ | "formatting-change"
244
+ | "paragraph-property-change"
245
+ | "structural-change"
246
+ | "object-change";
247
+ linkedRevisionIds?: string[];
248
+ predecessorSuggestionId?: string;
235
249
  label: string;
236
250
  status: "active" | "accepted" | "rejected" | "detached";
237
251
  actionability: "actionable" | "preserve-only";
@@ -264,6 +278,45 @@ export interface TrackedChangesSnapshot {
264
278
  revisions: TrackedChangeEntrySnapshot[];
265
279
  }
266
280
 
281
+ export interface SuggestionEntrySnapshot {
282
+ suggestionId: string;
283
+ kind:
284
+ | "insertion"
285
+ | "deletion"
286
+ | "replacement"
287
+ | "formatting-change"
288
+ | "paragraph-property-change"
289
+ | "structural-change"
290
+ | "object-change";
291
+ source: "runtime" | "import";
292
+ status: "active" | "accepted" | "rejected" | "detached";
293
+ actionability: "actionable" | "preserve-only";
294
+ storyTarget: EditorStoryTarget;
295
+ anchor: EditorAnchorProjection;
296
+ anchorLabel: string;
297
+ createdAt: string;
298
+ authorId: string;
299
+ changeIds: string[];
300
+ editable: boolean;
301
+ canAccept: boolean;
302
+ canReject: boolean;
303
+ isReplacement: boolean;
304
+ preserveOnlyReason?: string;
305
+ excerpt?: string;
306
+ detail?: string;
307
+ }
308
+
309
+ export interface SuggestionsSnapshot {
310
+ totalCount: number;
311
+ actionableSuggestionIds: string[];
312
+ preserveOnlySuggestionIds: string[];
313
+ activeSuggestionIds: string[];
314
+ acceptedSuggestionIds: string[];
315
+ rejectedSuggestionIds: string[];
316
+ detachedSuggestionIds: string[];
317
+ suggestions: SuggestionEntrySnapshot[];
318
+ }
319
+
267
320
  export type FormattingAlignment = "left" | "center" | "right" | "justify";
268
321
 
269
322
  export interface FormattingBreadcrumbItem {
@@ -423,6 +476,118 @@ export interface TocRefreshResult {
423
476
  }>;
424
477
  }
425
478
 
479
+ export type DocumentLocationSource =
480
+ | { kind: "selection" }
481
+ | { kind: "search"; resultId?: string; query?: string }
482
+ | { kind: "workflow"; markupId?: string; candidateId?: string }
483
+ | { kind: "navigation" };
484
+
485
+ export interface DocumentLocationSnapshot {
486
+ locationId: string;
487
+ anchor: EditorAnchorProjection;
488
+ storyTarget?: EditorStoryTarget;
489
+ sectionIndex?: number;
490
+ pageIndex?: number;
491
+ headingId?: string;
492
+ headingPath?: string[];
493
+ bookmarkName?: string;
494
+ source: DocumentLocationSource;
495
+ }
496
+
497
+ export type RestorePointCheckpointType = "selection" | "search-result" | "workflow-item" | "manual";
498
+
499
+ export interface RestorePointSnapshot {
500
+ restorePointId: string;
501
+ location: DocumentLocationSnapshot;
502
+ revisionToken: string;
503
+ createdAt: string;
504
+ checkpointType: RestorePointCheckpointType;
505
+ }
506
+
507
+ export interface RestoreResult {
508
+ status: "restored" | "remapped" | "detached" | "blocked";
509
+ selection?: SelectionSnapshot;
510
+ location?: DocumentLocationSnapshot;
511
+ reasons?: string[];
512
+ }
513
+
514
+ export interface DocumentOutlineHeadingSnapshot extends DocumentHeadingSnapshot {
515
+ parentHeadingIds: string[];
516
+ }
517
+
518
+ export interface DocumentOutlineSnapshot {
519
+ activeHeadingId?: string;
520
+ headings: DocumentOutlineHeadingSnapshot[];
521
+ }
522
+
523
+ export interface TocEntrySnapshot {
524
+ tocEntryId: string;
525
+ level: number;
526
+ text: string;
527
+ pageIndex?: number;
528
+ anchor?: EditorAnchorProjection;
529
+ bookmarkName?: string;
530
+ headingId?: string;
531
+ }
532
+
533
+ export interface TocSnapshot {
534
+ status: "current" | "stale" | "missing";
535
+ sourceFieldIndex?: number;
536
+ instruction?: string;
537
+ entries: TocEntrySnapshot[];
538
+ }
539
+
540
+ export interface DocumentSectionSnapshot {
541
+ sectionId: string;
542
+ sectionIndex: number;
543
+ pageRange: { start: number; end: number };
544
+ headingPath: string[];
545
+ primaryHeadingId?: string;
546
+ primaryHeadingText?: string;
547
+ layout?: PageLayoutSnapshot;
548
+ anchor: EditorAnchorProjection;
549
+ storyTargets: EditorStoryTarget[];
550
+ }
551
+
552
+ export type SnapshotRefreshInvalidateTarget =
553
+ | "selection"
554
+ | "render"
555
+ | "navigation"
556
+ | "fields"
557
+ | "comments"
558
+ | "trackedChanges"
559
+ | "workflowScope"
560
+ | "workflowMarkup"
561
+ | "reviewWork"
562
+ | "contextAnalytics"
563
+ | "chunks"
564
+ | "outline"
565
+ | "toc"
566
+ | "sections"
567
+ | "locations"
568
+ | "textStream";
569
+
570
+ export type SnapshotRefreshStaleTarget =
571
+ | "search_results"
572
+ | "anchors"
573
+ | "selection_only"
574
+ | "none";
575
+
576
+ export type SnapshotRefreshChangeKind =
577
+ | "selection"
578
+ | "content"
579
+ | "review"
580
+ | "workflow"
581
+ | "structure"
582
+ | "checkpoint";
583
+
584
+ export interface SnapshotRefreshHints {
585
+ invalidate: SnapshotRefreshInvalidateTarget[];
586
+ staleTargets: SnapshotRefreshStaleTarget[];
587
+ changeKinds: SnapshotRefreshChangeKind[];
588
+ checkpointType?: "session" | "snapshot" | "export";
589
+ }
590
+
426
591
  export interface StyleCatalogEntrySnapshot {
427
592
  styleId: string;
428
593
  displayName: string;
@@ -513,6 +678,8 @@ export type SurfaceInlineSegment =
513
678
  warningId: string;
514
679
  label: string;
515
680
  detail: string;
681
+ featureKey?: string;
682
+ blockedReasonCode?: "workflow_preserve_only" | "workflow_blocked_import";
516
683
  presentation?: "inline-chip" | "quiet-marker";
517
684
  state: "locked-preserve-only";
518
685
  }
@@ -560,6 +727,26 @@ export interface SurfaceTableRowSnapshot {
560
727
  isHeader?: boolean;
561
728
  }
562
729
 
730
+ export interface ResolvedNumberingGeometrySnapshot {
731
+ markerJustification?: "left" | "center" | "right" | "both" | "distribute";
732
+ spacing?: { before?: number; after?: number; line?: number; lineRule?: string };
733
+ indentation?: { left?: number; right?: number; firstLine?: number; hanging?: number };
734
+ tabStops?: Array<{ pos: number; val?: string; leader?: string }>;
735
+ markerLane?: { start: number; width: number; textStart: number };
736
+ textColumn?: { start: number; right?: number; firstLine?: number; hanging?: number };
737
+ }
738
+
739
+ export interface ResolvedNumberingSnapshot {
740
+ level: number;
741
+ format: string;
742
+ text?: string;
743
+ startAt: number;
744
+ paragraphStyleId?: string;
745
+ isLegalNumbering?: boolean;
746
+ suffix?: "tab" | "space" | "nothing";
747
+ geometry: ResolvedNumberingGeometrySnapshot;
748
+ }
749
+
563
750
  export type SurfaceBlockSnapshot =
564
751
  | {
565
752
  blockId: string;
@@ -573,6 +760,7 @@ export type SurfaceBlockSnapshot =
573
760
  };
574
761
  numberingPrefix?: string;
575
762
  numberingSuffix?: "tab" | "space" | "nothing";
763
+ resolvedNumbering?: ResolvedNumberingSnapshot;
576
764
  alignment?: "left" | "center" | "right" | "both" | "distribute";
577
765
  spacing?: { before?: number; after?: number; line?: number; lineRule?: string };
578
766
  contextualSpacing?: boolean;
@@ -631,6 +819,8 @@ export type SurfaceBlockSnapshot =
631
819
  warningId: string;
632
820
  label: string;
633
821
  detail: string;
822
+ featureKey?: string;
823
+ blockedReasonCode?: "workflow_preserve_only" | "workflow_blocked_import";
634
824
  state: "locked-preserve-only";
635
825
  };
636
826
 
@@ -797,6 +987,39 @@ export interface ActiveNoteContext {
797
987
  referencePosition: number;
798
988
  }
799
989
 
990
+ export interface TableOperationCapabilitySnapshot {
991
+ enabled: boolean;
992
+ reason?: string;
993
+ }
994
+
995
+ export interface TableStructureContextSnapshot {
996
+ tableBlockIndex: number;
997
+ currentStyleId?: string | null;
998
+ selectionKind: "text" | "cell";
999
+ rowCount: number;
1000
+ columnCount: number;
1001
+ selectedCellCount: number;
1002
+ isSimpleTable: boolean;
1003
+ currentCell: {
1004
+ rowIndex: number;
1005
+ columnIndex: number;
1006
+ isHeader: boolean;
1007
+ };
1008
+ operations: {
1009
+ setTableStyle: TableOperationCapabilitySnapshot;
1010
+ setCellBackground: TableOperationCapabilitySnapshot;
1011
+ addRowBefore: TableOperationCapabilitySnapshot;
1012
+ addRowAfter: TableOperationCapabilitySnapshot;
1013
+ deleteRow: TableOperationCapabilitySnapshot;
1014
+ addColumnBefore: TableOperationCapabilitySnapshot;
1015
+ addColumnAfter: TableOperationCapabilitySnapshot;
1016
+ deleteColumn: TableOperationCapabilitySnapshot;
1017
+ mergeCells: TableOperationCapabilitySnapshot;
1018
+ splitCell: TableOperationCapabilitySnapshot;
1019
+ deleteTable: TableOperationCapabilitySnapshot;
1020
+ };
1021
+ }
1022
+
800
1023
  export interface PageRegionHitTest {
801
1024
  region: "body" | "header" | "footer" | "margin" | "gutter";
802
1025
  sectionIndex: number;
@@ -869,6 +1092,7 @@ export interface EditorSessionState {
869
1092
  warningLog: EditorWarning[];
870
1093
  protectionSnapshot?: ProtectionSnapshot;
871
1094
  sourcePackage?: RuntimePersistedEditorSnapshot["sourcePackage"];
1095
+ workflowMetadata?: WorkflowMetadataSnapshot;
872
1096
  }
873
1097
 
874
1098
  export interface PersistedEditorSnapshot {
@@ -885,6 +1109,7 @@ export interface PersistedEditorSnapshot {
885
1109
  warningLog: EditorWarning[];
886
1110
  protectionSnapshot?: ProtectionSnapshot;
887
1111
  sourcePackage?: RuntimePersistedEditorSnapshot["sourcePackage"];
1112
+ workflowMetadata?: WorkflowMetadataSnapshot;
888
1113
  }
889
1114
 
890
1115
  export interface AddCommentParams {
@@ -928,6 +1153,7 @@ export interface WorkflowScope {
928
1153
  workItemId?: string;
929
1154
  label?: string;
930
1155
  domain?: "legal" | "commercial" | "finance" | "other";
1156
+ metadataRefs?: string[];
931
1157
  }
932
1158
 
933
1159
  export interface WorkflowWorkItem {
@@ -947,6 +1173,36 @@ export interface WorkflowOverlay {
947
1173
  activeWorkItemId?: string | null;
948
1174
  }
949
1175
 
1176
+ export type WorkflowMetadataPersistence =
1177
+ | "runtime-only"
1178
+ | "session"
1179
+ | "document-metadata";
1180
+
1181
+ export interface WorkflowMetadataDefinition {
1182
+ metadataId: string;
1183
+ kind: string;
1184
+ label: string;
1185
+ color?: string;
1186
+ icon?: string;
1187
+ dataSchema?: Record<string, unknown>;
1188
+ persistence: WorkflowMetadataPersistence;
1189
+ }
1190
+
1191
+ export interface WorkflowMetadataEntry {
1192
+ entryId: string;
1193
+ metadataId: string;
1194
+ anchor: EditorAnchorProjection;
1195
+ storyTarget?: EditorStoryTarget;
1196
+ value?: Record<string, unknown>;
1197
+ scopeId?: string;
1198
+ workItemId?: string;
1199
+ }
1200
+
1201
+ export interface WorkflowMetadataSnapshot {
1202
+ definitions: WorkflowMetadataDefinition[];
1203
+ entries: WorkflowMetadataEntry[];
1204
+ }
1205
+
950
1206
  export interface WorkflowBlockedCommandReason {
951
1207
  code:
952
1208
  | "outside_workflow_scope"
@@ -981,12 +1237,19 @@ export interface InteractionGuardSnapshot {
981
1237
  effectiveMode: EffectiveSelectionMode;
982
1238
  matchedScopeId?: string;
983
1239
  matchedScopeMode?: WorkflowScopeMode;
1240
+ targetAccess?: "direct-edit" | "suggest" | "comment-only" | "view-only" | "blocked";
1241
+ commandCapabilities?: Array<{
1242
+ family: "text" | "formatting" | "structure";
1243
+ supported: boolean;
1244
+ blockedReasons: WorkflowBlockedCommandReason[];
1245
+ }>;
984
1246
  disabledReason?: string;
985
1247
  blockedReasons: WorkflowBlockedCommandReason[];
986
1248
  }
987
1249
 
988
1250
  export type WorkflowMarkupKind =
989
1251
  | "highlight"
1252
+ | "metadata"
990
1253
  | "comment"
991
1254
  | "revision"
992
1255
  | "field"
@@ -1008,6 +1271,18 @@ export interface WorkflowHighlightMarkup extends WorkflowMarkupBase {
1008
1271
  text: string;
1009
1272
  }
1010
1273
 
1274
+ export interface WorkflowMetadataMarkup extends WorkflowMarkupBase {
1275
+ kind: "metadata";
1276
+ entryId: string;
1277
+ metadataId: string;
1278
+ color?: string;
1279
+ icon?: string;
1280
+ persistence: WorkflowMetadataPersistence;
1281
+ value?: Record<string, unknown>;
1282
+ scopeId?: string;
1283
+ workItemId?: string;
1284
+ }
1285
+
1011
1286
  export interface WorkflowCommentMarkup extends WorkflowMarkupBase {
1012
1287
  kind: "comment";
1013
1288
  commentId: string;
@@ -1057,6 +1332,7 @@ export interface WorkflowOpaqueFragmentMarkup extends WorkflowMarkupBase {
1057
1332
 
1058
1333
  export type WorkflowMarkupItem =
1059
1334
  | WorkflowHighlightMarkup
1335
+ | WorkflowMetadataMarkup
1060
1336
  | WorkflowCommentMarkup
1061
1337
  | WorkflowRevisionMarkup
1062
1338
  | WorkflowFieldMarkup
@@ -1067,6 +1343,7 @@ export interface WorkflowMarkupSnapshot {
1067
1343
  totalCount: number;
1068
1344
  items: WorkflowMarkupItem[];
1069
1345
  highlights: WorkflowHighlightMarkup[];
1346
+ metadata: WorkflowMetadataMarkup[];
1070
1347
  comments: WorkflowCommentMarkup[];
1071
1348
  revisions: WorkflowRevisionMarkup[];
1072
1349
  fields: WorkflowFieldMarkup[];
@@ -1104,6 +1381,174 @@ export interface HostAnnotationSnapshot {
1104
1381
  annotations: HostAnnotationItem[];
1105
1382
  }
1106
1383
 
1384
+ export type ReviewQueueItemKind = "comment" | "change" | "section_mark";
1385
+
1386
+ export interface ReviewQueueItem {
1387
+ itemId: string;
1388
+ kind: ReviewQueueItemKind;
1389
+ label: string;
1390
+ storyTarget?: EditorStoryTarget;
1391
+ anchor: EditorAnchorProjection;
1392
+ sectionIndex?: number;
1393
+ pageIndex?: number;
1394
+ status: "open" | "resolved";
1395
+ actionable: boolean;
1396
+ }
1397
+
1398
+ export interface ReviewQueueSnapshot {
1399
+ totalCount: number;
1400
+ openCount: number;
1401
+ activeIndex: number;
1402
+ items: ReviewQueueItem[];
1403
+ }
1404
+
1405
+ export interface DocumentTextToken {
1406
+ tokenId: string;
1407
+ storyTarget?: EditorStoryTarget;
1408
+ blockId: string;
1409
+ blockKind: SurfaceBlockSnapshot["kind"];
1410
+ segmentId?: string;
1411
+ kind: SurfaceInlineSegment["kind"] | "paragraph_boundary" | "table_boundary";
1412
+ from: number;
1413
+ to: number;
1414
+ text?: string;
1415
+ marks?: SurfaceTextMark[];
1416
+ pageIndex?: number;
1417
+ sectionIndex?: number;
1418
+ }
1419
+
1420
+ export interface StoryTextStreamSnapshot {
1421
+ target: EditorStoryTarget;
1422
+ label: string;
1423
+ storySize: number;
1424
+ tokens: DocumentTextToken[];
1425
+ }
1426
+
1427
+ export type DocumentChunkKind = "retrieval" | "action" | "workflow";
1428
+
1429
+ export interface DocumentChunkSnapshot {
1430
+ chunkId: string;
1431
+ kind: DocumentChunkKind;
1432
+ label: string;
1433
+ text: string;
1434
+ storyTarget?: EditorStoryTarget;
1435
+ anchor: EditorAnchorProjection;
1436
+ sectionIndex?: number;
1437
+ pageRange?: { start: number; end: number };
1438
+ headingPath: string[];
1439
+ blockRefs: Array<{ blockId: string; kind: string }>;
1440
+ source:
1441
+ | { type: "surface" }
1442
+ | { type: "search"; query: string }
1443
+ | { type: "workflow"; candidateId?: string; markupId?: string };
1444
+ cautionFlags: Array<
1445
+ | "contains_table"
1446
+ | "contains_protected_range"
1447
+ | "contains_preserve_only"
1448
+ | "contains_detached_anchor"
1449
+ >;
1450
+ }
1451
+
1452
+ export interface ReviewWorkItemSnapshot {
1453
+ workId: string;
1454
+ kind: "comment" | "revision" | "protected_range" | "opaque_fragment";
1455
+ label: string;
1456
+ excerpt: string;
1457
+ anchor: EditorAnchorProjection;
1458
+ storyTarget?: EditorStoryTarget;
1459
+ sectionIndex?: number;
1460
+ pageIndex?: number;
1461
+ }
1462
+
1463
+ export interface ReviewWorkSnapshot {
1464
+ openCommentCount: number;
1465
+ actionableRevisionCount: number;
1466
+ items: ReviewWorkItemSnapshot[];
1467
+ }
1468
+
1469
+ export type RuntimeContextAnalyticsScopeKind =
1470
+ | "selection"
1471
+ | "workflow_scope"
1472
+ | "work_item"
1473
+ | "document";
1474
+
1475
+ export interface RuntimeContextAnalyticsQuery {
1476
+ scopeKind?: RuntimeContextAnalyticsScopeKind;
1477
+ scopeId?: string;
1478
+ workItemId?: string;
1479
+ }
1480
+
1481
+ export interface RuntimeContextAnalyticsBadge {
1482
+ key: string;
1483
+ label: string;
1484
+ value?: string | number;
1485
+ tone?: "neutral" | "accent" | "warning" | "danger" | "success";
1486
+ priority?: 1 | 2 | 3;
1487
+ }
1488
+
1489
+ export interface RuntimeContextAnalyticsActionHint {
1490
+ key: string;
1491
+ label: string;
1492
+ kind: "next_step" | "blocker" | "warning" | "approval";
1493
+ }
1494
+
1495
+ export interface RuntimeContextAnalyticsCounts {
1496
+ tasksRemaining?: number;
1497
+ unresolvedComments?: number;
1498
+ pendingRevisions?: number;
1499
+ pendingSuggestions?: number;
1500
+ blockedCommands?: number;
1501
+ approvalsRemaining?: number;
1502
+ overdueItems?: number;
1503
+ warnings?: number;
1504
+ errors?: number;
1505
+ openWorkItems?: number;
1506
+ exportBlockers?: number;
1507
+ }
1508
+
1509
+ export interface RuntimeContextAnalyticsState {
1510
+ effectiveMode?: EffectiveSelectionMode;
1511
+ isBlocked?: boolean;
1512
+ disabledReason?: string;
1513
+ completionState?: "not_started" | "in_progress" | "ready" | "done";
1514
+ exportReadiness?: "ready" | "warning" | "blocked";
1515
+ lastTouchedAt?: string;
1516
+ }
1517
+
1518
+ export type RuntimeContextAnalyticsUnavailableField =
1519
+ | "tasksRemaining"
1520
+ | "approvalsRemaining"
1521
+ | "overdueItems"
1522
+ | "tags"
1523
+ | "assignee"
1524
+ | "dueDate"
1525
+ | "lastTouchedAt";
1526
+
1527
+ export interface RuntimeContextAnalyticsProvenance {
1528
+ kind: "runtime-derived";
1529
+ derivedFrom: Array<
1530
+ | "render"
1531
+ | "workflowScope"
1532
+ | "interactionGuard"
1533
+ | "workflowMarkup"
1534
+ | "reviewWork"
1535
+ | "warnings"
1536
+ | "compatibility"
1537
+ >;
1538
+ unavailable: RuntimeContextAnalyticsUnavailableField[];
1539
+ }
1540
+
1541
+ export interface RuntimeContextAnalyticsSnapshot {
1542
+ scopeKind: RuntimeContextAnalyticsScopeKind;
1543
+ scopeId?: string;
1544
+ workItemId?: string | null;
1545
+ badges: RuntimeContextAnalyticsBadge[];
1546
+ nextActions: RuntimeContextAnalyticsActionHint[];
1547
+ counts: RuntimeContextAnalyticsCounts;
1548
+ state: RuntimeContextAnalyticsState;
1549
+ provenance: RuntimeContextAnalyticsProvenance;
1550
+ }
1551
+
1107
1552
  export interface WorkflowCandidateRangeOptions {
1108
1553
  kinds?: WorkflowMarkupKind[];
1109
1554
  includeDetached?: boolean;
@@ -1217,17 +1662,47 @@ export type WordReviewEditorEvent =
1217
1662
  documentId: string;
1218
1663
  activeWorkItemId: string | null;
1219
1664
  }
1665
+ | {
1666
+ type: "workflow_metadata_changed";
1667
+ documentId: string;
1668
+ snapshot: WorkflowMetadataSnapshot;
1669
+ }
1220
1670
  | {
1221
1671
  type: "host_annotation_overlay_changed";
1222
1672
  documentId: string;
1223
1673
  snapshot: HostAnnotationSnapshot;
1224
1674
  }
1675
+ | {
1676
+ type: "context_analytics_changed";
1677
+ documentId: string;
1678
+ snapshot: RuntimeContextAnalyticsSnapshot | null;
1679
+ }
1225
1680
  | {
1226
1681
  type: "change_authored";
1227
1682
  documentId: string;
1228
1683
  changeId: string;
1229
1684
  kind: "insertion" | "deletion";
1230
1685
  }
1686
+ | {
1687
+ type: "suggestion_authored";
1688
+ documentId: string;
1689
+ suggestionId: string;
1690
+ changeIds: string[];
1691
+ suggestionKind: SuggestionEntrySnapshot["kind"];
1692
+ storyTarget: EditorStoryTarget;
1693
+ anchor: EditorAnchorProjection;
1694
+ isReplacement: boolean;
1695
+ }
1696
+ | {
1697
+ type: "suggestion_updated";
1698
+ documentId: string;
1699
+ suggestionId: string;
1700
+ changeIds: string[];
1701
+ suggestionKind: SuggestionEntrySnapshot["kind"];
1702
+ status: SuggestionEntrySnapshot["status"];
1703
+ storyTarget: EditorStoryTarget;
1704
+ anchor: EditorAnchorProjection;
1705
+ }
1231
1706
  | {
1232
1707
  type: "command_blocked";
1233
1708
  documentId: string;
@@ -1312,12 +1787,15 @@ export interface WordReviewEditorRef {
1312
1787
  getWarnings(): EditorWarning[];
1313
1788
  getCommentSidebarSnapshot(): CommentSidebarSnapshot;
1314
1789
  getTrackedChangesSnapshot(): TrackedChangesSnapshot;
1790
+ getSuggestionsSnapshot(): SuggestionsSnapshot;
1315
1791
  getComments(): CommentSidebarSnapshot;
1316
1792
  getTrackedChanges(): TrackedChangesSnapshot;
1317
1793
  isDirty(): boolean;
1318
1794
  getFormattingState(): FormattingStateSnapshot;
1319
1795
  getStyleCatalog(): StyleCatalogSnapshot;
1320
1796
  replaceText(text: string, target?: EditorAnchorProjection): void;
1797
+ toggleBulletedList(): void;
1798
+ toggleNumberedList(): void;
1321
1799
  toggleBold(): void;
1322
1800
  toggleItalic(): void;
1323
1801
  toggleUnderline(): void;
@@ -1333,6 +1811,8 @@ export interface WordReviewEditorRef {
1333
1811
  setTableStyle(styleId: string | null): void;
1334
1812
  indent(): void;
1335
1813
  outdent(): void;
1814
+ restartNumbering(): void;
1815
+ continueNumbering(): void;
1336
1816
  insertPageBreak(): void;
1337
1817
  insertTable(options: InsertTableOptions): void;
1338
1818
  insertImage(options: InsertImageOptions): void;
@@ -1355,6 +1835,28 @@ export interface WordReviewEditorRef {
1355
1835
  closeStory(): void;
1356
1836
  getPageLayoutSnapshot(): PageLayoutSnapshot | null;
1357
1837
  getDocumentNavigationSnapshot(): DocumentNavigationSnapshot;
1838
+ getCurrentLocation(): DocumentLocationSnapshot | null;
1839
+ getLocationForSelection(selection: SelectionSnapshot): DocumentLocationSnapshot | null;
1840
+ getLocationForAnchor(
1841
+ anchor: EditorAnchorProjection,
1842
+ storyTarget?: EditorStoryTarget,
1843
+ ): DocumentLocationSnapshot | null;
1844
+ captureRestorePoint(
1845
+ input?: SelectionSnapshot | EditorAnchorProjection,
1846
+ ): RestorePointSnapshot | null;
1847
+ restoreToPoint(
1848
+ point: RestorePointSnapshot,
1849
+ options?: { behavior?: "exact" | "semantic"; scroll?: boolean },
1850
+ ): RestoreResult;
1851
+ getOutlineSnapshot(): DocumentOutlineSnapshot;
1852
+ getTocSnapshot(): TocSnapshot | null;
1853
+ getSections(): DocumentSectionSnapshot[];
1854
+ getSectionSnapshot(input: {
1855
+ sectionIndex?: number;
1856
+ headingId?: string;
1857
+ bookmarkName?: string;
1858
+ }): DocumentSectionSnapshot | null;
1859
+ describeEventImpact(event: WordReviewEditorEvent): SnapshotRefreshHints;
1358
1860
  getFieldSnapshot(): FieldSnapshot;
1359
1861
  updateFields(options?: UpdateFieldsOptions): UpdateFieldsResult;
1360
1862
  updateTableOfContents(options?: TocRefreshOptions): TocRefreshResult;
@@ -1378,11 +1880,36 @@ export interface WordReviewEditorRef {
1378
1880
  getWorkflowScopeSnapshot(): WorkflowScopeSnapshot | null;
1379
1881
  getInteractionGuardSnapshot(): InteractionGuardSnapshot;
1380
1882
  getWorkflowMarkupSnapshot(): WorkflowMarkupSnapshot;
1883
+ setWorkflowMetadataDefinitions(definitions: WorkflowMetadataDefinition[]): void;
1884
+ clearWorkflowMetadataDefinitions(): void;
1885
+ setWorkflowMetadataEntries(entries: WorkflowMetadataEntry[]): void;
1886
+ clearWorkflowMetadataEntries(): void;
1887
+ getWorkflowMetadataSnapshot(): WorkflowMetadataSnapshot;
1381
1888
  setHostAnnotationOverlay(overlay: HostAnnotationOverlay): void;
1382
1889
  clearHostAnnotationOverlay(): void;
1383
1890
  getHostAnnotationSnapshot(): HostAnnotationSnapshot;
1891
+ getReviewQueueSnapshot(): ReviewQueueSnapshot;
1892
+ goToNextReviewItem(): ReviewQueueItem | null;
1893
+ goToPreviousReviewItem(): ReviewQueueItem | null;
1894
+ markSectionForReview(input?: { sectionIndex?: number; label?: string }): string | null;
1895
+ clearSectionReviewMark(annotationId: string): void;
1384
1896
  getWorkflowCandidateRanges(options?: WorkflowCandidateRangeOptions): WorkflowCandidateRange[];
1385
1897
  replaceWorkflowMarkupText(markupId: string, text: string): void;
1898
+ getRuntimeContextAnalytics(
1899
+ query?: RuntimeContextAnalyticsQuery,
1900
+ ): RuntimeContextAnalyticsSnapshot | null;
1901
+ }
1902
+
1903
+ export type WordReviewEditorChromePreset =
1904
+ | "selection"
1905
+ | "simple"
1906
+ | "advanced"
1907
+ | "review";
1908
+
1909
+ export interface WordReviewEditorChromeOptions {
1910
+ showReviewQueueBar: boolean;
1911
+ showSectionTagAction: boolean;
1912
+ showReviewRail: boolean;
1386
1913
  }
1387
1914
 
1388
1915
  export interface WordReviewEditorProps {
@@ -1399,7 +1926,10 @@ export interface WordReviewEditorProps {
1399
1926
  readOnly?: boolean;
1400
1927
  reviewMode?: "editing" | "review";
1401
1928
  suggestionsEnabled?: boolean;
1929
+ chromePreset?: WordReviewEditorChromePreset;
1930
+ chromeOptions?: Partial<WordReviewEditorChromeOptions>;
1402
1931
  markupDisplay?: "clean" | "simple" | "all";
1932
+ showUnsupportedObjectPreviews?: boolean;
1403
1933
  showReviewPanel?: boolean;
1404
1934
  chromeVisibility?: Partial<WordReviewEditorChromeVisibility>;
1405
1935
  hostAdapter?: EditorHostAdapter;
@@ -1415,6 +1945,7 @@ export interface WordReviewEditorChromeVisibility {
1415
1945
  alerts: boolean;
1416
1946
  selectionOverlay: boolean;
1417
1947
  contextToolbars: boolean;
1948
+ contextAnalytics: boolean;
1418
1949
  pageChrome: boolean;
1419
1950
  statusBar: boolean;
1420
1951
  reviewRail: boolean;