@docx-editor.dev/core 2.31.0 → 2.32.0

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 (129) hide show
  1. package/README.md +24 -0
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +16 -16
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +17 -15
  7. package/dist/binding.js +1 -1
  8. package/dist/{chrome-print-BWvaVEhD.d.ts → chrome-print-CznJ0ucN.d.ts} +58 -23
  9. package/dist/chunk-25EXMBV2.cjs +5 -0
  10. package/dist/chunk-2CWQY27B.cjs +1 -0
  11. package/dist/chunk-3IEXDEFH.cjs +7 -0
  12. package/dist/chunk-65XBN67F.cjs +2 -0
  13. package/dist/{chunk-5JPIEN54.cjs → chunk-6NVZNB7O.cjs} +2 -2
  14. package/dist/chunk-6UDJUI3W.cjs +2 -0
  15. package/dist/chunk-ACLR4DMK.js +1 -0
  16. package/dist/{chunk-2E2RPEKX.js → chunk-B2BEELUE.js} +1 -1
  17. package/dist/chunk-DDFHKQFU.js +30 -0
  18. package/dist/{chunk-MOYYRVFV.cjs → chunk-E4IAO4CY.cjs} +1 -1
  19. package/dist/chunk-ETDZFNMI.js +2 -0
  20. package/dist/chunk-FDSL5OJU.cjs +30 -0
  21. package/dist/chunk-FS7CMYLT.js +4 -0
  22. package/dist/chunk-GDS24SZN.js +30 -0
  23. package/dist/chunk-GIY6NT2X.js +5 -0
  24. package/dist/chunk-GWM3AKUD.js +18 -0
  25. package/dist/chunk-HDOXACHP.js +2 -0
  26. package/dist/chunk-IILEENID.js +1 -0
  27. package/dist/chunk-L5TYBFDB.js +1 -0
  28. package/dist/chunk-MNF2K7NN.cjs +30 -0
  29. package/dist/chunk-O324RB6R.cjs +1 -0
  30. package/dist/chunk-OKMEMSKB.cjs +1 -0
  31. package/dist/chunk-QXJKYNYZ.js +1 -0
  32. package/dist/chunk-RALTVLB6.js +2 -0
  33. package/dist/chunk-SRVKFUFI.js +3 -0
  34. package/dist/chunk-TELQ52LG.cjs +1 -0
  35. package/dist/chunk-TJHE5EET.cjs +1 -0
  36. package/dist/chunk-UMMRURPE.js +7 -0
  37. package/dist/chunk-WN7ICTA5.js +1 -0
  38. package/dist/{chunk-XSTGE3NI.cjs → chunk-XJYZVGQR.cjs} +1 -1
  39. package/dist/chunk-ZGTIE3QJ.cjs +4 -0
  40. package/dist/chunk-ZOZI27AW.cjs +18 -0
  41. package/dist/collaboration/replication.cjs +1 -1
  42. package/dist/collaboration/replication.d.ts +20 -4
  43. package/dist/collaboration/replication.js +1 -1
  44. package/dist/collaboration.cjs +1 -1
  45. package/dist/collaboration.d.ts +5 -5
  46. package/dist/collaboration.js +1 -1
  47. package/dist/contracts/document.d.ts +3 -3
  48. package/dist/contracts/editor.d.ts +13 -9
  49. package/dist/contracts/interaction.d.ts +2 -2
  50. package/dist/contracts/modules.d.ts +15 -12
  51. package/dist/contracts/types.d.ts +135 -2
  52. package/dist/{custom-node-writes-TeUvMP13.d.ts → custom-node-writes-CLJKGD9t.d.ts} +7 -2
  53. package/dist/{diagnostic-context-DJ0P1uZE.d.ts → diagnostic-context-BtDUY3v2.d.ts} +1 -1
  54. package/dist/{diagnostic-hints-C9JlLz1L.d.ts → diagnostic-hints-DK8-V0fk.d.ts} +2 -2
  55. package/dist/{document-protection-C8x3P2J6.d.ts → document-protection-NaniLHWF.d.ts} +1 -1
  56. package/dist/{editor-B2ShlO23.d.ts → editor-DZwOTmlR.d.ts} +104 -239
  57. package/dist/editor-fonts-D_-vjuJi.d.ts +53 -0
  58. package/dist/{editor-scope-C7ke1KJG.d.ts → editor-scope-B3L-1ALc.d.ts} +1 -1
  59. package/dist/editor.cjs +1 -1
  60. package/dist/editor.css +2 -2
  61. package/dist/editor.d.ts +74 -30
  62. package/dist/editor.js +1 -1
  63. package/dist/export.cjs +2 -2
  64. package/dist/export.d.ts +9 -15
  65. package/dist/export.js +1 -1
  66. package/dist/{failure-NS2lsya4.d.ts → failure-6KGFrDO9.d.ts} +1 -1
  67. package/dist/{font-resolver-CWh40DYp.d.ts → font-resolver-BlQNGdvR.d.ts} +1 -1
  68. package/dist/{headless-document-view-qOpaCF82.d.ts → headless-document-view-Bcz9_Qva.d.ts} +115 -4
  69. package/dist/index.cjs +1 -1
  70. package/dist/index.d.ts +27 -25
  71. package/dist/index.js +1 -1
  72. package/dist/{layout-shaping-CWS3j0Xr.d.ts → layout-shaping-E5J4Z1Gf.d.ts} +1 -1
  73. package/dist/layout.cjs +1 -1
  74. package/dist/layout.d.ts +24 -17
  75. package/dist/layout.js +1 -1
  76. package/dist/{note-properties-QsKh24sM.d.ts → note-properties-Ds5R2_3F.d.ts} +1 -1
  77. package/dist/output.cjs +1 -1
  78. package/dist/output.d.ts +11 -7
  79. package/dist/output.js +1 -1
  80. package/dist/{protocol-COZJUKUY.d.ts → protocol-DKa4qt7F.d.ts} +75 -5
  81. package/dist/{review-paragraph-order-C_QbCKcH.d.ts → review-paragraph-order-Dc17w_6v.d.ts} +1 -1
  82. package/dist/revision-projection-Cn6rZJ7H.d.ts +258 -0
  83. package/dist/{semantic-cell-selection-Cub9FDa8.d.ts → semantic-cell-selection-BaUR0iJ4.d.ts} +2 -2
  84. package/dist/{semantic-interaction-dApRIYpt.d.ts → semantic-interaction-CJoHLoOl.d.ts} +1 -1
  85. package/dist/{semantic-paint-DLzA8sjP.d.ts → semantic-paint-BPw_n0li.d.ts} +7 -4
  86. package/dist/{semantic-record-queries-3yp9o11g.d.ts → semantic-record-queries-C0rJ3sB4.d.ts} +1 -1
  87. package/dist/{semantic-records-B-akgRch.d.ts → semantic-records-BvN-WWst.d.ts} +216 -406
  88. package/dist/store.cjs +1 -1
  89. package/dist/store.d.ts +13 -14
  90. package/dist/store.js +1 -1
  91. package/dist/{types-barrel-CkF2JbU4.d.ts → tree-op-types-C_S2niXW.d.ts} +117 -26
  92. package/dist/{tree-package-store-B8l8DX3Z.d.ts → tree-package-store-CRHvMyNj.d.ts} +2 -2
  93. package/dist/{tree-session-contract-DeLRqohz.d.ts → tree-session-contract-D1awo_dA.d.ts} +5 -5
  94. package/dist/unsupported-elements-CVos5cqe.d.ts +23 -0
  95. package/docs/accept-reject-without-scrolling.md +95 -0
  96. package/docs/comment-on-found-text.md +72 -0
  97. package/docs/custom-review-cards.md +178 -0
  98. package/docs/highlight-ranges.md +48 -0
  99. package/docs/index.md +36 -0
  100. package/docs/propose-rewrite.md +247 -0
  101. package/docs/tracked-replacement.md +68 -0
  102. package/package.json +3 -2
  103. package/dist/chunk-243W4WW2.cjs +0 -2
  104. package/dist/chunk-4S24UOPG.js +0 -30
  105. package/dist/chunk-5SO5QDMV.cjs +0 -2
  106. package/dist/chunk-6IDOVU6L.cjs +0 -1
  107. package/dist/chunk-6JIJOZDW.js +0 -1
  108. package/dist/chunk-BTQKU64Q.cjs +0 -1
  109. package/dist/chunk-DBOOTED4.cjs +0 -30
  110. package/dist/chunk-EOTAXOJY.cjs +0 -5
  111. package/dist/chunk-FDAKJ2SJ.cjs +0 -30
  112. package/dist/chunk-FNNOJNGY.js +0 -3
  113. package/dist/chunk-FT33HRZP.js +0 -5
  114. package/dist/chunk-HC6YNKUI.cjs +0 -1
  115. package/dist/chunk-HZ66UCIS.js +0 -2
  116. package/dist/chunk-IBRBNT37.cjs +0 -1
  117. package/dist/chunk-IVIN7X43.js +0 -30
  118. package/dist/chunk-LZY6B6IV.js +0 -4
  119. package/dist/chunk-N6B3BXCL.js +0 -1
  120. package/dist/chunk-Q5K2GGNG.js +0 -2
  121. package/dist/chunk-R2XINWVE.js +0 -7
  122. package/dist/chunk-SUEXVBPR.js +0 -1
  123. package/dist/chunk-T2QQHG5C.js +0 -18
  124. package/dist/chunk-VWIJKH4A.js +0 -1
  125. package/dist/chunk-WO4V6PNS.cjs +0 -18
  126. package/dist/chunk-XMJKFURD.cjs +0 -4
  127. package/dist/chunk-YQWMI6J5.cjs +0 -7
  128. package/dist/chunk-ZCJS7D7S.js +0 -2
  129. package/dist/omml-equation-BsLAa2lX.d.ts +0 -115
