@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.
Files changed (146) hide show
  1. package/dist/AICommandBarPlugin-ZEC755KY.mjs +27 -0
  2. package/dist/{AIDialog-RHRYHSVN.mjs → AIDialog-HJW6PQPR.mjs} +11 -12
  3. package/dist/{AudioComponent-CKLMLB5T.mjs → AudioComponent-W5XMZPQB.mjs} +10 -6
  4. package/dist/{DynamicBlockComponent-2LOADZUX.mjs → DynamicBlockComponent-CHRL2GAQ.mjs} +7 -6
  5. package/dist/{EquationComponent-4NFG55NQ.mjs → EquationComponent-GNQHG53L.mjs} +26 -7
  6. package/dist/{ExcalidrawComponent-BMSYIPP6.mjs → ExcalidrawComponent-POMYXDSG.mjs} +33 -6
  7. package/dist/{FileComponent-Y56MX5QD.mjs → FileComponent-EOVCH4V5.mjs} +9 -5
  8. package/dist/{HintComponet-ET7M2Q7S.mjs → HintComponet-QXL5ESND.mjs} +32 -8
  9. package/dist/{InlineImageComponent-FVTA4LXZ.mjs → InlineImageComponent-KDN3VGZC.mjs} +8 -3
  10. package/dist/{StoryBuilderComponent-JN4ZPZOW.mjs → StoryBuilderComponent-CBRFPFTR.mjs} +8 -9
  11. package/dist/{chunk-6UVNHT3T.mjs → chunk-4SYRK2NH.mjs} +23 -1
  12. package/dist/chunk-5CJZC5IB.mjs +9086 -0
  13. package/dist/{chunk-FO7M3X2B.mjs → chunk-6NK5DONB.mjs} +1 -1
  14. package/dist/{chunk-N6ILV6NF.mjs → chunk-ACW4DLVO.mjs} +21 -7
  15. package/dist/chunk-BCGD2YXP.mjs +574 -0
  16. package/dist/{chunk-TC3IISJZ.mjs → chunk-BTR3TPIN.mjs} +18 -5
  17. package/dist/{chunk-ZYJ7KABY.mjs → chunk-CQCS5YPS.mjs} +3 -5
  18. package/dist/{chunk-T2UBAZ66.mjs → chunk-D4UBNSUW.mjs} +1 -1
  19. package/dist/{chunk-KNW2CGIP.mjs → chunk-DBRZIA43.mjs} +4 -1
  20. package/dist/{chunk-CDAMHK63.mjs → chunk-GJK2L7ZM.mjs} +23 -2
  21. package/dist/{chunk-ELBTVBTS.mjs → chunk-IKYVBTCJ.mjs} +43 -20
  22. package/dist/chunk-IXRA5D53.mjs +10447 -0
  23. package/dist/{chunk-W6VQSFE5.mjs → chunk-J2CEQXG4.mjs} +1 -1
  24. package/dist/{chunk-43Z4Z2KD.mjs → chunk-JTNLN4JI.mjs} +1 -1
  25. package/dist/{chunk-OE5JRLCN.mjs → chunk-ONOHG5NB.mjs} +6 -4
  26. package/dist/{chunk-QNIY45SF.mjs → chunk-OO42URWA.mjs} +27 -6
  27. package/dist/chunk-PBVRSNGU.mjs +129 -0
  28. package/dist/chunk-QCS57TIF.mjs +1794 -0
  29. package/dist/chunk-RNEIJRUS.mjs +60 -0
  30. package/dist/chunk-TJPTGECP.mjs +1556 -0
  31. package/dist/{chunk-XYMXGU4T.mjs → chunk-TMYRA2W4.mjs} +1 -1
  32. package/dist/{chunk-ZFV2HGD3.mjs → chunk-UNEFOZTS.mjs} +1 -1
  33. package/dist/chunk-X4NI7EQS.mjs +282 -0
  34. package/dist/{chunk-5D4JF3ZZ.mjs → chunk-XAJ4GACN.mjs} +171 -49
  35. package/dist/{chunk-7QRJVZQY.mjs → chunk-YVUQRJVV.mjs} +63 -18
  36. package/dist/components/editor/index.d.ts +1 -1
  37. package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +1 -0
  38. package/dist/components/editor/nodes/Hint/index.d.ts +2 -1
  39. package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +73 -1
  40. package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +25 -3
  41. package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +16 -3
  42. package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +20 -25
  43. package/dist/components/editor/plugins/MarkdownPastePlugin/index.d.ts +5 -0
  44. package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +2 -0
  45. package/dist/components/editor/plugins/SlashCommand/index.d.ts +18 -1
  46. package/dist/components/editor/plugins/SmartTypographyPlugin/index.d.ts +26 -0
  47. package/dist/components/editor/utils/aiStream.d.ts +27 -0
  48. package/dist/components/editor/utils/excalidrawDiagramBuilder.d.ts +29 -0
  49. package/dist/components/editor/utils/markdownTransformers.d.ts +4 -1
  50. package/dist/components/editor/utils/url.d.ts +16 -4
  51. package/dist/components/providers/AIContext.d.ts +8 -0
  52. package/dist/components/ui/equation/equationTypography.d.ts +23 -0
  53. package/dist/core/extension.d.ts +3 -1
  54. package/dist/core/extensions/blocks-kit.d.ts +22 -1
  55. package/dist/core/extensions/copilot-and-collab.d.ts +15 -1
  56. package/dist/core/react/NotiqContent.d.ts +4 -1
  57. package/dist/core/react/index.d.ts +1 -0
  58. package/dist/core/react/node-renderers.d.ts +73 -0
  59. package/dist/core.js +15429 -13116
  60. package/dist/core.mjs +47 -39
  61. package/dist/hooks/instructions-messages.d.ts +13 -4
  62. package/dist/{image-QPB2CVXP.mjs → image-AL6PHM2A.mjs} +17 -12
  63. package/dist/index.js +15526 -13194
  64. package/dist/index.mjs +64 -60
  65. package/dist/{insert-audio-I3PD6JFS.mjs → insert-audio-CRWR7EO5.mjs} +4 -6
  66. package/dist/{insert-file-PHR7XL4V.mjs → insert-file-I73AZW3L.mjs} +4 -6
  67. package/dist/{insert-gif-R5ZO4JHC.mjs → insert-gif-KWRC3ACT.mjs} +1 -1
  68. package/dist/{insert-image-PLBZELHK.mjs → insert-image-XIY6BGW5.mjs} +4 -3
  69. package/dist/{insert-poll-6BCIFY5G.mjs → insert-poll-J5YVZNZ4.mjs} +4 -3
  70. package/dist/{insert-table-ZRJP6X52.mjs → insert-table-OIMJRFFK.mjs} +1 -1
  71. package/dist/{poll-component-VHMM5KKZ.mjs → poll-component-TVHXIKGQ.mjs} +3 -2
  72. package/dist/react.js +14747 -12554
  73. package/dist/react.mjs +40 -38
  74. package/dist/{stepper-KNITDVLG.mjs → stepper-ILF7YXTO.mjs} +63 -73
  75. package/dist/styles/notiq.css +1 -1
  76. package/package.json +2 -2
  77. package/src/styles/notiq.css +20 -0
  78. package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +0 -12
  79. package/dist/CodeActionMenuPlugin-FGH6HZLL.mjs +0 -14
  80. package/dist/CollaborationPlugin-TIZOQBUT.mjs +0 -405
  81. package/dist/CollaboratorsBar-AMPIAUOY.mjs +0 -20
  82. package/dist/CommentsPlugin-SDJJTUGK.mjs +0 -19
  83. package/dist/ExcalidrawPlugin-QLPGJPSX.mjs +0 -14
  84. package/dist/ExportPlugin-MJHYKQZJ.mjs +0 -43
  85. package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +0 -12
  86. package/dist/FloatingTextFormatToolbarPlugin-BXCPN3KD.mjs +0 -45
  87. package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +0 -360
  88. package/dist/MobileToolbar-KV5DX4ED.mjs +0 -982
  89. package/dist/SlashCommand-SPR7G5EI.mjs +0 -39
  90. package/dist/TableCellActionMenuPlugin-YWBA64J7.mjs +0 -838
  91. package/dist/TableHoverActionsPlugin-2EIXHEXN.mjs +0 -265
  92. package/dist/TemplatePlugin-HNTPEXBB.mjs +0 -9
  93. package/dist/ToolbarPlugin-F52PVNXU.mjs +0 -823
  94. package/dist/VersionHistoryPlugin-YWGCREKA.mjs +0 -371
  95. package/dist/background-color-RW5JYLMG.mjs +0 -425
  96. package/dist/block-format-TODFREE2.mjs +0 -14
  97. package/dist/chunk-22ZIL6NH.mjs +0 -88
  98. package/dist/chunk-2LNT36RL.mjs +0 -555
  99. package/dist/chunk-37LC44W3.mjs +0 -2677
  100. package/dist/chunk-3IILA3IP.mjs +0 -28
  101. package/dist/chunk-4DVIYZVB.mjs +0 -193
  102. package/dist/chunk-4FFTOZGJ.mjs +0 -103
  103. package/dist/chunk-4UMUPCDK.mjs +0 -68
  104. package/dist/chunk-6D6QLRYR.mjs +0 -238
  105. package/dist/chunk-6FQFPPLG.mjs +0 -785
  106. package/dist/chunk-ACV47ZKE.mjs +0 -201
  107. package/dist/chunk-BGV62GC2.mjs +0 -26
  108. package/dist/chunk-C4JWLBYN.mjs +0 -132
  109. package/dist/chunk-CLRSETYQ.mjs +0 -431
  110. package/dist/chunk-D3IOUQFR.mjs +0 -441
  111. package/dist/chunk-EEBA6OAH.mjs +0 -59
  112. package/dist/chunk-EIZMKFHF.mjs +0 -32
  113. package/dist/chunk-ENH2IOHI.mjs +0 -1828
  114. package/dist/chunk-EVPWKNE4.mjs +0 -27
  115. package/dist/chunk-HOZ4QRFV.mjs +0 -536
  116. package/dist/chunk-IAFCQV3Z.mjs +0 -349
  117. package/dist/chunk-J6ZUY5BY.mjs +0 -202
  118. package/dist/chunk-K5OAFEVY.mjs +0 -191
  119. package/dist/chunk-KXRLARGI.mjs +0 -26
  120. package/dist/chunk-LBGM4VVZ.mjs +0 -409
  121. package/dist/chunk-LLGVCM7M.mjs +0 -809
  122. package/dist/chunk-LU2XWLOE.mjs +0 -219
  123. package/dist/chunk-LVRJM45C.mjs +0 -171
  124. package/dist/chunk-MSAO3YFB.mjs +0 -144
  125. package/dist/chunk-N3KDPSRI.mjs +0 -496
  126. package/dist/chunk-OXWTZV3U.mjs +0 -174
  127. package/dist/chunk-PD5K4AGP.mjs +0 -64
  128. package/dist/chunk-PFH63ZU4.mjs +0 -33
  129. package/dist/chunk-R7WFRENU.mjs +0 -262
  130. package/dist/chunk-RAVYEEIC.mjs +0 -36
  131. package/dist/chunk-RJQTA6HG.mjs +0 -358
  132. package/dist/chunk-SAOJHVPE.mjs +0 -153
  133. package/dist/chunk-SYUCM5G5.mjs +0 -111
  134. package/dist/chunk-VGAX6YEY.mjs +0 -399
  135. package/dist/chunk-VNDDDXGH.mjs +0 -682
  136. package/dist/chunk-WUVIQCX7.mjs +0 -944
  137. package/dist/chunk-XNJNT6PC.mjs +0 -1701
  138. package/dist/chunk-XYLTLGY5.mjs +0 -775
  139. package/dist/chunk-ZKZ7MLSS.mjs +0 -165
  140. package/dist/color-S55XFDYQ.mjs +0 -13
  141. package/dist/font-IJKFR4BM.mjs +0 -12
  142. package/dist/font-size-3HMJHKO2.mjs +0 -15
  143. package/dist/insert-node-DGCZBGKG.mjs +0 -243
  144. package/dist/table-dropdown-4VCRSQB6.mjs +0 -391
  145. package/dist/text-align-TEB4S52S.mjs +0 -121
  146. package/dist/text-format-T3IY7FBI.mjs +0 -15
