@pluv/client 5.0.1 → 5.0.3

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