@@ -1,139 +1,14 @@
1
- import { q as ResolvedRevisionMarkup, a as ReviewDisplayMode } from './semantic-records-B-akgRch.js';
2
- import { t as DocAnchor, g as ReviewRevisionKind, c as ReviewCommentItem, b as ReviewRevisionItem, d as ReviewCustomItem, aT as SourceCrop, Y as DrawingKind, a2 as ImageWrapTarget, _ as DrawingPositionInput, Z as DrawingLocks, a1 as ImageResourceState, r as ColorValue, x as ExecErrorCode, a6 as ParagraphFormatCommand, af as SupportedImageMime, al as Watermark, E as ExecResult, an as WatermarkState, n as ContentControlFilter, o as DocRange, k as RunFormatting, p as Revision, a9 as Rect, ae as SelectionPin, ai as Unsubscribe } from './types-barrel-CkF2JbU4.js';
3
- import { H as HistoryDiagnostic, V as ViewScope, b as HistoryGroup, a as EditorExecOptions, E as EditorScope, c as HistoryGroupOptions } from './editor-scope-C7ke1KJG.js';
4
- import { C as CollaborationDiagnosticCode, c as CustomNodeDiagnosticCode, D as DiagnosticErrorName, F as FailureStage, B as ByteSizeBucket, b as CountBucket, f as DocumentOpenDiagnosticCode, a as DocumentPartKind, g as DocumentSaveDiagnosticCode, E as EditDiagnosticCode, j as ReviewDiagnosticCode, k as ReviewOperation, R as ReviewChangeKind, i as FormattingChangeKind, h as FontDiagnosticCode, H as HistoryDiagnosticCode, P as PerformanceDiagnosticCode } from './diagnostic-hints-C9JlLz1L.js';
1
+ import { d as ResolvedRevisionMarkup, a as ReviewDisplayMode } from './revision-projection-Cn6rZJ7H.js';
2
+ import { ResolvedReviewPane } from './contracts/types.js';
3
+ import { V as ViewScope, b as HistoryDiagnostic, c as HistoryGroup, a as EditorExecOptions, E as EditorScope, d as HistoryGroupOptions } from './editor-scope-B3L-1ALc.js';
4
+ import { E as EditorFontErrorCode, a as FontFaceRequest } from './editor-fonts-D_-vjuJi.js';
5
+ import { t as DocAnchor, g as ReviewRevisionKind, c as ReviewCommentItem, b as ReviewRevisionItem, d as ReviewCustomItem, aT as SourceCrop, a8 as DrawingKind, ag as ImageWrapTarget, aa as DrawingPositionInput, a9 as DrawingLocks, af as ImageResourceState, r as ColorValue, x as ExecErrorCode, ah as ParagraphFormatCommand, an as SupportedImageMime, ar as Watermark, E as ExecResult, at as WatermarkState, n as ContentControlFilter, o as DocRange, k as RunFormatting, p as Revision, ak as Rect, am as SelectionPin, ao as Unsubscribe } from './tree-op-types-C_S2niXW.js';
6
+ import { C as CollaborationDiagnosticCode, c as CustomNodeDiagnosticCode, D as DiagnosticErrorName, F as FailureStage, B as ByteSizeBucket, b as CountBucket, f as DocumentOpenDiagnosticCode, a as DocumentPartKind, g as DocumentSaveDiagnosticCode, E as EditDiagnosticCode, j as ReviewDiagnosticCode, k as ReviewOperation, R as ReviewChangeKind, i as FormattingChangeKind, h as FontDiagnosticCode, H as HistoryDiagnosticCode, P as PerformanceDiagnosticCode } from './diagnostic-hints-DK8-V0fk.js';
5
7
  import { DocEdits, DocQueries, DocQueryResults, ContentControlSummary } from './contracts/document.js';
