@liveblocks/react 0.17.8 → 0.17.9

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/index.d.ts CHANGED
@@ -1,27 +1,11 @@
1
- /// <reference types="react" />
2
- import {
3
- Client,
4
- JsonObject,
5
- LsonObject,
6
- BaseUserMeta,
7
- Json,
8
- Room,
9
- BroadcastOptions,
10
- History,
11
- Others,
12
- User,
13
- LiveObject,
14
- Lson,
15
- LiveList,
16
- LiveMap,
17
- } from "@liveblocks/client";
18
- export { Json, JsonObject } from "@liveblocks/client";
19
- import * as React from "react";
20
- import { Resolve, RoomInitializers } from "@liveblocks/client/internal";
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
+ import * as React from 'react';
4
+ import { Resolve, RoomInitializers } from '@liveblocks/client/internal';
21
5
 
22
6
  declare type LiveblocksProviderProps = {
23
- children: React.ReactNode;
24
- client: Client;
7
+ children: React.ReactNode;
8
+ client: Client;
25
9
  };
26
10
  /**
27
11
  * Makes the Liveblocks client available in the component hierarchy below.
@@ -31,289 +15,241 @@ declare type LiveblocksProviderProps = {
31
15
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for
32
16
  * details.
33
17
  */
34
- declare function LiveblocksProvider(
35
- props: LiveblocksProviderProps
36
- ): JSX.Element;
18
+ declare function LiveblocksProvider(props: LiveblocksProviderProps): JSX.Element;
37
19
  /**
38
20
  * Returns the Client of the nearest LiveblocksProvider above in the React
39
21
  * component tree.
40
22
  */
41
23
  declare function useClient(): Client;
42
24
 
