@liveblocks/react 2.9.3-experimental1 → 2.10.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.
@@ -0,0 +1,721 @@
1
+ import { U as UseStorageStatusOptions, a as CommentsError, b as CreateCommentOptions, E as EditCommentOptions, D as DeleteCommentOptions, c as CommentReactionOptions, T as ThreadSubscription, R as RoomNotificationSettingsAsyncResult, H as HistoryVersionDataAsyncResult, S as StorageStatusSuccess, A as AttachmentUrlAsyncResult, d as RoomContextBundle } from './liveblocks-X3qYz1Vg.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 user's notification settings for the current room
197
+ * and a function to update them.
198
+ *
199
+ * @example
200
+ * const [{ settings }, updateSettings] = useRoomNotificationSettings();
201
+ */
202
+ declare function useRoomNotificationSettings(): [
203
+ RoomNotificationSettingsAsyncResult,
204
+ (settings: Partial<RoomNotificationSettings>) => void
205
+ ];
206
+ /**
207
+ * Returns the version data bianry for a given version
208
+ *
209
+ * @example
210
+ * const {data} = useHistoryVersionData(versionId);
211
+ */
212
+ declare function useHistoryVersionData(versionId: string): HistoryVersionDataAsyncResult;
213
+ /**
214
+ * Returns a function that updates the user's notification settings
215
+ * for the current room.
216
+ *
217
+ * @example
218
+ * const updateRoomNotificationSettings = useUpdateRoomNotificationSettings();
219
+ * updateRoomNotificationSettings({ threads: "all" });
220
+ */
221
+ declare function useUpdateRoomNotificationSettings(): (settings: Partial<RoomNotificationSettings>) => void;
222
+ /**
223
+ * Returns an array of connection IDs. This matches the values you'll get by
224
+ * using the `useOthers()` hook.
225
+ *
226
+ * Roughly equivalent to:
227
+ * useOthers((others) => others.map(other => other.connectionId), shallow)
228
+ *
229
+ * This is useful in particular to implement efficiently rendering components
230
+ * for each user in the room, e.g. cursors.
231
+ *
232
+ * @example
233
+ * const ids = useOthersConnectionIds();
234
+ * // [2, 4, 7]
235
+ */
236
+ declare function useOthersConnectionIdsSuspense(): readonly number[];
237
+ /**
238
+ * Returns the current storage status for the Room, and triggers
239
+ * a re-render whenever it changes. Can be used to render a "Saving..."
240
+ * indicator.
241
+ */
242
+ declare function useStorageStatusSuspense(options?: UseStorageStatusOptions): StorageStatusSuccess;
243
+ /**
244
+ * Returns a presigned URL for an attachment by its ID.
245
+ *
246
+ * @example
247
+ * const { url, error, isLoading } = useAttachmentUrl("at_xxx");
248
+ */
249
+ declare function useAttachmentUrl(attachmentId: string): AttachmentUrlAsyncResult;
250
+ /**
251
+ * Returns a presigned URL for an attachment by its ID.
252
+ *
253
+ * @example
254
+ * const { url } = useAttachmentUrl("at_xxx");
255
+ */
256
+ declare function useAttachmentUrlSuspense(attachmentId: string): {
257
+ readonly isLoading: false;
258
+ readonly url: string;
259
+ readonly error: undefined;
260
+ };
261
+ /**
262
+ * Creates a RoomProvider and a set of typed hooks to use in your app. Note
263
+ * that any RoomProvider created in this way does not need to be nested in
264
+ * LiveblocksProvider, as it already has access to the client.
265
+ */
266
+ 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>;
267
+ declare type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DM>;
268
+ /**
269
+ * Makes a Room available in the component hierarchy below.
270
+ * Joins the room when the component is mounted, and automatically leaves
271
+ * the room when the component is unmounted.
272
+ */
273
+ declare const _RoomProvider: TypedBundle["RoomProvider"];
274
+ /**
275
+ * Returns a callback that lets you broadcast custom events to other users in the room
276
+ *
277
+ * @example
278
+ * const broadcast = useBroadcastEvent();
279
+ *
280
+ * broadcast({ type: "CUSTOM_EVENT", data: { x: 0, y: 0 } });
281
+ */
282
+ declare const _useBroadcastEvent: TypedBundle["useBroadcastEvent"];
283
+ /**
284
+ * Get informed when users enter or leave the room, as an event.
285
+ *
286
+ * @example
287
+ * useOthersListener({ type, user, others }) => {
288
+ * if (type === 'enter') {
289
+ * // `user` has joined the room
290
+ * } else if (type === 'leave') {
291
+ * // `user` has left the room
292
+ * }
293
+ * })
294
+ */
295
+ declare const _useOthersListener: TypedBundle["useOthersListener"];
296
+ /**
297
+ * Returns the Room of the nearest RoomProvider above in the React component
298
+ * tree.
299
+ */
300
+ declare const _useRoom: TypedBundle["useRoom"];
301
+ /**
302
+ * Returns whether the hook is called within a RoomProvider context.
303
+ *
304
+ * @example
305
+ * const isInsideRoom = useIsInsideRoom();
306
+ */
307
+ declare const _useIsInsideRoom: TypedBundle["useIsInsideRoom"];
308
+ /**
309
+ * Returns a function that adds a reaction from a comment.
310
+ *
311
+ * @example
312
+ * const addReaction = useAddReaction();
313
+ * addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
314
+ */
315
+ declare const _useAddReaction: TypedBundle["useAddReaction"];
316
+ /**
317
+ * Create a callback function that lets you mutate Liveblocks state.
318
+ *
319
+ * The first argument that gets passed into your callback will be
320
+ * a "mutation context", which exposes the following:
321
+ *
322
+ * - `storage` - The mutable Storage root.
323
+ * You can mutate any Live structures with this, for example:
324
+ * `storage.get('layers').get('layer1').set('fill', 'red')`
325
+ *
326
+ * - `setMyPresence` - Call this with a new (partial) Presence value.
327
+ *
328
+ * - `self` - A read-only version of the latest self, if you need it to
329
+ * compute the next state.
330
+ *
331
+ * - `others` - A read-only version of the latest others list, if you
332
+ * need it to compute the next state.
333
+ *
334
+ * useMutation is like React's useCallback, except that the first argument
335
+ * that gets passed into your callback will be a "mutation context".
336
+ *
337
+ * If you want get access to the immutable root somewhere in your mutation,
338
+ * you can use `storage.ToImmutable()`.
339
+ *
340
+ * @example
341
+ * const fillLayers = useMutation(
342
+ * ({ storage }, color: Color) => {
343
+ * ...
344
+ * },
345
+ * [],
346
+ * );
347
+ *
348
+ * fillLayers('red');
349
+ *
350
+ * const deleteLayers = useMutation(
351
+ * ({ storage }) => {
352
+ * ...
353
+ * },
354
+ * [],
355
+ * );
356
+ *
357
+ * deleteLayers();
358
+ */
359
+ declare const _useMutation: TypedBundle["useMutation"];
360
+ /**
361
+ * Returns a function that creates a thread with an initial comment, and optionally some metadata.
362
+ *
363
+ * @example
364
+ * const createThread = useCreateThread();
365
+ * createThread({ body: {}, metadata: {} });
366
+ */
367
+ declare const _useCreateThread: TypedBundle["useCreateThread"];
368
+ /**
369
+ * Returns a function that deletes a thread and its associated comments.
370
+ * Only the thread creator can delete a thread, it will throw otherwise.
371
+ *
372
+ * @example
373
+ * const deleteThread = useDeleteThread();
374
+ * deleteThread("th_xxx");
375
+ */
376
+ declare const _useDeleteThread: TypedBundle["useDeleteThread"];
377
+ /**
378
+ * Returns a function that edits a thread's metadata.
379
+ * To delete an existing metadata property, set its value to `null`.
380
+ *
381
+ * @example
382
+ * const editThreadMetadata = useEditThreadMetadata();
383
+ * editThreadMetadata({ threadId: "th_xxx", metadata: {} })
384
+ */
385
+ declare const _useEditThreadMetadata: TypedBundle["useEditThreadMetadata"];
386
+ /**
387
+ * useEventListener is a React hook that allows you to respond to events broadcast
388
+ * by other users in the room.
389
+ *
390
+ * The `user` argument will indicate which `User` instance sent the message.
391
+ * This will be equal to one of the others in the room, but it can be `null`
392
+ * in case this event was broadcasted from the server.
393
+ *
394
+ * @example
395
+ * useEventListener(({ event, user, connectionId }) => {
396
+ * // ^^^^ Will be Client A
397
+ * if (event.type === "CUSTOM_EVENT") {
398
+ * // Do something
399
+ * }
400
+ * });
401
+ */
402
+ declare const _useEventListener: TypedBundle["useEventListener"];
403
+ /**
404
+ * Returns the presence of the current user of the current room, and a function to update it.
405
+ * It is different from the setState function returned by the useState hook from React.
406
+ * You don't need to pass the full presence object to update it.
407
+ *
408
+ * @example
409
+ * const [myPresence, updateMyPresence] = useMyPresence();
410
+ * updateMyPresence({ x: 0 });
411
+ * updateMyPresence({ y: 0 });
412
+ *
413
+ * // At the next render, "myPresence" will be equal to "{ x: 0, y: 0 }"
414
+ */
415
+ declare const _useMyPresence: TypedBundle["useMyPresence"];
416
+ /**
417
+ * Related to useOthers(), but optimized for selecting only "subsets" of
418
+ * others. This is useful for performance reasons in particular, because
419
+ * selecting only a subset of users also means limiting the number of
420
+ * re-renders that will be triggered.
421
+ *
422
+ * @example
423
+ * const avatars = useOthersMapped(user => user.info.avatar);
424
+ * // ^^^^^^^
425
+ * // { connectionId: number; data: string }[]
426
+ *
427
+ * The selector function you pass to useOthersMapped() is called an "item
428
+ * selector", and operates on a single user at a time. If you provide an
429
+ * (optional) "item comparison" function, it will be used to compare each
430
+ * item pairwise.
431
+ *
432
+ * For example, to select multiple properties:
433
+ *
434
+ * @example
435
+ * const avatarsAndCursors = useOthersMapped(
436
+ * user => [u.info.avatar, u.presence.cursor],
437
+ * shallow, // 👈
438
+ * );
439
+ */
440
+ declare const _useOthersMapped: TypedBundle["useOthersMapped"];
441
+ /**
442
+ * Related to useOthers(), but optimized for selecting only "subsets" of
443
+ * others. This is useful for performance reasons in particular, because
444
+ * selecting only a subset of users also means limiting the number of
445
+ * re-renders that will be triggered.
446
+ *
447
+ * @example
448
+ * const avatars = useOthersMapped(user => user.info.avatar);
449
+ * // ^^^^^^^
450
+ * // { connectionId: number; data: string }[]
451
+ *
452
+ * The selector function you pass to useOthersMapped() is called an "item
453
+ * selector", and operates on a single user at a time. If you provide an
454
+ * (optional) "item comparison" function, it will be used to compare each
455
+ * item pairwise.
456
+ *
457
+ * For example, to select multiple properties:
458
+ *
459
+ * @example
460
+ * const avatarsAndCursors = useOthersMapped(
461
+ * user => [u.info.avatar, u.presence.cursor],
462
+ * shallow, // 👈
463
+ * );
464
+ */
465
+ declare const _useOthersMappedSuspense: TypedBundle["suspense"]["useOthersMapped"];
466
+ /**
467
+ * Returns the threads within the current room.
468
+ *
469
+ * @example
470
+ * const { threads, error, isLoading } = useThreads();
471
+ */
472
+ declare const _useThreads: TypedBundle["useThreads"];
473
+ /**
474
+ * Returns the threads within the current room.
475
+ *
476
+ * @example
477
+ * const { threads } = useThreads();
478
+ */
479
+ declare const _useThreadsSuspense: TypedBundle["suspense"]["useThreads"];
480
+ /**
481
+ * (Private beta) Returns a history of versions of the current room.
482
+ *
483
+ * @example
484
+ * const { versions, error, isLoading } = useHistoryVersions();
485
+ */
486
+ declare const _useHistoryVersions: TypedBundle["useHistoryVersions"];
487
+ /**
488
+ * (Private beta) Returns a history of versions of the current room.
489
+ *
490
+ * @example
491
+ * const { versions } = useHistoryVersions();
492
+ */
493
+ declare const _useHistoryVersionsSuspense: TypedBundle["suspense"]["useHistoryVersions"];
494
+ /**
495
+ * Given a connection ID (as obtained by using `useOthersConnectionIds`), you
496
+ * can call this selector deep down in your component stack to only have the
497
+ * component re-render if properties for this particular user change.
498
+ *
499
+ * @example
500
+ * // Returns only the selected values re-renders whenever that selection changes)
501
+ * const { x, y } = useOther(2, user => user.presence.cursor);
502
+ */
503
+ declare const _useOther: TypedBundle["useOther"];
504
+ /**
505
+ * Returns an array with information about all the users currently connected in
506
+ * the room (except yourself).
507
+ *
508
+ * @example
509
+ * const others = useOthers();
510
+ *
511
+ * // Example to map all cursors in JSX
512
+ * return (
513
+ * <>
514
+ * {others.map((user) => {
515
+ * if (user.presence.cursor == null) {
516
+ * return null;
517
+ * }
518
+ * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
519
+ * })}
520
+ * </>
521
+ * )
522
+ */
523
+ declare function _useOthers(): readonly User<DP, DU>[];
524
+ /**
525
+ * Extract arbitrary data based on all the users currently connected in the
526
+ * room (except yourself).
527
+ *
528
+ * The selector function will get re-evaluated any time a user enters or
529
+ * leaves the room, as well as whenever their presence data changes.
530
+ *
531
+ * The component that uses this hook will automatically re-render if your
532
+ * selector function returns a different value from its previous run.
533
+ *
534
+ * By default `useOthers()` uses strict `===` to check for equality. Take
535
+ * extra care when returning a computed object or list, for example when you
536
+ * return the result of a .map() or .filter() call from the selector. In
537
+ * those cases, you'll probably want to use a `shallow` comparison check.
538
+ *
539
+ * @example
540
+ * const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
541
+ * const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
542
+ * const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
543
+ *
544
+ */
545
+ declare function _useOthers<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
546
+ /**
547
+ * Given a connection ID (as obtained by using `useOthersConnectionIds`), you
548
+ * can call this selector deep down in your component stack to only have the
549
+ * component re-render if properties for this particular user change.
550
+ *
551
+ * @example
552
+ * // Returns only the selected values re-renders whenever that selection changes)
553
+ * const { x, y } = useOther(2, user => user.presence.cursor);
554
+ */
555
+ declare const _useOtherSuspense: TypedBundle["suspense"]["useOther"];
556
+ /**
557
+ * Returns an array with information about all the users currently connected in
558
+ * the room (except yourself).
559
+ *
560
+ * @example
561
+ * const others = useOthers();
562
+ *
563
+ * // Example to map all cursors in JSX
564
+ * return (
565
+ * <>
566
+ * {others.map((user) => {
567
+ * if (user.presence.cursor == null) {
568
+ * return null;
569
+ * }
570
+ * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
571
+ * })}
572
+ * </>
573
+ * )
574
+ */
575
+ declare function _useOthersSuspense(): readonly User<DP, DU>[];
576
+ /**
577
+ * Extract arbitrary data based on all the users currently connected in the
578
+ * room (except yourself).
579
+ *
580
+ * The selector function will get re-evaluated any time a user enters or
581
+ * leaves the room, as well as whenever their presence data changes.
582
+ *
583
+ * The component that uses this hook will automatically re-render if your
584
+ * selector function returns a different value from its previous run.
585
+ *
586
+ * By default `useOthers()` uses strict `===` to check for equality. Take
587
+ * extra care when returning a computed object or list, for example when you
588
+ * return the result of a .map() or .filter() call from the selector. In
589
+ * those cases, you'll probably want to use a `shallow` comparison check.
590
+ *
591
+ * @example
592
+ * const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
593
+ * const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
594
+ * const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
595
+ *
596
+ */
597
+ declare function _useOthersSuspense<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
598
+ /**
599
+ * Extract arbitrary data from the Liveblocks Storage state, using an
600
+ * arbitrary selector function.
601
+ *
602
+ * The selector function will get re-evaluated any time something changes in
603
+ * Storage. The value returned by your selector function will also be the
604
+ * value returned by the hook.
605
+ *
606
+ * The `root` value that gets passed to your selector function is
607
+ * a immutable/readonly version of your Liveblocks storage root.
608
+ *
609
+ * The component that uses this hook will automatically re-render if the
610
+ * returned value changes.
611
+ *
612
+ * By default `useStorage()` uses strict `===` to check for equality. Take
613
+ * extra care when returning a computed object or list, for example when you
614
+ * return the result of a .map() or .filter() call from the selector. In
615
+ * those cases, you'll probably want to use a `shallow` comparison check.
616
+ */
617
+ declare const _useStorage: TypedBundle["useStorage"];
618
+ /**
619
+ * Extract arbitrary data from the Liveblocks Storage state, using an
620
+ * arbitrary selector function.
621
+ *
622
+ * The selector function will get re-evaluated any time something changes in
623
+ * Storage. The value returned by your selector function will also be the
624
+ * value returned by the hook.
625
+ *
626
+ * The `root` value that gets passed to your selector function is
627
+ * a immutable/readonly version of your Liveblocks storage root.
628
+ *
629
+ * The component that uses this hook will automatically re-render if the
630
+ * returned value changes.
631
+ *
632
+ * By default `useStorage()` uses strict `===` to check for equality. Take
633
+ * extra care when returning a computed object or list, for example when you
634
+ * return the result of a .map() or .filter() call from the selector. In
635
+ * those cases, you'll probably want to use a `shallow` comparison check.
636
+ */
637
+ declare const _useStorageSuspense: TypedBundle["suspense"]["useStorage"];
638
+ /**
639
+ * Gets the current user once it is connected to the room.
640
+ *
641
+ * @example
642
+ * const me = useSelf();
643
+ * if (me !== null) {
644
+ * const { x, y } = me.presence.cursor;
645
+ * }
646
+ */
647
+ declare function _useSelf(): User<DP, DU> | null;
648
+ /**
649
+ * Extract arbitrary data based on the current user.
650
+ *
651
+ * The selector function will get re-evaluated any time your presence data
652
+ * changes.
653
+ *
654
+ * The component that uses this hook will automatically re-render if your
655
+ * selector function returns a different value from its previous run.
656
+ *
657
+ * By default `useSelf()` uses strict `===` to check for equality. Take extra
658
+ * care when returning a computed object or list, for example when you return
659
+ * the result of a .map() or .filter() call from the selector. In those
660
+ * cases, you'll probably want to use a `shallow` comparison check.
661
+ *
662
+ * Will return `null` while Liveblocks isn't connected to a room yet.
663
+ *
664
+ * @example
665
+ * const cursor = useSelf(me => me.presence.cursor);
666
+ * if (cursor !== null) {
667
+ * const { x, y } = cursor;
668
+ * }
669
+ *
670
+ */
671
+ declare function _useSelf<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T | null;
672
+ /**
673
+ * Gets the current user once it is connected to the room.
674
+ *
675
+ * @example
676
+ * const me = useSelf();
677
+ * const { x, y } = me.presence.cursor;
678
+ */
679
+ declare function _useSelfSuspense(): User<DP, DU>;
680
+ /**
681
+ * Extract arbitrary data based on the current user.
682
+ *
683
+ * The selector function will get re-evaluated any time your presence data
684
+ * changes.
685
+ *
686
+ * The component that uses this hook will automatically re-render if your
687
+ * selector function returns a different value from its previous run.
688
+ *
689
+ * By default `useSelf()` uses strict `===` to check for equality. Take extra
690
+ * care when returning a computed object or list, for example when you return
691
+ * the result of a .map() or .filter() call from the selector. In those
692
+ * cases, you'll probably want to use a `shallow` comparison check.
693
+ *
694
+ * @example
695
+ * const cursor = useSelf(me => me.presence.cursor);
696
+ * const { x, y } = cursor;
697
+ *
698
+ */
699
+ declare function _useSelfSuspense<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
700
+ /**
701
+ * Returns the mutable (!) Storage root. This hook exists for
702
+ * backward-compatible reasons.
703
+ *
704
+ * @example
705
+ * const [root] = useStorageRoot();
706
+ */
707
+ declare const _useStorageRoot: TypedBundle["useStorageRoot"];
708
+ /**
709
+ * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
710
+ * 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.
711
+ *
712
+ * @example
713
+ * const updateMyPresence = useUpdateMyPresence();
714
+ * updateMyPresence({ x: 0 });
715
+ * updateMyPresence({ y: 0 });
716
+ *
717
+ * // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
718
+ */
719
+ declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
720
+
721
+ export { _useStorageSuspense as $, useRoomNotificationSettings as A, useStatus as B, ClientSideSuspense as C, _useStorageRoot as D, useThreadSubscription as E, useUndo as F, _useUpdateMyPresence as G, useUpdateRoomNotificationSettings as H, useHistoryVersionData as I, useCommentsErrorListener as J, _useOther as K, _useOthers as L, useOthersConnectionIds as M, _useOthersMapped as N, _useSelf as O, _useStorage as P, useStorageStatus as Q, RoomContext as R, _useThreads as S, useAttachmentUrl as T, _useHistoryVersions 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, _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 };