@pluv/react 2.2.1 → 2.2.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @pluv/react
2
2
 
3
+ ## 2.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/client@2.2.3
8
+ - @pluv/crdt@2.2.3
9
+ - @pluv/types@2.2.3
10
+
11
+ ## 2.2.2
12
+
13
+ ### Patch Changes
14
+
15
+ - @pluv/client@2.2.2
16
+ - @pluv/crdt@2.2.2
17
+ - @pluv/types@2.2.2
18
+
3
19
  ## 2.2.1
4
20
 
5
21
  ### Patch Changes
@@ -14,42 +30,42 @@
14
30
 
15
31
  - 3ce1547: Updated typings for `useDoc` to be narrower to get the native doc type.
16
32
 
17
- ```ts
18
- import { createClient } from "@pluv/client";
19
- import { yjs } from "@pluv/crdt-yjs";
20
- import { createBundle } from "@pluv/react";
21
- import type { Doc as YDoc } from "yjs";
33
+ ```ts
34
+ import { createClient } from "@pluv/client";
35
+ import { yjs } from "@pluv/crdt-yjs";
36
+ import { createBundle } from "@pluv/react";
37
+ import type { Doc as YDoc } from "yjs";
22
38
 
23
- const client = createClient({
24
- // ...
25
- crdt: yjs,
26
- });
27
- const { useDoc } = createBundle(client);
39
+ const client = createClient({
40
+ // ...
41
+ crdt: yjs,
42
+ });
43
+ const { useDoc } = createBundle(client);
28
44
 
29
- const doc = useDoc();
45
+ const doc = useDoc();
30
46
 
31
- // This is now typed as the native YDoc
32
- doc.value;
33
- // ^? const value: YDoc
34
- ```
47
+ // This is now typed as the native YDoc
48
+ doc.value;
49
+ // ^? const value: YDoc
50
+ ```
35
51
 
36
52
  - b999c1c: Added a new type `InferBundleRoom` to get the type of the `PluvRoom` from the react bundle that is created.
37
53
 
38
- ```ts
39
- import { createClient } from "@pluv/client";
40
- import type { InferBundleRoom } from "@pluv/react";
41
- import { createBundle } from "@pluv/react";
54
+ ```ts
55
+ import { createClient } from "@pluv/client";
56
+ import type { InferBundleRoom } from "@pluv/react";
57
+ import { createBundle } from "@pluv/react";
42
58
 
43
- const client = createclient({
44
- /* ... */
45
- });
59
+ const client = createclient({
60
+ /* ... */
61
+ });
46
62
 
47
- const bundle = createBundle(client);
63
+ const bundle = createBundle(client);
48
64
 
49
- type RoomType = InferBundleRoom<typeof bundle>;
65
+ type RoomType = InferBundleRoom<typeof bundle>;
50
66
 
51
- const { useStorage } = bundle;
52
- ```
67
+ const { useStorage } = bundle;
68
+ ```
53
69
 
54
70
  ### Patch Changes
55
71
 
@@ -61,9 +77,9 @@
61
77
  - Updated dependencies [aee40cb]
62
78
  - Updated dependencies [edd1789]
63
79
  - Updated dependencies [48191fa]
64
- - @pluv/client@2.2.0
65
- - @pluv/crdt@2.2.0
66
- - @pluv/types@2.2.0
80
+ - @pluv/client@2.2.0
81
+ - @pluv/crdt@2.2.0
82
+ - @pluv/types@2.2.0
67
83
 
68
84
  ## 2.1.0
69
85
 
@@ -80,9 +96,9 @@
80
96
  - Updated dependencies [5ca5cb6]
81
97
  - Updated dependencies [4acbe1e]
82
98
  - Updated dependencies [e8d8fbc]
83
- - @pluv/client@2.1.0
84
- - @pluv/crdt@2.1.0
85
- - @pluv/types@2.1.0
99
+ - @pluv/client@2.1.0
100
+ - @pluv/crdt@2.1.0
101
+ - @pluv/types@2.1.0
86
102
 
87
103
  ## 2.0.2
88
104
 
@@ -97,9 +113,9 @@
97
113
  ### Patch Changes
98
114
 
99
115
  - Updated dependencies [1b93b18]
100
- - @pluv/client@2.0.1
101
- - @pluv/crdt@2.0.1
102
- - @pluv/types@2.0.1
116
+ - @pluv/client@2.0.1
117
+ - @pluv/crdt@2.0.1
118
+ - @pluv/types@2.0.1
103
119
 
104
120
  ## 2.0.0
105
121
 
@@ -107,73 +123,73 @@
107
123
 
108
124
  - 5cec54a: **Deprecated** Declaring top-level types on your CRDT storage via the `yjs` or `loro` utility (e.g. `yjs.array` or `loro.list`) for the `initialStorage` prop on `PluvRoomProvider` is now deprecated, to be removed in the next major release (v2). Continuing to use the `yjs` or `loro` utilities to declare top-level types will log a warning to your console while in development mode (i.e. when `process.env.NODE_ENV === "development"`). To declare top-level types, you should now use the builder type exposed in the `initialStorage` function. See the example below:
109
125
 
110
- ```tsx
111
- import { yjs } from "@pluv/crdt-yjs";
112
-
113
- // Before
114
- <PluvRoomProvider
115
- room="example-room"
116
- initialStorage={() => ({
117
- // Using the `yjs` or `loro` utility (in this case `yjs.map`) when
118
- // declaring top-level types is now deprecated
119
- topType: yjs.map([
120
- ["key1", yjs.text("")],
121
- ["key2", yjs.text("")],
122
- ]),
123
- })}
124
- >
125
- <div />
126
- </PluvRoomProvider>
127
-
128
- // After
129
- <PluvRoomProvider
130
- room="example-room"
131
- initialStorage={(t) => ({
132
- // Top-level properties must now use the builder (in this case `t`).
133
- // This effectively calls `yjs.getMap("topType")` to instantiate the type on
134
- // the root document.
135
- // This simply returns the native Yjs shared-types (e.g. Y.Map), which
136
- // allows you operate on your yjs shared-typess in a more native way.
137
- topType: t.map("topType", [
138
- // Declaring nested types should continue to use the `yjs` utilities
139
- // you've used before
140
- ["key1", yjs.text("")],
141
- ["key2", yjs.text("")],
142
- ]),
143
- })}
144
- >
145
- <div />
146
- </PluvRoomProvider>
147
- ```
148
-
149
- The functions on the builder type calls the native yjs shared-type (or loro container type) instantiating methods and returns the native types (e.g. `t.map("topType")` is simply just a `Y.Doc.getMap("topType")`) call under the hood. This allows you to declare your type in a more yjs-native and predictable way, and enables declaring more complex initial storage states if needed.
126
+ ```tsx
127
+ import { yjs } from "@pluv/crdt-yjs";
128
+
129
+ // Before
130
+ <PluvRoomProvider
131
+ room="example-room"
132
+ initialStorage={() => ({
133
+ // Using the `yjs` or `loro` utility (in this case `yjs.map`) when
134
+ // declaring top-level types is now deprecated
135
+ topType: yjs.map([
136
+ ["key1", yjs.text("")],
137
+ ["key2", yjs.text("")],
138
+ ]),
139
+ })}
140
+ >
141
+ <div />
142
+ </PluvRoomProvider>
143
+
144
+ // After
145
+ <PluvRoomProvider
146
+ room="example-room"
147
+ initialStorage={(t) => ({
148
+ // Top-level properties must now use the builder (in this case `t`).
149
+ // This effectively calls `yjs.getMap("topType")` to instantiate the type on
150
+ // the root document.
151
+ // This simply returns the native Yjs shared-types (e.g. Y.Map), which
152
+ // allows you operate on your yjs shared-typess in a more native way.
153
+ topType: t.map("topType", [
154
+ // Declaring nested types should continue to use the `yjs` utilities
155
+ // you've used before
156
+ ["key1", yjs.text("")],
157
+ ["key2", yjs.text("")],
158
+ ]),
159
+ })}
160
+ >
161
+ <div />
162
+ </PluvRoomProvider>
163
+ ```
164
+
165
+ The functions on the builder type calls the native yjs shared-type (or loro container type) instantiating methods and returns the native types (e.g. `t.map("topType")` is simply just a `Y.Doc.getMap("topType")`) call under the hood. This allows you to declare your type in a more yjs-native and predictable way, and enables declaring more complex initial storage states if needed.
150
166
 
151
167
  ### Patch Changes
152
168
 
153
169
  - Updated dependencies [047a1d8]
154
170
  - Updated dependencies [0806212]
155
171
  - Updated dependencies [3a34dbb]
156
- - @pluv/client@2.0.0
157
- - @pluv/types@2.0.0
158
- - @pluv/crdt@2.0.0
172
+ - @pluv/client@2.0.0
173
+ - @pluv/types@2.0.0
174
+ - @pluv/crdt@2.0.0
159
175
 
160
176
  ## 1.0.2
161
177
 
162
178
  ### Patch Changes
163
179
 
164
180
  - Updated dependencies [d87159c]
165
- - @pluv/client@1.0.2
166
- - @pluv/crdt@1.0.2
167
- - @pluv/types@1.0.2
181
+ - @pluv/client@1.0.2
182
+ - @pluv/crdt@1.0.2
183
+ - @pluv/types@1.0.2
168
184
 
169
185
  ## 1.0.1
170
186
 
171
187
  ### Patch Changes
172
188
 
173
189
  - Updated dependencies [c583be9]
174
- - @pluv/client@1.0.1
175
- - @pluv/crdt@1.0.1
176
- - @pluv/types@1.0.1
190
+ - @pluv/client@1.0.1
191
+ - @pluv/crdt@1.0.1
192
+ - @pluv/types@1.0.1
177
193
 
178
194
  ## 1.0.0
179
195
 
@@ -182,34 +198,34 @@
182
198
  - 4c8b203: **BREAKING** `@pluv/client` is now a peer dependency of `@pluv/react`.
183
199
  - af94706: pluv.io is now stable and production ready!
184
200
 
185
- With this v1 release, pluv.io will now follow [semantic versioning](https://semver.org/) with more comprehensive release notes for future changes to the library.
201
+ With this v1 release, pluv.io will now follow [semantic versioning](https://semver.org/) with more comprehensive release notes for future changes to the library.
186
202
 
187
- Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
203
+ Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
188
204
 
189
205
  ### Patch Changes
190
206
 
191
207
  - Updated dependencies [af94706]
192
- - @pluv/client@1.0.0
193
- - @pluv/crdt@1.0.0
194
- - @pluv/types@1.0.0
208
+ - @pluv/client@1.0.0
209
+ - @pluv/crdt@1.0.0
210
+ - @pluv/types@1.0.0
195
211
 
196
212
  ## 0.44.2
197
213
 
198
214
  ### Patch Changes
199
215
 
200
216
  - Updated dependencies [6cfd36f]
201
- - @pluv/client@0.44.2
202
- - @pluv/crdt@0.44.2
203
- - @pluv/types@0.44.2
217
+ - @pluv/client@0.44.2
218
+ - @pluv/crdt@0.44.2
219
+ - @pluv/types@0.44.2
204
220
 
205
221
  ## 0.44.1
206
222
 
207
223
  ### Patch Changes
208
224
 
209
225
  - Updated dependencies [67c081d]
210
- - @pluv/client@0.44.1
211
- - @pluv/crdt@0.44.1
212
- - @pluv/types@0.44.1
226
+ - @pluv/client@0.44.1
227
+ - @pluv/crdt@0.44.1
228
+ - @pluv/types@0.44.1
213
229
 
214
230
  ## 0.44.0
215
231
 
@@ -218,27 +234,27 @@
218
234
  - Updated dependencies [fba9354]
219
235
  - Updated dependencies [bc2d684]
220
236
  - Updated dependencies [c9fcea5]
221
- - @pluv/client@0.44.0
222
- - @pluv/crdt@0.44.0
223
- - @pluv/types@0.44.0
237
+ - @pluv/client@0.44.0
238
+ - @pluv/crdt@0.44.0
239
+ - @pluv/types@0.44.0
224
240
 
225
241
  ## 0.43.0
226
242
 
227
243
  ### Patch Changes
228
244
 
229
245
  - Updated dependencies [65d9172]
230
- - @pluv/client@0.43.0
231
- - @pluv/crdt@0.43.0
232
- - @pluv/types@0.43.0
246
+ - @pluv/client@0.43.0
247
+ - @pluv/crdt@0.43.0
248
+ - @pluv/types@0.43.0
233
249
 
234
250
  ## 0.42.0
235
251
 
236
252
  ### Patch Changes
237
253
 
238
254
  - Updated dependencies [7ae56bf]
239
- - @pluv/client@0.42.0
240
- - @pluv/crdt@0.42.0
241
- - @pluv/types@0.42.0
255
+ - @pluv/client@0.42.0
256
+ - @pluv/crdt@0.42.0
257
+ - @pluv/types@0.42.0
242
258
 
243
259
  ## 0.41.7
244
260
 
@@ -253,18 +269,18 @@
253
269
  ### Patch Changes
254
270
 
255
271
  - Updated dependencies [71642fa]
256
- - @pluv/client@0.41.6
257
- - @pluv/crdt@0.41.6
258
- - @pluv/types@0.41.6
272
+ - @pluv/client@0.41.6
273
+ - @pluv/crdt@0.41.6
274
+ - @pluv/types@0.41.6
259
275
 
260
276
  ## 0.41.5
261
277
 
262
278
  ### Patch Changes
263
279
 
264
280
  - Updated dependencies [b3b7b30]
265
- - @pluv/client@0.41.5
266
- - @pluv/crdt@0.41.5
267
- - @pluv/types@0.41.5
281
+ - @pluv/client@0.41.5
282
+ - @pluv/crdt@0.41.5
283
+ - @pluv/types@0.41.5
268
284
 
269
285
  ## 0.41.4
270
286
 
@@ -279,18 +295,18 @@
279
295
  ### Patch Changes
280
296
 
281
297
  - Updated dependencies [49051c0]
282
- - @pluv/client@0.41.3
283
- - @pluv/crdt@0.41.3
284
- - @pluv/types@0.41.3
298
+ - @pluv/client@0.41.3
299
+ - @pluv/crdt@0.41.3
300
+ - @pluv/types@0.41.3
285
301
 
286
302
  ## 0.41.2
287
303
 
288
304
  ### Patch Changes
289
305
 
290
306
  - Updated dependencies [37956d3]
291
- - @pluv/client@0.41.2
292
- - @pluv/crdt@0.41.2
293
- - @pluv/types@0.41.2
307
+ - @pluv/client@0.41.2
308
+ - @pluv/crdt@0.41.2
309
+ - @pluv/types@0.41.2
294
310
 
295
311
  ## 0.41.1
296
312
 
@@ -308,18 +324,18 @@
308
324
  - Updated dependencies [eb2d903]
309
325
  - Updated dependencies [555b88d]
310
326
  - Updated dependencies [555b88d]
311
- - @pluv/client@0.41.0
312
- - @pluv/crdt@0.41.0
313
- - @pluv/types@0.41.0
327
+ - @pluv/client@0.41.0
328
+ - @pluv/crdt@0.41.0
329
+ - @pluv/types@0.41.0
314
330
 
315
331
  ## 0.40.2
316
332
 
317
333
  ### Patch Changes
318
334
 
319
335
  - Updated dependencies [6fbc2fe]
320
- - @pluv/client@0.40.2
321
- - @pluv/crdt@0.40.2
322
- - @pluv/types@0.40.2
336
+ - @pluv/client@0.40.2
337
+ - @pluv/crdt@0.40.2
338
+ - @pluv/types@0.40.2
323
339
 
324
340
  ## 0.40.1
325
341
 
@@ -342,9 +358,9 @@
342
358
  ### Patch Changes
343
359
 
344
360
  - 36606b4: Fix `PluvRoomProvider` never connecting when `metadata` is a function.
345
- - @pluv/client@0.39.1
346
- - @pluv/crdt@0.39.1
347
- - @pluv/types@0.39.1
361
+ - @pluv/client@0.39.1
362
+ - @pluv/crdt@0.39.1
363
+ - @pluv/types@0.39.1
348
364
 
349
365
  ## 0.39.0
350
366
 
@@ -352,13 +368,13 @@
352
368
 
353
369
  - ca160f5: **BREAKING** Update the context value of `MockedRoomContext` to mirror the same shape as `PluvRoomContext`. i.e. the value of `MockedRoomContext` is now the room itself, rather than an object containing the room. This should not be breaking in most cases. If you happen to be using `useContext(MockedRoomContext)`, those will need to be updated as shown below:
354
370
 
355
- ```tsx
356
- // Before
357
- const { room } = useContext(MockedRoomContext);
371
+ ```tsx
372
+ // Before
373
+ const { room } = useContext(MockedRoomContext);
358
374
 
359
- // After
360
- const room = useContext(MockedRoomContext);
361
- ```
375
+ // After
376
+ const room = useContext(MockedRoomContext);
377
+ ```
362
378
 
363
379
  ### Patch Changes
364
380
 
@@ -366,39 +382,39 @@
366
382
  - e6ddddc: (Internal) Update how `PluvRoomProvider` handles the `metadata` prop internally to be updated to how `PluvClient` now handles this (i.e. moved to `PluvClient.enter`, from `PluvClient.createRoom`).
367
383
  - e6ddddc: Add support for a passing either a function or object for the `metadata` prop on `PluvRoomProvider`. When a function is used, the `metadata` will be gotten at the moment of connection (internally this is a `useEffect`, so browser APIs can be used such as `document`, `window` and `localStorage`).
368
384
 
369
- ```tsx
370
- // Both of these work
371
- <PluvRoomProvider metadata={{ hello: "world" }}>
372
- {children}
373
- </PluvRoomProvider>
374
-
375
- <PluvRoomProvider
376
- metadata={() => {
377
- const value = localStorage.get(MY_LOCALSTORAGE_KEY);
378
-
379
- return { hello: value };
380
- }}
381
- >
382
- {children}
383
- </PluvRoomProvider>
384
- ```
385
+ ```tsx
386
+ // Both of these work
387
+ <PluvRoomProvider metadata={{ hello: "world" }}>
388
+ {children}
389
+ </PluvRoomProvider>
390
+
391
+ <PluvRoomProvider
392
+ metadata={() => {
393
+ const value = localStorage.get(MY_LOCALSTORAGE_KEY);
394
+
395
+ return { hello: value };
396
+ }}
397
+ >
398
+ {children}
399
+ </PluvRoomProvider>
400
+ ```
385
401
 
386
402
  - Updated dependencies [e6ddddc]
387
403
  - Updated dependencies [e6ddddc]
388
404
  - Updated dependencies [2cfb68d]
389
405
  - Updated dependencies [e6ddddc]
390
- - @pluv/client@0.39.0
391
- - @pluv/crdt@0.39.0
392
- - @pluv/types@0.39.0
406
+ - @pluv/client@0.39.0
407
+ - @pluv/crdt@0.39.0
408
+ - @pluv/types@0.39.0
393
409
 
394
410
  ## 0.38.14
395
411
 
396
412
  ### Patch Changes
397
413
 
398
414
  - Updated dependencies [886a1f9]
399
- - @pluv/client@0.38.14
400
- - @pluv/crdt@0.38.14
401
- - @pluv/types@0.38.14
415
+ - @pluv/client@0.38.14
416
+ - @pluv/crdt@0.38.14
417
+ - @pluv/types@0.38.14
402
418
 
403
419
  ## 0.38.13
404
420
 
@@ -413,27 +429,27 @@
413
429
  ### Patch Changes
414
430
 
415
431
  - Updated dependencies [b617726]
416
- - @pluv/client@0.38.12
417
- - @pluv/crdt@0.38.12
418
- - @pluv/types@0.38.12
432
+ - @pluv/client@0.38.12
433
+ - @pluv/crdt@0.38.12
434
+ - @pluv/types@0.38.12
419
435
 
420
436
  ## 0.38.11
421
437
 
422
438
  ### Patch Changes
423
439
 
424
440
  - Updated dependencies [5ac1aba]
425
- - @pluv/client@0.38.11
426
- - @pluv/crdt@0.38.11
427
- - @pluv/types@0.38.11
441
+ - @pluv/client@0.38.11
442
+ - @pluv/crdt@0.38.11
443
+ - @pluv/types@0.38.11
428
444
 
429
445
  ## 0.38.10
430
446
 
431
447
  ### Patch Changes
432
448
 
433
449
  - Updated dependencies [cadd963]
434
- - @pluv/client@0.38.10
435
- - @pluv/crdt@0.38.10
436
- - @pluv/types@0.38.10
450
+ - @pluv/client@0.38.10
451
+ - @pluv/crdt@0.38.10
452
+ - @pluv/types@0.38.10
437
453
 
438
454
  ## 0.38.9
439
455
 
@@ -488,18 +504,18 @@
488
504
  ### Patch Changes
489
505
 
490
506
  - Updated dependencies [8346273]
491
- - @pluv/client@0.38.3
492
- - @pluv/crdt@0.38.3
493
- - @pluv/types@0.38.3
507
+ - @pluv/client@0.38.3
508
+ - @pluv/crdt@0.38.3
509
+ - @pluv/types@0.38.3
494
510
 
495
511
  ## 0.38.2
496
512
 
497
513
  ### Patch Changes
498
514
 
499
515
  - Updated dependencies [de35f0b]
500
- - @pluv/client@0.38.2
501
- - @pluv/crdt@0.38.2
502
- - @pluv/types@0.38.2
516
+ - @pluv/client@0.38.2
517
+ - @pluv/crdt@0.38.2
518
+ - @pluv/types@0.38.2
503
519
 
504
520
  ## 0.38.1
505
521
 
@@ -514,9 +530,9 @@
514
530
  ### Patch Changes
515
531
 
516
532
  - Updated dependencies [f4ceca3]
517
- - @pluv/client@0.38.0
518
- - @pluv/types@0.38.0
519
- - @pluv/crdt@0.38.0
533
+ - @pluv/client@0.38.0
534
+ - @pluv/types@0.38.0
535
+ - @pluv/crdt@0.38.0
520
536
 
521
537
  ## 0.37.7
522
538
 
@@ -547,9 +563,9 @@
547
563
  ### Patch Changes
548
564
 
549
565
  - Updated dependencies [a9c3d17]
550
- - @pluv/client@0.37.4
551
- - @pluv/crdt@0.37.4
552
- - @pluv/types@0.37.4
566
+ - @pluv/client@0.37.4
567
+ - @pluv/crdt@0.37.4
568
+ - @pluv/types@0.37.4
553
569
 
554
570
  ## 0.37.3
555
571
 
@@ -557,27 +573,27 @@
557
573
 
558
574
  - dff89ff: Added an error message for when `createBundle` functions are used outside of `PluvRoomProvider`.
559
575
  - Updated dependencies [9ae837b]
560
- - @pluv/client@0.37.3
561
- - @pluv/crdt@0.37.3
562
- - @pluv/types@0.37.3
576
+ - @pluv/client@0.37.3
577
+ - @pluv/crdt@0.37.3
578
+ - @pluv/types@0.37.3
563
579
 
564
580
  ## 0.37.2
565
581
 
566
582
  ### Patch Changes
567
583
 
568
584
  - Updated dependencies [11920af]
569
- - @pluv/client@0.37.2
570
- - @pluv/crdt@0.37.2
571
- - @pluv/types@0.37.2
585
+ - @pluv/client@0.37.2
586
+ - @pluv/crdt@0.37.2
587
+ - @pluv/types@0.37.2
572
588
 
573
589
  ## 0.37.1
574
590
 
575
591
  ### Patch Changes
576
592
 
577
593
  - Updated dependencies [e923a8d]
578
- - @pluv/client@0.37.1
579
- - @pluv/crdt@0.37.1
580
- - @pluv/types@0.37.1
594
+ - @pluv/client@0.37.1
595
+ - @pluv/crdt@0.37.1
596
+ - @pluv/types@0.37.1
581
597
 
582
598
  ## 0.37.0
583
599
 
@@ -593,25 +609,25 @@
593
609
 
594
610
  - 2a84951: **BREAKING**
595
611
 
596
- Removed re-exports of `@pluv/client` and `@pluv/crdt` parts from `@pluv/react`.
612
+ Removed re-exports of `@pluv/client` and `@pluv/crdt` parts from `@pluv/react`.
597
613
 
598
- ```ts
599
- // Before
614
+ ```ts
615
+ // Before
600
616
 
601
- import { createBundle, createClient } from "@pluv/react";
617
+ import { createBundle, createClient } from "@pluv/react";
602
618
 
603
- // After
619
+ // After
604
620
 
605
- import { createClient } from "@pluv/client";
606
- import { createBundle } from "@pluv/react";
607
- ```
621
+ import { createClient } from "@pluv/client";
622
+ import { createBundle } from "@pluv/react";
623
+ ```
608
624
 
609
625
  ### Patch Changes
610
626
 
611
627
  - Updated dependencies [4518b6d]
612
- - @pluv/client@0.36.0
613
- - @pluv/crdt@0.36.0
614
- - @pluv/types@0.36.0
628
+ - @pluv/client@0.36.0
629
+ - @pluv/crdt@0.36.0
630
+ - @pluv/types@0.36.0
615
631
 
616
632
  ## 0.35.4
617
633
 
@@ -634,9 +650,9 @@
634
650
  ### Patch Changes
635
651
 
636
652
  - Updated dependencies [81cb692]
637
- - @pluv/types@0.35.2
638
- - @pluv/client@0.35.2
639
- - @pluv/crdt@0.35.2
653
+ - @pluv/types@0.35.2
654
+ - @pluv/client@0.35.2
655
+ - @pluv/crdt@0.35.2
640
656
 
641
657
  ## 0.35.1
642
658
 
@@ -687,9 +703,9 @@
687
703
  ### Patch Changes
688
704
 
689
705
  - 89d004d: Fix event proxy types for client-side events.
690
- - @pluv/client@0.32.9
691
- - @pluv/crdt@0.32.9
692
- - @pluv/types@0.32.9
706
+ - @pluv/client@0.32.9
707
+ - @pluv/crdt@0.32.9
708
+ - @pluv/types@0.32.9
693
709
 
694
710
  ## 0.32.8
695
711
 
@@ -737,9 +753,9 @@
737
753
 
738
754
  - 75e992f: Export `register` helper in `@pluv/react`.
739
755
  - Updated dependencies [b18230f]
740
- - @pluv/client@0.32.3
741
- - @pluv/crdt@0.32.3
742
- - @pluv/types@0.32.3
756
+ - @pluv/client@0.32.3
757
+ - @pluv/crdt@0.32.3
758
+ - @pluv/types@0.32.3
743
759
 
744
760
  ## 0.32.2
745
761
 
@@ -794,9 +810,9 @@
794
810
  ### Patch Changes
795
811
 
796
812
  - Updated dependencies [cff933a]
797
- - @pluv/client@0.30.0
798
- - @pluv/crdt@0.30.0
799
- - @pluv/types@0.30.0
813
+ - @pluv/client@0.30.0
814
+ - @pluv/crdt@0.30.0
815
+ - @pluv/types@0.30.0
800
816
 
801
817
  ## 0.29.0
802
818
 
@@ -804,75 +820,75 @@
804
820
 
805
821
  - 525aeae: **BREAKING**
806
822
 
807
- Merge `createBundle` with `createRoomBundle`.
808
-
809
- ```ts
810
- // Before
811
- const {
812
- createRoomBundle,
813
-
814
- // components
815
- PluvProvider,
816
-
817
- // hooks
818
- useClient,
819
- } = createBundle(client);
820
-
821
- export const {
822
- // components
823
- MockedRoomProvider,
824
- PluvRoomProvider,
825
-
826
- // utils
827
- event,
828
-
829
- // hooks
830
- useBroadcast,
831
- useCanRedo,
832
- useCanUndo,
833
- useConnection,
834
- useDoc,
835
- useEvent,
836
- useMyPresence,
837
- useMyself,
838
- useOther,
839
- useOthers,
840
- useRedo,
841
- useRoom,
842
- useStorage,
843
- useTransact,
844
- useUndo,
845
- } = createRoomBundle({});
846
-
847
- // After
848
- const {
849
- // components
850
- MockedRoomProvider,
851
- PluvProvider,
852
- PluvRoomProvider,
853
-
854
- // utils
855
- event,
856
-
857
- // hooks
858
- useBroadcast,
859
- useCanRedo,
860
- useCanUndo,
861
- useClient,
862
- useConnection,
863
- useDoc,
864
- useEvent,
865
- useMyPresence,
866
- useMyself,
867
- useOther,
868
- useOthers,
869
- useRedo,
870
- useRoom,
871
- useStorage,
872
- useTransact,
873
- useUndo,
874
- } = createBundle(client);
875
- ```
823
+ Merge `createBundle` with `createRoomBundle`.
824
+
825
+ ```ts
826
+ // Before
827
+ const {
828
+ createRoomBundle,
829
+
830
+ // components
831
+ PluvProvider,
832
+
833
+ // hooks
834
+ useClient,
835
+ } = createBundle(client);
836
+
837
+ export const {
838
+ // components
839
+ MockedRoomProvider,
840
+ PluvRoomProvider,
841
+
842
+ // utils
843
+ event,
844
+
845
+ // hooks
846
+ useBroadcast,
847
+ useCanRedo,
848
+ useCanUndo,
849
+ useConnection,
850
+ useDoc,
851
+ useEvent,
852
+ useMyPresence,
853
+ useMyself,
854
+ useOther,
855
+ useOthers,
856
+ useRedo,
857
+ useRoom,
858
+ useStorage,
859
+ useTransact,
860
+ useUndo,
861
+ } = createRoomBundle({});
862
+
863
+ // After
864
+ const {
865
+ // components
866
+ MockedRoomProvider,
867
+ PluvProvider,
868
+ PluvRoomProvider,
869
+
870
+ // utils
871
+ event,
872
+
873
+ // hooks
874
+ useBroadcast,
875
+ useCanRedo,
876
+ useCanUndo,
877
+ useClient,
878
+ useConnection,
879
+ useDoc,
880
+ useEvent,
881
+ useMyPresence,
882
+ useMyself,
883
+ useOther,
884
+ useOthers,
885
+ useRedo,
886
+ useRoom,
887
+ useStorage,
888
+ useTransact,
889
+ useUndo,
890
+ } = createBundle(client);
891
+ ```
876
892
 
877
893
  ### Patch Changes
878
894
 
@@ -898,119 +914,119 @@
898
914
 
899
915
  - 19ed36c: Updated `createClient` and `createRoomBundle` object params to better support automatic type inference.
900
916
 
901
- ```ts
902
- // Before
903
- import { createClient } from "@pluv/react";
904
- import { yjs } from "@pluv/crdt-yjs";
905
- import { z } from "zod";
906
- import type { ioServer } from "./server/ioServer";
907
-
908
- const client = createClient<typeof ioServer>({
909
- authEndpoint: ({ room }) => "MY_AUTH_URL",
910
- wsEndpoint: ({ room }) => "MY_WEBSOCKET_URL",
911
- });
912
-
913
- client.createRoom("my-example-room", {
914
- presence: z.object({
915
- selectionId: z.string().nullish(),
916
- }),
917
- initialPresence: {
918
- selectionId: null,
919
- },
920
- initialStorage: yjs.doc(() => ({
921
- messages: yjs.array<string>([]),
922
- })),
923
- });
924
-
925
- // After
926
-
927
- import { createBundle, createClient } from "@pluv/react";
928
-
929
- const client = createClient({
930
- authEndpoint: ({ room }) => "MY_AUTH_URL",
931
- wsEndpoint: ({ room }) => "MY_WEBSOCKET_URL",
932
- /**
933
- * @description The ioServer type now needs to be inferred on this property
934
- * instead of within the generic on `createClient`. This is because of
935
- * limitations with TypeScript not yet supporting partial type-inference
936
- * for generics. Ensure to no-loonger include any generics on `createClient`
937
- */
938
- infer: (i) => ({ io: i<typeof ioServer> }),
939
- // Now moved to `createClient` from `PluvClient.createRoom`
940
- presence: z.object({
941
- selectionId: z.string().nullish(),
942
- }),
943
- /**
944
- * @description Now added to `createClient` to specify defaults for all
945
- * rooms, and to infer types for storage. This value will be overwritten by
946
- * `PluvClient.createRoom`.
947
- */
948
- initialStorage: yjs.doc(() => ({
949
- messages: yjs.array<string>([]),
950
- })),
951
- });
917
+ ```ts
918
+ // Before
919
+ import { createClient } from "@pluv/react";
920
+ import { yjs } from "@pluv/crdt-yjs";
921
+ import { z } from "zod";
922
+ import type { ioServer } from "./server/ioServer";
923
+
924
+ const client = createClient<typeof ioServer>({
925
+ authEndpoint: ({ room }) => "MY_AUTH_URL",
926
+ wsEndpoint: ({ room }) => "MY_WEBSOCKET_URL",
927
+ });
928
+
929
+ client.createRoom("my-example-room", {
930
+ presence: z.object({
931
+ selectionId: z.string().nullish(),
932
+ }),
933
+ initialPresence: {
934
+ selectionId: null,
935
+ },
936
+ initialStorage: yjs.doc(() => ({
937
+ messages: yjs.array<string>([]),
938
+ })),
939
+ });
940
+
941
+ // After
942
+
943
+ import { createBundle, createClient } from "@pluv/react";
944
+
945
+ const client = createClient({
946
+ authEndpoint: ({ room }) => "MY_AUTH_URL",
947
+ wsEndpoint: ({ room }) => "MY_WEBSOCKET_URL",
948
+ /**
949
+ * @description The ioServer type now needs to be inferred on this property
950
+ * instead of within the generic on `createClient`. This is because of
951
+ * limitations with TypeScript not yet supporting partial type-inference
952
+ * for generics. Ensure to no-loonger include any generics on `createClient`
953
+ */
954
+ infer: (i) => ({ io: i<typeof ioServer> }),
955
+ // Now moved to `createClient` from `PluvClient.createRoom`
956
+ presence: z.object({
957
+ selectionId: z.string().nullish(),
958
+ }),
959
+ /**
960
+ * @description Now added to `createClient` to specify defaults for all
961
+ * rooms, and to infer types for storage. This value will be overwritten by
962
+ * `PluvClient.createRoom`.
963
+ */
964
+ initialStorage: yjs.doc(() => ({
965
+ messages: yjs.array<string>([]),
966
+ })),
967
+ });
952
968
 
953
- const { createRoomBundle } = createBundle(client);
954
- const pluv = createRoomBundle({});
955
- ```
969
+ const { createRoomBundle } = createBundle(client);
970
+ const pluv = createRoomBundle({});
971
+ ```
956
972
 
957
973
  ### Patch Changes
958
974
 
959
975
  - 19ed36c: Added client-side event router. This more-or-less mirrors the server-side event router. You can use both the server-side and client-side router simultaneously, but you should generally prefer only using one or the other.
960
976
 
961
- ```ts
962
- // Backend Server
963
- import { createIO } from "@pluv/io";
964
-
965
- const io = createIO({ /* ... */ });
966
- const ioServer = io.server({
967
- router: io.router({
968
- multiply2: io.procedure
969
- .input(z.object({ value: z.number() }))
970
- .broadcast(({ value }) => ({
971
- multiplied2: { value: value * 2 },
972
- })),
973
- }),
974
- });
975
-
976
- // Frontend Client
977
- import { createBundle createClient } from "@pluv/react";
978
-
979
- const io = createClient({ /* ... */ });
980
-
981
- const { createRoomBundle } = createBundle(io);
982
- const pluv = createRoomBundle({
983
- // ...
984
- router: io.router({
985
- add5: io.procedure
986
- .input(z.object({ value: z.number() }))
987
- .broadcast(({ value }) => ({
988
- /**
989
- * @description Because `ioServer` does not specify `added5`,
990
- * this will be forwarded to connected peers.
991
- */
992
- added5: { value: value + 5 },
993
- })),
994
- /**
995
- * @description This is possible, but not recommended to do. Because
996
- * `multiply2` is a procedure on `ioServer`, this will trigger the
997
- * `multiply2` procedure on `ioServer`. Connected peers will not
998
- * receive `multiply2`, but rather `multipled2`.
999
- */
1000
- subtract5Multiply2: io.procedure
1001
- .input(z.object({ value: z.number() }))
1002
- .broadcast(({ value }) => ({
1003
- multiply2: { value: value - 5 },
1004
- })),
1005
- }),
1006
- });
1007
- ```
977
+ ```ts
978
+ // Backend Server
979
+ import { createIO } from "@pluv/io";
980
+
981
+ const io = createIO({ /* ... */ });
982
+ const ioServer = io.server({
983
+ router: io.router({
984
+ multiply2: io.procedure
985
+ .input(z.object({ value: z.number() }))
986
+ .broadcast(({ value }) => ({
987
+ multiplied2: { value: value * 2 },
988
+ })),
989
+ }),
990
+ });
991
+
992
+ // Frontend Client
993
+ import { createBundle createClient } from "@pluv/react";
994
+
995
+ const io = createClient({ /* ... */ });
996
+
997
+ const { createRoomBundle } = createBundle(io);
998
+ const pluv = createRoomBundle({
999
+ // ...
1000
+ router: io.router({
1001
+ add5: io.procedure
1002
+ .input(z.object({ value: z.number() }))
1003
+ .broadcast(({ value }) => ({
1004
+ /**
1005
+ * @description Because `ioServer` does not specify `added5`,
1006
+ * this will be forwarded to connected peers.
1007
+ */
1008
+ added5: { value: value + 5 },
1009
+ })),
1010
+ /**
1011
+ * @description This is possible, but not recommended to do. Because
1012
+ * `multiply2` is a procedure on `ioServer`, this will trigger the
1013
+ * `multiply2` procedure on `ioServer`. Connected peers will not
1014
+ * receive `multiply2`, but rather `multipled2`.
1015
+ */
1016
+ subtract5Multiply2: io.procedure
1017
+ .input(z.object({ value: z.number() }))
1018
+ .broadcast(({ value }) => ({
1019
+ multiply2: { value: value - 5 },
1020
+ })),
1021
+ }),
1022
+ });
1023
+ ```
1008
1024
 
1009
1025
  - Updated dependencies [19ed36c]
1010
1026
  - Updated dependencies [19ed36c]
1011
- - @pluv/client@0.27.0
1012
- - @pluv/crdt@0.27.0
1013
- - @pluv/types@0.27.0
1027
+ - @pluv/client@0.27.0
1028
+ - @pluv/crdt@0.27.0
1029
+ - @pluv/types@0.27.0
1014
1030
 
1015
1031
  ## 0.26.0
1016
1032
 
@@ -1019,54 +1035,54 @@
1019
1035
  - 19e5dda: **BREAKING**
1020
1036
  Update `authEndpoint` and `wsEndpoint` to now use a parameterized object that passes through additional data via a `metadata` property.
1021
1037
 
1022
- ```tsx
1023
- // Before
1024
-
1025
- import { env } from "./env";
1026
- import type { ioServer } from "./server";
1027
-
1028
- const client = createClient<typeof ioServer>({
1029
- authEndpoint: (room: string) => `${env.API_URL}}/room/${room}`,
1030
- wsEndpoint: (room: string) => `${env.WS_URL}/room/${room}`,
1031
- });
1032
-
1033
- // After
1034
-
1035
- const client = createClient<
1036
- typeof ioServer,
1037
- // Optional: You can specify types for metadata here. This is useful for Cloudflare Pages
1038
- { apiUrl: string; wsUrl: string }
1039
- >({
1040
- authEndpoint: ({ metadata, room }) => `${metadata.apiUrl}}/room/${room}`,
1041
- wsEndpoint: ({ metadata, room }) => `${{ metadata.wsUrl }}/room/${room}`,
1042
- });
1043
-
1044
- client.createRoom("my-room", {
1045
- // This property exists when the `metadata` generic type is defined above
1046
- metadata: {
1047
- apiUrl: "https://example.com/api",
1048
- wsUrl: "wss://example.com/api",
1049
- },
1050
- // ...
1051
- });
1052
-
1053
- <PluvRoomProvider
1054
- // This property exists when the `metadata` generic type is defined above
1055
- metadata={{
1056
- apiUrl: "https://example.com/api",
1057
- wsUrl: "wss://example.com/api",
1058
- }}
1059
- >
1060
- {/* ... */}
1061
- </PluvRoomProvider>
1062
- ```
1038
+ ```tsx
1039
+ // Before
1040
+
1041
+ import { env } from "./env";
1042
+ import type { ioServer } from "./server";
1043
+
1044
+ const client = createClient<typeof ioServer>({
1045
+ authEndpoint: (room: string) => `${env.API_URL}}/room/${room}`,
1046
+ wsEndpoint: (room: string) => `${env.WS_URL}/room/${room}`,
1047
+ });
1048
+
1049
+ // After
1050
+
1051
+ const client = createClient<
1052
+ typeof ioServer,
1053
+ // Optional: You can specify types for metadata here. This is useful for Cloudflare Pages
1054
+ { apiUrl: string; wsUrl: string }
1055
+ >({
1056
+ authEndpoint: ({ metadata, room }) => `${metadata.apiUrl}}/room/${room}`,
1057
+ wsEndpoint: ({ metadata, room }) => `${{ metadata.wsUrl }}/room/${room}`,
1058
+ });
1059
+
1060
+ client.createRoom("my-room", {
1061
+ // This property exists when the `metadata` generic type is defined above
1062
+ metadata: {
1063
+ apiUrl: "https://example.com/api",
1064
+ wsUrl: "wss://example.com/api",
1065
+ },
1066
+ // ...
1067
+ });
1068
+
1069
+ <PluvRoomProvider
1070
+ // This property exists when the `metadata` generic type is defined above
1071
+ metadata={{
1072
+ apiUrl: "https://example.com/api",
1073
+ wsUrl: "wss://example.com/api",
1074
+ }}
1075
+ >
1076
+ {/* ... */}
1077
+ </PluvRoomProvider>
1078
+ ```
1063
1079
 
