@liveblocks/react 2.15.2 → 2.16.0-toolbars2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_private.d.mts +4 -4
- package/dist/_private.d.ts +4 -4
- package/dist/_private.js +5 -5
- package/dist/_private.js.map +1 -1
- package/dist/_private.mjs +1 -1
- package/dist/{chunk-Z5VZOX7K.mjs → chunk-3SVPWXCC.mjs} +2 -2
- package/dist/{chunk-EEYUKRIA.mjs → chunk-FQKGWA7O.mjs} +13 -30
- package/dist/chunk-FQKGWA7O.mjs.map +1 -0
- package/dist/{chunk-3KHBALYA.js → chunk-QN6HNYMJ.js} +2 -2
- package/dist/chunk-QN6HNYMJ.js.map +1 -0
- package/dist/{chunk-DEAPV4GE.js → chunk-VJYVOAD5.js} +13 -30
- package/dist/chunk-VJYVOAD5.js.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{room-0rxzsE_0.d.mts → room-ne1TCZyH.d.mts} +104 -104
- package/dist/{room-0rxzsE_0.d.ts → room-ne1TCZyH.d.ts} +104 -104
- package/dist/suspense.d.mts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +4 -4
- package/dist/suspense.js.map +1 -1
- package/dist/suspense.mjs +2 -2
- package/package.json +5 -5
- package/dist/chunk-3KHBALYA.js.map +0 -1
- package/dist/chunk-DEAPV4GE.js.map +0 -1
- package/dist/chunk-EEYUKRIA.mjs.map +0 -1
- /package/dist/{chunk-Z5VZOX7K.mjs.map → chunk-3SVPWXCC.mjs.map} +0 -0
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import * as _liveblocks_core from '@liveblocks/core';
|
|
2
|
-
import { BaseMetadata, CommentBody, Patchable, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, Resolve, CommentAttachment, PartialUnless, InboxNotificationData, ToImmutable, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, SyncStatus, LiveblocksError, RoomEventMessage, CommentData, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, DerivedSignal, DefaultMap, OpaqueClient, CommentUserReaction, InboxNotificationDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DM, OpaqueRoom, TextEditorType, IYjsProvider, DP, DS, DE } from '@liveblocks/core';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
1
|
import * as react from 'react';
|
|
5
2
|
import { Context, PropsWithChildren, ReactNode } from 'react';
|
|
6
|
-
import { JsonObject, LsonObject, BaseUserMeta,
|
|
3
|
+
import { JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata, Room, LiveObject, User, RoomNotificationSettings, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, Client as Client$1, ClientOptions, StorageStatus as StorageStatus$1, ThreadData as ThreadData$1, CommentData as CommentData$1 } from '@liveblocks/client';
|
|
4
|
+
import * as _liveblocks_core from '@liveblocks/core';
|
|
5
|
+
import { OpaqueRoom, BaseMetadata as BaseMetadata$1, CommentBody, Patchable, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, Resolve, CommentAttachment, PartialUnless, InboxNotificationData, ToImmutable, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, SyncStatus, LiveblocksError, RoomEventMessage, CommentData, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, DerivedSignal, DefaultMap, OpaqueClient, CommentUserReaction, InboxNotificationDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DM, TextEditorType, IYjsProvider, DP, DS, DE } from '@liveblocks/core';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Raw access to the React context where the RoomProvider stores the current
|
|
10
|
+
* room. Exposed for advanced use cases only.
|
|
11
|
+
*
|
|
12
|
+
* @private This is a private/advanced API. Do not rely on it.
|
|
13
|
+
*/
|
|
14
|
+
declare const RoomContext: react.Context<OpaqueRoom | null>;
|
|
15
|
+
/** @private */
|
|
16
|
+
declare function useRoomOrNull<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata>(): Room<P, S, U, E, M> | null;
|
|
7
17
|
|
|
8
18
|
/**
|
|
9
19
|
* @private Internal API, do not rely on it.
|
|
10
20
|
*/
|
|
11
|
-
declare class CreateThreadError<M extends BaseMetadata> extends Error {
|
|
21
|
+
declare class CreateThreadError<M extends BaseMetadata$1> extends Error {
|
|
12
22
|
cause: Error;
|
|
13
23
|
context: {
|
|
14
24
|
roomId: string;
|
|
@@ -28,7 +38,7 @@ declare class CreateThreadError<M extends BaseMetadata> extends Error {
|
|
|
28
38
|
/**
|
|
29
39
|
* @private Internal API, do not rely on it.
|
|
30
40
|
*/
|
|
31
|
-
declare class EditThreadMetadataError<M extends BaseMetadata> extends Error {
|
|
41
|
+
declare class EditThreadMetadataError<M extends BaseMetadata$1> extends Error {
|
|
32
42
|
cause: Error;
|
|
33
43
|
context: {
|
|
34
44
|
roomId: string;
|
|
@@ -120,9 +130,9 @@ declare class UpdateNotificationSettingsError extends Error {
|
|
|
120
130
|
/**
|
|
121
131
|
* @private Internal API, do not rely on it.
|
|
122
132
|
*/
|
|
123
|
-
|
|
133
|
+
type CommentsError<M extends BaseMetadata$1> = CreateThreadError<M> | EditThreadMetadataError<M> | CreateCommentError | EditCommentError | DeleteCommentError | MarkInboxNotificationAsReadError | UpdateNotificationSettingsError;
|
|
124
134
|
|
|
125
|
-
|
|
135
|
+
type UseSyncStatusOptions = {
|
|
126
136
|
/**
|
|
127
137
|
* When setting smooth, the hook will not update immediately as status
|
|
128
138
|
* changes. This is because in typical applications, these states can change
|
|
@@ -131,9 +141,9 @@ declare type UseSyncStatusOptions = {
|
|
|
131
141
|
*/
|
|
132
142
|
smooth?: boolean;
|
|
133
143
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
144
|
+
type UseStorageStatusOptions = UseSyncStatusOptions;
|
|
145
|
+
type StorageStatusSuccess = Exclude<StorageStatus, "not-loaded" | "loading">;
|
|
146
|
+
type ThreadsQuery<M extends BaseMetadata$1> = {
|
|
137
147
|
/**
|
|
138
148
|
* Whether to only return threads marked as resolved or unresolved. If not provided,
|
|
139
149
|
* all threads will be returned.
|
|
@@ -145,14 +155,14 @@ declare type ThreadsQuery<M extends BaseMetadata> = {
|
|
|
145
155
|
*/
|
|
146
156
|
metadata?: Partial<QueryMetadata<M>>;
|
|
147
157
|
};
|
|
148
|
-
|
|
158
|
+
type UseUserThreadsOptions<M extends BaseMetadata$1> = {
|
|
149
159
|
/**
|
|
150
160
|
* The query (including metadata) to filter the threads by. If provided, only threads
|
|
151
161
|
* that match the query will be returned. If not provided, all threads will be returned.
|
|
152
162
|
*/
|
|
153
163
|
query?: ThreadsQuery<M>;
|
|
154
164
|
};
|
|
155
|
-
|
|
165
|
+
type UseThreadsOptions<M extends BaseMetadata$1> = {
|
|
156
166
|
/**
|
|
157
167
|
* The query (including metadata) to filter the threads by. If provided, only threads
|
|
158
168
|
* that match the query will be returned. If not provided, all threads will be returned.
|
|
@@ -167,68 +177,68 @@ declare type UseThreadsOptions<M extends BaseMetadata> = {
|
|
|
167
177
|
*/
|
|
168
178
|
scrollOnLoad?: boolean;
|
|
169
179
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
type UserAsyncResult<T> = AsyncResult<T, "user">;
|
|
181
|
+
type UserAsyncSuccess<T> = AsyncSuccess<T, "user">;
|
|
182
|
+
type RoomInfoAsyncResult = AsyncResult<DRI, "info">;
|
|
183
|
+
type RoomInfoAsyncSuccess = AsyncSuccess<DRI, "info">;
|
|
184
|
+
type AttachmentUrlAsyncResult = AsyncResult<string, "url">;
|
|
185
|
+
type AttachmentUrlAsyncSuccess = AsyncSuccess<string, "url">;
|
|
186
|
+
type CreateThreadOptions<M extends BaseMetadata$1> = Resolve<{
|
|
177
187
|
body: CommentBody;
|
|
178
188
|
attachments?: CommentAttachment[];
|
|
179
189
|
} & PartialUnless<M, {
|
|
180
190
|
metadata: M;
|
|
181
191
|
}>>;
|
|
182
|
-
|
|
192
|
+
type EditThreadMetadataOptions<M extends BaseMetadata$1> = {
|
|
183
193
|
threadId: string;
|
|
184
194
|
metadata: Patchable<M>;
|
|
185
195
|
};
|
|
186
|
-
|
|
196
|
+
type CreateCommentOptions = {
|
|
187
197
|
threadId: string;
|
|
188
198
|
body: CommentBody;
|
|
189
199
|
attachments?: CommentAttachment[];
|
|
190
200
|
};
|
|
191
|
-
|
|
201
|
+
type EditCommentOptions = {
|
|
192
202
|
threadId: string;
|
|
193
203
|
commentId: string;
|
|
194
204
|
body: CommentBody;
|
|
195
205
|
attachments?: CommentAttachment[];
|
|
196
206
|
};
|
|
197
|
-
|
|
207
|
+
type DeleteCommentOptions = {
|
|
198
208
|
threadId: string;
|
|
199
209
|
commentId: string;
|
|
200
210
|
};
|
|
201
|
-
|
|
211
|
+
type CommentReactionOptions = {
|
|
202
212
|
threadId: string;
|
|
203
213
|
commentId: string;
|
|
204
214
|
emoji: string;
|
|
205
215
|
};
|
|
206
|
-
|
|
216
|
+
type NoPaginationFields = {
|
|
207
217
|
hasFetchedAll?: never;
|
|
208
218
|
isFetchingMore?: never;
|
|
209
219
|
fetchMore?: never;
|
|
210
220
|
fetchMoreError?: never;
|
|
211
221
|
};
|
|
212
|
-
|
|
222
|
+
type PaginationFields = {
|
|
213
223
|
hasFetchedAll: boolean;
|
|
214
224
|
isFetchingMore: boolean;
|
|
215
225
|
fetchMore: () => void;
|
|
216
226
|
fetchMoreError?: Error;
|
|
217
227
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
type PagedAsyncSuccess<T, F extends string> = Resolve<AsyncSuccess<T, F> & PaginationFields>;
|
|
229
|
+
type PagedAsyncResult<T, F extends string> = Resolve<AsyncLoading<F> & NoPaginationFields> | Resolve<AsyncError<F> & NoPaginationFields> | PagedAsyncSuccess<T, F>;
|
|
230
|
+
type ThreadsAsyncSuccess<M extends BaseMetadata$1> = PagedAsyncSuccess<ThreadData<M>[], "threads">;
|
|
231
|
+
type ThreadsAsyncResult<M extends BaseMetadata$1> = PagedAsyncResult<ThreadData<M>[], "threads">;
|
|
232
|
+
type InboxNotificationsAsyncSuccess = PagedAsyncSuccess<InboxNotificationData[], "inboxNotifications">;
|
|
233
|
+
type InboxNotificationsAsyncResult = PagedAsyncResult<InboxNotificationData[], "inboxNotifications">;
|
|
234
|
+
type UnreadInboxNotificationsCountAsyncSuccess = AsyncSuccess<number, "count">;
|
|
235
|
+
type UnreadInboxNotificationsCountAsyncResult = AsyncResult<number, "count">;
|
|
236
|
+
type RoomNotificationSettingsAsyncSuccess = AsyncSuccess<RoomNotificationSettings, "settings">;
|
|
237
|
+
type RoomNotificationSettingsAsyncResult = AsyncResult<RoomNotificationSettings, "settings">;
|
|
238
|
+
type HistoryVersionDataAsyncResult = AsyncResult<Uint8Array>;
|
|
239
|
+
type HistoryVersionsAsyncSuccess = AsyncSuccess<HistoryVersion[], "versions">;
|
|
240
|
+
type HistoryVersionsAsyncResult = AsyncResult<HistoryVersion[], "versions">;
|
|
241
|
+
type RoomProviderProps<P extends JsonObject, S extends LsonObject> = Resolve<{
|
|
232
242
|
/**
|
|
233
243
|
* The id of the room you want to connect to
|
|
234
244
|
*/
|
|
@@ -259,8 +269,8 @@ declare type RoomProviderProps<P extends JsonObject, S extends LsonObject> = Res
|
|
|
259
269
|
* For any function type, returns a similar function type, but without the
|
|
260
270
|
* first argument.
|
|
261
271
|
*/
|
|
262
|
-
|
|
263
|
-
|
|
272
|
+
type OmitFirstArg<F> = F extends (first: any, ...rest: infer A) => infer R ? (...args: A) => R : never;
|
|
273
|
+
type MutationContext<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta> = {
|
|
264
274
|
storage: LiveObject<S>;
|
|
265
275
|
self: User<P, U>;
|
|
266
276
|
others: readonly User<P, U>[];
|
|
@@ -268,7 +278,7 @@ declare type MutationContext<P extends JsonObject, S extends LsonObject, U exten
|
|
|
268
278
|
addToHistory: boolean;
|
|
269
279
|
}) => void;
|
|
270
280
|
};
|
|
271
|
-
|
|
281
|
+
type ThreadSubscription = {
|
|
272
282
|
status: "not-subscribed";
|
|
273
283
|
unreadSince?: never;
|
|
274
284
|
} | {
|
|
@@ -278,7 +288,7 @@ declare type ThreadSubscription = {
|
|
|
278
288
|
status: "subscribed";
|
|
279
289
|
unreadSince: Date;
|
|
280
290
|
};
|
|
281
|
-
|
|
291
|
+
type SharedContextBundle<U extends BaseUserMeta> = {
|
|
282
292
|
classic: {
|
|
283
293
|
/**
|
|
284
294
|
* Obtains a reference to the current Liveblocks client.
|
|
@@ -359,7 +369,7 @@ declare type SharedContextBundle<U extends BaseUserMeta> = {
|
|
|
359
369
|
/**
|
|
360
370
|
* Properties that are the same in RoomContext and RoomContext["suspense"].
|
|
361
371
|
*/
|
|
362
|
-
|
|
372
|
+
type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata$1> = {
|
|
363
373
|
/**
|
|
364
374
|
* You normally don't need to directly interact with the RoomContext, but
|
|
365
375
|
* it can be necessary if you're building an advanced app where you need to
|
|
@@ -775,10 +785,10 @@ declare type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject,
|
|
|
775
785
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
776
786
|
* will probably happen if you do.
|
|
777
787
|
*/
|
|
778
|
-
|
|
779
|
-
useCommentsErrorListener<M extends BaseMetadata>(callback: (err: CommentsError<M>) => void): void;
|
|
788
|
+
type PrivateRoomContextApi = {
|
|
789
|
+
useCommentsErrorListener<M extends BaseMetadata$1>(callback: (err: CommentsError<M>) => void): void;
|
|
780
790
|
};
|
|
781
|
-
|
|
791
|
+
type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata$1> = Resolve<RoomContextBundleCommon<P, S, U, E, M> & SharedContextBundle<U>["classic"] & {
|
|
782
792
|
/**
|
|
783
793
|
* Returns the current storage status for the Room, and triggers
|
|
784
794
|
* a re-render whenever it changes. Can be used to render a "Saving..."
|
|
@@ -974,7 +984,7 @@ declare type RoomContextBundle<P extends JsonObject, S extends LsonObject, U ext
|
|
|
974
984
|
/**
|
|
975
985
|
* Properties that are the same in LiveblocksContext and LiveblocksContext["suspense"].
|
|
976
986
|
*/
|
|
977
|
-
|
|
987
|
+
type LiveblocksContextBundleCommon<M extends BaseMetadata$1> = {
|
|
978
988
|
/**
|
|
979
989
|
* Makes Liveblocks features outside of rooms (e.g. Notifications) available
|
|
980
990
|
* in the component hierarchy below.
|
|
@@ -1040,7 +1050,7 @@ declare type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
|
|
|
1040
1050
|
*/
|
|
1041
1051
|
useSyncStatus(options?: UseSyncStatusOptions): SyncStatus;
|
|
1042
1052
|
};
|
|
1043
|
-
|
|
1053
|
+
type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata$1> = Resolve<LiveblocksContextBundleCommon<M> & SharedContextBundle<U>["classic"] & {
|
|
1044
1054
|
/**
|
|
1045
1055
|
* Returns the inbox notifications for the current user.
|
|
1046
1056
|
*
|
|
@@ -1087,7 +1097,7 @@ declare type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetad
|
|
|
1087
1097
|
}>;
|
|
1088
1098
|
}>;
|
|
1089
1099
|
|
|
1090
|
-
|
|
1100
|
+
type ReadonlyThreadDB<M extends BaseMetadata$1> = Omit<ThreadDB<M>, "upsert" | "delete" | "signal">;
|
|
1091
1101
|
/**
|
|
1092
1102
|
* This class implements a lightweight, in-memory, "database" for all Thread
|
|
1093
1103
|
* instances.
|
|
@@ -1105,7 +1115,7 @@ declare type ReadonlyThreadDB<M extends BaseMetadata> = Omit<ThreadDB<M>, "upser
|
|
|
1105
1115
|
* optimistic updates without losing the original thread contents.
|
|
1106
1116
|
*
|
|
1107
1117
|
*/
|
|
1108
|
-
declare class ThreadDB<M extends BaseMetadata> {
|
|
1118
|
+
declare class ThreadDB<M extends BaseMetadata$1> {
|
|
1109
1119
|
#private;
|
|
1110
1120
|
readonly signal: MutableSignal<this>;
|
|
1111
1121
|
constructor();
|
|
@@ -1138,50 +1148,50 @@ declare class ThreadDB<M extends BaseMetadata> {
|
|
|
1138
1148
|
findMany(roomId: string | undefined, query: ThreadsQuery<M>, direction: "asc" | "desc"): ThreadData<M>[];
|
|
1139
1149
|
}
|
|
1140
1150
|
|
|
1141
|
-
|
|
1142
|
-
|
|
1151
|
+
type OptimisticUpdate<M extends BaseMetadata$1> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
1152
|
+
type CreateThreadOptimisticUpdate<M extends BaseMetadata$1> = {
|
|
1143
1153
|
type: "create-thread";
|
|
1144
1154
|
id: string;
|
|
1145
1155
|
roomId: string;
|
|
1146
1156
|
thread: ThreadData<M>;
|
|
1147
1157
|
};
|
|
1148
|
-
|
|
1158
|
+
type DeleteThreadOptimisticUpdate = {
|
|
1149
1159
|
type: "delete-thread";
|
|
1150
1160
|
id: string;
|
|
1151
1161
|
roomId: string;
|
|
1152
1162
|
threadId: string;
|
|
1153
1163
|
deletedAt: Date;
|
|
1154
1164
|
};
|
|
1155
|
-
|
|
1165
|
+
type EditThreadMetadataOptimisticUpdate<M extends BaseMetadata$1> = {
|
|
1156
1166
|
type: "edit-thread-metadata";
|
|
1157
1167
|
id: string;
|
|
1158
1168
|
threadId: string;
|
|
1159
1169
|
metadata: Resolve<Patchable<M>>;
|
|
1160
1170
|
updatedAt: Date;
|
|
1161
1171
|
};
|
|
1162
|
-
|
|
1172
|
+
type MarkThreadAsResolvedOptimisticUpdate = {
|
|
1163
1173
|
type: "mark-thread-as-resolved";
|
|
1164
1174
|
id: string;
|
|
1165
1175
|
threadId: string;
|
|
1166
1176
|
updatedAt: Date;
|
|
1167
1177
|
};
|
|
1168
|
-
|
|
1178
|
+
type MarkThreadAsUnresolvedOptimisticUpdate = {
|
|
1169
1179
|
type: "mark-thread-as-unresolved";
|
|
1170
1180
|
id: string;
|
|
1171
1181
|
threadId: string;
|
|
1172
1182
|
updatedAt: Date;
|
|
1173
1183
|
};
|
|
1174
|
-
|
|
1184
|
+
type CreateCommentOptimisticUpdate = {
|
|
1175
1185
|
type: "create-comment";
|
|
1176
1186
|
id: string;
|
|
1177
1187
|
comment: CommentData;
|
|
1178
1188
|
};
|
|
1179
|
-
|
|
1189
|
+
type EditCommentOptimisticUpdate = {
|
|
1180
1190
|
type: "edit-comment";
|
|
1181
1191
|
id: string;
|
|
1182
1192
|
comment: CommentData;
|
|
1183
1193
|
};
|
|
1184
|
-
|
|
1194
|
+
type DeleteCommentOptimisticUpdate = {
|
|
1185
1195
|
type: "delete-comment";
|
|
1186
1196
|
id: string;
|
|
1187
1197
|
roomId: string;
|
|
@@ -1189,14 +1199,14 @@ declare type DeleteCommentOptimisticUpdate = {
|
|
|
1189
1199
|
deletedAt: Date;
|
|
1190
1200
|
commentId: string;
|
|
1191
1201
|
};
|
|
1192
|
-
|
|
1202
|
+
type AddReactionOptimisticUpdate = {
|
|
1193
1203
|
type: "add-reaction";
|
|
1194
1204
|
id: string;
|
|
1195
1205
|
threadId: string;
|
|
1196
1206
|
commentId: string;
|
|
1197
1207
|
reaction: CommentUserReaction;
|
|
1198
1208
|
};
|
|
1199
|
-
|
|
1209
|
+
type RemoveReactionOptimisticUpdate = {
|
|
1200
1210
|
type: "remove-reaction";
|
|
1201
1211
|
id: string;
|
|
1202
1212
|
threadId: string;
|
|
@@ -1205,29 +1215,29 @@ declare type RemoveReactionOptimisticUpdate = {
|
|
|
1205
1215
|
userId: string;
|
|
1206
1216
|
removedAt: Date;
|
|
1207
1217
|
};
|
|
1208
|
-
|
|
1218
|
+
type MarkInboxNotificationAsReadOptimisticUpdate = {
|
|
1209
1219
|
type: "mark-inbox-notification-as-read";
|
|
1210
1220
|
id: string;
|
|
1211
1221
|
inboxNotificationId: string;
|
|
1212
1222
|
readAt: Date;
|
|
1213
1223
|
};
|
|
1214
|
-
|
|
1224
|
+
type MarkAllInboxNotificationsAsReadOptimisticUpdate = {
|
|
1215
1225
|
type: "mark-all-inbox-notifications-as-read";
|
|
1216
1226
|
id: string;
|
|
1217
1227
|
readAt: Date;
|
|
1218
1228
|
};
|
|
1219
|
-
|
|
1229
|
+
type DeleteInboxNotificationOptimisticUpdate = {
|
|
1220
1230
|
type: "delete-inbox-notification";
|
|
1221
1231
|
id: string;
|
|
1222
1232
|
inboxNotificationId: string;
|
|
1223
1233
|
deletedAt: Date;
|
|
1224
1234
|
};
|
|
1225
|
-
|
|
1235
|
+
type DeleteAllInboxNotificationsOptimisticUpdate = {
|
|
1226
1236
|
type: "delete-all-inbox-notifications";
|
|
1227
1237
|
id: string;
|
|
1228
1238
|
deletedAt: Date;
|
|
1229
1239
|
};
|
|
1230
|
-
|
|
1240
|
+
type UpdateNotificationSettingsOptimisticUpdate = {
|
|
1231
1241
|
type: "update-notification-settings";
|
|
1232
1242
|
id: string;
|
|
1233
1243
|
roomId: string;
|
|
@@ -1238,7 +1248,7 @@ declare type UpdateNotificationSettingsOptimisticUpdate = {
|
|
|
1238
1248
|
* field, indicating the status of the promise.
|
|
1239
1249
|
* This is compatible with React's `use()` promises, hence the name.
|
|
1240
1250
|
*/
|
|
1241
|
-
|
|
1251
|
+
type UsablePromise<T> = Promise<T> & ({
|
|
1242
1252
|
status: "pending";
|
|
1243
1253
|
} | {
|
|
1244
1254
|
status: "rejected";
|
|
@@ -1247,17 +1257,17 @@ declare type UsablePromise<T> = Promise<T> & ({
|
|
|
1247
1257
|
status: "fulfilled";
|
|
1248
1258
|
value: T;
|
|
1249
1259
|
});
|
|
1250
|
-
|
|
1260
|
+
type LoadableResource<T> = {
|
|
1251
1261
|
signal: ISignal<T>;
|
|
1252
1262
|
waitUntilLoaded: () => UsablePromise<void>;
|
|
1253
1263
|
};
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1264
|
+
type RoomId = string;
|
|
1265
|
+
type UserQueryKey = string;
|
|
1266
|
+
type RoomQueryKey = string;
|
|
1257
1267
|
/**
|
|
1258
1268
|
* A lookup table (LUT) for all the inbox notifications.
|
|
1259
1269
|
*/
|
|
1260
|
-
|
|
1270
|
+
type NotificationsLUT = Map<string, InboxNotificationData>;
|
|
1261
1271
|
/**
|
|
1262
1272
|
* Notification settings by room ID.
|
|
1263
1273
|
* e.g. { 'room-abc': { threads: "all" },
|
|
@@ -1265,10 +1275,10 @@ declare type NotificationsLUT = Map<string, InboxNotificationData>;
|
|
|
1265
1275
|
* 'room-xyz': { threads: "none" },
|
|
1266
1276
|
* }
|
|
1267
1277
|
*/
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1278
|
+
type SettingsByRoomId = Record<RoomId, RoomNotificationSettings$1>;
|
|
1279
|
+
type PermissionHintsLUT = DefaultMap<RoomId, Set<Permission>>;
|
|
1280
|
+
type CleanThreadifications<M extends BaseMetadata$1> = CleanThreads<M> & CleanNotifications;
|
|
1281
|
+
type CleanThreads<M extends BaseMetadata$1> = {
|
|
1272
1282
|
/**
|
|
1273
1283
|
* Keep track of loading and error status of all the queries made by the client.
|
|
1274
1284
|
* e.g. 'room-abc-{"color":"red"}' - ok
|
|
@@ -1276,7 +1286,7 @@ declare type CleanThreads<M extends BaseMetadata> = {
|
|
|
1276
1286
|
*/
|
|
1277
1287
|
threadsDB: ReadonlyThreadDB<M>;
|
|
1278
1288
|
};
|
|
1279
|
-
|
|
1289
|
+
type CleanNotifications = {
|
|
1280
1290
|
/**
|
|
1281
1291
|
* All inbox notifications in a sorted array, optimistic updates applied.
|
|
1282
1292
|
*/
|
|
@@ -1297,7 +1307,7 @@ declare function createStore_forNotifications(): {
|
|
|
1297
1307
|
updateAssociatedNotification: (newComment: CommentData) => void;
|
|
1298
1308
|
upsert: (notification: InboxNotificationData) => void;
|
|
1299
1309
|
};
|
|
1300
|
-
declare function createStore_forRoomNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
|
|
1310
|
+
declare function createStore_forRoomNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata$1>[]>): {
|
|
1301
1311
|
signal: DerivedSignal<SettingsByRoomId>;
|
|
1302
1312
|
update: (roomId: string, settings: RoomNotificationSettings$1) => void;
|
|
1303
1313
|
};
|
|
@@ -1313,12 +1323,12 @@ declare function createStore_forPermissionHints(): {
|
|
|
1313
1323
|
signal: ISignal<PermissionHintsLUT>;
|
|
1314
1324
|
update: (newHints: Record<string, Permission[]>) => void;
|
|
1315
1325
|
};
|
|
1316
|
-
declare function createStore_forOptimistic<M extends BaseMetadata>(client: Client<BaseUserMeta$1, M>): {
|
|
1326
|
+
declare function createStore_forOptimistic<M extends BaseMetadata$1>(client: Client<BaseUserMeta$1, M>): {
|
|
1317
1327
|
signal: ISignal<readonly OptimisticUpdate<M>[]>;
|
|
1318
1328
|
add: (optimisticUpdate: DistributiveOmit<OptimisticUpdate<M>, "id">) => string;
|
|
1319
1329
|
remove: (optimisticId: string) => void;
|
|
1320
1330
|
};
|
|
1321
|
-
declare class UmbrellaStore<M extends BaseMetadata> {
|
|
1331
|
+
declare class UmbrellaStore<M extends BaseMetadata$1> {
|
|
1322
1332
|
#private;
|
|
1323
1333
|
readonly threads: ThreadDB<M>;
|
|
1324
1334
|
readonly notifications: ReturnType<typeof createStore_forNotifications>;
|
|
@@ -1406,15 +1416,15 @@ declare const ClientContext: react.Context<OpaqueClient | null>;
|
|
|
1406
1416
|
*
|
|
1407
1417
|
* @private
|
|
1408
1418
|
*/
|
|
1409
|
-
declare function getUmbrellaStoreForClient<M extends BaseMetadata
|
|
1419
|
+
declare function getUmbrellaStoreForClient<M extends BaseMetadata>(client: OpaqueClient): UmbrellaStore<M>;
|
|
1410
1420
|
/**
|
|
1411
1421
|
* @private This is an internal API.
|
|
1412
1422
|
*/
|
|
1413
|
-
declare function useClientOrNull<U extends BaseUserMeta>(): Client$1<U
|
|
1423
|
+
declare function useClientOrNull<U extends BaseUserMeta>(): Client$1<U> | null;
|
|
1414
1424
|
/**
|
|
1415
1425
|
* Obtains a reference to the current Liveblocks client.
|
|
1416
1426
|
*/
|
|
1417
|
-
declare function useClient<U extends BaseUserMeta>(): Client$1<U
|
|
1427
|
+
declare function useClient<U extends BaseUserMeta>(): Client$1<U>;
|
|
1418
1428
|
/**
|
|
1419
1429
|
* Sets up a client for connecting to Liveblocks, and is the recommended way to do
|
|
1420
1430
|
* this for React apps. You must define either `authEndpoint` or `publicApiKey`.
|
|
@@ -1429,7 +1439,7 @@ declare function LiveblocksProvider<U extends BaseUserMeta = DU>(props: PropsWit
|
|
|
1429
1439
|
* LiveblocksProvider created in this way takes no props, because it uses
|
|
1430
1440
|
* settings from the given client instead.
|
|
1431
1441
|
*/
|
|
1432
|
-
declare function createLiveblocksContext<U extends BaseUserMeta = DU, M extends BaseMetadata
|
|
1442
|
+
declare function createLiveblocksContext<U extends BaseUserMeta = DU, M extends BaseMetadata = DM>(client: OpaqueClient): LiveblocksContextBundle<U, M>;
|
|
1433
1443
|
/**
|
|
1434
1444
|
* Returns the inbox notifications for the current user.
|
|
1435
1445
|
*
|
|
@@ -1516,7 +1526,7 @@ declare function useRoomInfo(roomId: string): RoomInfoAsyncResult;
|
|
|
1516
1526
|
* const { info } = useRoomInfo("room-id");
|
|
1517
1527
|
*/
|
|
1518
1528
|
declare function useRoomInfoSuspense(roomId: string): RoomInfoAsyncSuccess;
|
|
1519
|
-
|
|
1529
|
+
type TypedBundle$1 = LiveblocksContextBundle<DU, DM>;
|
|
1520
1530
|
/**
|
|
1521
1531
|
* Returns the thread associated with a `"thread"` inbox notification.
|
|
1522
1532
|
*
|
|
@@ -1591,16 +1601,6 @@ declare const _useUserThreadsSuspense_experimental: TypedBundle$1["suspense"]["u
|
|
|
1591
1601
|
*/
|
|
1592
1602
|
declare function useSyncStatus(options?: UseSyncStatusOptions): SyncStatus;
|
|
1593
1603
|
|
|
1594
|
-
/**
|
|
1595
|
-
* Raw access to the React context where the RoomProvider stores the current
|
|
1596
|
-
* room. Exposed for advanced use cases only.
|
|
1597
|
-
*
|
|
1598
|
-
* @private This is a private/advanced API. Do not rely on it.
|
|
1599
|
-
*/
|
|
1600
|
-
declare const RoomContext: react.Context<OpaqueRoom | null>;
|
|
1601
|
-
/** @private */
|
|
1602
|
-
declare function useRoomOrNull<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata$1>(): Room<P, S, U, E, M> | null;
|
|
1603
|
-
|
|
1604
1604
|
/**
|
|
1605
1605
|
* Returns the current connection status for the Room, and triggers
|
|
1606
1606
|
* a re-render whenever it changes. Can be used to render a status badge.
|
|
@@ -1707,13 +1707,13 @@ declare function useOthersConnectionIds(): readonly number[];
|
|
|
1707
1707
|
/**
|
|
1708
1708
|
* @private Internal API, do not rely on it.
|
|
1709
1709
|
*/
|
|
1710
|
-
declare function useCommentsErrorListener<M extends BaseMetadata
|
|
1710
|
+
declare function useCommentsErrorListener<M extends BaseMetadata>(callback: (error: CommentsError<M>) => void): void;
|
|
1711
1711
|
/**
|
|
1712
1712
|
* @private
|
|
1713
1713
|
*/
|
|
1714
|
-
declare function useCreateRoomThread<M extends BaseMetadata
|
|
1714
|
+
declare function useCreateRoomThread<M extends BaseMetadata>(roomId: string): (options: CreateThreadOptions<M>) => ThreadData$1<M>;
|
|
1715
1715
|
declare function useDeleteRoomThread(roomId: string): (threadId: string) => void;
|
|
1716
|
-
declare function useEditRoomThreadMetadata<M extends BaseMetadata
|
|
1716
|
+
declare function useEditRoomThreadMetadata<M extends BaseMetadata>(roomId: string): (options: EditThreadMetadataOptions<M>) => void;
|
|
1717
1717
|
/**
|
|
1718
1718
|
* Returns a function that adds a comment to a thread.
|
|
1719
1719
|
*
|
|
@@ -1754,7 +1754,7 @@ declare function useDeleteRoomComment(roomId: string): ({ threadId, commentId }:
|
|
|
1754
1754
|
/**
|
|
1755
1755
|
* @private
|
|
1756
1756
|
*/
|
|
1757
|
-
declare function useAddRoomCommentReaction<M extends BaseMetadata
|
|
1757
|
+
declare function useAddRoomCommentReaction<M extends BaseMetadata>(roomId: string): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
|
|
1758
1758
|
/**
|
|
1759
1759
|
* Returns a function that removes a reaction on a comment.
|
|
1760
1760
|
*
|
|
@@ -1880,8 +1880,8 @@ declare function useRoomPermissions(roomId: string): Set<unknown>;
|
|
|
1880
1880
|
* that any RoomProvider created in this way does not need to be nested in
|
|
1881
1881
|
* LiveblocksProvider, as it already has access to the client.
|
|
1882
1882
|
*/
|
|
1883
|
-
declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata
|
|
1884
|
-
|
|
1883
|
+
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>;
|
|
1884
|
+
type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DM>;
|
|
1885
1885
|
/**
|
|
1886
1886
|
* Makes a Room available in the component hierarchy below.
|
|
1887
1887
|
* Joins the room when the component is mounted, and automatically leaves
|