@@ -1,358 +0,0 @@
1
- import {
2
- __spreadProps,
3
- __spreadValues,
4
- init_react_shim
5
- } from "./chunk-WYCFGRFJ.mjs";
6
-
7
- // src/components/providers/CollabContext.tsx
8
- init_react_shim();
9
- import React, {
10
- createContext,
11
- useContext,
12
- useState,
13
- useEffect,
14
- useCallback,
15
- useMemo
16
- } from "react";
17
- import { toast } from "sonner";
18
- import { Fragment, jsx } from "react/jsx-runtime";
19
- var COLLAB_SERVER_PRESETS = [
20
- { label: "Local Server (Self-Hosted: ws://localhost:4444)", url: "ws://localhost:4444" },
21
- { label: "Public Demo (Cloud: wss://demos.yjs.dev/ws)", url: "wss://demos.yjs.dev/ws" }
22
- ];
23
- var DEFAULT_SERVER_URL = "ws://localhost:4444";
24
- var FALLBACK_SERVER_URL = "wss://demos.yjs.dev/ws";
25
- var DEFAULT_DOC_ID = "notiq-collab-room";
26
- var COLLAB_COLORS = [
27
- "#2563eb",
28
- // Royal Blue
29
- "#7c3aed",
30
- // Violet
31
- "#db2777",
32
- // Pink
33
- "#ea580c",
34
- // Orange
35
- "#16a34a",
36
- // Emerald Green
37
- "#0891b2",
38
- // Cyan
39
- "#d97706",
40
- // Amber
41
- "#4f46e5",
42
- // Indigo
43
- "#e11d48",
44
- // Rose
45
- "#0d9488"
46
- // Teal
47
- ];
48
- var ANIMALS = [
49
- "Fox",
50
- "Falcon",
51
- "Otter",
52
- "Panda",
53
- "Koala",
54
- "Hawk",
55
- "Badger",
56
- "Lynx",
57
- "Tiger",
58
- "Wolf",
59
- "Dolphin",
60
- "Phoenix"
61
- ];
62
- var ADJECTIVES = [
63
- "Swift",
64
- "Bright",
65
- "Cosmic",
66
- "Clever",
67
- "Calm",
68
- "Brave",
69
- "Silent",
70
- "Vivid",
71
- "Solar",
72
- "Lunar",
73
- "Noble",
74
- "Radiant"
75
- ];
76
- function getRandomUser() {
77
- const adj = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)];
78
- const animal = ANIMALS[Math.floor(Math.random() * ANIMALS.length)];
79
- const color = COLLAB_COLORS[Math.floor(Math.random() * COLLAB_COLORS.length)];
80
- return {
81
- name: `${adj} ${animal}`,
82
- color
83
- };
84
- }
85
- var EMPTY_USERS = [];
86
- var CollabContext = createContext(null);
87
- var useCollab = () => {
88
- const context = useContext(CollabContext);
89
- if (!context) {
90
- throw new Error("useCollab must be used within a CollabProvider");
91
- }
92
- return context;
93
- };
94
- var CollabProviderInternal = ({
95
- config,
96
- children
97
- }) => {
98
- const [userProfile, setUserProfile] = useState({
99
- name: "Collaborator",
100
- color: COLLAB_COLORS[0]
101
- });
102
- const [enabled, setEnabled] = useState(() => {
103
- var _a;
104
- return (_a = config == null ? void 0 : config.enabled) != null ? _a : false;
105
- });
106
- const [docId, setDocId] = useState(() => (config == null ? void 0 : config.docId) || DEFAULT_DOC_ID);
107
- const [serverUrl, setServerUrlState] = useState(() => (config == null ? void 0 : config.serverUrl) || DEFAULT_SERVER_URL);
108
- const [status, setStatusState] = useState(
109
- () => (config == null ? void 0 : config.enabled) ? "connecting" : "offline"
110
- );
111
- const [users, setUsers] = useState([]);
112
- const [provider, setProvider] = useState(null);
113
- const [offlineStorageStatus, setOfflineStorageStatus] = useState(
114
- () => (config == null ? void 0 : config.offlinePersistence) !== false ? "loading" : "disabled"
115
- );
116
- const [isOnline, setIsOnline] = useState(
117
- () => typeof window !== "undefined" ? window.navigator.onLine : true
118
- );
119
- const [isServerSynced, setIsServerSynced] = useState(false);
120
- const [pendingUpdatesCount, setPendingUpdatesCount] = useState(0);
121
- const [lastSavedTimestamp, setLastSavedTimestamp] = useState(null);
122
- const [reconnectCountdown, setReconnectCountdown] = useState(null);
123
- useEffect(() => {
124
- if (typeof window === "undefined") return;
125
- const handleOffline = () => {
126
- setIsOnline(false);
127
- setStatusState("offline");
128
- toast.info("Network offline: Edits are being saved locally to IndexedDB.", {
129
- duration: 4e3
130
- });
131
- };
132
- const handleOnline = () => {
133
- setIsOnline(true);
134
- setStatusState("connecting");
135
- if (provider) {
136
- provider.connect();
137
- }
138
- toast.success("Network connection restored. Syncing with collaborators...", {
139
- duration: 3500
140
- });
141
- };
142
- window.addEventListener("offline", handleOffline);
143
- window.addEventListener("online", handleOnline);
144
- return () => {
145
- window.removeEventListener("offline", handleOffline);
146
- window.removeEventListener("online", handleOnline);
147
- };
148
- }, [provider]);
149
- const manualReconnect = useCallback(() => {
150
- setReconnectCountdown(null);
151
- setStatusState("connecting");
152
- if (provider) {
153
- if (!provider.shouldConnect) {
154
- provider.shouldConnect = true;
155
- }
156
- provider.connect();
157
- toast.loading("Reconnecting to collaboration server...", { duration: 1500 });
158
- }
159
- }, [provider]);
160
- const clearLocalPersistence = useCallback(async () => {
161
- try {
162
- if (typeof window !== "undefined" && "indexedDB" in window) {
163
- window.indexedDB.deleteDatabase(docId);
164
- setOfflineStorageStatus("synced");
165
- setPendingUpdatesCount(0);
166
- toast.success("Local document IndexedDB cache cleared.");
167
- }
168
- } catch (err) {
169
- console.error("[Notiq Collab] Failed to clear IndexedDB cache:", err);
170
- toast.error("Failed to clear local cache.");
171
- }
172
- }, [docId]);
173
- const hasUserSelectedServer = React.useRef(false);
174
- useEffect(() => {
175
- if (typeof window !== "undefined") {
176
- try {
177
- const saved = sessionStorage.getItem("notiq_collab_profile");
178
- if (saved) {
179
- const parsed = JSON.parse(saved);
180
- if (parsed.name && parsed.color) {
181
- setUserProfile(parsed);
182
- return;
183
- }
184
- }
185
- } catch (e) {
186
- }
187
- setUserProfile(getRandomUser());
188
- }
189
- }, []);
190
- useEffect(() => {
191
- if (typeof window !== "undefined" && !(config == null ? void 0 : config.serverUrl)) {
192
- try {
193
- const saved = localStorage.getItem("notiq_collab_server_url");
194
- if (saved) setServerUrlState(saved);
195
- } catch (e) {
196
- }
197
- }
198
- }, [config == null ? void 0 : config.serverUrl]);
199
- const setServerUrl = useCallback((url) => {
200
- const cleanUrl = url.trim();
201
- if (!cleanUrl) return;
202
- hasUserSelectedServer.current = true;
203
- setServerUrlState(cleanUrl);
204
- if (typeof window !== "undefined") {
205
- try {
206
- localStorage.setItem("notiq_collab_server_url", cleanUrl);
207
- } catch (e) {
208
- }
209
- }
210
- }, []);
211
- const offlinePersistence = (config == null ? void 0 : config.offlinePersistence) !== false;
212
- const setStatus = useCallback((action) => {
213
- setStatusState((prev) => {
214
- const next = typeof action === "function" ? action(prev) : action;
215
- return next === prev ? prev : next;
216
- });
217
- }, []);
218
- useEffect(() => {
219
- if ((config == null ? void 0 : config.enabled) !== void 0) {
220
- setEnabled(config.enabled);
221
- setStatusState((prev) => {
222
- if (config.enabled) {
223
- return prev === "offline" || prev === "disconnected" ? "connecting" : prev;
224
- }
225
- return "offline";
226
- });
227
- }
228
- if (config == null ? void 0 : config.docId) {
229
- setDocId(config.docId);
230
- }
231
- if ((config == null ? void 0 : config.serverUrl) && !hasUserSelectedServer.current) {
232
- setServerUrlState(config.serverUrl);
233
- }
234
- }, [config == null ? void 0 : config.enabled, config == null ? void 0 : config.docId, config == null ? void 0 : config.serverUrl]);
235
- const username = (config == null ? void 0 : config.username) || userProfile.name;
236
- const cursorColor = (config == null ? void 0 : config.cursorColor) || userProfile.color;
237
- const avatar = (config == null ? void 0 : config.avatar) || userProfile.avatar;
238
- const updateUser = useCallback(
239
- (name, color, newAvatar) => {
240
- var _a;
241
- const updated = {
242
- name: name.trim() || userProfile.name,
243
- color: color || userProfile.color,
244
- avatar: newAvatar !== void 0 ? newAvatar : userProfile.avatar
245
- };
246
- setUserProfile(updated);
247
- if (typeof window !== "undefined") {
248
- try {
249
- sessionStorage.setItem("notiq_collab_profile", JSON.stringify(updated));
250
- } catch (e) {
251
- }
252
- }
253
- if (provider == null ? void 0 : provider.awareness) {
254
- provider.awareness.setLocalStateField("name", updated.name);
255
- if (updated.color) {
256
- provider.awareness.setLocalStateField("color", updated.color);
257
- }
258
- if (updated.avatar !== void 0) {
259
- provider.awareness.setLocalStateField("avatar", updated.avatar);
260
- }
261
- const currentData = ((_a = provider.awareness.getLocalState()) == null ? void 0 : _a.awarenessData) || {};
262
- provider.awareness.setLocalStateField("awarenessData", __spreadProps(__spreadValues({}, currentData), {
263
- name: updated.name,
264
- color: updated.color,
265
- avatar: updated.avatar
266
- }));
267
- }
268
- },
269
- [provider, userProfile]
270
- );
271
- const toggleEnabled = useCallback(() => {
272
- setEnabled((prev) => {
273
- const next = !prev;
274
- setStatusState(next ? "connecting" : "offline");
275
- return next;
276
- });
277
- }, []);
278
- const value = useMemo(
279
- () => ({
280
- enabled,
281
- setEnabled,
282
- toggleEnabled,
283
- status: enabled ? status : "offline",
284
- setStatus,
285
- users: enabled ? users : EMPTY_USERS,
286
- setUsers,
287
- docId,
288
- setDocId,
289
- serverUrl,
290
- setServerUrl,
291
- username,
292
- cursorColor,
293
- avatar: config == null ? void 0 : config.avatar,
294
- offlinePersistence,
295
- offlineStorageStatus,
296
- setOfflineStorageStatus,
297
- isOnline,
298
- isServerSynced,
299
- setIsServerSynced,
300
- pendingUpdatesCount,
301
- setPendingUpdatesCount,
302
- lastSavedTimestamp,
303
- setLastSavedTimestamp,
304
- reconnectCountdown,
305
- setReconnectCountdown,
306
- manualReconnect,
307
- clearLocalPersistence,
308
- updateUser,
309
- provider,
310
- setProvider
311
- }),
312
- [
313
- enabled,
314
- toggleEnabled,
315
- status,
316
- setStatus,
317
- users,
318
- docId,
319
- serverUrl,
320
- setServerUrl,
321
- username,
322
- cursorColor,
323
- config == null ? void 0 : config.avatar,
324
- offlinePersistence,
325
- offlineStorageStatus,
326
- isOnline,
327
- isServerSynced,
328
- pendingUpdatesCount,
329
- lastSavedTimestamp,
330
- reconnectCountdown,
331
- manualReconnect,
332
- clearLocalPersistence,
333
- updateUser,
334
- provider
335
- ]
336
- );
337
- return /* @__PURE__ */ jsx(CollabContext.Provider, { value, children });
338
- };
339
- var CollabProvider = ({
340
- config,
341
- children
342
- }) => {
343
- const existing = useContext(CollabContext);
344
- if (existing) {
345
- return /* @__PURE__ */ jsx(Fragment, { children });
346
- }
347
- return /* @__PURE__ */ jsx(CollabProviderInternal, { config, children });
348
- };
349
-
350
- export {
351
- COLLAB_SERVER_PRESETS,
352
- DEFAULT_SERVER_URL,
353
- FALLBACK_SERVER_URL,
354
- DEFAULT_DOC_ID,
355
- COLLAB_COLORS,
356
- useCollab,
357
- CollabProvider
358
- };
@@ -1,153 +0,0 @@
1
- import {
2
- DropDown
3
- } from "./chunk-LU2XWLOE.mjs";
4
- import {
5
- __spreadProps,
6
- __spreadValues,
7
- init_react_shim
8
- } from "./chunk-WYCFGRFJ.mjs";
9
-
10
- // src/components/ui/drop-downs/font.tsx
11
- init_react_shim();
12
- import { $getSelection } from "lexical";
13
- import { useCallback } from "react";
14
- import { $patchStyleText } from "@lexical/selection";
15
- import { jsx } from "react/jsx-runtime";
16
- function Font({
17
- editor,
18
- style,
19
- disabled,
20
- value,
21
- sideOffset,
22
- side,
23
- ShowChevronsUpDown
24
- }) {
25
- const applyFont = useCallback(
26
- (font) => {
27
- editor.update(() => {
28
- const selection = $getSelection();
29
- if (selection !== null) {
30
- $patchStyleText(selection, {
31
- ["font-family"]: font
32
- });
33
- }
34
- });
35
- },
36
- [editor, style]
37
- );
38
- const FONT_FAMILY_OPTIONS = [
39
- {
40
- label: "Arial",
41
- func: () => applyFont("Arial"),
42
- style: { fontFamily: "Arial" }
43
- },
44
- {
45
- label: "Courier New",
46
- func: () => applyFont("Courier New"),
47
- style: { fontFamily: "Courier New" }
48
- },
49
- {
50
- label: "Georgia",
51
- func: () => applyFont("Georgia"),
52
- style: { fontFamily: "Georgia" }
53
- },
54
- {
55
- label: "Times New Roman",
56
- func: () => applyFont("Times New Roman"),
57
- style: { fontFamily: "Times New Roman" }
58
- },
59
- {
60
- label: "Trebuchet MS",
61
- func: () => applyFont("Trebuchet MS"),
62
- style: { fontFamily: "Trebuchet MS" }
63
- },
64
- {
65
- label: "Verdana",
66
- func: () => applyFont("Verdana"),
67
- style: { fontFamily: "Verdana" }
68
- },
69
- {
70
- label: "Comic Sans MS",
71
- func: () => applyFont("Comic Sans MS"),
72
- style: { fontFamily: "Comic Sans MS" }
73
- },
74
- {
75
- label: "Calibri",
76
- func: () => applyFont("Calibri"),
77
- style: { fontFamily: "Calibri" }
78
- },
79
- {
80
- label: "Poppins",
81
- func: () => applyFont("Poppins"),
82
- style: { fontFamily: "Poppins" }
83
- },
84
- {
85
- label: "Alegreya",
86
- func: () => applyFont("Alegreya"),
87
- style: { fontFamily: "Alegreya" }
88
- },
89
- {
90
- label: "Bree Serif",
91
- func: () => applyFont("Bree Serif"),
92
- style: { fontFamily: "Bree Serif" }
93
- },
94
- {
95
- label: "Cambria",
96
- func: () => applyFont("Cambria"),
97
- style: { fontFamily: "Cambria" }
98
- },
99
- {
100
- label: "Impact",
101
- func: () => applyFont("Impact"),
102
- style: { fontFamily: "Impact" }
103
- },
104
- {
105
- label: "Lexend",
106
- func: () => applyFont("Lexend"),
107
- style: { fontFamily: "Lexend" }
108
- },
109
- {
110
- label: "Lobster",
111
- func: () => applyFont("Lobster"),
112
- style: { fontFamily: "Lobster" }
113
- },
114
- {
115
- label: "Lora",
116
- func: () => applyFont("Lora"),
117
- style: { fontFamily: "Lora" }
118
- },
119
- {
120
- label: "Permanent Marker",
121
- func: () => applyFont("Permanent Marker"),
122
- style: { fontFamily: "Permanent Marker" }
123
- },
124
- {
125
- label: "Ultra",
126
- func: () => applyFont("Ultra"),
127
- style: { fontFamily: "Ultra" }
128
- },
129
- {
130
- label: "Reenie Beanie",
131
- func: () => applyFont("Reenie Beanie"),
132
- style: { fontFamily: "Reenie Beanie" }
133
- }
134
- ];
135
- return /* @__PURE__ */ jsx(
136
- DropDown,
137
- {
138
- ShowChevronsUpDown,
139
- side,
140
- sideOffset,
141
- className: "h-7 min-w-fit w-full px-2 border-none cursor-pointer hover:bg-zinc-100 hover:text-zinc-900",
142
- PopoverContentClassName: { minWidth: "80px", width: "150px" },
143
- TriggerClassName: __spreadProps(__spreadValues({}, style), { width: "100%" }),
144
- disabled,
145
- TriggerLabel: value,
146
- values: FONT_FAMILY_OPTIONS
147
- }
148
- );
149
- }
150
-
151
- export {
152
- Font
153
- };
@@ -1,111 +0,0 @@
1
- import {
2
- DropDown
3
- } from "./chunk-LU2XWLOE.mjs";
4
- import {
5
- SHORTCUTS
6
- } from "./chunk-K5OAFEVY.mjs";
7
- import {
8
- clearFormatting
9
- } from "./chunk-6D6QLRYR.mjs";
10
- import {
11
- __spreadProps,
12
- __spreadValues,
13
- init_react_shim
14
- } from "./chunk-WYCFGRFJ.mjs";
15
-
16
- // src/components/ui/drop-downs/text-format.tsx
17
- init_react_shim();
18
- import { FORMAT_TEXT_COMMAND } from "lexical";
19
- import {
20
- CaseSensitive,
21
- CaseUpper,
22
- HighlighterIcon,
23
- LucideRemoveFormatting,
24
- Strikethrough,
25
- Subscript,
26
- Superscript,
27
- Trash
28
- } from "lucide-react";
29
- import { useMemo } from "react";
30
- import { jsx } from "react/jsx-runtime";
31
- function TextFormat({
32
- disabled = false,
33
- editor,
34
- toolbarState,
35
- style,
36
- ShowChevronsUpDown,
37
- side,
38
- sideOffset
39
- }) {
40
- const items = useMemo(
41
- () => [
42
- {
43
- label: "Lowercase",
44
- icon: /* @__PURE__ */ jsx(CaseSensitive, { className: "w-4 h-4" }),
45
- func: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "lowercase"),
46
- shortcuts: SHORTCUTS.LOWERCASE,
47
- selected: toolbarState.isLowercase
48
- },
49
- {
50
- label: "Uppercase",
51
- icon: /* @__PURE__ */ jsx(CaseUpper, { className: "w-4 h-4" }),
52
- func: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "uppercase"),
53
- shortcuts: SHORTCUTS.UPPERCASE,
54
- selected: toolbarState.isUppercase
55
- },
56
- {
57
- label: "Strikethrough",
58
- icon: /* @__PURE__ */ jsx(Strikethrough, { className: "w-4 h-4" }),
59
- func: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough"),
60
- shortcuts: SHORTCUTS.STRIKETHROUGH,
61
- selected: toolbarState.isStrikethrough
62
- },
63
- {
64
- label: "Subscript",
65
- icon: /* @__PURE__ */ jsx(Subscript, { className: "w-4 h-4" }),
66
- func: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "subscript"),
67
- shortcuts: SHORTCUTS.SUBSCRIPT,
68
- selected: toolbarState.isSubscript
69
- },
70
- {
71
- label: "Superscript",
72
- icon: /* @__PURE__ */ jsx(Superscript, { className: "w-4 h-4" }),
73
- func: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "superscript"),
74
- shortcuts: SHORTCUTS.SUPERSCRIPT,
75
- selected: toolbarState.isSuperscript
76
- },
77
- {
78
- label: "Highlight",
79
- icon: /* @__PURE__ */ jsx(HighlighterIcon, { className: "w-4 h-4" }),
80
- func: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "highlight"),
81
- selected: toolbarState.isHighlight
82
- },
83
- {
84
- label: "Clear Formatting",
85
- icon: /* @__PURE__ */ jsx(Trash, { className: "w-4 h-4" }),
86
- func: () => clearFormatting(editor),
87
- shortcuts: SHORTCUTS.CLEAR_FORMATTING,
88
- selected: false
89
- }
90
- ],
91
- [editor, toolbarState]
92
- );
93
- return /* @__PURE__ */ jsx(
94
- DropDown,
95
- {
96
- PopoverContentClassName: { width: "100%" },
97
- TriggerClassName: __spreadProps(__spreadValues({}, style), { width: "100%", border: "none" }),
98
- disabled,
99
- sideOffset,
100
- side,
101
- className: "cursor-pointer",
102
- ShowChevronsUpDown,
103
- TriggerLabel: /* @__PURE__ */ jsx(LucideRemoveFormatting, {}),
104
- values: items
105
- }
106
- );
107
- }
108
-
109
- export {
110
- TextFormat
111
- };