@liveblocks/react 0.17.7 → 0.17.10-debug

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,281 +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 the LiveList associated with the provided key.
127
- * 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.
128
- *
129
- * @param key The storage key associated with the LiveList
130
- * @returns null while the storage is loading, otherwise, returns the LiveList associated to the storage
131
- *
132
- * @example
133
- * const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
134
- */
135
- useList<TKey extends Extract<keyof TStorage, string>>(
136
- key: TKey
137
- ): TStorage[TKey] | null;
138
- /**
139
- * Returns the LiveMap associated with the provided key. If the LiveMap does not exist, a new empty LiveMap will be created.
140
- * 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.
141
- *
142
- * @param key The storage key associated with the LiveMap
143
- * @returns null while the storage is loading, otherwise, returns the LiveMap associated to the storage
144
- *
145
- * @example
146
- * const shapesById = useMap("shapes");
147
- */
148
- useMap<TKey extends Extract<keyof TStorage, string>>(
149
- key: TKey
150
- ): TStorage[TKey] | null;
151
- /**
152
- * Returns the LiveObject associated with the provided key.
153
- * 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.
154
- *
155
- * @param key The storage key associated with the LiveObject
156
- * @returns null while the storage is loading, otherwise, returns the LveObject associated to the storage
157
- *
158
- * @example
159
- * const object = useObject("obj");
160
- */
161
- useObject<TKey extends Extract<keyof TStorage, string>>(
162
- key: TKey
163
- ): TStorage[TKey] | null;
164
- /**
165
- * Returns the presence of the current user of the current room, and a function to update it.
166
- * It is different from the setState function returned by the useState hook from React.
167
- * You don't need to pass the full presence object to update it.
168
- *
169
- * @example
170
- * const [myPresence, updateMyPresence] = useMyPresence();
171
- * updateMyPresence({ x: 0 });
172
- * updateMyPresence({ y: 0 });
173
- *
174
- * // At the next render, "myPresence" will be equal to "{ x: 0, y: 0 }"
175
- */
176
- useMyPresence(): [
177
- TPresence,
178
- (
179
- overrides: Partial<TPresence>,
180
- 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?: {
181
201
  addToHistory: boolean;
182
- }
183
- ) => void
184
- ];
185
- /**
186
- * Returns an object that lets you get information about all the the users currently connected in the room.
187
- *
188
- * @example
189
- * const others = useOthers();
190
- *
191
- * // Example to map all cursors in JSX
192
- * {
193
- * others.map((user) => {
194
- * if (user.presence?.cursor == null) {
195
- * return null;
196
- * }
197
- * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
198
- * })
199
- * }
200
- */
201
- useOthers(): Others<TPresence, TUserMeta>;
202
- /**
203
- * Returns the Room of the nearest RoomProvider above in the React component
204
- * tree.
205
- */
206
- useRoom(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
207
- /**
208
- * Gets the current user once it is connected to the room.
209
- *
210
- * @example
211
- * const user = useSelf();
212
- */
213
- useSelf(): User<TPresence, TUserMeta> | null;
214
- /**
215
- * Returns the LiveObject instance that is the root of your entire Liveblocks
216
- * Storage.
217
- *
218
- * @example
219
- * const [root] = useStorage();
220
- */
221
- useStorage(): [root: LiveObject<TStorage> | null];
222
- /**
223
- * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
224
- * 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.
225
- *
226
- * @example
227
- * const updateMyPresence = useUpdateMyPresence();
228
- * updateMyPresence({ x: 0 });
229
- * updateMyPresence({ y: 0 });
230
- *
231
- * // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
232
- */
233
- useUpdateMyPresence(): (
234
- overrides: Partial<TPresence>,
235
- options?: {
236
- addToHistory: boolean;
237
- }
238
- ) => void;
239
- /**
240
- * Returns the LiveList associated with the provided key.
241
- * 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.
242
- *
243
- * @param key The storage key associated with the LiveList
244
- * @returns null while the storage is loading, otherwise, returns the LiveList associated to the storage
245
- *
246
- * @example
247
- * const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
248
- */
249
- useList_deprecated<TValue extends Lson>(key: string): LiveList<TValue> | null;
250
- /**
251
- * @deprecated We no longer recommend initializing the
252
- * items from the useList() hook. For details, see https://bit.ly/3Niy5aP.
253
- */
254
- useList_deprecated<TValue extends Lson>(
255
- key: string,
256
- items: TValue[]
257
- ): LiveList<TValue> | null;
258
- /**
259
- * Returns the LiveMap associated with the provided key. If the LiveMap does not exist, a new empty LiveMap will be created.
260
- * 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.
261
- *
262
- * @param key The storage key associated with the LiveMap
263
- * @returns null while the storage is loading, otherwise, returns the LiveMap associated to the storage
264
- *
265
- * @example
266
- * const shapesById = useMap("shapes");
267
- */
268
- useMap_deprecated<TKey extends string, TValue extends Lson>(
269
- key: string
270
- ): LiveMap<TKey, TValue> | null;
271
- /**
272
- * @deprecated We no longer recommend initializing the
273
- * entries from the useMap() hook. For details, see https://bit.ly/3Niy5aP.
274
- */
275
- useMap_deprecated<TKey extends string, TValue extends Lson>(
276
- key: string,
277
- entries: readonly (readonly [TKey, TValue])[] | null
278
- ): LiveMap<TKey, TValue> | null;
279
- /**
280
- * Returns the LiveObject associated with the provided key.
281
- * 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.
282
- *
283
- * @param key The storage key associated with the LiveObject
284
- * @returns null while the storage is loading, otherwise, returns the LveObject associated to the storage
285
- *
286
- * @example
287
- * const object = useObject("obj");
288
- */
289
- useObject_deprecated<TData extends LsonObject>(
290
- key: string
291
- ): LiveObject<TData> | null;
292
- /**
293
- * @deprecated We no longer recommend initializing the fields from the
294
- * useObject() hook. For details, see https://bit.ly/3Niy5aP.
295
- */
296
- useObject_deprecated<TData extends LsonObject>(
297
- key: string,
298
- initialData: TData
299
- ): 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;
300
251
  };