6
8
  import { InteractionOutcome } from './contracts/interaction.js';
7
- import { a as SemanticSelection, S as SemanticPosition } from './semantic-interaction-dApRIYpt.js';
8
- import { a as DocumentProtectionState } from './document-protection-C8x3P2J6.js';
9
- import { C as CollaborationStatus } from './failure-NS2lsya4.js';
10
-
11
- /**
12
- * When the review pane opens by itself.
13
- *
14
- * - `'auto'`: the pane opens when a document with review items loads, and when a tracked
15
- * change is made while it is closed, in both cases when the pane has items to list. With
16
- * `revisionsIn: 'balloons'` the pane lists no tracked change and no reply to one, so
17
- * tracked changes and their replies alone do not open it.
18
- * - `'manual'`: the pane stays closed until the host or the user opens it. Use it when the
19
- * host shows review items its own way, such as in balloons or margin markers.
20
- *
21
- * @public
22
- */
23
- type ReviewPaneOpening = 'auto' | 'manual';
24
- /**
25
- * What the open review pane does when its full card column does not fit beside the page at
26
- * the page's zoom.
27
- *
28
- * - `'float'`: the pane shrinks to a strip of markers, and the open card floats over the
29
- * page.
30
- * - `'shrinkPage'`: under a fit zoom mode, the page may shrink down to the mode's
31
- * `minZoom` (or 10%) so that the full column fits. The pane changes to the marker strip
32
- * only when the column does not fit at that floor either. A fixed zoom behaves as
33
- * `'float'`.
34
- * - `'scroll'`: the page keeps the size it has beside the closed pane's marker strip, and
35
- * the full column stands beside it. The document and the column scroll together: the
36
- * viewport scrolls sideways to reach the cards.
37
- *
38
- * The setting applies to the review pane only. The navigation pane stays docked at its side
39
- * in every mode: it never scrolls with the document, and it takes its room beside the page
40
- * exactly as it does with no review pane.
41
- *
42
- * @public
43
- */
44
- type ReviewPaneOverflow = 'float' | 'shrinkPage' | 'scroll';
45
- /**
46
- * Where tracked changes open.
47
- *
48
- * - `'pane'`: the review pane lists tracked changes as cards beside the comments.
49
- * - `'balloons'`: the pane lists comments only, except comments that reply to a tracked
50
- * change: the change's balloon shows those. A tracked change opens in a balloon at its
51
- * text when the reader clicks it, or when Next Change, Previous Change, or
52
- * `setActiveReviewItem(key, { announce: true })` reaches it. A replacement is one balloon.
53
- * In both settings, Next Change and Previous Change stop on a replacement once.
54
- *
55
- * @public
56
- */
57
- type RevisionDisplay = 'pane' | 'balloons';
58
- /**
59
- * How a collapsed comment marker looks.
60
- *
61
- * - `'initials'`: a badge with the thread author's initials in the author's color, a reply
62
- * count, and a check mark when the thread is resolved.
63
- * - `'icon'`: the comment icon.
64
- *
65
- * @public
66
- */
67
- type CommentMarkerStyle = 'initials' | 'icon';
68
- /**
69
- * Review pane settings to change. Every field is optional, and an omitted field keeps its
70
- * current value.
71
- *
72
- * @public
73
- */
74
- interface ReviewPaneOptions {
75
- /** Default `'auto'`. */
76
- readonly opening?: ReviewPaneOpening;
77
- /** Default `'float'`. */
78
- readonly overflow?: ReviewPaneOverflow;
79
- /** Default `'pane'`. */
80
- readonly revisionsIn?: RevisionDisplay;
81
- /** Default `'icon'`. */
82
- readonly commentMarkers?: CommentMarkerStyle;
83
- }
84
- /**
85
- * The review pane settings in force, with every field resolved.
86
- *
87
- * @public
88
- */
89
- interface ResolvedReviewPane {
90
- /** When the pane opens by itself. */
91
- readonly opening: ReviewPaneOpening;
92
- /** What the open pane does when its card column does not fit beside the page. */
93
- readonly overflow: ReviewPaneOverflow;
94
- /** Where tracked changes open. */
95
- readonly revisionsIn: RevisionDisplay;
96
- /** How a collapsed comment marker looks. */
97
- readonly commentMarkers: CommentMarkerStyle;
98
- }
99
- /** The settings an editor starts with when nothing sets them. @public */
100
- declare const DEFAULT_REVIEW_PANE: ResolvedReviewPane;
101
- /**
102
- * Merge `options` over `base`. Throws a `TypeError` for an unknown field or value, so a
103
- * misspelled setting fails loudly instead of being ignored. Returns `base` itself when
104
- * nothing changes, so the snapshot keeps its reference.
105
- *
106
- * @public
107
- */
108
- declare function resolveReviewPane(options: ReviewPaneOptions | undefined, base?: ResolvedReviewPane): ResolvedReviewPane;
109
- /**
110
- * The fields of a review item that decide whether the review pane lists it. A
111
- * `ReviewItem` and a review item placement both have them.
112
- *
113
- * @public
114
- */
115
- interface ReviewPaneItemFields {
116
- /** The item kind, as `ReviewItem.kind` gives it. */
117
- readonly kind: 'revision' | 'comment' | 'custom';
118
- /** For a comment, the tracked change it replies to. */
119
- readonly parentRevisionId?: string;
120
- }
121
- /**
122
- * Whether the review pane lists a card for `item` under `revisionsIn`.
123
- *
124
- * With `'balloons'`, a balloon at the text shows every tracked change and every comment
125
- * that replies to a tracked change, so the pane lists neither. Give the item as an
126
- * unfiltered `getReviewItems()` read returns it: a query that excludes revision kinds
127
- * removes `parentRevisionId` from replies to the changes it drops.
128
- *
129
- * The engine applies this rule to every review item when it decides whether the pane opens
130
- * by itself or closes after a settings change. A review pane must apply the same rule before
131
- * its own filters, such as a hidden kind or a host filter. Those filters can hide every card,
132
- * and then the pane that the engine opens is empty.
133
- *
134
- * @public
135
- */
136
- declare function reviewPaneListsItem(revisionsIn: RevisionDisplay, item: ReviewPaneItemFields): boolean;
9
+ import { a as SemanticSelection, S as SemanticPosition } from './semantic-interaction-CJoHLoOl.js';
10
+ import { a as DocumentProtectionState } from './document-protection-NaniLHWF.js';
11
+ import { a as CollaborationStatus } from './failure-6KGFrDO9.js';
137
12
 
138
13
  /**
139
14
  * What a fit mode fits the page to.
@@ -167,6 +42,52 @@ type ZoomMode = {
167
42
  readonly maxZoom?: number;
168
43
  };
169
44
 
45
+ /**
46
+ * One occurrence of a search query in the document.
47
+ *
48
+ * Carries TWO addresses on purpose. `blockId` + `start` is the engine's own: stable
49
+ * across edits and independent of ordering. `paragraphIndex` + `runIndex` + `runOffset`
50
+ * is the positional one a find/replace UI needs to show and navigate results, and it is
51
+ * derived from the same walk rather than left to the caller to reconstruct — a caller
52
+ * guessing at run boundaries would send the selection to the wrong place.
53
+ *
54
+ * A match can span runs when formatting changes mid-word; the run address is where it
55
+ * STARTS. `scope` identifies a non-body story so navigation opens the correct surface.
56
+ * A frame scope selects its anchoring drawing and never places a caret inside its story.
57
+ * A match inside a field result reports the field atom's model range. Its `length` is one,
58
+ * while `text` carries the visible match and can be longer. Select with `start` and `length`.
59
+ * Never derive the selected length from `text.length`.
60
+ */
61
+ interface TextMatch {
62
+ readonly blockId: string;
63
+ /** Character offset within the paragraph's concatenated run text. */
64
+ readonly start: number;
65
+ readonly length: number;
66
+ /**
67
+ * Paragraph ordinal within this match's story. Table and nested-table paragraphs count.
68
+ * Non-paragraph blocks add no ordinal.
69
+ */
70
+ readonly paragraphIndex: number;
71
+ /** Index of the run the match starts in, and the offset within that run. */
72
+ readonly runIndex: number;
73
+ readonly runOffset: number;
74
+ /** Story containing the match. Absence means the body. */
75
+ readonly scope?: ViewScope;
76
+ /** The matched text as it appears in the document. */
77
+ readonly text: string;
78
+ /**
79
+ * Paragraph text immediately before and after the match, bounded at the derivation
80
+ * boundary. A results list shows the match in its sentence — "…as described in this
81
+ * **Exhi**bit A" — and nothing else in the contract can reach paragraph text, so a
82
+ * caller would otherwise have to re-read the document to render one row.
83
+ *
84
+ * Optional and additive: an implementation that has not derived them omits them, and a
85
+ * consumer treats absent as empty.
86
+ */
87
+ readonly contextBefore?: string;
88
+ readonly contextAfter?: string;
89
+ }
90
+
170
91
  /**
171
92
  * Anonymous diagnostics: why something failed, as stable codes and bucketed numbers.
172
93
  *
@@ -1736,57 +1657,6 @@ interface DocumentHandle {
1736
1657
  * where a new array per render rebuilds the editor per render.
1737
1658
  */
1738
1659
  type DocumentSource = ArrayBuffer | Uint8Array | DocumentHandle | 'blank';
1739
- /** A concrete font face requested by authored document content. */
1740
- interface FontFaceRequest {
1741
- readonly family: string;
1742
- readonly weight: number;
1743
- readonly style: 'normal' | 'italic';
1744
- }
1745
- /** Immutable, byte-backed font face supplied to layout and browser paint. */
1746
- interface FontSource {
1747
- readonly request: FontFaceRequest;
1748
- readonly id: string;
1749
- readonly bytes: Uint8Array;
1750
- readonly hash: string;
1751
- readonly faceIndex: number;
1752
- readonly availability?: 'available' | 'forbidden';
1753
- }
1754
- /** An explicit authored-font substitution. No implicit platform fallback is performed. */
1755
- interface FontSourceSubstitution {
1756
- readonly from: FontFaceRequest;
1757
- readonly to: FontFaceRequest;
1758
- /** Word line-box metrics for the requested face, expressed as em ratios. */
1759
- readonly lineMetrics?: {
1760
- readonly heightEm: number;
1761
- readonly baselineEm: number;
1762
- };
1763
- }
1764
- /**
1765
- * Public font source configuration sampled when an adapter mounts. It must be immutable for that
1766
- * editor lifetime; remount the adapter to replace bytes or substitutions atomically.
1767
- */
1768
- interface FontConfiguration {
1769
- /** Selectable provider families, independent of loaded bytes. Listing them performs no fetch. */
1770
- readonly supportedFamilies?: readonly string[];
1771
- readonly epoch: number;
1772
- readonly maxFontBytes: number;
1773
- readonly sources: readonly FontSource[];
1774
- readonly substitutions?: readonly FontSourceSubstitution[];
1775
- readonly defaultFont: {
1776
- readonly family: string;
1777
- readonly sizeHalfPoints: number;
1778
- };
1779
- readonly language?: string;
1780
- }
1781
- /**
1782
- * Why a font was not admitted.
1783
- *
1784
- * Distinguished rather than collapsed because the responses differ: `overLimit` and `malformed`
1785
- * are the caller's own bytes, while `forbidden` and `hashMismatch` mean the source was not what
1786
- * it claimed and the load should not be retried. `wasmUnavailable` alone is a HOST fault — the
1787
- * shaper's WASM never loaded, `diagnostic` carries the remedy — surface it as a setup error.
1788
- */
1789
- type EditorFontErrorCode = 'initializationFailed' | 'wasmUnavailable' | 'missing' | 'forbidden' | 'overLimit' | 'malformed' | 'hashMismatch' | 'metadataMismatch' | 'fontFaceLoadFailed' | 'unsupportedFaceIndex' | 'missingFont' | 'hashInvalid' | 'fontMismatch' | 'unsupportedFace' | 'loadFailed';
1790
1660
  /** Typed adapter error reported both through `onFontError` and accessible alert UI. */
1791
1661
  declare class EditorFontError extends Error {
1792
1662
  readonly name: string;
@@ -1980,6 +1850,13 @@ interface Editor extends EditorAnchorNavigation, EditorHighlights, EditorReviewH
1980
1850
  * The search narrows to the body and its selectable text boxes when other stories cannot open.
1981
1851
  * This includes viewing mode and surfaces without header, footer, or note entry methods.
1982
1852
  * Text boxes in footnotes and endnotes remain excluded until their drawings are selectable.
1853
+ *
1854
+ * Pass a match to `exec({ type: 'replaceMatch', match, text })` to replace it, which records a
1855
+ * tracked replacement in suggesting mode, or to {@link selectMatch} and then
1856
+ * {@link addComment} to comment on it. For headless or server use, see `body.search` in
1857
+ * `@docx-editor.dev/editor-api`.
1858
+ *
1859
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/tracked-replacement | Replace as a tracked change}
1983
1860
  */
