@docx-editor.dev/pro 2.29.0 → 2.31.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.
@@ -31,9 +31,9 @@ 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';
@@ -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
  *
@@ -172,6 +202,23 @@ interface UseReviewReturn {
172
202
  readonly selectionAnchorY: number | null;
173
203
  /** Comment on the current selection. Reports whether it landed, like {@link reply}. */
174
204
  readonly comment: (text: string, author?: string) => boolean;
205
+ /**
206
+ * Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null.
207
+ *
208
+ * Shared by every `useReview()` over the same editor, so a custom card sees a refusal the
209
+ * packaged rail recorded. Set by a refused write and cleared by the next one that lands, and
210
+ * by a change to the document, the editing mode, editability, the collaboration status or
211
+ * the author filter. A caret move keeps it. The packaged cards show it as a sentence; a
212
+ * custom card reads `key` to place it and `code`, the public diagnostic code, to word it.
213
+ *
214
+ * @example
215
+ * ```tsx
216
+ * const { lastRefusal } = useReview();
217
+ * // The packaged rail announces it; this only shows it.
218
+ * return lastRefusal?.key === item.key ? <p>{lastRefusal.code}</p> : null;
219
+ * ```
220
+ */
221
+ readonly lastRefusal: ReviewWriteRefusal | null;
175
222
  /** Whether the pane shows cards. Engine state: the toolbar's comments button toggles it. */
176
223
  readonly paneOpen: boolean;
177
224
  /** Open or close the pane — the same toggle the toolbar button runs. */
@@ -198,12 +245,19 @@ declare function useReviewOf(editor: Editor | null, query?: ReviewItemQuery): Us
198
245
  *
199
246
  * Takes anything with a key and an anchor, not only cards: a compose box competes for the
200
247
  * 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.
248
+ * just re-selected. Entries must arrive in document order.
249
+ *
250
+ * An entry with `isActive: true`, as a review placement has while its card is open, stays at
251
+ * its own anchor. The entries before it move up to make room, so Next Change never leaves the
252
+ * open card below the visible rail. Pass placements through as they are to keep this.
202
253
  *
203
254
  * UNITS. Anchors are in layout POINTS, because that is what the engine publishes; measured
204
255
  * heights are in CSS PIXELS, because that is what the DOM reports. Pass `scale` so the two
205
256
  * can be added. Without it a 330px card advanced the run by 330 POINTS — 440px — and two
206
257
  * comments on adjacent lines of one paragraph sat a third of a page apart.
258
+ *
259
+ * Returns each card's top in layout points. `useReviewRailMetrics` supplies `scale` and the
260
+ * pixel offset of the first page: a card's CSS `top` is `metrics.top + position * metrics.scale`.
207
261
  */
208
262
  declare function useStackedReviewPositions(items: readonly {
209
263
  readonly key: string;
@@ -366,6 +420,18 @@ declare function ReviewCard({ className, asChild, hidden, children }: ReviewPart
366
420
  declare namespace ReviewCard {
367
421
  var docxReviewPart: "Card";
368
422
  }
423
+ /**
424
+ * Why the card's last action did not land, when the editor refused it: an external refresh,
425
+ * viewing, protection, or a collaboration session that is not ready. Absent otherwise. A
426
+ * refused reply is shown by the reply line instead.
427
+ *
428
+ * Plain text, readable with the card: the rail's live region is what announces it, because a
429
+ * live region inside a `role="button"` card is not reliably announced. @public
430
+ */
431
+ declare function ReviewRefusal({ className, asChild, hidden, children }: ReviewPartProps): react.JSX.Element | null;
432
+ declare namespace ReviewRefusal {
433
+ var docxReviewPart: "Refusal";
434
+ }
369
435
  /** The author's initials, in their colour. @public */
370
436
  declare function ReviewAvatar({ className, asChild, hidden, children }: ReviewPartProps): react.JSX.Element | null;
371
437
  declare namespace ReviewAvatar {
@@ -565,6 +631,122 @@ declare function useReviewItem(): ReviewItemView | null;
565
631
  */
566
632
  declare function useReviewAuthor(author: string | undefined): ReviewAuthorInfo | undefined;
567
633
 
634
+ /**
635
+ * Where a review column sits, in the coordinates of the editor's scroll container.
636
+ *
637
+ * Review anchors (`item.anchorY`) and stacked positions (`useStackedReviewPositions`) are in
638
+ * layout points from the top of the first page. These values convert them to CSS pixels.
639
+ *
640
+ * @example Position a card at its stacked anchor
641
+ * ```ts
642
+ * const top = metrics.top + positions.get(item.key)! * metrics.scale;
643
+ * ```
644
+ *
645
+ * @public
646
+ */
647
+ interface ReviewRailMetrics {
648
+ /** CSS pixels per layout point, zoom included. */
649
+ readonly scale: number;
650
+ /**
651
+ * CSS pixels from the scroll container's top padding edge, in its scrolled content, to the
652
+ * top of the first page. Content above the pages, such as a host banner inside the
653
+ * viewport, is included. Scrolling does not change it.
654
+ */
655
+ readonly top: number;
656
+ /**
657
+ * CSS pixels from the scroll container's left padding edge, in its scrolled content, to
658
+ * the column's left edge: one 16px gutter right of the page. `null` until there is a page
659
+ * to measure. Keep the column hidden while it is `null`.
660
+ */
661
+ readonly left: number | null;
662
+ /**
663
+ * The `left` value, relative to {@link ReviewRailMetrics.left}, that puts a 300px card
664
+ * fully inside the visible area with a 12px inset from its right edge. Use it while
665
+ * {@link ReviewRailMetrics.compact} is true. `null` until there is a page to measure.
666
+ */
667
+ readonly compactCardLeft: number | null;
668
+ /**
669
+ * The review pane is open, but the viewport is too narrow for a full column beside the
670
+ * page. The packaged rail then shows markers and one floating card, the active item's,
671
+ * at `compactCardLeft`.
672
+ */
673
+ readonly compact: boolean;
674
+ }
675
+
676
+ /** Options for {@link useReviewRailMetrics}. @public */
677
+ interface UseReviewRailMetricsOptions {
678
+ /**
679
+ * Re-measure while the scroll container scrolls. Only `compactCardLeft` changes with
680
+ * scrolling, and only when the page is wider than the viewport. Default: `false`.
681
+ */
682
+ readonly trackScroll?: boolean;
683
+ /**
684
+ * With a `railRef`, reserve the review gutter beside the page while the column element is
685
+ * mounted, as `DocxEditorReview` does. The viewport then shifts the page left while the
686
+ * pane is open. The reservation does not show the comment controls in the toolbar and the
687
+ * context menu; see `ReviewRailContext` to serve them from your column. Set `false` when a
688
+ * mounted `DocxEditorReview` already reserves the gutter, or when your column overlays the
689
+ * page. Default: `true`.
690
+ */
691
+ readonly reserveGutter?: boolean;
692
+ }
693
+ /**
694
+ * The review column's geometry in CSS pixels: what converts review anchors and stacked
695
+ * positions, which are layout points from the top of the first page, into a card's `top`.
696
+ *
697
+ * Call it without arguments inside `DocxEditorReview`, for example in children of
698
+ * `<DocxEditorReview preset={false}>`, to read the packaged rail's own measurement. Those
699
+ * children render inside the rail element, which already sits at `left`.
700
+ *
701
+ * Pass `railRef` to measure your own column instead. Attach the ref to an element that
702
+ * the calling component renders, give it `position: absolute`, and render it directly
703
+ * inside `DocxEditor.Viewport` with no positioned element in between: its offset parent
704
+ * must be the scroll container that holds the pages. Development builds warn once when it
705
+ * is not. The column reserves the review gutter unless `reserveGutter` is `false`.
706
+ *
707
+ * While `useReview().paneOpen` is false the viewport reserves only a marker strip, so
708
+ * render no cards then. `compact` is true when the pane is open but too narrow for a column.
709
+ *
710
+ * The value updates when the zoom, the window size, the page count, the document load,
711
+ * content above the pages, or the reserved review gutter changes. It works in a pop-out
712
+ * window or an iframe, because it observes the element's own window.
713
+ *
714
+ * @example Position custom cards
715
+ * ```tsx
716
+ * function MyColumn({ heights }: { heights: ReadonlyMap<string, number> }) {
717
+ * const railRef = useRef<HTMLDivElement>(null);
718
+ * const metrics = useReviewRailMetrics(railRef);
719
+ * const { items } = useReview();
720
+ * const positions = useStackedReviewPositions(items, heights, { scale: metrics.scale });
721
+ * return (
722
+ * <div
723
+ * ref={railRef}
724
+ * style={{
725
+ * position: 'absolute',
726
+ * top: 0,
727
+ * left: metrics.left ?? 0,
728
+ * visibility: metrics.left === null ? 'hidden' : 'visible',
729
+ * }}
730
+ * >
731
+ * {items.map((item) => (
732
+ * <MyCard
733
+ * key={item.key}
734
+ * item={item}
735
+ * style={{
736
+ * position: 'absolute',
737
+ * top: metrics.top + (positions.get(item.key) ?? 0) * metrics.scale,
738
+ * }}
739
+ * />
740
+ * ))}
741
+ * </div>
742
+ * );
743
+ * }
744
+ * ```
745
+ *
746
+ * @public
747
+ */
748
+ declare function useReviewRailMetrics(railRef?: RefObject<HTMLElement | null> | null, options?: UseReviewRailMetricsOptions): ReviewRailMetrics;
749
+
568
750
  /**
569
751
  * The review rail.
570
752
  *
@@ -595,6 +777,8 @@ interface DocxEditorReviewNamespace {
595
777
  readonly Reopen: typeof ReviewReopen;
596
778
  /** Discard the card: delete a comment thread, or reject a tracked change. */
597
779
  readonly Delete: typeof ReviewDelete;
780
+ /** Why the card's last action was refused, when it was. Absent otherwise. */
781
+ readonly Refusal: typeof ReviewRefusal;
598
782
  readonly Replies: typeof ReviewReplies;
599
783
  readonly Reply: typeof ReviewReply;
600
784
  /** The collapsed rail: one marker per item, shown when the pane is closed. */
@@ -1175,5 +1359,5 @@ interface UseDocumentCollaborationReturn {
1175
1359
  */
1176
1360
  declare function useDocumentCollaboration(options?: UseDocumentCollaborationOptions): UseDocumentCollaborationReturn;
1177
1361
 
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 };
1362
+ export { CollaborationSession, CreateDocumentCollaborationOptions, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, resolveCustomNodeActivation, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useStackedReviewPositions };
1363
+ export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewReturn };
@@ -31,9 +31,9 @@ import { a as CustomNodeDefinition, b as ActivatedCustomNode, A as AnyCustomNode
31
31
  export { j as ReviewModuleOptions, q as reviewModule } from '../define-custom-node-D0c36PpZ.js';
32
32
  export { C as CollaborationModuleOptions, P as ProLicenseOptions, c as collaborationModule } from '../collaboration-module-DWn2heE1.js';
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';
@@ -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
  *
@@ -172,6 +202,23 @@ interface UseReviewReturn {
172
202
  readonly selectionAnchorY: number | null;
173
203
  /** Comment on the current selection. Reports whether it landed, like {@link reply}. */
174
204
  readonly comment: (text: string, author?: string) => boolean;
205
+ /**
206
+ * Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null.
207
+ *
208
+ * Shared by every `useReview()` over the same editor, so a custom card sees a refusal the
209
+ * packaged rail recorded. Set by a refused write and cleared by the next one that lands, and
210
+ * by a change to the document, the editing mode, editability, the collaboration status or
211
+ * the author filter. A caret move keeps it. The packaged cards show it as a sentence; a
212
+ * custom card reads `key` to place it and `code`, the public diagnostic code, to word it.
213
+ *
214
+ * @example
215
+ * ```tsx
216
+ * const { lastRefusal } = useReview();
217
+ * // The packaged rail announces it; this only shows it.
218
+ * return lastRefusal?.key === item.key ? <p>{lastRefusal.code}</p> : null;
219
+ * ```
220
+ */
221
+ readonly lastRefusal: ReviewWriteRefusal | null;
175
222
  /** Whether the pane shows cards. Engine state: the toolbar's comments button toggles it. */
176
223
  readonly paneOpen: boolean;
177
224
  /** Open or close the pane — the same toggle the toolbar button runs. */
@@ -198,12 +245,19 @@ declare function useReviewOf(editor: Editor | null, query?: ReviewItemQuery): Us
198
245
  *
199
246
  * Takes anything with a key and an anchor, not only cards: a compose box competes for the
200
247
  * 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.
248
+ * just re-selected. Entries must arrive in document order.
249
+ *
250
+ * An entry with `isActive: true`, as a review placement has while its card is open, stays at
251
+ * its own anchor. The entries before it move up to make room, so Next Change never leaves the
252
+ * open card below the visible rail. Pass placements through as they are to keep this.
202
253
  *
203
254
  * UNITS. Anchors are in layout POINTS, because that is what the engine publishes; measured
204
255
  * heights are in CSS PIXELS, because that is what the DOM reports. Pass `scale` so the two
205
256
  * can be added. Without it a 330px card advanced the run by 330 POINTS — 440px — and two
206
257
  * comments on adjacent lines of one paragraph sat a third of a page apart.
258
+ *
259
+ * Returns each card's top in layout points. `useReviewRailMetrics` supplies `scale` and the
260
+ * pixel offset of the first page: a card's CSS `top` is `metrics.top + position * metrics.scale`.
207
261
  */
208
262
  declare function useStackedReviewPositions(items: readonly {
209
263
  readonly key: string;
@@ -366,6 +420,18 @@ declare function ReviewCard({ className, asChild, hidden, children }: ReviewPart
366
420
  declare namespace ReviewCard {
367
421
  var docxReviewPart: "Card";
368
422
  }
423
+ /**
424
+ * Why the card's last action did not land, when the editor refused it: an external refresh,
425
+ * viewing, protection, or a collaboration session that is not ready. Absent otherwise. A
426
+ * refused reply is shown by the reply line instead.
427
+ *
428
+ * Plain text, readable with the card: the rail's live region is what announces it, because a
429
+ * live region inside a `role="button"` card is not reliably announced. @public
430
+ */
431
+ declare function ReviewRefusal({ className, asChild, hidden, children }: ReviewPartProps): react.JSX.Element | null;
432
+ declare namespace ReviewRefusal {
433
+ var docxReviewPart: "Refusal";
434
+ }
369
435
  /** The author's initials, in their colour. @public */
370
436
  declare function ReviewAvatar({ className, asChild, hidden, children }: ReviewPartProps): react.JSX.Element | null;
371
437
  declare namespace ReviewAvatar {
@@ -565,6 +631,122 @@ declare function useReviewItem(): ReviewItemView | null;
565
631
  */
566
632
  declare function useReviewAuthor(author: string | undefined): ReviewAuthorInfo | undefined;
567
633
 
634
+ /**
635
+ * Where a review column sits, in the coordinates of the editor's scroll container.
636
+ *
637
+ * Review anchors (`item.anchorY`) and stacked positions (`useStackedReviewPositions`) are in
638
+ * layout points from the top of the first page. These values convert them to CSS pixels.
639
+ *
640
+ * @example Position a card at its stacked anchor
641
+ * ```ts
642
+ * const top = metrics.top + positions.get(item.key)! * metrics.scale;
643
+ * ```
644
+ *
645
+ * @public
646
+ */
647
+ interface ReviewRailMetrics {
648
+ /** CSS pixels per layout point, zoom included. */
649
+ readonly scale: number;
650
+ /**
651
+ * CSS pixels from the scroll container's top padding edge, in its scrolled content, to the
652
+ * top of the first page. Content above the pages, such as a host banner inside the
653
+ * viewport, is included. Scrolling does not change it.
654
+ */
655
+ readonly top: number;
656
+ /**
657
+ * CSS pixels from the scroll container's left padding edge, in its scrolled content, to
658
+ * the column's left edge: one 16px gutter right of the page. `null` until there is a page
659
+ * to measure. Keep the column hidden while it is `null`.
660
+ */
661
+ readonly left: number | null;
662
+ /**
663
+ * The `left` value, relative to {@link ReviewRailMetrics.left}, that puts a 300px card
664
+ * fully inside the visible area with a 12px inset from its right edge. Use it while
665
+ * {@link ReviewRailMetrics.compact} is true. `null` until there is a page to measure.
666
+ */
667
+ readonly compactCardLeft: number | null;
668
+ /**
669
+ * The review pane is open, but the viewport is too narrow for a full column beside the
670
+ * page. The packaged rail then shows markers and one floating card, the active item's,
671
+ * at `compactCardLeft`.
672
+ */
673
+ readonly compact: boolean;
674
+ }
675
+
676
+ /** Options for {@link useReviewRailMetrics}. @public */
677
+ interface UseReviewRailMetricsOptions {
678
+ /**
679
+ * Re-measure while the scroll container scrolls. Only `compactCardLeft` changes with
680
+ * scrolling, and only when the page is wider than the viewport. Default: `false`.
681
+ */
682
+ readonly trackScroll?: boolean;
683
+ /**
684
+ * With a `railRef`, reserve the review gutter beside the page while the column element is
685
+ * mounted, as `DocxEditorReview` does. The viewport then shifts the page left while the
686
+ * pane is open. The reservation does not show the comment controls in the toolbar and the
687
+ * context menu; see `ReviewRailContext` to serve them from your column. Set `false` when a
688
+ * mounted `DocxEditorReview` already reserves the gutter, or when your column overlays the
689
+ * page. Default: `true`.
690
+ */
691
+ readonly reserveGutter?: boolean;
692
+ }
693
+ /**
694
+ * The review column's geometry in CSS pixels: what converts review anchors and stacked
695
+ * positions, which are layout points from the top of the first page, into a card's `top`.
696
+ *
697
+ * Call it without arguments inside `DocxEditorReview`, for example in children of
698
+ * `<DocxEditorReview preset={false}>`, to read the packaged rail's own measurement. Those
699
+ * children render inside the rail element, which already sits at `left`.
700
+ *
701
+ * Pass `railRef` to measure your own column instead. Attach the ref to an element that
702
+ * the calling component renders, give it `position: absolute`, and render it directly
703
+ * inside `DocxEditor.Viewport` with no positioned element in between: its offset parent
704
+ * must be the scroll container that holds the pages. Development builds warn once when it
705
+ * is not. The column reserves the review gutter unless `reserveGutter` is `false`.
706
+ *
707
+ * While `useReview().paneOpen` is false the viewport reserves only a marker strip, so
708
+ * render no cards then. `compact` is true when the pane is open but too narrow for a column.
709
+ *
710
+ * The value updates when the zoom, the window size, the page count, the document load,
711
+ * content above the pages, or the reserved review gutter changes. It works in a pop-out
712
+ * window or an iframe, because it observes the element's own window.
713
+ *
714
+ * @example Position custom cards
715
+ * ```tsx
716
+ * function MyColumn({ heights }: { heights: ReadonlyMap<string, number> }) {
717
+ * const railRef = useRef<HTMLDivElement>(null);
718
+ * const metrics = useReviewRailMetrics(railRef);
719
+ * const { items } = useReview();
720
+ * const positions = useStackedReviewPositions(items, heights, { scale: metrics.scale });
721
+ * return (
722
+ * <div
723
+ * ref={railRef}
724
+ * style={{
725
+ * position: 'absolute',
726
+ * top: 0,
727
+ * left: metrics.left ?? 0,
728
+ * visibility: metrics.left === null ? 'hidden' : 'visible',
729
+ * }}
730
+ * >
731
+ * {items.map((item) => (
732
+ * <MyCard
733
+ * key={item.key}
734
+ * item={item}
735
+ * style={{
736
+ * position: 'absolute',
737
+ * top: metrics.top + (positions.get(item.key) ?? 0) * metrics.scale,
738
+ * }}
739
+ * />
740
+ * ))}
741
+ * </div>
742
+ * );
743
+ * }
744
+ * ```
745
+ *
746
+ * @public
747
+ */
748
+ declare function useReviewRailMetrics(railRef?: RefObject<HTMLElement | null> | null, options?: UseReviewRailMetricsOptions): ReviewRailMetrics;
749
+
568
750
  /**
569
751
  * The review rail.
570
752
  *
@@ -595,6 +777,8 @@ interface DocxEditorReviewNamespace {
595
777
  readonly Reopen: typeof ReviewReopen;
596
778
  /** Discard the card: delete a comment thread, or reject a tracked change. */
597
779
  readonly Delete: typeof ReviewDelete;
780
+ /** Why the card's last action was refused, when it was. Absent otherwise. */
781
+ readonly Refusal: typeof ReviewRefusal;
598
782
  readonly Replies: typeof ReviewReplies;
599
783
  readonly Reply: typeof ReviewReply;
600
784
  /** The collapsed rail: one marker per item, shown when the pane is closed. */
@@ -1175,5 +1359,5 @@ interface UseDocumentCollaborationReturn {
1175
1359
  */
1176
1360
  declare function useDocumentCollaboration(options?: UseDocumentCollaborationOptions): UseDocumentCollaborationReturn;
1177
1361
 
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 };
1362
+ export { CollaborationSession, CreateDocumentCollaborationOptions, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, resolveCustomNodeActivation, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useStackedReviewPositions };
1363
+ export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewReturn };