@liveblocks/react 0.17.11 → 0.18.0-beta2
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 +206 -231
- package/index.js +345 -498
- package/index.mjs +2 -20
- package/package.json +5 -2
package/.built-by-link-script
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b78a4b6045d3aab4fd9a5e4686ccac3b534923fe
|
package/index.d.ts
CHANGED
|
@@ -1,27 +1,43 @@
|
|
|
1
|
-
import { Client, JsonObject, LsonObject, BaseUserMeta, Json, Room, BroadcastOptions, History, Others, User, LiveObject, Lson, LiveList, LiveMap } from '@liveblocks/client';
|
|
2
|
-
export { Json, JsonObject } from '@liveblocks/client';
|
|
3
1
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { JsonObject, LsonObject, LiveObject, BaseUserMeta, Json, Client, Room, BroadcastOptions, History, Others, User } from '@liveblocks/client';
|
|
4
|
+
export { Json, JsonObject, shallow } from '@liveblocks/client';
|
|
5
|
+
import { ToImmutable, Resolve, RoomInitializers } from '@liveblocks/client/internal';
|
|
5
6
|
|
|
6
|
-
declare type
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
declare type Props = {
|
|
8
|
+
fallback: NonNullable<ReactNode> | null;
|
|
9
|
+
children: () => ReactNode | undefined;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Almost like a normal <Suspense> component, except that for server-side
|
|
13
|
+
* renders, the fallback will be used.
|
|
14
|
+
*
|
|
15
|
+
* The child props will have to be provided in a function, i.e. change:
|
|
16
|
+
*
|
|
17
|
+
* <Suspense fallback={<Loading />}>
|
|
18
|
+
* <MyRealComponent a={1} />
|
|
19
|
+
* </Suspense>
|
|
20
|
+
*
|
|
21
|
+
* To:
|
|
22
|
+
*
|
|
23
|
+
* <ClientSideSuspense fallback={<Loading />}>
|
|
24
|
+
* {() => <MyRealComponent a={1} />}
|
|
25
|
+
* </ClientSideSuspense>
|
|
12
26
|
*
|
|
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
27
|
*/
|
|
18
|
-
declare function
|
|
28
|
+
declare function ClientSideSuspense(props: Props): ReactElement;
|
|
29
|
+
|
|
19
30
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
31
|
+
* For any function type, returns a similar function type, but without the
|
|
32
|
+
* first argument.
|
|
22
33
|
*/
|
|
23
|
-
declare
|
|
24
|
-
|
|
34
|
+
declare type OmitFirstArg<F> = F extends (first: any, ...rest: infer A) => infer R ? (...args: A) => R : never;
|
|
35
|
+
declare type MutationContext<TPresence extends JsonObject, TStorage extends LsonObject> = {
|
|
36
|
+
root: LiveObject<TStorage>;
|
|
37
|
+
setMyPresence: (patch: Partial<TPresence>, options?: {
|
|
38
|
+
addToHistory: boolean;
|
|
39
|
+
}) => void;
|
|
40
|
+
};
|
|
25
41
|
declare type RoomProviderProps<TPresence extends JsonObject, TStorage extends LsonObject> = Resolve<{
|
|
26
42
|
/**
|
|
27
43
|
* The id of the room you want to connect to
|
|
@@ -43,7 +59,7 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
43
59
|
* All the modifications are merged in a single history item (undo/redo).
|
|
44
60
|
* All the subscribers are called only after the batch is over.
|
|
45
61
|
*/
|
|
46
|
-
useBatch(): (callback: () =>
|
|
62
|
+
useBatch<T>(): (callback: () => T) => T;
|
|
47
63
|
/**
|
|
48
64
|
* Returns a callback that lets you broadcast custom events to other users in the room
|
|
49
65
|
*
|
|
@@ -131,6 +147,33 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
131
147
|
* const object = useObject("obj");
|
|
132
148
|
*/
|
|
133
149
|
useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
150
|
+
/**
|
|
151
|
+
* Returns your entire Liveblocks Storage as an immutable data structure.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* const root = useStorage();
|
|
155
|
+
*/
|
|
156
|
+
useStorage(): ToImmutable<TStorage> | null;
|
|
157
|
+
/**
|
|
158
|
+
* Extract arbitrary data from the Liveblocks Storage state, using an
|
|
159
|
+
* arbitrary selector function.
|
|
160
|
+
*
|
|
161
|
+
* The selector function will get re-evaluated any time something changes in
|
|
162
|
+
* Storage. The value returned by your selector function will also be the
|
|
163
|
+
* value returned by the hook.
|
|
164
|
+
*
|
|
165
|
+
* The `root` value that gets passed to your selector function is
|
|
166
|
+
* a immutable/readonly version of your Liveblocks storage root.
|
|
167
|
+
*
|
|
168
|
+
* The component that uses this hook will automatically re-render if the
|
|
169
|
+
* returned value changes.
|
|
170
|
+
*
|
|
171
|
+
* By default `useStorage()` uses strict `===` to check for equality. Take
|
|
172
|
+
* extra care when returning a computed object or list, for example when you
|
|
173
|
+
* return the result of a .map() or .filter() call from the selector. In
|
|
174
|
+
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
175
|
+
*/
|
|
176
|
+
useStorage<T>(selector: (root: ToImmutable<TStorage>) => T, isEqual?: (prev: T, curr: T) => boolean): T | null;
|
|
134
177
|
/**
|
|
135
178
|
* Returns the presence of the current user of the current room, and a function to update it.
|
|
136
179
|
* It is different from the setState function returned by the useState hook from React.
|
|
@@ -145,263 +188,195 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
145
188
|
*/
|
|
146
189
|
useMyPresence(): [
|
|
147
190
|
TPresence,
|
|
148
|
-
(
|
|
191
|
+
(patch: Partial<TPresence>, options?: {
|
|
149
192
|
addToHistory: boolean;
|
|
150
193
|
}) => void
|
|
151
194
|
];
|
|
152
195
|
/**
|
|
153
|
-
* Returns an object that lets you get information about all the
|
|
196
|
+
* Returns an object that lets you get information about all the users
|
|
197
|
+
* currently connected in the room.
|
|
154
198
|
*
|
|
155
199
|
* @example
|
|
156
200
|
* const others = useOthers();
|
|
157
201
|
*
|
|
158
202
|
* // Example to map all cursors in JSX
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
203
|
+
* return (
|
|
204
|
+
* <>
|
|
205
|
+
* {others.map((user) => {
|
|
206
|
+
* if (user.presence.cursor == null) {
|
|
207
|
+
* return null;
|
|
208
|
+
* }
|
|
209
|
+
* return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
|
|
210
|
+
* })}
|
|
211
|
+
* </>
|
|
212
|
+
* )
|
|
167
213
|
*/
|
|
168
214
|
useOthers(): Others<TPresence, TUserMeta>;
|
|
169
215
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
*
|
|
216
|
+
* Extract arbitrary data based on all the users currently connected in the
|
|
217
|
+
* room (except yourself).
|
|
218
|
+
*
|
|
219
|
+
* The selector function will get re-evaluated any time a user enters or
|
|
220
|
+
* leaves the room, as well as whenever their presence data changes.
|
|
221
|
+
*
|
|
222
|
+
* The component that uses this hook will automatically re-render if your
|
|
223
|
+
* selector function returns a different value from its previous run.
|
|
224
|
+
*
|
|
225
|
+
* By default `useOthers()` uses strict `===` to check for equality. Take
|
|
226
|
+
* extra care when returning a computed object or list, for example when you
|
|
227
|
+
* return the result of a .map() or .filter() call from the selector. In
|
|
228
|
+
* those cases, you'll probably want to use a `shallow` comparison check.
|
|
176
229
|
*
|
|
177
230
|
* @example
|
|
178
|
-
* const
|
|
231
|
+
* const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
|
|
232
|
+
* const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
|
|
233
|
+
* const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
|
|
234
|
+
*
|
|
179
235
|
*/
|
|
180
|
-
|
|
236
|
+
useOthers<T>(selector: (others: Others<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
181
237
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
238
|
+
* Related to useOthers(), but optimized for selecting only "subsets" of
|
|
239
|
+
* others. This is useful for performance reasons in particular, because
|
|
240
|
+
* selecting only a subset of users also means limiting the number of
|
|
241
|
+
* re-renders that will be triggered.
|
|
242
|
+
*
|
|
243
|
+
* Note that there are two ways to use this hook, and depending on how you
|
|
244
|
+
* call it, the return value will be slightly different.
|
|
184
245
|
*
|
|
185
246
|
* @example
|
|
186
|
-
* const
|
|
187
|
-
|
|
188
|
-
useStorageRoot(): [root: LiveObject<TStorage> | null];
|
|
189
|
-
/**
|
|
190
|
-
* @deprecated In the next major version, we're changing the meaning of `useStorage()`.
|
|
191
|
-
* Please use `useStorageRoot()` instead for the current behavior.
|
|
247
|
+
* const ids = useOtherIds();
|
|
248
|
+
* // ^^^ number[]
|
|
192
249
|
*/
|
|
193
|
-
|
|
250
|
+
useOtherIds(): readonly number[];
|
|
194
251
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
252
|
+
* Related to useOthers(), but optimized for selecting only "subsets" of
|
|
253
|
+
* others. This is useful for performance reasons in particular, because
|
|
254
|
+
* selecting only a subset of users also means limiting the number of
|
|
255
|
+
* re-renders that will be triggered.
|
|
256
|
+
*
|
|
257
|
+
* Note that there are two ways to use this hook, and depending on how you
|
|
258
|
+
* call it, the return value will be slightly different.
|
|
197
259
|
*
|
|
198
260
|
* @example
|
|
199
|
-
* const
|
|
200
|
-
*
|
|
201
|
-
*
|
|
261
|
+
* const avatars = useOtherIds(user => user.info.avatar);
|
|
262
|
+
* // ^^^^^^^
|
|
263
|
+
* // { connectionId: number; data: string }[]
|
|
202
264
|
*
|
|
203
|
-
*
|
|
265
|
+
* The selector function you pass to useOtherIds() is called an "item
|
|
266
|
+
* selector", and operates on a single user at a time. If you provide an
|
|
267
|
+
* (optional) comparison function, it will also work on the _item_ level.
|
|
268
|
+
*
|
|
269
|
+
* For example, to select multiple properties:
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* const avatarsAndCursors = useOtherIds(
|
|
273
|
+
* user => [u.info.avatar, u.presence.cursor],
|
|
274
|
+
* shallow, // ❗️
|
|
275
|
+
* );
|
|
204
276
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
277
|
+
useOtherIds<T>(itemSelector: (other: User<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): readonly {
|
|
278
|
+
readonly connectionId: number;
|
|
279
|
+
readonly data: T;
|
|
280
|
+
}[];
|
|
208
281
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
282
|
+
* Given a connection ID (as obtained by using `useOtherIds()`), you can call
|
|
283
|
+
* this selector deep down in your component stack to only have the component
|
|
284
|
+
* re-render if properties for this particular connection change.
|
|
211
285
|
*
|
|
212
|
-
* @
|
|
213
|
-
*
|
|
286
|
+
* @example
|
|
287
|
+
* // Returns full user and re-renders whenever anything on the user changes
|
|
288
|
+
* const secondUser = useOther(2);
|
|
289
|
+
*/
|
|
290
|
+
useOther(connectionId: number): User<TPresence, TUserMeta>;
|
|
291
|
+
/**
|
|
292
|
+
* Given a connection ID (as obtained by using `useOtherIds()`), you can call
|
|
293
|
+
* this selector deep down in your component stack to only have the component
|
|
294
|
+
* re-render if properties for this particular connection change.
|
|
214
295
|
*
|
|
215
296
|
* @example
|
|
216
|
-
*
|
|
297
|
+
* // Returns only the selected values re-renders whenever that selection changes)
|
|
298
|
+
* const { x, y } = useOther(2, user => user.presence.cursor);
|
|
217
299
|
*/
|
|
218
|
-
|
|
300
|
+
useOther<T>(connectionId: number, selector: (other: User<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
219
301
|
/**
|
|
220
|
-
*
|
|
221
|
-
*
|
|
302
|
+
* Returns the Room of the nearest RoomProvider above in the React component
|
|
303
|
+
* tree.
|
|
222
304
|
*/
|
|
223
|
-
|
|
305
|
+
useRoom(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
|
|
224
306
|
/**
|
|
225
|
-
*
|
|
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
|
|
307
|
+
* Gets the current user once it is connected to the room.
|
|
230
308
|
*
|
|
231
309
|
* @example
|
|
232
|
-
* const
|
|
310
|
+
* const me = useSelf();
|
|
311
|
+
* const { x, y } = me.presence.cursor;
|
|
233
312
|
*/
|
|
234
|
-
|
|
313
|
+
useSelf(): User<TPresence, TUserMeta> | null;
|
|
235
314
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
315
|
+
* Extract arbitrary data based on the current user.
|
|
316
|
+
*
|
|
317
|
+
* The selector function will get re-evaluated any time your presence data
|
|
318
|
+
* changes.
|
|
319
|
+
*
|
|
320
|
+
* The component that uses this hook will automatically re-render if your
|
|
321
|
+
* selector function returns a different value from its previous run.
|
|
322
|
+
*
|
|
323
|
+
* By default `useSelf()` uses strict `===` to check for equality. Take extra
|
|
324
|
+
* care when returning a computed object or list, for example when you return
|
|
325
|
+
* the result of a .map() or .filter() call from the selector. In those
|
|
326
|
+
* cases, you'll probably want to use a `shallow` comparison check.
|
|
327
|
+
*
|
|
328
|
+
* Will return `null` while Liveblocks isn't connected to a room yet.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* const cursor = useSelf(me => me.presence.cursor);
|
|
332
|
+
* if (cursor !== null) {
|
|
333
|
+
* const { x, y } = cursor;
|
|
334
|
+
* }
|
|
335
|
+
*
|
|
238
336
|
*/
|
|
239
|
-
|
|
337
|
+
useSelf<T>(selector: (me: User<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): T | null;
|
|
240
338
|
/**
|
|
241
|
-
* Returns the
|
|
242
|
-
*
|
|
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
|
|
339
|
+
* Returns the mutable (!) Storage root. This hook exists for
|
|
340
|
+
* backward-compatible reasons.
|
|
246
341
|
*
|
|
247
342
|
* @example
|
|
248
|
-
* const
|
|
343
|
+
* const [root] = useStorageRoot();
|
|
249
344
|
*/
|
|
250
|
-
|
|
345
|
+
useStorageRoot(): [root: LiveObject<TStorage> | null];
|
|
251
346
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
347
|
+
* useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
|
|
348
|
+
* 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.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* const updateMyPresence = useUpdateMyPresence();
|
|
352
|
+
* updateMyPresence({ x: 0 });
|
|
353
|
+
* updateMyPresence({ y: 0 });
|
|
354
|
+
*
|
|
355
|
+
* // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
|
|
254
356
|
*/
|
|
255
|
-
|
|
357
|
+
useUpdateMyPresence(): (patch: Partial<TPresence>, options?: {
|
|
358
|
+
addToHistory: boolean;
|
|
359
|
+
}) => void;
|
|
360
|
+
useMutation<F extends (context: MutationContext<TPresence, TStorage>, ...args: any[]) => any>(callback: F, deps?: unknown[]): OmitFirstArg<F>;
|
|
361
|
+
suspense: {
|
|
362
|
+
useStorage(): ToImmutable<TStorage>;
|
|
363
|
+
useStorage<T>(selector: (root: ToImmutable<TStorage>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
364
|
+
useSelf(): User<TPresence, TUserMeta>;
|
|
365
|
+
useSelf<T>(selector: (me: User<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
366
|
+
useOthers(): Others<TPresence, TUserMeta>;
|
|
367
|
+
useOthers<T>(selector: (others: Others<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
368
|
+
useOtherIds(): readonly number[];
|
|
369
|
+
useOtherIds<T>(itemSelector: (other: User<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): readonly {
|
|
370
|
+
readonly connectionId: number;
|
|
371
|
+
readonly data: T;
|
|
372
|
+
}[];
|
|
373
|
+
useOther(connectionId: number): User<TPresence, TUserMeta>;
|
|
374
|
+
useOther<T>(connectionId: number, selector: (other: User<TPresence, TUserMeta>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
|
|
375
|
+
useList<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
376
|
+
useMap<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
377
|
+
useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
378
|
+
};
|
|
256
379
|
};
|
|
257
380
|
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
381
|
|
|
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 };
|
|
382
|
+
export { ClientSideSuspense, MutationContext, createRoomContext };
|