@collabchron/notiq 1.1.12 → 1.2.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/AICommandBarPlugin-ZEC755KY.mjs +27 -0
- package/dist/{AIDialog-RHRYHSVN.mjs → AIDialog-HJW6PQPR.mjs} +11 -12
- package/dist/{AudioComponent-CKLMLB5T.mjs → AudioComponent-W5XMZPQB.mjs} +10 -6
- package/dist/{DynamicBlockComponent-2LOADZUX.mjs → DynamicBlockComponent-CHRL2GAQ.mjs} +7 -6
- package/dist/{EquationComponent-4NFG55NQ.mjs → EquationComponent-GNQHG53L.mjs} +26 -7
- package/dist/{ExcalidrawComponent-BMSYIPP6.mjs → ExcalidrawComponent-POMYXDSG.mjs} +33 -6
- package/dist/{FileComponent-Y56MX5QD.mjs → FileComponent-EOVCH4V5.mjs} +9 -5
- package/dist/{HintComponet-ET7M2Q7S.mjs → HintComponet-QXL5ESND.mjs} +32 -8
- package/dist/{InlineImageComponent-FVTA4LXZ.mjs → InlineImageComponent-KDN3VGZC.mjs} +8 -3
- package/dist/{StoryBuilderComponent-JN4ZPZOW.mjs → StoryBuilderComponent-CBRFPFTR.mjs} +8 -9
- package/dist/{chunk-6UVNHT3T.mjs → chunk-4SYRK2NH.mjs} +23 -1
- package/dist/chunk-5CJZC5IB.mjs +9086 -0
- package/dist/{chunk-FO7M3X2B.mjs → chunk-6NK5DONB.mjs} +1 -1
- package/dist/{chunk-N6ILV6NF.mjs → chunk-ACW4DLVO.mjs} +21 -7
- package/dist/chunk-BCGD2YXP.mjs +574 -0
- package/dist/{chunk-TC3IISJZ.mjs → chunk-BTR3TPIN.mjs} +18 -5
- package/dist/{chunk-ZYJ7KABY.mjs → chunk-CQCS5YPS.mjs} +3 -5
- package/dist/{chunk-T2UBAZ66.mjs → chunk-D4UBNSUW.mjs} +1 -1
- package/dist/{chunk-KNW2CGIP.mjs → chunk-DBRZIA43.mjs} +4 -1
- package/dist/{chunk-CDAMHK63.mjs → chunk-GJK2L7ZM.mjs} +23 -2
- package/dist/{chunk-ELBTVBTS.mjs → chunk-IKYVBTCJ.mjs} +43 -20
- package/dist/chunk-IXRA5D53.mjs +10447 -0
- package/dist/{chunk-W6VQSFE5.mjs → chunk-J2CEQXG4.mjs} +1 -1
- package/dist/{chunk-43Z4Z2KD.mjs → chunk-JTNLN4JI.mjs} +1 -1
- package/dist/{chunk-OE5JRLCN.mjs → chunk-ONOHG5NB.mjs} +6 -4
- package/dist/{chunk-QNIY45SF.mjs → chunk-OO42URWA.mjs} +27 -6
- package/dist/chunk-PBVRSNGU.mjs +129 -0
- package/dist/chunk-QCS57TIF.mjs +1794 -0
- package/dist/chunk-RNEIJRUS.mjs +60 -0
- package/dist/chunk-TJPTGECP.mjs +1556 -0
- package/dist/{chunk-XYMXGU4T.mjs → chunk-TMYRA2W4.mjs} +1 -1
- package/dist/{chunk-ZFV2HGD3.mjs → chunk-UNEFOZTS.mjs} +1 -1
- package/dist/chunk-X4NI7EQS.mjs +282 -0
- package/dist/{chunk-5D4JF3ZZ.mjs → chunk-XAJ4GACN.mjs} +171 -49
- package/dist/{chunk-7QRJVZQY.mjs → chunk-YVUQRJVV.mjs} +63 -18
- package/dist/components/editor/index.d.ts +1 -1
- package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +1 -0
- package/dist/components/editor/nodes/Hint/index.d.ts +2 -1
- package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +73 -1
- package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +25 -3
- package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +16 -3
- package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +20 -25
- package/dist/components/editor/plugins/MarkdownPastePlugin/index.d.ts +5 -0
- package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +2 -0
- package/dist/components/editor/plugins/SlashCommand/index.d.ts +18 -1
- package/dist/components/editor/plugins/SmartTypographyPlugin/index.d.ts +26 -0
- package/dist/components/editor/utils/aiStream.d.ts +27 -0
- package/dist/components/editor/utils/excalidrawDiagramBuilder.d.ts +29 -0
- package/dist/components/editor/utils/markdownTransformers.d.ts +4 -1
- package/dist/components/editor/utils/url.d.ts +16 -4
- package/dist/components/providers/AIContext.d.ts +8 -0
- package/dist/components/ui/equation/equationTypography.d.ts +23 -0
- package/dist/core/extension.d.ts +3 -1
- package/dist/core/extensions/blocks-kit.d.ts +22 -1
- package/dist/core/extensions/copilot-and-collab.d.ts +15 -1
- package/dist/core/react/NotiqContent.d.ts +4 -1
- package/dist/core/react/index.d.ts +1 -0
- package/dist/core/react/node-renderers.d.ts +73 -0
- package/dist/core.js +15429 -13116
- package/dist/core.mjs +47 -39
- package/dist/hooks/instructions-messages.d.ts +13 -4
- package/dist/{image-QPB2CVXP.mjs → image-AL6PHM2A.mjs} +17 -12
- package/dist/index.js +15526 -13194
- package/dist/index.mjs +64 -60
- package/dist/{insert-audio-I3PD6JFS.mjs → insert-audio-CRWR7EO5.mjs} +4 -6
- package/dist/{insert-file-PHR7XL4V.mjs → insert-file-I73AZW3L.mjs} +4 -6
- package/dist/{insert-gif-R5ZO4JHC.mjs → insert-gif-KWRC3ACT.mjs} +1 -1
- package/dist/{insert-image-PLBZELHK.mjs → insert-image-XIY6BGW5.mjs} +4 -3
- package/dist/{insert-poll-6BCIFY5G.mjs → insert-poll-J5YVZNZ4.mjs} +4 -3
- package/dist/{insert-table-ZRJP6X52.mjs → insert-table-OIMJRFFK.mjs} +1 -1
- package/dist/{poll-component-VHMM5KKZ.mjs → poll-component-TVHXIKGQ.mjs} +3 -2
- package/dist/react.js +14747 -12554
- package/dist/react.mjs +40 -38
- package/dist/{stepper-KNITDVLG.mjs → stepper-ILF7YXTO.mjs} +63 -73
- package/dist/styles/notiq.css +1 -1
- package/package.json +2 -2
- package/src/styles/notiq.css +20 -0
- package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +0 -12
- package/dist/CodeActionMenuPlugin-FGH6HZLL.mjs +0 -14
- package/dist/CollaborationPlugin-TIZOQBUT.mjs +0 -405
- package/dist/CollaboratorsBar-AMPIAUOY.mjs +0 -20
- package/dist/CommentsPlugin-SDJJTUGK.mjs +0 -19
- package/dist/ExcalidrawPlugin-QLPGJPSX.mjs +0 -14
- package/dist/ExportPlugin-MJHYKQZJ.mjs +0 -43
- package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +0 -12
- package/dist/FloatingTextFormatToolbarPlugin-BXCPN3KD.mjs +0 -45
- package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +0 -360
- package/dist/MobileToolbar-KV5DX4ED.mjs +0 -982
- package/dist/SlashCommand-SPR7G5EI.mjs +0 -39
- package/dist/TableCellActionMenuPlugin-YWBA64J7.mjs +0 -838
- package/dist/TableHoverActionsPlugin-2EIXHEXN.mjs +0 -265
- package/dist/TemplatePlugin-HNTPEXBB.mjs +0 -9
- package/dist/ToolbarPlugin-F52PVNXU.mjs +0 -823
- package/dist/VersionHistoryPlugin-YWGCREKA.mjs +0 -371
- package/dist/background-color-RW5JYLMG.mjs +0 -425
- package/dist/block-format-TODFREE2.mjs +0 -14
- package/dist/chunk-22ZIL6NH.mjs +0 -88
- package/dist/chunk-2LNT36RL.mjs +0 -555
- package/dist/chunk-37LC44W3.mjs +0 -2677
- package/dist/chunk-3IILA3IP.mjs +0 -28
- package/dist/chunk-4DVIYZVB.mjs +0 -193
- package/dist/chunk-4FFTOZGJ.mjs +0 -103
- package/dist/chunk-4UMUPCDK.mjs +0 -68
- package/dist/chunk-6D6QLRYR.mjs +0 -238
- package/dist/chunk-6FQFPPLG.mjs +0 -785
- package/dist/chunk-ACV47ZKE.mjs +0 -201
- package/dist/chunk-BGV62GC2.mjs +0 -26
- package/dist/chunk-C4JWLBYN.mjs +0 -132
- package/dist/chunk-CLRSETYQ.mjs +0 -431
- package/dist/chunk-D3IOUQFR.mjs +0 -441
- package/dist/chunk-EEBA6OAH.mjs +0 -59
- package/dist/chunk-EIZMKFHF.mjs +0 -32
- package/dist/chunk-ENH2IOHI.mjs +0 -1828
- package/dist/chunk-EVPWKNE4.mjs +0 -27
- package/dist/chunk-HOZ4QRFV.mjs +0 -536
- package/dist/chunk-IAFCQV3Z.mjs +0 -349
- package/dist/chunk-J6ZUY5BY.mjs +0 -202
- package/dist/chunk-K5OAFEVY.mjs +0 -191
- package/dist/chunk-KXRLARGI.mjs +0 -26
- package/dist/chunk-LBGM4VVZ.mjs +0 -409
- package/dist/chunk-LLGVCM7M.mjs +0 -809
- package/dist/chunk-LU2XWLOE.mjs +0 -219
- package/dist/chunk-LVRJM45C.mjs +0 -171
- package/dist/chunk-MSAO3YFB.mjs +0 -144
- package/dist/chunk-N3KDPSRI.mjs +0 -496
- package/dist/chunk-OXWTZV3U.mjs +0 -174
- package/dist/chunk-PD5K4AGP.mjs +0 -64
- package/dist/chunk-PFH63ZU4.mjs +0 -33
- package/dist/chunk-R7WFRENU.mjs +0 -262
- package/dist/chunk-RAVYEEIC.mjs +0 -36
- package/dist/chunk-RJQTA6HG.mjs +0 -358
- package/dist/chunk-SAOJHVPE.mjs +0 -153
- package/dist/chunk-SYUCM5G5.mjs +0 -111
- package/dist/chunk-VGAX6YEY.mjs +0 -399
- package/dist/chunk-VNDDDXGH.mjs +0 -682
- package/dist/chunk-WUVIQCX7.mjs +0 -944
- package/dist/chunk-XNJNT6PC.mjs +0 -1701
- package/dist/chunk-XYLTLGY5.mjs +0 -775
- package/dist/chunk-ZKZ7MLSS.mjs +0 -165
- package/dist/color-S55XFDYQ.mjs +0 -13
- package/dist/font-IJKFR4BM.mjs +0 -12
- package/dist/font-size-3HMJHKO2.mjs +0 -15
- package/dist/insert-node-DGCZBGKG.mjs +0 -243
- package/dist/table-dropdown-4VCRSQB6.mjs +0 -391
- package/dist/text-align-TEB4S52S.mjs +0 -121
- package/dist/text-format-T3IY7FBI.mjs +0 -15
package/package.json
CHANGED
package/src/styles/notiq.css
CHANGED
|
@@ -1313,3 +1313,23 @@ select {
|
|
|
1313
1313
|
background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
|
|
1314
1314
|
background-size: 24px 24px;
|
|
1315
1315
|
}
|
|
1316
|
+
|
|
1317
|
+
/* AI In-Canvas Streaming Caret & Highlight */
|
|
1318
|
+
@keyframes notiq-ai-pulse {
|
|
1319
|
+
0%, 100% {
|
|
1320
|
+
opacity: 1;
|
|
1321
|
+
transform: scale(1);
|
|
1322
|
+
}
|
|
1323
|
+
50% {
|
|
1324
|
+
opacity: 0.35;
|
|
1325
|
+
transform: scale(0.82);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.notiq-ai-caret {
|
|
1330
|
+
display: inline-block;
|
|
1331
|
+
animation: notiq-ai-pulse 1s ease-in-out infinite;
|
|
1332
|
+
color: #7c3aed;
|
|
1333
|
+
margin-left: 3px;
|
|
1334
|
+
vertical-align: middle;
|
|
1335
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
AICommandBarPlugin,
|
|
4
|
-
OPEN_AI_COMMAND_BAR_COMMAND
|
|
5
|
-
} from "./chunk-HOZ4QRFV.mjs";
|
|
6
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
7
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
8
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
9
|
-
export {
|
|
10
|
-
OPEN_AI_COMMAND_BAR_COMMAND,
|
|
11
|
-
AICommandBarPlugin as default
|
|
12
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CodeActionMenuPlugin
|
|
3
|
-
} from "./chunk-N3KDPSRI.mjs";
|
|
4
|
-
import "./chunk-EEBA6OAH.mjs";
|
|
5
|
-
import "./chunk-3IILA3IP.mjs";
|
|
6
|
-
import "./chunk-LU2XWLOE.mjs";
|
|
7
|
-
import "./chunk-H3P47YXJ.mjs";
|
|
8
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
9
|
-
import "./chunk-IIVB6JNE.mjs";
|
|
10
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
11
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
12
|
-
export {
|
|
13
|
-
CodeActionMenuPlugin as default
|
|
14
|
-
};
|
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
useCollab
|
|
4
|
-
} from "./chunk-RJQTA6HG.mjs";
|
|
5
|
-
import {
|
|
6
|
-
__spreadProps,
|
|
7
|
-
__spreadValues,
|
|
8
|
-
init_react_shim
|
|
9
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
10
|
-
|
|
11
|
-
// src/components/editor/plugins/CollaborationPlugin/index.tsx
|
|
12
|
-
init_react_shim();
|
|
13
|
-
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
14
|
-
import { CollaborationPlugin as LexicalCollaborationPlugin } from "@lexical/react/LexicalCollaborationPlugin";
|
|
15
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
16
|
-
import { CONNECTED_COMMAND } from "@lexical/yjs";
|
|
17
|
-
import { COMMAND_PRIORITY_LOW } from "lexical";
|
|
18
|
-
import { WebsocketProvider } from "y-websocket";
|
|
19
|
-
import { IndexeddbPersistence } from "y-indexeddb";
|
|
20
|
-
import { Doc } from "yjs";
|
|
21
|
-
import { jsx } from "react/jsx-runtime";
|
|
22
|
-
if (typeof globalThis !== "undefined") {
|
|
23
|
-
globalThis["__ $YJS$ __"] = void 0;
|
|
24
|
-
}
|
|
25
|
-
var COLLAB_EXCLUDED_PROPERTIES = /* @__PURE__ */ new Map([
|
|
26
|
-
["stepper", /* @__PURE__ */ new Set(["__steps"])],
|
|
27
|
-
["hint", /* @__PURE__ */ new Set(["__caption"])],
|
|
28
|
-
["link-with-metadata", /* @__PURE__ */ new Set(["__editor", "__metadata"])],
|
|
29
|
-
["poll", /* @__PURE__ */ new Set(["__options"])],
|
|
30
|
-
["story-builder", /* @__PURE__ */ new Set(["__nodes"])],
|
|
31
|
-
["dynamic-block", /* @__PURE__ */ new Set(["__payload"])]
|
|
32
|
-
]);
|
|
33
|
-
function safeDisconnect(provider) {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
if (!provider) return;
|
|
36
|
-
try {
|
|
37
|
-
const ws = provider.ws;
|
|
38
|
-
if (ws) {
|
|
39
|
-
if (ws.readyState === 0) {
|
|
40
|
-
ws.onopen = () => {
|
|
41
|
-
try {
|
|
42
|
-
ws.close(1e3, "Clean close");
|
|
43
|
-
} catch (e) {
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
ws.onclose = null;
|
|
47
|
-
ws.onerror = () => {
|
|
48
|
-
};
|
|
49
|
-
provider.ws = null;
|
|
50
|
-
provider.wsconnecting = false;
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
(_b = (_a = provider.__rawDisconnect) == null ? void 0 : _a.call(provider)) != null ? _b : provider.destroy();
|
|
55
|
-
} catch (e) {
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function CollaborationPluginWrapper({
|
|
59
|
-
cursorsContainerRef,
|
|
60
|
-
initialEditorState
|
|
61
|
-
}) {
|
|
62
|
-
const [editor] = useLexicalComposerContext();
|
|
63
|
-
const {
|
|
64
|
-
docId,
|
|
65
|
-
serverUrl,
|
|
66
|
-
username,
|
|
67
|
-
cursorColor,
|
|
68
|
-
avatar,
|
|
69
|
-
offlinePersistence,
|
|
70
|
-
setOfflineStorageStatus,
|
|
71
|
-
setStatus,
|
|
72
|
-
setUsers,
|
|
73
|
-
setProvider,
|
|
74
|
-
isOnline,
|
|
75
|
-
setIsServerSynced,
|
|
76
|
-
setPendingUpdatesCount,
|
|
77
|
-
setLastSavedTimestamp,
|
|
78
|
-
setReconnectCountdown
|
|
79
|
-
} = useCollab();
|
|
80
|
-
const providerRef = useRef(null);
|
|
81
|
-
const idbRef = useRef(null);
|
|
82
|
-
const isUnmountedRef = useRef(false);
|
|
83
|
-
const destroyTimerRef = useRef(null);
|
|
84
|
-
const serverUrlRef = useRef(serverUrl);
|
|
85
|
-
serverUrlRef.current = serverUrl;
|
|
86
|
-
const setStatusRef = useRef(setStatus);
|
|
87
|
-
setStatusRef.current = setStatus;
|
|
88
|
-
const setProviderRef = useRef(setProvider);
|
|
89
|
-
setProviderRef.current = setProvider;
|
|
90
|
-
const offlinePersistenceRef = useRef(offlinePersistence);
|
|
91
|
-
offlinePersistenceRef.current = offlinePersistence;
|
|
92
|
-
const setOfflineStorageStatusRef = useRef(setOfflineStorageStatus);
|
|
93
|
-
setOfflineStorageStatusRef.current = setOfflineStorageStatus;
|
|
94
|
-
const setIsServerSyncedRef = useRef(setIsServerSynced);
|
|
95
|
-
setIsServerSyncedRef.current = setIsServerSynced;
|
|
96
|
-
const setPendingUpdatesCountRef = useRef(setPendingUpdatesCount);
|
|
97
|
-
setPendingUpdatesCountRef.current = setPendingUpdatesCount;
|
|
98
|
-
const setLastSavedTimestampRef = useRef(setLastSavedTimestamp);
|
|
99
|
-
setLastSavedTimestampRef.current = setLastSavedTimestamp;
|
|
100
|
-
const setReconnectCountdownRef = useRef(setReconnectCountdown);
|
|
101
|
-
setReconnectCountdownRef.current = setReconnectCountdown;
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
isUnmountedRef.current = false;
|
|
104
|
-
if (destroyTimerRef.current) {
|
|
105
|
-
clearTimeout(destroyTimerRef.current);
|
|
106
|
-
destroyTimerRef.current = null;
|
|
107
|
-
}
|
|
108
|
-
const ws = providerRef.current;
|
|
109
|
-
if (ws && !ws.wsconnected && !ws.wsconnecting) {
|
|
110
|
-
ws.connect();
|
|
111
|
-
}
|
|
112
|
-
return () => {
|
|
113
|
-
isUnmountedRef.current = true;
|
|
114
|
-
destroyTimerRef.current = setTimeout(() => {
|
|
115
|
-
if (isUnmountedRef.current && providerRef.current) {
|
|
116
|
-
safeDisconnect(providerRef.current);
|
|
117
|
-
providerRef.current = null;
|
|
118
|
-
}
|
|
119
|
-
}, 150);
|
|
120
|
-
};
|
|
121
|
-
}, []);
|
|
122
|
-
const memoizedAwarenessData = useMemo(
|
|
123
|
-
() => ({
|
|
124
|
-
name: username,
|
|
125
|
-
color: cursorColor,
|
|
126
|
-
avatar
|
|
127
|
-
}),
|
|
128
|
-
[username, cursorColor, avatar]
|
|
129
|
-
);
|
|
130
|
-
const normalizedInitialEditorState = useMemo(() => {
|
|
131
|
-
if (!initialEditorState) return void 0;
|
|
132
|
-
if (typeof initialEditorState === "string") return initialEditorState;
|
|
133
|
-
if (typeof initialEditorState === "function") return initialEditorState;
|
|
134
|
-
if (typeof initialEditorState.isEmpty === "function") {
|
|
135
|
-
return initialEditorState;
|
|
136
|
-
}
|
|
137
|
-
try {
|
|
138
|
-
return JSON.stringify(initialEditorState);
|
|
139
|
-
} catch (e) {
|
|
140
|
-
return void 0;
|
|
141
|
-
}
|
|
142
|
-
}, [initialEditorState]);
|
|
143
|
-
const syncUsers = useCallback(
|
|
144
|
-
(ws) => {
|
|
145
|
-
if (!ws.awareness) return;
|
|
146
|
-
const states = ws.awareness.getStates();
|
|
147
|
-
const currentClientId = ws.awareness.clientID;
|
|
148
|
-
const userList = [];
|
|
149
|
-
states.forEach((state, clientId) => {
|
|
150
|
-
var _a, _b, _c, _d;
|
|
151
|
-
if (!state) return;
|
|
152
|
-
const isSelf = clientId === currentClientId;
|
|
153
|
-
const name = state.name || ((_a = state.awarenessData) == null ? void 0 : _a.name) || (isSelf ? username : `Collaborator #${clientId.toString().slice(-4)}`);
|
|
154
|
-
const color = state.color || ((_b = state.awarenessData) == null ? void 0 : _b.color) || (isSelf ? cursorColor : "#3b82f6");
|
|
155
|
-
const userAvatar = ((_c = state.awarenessData) == null ? void 0 : _c.avatar) || state.avatar;
|
|
156
|
-
const isTyping = Boolean(state.isTyping || ((_d = state.awarenessData) == null ? void 0 : _d.isTyping));
|
|
157
|
-
userList.push({
|
|
158
|
-
clientId,
|
|
159
|
-
name,
|
|
160
|
-
color,
|
|
161
|
-
avatar: userAvatar,
|
|
162
|
-
isTyping,
|
|
163
|
-
isSelf
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
userList.sort((a, b) => a.isSelf ? -1 : b.isSelf ? 1 : 0);
|
|
167
|
-
setUsers((prev) => {
|
|
168
|
-
if (prev.length === userList.length && prev.every(
|
|
169
|
-
(u, idx) => u.clientId === userList[idx].clientId && u.name === userList[idx].name && u.color === userList[idx].color && u.avatar === userList[idx].avatar && u.isTyping === userList[idx].isTyping && u.isSelf === userList[idx].isSelf
|
|
170
|
-
)) {
|
|
171
|
-
return prev;
|
|
172
|
-
}
|
|
173
|
-
return userList;
|
|
174
|
-
});
|
|
175
|
-
},
|
|
176
|
-
[username, cursorColor, avatar, setUsers]
|
|
177
|
-
);
|
|
178
|
-
const syncUsersRef = useRef(syncUsers);
|
|
179
|
-
syncUsersRef.current = syncUsers;
|
|
180
|
-
const providerFactory = useCallback(
|
|
181
|
-
(id, yjsDocMap) => {
|
|
182
|
-
var _a;
|
|
183
|
-
let doc = yjsDocMap.get(id);
|
|
184
|
-
if (!doc) {
|
|
185
|
-
doc = new Doc();
|
|
186
|
-
yjsDocMap.set(id, doc);
|
|
187
|
-
}
|
|
188
|
-
if (offlinePersistenceRef.current && typeof window !== "undefined" && "indexedDB" in window && (!idbRef.current || idbRef.current.name !== id)) {
|
|
189
|
-
try {
|
|
190
|
-
if (idbRef.current) {
|
|
191
|
-
idbRef.current.destroy();
|
|
192
|
-
}
|
|
193
|
-
const idb = new IndexeddbPersistence(id, doc);
|
|
194
|
-
idbRef.current = idb;
|
|
195
|
-
idb.on("synced", () => {
|
|
196
|
-
setOfflineStorageStatusRef.current("synced");
|
|
197
|
-
setLastSavedTimestampRef.current(Date.now());
|
|
198
|
-
});
|
|
199
|
-
} catch (e) {
|
|
200
|
-
console.warn("[Notiq Collab] IndexedDB persistence unavailable:", e);
|
|
201
|
-
setOfflineStorageStatusRef.current("error");
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
const currentServer = (_a = providerRef.current) == null ? void 0 : _a.serverUrl;
|
|
205
|
-
const isSameServer = currentServer === serverUrlRef.current;
|
|
206
|
-
if (providerRef.current && providerRef.current.roomname === id && providerRef.current.doc === doc && isSameServer) {
|
|
207
|
-
if (!providerRef.current.wsconnected && !providerRef.current.shouldConnect) {
|
|
208
|
-
providerRef.current.connect();
|
|
209
|
-
}
|
|
210
|
-
return providerRef.current;
|
|
211
|
-
}
|
|
212
|
-
if (providerRef.current) {
|
|
213
|
-
safeDisconnect(providerRef.current);
|
|
214
|
-
providerRef.current = null;
|
|
215
|
-
}
|
|
216
|
-
if (!isSameServer && doc) {
|
|
217
|
-
yjsDocMap.delete(id);
|
|
218
|
-
doc = new Doc();
|
|
219
|
-
yjsDocMap.set(id, doc);
|
|
220
|
-
}
|
|
221
|
-
const wsProvider = new WebsocketProvider(serverUrlRef.current, id, doc, {
|
|
222
|
-
connect: true,
|
|
223
|
-
resyncInterval: 1e4
|
|
224
|
-
// Periodically request server sync every 10s
|
|
225
|
-
});
|
|
226
|
-
wsProvider.on("sync", (isSynced) => {
|
|
227
|
-
setIsServerSyncedRef.current(isSynced);
|
|
228
|
-
if (isSynced) {
|
|
229
|
-
setPendingUpdatesCountRef.current(0);
|
|
230
|
-
setLastSavedTimestampRef.current(Date.now());
|
|
231
|
-
setReconnectCountdownRef.current(null);
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
const handleDocUpdate = (_update, origin) => {
|
|
235
|
-
setLastSavedTimestampRef.current(Date.now());
|
|
236
|
-
if (origin !== wsProvider && origin !== idbRef.current) {
|
|
237
|
-
if (!wsProvider.wsconnected) {
|
|
238
|
-
setPendingUpdatesCountRef.current((prev) => prev + 1);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
doc.on("update", handleDocUpdate);
|
|
243
|
-
if (wsProvider._checkInterval) {
|
|
244
|
-
clearInterval(wsProvider._checkInterval);
|
|
245
|
-
wsProvider._checkInterval = null;
|
|
246
|
-
}
|
|
247
|
-
wsProvider.wsLastMessageReceived = Date.now();
|
|
248
|
-
const rawDisconnect = wsProvider.disconnect.bind(wsProvider);
|
|
249
|
-
wsProvider.__rawDisconnect = rawDisconnect;
|
|
250
|
-
wsProvider.disconnect = () => {
|
|
251
|
-
if (isUnmountedRef.current) {
|
|
252
|
-
safeDisconnect(wsProvider);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
providerRef.current = wsProvider;
|
|
256
|
-
setProviderRef.current(wsProvider);
|
|
257
|
-
const handleStatus = ({ status }) => {
|
|
258
|
-
if (status === "connected") {
|
|
259
|
-
setStatusRef.current("connected");
|
|
260
|
-
syncUsersRef.current(wsProvider);
|
|
261
|
-
} else if (status === "connecting") {
|
|
262
|
-
setStatusRef.current("connecting");
|
|
263
|
-
} else if (status === "disconnected") {
|
|
264
|
-
setStatusRef.current("disconnected");
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
wsProvider.on("status", handleStatus);
|
|
268
|
-
wsProvider.awareness.on("change", () => syncUsersRef.current(wsProvider));
|
|
269
|
-
if (wsProvider.wsconnected) {
|
|
270
|
-
setStatusRef.current("connected");
|
|
271
|
-
syncUsersRef.current(wsProvider);
|
|
272
|
-
}
|
|
273
|
-
return wsProvider;
|
|
274
|
-
},
|
|
275
|
-
[]
|
|
276
|
-
// Empty deps ensures stable callback identity
|
|
277
|
-
);
|
|
278
|
-
useEffect(() => {
|
|
279
|
-
let reconnectDelaySec = 4;
|
|
280
|
-
let nextReconnectAt = 0;
|
|
281
|
-
const interval = setInterval(() => {
|
|
282
|
-
const ws = providerRef.current;
|
|
283
|
-
if (!ws) return;
|
|
284
|
-
if (!isOnline) {
|
|
285
|
-
setStatus("offline");
|
|
286
|
-
setReconnectCountdown(null);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
if (ws.wsconnected) {
|
|
290
|
-
setStatus((prev) => prev !== "connected" ? "connected" : prev);
|
|
291
|
-
syncUsers(ws);
|
|
292
|
-
setReconnectCountdown(null);
|
|
293
|
-
reconnectDelaySec = 4;
|
|
294
|
-
nextReconnectAt = 0;
|
|
295
|
-
} else if (ws.wsconnecting) {
|
|
296
|
-
setStatus((prev) => prev !== "connecting" ? "connecting" : prev);
|
|
297
|
-
setReconnectCountdown(null);
|
|
298
|
-
} else {
|
|
299
|
-
setStatus((prev) => prev !== "disconnected" ? "disconnected" : prev);
|
|
300
|
-
const now = Date.now();
|
|
301
|
-
if (!nextReconnectAt) {
|
|
302
|
-
nextReconnectAt = now + reconnectDelaySec * 1e3;
|
|
303
|
-
}
|
|
304
|
-
const remainingSec = Math.max(0, Math.ceil((nextReconnectAt - now) / 1e3));
|
|
305
|
-
setReconnectCountdown(remainingSec);
|
|
306
|
-
if (remainingSec === 0) {
|
|
307
|
-
if (!ws.shouldConnect) {
|
|
308
|
-
ws.shouldConnect = true;
|
|
309
|
-
}
|
|
310
|
-
ws.connect();
|
|
311
|
-
reconnectDelaySec = Math.min(16, Math.round(reconnectDelaySec * 1.5));
|
|
312
|
-
nextReconnectAt = now + reconnectDelaySec * 1e3;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}, 500);
|
|
316
|
-
return () => clearInterval(interval);
|
|
317
|
-
}, [setStatus, syncUsers, isOnline, setReconnectCountdown]);
|
|
318
|
-
useEffect(() => {
|
|
319
|
-
return editor.registerCommand(
|
|
320
|
-
CONNECTED_COMMAND,
|
|
321
|
-
(isConnected) => {
|
|
322
|
-
if (isConnected) {
|
|
323
|
-
setStatus("connected");
|
|
324
|
-
if (providerRef.current) {
|
|
325
|
-
syncUsers(providerRef.current);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
return false;
|
|
329
|
-
},
|
|
330
|
-
COMMAND_PRIORITY_LOW
|
|
331
|
-
);
|
|
332
|
-
}, [editor, setStatus, syncUsers]);
|
|
333
|
-
useEffect(() => {
|
|
334
|
-
const ws = providerRef.current;
|
|
335
|
-
if (!(ws == null ? void 0 : ws.awareness)) return;
|
|
336
|
-
const currentLocalState = ws.awareness.getLocalState() || {};
|
|
337
|
-
ws.awareness.setLocalState(__spreadProps(__spreadValues({}, currentLocalState), {
|
|
338
|
-
name: username,
|
|
339
|
-
color: cursorColor,
|
|
340
|
-
awarenessData: __spreadProps(__spreadValues({}, currentLocalState.awarenessData || {}), {
|
|
341
|
-
name: username,
|
|
342
|
-
color: cursorColor,
|
|
343
|
-
avatar
|
|
344
|
-
})
|
|
345
|
-
}));
|
|
346
|
-
}, [username, cursorColor, avatar]);
|
|
347
|
-
useEffect(() => {
|
|
348
|
-
const keepalive = setInterval(() => {
|
|
349
|
-
const ws = providerRef.current;
|
|
350
|
-
if (ws == null ? void 0 : ws.wsconnected) {
|
|
351
|
-
if (ws._checkInterval) {
|
|
352
|
-
clearInterval(ws._checkInterval);
|
|
353
|
-
ws._checkInterval = null;
|
|
354
|
-
}
|
|
355
|
-
ws.wsLastMessageReceived = Date.now();
|
|
356
|
-
if (ws.awareness) {
|
|
357
|
-
const localState = ws.awareness.getLocalState();
|
|
358
|
-
if (localState) {
|
|
359
|
-
ws.awareness.setLocalState(__spreadValues({}, localState));
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}, 5e3);
|
|
364
|
-
return () => clearInterval(keepalive);
|
|
365
|
-
}, []);
|
|
366
|
-
const typingTimeoutRef = useRef(null);
|
|
367
|
-
useEffect(() => {
|
|
368
|
-
return editor.registerUpdateListener(({ dirtyElements, dirtyLeaves }) => {
|
|
369
|
-
if (dirtyElements.size === 0 && dirtyLeaves.size === 0) return;
|
|
370
|
-
const ws = providerRef.current;
|
|
371
|
-
if (!(ws == null ? void 0 : ws.awareness)) return;
|
|
372
|
-
const localState = ws.awareness.getLocalState();
|
|
373
|
-
if (!(localState == null ? void 0 : localState.isTyping)) {
|
|
374
|
-
ws.awareness.setLocalStateField("isTyping", true);
|
|
375
|
-
}
|
|
376
|
-
if (typingTimeoutRef.current) {
|
|
377
|
-
clearTimeout(typingTimeoutRef.current);
|
|
378
|
-
}
|
|
379
|
-
typingTimeoutRef.current = setTimeout(() => {
|
|
380
|
-
const activeWs = providerRef.current;
|
|
381
|
-
if (activeWs == null ? void 0 : activeWs.awareness) {
|
|
382
|
-
activeWs.awareness.setLocalStateField("isTyping", false);
|
|
383
|
-
}
|
|
384
|
-
}, 1500);
|
|
385
|
-
});
|
|
386
|
-
}, [editor]);
|
|
387
|
-
return /* @__PURE__ */ jsx(
|
|
388
|
-
LexicalCollaborationPlugin,
|
|
389
|
-
{
|
|
390
|
-
id: docId,
|
|
391
|
-
providerFactory,
|
|
392
|
-
shouldBootstrap: true,
|
|
393
|
-
username,
|
|
394
|
-
cursorColor,
|
|
395
|
-
cursorsContainerRef,
|
|
396
|
-
initialEditorState: normalizedInitialEditorState,
|
|
397
|
-
awarenessData: memoizedAwarenessData,
|
|
398
|
-
excludedProperties: COLLAB_EXCLUDED_PROPERTIES
|
|
399
|
-
},
|
|
400
|
-
`${docId}-${serverUrl}`
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
export {
|
|
404
|
-
CollaborationPluginWrapper as default
|
|
405
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
AVATAR_PRESETS,
|
|
4
|
-
CollaboratorsBar,
|
|
5
|
-
OfflineBanner
|
|
6
|
-
} from "./chunk-VNDDDXGH.mjs";
|
|
7
|
-
import "./chunk-J6ZUY5BY.mjs";
|
|
8
|
-
import "./chunk-R7WFRENU.mjs";
|
|
9
|
-
import "./chunk-RJQTA6HG.mjs";
|
|
10
|
-
import "./chunk-PFH63ZU4.mjs";
|
|
11
|
-
import "./chunk-5NRAXWYA.mjs";
|
|
12
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
13
|
-
import "./chunk-IIVB6JNE.mjs";
|
|
14
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
15
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
16
|
-
export {
|
|
17
|
-
AVATAR_PRESETS,
|
|
18
|
-
OfflineBanner,
|
|
19
|
-
CollaboratorsBar as default
|
|
20
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
CommentsPlugin,
|
|
4
|
-
INSERT_COMMENT_COMMAND,
|
|
5
|
-
findDOMElementForQuote
|
|
6
|
-
} from "./chunk-WUVIQCX7.mjs";
|
|
7
|
-
import "./chunk-3JN6QEJR.mjs";
|
|
8
|
-
import "./chunk-6UVNHT3T.mjs";
|
|
9
|
-
import "./chunk-OXWTZV3U.mjs";
|
|
10
|
-
import "./chunk-R7WFRENU.mjs";
|
|
11
|
-
import "./chunk-RJQTA6HG.mjs";
|
|
12
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
13
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
14
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
15
|
-
export {
|
|
16
|
-
INSERT_COMMENT_COMMAND,
|
|
17
|
-
CommentsPlugin as default,
|
|
18
|
-
findDOMElementForQuote
|
|
19
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExcalidrawPlugin,
|
|
3
|
-
INSERT_EXCALIDRAW_COMMAND
|
|
4
|
-
} from "./chunk-22ZIL6NH.mjs";
|
|
5
|
-
import "./chunk-TC3IISJZ.mjs";
|
|
6
|
-
import "./chunk-H3P47YXJ.mjs";
|
|
7
|
-
import "./chunk-QNIY45SF.mjs";
|
|
8
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
9
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
10
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
11
|
-
export {
|
|
12
|
-
INSERT_EXCALIDRAW_COMMAND,
|
|
13
|
-
ExcalidrawPlugin as default
|
|
14
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EXPORT_HTML_COMMAND,
|
|
3
|
-
EXPORT_JSON_COMMAND,
|
|
4
|
-
EXPORT_MARKDOWN_COMMAND,
|
|
5
|
-
EXPORT_PDF_COMMAND,
|
|
6
|
-
EXPORT_TEXT_COMMAND,
|
|
7
|
-
ExportPlugin,
|
|
8
|
-
IMPORT_HTML_COMMAND,
|
|
9
|
-
IMPORT_JSON_COMMAND,
|
|
10
|
-
IMPORT_MARKDOWN_COMMAND,
|
|
11
|
-
IMPORT_TEXT_COMMAND,
|
|
12
|
-
OPEN_IMPORT_EXPORT_MODAL_COMMAND
|
|
13
|
-
} from "./chunk-ENH2IOHI.mjs";
|
|
14
|
-
import "./chunk-6UVNHT3T.mjs";
|
|
15
|
-
import "./chunk-LVRJM45C.mjs";
|
|
16
|
-
import "./chunk-LLGVCM7M.mjs";
|
|
17
|
-
import "./chunk-VGAX6YEY.mjs";
|
|
18
|
-
import "./chunk-N6ILV6NF.mjs";
|
|
19
|
-
import "./chunk-T2UBAZ66.mjs";
|
|
20
|
-
import "./chunk-43Z4Z2KD.mjs";
|
|
21
|
-
import "./chunk-XYMXGU4T.mjs";
|
|
22
|
-
import "./chunk-ZFV2HGD3.mjs";
|
|
23
|
-
import "./chunk-NBE6FF6L.mjs";
|
|
24
|
-
import "./chunk-ELBTVBTS.mjs";
|
|
25
|
-
import "./chunk-QNIY45SF.mjs";
|
|
26
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
27
|
-
import "./chunk-KNW2CGIP.mjs";
|
|
28
|
-
import "./chunk-7QRJVZQY.mjs";
|
|
29
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
30
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
31
|
-
export {
|
|
32
|
-
EXPORT_HTML_COMMAND,
|
|
33
|
-
EXPORT_JSON_COMMAND,
|
|
34
|
-
EXPORT_MARKDOWN_COMMAND,
|
|
35
|
-
EXPORT_PDF_COMMAND,
|
|
36
|
-
EXPORT_TEXT_COMMAND,
|
|
37
|
-
IMPORT_HTML_COMMAND,
|
|
38
|
-
IMPORT_JSON_COMMAND,
|
|
39
|
-
IMPORT_MARKDOWN_COMMAND,
|
|
40
|
-
IMPORT_TEXT_COMMAND,
|
|
41
|
-
OPEN_IMPORT_EXPORT_MODAL_COMMAND,
|
|
42
|
-
ExportPlugin as default
|
|
43
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FloatingLinkEditorPlugin
|
|
3
|
-
} from "./chunk-D3IOUQFR.mjs";
|
|
4
|
-
import "./chunk-KXRLARGI.mjs";
|
|
5
|
-
import "./chunk-5NRAXWYA.mjs";
|
|
6
|
-
import "./chunk-RAVYEEIC.mjs";
|
|
7
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
8
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
9
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
10
|
-
export {
|
|
11
|
-
FloatingLinkEditorPlugin as default
|
|
12
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FloatingTextFormatToolbarPlugin
|
|
3
|
-
} from "./chunk-XNJNT6PC.mjs";
|
|
4
|
-
import "./chunk-PD5K4AGP.mjs";
|
|
5
|
-
import "./chunk-KXRLARGI.mjs";
|
|
6
|
-
import "./chunk-SYUCM5G5.mjs";
|
|
7
|
-
import "./chunk-SAOJHVPE.mjs";
|
|
8
|
-
import "./chunk-C4JWLBYN.mjs";
|
|
9
|
-
import "./chunk-ZYJ7KABY.mjs";
|
|
10
|
-
import "./chunk-MSAO3YFB.mjs";
|
|
11
|
-
import "./chunk-LU2XWLOE.mjs";
|
|
12
|
-
import "./chunk-WUVIQCX7.mjs";
|
|
13
|
-
import "./chunk-3JN6QEJR.mjs";
|
|
14
|
-
import "./chunk-CLRSETYQ.mjs";
|
|
15
|
-
import "./chunk-6UVNHT3T.mjs";
|
|
16
|
-
import "./chunk-BGV62GC2.mjs";
|
|
17
|
-
import "./chunk-K5OAFEVY.mjs";
|
|
18
|
-
import "./chunk-4DVIYZVB.mjs";
|
|
19
|
-
import "./chunk-LLGVCM7M.mjs";
|
|
20
|
-
import "./chunk-VGAX6YEY.mjs";
|
|
21
|
-
import "./chunk-N6ILV6NF.mjs";
|
|
22
|
-
import "./chunk-XYMXGU4T.mjs";
|
|
23
|
-
import "./chunk-ZFV2HGD3.mjs";
|
|
24
|
-
import "./chunk-6D6QLRYR.mjs";
|
|
25
|
-
import "./chunk-4FFTOZGJ.mjs";
|
|
26
|
-
import "./chunk-OXWTZV3U.mjs";
|
|
27
|
-
import "./chunk-R7WFRENU.mjs";
|
|
28
|
-
import "./chunk-RJQTA6HG.mjs";
|
|
29
|
-
import "./chunk-PFH63ZU4.mjs";
|
|
30
|
-
import "./chunk-CDAMHK63.mjs";
|
|
31
|
-
import "./chunk-NBE6FF6L.mjs";
|
|
32
|
-
import "./chunk-ELBTVBTS.mjs";
|
|
33
|
-
import "./chunk-5NRAXWYA.mjs";
|
|
34
|
-
import "./chunk-RAVYEEIC.mjs";
|
|
35
|
-
import "./chunk-H3P47YXJ.mjs";
|
|
36
|
-
import "./chunk-QNIY45SF.mjs";
|
|
37
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
38
|
-
import "./chunk-KNW2CGIP.mjs";
|
|
39
|
-
import "./chunk-7QRJVZQY.mjs";
|
|
40
|
-
import "./chunk-IIVB6JNE.mjs";
|
|
41
|
-
import "./chunk-JHXDLYEV.mjs";
|
|
42
|
-
import "./chunk-WYCFGRFJ.mjs";
|
|
43
|
-
export {
|
|
44
|
-
FloatingTextFormatToolbarPlugin as default
|
|
45
|
-
};
|