@liveblocks/react 0.17.0-test1 → 0.17.1
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 +144 -151
- package/index.js +36 -31
- package/index.mjs +55 -50
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -3,16 +3,17 @@ import {
|
|
|
3
3
|
Client,
|
|
4
4
|
JsonObject,
|
|
5
5
|
LsonObject,
|
|
6
|
+
BaseUserMeta,
|
|
6
7
|
Json,
|
|
7
8
|
BroadcastOptions,
|
|
8
9
|
History,
|
|
9
|
-
Lson,
|
|
10
|
-
LiveList,
|
|
11
|
-
LiveMap,
|
|
12
|
-
LiveObject,
|
|
13
10
|
Others,
|
|
14
11
|
Room,
|
|
15
12
|
User,
|
|
13
|
+
LiveObject,
|
|
14
|
+
Lson,
|
|
15
|
+
LiveList,
|
|
16
|
+
LiveMap,
|
|
16
17
|
} from "@liveblocks/client";
|
|
17
18
|
export { Json, JsonObject } from "@liveblocks/client";
|
|
18
19
|
import * as React from "react";
|
|
@@ -25,9 +26,10 @@ declare type LiveblocksProviderProps = {
|
|
|
25
26
|
/**
|
|
26
27
|
* Makes the Liveblocks client available in the component hierarchy below.
|
|
27
28
|
*
|
|
28
|
-
* @deprecated
|
|
29
|
-
* context using `
|
|
30
|
-
* https://
|
|
29
|
+
* @deprecated LiveblocksProvider is no longer needed in your component tree if
|
|
30
|
+
* you set up your Liveblocks context using `createRoomContext()`. See
|
|
31
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for
|
|
32
|
+
* details.
|
|
31
33
|
*/
|
|
32
34
|
declare function LiveblocksProvider(
|
|
33
35
|
props: LiveblocksProviderProps
|
|
@@ -50,43 +52,31 @@ declare type RoomProviderProps<
|
|
|
50
52
|
children: React.ReactNode;
|
|
51
53
|
} & RoomInitializers<TPresence, TStorage>
|
|
52
54
|
>;
|
|
53
|
-
declare function
|
|
55
|
+
declare function createRoomContext<
|
|
54
56
|
TPresence extends JsonObject,
|
|
55
|
-
TStorage extends LsonObject
|
|
57
|
+
TStorage extends LsonObject = LsonObject,
|
|
58
|
+
TUserMeta extends BaseUserMeta = BaseUserMeta,
|
|
59
|
+
TRoomEvent extends Json = never
|
|
56
60
|
>(
|
|
57
|
-
client
|
|
61
|
+
client: Client
|
|
58
62
|
): {
|
|
59
63
|
RoomProvider: (props: RoomProviderProps<TPresence, TStorage>) => JSX.Element;
|
|
60
64
|
useBatch: () => (callback: () => void) => void;
|
|
61
|
-
useBroadcastEvent: () => (
|
|
65
|
+
useBroadcastEvent: () => (
|
|
66
|
+
event: TRoomEvent,
|
|
67
|
+
options?: BroadcastOptions
|
|
68
|
+
) => void;
|
|
62
69
|
useErrorListener: (callback: (err: Error) => void) => void;
|
|
63
70
|
useEventListener: (
|
|
64
|
-
callback: (eventData: { connectionId: number; event:
|
|
71
|
+
callback: (eventData: { connectionId: number; event: TRoomEvent }) => void
|
|
65
72
|
) => void;
|
|
66
73
|
useHistory: () => History;
|
|
67
74
|
useList: <TKey extends Extract<keyof TStorage, string>>(
|
|
68
75
|
key: TKey
|
|
69
76
|
) => TStorage[TKey] | null;
|
|
70
|
-
deprecated_useList: {
|
|
71
|
-
<TValue extends Lson>(key: string): LiveList<TValue> | null;
|
|
72
|
-
<TValue_1 extends Lson>(
|
|
73
|
-
key: string,
|
|
74
|
-
items: TValue_1[]
|
|
75
|
-
): LiveList<TValue_1> | null;
|
|
76
|
-
};
|
|
77
77
|
useMap: <TKey_1 extends Extract<keyof TStorage, string>>(
|
|
78
78
|
key: TKey_1
|
|
79
79
|
) => TStorage[TKey_1] | null;
|
|
80
|
-
deprecated_useMap: {
|
|
81
|
-
<TKey_2 extends string, TValue_2 extends Lson>(key: string): LiveMap<
|
|
82
|
-
TKey_2,
|
|
83
|
-
TValue_2
|
|
84
|
-
> | null;
|
|
85
|
-
<TKey_3 extends string, TValue_3 extends Lson>(
|
|
86
|
-
key: string,
|
|
87
|
-
entries: readonly (readonly [TKey_3, TValue_3])[] | null
|
|
88
|
-
): LiveMap<TKey_3, TValue_3> | null;
|
|
89
|
-
};
|
|
90
80
|
useMyPresence: () => [
|
|
91
81
|
TPresence,
|
|
92
82
|
(
|
|
@@ -96,20 +86,13 @@ declare function configureRoom<
|
|
|
96
86
|
}
|
|
97
87
|
) => void
|
|
98
88
|
];
|
|
99
|
-
useObject: <
|
|
100
|
-
key:
|
|
101
|
-
) => TStorage[
|
|
102
|
-
|
|
103
|
-
<TData extends LsonObject>(key: string): LiveObject<TData> | null;
|
|
104
|
-
<TData_1 extends LsonObject>(
|
|
105
|
-
key: string,
|
|
106
|
-
initialData: TData_1
|
|
107
|
-
): LiveObject<TData_1> | null;
|
|
108
|
-
};
|
|
109
|
-
useOthers: () => Others<TPresence>;
|
|
89
|
+
useObject: <TKey_2 extends Extract<keyof TStorage, string>>(
|
|
90
|
+
key: TKey_2
|
|
91
|
+
) => TStorage[TKey_2] | null;
|
|
92
|
+
useOthers: () => Others<TPresence, TUserMeta>;
|
|
110
93
|
useRedo: () => () => void;
|
|
111
|
-
useRoom: () => Room<TPresence, TStorage>;
|
|
112
|
-
useSelf: () => User<TPresence> | null;
|
|
94
|
+
useRoom: () => Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
|
|
95
|
+
useSelf: () => User<TPresence, TUserMeta> | null;
|
|
113
96
|
useStorage: () => [root: LiveObject<TStorage> | null];
|
|
114
97
|
useUndo: () => () => void;
|
|
115
98
|
useUpdateMyPresence: () => (
|
|
@@ -118,6 +101,30 @@ declare function configureRoom<
|
|
|
118
101
|
addToHistory: boolean;
|
|
119
102
|
}
|
|
120
103
|
) => void;
|
|
104
|
+
deprecated_useList: {
|
|
105
|
+
<TValue extends Lson>(key: string): LiveList<TValue> | null;
|
|
106
|
+
<TValue_1 extends Lson>(
|
|
107
|
+
key: string,
|
|
108
|
+
items: TValue_1[]
|
|
109
|
+
): LiveList<TValue_1> | null;
|
|
110
|
+
};
|
|
111
|
+
deprecated_useMap: {
|
|
112
|
+
<TKey_3 extends string, TValue_2 extends Lson>(key: string): LiveMap<
|
|
113
|
+
TKey_3,
|
|
114
|
+
TValue_2
|
|
115
|
+
> | null;
|
|
116
|
+
<TKey_4 extends string, TValue_3 extends Lson>(
|
|
117
|
+
key: string,
|
|
118
|
+
entries: readonly (readonly [TKey_4, TValue_3])[] | null
|
|
119
|
+
): LiveMap<TKey_4, TValue_3> | null;
|
|
120
|
+
};
|
|
121
|
+
deprecated_useObject: {
|
|
122
|
+
<TData extends LsonObject>(key: string): LiveObject<TData> | null;
|
|
123
|
+
<TData_1 extends LsonObject>(
|
|
124
|
+
key: string,
|
|
125
|
+
initialData: TData_1
|
|
126
|
+
): LiveObject<TData_1> | null;
|
|
127
|
+
};
|
|
121
128
|
};
|
|
122
129
|
|
|
123
130
|
/**
|
|
@@ -128,98 +135,53 @@ declare function configureRoom<
|
|
|
128
135
|
*/
|
|
129
136
|
|
|
130
137
|
/**
|
|
131
|
-
* @deprecated Please use `
|
|
138
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
132
139
|
* `RoomProvider` from `@liveblocks/react` directly. See
|
|
133
|
-
* https://
|
|
134
|
-
* details.
|
|
140
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
135
141
|
*/
|
|
136
142
|
declare function RoomProvider<
|
|
137
143
|
TPresence extends JsonObject,
|
|
138
144
|
TStorage extends LsonObject
|
|
139
145
|
>(props: RoomProviderProps<TPresence, TStorage>): JSX.Element;
|
|
140
146
|
/**
|
|
141
|
-
* @deprecated Please use `
|
|
147
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
142
148
|
* `useBatch` from `@liveblocks/react` directly. See
|
|
143
|
-
* https://
|
|
144
|
-
* details.
|
|
149
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
145
150
|
*/
|
|
146
151
|
declare function useBatch(): (callback: () => void) => void;
|
|
147
152
|
/**
|
|
148
|
-
* @deprecated Please use `
|
|
153
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
149
154
|
* `useBroadcastEvent` from `@liveblocks/react` directly. See
|
|
150
|
-
* https://
|
|
151
|
-
* details.
|
|
155
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
152
156
|
*/
|
|
153
|
-
declare function useBroadcastEvent(): (
|
|
154
|
-
event:
|
|
157
|
+
declare function useBroadcastEvent<TRoomEvent extends Json>(): (
|
|
158
|
+
event: TRoomEvent,
|
|
155
159
|
options?: BroadcastOptions
|
|
156
160
|
) => void;
|
|
157
161
|
/**
|
|
158
|
-
* @deprecated Please use `
|
|
162
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
159
163
|
* `useErrorListener` from `@liveblocks/react` directly. See
|
|
160
|
-
* https://
|
|
161
|
-
* details.
|
|
164
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
162
165
|
*/
|
|
163
166
|
declare function useErrorListener(callback: (err: Error) => void): void;
|
|
164
167
|
/**
|
|
165
|
-
* @deprecated Please use `
|
|
168
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
166
169
|
* `useEventListener` from `@liveblocks/react` directly. See
|
|
167
|
-
* https://
|
|
168
|
-
* details.
|
|
170
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
169
171
|
*/
|
|
170
|
-
declare function useEventListener(
|
|
171
|
-
callback: (eventData: { connectionId: number; event:
|
|
172
|
+
declare function useEventListener<TRoomEvent extends Json>(
|
|
173
|
+
callback: (eventData: { connectionId: number; event: TRoomEvent }) => void
|
|
172
174
|
): void;
|
|
173
175
|
/**
|
|
174
|
-
* @deprecated Please use `
|
|
176
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
175
177
|
* `useHistory` from `@liveblocks/react` directly. See
|
|
176
|
-
* https://
|
|
177
|
-
* details.
|
|
178
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
178
179
|
*/
|
|
179
180
|
declare function useHistory(): History;
|
|
180
181
|
/**
|
|
181
|
-
* @deprecated Please use `
|
|
182
|
-
* `useList` from `@liveblocks/react` directly. See
|
|
183
|
-
* https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for
|
|
184
|
-
* details.
|
|
185
|
-
*/
|
|
186
|
-
declare function useList<TValue extends Lson>(
|
|
187
|
-
key: string
|
|
188
|
-
): LiveList<TValue> | null;
|
|
189
|
-
/**
|
|
190
|
-
* @deprecated Please use `configureRoom()` instead of importing
|
|
191
|
-
* `useList` from `@liveblocks/react` directly. See
|
|
192
|
-
* https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for
|
|
193
|
-
* details.
|
|
194
|
-
*/
|
|
195
|
-
declare function useList<TValue extends Lson>(
|
|
196
|
-
key: string,
|
|
197
|
-
items: TValue[]
|
|
198
|
-
): LiveList<TValue> | null;
|
|
199
|
-
/**
|
|
200
|
-
* @deprecated Please use `configureRoom()` instead of importing
|
|
201
|
-
* `useMap` from `@liveblocks/react` directly. See
|
|
202
|
-
* https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for
|
|
203
|
-
* details.
|
|
204
|
-
*/
|
|
205
|
-
declare function useMap<TKey extends string, TValue extends Lson>(
|
|
206
|
-
key: string
|
|
207
|
-
): LiveMap<TKey, TValue> | null;
|
|
208
|
-
/**
|
|
209
|
-
* @deprecated Please use `configureRoom()` instead of importing
|
|
210
|
-
* `useMap` from `@liveblocks/react` directly. See
|
|
211
|
-
* https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for
|
|
212
|
-
* details.
|
|
213
|
-
*/
|
|
214
|
-
declare function useMap<TKey extends string, TValue extends Lson>(
|
|
215
|
-
key: string,
|
|
216
|
-
entries: readonly (readonly [TKey, TValue])[] | null
|
|
217
|
-
): LiveMap<TKey, TValue> | null;
|
|
218
|
-
/**
|
|
219
|
-
* @deprecated Please use `configureRoom()` instead of importing
|
|
182
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
220
183
|
* `useMyPresence` from `@liveblocks/react` directly. See
|
|
221
|
-
* https://
|
|
222
|
-
* details.
|
|
184
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
223
185
|
*/
|
|
224
186
|
declare function useMyPresence<TPresence extends JsonObject>(): [
|
|
225
187
|
TPresence,
|
|
@@ -231,78 +193,58 @@ declare function useMyPresence<TPresence extends JsonObject>(): [
|
|
|
231
193
|
) => void
|
|
232
194
|
];
|
|
233
195
|
/**
|
|
234
|
-
* @deprecated Please use `
|
|
235
|
-
* `useObject` from `@liveblocks/react` directly. See
|
|
236
|
-
* https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for
|
|
237
|
-
* details.
|
|
238
|
-
*/
|
|
239
|
-
declare function useObject<TData extends LsonObject>(
|
|
240
|
-
key: string
|
|
241
|
-
): LiveObject<TData> | null;
|
|
242
|
-
/**
|
|
243
|
-
* @deprecated Please use `configureRoom()` instead of importing
|
|
244
|
-
* `useObject` from `@liveblocks/react` directly. See
|
|
245
|
-
* https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for
|
|
246
|
-
* details.
|
|
247
|
-
*/
|
|
248
|
-
declare function useObject<TData extends LsonObject>(
|
|
249
|
-
key: string,
|
|
250
|
-
initialData: TData
|
|
251
|
-
): LiveObject<TData> | null;
|
|
252
|
-
/**
|
|
253
|
-
* @deprecated Please use `configureRoom()` instead of importing
|
|
196
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
254
197
|
* `useOthers` from `@liveblocks/react` directly. See
|
|
255
|
-
* https://
|
|
256
|
-
* details.
|
|
198
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
257
199
|
*/
|
|
258
|
-
declare function useOthers<
|
|
200
|
+
declare function useOthers<
|
|
201
|
+
TPresence extends JsonObject,
|
|
202
|
+
TUserMeta extends BaseUserMeta
|
|
203
|
+
>(): Others<TPresence, TUserMeta>;
|
|
259
204
|
/**
|
|
260
|
-
* @deprecated Please use `
|
|
205
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
261
206
|
* `useRedo` from `@liveblocks/react` directly. See
|
|
262
|
-
* https://
|
|
263
|
-
* details.
|
|
207
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
264
208
|
*/
|
|
265
209
|
declare function useRedo(): () => void;
|
|
266
210
|
/**
|
|
267
|
-
* @deprecated Please use `
|
|
211
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
268
212
|
* `useRoom` from `@liveblocks/react` directly. See
|
|
269
|
-
* https://
|
|
270
|
-
* details.
|
|
213
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
271
214
|
*/
|
|
272
215
|
declare function useRoom<
|
|
273
216
|
TPresence extends JsonObject,
|
|
274
|
-
TStorage extends LsonObject
|
|
275
|
-
|
|
217
|
+
TStorage extends LsonObject,
|
|
218
|
+
TUserMeta extends BaseUserMeta,
|
|
219
|
+
TRoomEvent extends Json
|
|
220
|
+
>(): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
|
|
276
221
|
/**
|
|
277
|
-
* @deprecated Please use `
|
|
222
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
278
223
|
* `useSelf` from `@liveblocks/react` directly. See
|
|
279
|
-
* https://
|
|
280
|
-
* details.
|
|
224
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
281
225
|
*/
|
|
282
226
|
declare function useSelf<
|
|
283
|
-
TPresence extends JsonObject
|
|
284
|
-
|
|
227
|
+
TPresence extends JsonObject,
|
|
228
|
+
TUserMeta extends BaseUserMeta
|
|
229
|
+
>(): User<TPresence, TUserMeta> | null;
|
|
285
230
|
/**
|
|
286
|
-
* @deprecated Please use `
|
|
231
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
287
232
|
* `useStorage` from `@liveblocks/react` directly. See
|
|
288
|
-
* https://
|
|
289
|
-
* details.
|
|
233
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
290
234
|
*/
|
|
291
235
|
declare function useStorage<TStorage extends LsonObject>(): [
|
|
292
236
|
root: LiveObject<TStorage> | null
|
|
293
237
|
];
|
|
294
238
|
/**
|
|
295
|
-
* @deprecated Please use `
|
|
239
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
296
240
|
* `useUndo` from `@liveblocks/react` directly. See
|
|
297
|
-
* https://
|
|
298
|
-
* details.
|
|
241
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
299
242
|
*/
|
|
300
243
|
declare function useUndo(): () => void;
|
|
301
244
|
/**
|
|
302
|
-
* @deprecated Please use `
|
|
245
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
303
246
|
* `useUpdateMyPresence` from `@liveblocks/react` directly. See
|
|
304
|
-
* https://
|
|
305
|
-
* details.
|
|
247
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
306
248
|
*/
|
|
307
249
|
declare function useUpdateMyPresence<TPresence extends JsonObject>(): (
|
|
308
250
|
overrides: Partial<TPresence>,
|
|
@@ -310,11 +252,62 @@ declare function useUpdateMyPresence<TPresence extends JsonObject>(): (
|
|
|
310
252
|
addToHistory: boolean;
|
|
311
253
|
}
|
|
312
254
|
) => void;
|
|
255
|
+
/**
|
|
256
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
257
|
+
* `useList` from `@liveblocks/react` directly. See
|
|
258
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
259
|
+
*/
|
|
260
|
+
declare function useList<TValue extends Lson>(
|
|
261
|
+
key: string
|
|
262
|
+
): LiveList<TValue> | null;
|
|
263
|
+
/**
|
|
264
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
265
|
+
* `useList` from `@liveblocks/react` directly. See
|
|
266
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
267
|
+
*/
|
|
268
|
+
declare function useList<TValue extends Lson>(
|
|
269
|
+
key: string,
|
|
270
|
+
items: TValue[]
|
|
271
|
+
): LiveList<TValue> | null;
|
|
272
|
+
/**
|
|
273
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
274
|
+
* `useMap` 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 useMap<TKey extends string, TValue extends Lson>(
|
|
278
|
+
key: string
|
|
279
|
+
): LiveMap<TKey, TValue> | null;
|
|
280
|
+
/**
|
|
281
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
282
|
+
* `useMap` from `@liveblocks/react` directly. See
|
|
283
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
284
|
+
*/
|
|
285
|
+
declare function useMap<TKey extends string, TValue extends Lson>(
|
|
286
|
+
key: string,
|
|
287
|
+
entries: readonly (readonly [TKey, TValue])[] | null
|
|
288
|
+
): LiveMap<TKey, TValue> | null;
|
|
289
|
+
/**
|
|
290
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
291
|
+
* `useObject` from `@liveblocks/react` directly. See
|
|
292
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
293
|
+
*/
|
|
294
|
+
declare function useObject<TData extends LsonObject>(
|
|
295
|
+
key: string
|
|
296
|
+
): LiveObject<TData> | null;
|
|
297
|
+
/**
|
|
298
|
+
* @deprecated Please use `createRoomContext()` instead of importing
|
|
299
|
+
* `useObject` from `@liveblocks/react` directly. See
|
|
300
|
+
* https://liveblocks.io/docs/guides/upgrading#upgrading-from-0-16-to-0-17 for details.
|
|
301
|
+
*/
|
|
302
|
+
declare function useObject<TData extends LsonObject>(
|
|
303
|
+
key: string,
|
|
304
|
+
initialData: TData
|
|
305
|
+
): LiveObject<TData> | null;
|
|
313
306
|
|
|
314
307
|
export {
|
|
315
308
|
LiveblocksProvider,
|
|
316
309
|
RoomProvider,
|
|
317
|
-
|
|
310
|
+
createRoomContext,
|
|
318
311
|
useBatch,
|
|
319
312
|
useBroadcastEvent,
|
|
320
313
|
useClient,
|
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
var internal = require("@liveblocks/client/internal"),
|
|
4
|
+
React = require("react"),
|
|
5
|
+
client = require("@liveblocks/client");
|
|
6
6
|
function _interopNamespace(e) {
|
|
7
7
|
if (e && e.__esModule) return e;
|
|
8
8
|
var n = Object.create(null);
|
|
@@ -67,10 +67,10 @@ function useRerender() {
|
|
|
67
67
|
return x + 1;
|
|
68
68
|
}, 0)[1];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function createRoomContext(client$1) {
|
|
71
71
|
var useClient$1;
|
|
72
72
|
useClient$1 =
|
|
73
|
-
|
|
73
|
+
"__legacy" !== client$1
|
|
74
74
|
? function () {
|
|
75
75
|
return client$1;
|
|
76
76
|
}
|
|
@@ -344,11 +344,9 @@ function configureRoom(client$1) {
|
|
|
344
344
|
useList: function (key) {
|
|
345
345
|
return deprecated_useList(key);
|
|
346
346
|
},
|
|
347
|
-
deprecated_useList: deprecated_useList,
|
|
348
347
|
useMap: function (key) {
|
|
349
348
|
return deprecated_useMap(key);
|
|
350
349
|
},
|
|
351
|
-
deprecated_useMap: deprecated_useMap,
|
|
352
350
|
useMyPresence: function () {
|
|
353
351
|
var room = useRoom(),
|
|
354
352
|
presence = room.getPresence(),
|
|
@@ -377,7 +375,6 @@ function configureRoom(client$1) {
|
|
|
377
375
|
useObject: function (key) {
|
|
378
376
|
return deprecated_useObject(key);
|
|
379
377
|
},
|
|
380
|
-
deprecated_useObject: deprecated_useObject,
|
|
381
378
|
useOthers: function () {
|
|
382
379
|
var room = useRoom(),
|
|
383
380
|
rerender = useRerender();
|
|
@@ -428,29 +425,37 @@ function configureRoom(client$1) {
|
|
|
428
425
|
[room]
|
|
429
426
|
);
|
|
430
427
|
},
|
|
428
|
+
deprecated_useList: deprecated_useList,
|
|
429
|
+
deprecated_useMap: deprecated_useMap,
|
|
430
|
+
deprecated_useObject: deprecated_useObject,
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
|
-
var _hooks =
|
|
433
|
+
var _hooks = createRoomContext("__legacy");
|
|
434
434
|
(exports.LiveblocksProvider = function (props) {
|
|
435
|
-
return
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
435
|
+
return (
|
|
436
|
+
internal.deprecate(
|
|
437
|
+
"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."
|
|
438
|
+
),
|
|
439
|
+
React__namespace.createElement(
|
|
440
|
+
ClientContext.Provider,
|
|
441
|
+
{ value: props.client },
|
|
442
|
+
props.children
|
|
443
|
+
)
|
|
439
444
|
);
|
|
440
445
|
}),
|
|
441
446
|
(exports.RoomProvider = function (props) {
|
|
442
447
|
return (
|
|
443
448
|
internal.deprecate(
|
|
444
|
-
"Please use `
|
|
449
|
+
"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."
|
|
445
450
|
),
|
|
446
451
|
_hooks.RoomProvider(props)
|
|
447
452
|
);
|
|
448
453
|
}),
|
|
449
|
-
(exports.
|
|
454
|
+
(exports.createRoomContext = createRoomContext),
|
|
450
455
|
(exports.useBatch = function () {
|
|
451
456
|
return (
|
|
452
457
|
internal.deprecate(
|
|
453
|
-
"Please use `
|
|
458
|
+
"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."
|
|
454
459
|
),
|
|
455
460
|
_hooks.useBatch()
|
|
456
461
|
);
|
|
@@ -458,7 +463,7 @@ var _hooks = configureRoom();
|
|
|
458
463
|
(exports.useBroadcastEvent = function () {
|
|
459
464
|
return (
|
|
460
465
|
internal.deprecate(
|
|
461
|
-
"Please use `
|
|
466
|
+
"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."
|
|
462
467
|
),
|
|
463
468
|
_hooks.useBroadcastEvent()
|
|
464
469
|
);
|
|
@@ -467,7 +472,7 @@ var _hooks = configureRoom();
|
|
|
467
472
|
(exports.useErrorListener = function (callback) {
|
|
468
473
|
return (
|
|
469
474
|
internal.deprecate(
|
|
470
|
-
"Please use `
|
|
475
|
+
"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."
|
|
471
476
|
),
|
|
472
477
|
_hooks.useErrorListener(callback)
|
|
473
478
|
);
|
|
@@ -475,7 +480,7 @@ var _hooks = configureRoom();
|
|
|
475
480
|
(exports.useEventListener = function (callback) {
|
|
476
481
|
return (
|
|
477
482
|
internal.deprecate(
|
|
478
|
-
"Please use `
|
|
483
|
+
"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."
|
|
479
484
|
),
|
|
480
485
|
_hooks.useEventListener(callback)
|
|
481
486
|
);
|
|
@@ -483,7 +488,7 @@ var _hooks = configureRoom();
|
|
|
483
488
|
(exports.useHistory = function () {
|
|
484
489
|
return (
|
|
485
490
|
internal.deprecate(
|
|
486
|
-
"Please use `
|
|
491
|
+
"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."
|
|
487
492
|
),
|
|
488
493
|
_hooks.useHistory()
|
|
489
494
|
);
|
|
@@ -491,7 +496,7 @@ var _hooks = configureRoom();
|
|
|
491
496
|
(exports.useList = function (key, items) {
|
|
492
497
|
return (
|
|
493
498
|
internal.deprecate(
|
|
494
|
-
"Please use `
|
|
499
|
+
"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."
|
|
495
500
|
),
|
|
496
501
|
_hooks.deprecated_useList(key, items)
|
|
497
502
|
);
|
|
@@ -499,7 +504,7 @@ var _hooks = configureRoom();
|
|
|
499
504
|
(exports.useMap = function (key, entries) {
|
|
500
505
|
return (
|
|
501
506
|
internal.deprecate(
|
|
502
|
-
"Please use `
|
|
507
|
+
"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."
|
|
503
508
|
),
|
|
504
509
|
_hooks.deprecated_useMap(key, entries)
|
|
505
510
|
);
|
|
@@ -507,7 +512,7 @@ var _hooks = configureRoom();
|
|
|
507
512
|
(exports.useMyPresence = function () {
|
|
508
513
|
return (
|
|
509
514
|
internal.deprecate(
|
|
510
|
-
"Please use `
|
|
515
|
+
"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."
|
|
511
516
|
),
|
|
512
517
|
_hooks.useMyPresence()
|
|
513
518
|
);
|
|
@@ -515,7 +520,7 @@ var _hooks = configureRoom();
|
|
|
515
520
|
(exports.useObject = function (key, initialData) {
|
|
516
521
|
return (
|
|
517
522
|
internal.deprecate(
|
|
518
|
-
"Please use `
|
|
523
|
+
"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."
|
|
519
524
|
),
|
|
520
525
|
_hooks.deprecated_useObject(key, initialData)
|
|
521
526
|
);
|
|
@@ -523,7 +528,7 @@ var _hooks = configureRoom();
|
|
|
523
528
|
(exports.useOthers = function () {
|
|
524
529
|
return (
|
|
525
530
|
internal.deprecate(
|
|
526
|
-
"Please use `
|
|
531
|
+
"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."
|
|
527
532
|
),
|
|
528
533
|
_hooks.useOthers()
|
|
529
534
|
);
|
|
@@ -531,7 +536,7 @@ var _hooks = configureRoom();
|
|
|
531
536
|
(exports.useRedo = function () {
|
|
532
537
|
return (
|
|
533
538
|
internal.deprecate(
|
|
534
|
-
"Please use `
|
|
539
|
+
"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."
|
|
535
540
|
),
|
|
536
541
|
_hooks.useRedo()
|
|
537
542
|
);
|
|
@@ -539,7 +544,7 @@ var _hooks = configureRoom();
|
|
|
539
544
|
(exports.useRoom = function () {
|
|
540
545
|
return (
|
|
541
546
|
internal.deprecate(
|
|
542
|
-
"Please use `
|
|
547
|
+
"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."
|
|
543
548
|
),
|
|
544
549
|
_hooks.useRoom()
|
|
545
550
|
);
|
|
@@ -547,7 +552,7 @@ var _hooks = configureRoom();
|
|
|
547
552
|
(exports.useSelf = function () {
|
|
548
553
|
return (
|
|
549
554
|
internal.deprecate(
|
|
550
|
-
"Please use `
|
|
555
|
+
"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."
|
|
551
556
|
),
|
|
552
557
|
_hooks.useSelf()
|
|
553
558
|
);
|
|
@@ -555,7 +560,7 @@ var _hooks = configureRoom();
|
|
|
555
560
|
(exports.useStorage = function () {
|
|
556
561
|
return (
|
|
557
562
|
internal.deprecate(
|
|
558
|
-
"Please use `
|
|
563
|
+
"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."
|
|
559
564
|
),
|
|
560
565
|
_hooks.useStorage()
|
|
561
566
|
);
|
|
@@ -563,7 +568,7 @@ var _hooks = configureRoom();
|
|
|
563
568
|
(exports.useUndo = function () {
|
|
564
569
|
return (
|
|
565
570
|
internal.deprecate(
|
|
566
|
-
"Please use `
|
|
571
|
+
"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."
|
|
567
572
|
),
|
|
568
573
|
_hooks.useUndo()
|
|
569
574
|
);
|
|
@@ -571,7 +576,7 @@ var _hooks = configureRoom();
|
|
|
571
576
|
(exports.useUpdateMyPresence = function () {
|
|
572
577
|
return (
|
|
573
578
|
internal.deprecate(
|
|
574
|
-
"Please use `
|
|
579
|
+
"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."
|
|
575
580
|
),
|
|
576
581
|
_hooks.useUpdateMyPresence()
|
|
577
582
|
);
|
package/index.mjs
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { deprecate, errorIf } from "@liveblocks/client/internal";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { useReducer } from "react";
|
|
3
4
|
import { LiveMap, LiveList, LiveObject } from "@liveblocks/client";
|
|
4
|
-
import { errorIf, deprecate } from "@liveblocks/client/internal";
|
|
5
5
|
const ClientContext = React.createContext(null);
|
|
6
6
|
function LiveblocksProvider(props) {
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
return (
|
|
8
|
+
deprecate(
|
|
9
|
+
"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."
|
|
10
|
+
),
|
|
11
|
+
React.createElement(
|
|
12
|
+
ClientContext.Provider,
|
|
13
|
+
{ value: props.client },
|
|
14
|
+
props.children
|
|
15
|
+
)
|
|
11
16
|
);
|
|
12
17
|
}
|
|
13
18
|
function useClient() {
|
|
@@ -50,9 +55,9 @@ function useRerender() {
|
|
|
50
55
|
const [, update] = useReducer((x) => x + 1, 0);
|
|
51
56
|
return update;
|
|
52
57
|
}
|
|
53
|
-
function
|
|
58
|
+
function createRoomContext(client) {
|
|
54
59
|
let useClient$1;
|
|
55
|
-
useClient$1 =
|
|
60
|
+
useClient$1 = "__legacy" !== client ? () => client : useClient;
|
|
56
61
|
const RoomContext = React.createContext(null);
|
|
57
62
|
function useRoom() {
|
|
58
63
|
const room = React.useContext(RoomContext);
|
|
@@ -289,11 +294,9 @@ function configureRoom(client) {
|
|
|
289
294
|
useList: function (key) {
|
|
290
295
|
return deprecated_useList(key);
|
|
291
296
|
},
|
|
292
|
-
deprecated_useList: deprecated_useList,
|
|
293
297
|
useMap: function (key) {
|
|
294
298
|
return deprecated_useMap(key);
|
|
295
299
|
},
|
|
296
|
-
deprecated_useMap: deprecated_useMap,
|
|
297
300
|
useMyPresence: function () {
|
|
298
301
|
const room = useRoom(),
|
|
299
302
|
presence = room.getPresence(),
|
|
@@ -317,7 +320,6 @@ function configureRoom(client) {
|
|
|
317
320
|
useObject: function (key) {
|
|
318
321
|
return deprecated_useObject(key);
|
|
319
322
|
},
|
|
320
|
-
deprecated_useObject: deprecated_useObject,
|
|
321
323
|
useOthers: function () {
|
|
322
324
|
const room = useRoom(),
|
|
323
325
|
rerender = useRerender();
|
|
@@ -362,13 +364,16 @@ function configureRoom(client) {
|
|
|
362
364
|
[room]
|
|
363
365
|
);
|
|
364
366
|
},
|
|
367
|
+
deprecated_useList: deprecated_useList,
|
|
368
|
+
deprecated_useMap: deprecated_useMap,
|
|
369
|
+
deprecated_useObject: deprecated_useObject,
|
|
365
370
|
};
|
|
366
371
|
}
|
|
367
|
-
const _hooks =
|
|
372
|
+
const _hooks = createRoomContext("__legacy");
|
|
368
373
|
function RoomProvider(props) {
|
|
369
374
|
return (
|
|
370
375
|
deprecate(
|
|
371
|
-
"Please use `
|
|
376
|
+
"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."
|
|
372
377
|
),
|
|
373
378
|
_hooks.RoomProvider(props)
|
|
374
379
|
);
|
|
@@ -376,7 +381,7 @@ function RoomProvider(props) {
|
|
|
376
381
|
function useBatch() {
|
|
377
382
|
return (
|
|
378
383
|
deprecate(
|
|
379
|
-
"Please use `
|
|
384
|
+
"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."
|
|
380
385
|
),
|
|
381
386
|
_hooks.useBatch()
|
|
382
387
|
);
|
|
@@ -384,7 +389,7 @@ function useBatch() {
|
|
|
384
389
|
function useBroadcastEvent() {
|
|
385
390
|
return (
|
|
386
391
|
deprecate(
|
|
387
|
-
"Please use `
|
|
392
|
+
"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."
|
|
388
393
|
),
|
|
389
394
|
_hooks.useBroadcastEvent()
|
|
390
395
|
);
|
|
@@ -392,7 +397,7 @@ function useBroadcastEvent() {
|
|
|
392
397
|
function useErrorListener(callback) {
|
|
393
398
|
return (
|
|
394
399
|
deprecate(
|
|
395
|
-
"Please use `
|
|
400
|
+
"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."
|
|
396
401
|
),
|
|
397
402
|
_hooks.useErrorListener(callback)
|
|
398
403
|
);
|
|
@@ -400,7 +405,7 @@ function useErrorListener(callback) {
|
|
|
400
405
|
function useEventListener(callback) {
|
|
401
406
|
return (
|
|
402
407
|
deprecate(
|
|
403
|
-
"Please use `
|
|
408
|
+
"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."
|
|
404
409
|
),
|
|
405
410
|
_hooks.useEventListener(callback)
|
|
406
411
|
);
|
|
@@ -408,47 +413,23 @@ function useEventListener(callback) {
|
|
|
408
413
|
function useHistory() {
|
|
409
414
|
return (
|
|
410
415
|
deprecate(
|
|
411
|
-
"Please use `
|
|
416
|
+
"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."
|
|
412
417
|
),
|
|
413
418
|
_hooks.useHistory()
|
|
414
419
|
);
|
|
415
420
|
}
|
|
416
|
-
function useList(key, items) {
|
|
417
|
-
return (
|
|
418
|
-
deprecate(
|
|
419
|
-
"Please use `configureRoom()` instead of importing `useList` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
420
|
-
),
|
|
421
|
-
_hooks.deprecated_useList(key, items)
|
|
422
|
-
);
|
|
423
|
-
}
|
|
424
|
-
function useMap(key, entries) {
|
|
425
|
-
return (
|
|
426
|
-
deprecate(
|
|
427
|
-
"Please use `configureRoom()` instead of importing `useMap` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
428
|
-
),
|
|
429
|
-
_hooks.deprecated_useMap(key, entries)
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
421
|
function useMyPresence() {
|
|
433
422
|
return (
|
|
434
423
|
deprecate(
|
|
435
|
-
"Please use `
|
|
424
|
+
"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."
|
|
436
425
|
),
|
|
437
426
|
_hooks.useMyPresence()
|
|
438
427
|
);
|
|
439
428
|
}
|
|
440
|
-
function useObject(key, initialData) {
|
|
441
|
-
return (
|
|
442
|
-
deprecate(
|
|
443
|
-
"Please use `configureRoom()` instead of importing `useObject` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
444
|
-
),
|
|
445
|
-
_hooks.deprecated_useObject(key, initialData)
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
429
|
function useOthers() {
|
|
449
430
|
return (
|
|
450
431
|
deprecate(
|
|
451
|
-
"Please use `
|
|
432
|
+
"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."
|
|
452
433
|
),
|
|
453
434
|
_hooks.useOthers()
|
|
454
435
|
);
|
|
@@ -456,7 +437,7 @@ function useOthers() {
|
|
|
456
437
|
function useRedo() {
|
|
457
438
|
return (
|
|
458
439
|
deprecate(
|
|
459
|
-
"Please use `
|
|
440
|
+
"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."
|
|
460
441
|
),
|
|
461
442
|
_hooks.useRedo()
|
|
462
443
|
);
|
|
@@ -464,7 +445,7 @@ function useRedo() {
|
|
|
464
445
|
function useRoom() {
|
|
465
446
|
return (
|
|
466
447
|
deprecate(
|
|
467
|
-
"Please use `
|
|
448
|
+
"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."
|
|
468
449
|
),
|
|
469
450
|
_hooks.useRoom()
|
|
470
451
|
);
|
|
@@ -472,7 +453,7 @@ function useRoom() {
|
|
|
472
453
|
function useSelf() {
|
|
473
454
|
return (
|
|
474
455
|
deprecate(
|
|
475
|
-
"Please use `
|
|
456
|
+
"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."
|
|
476
457
|
),
|
|
477
458
|
_hooks.useSelf()
|
|
478
459
|
);
|
|
@@ -480,7 +461,7 @@ function useSelf() {
|
|
|
480
461
|
function useStorage() {
|
|
481
462
|
return (
|
|
482
463
|
deprecate(
|
|
483
|
-
"Please use `
|
|
464
|
+
"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."
|
|
484
465
|
),
|
|
485
466
|
_hooks.useStorage()
|
|
486
467
|
);
|
|
@@ -488,7 +469,7 @@ function useStorage() {
|
|
|
488
469
|
function useUndo() {
|
|
489
470
|
return (
|
|
490
471
|
deprecate(
|
|
491
|
-
"Please use `
|
|
472
|
+
"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."
|
|
492
473
|
),
|
|
493
474
|
_hooks.useUndo()
|
|
494
475
|
);
|
|
@@ -496,15 +477,39 @@ function useUndo() {
|
|
|
496
477
|
function useUpdateMyPresence() {
|
|
497
478
|
return (
|
|
498
479
|
deprecate(
|
|
499
|
-
"Please use `
|
|
480
|
+
"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."
|
|
500
481
|
),
|
|
501
482
|
_hooks.useUpdateMyPresence()
|
|
502
483
|
);
|
|
503
484
|
}
|
|
485
|
+
function useList(key, items) {
|
|
486
|
+
return (
|
|
487
|
+
deprecate(
|
|
488
|
+
"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."
|
|
489
|
+
),
|
|
490
|
+
_hooks.deprecated_useList(key, items)
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
function useMap(key, entries) {
|
|
494
|
+
return (
|
|
495
|
+
deprecate(
|
|
496
|
+
"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."
|
|
497
|
+
),
|
|
498
|
+
_hooks.deprecated_useMap(key, entries)
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
function useObject(key, initialData) {
|
|
502
|
+
return (
|
|
503
|
+
deprecate(
|
|
504
|
+
"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."
|
|
505
|
+
),
|
|
506
|
+
_hooks.deprecated_useObject(key, initialData)
|
|
507
|
+
);
|
|
508
|
+
}
|
|
504
509
|
export {
|
|
505
510
|
LiveblocksProvider,
|
|
506
511
|
RoomProvider,
|
|
507
|
-
|
|
512
|
+
createRoomContext,
|
|
508
513
|
useBatch,
|
|
509
514
|
useBroadcastEvent,
|
|
510
515
|
useClient,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/react",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "A set of React hooks and providers to use Liveblocks declaratively.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.mjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"license": "Apache-2.0",
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@liveblocks/client": "0.17.
|
|
32
|
+
"@liveblocks/client": "0.17.1",
|
|
33
33
|
"react": "^16.14.0 || ^17 || ^18"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|