@liveblocks/react 0.17.11-debug1 → 0.18.0-beta0
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/.built-by-link-script +1 -1
- package/index.d.ts +112 -235
- package/index.js +266 -518
- package/index.mjs +0 -20
- package/package.json +5 -2
package/.built-by-link-script
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
11a0666afa7ed3e5356b3c304466109fb37d8b87
|
package/index.d.ts
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JsonObject, LsonObject, LiveObject, BaseUserMeta, Json, Client, Room, BroadcastOptions, History, Others, User } from '@liveblocks/client';
|
|
2
2
|
export { Json, JsonObject } from '@liveblocks/client';
|
|
3
|
+
import { ToImmutable, Resolve, RoomInitializers } from '@liveblocks/client/internal';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
import { Resolve, RoomInitializers } from '@liveblocks/client/internal';
|
|
5
5
|
|
|
6
|
-
declare type LiveblocksProviderProps = {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
client: Client;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Makes the Liveblocks client available in the component hierarchy below.
|
|
12
|
-
*
|
|
13
|
-
* @deprecated LiveblocksProvider is no longer needed in your component tree if
|
|
14
|
-
* you set up your Liveblocks context using `createRoomContext()`. See
|
|
15
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for
|
|
16
|
-
* details.
|
|
17
|
-
*/
|
|
18
|
-
declare function LiveblocksProvider(props: LiveblocksProviderProps): JSX.Element;
|
|
19
6
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
7
|
+
* For any function type, returns a similar function type, but without the
|
|
8
|
+
* first argument.
|
|
22
9
|
*/
|
|
23
|
-
declare
|
|
24
|
-
|
|
10
|
+
declare type OmitFirstArg<F> = F extends (first: any, ...rest: infer A) => infer R ? (...args: A) => R : never;
|
|
11
|
+
declare type MutationContext<TPresence extends JsonObject, TStorage extends LsonObject> = {
|
|
12
|
+
root: LiveObject<TStorage>;
|
|
13
|
+
setMyPresence: (patch: Partial<TPresence>, options?: {
|
|
14
|
+
addToHistory: boolean;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
25
17
|
declare type RoomProviderProps<TPresence extends JsonObject, TStorage extends LsonObject> = Resolve<{
|
|
26
18
|
/**
|
|
27
19
|
* The id of the room you want to connect to
|
|
@@ -131,6 +123,33 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
131
123
|
* const object = useObject("obj");
|
|
132
124
|
*/
|
|
133
125
|
useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
126
|
+
/**
|
|
127
|
+
* Returns your entire Liveblocks Storage as an immutable data structure.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* const root = useStorage();
|
|
131
|
+
*/
|
|
132
|
+
useStorage(): ToImmutable<TStorage> | null;
|
|
133
|
+
/**
|
|
134
|
+
* Extract arbitrary data from the Liveblocks Storage state, using an
|
|
135
|
+
* arbitrary selector function.
|
|
136
|
+
*
|
|
137
|
+
* The selector function will get re-evaluated any time something changes in
|
|
138
|
+
* Storage. The value returned by your selector function will also be the
|
|
139
|
+
* value returned by the hook.
|
|
140
|
+
*
|
|
141
|
+
* The `root` value that gets passed to your selector function is
|
|
142
|
+
* a immutable/readonly version of your Liveblocks storage root.
|
|
143
|
+
*
|
|
144
|
+
* The component that uses this hook will automatically re-render if the
|
|
145
|
+
* returned value changes.
|
|
146
|
+
*
|
|
147
|
+
* By default `useStorage()` uses strict `===` to check for equality. Take
|
|
148
|
+
* extra care when returning a computed object or list, for example when you
|
|
149
|
+
* return the result of a .map() or .filter() call from the selector. In
|
|
150
|
+
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
151
|
+
*/
|
|
152
|
+
useStorage<T>(selector: (root: ToImmutable<TStorage>) => T, isEqual?: (a: T, b: T) => boolean): T | null;
|
|
134
153
|
/**
|
|
135
154
|
* Returns the presence of the current user of the current room, and a function to update it.
|
|
136
155
|
* It is different from the setState function returned by the useState hook from React.
|
|
@@ -145,27 +164,52 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
145
164
|
*/
|
|
146
165
|
useMyPresence(): [
|
|
147
166
|
TPresence,
|
|
148
|
-
(
|
|
167
|
+
(patch: Partial<TPresence>, options?: {
|
|
149
168
|
addToHistory: boolean;
|
|
150
169
|
}) => void
|
|
151
170
|
];
|
|
152
171
|
/**
|
|
153
|
-
* Returns an object that lets you get information about all the
|
|
172
|
+
* Returns an object that lets you get information about all the users
|
|
173
|
+
* currently connected in the room.
|
|
154
174
|
*
|
|
155
175
|
* @example
|
|
156
176
|
* const others = useOthers();
|
|
157
177
|
*
|
|
158
178
|
* // Example to map all cursors in JSX
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
179
|
+
* return (
|
|
180
|
+
* <>
|
|
181
|
+
* {others.map((user) => {
|
|
182
|
+
* if (user.presence.cursor == null) {
|
|
183
|
+
* return null;
|
|
184
|
+
* }
|
|
185
|
+
* return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
|
|
186
|
+
* })}
|
|
187
|
+
* </>
|
|
188
|
+
* )
|
|
167
189
|
*/
|
|
168
190
|
useOthers(): Others<TPresence, TUserMeta>;
|
|
191
|
+
/**
|
|
192
|
+
* Extract arbitrary data based on all the users currently connected in the
|
|
193
|
+
* room (except yourself).
|
|
194
|
+
*
|
|
195
|
+
* The selector function will get re-evaluated any time a user enters or
|
|
196
|
+
* leaves the room, as well as whenever their presence data changes.
|
|
197
|
+
*
|
|
198
|
+
* The component that uses this hook will automatically re-render if your
|
|
199
|
+
* selector function returns a different value from its previous run.
|
|
200
|
+
*
|
|
201
|
+
* By default `useOthers()` uses strict `===` to check for equality. Take
|
|
202
|
+
* extra care when returning a computed object or list, for example when you
|
|
203
|
+
* return the result of a .map() or .filter() call from the selector. In
|
|
204
|
+
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
|
|
208
|
+
* const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
|
|
209
|
+
* const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
|
|
210
|
+
*
|
|
211
|
+
*/
|
|
212
|
+
useOthers<T>(selector: (others: Others<TPresence, TUserMeta>) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
169
213
|
/**
|
|
170
214
|
* Returns the Room of the nearest RoomProvider above in the React component
|
|
171
215
|
* tree.
|
|
@@ -175,22 +219,42 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
175
219
|
* Gets the current user once it is connected to the room.
|
|
176
220
|
*
|
|
177
221
|
* @example
|
|
178
|
-
* const
|
|
222
|
+
* const me = useSelf();
|
|
223
|
+
* const { x, y } = me.presence.cursor;
|
|
179
224
|
*/
|
|
180
225
|
useSelf(): User<TPresence, TUserMeta> | null;
|
|
181
226
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
227
|
+
* Extract arbitrary data based on the current user.
|
|
228
|
+
*
|
|
229
|
+
* The selector function will get re-evaluated any time your presence data
|
|
230
|
+
* changes.
|
|
231
|
+
*
|
|
232
|
+
* The component that uses this hook will automatically re-render if your
|
|
233
|
+
* selector function returns a different value from its previous run.
|
|
234
|
+
*
|
|
235
|
+
* By default `useSelf()` uses strict `===` to check for equality. Take extra
|
|
236
|
+
* care when returning a computed object or list, for example when you return
|
|
237
|
+
* the result of a .map() or .filter() call from the selector. In those
|
|
238
|
+
* cases, you'll probably want to use a `shallow` comparison check.
|
|
239
|
+
*
|
|
240
|
+
* Will return `null` while Liveblocks isn't connected to a room yet.
|
|
184
241
|
*
|
|
185
242
|
* @example
|
|
186
|
-
* const
|
|
243
|
+
* const cursor = useSelf(me => me.presence.cursor);
|
|
244
|
+
* if (cursor !== null) {
|
|
245
|
+
* const { x, y } = cursor;
|
|
246
|
+
* }
|
|
247
|
+
*
|
|
187
248
|
*/
|
|
188
|
-
|
|
249
|
+
useSelf<T>(selector: (me: User<TPresence, TUserMeta>) => T, isEqual?: (a: T, b: T) => boolean): T | null;
|
|
189
250
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
251
|
+
* Returns the mutable (!) Storage root. This hook exists for
|
|
252
|
+
* backward-compatible reasons.
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* const [root] = useStorageRoot();
|
|
192
256
|
*/
|
|
193
|
-
|
|
257
|
+
useStorageRoot(): [root: LiveObject<TStorage> | null];
|
|
194
258
|
/**
|
|
195
259
|
* useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
|
|
196
260
|
* 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.
|
|
@@ -202,206 +266,19 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
202
266
|
*
|
|
203
267
|
* // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
|
|
204
268
|
*/
|
|
205
|
-
useUpdateMyPresence(): (
|
|
269
|
+
useUpdateMyPresence(): (patch: Partial<TPresence>, options?: {
|
|
206
270
|
addToHistory: boolean;
|
|
207
271
|
}) => void;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
*/
|
|
218
|
-
useList_deprecated<TValue extends Lson>(key: string): LiveList<TValue> | null;
|
|
219
|
-
/**
|
|
220
|
-
* @deprecated We no longer recommend initializing the
|
|
221
|
-
* items from the useList() hook. For details, see https://bit.ly/3Niy5aP.
|
|
222
|
-
*/
|
|
223
|
-
useList_deprecated<TValue extends Lson>(key: string, items: TValue[]): LiveList<TValue> | null;
|
|
224
|
-
/**
|
|
225
|
-
* Returns the LiveMap associated with the provided key. If the LiveMap does not exist, a new empty LiveMap will be created.
|
|
226
|
-
* The hook triggers a re-render if the LiveMap is updated, however it does not triggers a re-render if a nested CRDT is updated.
|
|
227
|
-
*
|
|
228
|
-
* @param key The storage key associated with the LiveMap
|
|
229
|
-
* @returns null while the storage is loading, otherwise, returns the LiveMap associated to the storage
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* const shapesById = useMap("shapes");
|
|
233
|
-
*/
|
|
234
|
-
useMap_deprecated<TKey extends string, TValue extends Lson>(key: string): LiveMap<TKey, TValue> | null;
|
|
235
|
-
/**
|
|
236
|
-
* @deprecated We no longer recommend initializing the
|
|
237
|
-
* entries from the useMap() hook. For details, see https://bit.ly/3Niy5aP.
|
|
238
|
-
*/
|
|
239
|
-
useMap_deprecated<TKey extends string, TValue extends Lson>(key: string, entries: readonly (readonly [TKey, TValue])[] | null): LiveMap<TKey, TValue> | null;
|
|
240
|
-
/**
|
|
241
|
-
* Returns the LiveObject associated with the provided key.
|
|
242
|
-
* The hook triggers a re-render if the LiveObject is updated, however it does not triggers a re-render if a nested CRDT is updated.
|
|
243
|
-
*
|
|
244
|
-
* @param key The storage key associated with the LiveObject
|
|
245
|
-
* @returns null while the storage is loading, otherwise, returns the LveObject associated to the storage
|
|
246
|
-
*
|
|
247
|
-
* @example
|
|
248
|
-
* const object = useObject("obj");
|
|
249
|
-
*/
|
|
250
|
-
useObject_deprecated<TData extends LsonObject>(key: string): LiveObject<TData> | null;
|
|
251
|
-
/**
|
|
252
|
-
* @deprecated We no longer recommend initializing the fields from the
|
|
253
|
-
* useObject() hook. For details, see https://bit.ly/3Niy5aP.
|
|
254
|
-
*/
|
|
255
|
-
useObject_deprecated<TData extends LsonObject>(key: string, initialData: TData): LiveObject<TData> | null;
|
|
272
|
+
useMutation<F extends (context: MutationContext<TPresence, TStorage>, ...args: any[]) => any>(callback: F, deps?: unknown[]): OmitFirstArg<F>;
|
|
273
|
+
suspense: {
|
|
274
|
+
useStorage(): ToImmutable<TStorage>;
|
|
275
|
+
useStorage<T>(selector: (root: ToImmutable<TStorage>) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
276
|
+
useSelf(): User<TPresence, TUserMeta>;
|
|
277
|
+
useSelf<T>(selector: (me: User<TPresence, TUserMeta>) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
278
|
+
useOthers(): Others<TPresence, TUserMeta>;
|
|
279
|
+
useOthers<T>(selector: (others: Others<TPresence, TUserMeta>) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
280
|
+
};
|
|
256
281
|
};
|
|
257
282
|
declare function createRoomContext<TPresence extends JsonObject, TStorage extends LsonObject = LsonObject, TUserMeta extends BaseUserMeta = BaseUserMeta, TRoomEvent extends Json = never>(client: Client): RoomContextBundle<TPresence, TStorage, TUserMeta, TRoomEvent>;
|
|
258
283
|
|
|
259
|
-
|
|
260
|
-
* NOTE:
|
|
261
|
-
* This file is AUTOGENERATED!
|
|
262
|
-
*
|
|
263
|
-
* Do not update it manually.
|
|
264
|
-
*/
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
268
|
-
* `RoomProvider` from `@liveblocks/react` directly. See
|
|
269
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
270
|
-
*/
|
|
271
|
-
declare function RoomProvider<TPresence extends JsonObject, TStorage extends LsonObject>(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
|
|
272
|
-
/**
|
|
273
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
274
|
-
* `useBatch` from `@liveblocks/react` directly. See
|
|
275
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
276
|
-
*/
|
|
277
|
-
declare function useBatch(): (callback: () => void) => void;
|
|
278
|
-
/**
|
|
279
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
280
|
-
* `useBroadcastEvent` from `@liveblocks/react` directly. See
|
|
281
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
282
|
-
*/
|
|
283
|
-
declare function useBroadcastEvent<TRoomEvent extends Json>(): (event: TRoomEvent, options?: BroadcastOptions) => void;
|
|
284
|
-
/**
|
|
285
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
286
|
-
* `useErrorListener` from `@liveblocks/react` directly. See
|
|
287
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
288
|
-
*/
|
|
289
|
-
declare function useErrorListener(callback: (err: Error) => void): void;
|
|
290
|
-
/**
|
|
291
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
292
|
-
* `useEventListener` from `@liveblocks/react` directly. See
|
|
293
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
294
|
-
*/
|
|
295
|
-
declare function useEventListener<TRoomEvent extends Json>(callback: (eventData: {
|
|
296
|
-
connectionId: number;
|
|
297
|
-
event: TRoomEvent;
|
|
298
|
-
}) => void): void;
|
|
299
|
-
/**
|
|
300
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
301
|
-
* `useHistory` from `@liveblocks/react` directly. See
|
|
302
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
303
|
-
*/
|
|
304
|
-
declare function useHistory(): History;
|
|
305
|
-
/**
|
|
306
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
307
|
-
* `useMyPresence` from `@liveblocks/react` directly. See
|
|
308
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
309
|
-
*/
|
|
310
|
-
declare function useMyPresence<TPresence extends JsonObject>(): [
|
|
311
|
-
TPresence,
|
|
312
|
-
(overrides: Partial<TPresence>, options?: {
|
|
313
|
-
addToHistory: boolean;
|
|
314
|
-
}) => void
|
|
315
|
-
];
|
|
316
|
-
/**
|
|
317
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
318
|
-
* `useOthers` from `@liveblocks/react` directly. See
|
|
319
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
320
|
-
*/
|
|
321
|
-
declare function useOthers<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>(): Others<TPresence, TUserMeta>;
|
|
322
|
-
/**
|
|
323
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
324
|
-
* `useRedo` from `@liveblocks/react` directly. See
|
|
325
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
326
|
-
*/
|
|
327
|
-
declare function useRedo(): () => void;
|
|
328
|
-
/**
|
|
329
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
330
|
-
* `useRoom` from `@liveblocks/react` directly. See
|
|
331
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
332
|
-
*/
|
|
333
|
-
declare function useRoom<TPresence extends JsonObject, TStorage extends LsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json>(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
|
|
334
|
-
/**
|
|
335
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
336
|
-
* `useSelf` from `@liveblocks/react` directly. See
|
|
337
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
338
|
-
*/
|
|
339
|
-
declare function useSelf<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>(): User<TPresence, TUserMeta> | null;
|
|
340
|
-
/**
|
|
341
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
342
|
-
* `useStorageRoot` from `@liveblocks/react` directly. See
|
|
343
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
344
|
-
*/
|
|
345
|
-
declare function useStorageRoot<TStorage extends LsonObject>(): [
|
|
346
|
-
root: LiveObject<TStorage> | null
|
|
347
|
-
];
|
|
348
|
-
/**
|
|
349
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
350
|
-
* `useStorage` from `@liveblocks/react` directly. See
|
|
351
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
352
|
-
*/
|
|
353
|
-
declare function useStorage<TStorage extends LsonObject>(): [
|
|
354
|
-
root: LiveObject<TStorage> | null
|
|
355
|
-
];
|
|
356
|
-
/**
|
|
357
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
358
|
-
* `useUndo` from `@liveblocks/react` directly. See
|
|
359
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
360
|
-
*/
|
|
361
|
-
declare function useUndo(): () => void;
|
|
362
|
-
/**
|
|
363
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
364
|
-
* `useUpdateMyPresence` from `@liveblocks/react` directly. See
|
|
365
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
366
|
-
*/
|
|
367
|
-
declare function useUpdateMyPresence<TPresence extends JsonObject>(): (overrides: Partial<TPresence>, options?: {
|
|
368
|
-
addToHistory: boolean;
|
|
369
|
-
}) => void;
|
|
370
|
-
/**
|
|
371
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
372
|
-
* `useList` from `@liveblocks/react` directly. See
|
|
373
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
374
|
-
*/
|
|
375
|
-
declare function useList<TValue extends Lson>(key: string): LiveList<TValue> | null;
|
|
376
|
-
/**
|
|
377
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
378
|
-
* `useList` from `@liveblocks/react` directly. See
|
|
379
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
380
|
-
*/
|
|
381
|
-
declare function useList<TValue extends Lson>(key: string, items: TValue[]): LiveList<TValue> | null;
|
|
382
|
-
/**
|
|
383
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
384
|
-
* `useMap` from `@liveblocks/react` directly. See
|
|
385
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
386
|
-
*/
|
|
387
|
-
declare function useMap<TKey extends string, TValue extends Lson>(key: string): LiveMap<TKey, TValue> | null;
|
|
388
|
-
/**
|
|
389
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
390
|
-
* `useMap` from `@liveblocks/react` directly. See
|
|
391
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
392
|
-
*/
|
|
393
|
-
declare function useMap<TKey extends string, TValue extends Lson>(key: string, entries: readonly (readonly [TKey, TValue])[] | null): LiveMap<TKey, TValue> | null;
|
|
394
|
-
/**
|
|
395
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
396
|
-
* `useObject` from `@liveblocks/react` directly. See
|
|
397
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
398
|
-
*/
|
|
399
|
-
declare function useObject<TData extends LsonObject>(key: string): LiveObject<TData> | null;
|
|
400
|
-
/**
|
|
401
|
-
* @deprecated Please use `createRoomContext()` instead of importing
|
|
402
|
-
* `useObject` from `@liveblocks/react` directly. See
|
|
403
|
-
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
404
|
-
*/
|
|
405
|
-
declare function useObject<TData extends LsonObject>(key: string, initialData: TData): LiveObject<TData> | null;
|
|
406
|
-
|
|
407
|
-
export { LiveblocksProvider, RoomProvider, createRoomContext, useBatch, useBroadcastEvent, useClient, useErrorListener, useEventListener, useHistory, useList, useMap, useMyPresence, useObject, useOthers, useRedo, useRoom, useSelf, useStorage, useStorageRoot, useUndo, useUpdateMyPresence };
|
|
284
|
+
export { MutationContext, createRoomContext };
|
package/index.js
CHANGED
|
@@ -1,48 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/client.tsx
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/factory.tsx
|
|
23
2
|
var _internal = require('@liveblocks/client/internal');
|
|
24
|
-
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
25
|
-
var
|
|
26
|
-
function LiveblocksProvider(props) {
|
|
27
|
-
_internal.deprecate.call(void 0,
|
|
28
|
-
"LiveblocksProvider is no longer needed in your component tree if you set up your Liveblocks context using `createRoomContext()`. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
29
|
-
);
|
|
30
|
-
return /* @__PURE__ */ React.createElement(ClientContext.Provider, {
|
|
31
|
-
value: props.client
|
|
32
|
-
}, props.children);
|
|
33
|
-
}
|
|
34
|
-
function useClient() {
|
|
35
|
-
const client = React.useContext(ClientContext);
|
|
36
|
-
if (client == null) {
|
|
37
|
-
throw new Error("LiveblocksProvider is missing from the react tree");
|
|
38
|
-
}
|
|
39
|
-
return client;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/factory.tsx
|
|
43
|
-
var _client2 = require('@liveblocks/client');
|
|
44
|
-
|
|
45
|
-
|
|
3
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
4
|
+
var _withselector = require('use-sync-external-store/shim/with-selector');
|
|
46
5
|
|
|
47
6
|
// src/hooks.ts
|
|
48
7
|
|
|
@@ -53,27 +12,31 @@ function useRerender() {
|
|
|
53
12
|
);
|
|
54
13
|
return update;
|
|
55
14
|
}
|
|
15
|
+
function useInitial(value) {
|
|
16
|
+
return _react.useRef.call(void 0, value).current;
|
|
17
|
+
}
|
|
56
18
|
|
|
57
19
|
// src/factory.tsx
|
|
58
|
-
|
|
59
|
-
|
|
20
|
+
var noop = () => {
|
|
21
|
+
};
|
|
22
|
+
var identity = (x) => x;
|
|
23
|
+
var EMPTY_OTHERS = [];
|
|
24
|
+
Object.defineProperty(EMPTY_OTHERS, "count", {
|
|
25
|
+
value: 0,
|
|
26
|
+
enumerable: false
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(EMPTY_OTHERS, "toArray", {
|
|
29
|
+
value: () => EMPTY_OTHERS,
|
|
30
|
+
enumerable: false
|
|
31
|
+
});
|
|
32
|
+
_internal.freeze.call(void 0, EMPTY_OTHERS);
|
|
33
|
+
function getEmptyOthers() {
|
|
34
|
+
return EMPTY_OTHERS;
|
|
60
35
|
}
|
|
61
36
|
function createRoomContext(client) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} else {
|
|
66
|
-
useClient2 = useClient;
|
|
67
|
-
}
|
|
68
|
-
const RoomContext = React2.createContext(null);
|
|
69
|
-
function RoomProvider2(props) {
|
|
70
|
-
const {
|
|
71
|
-
id: roomId,
|
|
72
|
-
initialPresence,
|
|
73
|
-
initialStorage,
|
|
74
|
-
defaultPresence,
|
|
75
|
-
defaultStorageRoot
|
|
76
|
-
} = props;
|
|
37
|
+
const RoomContext = React.createContext(null);
|
|
38
|
+
function RoomProvider(props) {
|
|
39
|
+
const { id: roomId, initialPresence, initialStorage } = props;
|
|
77
40
|
if (process.env.NODE_ENV !== "production") {
|
|
78
41
|
if (roomId == null) {
|
|
79
42
|
throw new Error(
|
|
@@ -84,374 +47,186 @@ function createRoomContext(client) {
|
|
|
84
47
|
throw new Error("RoomProvider id property should be a string.");
|
|
85
48
|
}
|
|
86
49
|
}
|
|
87
|
-
_internal.errorIf.call(void 0,
|
|
88
|
-
defaultPresence,
|
|
89
|
-
"RoomProvider's `defaultPresence` prop will be removed in @liveblocks/react 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP"
|
|
90
|
-
);
|
|
91
|
-
_internal.errorIf.call(void 0,
|
|
92
|
-
defaultStorageRoot,
|
|
93
|
-
"RoomProvider's `defaultStorageRoot` prop will be removed in @liveblocks/react 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP"
|
|
94
|
-
);
|
|
95
|
-
const _client = useClient2();
|
|
96
50
|
const frozen = useInitial({
|
|
97
51
|
initialPresence,
|
|
98
|
-
initialStorage
|
|
99
|
-
defaultPresence,
|
|
100
|
-
defaultStorageRoot
|
|
52
|
+
initialStorage
|
|
101
53
|
});
|
|
102
|
-
const [room, setRoom] =
|
|
103
|
-
() =>
|
|
54
|
+
const [room, setRoom] = React.useState(
|
|
55
|
+
() => client.enter(roomId, {
|
|
104
56
|
initialPresence,
|
|
105
57
|
initialStorage,
|
|
106
|
-
defaultPresence,
|
|
107
|
-
defaultStorageRoot,
|
|
108
58
|
DO_NOT_USE_withoutConnecting: typeof window === "undefined"
|
|
109
59
|
})
|
|
110
60
|
);
|
|
111
|
-
|
|
61
|
+
React.useEffect(() => {
|
|
112
62
|
setRoom(
|
|
113
|
-
|
|
63
|
+
client.enter(roomId, {
|
|
114
64
|
initialPresence: frozen.initialPresence,
|
|
115
65
|
initialStorage: frozen.initialStorage,
|
|
116
|
-
defaultPresence: frozen.defaultPresence,
|
|
117
|
-
defaultStorageRoot: frozen.defaultStorageRoot,
|
|
118
66
|
DO_NOT_USE_withoutConnecting: typeof window === "undefined"
|
|
119
67
|
})
|
|
120
68
|
);
|
|
121
69
|
return () => {
|
|
122
|
-
|
|
70
|
+
client.leave(roomId);
|
|
123
71
|
};
|
|
124
|
-
}, [
|
|
125
|
-
return /* @__PURE__ */
|
|
72
|
+
}, [roomId, frozen]);
|
|
73
|
+
return /* @__PURE__ */ React.createElement(RoomContext.Provider, {
|
|
126
74
|
value: room
|
|
127
75
|
}, props.children);
|
|
128
76
|
}
|
|
129
|
-
function
|
|
130
|
-
const room =
|
|
77
|
+
function useRoom() {
|
|
78
|
+
const room = React.useContext(RoomContext);
|
|
131
79
|
if (room == null) {
|
|
132
80
|
throw new Error("RoomProvider is missing from the react tree");
|
|
133
81
|
}
|
|
134
82
|
return room;
|
|
135
83
|
}
|
|
136
|
-
function
|
|
137
|
-
const room =
|
|
84
|
+
function useMyPresence() {
|
|
85
|
+
const room = useRoom();
|
|
138
86
|
const presence = room.getPresence();
|
|
139
87
|
const rerender = useRerender();
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
unsubscribe();
|
|
144
|
-
};
|
|
145
|
-
}, [room, rerender]);
|
|
146
|
-
const setPresence = React2.useCallback(
|
|
147
|
-
(overrides, options) => room.updatePresence(overrides, options),
|
|
88
|
+
React.useEffect(() => room.events.me.subscribe(rerender), [room, rerender]);
|
|
89
|
+
const setPresence = React.useCallback(
|
|
90
|
+
(patch, options) => room.updatePresence(patch, options),
|
|
148
91
|
[room]
|
|
149
92
|
);
|
|
150
93
|
return [presence, setPresence];
|
|
151
94
|
}
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
95
|
+
function useUpdateMyPresence() {
|
|
96
|
+
return useRoom().updatePresence;
|
|
97
|
+
}
|
|
98
|
+
function useOthers(selector, isEqual) {
|
|
99
|
+
const room = useRoom();
|
|
100
|
+
const subscribe = room.events.others.subscribe;
|
|
101
|
+
const getSnapshot = React.useCallback(
|
|
102
|
+
() => room.getOthers(),
|
|
158
103
|
[room]
|
|
159
104
|
);
|
|
105
|
+
const getServerSnapshot = getEmptyOthers;
|
|
106
|
+
return _withselector.useSyncExternalStoreWithSelector.call(void 0,
|
|
107
|
+
subscribe,
|
|
108
|
+
getSnapshot,
|
|
109
|
+
getServerSnapshot,
|
|
110
|
+
selector != null ? selector : identity,
|
|
111
|
+
isEqual
|
|
112
|
+
);
|
|
160
113
|
}
|
|
161
|
-
function
|
|
162
|
-
const room =
|
|
163
|
-
|
|
164
|
-
React2.useEffect(() => {
|
|
165
|
-
const unsubscribe = room.subscribe("others", rerender);
|
|
166
|
-
return () => {
|
|
167
|
-
unsubscribe();
|
|
168
|
-
};
|
|
169
|
-
}, [room, rerender]);
|
|
170
|
-
return room.getOthers();
|
|
171
|
-
}
|
|
172
|
-
function useBroadcastEvent2() {
|
|
173
|
-
const room = useRoom2();
|
|
174
|
-
return React2.useCallback(
|
|
114
|
+
function useBroadcastEvent() {
|
|
115
|
+
const room = useRoom();
|
|
116
|
+
return React.useCallback(
|
|
175
117
|
(event, options = { shouldQueueEventIfNotReady: false }) => {
|
|
176
118
|
room.broadcastEvent(event, options);
|
|
177
119
|
},
|
|
178
120
|
[room]
|
|
179
121
|
);
|
|
180
122
|
}
|
|
181
|
-
function
|
|
182
|
-
const room =
|
|
183
|
-
const savedCallback =
|
|
184
|
-
|
|
123
|
+
function useErrorListener(callback) {
|
|
124
|
+
const room = useRoom();
|
|
125
|
+
const savedCallback = React.useRef(callback);
|
|
126
|
+
React.useEffect(() => {
|
|
185
127
|
savedCallback.current = callback;
|
|
186
128
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
unsubscribe();
|
|
192
|
-
};
|
|
193
|
-
}, [room]);
|
|
129
|
+
React.useEffect(
|
|
130
|
+
() => room.events.error.subscribe((e) => savedCallback.current(e)),
|
|
131
|
+
[room]
|
|
132
|
+
);
|
|
194
133
|
}
|
|
195
|
-
function
|
|
196
|
-
const room =
|
|
197
|
-
const savedCallback =
|
|
198
|
-
|
|
134
|
+
function useEventListener(callback) {
|
|
135
|
+
const room = useRoom();
|
|
136
|
+
const savedCallback = React.useRef(callback);
|
|
137
|
+
React.useEffect(() => {
|
|
199
138
|
savedCallback.current = callback;
|
|
200
139
|
});
|
|
201
|
-
|
|
140
|
+
React.useEffect(() => {
|
|
202
141
|
const listener = (eventData) => {
|
|
203
142
|
savedCallback.current(eventData);
|
|
204
143
|
};
|
|
205
|
-
|
|
206
|
-
return () => {
|
|
207
|
-
unsubscribe();
|
|
208
|
-
};
|
|
209
|
-
}, [room]);
|
|
210
|
-
}
|
|
211
|
-
function useSelf2() {
|
|
212
|
-
const room = useRoom2();
|
|
213
|
-
const rerender = useRerender();
|
|
214
|
-
React2.useEffect(() => {
|
|
215
|
-
const unsubscribePresence = room.subscribe("my-presence", rerender);
|
|
216
|
-
const unsubscribeConnection = room.subscribe("connection", rerender);
|
|
217
|
-
return () => {
|
|
218
|
-
unsubscribePresence();
|
|
219
|
-
unsubscribeConnection();
|
|
220
|
-
};
|
|
221
|
-
}, [room, rerender]);
|
|
222
|
-
return room.getSelf();
|
|
223
|
-
}
|
|
224
|
-
function useStorageRoot2() {
|
|
225
|
-
const room = useRoom2();
|
|
226
|
-
const [root, setState] = React2.useState(null);
|
|
227
|
-
React2.useEffect(() => {
|
|
228
|
-
let didCancel = false;
|
|
229
|
-
function fetchStorage() {
|
|
230
|
-
return __async(this, null, function* () {
|
|
231
|
-
const storage = yield room.getStorage();
|
|
232
|
-
if (!didCancel) {
|
|
233
|
-
setState(storage.root);
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
fetchStorage();
|
|
238
|
-
return () => {
|
|
239
|
-
didCancel = true;
|
|
240
|
-
};
|
|
144
|
+
return room.events.customEvent.subscribe(listener);
|
|
241
145
|
}, [room]);
|
|
242
|
-
return [root];
|
|
243
146
|
}
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
|
|
147
|
+
function useSelf(maybeSelector, isEqual) {
|
|
148
|
+
const room = useRoom();
|
|
149
|
+
const subscribe = React.useCallback(
|
|
150
|
+
(onChange) => {
|
|
151
|
+
const unsub1 = room.events.me.subscribe(onChange);
|
|
152
|
+
const unsub2 = room.events.connection.subscribe(onChange);
|
|
153
|
+
return () => {
|
|
154
|
+
unsub1();
|
|
155
|
+
unsub2();
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
[room]
|
|
247
159
|
);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
`Support for initializing entries in useMap() directly will be removed in @liveblocks/react 0.18.
|
|
254
|
-
|
|
255
|
-
Instead, please initialize this data where you set up your RoomProvider:
|
|
256
|
-
|
|
257
|
-
const initialStorage = () => ({
|
|
258
|
-
${JSON.stringify(key)}: new LiveMap(...),
|
|
259
|
-
...
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
<RoomProvider initialStorage={initialStorage}>
|
|
263
|
-
...
|
|
264
|
-
</RoomProvider>
|
|
265
|
-
|
|
266
|
-
Please see https://bit.ly/3Niy5aP for details.`
|
|
160
|
+
const getSnapshot = room.getSelf;
|
|
161
|
+
const selector = maybeSelector != null ? maybeSelector : identity;
|
|
162
|
+
const wrappedSelector = React.useCallback(
|
|
163
|
+
(me) => me !== null ? selector(me) : null,
|
|
164
|
+
[selector]
|
|
267
165
|
);
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
key
|
|
276
|
-
)} was not found in Storage. Starting with 0.18, useMap() will no longer automatically create this key.
|
|
277
|
-
|
|
278
|
-
Instead, please initialize your storage where you set up your RoomProvider:
|
|
279
|
-
|
|
280
|
-
import { LiveMap } from "@liveblocks/client";
|
|
281
|
-
|
|
282
|
-
const initialStorage = () => ({
|
|
283
|
-
${JSON.stringify(key)}: new LiveMap(...),
|
|
284
|
-
...
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
<RoomProvider initialStorage={initialStorage}>
|
|
288
|
-
...
|
|
289
|
-
</RoomProvider>
|
|
290
|
-
|
|
291
|
-
Please see https://bit.ly/3Niy5aP for details.`
|
|
292
|
-
);
|
|
293
|
-
return null;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
function useList_deprecated(key, items) {
|
|
297
|
-
_internal.errorIf.call(void 0,
|
|
298
|
-
items,
|
|
299
|
-
`Support for initializing items in useList() directly will be removed in @liveblocks/react 0.18.
|
|
300
|
-
|
|
301
|
-
Instead, please initialize this data where you set up your RoomProvider:
|
|
302
|
-
|
|
303
|
-
import { LiveList } from "@liveblocks/client";
|
|
304
|
-
|
|
305
|
-
const initialStorage = () => ({
|
|
306
|
-
${JSON.stringify(key)}: new LiveList(...),
|
|
307
|
-
...
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
<RoomProvider initialStorage={initialStorage}>
|
|
311
|
-
...
|
|
312
|
-
</RoomProvider>
|
|
313
|
-
|
|
314
|
-
Please see https://bit.ly/3Niy5aP for details.`
|
|
166
|
+
const getServerSnapshot = React.useCallback(() => null, []);
|
|
167
|
+
return _withselector.useSyncExternalStoreWithSelector.call(void 0,
|
|
168
|
+
subscribe,
|
|
169
|
+
getSnapshot,
|
|
170
|
+
getServerSnapshot,
|
|
171
|
+
wrappedSelector,
|
|
172
|
+
isEqual
|
|
315
173
|
);
|
|
316
|
-
const value = useStorageValue(key, new (0, _client2.LiveList)(items));
|
|
317
|
-
if (value.status === "ok") {
|
|
318
|
-
return value.value;
|
|
319
|
-
} else {
|
|
320
|
-
_internal.errorIf.call(void 0,
|
|
321
|
-
value.status === "notfound",
|
|
322
|
-
`Key ${JSON.stringify(
|
|
323
|
-
key
|
|
324
|
-
)} was not found in Storage. Starting with 0.18, useList() will no longer automatically create this key.
|
|
325
|
-
|
|
326
|
-
Instead, please initialize your storage where you set up your RoomProvider:
|
|
327
|
-
|
|
328
|
-
import { LiveList } from "@liveblocks/client";
|
|
329
|
-
|
|
330
|
-
const initialStorage = () => ({
|
|
331
|
-
${JSON.stringify(key)}: new LiveList(...),
|
|
332
|
-
...
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
<RoomProvider initialStorage={initialStorage}>
|
|
336
|
-
...
|
|
337
|
-
</RoomProvider>
|
|
338
|
-
|
|
339
|
-
Please see https://bit.ly/3Niy5aP for details.`
|
|
340
|
-
);
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
174
|
}
|
|
344
|
-
function
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
...
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
<RoomProvider initialStorage={initialStorage}>
|
|
359
|
-
...
|
|
360
|
-
</RoomProvider>
|
|
361
|
-
|
|
362
|
-
Please see https://bit.ly/3Niy5aP for details.`
|
|
175
|
+
function useMutableStorageRoot() {
|
|
176
|
+
const room = useRoom();
|
|
177
|
+
const subscribe = room.events.storageDidLoad.subscribeOnce;
|
|
178
|
+
const getSnapshot = room.getStorageSnapshot;
|
|
179
|
+
const getServerSnapshot = React.useCallback(() => null, []);
|
|
180
|
+
const selector = identity;
|
|
181
|
+
return _withselector.useSyncExternalStoreWithSelector.call(void 0,
|
|
182
|
+
subscribe,
|
|
183
|
+
getSnapshot,
|
|
184
|
+
getServerSnapshot,
|
|
185
|
+
selector
|
|
363
186
|
);
|
|
364
|
-
const value = useStorageValue(key, new (0, _client2.LiveObject)(initialData));
|
|
365
|
-
if (value.status === "ok") {
|
|
366
|
-
return value.value;
|
|
367
|
-
} else {
|
|
368
|
-
_internal.errorIf.call(void 0,
|
|
369
|
-
value.status === "notfound",
|
|
370
|
-
`Key ${JSON.stringify(
|
|
371
|
-
key
|
|
372
|
-
)} was not found in Storage. Starting with 0.18, useObject() will no longer automatically create this key.
|
|
373
|
-
|
|
374
|
-
Instead, please initialize your storage where you set up your RoomProvider:
|
|
375
|
-
|
|
376
|
-
import { LiveObject } from "@liveblocks/client";
|
|
377
|
-
|
|
378
|
-
const initialStorage = () => ({
|
|
379
|
-
${JSON.stringify(key)}: new LiveObject(...),
|
|
380
|
-
...
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
<RoomProvider initialStorage={initialStorage}>
|
|
384
|
-
...
|
|
385
|
-
</RoomProvider>
|
|
386
|
-
|
|
387
|
-
Please see https://bit.ly/3Niy5aP for details.`
|
|
388
|
-
);
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
function useList2(key) {
|
|
393
|
-
return useList_deprecated(key);
|
|
394
187
|
}
|
|
395
|
-
function
|
|
396
|
-
return
|
|
188
|
+
function useStorageRoot() {
|
|
189
|
+
return [useMutableStorageRoot()];
|
|
397
190
|
}
|
|
398
|
-
function
|
|
399
|
-
return
|
|
191
|
+
function useHistory() {
|
|
192
|
+
return useRoom().history;
|
|
400
193
|
}
|
|
401
|
-
function
|
|
402
|
-
return
|
|
194
|
+
function useUndo() {
|
|
195
|
+
return useHistory().undo;
|
|
403
196
|
}
|
|
404
|
-
function
|
|
405
|
-
return
|
|
406
|
-
}
|
|
407
|
-
function useRedo2() {
|
|
408
|
-
return useHistory2().redo;
|
|
197
|
+
function useRedo() {
|
|
198
|
+
return useHistory().redo;
|
|
409
199
|
}
|
|
410
200
|
function useCanUndo() {
|
|
411
|
-
const room =
|
|
412
|
-
const [canUndo, setCanUndo] =
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
);
|
|
418
|
-
return () => {
|
|
419
|
-
unsubscribe();
|
|
420
|
-
};
|
|
421
|
-
}, [room]);
|
|
201
|
+
const room = useRoom();
|
|
202
|
+
const [canUndo, setCanUndo] = React.useState(room.history.canUndo);
|
|
203
|
+
React.useEffect(
|
|
204
|
+
() => room.events.history.subscribe(({ canUndo: canUndo2 }) => setCanUndo(canUndo2)),
|
|
205
|
+
[room]
|
|
206
|
+
);
|
|
422
207
|
return canUndo;
|
|
423
208
|
}
|
|
424
209
|
function useCanRedo() {
|
|
425
|
-
const room =
|
|
426
|
-
const [canRedo, setCanRedo] =
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
);
|
|
432
|
-
return () => {
|
|
433
|
-
unsubscribe();
|
|
434
|
-
};
|
|
435
|
-
}, [room]);
|
|
210
|
+
const room = useRoom();
|
|
211
|
+
const [canRedo, setCanRedo] = React.useState(room.history.canRedo);
|
|
212
|
+
React.useEffect(
|
|
213
|
+
() => room.events.history.subscribe(({ canRedo: canRedo2 }) => setCanRedo(canRedo2)),
|
|
214
|
+
[room]
|
|
215
|
+
);
|
|
436
216
|
return canRedo;
|
|
437
217
|
}
|
|
438
|
-
function
|
|
439
|
-
return
|
|
218
|
+
function useBatch() {
|
|
219
|
+
return useRoom().batch;
|
|
440
220
|
}
|
|
441
|
-
function
|
|
442
|
-
const room =
|
|
443
|
-
const
|
|
221
|
+
function useLegacyKey(key) {
|
|
222
|
+
const room = useRoom();
|
|
223
|
+
const root = useMutableStorageRoot();
|
|
444
224
|
const rerender = useRerender();
|
|
445
|
-
|
|
446
|
-
React2.useEffect(() => {
|
|
225
|
+
React.useEffect(() => {
|
|
447
226
|
if (root == null) {
|
|
448
227
|
return;
|
|
449
228
|
}
|
|
450
229
|
let liveValue = root.get(key);
|
|
451
|
-
if (liveValue == null) {
|
|
452
|
-
liveValue = frozenInitialValue;
|
|
453
|
-
root.set(key, liveValue);
|
|
454
|
-
}
|
|
455
230
|
function onRootChange() {
|
|
456
231
|
const newCrdt = root.get(key);
|
|
457
232
|
if (newCrdt !== liveValue) {
|
|
@@ -477,177 +252,150 @@ Please see https://bit.ly/3Niy5aP for details.`
|
|
|
477
252
|
unsubscribeRoot();
|
|
478
253
|
unsubscribeCrdt();
|
|
479
254
|
};
|
|
480
|
-
}, [root, room, key,
|
|
255
|
+
}, [root, room, key, rerender]);
|
|
481
256
|
if (root == null) {
|
|
482
|
-
return
|
|
257
|
+
return null;
|
|
483
258
|
} else {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
259
|
+
return root.get(key);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function useStorage(maybeSelector, isEqual) {
|
|
263
|
+
const room = useRoom();
|
|
264
|
+
const rootOrNull = useMutableStorageRoot();
|
|
265
|
+
const selector = maybeSelector != null ? maybeSelector : identity;
|
|
266
|
+
const wrappedSelector = React.useCallback(
|
|
267
|
+
(rootOrNull2) => rootOrNull2 !== null ? selector(rootOrNull2) : null,
|
|
268
|
+
[selector]
|
|
269
|
+
);
|
|
270
|
+
const subscribe = React.useCallback(
|
|
271
|
+
(onStoreChange) => rootOrNull !== null ? room.subscribe(rootOrNull, onStoreChange, { isDeep: true }) : noop,
|
|
272
|
+
[room, rootOrNull]
|
|
273
|
+
);
|
|
274
|
+
const getSnapshot = React.useCallback(() => {
|
|
275
|
+
if (rootOrNull === null) {
|
|
276
|
+
return null;
|
|
487
277
|
} else {
|
|
488
|
-
|
|
278
|
+
const root = rootOrNull;
|
|
279
|
+
const imm = root.toImmutable();
|
|
280
|
+
return imm;
|
|
489
281
|
}
|
|
282
|
+
}, [rootOrNull]);
|
|
283
|
+
const getServerSnapshot = React.useCallback(() => null, []);
|
|
284
|
+
return _withselector.useSyncExternalStoreWithSelector.call(void 0,
|
|
285
|
+
subscribe,
|
|
286
|
+
getSnapshot,
|
|
287
|
+
getServerSnapshot,
|
|
288
|
+
wrappedSelector,
|
|
289
|
+
isEqual
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
function ensureNotServerSide() {
|
|
293
|
+
if (typeof window === "undefined") {
|
|
294
|
+
throw new Error(
|
|
295
|
+
"You cannot call the Suspense version of this hook on the server side. Make sure to only call them on the client side.\nFor tips for structuring your app, see XXX"
|
|
296
|
+
);
|
|
490
297
|
}
|
|
491
298
|
}
|
|
299
|
+
function useSuspendUntilStorageLoaded() {
|
|
300
|
+
const room = useRoom();
|
|
301
|
+
if (room.getStorageSnapshot() !== null) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
ensureNotServerSide();
|
|
305
|
+
throw new Promise((res) => {
|
|
306
|
+
room.events.storageDidLoad.subscribeOnce(() => res());
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function useSuspendUntilPresenceLoaded() {
|
|
310
|
+
const room = useRoom();
|
|
311
|
+
if (room.isSelfAware()) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
ensureNotServerSide();
|
|
315
|
+
throw new Promise((res) => {
|
|
316
|
+
room.events.connection.subscribeOnce(() => res());
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function useMutation(callback, deps) {
|
|
320
|
+
const room = useRoom();
|
|
321
|
+
const root = useMutableStorageRoot();
|
|
322
|
+
const setMyPresence = room.updatePresence;
|
|
323
|
+
return React.useMemo(
|
|
324
|
+
() => {
|
|
325
|
+
if (root !== null) {
|
|
326
|
+
const mutationCtx = {
|
|
327
|
+
root,
|
|
328
|
+
setMyPresence
|
|
329
|
+
};
|
|
330
|
+
return (...args) => {
|
|
331
|
+
let rv;
|
|
332
|
+
room.batch(() => {
|
|
333
|
+
rv = callback(mutationCtx, ...args);
|
|
334
|
+
});
|
|
335
|
+
return rv;
|
|
336
|
+
};
|
|
337
|
+
} else {
|
|
338
|
+
return () => {
|
|
339
|
+
throw new Error(
|
|
340
|
+
"Mutation cannot be called while Liveblocks Storage has not loaded yet"
|
|
341
|
+
);
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
deps !== void 0 ? [root, room, setMyPresence, ...deps] : [root, room, setMyPresence, callback]
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
function useStorageSuspense(selector, isEqual) {
|
|
349
|
+
useSuspendUntilStorageLoaded();
|
|
350
|
+
return useStorage(
|
|
351
|
+
selector,
|
|
352
|
+
isEqual
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
function useSelfSuspense(selector, isEqual) {
|
|
356
|
+
useSuspendUntilPresenceLoaded();
|
|
357
|
+
return useSelf(
|
|
358
|
+
selector,
|
|
359
|
+
isEqual
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
function useOthersSuspense(selector, isEqual) {
|
|
363
|
+
useSuspendUntilPresenceLoaded();
|
|
364
|
+
return useOthers(
|
|
365
|
+
selector,
|
|
366
|
+
isEqual
|
|
367
|
+
);
|
|
368
|
+
}
|
|
492
369
|
return {
|
|
493
|
-
RoomProvider
|
|
494
|
-
useBatch
|
|
495
|
-
useBroadcastEvent
|
|
370
|
+
RoomProvider,
|
|
371
|
+
useBatch,
|
|
372
|
+
useBroadcastEvent,
|
|
496
373
|
useCanRedo,
|
|
497
374
|
useCanUndo,
|
|
498
|
-
useErrorListener
|
|
499
|
-
useEventListener
|
|
500
|
-
useHistory
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
375
|
+
useErrorListener,
|
|
376
|
+
useEventListener,
|
|
377
|
+
useHistory,
|
|
378
|
+
useMyPresence,
|
|
379
|
+
useOthers,
|
|
380
|
+
useRedo,
|
|
381
|
+
useRoom,
|
|
382
|
+
useSelf,
|
|
383
|
+
useStorageRoot,
|
|
384
|
+
useStorage,
|
|
385
|
+
useUndo,
|
|
386
|
+
useUpdateMyPresence,
|
|
387
|
+
useMutation,
|
|
388
|
+
useList: useLegacyKey,
|
|
389
|
+
useMap: useLegacyKey,
|
|
390
|
+
useObject: useLegacyKey,
|
|
513
391
|
RoomContext,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
392
|
+
suspense: {
|
|
393
|
+
useStorage: useStorageSuspense,
|
|
394
|
+
useSelf: useSelfSuspense,
|
|
395
|
+
useOthers: useOthersSuspense
|
|
396
|
+
}
|
|
517
397
|
};
|
|
518
398
|
}
|
|
519
|
-
|
|
520
|
-
// src/compat.tsx
|
|
521
|
-
|
|
522
|
-
var _hooks = createRoomContext("__legacy");
|
|
523
|
-
function RoomProvider(props) {
|
|
524
|
-
_internal.deprecate.call(void 0,
|
|
525
|
-
"Please use `createRoomContext()` instead of importing `RoomProvider` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
526
|
-
);
|
|
527
|
-
return _hooks.RoomProvider(props);
|
|
528
|
-
}
|
|
529
|
-
function useBatch() {
|
|
530
|
-
_internal.deprecate.call(void 0,
|
|
531
|
-
"Please use `createRoomContext()` instead of importing `useBatch` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
532
|
-
);
|
|
533
|
-
return _hooks.useBatch();
|
|
534
|
-
}
|
|
535
|
-
function useBroadcastEvent() {
|
|
536
|
-
_internal.deprecate.call(void 0,
|
|
537
|
-
"Please use `createRoomContext()` instead of importing `useBroadcastEvent` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
538
|
-
);
|
|
539
|
-
return _hooks.useBroadcastEvent();
|
|
540
|
-
}
|
|
541
|
-
function useErrorListener(callback) {
|
|
542
|
-
_internal.deprecate.call(void 0,
|
|
543
|
-
"Please use `createRoomContext()` instead of importing `useErrorListener` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
544
|
-
);
|
|
545
|
-
return _hooks.useErrorListener(callback);
|
|
546
|
-
}
|
|
547
|
-
function useEventListener(callback) {
|
|
548
|
-
_internal.deprecate.call(void 0,
|
|
549
|
-
"Please use `createRoomContext()` instead of importing `useEventListener` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
550
|
-
);
|
|
551
|
-
return _hooks.useEventListener(callback);
|
|
552
|
-
}
|
|
553
|
-
function useHistory() {
|
|
554
|
-
_internal.deprecate.call(void 0,
|
|
555
|
-
"Please use `createRoomContext()` instead of importing `useHistory` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
556
|
-
);
|
|
557
|
-
return _hooks.useHistory();
|
|
558
|
-
}
|
|
559
|
-
function useMyPresence() {
|
|
560
|
-
_internal.deprecate.call(void 0,
|
|
561
|
-
"Please use `createRoomContext()` instead of importing `useMyPresence` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
562
|
-
);
|
|
563
|
-
return _hooks.useMyPresence();
|
|
564
|
-
}
|
|
565
|
-
function useOthers() {
|
|
566
|
-
_internal.deprecate.call(void 0,
|
|
567
|
-
"Please use `createRoomContext()` instead of importing `useOthers` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
568
|
-
);
|
|
569
|
-
return _hooks.useOthers();
|
|
570
|
-
}
|
|
571
|
-
function useRedo() {
|
|
572
|
-
_internal.deprecate.call(void 0,
|
|
573
|
-
"Please use `createRoomContext()` instead of importing `useRedo` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
574
|
-
);
|
|
575
|
-
return _hooks.useRedo();
|
|
576
|
-
}
|
|
577
|
-
function useRoom() {
|
|
578
|
-
_internal.deprecate.call(void 0,
|
|
579
|
-
"Please use `createRoomContext()` instead of importing `useRoom` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
580
|
-
);
|
|
581
|
-
return _hooks.useRoom();
|
|
582
|
-
}
|
|
583
|
-
function useSelf() {
|
|
584
|
-
_internal.deprecate.call(void 0,
|
|
585
|
-
"Please use `createRoomContext()` instead of importing `useSelf` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
586
|
-
);
|
|
587
|
-
return _hooks.useSelf();
|
|
588
|
-
}
|
|
589
|
-
function useStorageRoot() {
|
|
590
|
-
_internal.deprecate.call(void 0,
|
|
591
|
-
"Please use `createRoomContext()` instead of importing `useStorageRoot` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
592
|
-
);
|
|
593
|
-
return _hooks.useStorageRoot();
|
|
594
|
-
}
|
|
595
|
-
function useStorage() {
|
|
596
|
-
_internal.deprecate.call(void 0,
|
|
597
|
-
"Please use `createRoomContext()` instead of importing `useStorage` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
598
|
-
);
|
|
599
|
-
return _hooks.useStorage();
|
|
600
|
-
}
|
|
601
|
-
function useUndo() {
|
|
602
|
-
_internal.deprecate.call(void 0,
|
|
603
|
-
"Please use `createRoomContext()` instead of importing `useUndo` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
604
|
-
);
|
|
605
|
-
return _hooks.useUndo();
|
|
606
|
-
}
|
|
607
|
-
function useUpdateMyPresence() {
|
|
608
|
-
_internal.deprecate.call(void 0,
|
|
609
|
-
"Please use `createRoomContext()` instead of importing `useUpdateMyPresence` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
610
|
-
);
|
|
611
|
-
return _hooks.useUpdateMyPresence();
|
|
612
|
-
}
|
|
613
|
-
function useList(key, items) {
|
|
614
|
-
_internal.deprecate.call(void 0,
|
|
615
|
-
"Please use `createRoomContext()` instead of importing `useList` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
616
|
-
);
|
|
617
|
-
return _hooks.useList_deprecated(key, items);
|
|
618
|
-
}
|
|
619
|
-
function useMap(key, entries) {
|
|
620
|
-
_internal.deprecate.call(void 0,
|
|
621
|
-
"Please use `createRoomContext()` instead of importing `useMap` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
622
|
-
);
|
|
623
|
-
return _hooks.useMap_deprecated(key, entries);
|
|
624
|
-
}
|
|
625
|
-
function useObject(key, initialData) {
|
|
626
|
-
_internal.deprecate.call(void 0,
|
|
627
|
-
"Please use `createRoomContext()` instead of importing `useObject` from `@liveblocks/react` directly. See https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details."
|
|
628
|
-
);
|
|
629
|
-
return _hooks.useObject_deprecated(key, initialData);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
399
|
|
|
652
400
|
|
|
653
|
-
exports.
|
|
401
|
+
exports.createRoomContext = createRoomContext;
|
package/index.mjs
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
import mod from "./index.js";
|
|
2
2
|
|
|
3
3
|
export default mod;
|
|
4
|
-
export const LiveblocksProvider = mod.LiveblocksProvider;
|
|
5
|
-
export const RoomProvider = mod.RoomProvider;
|
|
6
4
|
export const createRoomContext = mod.createRoomContext;
|
|
7
|
-
export const useBatch = mod.useBatch;
|
|
8
|
-
export const useBroadcastEvent = mod.useBroadcastEvent;
|
|
9
|
-
export const useClient = mod.useClient;
|
|
10
|
-
export const useErrorListener = mod.useErrorListener;
|
|
11
|
-
export const useEventListener = mod.useEventListener;
|
|
12
|
-
export const useHistory = mod.useHistory;
|
|
13
|
-
export const useList = mod.useList;
|
|
14
|
-
export const useMap = mod.useMap;
|
|
15
|
-
export const useMyPresence = mod.useMyPresence;
|
|
16
|
-
export const useObject = mod.useObject;
|
|
17
|
-
export const useOthers = mod.useOthers;
|
|
18
|
-
export const useRedo = mod.useRedo;
|
|
19
|
-
export const useRoom = mod.useRoom;
|
|
20
|
-
export const useSelf = mod.useSelf;
|
|
21
|
-
export const useStorage = mod.useStorage;
|
|
22
|
-
export const useStorageRoot = mod.useStorageRoot;
|
|
23
|
-
export const useUndo = mod.useUndo;
|
|
24
|
-
export const useUpdateMyPresence = mod.useUpdateMyPresence;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-beta0",
|
|
4
4
|
"description": "A set of React hooks and providers to use Liveblocks declaratively.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.mjs",
|
|
@@ -23,8 +23,11 @@
|
|
|
23
23
|
"url": "https://github.com/liveblocks/liveblocks/issues"
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"use-sync-external-store": "^1.2.0"
|
|
28
|
+
},
|
|
26
29
|
"peerDependencies": {
|
|
27
|
-
"@liveblocks/client": "0.
|
|
30
|
+
"@liveblocks/client": "0.18.0-beta0",
|
|
28
31
|
"react": "^16.14.0 || ^17 || ^18"
|
|
29
32
|
},
|
|
30
33
|
"repository": {
|