@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.
- package/_private/README.md +5 -0
- package/_private/package.json +4 -0
- package/dist/_private.d.mts +14 -0
- package/dist/_private.d.ts +14 -0
- package/dist/_private.js +67 -0
- package/dist/_private.js.map +1 -0
- package/dist/_private.mjs +67 -0
- package/dist/_private.mjs.map +1 -0
- package/dist/{chunk-PZIVKFDZ.js → chunk-3MM4G6XB.js} +794 -776
- package/dist/chunk-3MM4G6XB.js.map +1 -0
- package/dist/{chunk-SNEUTGU4.mjs → chunk-A7GJNN4L.mjs} +794 -776
- package/dist/chunk-A7GJNN4L.mjs.map +1 -0
- package/dist/chunk-DNACURSM.mjs +22 -0
- package/dist/chunk-DNACURSM.mjs.map +1 -0
- package/dist/chunk-EXS4G6PT.js +22 -0
- package/dist/chunk-EXS4G6PT.js.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -12
- package/dist/index.mjs.map +1 -1
- package/dist/{suspense-fYGGJ3D9.d.mts → liveblocks-SAVcXwMX.d.mts} +112 -782
- package/dist/{suspense-fYGGJ3D9.d.ts → liveblocks-SAVcXwMX.d.ts} +112 -782
- package/dist/suspense-W7Cp9ygn.d.ts +726 -0
- package/dist/suspense-vGJE9Mgq.d.mts +726 -0
- package/dist/suspense.d.mts +2 -1
- package/dist/suspense.d.ts +2 -1
- package/dist/suspense.js +5 -3
- package/dist/suspense.js.map +1 -1
- package/dist/suspense.mjs +8 -6
- package/dist/suspense.mjs.map +1 -1
- package/package.json +16 -4
- package/dist/chunk-PZIVKFDZ.js.map +0 -1
- package/dist/chunk-SNEUTGU4.mjs.map +0 -1
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
import { JsonObject, LsonObject, BaseUserMeta, LiveObject, User,
|
|
2
|
-
import
|
|
3
|
-
import React__default, {
|
|
4
|
-
import { BaseMetadata, CommentBody, Patchable, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, CommentAttachment, InboxNotificationData, Resolve, ToImmutable, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, LiveblocksError, RoomEventMessage, CommentData, PartialUnless, ThreadDataWithDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, OpaqueClient, CommentUserReaction, ThreadDeleteInfo, InboxNotificationDeleteInfo, DistributiveOmit, DU, DM, OpaqueRoom, DP, DS, DE } from '@liveblocks/core';
|
|
5
|
-
|
|
6
|
-
declare type Props = {
|
|
7
|
-
fallback: ReactNode;
|
|
8
|
-
children: (() => ReactNode | undefined) | ReactNode | undefined;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Almost like a normal <Suspense> component, except that for server-side
|
|
12
|
-
* renders, the fallback will be used.
|
|
13
|
-
*
|
|
14
|
-
* The child props will have to be provided in a function, i.e. change:
|
|
15
|
-
*
|
|
16
|
-
* <Suspense fallback={<Loading />}>
|
|
17
|
-
* <MyRealComponent a={1} />
|
|
18
|
-
* </Suspense>
|
|
19
|
-
*
|
|
20
|
-
* To:
|
|
21
|
-
*
|
|
22
|
-
* <ClientSideSuspense fallback={<Loading />}>
|
|
23
|
-
* <MyRealComponent a={1} />
|
|
24
|
-
* </ClientSideSuspense>
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
declare function ClientSideSuspense(props: Props): React$1.JSX.Element;
|
|
1
|
+
import { JsonObject, LsonObject, BaseUserMeta, LiveObject, User, Json, RoomNotificationSettings, Room, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, BaseMetadata as BaseMetadata$1, Client as Client$1, ClientOptions } from '@liveblocks/client';
|
|
2
|
+
import { BaseMetadata, CommentBody, Patchable, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, CommentAttachment, InboxNotificationData, Resolve, ToImmutable, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, LiveblocksError, RoomEventMessage, CommentData, PartialUnless, ThreadDataWithDeleteInfo, OpaqueClient, CommentUserReaction, ThreadDeleteInfo, InboxNotificationDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, DistributiveOmit, DU, DM } from '@liveblocks/core';
|
|
3
|
+
import React__default, { PropsWithChildren } from 'react';
|
|
28
4
|
|
|
29
5
|
/**
|
|
30
6
|
* @private Internal API, do not rely on it.
|
|
@@ -46,6 +22,9 @@ declare class CreateThreadError<M extends BaseMetadata> extends Error {
|
|
|
46
22
|
metadata: M;
|
|
47
23
|
});
|
|
48
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* @private Internal API, do not rely on it.
|
|
27
|
+
*/
|
|
49
28
|
declare class EditThreadMetadataError<M extends BaseMetadata> extends Error {
|
|
50
29
|
cause: Error;
|
|
51
30
|
context: {
|
|
@@ -59,6 +38,9 @@ declare class EditThreadMetadataError<M extends BaseMetadata> extends Error {
|
|
|
59
38
|
metadata: Patchable<M>;
|
|
60
39
|
});
|
|
61
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @private Internal API, do not rely on it.
|
|
43
|
+
*/
|
|
62
44
|
declare class CreateCommentError extends Error {
|
|
63
45
|
cause: Error;
|
|
64
46
|
context: {
|
|
@@ -74,6 +56,9 @@ declare class CreateCommentError extends Error {
|
|
|
74
56
|
body: CommentBody;
|
|
75
57
|
});
|
|
76
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* @private Internal API, do not rely on it.
|
|
61
|
+
*/
|
|
77
62
|
declare class EditCommentError extends Error {
|
|
78
63
|
cause: Error;
|
|
79
64
|
context: {
|
|
@@ -89,6 +74,9 @@ declare class EditCommentError extends Error {
|
|
|
89
74
|
body: CommentBody;
|
|
90
75
|
});
|
|
91
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* @private Internal API, do not rely on it.
|
|
79
|
+
*/
|
|
92
80
|
declare class DeleteCommentError extends Error {
|
|
93
81
|
cause: Error;
|
|
94
82
|
context: {
|
|
@@ -102,6 +90,9 @@ declare class DeleteCommentError extends Error {
|
|
|
102
90
|
commentId: string;
|
|
103
91
|
});
|
|
104
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* @private Internal API, do not rely on it.
|
|
95
|
+
*/
|
|
105
96
|
declare class MarkInboxNotificationAsReadError extends Error {
|
|
106
97
|
cause: Error;
|
|
107
98
|
context: {
|
|
@@ -111,6 +102,9 @@ declare class MarkInboxNotificationAsReadError extends Error {
|
|
|
111
102
|
inboxNotificationId: string;
|
|
112
103
|
});
|
|
113
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* @private Internal API, do not rely on it.
|
|
107
|
+
*/
|
|
114
108
|
declare class UpdateNotificationSettingsError extends Error {
|
|
115
109
|
cause: Error;
|
|
116
110
|
context: {
|
|
@@ -120,6 +114,9 @@ declare class UpdateNotificationSettingsError extends Error {
|
|
|
120
114
|
roomId: string;
|
|
121
115
|
});
|
|
122
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* @private Internal API, do not rely on it.
|
|
119
|
+
*/
|
|
123
120
|
declare type CommentsError<M extends BaseMetadata> = CreateThreadError<M> | EditThreadMetadataError<M> | CreateCommentError | EditCommentError | DeleteCommentError | MarkInboxNotificationAsReadError | UpdateNotificationSettingsError;
|
|
124
121
|
|
|
125
122
|
declare type UseStorageStatusOptions = {
|
|
@@ -1064,6 +1061,61 @@ declare type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetad
|
|
|
1064
1061
|
}>;
|
|
1065
1062
|
}>;
|
|
1066
1063
|
|
|
1064
|
+
declare type ReadonlyThreadDB<M extends BaseMetadata> = Omit<ThreadDB<M>, "upsert" | "delete">;
|
|
1065
|
+
/**
|
|
1066
|
+
* This class implements a lightweight, in-memory, "database" for all Thread
|
|
1067
|
+
* instances.
|
|
1068
|
+
*
|
|
1069
|
+
* It exposes the following methods:
|
|
1070
|
+
*
|
|
1071
|
+
* - upsert: To add/update a thread
|
|
1072
|
+
* - upsertIfNewer: To add/update a thread. Only update an existing thread if
|
|
1073
|
+
* its newer
|
|
1074
|
+
* - delete: To mark existing threads as deleted
|
|
1075
|
+
* - get: To get any non-deleted thread
|
|
1076
|
+
* - getEvenIfDeleted: To get a thread which is possibly deleted
|
|
1077
|
+
* - findMany: To filter an ordered list of non-deleted threads
|
|
1078
|
+
* - clone: To clone the DB to mutate it further. This is used to mix in
|
|
1079
|
+
* optimistic updates without losing the original thread contents.
|
|
1080
|
+
*
|
|
1081
|
+
*/
|
|
1082
|
+
declare class ThreadDB<M extends BaseMetadata> {
|
|
1083
|
+
private _byId;
|
|
1084
|
+
private _asc;
|
|
1085
|
+
private _desc;
|
|
1086
|
+
private _version;
|
|
1087
|
+
constructor();
|
|
1088
|
+
clone(): ThreadDB<M>;
|
|
1089
|
+
/** Gets the transaction count for this DB. Increments any time the DB is modified. */
|
|
1090
|
+
get version(): number;
|
|
1091
|
+
/** Returns an existing thread by ID. Will never return a deleted thread. */
|
|
1092
|
+
get(threadId: string): ThreadData<M> | undefined;
|
|
1093
|
+
/** Returns the (possibly deleted) thread by ID. */
|
|
1094
|
+
getEvenIfDeleted(threadId: string): ThreadDataWithDeleteInfo<M> | undefined;
|
|
1095
|
+
/** Adds or updates a thread in the DB. If the newly given thread is a deleted one, it will get deleted. */
|
|
1096
|
+
upsert(thread: ThreadDataWithDeleteInfo<M>): void;
|
|
1097
|
+
/** Like .upsert(), except it won't update if a thread by this ID already exists. */
|
|
1098
|
+
upsertIfNewer(thread: ThreadDataWithDeleteInfo<M>): void;
|
|
1099
|
+
/**
|
|
1100
|
+
* Marks a thread as deleted. It will no longer pop up in .findMany()
|
|
1101
|
+
* queries, but it can still be accessed via `.getEvenIfDeleted()`.
|
|
1102
|
+
*/
|
|
1103
|
+
delete(threadId: string, deletedAt: Date): void;
|
|
1104
|
+
/**
|
|
1105
|
+
* Returns all threads matching a given roomId and query. If roomId is not
|
|
1106
|
+
* specified, it will return all threads matching the query, across all
|
|
1107
|
+
* rooms.
|
|
1108
|
+
*
|
|
1109
|
+
* Returns the results in the requested order. Please note:
|
|
1110
|
+
* 'asc' means by createdAt ASC
|
|
1111
|
+
* 'desc' means by updatedAt DESC
|
|
1112
|
+
*
|
|
1113
|
+
* Will never return deleted threads in the result.
|
|
1114
|
+
*/
|
|
1115
|
+
findMany(roomId: string | undefined, query: ThreadsQuery<M>, direction: "asc" | "desc"): ThreadData<M>[];
|
|
1116
|
+
private touch;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1067
1119
|
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
1068
1120
|
declare type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
|
|
1069
1121
|
type: "create-thread";
|
|
@@ -1159,15 +1211,6 @@ declare type UpdateNotificationSettingsOptimisticUpdate = {
|
|
|
1159
1211
|
roomId: string;
|
|
1160
1212
|
settings: Partial<RoomNotificationSettings$1>;
|
|
1161
1213
|
};
|
|
1162
|
-
declare type QueryAsyncResult = AsyncResult<undefined>;
|
|
1163
|
-
/**
|
|
1164
|
-
* @private Do not rely on this internal API.
|
|
1165
|
-
*/
|
|
1166
|
-
declare function selectThreads<M extends BaseMetadata>(state: UmbrellaStoreState<M>, options: {
|
|
1167
|
-
roomId: string | null;
|
|
1168
|
-
query?: ThreadsQuery<M>;
|
|
1169
|
-
orderBy: "age" | "last-update";
|
|
1170
|
-
}): ThreadData<M>[];
|
|
1171
1214
|
/**
|
|
1172
1215
|
* Like Promise<T>, except it will have a synchronously readable `status`
|
|
1173
1216
|
* field, indicating the status of the promise.
|
|
@@ -1193,23 +1236,11 @@ declare type UmbrellaStoreState<M extends BaseMetadata> = {
|
|
|
1193
1236
|
* e.g. 'room-abc-{"color":"red"}' - ok
|
|
1194
1237
|
* e.g. 'room-abc-{}' - loading
|
|
1195
1238
|
*/
|
|
1196
|
-
|
|
1197
|
-
queries4: Record<string, QueryAsyncResult>;
|
|
1198
|
-
/**
|
|
1199
|
-
* All threads in a sorted array, optimistic updates applied, without deleted
|
|
1200
|
-
* threads.
|
|
1201
|
-
*/
|
|
1202
|
-
threads: ThreadData<M>[];
|
|
1203
|
-
/**
|
|
1204
|
-
* All threads in a map, keyed by thread ID, with all optimistic updates
|
|
1205
|
-
* applied. Deleted threads are still in this mapping, and will have
|
|
1206
|
-
* a deletedAt field if so.
|
|
1207
|
-
*/
|
|
1208
|
-
threadsById: Record<string, ThreadDataWithDeleteInfo<M>>;
|
|
1239
|
+
threadsDB: ReadonlyThreadDB<M>;
|
|
1209
1240
|
/**
|
|
1210
1241
|
* All inbox notifications in a sorted array, optimistic updates applied.
|
|
1211
1242
|
*/
|
|
1212
|
-
|
|
1243
|
+
cleanedNotifications: InboxNotificationData[];
|
|
1213
1244
|
/**
|
|
1214
1245
|
* Inbox notifications by ID.
|
|
1215
1246
|
* e.g. `in_${string}`
|
|
@@ -1227,10 +1258,12 @@ declare type UmbrellaStoreState<M extends BaseMetadata> = {
|
|
|
1227
1258
|
* Versions by roomId
|
|
1228
1259
|
* e.g. { 'room-abc': {versions: "all versions"}}
|
|
1229
1260
|
*/
|
|
1230
|
-
versionsByRoomId: Record<string, HistoryVersion
|
|
1261
|
+
versionsByRoomId: Record<string, Record<string, HistoryVersion>>;
|
|
1231
1262
|
};
|
|
1232
1263
|
declare class UmbrellaStore<M extends BaseMetadata> {
|
|
1233
|
-
private _client
|
|
1264
|
+
private _client;
|
|
1265
|
+
private _rawThreadsDB;
|
|
1266
|
+
private _prevVersion;
|
|
1234
1267
|
private _store;
|
|
1235
1268
|
private _prevState;
|
|
1236
1269
|
private _stateCached;
|
|
@@ -1240,7 +1273,10 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1240
1273
|
private _roomThreads;
|
|
1241
1274
|
private _userThreadsLastRequestedAt;
|
|
1242
1275
|
private _userThreads;
|
|
1243
|
-
|
|
1276
|
+
private _roomVersions;
|
|
1277
|
+
private _roomVersionsLastRequestedAtByRoom;
|
|
1278
|
+
private _roomNotificationSettings;
|
|
1279
|
+
constructor(client: OpaqueClient);
|
|
1244
1280
|
private get;
|
|
1245
1281
|
batch(callback: () => void): void;
|
|
1246
1282
|
getFullState(): UmbrellaStoreState<M>;
|
|
@@ -1249,31 +1285,20 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1249
1285
|
* then it will return the threads that match that provided query and room id.
|
|
1250
1286
|
*
|
|
1251
1287
|
*/
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1288
|
+
getRoomThreadsLoadingState(roomId: string, query: ThreadsQuery<M> | undefined): ThreadsAsyncResult<M>;
|
|
1289
|
+
getUserThreadsLoadingState(query: ThreadsQuery<M> | undefined): ThreadsAsyncResult<M>;
|
|
1290
|
+
getInboxNotificationsLoadingState(): InboxNotificationsAsyncResult;
|
|
1291
|
+
getNotificationSettingsLoadingState(roomId: string): RoomNotificationSettingsAsyncResult;
|
|
1292
|
+
getRoomVersionsLoadingState(roomId: string): AsyncResult<HistoryVersion[], "versions">;
|
|
1257
1293
|
/**
|
|
1258
1294
|
* @private Only used by the E2E test suite.
|
|
1259
1295
|
*/
|
|
1260
1296
|
_hasOptimisticUpdates(): boolean;
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
* @private Only used by the E2E test suite.
|
|
1264
|
-
*/
|
|
1265
|
-
_subscribeOptimisticUpdates(callback: () => void): () => void;
|
|
1266
|
-
subscribeThreads(callback: () => void): () => void;
|
|
1267
|
-
subscribeUserThreads(callback: () => void): () => void;
|
|
1268
|
-
subscribeThreadsOrInboxNotifications(callback: () => void): () => void;
|
|
1269
|
-
subscribeNotificationSettings(callback: () => void): () => void;
|
|
1270
|
-
subscribeVersions(callback: () => void): () => void;
|
|
1271
|
-
private updateThreadsCache;
|
|
1297
|
+
subscribe(callback: () => void): () => void;
|
|
1298
|
+
private mutateThreadsDB;
|
|
1272
1299
|
private updateInboxNotificationsCache;
|
|
1273
1300
|
private setNotificationSettings;
|
|
1274
|
-
private
|
|
1275
|
-
private setQuery3State;
|
|
1276
|
-
private setQuery4State;
|
|
1301
|
+
private updateRoomVersions;
|
|
1277
1302
|
private updateOptimisticUpdatesCache;
|
|
1278
1303
|
/**
|
|
1279
1304
|
* Updates an existing inbox notification with a new value, replacing the
|
|
@@ -1342,23 +1367,19 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1342
1367
|
* Updates existing notification setting for a room with a new value,
|
|
1343
1368
|
* replacing the corresponding optimistic update.
|
|
1344
1369
|
*/
|
|
1345
|
-
|
|
1346
|
-
updateRoomInboxNotificationSettings(roomId: string, settings: RoomNotificationSettings$1, queryKey: string): void;
|
|
1347
|
-
updateRoomVersions(roomId: string, versions: HistoryVersion[], queryKey?: string): void;
|
|
1370
|
+
updateRoomNotificationSettings_confirmOptimisticUpdate(roomId: string, optimisticUpdateId: string, settings: Readonly<RoomNotificationSettings$1>): void;
|
|
1348
1371
|
addOptimisticUpdate(optimisticUpdate: DistributiveOmit<OptimisticUpdate<M>, "id">): string;
|
|
1349
1372
|
removeOptimisticUpdate(optimisticUpdateId: string): void;
|
|
1350
|
-
|
|
1351
|
-
private setQuery3OK;
|
|
1352
|
-
setQuery3Error(queryKey: string, error: Error): void;
|
|
1353
|
-
setQuery4Loading(queryKey: string): void;
|
|
1354
|
-
private setQuery4OK;
|
|
1355
|
-
setQuery4Error(queryKey: string, error: Error): void;
|
|
1356
|
-
fetchNotificationsDeltaUpdate(): Promise<void>;
|
|
1373
|
+
fetchNotificationsDeltaUpdate(signal: AbortSignal): Promise<void>;
|
|
1357
1374
|
waitUntilNotificationsLoaded(): UsablePromise<void>;
|
|
1358
1375
|
waitUntilRoomThreadsLoaded(roomId: string, query: ThreadsQuery<M> | undefined): UsablePromise<void>;
|
|
1359
|
-
fetchRoomThreadsDeltaUpdate(roomId: string): Promise<void>;
|
|
1376
|
+
fetchRoomThreadsDeltaUpdate(roomId: string, signal: AbortSignal): Promise<void>;
|
|
1360
1377
|
waitUntilUserThreadsLoaded(query: ThreadsQuery<M> | undefined): UsablePromise<void>;
|
|
1361
|
-
fetchUserThreadsDeltaUpdate(): Promise<void>;
|
|
1378
|
+
fetchUserThreadsDeltaUpdate(signal: AbortSignal): Promise<void>;
|
|
1379
|
+
waitUntilRoomVersionsLoaded(roomId: string): UsablePromise<void>;
|
|
1380
|
+
fetchRoomVersionsDeltaUpdate(roomId: string, signal: AbortSignal): Promise<void>;
|
|
1381
|
+
waitUntilRoomNotificationSettingsLoaded(roomId: string): UsablePromise<void>;
|
|
1382
|
+
refreshRoomNotificationSettings(roomId: string, signal: AbortSignal): Promise<void>;
|
|
1362
1383
|
}
|
|
1363
1384
|
|
|
1364
1385
|
/**
|
|
@@ -1479,7 +1500,7 @@ declare function useRoomInfo(roomId: string): RoomInfoAsyncResult;
|
|
|
1479
1500
|
* const { info } = useRoomInfo("room-id");
|
|
1480
1501
|
*/
|
|
1481
1502
|
declare function useRoomInfoSuspense(roomId: string): RoomInfoAsyncSuccess;
|
|
1482
|
-
declare type TypedBundle
|
|
1503
|
+
declare type TypedBundle = LiveblocksContextBundle<DU, DM>;
|
|
1483
1504
|
/**
|
|
1484
1505
|
* Returns the thread associated with a `"thread"` inbox notification.
|
|
1485
1506
|
*
|
|
@@ -1495,21 +1516,21 @@ declare type TypedBundle$1 = LiveblocksContextBundle<DU, DM>;
|
|
|
1495
1516
|
* @example
|
|
1496
1517
|
* const thread = useInboxNotificationThread("in_xxx");
|
|
1497
1518
|
*/
|
|
1498
|
-
declare const _useInboxNotificationThread: TypedBundle
|
|
1519
|
+
declare const _useInboxNotificationThread: TypedBundle["useInboxNotificationThread"];
|
|
1499
1520
|
/**
|
|
1500
1521
|
* Returns user info from a given user ID.
|
|
1501
1522
|
*
|
|
1502
1523
|
* @example
|
|
1503
1524
|
* const { user, error, isLoading } = useUser("user-id");
|
|
1504
1525
|
*/
|
|
1505
|
-
declare const _useUser: TypedBundle
|
|
1526
|
+
declare const _useUser: TypedBundle["useUser"];
|
|
1506
1527
|
/**
|
|
1507
1528
|
* Returns user info from a given user ID.
|
|
1508
1529
|
*
|
|
1509
1530
|
* @example
|
|
1510
1531
|
* const { user } = useUser("user-id");
|
|
1511
1532
|
*/
|
|
1512
|
-
declare const _useUserSuspense: TypedBundle
|
|
1533
|
+
declare const _useUserSuspense: TypedBundle["suspense"]["useUser"];
|
|
1513
1534
|
/**
|
|
1514
1535
|
* @experimental
|
|
1515
1536
|
*
|
|
@@ -1525,7 +1546,7 @@ declare const _useUserSuspense: TypedBundle$1["suspense"]["useUser"];
|
|
|
1525
1546
|
* specify the sort order to be by most recently updated first somehow.
|
|
1526
1547
|
* The final API for that is still TBD.
|
|
1527
1548
|
*/
|
|
1528
|
-
declare const _useUserThreads_experimental: TypedBundle
|
|
1549
|
+
declare const _useUserThreads_experimental: TypedBundle["useUserThreads_experimental"];
|
|
1529
1550
|
/**
|
|
1530
1551
|
* @experimental
|
|
1531
1552
|
*
|
|
@@ -1541,697 +1562,6 @@ declare const _useUserThreads_experimental: TypedBundle$1["useUserThreads_experi
|
|
|
1541
1562
|
* specify the sort order to be by most recently updated first somehow.
|
|
1542
1563
|
* The final API for that is still TBD.
|
|
1543
1564
|
*/
|
|
1544
|
-
declare const _useUserThreadsSuspense_experimental: TypedBundle
|
|
1545
|
-
|
|
1546
|
-
/**
|
|
1547
|
-
* Raw access to the React context where the RoomProvider stores the current
|
|
1548
|
-
* room. Exposed for advanced use cases only.
|
|
1549
|
-
*
|
|
1550
|
-
* @private This is a private/advanced API. Do not rely on it.
|
|
1551
|
-
*/
|
|
1552
|
-
declare const RoomContext: React$1.Context<OpaqueRoom | null>;
|
|
1553
|
-
|
|
1554
|
-
/**
|
|
1555
|
-
* Returns the current connection status for the Room, and triggers
|
|
1556
|
-
* a re-render whenever it changes. Can be used to render a status badge.
|
|
1557
|
-
*/
|
|
1558
|
-
declare function useStatus(): Status;
|
|
1559
|
-
/**
|
|
1560
|
-
* Returns the current storage status for the Room, and triggers
|
|
1561
|
-
* a re-render whenever it changes. Can be used to render a "Saving..."
|
|
1562
|
-
* indicator.
|
|
1563
|
-
*/
|
|
1564
|
-
declare function useStorageStatus(options?: UseStorageStatusOptions): StorageStatus$1;
|
|
1565
|
-
/**
|
|
1566
|
-
* @deprecated It's recommended to use `useMutation` for writing to Storage,
|
|
1567
|
-
* which will automatically batch all mutations.
|
|
1568
|
-
*
|
|
1569
|
-
* Returns a function that batches modifications made during the given function.
|
|
1570
|
-
* All the modifications are sent to other clients in a single message.
|
|
1571
|
-
* All the modifications are merged in a single history item (undo/redo).
|
|
1572
|
-
* All the subscribers are called only after the batch is over.
|
|
1573
|
-
*/
|
|
1574
|
-
declare function useBatch<T>(): (callback: () => T) => T;
|
|
1575
|
-
/**
|
|
1576
|
-
* Get informed when reconnecting to the Liveblocks servers is taking
|
|
1577
|
-
* longer than usual. This typically is a sign of a client that has lost
|
|
1578
|
-
* internet connectivity.
|
|
1579
|
-
*
|
|
1580
|
-
* This isn't problematic (because the Liveblocks client is still trying to
|
|
1581
|
-
* reconnect), but it's typically a good idea to inform users about it if
|
|
1582
|
-
* the connection takes too long to recover.
|
|
1583
|
-
*
|
|
1584
|
-
* @example
|
|
1585
|
-
* useLostConnectionListener(event => {
|
|
1586
|
-
* if (event === 'lost') {
|
|
1587
|
-
* toast.warn('Reconnecting to the Liveblocks servers is taking longer than usual...')
|
|
1588
|
-
* } else if (event === 'failed') {
|
|
1589
|
-
* toast.warn('Reconnecting to the Liveblocks servers failed.')
|
|
1590
|
-
* } else if (event === 'restored') {
|
|
1591
|
-
* toast.clear();
|
|
1592
|
-
* }
|
|
1593
|
-
* })
|
|
1594
|
-
*/
|
|
1595
|
-
declare function useLostConnectionListener(callback: (event: LostConnectionEvent) => void): void;
|
|
1596
|
-
/**
|
|
1597
|
-
* useErrorListener is a React hook that allows you to respond to potential room
|
|
1598
|
-
* connection errors.
|
|
1599
|
-
*
|
|
1600
|
-
* @example
|
|
1601
|
-
* useErrorListener(er => {
|
|
1602
|
-
* console.error(er);
|
|
1603
|
-
* })
|
|
1604
|
-
*/
|
|
1605
|
-
declare function useErrorListener(callback: (err: LiveblocksError) => void): void;
|
|
1606
|
-
/**
|
|
1607
|
-
* Returns the room.history
|
|
1608
|
-
*/
|
|
1609
|
-
declare function useHistory(): History;
|
|
1610
|
-
/**
|
|
1611
|
-
* Returns a function that undoes the last operation executed by the current
|
|
1612
|
-
* client. It does not impact operations made by other clients.
|
|
1613
|
-
*/
|
|
1614
|
-
declare function useUndo(): () => void;
|
|
1615
|
-
/**
|
|
1616
|
-
* Returns a function that redoes the last operation executed by the current
|
|
1617
|
-
* client. It does not impact operations made by other clients.
|
|
1618
|
-
*/
|
|
1619
|
-
declare function useRedo(): () => void;
|
|
1620
|
-
/**
|
|
1621
|
-
* Returns whether there are any operations to undo.
|
|
1622
|
-
*/
|
|
1623
|
-
declare function useCanUndo(): boolean;
|
|
1624
|
-
/**
|
|
1625
|
-
* Returns whether there are any operations to redo.
|
|
1626
|
-
*/
|
|
1627
|
-
declare function useCanRedo(): boolean;
|
|
1628
|
-
/**
|
|
1629
|
-
* Returns an array of connection IDs. This matches the values you'll get by
|
|
1630
|
-
* using the `useOthers()` hook.
|
|
1631
|
-
*
|
|
1632
|
-
* Roughly equivalent to:
|
|
1633
|
-
* useOthers((others) => others.map(other => other.connectionId), shallow)
|
|
1634
|
-
*
|
|
1635
|
-
* This is useful in particular to implement efficiently rendering components
|
|
1636
|
-
* for each user in the room, e.g. cursors.
|
|
1637
|
-
*
|
|
1638
|
-
* @example
|
|
1639
|
-
* const ids = useOthersConnectionIds();
|
|
1640
|
-
* // [2, 4, 7]
|
|
1641
|
-
*/
|
|
1642
|
-
declare function useOthersConnectionIds(): readonly number[];
|
|
1643
|
-
/**
|
|
1644
|
-
* @private Internal API, do not rely on it.
|
|
1645
|
-
*/
|
|
1646
|
-
declare function useCommentsErrorListener<M extends BaseMetadata$1>(callback: (error: CommentsError<M>) => void): void;
|
|
1647
|
-
/**
|
|
1648
|
-
* Returns a function that adds a comment to a thread.
|
|
1649
|
-
*
|
|
1650
|
-
* @example
|
|
1651
|
-
* const createComment = useCreateComment();
|
|
1652
|
-
* createComment({ threadId: "th_xxx", body: {} });
|
|
1653
|
-
*/
|
|
1654
|
-
declare function useCreateComment(): (options: CreateCommentOptions) => CommentData$1;
|
|
1655
|
-
/**
|
|
1656
|
-
* Returns a function that edits a comment's body.
|
|
1657
|
-
*
|
|
1658
|
-
* @example
|
|
1659
|
-
* const editComment = useEditComment()
|
|
1660
|
-
* editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
|
|
1661
|
-
*/
|
|
1662
|
-
declare function useEditComment(): (options: EditCommentOptions) => void;
|
|
1663
|
-
/**
|
|
1664
|
-
* Returns a function that deletes a comment.
|
|
1665
|
-
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
1666
|
-
*
|
|
1667
|
-
* @example
|
|
1668
|
-
* const deleteComment = useDeleteComment();
|
|
1669
|
-
* deleteComment({ threadId: "th_xxx", commentId: "cm_xxx" })
|
|
1670
|
-
*/
|
|
1671
|
-
declare function useDeleteComment(): ({ threadId, commentId }: DeleteCommentOptions) => void;
|
|
1672
|
-
/**
|
|
1673
|
-
* Returns a function that removes a reaction on a comment.
|
|
1674
|
-
*
|
|
1675
|
-
* @example
|
|
1676
|
-
* const removeReaction = useRemoveReaction();
|
|
1677
|
-
* removeReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
1678
|
-
*/
|
|
1679
|
-
declare function useRemoveReaction(): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
|
|
1680
|
-
/**
|
|
1681
|
-
* Returns a function that marks a thread as read.
|
|
1682
|
-
*
|
|
1683
|
-
* @example
|
|
1684
|
-
* const markThreadAsRead = useMarkThreadAsRead();
|
|
1685
|
-
* markThreadAsRead("th_xxx");
|
|
1686
|
-
*/
|
|
1687
|
-
declare function useMarkThreadAsRead(): (threadId: string) => void;
|
|
1688
|
-
/**
|
|
1689
|
-
* Returns a function that marks a thread as resolved.
|
|
1690
|
-
*
|
|
1691
|
-
* @example
|
|
1692
|
-
* const markThreadAsResolved = useMarkThreadAsResolved();
|
|
1693
|
-
* markThreadAsResolved("th_xxx");
|
|
1694
|
-
*/
|
|
1695
|
-
declare function useMarkThreadAsResolved(): (threadId: string) => void;
|
|
1696
|
-
/**
|
|
1697
|
-
* Returns a function that marks a thread as unresolved.
|
|
1698
|
-
*
|
|
1699
|
-
* @example
|
|
1700
|
-
* const markThreadAsUnresolved = useMarkThreadAsUnresolved();
|
|
1701
|
-
* markThreadAsUnresolved("th_xxx");
|
|
1702
|
-
*/
|
|
1703
|
-
declare function useMarkThreadAsUnresolved(): (threadId: string) => void;
|
|
1704
|
-
/**
|
|
1705
|
-
* Returns the subscription status of a thread.
|
|
1706
|
-
*
|
|
1707
|
-
* @example
|
|
1708
|
-
* const { status, unreadSince } = useThreadSubscription("th_xxx");
|
|
1709
|
-
*/
|
|
1710
|
-
declare function useThreadSubscription(threadId: string): ThreadSubscription;
|
|
1711
|
-
/**
|
|
1712
|
-
* Returns the user's notification settings for the current room
|
|
1713
|
-
* and a function to update them.
|
|
1714
|
-
*
|
|
1715
|
-
* @example
|
|
1716
|
-
* const [{ settings }, updateSettings] = useRoomNotificationSettings();
|
|
1717
|
-
*/
|
|
1718
|
-
declare function useRoomNotificationSettings(): [
|
|
1719
|
-
RoomNotificationSettingsAsyncResult,
|
|
1720
|
-
(settings: Partial<RoomNotificationSettings>) => void
|
|
1721
|
-
];
|
|
1722
|
-
/**
|
|
1723
|
-
* Returns the version data bianry for a given version
|
|
1724
|
-
*
|
|
1725
|
-
* @example
|
|
1726
|
-
* const {data} = useHistoryVersionData(versionId);
|
|
1727
|
-
*/
|
|
1728
|
-
declare function useHistoryVersionData(versionId: string): HistoryVersionDataAsyncResult;
|
|
1729
|
-
/**
|
|
1730
|
-
* Returns a function that updates the user's notification settings
|
|
1731
|
-
* for the current room.
|
|
1732
|
-
*
|
|
1733
|
-
* @example
|
|
1734
|
-
* const updateRoomNotificationSettings = useUpdateRoomNotificationSettings();
|
|
1735
|
-
* updateRoomNotificationSettings({ threads: "all" });
|
|
1736
|
-
*/
|
|
1737
|
-
declare function useUpdateRoomNotificationSettings(): (settings: Partial<RoomNotificationSettings>) => void;
|
|
1738
|
-
/**
|
|
1739
|
-
* Returns an array of connection IDs. This matches the values you'll get by
|
|
1740
|
-
* using the `useOthers()` hook.
|
|
1741
|
-
*
|
|
1742
|
-
* Roughly equivalent to:
|
|
1743
|
-
* useOthers((others) => others.map(other => other.connectionId), shallow)
|
|
1744
|
-
*
|
|
1745
|
-
* This is useful in particular to implement efficiently rendering components
|
|
1746
|
-
* for each user in the room, e.g. cursors.
|
|
1747
|
-
*
|
|
1748
|
-
* @example
|
|
1749
|
-
* const ids = useOthersConnectionIds();
|
|
1750
|
-
* // [2, 4, 7]
|
|
1751
|
-
*/
|
|
1752
|
-
declare function useOthersConnectionIdsSuspense(): readonly number[];
|
|
1753
|
-
/**
|
|
1754
|
-
* Returns the current storage status for the Room, and triggers
|
|
1755
|
-
* a re-render whenever it changes. Can be used to render a "Saving..."
|
|
1756
|
-
* indicator.
|
|
1757
|
-
*/
|
|
1758
|
-
declare function useStorageStatusSuspense(options?: UseStorageStatusOptions): StorageStatusSuccess;
|
|
1759
|
-
/**
|
|
1760
|
-
* Returns a presigned URL for an attachment by its ID.
|
|
1761
|
-
*
|
|
1762
|
-
* @example
|
|
1763
|
-
* const { url, error, isLoading } = useAttachmentUrl("at_xxx");
|
|
1764
|
-
*/
|
|
1765
|
-
declare function useAttachmentUrl(attachmentId: string): AttachmentUrlAsyncResult;
|
|
1766
|
-
/**
|
|
1767
|
-
* Returns a presigned URL for an attachment by its ID.
|
|
1768
|
-
*
|
|
1769
|
-
* @example
|
|
1770
|
-
* const { url } = useAttachmentUrl("at_xxx");
|
|
1771
|
-
*/
|
|
1772
|
-
declare function useAttachmentUrlSuspense(attachmentId: string): {
|
|
1773
|
-
readonly isLoading: false;
|
|
1774
|
-
readonly url: string;
|
|
1775
|
-
readonly error: undefined;
|
|
1776
|
-
};
|
|
1777
|
-
/**
|
|
1778
|
-
* Creates a RoomProvider and a set of typed hooks to use in your app. Note
|
|
1779
|
-
* that any RoomProvider created in this way does not need to be nested in
|
|
1780
|
-
* LiveblocksProvider, as it already has access to the client.
|
|
1781
|
-
*/
|
|
1782
|
-
declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata$1 = DM>(client: OpaqueClient): RoomContextBundle<P, S, U, E, M>;
|
|
1783
|
-
declare type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DM>;
|
|
1784
|
-
/**
|
|
1785
|
-
* Makes a Room available in the component hierarchy below.
|
|
1786
|
-
* Joins the room when the component is mounted, and automatically leaves
|
|
1787
|
-
* the room when the component is unmounted.
|
|
1788
|
-
*/
|
|
1789
|
-
declare const _RoomProvider: TypedBundle["RoomProvider"];
|
|
1790
|
-
/**
|
|
1791
|
-
* Returns a callback that lets you broadcast custom events to other users in the room
|
|
1792
|
-
*
|
|
1793
|
-
* @example
|
|
1794
|
-
* const broadcast = useBroadcastEvent();
|
|
1795
|
-
*
|
|
1796
|
-
* broadcast({ type: "CUSTOM_EVENT", data: { x: 0, y: 0 } });
|
|
1797
|
-
*/
|
|
1798
|
-
declare const _useBroadcastEvent: TypedBundle["useBroadcastEvent"];
|
|
1799
|
-
/**
|
|
1800
|
-
* Get informed when users enter or leave the room, as an event.
|
|
1801
|
-
*
|
|
1802
|
-
* @example
|
|
1803
|
-
* useOthersListener({ type, user, others }) => {
|
|
1804
|
-
* if (type === 'enter') {
|
|
1805
|
-
* // `user` has joined the room
|
|
1806
|
-
* } else if (type === 'leave') {
|
|
1807
|
-
* // `user` has left the room
|
|
1808
|
-
* }
|
|
1809
|
-
* })
|
|
1810
|
-
*/
|
|
1811
|
-
declare const _useOthersListener: TypedBundle["useOthersListener"];
|
|
1812
|
-
/**
|
|
1813
|
-
* Returns the Room of the nearest RoomProvider above in the React component
|
|
1814
|
-
* tree.
|
|
1815
|
-
*/
|
|
1816
|
-
declare const _useRoom: TypedBundle["useRoom"];
|
|
1817
|
-
/**
|
|
1818
|
-
* Returns whether the hook is called within a RoomProvider context.
|
|
1819
|
-
*
|
|
1820
|
-
* @example
|
|
1821
|
-
* const isInsideRoom = useIsInsideRoom();
|
|
1822
|
-
*/
|
|
1823
|
-
declare const _useIsInsideRoom: TypedBundle["useIsInsideRoom"];
|
|
1824
|
-
/**
|
|
1825
|
-
* Returns a function that adds a reaction from a comment.
|
|
1826
|
-
*
|
|
1827
|
-
* @example
|
|
1828
|
-
* const addReaction = useAddReaction();
|
|
1829
|
-
* addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
1830
|
-
*/
|
|
1831
|
-
declare const _useAddReaction: TypedBundle["useAddReaction"];
|
|
1832
|
-
/**
|
|
1833
|
-
* Create a callback function that lets you mutate Liveblocks state.
|
|
1834
|
-
*
|
|
1835
|
-
* The first argument that gets passed into your callback will be
|
|
1836
|
-
* a "mutation context", which exposes the following:
|
|
1837
|
-
*
|
|
1838
|
-
* - `storage` - The mutable Storage root.
|
|
1839
|
-
* You can mutate any Live structures with this, for example:
|
|
1840
|
-
* `storage.get('layers').get('layer1').set('fill', 'red')`
|
|
1841
|
-
*
|
|
1842
|
-
* - `setMyPresence` - Call this with a new (partial) Presence value.
|
|
1843
|
-
*
|
|
1844
|
-
* - `self` - A read-only version of the latest self, if you need it to
|
|
1845
|
-
* compute the next state.
|
|
1846
|
-
*
|
|
1847
|
-
* - `others` - A read-only version of the latest others list, if you
|
|
1848
|
-
* need it to compute the next state.
|
|
1849
|
-
*
|
|
1850
|
-
* useMutation is like React's useCallback, except that the first argument
|
|
1851
|
-
* that gets passed into your callback will be a "mutation context".
|
|
1852
|
-
*
|
|
1853
|
-
* If you want get access to the immutable root somewhere in your mutation,
|
|
1854
|
-
* you can use `storage.ToImmutable()`.
|
|
1855
|
-
*
|
|
1856
|
-
* @example
|
|
1857
|
-
* const fillLayers = useMutation(
|
|
1858
|
-
* ({ storage }, color: Color) => {
|
|
1859
|
-
* ...
|
|
1860
|
-
* },
|
|
1861
|
-
* [],
|
|
1862
|
-
* );
|
|
1863
|
-
*
|
|
1864
|
-
* fillLayers('red');
|
|
1865
|
-
*
|
|
1866
|
-
* const deleteLayers = useMutation(
|
|
1867
|
-
* ({ storage }) => {
|
|
1868
|
-
* ...
|
|
1869
|
-
* },
|
|
1870
|
-
* [],
|
|
1871
|
-
* );
|
|
1872
|
-
*
|
|
1873
|
-
* deleteLayers();
|
|
1874
|
-
*/
|
|
1875
|
-
declare const _useMutation: TypedBundle["useMutation"];
|
|
1876
|
-
/**
|
|
1877
|
-
* Returns a function that creates a thread with an initial comment, and optionally some metadata.
|
|
1878
|
-
*
|
|
1879
|
-
* @example
|
|
1880
|
-
* const createThread = useCreateThread();
|
|
1881
|
-
* createThread({ body: {}, metadata: {} });
|
|
1882
|
-
*/
|
|
1883
|
-
declare const _useCreateThread: TypedBundle["useCreateThread"];
|
|
1884
|
-
/**
|
|
1885
|
-
* Returns a function that deletes a thread and its associated comments.
|
|
1886
|
-
* Only the thread creator can delete a thread, it will throw otherwise.
|
|
1887
|
-
*
|
|
1888
|
-
* @example
|
|
1889
|
-
* const deleteThread = useDeleteThread();
|
|
1890
|
-
* deleteThread("th_xxx");
|
|
1891
|
-
*/
|
|
1892
|
-
declare const _useDeleteThread: TypedBundle["useDeleteThread"];
|
|
1893
|
-
/**
|
|
1894
|
-
* Returns a function that edits a thread's metadata.
|
|
1895
|
-
* To delete an existing metadata property, set its value to `null`.
|
|
1896
|
-
*
|
|
1897
|
-
* @example
|
|
1898
|
-
* const editThreadMetadata = useEditThreadMetadata();
|
|
1899
|
-
* editThreadMetadata({ threadId: "th_xxx", metadata: {} })
|
|
1900
|
-
*/
|
|
1901
|
-
declare const _useEditThreadMetadata: TypedBundle["useEditThreadMetadata"];
|
|
1902
|
-
/**
|
|
1903
|
-
* useEventListener is a React hook that allows you to respond to events broadcast
|
|
1904
|
-
* by other users in the room.
|
|
1905
|
-
*
|
|
1906
|
-
* The `user` argument will indicate which `User` instance sent the message.
|
|
1907
|
-
* This will be equal to one of the others in the room, but it can be `null`
|
|
1908
|
-
* in case this event was broadcasted from the server.
|
|
1909
|
-
*
|
|
1910
|
-
* @example
|
|
1911
|
-
* useEventListener(({ event, user, connectionId }) => {
|
|
1912
|
-
* // ^^^^ Will be Client A
|
|
1913
|
-
* if (event.type === "CUSTOM_EVENT") {
|
|
1914
|
-
* // Do something
|
|
1915
|
-
* }
|
|
1916
|
-
* });
|
|
1917
|
-
*/
|
|
1918
|
-
declare const _useEventListener: TypedBundle["useEventListener"];
|
|
1919
|
-
/**
|
|
1920
|
-
* Returns the presence of the current user of the current room, and a function to update it.
|
|
1921
|
-
* It is different from the setState function returned by the useState hook from React.
|
|
1922
|
-
* You don't need to pass the full presence object to update it.
|
|
1923
|
-
*
|
|
1924
|
-
* @example
|
|
1925
|
-
* const [myPresence, updateMyPresence] = useMyPresence();
|
|
1926
|
-
* updateMyPresence({ x: 0 });
|
|
1927
|
-
* updateMyPresence({ y: 0 });
|
|
1928
|
-
*
|
|
1929
|
-
* // At the next render, "myPresence" will be equal to "{ x: 0, y: 0 }"
|
|
1930
|
-
*/
|
|
1931
|
-
declare const _useMyPresence: TypedBundle["useMyPresence"];
|
|
1932
|
-
/**
|
|
1933
|
-
* Related to useOthers(), but optimized for selecting only "subsets" of
|
|
1934
|
-
* others. This is useful for performance reasons in particular, because
|
|
1935
|
-
* selecting only a subset of users also means limiting the number of
|
|
1936
|
-
* re-renders that will be triggered.
|
|
1937
|
-
*
|
|
1938
|
-
* @example
|
|
1939
|
-
* const avatars = useOthersMapped(user => user.info.avatar);
|
|
1940
|
-
* // ^^^^^^^
|
|
1941
|
-
* // { connectionId: number; data: string }[]
|
|
1942
|
-
*
|
|
1943
|
-
* The selector function you pass to useOthersMapped() is called an "item
|
|
1944
|
-
* selector", and operates on a single user at a time. If you provide an
|
|
1945
|
-
* (optional) "item comparison" function, it will be used to compare each
|
|
1946
|
-
* item pairwise.
|
|
1947
|
-
*
|
|
1948
|
-
* For example, to select multiple properties:
|
|
1949
|
-
*
|
|
1950
|
-
* @example
|
|
1951
|
-
* const avatarsAndCursors = useOthersMapped(
|
|
1952
|
-
* user => [u.info.avatar, u.presence.cursor],
|
|
1953
|
-
* shallow, // 👈
|
|
1954
|
-
* );
|
|
1955
|
-
*/
|
|
1956
|
-
declare const _useOthersMapped: TypedBundle["useOthersMapped"];
|
|
1957
|
-
/**
|
|
1958
|
-
* Related to useOthers(), but optimized for selecting only "subsets" of
|
|
1959
|
-
* others. This is useful for performance reasons in particular, because
|
|
1960
|
-
* selecting only a subset of users also means limiting the number of
|
|
1961
|
-
* re-renders that will be triggered.
|
|
1962
|
-
*
|
|
1963
|
-
* @example
|
|
1964
|
-
* const avatars = useOthersMapped(user => user.info.avatar);
|
|
1965
|
-
* // ^^^^^^^
|
|
1966
|
-
* // { connectionId: number; data: string }[]
|
|
1967
|
-
*
|
|
1968
|
-
* The selector function you pass to useOthersMapped() is called an "item
|
|
1969
|
-
* selector", and operates on a single user at a time. If you provide an
|
|
1970
|
-
* (optional) "item comparison" function, it will be used to compare each
|
|
1971
|
-
* item pairwise.
|
|
1972
|
-
*
|
|
1973
|
-
* For example, to select multiple properties:
|
|
1974
|
-
*
|
|
1975
|
-
* @example
|
|
1976
|
-
* const avatarsAndCursors = useOthersMapped(
|
|
1977
|
-
* user => [u.info.avatar, u.presence.cursor],
|
|
1978
|
-
* shallow, // 👈
|
|
1979
|
-
* );
|
|
1980
|
-
*/
|
|
1981
|
-
declare const _useOthersMappedSuspense: TypedBundle["suspense"]["useOthersMapped"];
|
|
1982
|
-
/**
|
|
1983
|
-
* Returns the threads within the current room.
|
|
1984
|
-
*
|
|
1985
|
-
* @example
|
|
1986
|
-
* const { threads, error, isLoading } = useThreads();
|
|
1987
|
-
*/
|
|
1988
|
-
declare const _useThreads: TypedBundle["useThreads"];
|
|
1989
|
-
/**
|
|
1990
|
-
* Returns the threads within the current room.
|
|
1991
|
-
*
|
|
1992
|
-
* @example
|
|
1993
|
-
* const { threads } = useThreads();
|
|
1994
|
-
*/
|
|
1995
|
-
declare const _useThreadsSuspense: TypedBundle["suspense"]["useThreads"];
|
|
1996
|
-
/**
|
|
1997
|
-
* (Private beta) Returns a history of versions of the current room.
|
|
1998
|
-
*
|
|
1999
|
-
* @example
|
|
2000
|
-
* const { versions, error, isLoading } = useHistoryVersions();
|
|
2001
|
-
*/
|
|
2002
|
-
declare const _useHistoryVersions: TypedBundle["useHistoryVersions"];
|
|
2003
|
-
/**
|
|
2004
|
-
* (Private beta) Returns a history of versions of the current room.
|
|
2005
|
-
*
|
|
2006
|
-
* @example
|
|
2007
|
-
* const { versions } = useHistoryVersions();
|
|
2008
|
-
*/
|
|
2009
|
-
declare const _useHistoryVersionsSuspense: TypedBundle["suspense"]["useHistoryVersions"];
|
|
2010
|
-
/**
|
|
2011
|
-
* Given a connection ID (as obtained by using `useOthersConnectionIds`), you
|
|
2012
|
-
* can call this selector deep down in your component stack to only have the
|
|
2013
|
-
* component re-render if properties for this particular user change.
|
|
2014
|
-
*
|
|
2015
|
-
* @example
|
|
2016
|
-
* // Returns only the selected values re-renders whenever that selection changes)
|
|
2017
|
-
* const { x, y } = useOther(2, user => user.presence.cursor);
|
|
2018
|
-
*/
|
|
2019
|
-
declare const _useOther: TypedBundle["useOther"];
|
|
2020
|
-
/**
|
|
2021
|
-
* Returns an array with information about all the users currently connected in
|
|
2022
|
-
* the room (except yourself).
|
|
2023
|
-
*
|
|
2024
|
-
* @example
|
|
2025
|
-
* const others = useOthers();
|
|
2026
|
-
*
|
|
2027
|
-
* // Example to map all cursors in JSX
|
|
2028
|
-
* return (
|
|
2029
|
-
* <>
|
|
2030
|
-
* {others.map((user) => {
|
|
2031
|
-
* if (user.presence.cursor == null) {
|
|
2032
|
-
* return null;
|
|
2033
|
-
* }
|
|
2034
|
-
* return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
|
|
2035
|
-
* })}
|
|
2036
|
-
* </>
|
|
2037
|
-
* )
|
|
2038
|
-
*/
|
|
2039
|
-
declare function _useOthers(): readonly User<DP, DU>[];
|
|
2040
|
-
/**
|
|
2041
|
-
* Extract arbitrary data based on all the users currently connected in the
|
|
2042
|
-
* room (except yourself).
|
|
2043
|
-
*
|
|
2044
|
-
* The selector function will get re-evaluated any time a user enters or
|
|
2045
|
-
* leaves the room, as well as whenever their presence data changes.
|
|
2046
|
-
*
|
|
2047
|
-
* The component that uses this hook will automatically re-render if your
|
|
2048
|
-
* selector function returns a different value from its previous run.
|
|
2049
|
-
*
|
|
2050
|
-
* By default `useOthers()` uses strict `===` to check for equality. Take
|
|
2051
|
-
* extra care when returning a computed object or list, for example when you
|
|
2052
|
-
* return the result of a .map() or .filter() call from the selector. In
|
|
2053
|
-
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
2054
|
-
*
|
|
2055
|
-
* @example
|
|
2056
|
-
* const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
|
|
2057
|
-
* const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
|
|
2058
|
-
* const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
|
|
2059
|
-
*
|
|
2060
|
-
*/
|
|
2061
|
-
declare function _useOthers<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
2062
|
-
/**
|
|
2063
|
-
* Given a connection ID (as obtained by using `useOthersConnectionIds`), you
|
|
2064
|
-
* can call this selector deep down in your component stack to only have the
|
|
2065
|
-
* component re-render if properties for this particular user change.
|
|
2066
|
-
*
|
|
2067
|
-
* @example
|
|
2068
|
-
* // Returns only the selected values re-renders whenever that selection changes)
|
|
2069
|
-
* const { x, y } = useOther(2, user => user.presence.cursor);
|
|
2070
|
-
*/
|
|
2071
|
-
declare const _useOtherSuspense: TypedBundle["suspense"]["useOther"];
|
|
2072
|
-
/**
|
|
2073
|
-
* Returns an array with information about all the users currently connected in
|
|
2074
|
-
* the room (except yourself).
|
|
2075
|
-
*
|
|
2076
|
-
* @example
|
|
2077
|
-
* const others = useOthers();
|
|
2078
|
-
*
|
|
2079
|
-
* // Example to map all cursors in JSX
|
|
2080
|
-
* return (
|
|
2081
|
-
* <>
|
|
2082
|
-
* {others.map((user) => {
|
|
2083
|
-
* if (user.presence.cursor == null) {
|
|
2084
|
-
* return null;
|
|
2085
|
-
* }
|
|
2086
|
-
* return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
|
|
2087
|
-
* })}
|
|
2088
|
-
* </>
|
|
2089
|
-
* )
|
|
2090
|
-
*/
|
|
2091
|
-
declare function _useOthersSuspense(): readonly User<DP, DU>[];
|
|
2092
|
-
/**
|
|
2093
|
-
* Extract arbitrary data based on all the users currently connected in the
|
|
2094
|
-
* room (except yourself).
|
|
2095
|
-
*
|
|
2096
|
-
* The selector function will get re-evaluated any time a user enters or
|
|
2097
|
-
* leaves the room, as well as whenever their presence data changes.
|
|
2098
|
-
*
|
|
2099
|
-
* The component that uses this hook will automatically re-render if your
|
|
2100
|
-
* selector function returns a different value from its previous run.
|
|
2101
|
-
*
|
|
2102
|
-
* By default `useOthers()` uses strict `===` to check for equality. Take
|
|
2103
|
-
* extra care when returning a computed object or list, for example when you
|
|
2104
|
-
* return the result of a .map() or .filter() call from the selector. In
|
|
2105
|
-
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
2106
|
-
*
|
|
2107
|
-
* @example
|
|
2108
|
-
* const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
|
|
2109
|
-
* const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
|
|
2110
|
-
* const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
|
|
2111
|
-
*
|
|
2112
|
-
*/
|
|
2113
|
-
declare function _useOthersSuspense<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
2114
|
-
/**
|
|
2115
|
-
* Extract arbitrary data from the Liveblocks Storage state, using an
|
|
2116
|
-
* arbitrary selector function.
|
|
2117
|
-
*
|
|
2118
|
-
* The selector function will get re-evaluated any time something changes in
|
|
2119
|
-
* Storage. The value returned by your selector function will also be the
|
|
2120
|
-
* value returned by the hook.
|
|
2121
|
-
*
|
|
2122
|
-
* The `root` value that gets passed to your selector function is
|
|
2123
|
-
* a immutable/readonly version of your Liveblocks storage root.
|
|
2124
|
-
*
|
|
2125
|
-
* The component that uses this hook will automatically re-render if the
|
|
2126
|
-
* returned value changes.
|
|
2127
|
-
*
|
|
2128
|
-
* By default `useStorage()` uses strict `===` to check for equality. Take
|
|
2129
|
-
* extra care when returning a computed object or list, for example when you
|
|
2130
|
-
* return the result of a .map() or .filter() call from the selector. In
|
|
2131
|
-
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
2132
|
-
*/
|
|
2133
|
-
declare const _useStorage: TypedBundle["useStorage"];
|
|
2134
|
-
/**
|
|
2135
|
-
* Extract arbitrary data from the Liveblocks Storage state, using an
|
|
2136
|
-
* arbitrary selector function.
|
|
2137
|
-
*
|
|
2138
|
-
* The selector function will get re-evaluated any time something changes in
|
|
2139
|
-
* Storage. The value returned by your selector function will also be the
|
|
2140
|
-
* value returned by the hook.
|
|
2141
|
-
*
|
|
2142
|
-
* The `root` value that gets passed to your selector function is
|
|
2143
|
-
* a immutable/readonly version of your Liveblocks storage root.
|
|
2144
|
-
*
|
|
2145
|
-
* The component that uses this hook will automatically re-render if the
|
|
2146
|
-
* returned value changes.
|
|
2147
|
-
*
|
|
2148
|
-
* By default `useStorage()` uses strict `===` to check for equality. Take
|
|
2149
|
-
* extra care when returning a computed object or list, for example when you
|
|
2150
|
-
* return the result of a .map() or .filter() call from the selector. In
|
|
2151
|
-
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
2152
|
-
*/
|
|
2153
|
-
declare const _useStorageSuspense: TypedBundle["suspense"]["useStorage"];
|
|
2154
|
-
/**
|
|
2155
|
-
* Gets the current user once it is connected to the room.
|
|
2156
|
-
*
|
|
2157
|
-
* @example
|
|
2158
|
-
* const me = useSelf();
|
|
2159
|
-
* if (me !== null) {
|
|
2160
|
-
* const { x, y } = me.presence.cursor;
|
|
2161
|
-
* }
|
|
2162
|
-
*/
|
|
2163
|
-
declare function _useSelf(): User<DP, DU> | null;
|
|
2164
|
-
/**
|
|
2165
|
-
* Extract arbitrary data based on the current user.
|
|
2166
|
-
*
|
|
2167
|
-
* The selector function will get re-evaluated any time your presence data
|
|
2168
|
-
* changes.
|
|
2169
|
-
*
|
|
2170
|
-
* The component that uses this hook will automatically re-render if your
|
|
2171
|
-
* selector function returns a different value from its previous run.
|
|
2172
|
-
*
|
|
2173
|
-
* By default `useSelf()` uses strict `===` to check for equality. Take extra
|
|
2174
|
-
* care when returning a computed object or list, for example when you return
|
|
2175
|
-
* the result of a .map() or .filter() call from the selector. In those
|
|
2176
|
-
* cases, you'll probably want to use a `shallow` comparison check.
|
|
2177
|
-
*
|
|
2178
|
-
* Will return `null` while Liveblocks isn't connected to a room yet.
|
|
2179
|
-
*
|
|
2180
|
-
* @example
|
|
2181
|
-
* const cursor = useSelf(me => me.presence.cursor);
|
|
2182
|
-
* if (cursor !== null) {
|
|
2183
|
-
* const { x, y } = cursor;
|
|
2184
|
-
* }
|
|
2185
|
-
*
|
|
2186
|
-
*/
|
|
2187
|
-
declare function _useSelf<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T | null;
|
|
2188
|
-
/**
|
|
2189
|
-
* Gets the current user once it is connected to the room.
|
|
2190
|
-
*
|
|
2191
|
-
* @example
|
|
2192
|
-
* const me = useSelf();
|
|
2193
|
-
* const { x, y } = me.presence.cursor;
|
|
2194
|
-
*/
|
|
2195
|
-
declare function _useSelfSuspense(): User<DP, DU>;
|
|
2196
|
-
/**
|
|
2197
|
-
* Extract arbitrary data based on the current user.
|
|
2198
|
-
*
|
|
2199
|
-
* The selector function will get re-evaluated any time your presence data
|
|
2200
|
-
* changes.
|
|
2201
|
-
*
|
|
2202
|
-
* The component that uses this hook will automatically re-render if your
|
|
2203
|
-
* selector function returns a different value from its previous run.
|
|
2204
|
-
*
|
|
2205
|
-
* By default `useSelf()` uses strict `===` to check for equality. Take extra
|
|
2206
|
-
* care when returning a computed object or list, for example when you return
|
|
2207
|
-
* the result of a .map() or .filter() call from the selector. In those
|
|
2208
|
-
* cases, you'll probably want to use a `shallow` comparison check.
|
|
2209
|
-
*
|
|
2210
|
-
* @example
|
|
2211
|
-
* const cursor = useSelf(me => me.presence.cursor);
|
|
2212
|
-
* const { x, y } = cursor;
|
|
2213
|
-
*
|
|
2214
|
-
*/
|
|
2215
|
-
declare function _useSelfSuspense<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
2216
|
-
/**
|
|
2217
|
-
* Returns the mutable (!) Storage root. This hook exists for
|
|
2218
|
-
* backward-compatible reasons.
|
|
2219
|
-
*
|
|
2220
|
-
* @example
|
|
2221
|
-
* const [root] = useStorageRoot();
|
|
2222
|
-
*/
|
|
2223
|
-
declare const _useStorageRoot: TypedBundle["useStorageRoot"];
|
|
2224
|
-
/**
|
|
2225
|
-
* useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
|
|
2226
|
-
* 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.
|
|
2227
|
-
*
|
|
2228
|
-
* @example
|
|
2229
|
-
* const updateMyPresence = useUpdateMyPresence();
|
|
2230
|
-
* updateMyPresence({ x: 0 });
|
|
2231
|
-
* updateMyPresence({ y: 0 });
|
|
2232
|
-
*
|
|
2233
|
-
* // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
|
|
2234
|
-
*/
|
|
2235
|
-
declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
|
|
1565
|
+
declare const _useUserThreadsSuspense_experimental: TypedBundle["suspense"]["useUserThreads_experimental"];
|
|
2236
1566
|
|
|
2237
|
-
export {
|
|
1567
|
+
export { type AttachmentUrlAsyncResult as A, CreateThreadError as C, type DeleteCommentOptions as D, type EditCommentOptions as E, type HistoryVersionDataAsyncResult as H, LiveblocksProvider as L, type MutationContext as M, type RoomContextBundle as R, type StorageStatusSuccess as S, type ThreadSubscription as T, type UseStorageStatusOptions as U, _useInboxNotificationThread as _, type CommentsError as a, type CreateCommentOptions as b, type CommentReactionOptions as c, type UseThreadsOptions as d, ClientContext as e, createLiveblocksContext as f, getUmbrellaStoreForClient as g, useMarkAllInboxNotificationsAsRead as h, useMarkInboxNotificationAsRead as i, useDeleteAllInboxNotifications as j, useDeleteInboxNotification as k, useInboxNotifications as l, _useUserThreads_experimental as m, useRoomInfo as n, useUnreadInboxNotificationsCount as o, _useUser as p, useInboxNotificationsSuspense as q, useRoomInfoSuspense as r, useUnreadInboxNotificationsCountSuspense as s, _useUserSuspense as t, useClient as u, _useUserThreadsSuspense_experimental as v };
|