301
- declare function createRoomContext<
302
- TPresence extends JsonObject,
303
- TStorage extends LsonObject = LsonObject,
304
- TUserMeta extends BaseUserMeta = BaseUserMeta,
305
- TRoomEvent extends Json = never
306
- >(
307
- client: Client
308
- ): 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>;
309
253
 
310
254
  /**
311
255
  * NOTE:
@@ -319,10 +263,7 @@ declare function createRoomContext<
319
263
  * `RoomProvider` from `@liveblocks/react` directly. See
320
264
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
321
265
  */
322
- declare function RoomProvider<
323
- TPresence extends JsonObject,
324
- TStorage extends LsonObject
325
- >(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
266
+ declare function RoomProvider<TPresence extends JsonObject, TStorage extends LsonObject>(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
326
267
  /**
327
268
  * @deprecated Please use `createRoomContext()` instead of importing
328
269
  * `useBatch` from `@liveblocks/react` directly. See
@@ -334,10 +275,7 @@ declare function useBatch(): (callback: () => void) => void;
334
275
  * `useBroadcastEvent` from `@liveblocks/react` directly. See
335
276
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
336
277
  */
337
- declare function useBroadcastEvent<TRoomEvent extends Json>(): (
338
- event: TRoomEvent,
339
- options?: BroadcastOptions
340
- ) => void;
278
+ declare function useBroadcastEvent<TRoomEvent extends Json>(): (event: TRoomEvent, options?: BroadcastOptions) => void;
341
279
  /**
342
280
  * @deprecated Please use `createRoomContext()` instead of importing
343
281
  * `useErrorListener` from `@liveblocks/react` directly. See
@@ -349,9 +287,10 @@ declare function useErrorListener(callback: (err: Error) => void): void;
349
287
  * `useEventListener` from `@liveblocks/react` directly. See
350
288
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
351
289
  */
352
- declare function useEventListener<TRoomEvent extends Json>(
353
- callback: (eventData: { connectionId: number; event: TRoomEvent }) => void
354
- ): void;
290
+ declare function useEventListener<TRoomEvent extends Json>(callback: (eventData: {
291
+ connectionId: number;
292
+ event: TRoomEvent;
293
+ }) => void): void;
355
294
  /**
356
295
  * @deprecated Please use `createRoomContext()` instead of importing
357
296
  * `useHistory` from `@liveblocks/react` directly. See
@@ -364,23 +303,17 @@ declare function useHistory(): History;
364
303
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
365
304
  */
366
305
  declare function useMyPresence<TPresence extends JsonObject>(): [
367
- TPresence,
368
- (
369
- overrides: Partial<TPresence>,
370
- options?: {
371
- addToHistory: boolean;
372
- }
373
- ) => void
306
+ TPresence,
307
+ (overrides: Partial<TPresence>, options?: {
308
+ addToHistory: boolean;
309
+ }) => void
374
310
  ];
375
311
  /**
376
312
  * @deprecated Please use `createRoomContext()` instead of importing
377
313
  * `useOthers` from `@liveblocks/react` directly. See
378
314
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
379
315
  */
380
- declare function useOthers<
381
- TPresence extends JsonObject,
382
- TUserMeta extends BaseUserMeta
383
- >(): Others<TPresence, TUserMeta>;
316
+ declare function useOthers<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>(): Others<TPresence, TUserMeta>;
384
317
  /**
385
318
  * @deprecated Please use `createRoomContext()` instead of importing
386
319
  * `useRedo` from `@liveblocks/react` directly. See
@@ -392,28 +325,20 @@ declare function useRedo(): () => void;
392
325
  * `useRoom` from `@liveblocks/react` directly. See
393
326
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
394
327
  */
395
- declare function useRoom<
396
- TPresence extends JsonObject,
397
- TStorage extends LsonObject,
398
- TUserMeta extends BaseUserMeta,
399
- TRoomEvent extends Json
400
- >(): 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>;
401
329
  /**
402
330
  * @deprecated Please use `createRoomContext()` instead of importing
403
331
  * `useSelf` from `@liveblocks/react` directly. See
404
332
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
405
333
  */
406
- declare function useSelf<
407
- TPresence extends JsonObject,
408
- TUserMeta extends BaseUserMeta
409
- >(): User<TPresence, TUserMeta> | null;
334
+ declare function useSelf<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>(): User<TPresence, TUserMeta> | null;
410
335
  /**
411
336
  * @deprecated Please use `createRoomContext()` instead of importing
412
337
  * `useStorage` from `@liveblocks/react` directly. See
413
338
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
414
339
  */
415
340
  declare function useStorage<TStorage extends LsonObject>(): [
416
- root: LiveObject<TStorage> | null
341
+ root: LiveObject<TStorage> | null
417
342
  ];
418
343
  /**
419
344
  * @deprecated Please use `createRoomContext()` instead of importing
@@ -426,83 +351,44 @@ declare function useUndo(): () => void;
426
351
  * `useUpdateMyPresence` from `@liveblocks/react` directly. See
427
352
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
428
353
  */
429
- declare function useUpdateMyPresence<TPresence extends JsonObject>(): (
430
- overrides: Partial<TPresence>,
431
- options?: {
354
+ declare function useUpdateMyPresence<TPresence extends JsonObject>(): (overrides: Partial<TPresence>, options?: {
432
355
  addToHistory: boolean;
433
- }
434
- ) => void;
356
+ }) => void;
435
357
  /**
436
358
  * @deprecated Please use `createRoomContext()` instead of importing
437
359
  * `useList` from `@liveblocks/react` directly. See
438
360
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
439
361
  */
440
- declare function useList<TValue extends Lson>(
441
- key: string
442
- ): LiveList<TValue> | null;
362
+ declare function useList<TValue extends Lson>(key: string): LiveList<TValue> | null;
443
363
  /**
444
364
  * @deprecated Please use `createRoomContext()` instead of importing
445
365
  * `useList` from `@liveblocks/react` directly. See
446
366
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
447
367
  */
448
- declare function useList<TValue extends Lson>(
449
- key: string,
450
- items: TValue[]
451
- ): LiveList<TValue> | null;
368
+ declare function useList<TValue extends Lson>(key: string, items: TValue[]): LiveList<TValue> | null;
452
369
  /**
453
370
  * @deprecated Please use `createRoomContext()` instead of importing
454
371
  * `useMap` from `@liveblocks/react` directly. See
455
372
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
456
373
  */
457
- declare function useMap<TKey extends string, TValue extends Lson>(
458
- key: string
459
- ): LiveMap<TKey, TValue> | null;
374
+ declare function useMap<TKey extends string, TValue extends Lson>(key: string): LiveMap<TKey, TValue> | null;
460
375
  /**
461
376
  * @deprecated Please use `createRoomContext()` instead of importing
462
377
  * `useMap` from `@liveblocks/react` directly. See
463
378
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
464
379
  */
465
- declare function useMap<TKey extends string, TValue extends Lson>(
466
- key: string,
467
- entries: readonly (readonly [TKey, TValue])[] | null
468
- ): 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;
469
381
  /**
470
382
  * @deprecated Please use `createRoomContext()` instead of importing
471
383
  * `useObject` from `@liveblocks/react` directly. See
472
384
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
473
385
  */
474
- declare function useObject<TData extends LsonObject>(
475
- key: string
476
- ): LiveObject<TData> | null;
386
+ declare function useObject<TData extends LsonObject>(key: string): LiveObject<TData> | null;
477
387
  /**
478
388
  * @deprecated Please use `createRoomContext()` instead of importing
479
389
  * `useObject` from `@liveblocks/react` directly. See
480
390
  * https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
481
391
  */
482
- declare function useObject<TData extends LsonObject>(
483
- key: string,
484
- initialData: TData
485
- ): LiveObject<TData> | null;
392
+ declare function useObject<TData extends LsonObject>(key: string, initialData: TData): LiveObject<TData> | null;
486
393
 
487
- export {
488
- LiveblocksProvider,
489
- RoomProvider,
490
- createRoomContext,
491
- useBatch,
492
- useBroadcastEvent,
493
- useClient,
494
- useErrorListener,
495
- useEventListener,
496
- useHistory,
497
- useList,
498
- useMap,
499
- useMyPresence,
500
- useObject,
501
- useOthers,
502
- useRedo,
503
- useRoom,
504
- useSelf,
505
- useStorage,
506
- useUndo,
507
- useUpdateMyPresence,
508
- };
394
+ export { LiveblocksProvider, RoomProvider, createRoomContext, useBatch, useBroadcastEvent, useClient, useErrorListener, useEventListener, useHistory, useList, useMap, useMyPresence, useObject, useOthers, useRedo, useRoom, useSelf, useStorage, useUndo, useUpdateMyPresence };