@fileverse-dev/ddoc 3.0.96-zustand-21 → 3.0.97-fragment-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/index.es.js +31818 -33458
- package/dist/package/components/inline-comment/comment-card.d.ts +1 -1
- package/dist/package/components/inline-comment/context/comment-context.d.ts +4 -0
- package/dist/package/components/inline-comment/context/types.d.ts +89 -40
- package/dist/package/components/inline-comment/types.d.ts +0 -4
- package/dist/package/extensions/comment/comment.d.ts +0 -27
- package/dist/package/hooks/use-tab-editor.d.ts +0 -2
- package/dist/package/types.d.ts +1 -11
- package/dist/package/use-ddoc-editor.d.ts +0 -1
- package/dist/style.css +1 -1
- package/package.json +4 -5
- package/dist/package/components/inline-comment/comment-compose-input.d.ts +0 -1
- package/dist/package/components/inline-comment/comment-floating-container.d.ts +0 -10
- package/dist/package/components/inline-comment/comment-floating-layout.d.ts +0 -29
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +0 -7
- package/dist/package/components/inline-comment/delete-confirm-overlay.d.ts +0 -7
- package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +0 -31
- package/dist/package/stores/comment-store-provider.d.ts +0 -46
- package/dist/package/stores/comment-store.d.ts +0 -130
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@fileverse-dev/ddoc",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "DDoc",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.97-fragment-0",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
8
8
|
"exports": {
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"mammoth": "^1.10.0",
|
|
94
94
|
"markdown-it-footnote": "^4.0.0",
|
|
95
95
|
"ollama": "^0.5.14",
|
|
96
|
+
"socket.io-client": "^4.7.5",
|
|
96
97
|
"platform": "^1.3.6",
|
|
97
98
|
"prosemirror-model": "^1.21.0",
|
|
98
99
|
"prosemirror-state": "^1.4.3",
|
|
@@ -100,7 +101,6 @@
|
|
|
100
101
|
"react-dom": "^18.2.0",
|
|
101
102
|
"react-tweet": "^3.2.2",
|
|
102
103
|
"react-uuid": "^2.0.0",
|
|
103
|
-
"socket.io-client": "^4.7.5",
|
|
104
104
|
"tailwindcss-animate": "^1.0.7",
|
|
105
105
|
"tiptap-markdown": "^0.9.0",
|
|
106
106
|
"turndown": "^7.2.0",
|
|
@@ -113,8 +113,7 @@
|
|
|
113
113
|
"y-prosemirror": "^1.2.5",
|
|
114
114
|
"y-protocols": "^1.0.6",
|
|
115
115
|
"y-webrtc": "^10.3.0",
|
|
116
|
-
"yjs": "^13.6.15"
|
|
117
|
-
"zustand": "^5.0.12"
|
|
116
|
+
"yjs": "^13.6.15"
|
|
118
117
|
},
|
|
119
118
|
"peerDependencies": {
|
|
120
119
|
"@dnd-kit/core": ">=6.3.1",
|
|
@@ -153,4 +152,4 @@
|
|
|
153
152
|
"typescript": "^5.2.2",
|
|
154
153
|
"vite": "^5.0.0"
|
|
155
154
|
}
|
|
156
|
-
}
|
|
155
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CommentComposeInput: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { Editor } from '@tiptap/react';
|
|
3
|
-
|
|
4
|
-
export declare const CommentFloatingContainer: ({ editor, editorWrapperRef, scrollContainerRef, tabName, isHidden, }: {
|
|
5
|
-
editor: Editor;
|
|
6
|
-
editorWrapperRef: React.RefObject<HTMLDivElement>;
|
|
7
|
-
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
8
|
-
tabName: string;
|
|
9
|
-
isHidden: boolean;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare const FLOATING_COMMENT_CARD_GAP = 12;
|
|
2
|
-
export declare const enum FloatingLayoutDirtyFlag {
|
|
3
|
-
None = 0,
|
|
4
|
-
Anchor = 1,
|
|
5
|
-
Viewport = 2,
|
|
6
|
-
Height = 4,
|
|
7
|
-
Visibility = 8
|
|
8
|
-
}
|
|
9
|
-
export interface FloatingLayoutItemInput {
|
|
10
|
-
itemId: string;
|
|
11
|
-
anchorTop: number | null;
|
|
12
|
-
height: number;
|
|
13
|
-
isVisible: boolean;
|
|
14
|
-
isMeasured: boolean;
|
|
15
|
-
previousTranslateY: number | null;
|
|
16
|
-
dirtyFlags: FloatingLayoutDirtyFlag;
|
|
17
|
-
}
|
|
18
|
-
export interface FloatingLayoutResult {
|
|
19
|
-
placements: Map<string, {
|
|
20
|
-
translateY: number | null;
|
|
21
|
-
isVisible: boolean;
|
|
22
|
-
}>;
|
|
23
|
-
stopIndex: number;
|
|
24
|
-
}
|
|
25
|
-
export declare const computeFloatingCommentLayout: ({ items, dirtyStartIndex, gap, }: {
|
|
26
|
-
items: FloatingLayoutItemInput[];
|
|
27
|
-
dirtyStartIndex: number;
|
|
28
|
-
gap?: number;
|
|
29
|
-
}) => FloatingLayoutResult;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
interface CommentReplyInputProps {
|
|
2
|
-
commentId: string;
|
|
3
|
-
commentUsername?: string;
|
|
4
|
-
replyCount: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const CommentReplyInput: ({ commentId, commentUsername, replyCount, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { PluginKey } from '@tiptap/pm/state';
|
|
3
|
-
import { DecorationSet } from '@tiptap/pm/view';
|
|
4
|
-
|
|
5
|
-
import * as Y from 'yjs';
|
|
6
|
-
export interface CommentAnchor {
|
|
7
|
-
id: string;
|
|
8
|
-
anchorFrom: Y.RelativePosition;
|
|
9
|
-
anchorTo: Y.RelativePosition;
|
|
10
|
-
resolved: boolean;
|
|
11
|
-
deleted: boolean;
|
|
12
|
-
}
|
|
13
|
-
interface CommentDecorationPluginState {
|
|
14
|
-
decorations: DecorationSet;
|
|
15
|
-
}
|
|
16
|
-
export declare const commentDecorationPluginKey: PluginKey<CommentDecorationPluginState>;
|
|
17
|
-
export interface CommentDecorationOptions {
|
|
18
|
-
getAnchors: () => CommentAnchor[];
|
|
19
|
-
}
|
|
20
|
-
export declare const CommentDecorationExtension: Extension<CommentDecorationOptions, any>;
|
|
21
|
-
export declare function createCommentAnchorFromEditor(editor: any, from: number, to: number): {
|
|
22
|
-
anchorFrom: Y.RelativePosition;
|
|
23
|
-
anchorTo: Y.RelativePosition;
|
|
24
|
-
} | null;
|
|
25
|
-
export declare function createCommentAnchorFromSelection(editor: any): {
|
|
26
|
-
anchorFrom: Y.RelativePosition;
|
|
27
|
-
anchorTo: Y.RelativePosition;
|
|
28
|
-
} | null;
|
|
29
|
-
export declare function triggerDecorationRebuild(editor: any): void;
|
|
30
|
-
export declare function getCommentAtPosition(editor: any, pos: number, getAnchors: () => CommentAnchor[]): CommentAnchor | null;
|
|
31
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { Editor } from '@tiptap/react';
|
|
3
|
-
import { IComment } from '../extensions/comment';
|
|
4
|
-
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
5
|
-
import { CommentMutationMeta, SerializedCommentAnchor } from '../types';
|
|
6
|
-
|
|
7
|
-
import * as Y from 'yjs';
|
|
8
|
-
export interface CommentStoreProviderProps {
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
editor: Editor | null;
|
|
11
|
-
ydoc: Y.Doc;
|
|
12
|
-
setActiveCommentId: (id: string | null) => void;
|
|
13
|
-
focusCommentWithActiveId: (id: string) => void;
|
|
14
|
-
setInitialComments?: React.Dispatch<React.SetStateAction<IComment[]>>;
|
|
15
|
-
onNewComment?: (comment: IComment, meta?: CommentMutationMeta) => void;
|
|
16
|
-
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
17
|
-
onResolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
18
|
-
onUnresolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
19
|
-
onDeleteComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
20
|
-
onInlineComment?: () => void;
|
|
21
|
-
onComment?: () => void;
|
|
22
|
-
setCommentDrawerOpen?: (open: boolean) => void;
|
|
23
|
-
connectViaWallet?: () => Promise<void>;
|
|
24
|
-
connectViaUsername?: (username: string) => Promise<void>;
|
|
25
|
-
ensResolutionUrl: string;
|
|
26
|
-
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
27
|
-
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
28
|
-
initialComments: IComment[];
|
|
29
|
-
username: string | null;
|
|
30
|
-
activeCommentId: string | null;
|
|
31
|
-
activeTabId: string;
|
|
32
|
-
isConnected?: boolean;
|
|
33
|
-
isLoading?: boolean;
|
|
34
|
-
isDDocOwner?: boolean;
|
|
35
|
-
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
36
|
-
}
|
|
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
|
-
interface CommentRefsContextType {
|
|
39
|
-
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
40
|
-
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
41
|
-
portalRef: React.RefObject<HTMLDivElement>;
|
|
42
|
-
buttonRef: React.RefObject<HTMLDivElement>;
|
|
43
|
-
dropdownRef: React.RefObject<HTMLDivElement>;
|
|
44
|
-
}
|
|
45
|
-
export declare const useCommentRefs: () => CommentRefsContextType;
|
|
46
|
-
export {};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/react';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
4
|
-
import { CommentFloatingItem, EnsCache, InlineCommentData } from '../components/inline-comment/context/types';
|
|
5
|
-
import { EnsStatus } from '../components/inline-comment/types';
|
|
6
|
-
import { IComment } from '../extensions/comment';
|
|
7
|
-
import { CommentMutationMeta, CommentMutationType } from '../types';
|
|
8
|
-
|
|
9
|
-
import * as Y from 'yjs';
|
|
10
|
-
export interface CommentExternalDeps {
|
|
11
|
-
editor: Editor | null;
|
|
12
|
-
ydoc: Y.Doc;
|
|
13
|
-
setActiveCommentId: (id: string | null) => void;
|
|
14
|
-
focusCommentWithActiveId: (id: string) => void;
|
|
15
|
-
setInitialComments?: React.Dispatch<React.SetStateAction<IComment[]>>;
|
|
16
|
-
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
17
|
-
onNewComment?: (comment: IComment, meta?: CommentMutationMeta) => void;
|
|
18
|
-
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
19
|
-
onResolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
20
|
-
onUnresolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
21
|
-
onDeleteComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
22
|
-
onInlineComment?: () => void;
|
|
23
|
-
onComment?: () => void;
|
|
24
|
-
setCommentDrawerOpen?: (open: boolean) => void;
|
|
25
|
-
connectViaWallet?: () => Promise<void>;
|
|
26
|
-
connectViaUsername?: (username: string) => Promise<void>;
|
|
27
|
-
ensResolutionUrl: string;
|
|
28
|
-
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
29
|
-
}
|
|
30
|
-
type FloatingItemsUpdater = React.SetStateAction<CommentFloatingItem[]>;
|
|
31
|
-
type InlineCommentDataUpdater = Partial<InlineCommentData> | ((prev: InlineCommentData) => Partial<InlineCommentData> | InlineCommentData);
|
|
32
|
-
export interface CommentStoreState {
|
|
33
|
-
initialComments: IComment[];
|
|
34
|
-
tabComments: IComment[];
|
|
35
|
-
activeComments: IComment[];
|
|
36
|
-
activeComment: IComment | undefined;
|
|
37
|
-
activeCommentIndex: number;
|
|
38
|
-
username: string | null;
|
|
39
|
-
activeCommentId: string | null;
|
|
40
|
-
activeTabId: string;
|
|
41
|
-
isConnected: boolean;
|
|
42
|
-
isLoading: boolean;
|
|
43
|
-
isDDocOwner: boolean;
|
|
44
|
-
onComment: (() => void) | null;
|
|
45
|
-
setCommentDrawerOpen: ((open: boolean) => void) | null;
|
|
46
|
-
connectViaWallet: (() => Promise<void>) | null;
|
|
47
|
-
connectViaUsername: ((username: string) => Promise<void>) | null;
|
|
48
|
-
isCommentActive: boolean;
|
|
49
|
-
isCommentResolved: boolean;
|
|
50
|
-
showResolved: boolean;
|
|
51
|
-
reply: string;
|
|
52
|
-
comment: string;
|
|
53
|
-
openReplyId: string | null;
|
|
54
|
-
selectedText: string;
|
|
55
|
-
isCommentOpen: boolean;
|
|
56
|
-
isBubbleMenuSuppressed: boolean;
|
|
57
|
-
inlineCommentData: InlineCommentData;
|
|
58
|
-
floatingItems: CommentFloatingItem[];
|
|
59
|
-
isDesktopFloatingEnabled: boolean;
|
|
60
|
-
ensCache: EnsCache;
|
|
61
|
-
inProgressFetch: string[];
|
|
62
|
-
_externalDepsRef: React.RefObject<CommentExternalDeps | null> | null;
|
|
63
|
-
setExternalDepsRef: (ref: React.RefObject<CommentExternalDeps | null>) => void;
|
|
64
|
-
_recomputeDerived: () => void;
|
|
65
|
-
setInitialComments: (comments: IComment[]) => void;
|
|
66
|
-
setUsername: (username: string | null) => void;
|
|
67
|
-
setActiveCommentId: (id: string | null) => void;
|
|
68
|
-
setActiveTabId: (tabId: string) => void;
|
|
69
|
-
setIsConnected: (connected: boolean) => void;
|
|
70
|
-
setIsLoading: (loading: boolean) => void;
|
|
71
|
-
setIsDDocOwner: (isOwner: boolean) => void;
|
|
72
|
-
setOnComment: (fn: (() => void) | null) => void;
|
|
73
|
-
setCommentDrawerOpenFn: (fn: ((open: boolean) => void) | null) => void;
|
|
74
|
-
setConnectViaWallet: (fn: (() => Promise<void>) | null) => void;
|
|
75
|
-
setConnectViaUsername: (fn: ((username: string) => Promise<void>) | null) => void;
|
|
76
|
-
setIsCommentActive: (active: boolean) => void;
|
|
77
|
-
setIsCommentResolved: (resolved: boolean) => void;
|
|
78
|
-
getTabComments: () => IComment[];
|
|
79
|
-
getActiveComment: () => IComment | undefined;
|
|
80
|
-
getActiveComments: () => IComment[];
|
|
81
|
-
getActiveCommentIndex: () => number;
|
|
82
|
-
getIsCommentActive: () => boolean;
|
|
83
|
-
getIsCommentResolved: () => boolean;
|
|
84
|
-
setShowResolved: (show: boolean) => void;
|
|
85
|
-
setReply: (reply: string) => void;
|
|
86
|
-
setComment: (comment: string) => void;
|
|
87
|
-
setOpenReplyId: (id: string | null) => void;
|
|
88
|
-
setSelectedText: (text: string) => void;
|
|
89
|
-
setIsCommentOpen: (open: boolean) => void;
|
|
90
|
-
setIsBubbleMenuSuppressed: (suppressed: boolean) => void;
|
|
91
|
-
setInlineCommentData: (data: InlineCommentDataUpdater) => void;
|
|
92
|
-
setFloatingItems: (items: FloatingItemsUpdater) => void;
|
|
93
|
-
clearFloatingItems: () => void;
|
|
94
|
-
setIsDesktopFloatingEnabled: (enabled: boolean) => void;
|
|
95
|
-
toggleResolved: () => void;
|
|
96
|
-
handleInput: (e: React.FormEvent<HTMLTextAreaElement>, content: string) => void;
|
|
97
|
-
handleReplyChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
98
|
-
handleCommentChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
99
|
-
handleCommentKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
100
|
-
handleReplyKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
101
|
-
handleReplySubmit: () => void;
|
|
102
|
-
handleCommentSubmit: () => void;
|
|
103
|
-
handleInlineComment: () => void;
|
|
104
|
-
addComment: (content?: string, usernameProp?: string) => string | undefined;
|
|
105
|
-
createFloatingDraft: () => string | null;
|
|
106
|
-
updateFloatingDraftText: (draftId: string, value: string) => void;
|
|
107
|
-
cancelFloatingDraft: (draftId: string) => void;
|
|
108
|
-
submitFloatingDraft: (draftId: string) => void;
|
|
109
|
-
openFloatingThread: (commentId: string) => void;
|
|
110
|
-
closeFloatingItem: (itemId: string) => void;
|
|
111
|
-
blurFloatingItem: (itemId: string) => void;
|
|
112
|
-
focusFloatingItem: (itemId: string) => void;
|
|
113
|
-
pruneFloatingItems: () => void;
|
|
114
|
-
syncFloatingThreadWithActiveComment: () => void;
|
|
115
|
-
submitPendingFloatingDrafts: () => void;
|
|
116
|
-
resolveComment: (commentId: string) => void;
|
|
117
|
-
unresolveComment: (commentId: string) => void;
|
|
118
|
-
deleteComment: (commentId: string) => void;
|
|
119
|
-
deleteReply: (commentId: string, replyId: string) => void;
|
|
120
|
-
handleAddReply: (activeCommentId: string, replyContent: string, replyCallback?: (activeCommentId: string, reply: IComment) => void) => void;
|
|
121
|
-
focusCommentInEditor: (commentId: string) => void;
|
|
122
|
-
onPrevComment: () => void;
|
|
123
|
-
onNextComment: () => void;
|
|
124
|
-
getEnsStatus: (walletAddress: string, setEnsStatus: React.Dispatch<React.SetStateAction<EnsStatus>>) => void;
|
|
125
|
-
createMutationMeta: (type: CommentMutationType, mutate: () => boolean) => CommentMutationMeta | undefined;
|
|
126
|
-
}
|
|
127
|
-
export declare const createCommentStore: () => import('zustand').StoreApi<CommentStoreState>;
|
|
128
|
-
export declare const CommentStoreContext: React.Context<import('zustand').StoreApi<CommentStoreState> | null>;
|
|
129
|
-
export declare function useCommentStore<T>(selector: (state: CommentStoreState) => T): T;
|
|
130
|
-
export {};
|