@fileverse-dev/ddoc 3.1.7-linkCaption-0 → 3.1.7-sg-1
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/index.es.js +35271 -30419
- package/dist/package/components/editor-bubble-menu/props.d.ts +2 -0
- package/dist/package/components/inline-comment/comment-card.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-dropdown.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-floating-container.d.ts +1 -0
- package/dist/package/components/inline-comment/comment-floating-layout.d.ts +34 -0
- package/dist/package/components/inline-comment/comment-input-field.d.ts +4 -0
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +8 -0
- package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-username.d.ts +1 -1
- package/dist/package/components/inline-comment/constants.d.ts +1 -0
- package/dist/package/components/inline-comment/context/types.d.ts +52 -89
- package/dist/package/components/inline-comment/delete-confirm-overlay.d.ts +10 -0
- package/dist/package/components/inline-comment/empty-comments.d.ts +4 -1
- package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/draft-floating-card.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/floating-auth-prompt.d.ts +1 -0
- package/dist/package/components/inline-comment/floating-comment/floating-card-shell.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/index.d.ts +1 -0
- package/dist/package/components/inline-comment/floating-comment/suggestion-draft-floating-card.d.ts +11 -0
- package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts +15 -0
- package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/types.d.ts +39 -0
- package/dist/package/components/inline-comment/floating-comment-layout-utils.d.ts +81 -0
- package/dist/package/components/inline-comment/resize-inline-comment-textarea.d.ts +1 -0
- package/dist/package/components/inline-comment/types.d.ts +24 -0
- package/dist/package/components/inline-comment/use-anchor-registry.d.ts +34 -0
- package/dist/package/components/inline-comment/use-comment-card.d.ts +29 -0
- package/dist/package/components/inline-comment/use-comment-list-container.d.ts +17 -0
- package/dist/package/components/inline-comment/use-ens-status.d.ts +3 -0
- package/dist/package/components/inline-comment/use-floating-card-state.d.ts +36 -0
- package/dist/package/components/inline-comment/use-floating-comment-card-layout.d.ts +23 -0
- package/dist/package/components/inline-comment/use-floating-comment-card-state.d.ts +13 -0
- package/dist/package/components/inline-comment/use-floating-layout-engine.d.ts +26 -0
- package/dist/package/components/inline-comment/use-is-selected-content-deleted.d.ts +1 -0
- package/dist/package/components/tabs/document-tabs-sidebar.d.ts +2 -1
- package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +95 -0
- package/dist/package/extensions/comment/comment.d.ts +38 -0
- package/dist/package/extensions/resizable-media/resizable-media-menu-util.d.ts +5 -4
- package/dist/package/extensions/resizable-media/resizable-media-node-view.d.ts +1 -1
- package/dist/package/extensions/suggestion/suggestion-tracking-extension.d.ts +30 -0
- package/dist/package/hooks/use-editing-context.d.ts +2 -0
- package/dist/package/hooks/use-tab-editor.d.ts +9 -2
- package/dist/package/stores/comment-store-provider.d.ts +64 -0
- package/dist/package/stores/comment-store.d.ts +263 -0
- package/dist/package/types.d.ts +25 -2
- package/dist/package/use-ddoc-editor.d.ts +6 -1
- package/dist/package/utils/comment-anchor-serialization.d.ts +5 -0
- package/dist/package/utils/comment-scroll-into-view.d.ts +21 -0
- package/dist/style.css +1 -1
- package/package.json +4 -3
- package/dist/package/components/inline-comment/context/comment-context.d.ts +0 -4
- package/dist/package/extensions/resizable-media/media-caption.d.ts +0 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/core';
|
|
2
2
|
|
|
3
|
+
export declare const isSelectionInsideEditor: (editor: Editor) => boolean;
|
|
3
4
|
export declare const shouldShow: ({ editor }: {
|
|
4
5
|
editor: Editor;
|
|
5
6
|
}) => boolean;
|
|
7
|
+
export declare const shouldShowIgnoringFocus: (editor: Editor) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CommentCardProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentCard: (
|
|
3
|
+
export declare const CommentCard: (props: CommentCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const UserDisplaySkeleton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentDrawerProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, isPreviewMode, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, activeTabId, onTabChange, isPreviewMode, tabs, isCollaborationEnabled, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentDropdownProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentDropdown: ({ activeCommentId,
|
|
3
|
+
export declare const CommentDropdown: ({ activeCommentId, isBubbleMenu, isDisabled, isCommentOwner, }: CommentDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CommentFloatingContainer } from './floating-comment';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const FLOATING_COMMENT_CARD_GAP = 8;
|
|
2
|
+
export declare const enum FloatingLayoutInvalidationFlag {
|
|
3
|
+
None = 0,
|
|
4
|
+
Anchor = 1,
|
|
5
|
+
Viewport = 2,
|
|
6
|
+
Height = 4,
|
|
7
|
+
Visibility = 8
|
|
8
|
+
}
|
|
9
|
+
export interface FloatingCardLayoutInput {
|
|
10
|
+
floatingCardId: string;
|
|
11
|
+
anchorTop: number | null;
|
|
12
|
+
height: number;
|
|
13
|
+
isVisible: boolean;
|
|
14
|
+
isMeasured: boolean;
|
|
15
|
+
lastCommittedTranslateY: number | null;
|
|
16
|
+
invalidationFlags: FloatingLayoutInvalidationFlag;
|
|
17
|
+
}
|
|
18
|
+
export interface FloatingLayoutResult {
|
|
19
|
+
placements: Map<string, {
|
|
20
|
+
translateY: number | null;
|
|
21
|
+
isVisible: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
stopIndex: number;
|
|
24
|
+
usedFocusedLayout: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const roundFloatingTranslateY: (translateY: number | null) => number | null;
|
|
27
|
+
export declare const computeFloatingCommentLayout: ({ floatingCards, recomputeStartIndex, firstInvalidatedIndex, lastInvalidatedIndex, gap, focusedFloatingCardId, }: {
|
|
28
|
+
floatingCards: FloatingCardLayoutInput[];
|
|
29
|
+
recomputeStartIndex: number;
|
|
30
|
+
firstInvalidatedIndex?: number;
|
|
31
|
+
lastInvalidatedIndex: number;
|
|
32
|
+
gap?: number;
|
|
33
|
+
focusedFloatingCardId?: string | null;
|
|
34
|
+
}) => FloatingLayoutResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface CommentReplyInputProps {
|
|
2
|
+
commentId: string;
|
|
3
|
+
commentUsername?: string;
|
|
4
|
+
replyCount: number;
|
|
5
|
+
isCollaborationEnabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const CommentReplyInput: ({ commentId, replyCount, isCollaborationEnabled, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentSectionProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode, isMobile, comments: commentsProp, commentType, tabNameById, selectedTabLabel, newCommentTabId, showNewCommentInput, onCommentFocus, onReset, isCollaborationEnabled, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CommentUsernameProps } from './context/types';
|
|
2
2
|
|
|
3
|
-
declare const CommentUsername: ({ username, setUsername,
|
|
3
|
+
declare const CommentUsername: ({ username, setUsername, isConnected, connectViaUsername, connectViaWallet, isLoading, }: CommentUsernameProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export { CommentUsername };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FLOATING_CARD_WIDTH = 300;
|
|
@@ -1,100 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
2
2
|
import { IComment } from '../../../extensions/comment';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { CommentStoreState } from '../../../stores/comment-store';
|
|
4
|
+
import { CommentStoreProviderProps } from '../../../stores/comment-store-provider';
|
|
5
|
+
import { CommentAccountProps } from '../../../types';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
comments: IComment[];
|
|
10
|
-
setComments: React.Dispatch<SetStateAction<IComment[]>>;
|
|
11
|
-
editor: Editor;
|
|
12
|
-
username?: string | null;
|
|
13
|
-
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
14
|
-
showResolved: boolean;
|
|
15
|
-
setShowResolved: (show: boolean) => void;
|
|
16
|
-
resolveComment: (commentId: string) => void;
|
|
17
|
-
unresolveComment: (commentId: string) => void;
|
|
18
|
-
deleteComment: (commentId: string) => void;
|
|
19
|
-
handleAddReply: (activeCommentId: string, replyContent: string, onCommentReply: (activeCommentId: string, reply: IComment) => void) => void;
|
|
20
|
-
focusCommentInEditor: (commentId: string) => void;
|
|
21
|
-
handleReplyChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
22
|
-
handleCommentChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
23
|
-
handleCommentKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
24
|
-
handleReplySubmit: () => void;
|
|
25
|
-
toggleResolved: () => void;
|
|
26
|
-
openReplyId: string | null;
|
|
27
|
-
setOpenReplyId: (id: string | null) => void;
|
|
28
|
-
handleReplyKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
29
|
-
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
30
|
-
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
31
|
-
addComment: (content?: string) => void;
|
|
32
|
-
handleCommentSubmit: () => void;
|
|
33
|
-
reply: string;
|
|
34
|
-
setReply: React.Dispatch<React.SetStateAction<string>>;
|
|
35
|
-
comment: string;
|
|
36
|
-
setComment: React.Dispatch<React.SetStateAction<string>>;
|
|
37
|
-
onPrevComment: () => void;
|
|
38
|
-
onNextComment: () => void;
|
|
39
|
-
activeCommentIndex: number;
|
|
40
|
-
activeComment: IComment | undefined;
|
|
7
|
+
export interface CommentFloatingBaseCard {
|
|
8
|
+
floatingCardId: string;
|
|
41
9
|
selectedText: string;
|
|
42
|
-
|
|
43
|
-
isBubbleMenuSuppressed: boolean;
|
|
44
|
-
setIsBubbleMenuSuppressed: React.Dispatch<React.SetStateAction<boolean>>;
|
|
45
|
-
handleInlineComment: () => void;
|
|
46
|
-
portalRef: React.RefObject<HTMLDivElement>;
|
|
47
|
-
buttonRef: React.RefObject<HTMLDivElement>;
|
|
48
|
-
dropdownRef: React.RefObject<HTMLDivElement>;
|
|
49
|
-
activeComments: IComment[];
|
|
50
|
-
handleInput: (e: React.FormEvent<HTMLTextAreaElement>, content: string) => void;
|
|
51
|
-
isCommentActive: boolean;
|
|
52
|
-
isCommentResolved: boolean;
|
|
53
|
-
ensResolutionUrl: string;
|
|
54
|
-
activeTabId: string;
|
|
55
|
-
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
56
|
-
onComment?: () => void;
|
|
57
|
-
setCommentDrawerOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
58
|
-
inlineCommentData: {
|
|
59
|
-
inlineCommentText: string;
|
|
60
|
-
handleClick: boolean;
|
|
61
|
-
};
|
|
62
|
-
setInlineCommentData: React.Dispatch<React.SetStateAction<{
|
|
63
|
-
inlineCommentText: string;
|
|
64
|
-
handleClick: boolean;
|
|
65
|
-
}>>;
|
|
66
|
-
getEnsStatus: (walletAddress: string, setEnsStatus: React.Dispatch<React.SetStateAction<EnsStatus>>) => void;
|
|
67
|
-
ensCache: EnsCache;
|
|
10
|
+
isFocused: boolean;
|
|
68
11
|
}
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
onResolveComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
78
|
-
onUnresolveComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
79
|
-
onDeleteComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
80
|
-
username: string | null;
|
|
81
|
-
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
82
|
-
activeCommentId: string | null;
|
|
83
|
-
setActiveCommentId: React.Dispatch<React.SetStateAction<string | null>>;
|
|
84
|
-
activeTabId: string;
|
|
85
|
-
focusCommentWithActiveId: (id: string) => void;
|
|
86
|
-
ensResolutionUrl: string;
|
|
87
|
-
onInlineComment?: () => void;
|
|
88
|
-
onComment?: () => void;
|
|
89
|
-
setCommentDrawerOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
|
+
export type InlineDraftLocation = 'drawer' | 'floating';
|
|
13
|
+
export interface InlineCommentDraft {
|
|
14
|
+
draftId: string;
|
|
15
|
+
tabId: string;
|
|
16
|
+
selectedText: string;
|
|
17
|
+
text: string;
|
|
18
|
+
location: InlineDraftLocation;
|
|
19
|
+
isAuthPending: boolean;
|
|
90
20
|
}
|
|
91
|
-
export interface
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
21
|
+
export interface CommentFloatingDraftCard extends CommentFloatingBaseCard {
|
|
22
|
+
type: 'draft';
|
|
23
|
+
draftId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CommentFloatingThreadCard extends CommentFloatingBaseCard {
|
|
26
|
+
type: 'thread';
|
|
27
|
+
commentId: string;
|
|
28
|
+
}
|
|
29
|
+
export interface SuggestionFloatingDraftCard extends CommentFloatingBaseCard {
|
|
30
|
+
type: 'suggestion-draft';
|
|
31
|
+
suggestionId: string;
|
|
32
|
+
/** Accumulated inserted text from the live suggestion context. */
|
|
33
|
+
insertedText: string;
|
|
34
|
+
}
|
|
35
|
+
export type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard | SuggestionFloatingDraftCard;
|
|
36
|
+
export interface InlineCommentData {
|
|
37
|
+
highlightedTextContent?: string;
|
|
38
|
+
inlineCommentText: string;
|
|
39
|
+
handleClick: boolean;
|
|
95
40
|
}
|
|
96
41
|
export interface EnsEntry {
|
|
97
42
|
name: string;
|
|
98
43
|
isEns: boolean;
|
|
99
44
|
}
|
|
100
45
|
export type EnsCache = Record<string, EnsEntry>;
|
|
46
|
+
export type CommentProviderProps = CommentStoreProviderProps;
|
|
47
|
+
export type CommentContextType = Pick<CommentStoreState, 'activeComment' | 'activeCommentIndex' | 'activeComments' | 'activeTabId' | 'addComment' | 'blurFloatingCard' | 'cancelFloatingDraft' | 'closeFloatingCard' | 'comment' | 'connectViaUsername' | 'connectViaWallet' | 'createFloatingDraft' | 'deleteComment' | 'deleteReply' | 'ensCache' | 'floatingCards' | 'focusCommentInEditor' | 'focusFloatingCard' | 'getEnsStatus' | 'handleAddReply' | 'handleCommentChange' | 'handleCommentKeyDown' | 'handleCommentSubmit' | 'handleInlineComment' | 'handleInput' | 'handleReplyChange' | 'handleReplyKeyDown' | 'handleReplySubmit' | 'inlineCommentData' | 'isBubbleMenuSuppressed' | 'isCommentActive' | 'isCommentOpen' | 'isCommentResolved' | 'isConnected' | 'isDDocOwner' | 'isDesktopFloatingEnabled' | 'isLoading' | 'onComment' | 'onNextComment' | 'onPrevComment' | 'openFloatingThread' | 'openReplyId' | 'reply' | 'resolveComment' | 'setComment' | 'setCommentDrawerOpen' | 'setInlineCommentData' | 'setIsBubbleMenuSuppressed' | 'setOpenReplyId' | 'setReply' | 'setShowResolved' | 'setUsername' | 'selectedText' | 'showResolved' | 'submitFloatingDraft' | 'toggleResolved' | 'unresolveComment' | 'updateFloatingDraftText' | 'username'> & {
|
|
48
|
+
comments: IComment[];
|
|
49
|
+
commentsSectionRef: RefObject<HTMLDivElement>;
|
|
50
|
+
dropdownRef: RefObject<HTMLDivElement>;
|
|
51
|
+
buttonRef: RefObject<HTMLDivElement>;
|
|
52
|
+
portalRef: RefObject<HTMLDivElement>;
|
|
53
|
+
replySectionRef: RefObject<HTMLDivElement>;
|
|
54
|
+
editor: CommentStoreProviderProps['editor'];
|
|
55
|
+
ensResolutionUrl: string;
|
|
56
|
+
onCommentReply?: CommentStoreProviderProps['onCommentReply'];
|
|
57
|
+
setComments?: Dispatch<SetStateAction<IComment[]>>;
|
|
58
|
+
};
|
|
59
|
+
export interface CommentUsernameProps extends CommentAccountProps {
|
|
60
|
+
username?: string | null;
|
|
61
|
+
setUsername?: Dispatch<SetStateAction<string>>;
|
|
62
|
+
isNavbarVisible?: boolean;
|
|
63
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const DeleteConfirmOverlay: ({ isVisible, title, onCancel, onConfirm, className, heading, description, confirmLabel, }: {
|
|
2
|
+
isVisible: boolean;
|
|
3
|
+
title: string;
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
onConfirm: () => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
heading?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
confirmLabel?: string;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CommentFloatingContainerProps } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const CommentFloatingContainer: ({ editor, editorWrapperRef, scrollContainerRef, tabName, isHidden, isCollaborationEnabled, }: CommentFloatingContainerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FloatingAuthPrompt: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CommentFloatingContainer } from './comment-floating-container';
|
package/dist/package/components/inline-comment/floating-comment/suggestion-draft-floating-card.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SuggestionDraftFloatingCardProps } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SuggestionDraftFloatingCard
|
|
5
|
+
*
|
|
6
|
+
* Shown while a viewer is composing a suggestion (in suggestion mode).
|
|
7
|
+
* Uses the same one-line diff format as the submitted thread card
|
|
8
|
+
* (Add: "X" / Delete: "X" / Replace: "X" with "Y") plus a Submit action
|
|
9
|
+
* and a Discard (X) button.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SuggestionDraftFloatingCard: ({ card, isHidden, registerCardNode, }: SuggestionDraftFloatingCardProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ThreadFloatingCardProps } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SuggestionThreadFloatingCard
|
|
5
|
+
*
|
|
6
|
+
* Shown in place of the generic ThreadFloatingCard for submitted suggestions
|
|
7
|
+
* (comments with `isSuggestion: true`). Renders the Figma-specified layout:
|
|
8
|
+
* author + timestamp header, Accept/Reject (owner) or Withdraw (author)
|
|
9
|
+
* actions, a one-line diff summary (Add/Delete/Replace), and a reply input.
|
|
10
|
+
*
|
|
11
|
+
* Renders from the underlying IComment — the same source ThreadFloatingCard
|
|
12
|
+
* uses — so once a draft is submitted, nothing else in the pipeline needs
|
|
13
|
+
* to change to show the suggestion here.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SuggestionThreadFloatingCard: ({ thread, comment, isHidden, registerCardNode, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { ReactNode, RefObject } from 'react';
|
|
3
|
+
import { IComment } from '../../../extensions/comment';
|
|
4
|
+
import { CommentFloatingDraftCard, CommentFloatingThreadCard, SuggestionFloatingDraftCard } from '../context/types';
|
|
5
|
+
|
|
6
|
+
export type RegisterCardNode = (floatingCardId: string, node: HTMLDivElement | null) => void;
|
|
7
|
+
export interface CommentFloatingContainerProps {
|
|
8
|
+
editor: Editor;
|
|
9
|
+
editorWrapperRef: RefObject<HTMLDivElement>;
|
|
10
|
+
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
11
|
+
tabName: string;
|
|
12
|
+
isHidden: boolean;
|
|
13
|
+
isCollaborationEnabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface FloatingCardShellProps {
|
|
16
|
+
floatingCardId: string;
|
|
17
|
+
isHidden: boolean;
|
|
18
|
+
isFocused: boolean;
|
|
19
|
+
onFocus: () => void;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export interface DraftFloatingCardProps {
|
|
23
|
+
draft: CommentFloatingDraftCard;
|
|
24
|
+
isHidden: boolean;
|
|
25
|
+
registerCardNode: RegisterCardNode;
|
|
26
|
+
}
|
|
27
|
+
export interface ThreadFloatingCardProps {
|
|
28
|
+
thread: CommentFloatingThreadCard;
|
|
29
|
+
comment: IComment | undefined;
|
|
30
|
+
tabName: string;
|
|
31
|
+
isHidden: boolean;
|
|
32
|
+
registerCardNode: RegisterCardNode;
|
|
33
|
+
isCollaborationEnabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface SuggestionDraftFloatingCardProps {
|
|
36
|
+
card: SuggestionFloatingDraftCard;
|
|
37
|
+
isHidden: boolean;
|
|
38
|
+
registerCardNode: RegisterCardNode;
|
|
39
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { FloatingLayoutInvalidationFlag, FloatingCardLayoutInput } from './comment-floating-layout';
|
|
3
|
+
import { CommentFloatingCard } from './context/types';
|
|
4
|
+
|
|
5
|
+
export type AnchorType = 'draft' | 'thread' | 'suggestion-draft';
|
|
6
|
+
export interface CachedAnchorRect {
|
|
7
|
+
top: number;
|
|
8
|
+
height: number;
|
|
9
|
+
scrollTop: number;
|
|
10
|
+
containerTop: number;
|
|
11
|
+
}
|
|
12
|
+
export interface AnchorRecord {
|
|
13
|
+
floatingCardId: string;
|
|
14
|
+
anchorId: string;
|
|
15
|
+
anchorType: AnchorType;
|
|
16
|
+
elements: HTMLElement[];
|
|
17
|
+
pmPos: number | null;
|
|
18
|
+
anchorVersion: number;
|
|
19
|
+
cachedRect: CachedAnchorRect | null;
|
|
20
|
+
lastSeenEditorRoot: HTMLElement | null;
|
|
21
|
+
missingSinceDocVersion: number | null;
|
|
22
|
+
missingSinceCycle: number | null;
|
|
23
|
+
}
|
|
24
|
+
export interface FloatingCardRuntimeState {
|
|
25
|
+
floatingCardId: string;
|
|
26
|
+
anchorPosition: number | null;
|
|
27
|
+
anchorVersion: number;
|
|
28
|
+
anchorTop: number | null;
|
|
29
|
+
anchorHeight: number;
|
|
30
|
+
height: number;
|
|
31
|
+
isMeasured: boolean;
|
|
32
|
+
isInViewport: boolean;
|
|
33
|
+
translateY: number | null;
|
|
34
|
+
lastCommittedTranslateY: number | null;
|
|
35
|
+
lastCommittedVisible: boolean;
|
|
36
|
+
needsTransformSync: boolean;
|
|
37
|
+
invalidationFlags: FloatingLayoutInvalidationFlag;
|
|
38
|
+
}
|
|
39
|
+
export declare const FLOATING_VIEWPORT_BUFFER_MULTIPLIER = 1;
|
|
40
|
+
export declare const getAnchorIdentity: (floatingCard: CommentFloatingCard) => {
|
|
41
|
+
anchorId: string;
|
|
42
|
+
anchorType: "draft";
|
|
43
|
+
} | {
|
|
44
|
+
anchorId: string;
|
|
45
|
+
anchorType: "suggestion-draft";
|
|
46
|
+
} | {
|
|
47
|
+
anchorId: string;
|
|
48
|
+
anchorType: "thread";
|
|
49
|
+
};
|
|
50
|
+
export declare const getAnchorElements: ({ editorRoot, anchorId, anchorType, }: {
|
|
51
|
+
editorRoot: HTMLElement;
|
|
52
|
+
anchorId: string;
|
|
53
|
+
anchorType: AnchorType;
|
|
54
|
+
}) => HTMLElement[];
|
|
55
|
+
export declare const getAnchorStartPos: (editor: Editor, elements: HTMLElement[]) => null;
|
|
56
|
+
export declare const getEditorRoot: (editor: Editor) => HTMLElement | null;
|
|
57
|
+
export declare const areAnchorElementsEqual: (previousElements: HTMLElement[], nextElements: HTMLElement[]) => boolean;
|
|
58
|
+
export declare const isAnchorEntryValid: (entry: AnchorRecord, editorRoot: HTMLElement) => boolean;
|
|
59
|
+
export declare const getCachedAnchorRect: ({ cachedRect, scrollTop, containerTop, }: {
|
|
60
|
+
cachedRect: CachedAnchorRect;
|
|
61
|
+
scrollTop: number;
|
|
62
|
+
containerTop: number;
|
|
63
|
+
}) => {
|
|
64
|
+
top: number;
|
|
65
|
+
height: number;
|
|
66
|
+
};
|
|
67
|
+
export declare const getRect: ({ elements, viewportTop, viewportBottom, }: {
|
|
68
|
+
elements: HTMLElement[];
|
|
69
|
+
viewportTop: number;
|
|
70
|
+
viewportBottom: number;
|
|
71
|
+
}) => DOMRect | null;
|
|
72
|
+
export declare const reconcileOrderedFloatingCardIds: ({ previousOrderedFloatingCardIds, nextFloatingCards, getPos, }: {
|
|
73
|
+
previousOrderedFloatingCardIds: string[];
|
|
74
|
+
nextFloatingCards: CommentFloatingCard[];
|
|
75
|
+
getPos: (floatingCardId: string) => number | null;
|
|
76
|
+
}) => {
|
|
77
|
+
orderedFloatingCardIds: string[];
|
|
78
|
+
firstChangedIndex: number | null;
|
|
79
|
+
};
|
|
80
|
+
export declare const areFloatingCardIdListsEqual: (a: string[], b: string[]) => boolean;
|
|
81
|
+
export declare const toFloatingCardLayoutInput: (floatingCardState: FloatingCardRuntimeState) => FloatingCardLayoutInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resizeInlineCommentTextarea: (textarea: HTMLTextAreaElement, maxHeight?: number) => void;
|
|
@@ -2,6 +2,7 @@ import { BubbleMenuProps } from '@tiptap/react/menus';
|
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { IComment } from '../../extensions/comment';
|
|
4
4
|
import { SetStateAction } from 'react';
|
|
5
|
+
import { Tab } from '../tabs/utils/tab-utils';
|
|
5
6
|
|
|
6
7
|
export interface UseCommentActionsProps {
|
|
7
8
|
editor: Editor;
|
|
@@ -31,13 +32,19 @@ export interface CommentDrawerProps {
|
|
|
31
32
|
isNavbarVisible: boolean;
|
|
32
33
|
isPresentationMode: boolean;
|
|
33
34
|
activeCommentId: string | null;
|
|
35
|
+
activeTabId: string;
|
|
36
|
+
onTabChange?: (tabId: string) => void;
|
|
34
37
|
isPreviewMode: boolean;
|
|
38
|
+
tabs: Tab[];
|
|
39
|
+
isCollaborationEnabled: boolean;
|
|
35
40
|
}
|
|
36
41
|
export interface CommentCardProps extends IComment {
|
|
37
42
|
comment?: string;
|
|
38
43
|
onResolve?: (commentId: string) => void;
|
|
39
44
|
onDelete?: (commentId: string) => void;
|
|
45
|
+
onRequestDelete?: (commentId: string) => void;
|
|
40
46
|
onUnresolve?: (commentId: string) => void;
|
|
47
|
+
onFocusRequest?: () => void;
|
|
41
48
|
isResolved?: boolean;
|
|
42
49
|
isDropdown?: boolean;
|
|
43
50
|
activeCommentId?: string;
|
|
@@ -45,15 +52,21 @@ export interface CommentCardProps extends IComment {
|
|
|
45
52
|
isCommentOwner?: boolean;
|
|
46
53
|
version?: string;
|
|
47
54
|
emptyComment?: boolean;
|
|
55
|
+
isFocused?: boolean;
|
|
56
|
+
isCommentDrawerContext?: boolean;
|
|
48
57
|
}
|
|
49
58
|
export type CommentBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
|
50
59
|
zoomLevel: string;
|
|
51
60
|
};
|
|
52
61
|
export interface CommentReplyProps {
|
|
62
|
+
commentId: string;
|
|
63
|
+
replyId: string;
|
|
53
64
|
reply: string;
|
|
54
65
|
username: string;
|
|
55
66
|
createdAt: Date;
|
|
56
67
|
isLast: boolean;
|
|
68
|
+
isThreadResolved?: boolean;
|
|
69
|
+
isCommentDrawerContext?: boolean;
|
|
57
70
|
}
|
|
58
71
|
export interface EnsStatus {
|
|
59
72
|
name: string;
|
|
@@ -63,6 +76,17 @@ export interface CommentSectionProps {
|
|
|
63
76
|
activeCommentId: string | null;
|
|
64
77
|
isNavbarVisible?: boolean;
|
|
65
78
|
isPresentationMode?: boolean;
|
|
79
|
+
isMobile?: boolean;
|
|
80
|
+
comments?: IComment[];
|
|
81
|
+
commentType?: 'all' | 'active' | 'resolved';
|
|
82
|
+
sectionLabel?: string;
|
|
83
|
+
tabNameById?: Record<string, string>;
|
|
84
|
+
selectedTabLabel?: string;
|
|
85
|
+
newCommentTabId?: string;
|
|
86
|
+
showNewCommentInput?: boolean;
|
|
87
|
+
onCommentFocus?: (commentId: string, tabId?: string) => void;
|
|
88
|
+
onReset?: () => void;
|
|
89
|
+
isCollaborationEnabled: boolean;
|
|
66
90
|
}
|
|
67
91
|
export interface UserDisplayProps {
|
|
68
92
|
username: string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { FloatingLayoutInvalidationFlag } from './comment-floating-layout';
|
|
4
|
+
import { CommentFloatingCard } from './context/types';
|
|
5
|
+
import { AnchorRecord, FloatingCardRuntimeState } from './floating-comment-layout-utils';
|
|
6
|
+
|
|
7
|
+
interface SyncAnchorsArgs {
|
|
8
|
+
currentCycle: number;
|
|
9
|
+
currentDocVersion: number;
|
|
10
|
+
editor: Editor;
|
|
11
|
+
editorRoot: HTMLElement;
|
|
12
|
+
editorWrapperNode: HTMLDivElement | null;
|
|
13
|
+
floatingCards: CommentFloatingCard[];
|
|
14
|
+
getFloatingCardRuntimeState: (floatingCardId: string) => FloatingCardRuntimeState;
|
|
15
|
+
markFloatingCardInvalidated: (floatingCardId: string, flag: FloatingLayoutInvalidationFlag) => void;
|
|
16
|
+
markFloatingCardOrderDirty: () => void;
|
|
17
|
+
markRecomputeFromIndex: (recomputeFromIndex: number) => void;
|
|
18
|
+
getOrderedFloatingCardIndex: (floatingCardId: string) => number | null;
|
|
19
|
+
}
|
|
20
|
+
interface SyncAnchorsResult {
|
|
21
|
+
activeFloatingCards: CommentFloatingCard[];
|
|
22
|
+
activeFloatingCardMap: Map<string, CommentFloatingCard>;
|
|
23
|
+
floatingCardIdsToClose: Set<string>;
|
|
24
|
+
shouldScheduleFollowUp: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface UseAnchorRegistryResult {
|
|
27
|
+
anchorRegistryRef: MutableRefObject<Map<string, AnchorRecord>>;
|
|
28
|
+
queueAnchorRefresh: (floatingCardId: string) => void;
|
|
29
|
+
queueAnchorRefreshForCards: (floatingCards: CommentFloatingCard[]) => void;
|
|
30
|
+
resetAnchorRegistry: () => void;
|
|
31
|
+
syncAnchors: (args: SyncAnchorsArgs) => SyncAnchorsResult;
|
|
32
|
+
}
|
|
33
|
+
export declare const useAnchorRegistry: () => UseAnchorRegistryResult;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { IComment } from '../../extensions/comment';
|
|
3
|
+
import { CommentCardProps } from './types';
|
|
4
|
+
|
|
5
|
+
export declare const useCommentCard: ({ username, comment, replies, onResolve, onRequestDelete, onUnresolve, onFocusRequest, isResolved, isDropdown, isCommentDrawerContext, activeCommentId, id, isFocused, }: CommentCardProps) => {
|
|
6
|
+
commentsContainerRef: import('react').RefObject<HTMLDivElement>;
|
|
7
|
+
displayedComment: string | undefined;
|
|
8
|
+
displayedReplies: IComment[];
|
|
9
|
+
dropdownRef: import('react').RefObject<HTMLDivElement>;
|
|
10
|
+
ensStatus: import('./types').EnsStatus;
|
|
11
|
+
focusCardIfNeeded: () => void;
|
|
12
|
+
handleCommentExpandClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
+
handleReplyToggleClick: (event: MouseEvent<HTMLElement>) => void;
|
|
14
|
+
handleRequestEditClick: () => void;
|
|
15
|
+
handleRequestDeleteClick: () => void;
|
|
16
|
+
handleResolveClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
handleUnresolveClick: () => void;
|
|
18
|
+
isBelow1280px: boolean;
|
|
19
|
+
isCardActive: boolean;
|
|
20
|
+
isCommentExpanded: boolean;
|
|
21
|
+
isCommentMobileFocused: boolean;
|
|
22
|
+
isCommentTruncated: boolean;
|
|
23
|
+
replyToggleLabel: string;
|
|
24
|
+
shouldShowReplyThread: boolean;
|
|
25
|
+
shouldShowReplyToggle: boolean;
|
|
26
|
+
shouldShowResolvedMobileReplyCount: boolean;
|
|
27
|
+
showAllReplies: boolean;
|
|
28
|
+
visibleReplies: IComment[];
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { CommentFloatingCard } from './context/types';
|
|
4
|
+
|
|
5
|
+
export interface UseCommentListContainerProps {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
editorWrapperRef: RefObject<HTMLDivElement>;
|
|
8
|
+
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
9
|
+
isHidden: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseCommentListContainerResult {
|
|
12
|
+
floatingCardListContainerRef: RefObject<HTMLDivElement>;
|
|
13
|
+
mountedFloatingCards: CommentFloatingCard[];
|
|
14
|
+
registerCardNode: (floatingCardId: string, node: HTMLDivElement | null) => void;
|
|
15
|
+
shouldRender: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const useCommentListContainer: ({ editor, editorWrapperRef, scrollContainerRef, isHidden, }: UseCommentListContainerProps) => UseCommentListContainerResult;
|