@docx-editor.dev/pro 2.30.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 (75) hide show
  1. package/README.md +24 -0
  2. package/dist/chunk-3WTOHPAB.js +1 -0
  3. package/dist/chunk-AVZO5ZHZ.js +1 -0
  4. package/dist/{chunk-CNXDNDD3.js → chunk-DLYVBBO7.js} +1 -1
  5. package/dist/chunk-GAGYRL3L.js +5 -0
  6. package/dist/chunk-HMSOWKXT.js +1 -0
  7. package/dist/chunk-I6HVINA4.cjs +1 -0
  8. package/dist/chunk-MHB6ID2P.cjs +1 -0
  9. package/dist/chunk-PMS3PGOE.cjs +1 -0
  10. package/dist/{chunk-N34IUO36.cjs → chunk-RYF4SNKX.cjs} +1 -1
  11. package/dist/chunk-YOWEY5F3.cjs +5 -0
  12. package/dist/collaboration/hocuspocus.cjs +1 -1
  13. package/dist/collaboration/hocuspocus.d.cts +3 -3
  14. package/dist/collaboration/hocuspocus.d.ts +3 -3
  15. package/dist/collaboration/hocuspocus.js +1 -1
  16. package/dist/collaboration/index.cjs +2 -2
  17. package/dist/collaboration/index.d.cts +63 -7
  18. package/dist/collaboration/index.d.ts +63 -7
  19. package/dist/collaboration/index.js +2 -2
  20. package/dist/collaboration/webrtc.cjs +2 -2
  21. package/dist/collaboration/webrtc.d.cts +34 -15
  22. package/dist/collaboration/webrtc.d.ts +34 -15
  23. package/dist/collaboration/webrtc.js +2 -2
  24. package/dist/{document-session-_v9vqiSX.d.cts → document-session-B-MlORjE.d.cts} +105 -9
  25. package/dist/{document-session-Bxs4_GgX.d.ts → document-session-B-iH-YCU.d.ts} +105 -9
  26. package/dist/document-session-B35ZX2W4.js +1 -0
  27. package/dist/document-session-V3O7XBJY.cjs +1 -0
  28. package/dist/{document-session-options-DelOC7PX.d.ts → document-session-options-CdOH-TNn.d.ts} +1 -1
  29. package/dist/{document-session-options-CfKypp9c.d.cts → document-session-options-CxR0F5xT.d.cts} +1 -1
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.cts +2 -1
  32. package/dist/index.d.ts +2 -1
  33. package/dist/index.js +1 -1
  34. package/dist/react/hocuspocus.d.cts +2 -2
  35. package/dist/react/hocuspocus.d.ts +2 -2
  36. package/dist/react/index.cjs +2 -2
  37. package/dist/react/index.d.cts +283 -16
  38. package/dist/react/index.d.ts +283 -16
  39. package/dist/react/index.js +2 -2
  40. package/dist/react/webrtc.d.cts +9 -4
  41. package/dist/react/webrtc.d.ts +9 -4
  42. package/dist/{types-BQ1vBt5Q.d.ts → types-DvGpDOcZ.d.cts} +9 -1
  43. package/dist/{types-BQ1vBt5Q.d.cts → types-DvGpDOcZ.d.ts} +9 -1
  44. package/dist/{types-6EmrEn4n.d.cts → types-bt2k1VO0.d.cts} +9 -1
  45. package/dist/{types-6EmrEn4n.d.ts → types-bt2k1VO0.d.ts} +9 -1
  46. package/dist/vue/hocuspocus.cjs +1 -1
  47. package/dist/vue/hocuspocus.d.cts +2 -2
  48. package/dist/vue/hocuspocus.d.ts +2 -2
  49. package/dist/vue/hocuspocus.js +1 -1
  50. package/dist/vue/index.cjs +2 -2
  51. package/dist/vue/index.d.cts +285 -16
  52. package/dist/vue/index.d.ts +285 -16
  53. package/dist/vue/index.js +2 -2
  54. package/dist/vue/webrtc.cjs +1 -1
  55. package/dist/vue/webrtc.d.cts +9 -4
  56. package/dist/vue/webrtc.d.ts +9 -4
  57. package/dist/vue/webrtc.js +1 -1
  58. package/docs/accept-reject-without-scrolling.md +95 -0
  59. package/docs/comment-on-found-text.md +72 -0
  60. package/docs/custom-review-cards.md +178 -0
  61. package/docs/highlight-ranges.md +48 -0
  62. package/docs/index.md +36 -0
  63. package/docs/propose-rewrite.md +247 -0
  64. package/docs/tracked-replacement.md +68 -0
  65. package/package.json +5 -4
  66. package/dist/chunk-FD2KDBHX.cjs +0 -1
  67. package/dist/chunk-JRHEYVVY.cjs +0 -1
  68. package/dist/chunk-L567WP3J.js +0 -5
  69. package/dist/chunk-MJECUVHQ.cjs +0 -5
  70. package/dist/chunk-P2EF7WMV.js +0 -1
  71. package/dist/chunk-Q5JTCGJI.js +0 -1
  72. package/dist/chunk-SNQCYZLT.js +0 -1
  73. package/dist/chunk-ZSAAX6HV.cjs +0 -1
  74. package/dist/document-session-3VC43WNI.cjs +0 -1
  75. package/dist/document-session-J2YKWERI.js +0 -1
