@liveblocks/react 2.9.3-experimental1 → 2.10.1-react19

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.
@@ -0,0 +1,726 @@
1
+ import { U as UseStorageStatusOptions, a as CommentsError, b as CreateCommentOptions, E as EditCommentOptions, D as DeleteCommentOptions, c as CommentReactionOptions, T as ThreadSubscription, H as HistoryVersionDataAsyncResult, S as StorageStatusSuccess, A as AttachmentUrlAsyncResult, R as RoomContextBundle } from './liveblocks-SAVcXwMX.js';
2
+ import { Status, StorageStatus, LostConnectionEvent, History, BaseMetadata, CommentData, RoomNotificationSettings, JsonObject, LsonObject, BaseUserMeta, Json, User } from '@liveblocks/client';
3
+ import * as React from 'react';
4
+ import { ReactNode } from 'react';
5
+ import { OpaqueRoom, LiveblocksError, DP, DS, DU, DE, DM, OpaqueClient } from '@liveblocks/core';
6
+
7
+ declare type Props = {
8
+ fallback: ReactNode;
9
+ children: (() => ReactNode | undefined) | ReactNode | undefined;
10
+ };
11
+ /**
12
+ * Almost like a normal <Suspense> component, except that for server-side
13
+ * renders, the fallback will be used.
14
+ *
15
+ * The child props will have to be provided in a function, i.e. change:
16
+ *
17
+ * <Suspense fallback={<Loading />}>
18
+ * <MyRealComponent a={1} />
19
+ * </Suspense>
20
+ *
21
+ * To:
22
+ *
23
+ * <ClientSideSuspense fallback={<Loading />}>
24
+ * <MyRealComponent a={1} />
25
+ * </ClientSideSuspense>
26
+ *
27
+ */
28
+ declare function ClientSideSuspense(props: Props): React.JSX.Element;
29
+
30
+ /**
31
+ * Raw access to the React context where the RoomProvider stores the current
32
+ * room. Exposed for advanced use cases only.
33
+ *
34
+ * @private This is a private/advanced API. Do not rely on it.
35
+ */
36
+ declare const RoomContext: React.Context<OpaqueRoom | null>;
37
+
38
+ /**
39
+ * Returns the current connection status for the Room, and triggers
40
+ * a re-render whenever it changes. Can be used to render a status badge.
41
+ */
42
+ declare function useStatus(): Status;
43
+ /**
44
+ * Returns the current storage status for the Room, and triggers
45
+ * a re-render whenever it changes. Can be used to render a "Saving..."
46
+ * indicator.
47
+ */
48
+ declare function useStorageStatus(options?: UseStorageStatusOptions): StorageStatus;
49
+ /**
50
+ * @deprecated It's recommended to use `useMutation` for writing to Storage,
51
+ * which will automatically batch all mutations.
52
+ *
53
+ * Returns a function that batches modifications made during the given function.
54
+ * All the modifications are sent to other clients in a single message.
55
+ * All the modifications are merged in a single history item (undo/redo).
56
+ * All the subscribers are called only after the batch is over.
57
+ */
58
+ declare function useBatch<T>(): (callback: () => T) => T;
59
+ /**
60
+ * Get informed when reconnecting to the Liveblocks servers is taking
61
+ * longer than usual. This typically is a sign of a client that has lost
62
+ * internet connectivity.
63
+ *
64
+ * This isn't problematic (because the Liveblocks client is still trying to
65
+ * reconnect), but it's typically a good idea to inform users about it if
66
+ * the connection takes too long to recover.
67
+ *
68
+ * @example
69
+ * useLostConnectionListener(event => {
70
+ * if (event === 'lost') {
71
+ * toast.warn('Reconnecting to the Liveblocks servers is taking longer than usual...')
72
+ * } else if (event === 'failed') {
73
+ * toast.warn('Reconnecting to the Liveblocks servers failed.')
74
+ * } else if (event === 'restored') {
75
+ * toast.clear();
76
+ * }
77
+ * })
78
+ */
79
+ declare function useLostConnectionListener(callback: (event: LostConnectionEvent) => void): void;
80
+ /**
81
+ * useErrorListener is a React hook that allows you to respond to potential room
82
+ * connection errors.
83
+ *
84
+ * @example
85
+ * useErrorListener(er => {
86
+ * console.error(er);
87
+ * })
88
+ */
89
+ declare function useErrorListener(callback: (err: LiveblocksError) => void): void;
90
+ /**
91
+ * Returns the room.history
92
+ */
93
+ declare function useHistory(): History;
94
+ /**
95
+ * Returns a function that undoes the last operation executed by the current
96
+ * client. It does not impact operations made by other clients.
97
+ */
98
+ declare function useUndo(): () => void;
99
+ /**
100
+ * Returns a function that redoes the last operation executed by the current
101
+ * client. It does not impact operations made by other clients.
102
+ */
103
+ declare function useRedo(): () => void;
104
+ /**
105
+ * Returns whether there are any operations to undo.
106
+ */
107
+ declare function useCanUndo(): boolean;
108
+ /**
109
+ * Returns whether there are any operations to redo.
110
+ */
111
+ declare function useCanRedo(): boolean;
112
+ /**
113
+ * Returns an array of connection IDs. This matches the values you'll get by
114
+ * using the `useOthers()` hook.
115
+ *
116
+ * Roughly equivalent to:
117
+ * useOthers((others) => others.map(other => other.connectionId), shallow)
118
+ *
119
+ * This is useful in particular to implement efficiently rendering components
120
+ * for each user in the room, e.g. cursors.
121
+ *
122
+ * @example
123
+ * const ids = useOthersConnectionIds();
124
+ * // [2, 4, 7]
125
+ */
126
+ declare function useOthersConnectionIds(): readonly number[];
127
+ /**
128
+ * @private Internal API, do not rely on it.
129
+ */
130
+ declare function useCommentsErrorListener<M extends BaseMetadata>(callback: (error: CommentsError<M>) => void): void;
131
+ /**
132
+ * Returns a function that adds a comment to a thread.
133
+ *
134
+ * @example
135
+ * const createComment = useCreateComment();
136
+ * createComment({ threadId: "th_xxx", body: {} });
137
+ */
138
+ declare function useCreateComment(): (options: CreateCommentOptions) => CommentData;
139
+ /**
140
+ * Returns a function that edits a comment's body.
141
+ *
142
+ * @example
143
+ * const editComment = useEditComment()
144
+ * editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
145
+ */
146
+ declare function useEditComment(): (options: EditCommentOptions) => void;
147
+ /**
148
+ * Returns a function that deletes a comment.
149
+ * If it is the last non-deleted comment, the thread also gets deleted.
150
+ *
151
+ * @example
152
+ * const deleteComment = useDeleteComment();
153
+ * deleteComment({ threadId: "th_xxx", commentId: "cm_xxx" })
154
+ */
155
+ declare function useDeleteComment(): ({ threadId, commentId }: DeleteCommentOptions) => void;
156
+ /**
157
+ * Returns a function that removes a reaction on a comment.
158
+ *
159
+ * @example
160
+ * const removeReaction = useRemoveReaction();
161
+ * removeReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
162
+ */
163
+ declare function useRemoveReaction(): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
164
+ /**
165
+ * Returns a function that marks a thread as read.
166
+ *
167
+ * @example
168
+ * const markThreadAsRead = useMarkThreadAsRead();
169
+ * markThreadAsRead("th_xxx");
170
+ */
171
+ declare function useMarkThreadAsRead(): (threadId: string) => void;
172
+ /**
173
+ * Returns a function that marks a thread as resolved.
174
+ *
175
+ * @example
176
+ * const markThreadAsResolved = useMarkThreadAsResolved();
177
+ * markThreadAsResolved("th_xxx");
178
+ */
179
+ declare function useMarkThreadAsResolved(): (threadId: string) => void;
180
+ /**
181
+ * Returns a function that marks a thread as unresolved.
182
+ *
183
+ * @example
184
+ * const markThreadAsUnresolved = useMarkThreadAsUnresolved();
185
+ * markThreadAsUnresolved("th_xxx");
186
+ */
187
+ declare function useMarkThreadAsUnresolved(): (threadId: string) => void;
188
+ /**
189
+ * Returns the subscription status of a thread.
190
+ *
191
+ * @example
192
+ * const { status, unreadSince } = useThreadSubscription("th_xxx");
193
+ */
194
+ declare function useThreadSubscription(threadId: string): ThreadSubscription;
195
+ /**
196
+ * Returns the version data bianry for a given version
197
+ *
198
+ * @example
199
+ * const {data} = useHistoryVersionData(versionId);
200
+ */
201
+ declare function useHistoryVersionData(versionId: string): HistoryVersionDataAsyncResult;
202
+ /**
203
+ * Returns a function that updates the user's notification settings
204
+ * for the current room.
205
+ *
206
+ * @example
207
+ * const updateRoomNotificationSettings = useUpdateRoomNotificationSettings();
208
+ * updateRoomNotificationSettings({ threads: "all" });
209
+ */
210
+ declare function useUpdateRoomNotificationSettings(): (settings: Partial<RoomNotificationSettings>) => void;
211
+ /**
212
+ * Returns an array of connection IDs. This matches the values you'll get by
213
+ * using the `useOthers()` hook.
214
+ *
215
+ * Roughly equivalent to:
216
+ * useOthers((others) => others.map(other => other.connectionId), shallow)
217
+ *
218
+ * This is useful in particular to implement efficiently rendering components
219
+ * for each user in the room, e.g. cursors.
220
+ *
221
+ * @example
222
+ * const ids = useOthersConnectionIds();
223
+ * // [2, 4, 7]
224
+ */
225
+ declare function useOthersConnectionIdsSuspense(): readonly number[];
226
+ /**
227
+ * Returns the current storage status for the Room, and triggers
228
+ * a re-render whenever it changes. Can be used to render a "Saving..."
229
+ * indicator.
230
+ */
231
+ declare function useStorageStatusSuspense(options?: UseStorageStatusOptions): StorageStatusSuccess;
232
+ /**
233
+ * Returns a presigned URL for an attachment by its ID.
234
+ *
235
+ * @example
236
+ * const { url, error, isLoading } = useAttachmentUrl("at_xxx");
237
+ */
238
+ declare function useAttachmentUrl(attachmentId: string): AttachmentUrlAsyncResult;
239
+ /**
240
+ * Returns a presigned URL for an attachment by its ID.
241
+ *
242
+ * @example
243
+ * const { url } = useAttachmentUrl("at_xxx");
244
+ */
245
+ declare function useAttachmentUrlSuspense(attachmentId: string): {
246
+ readonly isLoading: false;
247
+ readonly url: string;
248
+ readonly error: undefined;
249
+ };
250
+ /**
251
+ * Creates a RoomProvider and a set of typed hooks to use in your app. Note
252
+ * that any RoomProvider created in this way does not need to be nested in
253
+ * LiveblocksProvider, as it already has access to the client.
254
+ */
255
+ declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata = DM>(client: OpaqueClient): RoomContextBundle<P, S, U, E, M>;
256
+ declare type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DM>;
257
+ /**
258
+ * Makes a Room available in the component hierarchy below.
259
+ * Joins the room when the component is mounted, and automatically leaves
260
+ * the room when the component is unmounted.
261
+ */
262
+ declare const _RoomProvider: TypedBundle["RoomProvider"];
263
+ /**
264
+ * Returns a callback that lets you broadcast custom events to other users in the room
265
+ *
266
+ * @example
267
+ * const broadcast = useBroadcastEvent();
268
+ *
269
+ * broadcast({ type: "CUSTOM_EVENT", data: { x: 0, y: 0 } });
270
+ */
271
+ declare const _useBroadcastEvent: TypedBundle["useBroadcastEvent"];
272
+ /**
273
+ * Get informed when users enter or leave the room, as an event.
274
+ *
275
+ * @example
276
+ * useOthersListener({ type, user, others }) => {
277
+ * if (type === 'enter') {
278
+ * // `user` has joined the room
279
+ * } else if (type === 'leave') {
280
+ * // `user` has left the room
281
+ * }
282
+ * })
283
+ */
284
+ declare const _useOthersListener: TypedBundle["useOthersListener"];
285
+ /**
286
+ * Returns the Room of the nearest RoomProvider above in the React component
287
+ * tree.
288
+ */
289
+ declare const _useRoom: TypedBundle["useRoom"];
290
+ /**
291
+ * Returns whether the hook is called within a RoomProvider context.
292
+ *
293
+ * @example
294
+ * const isInsideRoom = useIsInsideRoom();
295
+ */
296
+ declare const _useIsInsideRoom: TypedBundle["useIsInsideRoom"];
297
+ /**
298
+ * Returns a function that adds a reaction from a comment.
299
+ *
300
+ * @example
301
+ * const addReaction = useAddReaction();
302
+ * addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
303
+ */
304
+ declare const _useAddReaction: TypedBundle["useAddReaction"];
305
+ /**
306
+ * Create a callback function that lets you mutate Liveblocks state.
307
+ *
308
+ * The first argument that gets passed into your callback will be
309
+ * a "mutation context", which exposes the following:
310
+ *
311
+ * - `storage` - The mutable Storage root.
312
+ * You can mutate any Live structures with this, for example:
313
+ * `storage.get('layers').get('layer1').set('fill', 'red')`
314
+ *
315
+ * - `setMyPresence` - Call this with a new (partial) Presence value.
316
+ *
317
+ * - `self` - A read-only version of the latest self, if you need it to
318
+ * compute the next state.
319
+ *
320
+ * - `others` - A read-only version of the latest others list, if you
321
+ * need it to compute the next state.
322
+ *
323
+ * useMutation is like React's useCallback, except that the first argument
324
+ * that gets passed into your callback will be a "mutation context".
325
+ *
326
+ * If you want get access to the immutable root somewhere in your mutation,
327
+ * you can use `storage.ToImmutable()`.
328
+ *
329
+ * @example
330
+ * const fillLayers = useMutation(
331
+ * ({ storage }, color: Color) => {
332
+ * ...
333
+ * },
334
+ * [],
335
+ * );
336
+ *
337
+ * fillLayers('red');
338
+ *
339
+ * const deleteLayers = useMutation(
340
+ * ({ storage }) => {
341
+ * ...
342
+ * },
343
+ * [],
344
+ * );
345
+ *
346
+ * deleteLayers();
347
+ */
348
+ declare const _useMutation: TypedBundle["useMutation"];
349
+ /**
350
+ * Returns a function that creates a thread with an initial comment, and optionally some metadata.
351
+ *
352
+ * @example
353
+ * const createThread = useCreateThread();
354
+ * createThread({ body: {}, metadata: {} });
355
+ */
356
+ declare const _useCreateThread: TypedBundle["useCreateThread"];
357
+ /**
358
+ * Returns a function that deletes a thread and its associated comments.
359
+ * Only the thread creator can delete a thread, it will throw otherwise.
360
+ *
361
+ * @example
362
+ * const deleteThread = useDeleteThread();
363
+ * deleteThread("th_xxx");
364
+ */
365
+ declare const _useDeleteThread: TypedBundle["useDeleteThread"];
366
+ /**
367
+ * Returns a function that edits a thread's metadata.
368
+ * To delete an existing metadata property, set its value to `null`.
369
+ *
370
+ * @example
371
+ * const editThreadMetadata = useEditThreadMetadata();
372
+ * editThreadMetadata({ threadId: "th_xxx", metadata: {} })
373
+ */
374
+ declare const _useEditThreadMetadata: TypedBundle["useEditThreadMetadata"];
375
+ /**
376
+ * useEventListener is a React hook that allows you to respond to events broadcast
377
+ * by other users in the room.
378
+ *
379
+ * The `user` argument will indicate which `User` instance sent the message.
380
+ * This will be equal to one of the others in the room, but it can be `null`
381
+ * in case this event was broadcasted from the server.
382
+ *
383
+ * @example
384
+ * useEventListener(({ event, user, connectionId }) => {
385
+ * // ^^^^ Will be Client A
386
+ * if (event.type === "CUSTOM_EVENT") {
387
+ * // Do something
388
+ * }
389
+ * });
390
+ */
391
+ declare const _useEventListener: TypedBundle["useEventListener"];
392
+ /**
393
+ * Returns the presence of the current user of the current room, and a function to update it.
394
+ * It is different from the setState function returned by the useState hook from React.
395
+ * You don't need to pass the full presence object to update it.
396
+ *
397
+ * @example
398
+ * const [myPresence, updateMyPresence] = useMyPresence();
399
+ * updateMyPresence({ x: 0 });
400
+ * updateMyPresence({ y: 0 });
401
+ *
402
+ * // At the next render, "myPresence" will be equal to "{ x: 0, y: 0 }"
403
+ */
404
+ declare const _useMyPresence: TypedBundle["useMyPresence"];
405
+ /**
406
+ * Related to useOthers(), but optimized for selecting only "subsets" of
407
+ * others. This is useful for performance reasons in particular, because
408
+ * selecting only a subset of users also means limiting the number of
409
+ * re-renders that will be triggered.
410
+ *
411
+ * @example
412
+ * const avatars = useOthersMapped(user => user.info.avatar);
413
+ * // ^^^^^^^
414
+ * // { connectionId: number; data: string }[]
415
+ *
416
+ * The selector function you pass to useOthersMapped() is called an "item
417
+ * selector", and operates on a single user at a time. If you provide an
418
+ * (optional) "item comparison" function, it will be used to compare each
419
+ * item pairwise.
420
+ *
421
+ * For example, to select multiple properties:
422
+ *
423
+ * @example
424
+ * const avatarsAndCursors = useOthersMapped(
425
+ * user => [u.info.avatar, u.presence.cursor],
426
+ * shallow, // 👈
427
+ * );
428
+ */
429
+ declare const _useOthersMapped: TypedBundle["useOthersMapped"];
430
+ /**
431
+ * Related to useOthers(), but optimized for selecting only "subsets" of
432
+ * others. This is useful for performance reasons in particular, because
433
+ * selecting only a subset of users also means limiting the number of
434
+ * re-renders that will be triggered.
435
+ *
436
+ * @example
437
+ * const avatars = useOthersMapped(user => user.info.avatar);
438
+ * // ^^^^^^^
439
+ * // { connectionId: number; data: string }[]
440
+ *
441
+ * The selector function you pass to useOthersMapped() is called an "item
442
+ * selector", and operates on a single user at a time. If you provide an
443
+ * (optional) "item comparison" function, it will be used to compare each
444
+ * item pairwise.
445
+ *
446
+ * For example, to select multiple properties:
447
+ *
448
+ * @example
449
+ * const avatarsAndCursors = useOthersMapped(
450
+ * user => [u.info.avatar, u.presence.cursor],
451
+ * shallow, // 👈
452
+ * );
453
+ */
454
+ declare const _useOthersMappedSuspense: TypedBundle["suspense"]["useOthersMapped"];
455
+ /**
456
+ * Returns the threads within the current room.
457
+ *
458
+ * @example
459
+ * const { threads, error, isLoading } = useThreads();
460
+ */
461
+ declare const _useThreads: TypedBundle["useThreads"];
462
+ /**
463
+ * Returns the threads within the current room.
464
+ *
465
+ * @example
466
+ * const { threads } = useThreads();
467
+ */
468
+ declare const _useThreadsSuspense: TypedBundle["suspense"]["useThreads"];
469
+ /**
470
+ * Returns the user's notification settings for the current room
471
+ * and a function to update them.
472
+ *
473
+ * @example
474
+ * const [{ settings }, updateSettings] = useRoomNotificationSettings();
475
+ */
476
+ declare const _useRoomNotificationSettings: TypedBundle["useRoomNotificationSettings"];
477
+ /**
478
+ * Returns the user's notification settings for the current room
479
+ * and a function to update them.
480
+ *
481
+ * @example
482
+ * const [{ settings }, updateSettings] = useRoomNotificationSettings();
483
+ */
484
+ declare const _useRoomNotificationSettingsSuspense: TypedBundle["suspense"]["useRoomNotificationSettings"];
485
+ /**
486
+ * (Private beta) Returns a history of versions of the current room.
487
+ *
488
+ * @example
489
+ * const { versions, error, isLoading } = useHistoryVersions();
490
+ */
491
+ declare const _useHistoryVersions: TypedBundle["useHistoryVersions"];
492
+ /**
493
+ * (Private beta) Returns a history of versions of the current room.
494
+ *
495
+ * @example
496
+ * const { versions } = useHistoryVersions();
497
+ */
498
+ declare const _useHistoryVersionsSuspense: TypedBundle["suspense"]["useHistoryVersions"];
499
+ /**
500
+ * Given a connection ID (as obtained by using `useOthersConnectionIds`), you
501
+ * can call this selector deep down in your component stack to only have the
502
+ * component re-render if properties for this particular user change.
503
+ *
504
+ * @example
505
+ * // Returns only the selected values re-renders whenever that selection changes)
506
+ * const { x, y } = useOther(2, user => user.presence.cursor);
507
+ */
508
+ declare const _useOther: TypedBundle["useOther"];
509
+ /**
510
+ * Returns an array with information about all the users currently connected in
511
+ * the room (except yourself).
512
+ *
513
+ * @example
514
+ * const others = useOthers();
515
+ *
516
+ * // Example to map all cursors in JSX
517
+ * return (
518
+ * <>
519
+ * {others.map((user) => {
520
+ * if (user.presence.cursor == null) {
521
+ * return null;
522
+ * }
523
+ * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
524
+ * })}
525
+ * </>
526
+ * )
527
+ */
528
+ declare function _useOthers(): readonly User<DP, DU>[];
529
+ /**
530
+ * Extract arbitrary data based on all the users currently connected in the
531
+ * room (except yourself).
532
+ *
533
+ * The selector function will get re-evaluated any time a user enters or
534
+ * leaves the room, as well as whenever their presence data changes.
535
+ *
536
+ * The component that uses this hook will automatically re-render if your
537
+ * selector function returns a different value from its previous run.
538
+ *
539
+ * By default `useOthers()` uses strict `===` to check for equality. Take
540
+ * extra care when returning a computed object or list, for example when you
541
+ * return the result of a .map() or .filter() call from the selector. In
542
+ * those cases, you'll probably want to use a `shallow` comparison check.
543
+ *
544
+ * @example
545
+ * const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
546
+ * const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
547
+ * const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
548
+ *
549
+ */
550
+ declare function _useOthers<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
551
+ /**
552
+ * Given a connection ID (as obtained by using `useOthersConnectionIds`), you
553
+ * can call this selector deep down in your component stack to only have the
554
+ * component re-render if properties for this particular user change.
555
+ *
556
+ * @example
557
+ * // Returns only the selected values re-renders whenever that selection changes)
558
+ * const { x, y } = useOther(2, user => user.presence.cursor);
559
+ */
560
+ declare const _useOtherSuspense: TypedBundle["suspense"]["useOther"];
561
+ /**
562
+ * Returns an array with information about all the users currently connected in
563
+ * the room (except yourself).
564
+ *
565
+ * @example
566
+ * const others = useOthers();
567
+ *
568
+ * // Example to map all cursors in JSX
569
+ * return (
570
+ * <>
571
+ * {others.map((user) => {
572
+ * if (user.presence.cursor == null) {
573
+ * return null;
574
+ * }
575
+ * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
576
+ * })}
577
+ * </>
578
+ * )
579
+ */
580
+ declare function _useOthersSuspense(): readonly User<DP, DU>[];
581
+ /**
582
+ * Extract arbitrary data based on all the users currently connected in the
583
+ * room (except yourself).
584
+ *
585
+ * The selector function will get re-evaluated any time a user enters or
586
+ * leaves the room, as well as whenever their presence data changes.
587
+ *
588
+ * The component that uses this hook will automatically re-render if your
589
+ * selector function returns a different value from its previous run.
590
+ *
591
+ * By default `useOthers()` uses strict `===` to check for equality. Take
592
+ * extra care when returning a computed object or list, for example when you
593
+ * return the result of a .map() or .filter() call from the selector. In
594
+ * those cases, you'll probably want to use a `shallow` comparison check.
595
+ *
596
+ * @example
597
+ * const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
598
+ * const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
599
+ * const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
600
+ *
601
+ */
602
+ declare function _useOthersSuspense<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
603
+ /**
604
+ * Extract arbitrary data from the Liveblocks Storage state, using an
605
+ * arbitrary selector function.
606
+ *
607
+ * The selector function will get re-evaluated any time something changes in
608
+ * Storage. The value returned by your selector function will also be the
609
+ * value returned by the hook.
610
+ *
611
+ * The `root` value that gets passed to your selector function is
612
+ * a immutable/readonly version of your Liveblocks storage root.
613
+ *
614
+ * The component that uses this hook will automatically re-render if the
615
+ * returned value changes.
616
+ *
617
+ * By default `useStorage()` uses strict `===` to check for equality. Take
618
+ * extra care when returning a computed object or list, for example when you
619
+ * return the result of a .map() or .filter() call from the selector. In
620
+ * those cases, you'll probably want to use a `shallow` comparison check.
621
+ */
622
+ declare const _useStorage: TypedBundle["useStorage"];
623
+ /**
624
+ * Extract arbitrary data from the Liveblocks Storage state, using an
625
+ * arbitrary selector function.
626
+ *
627
+ * The selector function will get re-evaluated any time something changes in
628
+ * Storage. The value returned by your selector function will also be the
629
+ * value returned by the hook.
630
+ *
631
+ * The `root` value that gets passed to your selector function is
632
+ * a immutable/readonly version of your Liveblocks storage root.
633
+ *
634
+ * The component that uses this hook will automatically re-render if the
635
+ * returned value changes.
636
+ *
637
+ * By default `useStorage()` uses strict `===` to check for equality. Take
638
+ * extra care when returning a computed object or list, for example when you
639
+ * return the result of a .map() or .filter() call from the selector. In
640
+ * those cases, you'll probably want to use a `shallow` comparison check.
641
+ */
642
+ declare const _useStorageSuspense: TypedBundle["suspense"]["useStorage"];
643
+ /**
644
+ * Gets the current user once it is connected to the room.
645
+ *
646
+ * @example
647
+ * const me = useSelf();
648
+ * if (me !== null) {
649
+ * const { x, y } = me.presence.cursor;
650
+ * }
651
+ */
652
+ declare function _useSelf(): User<DP, DU> | null;
653
+ /**
654
+ * Extract arbitrary data based on the current user.
655
+ *
656
+ * The selector function will get re-evaluated any time your presence data
657
+ * changes.
658
+ *
659
+ * The component that uses this hook will automatically re-render if your
660
+ * selector function returns a different value from its previous run.
661
+ *
662
+ * By default `useSelf()` uses strict `===` to check for equality. Take extra
663
+ * care when returning a computed object or list, for example when you return
664
+ * the result of a .map() or .filter() call from the selector. In those
665
+ * cases, you'll probably want to use a `shallow` comparison check.
666
+ *
667
+ * Will return `null` while Liveblocks isn't connected to a room yet.
668
+ *
669
+ * @example
670
+ * const cursor = useSelf(me => me.presence.cursor);
671
+ * if (cursor !== null) {
672
+ * const { x, y } = cursor;
673
+ * }
674
+ *
675
+ */
676
+ declare function _useSelf<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T | null;
677
+ /**
678
+ * Gets the current user once it is connected to the room.
679
+ *
680
+ * @example
681
+ * const me = useSelf();
682
+ * const { x, y } = me.presence.cursor;
683
+ */
684
+ declare function _useSelfSuspense(): User<DP, DU>;
685
+ /**
686
+ * Extract arbitrary data based on the current user.
687
+ *
688
+ * The selector function will get re-evaluated any time your presence data
689
+ * changes.
690
+ *
691
+ * The component that uses this hook will automatically re-render if your
692
+ * selector function returns a different value from its previous run.
693
+ *
694
+ * By default `useSelf()` uses strict `===` to check for equality. Take extra
695
+ * care when returning a computed object or list, for example when you return
696
+ * the result of a .map() or .filter() call from the selector. In those
697
+ * cases, you'll probably want to use a `shallow` comparison check.
698
+ *
699
+ * @example
700
+ * const cursor = useSelf(me => me.presence.cursor);
701
+ * const { x, y } = cursor;
702
+ *
703
+ */
704
+ declare function _useSelfSuspense<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
705
+ /**
706
+ * Returns the mutable (!) Storage root. This hook exists for
707
+ * backward-compatible reasons.
708
+ *
709
+ * @example
710
+ * const [root] = useStorageRoot();
711
+ */
712
+ declare const _useStorageRoot: TypedBundle["useStorageRoot"];
713
+ /**
714
+ * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
715
+ * If you don't use the current user presence in your component, but you need to update it (e.g. live cursor), it's better to use useUpdateMyPresence to avoid unnecessary renders.
716
+ *
717
+ * @example
718
+ * const updateMyPresence = useUpdateMyPresence();
719
+ * updateMyPresence({ x: 0 });
720
+ * updateMyPresence({ y: 0 });
721
+ *
722
+ * // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
723
+ */
724
+ declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
725
+
726
+ export { _useStorageSuspense as $, useStatus as A, _useStorageRoot as B, ClientSideSuspense as C, useThreadSubscription as D, useUndo as E, _useUpdateMyPresence as F, useUpdateRoomNotificationSettings as G, useHistoryVersionData as H, useCommentsErrorListener as I, _useOther as J, _useOthers as K, useOthersConnectionIds as L, _useOthersMapped as M, _useSelf as N, _useStorage as O, useStorageStatus as P, _useThreads as Q, RoomContext as R, useAttachmentUrl as S, _useHistoryVersions as T, _useRoomNotificationSettings as U, _useOtherSuspense as V, _useOthersSuspense as W, useOthersConnectionIdsSuspense as X, _useOthersMappedSuspense as Y, _useSelfSuspense as Z, _RoomProvider as _, _useAddReaction as a, useStorageStatusSuspense as a0, _useThreadsSuspense as a1, useAttachmentUrlSuspense as a2, _useHistoryVersionsSuspense as a3, _useRoomNotificationSettingsSuspense as a4, _useBroadcastEvent as b, createRoomContext as c, useCanRedo as d, useCanUndo as e, useCreateComment as f, _useCreateThread as g, useDeleteComment as h, _useDeleteThread as i, useEditComment as j, _useEditThreadMetadata as k, useMarkThreadAsResolved as l, useMarkThreadAsUnresolved as m, useErrorListener as n, _useEventListener as o, useHistory as p, _useIsInsideRoom as q, useLostConnectionListener as r, useMarkThreadAsRead as s, _useMutation as t, useBatch as u, _useMyPresence as v, _useOthersListener as w, useRedo as x, useRemoveReaction as y, _useRoom as z };