1064
1080
  ### Patch Changes
1065
1081
 
1066
1082
  - Updated dependencies [19e5dda]
1067
- - @pluv/client@0.26.0
1068
- - @pluv/crdt@0.26.0
1069
- - @pluv/types@0.26.0
1083
+ - @pluv/client@0.26.0
1084
+ - @pluv/crdt@0.26.0
1085
+ - @pluv/types@0.26.0
1070
1086
 
1071
1087
  ## 0.25.4
1072
1088
 
@@ -1113,9 +1129,9 @@
1113
1129
  ### Patch Changes
1114
1130
 
1115
1131
  - Updated dependencies [ba299e2]
1116
- - @pluv/client@0.24.1
1117
- - @pluv/crdt@0.24.1
1118
- - @pluv/types@0.24.1
1132
+ - @pluv/client@0.24.1
1133
+ - @pluv/crdt@0.24.1
1134
+ - @pluv/types@0.24.1
1119
1135
 
1120
1136
  ## 0.24.0
1121
1137
 
@@ -1154,9 +1170,9 @@
1154
1170
  ### Patch Changes
1155
1171
 
1156
1172
  - Updated dependencies [b98ab6b]
1157
- - @pluv/client@0.21.0
1158
- - @pluv/crdt@0.21.0
1159
- - @pluv/types@0.21.0
1173
+ - @pluv/client@0.21.0
1174
+ - @pluv/crdt@0.21.0
1175
+ - @pluv/types@0.21.0
1160
1176
 