@@ -31,17 +31,17 @@ import { a as CustomNodeDefinition, b as ActivatedCustomNode, A as AnyCustomNode
31
31
  export { j as ReviewModuleOptions, q as reviewModule } from '../define-custom-node-CNRQG1TI.cjs';
32
32
  export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from '../collaboration-module-DWn2heE1.cjs';
33
33
  import * as react from 'react';
34
- import { ReactNode } from 'react';
34
+ import { ReactNode, RefObject } from 'react';
35
35
  import { ToolbarTranslate, ReviewAuthorInfo, DocxEditorRootProps } from '@docx-editor.dev/react';
36
- import { ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
36
+ import { EditDiagnosticCode, ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
37
37
  export { ReviewActivationOptions, ReviewItemRevealEvent, ReviewItemRevealSource, ScrollPlacement } from '@docx-editor.dev/core/contracts/editor';
38
38
  import { CollaborationParticipant, CollaborationRemoteSelection, CollaborationStatus, CollaborationFailure } from '@docx-editor.dev/core/collaboration';
39
39
  export { CollaborationFailure, CollaborationFailureCode, CollaborationIdentity, CollaborationParticipant, CollaborationRemoteSelection, CollaborationRemoteSelectionAddress, CollaborationSelectionKind, CollaborationStatus, CollaborationStatusSnapshot } from '@docx-editor.dev/core/collaboration';
40
- import { C as CollaborationSession } from '../types-BQ1vBt5Q.cjs';
41
- export { a as CollaborationBootstrap, b as CollaborationIdentityUpdate } from '../types-BQ1vBt5Q.cjs';
40
+ import { C as CollaborationSession } from '../types-DvGpDOcZ.cjs';
41
+ export { a as CollaborationBootstrap, b as CollaborationIdentityUpdate } from '../types-DvGpDOcZ.cjs';
42
42
  import { EditorModule } from '@docx-editor.dev/core/editor';
43
43
  export { CommentMarkerStyle, ResolvedReviewPane, ReviewPaneOpening, ReviewPaneOptions, ReviewPaneOverflow, RevisionDisplay } from '@docx-editor.dev/core/editor';
44
- import { C as CreateDocumentCollaborationOptions } from '../document-session-options-CfKypp9c.cjs';
44
+ import { C as CreateDocumentCollaborationOptions } from '../document-session-options-CxR0F5xT.cjs';
45
45
  import '@docx-editor.dev/core/store';
46
46
  import 'yjs';
47
47
  import 'y-protocols/awareness';
@@ -58,6 +58,36 @@ interface ReviewAdoptOptions {
58
58
  readonly date?: Date;
59
59
  }
60
60
 
61
+ /**
62
+ * The review write a refusal answered.
63
+ *
64
+ * @public
65
+ */
66
+ type ReviewWriteAction = 'accept' | 'reject' | 'resolve' | 'reopen' | 'remove' | 'reply' | 'comment';
67
+ /**
68
+ * A review write the editor refused.
69
+ *
70
+ * @public
71
+ */
72
+ interface ReviewWriteRefusal {
73
+ /** Which write was refused. */
74
+ readonly action: ReviewWriteAction;
75
+ /** The card the write addressed, or null for a new comment on the selection. */
76
+ readonly key: string | null;
77
+ /** The public diagnostic code, the same one `onDiagnostic` reports for the refusal. */
78
+ readonly code: EditDiagnosticCode;
79
+ /**
80
+ * Rises with every refusal of this editor, so the same refusal twice still differs. Key a
81
+ * live announcement on it to announce a repeat.
82
+ */
83
+ readonly sequence: number;
84
+ /**
85
+ * True when retrying cannot help: the collaboration session ended, so the document must be
86
+ * opened again before it takes another review write.
87
+ */
88
+ readonly final: boolean;
89
+ }
90
+
61
91
  /**
62
92
  * One card's data plus where it belongs on screen.
63
93
  *
@@ -111,7 +141,10 @@ interface UseReviewReturn {
111
141
  * useEditorEvent('reviewItemReveal', ({ key, source }) => openMyCard(key, source));
112
142
  * setActive(key); // fires nothing
113
143
  * setActive(key, { announce: true }); // fires 'reviewItemReveal'
144
+ * setActive(key, { reveal: false }); // opens the item without scrolling
114
145
  * ```
146
+ *
147
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
115
148
  */
116
149
  readonly setActive: (key: string | null, options?: ReviewActivationOptions) => boolean;
117
150
  /**
@@ -120,9 +153,17 @@ interface UseReviewReturn {
120
153
  * False for an item whose `readOnly` is true, and equally for a resolution the engine
121
154
  * refuses on other grounds — a document open for viewing refuses every one. A caller
122
155
  * that assumed success drew a live button that did nothing.
156
+ *
157
+ * For headless or server use, see `Revision.accept()` in `@docx-editor.dev/editor-api`.
158
+ *
159
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
123
160
  */
124
161
  readonly accept: (item: ReviewItemView) => boolean;
125
- /** Reject a revision. Reports whether it landed, on the same terms as {@link accept}. */
162
+ /**
163
+ * Reject a revision. Reports whether it landed, on the same terms as {@link accept}.
164
+ *
165
+ * For headless or server use, see `Revision.reject()` in `@docx-editor.dev/editor-api`.
166
+ */
126
167
  readonly reject: (item: ReviewItemView) => boolean;
127
168
  /**
128
169
  * Adopt tracked changes as the reviewer's own: they record the reviewer as their author
@@ -162,6 +203,8 @@ interface UseReviewReturn {
162
203
  * neither rather than writing an empty attribute — which is why this REPORTS whether the
163
204
  * reply landed. A box that cleared itself on a refusal would throw the text away and show
164
205
  * nothing, and the writer would not learn their reply never existed.
206
+ *
207
+ * For headless or server use, see `Comment.reply` in `@docx-editor.dev/editor-api`.
165
208
  */
166
209
  readonly reply: (item: ReviewItemView, text: string, author?: string) => boolean;
167
210
  /**
@@ -170,8 +213,39 @@ interface UseReviewReturn {
170
213
  * From the engine, not from the DOM — the same rule the card anchors follow.
171
214
  */
172
215
  readonly selectionAnchorY: number | null;
173
- /** Comment on the current selection. Reports whether it landed, like {@link reply}. */
216
+ /**
217
+ * Comment on the current selection. Reports whether it landed, like {@link reply}.
218
+ *
219
+ * To comment on found text, select it first with `editor.findMatches` and
220
+ * `editor.selectMatch`. For headless or server use, see `Range.insertComment` in
221
+ * `@docx-editor.dev/editor-api`.
222
+ *
223
+ * @example
224
+ * ```tsx
225
+ * const [match] = editor.findMatches('Effective Date', { wholeWord: true });
226
+ * if (match && editor.selectMatch(match).ok) comment('Define this term.');
227
+ * ```
228
+ *
229
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/comment-on-found-text | Comment on found text}
230
+ */
174
231
  readonly comment: (text: string, author?: string) => boolean;
232
+ /**
233
+ * Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null.
234
+ *
235
+ * Shared by every `useReview()` over the same editor, so a custom card sees a refusal the
236
+ * packaged rail recorded. Set by a refused write and cleared by the next one that lands, and
237
+ * by a change to the document, the editing mode, editability, the collaboration status or
238
+ * the author filter. A caret move keeps it. The packaged cards show it as a sentence; a
239
+ * custom card reads `key` to place it and `code`, the public diagnostic code, to word it.
240
+ *
241
+ * @example
242
+ * ```tsx
243
+ * const { lastRefusal } = useReview();
244
+ * // The packaged rail announces it; this only shows it.
245
+ * return lastRefusal?.key === item.key ? <p>{lastRefusal.code}</p> : null;
246
+ * ```
247
+ */
248
+ readonly lastRefusal: ReviewWriteRefusal | null;
175
249
  /** Whether the pane shows cards. Engine state: the toolbar's comments button toggles it. */
176
250
  readonly paneOpen: boolean;
177
251
  /** Open or close the pane — the same toggle the toolbar button runs. */
@@ -184,6 +258,11 @@ interface UseReviewReturn {
184
258
  *
185
259
  * Subscribes to the editor's own change stream, so the list re-derives when the document does
186
260
  * and not on every render.
261
+ *
262
+ * This is the browser review API: comment, reply, accept, reject, and open items from your own
263
+ * UI. For headless, server, or agent pipelines, use `@docx-editor.dev/editor-api` instead.
264
+ *
265
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes | Which API for which job}
187
266
  */
188
267
  declare function useReview(query?: ReviewItemQuery): UseReviewReturn;
189
268
  /** The same hook against an explicit editor, for hosts that hold their own. */
@@ -198,16 +277,27 @@ declare function useReviewOf(editor: Editor | null, query?: ReviewItemQuery): Us
198
277
  *
199
278
  * Takes anything with a key and an anchor, not only cards: a compose box competes for the
200
279
  * same column and has to be stacked WITH them or it lands on top of the card whose text was
201
- * just re-selected. Entries must arrive in document order — the run is a single sweep.
280
+ * just re-selected. Entries must arrive in document order.
281
+ *
282
+ * An entry with `isActive: true`, as a review placement has while its card is open, stays at
283
+ * its own anchor. The entries before it move up to make room, so Next Change never leaves the
284
+ * open card below the visible rail. Pass placements through as they are to keep this.
202
285
  *
203
286
  * UNITS. Anchors are in layout POINTS, because that is what the engine publishes; measured
204
287
  * heights are in CSS PIXELS, because that is what the DOM reports. Pass `scale` so the two
205
288
  * can be added. Without it a 330px card advanced the run by 330 POINTS — 440px — and two
206
289
  * comments on adjacent lines of one paragraph sat a third of a page apart.
290
+ *
291
+ * Returns each card's top in layout points. `useReviewRailMetrics` supplies `scale` and the
292
+ * pixel offset of the first page: a card's CSS `top` is `metrics.top + position * metrics.scale`.
293
+ *
294
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
207
295
  */
208
296
  declare function useStackedReviewPositions(items: readonly {
209
297
  readonly key: string;
210
298
  readonly anchorY: number | null;
299
+ /** Keep this entry at its own anchor; the entries before it move up. */
300
+ readonly isActive?: boolean;
211
301
  }[], heights: ReadonlyMap<string, number>, options?: {
212
302
  readonly gap?: number;
213
303
  readonly scale?: number;
@@ -329,6 +419,26 @@ interface ReviewMarkersProps {
329
419
  icon?: ReactNode | ((item: ReviewItemView) => ReactNode);
330
420
  }
331
421
 
422
+ /**
423
+ * Props of `DocxEditorReview.Draft`.
424
+ *
425
+ * @public
426
+ */
427
+ interface ReviewDraftProps extends ReviewPartProps {
428
+ /**
429
+ * Rail-local `top` in CSS pixels. Omit it to use the packaged card stack's position. Pass
430
+ * your own when you render your own cards, so the box stacks with them.
431
+ */
432
+ top?: number;
433
+ /**
434
+ * Rail-local `left` for the COMPACT rail, where the strip is 32px wide and a box laid
435
+ * out at column width would be cut by the viewport's edge. Omit it to use the compact
436
+ * card's position in the compact rail and the rail's own column otherwise. Null keeps the
437
+ * box in the rail's own column.
438
+ */
439
+ left?: number | null;
440
+ }
441
+
332
442
  declare const ReviewResolve: {
333
443
  ({ className, asChild, hidden, children, icon: glyph }: ReviewActionProps): react.JSX.Element | null;
334
444
  docxReviewPart: "Resolve";
@@ -338,10 +448,7 @@ declare const ReviewReopen: {
338
448
  docxReviewPart: "Reopen";
339
449
  };
340
450
  declare const ReviewDraft: {
341
- ({ top, left, className, hidden, }: ReviewPartProps & {
342
- top?: number;
343
- left?: number | null;
344
- }): react.JSX.Element | null;
451
+ (props: ReviewDraftProps): react.JSX.Element | null;
345
452
  docxReviewPart: "Draft";
346
453
  };
347
454
  declare const ReviewReply: {
@@ -366,6 +473,18 @@ declare function ReviewCard({ className, asChild, hidden, children }: ReviewPart
366
473
  declare namespace ReviewCard {
367
474
  var docxReviewPart: "Card";
368
475
  }
476
+ /**
477
+ * Why the card's last action did not land, when the editor refused it: an external refresh,
478
+ * viewing, protection, or a collaboration session that is not ready. Absent otherwise. A
479
+ * refused reply is shown by the reply line instead.
480
+ *
481
+ * Plain text, readable with the card: the rail's live region is what announces it, because a
482
+ * live region inside a `role="button"` card is not reliably announced. @public
483
+ */
484
+ declare function ReviewRefusal({ className, asChild, hidden, children }: ReviewPartProps): react.JSX.Element | null;
485
+ declare namespace ReviewRefusal {
486
+ var docxReviewPart: "Refusal";
487
+ }
369
488
  /** The author's initials, in their colour. @public */
370
489
  declare function ReviewAvatar({ className, asChild, hidden, children }: ReviewPartProps): react.JSX.Element | null;
371
490
  declare namespace ReviewAvatar {
@@ -565,6 +684,123 @@ declare function useReviewItem(): ReviewItemView | null;
565
684
  */
566
685
  declare function useReviewAuthor(author: string | undefined): ReviewAuthorInfo | undefined;
567
686
 
687
+ /**
688
+ * Where a review column sits, in the coordinates of the editor's scroll container.
689
+ *
690
+ * Review anchors (`item.anchorY`) and stacked positions (`useStackedReviewPositions`) are in
691
+ * layout points from the top of the first page. These values convert them to CSS pixels.
692
+ *
693
+ * @example Position a card at its stacked anchor
694
+ * ```ts
695
+ * const top = metrics.top + positions.get(item.key)! * metrics.scale;
696
+ * ```
697
+ *
698
+ * @public
699
+ */
700
+ interface ReviewRailMetrics {
701
+ /** CSS pixels per layout point, zoom included. */
702
+ readonly scale: number;
703
+ /**
704
+ * CSS pixels from the scroll container's top padding edge, in its scrolled content, to the
705
+ * top of the first page. Content above the pages, such as a host banner inside the
706
+ * viewport, is included. Scrolling does not change it.
707
+ */
708
+ readonly top: number;
709
+ /**
710
+ * CSS pixels from the scroll container's left padding edge, in its scrolled content, to
711
+ * the column's left edge: one 16px gutter right of the page. `null` until there is a page
712
+ * to measure. Keep the column hidden while it is `null`.
713
+ */
714
+ readonly left: number | null;
715
+ /**
716
+ * The `left` value, relative to {@link ReviewRailMetrics.left}, that puts a 300px card
717
+ * fully inside the visible area with a 12px inset from its right edge. Use it while
718
+ * {@link ReviewRailMetrics.compact} is true. `null` until there is a page to measure.
719
+ */
720
+ readonly compactCardLeft: number | null;
721
+ /**
722
+ * The review pane is open, but the viewport is too narrow for a full column beside the
723
+ * page. The packaged rail then shows markers and one floating card, the active item's,
724
+ * at `compactCardLeft`.
725
+ */
726
+ readonly compact: boolean;
727
+ }
728
+
729
+ /** Options for {@link useReviewRailMetrics}. @public */
730
+ interface UseReviewRailMetricsOptions {
731
+ /**
732
+ * Re-measure while the scroll container scrolls. Only `compactCardLeft` changes with
733
+ * scrolling, and only when the page is wider than the viewport. Default: `false`.
734
+ */
735
+ readonly trackScroll?: boolean;
736
+ /**
737
+ * With a `railRef`, reserve the review gutter beside the page while the column element is
738
+ * mounted, as `DocxEditorReview` does. The viewport then shifts the page left while the
739
+ * pane is open. The reservation does not show the comment controls in the toolbar and the
740
+ * context menu; see `ReviewRailContext` to serve them from your column. Set `false` when a
741
+ * mounted `DocxEditorReview` already reserves the gutter, or when your column overlays the
742
+ * page. Default: `true`.
743
+ */
744
+ readonly reserveGutter?: boolean;
745
+ }
746
+ /**
747
+ * The review column's geometry in CSS pixels: what converts review anchors and stacked
748
+ * positions, which are layout points from the top of the first page, into a card's `top`.
749
+ *
750
+ * Call it without arguments inside `DocxEditorReview`, for example in children of
751
+ * `<DocxEditorReview preset={false}>`, to read the packaged rail's own measurement. Those
752
+ * children render inside the rail element, which already sits at `left`.
753
+ *
754
+ * Pass `railRef` to measure your own column instead. Attach the ref to an element that
755
+ * the calling component renders, give it `position: absolute`, and render it directly
756
+ * inside `DocxEditor.Viewport` with no positioned element in between: its offset parent
757
+ * must be the scroll container that holds the pages. Development builds warn once when it
758
+ * is not. The column reserves the review gutter unless `reserveGutter` is `false`.
759
+ *
760
+ * While `useReview().paneOpen` is false the viewport reserves only a marker strip, so
761
+ * render no cards then. `compact` is true when the pane is open but too narrow for a column.
762
+ *
763
+ * The value updates when the zoom, the window size, the page count, the document load,
764
+ * content above the pages, or the reserved review gutter changes. It works in a pop-out
765
+ * window or an iframe, because it observes the element's own window.
766
+ *
767
+ * @example Position custom cards
768
+ * ```tsx
769
+ * function MyColumn({ heights }: { heights: ReadonlyMap<string, number> }) {
770
+ * const railRef = useRef<HTMLDivElement>(null);
771
+ * const metrics = useReviewRailMetrics(railRef);
772
+ * const { items } = useReview();
773
+ * const positions = useStackedReviewPositions(items, heights, { scale: metrics.scale });
774
+ * return (
775
+ * <div
776
+ * ref={railRef}
777
+ * style={{
778
+ * position: 'absolute',
779
+ * top: 0,
780
+ * left: metrics.left ?? 0,
781
+ * visibility: metrics.left === null ? 'hidden' : 'visible',
782
+ * }}
783
+ * >
784
+ * {items.map((item) => (
785
+ * <MyCard
786
+ * key={item.key}
787
+ * item={item}
788
+ * style={{
789
+ * position: 'absolute',
790
+ * top: metrics.top + (positions.get(item.key) ?? 0) * metrics.scale,
791
+ * }}
792
+ * />
793
+ * ))}
794
+ * </div>
795
+ * );
796
+ * }
797
+ * ```
798
+ *
799
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
800
+ * @public
801
+ */
802
+ declare function useReviewRailMetrics(railRef?: RefObject<HTMLElement | null> | null, options?: UseReviewRailMetricsOptions): ReviewRailMetrics;
803
+
568
804
  /**
569
805
  * The review rail.
570
806
  *
@@ -595,13 +831,21 @@ interface DocxEditorReviewNamespace {
595
831
  readonly Reopen: typeof ReviewReopen;
596
832
  /** Discard the card: delete a comment thread, or reject a tracked change. */
597
833
  readonly Delete: typeof ReviewDelete;
834
+ /** Why the card's last action was refused, when it was. Absent otherwise. */
835
+ readonly Refusal: typeof ReviewRefusal;
598
836
  readonly Replies: typeof ReviewReplies;
599
837
  readonly Reply: typeof ReviewReply;
600
838
  /** The collapsed rail: one marker per item, shown when the pane is closed. */
601
839
  readonly Markers: typeof ReviewMarkers;
602
- /** The "comment on this" button beside a selected range. */
840
+ /**
841
+ * The "comment on this" button beside a selected range. A root part: put it as a direct
842
+ * child of `DocxEditorReview` so the rail positions it.
843
+ */
603
844
  readonly AddComment: typeof ReviewAddComment;
604
- /** The compose box a new comment is written in. */
845
+ /**
846
+ * The compose box a new comment is written in. It renders only while a draft is open. Pass
847
+ * `top` when you render your own cards; without it, the box uses the packaged card stack.
848
+ */
605
849
  readonly Draft: typeof ReviewDraft;
606
850
  /**
607
851
  * The decision balloon opened by clicking a tracked change in the page: format and
@@ -617,6 +861,29 @@ interface DocxEditorReviewNamespace {
617
861
  * via `createDocxEditor({ modules: [reviewModule()] })` — without it there is nothing to derive
618
862
  * cards from.
619
863
  *
864
+ * PARTS AND SCOPES. The rail reads its parts from its own children, by element type. There are
865
+ * two scopes:
866
+ *
867
+ * - Root parts: `List`, `Markers`, `AddComment`, `Draft`, and `Balloon`. Put them as DIRECT
868
+ * children of `DocxEditorReview` (fragments are transparent). The rail gives them the geometry
869
+ * only it can compute: the comment button's and the compose box's `top`, and the markers'
870
+ * scale and window. A root part inside a wrapper component is not seen as a part. It renders
871
+ * as ordinary content, without that wiring.
872
+ * - Card parts: `Card`, `Empty`, and the parts inside a card (`Author`, `Summary`, `Accept`,
873
+ * `Reject`, `Reply`, and the others). Put them inside `DocxEditorReview.List`, or as other
874
+ * direct children, which become the card template.
875
+ *
876
+ * `preset={false}` drops the packaged defaults. Root parts you pass still get their wiring, and
877
+ * every other child renders as is inside the rail, where `useReviewRailMetrics()` reads the
878
+ * rail's own measurement. To render your own cards, use `useReview().items`,
879
+ * `useStackedReviewPositions`, and `useReviewRailMetrics`. `Draft` without `top` sits where the
880
+ * packaged card stack puts it, so pass `top` from your own stack.
881
+ *
882
+ * In a browser host, this rail and `useReview()` are the way to build a review UI. For headless,
883
+ * server, or agent pipelines, use `@docx-editor.dev/editor-api`.
884
+ *
885
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
886
+ *
620
887
  * @example
621
888
  * ```tsx
622
889
  * <DocxEditorReview>
@@ -1175,5 +1442,5 @@ interface UseDocumentCollaborationReturn {
1175
1442
  */
1176
1443
  declare function useDocumentCollaboration(options?: UseDocumentCollaborationOptions): UseDocumentCollaborationReturn;
1177
1444
 
1178
- export { CollaborationSession, CreateDocumentCollaborationOptions, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, resolveCustomNodeActivation, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useStackedReviewPositions };
1179
- export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewPartProps, ReviewProps, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewReturn };
1445
+ export { CollaborationSession, CreateDocumentCollaborationOptions, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, resolveCustomNodeActivation, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useStackedReviewPositions };
1446
+ export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewDraftProps, ReviewItemView, ReviewMarkersProps, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewReturn };