@docx-editor.dev/pro 2.30.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.
- package/dist/chunk-32WEH2XH.cjs +1 -0
- package/dist/{chunk-CNXDNDD3.js → chunk-DLYVBBO7.js} +1 -1
- package/dist/{chunk-N34IUO36.cjs → chunk-RYF4SNKX.cjs} +1 -1
- package/dist/chunk-UOAEJRVX.js +1 -0
- package/dist/collaboration/webrtc.cjs +2 -2
- package/dist/collaboration/webrtc.d.cts +31 -12
- package/dist/collaboration/webrtc.d.ts +31 -12
- package/dist/collaboration/webrtc.js +2 -2
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +189 -5
- package/dist/react/index.d.ts +189 -5
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.d.cts +7 -2
- package/dist/react/webrtc.d.ts +7 -2
- package/dist/vue/hocuspocus.cjs +1 -1
- package/dist/vue/hocuspocus.js +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +197 -4
- package/dist/vue/index.d.ts +197 -4
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.d.cts +7 -2
- package/dist/vue/webrtc.d.ts +7 -2
- package/dist/vue/webrtc.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-JRHEYVVY.cjs +0 -1
- package/dist/chunk-P2EF7WMV.js +0 -1
package/dist/vue/index.d.cts
CHANGED
|
@@ -16,7 +16,7 @@ export { CollaborationFailure, CollaborationFailureCode, CollaborationIdentity,
|
|
|
16
16
|
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
17
17
|
import * as vue from 'vue';
|
|
18
18
|
import { ComputedRef, Ref, VNode, MaybeRefOrGetter as MaybeRefOrGetter$1, PropType } from 'vue';
|
|
19
|
-
import { ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
19
|
+
import { EditDiagnosticCode, ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
20
20
|
export { ReviewActivationOptions, ReviewItemRevealEvent, ReviewItemRevealSource, ScrollPlacement } from '@docx-editor.dev/core/contracts/editor';
|
|
21
21
|
import { MaybeRefOrGetter, ReviewAuthorInfo } from '@docx-editor.dev/vue';
|
|
22
22
|
import { C as CollaborationSession, a as CollaborationBootstrap } from '../types-6EmrEn4n.cjs';
|
|
@@ -107,6 +107,36 @@ interface ReviewAdoptOptions {
|
|
|
107
107
|
readonly date?: Date;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* The review write a refusal answered.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
type ReviewWriteAction = 'accept' | 'reject' | 'resolve' | 'reopen' | 'remove' | 'reply' | 'comment';
|
|
116
|
+
/**
|
|
117
|
+
* A review write the editor refused.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
interface ReviewWriteRefusal {
|
|
122
|
+
/** Which write was refused. */
|
|
123
|
+
readonly action: ReviewWriteAction;
|
|
124
|
+
/** The card the write addressed, or null for a new comment on the selection. */
|
|
125
|
+
readonly key: string | null;
|
|
126
|
+
/** The public diagnostic code, the same one `onDiagnostic` reports for the refusal. */
|
|
127
|
+
readonly code: EditDiagnosticCode;
|
|
128
|
+
/**
|
|
129
|
+
* Rises with every refusal of this editor, so the same refusal twice still differs. Key a
|
|
130
|
+
* live announcement on it to announce a repeat.
|
|
131
|
+
*/
|
|
132
|
+
readonly sequence: number;
|
|
133
|
+
/**
|
|
134
|
+
* True when retrying cannot help: the collaboration session ended, so the document must be
|
|
135
|
+
* opened again before it takes another review write.
|
|
136
|
+
*/
|
|
137
|
+
readonly final: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
110
140
|
/** @public */
|
|
111
141
|
type ReviewItemView = ReviewItemPlacement;
|
|
112
142
|
|
|
@@ -158,6 +188,16 @@ interface UseReviewReturn {
|
|
|
158
188
|
readonly reply: (item: ReviewItemView, text: string, author?: string) => boolean;
|
|
159
189
|
readonly selectionAnchorY: ComputedRef<number | null>;
|
|
160
190
|
readonly comment: (text: string, author?: string) => boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null.
|
|
193
|
+
*
|
|
194
|
+
* Shared by every `useReview()` over the same editor, so a custom card sees a refusal the
|
|
195
|
+
* packaged rail recorded. Cleared by the next write that lands and by a change to the
|
|
196
|
+
* document, the editing mode, editability, the collaboration status or the author filter; a
|
|
197
|
+
* caret move keeps it. The packaged cards show it as a sentence; a custom card reads `key` to
|
|
198
|
+
* place it and `code`, the public diagnostic code, to word it.
|
|
199
|
+
*/
|
|
200
|
+
readonly lastRefusal: ComputedRef<ReviewWriteRefusal | null>;
|
|
161
201
|
readonly paneOpen: ComputedRef<boolean>;
|
|
162
202
|
readonly setPaneOpen: (open: boolean) => void;
|
|
163
203
|
readonly ready: ComputedRef<boolean>;
|
|
@@ -166,7 +206,18 @@ interface UseReviewReturn {
|
|
|
166
206
|
declare function useReview(query?: MaybeRefOrGetter<ReviewItemQuery | undefined>): UseReviewReturn;
|
|
167
207
|
/** @public */
|
|
168
208
|
declare function useReviewOf(editorRef: Ref<Editor | null>, query?: MaybeRefOrGetter<ReviewItemQuery | undefined>): UseReviewReturn;
|
|
169
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Non-overlapping Y positions for cards you have measured.
|
|
211
|
+
*
|
|
212
|
+
* Pass entries in document order, each with a key and an anchor, and the measured card heights.
|
|
213
|
+
* An entry with `isActive: true` stays at its own anchor, and the entries before it move up.
|
|
214
|
+
* Anchors are in layout points. Measured heights are in CSS pixels, so pass `scale` to add them.
|
|
215
|
+
*
|
|
216
|
+
* Returns each card's top in layout points. `useReviewRailMetrics` supplies `scale` and the
|
|
217
|
+
* pixel offset of the first page: a card's CSS `top` is `metrics.top + position * metrics.scale`.
|
|
218
|
+
*
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
170
221
|
declare function useStackedReviewPositions(items: MaybeRefOrGetter<readonly {
|
|
171
222
|
readonly key: string;
|
|
172
223
|
readonly anchorY: number | null;
|
|
@@ -705,6 +756,18 @@ declare const DocxEditorReview: {
|
|
|
705
756
|
[key: string]: any;
|
|
706
757
|
}>;
|
|
707
758
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
759
|
+
Refusal: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
760
|
+
className: StringConstructor;
|
|
761
|
+
hidden: BooleanConstructor;
|
|
762
|
+
asChild: BooleanConstructor;
|
|
763
|
+
}>, () => vue_jsx_runtime.JSX.Element | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
764
|
+
className: StringConstructor;
|
|
765
|
+
hidden: BooleanConstructor;
|
|
766
|
+
asChild: BooleanConstructor;
|
|
767
|
+
}>> & Readonly<{}>, {
|
|
768
|
+
hidden: boolean;
|
|
769
|
+
asChild: boolean;
|
|
770
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
708
771
|
Replies: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
709
772
|
className: StringConstructor;
|
|
710
773
|
hidden: BooleanConstructor;
|
|
@@ -854,6 +917,136 @@ declare const DocxEditorReview: {
|
|
|
854
917
|
/** @public */
|
|
855
918
|
type DocxEditorReviewNamespace = typeof DocxEditorReview;
|
|
856
919
|
|
|
920
|
+
/**
|
|
921
|
+
* Where a review column sits, in the coordinates of the editor's scroll container.
|
|
922
|
+
*
|
|
923
|
+
* Review anchors (`item.anchorY`) and stacked positions (`useStackedReviewPositions`) are in
|
|
924
|
+
* layout points from the top of the first page. These values convert them to CSS pixels.
|
|
925
|
+
*
|
|
926
|
+
* @example Position a card at its stacked anchor
|
|
927
|
+
* ```ts
|
|
928
|
+
* const top = metrics.top + positions.get(item.key)! * metrics.scale;
|
|
929
|
+
* ```
|
|
930
|
+
*
|
|
931
|
+
* @public
|
|
932
|
+
*/
|
|
933
|
+
interface ReviewRailMetrics {
|
|
934
|
+
/** CSS pixels per layout point, zoom included. */
|
|
935
|
+
readonly scale: number;
|
|
936
|
+
/**
|
|
937
|
+
* CSS pixels from the scroll container's top padding edge, in its scrolled content, to the
|
|
938
|
+
* top of the first page. Content above the pages, such as a host banner inside the
|
|
939
|
+
* viewport, is included. Scrolling does not change it.
|
|
940
|
+
*/
|
|
941
|
+
readonly top: number;
|
|
942
|
+
/**
|
|
943
|
+
* CSS pixels from the scroll container's left padding edge, in its scrolled content, to
|
|
944
|
+
* the column's left edge: one 16px gutter right of the page. `null` until there is a page
|
|
945
|
+
* to measure. Keep the column hidden while it is `null`.
|
|
946
|
+
*/
|
|
947
|
+
readonly left: number | null;
|
|
948
|
+
/**
|
|
949
|
+
* The `left` value, relative to {@link ReviewRailMetrics.left}, that puts a 300px card
|
|
950
|
+
* fully inside the visible area with a 12px inset from its right edge. Use it while
|
|
951
|
+
* {@link ReviewRailMetrics.compact} is true. `null` until there is a page to measure.
|
|
952
|
+
*/
|
|
953
|
+
readonly compactCardLeft: number | null;
|
|
954
|
+
/**
|
|
955
|
+
* The review pane is open, but the viewport is too narrow for a full column beside the
|
|
956
|
+
* page. The packaged rail then shows markers and one floating card, the active item's,
|
|
957
|
+
* at `compactCardLeft`.
|
|
958
|
+
*/
|
|
959
|
+
readonly compact: boolean;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/** Options for {@link useReviewRailMetrics}. @public */
|
|
963
|
+
interface UseReviewRailMetricsOptions {
|
|
964
|
+
/**
|
|
965
|
+
* Re-measure while the scroll container scrolls. Only `compactCardLeft` changes with
|
|
966
|
+
* scrolling, and only when the page is wider than the viewport. Default: `false`.
|
|
967
|
+
*/
|
|
968
|
+
readonly trackScroll?: boolean;
|
|
969
|
+
/**
|
|
970
|
+
* With a `railRef`, reserve the review gutter beside the page while the column element is
|
|
971
|
+
* mounted, as `DocxEditorReview` does. The viewport then shifts the page left while the
|
|
972
|
+
* pane is open. The reservation does not show the comment controls in the toolbar and the
|
|
973
|
+
* context menu; see `ReviewRailContext` to serve them from your column. Set `false` when a
|
|
974
|
+
* mounted `DocxEditorReview` already reserves the gutter, or when your column overlays the
|
|
975
|
+
* page. Default: `true`.
|
|
976
|
+
*/
|
|
977
|
+
readonly reserveGutter?: boolean;
|
|
978
|
+
}
|
|
979
|
+
/** The review column's geometry for Vue hosts. @public */
|
|
980
|
+
interface UseReviewRailMetricsReturn {
|
|
981
|
+
/** The current measurement. See `ReviewRailMetrics` for each value's meaning. */
|
|
982
|
+
readonly metrics: Readonly<Ref<ReviewRailMetrics>>;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* The review column's geometry in CSS pixels: what converts review anchors and stacked
|
|
986
|
+
* positions, which are layout points from the top of the first page, into a card's `top`.
|
|
987
|
+
*
|
|
988
|
+
* Call it without arguments inside `DocxEditorReview`, for example in a component placed in
|
|
989
|
+
* `<DocxEditorReview :preset="false">`, to read the packaged rail's own measurement. Those
|
|
990
|
+
* children render inside the rail element, which already sits at `left`.
|
|
991
|
+
*
|
|
992
|
+
* Pass `railRef`, a template ref or a getter, to measure your own column instead. Give the
|
|
993
|
+
* element `position: absolute` and render it directly inside `DocxEditor.Viewport` with no
|
|
994
|
+
* positioned element in between: its offset parent must be the scroll container that holds
|
|
995
|
+
* the pages. Development builds warn once when it is not. The column reserves the review
|
|
996
|
+
* gutter unless `reserveGutter` is `false`.
|
|
997
|
+
*
|
|
998
|
+
* While `useReview().paneOpen` is false the viewport reserves only a marker strip, so
|
|
999
|
+
* render no cards then. `compact` is true when the pane is open but too narrow for a column.
|
|
1000
|
+
*
|
|
1001
|
+
* The value updates when the zoom, the window size, the page count, the document load,
|
|
1002
|
+
* content above the pages, or the reserved review gutter changes. It works in a pop-out
|
|
1003
|
+
* window or an iframe, because it observes the element's own window.
|
|
1004
|
+
*
|
|
1005
|
+
* @example Position custom cards
|
|
1006
|
+
* ```vue
|
|
1007
|
+
* <script setup lang="ts">
|
|
1008
|
+
* import { ref } from 'vue';
|
|
1009
|
+
* import {
|
|
1010
|
+
* useReview,
|
|
1011
|
+
* useReviewRailMetrics,
|
|
1012
|
+
* useStackedReviewPositions,
|
|
1013
|
+
* } from '@docx-editor.dev/pro/vue';
|
|
1014
|
+
*
|
|
1015
|
+
* const props = defineProps<{ heights: ReadonlyMap<string, number> }>();
|
|
1016
|
+
* const railRef = ref<HTMLElement | null>(null);
|
|
1017
|
+
* const { metrics } = useReviewRailMetrics(railRef);
|
|
1018
|
+
* const { items } = useReview();
|
|
1019
|
+
* const positions = useStackedReviewPositions(items, () => props.heights, () => ({
|
|
1020
|
+
* scale: metrics.value.scale,
|
|
1021
|
+
* }));
|
|
1022
|
+
* const topOf = (key: string) =>
|
|
1023
|
+
* metrics.value.top + (positions.value.get(key) ?? 0) * metrics.value.scale;
|
|
1024
|
+
* </script>
|
|
1025
|
+
*
|
|
1026
|
+
* <template>
|
|
1027
|
+
* <div
|
|
1028
|
+
* ref="railRef"
|
|
1029
|
+
* :style="{
|
|
1030
|
+
* position: 'absolute',
|
|
1031
|
+
* top: '0px',
|
|
1032
|
+
* left: `${metrics.left ?? 0}px`,
|
|
1033
|
+
* visibility: metrics.left === null ? 'hidden' : 'visible',
|
|
1034
|
+
* }"
|
|
1035
|
+
* >
|
|
1036
|
+
* <MyCard
|
|
1037
|
+
* v-for="item in items"
|
|
1038
|
+
* :key="item.key"
|
|
1039
|
+
* :item="item"
|
|
1040
|
+
* :style="{ position: 'absolute', top: `${topOf(item.key)}px` }"
|
|
1041
|
+
* />
|
|
1042
|
+
* </div>
|
|
1043
|
+
* </template>
|
|
1044
|
+
* ```
|
|
1045
|
+
*
|
|
1046
|
+
* @public
|
|
1047
|
+
*/
|
|
1048
|
+
declare function useReviewRailMetrics(railRef?: MaybeRefOrGetter$1<HTMLElement | null> | null, options?: MaybeRefOrGetter$1<UseReviewRailMetricsOptions | undefined>): UseReviewRailMetricsReturn;
|
|
1049
|
+
|
|
857
1050
|
/** Reactive collaboration status for Vue hosts. @public */
|
|
858
1051
|
interface UseCollaborationStatusReturn {
|
|
859
1052
|
/** Current lifecycle state, or `inactive` when no session is attached. */
|
|
@@ -1730,5 +1923,5 @@ declare function activatedCustomNodeOf(resolved: ResolvedCustomNodeActivation, e
|
|
|
1730
1923
|
/** Resolves a painted pointer target to a registered custom-node definition. @public */
|
|
1731
1924
|
declare function resolveCustomNodeActivation(target: EventTarget | null, nodes: readonly AnyCustomNodeDefinition[]): ResolvedCustomNodeActivation | null;
|
|
1732
1925
|
|
|
1733
|
-
export { CollaborationBootstrap, CollaborationSession, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, collaborationModule, resolveCustomNodeActivation, reviewModule, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useStackedReviewPositions };
|
|
1734
|
-
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationModuleOptions, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CreateDocumentCollaborationOptions, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ProLicenseOptions, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewModuleOptions, ReviewPartProps, ReviewProps, UseCollaborationParticipantsReturn, UseCollaborationSessionReturn, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewReturn };
|
|
1926
|
+
export { CollaborationBootstrap, CollaborationSession, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, collaborationModule, resolveCustomNodeActivation, reviewModule, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useStackedReviewPositions };
|
|
1927
|
+
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationModuleOptions, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CreateDocumentCollaborationOptions, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ProLicenseOptions, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewModuleOptions, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationParticipantsReturn, UseCollaborationSessionReturn, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewRailMetricsReturn, UseReviewReturn };
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { CollaborationFailure, CollaborationFailureCode, CollaborationIdentity,
|
|
|
16
16
|
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
17
17
|
import * as vue from 'vue';
|
|
18
18
|
import { ComputedRef, Ref, VNode, MaybeRefOrGetter as MaybeRefOrGetter$1, PropType } from 'vue';
|
|
19
|
-
import { ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
19
|
+
import { EditDiagnosticCode, ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
20
20
|
export { ReviewActivationOptions, ReviewItemRevealEvent, ReviewItemRevealSource, ScrollPlacement } from '@docx-editor.dev/core/contracts/editor';
|
|
21
21
|
import { MaybeRefOrGetter, ReviewAuthorInfo } from '@docx-editor.dev/vue';
|
|
22
22
|
import { C as CollaborationSession, a as CollaborationBootstrap } from '../types-6EmrEn4n.js';
|
|
@@ -107,6 +107,36 @@ interface ReviewAdoptOptions {
|
|
|
107
107
|
readonly date?: Date;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* The review write a refusal answered.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
type ReviewWriteAction = 'accept' | 'reject' | 'resolve' | 'reopen' | 'remove' | 'reply' | 'comment';
|
|
116
|
+
/**
|
|
117
|
+
* A review write the editor refused.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
interface ReviewWriteRefusal {
|
|
122
|
+
/** Which write was refused. */
|
|
123
|
+
readonly action: ReviewWriteAction;
|
|
124
|
+
/** The card the write addressed, or null for a new comment on the selection. */
|
|
125
|
+
readonly key: string | null;
|
|
126
|
+
/** The public diagnostic code, the same one `onDiagnostic` reports for the refusal. */
|
|
127
|
+
readonly code: EditDiagnosticCode;
|
|
128
|
+
/**
|
|
129
|
+
* Rises with every refusal of this editor, so the same refusal twice still differs. Key a
|
|
130
|
+
* live announcement on it to announce a repeat.
|
|
131
|
+
*/
|
|
132
|
+
readonly sequence: number;
|
|
133
|
+
/**
|
|
134
|
+
* True when retrying cannot help: the collaboration session ended, so the document must be
|
|
135
|
+
* opened again before it takes another review write.
|
|
136
|
+
*/
|
|
137
|
+
readonly final: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
110
140
|
/** @public */
|
|
111
141
|
type ReviewItemView = ReviewItemPlacement;
|
|
112
142
|
|
|
@@ -158,6 +188,16 @@ interface UseReviewReturn {
|
|
|
158
188
|
readonly reply: (item: ReviewItemView, text: string, author?: string) => boolean;
|
|
159
189
|
readonly selectionAnchorY: ComputedRef<number | null>;
|
|
160
190
|
readonly comment: (text: string, author?: string) => boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null.
|
|
193
|
+
*
|
|
194
|
+
* Shared by every `useReview()` over the same editor, so a custom card sees a refusal the
|
|
195
|
+
* packaged rail recorded. Cleared by the next write that lands and by a change to the
|
|
196
|
+
* document, the editing mode, editability, the collaboration status or the author filter; a
|
|
197
|
+
* caret move keeps it. The packaged cards show it as a sentence; a custom card reads `key` to
|
|
198
|
+
* place it and `code`, the public diagnostic code, to word it.
|
|
199
|
+
*/
|
|
200
|
+
readonly lastRefusal: ComputedRef<ReviewWriteRefusal | null>;
|
|
161
201
|
readonly paneOpen: ComputedRef<boolean>;
|
|
162
202
|
readonly setPaneOpen: (open: boolean) => void;
|
|
163
203
|
readonly ready: ComputedRef<boolean>;
|
|
@@ -166,7 +206,18 @@ interface UseReviewReturn {
|
|
|
166
206
|
declare function useReview(query?: MaybeRefOrGetter<ReviewItemQuery | undefined>): UseReviewReturn;
|
|
167
207
|
/** @public */
|
|
168
208
|
declare function useReviewOf(editorRef: Ref<Editor | null>, query?: MaybeRefOrGetter<ReviewItemQuery | undefined>): UseReviewReturn;
|
|
169
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Non-overlapping Y positions for cards you have measured.
|
|
211
|
+
*
|
|
212
|
+
* Pass entries in document order, each with a key and an anchor, and the measured card heights.
|
|
213
|
+
* An entry with `isActive: true` stays at its own anchor, and the entries before it move up.
|
|
214
|
+
* Anchors are in layout points. Measured heights are in CSS pixels, so pass `scale` to add them.
|
|
215
|
+
*
|
|
216
|
+
* Returns each card's top in layout points. `useReviewRailMetrics` supplies `scale` and the
|
|
217
|
+
* pixel offset of the first page: a card's CSS `top` is `metrics.top + position * metrics.scale`.
|
|
218
|
+
*
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
170
221
|
declare function useStackedReviewPositions(items: MaybeRefOrGetter<readonly {
|
|
171
222
|
readonly key: string;
|
|
172
223
|
readonly anchorY: number | null;
|
|
@@ -705,6 +756,18 @@ declare const DocxEditorReview: {
|
|
|
705
756
|
[key: string]: any;
|
|
706
757
|
}>;
|
|
707
758
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
759
|
+
Refusal: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
760
|
+
className: StringConstructor;
|
|
761
|
+
hidden: BooleanConstructor;
|
|
762
|
+
asChild: BooleanConstructor;
|
|
763
|
+
}>, () => vue_jsx_runtime.JSX.Element | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
764
|
+
className: StringConstructor;
|
|
765
|
+
hidden: BooleanConstructor;
|
|
766
|
+
asChild: BooleanConstructor;
|
|
767
|
+
}>> & Readonly<{}>, {
|
|
768
|
+
hidden: boolean;
|
|
769
|
+
asChild: boolean;
|
|
770
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
708
771
|
Replies: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
709
772
|
className: StringConstructor;
|
|
710
773
|
hidden: BooleanConstructor;
|
|
@@ -854,6 +917,136 @@ declare const DocxEditorReview: {
|
|
|
854
917
|
/** @public */
|
|
855
918
|
type DocxEditorReviewNamespace = typeof DocxEditorReview;
|
|
856
919
|
|
|
920
|
+
/**
|
|
921
|
+
* Where a review column sits, in the coordinates of the editor's scroll container.
|
|
922
|
+
*
|
|
923
|
+
* Review anchors (`item.anchorY`) and stacked positions (`useStackedReviewPositions`) are in
|
|
924
|
+
* layout points from the top of the first page. These values convert them to CSS pixels.
|
|
925
|
+
*
|
|
926
|
+
* @example Position a card at its stacked anchor
|
|
927
|
+
* ```ts
|
|
928
|
+
* const top = metrics.top + positions.get(item.key)! * metrics.scale;
|
|
929
|
+
* ```
|
|
930
|
+
*
|
|
931
|
+
* @public
|
|
932
|
+
*/
|
|
933
|
+
interface ReviewRailMetrics {
|
|
934
|
+
/** CSS pixels per layout point, zoom included. */
|
|
935
|
+
readonly scale: number;
|
|
936
|
+
/**
|
|
937
|
+
* CSS pixels from the scroll container's top padding edge, in its scrolled content, to the
|
|
938
|
+
* top of the first page. Content above the pages, such as a host banner inside the
|
|
939
|
+
* viewport, is included. Scrolling does not change it.
|
|
940
|
+
*/
|
|
941
|
+
readonly top: number;
|
|
942
|
+
/**
|
|
943
|
+
* CSS pixels from the scroll container's left padding edge, in its scrolled content, to
|
|
944
|
+
* the column's left edge: one 16px gutter right of the page. `null` until there is a page
|
|
945
|
+
* to measure. Keep the column hidden while it is `null`.
|
|
946
|
+
*/
|
|
947
|
+
readonly left: number | null;
|
|
948
|
+
/**
|
|
949
|
+
* The `left` value, relative to {@link ReviewRailMetrics.left}, that puts a 300px card
|
|
950
|
+
* fully inside the visible area with a 12px inset from its right edge. Use it while
|
|
951
|
+
* {@link ReviewRailMetrics.compact} is true. `null` until there is a page to measure.
|
|
952
|
+
*/
|
|
953
|
+
readonly compactCardLeft: number | null;
|
|
954
|
+
/**
|
|
955
|
+
* The review pane is open, but the viewport is too narrow for a full column beside the
|
|
956
|
+
* page. The packaged rail then shows markers and one floating card, the active item's,
|
|
957
|
+
* at `compactCardLeft`.
|
|
958
|
+
*/
|
|
959
|
+
readonly compact: boolean;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/** Options for {@link useReviewRailMetrics}. @public */
|
|
963
|
+
interface UseReviewRailMetricsOptions {
|
|
964
|
+
/**
|
|
965
|
+
* Re-measure while the scroll container scrolls. Only `compactCardLeft` changes with
|
|
966
|
+
* scrolling, and only when the page is wider than the viewport. Default: `false`.
|
|
967
|
+
*/
|
|
968
|
+
readonly trackScroll?: boolean;
|
|
969
|
+
/**
|
|
970
|
+
* With a `railRef`, reserve the review gutter beside the page while the column element is
|
|
971
|
+
* mounted, as `DocxEditorReview` does. The viewport then shifts the page left while the
|
|
972
|
+
* pane is open. The reservation does not show the comment controls in the toolbar and the
|
|
973
|
+
* context menu; see `ReviewRailContext` to serve them from your column. Set `false` when a
|
|
974
|
+
* mounted `DocxEditorReview` already reserves the gutter, or when your column overlays the
|
|
975
|
+
* page. Default: `true`.
|
|
976
|
+
*/
|
|
977
|
+
readonly reserveGutter?: boolean;
|
|
978
|
+
}
|
|
979
|
+
/** The review column's geometry for Vue hosts. @public */
|
|
980
|
+
interface UseReviewRailMetricsReturn {
|
|
981
|
+
/** The current measurement. See `ReviewRailMetrics` for each value's meaning. */
|
|
982
|
+
readonly metrics: Readonly<Ref<ReviewRailMetrics>>;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* The review column's geometry in CSS pixels: what converts review anchors and stacked
|
|
986
|
+
* positions, which are layout points from the top of the first page, into a card's `top`.
|
|
987
|
+
*
|
|
988
|
+
* Call it without arguments inside `DocxEditorReview`, for example in a component placed in
|
|
989
|
+
* `<DocxEditorReview :preset="false">`, to read the packaged rail's own measurement. Those
|
|
990
|
+
* children render inside the rail element, which already sits at `left`.
|
|
991
|
+
*
|
|
992
|
+
* Pass `railRef`, a template ref or a getter, to measure your own column instead. Give the
|
|
993
|
+
* element `position: absolute` and render it directly inside `DocxEditor.Viewport` with no
|
|
994
|
+
* positioned element in between: its offset parent must be the scroll container that holds
|
|
995
|
+
* the pages. Development builds warn once when it is not. The column reserves the review
|
|
996
|
+
* gutter unless `reserveGutter` is `false`.
|
|
997
|
+
*
|
|
998
|
+
* While `useReview().paneOpen` is false the viewport reserves only a marker strip, so
|
|
999
|
+
* render no cards then. `compact` is true when the pane is open but too narrow for a column.
|
|
1000
|
+
*
|
|
1001
|
+
* The value updates when the zoom, the window size, the page count, the document load,
|
|
1002
|
+
* content above the pages, or the reserved review gutter changes. It works in a pop-out
|
|
1003
|
+
* window or an iframe, because it observes the element's own window.
|
|
1004
|
+
*
|
|
1005
|
+
* @example Position custom cards
|
|
1006
|
+
* ```vue
|
|
1007
|
+
* <script setup lang="ts">
|
|
1008
|
+
* import { ref } from 'vue';
|
|
1009
|
+
* import {
|
|
1010
|
+
* useReview,
|
|
1011
|
+
* useReviewRailMetrics,
|
|
1012
|
+
* useStackedReviewPositions,
|
|
1013
|
+
* } from '@docx-editor.dev/pro/vue';
|
|
1014
|
+
*
|
|
1015
|
+
* const props = defineProps<{ heights: ReadonlyMap<string, number> }>();
|
|
1016
|
+
* const railRef = ref<HTMLElement | null>(null);
|
|
1017
|
+
* const { metrics } = useReviewRailMetrics(railRef);
|
|
1018
|
+
* const { items } = useReview();
|
|
1019
|
+
* const positions = useStackedReviewPositions(items, () => props.heights, () => ({
|
|
1020
|
+
* scale: metrics.value.scale,
|
|
1021
|
+
* }));
|
|
1022
|
+
* const topOf = (key: string) =>
|
|
1023
|
+
* metrics.value.top + (positions.value.get(key) ?? 0) * metrics.value.scale;
|
|
1024
|
+
* </script>
|
|
1025
|
+
*
|
|
1026
|
+
* <template>
|
|
1027
|
+
* <div
|
|
1028
|
+
* ref="railRef"
|
|
1029
|
+
* :style="{
|
|
1030
|
+
* position: 'absolute',
|
|
1031
|
+
* top: '0px',
|
|
1032
|
+
* left: `${metrics.left ?? 0}px`,
|
|
1033
|
+
* visibility: metrics.left === null ? 'hidden' : 'visible',
|
|
1034
|
+
* }"
|
|
1035
|
+
* >
|
|
1036
|
+
* <MyCard
|
|
1037
|
+
* v-for="item in items"
|
|
1038
|
+
* :key="item.key"
|
|
1039
|
+
* :item="item"
|
|
1040
|
+
* :style="{ position: 'absolute', top: `${topOf(item.key)}px` }"
|
|
1041
|
+
* />
|
|
1042
|
+
* </div>
|
|
1043
|
+
* </template>
|
|
1044
|
+
* ```
|
|
1045
|
+
*
|
|
1046
|
+
* @public
|
|
1047
|
+
*/
|
|
1048
|
+
declare function useReviewRailMetrics(railRef?: MaybeRefOrGetter$1<HTMLElement | null> | null, options?: MaybeRefOrGetter$1<UseReviewRailMetricsOptions | undefined>): UseReviewRailMetricsReturn;
|
|
1049
|
+
|
|
857
1050
|
/** Reactive collaboration status for Vue hosts. @public */
|
|
858
1051
|
interface UseCollaborationStatusReturn {
|
|
859
1052
|
/** Current lifecycle state, or `inactive` when no session is attached. */
|
|
@@ -1730,5 +1923,5 @@ declare function activatedCustomNodeOf(resolved: ResolvedCustomNodeActivation, e
|
|
|
1730
1923
|
/** Resolves a painted pointer target to a registered custom-node definition. @public */
|
|
1731
1924
|
declare function resolveCustomNodeActivation(target: EventTarget | null, nodes: readonly AnyCustomNodeDefinition[]): ResolvedCustomNodeActivation | null;
|
|
1732
1925
|
|
|
1733
|
-
export { CollaborationBootstrap, CollaborationSession, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, collaborationModule, resolveCustomNodeActivation, reviewModule, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useStackedReviewPositions };
|
|
1734
|
-
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationModuleOptions, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CreateDocumentCollaborationOptions, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ProLicenseOptions, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewModuleOptions, ReviewPartProps, ReviewProps, UseCollaborationParticipantsReturn, UseCollaborationSessionReturn, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewReturn };
|
|
1926
|
+
export { CollaborationBootstrap, CollaborationSession, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, collaborationModule, resolveCustomNodeActivation, reviewModule, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useStackedReviewPositions };
|
|
1927
|
+
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationModuleOptions, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CreateDocumentCollaborationOptions, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ProLicenseOptions, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewModuleOptions, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationParticipantsReturn, UseCollaborationSessionReturn, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewRailMetricsReturn, UseReviewReturn };
|