1161
1177
  ## 0.20.0
1162
1178
 
@@ -1164,77 +1180,77 @@
1164
1180
 
1165
1181
  - 9492085: **BREAKING**: `@pluv/crdt-yjs` and `@pluv/crdt-loro` have been updated so that the utilities to create shared-types/containers no-longer return a wrapper around the underlying shared-types and containers, but rather return the shared-types/containers directly.
1166
1182
 
1167
- This means that for methods such as `getStorage` from `@pluv/client` and `useStorage` from `@pluv/react`, the shared-types/containers are also returned instead of the wrapper types.
1183
+ This means that for methods such as `getStorage` from `@pluv/client` and `useStorage` from `@pluv/react`, the shared-types/containers are also returned instead of the wrapper types.
1168
1184
 
1169
- The motivation for these changes are so that pluv.io is supplementary to `yjs` and `loro-crdt`, instead of having these libraries be an internal implementation of pluv.io.
1185
+ The motivation for these changes are so that pluv.io is supplementary to `yjs` and `loro-crdt`, instead of having these libraries be an internal implementation of pluv.io.
1170
1186
 
1171
- ```ts
1172
- // Before
1187
+ ```ts
1188
+ // Before
1173
1189
 
1174
- import { yjs } from "@pluv/crdt-yjs";
1190
+ import { yjs } from "@pluv/crdt-yjs";
1175
1191
 
1176
- yjs.array([]); // Returns CrdtYjsArray
1177
- yjs.object([]); // Returns CrdtYjsObject
1192
+ yjs.array([]); // Returns CrdtYjsArray
1193
+ yjs.object([]); // Returns CrdtYjsObject
1178
1194
 
1179
- const room: PluvRoom = /* ... */;
1195
+ const room: PluvRoom = /* ... */;
1180
1196
 
1181
- room.getStorage("messages"); // Returns AbstractCrdtType
1197
+ room.getStorage("messages"); // Returns AbstractCrdtType
1182
1198
 
1183
- const [, sharedType] = useStorage("messages"); // sharedType is an AbstractCrdtType
1184
- ```
1199
+ const [, sharedType] = useStorage("messages"); // sharedType is an AbstractCrdtType
1200
+ ```
1185
1201
 
1186
- ```ts
1187
- // Now
1202
+ ```ts
1203
+ // Now
1188
1204
 
1189
- import { yjs } from "@pluv/crdt-yjs";
1205
+ import { yjs } from "@pluv/crdt-yjs";
1190
1206
 
1191
- yjs.array([]); // Returns yjs.Array
1192
- yjs.object([]); // Returns yjs.Map
1207
+ yjs.array([]); // Returns yjs.Array
1208
+ yjs.object([]); // Returns yjs.Map
1193
1209
 
1194
- const room: PluvRoom = /* ... */;
1210
+ const room: PluvRoom = /* ... */;
1195
1211
 
1196
- room.getStorage("messages"); // Returns yjs.AbstractType
1212
+ room.getStorage("messages"); // Returns yjs.AbstractType
1197
1213
 
1198
- const [, sharedType] = useStorage("messages"); // sharedType is a yjs.AbstractType
1199
- ```
1214
+ const [, sharedType] = useStorage("messages"); // sharedType is a yjs.AbstractType
1215
+ ```
1200
1216
 
1201
- For `@pluv/crdt-loro` specifically, `@pluv/client` relies on [loro events and subscriptions](https://www.loro.dev/docs/tutorial/get_started#event) to detect changes. The `AbstractLoroCrdt` types previously called `Loro.commit` after each change as an abstraction, but now this no-longer happens. To ensure that changes to loro containers are properly handled in `@pluv/react`, make sure to commit your changes whenever possible:
1217
+ For `@pluv/crdt-loro` specifically, `@pluv/client` relies on [loro events and subscriptions](https://www.loro.dev/docs/tutorial/get_started#event) to detect changes. The `AbstractLoroCrdt` types previously called `Loro.commit` after each change as an abstraction, but now this no-longer happens. To ensure that changes to loro containers are properly handled in `@pluv/react`, make sure to commit your changes whenever possible:
1202
1218
 
1203
- ```ts
1204
- // Before
1219
+ ```ts
1220
+ // Before
1205
1221
 
1206
- const [data, container] = useStorage("messages");
1222
+ const [data, container] = useStorage("messages");
1223
+
1224
+ // This automatically called Loro.commit under the hood and rerendered the page with updated data.
1225
+ container.push(loro.object({ name: "John Doe", age: 35 }));
1226
+ ```
1207
1227
 
1208
- // This automatically called Loro.commit under the hood and rerendered the page with updated data.
1209
- container.push(loro.object({ name: "John Doe", age: 35 }));
1210
- ```
1228
+ ```ts
1229
+ // Now
1211
1230
 
1212
- ```ts
1213
- // Now
1231
+ const [data, container] = useStorage("messages");
1214
1232
 
1215
- const [data, container] = useStorage("messages");
1233
+ const doc = useDoc();
1234
+ const transact = useTransact();
1216
1235
 
1217
- const doc = useDoc();
1218
- const transact = useTransact();
1236
+ // Updates need to be committed back to the doc whenever the changes need to be emitted to other users
1237
+ // The returned data also will not update until the changes are commited
1219
1238
 
1220
- // Updates need to be committed back to the doc whenever the changes need to be emitted to other users
1221
- // The returned data also will not update until the changes are commited
1239
+ // The two operations below are functionally equivalent
1240
+ transact(() => {
1241
+ container.push(loro.object({ name: "John Doe", age: 35 }));
1242
+ });
1222
1243
 
1223
- // The two operations below are functionally equivalent
1224
- transact(() => {
1225
1244
  container.push(loro.object({ name: "John Doe", age: 35 }));
1226
- });
1227
-
1228
- container.push(loro.object({ name: "John Doe", age: 35 }));
1229
- doc.value.commit();
1230
- ```
1245
+ doc.value.commit();
1246
+ ```
1231
1247
 
1232
1248
  ### Patch Changes
1233
1249
 
1234
1250
  - Updated dependencies [9492085]
1235
- - @pluv/client@0.20.0
1236
- - @pluv/crdt@0.20.0
1237
- - @pluv/types@0.20.0
1251
+ - @pluv/client@0.20.0
1252
+ - @pluv/crdt@0.20.0
1253
+ - @pluv/types@0.20.0
1238
1254
 
1239
1255
  ## 0.19.0
1240
1256
 
@@ -1248,9 +1264,9 @@
1248
1264
  - 607afe3: Update the `updateMyPresence` function from `useMyPresence` to simply forward the function from the `PluvRoom`. This means all `updateMyPresence` functions should be the same underlying reference across all `useMyPresence` hooks.
1249
1265
  - Updated dependencies [137444b]
1250
1266
  - Updated dependencies [f5e4370]
1251
- - @pluv/client@0.19.0
1252
- - @pluv/crdt@0.19.0
1253
- - @pluv/types@0.19.0
1267
+ - @pluv/client@0.19.0
1268
+ - @pluv/crdt@0.19.0
1269
+ - @pluv/types@0.19.0
1254
1270
 
1255
1271
  ## 0.18.0
1256
1272
 
@@ -1258,156 +1274,156 @@
1258
1274
 
1259
1275
  - 99b5ca9: ## Breaking Changes
1260
1276
 
1261
- - `@pluv/io` has been updated to introduce `PluvProcedure`, `PluvRouter` and `PluvServer`. This change is intended to improve the ergonomics of declaring events and simplifying inferences of event types.
1277
+ - `@pluv/io` has been updated to introduce `PluvProcedure`, `PluvRouter` and `PluvServer`. This change is intended to improve the ergonomics of declaring events and simplifying inferences of event types.
1262
1278
 
1263
- ### Before:
1279
+ ### Before:
1264
1280
 
1265
- ```ts
1266
- // backend/io.ts
1281
+ ```ts
1282
+ // backend/io.ts
1267
1283
 
1268
- import { createIO } from "@pluv/io";
1269
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
1270
- import { z } from "zod";
1284
+ import { createIO } from "@pluv/io";
1285
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
1286
+ import { z } from "zod";
1271
1287
 
1272
- export const io = createIO({
1273
- platform: platformNode(),
1274
- })
1275
- .event("SEND_MESSAGE", {
1276
- input: z.object({ message: z.string() }),
1277
- resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
1288
+ export const io = createIO({
1289
+ platform: platformNode(),
1278
1290
  })
1279
- .event("DOUBLE_VALUE", {
1280
- input: z.object({ value: z.number() }),
1281
- resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
1291
+ .event("SEND_MESSAGE", {
1292
+ input: z.object({ message: z.string() }),
1293
+ resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
1294
+ })
1295
+ .event("DOUBLE_VALUE", {
1296
+ input: z.object({ value: z.number() }),
1297
+ resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
1298
+ });
1299
+
1300
+ const Pluv = createPluvHandler({
1301
+ io,
1302
+ /* ... */
1303
+ });
1304
+ ```
1305
+
1306
+ ```ts
1307
+ // frontend/pluv.ts
1308
+
1309
+ import { createClient } from "@pluv/react";
1310
+ import type { io } from "../backend/io";
1311
+
1312
+ const client = createClient<typeof io>({
1313
+ /* ... */
1314
+ });
1315
+ ```
1316
+
1317
+ ### Now:
1318
+
1319
+ ```ts
1320
+ import { createIO } from "@pluv/io";
1321
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
1322
+ import { z } from "zod";
1323
+
1324
+ const io = createIO({
1325
+ platform: platformNode(),
1326
+ });
1327
+
1328
+ const router = io.router({
1329
+ SEND_MESSAGE: io.procedure
1330
+ .input(z.object({ message: z.string() }))
1331
+ .broadcast(({ message }) => ({
1332
+ RECEIVE_MESSAGE: { message },
1333
+ })),
1334
+ DOUBLE_VALUE: io.procedure
1335
+ .input(z.object({ value: z.number() }))
1336
+ .broadcast(({ value }) => ({
1337
+ VALUE_DOUBLED: { value: value * 2 },
1338
+ })),
1339
+ });
1340
+
1341
+ export const ioServer = io.server({ router });
1342
+
1343
+ const Pluv = createPluvHandler({
1344
+ io: ioServer, // <- This uses the PluvServer now
1345
+ /* ... */
1346
+ });
1347
+ ```
1348
+
1349
+ ```ts
1350
+ // frontend/pluv.ts
1351
+
1352
+ import { createClient } from "@pluv/react";
1353
+ import type { ioServer } from "../backend/io";
1354
+
1355
+ // This users the PluvServer type now
1356
+ const client = createClient<typeof ioServer>({
1357
+ /* ... */
1282
1358
  });
1359
+ ```
1283
1360
 
1284
- const Pluv = createPluvHandler({
1285
- io,
1286
- /* ... */
1287
- });
1288
- ```
1289
-
1290
- ```ts
1291
- // frontend/pluv.ts
1292
-
1293
- import { createClient } from "@pluv/react";
1294
- import type { io } from "../backend/io";
1295
-
1296
- const client = createClient<typeof io>({
1297
- /* ... */
1298
- });
1299
- ```
1300
-
1301
- ### Now:
1302
-
1303
- ```ts
1304
- import { createIO } from "@pluv/io";
1305
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
1306
- import { z } from "zod";
1307
-
1308
- const io = createIO({
1309
- platform: platformNode(),
1310
- });
1311
-
1312
- const router = io.router({
1313
- SEND_MESSAGE: io.procedure
1314
- .input(z.object({ message: z.string() }))
1315
- .broadcast(({ message }) => ({
1316
- RECEIVE_MESSAGE: { message },
1317
- })),
1318
- DOUBLE_VALUE: io.procedure
1319
- .input(z.object({ value: z.number() }))
1320
- .broadcast(({ value }) => ({
1321
- VALUE_DOUBLED: { value: value * 2 },
1322
- })),
1323
- });
1324
-
1325
- export const ioServer = io.server({ router });
1326
-
1327
- const Pluv = createPluvHandler({
1328
- io: ioServer, // <- This uses the PluvServer now
1329
- /* ... */
1330
- });
1331
- ```
1332
-
1333
- ```ts
1334
- // frontend/pluv.ts
1335
-
1336
- import { createClient } from "@pluv/react";
1337
- import type { ioServer } from "../backend/io";
1338
-
1339
- // This users the PluvServer type now
1340
- const client = createClient<typeof ioServer>({
1341
- /* ... */
1342
- });
1343
- ```
1344
-
1345
- - `PluvRouter` instances can also be merged via the `mergeRouters` method, which effectively performs an `Object.assign` of the events object and returns a new `PluvRouter` with the correct types:
1346
-
1347
- ```ts
1348
- const router = io.mergeRouters(router1, router2);
1349
- ```
1361
+ - `PluvRouter` instances can also be merged via the `mergeRouters` method, which effectively performs an `Object.assign` of the events object and returns a new `PluvRouter` with the correct types:
1362
+
1363
+ ```ts
1364
+ const router = io.mergeRouters(router1, router2);
1365
+ ```
1350
1366
 
1351
1367
  - 07a7725: Added broadcast proxy as a new way to broadcast events to other users.
1352
1368
 
1353
- ```tsx
1354
- // backend
1369
+ ```tsx
1370
+ // backend
1355
1371
 
1356
- const router = io.router({
1357
- SEND_MESSAGE: io.procedure
1358
- .input(z.object({ message: z.string() }))
1359
- .broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
1360
- });
1372
+ const router = io.router({
1373
+ SEND_MESSAGE: io.procedure
1374
+ .input(z.object({ message: z.string() }))
1375
+ .broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
1376
+ });
1361
1377
 
1362
- // frontend
1363
- const pluv = createRoomBundle(/* ... */);
1378
+ // frontend
1379
+ const pluv = createRoomBundle(/* ... */);
1364
1380
 
1365
- const broadcast = pluv.useBroadcast();
1381
+ const broadcast = pluv.useBroadcast();
1366
1382
 
1367
- // Both of the examples below are equivalent.
1383
+ // Both of the examples below are equivalent.
1368
1384
 
1369
- broadcast("SEND_MESSAGE", { message: "Hello world~!" });
1385
+ broadcast("SEND_MESSAGE", { message: "Hello world~!" });
1370
1386
 
1371
- broadcast.SEND_MESSAGE({ message: "Hello world~!" });
1372
- ```
1387
+ broadcast.SEND_MESSAGE({ message: "Hello world~!" });
1388
+ ```
1373
1389
 
1374
1390
  ### Patch Changes
1375
1391
 
1376
1392
  - e587c18: Added event proxy as a new way to listen to events.
1377
1393
 
1378
- ```tsx
1379
- // backend
1394
+ ```tsx
1395
+ // backend
1380
1396
 
1381
- const router = io.router({
1382
- SEND_MESSAGE: io.procedure
1383
- .input(z.object({ message: z.string() }))
1384
- .broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
1385
- });
1397
+ const router = io.router({
1398
+ SEND_MESSAGE: io.procedure
1399
+ .input(z.object({ message: z.string() }))
1400
+ .broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
1401
+ });
1386
1402
 
1387
- // frontend
1388
- const pluv = createRoomBundle(/* ... */);
1403
+ // frontend
1404
+ const pluv = createRoomBundle(/* ... */);
1389
1405
 
1390
- // Both of the examples below are equivalent.
1406
+ // Both of the examples below are equivalent.
1391
1407
 
1392
- pluv.useEvent("RECEIVE_MESSAGE", ({ data }) => {
1393
- const { message } = data;
1408
+ pluv.useEvent("RECEIVE_MESSAGE", ({ data }) => {
1409
+ const { message } = data;
1394
1410
 
1395
- console.log(message);
1396
- });
1411
+ console.log(message);
1412
+ });
1397
1413
 
1398
- pluv.event.RECEIVE_MESSAGE.useEvent(({ data }) => {
1399
- const { message } = data;
1414
+ pluv.event.RECEIVE_MESSAGE.useEvent(({ data }) => {
1415
+ const { message } = data;
1400
1416
 
1401
- console.log(message);
1402
- });
1403
- ```
1417
+ console.log(message);
1418
+ });
1419
+ ```
1404
1420
 
1405
1421
  - Updated dependencies [06c67be]
1406
1422
  - Updated dependencies [99b5ca9]
1407
1423
  - Updated dependencies [df1342c]
1408
- - @pluv/client@0.18.0
1409
- - @pluv/types@0.18.0
1410
- - @pluv/crdt@0.18.0
1424
+ - @pluv/client@0.18.0
1425
+ - @pluv/types@0.18.0
1426
+ - @pluv/crdt@0.18.0
1411
1427
 
1412
1428
  ## 0.17.3
1413
1429
 
@@ -1438,9 +1454,9 @@
1438
1454
  ### Patch Changes
1439
1455
 
1440
1456
  - Updated dependencies [507bc00]
1441
- - @pluv/types@0.17.0
1442
- - @pluv/client@0.17.0
1443
- - @pluv/crdt@0.17.0
1457
+ - @pluv/types@0.17.0
1458
+ - @pluv/client@0.17.0
1459
+ - @pluv/crdt@0.17.0
1444
1460
 
1445
1461
  ## 0.16.3
1446
1462
 
@@ -1472,165 +1488,163 @@
1472
1488
 
1473
1489
  - 995aa9c: Renamed all hooks from `@pluv/react` to be simply prefixed with `use` instead of `usePluv` (e.g. `usePluvStorage` is now just `useStorage`).
1474
1490
 
1475
- Hooks can be aliased to retain the same names if preferred:
1476
-
1477
- ```ts
1478
- export const {
1479
- // ...
1480
- useStorage: usePluvStorage,
1481
- useTransact: usePluvTransact,
1482
- // ...
1483
- } = createRoomBundle(/* */);
1484
- ```
1485
-
1486
- - 4280220: ## Breaking Changes
1487
-
1488
- - Storage types are now kept on the root of the document.
1489
- - Previously, `@pluv/crdt-yjs` kept all shared-types on a hidden Yjs Map called `storage` on the root of the Yjs Doc. Now all shared-types are kept on the root of the Yjs Doc instead. This behavior should be more in-line with how shared-types are documented to be used from Yjs.
1490
- - `@pluv/client` and `@pluv/react` no-longer re-export `@pluv/crdt-yjs`. This package will now need to be installed separately.
1491
-
1492
- ```bash
1493
- # if installing @pluv/client
1494
- npm install @pluv/client @pluv/crdt-yjs
1495
- # if installing @pluv/react
1496
- npm install @pluv/react @pluv/crdt-yjs
1497
- ```
1498
-
1499
- ```ts
1500
- // Before:
1501
- import { createClient, y } from "@pluv/client";
1502
- // After:
1503
- import { createClient } from "@pluv/client";
1504
- import { yjs } from "@pluv/crdt-yjs"; // y renamed to yjs
1505
- ```
1506
-
1507
- - The `y` import has been renamed to `yjs`.
1508
- ```ts
1509
- // Before:
1510
- import { y } from "@pluv/crdt-yjs";
1511
- // After:
1512
- import { yjs } from "@pluv/crdt-yjs";
1513
- ```
1514
- - `@pluv/crdt-yjs` functions no-longer return Yjs shared-types directly, but instead return an `AbstractCrdtType` from `@pluv/crdt` (new package). This also affects methods that return storage shared types in both `@pluv/client` and `@pluv/react` from functions like `PluvRoom.getStorage` and `PluvRoom.useStorage`.
1515
-
1516
- ```ts
1517
- // Before:
1518
- import { y } from "@pluv/crdt-yjs";
1519
- import type { Array as YArray, Map as YMap } from "yjs";
1520
-
1521
- const array: YArray<YMap<{ message: string }>> = y.array([
1522
- y.object({ message: "Hello" }),
1523
- ]);
1524
-
1525
- array.push([y.object({ message: "World!" })]);
1526
-
1527
- // After:
1528
- import type { CrdtYjsArray, CrdtYjsObject } from "@pluv/crdt-yjs";
1529
- import { yjs } from "@pluv/crdt-yjs";
1530
- import type { Array as YArray } from "yjs";
1531
-
1532
- const array: CrdtYjsArray<CrdtYjsObject<{ message: string }>> = yjs.array([
1533
- yjs.object({ message: "Hello" }),
1534
- ]);
1535
-
1536
- array.push(yjs.object({ message: "World!" }));
1537
-
1538
- // use .value to get the underlying yjs type
1539
- const yarray: YArray<YMap<{ message: string }>> = array.value;
1540
- ```
1541
-
1542
- - `initialStorage` must now use the `doc` function from `@pluv/crdt-yjs` to be defined. This also affects `@pluv/react`.
1543
-
1544
- ```ts
1545
- // Before:
1546
- import { createClient, y } from "@pluv/client";
1547
-
1548
- const client = createClient({
1549
- /* ... */
1550
- });
1551
-
1552
- client.createRoom({
1553
- // ...
1554
- initialStorage: () => ({
1555
- messages: y.array([y.object({ message: "Hello world!" })]),
1556
- }),
1557
- });
1558
-
1559
- // After:
1560
- import { createClient } from "@pluv/client";
1561
- // This is now imported separately
1562
- import { yjs } from "@pluv/crdt-yjs";
1563
-
1564
- const client = createClient({
1565
- /* ... */
1566
- });
1567
-
1568
- client.createRoom({
1569
- // ...
1570
- initialStorage: yjs.doc(() => ({
1571
- messages: yjs.array([yjs.object({ message: "Hello world!" })]),
1572
- })),
1573
- });
1574
- ```
1575
-
1576
- - `@pluv/client` can now instead use [loro](https://github.com/loro-dev/loro) instead of [yjs](https://github.com/yjs/yjs).
1577
- ```bash
1578
- npm install @pluv/client @pluv/crdt-loro loro-crdt
1579
- ```
1580
- - If you are using storage features with pluv, `@pluv/io` must now specify which crdt library (i.e. `@pluv/crdt-yjs` or `@pluv/crdt-loro`) it is meant to use.
1491
+ Hooks can be aliased to retain the same names if preferred:
1581
1492
 
1582
1493
  ```ts
1583
- import { loro } from "@pluv/crdt-loro";
1584
- import { yjs } from "@pluv/crdt-yjs";
1585
- import { createIO } from "@pluv/io";
1586
-
1587
- const io = createIO({
1588
- // ...
1589
- // If using loro
1590
- crdt: loro,
1591
- // If using yjs
1592
- crdt: yjs,
1593
- });
1494
+ export const {
1495
+ // ...
1496
+ useStorage: usePluvStorage,
1497
+ useTransact: usePluvTransact,
1498
+ // ...
1499
+ } = createRoomBundle(/* */);
1594
1500
  ```
1595
1501
 
1596
- - `PluvRoom.getDoc()` from `@pluv/client` no-longer returns the Yjs Doc instance, but rather a `AbstractCrdtDoc` instance from `@pluv/crdt`. This also affects the hook from `@pluv/react`.
1502
+ - 4280220: ## Breaking Changes
1597
1503
 
1598
- ```ts
1599
- // Before:
1600
- import { Doc as YDoc } from "yjs";
1504
+ - Storage types are now kept on the root of the document.
1505
+ - Previously, `@pluv/crdt-yjs` kept all shared-types on a hidden Yjs Map called `storage` on the root of the Yjs Doc. Now all shared-types are kept on the root of the Yjs Doc instead. This behavior should be more in-line with how shared-types are documented to be used from Yjs.
1506
+ - `@pluv/client` and `@pluv/react` no-longer re-export `@pluv/crdt-yjs`. This package will now need to be installed separately.
1507
+
1508
+ ```bash
1509
+ # if installing @pluv/client
1510
+ npm install @pluv/client @pluv/crdt-yjs
1511
+ # if installing @pluv/react
1512
+ npm install @pluv/react @pluv/crdt-yjs
1513
+ ```
1514
+
1515
+ ```ts
1516
+ // Before:
1517
+ import { createClient, y } from "@pluv/client";
1518
+ // After:
1519
+ import { createClient } from "@pluv/client";
1520
+ import { yjs } from "@pluv/crdt-yjs"; // y renamed to yjs
1521
+ ```
1522
+
1523
+ - The `y` import has been renamed to `yjs`.
1524
+ ```ts
1525
+ // Before:
1526
+ import { y } from "@pluv/crdt-yjs";
1527
+ // After:
1528
+ import { yjs } from "@pluv/crdt-yjs";
1529
+ ```
1530
+ - `@pluv/crdt-yjs` functions no-longer return Yjs shared-types directly, but instead return an `AbstractCrdtType` from `@pluv/crdt` (new package). This also affects methods that return storage shared types in both `@pluv/client` and `@pluv/react` from functions like `PluvRoom.getStorage` and `PluvRoom.useStorage`.
1531
+
1532
+ ```ts
1533
+ // Before:
1534
+ import { y } from "@pluv/crdt-yjs";
1535
+ import type { Array as YArray, Map as YMap } from "yjs";
1536
+
1537
+ const array: YArray<YMap<{ message: string }>> = y.array([y.object({ message: "Hello" })]);
1538
+
1539
+ array.push([y.object({ message: "World!" })]);
1540
+
1541
+ // After:
1542
+ import type { CrdtYjsArray, CrdtYjsObject } from "@pluv/crdt-yjs";
1543
+ import { yjs } from "@pluv/crdt-yjs";
1544
+ import type { Array as YArray } from "yjs";
1545
+
1546
+ const array: CrdtYjsArray<CrdtYjsObject<{ message: string }>> = yjs.array([
1547
+ yjs.object({ message: "Hello" }),
1548
+ ]);
1549
+
1550
+ array.push(yjs.object({ message: "World!" }));
1551
+
1552
+ // use .value to get the underlying yjs type
1553
+ const yarray: YArray<YMap<{ message: string }>> = array.value;
1554
+ ```
1555
+
1556
+ - `initialStorage` must now use the `doc` function from `@pluv/crdt-yjs` to be defined. This also affects `@pluv/react`.
1557
+
1558
+ ```ts
1559
+ // Before:
1560
+ import { createClient, y } from "@pluv/client";
1561
+
1562
+ const client = createClient({
1563
+ /* ... */
1564
+ });
1565
+
1566
+ client.createRoom({
1567
+ // ...
1568
+ initialStorage: () => ({
1569
+ messages: y.array([y.object({ message: "Hello world!" })]),
1570
+ }),
1571
+ });
1572
+
1573
+ // After:
1574
+ import { createClient } from "@pluv/client";
1575
+ // This is now imported separately
1576
+ import { yjs } from "@pluv/crdt-yjs";
1577
+
1578
+ const client = createClient({
1579
+ /* ... */
1580
+ });
1581
+
1582
+ client.createRoom({
1583
+ // ...
1584
+ initialStorage: yjs.doc(() => ({
1585
+ messages: yjs.array([yjs.object({ message: "Hello world!" })]),
1586
+ })),
1587
+ });
1588
+ ```
1589
+
1590
+ - `@pluv/client` can now instead use [loro](https://github.com/loro-dev/loro) instead of [yjs](https://github.com/yjs/yjs).
1591
+ ```bash
1592
+ npm install @pluv/client @pluv/crdt-loro loro-crdt
1593
+ ```
1594
+ - If you are using storage features with pluv, `@pluv/io` must now specify which crdt library (i.e. `@pluv/crdt-yjs` or `@pluv/crdt-loro`) it is meant to use.
1595
+
1596
+ ```ts
1597
+ import { loro } from "@pluv/crdt-loro";
1598
+ import { yjs } from "@pluv/crdt-yjs";
1599
+ import { createIO } from "@pluv/io";
1600
+
1601
+ const io = createIO({
1602
+ // ...
1603
+ // If using loro
1604
+ crdt: loro,
1605
+ // If using yjs
1606
+ crdt: yjs,
1607
+ });
1608
+ ```
1609
+
1610
+ - `PluvRoom.getDoc()` from `@pluv/client` no-longer returns the Yjs Doc instance, but rather a `AbstractCrdtDoc` instance from `@pluv/crdt`. This also affects the hook from `@pluv/react`.
1611
+
1612
+ ```ts
1613
+ // Before:
1614
+ import { Doc as YDoc } from "yjs";
1615
+
1616
+ const room: PluvRoom = client.createRoom({
1617
+ /* ... */
1618
+ });
1601
1619
 
1602
- const room: PluvRoom = client.createRoom({
1603
- /* ... */
1604
- });
1620
+ const doc: YDoc = room.getDoc();
1605
1621
 
1606
- const doc: YDoc = room.getDoc();
1622
+ // After:
1623
+ import { CrdtYjsDoc } from "@pluv/crdt-yjs";
1624
+ import { Doc as YDoc } from "yjs";
1607
1625
 
1608
- // After:
1609
- import { CrdtYjsDoc } from "@pluv/crdt-yjs";
1610
- import { Doc as YDoc } from "yjs";
1626
+ const room: PluvRoom = client.createRoom({
1627
+ /* ... */
1628
+ });
1611
1629
 
1612
- const room: PluvRoom = client.createRoom({
1613
- /* ... */
1614
- });
1630
+ const doc: CrdtYjsDoc<any> = room.getDoc();
1631
+ const ydoc: YDoc = doc.value;
1632
+ ```
1615
1633
 
1616
- const doc: CrdtYjsDoc<any> = room.getDoc();
1617
- const ydoc: YDoc = doc.value;
1618
- ```
1634
+ - `@pluv/client` and `@pluv/react` now may return `null` when retrieving storage while storage is being initialized.
1619
1635
 
1620
- - `@pluv/client` and `@pluv/react` now may return `null` when retrieving storage while storage is being initialized.
1636
+ ```ts
1637
+ const sharedType = room.getStorage("messages"); // This may be null
1621
1638
 
1622
- ```ts
1623
- const sharedType = room.getStorage("messages"); // This may be null
1624
-
1625
- const [data, sharedType] = useStorage("messages"); // data and sharedType may both be null
1626
- ```
1639
+ const [data, sharedType] = useStorage("messages"); // data and sharedType may both be null
1640
+ ```
1627
1641
 
1628
1642
  ### Patch Changes
1629
1643
 
1630
1644
  - Updated dependencies [4280220]
1631
- - @pluv/client@0.16.0
1632
- - @pluv/crdt@0.16.0
1633
- - @pluv/types@0.16.0
1645
+ - @pluv/client@0.16.0
1646
+ - @pluv/crdt@0.16.0
1647
+ - @pluv/types@0.16.0
1634
1648
 
1635
1649
  ## 0.15.0
1636
1650
 
@@ -1659,17 +1673,17 @@
1659
1673
 
1660
1674
  - 4c4b47f: Added `useDoc` to access the root Yjs doc.
1661
1675
 
1662
- ```ts
1663
- import type { Doc } from "yjs";
1676
+ ```ts
1677
+ import type { Doc } from "yjs";
1664
1678
 
1665
- const doc: Doc = useDoc();
1666
- ```
1679
+ const doc: Doc = useDoc();
1680
+ ```
1667
1681
 
1668
1682
  ### Patch Changes
1669
1683
 
1670
1684
  - Updated dependencies [1126215]
1671
- - @pluv/client@0.13.0
1672
- - @pluv/types@0.13.0
1685
+ - @pluv/client@0.13.0
1686
+ - @pluv/types@0.13.0
1673
1687
 
1674
1688
  ## 0.12.3
1675
1689
 
@@ -1677,8 +1691,8 @@
1677
1691
 
1678
1692
  - da9f600: Upgraded dependencies
1679
1693
  - Updated dependencies [da9f600]
1680
- - @pluv/client@0.12.3
1681
- - @pluv/types@0.12.3
1694
+ - @pluv/client@0.12.3
1695
+ - @pluv/types@0.12.3
1682
1696
 
1683
1697
  ## 0.12.2
1684
1698
 
@@ -1692,8 +1706,8 @@
1692
1706
 
1693
1707
  - cae08aa: Updated storage from `getStorage` to never return null
1694
1708
  - Updated dependencies [cae08aa]
1695
- - @pluv/client@0.12.1
1696
- - @pluv/types@0.12.1
1709
+ - @pluv/client@0.12.1
1710
+ - @pluv/types@0.12.1
1697
1711
 
1698
1712
  ## 0.12.0
1699
1713
 
@@ -1701,239 +1715,238 @@
1701
1715
 
1702
1716
  - 436040b: Added ability to undo and redo changes to storage.
1703
1717
 
1704
- ## @pluv/crdt-yjs
1718
+ ## @pluv/crdt-yjs
1719
+
1720
+ `@pluv/crdt-yjs` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `trackOrigins`.
1721
+
1722
+ Refer to the code-example below to better understand how to undo and redo with your doc.
1723
+
1724
+ ```ts
1725
+ // Example
1726
+ import { array, doc } from "@pluv/crdt-yjs";
1727
+
1728
+ // Create your doc with your shared-types
1729
+ const myDoc = doc({
1730
+ messages: array<string>([]),
1731
+ });
1732
+
1733
+ /**
1734
+ * @description Track origins to enable undos and redos for your document.
1735
+ * trackOrigins must be called before any storage mutations, to enable those
1736
+ * mutations to be undone/redone.
1737
+ */
1738
+ myDoc.trackOrigins({
1739
+ /**
1740
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
1741
+ * This specifies a number in ms, during which edits are merged together to be
1742
+ * undone together. Set this to 0, to track each transacted change individually.
1743
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1744
+ * @default 500
1745
+ */
1746
+ captureTimeout: 500,
1747
+ /**
1748
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1749
+ * This specifies transaction origins (strings only) to filter which transactions
1750
+ * can be undone.
1751
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1752
+ * @default undefined
1753
+ */
1754
+ trackedOrigins: ["user-123"],
1755
+ });
1756
+
1757
+ /**
1758
+ * @description Check whether calling undo will mutate storage
1759
+ * @returns boolean
1760
+ */
1761
+ myDoc.canUndo();
1762
+ /**
1763
+ * @description Check whether calling redo will mutate storage
1764
+ * @returns boolean
1765
+ */
1766
+ myDoc.canRedo();
1767
+
1768
+ // Perform a storage mutation within a transaction so that it can be affected
1769
+ // by undo/redo operations.
1770
+ myDoc.transact(() => {
1771
+ myDoc.get("messages").push(["hello world!"]);
1772
+ }, "user-123");
1773
+
1774
+ /**
1775
+ * @description Undoes the last valid mutation to storage
1776
+ */
1777
+ myDoc.undo();
1778
+
1779
+ /**
1780
+ * @description Re-applies the last undone mutation to storage
1781
+ */
1782
+ myDoc.redo();
1783
+ ```
1784
+
1785
+ ## @pluv/client
1705
1786
 
1706
- `@pluv/crdt-yjs` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `trackOrigins`.
1787
+ `@pluv/client`'s `PluvRoom` and `MockedRoom` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `transact`.
1707
1788
 
1708
- Refer to the code-example below to better understand how to undo and redo with your doc.
1789
+ Refer to the code-example below to better understand how to undo and redo with your `PluvRoom`.
1709
1790
 
1710
- ```ts
1711
- // Example
1712
- import { array, doc } from "@pluv/crdt-yjs";
1791
+ ```ts
1792
+ import { createClient, y } from "@pluv/client";
1713
1793
 
1714
- // Create your doc with your shared-types
1715
- const myDoc = doc({
1716
- messages: array<string>([]),
1717
- });
1794
+ const client = createClient({});
1718
1795
 
1719
- /**
1720
- * @description Track origins to enable undos and redos for your document.
1721
- * trackOrigins must be called before any storage mutations, to enable those
1722
- * mutations to be undone/redone.
1723
- */
1724
- myDoc.trackOrigins({
1725
1796
  /**
1726
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
1727
- * This specifies a number in ms, during which edits are merged together to be
1728
- * undone together. Set this to 0, to track each transacted change individually.
1729
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1730
- * @default 500
1797
+ * @description When a room is created, undo/redo will automatically
1798
+ * be configured to filter for changes made by the connected user
1799
+ * (so that users only undo/redo their changes).
1731
1800
  */
1732
- captureTimeout: 500,
1801
+ const room = client.createRoom("my-room", {
1802
+ initialStorage: () => ({
1803
+ messages: y.array<string>([]),
1804
+ }),
1805
+ /**
1806
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
1807
+ * This specifies a number in ms, during which edits are merged together to be
1808
+ * undone together. Set this to 0, to track each transacted change individually.
1809
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1810
+ * @default 500
1811
+ */
1812
+ captureTimeout: 500,
1813
+ /**
1814
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1815
+ * This specifies transaction origins (strings only) to filter which transactions
1816
+ * can be undone.
1817
+ * When omitted, the user's connection id will be tracked. When provided,
1818
+ * specifies additional tracked origins besides the user's connection id.
1819
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1820
+ * @default undefined
1821
+ */
1822
+ trackedOrigins: ["user-123"],
1823
+ });
1824
+
1825
+ /**
1826
+ * @description Check whether calling undo will mutate storage
1827
+ * @returns boolean
1828
+ */
1829
+ room.canUndo();
1733
1830
  /**
1734
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1735
- * This specifies transaction origins (strings only) to filter which transactions
1736
- * can be undone.
1737
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1738
- * @default undefined
1831
+ * @description Check whether calling redo will mutate storage
1832
+ * @returns boolean
1739
1833
  */
1740
- trackedOrigins: ["user-123"],
1741
- });
1742
-
1743
- /**
1744
- * @description Check whether calling undo will mutate storage
1745
- * @returns boolean
1746
- */
1747
- myDoc.canUndo();
1748
- /**
1749
- * @description Check whether calling redo will mutate storage
1750
- * @returns boolean
1751
- */
1752
- myDoc.canRedo();
1753
-
1754
- // Perform a storage mutation within a transaction so that it can be affected
1755
- // by undo/redo operations.
1756
- myDoc.transact(() => {
1757
- myDoc.get("messages").push(["hello world!"]);
1758
- }, "user-123");
1759
-
1760
- /**
1761
- * @description Undoes the last valid mutation to storage
1762
- */
1763
- myDoc.undo();
1764
-
1765
- /**
1766
- * @description Re-applies the last undone mutation to storage
1767
- */
1768
- myDoc.redo();
1769
- ```
1770
-
1771
- ## @pluv/client
1772
-
1773
- `@pluv/client`'s `PluvRoom` and `MockedRoom` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `transact`.
1774
-
1775
- Refer to the code-example below to better understand how to undo and redo with your `PluvRoom`.
1776
-
1777
- ```ts
1778
- import { createClient, y } from "@pluv/client";
1779
-
1780
- const client = createClient({});
1781
-
1782
- /**
1783
- * @description When a room is created, undo/redo will automatically
1784
- * be configured to filter for changes made by the connected user
1785
- * (so that users only undo/redo their changes).
1786
- */
1787
- const room = client.createRoom("my-room", {
1788
- initialStorage: () => ({
1789
- messages: y.array<string>([]),
1790
- }),
1834
+ room.canRedo();
1835
+
1836
+ /**
1837
+ * @description Calling transact will enable a storage mutation to be undone/redone.
1838
+ * When called without an origin, the origin will default to the user's connection
1839
+ * id.
1840
+ *
1841
+ * You can specify a 2nd parameter to transact with a different transaction origin.
1842
+ */
1843
+ room.transact(() => {
1844
+ room.get("messages").push(["hello world!"]);
1845
+ });
1846
+
1847
+ // This will also be undoable because `"user-123"` is a tracked origin.
1848
+ room.transact(() => {
1849
+ room.get("messages").push(["hello world!"]);
1850
+ }, "user-123");
1851
+
1791
1852
  /**
1792
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
1793
- * This specifies a number in ms, during which edits are merged together to be
1794
- * undone together. Set this to 0, to track each transacted change individually.
1795
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1796
- * @default 500
1853
+ * @description Undoes the last valid mutation to storage
1797
1854
  */
1798
- captureTimeout: 500,
1855
+ room.undo();
1856
+
1799
1857
  /**
1800
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1801
- * This specifies transaction origins (strings only) to filter which transactions
1802
- * can be undone.
1803
- * When omitted, the user's connection id will be tracked. When provided,
1804
- * specifies additional tracked origins besides the user's connection id.
1805
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1806
- * @default undefined
1858
+ * @description Re-applies the last undone mutation to storage
1807
1859
  */
1808
- trackedOrigins: ["user-123"],
1809
- });
1810
-
1811
- /**
1812
- * @description Check whether calling undo will mutate storage
1813
- * @returns boolean
1814
- */
1815
- room.canUndo();
1816
- /**
1817
- * @description Check whether calling redo will mutate storage
1818
- * @returns boolean
1819
- */
1820
- room.canRedo();
1821
-
1822
- /**
1823
- * @description Calling transact will enable a storage mutation to be undone/redone.
1824
- * When called without an origin, the origin will default to the user's connection
1825
- * id.
1826
- *
1827
- * You can specify a 2nd parameter to transact with a different transaction origin.
1828
- */
1829
- room.transact(() => {
1830
- room.get("messages").push(["hello world!"]);
1831
- });
1832
-
1833
- // This will also be undoable because `"user-123"` is a tracked origin.
1834
- room.transact(() => {
1835
- room.get("messages").push(["hello world!"]);
1836
- }, "user-123");
1837
-
1838
- /**
1839
- * @description Undoes the last valid mutation to storage
1840
- */
1841
- room.undo();
1842
-
1843
- /**
1844
- * @description Re-applies the last undone mutation to storage
1845
- */
1846
- room.redo();
1847
- ```
1848
-
1849
- ## @pluv/react
1850
-
1851
- `@pluv/react`'s `createRoomBundle` now exposes 5 new react hooks: `useCanRedo`, `useCanUndo`, `useRedo`, `useUndo` and `useTransact`.
1852
-
1853
- Refer to the code-example below to better understand how to undo and redo with your `createRoomBundle`.
1854
-
1855
- ```tsx
1856
- import { createBundle, createClient, y } from "@pluv/react";
1857
- import { type io } from "./io";
1858
-
1859
- const client = createClient<typeof io>();
1860
-
1861
- const { createRoomBundle } = createBundle(client);
1862
-
1863
- const { useCanRedo, useCanUndo, useRedo, useStorage, useTransact, useUndo } =
1864
- createRoomBundle({
1865
- initialStorage: () => ({
1866
- messages: y.array<string>([]),
1867
- }),
1868
- /**
1869
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
1870
- * This specifies a number in ms, during which edits are merged together to be
1871
- * undone together. Set this to 0, to track each transacted change individually.
1872
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1873
- * @default 500
1874
- */
1875
- captureTimeout: 500,
1876
- /**
1877
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1878
- * This specifies transaction origins (strings only) to filter which transactions
1879
- * can be undone.
1880
- * When omitted, the user's connection id will be tracked. When provided,
1881
- * specifies additional tracked origins besides the user's connection id.
1882
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1883
- * @default undefined
1884
- */
1885
- trackedOrigins: ["user-123"],
1860
+ room.redo();
1861
+ ```
1862
+
1863
+ ## @pluv/react
1864
+
1865
+ `@pluv/react`'s `createRoomBundle` now exposes 5 new react hooks: `useCanRedo`, `useCanUndo`, `useRedo`, `useUndo` and `useTransact`.
1866
+
1867
+ Refer to the code-example below to better understand how to undo and redo with your `createRoomBundle`.
1868
+
1869
+ ```tsx
1870
+ import { createBundle, createClient, y } from "@pluv/react";
1871
+ import { type io } from "./io";
1872
+
1873
+ const client = createClient<typeof io>();
1874
+
1875
+ const { createRoomBundle } = createBundle(client);
1876
+
1877
+ const { useCanRedo, useCanUndo, useRedo, useStorage, useTransact, useUndo } = createRoomBundle({
1878
+ initialStorage: () => ({
1879
+ messages: y.array<string>([]),
1880
+ }),
1881
+ /**
1882
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
1883
+ * This specifies a number in ms, during which edits are merged together to be
1884
+ * undone together. Set this to 0, to track each transacted change individually.
1885
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1886
+ * @default 500
1887
+ */
1888
+ captureTimeout: 500,
1889
+ /**
1890
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1891
+ * This specifies transaction origins (strings only) to filter which transactions
1892
+ * can be undone.
1893
+ * When omitted, the user's connection id will be tracked. When provided,
1894
+ * specifies additional tracked origins besides the user's connection id.
1895
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1896
+ * @default undefined
1897
+ */
1898
+ trackedOrigins: ["user-123"],
1886
1899
  });
1887
1900
 
1888
- /**
1889
- * @description Check whether calling undo will mutate storage
1890
- */
1891
- const canUndo: boolean = useCanUndo();
1892
- /**
1893
- * @description Check whether calling redo will mutate storage
1894
- */
1895
- const canRedo: boolean = useCanRedo();
1901
+ /**
1902
+ * @description Check whether calling undo will mutate storage
1903
+ */
1904
+ const canUndo: boolean = useCanUndo();
1905
+ /**
1906
+ * @description Check whether calling redo will mutate storage
1907
+ */
1908
+ const canRedo: boolean = useCanRedo();
1896
1909
 
1897
- const [messages, sharedType] = useStorage("messages");
1910
+ const [messages, sharedType] = useStorage("messages");
1898
1911
 
1899
- /**
1900
- * @description Calling transact will enable a storage mutation to be undone/redone.
1901
- * When called without an origin, the origin will default to the user's connection
1902
- * id.
1903
- *
1904
- * You can specify a 2nd parameter to transact with a different transaction origin.
1905
- */
1906
- const transact = useTransact();
1912
+ /**
1913
+ * @description Calling transact will enable a storage mutation to be undone/redone.
1914
+ * When called without an origin, the origin will default to the user's connection
1915
+ * id.
1916
+ *
1917
+ * You can specify a 2nd parameter to transact with a different transaction origin.
1918
+ */
1919
+ const transact = useTransact();
1907
1920
 
1908
- transact(() => {
1909
- sharedType.push(["hello world!"]);
1910
- });
1921
+ transact(() => {
1922
+ sharedType.push(["hello world!"]);
1923
+ });
1911
1924
 
1912
- // This will also be undoable because `"user-123"` is a tracked origin.
1913
- transact(() => {
1914
- sharedType.push(["hello world!"]);
1915
- }, "user-123");
1925
+ // This will also be undoable because `"user-123"` is a tracked origin.
1926
+ transact(() => {
1927
+ sharedType.push(["hello world!"]);
1928
+ }, "user-123");
1916
1929
 
1917
- /**
1918
- * @description Undoes the last valid mutation to storage
1919
- */
1920
- const undo = useUndo();
1930
+ /**
1931
+ * @description Undoes the last valid mutation to storage
1932
+ */
1933
+ const undo = useUndo();
1921
1934
 
1922
- undo();
1935
+ undo();
1923
1936
 
1924
- /**
1925
- * @description Re-applies the last undone mutation to storage
1926
- */
1927
- const redo = useRedo();
1937
+ /**
1938
+ * @description Re-applies the last undone mutation to storage
1939
+ */
1940
+ const redo = useRedo();
1928
1941
 
1929
- redo();
1930
- ```
1942
+ redo();
1943
+ ```
1931
1944
 
1932
1945
  ### Patch Changes
1933
1946
 
1934
1947
  - Updated dependencies [436040b]
1935
- - @pluv/client@0.12.0
1936
- - @pluv/types@0.12.0
1948
+ - @pluv/client@0.12.0
1949
+ - @pluv/types@0.12.0
1937
1950
 
1938
1951
  ## 0.11.1
1939
1952
 
@@ -1941,8 +1954,8 @@
1941
1954
 
1942
1955
  - 74b3061: Bumped minor and patch dependencies.
1943
1956
  - Updated dependencies [74b3061]
1944
- - @pluv/client@0.11.1
1945
- - @pluv/types@0.11.1
1957
+ - @pluv/client@0.11.1
1958
+ - @pluv/types@0.11.1
1946
1959
 
1947
1960
  ## 0.11.0
1948
1961
 
@@ -1971,8 +1984,8 @@
1971
1984
 
1972
1985
  - 885835d: remove unnecessary dependency
1973
1986
  - Updated dependencies [885835d]
1974
- - @pluv/client@0.10.1
1975
- - @pluv/types@0.10.1
1987
+ - @pluv/client@0.10.1
1988
+ - @pluv/types@0.10.1
1976
1989
 
1977
1990
  ## 0.10.0
1978
1991
 
@@ -1983,8 +1996,8 @@
1983
1996
  ### Patch Changes
1984
1997
 
1985
1998
  - Updated dependencies [f43f1cc]
1986
- - @pluv/client@0.10.0
1987
- - @pluv/types@0.10.0
1999
+ - @pluv/client@0.10.0
2000
+ - @pluv/types@0.10.0
1988
2001
 
1989
2002
  ## 0.6.2
1990
2003
 
@@ -1992,21 +2005,21 @@
1992
2005
 
1993
2006
  - f4317ba: \* Renamed type `unstable_YObjectValue` to `YObjectValue`;
1994
2007
 
1995
- - Renamed type `unstable_YObject` to `YObject`.
1996
- - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
2008
+ - Renamed type `unstable_YObject` to `YObject`.
2009
+ - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
1997
2010
 
1998
- ```ts
1999
- import { y } from "@pluv/client";
2000
- // or
2001
- import { y } from "@pluv/react";
2011
+ ```ts
2012
+ import { y } from "@pluv/client";
2013
+ // or
2014
+ import { y } from "@pluv/react";
2002
2015
 
2003
- y.xmlElement("MyElement", {});
2004
- y.xmlFragment({});
2005
- y.xmlText("hello world");
2006
- ```
2016
+ y.xmlElement("MyElement", {});
2017
+ y.xmlFragment({});
2018
+ y.xmlText("hello world");
2019
+ ```
2007
2020
 
2008
2021
  - Updated dependencies [f4317ba]
2009
- - @pluv/client@0.9.2
2022
+ - @pluv/client@0.9.2
2010
2023
 
2011
2024
  ## 0.6.1
2012
2025
 
@@ -2016,8 +2029,8 @@
2016
2029
  - 8997c65: bumped dependencies
2017
2030
  - Updated dependencies [8fba48b]
2018
2031
  - Updated dependencies [8997c65]
2019
- - @pluv/client@0.9.1
2020
- - @pluv/types@0.2.2
2032
+ - @pluv/client@0.9.1
2033
+ - @pluv/types@0.2.2
2021
2034
 
2022
2035
  ## 0.6.0
2023
2036
 
@@ -2025,49 +2038,49 @@
2025
2038
 
2026
2039
  - 829d31b: Added support for defining persistant frontend storage for rooms via a new `addons` option on rooms.
2027
2040
 
2028
- This also introduces the first new addon `@pluv/addon-indexeddb`, which is more-or-less the equivalent to `y-indexeddb` which you can install like so:
2041
+ This also introduces the first new addon `@pluv/addon-indexeddb`, which is more-or-less the equivalent to `y-indexeddb` which you can install like so:
2029
2042
 
2030
- ```
2031
- npm install @pluv/addon-indexeddb
2032
- ```
2043
+ ```
2044
+ npm install @pluv/addon-indexeddb
2045
+ ```
2033
2046
 
2034
- To use this new addon, simply pass it to options when creating a room:
2047
+ To use this new addon, simply pass it to options when creating a room:
2035
2048
 
2036
- ```ts
2037
- import { addonIndexedDB } from "@pluv/addon-indexeddb";
2038
- import { createClient } from "@pluv/client";
2049
+ ```ts
2050
+ import { addonIndexedDB } from "@pluv/addon-indexeddb";
2051
+ import { createClient } from "@pluv/client";
2039
2052
 
2040
- const client = createClient({
2041
- // ...
2042
- });
2053
+ const client = createClient({
2054
+ // ...
2055
+ });
2043
2056
 
2044
- const room = client.createRoom("my-new-room", {
2045
- addons: [
2046
- // Define your addons in an array like so
2047
- addonIndexedDB(),
2048
- ],
2049
- });
2050
- ```
2057
+ const room = client.createRoom("my-new-room", {
2058
+ addons: [
2059
+ // Define your addons in an array like so
2060
+ addonIndexedDB(),
2061
+ ],
2062
+ });
2063
+ ```
2051
2064
 
2052
- Or when using `@pluv/react`:
2065
+ Or when using `@pluv/react`:
2053
2066
 
2054
- ```ts
2055
- const PluvRoom = createRoomBundle({
2056
- // ...
2057
- addons: [
2058
- // Define your addons in an array like so
2059
- addonIndexedDB(),
2060
- ],
2061
- });
2062
- ```
2067
+ ```ts
2068
+ const PluvRoom = createRoomBundle({
2069
+ // ...
2070
+ addons: [
2071
+ // Define your addons in an array like so
2072
+ addonIndexedDB(),
2073
+ ],
2074
+ });
2075
+ ```
2063
2076
 
2064
2077
  ### Patch Changes
2065
2078
 
2066
2079
  - 8d11672: bumped dependencies to latest
2067
2080
  - Updated dependencies [8d11672]
2068
2081
  - Updated dependencies [829d31b]
2069
- - @pluv/client@0.9.0
2070
- - @pluv/types@0.2.1
2082
+ - @pluv/client@0.9.0
2083
+ - @pluv/types@0.2.1
2071
2084
 
2072
2085
  ## 0.5.11
2073
2086
 
@@ -2075,7 +2088,7 @@
2075
2088
 
2076
2089
  - 2c9c5c3: changed my-presence to be non-nullable
2077
2090
  - Updated dependencies [2c9c5c3]
2078
- - @pluv/client@0.8.1
2091
+ - @pluv/client@0.8.1
2079
2092
 
2080
2093
  ## 0.5.10
2081
2094
 
@@ -2086,8 +2099,8 @@
2086
2099
  - Updated dependencies [5bbfb98]
2087
2100
  - Updated dependencies [b85a232]
2088
2101
  - Updated dependencies [fde89cf]
2089
- - @pluv/client@0.8.0
2090
- - @pluv/types@0.2.0
2102
+ - @pluv/client@0.8.0
2103
+ - @pluv/types@0.2.0
2091
2104
 
2092
2105
  ## 0.5.9
2093
2106
 
@@ -2099,8 +2112,8 @@
2099
2112
  - Updated dependencies [ae679a8]
2100
2113
  - Updated dependencies [bb2886b]
2101
2114
  - Updated dependencies [3518a83]
2102
- - @pluv/client@0.7.0
2103
- - @pluv/types@0.2.0
2115
+ - @pluv/client@0.7.0
2116
+ - @pluv/types@0.2.0
2104
2117
 
2105
2118
  ## 0.5.8
2106
2119
 
@@ -2109,8 +2122,8 @@
2109
2122
  - 7ad4967: fixed user's presence not updating locally while offline
2110
2123
  - Updated dependencies [7ad4967]
2111
2124
  - Updated dependencies [4535687]
2112
- - @pluv/client@0.6.5
2113
- - @pluv/types@0.1.6
2125
+ - @pluv/client@0.6.5
2126
+ - @pluv/types@0.1.6
2114
2127
 
2115
2128
  ## 0.5.7
2116
2129
 
@@ -2118,7 +2131,7 @@
2118
2131
 
2119
2132
  - 78fd644: updated readmes with links to the documentation website
2120
2133
  - Updated dependencies [78fd644]
2121
- - @pluv/client@0.6.4
2134
+ - @pluv/client@0.6.4
2122
2135
 
2123
2136
  ## 0.5.6
2124
2137
 
@@ -2126,8 +2139,8 @@
2126
2139
 
2127
2140
  - 850626e: bumped dependencies
2128
2141
  - Updated dependencies [850626e]
2129
- - @pluv/client@0.6.3
2130
- - @pluv/types@0.1.6
2142
+ - @pluv/client@0.6.3
2143
+ - @pluv/types@0.1.6
2131
2144
 
2132
2145
  ## 0.5.5
2133
2146
 
@@ -2135,7 +2148,7 @@
2135
2148
 
2136
2149
  - 9ae251d: bumped dependencies
2137
2150
  - Updated dependencies [9ae251d]
2138
- - @pluv/client@0.6.2
2151
+ - @pluv/client@0.6.2
2139
2152
 
2140
2153
  ## 0.5.4
2141
2154
 
@@ -2146,16 +2159,16 @@
2146
2159
  - 74870ee: bumped dependencies
2147
2160
  - Updated dependencies [19433af]
2148
2161
  - Updated dependencies [74870ee]
2149
- - @pluv/client@0.6.1
2150
- - @pluv/types@0.1.5
2162
+ - @pluv/client@0.6.1
2163
+ - @pluv/types@0.1.5
2151
2164
 
2152
2165
  ## 0.5.3
2153
2166
 
2154
2167
  ### Patch Changes
2155
2168
 
2156
2169
  - 57ae13f: bumped dependencies
2157
- - @pluv/client@0.6.0
2158
- - @pluv/types@0.1.4
2170
+ - @pluv/client@0.6.0
2171
+ - @pluv/types@0.1.4
2159
2172
 
2160
2173
  ## 0.5.2
2161
2174
 
@@ -2171,8 +2184,8 @@
2171
2184
  - Updated dependencies [7b6da1c]
2172
2185
  - Updated dependencies [e9c1514]
2173
2186
  - Updated dependencies [9d1829c]
2174
- - @pluv/client@0.6.0
2175
- - @pluv/types@0.1.4
2187
+ - @pluv/client@0.6.0
2188
+ - @pluv/types@0.1.4
2176
2189
 
2177
2190
  ## 0.5.1
2178
2191
 
@@ -2182,8 +2195,8 @@
2182
2195
  - f6c0e65: bumped dependencies
2183
2196
  - Updated dependencies [161e00e]
2184
2197
  - Updated dependencies [f6c0e65]
2185
- - @pluv/client@0.5.1
2186
- - @pluv/types@0.1.3
2198
+ - @pluv/client@0.5.1
2199
+ - @pluv/types@0.1.3
2187
2200
 
2188
2201
  ## 0.5.0
2189
2202
 
@@ -2206,8 +2219,8 @@
2206
2219
  - Updated dependencies [b1cb325]
2207
2220
  - Updated dependencies [327a6ef]
2208
2221
  - Updated dependencies [8e97fb2]
2209
- - @pluv/client@0.5.0
2210
- - @pluv/types@0.1.3
2222
+ - @pluv/client@0.5.0
2223
+ - @pluv/types@0.1.3
2211
2224
 
2212
2225
  ## 0.4.0
2213
2226
 
@@ -2219,7 +2232,7 @@
2219
2232
 
2220
2233
  - 93f8c54: chore(deps): update dependency @types/react to v18.0.27
2221
2234
  - Updated dependencies [595e66f]
2222
- - @pluv/client@0.4.0
2235
+ - @pluv/client@0.4.0
2223
2236
 
2224
2237
  ## 0.3.0
2225
2238
 
@@ -2231,7 +2244,7 @@
2231
2244
 
2232
2245
  - 93f8c54: chore(deps): update dependency @types/react to v18.0.27
2233
2246
  - Updated dependencies [595e66f]
2234
- - @pluv/client@0.3.0
2247
+ - @pluv/client@0.3.0
2235
2248
 
2236
2249
  ## 0.2.0
2237
2250
 
@@ -2242,8 +2255,8 @@
2242
2255
  ### Patch Changes
2243
2256
 
2244
2257
  - Updated dependencies [95b5ef8]
2245
- - @pluv/client@0.2.0
2246
- - @pluv/types@0.1.2
2258
+ - @pluv/client@0.2.0
2259
+ - @pluv/types@0.1.2
2247
2260
 
2248
2261
  ## 0.1.3
2249
2262
 
@@ -2251,8 +2264,8 @@
2251
2264
 
2252
2265
  - fe80d7b: added preview disclaimer about breaking changes in the readme
2253
2266
  - Updated dependencies [fe80d7b]
2254
- - @pluv/client@0.1.3
2255
- - @pluv/types@0.1.2
2267
+ - @pluv/client@0.1.3
2268
+ - @pluv/types@0.1.2
2256
2269
 
2257
2270
  ## 0.1.2
2258
2271
 
@@ -2267,8 +2280,8 @@
2267
2280
  - 24016e6: Updated dependencies
2268
2281
  - Updated dependencies [23a7382]
2269
2282
  - Updated dependencies [24016e6]
2270
- - @pluv/client@0.1.1
2271
- - @pluv/types@0.1.1
2283
+ - @pluv/client@0.1.1
2284
+ - @pluv/types@0.1.1
2272
2285
 
2273
2286
  ## 0.1.0
2274
2287
 
@@ -2279,5 +2292,5 @@
2279
2292
  ### Patch Changes
2280
2293
 
2281
2294
  - Updated dependencies [a22f525]
2282
- - @pluv/client@0.1.0
2283
- - @pluv/types@0.1.0
2295
+ - @pluv/client@0.1.0
2296
+ - @pluv/types@0.1.0