@pluv/react 2.2.0 → 2.2.2

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