43
- declare type RoomProviderProps<
44
- TPresence extends JsonObject,
45
- TStorage extends LsonObject
46
- > = Resolve<
47
- {
25
+ declare type RoomProviderProps<TPresence extends JsonObject, TStorage extends LsonObject> = Resolve<{
48
26
  /**
49
27
  * The id of the room you want to connect to
50
28
  */
51
29
  id: string;
52
30
  children: React.ReactNode;
53
- } & RoomInitializers<TPresence, TStorage>
54
- >;
55
- declare type RoomContextBundle<
56
- TPresence extends JsonObject,
57
- TStorage extends LsonObject,
58
- TUserMeta extends BaseUserMeta,
59
- TRoomEvent extends Json
60
- > = {
61
- RoomContext: React.Context<Room<
62
- TPresence,
63
- TStorage,
64
- TUserMeta,
65
- TRoomEvent
66
- > | null>;
67
- /**
68
- * Makes a Room available in the component hierarchy below.
69
- * When this component is unmounted, the current user leave the room.
70
- * That means that you can't have 2 RoomProvider with the same room id in your react tree.
71
- */
72
- RoomProvider(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
73
- /**
74
- * Returns a function that batches modifications made during the given function.
75
- * All the modifications are sent to other clients in a single message.
76
- * All the modifications are merged in a single history item (undo/redo).
77
- * All the subscribers are called only after the batch is over.
78
- */
79
- useBatch(): (callback: () => void) => void;
80
- /**
81
- * Returns a callback that lets you broadcast custom events to other users in the room
82
- *
83
- * @example
84
- * const broadcast = useBroadcastEvent();
85
- *
86
- * broadcast({ type: "CUSTOM_EVENT", data: { x: 0, y: 0 } });
87
- */
88
- useBroadcastEvent(): (event: TRoomEvent, options?: BroadcastOptions) => void;
89
- /**
90
- * useErrorListener is a react hook that lets you react to potential room connection errors.
91
- *
92
- * @example
93
- * useErrorListener(er => {
94
- * console.error(er);
95
- * })
96
- */
97
- useErrorListener(callback: (err: Error) => void): void;
98
- /**
99
- * useEventListener is a react hook that lets you react to event broadcasted by other users in the room.
100
- *
101
- * @example
102
- * useEventListener(({ connectionId, event }) => {
103
- * if (event.type === "CUSTOM_EVENT") {
104
- * // Do something
105
- * }
106
- * });
107
- */
108
- useEventListener(
109
- callback: (eventData: { connectionId: number; event: TRoomEvent }) => void
110
- ): void;
111
- /**
112
- * Returns the room.history
113
- */
114
- useHistory(): History;
115
- /**
116
- * Returns a function that undoes the last operation executed by the current client.
117
- * It does not impact operations made by other clients.
118
- */
119
- useUndo(): () => void;
120
- /**
121
- * Returns a function that redoes the last operation executed by the current client.
122
- * It does not impact operations made by other clients.
123
- */
124
- useRedo(): () => void;
125
- /**
126
- * Returns whether there are any operations to undo.
127
- */
128
- useCanUndo(): boolean;
129
- /**
130
- * Returns whether there are any operations to redo.
131
- */
132
- useCanRedo(): boolean;
133
- /**
134
- * Returns the LiveList associated with the provided key.
135
- * The hook triggers a re-render if the LiveList is updated, however it does not triggers a re-render if a nested CRDT is updated.
136
- *
137
- * @param key The storage key associated with the LiveList
138
- * @returns null while the storage is loading, otherwise, returns the LiveList associated to the storage
139
- *
140
- * @example
141
- * const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
142
- */
143
- useList<TKey extends Extract<keyof TStorage, string>>(
144
- key: TKey
145
- ): TStorage[TKey] | null;
146
- /**
147
- * Returns the LiveMap associated with the provided key. If the LiveMap does not exist, a new empty LiveMap will be created.
148
- * 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.
149
- *
150
- * @param key The storage key associated with the LiveMap
151
- * @returns null while the storage is loading, otherwise, returns the LiveMap associated to the storage
152
- *
153
- * @example
154
- * const shapesById = useMap("shapes");
155
- */
156
- useMap<TKey extends Extract<keyof TStorage, string>>(
157
- key: TKey
158
- ): TStorage[TKey] | null;
159
- /**
160
- * Returns the LiveObject associated with the provided key.
161
- * 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.
162
- *
163
- * @param key The storage key associated with the LiveObject
164
- * @returns null while the storage is loading, otherwise, returns the LveObject associated to the storage
165
- *
166
- * @example
167
- * const object = useObject("obj");
168
- */
169
- useObject<TKey extends Extract<keyof TStorage, string>>(
170
- key: TKey
171
- ): TStorage[TKey] | null;
172
- /**
173
- * Returns the presence of the current user of the current room, and a function to update it.
174
- * It is different from the setState function returned by the useState hook from React.
175
- * You don't need to pass the full presence object to update it.
176
- *
177
- * @example
178
- * const [myPresence, updateMyPresence] = useMyPresence();
179
- * updateMyPresence({ x: 0 });
180
- * updateMyPresence({ y: 0 });
181
- *
182
- * // At the next render, "myPresence" will be equal to "{ x: 0, y: 0 }"
183
- */
184
- useMyPresence(): [
185
- TPresence,
186
- (
187
- overrides: Partial<TPresence>,
188
- options?: {
31
+ } & RoomInitializers<TPresence, TStorage>>;
32
+ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends LsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json> = {
33
+ RoomContext: React.Context<Room<TPresence, TStorage, TUserMeta, TRoomEvent> | null>;
34
+ /**
35
+ * Makes a Room available in the component hierarchy below.
36
+ * When this component is unmounted, the current user leave the room.
37
+ * That means that you can't have 2 RoomProvider with the same room id in your react tree.
38
+ */
39
+ RoomProvider(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
40
+ /**
41
+ * Returns a function that batches modifications made during the given function.
42
+ * All the modifications are sent to other clients in a single message.
43
+ * All the modifications are merged in a single history item (undo/redo).
44
+ * All the subscribers are called only after the batch is over.
45
+ */
46
+ useBatch(): (callback: () => void) => void;
47
+ /**
48
+ * Returns a callback that lets you broadcast custom events to other users in the room
49
+ *
50
+ * @example
51
+ * const broadcast = useBroadcastEvent();
52
+ *
53
+ * broadcast({ type: "CUSTOM_EVENT", data: { x: 0, y: 0 } });
54
+ */
55
+ useBroadcastEvent(): (event: TRoomEvent, options?: BroadcastOptions) => void;
56
+ /**
57
+ * useErrorListener is a react hook that lets you react to potential room connection errors.
58
+ *
59
+ * @example
60
+ * useErrorListener(er => {
61
+ * console.error(er);
62
+ * })
63
+ */
64
+ useErrorListener(callback: (err: Error) => void): void;
65
+ /**
66
+ * useEventListener is a react hook that lets you react to event broadcasted by other users in the room.
67
+ *
68
+ * @example
69
+ * useEventListener(({ connectionId, event }) => {
70
+ * if (event.type === "CUSTOM_EVENT") {
71
+ * // Do something
72
+ * }
73
+ * });
74
+ */
75
+ useEventListener(callback: (eventData: {
76
+ connectionId: number;
77
+ event: TRoomEvent;
78
+ }) => void): void;
79
+ /**
80
+ * Returns the room.history
81
+ */
82
+ useHistory(): History;
83
+ /**
84
+ * Returns a function that undoes the last operation executed by the current client.
85
+ * It does not impact operations made by other clients.
86
+ */
87
+ useUndo(): () => void;
88
+ /**
89
+ * Returns a function that redoes the last operation executed by the current client.
90
+ * It does not impact operations made by other clients.
91
+ */
92
+ useRedo(): () => void;
93
+ /**
94
+ * Returns whether there are any operations to undo.
95
+ */
96
+ useCanUndo(): boolean;
97
+ /**
98
+ * Returns whether there are any operations to redo.
99
+ */
100
+ useCanRedo(): boolean;
101
+ /**
102
+ * Returns the LiveList associated with the provided key.
103
+ * The hook triggers a re-render if the LiveList is updated, however it does not triggers a re-render if a nested CRDT is updated.
104
+ *
105
+ * @param key The storage key associated with the LiveList
106
+ * @returns null while the storage is loading, otherwise, returns the LiveList associated to the storage
107
+ *
108
+ * @example
109
+ * const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
110
+ */
111
+ useList<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
112
+ /**
113
+ * Returns the LiveMap associated with the provided key. If the LiveMap does not exist, a new empty LiveMap will be created.
114
+ * 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.
115
+ *
116
+ * @param key The storage key associated with the LiveMap
117
+ * @returns null while the storage is loading, otherwise, returns the LiveMap associated to the storage
118
+ *
119
+ * @example
120
+ * const shapesById = useMap("shapes");
121
+ */
122
+ useMap<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
123
+ /**
124
+ * Returns the LiveObject associated with the provided key.
125
+ * 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.
126
+ *
127
+ * @param key The storage key associated with the LiveObject
128
+ * @returns null while the storage is loading, otherwise, returns the LveObject associated to the storage
129
+ *
130
+ * @example
131
+ * const object = useObject("obj");
132
+ */
133
+ useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
134
+ /**
135
+ * Returns the presence of the current user of the current room, and a function to update it.
136
+ * It is different from the setState function returned by the useState hook from React.
137
+ * You don't need to pass the full presence object to update it.
138
+ *
139
+ * @example
140
+ * const [myPresence, updateMyPresence] = useMyPresence();
141
+ * updateMyPresence({ x: 0 });
142
+ * updateMyPresence({ y: 0 });
143
+ *
144
+ * // At the next render, "myPresence" will be equal to "{ x: 0, y: 0 }"
145
+ */
146
+ useMyPresence(): [
147
+ TPresence,
148
+ (overrides: Partial<TPresence>, options?: {
149
+ addToHistory: boolean;
150
+ }) => void
151
+ ];
152
+ /**
153
+ * Returns an object that lets you get information about all the the users currently connected in the room.
154
+ *
155
+ * @example
156
+ * const others = useOthers();
157
+ *
158
+ * // Example to map all cursors in JSX
159
+ * {
160
+ * others.map((user) => {
161
+ * if (user.presence?.cursor == null) {
162
+ * return null;
163
+ * }
164
+ * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
165
+ * })
166
+ * }
167
+ */
168
+ useOthers(): Others<TPresence, TUserMeta>;
169
+ /**
170
+ * Returns the Room of the nearest RoomProvider above in the React component
171
+ * tree.
172
+ */
173
+ useRoom(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
174
+ /**
175
+ * Gets the current user once it is connected to the room.
176
+ *
177
+ * @example
178
+ * const user = useSelf();
179
+ */
180
+ useSelf(): User<TPresence, TUserMeta> | null;
181
+ /**
182
+ * Returns the LiveObject instance that is the root of your entire Liveblocks
183
+ * Storage.
184
+ *
185
+ * @example
186
+ * const [root] = useStorage();
187
+ */
188
+ useStorage(): [root: LiveObject<TStorage> | null];
189
+ /**
190
+ * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
191
+ * 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.
192
+ *
193
+ * @example
194
+ * const updateMyPresence = useUpdateMyPresence();
195
+ * updateMyPresence({ x: 0 });
196
+ * updateMyPresence({ y: 0 });
197
+ *
198
+ * // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
199
+ */
200
+ useUpdateMyPresence(): (overrides: Partial<TPresence>, options?: {
189
201
  addToHistory: boolean;
190
- }
191
- ) => void
192
- ];
193
- /**
194
- * Returns an object that lets you get information about all the the users currently connected in the room.
195
- *
196
- * @example
197
- * const others = useOthers();
198
- *
199
- * // Example to map all cursors in JSX
200
- * {
201
- * others.map((user) => {
202
- * if (user.presence?.cursor == null) {
203
- * return null;
204
- * }
205
- * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
206
- * })
207
- * }
208
- */
209
- useOthers(): Others<TPresence, TUserMeta>;
210
- /**
211
- * Returns the Room of the nearest RoomProvider above in the React component
212
- * tree.
213
- */
214
- useRoom(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
215
- /**
216
- * Gets the current user once it is connected to the room.
217
- *
218
- * @example
219
- * const user = useSelf();
220
- */
221
- useSelf(): User<TPresence, TUserMeta> | null;
222
- /**
223
- * Returns the LiveObject instance that is the root of your entire Liveblocks
224
- * Storage.
225
- *
226
- * @example
227
- * const [root] = useStorage();
228
- */
229
- useStorage(): [root: LiveObject<TStorage> | null];
230
- /**
231
- * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
232
- * 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.
233
- *
234
- * @example
235
- * const updateMyPresence = useUpdateMyPresence();
236
- * updateMyPresence({ x: 0 });
237
- * updateMyPresence({ y: 0 });
238
- *
239
- * // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
240
- */
241
- useUpdateMyPresence(): (
242
- overrides: Partial<TPresence>,
243
- options?: {
244
- addToHistory: boolean;
245
- }
246
- ) => void;
247
- /**
248
- * Returns the LiveList associated with the provided key.
249
- * The hook triggers a re-render if the LiveList is updated, however it does not triggers a re-render if a nested CRDT is updated.
250
- *
251
- * @param key The storage key associated with the LiveList
252
- * @returns null while the storage is loading, otherwise, returns the LiveList associated to the storage
253
- *
254
- * @example
255
- * const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
256
- */
257
- useList_deprecated<TValue extends Lson>(key: string): LiveList<TValue> | null;
258
- /**
259
- * @deprecated We no longer recommend initializing the
260
- * items from the useList() hook. For details, see https://bit.ly/3Niy5aP.
261
- */
262
- useList_deprecated<TValue extends Lson>(
263
- key: string,
264
- items: TValue[]
265
- ): LiveList<TValue> | null;
266
- /**
267
- * Returns the LiveMap associated with the provided key. If the LiveMap does not exist, a new empty LiveMap will be created.
268
- * 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.
269
- *
270
- * @param key The storage key associated with the LiveMap
271
- * @returns null while the storage is loading, otherwise, returns the LiveMap associated to the storage
272
- *
273
- * @example
274
- * const shapesById = useMap("shapes");
275
- */
276
- useMap_deprecated<TKey extends string, TValue extends Lson>(
277
- key: string
278
- ): LiveMap<TKey, TValue> | null;
279
- /**
280
- * @deprecated We no longer recommend initializing the
281
- * entries from the useMap() hook. For details, see https://bit.ly/3Niy5aP.
282
- */
283
- useMap_deprecated<TKey extends string, TValue extends Lson>(
284
- key: string,
285
- entries: readonly (readonly [TKey, TValue])[] | null
286
- ): LiveMap<TKey, TValue> | null;
287
- /**
288
- * Returns the LiveObject associated with the provided key.
289
- * 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.
290
- *
291
- * @param key The storage key associated with the LiveObject
292
- * @returns null while the storage is loading, otherwise, returns the LveObject associated to the storage
293
- *
294
- * @example
295
- * const object = useObject("obj");
296
- */
297
- useObject_deprecated<TData extends LsonObject>(
298
- key: string
299
- ): LiveObject<TData> | null;
300
- /**
301
- * @deprecated We no longer recommend initializing the fields from the
302
- * useObject() hook. For details, see https://bit.ly/3Niy5aP.
303
- */
304
- useObject_deprecated<TData extends LsonObject>(
305
- key: string,
306
- initialData: TData
307
- ): LiveObject<TData> | null;
202
+ }) => void;
203
+ /**
204
+ * Returns the LiveList associated with the provided key.
205
+ * The hook triggers a re-render if the LiveList is updated, however it does not triggers a re-render if a nested CRDT is updated.
206
+ *
207
+ * @param key The storage key associated with the LiveList
208
+ * @returns null while the storage is loading, otherwise, returns the LiveList associated to the storage
209
+ *
210
+ * @example
211
+ * const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
212
+ */
213
+ useList_deprecated<TValue extends Lson>(key: string): LiveList<TValue> | null;
214
+ /**
215
+ * @deprecated We no longer recommend initializing the
216
+ * items from the useList() hook. For details, see https://bit.ly/3Niy5aP.
217
+ */
218
+ useList_deprecated<TValue extends Lson>(key: string, items: TValue[]): LiveList<TValue> | null;
219
+ /**
220
+ * Returns the LiveMap associated with the provided key. If the LiveMap does not exist, a new empty LiveMap will be created.
221
+ * 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.
222
+ *
223
+ * @param key The storage key associated with the LiveMap
224
+ * @returns null while the storage is loading, otherwise, returns the LiveMap associated to the storage
225
+ *
226
+ * @example
227
+ * const shapesById = useMap("shapes");
228
+ */
229
+ useMap_deprecated<TKey extends string, TValue extends Lson>(key: string): LiveMap<TKey, TValue> | null;
230
+ /**
231
+ * @deprecated We no longer recommend initializing the
232
+ * entries from the useMap() hook. For details, see https://bit.ly/3Niy5aP.
233
+ */
234
+ useMap_deprecated<TKey extends string, TValue extends Lson>(key: string, entries: readonly (readonly [TKey, TValue])[] | null): LiveMap<TKey, TValue> | null;
235
+ /**
236
+ * Returns the LiveObject associated with the provided key.
237
+ * 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.
238
+ *
239
+ * @param key The storage key associated with the LiveObject
240
+ * @returns null while the storage is loading, otherwise, returns the LveObject associated to the storage
241
+ *
242
+ * @example
243
+ * const object = useObject("obj");
244
+ */
245
+ useObject_deprecated<TData extends LsonObject>(key: string): LiveObject<TData> | null;
246
+ /**
247
+ * @deprecated We no longer recommend initializing the fields from the
248
+ * useObject() hook. For details, see https://bit.ly/3Niy5aP.
249
+ */
250
+ useObject_deprecated<TData extends LsonObject>(key: string, initialData: TData): LiveObject<TData> | null;
308
251
  };
309
- declare function createRoomContext<
310
- TPresence extends JsonObject,
311
- TStorage extends LsonObject = LsonObject,
312
- TUserMeta extends BaseUserMeta = BaseUserMeta,
313
- TRoomEvent extends Json = never
314
- >(
315
- client: Client
316
- ): RoomContextBundle<TPresence, TStorage, TUserMeta, TRoomEvent>;
252
+ 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>;
317
253
 
318
254
  /**
319
255
  * NOTE:
@@ -327,10 +263,7 @@ declare function createRoomContext<
327
263
  * `RoomProvider` from `@liveblocks/react` directly. See
328
264
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
329
265
  */
330
- declare function RoomProvider<
331
- TPresence extends JsonObject,
332
- TStorage extends LsonObject
333
- >(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
266
+ declare function RoomProvider<TPresence extends JsonObject, TStorage extends LsonObject>(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
334
267
  /**
335
268
  * @deprecated Please use `createRoomContext()` instead of importing
336
269
  * `useBatch` from `@liveblocks/react` directly. See
@@ -342,10 +275,7 @@ declare function useBatch(): (callback: () => void) => void;
342
275
  * `useBroadcastEvent` from `@liveblocks/react` directly. See
343
276
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
344
277
  */
345
- declare function useBroadcastEvent<TRoomEvent extends Json>(): (
346
- event: TRoomEvent,
347
- options?: BroadcastOptions
348
- ) => void;
278
+ declare function useBroadcastEvent<TRoomEvent extends Json>(): (event: TRoomEvent, options?: BroadcastOptions) => void;
349
279
  /**
350
280
  * @deprecated Please use `createRoomContext()` instead of importing
351
281
  * `useErrorListener` from `@liveblocks/react` directly. See
@@ -357,9 +287,10 @@ declare function useErrorListener(callback: (err: Error) => void): void;
357
287
  * `useEventListener` from `@liveblocks/react` directly. See
358
288
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
359
289
  */
360
- declare function useEventListener<TRoomEvent extends Json>(
361
- callback: (eventData: { connectionId: number; event: TRoomEvent }) => void
362
- ): void;
290
+ declare function useEventListener<TRoomEvent extends Json>(callback: (eventData: {
291
+ connectionId: number;
292
+ event: TRoomEvent;
293
+ }) => void): void;
363
294
  /**
364
295
  * @deprecated Please use `createRoomContext()` instead of importing
365
296
  * `useHistory` from `@liveblocks/react` directly. See
@@ -372,23 +303,17 @@ declare function useHistory(): History;
372
303
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
373
304
  */
374
305
  declare function useMyPresence<TPresence extends JsonObject>(): [
375
- TPresence,
376
- (
377
- overrides: Partial<TPresence>,
378
- options?: {
379
- addToHistory: boolean;
380
- }
381
- ) => void
306
+ TPresence,
307
+ (overrides: Partial<TPresence>, options?: {
308
+ addToHistory: boolean;
309
+ }) => void
382
310
  ];
383
311
  /**
384
312
  * @deprecated Please use `createRoomContext()` instead of importing
385
313
  * `useOthers` from `@liveblocks/react` directly. See
386
314
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
387
315
  */
388
- declare function useOthers<
389
- TPresence extends JsonObject,
390
- TUserMeta extends BaseUserMeta
391
- >(): Others<TPresence, TUserMeta>;
316
+ declare function useOthers<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>(): Others<TPresence, TUserMeta>;
392
317
  /**
393
318
  * @deprecated Please use `createRoomContext()` instead of importing
394
319
  * `useRedo` from `@liveblocks/react` directly. See
@@ -400,28 +325,20 @@ declare function useRedo(): () => void;
400
325
  * `useRoom` from `@liveblocks/react` directly. See
401
326
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
402
327
  */
403
- declare function useRoom<
404
- TPresence extends JsonObject,
405
- TStorage extends LsonObject,
406
- TUserMeta extends BaseUserMeta,
407
- TRoomEvent extends Json
408
- >(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
328
+ declare function useRoom<TPresence extends JsonObject, TStorage extends LsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json>(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
409
329
  /**
410
330
  * @deprecated Please use `createRoomContext()` instead of importing
411
331
  * `useSelf` from `@liveblocks/react` directly. See
412
332
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
413
333
  */
414
- declare function useSelf<
415
- TPresence extends JsonObject,
416
- TUserMeta extends BaseUserMeta
417
- >(): User<TPresence, TUserMeta> | null;
334
+ declare function useSelf<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>(): User<TPresence, TUserMeta> | null;
418
335
  /**
419
336
  * @deprecated Please use `createRoomContext()` instead of importing
420
337
  * `useStorage` from `@liveblocks/react` directly. See
421
338
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
422
339
  */
423
340
  declare function useStorage<TStorage extends LsonObject>(): [
424
- root: LiveObject<TStorage> | null
341
+ root: LiveObject<TStorage> | null
425
342
  ];
426
343
  /**
427
344
  * @deprecated Please use `createRoomContext()` instead of importing
@@ -434,83 +351,44 @@ declare function useUndo(): () => void;
434
351
  * `useUpdateMyPresence` from `@liveblocks/react` directly. See
435
352
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
436
353
  */
437
- declare function useUpdateMyPresence<TPresence extends JsonObject>(): (
438
- overrides: Partial<TPresence>,
439
- options?: {
354
+ declare function useUpdateMyPresence<TPresence extends JsonObject>(): (overrides: Partial<TPresence>, options?: {
440
355
  addToHistory: boolean;
441
- }
442
- ) => void;
356
+ }) => void;
443
357
  /**
444
358
  * @deprecated Please use `createRoomContext()` instead of importing
445
359
  * `useList` from `@liveblocks/react` directly. See
446
360
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
447
361
  */
448
- declare function useList<TValue extends Lson>(
449
- key: string
450
- ): LiveList<TValue> | null;
362
+ declare function useList<TValue extends Lson>(key: string): LiveList<TValue> | null;
451
363
  /**
452
364
  * @deprecated Please use `createRoomContext()` instead of importing
453
365
  * `useList` from `@liveblocks/react` directly. See
454
366
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
455
367
  */
456
- declare function useList<TValue extends Lson>(
457
- key: string,
458
- items: TValue[]
459
- ): LiveList<TValue> | null;
368
+ declare function useList<TValue extends Lson>(key: string, items: TValue[]): LiveList<TValue> | null;
460
369
  /**
461
370
  * @deprecated Please use `createRoomContext()` instead of importing
462
371
  * `useMap` from `@liveblocks/react` directly. See
463
372
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
464
373
  */
465
- declare function useMap<TKey extends string, TValue extends Lson>(
466
- key: string
467
- ): LiveMap<TKey, TValue> | null;
374
+ declare function useMap<TKey extends string, TValue extends Lson>(key: string): LiveMap<TKey, TValue> | null;
468
375
  /**
469
376
  * @deprecated Please use `createRoomContext()` instead of importing
470
377
  * `useMap` from `@liveblocks/react` directly. See
471
378
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
472
379
  */
473
- declare function useMap<TKey extends string, TValue extends Lson>(
474
- key: string,
475
- entries: readonly (readonly [TKey, TValue])[] | null
476
- ): LiveMap<TKey, TValue> | null;
380
+ declare function useMap<TKey extends string, TValue extends Lson>(key: string, entries: readonly (readonly [TKey, TValue])[] | null): LiveMap<TKey, TValue> | null;
477
381
  /**
478
382
  * @deprecated Please use `createRoomContext()` instead of importing
479
383
  * `useObject` from `@liveblocks/react` directly. See
480
384
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
481
385
  */
482
- declare function useObject<TData extends LsonObject>(
483
- key: string
484
- ): LiveObject<TData> | null;
386
+ declare function useObject<TData extends LsonObject>(key: string): LiveObject<TData> | null;
485
387
  /**
486
388
  * @deprecated Please use `createRoomContext()` instead of importing
487
389
  * `useObject` from `@liveblocks/react` directly. See
488
390
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
489
391
  */
490
- declare function useObject<TData extends LsonObject>(
491
- key: string,
492
- initialData: TData
493
- ): LiveObject<TData> | null;
392
+ declare function useObject<TData extends LsonObject>(key: string, initialData: TData): LiveObject<TData> | null;
494
393
 
495
- export {
496
- LiveblocksProvider,
497
- RoomProvider,
498
- createRoomContext,
499
- useBatch,
500
- useBroadcastEvent,
501
- useClient,
502
- useErrorListener,
503
- useEventListener,
504
- useHistory,
505
- useList,
506
- useMap,
507
- useMyPresence,
508
- useObject,
509
- useOthers,
510
- useRedo,
511
- useRoom,
512
- useSelf,
513
- useStorage,
514
- useUndo,
515
- useUpdateMyPresence,
516
- };
394
+ export { LiveblocksProvider, RoomProvider, createRoomContext, useBatch, useBroadcastEvent, useClient, useErrorListener, useEventListener, useHistory, useList, useMap, useMyPresence, useObject, useOthers, useRedo, useRoom, useSelf, useStorage, useUndo, useUpdateMyPresence };