@fileverse-dev/ddoc 3.0.96-zustand-21 → 3.0.96-zustand-24
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 +25357 -24523
- 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-floating-layout.d.ts +10 -8
- package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
- package/dist/package/components/inline-comment/context/types.d.ts +6 -7
- package/dist/package/components/inline-comment/delete-confirm-overlay.d.ts +4 -1
- package/dist/package/components/inline-comment/empty-comments.d.ts +4 -1
- package/dist/package/components/inline-comment/floating-comment-layout-utils.d.ts +78 -0
- package/dist/package/components/inline-comment/types.d.ts +13 -0
- package/dist/package/components/inline-comment/use-anchor-registry.d.ts +33 -0
- package/dist/package/components/inline-comment/use-comment-list-container.d.ts +17 -0
- package/dist/package/components/inline-comment/use-floating-card-state.d.ts +34 -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/stores/comment-store-provider.d.ts +2 -1
- package/dist/package/stores/comment-store.d.ts +11 -10
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CommentCardProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentCard: ({ username, comment, createdAt, replies, onResolve, onDelete: _onDelete, onRequestDelete, onUnresolve, isResolved, isDropdown, activeCommentId, id, isDisabled, isCommentOwner, version, emptyComment, }: CommentCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const CommentCard: ({ username, comment, createdAt, replies, onResolve, onDelete: _onDelete, onRequestDelete, onUnresolve, isResolved, isDropdown, activeCommentId, id, isDisabled, isCommentOwner, version, emptyComment, isCommentDrawerContext, }: 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, isPreviewMode, tabs, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export declare const FLOATING_COMMENT_CARD_GAP = 12;
|
|
2
|
-
export declare const enum
|
|
2
|
+
export declare const enum FloatingLayoutInvalidationFlag {
|
|
3
3
|
None = 0,
|
|
4
4
|
Anchor = 1,
|
|
5
5
|
Viewport = 2,
|
|
6
6
|
Height = 4,
|
|
7
7
|
Visibility = 8
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
10
|
-
|
|
9
|
+
export interface FloatingCardLayoutInput {
|
|
10
|
+
floatingCardId: string;
|
|
11
11
|
anchorTop: number | null;
|
|
12
12
|
height: number;
|
|
13
13
|
isVisible: boolean;
|
|
14
14
|
isMeasured: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
lastCommittedTranslateY: number | null;
|
|
16
|
+
invalidationFlags: FloatingLayoutInvalidationFlag;
|
|
17
17
|
}
|
|
18
18
|
export interface FloatingLayoutResult {
|
|
19
19
|
placements: Map<string, {
|
|
@@ -22,8 +22,10 @@ export interface FloatingLayoutResult {
|
|
|
22
22
|
}>;
|
|
23
23
|
stopIndex: number;
|
|
24
24
|
}
|
|
25
|
-
export declare const
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
export declare const roundFloatingTranslateY: (translateY: number | null) => number | null;
|
|
26
|
+
export declare const computeFloatingCommentLayout: ({ floatingCards, recomputeStartIndex, lastInvalidatedIndex, gap, }: {
|
|
27
|
+
floatingCards: FloatingCardLayoutInput[];
|
|
28
|
+
recomputeStartIndex: number;
|
|
29
|
+
lastInvalidatedIndex: number;
|
|
28
30
|
gap?: number;
|
|
29
31
|
}) => FloatingLayoutResult;
|
|
@@ -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, showComposeInput, onCommentFocus, onReset, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,23 +4,22 @@ import { CommentStoreState } from '../../../stores/comment-store';
|
|
|
4
4
|
import { CommentStoreProviderProps } from '../../../stores/comment-store-provider';
|
|
5
5
|
import { CommentAccountProps } from '../../../types';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
8
|
-
|
|
7
|
+
export interface CommentFloatingBaseCard {
|
|
8
|
+
floatingCardId: string;
|
|
9
9
|
selectedText: string;
|
|
10
|
-
isOpen: boolean;
|
|
11
10
|
isFocused: boolean;
|
|
12
11
|
}
|
|
13
|
-
export interface
|
|
12
|
+
export interface CommentFloatingDraftCard extends CommentFloatingBaseCard {
|
|
14
13
|
type: 'draft';
|
|
15
14
|
draftId: string;
|
|
16
15
|
draftText: string;
|
|
17
16
|
isAuthPending: boolean;
|
|
18
17
|
}
|
|
19
|
-
export interface
|
|
18
|
+
export interface CommentFloatingThreadCard extends CommentFloatingBaseCard {
|
|
20
19
|
type: 'thread';
|
|
21
20
|
commentId: string;
|
|
22
21
|
}
|
|
23
|
-
export type
|
|
22
|
+
export type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard;
|
|
24
23
|
export interface InlineCommentData {
|
|
25
24
|
highlightedTextContent?: string;
|
|
26
25
|
inlineCommentText: string;
|
|
@@ -32,7 +31,7 @@ export interface EnsEntry {
|
|
|
32
31
|
}
|
|
33
32
|
export type EnsCache = Record<string, EnsEntry>;
|
|
34
33
|
export type CommentProviderProps = CommentStoreProviderProps;
|
|
35
|
-
export type CommentContextType = Pick<CommentStoreState, 'activeComment' | 'activeCommentIndex' | 'activeComments' | 'activeTabId' | 'addComment' | '
|
|
34
|
+
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'> & {
|
|
36
35
|
comments: IComment[];
|
|
37
36
|
commentsSectionRef: RefObject<HTMLDivElement>;
|
|
38
37
|
dropdownRef: RefObject<HTMLDivElement>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export declare const DeleteConfirmOverlay: ({ isVisible, title, onCancel, onConfirm, className, }: {
|
|
1
|
+
export declare const DeleteConfirmOverlay: ({ isVisible, title, onCancel, onConfirm, className, heading, description, confirmLabel, }: {
|
|
2
2
|
isVisible: boolean;
|
|
3
3
|
title: string;
|
|
4
4
|
onCancel: () => void;
|
|
5
5
|
onConfirm: () => void;
|
|
6
6
|
className?: string;
|
|
7
|
+
heading?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
confirmLabel?: string;
|
|
7
10
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,78 @@
|
|
|
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';
|
|
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: "thread";
|
|
46
|
+
};
|
|
47
|
+
export declare const getAnchorElements: ({ editorRoot, anchorId, anchorType, }: {
|
|
48
|
+
editorRoot: HTMLElement;
|
|
49
|
+
anchorId: string;
|
|
50
|
+
anchorType: AnchorType;
|
|
51
|
+
}) => HTMLElement[];
|
|
52
|
+
export declare const getAnchorStartPos: (editor: Editor, elements: HTMLElement[]) => null;
|
|
53
|
+
export declare const getEditorRoot: (editor: Editor) => HTMLElement | null;
|
|
54
|
+
export declare const areAnchorElementsEqual: (previousElements: HTMLElement[], nextElements: HTMLElement[]) => boolean;
|
|
55
|
+
export declare const isAnchorEntryValid: (entry: AnchorRecord, editorRoot: HTMLElement) => boolean;
|
|
56
|
+
export declare const getCachedAnchorRect: ({ cachedRect, scrollTop, containerTop, }: {
|
|
57
|
+
cachedRect: CachedAnchorRect;
|
|
58
|
+
scrollTop: number;
|
|
59
|
+
containerTop: number;
|
|
60
|
+
}) => {
|
|
61
|
+
top: number;
|
|
62
|
+
height: number;
|
|
63
|
+
};
|
|
64
|
+
export declare const getRect: ({ elements, viewportTop, viewportBottom, }: {
|
|
65
|
+
elements: HTMLElement[];
|
|
66
|
+
viewportTop: number;
|
|
67
|
+
viewportBottom: number;
|
|
68
|
+
}) => DOMRect | null;
|
|
69
|
+
export declare const reconcileOrderedFloatingCardIds: ({ previousOrderedFloatingCardIds, nextFloatingCards, getPos, }: {
|
|
70
|
+
previousOrderedFloatingCardIds: string[];
|
|
71
|
+
nextFloatingCards: CommentFloatingCard[];
|
|
72
|
+
getPos: (floatingCardId: string) => number | null;
|
|
73
|
+
}) => {
|
|
74
|
+
orderedFloatingCardIds: string[];
|
|
75
|
+
firstChangedIndex: number | null;
|
|
76
|
+
};
|
|
77
|
+
export declare const areFloatingCardIdListsEqual: (a: string[], b: string[]) => boolean;
|
|
78
|
+
export declare const toFloatingCardLayoutInput: (floatingCardState: FloatingCardRuntimeState) => FloatingCardLayoutInput;
|
|
@@ -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,7 +32,9 @@ export interface CommentDrawerProps {
|
|
|
31
32
|
isNavbarVisible: boolean;
|
|
32
33
|
isPresentationMode: boolean;
|
|
33
34
|
activeCommentId: string | null;
|
|
35
|
+
activeTabId: string;
|
|
34
36
|
isPreviewMode: boolean;
|
|
37
|
+
tabs: Tab[];
|
|
35
38
|
}
|
|
36
39
|
export interface CommentCardProps extends IComment {
|
|
37
40
|
comment?: string;
|
|
@@ -47,6 +50,7 @@ export interface CommentCardProps extends IComment {
|
|
|
47
50
|
version?: string;
|
|
48
51
|
emptyComment?: boolean;
|
|
49
52
|
isFocused?: boolean;
|
|
53
|
+
isCommentDrawerContext?: boolean;
|
|
50
54
|
}
|
|
51
55
|
export type CommentBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
|
52
56
|
zoomLevel: string;
|
|
@@ -67,6 +71,15 @@ export interface CommentSectionProps {
|
|
|
67
71
|
activeCommentId: string | null;
|
|
68
72
|
isNavbarVisible?: boolean;
|
|
69
73
|
isPresentationMode?: boolean;
|
|
74
|
+
isMobile?: boolean;
|
|
75
|
+
comments?: IComment[];
|
|
76
|
+
commentType?: 'all' | 'active' | 'resolved';
|
|
77
|
+
sectionLabel?: string;
|
|
78
|
+
tabNameById?: Record<string, string>;
|
|
79
|
+
selectedTabLabel?: string;
|
|
80
|
+
showComposeInput?: boolean;
|
|
81
|
+
onCommentFocus?: (commentId: string, tabId?: string) => void;
|
|
82
|
+
onReset?: () => void;
|
|
70
83
|
}
|
|
71
84
|
export interface UserDisplayProps {
|
|
72
85
|
username: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
markRecomputeFromIndex: (recomputeFromIndex: number) => void;
|
|
17
|
+
getOrderedFloatingCardIndex: (floatingCardId: string) => number | null;
|
|
18
|
+
}
|
|
19
|
+
interface SyncAnchorsResult {
|
|
20
|
+
activeFloatingCards: CommentFloatingCard[];
|
|
21
|
+
activeFloatingCardMap: Map<string, CommentFloatingCard>;
|
|
22
|
+
floatingCardIdsToClose: Set<string>;
|
|
23
|
+
shouldScheduleFollowUp: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface UseAnchorRegistryResult {
|
|
26
|
+
anchorRegistryRef: MutableRefObject<Map<string, AnchorRecord>>;
|
|
27
|
+
queueAnchorRefresh: (floatingCardId: string) => void;
|
|
28
|
+
queueAnchorRefreshForCards: (floatingCards: CommentFloatingCard[]) => void;
|
|
29
|
+
resetAnchorRegistry: () => void;
|
|
30
|
+
syncAnchors: (args: SyncAnchorsArgs) => SyncAnchorsResult;
|
|
31
|
+
}
|
|
32
|
+
export declare const useAnchorRegistry: () => UseAnchorRegistryResult;
|
|
33
|
+
export {};
|
|
@@ -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;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { FloatingLayoutInvalidationFlag, FloatingCardLayoutInput } from './comment-floating-layout';
|
|
3
|
+
import { CommentFloatingCard } from './context/types';
|
|
4
|
+
import { FloatingCardRuntimeState } from './floating-comment-layout-utils';
|
|
5
|
+
|
|
6
|
+
interface SyncMountedFloatingCardIdsResult {
|
|
7
|
+
didChange: boolean;
|
|
8
|
+
previousMountedFloatingCardIds: Set<string>;
|
|
9
|
+
}
|
|
10
|
+
export interface UseFloatingCardStateResult {
|
|
11
|
+
floatingCardStateRef: MutableRefObject<Map<string, FloatingCardRuntimeState>>;
|
|
12
|
+
orderedFloatingCardIdsRef: MutableRefObject<string[]>;
|
|
13
|
+
heightMeasurementQueueRef: MutableRefObject<Set<string>>;
|
|
14
|
+
layoutBoundaryRef: MutableRefObject<{
|
|
15
|
+
recomputeFromIndex: number;
|
|
16
|
+
}>;
|
|
17
|
+
mountedFloatingCardIdsRef: MutableRefObject<string[]>;
|
|
18
|
+
mountedFloatingCardIds: string[];
|
|
19
|
+
getFloatingCardRuntimeState: (floatingCardId: string) => FloatingCardRuntimeState;
|
|
20
|
+
getOrderedFloatingCardIndex: (floatingCardId: string) => number | null;
|
|
21
|
+
markRecomputeFromIndex: (recomputeFromIndex: number) => void;
|
|
22
|
+
markFloatingCardInvalidated: (floatingCardId: string, flag: FloatingLayoutInvalidationFlag) => void;
|
|
23
|
+
reconcileFloatingCardOrder: (nextFloatingCards: CommentFloatingCard[]) => {
|
|
24
|
+
orderedFloatingCardIds: string[];
|
|
25
|
+
firstChangedIndex: number | null;
|
|
26
|
+
};
|
|
27
|
+
pruneFloatingCardRuntimeState: (activeFloatingCardIds: Set<string>) => void;
|
|
28
|
+
syncMountedFloatingCardIds: (nextMountedFloatingCardIds: string[]) => SyncMountedFloatingCardIdsResult;
|
|
29
|
+
clearInvalidationFlagsThroughIndex: (stopIndex: number) => void;
|
|
30
|
+
getFloatingCardLayoutInputs: () => FloatingCardLayoutInput[];
|
|
31
|
+
resetFloatingCardState: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const useFloatingCardState: () => UseFloatingCardStateResult;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { CommentFloatingCard } from './context/types';
|
|
4
|
+
|
|
5
|
+
interface UseFloatingCommentCardLayoutProps {
|
|
6
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
7
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
8
|
+
editor: Editor;
|
|
9
|
+
editorWrapperRef: RefObject<HTMLDivElement>;
|
|
10
|
+
floatingCardIdsKey: string;
|
|
11
|
+
floatingCards: CommentFloatingCard[];
|
|
12
|
+
focusedFloatingCardId: string | null;
|
|
13
|
+
isDesktopFloatingEnabled: boolean;
|
|
14
|
+
isHidden: boolean;
|
|
15
|
+
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
16
|
+
}
|
|
17
|
+
interface UseFloatingCommentCardLayoutResult {
|
|
18
|
+
floatingCardListContainerRef: RefObject<HTMLDivElement>;
|
|
19
|
+
mountedFloatingCardIds: string[];
|
|
20
|
+
registerCardNode: (floatingCardId: string, node: HTMLDivElement | null) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const useFloatingCommentCardLayout: ({ blurFloatingCard, closeFloatingCard, editor, editorWrapperRef, floatingCardIdsKey, floatingCards, focusedFloatingCardId, isDesktopFloatingEnabled, isHidden, scrollContainerRef, }: UseFloatingCommentCardLayoutProps) => UseFloatingCommentCardLayoutResult;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommentFloatingCard } from './context/types';
|
|
2
|
+
|
|
3
|
+
interface UseFloatingCommentCardStateResult {
|
|
4
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
5
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
6
|
+
floatingCardIdsKey: string;
|
|
7
|
+
floatingCardMap: Map<string, CommentFloatingCard>;
|
|
8
|
+
floatingCards: CommentFloatingCard[];
|
|
9
|
+
focusedFloatingCardId: string | null;
|
|
10
|
+
isDesktopFloatingEnabled: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const useFloatingCommentCardState: () => UseFloatingCommentCardStateResult;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { CommentFloatingCard } from './context/types';
|
|
4
|
+
import { UseAnchorRegistryResult } from './use-anchor-registry';
|
|
5
|
+
import { UseFloatingCardStateResult } from './use-floating-card-state';
|
|
6
|
+
|
|
7
|
+
interface UseFloatingLayoutEngineProps {
|
|
8
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
9
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
10
|
+
editor: Editor;
|
|
11
|
+
editorWrapperRef: RefObject<HTMLDivElement>;
|
|
12
|
+
floatingCardIdsKey: string;
|
|
13
|
+
floatingCards: CommentFloatingCard[];
|
|
14
|
+
focusedFloatingCardId: string | null;
|
|
15
|
+
isDesktopFloatingEnabled: boolean;
|
|
16
|
+
isHidden: boolean;
|
|
17
|
+
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
18
|
+
anchorRegistry: UseAnchorRegistryResult;
|
|
19
|
+
floatingCardState: UseFloatingCardStateResult;
|
|
20
|
+
}
|
|
21
|
+
export interface UseFloatingLayoutEngineResult {
|
|
22
|
+
floatingCardListContainerRef: RefObject<HTMLDivElement>;
|
|
23
|
+
registerCardNode: (floatingCardId: string, node: HTMLDivElement | null) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const useFloatingLayoutEngine: ({ blurFloatingCard, closeFloatingCard, editor, editorWrapperRef, floatingCardIdsKey, floatingCards, focusedFloatingCardId, isDesktopFloatingEnabled, isHidden, scrollContainerRef, anchorRegistry, floatingCardState, }: UseFloatingLayoutEngineProps) => UseFloatingLayoutEngineResult;
|
|
26
|
+
export {};
|
|
@@ -9,6 +9,7 @@ export interface CommentStoreProviderProps {
|
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
editor: Editor | null;
|
|
11
11
|
ydoc: Y.Doc;
|
|
12
|
+
isFocusMode?: boolean;
|
|
12
13
|
setActiveCommentId: (id: string | null) => void;
|
|
13
14
|
focusCommentWithActiveId: (id: string) => void;
|
|
14
15
|
setInitialComments?: React.Dispatch<React.SetStateAction<IComment[]>>;
|
|
@@ -34,7 +35,7 @@ export interface CommentStoreProviderProps {
|
|
|
34
35
|
isDDocOwner?: boolean;
|
|
35
36
|
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
36
37
|
}
|
|
37
|
-
export declare const CommentStoreProvider: ({ children, editor, ydoc, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
39
|
interface CommentRefsContextType {
|
|
39
40
|
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
40
41
|
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
4
|
-
import {
|
|
4
|
+
import { CommentFloatingCard, EnsCache, InlineCommentData } from '../components/inline-comment/context/types';
|
|
5
5
|
import { EnsStatus } from '../components/inline-comment/types';
|
|
6
6
|
import { IComment } from '../extensions/comment';
|
|
7
7
|
import { CommentMutationMeta, CommentMutationType } from '../types';
|
|
@@ -27,7 +27,7 @@ export interface CommentExternalDeps {
|
|
|
27
27
|
ensResolutionUrl: string;
|
|
28
28
|
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
29
29
|
}
|
|
30
|
-
type
|
|
30
|
+
type FloatingCardsUpdater = React.SetStateAction<CommentFloatingCard[]>;
|
|
31
31
|
type InlineCommentDataUpdater = Partial<InlineCommentData> | ((prev: InlineCommentData) => Partial<InlineCommentData> | InlineCommentData);
|
|
32
32
|
export interface CommentStoreState {
|
|
33
33
|
initialComments: IComment[];
|
|
@@ -55,7 +55,8 @@ export interface CommentStoreState {
|
|
|
55
55
|
isCommentOpen: boolean;
|
|
56
56
|
isBubbleMenuSuppressed: boolean;
|
|
57
57
|
inlineCommentData: InlineCommentData;
|
|
58
|
-
|
|
58
|
+
floatingCards: CommentFloatingCard[];
|
|
59
|
+
mobileDraftId: string | null;
|
|
59
60
|
isDesktopFloatingEnabled: boolean;
|
|
60
61
|
ensCache: EnsCache;
|
|
61
62
|
inProgressFetch: string[];
|
|
@@ -89,8 +90,8 @@ export interface CommentStoreState {
|
|
|
89
90
|
setIsCommentOpen: (open: boolean) => void;
|
|
90
91
|
setIsBubbleMenuSuppressed: (suppressed: boolean) => void;
|
|
91
92
|
setInlineCommentData: (data: InlineCommentDataUpdater) => void;
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
setFloatingCards: (floatingCards: FloatingCardsUpdater) => void;
|
|
94
|
+
clearFloatingCards: () => void;
|
|
94
95
|
setIsDesktopFloatingEnabled: (enabled: boolean) => void;
|
|
95
96
|
toggleResolved: () => void;
|
|
96
97
|
handleInput: (e: React.FormEvent<HTMLTextAreaElement>, content: string) => void;
|
|
@@ -107,11 +108,11 @@ export interface CommentStoreState {
|
|
|
107
108
|
cancelFloatingDraft: (draftId: string) => void;
|
|
108
109
|
submitFloatingDraft: (draftId: string) => void;
|
|
109
110
|
openFloatingThread: (commentId: string) => void;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
112
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
113
|
+
focusFloatingCard: (floatingCardId: string) => void;
|
|
114
|
+
removeInvalidFloatingCards: () => void;
|
|
115
|
+
syncFloatingThreadCardWithActiveComment: () => void;
|
|
115
116
|
submitPendingFloatingDrafts: () => void;
|
|
116
117
|
resolveComment: (commentId: string) => void;
|
|
117
118
|
unresolveComment: (commentId: string) => void;
|