1984
1861
  findMatches(query: string, options?: {
1985
1862
  readonly matchCase?: boolean;
@@ -2138,6 +2015,13 @@ interface Editor extends EditorAnchorNavigation, EditorHighlights, EditorReviewH
2138
2015
  * editor.addComment('Counter-proposal: 45 days.', { historyGroup: decision });
2139
2016
  * editor.addComment('Approved.', 'Legal team', { historyGroup: decision });
2140
2017
  * ```
2018
+ *
2019
+ * To comment on found text, select it first with {@link findMatches} and
2020
+ * {@link selectMatch}. In a React or Vue host with the review module, `useReview().comment`
2021
+ * calls this. For headless or server use, see `Range.insertComment` in
2022
+ * `@docx-editor.dev/editor-api`.
2023
+ *
2024
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/comment-on-found-text | Comment on found text}
2141
2025
  */
2142
2026
  addComment(text: string, options?: HistoryGroupOptions): ExecResult;
2143
2027
  /** {@link addComment} with an author for this call, overriding the configured author. */
@@ -2165,6 +2049,11 @@ interface Editor extends EditorAnchorNavigation, EditorHighlights, EditorReviewH
2165
2049
  * With `options.announce: true`, a call that lands fires `reviewItemReveal` with
2166
2050
  * `source: 'host'`, also when the item was already active, so the packaged review UI opens
2167
2051
  * the item's balloon or card. By default it fires nothing. A `null` key fires nothing.
2052
+ *
2053
+ * Pass `{ reveal: false }` to open the item without scrolling, for a host whose own list
2054
+ * drives the scroll. `useReview().setActive` calls this.
2055
+ *
2056
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
2168
2057
  */
2169
2058
  setActiveReviewItem(key: string | null, options?: ReviewActivationOptions): ExecResult;
2170
2059
  /**
@@ -2213,6 +2102,12 @@ interface Editor extends EditorAnchorNavigation, EditorHighlights, EditorReviewH
2213
2102
  * Refused for a card whose kind the engine cannot resolve structurally, which is why
2214
2103
  * `readOnly` is on the item — a surface should not offer the button in the first place.
2215
2104
  * Other refusals name their cause, as {@link addComment} describes.
2105
+ *
2106
+ * Neither call scrolls. In a React or Vue host with the review module, `useReview().accept`
2107
+ * and `useReview().reject` call these. For headless or server use, see `Revision.accept()`
2108
+ * and `Revision.reject()` in `@docx-editor.dev/editor-api`.
2109
+ *
2110
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
2216
2111
  */
2217
2112
  acceptReviewItem(key: string, options?: HistoryGroupOptions): ExecResult;
2218
2113
  /** The rejecting half of {@link acceptReviewItem}, with the same rules and options. */
@@ -2254,6 +2149,9 @@ interface Editor extends EditorAnchorNavigation, EditorHighlights, EditorReviewH
2254
2149
  * source it — and the argument overrides it for one call. `CT_Comment` makes `@w:author`
2255
2150
  * required, so a reply with neither is refused rather than written as an empty attribute.
2256
2151
  * Other refusals name their cause, as {@link addComment} describes.
2152
+ *
2153
+ * In a React or Vue host with the review module, `useReview().reply` calls this. For
2154
+ * headless or server use, see `Comment.reply` in `@docx-editor.dev/editor-api`.
2257
2155
  */
2258
2156
  replyToReviewItem(key: string, text: string, options?: HistoryGroupOptions): ExecResult;
2259
2157
  /** {@link replyToReviewItem} with an author for this call, overriding the configured author. */
@@ -2284,7 +2182,8 @@ interface Editor extends EditorAnchorNavigation, EditorHighlights, EditorReviewH
2284
2182
  */
2285
2183
  /**
2286
2184
  * Scroll a page or a block into view. Returns false when the target does not exist or
2287
- * the host has no scroll container — a caller can tell "not found" from "scrolled".
2185
+ * the host has no scroll container. During a large open, a target not laid out yet answers
2186
+ * true and scrolls once it is; input cancels that, and a page past the end never scrolls.
2288
2187
  */
2289
2188
  scrollToPage(pageNumber: number): boolean;
2290
2189
  /**
@@ -2622,6 +2521,17 @@ interface EditorCommands extends EditorCommandShape<DocEdits>, EditorHeaderFoote
2622
2521
  * returns. An empty `text` deletes it. The selection and scroll position stay put. In
2623
2522
  * suggesting mode it is a tracked replacement under the editor's author, refused where
2624
2523
  * `proposeReplacement` would be. The match must be in the open story, not a text box.
2524
+ *
2525
+ * For headless or server use, see `range.insertText(text, 'Replace')` with
2526
+ * `document.changeTrackingMode` set to `'TrackMineOnly'` in `@docx-editor.dev/editor-api`.
2527
+ *
2528
+ * @example
2529
+ * ```ts
2530
+ * const [match] = editor.findMatches('30 days', { matchCase: true });
2531
+ * if (match) editor.exec({ type: 'replaceMatch', match, text: '45 days' });
2532
+ * ```
2533
+ *
2534
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/tracked-replacement | Replace as a tracked change}
2625
2535
  */
2626
2536
  replaceMatch: {
2627
2537
  match: TextMatch;
@@ -2872,51 +2782,6 @@ interface EditorQueryResults extends DocQueryResults {
2872
2782
  trackedChanges: readonly Revision[];
2873
2783
  bookmarks: readonly BookmarkSummary[];
2874
2784
  }
2875
- /**
2876
- * One occurrence of a search query in the document.
2877
- *
2878
- * Carries TWO addresses on purpose. `blockId` + `start` is the engine's own: stable
2879
- * across edits and independent of ordering. `paragraphIndex` + `runIndex` + `runOffset`
2880
- * is the positional one a find/replace UI needs to show and navigate results, and it is
2881
- * derived from the same walk rather than left to the caller to reconstruct — a caller
2882
- * guessing at run boundaries would send the selection to the wrong place.
2883
- *
2884
- * A match can span runs when formatting changes mid-word; the run address is where it
2885
- * STARTS. `scope` identifies a non-body story so navigation opens the correct surface.
2886
- * A frame scope selects its anchoring drawing and never places a caret inside its story.
2887
- * A match inside a field result reports the field atom's model range. Its `length` is one,
2888
- * while `text` carries the visible match and can be longer. Select with `start` and `length`.
2889
- * Never derive the selected length from `text.length`.
2890
- */
2891
- interface TextMatch {
2892
- readonly blockId: string;
2893
- /** Character offset within the paragraph's concatenated run text. */
2894
- readonly start: number;
2895
- readonly length: number;
2896
- /**
2897
- * Paragraph ordinal within this match's story. Table and nested-table paragraphs count.
2898
- * Non-paragraph blocks add no ordinal.
2899
- */
2900
- readonly paragraphIndex: number;
2901
- /** Index of the run the match starts in, and the offset within that run. */
2902
- readonly runIndex: number;
2903
- readonly runOffset: number;
2904
- /** Story containing the match. Absence means the body. */
2905
- readonly scope?: ViewScope;
2906
- /** The matched text as it appears in the document. */
2907
- readonly text: string;
2908
- /**
2909
- * Paragraph text immediately before and after the match, bounded at the derivation
2910
- * boundary. A results list shows the match in its sentence — "…as described in this
2911
- * **Exhi**bit A" — and nothing else in the contract can reach paragraph text, so a
2912
- * caller would otherwise have to re-read the document to render one row.
2913
- *
2914
- * Optional and additive: an implementation that has not derived them omits them, and a
2915
- * consumer treats absent as empty.
2916
- */
2917
- readonly contextBefore?: string;
2918
- readonly contextAfter?: string;
2919
- }
2920
2785
  /**
2921
2786
  * The hyperlink under a position: where it points, how far it reaches, and what Word shows on
2922
2787
  * hover.
@@ -2965,12 +2830,12 @@ interface EditorSnapshot {
2965
2830
  * point on — it never depends on one existing. */
2966
2831
  readonly isLoading: boolean;
2967
2832
  /**
2968
- * Whether a supplied document is still on its way to painted pages. Opening a large
2969
- * document mounts behind one painted frame so a loading screen can show instead of a
2970
- * frozen page; this is true for exactly that window, and across it the previous
2971
- * document (if any) stays on screen. Show a loading overlay while it holds — but gate
2972
- * only chrome on it, never the mount point, which must stay mounted for the open to
2973
- * complete ({@link EditorSnapshot.isLoading} is the gate-safe flag). Optional and
2833
+ * Whether a supplied document is still on its way to painted pages. A large document
2834
+ * mounts behind one painted frame so a loading screen can show instead of a frozen page,
2835
+ * with the previous document (if any) still on screen. Show an overlay while it holds,
2836
+ * but gate only chrome on it, never the mount point, which must stay mounted for the open
2837
+ * to complete ({@link EditorSnapshot.isLoading} is the gate-safe flag). It turns false
2838
+ * when the first pages paint; they take input while the rest lay out. Optional and
2974
2839
  * additive: absent means the implementation has not derived it, read as `false`.
2975
2840
  */
2976
2841
  readonly isOpening?: boolean;
@@ -3137,5 +3002,5 @@ interface EditorError extends Error {
3137
3002
  readonly code?: string;
3138
3003
  }
3139
3004
 
3140
- export { DIAGNOSTIC_SCHEMA_VERSION as D, EditorFontError as J, DEFAULT_REVIEW_PANE as aY, cropPercentFromCropPermille as b2, cropPercentFromPermille as b3, cropPercentFromSourceCrop as b4, cropPermilleFromCropPercent as b5, cropPermilleFromPercent as b6, resolveReviewPane as b7, reviewPaneListsItem as b8, sourceCropFromCropPercent as b9, validateImageCropPercent as ba };
3141
- export type { FontFailedDiagnostic as $, AnchorHighlightAnimation as A, BookmarkPlace as B, CanResult as C, EditorDiagnostic as E, EditorCommandShape as F, EditorCommands as G, EditorError as H, EditorEvents as I, EditorFontErrorCode as K, EditorFormatPainterCommands as L, EditorHeaderFooterCommands as M, EditorHighlights as N, EditorHostChange as O, EditorHostDocument as P, EditorNoteCommands as Q, ReviewPaneOptions as R, EditorPosition as S, EditorQueries as T, EditorQuery as U, EditorQueryResults as V, EditorReviewHits as W, EditorSelection as X, EditorSnapshot as Y, FontConfiguration as Z, FontFaceRequest as _, EditorDiagnosticKind as a, ReviewPaneItemFields as a$, FontSource as a0, FontSourceSubstitution as a1, FormatPainterLevel as a2, FormatPainterMode as a3, FormatPainterSurfaceState as a4, FurnitureVariant as a5, HeaderFooterSlotArgs as a6, HeaderFooterState as a7, HighlightHit as a8, HighlightOptions as a9, ScrollPlacement as aA, ScrollToAnchorOptions as aB, SelectedImageState as aC, SessionActivity as aD, SessionDiagnostic as aE, SetReviewChangesAuthorOptions as aF, TableBorderEdgeTarget as aG, TableBorderSpec as aH, TableBorderStyle as aI, TableBorderTarget as aJ, TableCellVerticalAlignment as aK, TableColumnDividerResizeTarget as aL, TableColumnOccurrenceTarget as aM, TableContext as aN, TableRightEdgeResizeTarget as aO, TableRowOccurrenceTarget as aP, TextMatch as aQ, TimingSummary as aR, TrackedChangeFilterMode as aS, TrackedChangePredicate as aT, ZoomFitTarget as aU, ZoomMode as aV, ReviewPaneOverflow as aW, CommentMarkerStyle as aX, ImageCropPermille as aZ, ResolvedReviewPane as a_, HighlightRange as aa, HighlightRect as ab, HighlightResult as ac, HistoryDiagnosticEvent as ad, HyperlinkInfo as ae, ImageContext as af, ImageCropPercent as ag, NoteKind as ah, NotePropertiesSide as ai, NotePropertiesState as aj, PageSetup as ak, PerformanceDiagnostic as al, ResolveReviewChangesOptions as am, ResolvedNoteNumbering as an, ReviewActivationOptions as ao, ReviewChangesAttribution as ap, ReviewCommentPlacement as aq, ReviewCustomPlacement as ar, ReviewItemHit as as, ReviewItemPlacement as at, ReviewItemPlacementBase as au, ReviewItemQuery as av, ReviewItemRevealEvent as aw, ReviewItemRevealSource as ax, ReviewRevisionPlacement as ay, ReviewSkippedDiagnostic as az, EditorCommand as b, ReviewPaneOpening as b0, RevisionDisplay as b1, AnchorHighlightOptions as c, AuthoredNoteNumbering as d, BookmarkStory as e, BookmarkSummary as f, ClearAnchorHighlightOptions as g, CollaborationParticipantsDiagnostic as h, CollaborationStatusDiagnostic as i, CustomNodeDiagnosticEvent as j, DiagnosticBase as k, DiagnosticFailureDetail as l, DocumentChange as m, DocumentEditingMode as n, DocumentHandle as o, DocumentOpenDiagnostic as p, DocumentOpenFailure as q, DocumentOpenFailureReason as r, DocumentSaveDiagnostic as s, DocumentShape as t, DocumentSource as u, EditRejectedDiagnostic as v, EditRejectionOrigin as w, Editor as x, EditorAnchorNavigation as y, EditorBookmarkCommands as z };
3005
+ export { DIAGNOSTIC_SCHEMA_VERSION as D, EditorFontError as J, cropPercentFromCropPermille as aR, cropPercentFromPermille as aS, cropPercentFromSourceCrop as aT, cropPermilleFromCropPercent as aU, cropPermilleFromPercent as aV, sourceCropFromCropPercent as aW, validateImageCropPercent as aX };
3006
+ export type { FurnitureVariant as $, AnchorHighlightAnimation as A, BookmarkPlace as B, CanResult as C, EditorDiagnostic as E, EditorCommandShape as F, EditorCommands as G, EditorError as H, EditorEvents as I, EditorFormatPainterCommands as K, EditorHeaderFooterCommands as L, EditorHighlights as M, EditorHostChange as N, EditorHostDocument as O, EditorNoteCommands as P, EditorPosition as Q, EditorQueries as R, EditorQuery as S, EditorQueryResults as T, EditorReviewHits as U, EditorSelection as V, EditorSnapshot as W, FontFailedDiagnostic as X, FormatPainterLevel as Y, FormatPainterMode as Z, FormatPainterSurfaceState as _, EditorDiagnosticKind as a, HeaderFooterSlotArgs as a0, HeaderFooterState as a1, HighlightHit as a2, HighlightOptions as a3, HighlightRange as a4, HighlightRect as a5, HighlightResult as a6, HistoryDiagnosticEvent as a7, HyperlinkInfo as a8, ImageContext as a9, TableBorderEdgeTarget as aA, TableBorderSpec as aB, TableBorderStyle as aC, TableBorderTarget as aD, TableCellVerticalAlignment as aE, TableColumnDividerResizeTarget as aF, TableColumnOccurrenceTarget as aG, TableContext as aH, TableRightEdgeResizeTarget as aI, TableRowOccurrenceTarget as aJ, TextMatch as aK, TimingSummary as aL, TrackedChangeFilterMode as aM, TrackedChangePredicate as aN, ZoomFitTarget as aO, ZoomMode as aP, ImageCropPermille as aQ, ImageCropPercent as aa, NoteKind as ab, NotePropertiesSide as ac, NotePropertiesState as ad, PageSetup as ae, PerformanceDiagnostic as af, ResolveReviewChangesOptions as ag, ResolvedNoteNumbering as ah, ReviewActivationOptions as ai, ReviewChangesAttribution as aj, ReviewCommentPlacement as ak, ReviewCustomPlacement as al, ReviewItemHit as am, ReviewItemPlacement as an, ReviewItemPlacementBase as ao, ReviewItemQuery as ap, ReviewItemRevealEvent as aq, ReviewItemRevealSource as ar, ReviewRevisionPlacement as as, ReviewSkippedDiagnostic as at, ScrollPlacement as au, ScrollToAnchorOptions as av, SelectedImageState as aw, SessionActivity as ax, SessionDiagnostic as ay, SetReviewChangesAuthorOptions as az, EditorCommand as b, AnchorHighlightOptions as c, AuthoredNoteNumbering as d, BookmarkStory as e, BookmarkSummary as f, ClearAnchorHighlightOptions as g, CollaborationParticipantsDiagnostic as h, CollaborationStatusDiagnostic as i, CustomNodeDiagnosticEvent as j, DiagnosticBase as k, DiagnosticFailureDetail as l, DocumentChange as m, DocumentEditingMode as n, DocumentHandle as o, DocumentOpenDiagnostic as p, DocumentOpenFailure as q, DocumentOpenFailureReason as r, DocumentSaveDiagnostic as s, DocumentShape as t, DocumentSource as u, EditRejectedDiagnostic as v, EditRejectionOrigin as w, Editor as x, EditorAnchorNavigation as y, EditorBookmarkCommands as z };
@@ -0,0 +1,53 @@
1
+ /** A concrete font face requested by authored document content. */
2
+ interface FontFaceRequest {
3
+ readonly family: string;
4
+ readonly weight: number;
5
+ readonly style: 'normal' | 'italic';
6
+ }
7
+ /** Immutable, byte-backed font face supplied to layout and browser paint. */
8
+ interface FontSource {
9
+ readonly request: FontFaceRequest;
10
+ readonly id: string;
11
+ readonly bytes: Uint8Array;
12
+ readonly hash: string;
13
+ readonly faceIndex: number;
14
+ readonly availability?: 'available' | 'forbidden';
15
+ }
16
+ /** An explicit authored-font substitution. No implicit platform fallback is performed. */
17
+ interface FontSourceSubstitution {
18
+ readonly from: FontFaceRequest;
19
+ readonly to: FontFaceRequest;
20
+ /** Word line-box metrics for the requested face, expressed as em ratios. */
21
+ readonly lineMetrics?: {
22
+ readonly heightEm: number;
23
+ readonly baselineEm: number;
24
+ };
25
+ }
26
+ /**
27
+ * Public font source configuration sampled when an adapter mounts. It must be immutable for that
28
+ * editor lifetime; remount the adapter to replace bytes or substitutions atomically.
29
+ */
30
+ interface FontConfiguration {
31
+ /** Selectable provider families, independent of loaded bytes. Listing them performs no fetch. */
32
+ readonly supportedFamilies?: readonly string[];
33
+ readonly epoch: number;
34
+ readonly maxFontBytes: number;
35
+ readonly sources: readonly FontSource[];
36
+ readonly substitutions?: readonly FontSourceSubstitution[];
37
+ readonly defaultFont: {
38
+ readonly family: string;
39
+ readonly sizeHalfPoints: number;
40
+ };
41
+ readonly language?: string;
42
+ }
43
+ /**
44
+ * Why a font was not admitted.
45
+ *
46
+ * Distinguished rather than collapsed because the responses differ: `overLimit` and `malformed`
47
+ * are the caller's own bytes, while `forbidden` and `hashMismatch` mean the source was not what
48
+ * it claimed and the load should not be retried. `wasmUnavailable` alone is a HOST fault — the
49
+ * shaper's WASM never loaded, `diagnostic` carries the remedy — surface it as a setup error.
50
+ */
51
+ type EditorFontErrorCode = 'initializationFailed' | 'wasmUnavailable' | 'missing' | 'forbidden' | 'overLimit' | 'malformed' | 'hashMismatch' | 'metadataMismatch' | 'fontFaceLoadFailed' | 'unsupportedFaceIndex' | 'missingFont' | 'hashInvalid' | 'fontMismatch' | 'unsupportedFace' | 'loadFailed';
52
+
53
+ export type { EditorFontErrorCode as E, FontConfiguration as F, FontFaceRequest as a, FontSource as b, FontSourceSubstitution as c };
@@ -134,4 +134,4 @@ interface HistoryDiagnostic {
134
134
  readonly reason: string;
135
135
  }
136
136
 
137
- export type { EditorScope as E, HistoryDiagnostic as H, ViewScope as V, EditorExecOptions as a, HistoryGroup as b, HistoryGroupOptions as c, HistoryGroupOutcome as d };
137
+ export type { EditorScope as E, HistoryGroupOutcome as H, ViewScope as V, EditorExecOptions as a, HistoryDiagnostic as b, HistoryGroup as c, HistoryGroupOptions as d };