@pluv/client 5.0.0 → 5.0.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 DELETED
@@ -1,2426 +0,0 @@
1
- # @pluv/client
2
-
3
- ## 5.0.0
4
-
5
- ### Patch Changes
6
-
7
- - @pluv/crdt@5.0.0
8
- - @pluv/types@5.0.0
9
-
10
- ## 4.1.0
11
-
12
- ### Patch Changes
13
-
14
- - @pluv/crdt@4.1.0
15
- - @pluv/types@4.1.0
16
-
17
- ## 4.0.2
18
-
19
- ### Patch Changes
20
-
21
- - e1913b3: Upgraded internal dependencies
22
- - Updated dependencies [e1913b3]
23
- - @pluv/types@4.0.2
24
- - @pluv/crdt@4.0.2
25
-
26
- ## 4.0.1
27
-
28
- ### Patch Changes
29
-
30
- - @pluv/crdt@4.0.1
31
- - @pluv/types@4.0.1
32
-
33
- ## 4.0.0
34
-
35
- ### Major Changes
36
-
37
- - df5c39c: Update all packages to be ESM only.
38
-
39
- ### Minor Changes
40
-
41
- - 037074e: Migrated build process from tsup to tsdown.
42
-
43
- ### Patch Changes
44
-
45
- - 2eb5def: Bumped dependencies.
46
- - Updated dependencies [2eb5def]
47
- - Updated dependencies [df5c39c]
48
- - Updated dependencies [037074e]
49
- - @pluv/types@4.0.0
50
- - @pluv/crdt@4.0.0
51
-
52
- ## 3.2.2
53
-
54
- ### Patch Changes
55
-
56
- - 8665dbe: Updated types of `createClient` so that the types inferred from `createClient` are flattened and no-longer depend on `@pluv/server`.
57
- - Updated dependencies [8665dbe]
58
- - @pluv/types@3.2.2
59
- - @pluv/crdt@3.2.2
60
-
61
- ## 3.2.1
62
-
63
- ### Patch Changes
64
-
65
- - 1e0c886: Updated crdt internal private properties to use native [private elements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_elements).
66
- - @pluv/crdt@3.2.1
67
- - @pluv/types@3.2.1
68
-
69
- ## 3.2.0
70
-
71
- ### Patch Changes
72
-
73
- - @pluv/crdt@3.2.0
74
- - @pluv/types@3.2.0
75
-
76
- ## 3.1.7
77
-
78
- ### Patch Changes
79
-
80
- - @pluv/crdt@3.1.7
81
- - @pluv/types@3.1.7
82
-
83
- ## 3.1.6
84
-
85
- ### Patch Changes
86
-
87
- - @pluv/crdt@3.1.6
88
- - @pluv/types@3.1.6
89
-
90
- ## 3.1.5
91
-
92
- ### Patch Changes
93
-
94
- - @pluv/crdt@3.1.5
95
- - @pluv/types@3.1.5
96
-
97
- ## 3.1.4
98
-
99
- ### Patch Changes
100
-
101
- - e443b66: Fixed a case where an empty storage store (e.g. @pluv/addon-indexeddb) would result in an empty initial storage, even when an initial storage was defined.
102
- - @pluv/crdt@3.1.4
103
- - @pluv/types@3.1.4
104
-
105
- ## 3.1.3
106
-
107
- ### Patch Changes
108
-
109
- - @pluv/crdt@3.1.3
110
- - @pluv/types@3.1.3
111
-
112
- ## 3.1.2
113
-
114
- ### Patch Changes
115
-
116
- - @pluv/crdt@3.1.2
117
- - @pluv/types@3.1.2
118
-
119
- ## 3.1.1
120
-
121
- ### Patch Changes
122
-
123
- - @pluv/crdt@3.1.1
124
- - @pluv/types@3.1.1
125
-
126
- ## 3.1.0
127
-
128
- ### Minor Changes
129
-
130
- - 022857d: TypeScript will now emit an error if `initialStorage` was provided to `createClient` while `createIO` was not provided a `crdt`.
131
-
132
- ```ts
133
- import { createClient, infer } from "@pluv/client";
134
- import { yjs } from "@pluv/crdt-yjs";
135
- import { createIO } from "@pluv/io";
136
- import { platformCloudflare } from "@pluv/platform-cloudflare";
137
-
138
- const io = createIO(
139
- // Assume no crdt was provided here
140
- platformCloudflare({
141
- /* ... */
142
- }),
143
- );
144
-
145
- const ioServer = io.server();
146
-
147
- const types = infer((i) => ({ io: i<typeof ioServer> }));
148
- const client = createClient({
149
- types,
150
- // This will now emit a TypeScript error, because `crdt` was not provided to
151
- // `createIO` above
152
- initialStorage: yjs.doc((t) => ({
153
- groceries: t.array<string>("groceries"),
154
- })),
155
- });
156
- ```
157
-
158
- ### Patch Changes
159
-
160
- - @pluv/crdt@3.1.0
161
- - @pluv/types@3.1.0
162
-
163
- ## 3.0.0
164
-
165
- ### Major Changes
166
-
167
- - bc1ae91: **BREAKING** Removed deprecated `event`, `others`, `storageLoaded`, `storageRoot` and `storage` methods on `PluvRoom`. These methods now exist under `PluvRoom.subscribe`.
168
-
169
- ### Patch Changes
170
-
171
- - @pluv/crdt@3.0.0
172
- - @pluv/types@3.0.0
173
-
174
- ## 2.3.1
175
-
176
- ### Patch Changes
177
-
178
- - @pluv/crdt@2.3.1
179
- - @pluv/types@2.3.1
180
-
181
- ## 2.3.0
182
-
183
- ### Patch Changes
184
-
185
- - @pluv/crdt@2.3.0
186
- - @pluv/types@2.3.0
187
-
188
- ## 2.2.8
189
-
190
- ### Patch Changes
191
-
192
- - @pluv/crdt@2.2.8
193
- - @pluv/types@2.2.8
194
-
195
- ## 2.2.7
196
-
197
- ### Patch Changes
198
-
199
- - @pluv/crdt@2.2.7
200
- - @pluv/types@2.2.7
201
-
202
- ## 2.2.6
203
-
204
- ### Patch Changes
205
-
206
- - @pluv/crdt@2.2.6
207
- - @pluv/types@2.2.6
208
-
209
- ## 2.2.5
210
-
211
- ### Patch Changes
212
-
213
- - @pluv/crdt@2.2.5
214
- - @pluv/types@2.2.5
215
-
216
- ## 2.2.4
217
-
218
- ### Patch Changes
219
-
220
- - @pluv/crdt@2.2.4
221
- - @pluv/types@2.2.4
222
-
223
- ## 2.2.3
224
-
225
- ### Patch Changes
226
-
227
- - @pluv/crdt@2.2.3
228
- - @pluv/types@2.2.3
229
-
230
- ## 2.2.2
231
-
232
- ### Patch Changes
233
-
234
- - @pluv/crdt@2.2.2
235
- - @pluv/types@2.2.2
236
-
237
- ## 2.2.1
238
-
239
- ### Patch Changes
240
-
241
- - @pluv/crdt@2.2.1
242
- - @pluv/types@2.2.1
243
-
244
- ## 2.2.0
245
-
246
- ### Minor Changes
247
-
248
- - 3ce1547: Updated typings for `PluvRoom.getDoc` to be narrower to get the native doc type.
249
-
250
- ```ts
251
- import { createClient } from "@pluv/client";
252
- import { yjs } from "@pluv/crdt-yjs";
253
- import type { Doc as YDoc } from "yjs";
254
-
255
- const client = createClient({
256
- // ...
257
- crdt: yjs,
258
- });
259
- const room = client.createRoom("example-room");
260
-
261
- const doc = room.getDoc();
262
-
263
- // This is now typed as the native YDoc
264
- doc.value;
265
- // ^? const value: YDoc
266
- ```
267
-
268
- - fd3bfe2: Added the ability to listen to the room's underlying websocket's event listeners.
269
- - aee40cb: Updated `presence` types to be more lenient (i.e. no-longer extends `JsonObject`). This is to enable types like `.passthrough` with zod, which can be useful for integrating `yjs.awareness` with libraries such as [lexical](https://lexical.dev/).
270
- - edd1789: **DEPRECATED** `PluvRoom.storageLoaded` will be removed in v3. Added `PluvRoom.getStorageLoaded` with improved detection of when the storage was synced.
271
-
272
- ```ts
273
- const room = client.createRoom("example-room");
274
-
275
- // Before
276
- room.storageLoaded;
277
-
278
- // After
279
- room.getStorageLoaded();
280
- ```
281
-
282
- ### Patch Changes
283
-
284
- - 48191fa: Fixed `PluvRoom.getDoc` not returning a stable doc reference for a single connection.
285
- - @pluv/crdt@2.2.0
286
- - @pluv/types@2.2.0
287
-
288
- ## 2.1.0
289
-
290
- ### Minor Changes
291
-
292
- - e8d8fbc: **DEPRECATED** Subscribing to data via string parameters on `PluvRoom.subscribe` is deprecated, to be removed in v3. To subscribe to things such as `myself`, `my-presence` and `others`, you must now do so via nested properties on the `subscribe` object (see example below).
293
-
294
- ```ts
295
- const room = client.createRoom("example-room");
296
-
297
- // Before (now deprecated)
298
- room.subscribe("connection", (state) => {});
299
- room.subscribe("my-presence", (myPresence) => {});
300
- room.subscribe("myself", (myself) => {});
301
- room.subscribe("others", (others) => {});
302
- room.subscribe("storage-loaded", (storageLoaded) => {});
303
-
304
- // After
305
- room.subscribe.connection((state) => {});
306
- room.subscribe.myPresence((myPresence) => {});
307
- room.subscribe.myself((myself) => {});
308
- room.subscribe.others((others) => {});
309
- room.subscribe.storageLoaded((storageLoaded) => {});
310
- ```
311
-
312
- - d5ac29e: **DEPRECATED** `PluvRoom.event`, `PluvRoom.storage`, `PluvRoom.storageRoot` and `PluvRoom.other` have all been deprecated, to be removed in v3. These now exist under `PluvRoom.subscribe` instead.
313
-
314
- ```ts
315
- const room = client.createRoom("example-room");
316
-
317
- // Before (now deprecated)
318
- room.event.receiveMessage((event) => {});
319
- room.storage.messages((messages) => {});
320
- room.storageRoot((storage) => {});
321
- room.other(("id_...", other) => {});
322
-
323
- // After
324
- room.subscribe.event.receiveMessage((event) => {});
325
- room.subscribe.storage.messages((messages) => {});
326
- room.subscribe.storageRoot((storage) => {});
327
- room.subscribe.other(("id_...", other) => {});
328
- ```
329
-
330
- - 5ca5cb6: Updated `PluvRoom.storage` to also allow subscribing to storage fields as nested properties.
331
-
332
- ```ts
333
- const client = createClient({
334
- // ...
335
- initialStorage: yjs.doc((t) => ({
336
- messages: yjs.array<string>(),
337
- })),
338
- });
339
-
340
- const room = client.createRoom("example-room");
341
-
342
- // The two statements below are equivalent.
343
- room.storage("messages", (value) => {});
344
-
345
- // You can now subscribe to storage fields as nested properties like so
346
- room.storage.messages((value) => {});
347
- ```
348
-
349
- - 4acbe1e: Updated `PluvRoom.storage` to also allow subscribing to the root storage when no field is provided.
350
-
351
- ```ts
352
- const client = createClient({
353
- // ...
354
- initialStorage: yjs.doc((t) => ({
355
- messages: yjs.array<string>(),
356
- })),
357
- });
358
-
359
- const room = client.createRoom("example-room");
360
-
361
- room.storage("messages", (value) => {});
362
- // ^? const value: string[];
363
-
364
- // You can now subscribe to the storage root when no key is provided
365
- room.storage((value) => {});
366
- // ^? const value: { messages: string[] };
367
- ```
368
-
369
- - e8d8fbc: Updated `PluvRoom.subscribe` so that `PluvRoom.event` and `PluvRoom.storage` can be accessed as properties under `PluvRoom.subscribe`.
370
-
371
- ```ts
372
- const room = client.createRoom("example-room");
373
-
374
- // These are now available under the subscribe object
375
- room.subscribe.event.receiveEvent((event) => {});
376
- room.subscribe.storage.messages((data) => {});
377
- ```
378
-
379
- ### Patch Changes
380
-
381
- - a86ff5e: Updated internal types to simplify the type for `PluvRoom.broadcast` and `PluvRoom.event`.
382
- - @pluv/crdt@2.1.0
383
- - @pluv/types@2.1.0
384
-
385
- ## 2.0.2
386
-
387
- ### Patch Changes
388
-
389
- - @pluv/crdt@2.0.2
390
- - @pluv/types@2.0.2
391
-
392
- ## 2.0.1
393
-
394
- ### Patch Changes
395
-
396
- - 1b93b18: Fixed `ConnectionState` not being exported.
397
- - @pluv/crdt@2.0.1
398
- - @pluv/types@2.0.1
399
-
400
- ## 2.0.0
401
-
402
- ### Patch Changes
403
-
404
- - 047a1d8: Moved several internal types to `@pluv/types`.
405
- - 0806212: Fix the room's id not being defined during the initialization of addons.
406
- - 3a34dbb: Fixed `initialStorage` on `PluvClient.createRoom` not overwriting the `initialStorage` from the `PluvClient` constructor.
407
- - Updated dependencies [047a1d8]
408
- - @pluv/types@2.0.0
409
- - @pluv/crdt@2.0.0
410
-
411
- ## 1.0.2
412
-
413
- ### Patch Changes
414
-
415
- - d87159c: Restored `@pluv/addon-indexeddb` functionality, and fixed `@pluv/addon-indexeddb` sometimes duplicating storage operations based on `initialStorage` values.
416
- - @pluv/crdt@1.0.2
417
- - @pluv/types@1.0.2
418
-
419
- ## 1.0.1
420
-
421
- ### Patch Changes
422
-
423
- - c583be9: Fixed storage race condition that occurred when 2 users joined a room near simultaneously that would cause users to have mismatched storage states from the server (and thereby preventing updates from properly registering) until the user reconnected.
424
- - @pluv/crdt@1.0.1
425
- - @pluv/types@1.0.1
426
-
427
- ## 1.0.0
428
-
429
- ### Major Changes
430
-
431
- - af94706: pluv.io is now stable and production ready!
432
-
433
- 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.
434
-
435
- Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
436
-
437
- ### Patch Changes
438
-
439
- - Updated dependencies [af94706]
440
- - @pluv/crdt@1.0.0
441
- - @pluv/types@1.0.0
442
-
443
- ## 0.44.2
444
-
445
- ### Patch Changes
446
-
447
- - 6cfd36f: Update `PluvRoom` to attempt to reconnect if currently disconnected when the window is re-focused.
448
- - @pluv/crdt@0.44.2
449
- - @pluv/types@0.44.2
450
-
451
- ## 0.44.1
452
-
453
- ### Patch Changes
454
-
455
- - 67c081d: Fix `PluvRoom._reconnect` not being called with the last used metadata (from `PluvRoom.connect`).
456
- - @pluv/crdt@0.44.1
457
- - @pluv/types@0.44.1
458
-
459
- ## 0.44.0
460
-
461
- ### Minor Changes
462
-
463
- - c9fcea5: **BREAKING** The `ConnectionState` enum is now a `const` to avoid several pitfalls of using TypeScript enums.
464
-
465
- ### Patch Changes
466
-
467
- - fba9354: Fix potential edge case where event handlers may be called redundantly.
468
- - bc2d684: Fix `PluvRoom` not properly reconnecting when connections are unavailable.
469
- - @pluv/crdt@0.44.0
470
- - @pluv/types@0.44.0
471
-
472
- ## 0.43.0
473
-
474
- ### Patch Changes
475
-
476
- - 65d9172: Added configurable limits for client-side validation. These should only be updated if you control the server and the server limits have been changed.
477
-
478
- ```ts
479
- // defaults
480
- createClient({
481
- limits: {
482
- presenceMaxSize: 512,
483
- },
484
- });
485
- ```
486
-
487
- - @pluv/crdt@0.43.0
488
- - @pluv/types@0.43.0
489
-
490
- ## 0.42.0
491
-
492
- ### Patch Changes
493
-
494
- - 7ae56bf: Periodically sync connection ids with the server to clear stale connections.
495
- - @pluv/crdt@0.42.0
496
- - @pluv/types@0.42.0
497
-
498
- ## 0.41.7
499
-
500
- ### Patch Changes
501
-
502
- - @pluv/crdt@0.41.7
503
- - @pluv/types@0.41.7
504
-
505
- ## 0.41.6
506
-
507
- ### Patch Changes
508
-
509
- - 71642fa: Fix error about missing wsEndpoint.
510
- - @pluv/crdt@0.41.6
511
- - @pluv/types@0.41.6
512
-
513
- ## 0.41.5
514
-
515
- ### Patch Changes
516
-
517
- - b3b7b30: Fix error being thrown about missing wsEndpoint when a public key is provided.
518
- - @pluv/crdt@0.41.5
519
- - @pluv/types@0.41.5
520
-
521
- ## 0.41.4
522
-
523
- ### Patch Changes
524
-
525
- - @pluv/crdt@0.41.4
526
- - @pluv/types@0.41.4
527
-
528
- ## 0.41.3
529
-
530
- ### Patch Changes
531
-
532
- - 49051c0: Fix presence keys becoming lost, causing presence objects to be partial and failing schema validation.
533
- - @pluv/crdt@0.41.3
534
- - @pluv/types@0.41.3
535
-
536
- ## 0.41.2
537
-
538
- ### Patch Changes
539
-
540
- - 37956d3: When presence is received for a user that is not currently being tracked, `PluvRoom` now automatically updates `others` to include the connection of the received presence.
541
- - @pluv/crdt@0.41.2
542
- - @pluv/types@0.41.2
543
-
544
- ## 0.41.1
545
-
546
- ### Patch Changes
547
-
548
- - @pluv/crdt@0.41.1
549
- - @pluv/types@0.41.1
550
-
551
- ## 0.41.0
552
-
553
- ### Minor Changes
554
-
555
- - 41aa439: **BREAKING** User's presence is now limited to be at most 512 bytes. If the presence is any larger, the `PluvRoom` will now throw an error.
556
- - 555b88d: Users can now have multiple simultaneous connections. Previously, if a user tried to open a connection to a room while already being connected to the room, the new connection would be blocked. Now, when the user opens another connection, the new connection will be opened and initialized with their latest presence.
557
-
558
- Users can only have 1 identity and 1 presence, which means that all presence updates will sync across all of that user's connections. This means that even when a user opens multiple connections, they will only appear once in `others`.
559
-
560
- ### Patch Changes
561
-
562
- - eb2d903: `PluvRoom` attempts to reconnect immediately after receiving a `close` event, instead of waiting for the reconnect timer. After failing the initial reconnect will the reconnects poll on the timer.
563
- - 555b88d: Fixed the `presence` type of `other` and `others` to equal the inferred presence type.
564
- - @pluv/crdt@0.41.0
565
- - @pluv/types@0.41.0
566
-
567
- ## 0.40.2
568
-
569
- ### Patch Changes
570
-
571
- - 6fbc2fe: Update `PluvClient.createRoom` so that the 2nd parameter is optional.
572
- - @pluv/crdt@0.40.2
573
- - @pluv/types@0.40.2
574
-
575
- ## 0.40.1
576
-
577
- ### Patch Changes
578
-
579
- - @pluv/crdt@0.40.1
580
- - @pluv/types@0.40.1
581
-
582
- ## 0.40.0
583
-
584
- ### Patch Changes
585
-
586
- - @pluv/crdt@0.40.0
587
- - @pluv/types@0.40.0
588
-
589
- ## 0.39.1
590
-
591
- ### Patch Changes
592
-
593
- - @pluv/crdt@0.39.1
594
- - @pluv/types@0.39.1
595
-
596
- ## 0.39.0
597
-
598
- ### Minor Changes
599
-
600
- - e6ddddc: **BREAKING** Moved the `metadata` parameter from the constructor of `PluvRoom` to `PluvClient.connect`. The `metadata` parameter from the constructor of `PluvRoom` is now the validation schema for `metadata` passed through from `PluvClient`.
601
-
602
- This should not be breaking for most users, as the recommended way to enter a room has always been via `PluvClient.enter(room)` (i.e. these are mostly internal-only changes).
603
-
604
- ```ts
605
- // Before
606
- const room = new Room("my-room", { metadata: { hello: "world" } });
607
-
608
- await room.connect();
609
-
610
- // After
611
- const room = new Room("my-room", {
612
- metadata: z.object({ hello: z.string() }),
613
- });
614
-
615
- await room.connect({ metadata: { hello: "world" } });
616
- ```
617
-
618
- - e6ddddc: **BREAKING** Moved the `metadata` parameter from `PluvClient.createRoom` to `PluvClient.enter`.
619
-
620
- ```ts
621
- // Before
622
- const room = client.createRoom({
623
- // ...
624
- metadata: { hello: "world" },
625
- // ...
626
- });
627
-
628
- client.enter(room);
629
-
630
- // After
631
- const room = client.createRoom({
632
- // ...
633
- });
634
-
635
- client.enter(room, { metadata });
636
- ```
637
-
638
- ### Patch Changes
639
-
640
- - e6ddddc: Improved handling of polling-reconnects to `PluvRoom` after the websocket closes (depending on the close event's code).
641
- - 2cfb68d: Add the ability to configure the reconnect timeout (in milliseconds) for a `PluvRoom`, and lowered the default reconnect timeout from 30s to 5s. Values will be automatically clamped to between 1s and 60s.
642
-
643
- ```ts
644
- // Both of these are valid
645
- const room = client.createRoom("my-room", {
646
- // Set timeout to a fixed 10s
647
- reconnectTimeoutMs: 10_000,
648
- });
649
-
650
- const room = client.createRoom("my-room", {
651
- /**
652
- * `attempts` is the count of failed reconnect attempts, starting from 0 on the first attempt.
653
- * The returned value will be how long until the next attempt.
654
- */
655
- reconnectTimeoutMs: ({ attempts }) => {
656
- return 10_000 + 1_000 * Math.pow(2, attempts);
657
- },
658
- });
659
- ```
660
-
661
- - @pluv/crdt@0.39.0
662
- - @pluv/types@0.39.0
663
-
664
- ## 0.38.14
665
-
666
- ### Patch Changes
667
-
668
- - 886a1f9: Fix cases where the user's own presence was getting updated excessively, and without re-triggering subscriptions.
669
- - @pluv/crdt@0.38.14
670
- - @pluv/types@0.38.14
671
-
672
- ## 0.38.13
673
-
674
- ### Patch Changes
675
-
676
- - @pluv/crdt@0.38.13
677
- - @pluv/types@0.38.13
678
-
679
- ## 0.38.12
680
-
681
- ### Patch Changes
682
-
683
- - b617726: Fix broken type narrowing for `PluvRoom.event` and `PluvRoom.broadcast`.
684
- - @pluv/crdt@0.38.12
685
- - @pluv/types@0.38.12
686
-
687
- ## 0.38.11
688
-
689
- ### Patch Changes
690
-
691
- - 5ac1aba: Fix the default `wsEndpoint` parameter (for when `@pluv/platform-pluv` is being used).
692
- - @pluv/crdt@0.38.11
693
- - @pluv/types@0.38.11
694
-
695
- ## 0.38.10
696
-
697
- ### Patch Changes
698
-
699
- - cadd963: Update the user's presence locally only via `PluvRoom.updateMyPresence` (i.e. do not update the user's own presence from WebSocket messages) to avoid update delays. This should fix some cases of "jitter" depending on network latecy.
700
- - @pluv/crdt@0.38.10
701
- - @pluv/types@0.38.10
702
-
703
- ## 0.38.9
704
-
705
- ### Patch Changes
706
-
707
- - @pluv/crdt@0.38.9
708
- - @pluv/types@0.38.9
709
-
710
- ## 0.38.8
711
-
712
- ### Patch Changes
713
-
714
- - @pluv/crdt@0.38.8
715
- - @pluv/types@0.38.8
716
-
717
- ## 0.38.7
718
-
719
- ### Patch Changes
720
-
721
- - @pluv/crdt@0.38.7
722
- - @pluv/types@0.38.7
723
-
724
- ## 0.38.6
725
-
726
- ### Patch Changes
727
-
728
- - @pluv/crdt@0.38.6
729
- - @pluv/types@0.38.6
730
-
731
- ## 0.38.5
732
-
733
- ### Patch Changes
734
-
735
- - @pluv/crdt@0.38.5
736
- - @pluv/types@0.38.5
737
-
738
- ## 0.38.4
739
-
740
- ### Patch Changes
741
-
742
- - @pluv/crdt@0.38.4
743
- - @pluv/types@0.38.4
744
-
745
- ## 0.38.3
746
-
747
- ### Patch Changes
748
-
749
- - 8346273: Disallow the `# @pluv/client character in router event names.
750
- - @pluv/crdt@0.38.3
751
- - @pluv/types@0.38.3
752
-
753
- ## 0.38.2
754
-
755
- ### Patch Changes
756
-
757
- - de35f0b: Require `PluvRouter` event names to be formatted as valid JavaScript variable names.
758
- - @pluv/crdt@0.38.2
759
- - @pluv/types@0.38.2
760
-
761
- ## 0.38.1
762
-
763
- ### Patch Changes
764
-
765
- - @pluv/crdt@0.38.1
766
- - @pluv/types@0.38.1
767
-
768
- ## 0.38.0
769
-
770
- ### Minor Changes
771
-
772
- - f4ceca3: Updated internal event names to follow a new naming convention.
773
-
774
- ### Patch Changes
775
-
776
- - Updated dependencies [f4ceca3]
777
- - @pluv/types@0.38.0
778
- - @pluv/crdt@0.38.0
779
-
780
- ## 0.37.7
781
-
782
- ### Patch Changes
783
-
784
- - @pluv/crdt@0.37.7
785
- - @pluv/types@0.37.7
786
-
787
- ## 0.37.6
788
-
789
- ### Patch Changes
790
-
791
- - @pluv/crdt@0.37.6
792
- - @pluv/types@0.37.6
793
-
794
- ## 0.37.5
795
-
796
- ### Patch Changes
797
-
798
- - @pluv/crdt@0.37.5
799
- - @pluv/types@0.37.5
800
-
801
- ## 0.37.4
802
-
803
- ### Patch Changes
804
-
805
- - a9c3d17: Fix `publicKey` not being properly set on `PluvClient` when `publicKey` is a function.
806
- - @pluv/crdt@0.37.4
807
- - @pluv/types@0.37.4
808
-
809
- ## 0.37.3
810
-
811
- ### Patch Changes
812
-
813
- - 9ae837b: Add missing schema validation for room metadata.
814
- - @pluv/crdt@0.37.3
815
- - @pluv/types@0.37.3
816
-
817
- ## 0.37.2
818
-
819
- ### Patch Changes
820
-
821
- - 11920af: Updated the default `wsEndpoint` for `PluvClient` when `publicKey` is provided to be correct.
822
- - @pluv/crdt@0.37.2
823
- - @pluv/types@0.37.2
824
-
825
- ## 0.37.1
826
-
827
- ### Patch Changes
828
-
829
- - e923a8d: Added support for specifying the `publicKey` param for `createClient` as a function with metadata. This is particularly useful for non-static Next.js applications built with Cloudflare Pages.
830
-
831
- ```ts
832
- import { createClient } from "@pluv/client";
833
- import { z } from "zod";
834
-
835
- export const client = createClient({
836
- // Can be a string
837
- publicKey: "pk_abc123...",
838
-
839
- // Or can be a function
840
- metadata: z.object({
841
- publicKey: z.string().min(1, "Required"),
842
- }),
843
- publicKey: ({ metadata }) => metadata.publicKey,
844
- });
845
- ```
846
-
847
- - @pluv/crdt@0.37.1
848
- - @pluv/types@0.37.1
849
-
850
- ## 0.37.0
851
-
852
- ### Patch Changes
853
-
854
- - @pluv/crdt@0.37.0
855
- - @pluv/types@0.37.0
856
-
857
- ## 0.36.0
858
-
859
- ### Minor Changes
860
-
861
- - 4518b6d: **BREAKING**
862
- Updated how `createClient` infers the `PluvServer` type (again 🙁). The property to specify the type-inferred `PluvServer` type has been renamed to `types` from `infer`. `@pluv/client` now exports a function called `infer` that must now be used to construct the inferred `types` property. `infer` must be called before, and outside of `createClient` due to TypeScript inferrence limitations. See examples below:
863
-
864
- ```ts
865
- // Before
866
-
867
- import { createClient } from "@pluv/client";
868
- import type { ioServer } from "../server/pluv";
869
-
870
- const client = createClient({
871
- // ...
872
- infer: (i) => ({ io: i<typeof ioServer> }),
873
- // ...
874
- });
875
-
876
- // After
877
-
878
- import { createClient, infer } from "@pluv/client";
879
- import type { ioServer } from "../server/pluv";
880
-
881
- // Observe that `types` is initialized outside of `createClient`, instead of
882
- // inline within the `createClient` function.`
883
- const types = infer((i) => ({ io: i<typeof ioServer> }));
884
- const client = createClient({
885
- // ...
886
- // Avoid calling `infer` inline within this function like in the commented
887
- // example below:
888
- // types: infer((i) => ({ io: i<typeof ioServer> })),
889
- types,
890
- // ...
891
- });
892
- ```
893
-
894
- ### Patch Changes
895
-
896
- - @pluv/crdt@0.36.0
897
- - @pluv/types@0.36.0
898
-
899
- ## 0.35.4
900
-
901
- ### Patch Changes
902
-
903
- - @pluv/crdt@0.35.4
904
- - @pluv/types@0.35.4
905
-
906
- ## 0.35.3
907
-
908
- ### Patch Changes
909
-
910
- - @pluv/crdt@0.35.3
911
- - @pluv/types@0.35.3
912
-
913
- ## 0.35.2
914
-
915
- ### Patch Changes
916
-
917
- - Updated dependencies [81cb692]
918
- - @pluv/types@0.35.2
919
- - @pluv/crdt@0.35.2
920
-
921
- ## 0.35.1
922
-
923
- ### Patch Changes
924
-
925
- - @pluv/crdt@0.35.1
926
- - @pluv/types@0.35.1
927
-
928
- ## 0.35.0
929
-
930
- ### Patch Changes
931
-
932
- - @pluv/crdt@0.35.0
933
- - @pluv/types@0.35.0
934
-
935
- ## 0.34.1
936
-
937
- ### Patch Changes
938
-
939
- - @pluv/crdt@0.34.1
940
- - @pluv/types@0.34.1
941
-
942
- ## 0.34.0
943
-
944
- ### Patch Changes
945
-
946
- - @pluv/crdt@0.34.0
947
- - @pluv/types@0.34.0
948
-
949
- ## 0.33.0
950
-
951
- ### Patch Changes
952
-
953
- - @pluv/crdt@0.33.0
954
- - @pluv/types@0.33.0
955
-
956
- ## 0.32.9
957
-
958
- ### Patch Changes
959
-
960
- - @pluv/crdt@0.32.9
961
- - @pluv/types@0.32.9
962
-
963
- ## 0.32.8
964
-
965
- ### Patch Changes
966
-
967
- - @pluv/crdt@0.32.8
968
- - @pluv/types@0.32.8
969
-
970
- ## 0.32.7
971
-
972
- ### Patch Changes
973
-
974
- - @pluv/crdt@0.32.7
975
- - @pluv/types@0.32.7
976
-
977
- ## 0.32.6
978
-
979
- ### Patch Changes
980
-
981
- - @pluv/crdt@0.32.6
982
- - @pluv/types@0.32.6
983
-
984
- ## 0.32.5
985
-
986
- ### Patch Changes
987
-
988
- - @pluv/crdt@0.32.5
989
- - @pluv/types@0.32.5
990
-
991
- ## 0.32.4
992
-
993
- ### Patch Changes
994
-
995
- - @pluv/crdt@0.32.4
996
- - @pluv/types@0.32.4
997
-
998
- ## 0.32.3
999
-
1000
- ### Patch Changes
1001
-
1002
- - b18230f: Add `register` helper to improve client initialization when hosted on pluv.io.
1003
-
1004
- ```ts
1005
- import { createClient, register } from "@pluv/client";
1006
- import type { ioServer } from "./server";
1007
-
1008
- const client = createClient({
1009
- infer: (i) => ({ io: i<typeof ioServer> }),
1010
- // This includes `wsEndpoint` and therefore should no-longer be manually provided
1011
- ...register({
1012
- // `authEndpoint` and `publicKey` are now required
1013
- authEndpoint: ({ room }) => `${process.env.API_URL}/api/room?room=${room}`,
1014
- publicKey: "pk_...",
1015
- }),
1016
- });
1017
- ```
1018
-
1019
- - @pluv/crdt@0.32.3
1020
- - @pluv/types@0.32.3
1021
-
1022
- ## 0.32.2
1023
-
1024
- ### Patch Changes
1025
-
1026
- - @pluv/crdt@0.32.2
1027
- - @pluv/types@0.32.2
1028
-
1029
- ## 0.32.1
1030
-
1031
- ### Patch Changes
1032
-
1033
- - @pluv/crdt@0.32.1
1034
- - @pluv/types@0.32.1
1035
-
1036
- ## 0.32.0
1037
-
1038
- ### Patch Changes
1039
-
1040
- - @pluv/crdt@0.32.0
1041
- - @pluv/types@0.32.0
1042
-
1043
- ## 0.31.0
1044
-
1045
- ### Patch Changes
1046
-
1047
- - @pluv/crdt@0.31.0
1048
- - @pluv/types@0.31.0
1049
-
1050
- ## 0.30.2
1051
-
1052
- ### Patch Changes
1053
-
1054
- - @pluv/crdt@0.30.2
1055
- - @pluv/types@0.30.2
1056
-
1057
- ## 0.30.1
1058
-
1059
- ### Patch Changes
1060
-
1061
- - @pluv/crdt@0.30.1
1062
- - @pluv/types@0.30.1
1063
-
1064
- ## 0.30.0
1065
-
1066
- ### Patch Changes
1067
-
1068
- - cff933a: Add `publicKey` property to `createClient` for later usage ;)
1069
- - @pluv/crdt@0.30.0
1070
- - @pluv/types@0.30.0
1071
-
1072
- ## 0.29.0
1073
-
1074
- ### Patch Changes
1075
-
1076
- - @pluv/crdt@0.29.0
1077
- - @pluv/types@0.29.0
1078
-
1079
- ## 0.28.0
1080
-
1081
- ### Patch Changes
1082
-
1083
- - @pluv/crdt@0.28.0
1084
- - @pluv/types@0.28.0
1085
-
1086
- ## 0.27.0
1087
-
1088
- ### Minor Changes
1089
-
1090
- - 19ed36c: **BREAKNG**
1091
-
1092
- Updated `createClient` and `PluvClient.createRoom` object params to better support automatic type inference.
1093
-
1094
- ```ts
1095
- // Before
1096
- import { createClient } from "@pluv/client";
1097
- import { yjs } from "@pluv/crdt-yjs";
1098
- import { z } from "zod";
1099
- import type { ioServer } from "./server/ioServer";
1100
-
1101
- const client = createClient<typeof ioServer>({
1102
- authEndpoint: ({ room }) => "MY_AUTH_URL",
1103
- wsEndpoint: ({ room }) => "MY_WEBSOCKET_URL",
1104
- });
1105
-
1106
- client.createRoom("my-example-room", {
1107
- presence: z.object({
1108
- selectionId: z.string().nullish(),
1109
- }),
1110
- initialPresence: {
1111
- selectionId: null,
1112
- },
1113
- initialStorage: yjs.doc(() => ({
1114
- messages: yjs.array<string>([]),
1115
- })),
1116
- });
1117
-
1118
- // After
1119
- const client = createClient({
1120
- authEndpoint: ({ room }) => "MY_AUTH_URL",
1121
- wsEndpoint: ({ room }) => "MY_WEBSOCKET_URL",
1122
- /**
1123
- * @description The ioServer type now needs to be inferred on this property
1124
- * instead of within the generic on `createClient`. This is because of
1125
- * limitations with TypeScript not yet supporting partial type-inference
1126
- * for generics. Ensure to no-loonger include any generics on `createClient`
1127
- */
1128
- infer: (i) => ({ io: i<typeof ioServer> }),
1129
- // Now moved to `createClient` from `PluvClient.createRoom`
1130
- presence: z.object({
1131
- selectionId: z.string().nullish(),
1132
- }),
1133
- /**
1134
- * @description Now added to `createClient` to specify defaults for all
1135
- * rooms, and to infer types for storage. This value will be overwritten by
1136
- * `PluvClient.createRoom`.
1137
- */
1138
- initialStorage: yjs.doc(() => ({
1139
- messages: yjs.array<string>([]),
1140
- })),
1141
- });
1142
-
1143
- const room = client.createRoom("my-example-room", {
1144
- initialPresence: {
1145
- selectionId: null,
1146
- },
1147
- initialStorage: yjs.doc(() => ({
1148
- messages: yjs.array<string>([]),
1149
- })),
1150
- });
1151
- ```
1152
-
1153
- ### Patch Changes
1154
-
1155
- - 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.
1156
-
1157
- ```ts
1158
- // Backend Server
1159
- import { createIO } from "@pluv/io";
1160
-
1161
- const io = createIO({
1162
- /* ... */
1163
- });
1164
- const ioServer = io.server({
1165
- router: io.router({
1166
- multiply2: io.procedure
1167
- .input(z.object({ value: z.number() }))
1168
- .broadcast(({ value }) => ({
1169
- multiplied2: { value: value * 2 },
1170
- })),
1171
- }),
1172
- });
1173
-
1174
- // Frontend Client
1175
- import { createClient } from "@pluv/client";
1176
-
1177
- const io = createClient({
1178
- /* ... */
1179
- });
1180
-
1181
- const room = io.createRoom("my-example-room", {
1182
- // ...
1183
- router: io.router({
1184
- add5: io.procedure.input(z.object({ value: z.number() })).broadcast(({ value }) => ({
1185
- /**
1186
- * @description Because `ioServer` does not specify `added5`,
1187
- * this will be forwarded to connected peers.
1188
- */
1189
- added5: { value: value + 5 },
1190
- })),
1191
- /**
1192
- * @description This is possible, but not recommended to do. Because
1193
- * `multiply2` is a procedure on `ioServer`, this will trigger the
1194
- * `multiply2` procedure on `ioServer`. Connected peers will not
1195
- * receive `multiply2`, but rather `multipled2`.
1196
- */
1197
- subtract5Multiply2: io.procedure
1198
- .input(z.object({ value: z.number() }))
1199
- .broadcast(({ value }) => ({
1200
- multiply2: { value: value - 5 },
1201
- })),
1202
- }),
1203
- });
1204
- ```
1205
-
1206
- - @pluv/crdt@0.27.0
1207
- - @pluv/types@0.27.0
1208
-
1209
- ## 0.26.0
1210
-
1211
- ### Minor Changes
1212
-
1213
- - 19e5dda: **BREAKING**
1214
- Update `authEndpoint` and `wsEndpoint` to now use a parameterized object that passes through additional data via a `metadata` property.
1215
-
1216
- ```tsx
1217
- // Before
1218
-
1219
- import { env } from "./env";
1220
- import type { ioServer } from "./server";
1221
-
1222
- const client = createClient<typeof ioServer>({
1223
- authEndpoint: (room: string) => `${env.API_URL}}/room/${room}`,
1224
- wsEndpoint: (room: string) => `${env.WS_URL}/room/${room}`,
1225
- });
1226
-
1227
- // After
1228
-
1229
- const client = createClient<
1230
- typeof ioServer,
1231
- // Optional: You can specify types for metadata here. This is useful for Cloudflare Pages
1232
- { apiUrl: string; wsUrl: string }
1233
- >({
1234
- authEndpoint: ({ metadata, room }) => `${metadata.apiUrl}}/room/${room}`,
1235
- wsEndpoint: ({ metadata, room }) => `${{ metadata.wsUrl }}/room/${room}`,
1236
- });
1237
-
1238
- client.createRoom("my-room", {
1239
- // This property exists when the `metadata` generic type is defined above
1240
- metadata: {
1241
- apiUrl: "https://example.com/api",
1242
- wsUrl: "wss://example.com/api",
1243
- },
1244
- // ...
1245
- });
1246
-
1247
- <PluvRoomProvider
1248
- // This property exists when the `metadata` generic type is defined above
1249
- metadata={{
1250
- apiUrl: "https://example.com/api",
1251
- wsUrl: "wss://example.com/api",
1252
- }}
1253
- >
1254
- {/* ... */}
1255
- </PluvRoomProvider>
1256
- ```
1257
-
1258
- ### Patch Changes
1259
-
1260
- - @pluv/crdt@0.26.0
1261
- - @pluv/types@0.26.0
1262
-
1263
- ## 0.25.4
1264
-
1265
- ### Patch Changes
1266
-
1267
- - @pluv/crdt@0.25.4
1268
- - @pluv/types@0.25.4
1269
-
1270
- ## 0.25.3
1271
-
1272
- ### Patch Changes
1273
-
1274
- - @pluv/crdt@0.25.3
1275
- - @pluv/types@0.25.3
1276
-
1277
- ## 0.25.2
1278
-
1279
- ### Patch Changes
1280
-
1281
- - @pluv/crdt@0.25.2
1282
- - @pluv/types@0.25.2
1283
-
1284
- ## 0.25.1
1285
-
1286
- ### Patch Changes
1287
-
1288
- - @pluv/crdt@0.25.1
1289
- - @pluv/types@0.25.1
1290
-
1291
- ## 0.25.0
1292
-
1293
- ### Patch Changes
1294
-
1295
- - @pluv/crdt@0.25.0
1296
- - @pluv/types@0.25.0
1297
-
1298
- ## 0.24.1
1299
-
1300
- ### Patch Changes
1301
-
1302
- - ba299e2: Fixed "others" state in the PluvClient not getting cleared when the user's websocket connection is closed, creating "ghost users" during some reconnects.
1303
- - @pluv/crdt@0.24.1
1304
- - @pluv/types@0.24.1
1305
-
1306
- ## 0.24.0
1307
-
1308
- ### Patch Changes
1309
-
1310
- - @pluv/crdt@0.24.0
1311
- - @pluv/types@0.24.0
1312
-
1313
- ## 0.23.0
1314
-
1315
- ### Patch Changes
1316
-
1317
- - @pluv/crdt@0.23.0
1318
- - @pluv/types@0.23.0
1319
-
1320
- ## 0.22.0
1321
-
1322
- ### Patch Changes
1323
-
1324
- - @pluv/crdt@0.22.0
1325
- - @pluv/types@0.22.0
1326
-
1327
- ## 0.21.1
1328
-
1329
- ### Patch Changes
1330
-
1331
- - @pluv/crdt@0.21.1
1332
- - @pluv/types@0.21.1
1333
-
1334
- ## 0.21.0
1335
-
1336
- ### Minor Changes
1337
-
1338
- - b98ab6b: Internal updates to platforms (i.e. `@pluv/platform-cloudflare` and `@pluv/platform-node`) to be able to support Cloudflare Worker Websocket Hibernation APIs.
1339
-
1340
- ### Patch Changes
1341
-
1342
- - @pluv/crdt@0.21.0
1343
- - @pluv/types@0.21.0
1344
-
1345
- ## 0.20.0
1346
-
1347
- ### Minor Changes
1348
-
1349
- - 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.
1350
-
1351
- 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.
1352
-
1353
- 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.
1354
-
1355
- ```ts
1356
- // Before
1357
-
1358
- import { yjs } from "@pluv/crdt-yjs";
1359
-
1360
- yjs.array([]); // Returns CrdtYjsArray
1361
- yjs.object([]); // Returns CrdtYjsObject
1362
-
1363
- const room: PluvRoom = /* ... */;
1364
-
1365
- room.getStorage("messages"); // Returns AbstractCrdtType
1366
-
1367
- const [, sharedType] = useStorage("messages"); // sharedType is an AbstractCrdtType
1368
- ```
1369
-
1370
- ```ts
1371
- // Now
1372
-
1373
- import { yjs } from "@pluv/crdt-yjs";
1374
-
1375
- yjs.array([]); // Returns yjs.Array
1376
- yjs.object([]); // Returns yjs.Map
1377
-
1378
- const room: PluvRoom = /* ... */;
1379
-
1380
- room.getStorage("messages"); // Returns yjs.AbstractType
1381
-
1382
- const [, sharedType] = useStorage("messages"); // sharedType is a yjs.AbstractType
1383
- ```
1384
-
1385
- 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:
1386
-
1387
- ```ts
1388
- // Before
1389
-
1390
- const [data, container] = useStorage("messages");
1391
-
1392
- // This automatically called Loro.commit under the hood and rerendered the page with updated data.
1393
- container.push(loro.object({ name: "John Doe", age: 35 }));
1394
- ```
1395
-
1396
- ```ts
1397
- // Now
1398
-
1399
- const [data, container] = useStorage("messages");
1400
-
1401
- const doc = useDoc();
1402
- const transact = useTransact();
1403
-
1404
- // Updates need to be committed back to the doc whenever the changes need to be emitted to other users
1405
- // The returned data also will not update until the changes are commited
1406
-
1407
- // The two operations below are functionally equivalent
1408
- transact(() => {
1409
- container.push(loro.object({ name: "John Doe", age: 35 }));
1410
- });
1411
-
1412
- container.push(loro.object({ name: "John Doe", age: 35 }));
1413
- doc.value.commit();
1414
- ```
1415
-
1416
- ### Patch Changes
1417
-
1418
- - Updated dependencies [9492085]
1419
- - @pluv/crdt@0.20.0
1420
- - @pluv/types@0.20.0
1421
-
1422
- ## 0.19.0
1423
-
1424
- ### Patch Changes
1425
-
1426
- - 137444b: Updated PluvRoom.updateMyPresence to allow passing in a callback function that exposes the previous presence value and returns a presence update.
1427
-
1428
- ```ts
1429
- type Presence = {
1430
- selectionId: string | null;
1431
- };
1432
-
1433
- const room: PluvRoom = /* ... */;
1434
- const newSelectionId: string | null = /* ... */;
1435
-
1436
- room.updateMyPresence({ selectionId: newSelection });
1437
-
1438
- // You can reference the previous presence and return a new presence based on it
1439
- room.updateMyPresence((previousPresence) => ({ selectionId: newSelection ?? previousPresence.selectionId }));
1440
- ```
1441
-
1442
- - f5e4370: Fix others' presence not getting tracked in PluvRoom when the user is unauthorized.
1443
- - @pluv/crdt@0.19.0
1444
- - @pluv/types@0.19.0
1445
-
1446
- ## 0.18.0
1447
-
1448
- ### Minor Changes
1449
-
1450
- - 99b5ca9: ## Breaking Changes
1451
- - `@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.
1452
-
1453
- ### Before:
1454
-
1455
- ```ts
1456
- // backend/io.ts
1457
-
1458
- import { createIO } from "@pluv/io";
1459
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
1460
- import { z } from "zod";
1461
-
1462
- export const io = createIO({
1463
- platform: platformNode(),
1464
- })
1465
- .event("SEND_MESSAGE", {
1466
- input: z.object({ message: z.string() }),
1467
- resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
1468
- })
1469
- .event("DOUBLE_VALUE", {
1470
- input: z.object({ value: z.number() }),
1471
- resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
1472
- });
1473
-
1474
- const Pluv = createPluvHandler({
1475
- io,
1476
- /* ... */
1477
- });
1478
- ```
1479
-
1480
- ```ts
1481
- // frontend/pluv.ts
1482
-
1483
- import { createClient } from "@pluv/react";
1484
- import type { io } from "../backend/io";
1485
-
1486
- const client = createClient<typeof io>({
1487
- /* ... */
1488
- });
1489
- ```
1490
-
1491
- ### Now:
1492
-
1493
- ```ts
1494
- import { createIO } from "@pluv/io";
1495
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
1496
- import { z } from "zod";
1497
-
1498
- const io = createIO({
1499
- platform: platformNode(),
1500
- });
1501
-
1502
- const router = io.router({
1503
- SEND_MESSAGE: io.procedure
1504
- .input(z.object({ message: z.string() }))
1505
- .broadcast(({ message }) => ({
1506
- RECEIVE_MESSAGE: { message },
1507
- })),
1508
- DOUBLE_VALUE: io.procedure
1509
- .input(z.object({ value: z.number() }))
1510
- .broadcast(({ value }) => ({
1511
- VALUE_DOUBLED: { value: value * 2 },
1512
- })),
1513
- });
1514
-
1515
- export const ioServer = io.server({ router });
1516
-
1517
- const Pluv = createPluvHandler({
1518
- io: ioServer, // <- This uses the PluvServer now
1519
- /* ... */
1520
- });
1521
- ```
1522
-
1523
- ```ts
1524
- // frontend/pluv.ts
1525
-
1526
- import { createClient } from "@pluv/react";
1527
- import type { ioServer } from "../backend/io";
1528
-
1529
- // This users the PluvServer type now
1530
- const client = createClient<typeof ioServer>({
1531
- /* ... */
1532
- });
1533
- ```
1534
-
1535
- - `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:
1536
-
1537
- ```ts
1538
- const router = io.mergeRouters(router1, router2);
1539
- ```
1540
-
1541
- ### Patch Changes
1542
-
1543
- - 06c67be: Added broadcast proxy as a new way to broadcast events.
1544
-
1545
- ```ts
1546
- // backend
1547
-
1548
- const router = io.router({
1549
- SEND_MESSAGE: io.procedure
1550
- .input(z.object({ message: z.string() }))
1551
- .broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
1552
- });
1553
-
1554
- // frontend
1555
- const client = createClient(/* ... */);
1556
-
1557
- // Both of the examples below are equivalent.
1558
-
1559
- client.broadcast("SEND_MESSAGE", { message: "Hello world~!" });
1560
-
1561
- client.broadcast.SEND_MESSAGE({ message: "Hello world~!" });
1562
- ```
1563
-
1564
- - df1342c: Added event proxy as a new way to listen to events.
1565
-
1566
- ```ts
1567
- // backend
1568
-
1569
- const router = io.router({
1570
- SEND_MESSAGE: io.procedure
1571
- .input(z.object({ message: z.string() }))
1572
- .broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
1573
- });
1574
-
1575
- // frontend
1576
- const client = createClient(/* ... */);
1577
-
1578
- // Both of the examples below are equivalent.
1579
-
1580
- client.event("RECEIVE_MESSAGE", ({ data }) => {
1581
- const { message } = data;
1582
-
1583
- console.log(message);
1584
- });
1585
-
1586
- client.event.RECEIVE_MESSAGE(({ data }) => {
1587
- const { message } = data;
1588
-
1589
- console.log(message);
1590
- });
1591
- ```
1592
-
1593
- - Updated dependencies [99b5ca9]
1594
- - @pluv/types@0.18.0
1595
- - @pluv/crdt@0.18.0
1596
-
1597
- ## 0.17.3
1598
-
1599
- ### Patch Changes
1600
-
1601
- - @pluv/crdt@0.17.3
1602
- - @pluv/types@0.17.3
1603
-
1604
- ## 0.17.2
1605
-
1606
- ### Patch Changes
1607
-
1608
- - @pluv/crdt@0.17.2
1609
- - @pluv/types@0.17.2
1610
-
1611
- ## 0.17.1
1612
-
1613
- ### Patch Changes
1614
-
1615
- - @pluv/crdt@0.17.1
1616
- - @pluv/types@0.17.1
1617
-
1618
- ## 0.17.0
1619
-
1620
- ### Patch Changes
1621
-
1622
- - Updated dependencies [507bc00]
1623
- - @pluv/types@0.17.0
1624
- - @pluv/crdt@0.17.0
1625
-
1626
- ## 0.16.3
1627
-
1628
- ### Patch Changes
1629
-
1630
- - @pluv/crdt@0.16.3
1631
- - @pluv/types@0.16.3
1632
-
1633
- ## 0.16.2
1634
-
1635
- ### Patch Changes
1636
-
1637
- - @pluv/crdt@0.16.2
1638
- - @pluv/types@0.16.2
1639
-
1640
- ## 0.16.1
1641
-
1642
- ### Patch Changes
1643
-
1644
- - @pluv/crdt@0.16.1
1645
- - @pluv/types@0.16.1
1646
-
1647
- ## 0.16.0
1648
-
1649
- ### Minor Changes
1650
-
1651
- - 4280220: ## Breaking Changes
1652
- - Storage types are now kept on the root of the document.
1653
- - 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.
1654
- - `@pluv/client` and `@pluv/react` no-longer re-export `@pluv/crdt-yjs`. This package will now need to be installed separately.
1655
-
1656
- ```bash
1657
- # if installing @pluv/client
1658
- npm install @pluv/client @pluv/crdt-yjs
1659
- # if installing @pluv/react
1660
- npm install @pluv/react @pluv/crdt-yjs
1661
- ```
1662
-
1663
- ```ts
1664
- // Before:
1665
- import { createClient, y } from "@pluv/client";
1666
- // After:
1667
- import { createClient } from "@pluv/client";
1668
- import { yjs } from "@pluv/crdt-yjs"; // y renamed to yjs
1669
- ```
1670
-
1671
- - The `y` import has been renamed to `yjs`.
1672
- ```ts
1673
- // Before:
1674
- import { y } from "@pluv/crdt-yjs";
1675
- // After:
1676
- import { yjs } from "@pluv/crdt-yjs";
1677
- ```
1678
- - `@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`.
1679
-
1680
- ```ts
1681
- // Before:
1682
- import { y } from "@pluv/crdt-yjs";
1683
- import type { Array as YArray, Map as YMap } from "yjs";
1684
-
1685
- const array: YArray<YMap<{ message: string }>> = y.array([y.object({ message: "Hello" })]);
1686
-
1687
- array.push([y.object({ message: "World!" })]);
1688
-
1689
- // After:
1690
- import type { CrdtYjsArray, CrdtYjsObject } from "@pluv/crdt-yjs";
1691
- import { yjs } from "@pluv/crdt-yjs";
1692
- import type { Array as YArray } from "yjs";
1693
-
1694
- const array: CrdtYjsArray<CrdtYjsObject<{ message: string }>> = yjs.array([
1695
- yjs.object({ message: "Hello" }),
1696
- ]);
1697
-
1698
- array.push(yjs.object({ message: "World!" }));
1699
-
1700
- // use .value to get the underlying yjs type
1701
- const yarray: YArray<YMap<{ message: string }>> = array.value;
1702
- ```
1703
-
1704
- - `initialStorage` must now use the `doc` function from `@pluv/crdt-yjs` to be defined. This also affects `@pluv/react`.
1705
-
1706
- ```ts
1707
- // Before:
1708
- import { createClient, y } from "@pluv/client";
1709
-
1710
- const client = createClient({
1711
- /* ... */
1712
- });
1713
-
1714
- client.createRoom({
1715
- // ...
1716
- initialStorage: () => ({
1717
- messages: y.array([y.object({ message: "Hello world!" })]),
1718
- }),
1719
- });
1720
-
1721
- // After:
1722
- import { createClient } from "@pluv/client";
1723
- // This is now imported separately
1724
- import { yjs } from "@pluv/crdt-yjs";
1725
-
1726
- const client = createClient({
1727
- /* ... */
1728
- });
1729
-
1730
- client.createRoom({
1731
- // ...
1732
- initialStorage: yjs.doc(() => ({
1733
- messages: yjs.array([yjs.object({ message: "Hello world!" })]),
1734
- })),
1735
- });
1736
- ```
1737
-
1738
- - `@pluv/client` can now instead use [loro](https://github.com/loro-dev/loro) instead of [yjs](https://github.com/yjs/yjs).
1739
- ```bash
1740
- npm install @pluv/client @pluv/crdt-loro loro-crdt
1741
- ```
1742
- - 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.
1743
-
1744
- ```ts
1745
- import { loro } from "@pluv/crdt-loro";
1746
- import { yjs } from "@pluv/crdt-yjs";
1747
- import { createIO } from "@pluv/io";
1748
-
1749
- const io = createIO({
1750
- // ...
1751
- // If using loro
1752
- crdt: loro,
1753
- // If using yjs
1754
- crdt: yjs,
1755
- });
1756
- ```
1757
-
1758
- - `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`.
1759
-
1760
- ```ts
1761
- // Before:
1762
- import { Doc as YDoc } from "yjs";
1763
-
1764
- const room: PluvRoom = client.createRoom({
1765
- /* ... */
1766
- });
1767
-
1768
- const doc: YDoc = room.getDoc();
1769
-
1770
- // After:
1771
- import { CrdtYjsDoc } from "@pluv/crdt-yjs";
1772
- import { Doc as YDoc } from "yjs";
1773
-
1774
- const room: PluvRoom = client.createRoom({
1775
- /* ... */
1776
- });
1777
-
1778
- const doc: CrdtYjsDoc<any> = room.getDoc();
1779
- const ydoc: YDoc = doc.value;
1780
- ```
1781
-
1782
- - `@pluv/client` and `@pluv/react` now may return `null` when retrieving storage while storage is being initialized.
1783
-
1784
- ```ts
1785
- const sharedType = room.getStorage("messages"); // This may be null
1786
-
1787
- const [data, sharedType] = useStorage("messages"); // data and sharedType may both be null
1788
- ```
1789
-
1790
- ### Patch Changes
1791
-
1792
- - @pluv/crdt@0.16.0
1793
- - @pluv/types@0.16.0
1794
-
1795
- ## 0.15.0
1796
-
1797
- ### Patch Changes
1798
-
1799
- - @pluv/crdt-yjs@0.15.0
1800
- - @pluv/types@0.15.0
1801
-
1802
- ## 0.14.1
1803
-
1804
- ### Patch Changes
1805
-
1806
- - @pluv/crdt-yjs@0.14.1
1807
- - @pluv/types@0.14.1
1808
-
1809
- ## 0.14.0
1810
-
1811
- ### Patch Changes
1812
-
1813
- - @pluv/crdt-yjs@0.14.0
1814
- - @pluv/types@0.14.0
1815
-
1816
- ## 0.13.0
1817
-
1818
- ### Minor Changes
1819
-
1820
- - 1126215: Added `getDoc` on `PluvRoom` to access the root Yjs doc.
1821
-
1822
- ```ts
1823
- import { createClient } from "@pluv/client";
1824
- import type { Doc } from "yjs";
1825
-
1826
- const client = createClient(/* ... */);
1827
- const room = client.createRoom(/* ... */);
1828
-
1829
- const doc: Doc = room.getDoc();
1830
- ```
1831
-
1832
- ### Patch Changes
1833
-
1834
- - @pluv/crdt-yjs@0.13.0
1835
- - @pluv/types@0.13.0
1836
-
1837
- ## 0.12.3
1838
-
1839
- ### Patch Changes
1840
-
1841
- - da9f600: Upgraded dependencies
1842
- - Updated dependencies [da9f600]
1843
- - @pluv/crdt-yjs@0.12.3
1844
- - @pluv/types@0.12.3
1845
-
1846
- ## 0.12.2
1847
-
1848
- ### Patch Changes
1849
-
1850
- - 259a7da: Bumped dependencies
1851
-
1852
- ## 0.12.1
1853
-
1854
- ### Patch Changes
1855
-
1856
- - cae08aa: Updated storage from `getStorage` to never return null
1857
- - @pluv/crdt-yjs@0.12.1
1858
- - @pluv/types@0.12.1
1859
-
1860
- ## 0.12.0
1861
-
1862
- ### Minor Changes
1863
-
1864
- - 436040b: Added ability to undo and redo changes to storage.
1865
-
1866
- ## @pluv/crdt-yjs
1867
-
1868
- `@pluv/crdt-yjs` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `trackOrigins`.
1869
-
1870
- Refer to the code-example below to better understand how to undo and redo with your doc.
1871
-
1872
- ```ts
1873
- // Example
1874
- import { array, doc } from "@pluv/crdt-yjs";
1875
-
1876
- // Create your doc with your shared-types
1877
- const myDoc = doc({
1878
- messages: array<string>([]),
1879
- });
1880
-
1881
- /**
1882
- * @description Track origins to enable undos and redos for your document.
1883
- * trackOrigins must be called before any storage mutations, to enable those
1884
- * mutations to be undone/redone.
1885
- */
1886
- myDoc.trackOrigins({
1887
- /**
1888
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
1889
- * This specifies a number in ms, during which edits are merged together to be
1890
- * undone together. Set this to 0, to track each transacted change individually.
1891
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1892
- * @default 500
1893
- */
1894
- captureTimeout: 500,
1895
- /**
1896
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1897
- * This specifies transaction origins (strings only) to filter which transactions
1898
- * can be undone.
1899
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1900
- * @default undefined
1901
- */
1902
- trackedOrigins: ["user-123"],
1903
- });
1904
-
1905
- /**
1906
- * @description Check whether calling undo will mutate storage
1907
- * @returns boolean
1908
- */
1909
- myDoc.canUndo();
1910
- /**
1911
- * @description Check whether calling redo will mutate storage
1912
- * @returns boolean
1913
- */
1914
- myDoc.canRedo();
1915
-
1916
- // Perform a storage mutation within a transaction so that it can be affected
1917
- // by undo/redo operations.
1918
- myDoc.transact(() => {
1919
- myDoc.get("messages").push(["hello world!"]);
1920
- }, "user-123");
1921
-
1922
- /**
1923
- * @description Undoes the last valid mutation to storage
1924
- */
1925
- myDoc.undo();
1926
-
1927
- /**
1928
- * @description Re-applies the last undone mutation to storage
1929
- */
1930
- myDoc.redo();
1931
- ```
1932
-
1933
- ## @pluv/client
1934
-
1935
- `@pluv/client`'s `PluvRoom` and `MockedRoom` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `transact`.
1936
-
1937
- Refer to the code-example below to better understand how to undo and redo with your `PluvRoom`.
1938
-
1939
- ```ts
1940
- import { createClient, y } from "@pluv/client";
1941
-
1942
- const client = createClient({});
1943
-
1944
- /**
1945
- * @description When a room is created, undo/redo will automatically
1946
- * be configured to filter for changes made by the connected user
1947
- * (so that users only undo/redo their changes).
1948
- */
1949
- const room = client.createRoom("my-room", {
1950
- initialStorage: () => ({
1951
- messages: y.array<string>([]),
1952
- }),
1953
- /**
1954
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
1955
- * This specifies a number in ms, during which edits are merged together to be
1956
- * undone together. Set this to 0, to track each transacted change individually.
1957
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1958
- * @default 500
1959
- */
1960
- captureTimeout: 500,
1961
- /**
1962
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1963
- * This specifies transaction origins (strings only) to filter which transactions
1964
- * can be undone.
1965
- * When omitted, the user's connection id will be tracked. When provided,
1966
- * specifies additional tracked origins besides the user's connection id.
1967
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1968
- * @default undefined
1969
- */
1970
- trackedOrigins: ["user-123"],
1971
- });
1972
-
1973
- /**
1974
- * @description Check whether calling undo will mutate storage
1975
- * @returns boolean
1976
- */
1977
- room.canUndo();
1978
- /**
1979
- * @description Check whether calling redo will mutate storage
1980
- * @returns boolean
1981
- */
1982
- room.canRedo();
1983
-
1984
- /**
1985
- * @description Calling transact will enable a storage mutation to be undone/redone.
1986
- * When called without an origin, the origin will default to the user's connection
1987
- * id.
1988
- *
1989
- * You can specify a 2nd parameter to transact with a different transaction origin.
1990
- */
1991
- room.transact(() => {
1992
- room.get("messages").push(["hello world!"]);
1993
- });
1994
-
1995
- // This will also be undoable because `"user-123"` is a tracked origin.
1996
- room.transact(() => {
1997
- room.get("messages").push(["hello world!"]);
1998
- }, "user-123");
1999
-
2000
- /**
2001
- * @description Undoes the last valid mutation to storage
2002
- */
2003
- room.undo();
2004
-
2005
- /**
2006
- * @description Re-applies the last undone mutation to storage
2007
- */
2008
- room.redo();
2009
- ```
2010
-
2011
- ## @pluv/react
2012
-
2013
- `@pluv/react`'s `createRoomBundle` now exposes 5 new react hooks: `useCanRedo`, `useCanUndo`, `useRedo`, `useUndo` and `useTransact`.
2014
-
2015
- Refer to the code-example below to better understand how to undo and redo with your `createRoomBundle`.
2016
-
2017
- ```tsx
2018
- import { createBundle, createClient, y } from "@pluv/react";
2019
- import { type io } from "./io";
2020
-
2021
- const client = createClient<typeof io>();
2022
-
2023
- const { createRoomBundle } = createBundle(client);
2024
-
2025
- const { useCanRedo, useCanUndo, useRedo, useStorage, useTransact, useUndo } = createRoomBundle({
2026
- initialStorage: () => ({
2027
- messages: y.array<string>([]),
2028
- }),
2029
- /**
2030
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
2031
- * This specifies a number in ms, during which edits are merged together to be
2032
- * undone together. Set this to 0, to track each transacted change individually.
2033
- * @see (@link https://docs.yjs.dev/api/undo-manager)
2034
- * @default 500
2035
- */
2036
- captureTimeout: 500,
2037
- /**
2038
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
2039
- * This specifies transaction origins (strings only) to filter which transactions
2040
- * can be undone.
2041
- * When omitted, the user's connection id will be tracked. When provided,
2042
- * specifies additional tracked origins besides the user's connection id.
2043
- * @see (@link https://docs.yjs.dev/api/undo-manager)
2044
- * @default undefined
2045
- */
2046
- trackedOrigins: ["user-123"],
2047
- });
2048
-
2049
- /**
2050
- * @description Check whether calling undo will mutate storage
2051
- */
2052
- const canUndo: boolean = useCanUndo();
2053
- /**
2054
- * @description Check whether calling redo will mutate storage
2055
- */
2056
- const canRedo: boolean = useCanRedo();
2057
-
2058
- const [messages, sharedType] = useStorage("messages");
2059
-
2060
- /**
2061
- * @description Calling transact will enable a storage mutation to be undone/redone.
2062
- * When called without an origin, the origin will default to the user's connection
2063
- * id.
2064
- *
2065
- * You can specify a 2nd parameter to transact with a different transaction origin.
2066
- */
2067
- const transact = useTransact();
2068
-
2069
- transact(() => {
2070
- sharedType.push(["hello world!"]);
2071
- });
2072
-
2073
- // This will also be undoable because `"user-123"` is a tracked origin.
2074
- transact(() => {
2075
- sharedType.push(["hello world!"]);
2076
- }, "user-123");
2077
-
2078
- /**
2079
- * @description Undoes the last valid mutation to storage
2080
- */
2081
- const undo = useUndo();
2082
-
2083
- undo();
2084
-
2085
- /**
2086
- * @description Re-applies the last undone mutation to storage
2087
- */
2088
- const redo = useRedo();
2089
-
2090
- redo();
2091
- ```
2092
-
2093
- ### Patch Changes
2094
-
2095
- - Updated dependencies [436040b]
2096
- - @pluv/crdt-yjs@0.12.0
2097
- - @pluv/types@0.12.0
2098
-
2099
- ## 0.11.1
2100
-
2101
- ### Patch Changes
2102
-
2103
- - 74b3061: Bumped minor and patch dependencies.
2104
- - Updated dependencies [74b3061]
2105
- - @pluv/crdt-yjs@0.11.1
2106
- - @pluv/types@0.11.1
2107
-
2108
- ## 0.11.0
2109
-
2110
- ### Patch Changes
2111
-
2112
- - @pluv/crdt-yjs@0.11.0
2113
- - @pluv/types@0.11.0
2114
-
2115
- ## 0.10.3
2116
-
2117
- ### Patch Changes
2118
-
2119
- - @pluv/crdt-yjs@0.10.3
2120
- - @pluv/types@0.10.3
2121
-
2122
- ## 0.10.2
2123
-
2124
- ### Patch Changes
2125
-
2126
- - @pluv/crdt-yjs@0.10.2
2127
- - @pluv/types@0.10.2
2128
-
2129
- ## 0.10.1
2130
-
2131
- ### Patch Changes
2132
-
2133
- - 885835d: remove unnecessary dependency
2134
- - Updated dependencies [885835d]
2135
- - @pluv/crdt-yjs@0.10.1
2136
- - @pluv/types@0.10.1
2137
-
2138
- ## 0.10.0
2139
-
2140
- ### Minor Changes
2141
-
2142
- - f43f1cc: Change packages to all be versioned together for consistency.
2143
-
2144
- ### Patch Changes
2145
-
2146
- - Updated dependencies [f43f1cc]
2147
- - @pluv/crdt-yjs@0.10.0
2148
- - @pluv/types@0.10.0
2149
-
2150
- ## 0.9.2
2151
-
2152
- ### Patch Changes
2153
-
2154
- - f4317ba: \* Renamed type `unstable_YObjectValue` to `YObjectValue`;
2155
- - Renamed type `unstable_YObject` to `YObject`.
2156
- - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
2157
-
2158
- ```ts
2159
- import { y } from "@pluv/client";
2160
- // or
2161
- import { y } from "@pluv/react";
2162
-
2163
- y.xmlElement("MyElement", {});
2164
- y.xmlFragment({});
2165
- y.xmlText("hello world");
2166
- ```
2167
-
2168
- - Updated dependencies [f4317ba]
2169
- - @pluv/crdt-yjs@0.4.2
2170
-
2171
- ## 0.9.1
2172
-
2173
- ### Patch Changes
2174
-
2175
- - 8fba48b: fix including incorrect dependency
2176
- - 8997c65: bumped dependencies
2177
- - Updated dependencies [8fba48b]
2178
- - Updated dependencies [8997c65]
2179
- - @pluv/crdt-yjs@0.4.1
2180
- - @pluv/types@0.2.2
2181
-
2182
- ## 0.9.0
2183
-
2184
- ### Minor Changes
2185
-
2186
- - 829d31b: Added support for defining persistant frontend storage for rooms via a new `addons` option on rooms.
2187
-
2188
- 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:
2189
-
2190
- ```
2191
- npm install @pluv/addon-indexeddb
2192
- ```
2193
-
2194
- To use this new addon, simply pass it to options when creating a room:
2195
-
2196
- ```ts
2197
- import { addonIndexedDB } from "@pluv/addon-indexeddb";
2198
- import { createClient } from "@pluv/client";
2199
-
2200
- const client = createClient({
2201
- // ...
2202
- });
2203
-
2204
- const room = client.createRoom("my-new-room", {
2205
- addons: [
2206
- // Define your addons in an array like so
2207
- addonIndexedDB(),
2208
- ],
2209
- });
2210
- ```
2211
-
2212
- Or when using `@pluv/react`:
2213
-
2214
- ```ts
2215
- const PluvRoom = createRoomBundle({
2216
- // ...
2217
- addons: [
2218
- // Define your addons in an array like so
2219
- addonIndexedDB(),
2220
- ],
2221
- });
2222
- ```
2223
-
2224
- ### Patch Changes
2225
-
2226
- - 8d11672: bumped dependencies to latest
2227
- - Updated dependencies [8d11672]
2228
- - Updated dependencies [829d31b]
2229
- - @pluv/crdt-yjs@0.4.0
2230
- - @pluv/types@0.2.1
2231
-
2232
- ## 0.8.1
2233
-
2234
- ### Patch Changes
2235
-
2236
- - 2c9c5c3: changed my-presence to be non-nullable
2237
-
2238
- ## 0.8.0
2239
-
2240
- ### Minor Changes
2241
-
2242
- - fde89cf: added defaults to the client to align it with createPluvClient by default
2243
-
2244
- ### Patch Changes
2245
-
2246
- - 5bbfb98: fix not properly handling unauthorized checks
2247
- - b85a232: bumped dependencies
2248
- - Updated dependencies [b85a232]
2249
- - @pluv/crdt-yjs@0.3.8
2250
- - @pluv/types@0.2.0
2251
-
2252
- ## 0.7.0
2253
-
2254
- ### Minor Changes
2255
-
2256
- - ae679a8: updated offline presence to be set when reconnecting to a room
2257
-
2258
- ### Patch Changes
2259
-
2260
- - 0dd847e: updated storage to be synced when reconnected to the room
2261
- - bb2886b: fixed not reconnecting during heartbeat
2262
- - 3518a83: bumped dependencies
2263
- - Updated dependencies [0dd847e]
2264
- - Updated dependencies [bb2886b]
2265
- - Updated dependencies [ae679a8]
2266
- - Updated dependencies [3518a83]
2267
- - @pluv/crdt-yjs@0.3.7
2268
- - @pluv/types@0.2.0
2269
-
2270
- ## 0.6.5
2271
-
2272
- ### Patch Changes
2273
-
2274
- - 7ad4967: fixed user's presence not updating locally while offline
2275
- - 4535687: fix local yjs doc not updating while disconnected
2276
- - @pluv/crdt-yjs@0.3.6
2277
- - @pluv/types@0.1.6
2278
-
2279
- ## 0.6.4
2280
-
2281
- ### Patch Changes
2282
-
2283
- - 78fd644: updated readmes with links to the documentation website
2284
- - Updated dependencies [78fd644]
2285
- - @pluv/crdt-yjs@0.3.6
2286
-
2287
- ## 0.6.3
2288
-
2289
- ### Patch Changes
2290
-
2291
- - 850626e: bumped dependencies
2292
- - Updated dependencies [850626e]
2293
- - @pluv/crdt-yjs@0.3.5
2294
- - @pluv/types@0.1.6
2295
-
2296
- ## 0.6.2
2297
-
2298
- ### Patch Changes
2299
-
2300
- - 9ae251d: bumped dependencies
2301
- - Updated dependencies [9ae251d]
2302
- - @pluv/crdt-yjs@0.3.4
2303
-
2304
- ## 0.6.1
2305
-
2306
- ### Patch Changes
2307
-
2308
- - 19433af: updated MockedRoomProvider events to allow partial events
2309
- - 74870ee: bumped dependencies
2310
- - Updated dependencies [74870ee]
2311
- - @pluv/crdt-yjs@0.3.3
2312
- - @pluv/types@0.1.5
2313
-
2314
- ## 0.6.0
2315
-
2316
- ### Minor Changes
2317
-
2318
- - e1308e3: changed `PluvClient.createRoom` to have optional options.
2319
- - e1308e3: changed `PluvClient.enter` to return the `PluvRoom` that was entered.
2320
-
2321
- ### Patch Changes
2322
-
2323
- - 9516a4e: updated typescript to 5.0
2324
- - 7b6da1c: bumped dependencies
2325
- - e9c1514: bumped dependencies
2326
- - 9d1829c: chore: bumped dependencies
2327
- - Updated dependencies [9516a4e]
2328
- - Updated dependencies [7b6da1c]
2329
- - Updated dependencies [e9c1514]
2330
- - Updated dependencies [9d1829c]
2331
- - @pluv/crdt-yjs@0.3.2
2332
- - @pluv/types@0.1.4
2333
-
2334
- ## 0.5.1
2335
-
2336
- ### Patch Changes
2337
-
2338
- - 161e00e: fixed links to other pluv packages in readmes
2339
- - f6c0e65: bumped dependencies
2340
- - Updated dependencies [161e00e]
2341
- - Updated dependencies [f6c0e65]
2342
- - @pluv/crdt-yjs@0.3.1
2343
- - @pluv/types@0.1.3
2344
-
2345
- ## 0.5.0
2346
-
2347
- ### Minor Changes
2348
-
2349
- - 327a6ef: renamed y.unstable\_\_object to y.object
2350
-
2351
- ### Patch Changes
2352
-
2353
- - 78a6119: Fixed MockedRoom not sending storage updates
2354
- - 8bf62cb: bumped dependencies
2355
- - 7e52685: Bumped dependencies
2356
- - b1cb325: Updated dependencies
2357
- - 8e97fb2: Updated dependencies
2358
- - Updated dependencies [8bf62cb]
2359
- - Updated dependencies [7e52685]
2360
- - Updated dependencies [b1cb325]
2361
- - Updated dependencies [327a6ef]
2362
- - Updated dependencies [8e97fb2]
2363
- - @pluv/crdt-yjs@0.3.0
2364
- - @pluv/types@0.1.3
2365
-
2366
- ## 0.4.0
2367
-
2368
- ### Minor Changes
2369
-
2370
- - 595e66f: added mocked-room for mocking a client-side room for testing
2371
-
2372
- ## 0.3.0
2373
-
2374
- ### Minor Changes
2375
-
2376
- - 595e66f: added mocked-room for mocking a client-side room for testing
2377
-
2378
- ## 0.2.0
2379
-
2380
- ### Minor Changes
2381
-
2382
- - 95b5ef8: breaking: update PluvRoom.broadcast api
2383
-
2384
- ### Patch Changes
2385
-
2386
- - Updated dependencies [6858682]
2387
- - @pluv/crdt-yjs@0.2.0
2388
- - @pluv/types@0.1.2
2389
-
2390
- ## 0.1.3
2391
-
2392
- ### Patch Changes
2393
-
2394
- - fe80d7b: added preview disclaimer about breaking changes in the readme
2395
- - Updated dependencies [fe80d7b]
2396
- - @pluv/crdt-yjs@0.1.3
2397
- - @pluv/types@0.1.2
2398
-
2399
- ## 0.1.2
2400
-
2401
- ### Patch Changes
2402
-
2403
- - Updated dependencies [b45d642]
2404
- - @pluv/crdt-yjs@0.1.2
2405
-
2406
- ## 0.1.1
2407
-
2408
- ### Patch Changes
2409
-
2410
- - 23a7382: Omitted unused `encodedState` param from PluvRoom.
2411
- - 24016e6: Updated dependencies
2412
- - Updated dependencies [24016e6]
2413
- - @pluv/crdt-yjs@0.1.1
2414
- - @pluv/types@0.1.1
2415
-
2416
- ## 0.1.0
2417
-
2418
- ### Minor Changes
2419
-
2420
- - a22f525: Added documentation
2421
-
2422
- ### Patch Changes
2423
-
2424
- - Updated dependencies [a22f525]
2425
- - @pluv/crdt-yjs@0.1.0
2426
- - @pluv/types@0.1.0