@liveblocks/react 0.16.15 → 0.17.0-test1
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 +318 -45
- package/index.js +565 -259
- package/index.mjs +511 -216
- package/package.json +12 -11
package/index.js
CHANGED
|
@@ -1,272 +1,578 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var React = require("react"), client = require("@liveblocks/client"), internal = require("@liveblocks/client/internal");
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
+
var React = require("react"),
|
|
4
|
+
client = require("@liveblocks/client"),
|
|
5
|
+
internal = require("@liveblocks/client/internal");
|
|
9
6
|
function _interopNamespace(e) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
return (
|
|
10
|
+
e &&
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if ("default" !== k) {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(
|
|
15
|
+
n,
|
|
16
|
+
k,
|
|
17
|
+
d.get
|
|
18
|
+
? d
|
|
19
|
+
: {
|
|
20
|
+
enumerable: !0,
|
|
21
|
+
get: function () {
|
|
22
|
+
return e[k];
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
(n.default = e),
|
|
29
|
+
Object.freeze(n)
|
|
30
|
+
);
|
|
23
31
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
var React__namespace = _interopNamespace(React),
|
|
33
|
+
ClientContext = React__namespace.createContext(null);
|
|
27
34
|
function useClient() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
var client = React__namespace.useContext(ClientContext);
|
|
36
|
+
if (null == client)
|
|
37
|
+
throw new Error("LiveblocksProvider is missing from the react tree");
|
|
38
|
+
return client;
|
|
31
39
|
}
|
|
32
|
-
|
|
33
40
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
try {
|
|
42
|
+
var info = gen[key](arg),
|
|
43
|
+
value = info.value;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
return void reject(error);
|
|
46
|
+
}
|
|
47
|
+
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
40
48
|
}
|
|
41
|
-
|
|
42
49
|
function _asyncToGenerator(fn) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
return function () {
|
|
51
|
+
var self = this,
|
|
52
|
+
args = arguments;
|
|
53
|
+
return new Promise(function (resolve, reject) {
|
|
54
|
+
var gen = fn.apply(self, args);
|
|
55
|
+
function _next(value) {
|
|
56
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
57
|
+
}
|
|
58
|
+
function _throw(err) {
|
|
59
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
60
|
+
}
|
|
61
|
+
_next(void 0);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
56
64
|
}
|
|
57
|
-
|
|
58
65
|
function useRerender() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
return React.useReducer(function (x) {
|
|
67
|
+
return x + 1;
|
|
68
|
+
}, 0)[1];
|
|
62
69
|
}
|
|
63
|
-
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
70
|
+
function configureRoom(client$1) {
|
|
71
|
+
var useClient$1;
|
|
72
|
+
useClient$1 =
|
|
73
|
+
void 0 !== client$1
|
|
74
|
+
? function () {
|
|
75
|
+
return client$1;
|
|
76
|
+
}
|
|
77
|
+
: useClient;
|
|
78
|
+
var RoomContext = React__namespace.createContext(null);
|
|
79
|
+
function useRoom() {
|
|
80
|
+
var room = React__namespace.useContext(RoomContext);
|
|
81
|
+
if (null == room)
|
|
82
|
+
throw new Error("RoomProvider is missing from the react tree");
|
|
83
|
+
return room;
|
|
84
|
+
}
|
|
85
|
+
function useStorage() {
|
|
86
|
+
var room = useRoom(),
|
|
87
|
+
_React$useState2 = React__namespace.useState(null),
|
|
88
|
+
root = _React$useState2[0],
|
|
89
|
+
setState = _React$useState2[1];
|
|
90
|
+
return (
|
|
91
|
+
React__namespace.useEffect(
|
|
92
|
+
function () {
|
|
93
|
+
var didCancel = !1;
|
|
94
|
+
function _fetchStorage() {
|
|
95
|
+
return (_fetchStorage = _asyncToGenerator(
|
|
96
|
+
regeneratorRuntime.mark(function _callee() {
|
|
97
|
+
var storage;
|
|
98
|
+
return regeneratorRuntime.wrap(function (_context) {
|
|
99
|
+
for (;;)
|
|
100
|
+
switch ((_context.prev = _context.next)) {
|
|
101
|
+
case 0:
|
|
102
|
+
return (_context.next = 2), room.getStorage();
|
|
103
|
+
case 2:
|
|
104
|
+
(storage = _context.sent),
|
|
105
|
+
didCancel || setState(storage.root);
|
|
106
|
+
case 4:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context.stop();
|
|
109
|
+
}
|
|
110
|
+
}, _callee);
|
|
111
|
+
})
|
|
112
|
+
)).apply(this, arguments);
|
|
113
|
+
}
|
|
114
|
+
return (
|
|
115
|
+
(function () {
|
|
116
|
+
_fetchStorage.apply(this, arguments);
|
|
117
|
+
})(),
|
|
118
|
+
function () {
|
|
119
|
+
didCancel = !0;
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
},
|
|
123
|
+
[room]
|
|
124
|
+
),
|
|
125
|
+
[root]
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function deprecated_useMap(key, entries) {
|
|
129
|
+
internal.errorIf(
|
|
130
|
+
entries,
|
|
131
|
+
"Support for initializing entries in useMap() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n const initialStorage = () => ({\n " +
|
|
132
|
+
JSON.stringify(key) +
|
|
133
|
+
": new LiveMap(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."
|
|
134
|
+
);
|
|
135
|
+
var value = useStorageValue(
|
|
136
|
+
key,
|
|
137
|
+
new client.LiveMap(null != entries ? entries : void 0)
|
|
138
|
+
);
|
|
139
|
+
return "ok" === value.status
|
|
140
|
+
? value.value
|
|
141
|
+
: (internal.errorIf(
|
|
142
|
+
"notfound" === value.status,
|
|
143
|
+
"Key " +
|
|
144
|
+
JSON.stringify(key) +
|
|
145
|
+
' was not found in Storage. Starting with 0.18, useMap() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveMap } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' +
|
|
146
|
+
JSON.stringify(key) +
|
|
147
|
+
": new LiveMap(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."
|
|
148
|
+
),
|
|
149
|
+
null);
|
|
150
|
+
}
|
|
151
|
+
function deprecated_useList(key, items) {
|
|
152
|
+
internal.errorIf(
|
|
153
|
+
items,
|
|
154
|
+
'Support for initializing items in useList() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n import { LiveList } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' +
|
|
155
|
+
JSON.stringify(key) +
|
|
156
|
+
": new LiveList(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."
|
|
157
|
+
);
|
|
158
|
+
var value = useStorageValue(key, new client.LiveList(items));
|
|
159
|
+
return "ok" === value.status
|
|
160
|
+
? value.value
|
|
161
|
+
: (internal.errorIf(
|
|
162
|
+
"notfound" === value.status,
|
|
163
|
+
"Key " +
|
|
164
|
+
JSON.stringify(key) +
|
|
165
|
+
' was not found in Storage. Starting with 0.18, useList() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveList } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' +
|
|
166
|
+
JSON.stringify(key) +
|
|
167
|
+
": new LiveList(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."
|
|
168
|
+
),
|
|
169
|
+
null);
|
|
170
|
+
}
|
|
171
|
+
function deprecated_useObject(key, initialData) {
|
|
172
|
+
internal.errorIf(
|
|
173
|
+
initialData,
|
|
174
|
+
'Support for initializing data in useObject() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n import { LiveObject } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' +
|
|
175
|
+
JSON.stringify(key) +
|
|
176
|
+
": new LiveObject(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."
|
|
177
|
+
);
|
|
178
|
+
var value = useStorageValue(key, new client.LiveObject(initialData));
|
|
179
|
+
return "ok" === value.status
|
|
180
|
+
? value.value
|
|
181
|
+
: (internal.errorIf(
|
|
182
|
+
"notfound" === value.status,
|
|
183
|
+
"Key " +
|
|
184
|
+
JSON.stringify(key) +
|
|
185
|
+
' was not found in Storage. Starting with 0.18, useObject() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveObject } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' +
|
|
186
|
+
JSON.stringify(key) +
|
|
187
|
+
": new LiveObject(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."
|
|
188
|
+
),
|
|
189
|
+
null);
|
|
190
|
+
}
|
|
191
|
+
function useHistory() {
|
|
192
|
+
return useRoom().history;
|
|
193
|
+
}
|
|
194
|
+
function useStorageValue(key, initialValue) {
|
|
195
|
+
var room = useRoom(),
|
|
196
|
+
root = useStorage()[0],
|
|
197
|
+
rerender = useRerender();
|
|
198
|
+
if (
|
|
199
|
+
(React__namespace.useEffect(
|
|
200
|
+
function () {
|
|
201
|
+
if (null != root) {
|
|
202
|
+
var liveValue = root.get(key);
|
|
203
|
+
null == liveValue &&
|
|
204
|
+
((liveValue = initialValue), root.set(key, liveValue));
|
|
205
|
+
var unsubscribeCrdt = room.subscribe(liveValue, rerender),
|
|
206
|
+
unsubscribeRoot = room.subscribe(root, function () {
|
|
207
|
+
var newCrdt = root.get(key);
|
|
208
|
+
newCrdt !== liveValue &&
|
|
209
|
+
(unsubscribeCrdt(),
|
|
210
|
+
(liveValue = newCrdt),
|
|
211
|
+
(unsubscribeCrdt = room.subscribe(liveValue, rerender)),
|
|
212
|
+
rerender());
|
|
213
|
+
});
|
|
214
|
+
return (
|
|
215
|
+
rerender(),
|
|
216
|
+
function () {
|
|
217
|
+
unsubscribeRoot(), unsubscribeCrdt();
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
[root, room]
|
|
223
|
+
),
|
|
224
|
+
null == root)
|
|
225
|
+
)
|
|
226
|
+
return { status: "loading" };
|
|
227
|
+
var value = root.get(key);
|
|
228
|
+
return null == value
|
|
229
|
+
? { status: "notfound" }
|
|
230
|
+
: { status: "ok", value: value };
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
RoomProvider: function (props) {
|
|
234
|
+
var roomId = props.id,
|
|
235
|
+
initialPresence = props.initialPresence,
|
|
236
|
+
initialStorage = props.initialStorage,
|
|
237
|
+
defaultPresence = props.defaultPresence,
|
|
238
|
+
defaultStorageRoot = props.defaultStorageRoot;
|
|
239
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
240
|
+
if (null == roomId)
|
|
241
|
+
throw new Error(
|
|
242
|
+
"RoomProvider id property is required. For more information: https://liveblocks.io/docs/errors/liveblocks-react/RoomProvider-id-property-is-required"
|
|
243
|
+
);
|
|
244
|
+
if ("string" != typeof roomId)
|
|
245
|
+
throw new Error("RoomProvider id property should be a string.");
|
|
89
246
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
247
|
+
internal.errorIf(
|
|
248
|
+
defaultPresence,
|
|
249
|
+
"RoomProvider's `defaultPresence` prop will be removed in @liveblocks/react 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP"
|
|
250
|
+
),
|
|
251
|
+
internal.errorIf(
|
|
252
|
+
defaultStorageRoot,
|
|
253
|
+
"RoomProvider's `defaultStorageRoot` prop will be removed in @liveblocks/react 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP"
|
|
254
|
+
);
|
|
255
|
+
var _client = useClient$1(),
|
|
256
|
+
_React$useState = React__namespace.useState(function () {
|
|
257
|
+
return _client.enter(roomId, {
|
|
258
|
+
initialPresence: initialPresence,
|
|
259
|
+
initialStorage: initialStorage,
|
|
260
|
+
defaultPresence: defaultPresence,
|
|
261
|
+
defaultStorageRoot: defaultStorageRoot,
|
|
262
|
+
DO_NOT_USE_withoutConnecting: "undefined" == typeof window,
|
|
263
|
+
});
|
|
264
|
+
}),
|
|
265
|
+
room = _React$useState[0],
|
|
266
|
+
setRoom = _React$useState[1];
|
|
267
|
+
return (
|
|
268
|
+
React__namespace.useEffect(
|
|
269
|
+
function () {
|
|
270
|
+
return (
|
|
271
|
+
setRoom(
|
|
272
|
+
_client.enter(roomId, {
|
|
273
|
+
initialPresence: initialPresence,
|
|
274
|
+
initialStorage: initialStorage,
|
|
275
|
+
defaultPresence: defaultPresence,
|
|
276
|
+
defaultStorageRoot: defaultStorageRoot,
|
|
277
|
+
DO_NOT_USE_withoutConnecting: "undefined" == typeof window,
|
|
278
|
+
})
|
|
279
|
+
),
|
|
280
|
+
function () {
|
|
281
|
+
_client.leave(roomId);
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
},
|
|
285
|
+
[_client, roomId]
|
|
286
|
+
),
|
|
287
|
+
React__namespace.createElement(
|
|
288
|
+
RoomContext.Provider,
|
|
289
|
+
{ value: room },
|
|
290
|
+
props.children
|
|
291
|
+
)
|
|
292
|
+
);
|
|
293
|
+
},
|
|
294
|
+
useBatch: function () {
|
|
295
|
+
return useRoom().batch;
|
|
296
|
+
},
|
|
297
|
+
useBroadcastEvent: function () {
|
|
298
|
+
var room = useRoom();
|
|
299
|
+
return React__namespace.useCallback(
|
|
300
|
+
function (event, options) {
|
|
301
|
+
void 0 === options && (options = { shouldQueueEventIfNotReady: !1 }),
|
|
302
|
+
room.broadcastEvent(event, options);
|
|
303
|
+
},
|
|
304
|
+
[room]
|
|
305
|
+
);
|
|
306
|
+
},
|
|
307
|
+
useErrorListener: function (callback) {
|
|
308
|
+
var room = useRoom(),
|
|
309
|
+
savedCallback = React__namespace.useRef(callback);
|
|
310
|
+
React__namespace.useEffect(function () {
|
|
311
|
+
savedCallback.current = callback;
|
|
312
|
+
}),
|
|
313
|
+
React__namespace.useEffect(
|
|
314
|
+
function () {
|
|
315
|
+
var unsubscribe = room.subscribe("error", function (e) {
|
|
316
|
+
return savedCallback.current(e);
|
|
317
|
+
});
|
|
318
|
+
return function () {
|
|
319
|
+
unsubscribe();
|
|
320
|
+
};
|
|
321
|
+
},
|
|
322
|
+
[room]
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
useEventListener: function (callback) {
|
|
326
|
+
var room = useRoom(),
|
|
327
|
+
savedCallback = React__namespace.useRef(callback);
|
|
328
|
+
React__namespace.useEffect(function () {
|
|
329
|
+
savedCallback.current = callback;
|
|
330
|
+
}),
|
|
331
|
+
React__namespace.useEffect(
|
|
332
|
+
function () {
|
|
333
|
+
var unsubscribe = room.subscribe("event", function (eventData) {
|
|
334
|
+
savedCallback.current(eventData);
|
|
335
|
+
});
|
|
336
|
+
return function () {
|
|
337
|
+
unsubscribe();
|
|
338
|
+
};
|
|
339
|
+
},
|
|
340
|
+
[room]
|
|
341
|
+
);
|
|
342
|
+
},
|
|
343
|
+
useHistory: useHistory,
|
|
344
|
+
useList: function (key) {
|
|
345
|
+
return deprecated_useList(key);
|
|
346
|
+
},
|
|
347
|
+
deprecated_useList: deprecated_useList,
|
|
348
|
+
useMap: function (key) {
|
|
349
|
+
return deprecated_useMap(key);
|
|
350
|
+
},
|
|
351
|
+
deprecated_useMap: deprecated_useMap,
|
|
352
|
+
useMyPresence: function () {
|
|
353
|
+
var room = useRoom(),
|
|
354
|
+
presence = room.getPresence(),
|
|
355
|
+
rerender = useRerender();
|
|
356
|
+
return (
|
|
357
|
+
React__namespace.useEffect(
|
|
358
|
+
function () {
|
|
359
|
+
var unsubscribe = room.subscribe("my-presence", rerender);
|
|
360
|
+
return function () {
|
|
361
|
+
unsubscribe();
|
|
362
|
+
};
|
|
363
|
+
},
|
|
364
|
+
[room]
|
|
365
|
+
),
|
|
366
|
+
[
|
|
367
|
+
presence,
|
|
368
|
+
React__namespace.useCallback(
|
|
369
|
+
function (overrides, options) {
|
|
370
|
+
return room.updatePresence(overrides, options);
|
|
371
|
+
},
|
|
372
|
+
[room]
|
|
373
|
+
),
|
|
374
|
+
]
|
|
375
|
+
);
|
|
376
|
+
},
|
|
377
|
+
useObject: function (key) {
|
|
378
|
+
return deprecated_useObject(key);
|
|
379
|
+
},
|
|
380
|
+
deprecated_useObject: deprecated_useObject,
|
|
381
|
+
useOthers: function () {
|
|
382
|
+
var room = useRoom(),
|
|
383
|
+
rerender = useRerender();
|
|
384
|
+
return (
|
|
385
|
+
React__namespace.useEffect(
|
|
386
|
+
function () {
|
|
387
|
+
var unsubscribe = room.subscribe("others", rerender);
|
|
388
|
+
return function () {
|
|
389
|
+
unsubscribe();
|
|
390
|
+
};
|
|
391
|
+
},
|
|
392
|
+
[room]
|
|
393
|
+
),
|
|
394
|
+
room.getOthers()
|
|
395
|
+
);
|
|
396
|
+
},
|
|
397
|
+
useRedo: function () {
|
|
398
|
+
return useHistory().redo;
|
|
399
|
+
},
|
|
400
|
+
useRoom: useRoom,
|
|
401
|
+
useSelf: function () {
|
|
402
|
+
var room = useRoom(),
|
|
403
|
+
rerender = useRerender();
|
|
404
|
+
return (
|
|
405
|
+
React__namespace.useEffect(
|
|
406
|
+
function () {
|
|
407
|
+
var unsubscribePresence = room.subscribe("my-presence", rerender),
|
|
408
|
+
unsubscribeConnection = room.subscribe("connection", rerender);
|
|
409
|
+
return function () {
|
|
410
|
+
unsubscribePresence(), unsubscribeConnection();
|
|
411
|
+
};
|
|
412
|
+
},
|
|
413
|
+
[room]
|
|
414
|
+
),
|
|
415
|
+
room.getSelf()
|
|
416
|
+
);
|
|
417
|
+
},
|
|
418
|
+
useStorage: useStorage,
|
|
419
|
+
useUndo: function () {
|
|
420
|
+
return useHistory().undo;
|
|
421
|
+
},
|
|
422
|
+
useUpdateMyPresence: function () {
|
|
423
|
+
var room = useRoom();
|
|
424
|
+
return React__namespace.useCallback(
|
|
425
|
+
function (overrides, options) {
|
|
426
|
+
room.updatePresence(overrides, options);
|
|
427
|
+
},
|
|
428
|
+
[room]
|
|
429
|
+
);
|
|
430
|
+
},
|
|
120
431
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
RoomProvider
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
exports.useClient = useClient, exports.useErrorListener = useErrorListener, exports.useEventListener = useEventListener,
|
|
269
|
-
exports.useHistory = useHistory, exports.useList = useList, exports.useMap = useMap,
|
|
270
|
-
exports.useMyPresence = useMyPresence, exports.useObject = useObject, exports.useOthers = useOthers,
|
|
271
|
-
exports.useRedo = useRedo, exports.useRoom = useRoom, exports.useSelf = useSelf,
|
|
272
|
-
exports.useStorage = useStorage, exports.useUndo = useUndo, exports.useUpdateMyPresence = useUpdateMyPresence;
|
|
432
|
+
}
|
|
433
|
+
var _hooks = configureRoom();
|
|
434
|
+
(exports.LiveblocksProvider = function (props) {
|
|
435
|
+
return React__namespace.createElement(
|
|
436
|
+
ClientContext.Provider,
|
|
437
|
+
{ value: props.client },
|
|
438
|
+
props.children
|
|
439
|
+
);
|
|
440
|
+
}),
|
|
441
|
+
(exports.RoomProvider = function (props) {
|
|
442
|
+
return (
|
|
443
|
+
internal.deprecate(
|
|
444
|
+
"Please use `configureRoom()` instead of importing `RoomProvider` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
445
|
+
),
|
|
446
|
+
_hooks.RoomProvider(props)
|
|
447
|
+
);
|
|
448
|
+
}),
|
|
449
|
+
(exports.configureRoom = configureRoom),
|
|
450
|
+
(exports.useBatch = function () {
|
|
451
|
+
return (
|
|
452
|
+
internal.deprecate(
|
|
453
|
+
"Please use `configureRoom()` instead of importing `useBatch` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
454
|
+
),
|
|
455
|
+
_hooks.useBatch()
|
|
456
|
+
);
|
|
457
|
+
}),
|
|
458
|
+
(exports.useBroadcastEvent = function () {
|
|
459
|
+
return (
|
|
460
|
+
internal.deprecate(
|
|
461
|
+
"Please use `configureRoom()` instead of importing `useBroadcastEvent` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
462
|
+
),
|
|
463
|
+
_hooks.useBroadcastEvent()
|
|
464
|
+
);
|
|
465
|
+
}),
|
|
466
|
+
(exports.useClient = useClient),
|
|
467
|
+
(exports.useErrorListener = function (callback) {
|
|
468
|
+
return (
|
|
469
|
+
internal.deprecate(
|
|
470
|
+
"Please use `configureRoom()` instead of importing `useErrorListener` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
471
|
+
),
|
|
472
|
+
_hooks.useErrorListener(callback)
|
|
473
|
+
);
|
|
474
|
+
}),
|
|
475
|
+
(exports.useEventListener = function (callback) {
|
|
476
|
+
return (
|
|
477
|
+
internal.deprecate(
|
|
478
|
+
"Please use `configureRoom()` instead of importing `useEventListener` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
479
|
+
),
|
|
480
|
+
_hooks.useEventListener(callback)
|
|
481
|
+
);
|
|
482
|
+
}),
|
|
483
|
+
(exports.useHistory = function () {
|
|
484
|
+
return (
|
|
485
|
+
internal.deprecate(
|
|
486
|
+
"Please use `configureRoom()` instead of importing `useHistory` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
487
|
+
),
|
|
488
|
+
_hooks.useHistory()
|
|
489
|
+
);
|
|
490
|
+
}),
|
|
491
|
+
(exports.useList = function (key, items) {
|
|
492
|
+
return (
|
|
493
|
+
internal.deprecate(
|
|
494
|
+
"Please use `configureRoom()` instead of importing `useList` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
495
|
+
),
|
|
496
|
+
_hooks.deprecated_useList(key, items)
|
|
497
|
+
);
|
|
498
|
+
}),
|
|
499
|
+
(exports.useMap = function (key, entries) {
|
|
500
|
+
return (
|
|
501
|
+
internal.deprecate(
|
|
502
|
+
"Please use `configureRoom()` instead of importing `useMap` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
503
|
+
),
|
|
504
|
+
_hooks.deprecated_useMap(key, entries)
|
|
505
|
+
);
|
|
506
|
+
}),
|
|
507
|
+
(exports.useMyPresence = function () {
|
|
508
|
+
return (
|
|
509
|
+
internal.deprecate(
|
|
510
|
+
"Please use `configureRoom()` instead of importing `useMyPresence` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
511
|
+
),
|
|
512
|
+
_hooks.useMyPresence()
|
|
513
|
+
);
|
|
514
|
+
}),
|
|
515
|
+
(exports.useObject = function (key, initialData) {
|
|
516
|
+
return (
|
|
517
|
+
internal.deprecate(
|
|
518
|
+
"Please use `configureRoom()` instead of importing `useObject` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
519
|
+
),
|
|
520
|
+
_hooks.deprecated_useObject(key, initialData)
|
|
521
|
+
);
|
|
522
|
+
}),
|
|
523
|
+
(exports.useOthers = function () {
|
|
524
|
+
return (
|
|
525
|
+
internal.deprecate(
|
|
526
|
+
"Please use `configureRoom()` instead of importing `useOthers` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
527
|
+
),
|
|
528
|
+
_hooks.useOthers()
|
|
529
|
+
);
|
|
530
|
+
}),
|
|
531
|
+
(exports.useRedo = function () {
|
|
532
|
+
return (
|
|
533
|
+
internal.deprecate(
|
|
534
|
+
"Please use `configureRoom()` instead of importing `useRedo` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
535
|
+
),
|
|
536
|
+
_hooks.useRedo()
|
|
537
|
+
);
|
|
538
|
+
}),
|
|
539
|
+
(exports.useRoom = function () {
|
|
540
|
+
return (
|
|
541
|
+
internal.deprecate(
|
|
542
|
+
"Please use `configureRoom()` instead of importing `useRoom` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
543
|
+
),
|
|
544
|
+
_hooks.useRoom()
|
|
545
|
+
);
|
|
546
|
+
}),
|
|
547
|
+
(exports.useSelf = function () {
|
|
548
|
+
return (
|
|
549
|
+
internal.deprecate(
|
|
550
|
+
"Please use `configureRoom()` instead of importing `useSelf` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
551
|
+
),
|
|
552
|
+
_hooks.useSelf()
|
|
553
|
+
);
|
|
554
|
+
}),
|
|
555
|
+
(exports.useStorage = function () {
|
|
556
|
+
return (
|
|
557
|
+
internal.deprecate(
|
|
558
|
+
"Please use `configureRoom()` instead of importing `useStorage` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
559
|
+
),
|
|
560
|
+
_hooks.useStorage()
|
|
561
|
+
);
|
|
562
|
+
}),
|
|
563
|
+
(exports.useUndo = function () {
|
|
564
|
+
return (
|
|
565
|
+
internal.deprecate(
|
|
566
|
+
"Please use `configureRoom()` instead of importing `useUndo` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
567
|
+
),
|
|
568
|
+
_hooks.useUndo()
|
|
569
|
+
);
|
|
570
|
+
}),
|
|
571
|
+
(exports.useUpdateMyPresence = function () {
|
|
572
|
+
return (
|
|
573
|
+
internal.deprecate(
|
|
574
|
+
"Please use `configureRoom()` instead of importing `useUpdateMyPresence` from `@liveblocks/react` directly. See https://gist.github.com/nvie/5e718902c51ea7dad93cd6952fe1af03 for details."
|
|
575
|
+
),
|
|
576
|
+
_hooks.useUpdateMyPresence()
|
|
577
|
+
);
|
|
578
|
+
});
|