@pluv/crdt-yjs 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
1
 
2
- > @pluv/crdt-yjs@2.2.1 build /home/runner/work/pluv/pluv/packages/crdt-yjs
2
+ > @pluv/crdt-yjs@2.2.3 build /home/runner/work/pluv/pluv/packages/crdt-yjs
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.4.0
7
+ CLI tsup v8.5.0
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 23.15 KB
12
- CJS ⚡️ Build success in 110ms
13
- ESM dist/index.mjs 22.21 KB
14
- ESM ⚡️ Build success in 110ms
11
+ ESM dist/index.mjs 22.25 KB
12
+ ESM ⚡️ Build success in 112ms
13
+ CJS dist/index.js 23.19 KB
14
+ CJS ⚡️ Build success in 113ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4831ms
17
- DTS dist/index.d.mts 10.93 KB
18
- DTS dist/index.d.ts 10.93 KB
16
+ DTS ⚡️ Build success in 4697ms
17
+ DTS dist/index.d.mts 10.95 KB
18
+ DTS dist/index.d.ts 10.95 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pluv/crdt-yjs
2
2
 
3
+ ## 2.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/crdt@2.2.3
8
+ - @pluv/types@2.2.3
9
+
10
+ ## 2.2.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 289d71d: Updated `yjs.provider` field to `presenceField`.
15
+ - @pluv/crdt@2.2.2
16
+ - @pluv/types@2.2.2
17
+
3
18
  ## 2.2.1
4
19
 
5
20
  ### Patch Changes
@@ -13,71 +28,71 @@
13
28
 
14
29
  - 745f6df: Added a `provider` function that satisfies Yjs's provider interface.
15
30
 
16
- ```ts
17
- import { createClient } from "@pluv/client";
18
- import { yjs } from "@pluv/crdt-yjs";
31
+ ```ts
32
+ import { createClient } from "@pluv/client";
33
+ import { yjs } from "@pluv/crdt-yjs";
19
34
 
20
- const client = createClient({
21
- /* ... */
22
- });
23
- const room = client.createRoom("example-room");
35
+ const client = createClient({
36
+ /* ... */
37
+ });
38
+ const room = client.createRoom("example-room");
24
39
 
25
- // Yjs Provider
26
- yjs.provider({ room });
27
- ```
40
+ // Yjs Provider
41
+ yjs.provider({ room });
42
+ ```
28
43
 
29
44
  - df4ceed: Update `yjs.awareness` and `yjs.provider` to allow for a `field` parameter to use awareness on a nested presence field.
30
45
 
31
- ```ts
32
- createClient({
33
- presence: z.object({
34
- topField: z.number(),
35
- forAwareness: z.object({
36
- nestedField: z.number(),
37
- }),
38
- }),
39
- });
40
-
41
- yjs.provider({
42
- // ...
43
- // Optional field to use a nested field, instead of the presence root
44
- field: "forAwareness",
45
- });
46
-
47
- yjs.awareness({
48
- // ...
49
- // Optional field to use a nested field, instead of the presence root
50
- field: "forAwareness",
51
- });
52
- ```
53
-
54
- This allows better integrations with [lexical](https://lexical.dev), since they have their own presence types.
55
-
56
- ```tsx
57
- createClient({
58
- presence: z.object({
59
- topField: z.number(),
60
- lexical: z.any(),
61
- }),
62
- });
63
-
64
- yjs.provider({ field: "lexical" /* ... */ });
65
- ```
46
+ ```ts
47
+ createClient({
48
+ presence: z.object({
49
+ topField: z.number(),
50
+ forAwareness: z.object({
51
+ nestedField: z.number(),
52
+ }),
53
+ }),
54
+ });
55
+
56
+ yjs.provider({
57
+ // ...
58
+ // Optional field to use a nested field, instead of the presence root
59
+ field: "forAwareness",
60
+ });
61
+
62
+ yjs.awareness({
63
+ // ...
64
+ // Optional field to use a nested field, instead of the presence root
65
+ field: "forAwareness",
66
+ });
67
+ ```
68
+
69
+ This allows better integrations with [lexical](https://lexical.dev), since they have their own presence types.
70
+
71
+ ```tsx
72
+ createClient({
73
+ presence: z.object({
74
+ topField: z.number(),
75
+ lexical: z.any(),
76
+ }),
77
+ });
78
+
79
+ yjs.provider({ field: "lexical" /* ... */ });
80
+ ```
66
81
 
67
82
  - 6323979: Added an `awareness` function that satisfies Yjs's [awareness interface](https://github.com/yjs/y-protocols/blob/master/awareness.js).
68
83
 
69
- ```ts
70
- import { createClient } from "@pluv/client";
71
- import { yjs } from "@pluv/crdt-yjs";
84
+ ```ts
85
+ import { createClient } from "@pluv/client";
86
+ import { yjs } from "@pluv/crdt-yjs";
72
87
 
73
- const client = createClient({
74
- /* ... */
75
- });
76
- const room = client.createRoom("example-room");
88
+ const client = createClient({
89
+ /* ... */
90
+ });
91
+ const room = client.createRoom("example-room");
77
92
 
78
- // Yjs Awareness
79
- yjs.awareness({ room /* ... */ });
80
- ```
93
+ // Yjs Awareness
94
+ yjs.awareness({ room /* ... */ });
95
+ ```
81
96
 
82
97
  ### Patch Changes
83
98
 
@@ -97,10 +112,10 @@
97
112
 
98
113
  - 945c47d: Updated deprecation warnings to read that features will be removed in v3 instead of v2.
99
114
 
100
- Due to an [extremely unfortunate bug in changesets](https://github.com/changesets/changesets/issues/1011), minor and patch changes will create major releases. This caused an unintended v2 release that had no breaking changes. To avoid backtracking and deleting deprecated functionalities right away, the deprecation warnings have been updated so that those APIs will be removed in v3 instead of v2.
115
+ Due to an [extremely unfortunate bug in changesets](https://github.com/changesets/changesets/issues/1011), minor and patch changes will create major releases. This caused an unintended v2 release that had no breaking changes. To avoid backtracking and deleting deprecated functionalities right away, the deprecation warnings have been updated so that those APIs will be removed in v3 instead of v2.
101
116
 
102
- - @pluv/crdt@2.0.2
103
- - @pluv/types@2.0.2
117
+ - @pluv/crdt@2.0.2
118
+ - @pluv/types@2.0.2
104
119
 
105
120
  ## 2.0.1
106
121
 
@@ -115,43 +130,43 @@
115
130
 
116
131
  - 0b234d1: **Deprecated** Declaring top-level types on your CRDT storage via the `yjs` utility (e.g. `yjs.array`) is now deprecated, to be removed in the next major release (v2). Continuing to use the `yjs` utility to declare top-level types will log a warning to your console while in development mode (i.e. when `process.env.NODE_ENV === "development"`). To declare top-level types, you should now use the builder type exposed in the storage factory function. See the example below:
117
132
 
118
- ```ts
119
- import { yjs } from "@pluv/crdt-yjs";
120
-
121
- // Before
122
- yjs.doc(() => ({
123
- // Using the `yjs` utility (in this case `yjs.map`) when declaring
124
- // top-level types is now deprecated
125
- topType: yjs.map([
126
- ["key1", yjs.text("")],
127
- ["key2", yjs.text("")],
128
- ]),
129
- }));
130
-
131
- // After
132
- yjs.doc((t) => ({
133
- // Top-level properties must now use the builder (in this case `t`).
134
- // This effectively calls `yjs.getMap("topType")` to instantiate the type on
135
- // the root document.
136
- // This simply returns the native Yjs shared-types (e.g. Y.Map), which
137
- // allows you operate on your yjs shared-typess in a more native way.
138
- topType: t.map("topType", [
139
- // Declaring nested types should continue to use the `yjs` utilities
140
- // you've used before
141
- ["key1", yjs.text("")],
142
- ["key2", yjs.text("")],
143
- ]),
144
- }));
145
- ```
146
-
147
- The functions on the builder type calls the native yjs shared-type instantiating methods and returns the native types (e.g. `t.map("topType")` is simply just a `Y.Doc.getMap("topType")`) call under the hood. This allows you to declare your type in a more yjs-native and predictable way, and enables declaring more complex initial storage states if needed.
133
+ ```ts
134
+ import { yjs } from "@pluv/crdt-yjs";
135
+
136
+ // Before
137
+ yjs.doc(() => ({
138
+ // Using the `yjs` utility (in this case `yjs.map`) when declaring
139
+ // top-level types is now deprecated
140
+ topType: yjs.map([
141
+ ["key1", yjs.text("")],
142
+ ["key2", yjs.text("")],
143
+ ]),
144
+ }));
145
+
146
+ // After
147
+ yjs.doc((t) => ({
148
+ // Top-level properties must now use the builder (in this case `t`).
149
+ // This effectively calls `yjs.getMap("topType")` to instantiate the type on
150
+ // the root document.
151
+ // This simply returns the native Yjs shared-types (e.g. Y.Map), which
152
+ // allows you operate on your yjs shared-typess in a more native way.
153
+ topType: t.map("topType", [
154
+ // Declaring nested types should continue to use the `yjs` utilities
155
+ // you've used before
156
+ ["key1", yjs.text("")],
157
+ ["key2", yjs.text("")],
158
+ ]),
159
+ }));
160
+ ```
161
+
162
+ The functions on the builder type calls the native yjs shared-type instantiating methods and returns the native types (e.g. `t.map("topType")` is simply just a `Y.Doc.getMap("topType")`) call under the hood. This allows you to declare your type in a more yjs-native and predictable way, and enables declaring more complex initial storage states if needed.
148
163
 
149
164
  ### Patch Changes
150
165
 
151
166
  - 0b234d1: Fixed `Y.XmlText` types transforming into `Y.Text` types on the initial initializaion of storage states.
152
167
  - Updated dependencies [047a1d8]
153
- - @pluv/types@2.0.0
154
- - @pluv/crdt@2.0.0
168
+ - @pluv/types@2.0.0
169
+ - @pluv/crdt@2.0.0
155
170
 
156
171
  ## 1.0.2
157
172
 
@@ -173,15 +188,15 @@
173
188
 
174
189
  - af94706: pluv.io is now stable and production ready!
175
190
 
176
- 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.
191
+ 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.
177
192
 
178
- Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
193
+ Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
179
194
 
180
195
  ### Patch Changes
181
196
 
182
197
  - Updated dependencies [af94706]
183
- - @pluv/crdt@1.0.0
184
- - @pluv/types@1.0.0
198
+ - @pluv/crdt@1.0.0
199
+ - @pluv/types@1.0.0
185
200
 
186
201
  ## 0.44.2
187
202
 
@@ -202,8 +217,8 @@
202
217
  ### Patch Changes
203
218
 
204
219
  - 503c23b: Updated `batchApplyEncodedState` to use `Yjs.mergeUpdates` to more efficiently update the document under-the-hood, while also producing a smaller document.
205
- - @pluv/crdt@0.44.0
206
- - @pluv/types@0.44.0
220
+ - @pluv/crdt@0.44.0
221
+ - @pluv/types@0.44.0
207
222
 
208
223
  ## 0.43.0
209
224
 
@@ -413,8 +428,8 @@
413
428
  ### Patch Changes
414
429
 
415
430
  - Updated dependencies [f4ceca3]
416
- - @pluv/types@0.38.0
417
- - @pluv/crdt@0.38.0
431
+ - @pluv/types@0.38.0
432
+ - @pluv/crdt@0.38.0
418
433
 
419
434
  ## 0.37.7
420
435
 
@@ -498,16 +513,16 @@
498
513
  ### Patch Changes
499
514
 
500
515
  - Updated dependencies [81cb692]
501
- - @pluv/types@0.35.2
502
- - @pluv/crdt@0.35.2
516
+ - @pluv/types@0.35.2
517
+ - @pluv/crdt@0.35.2
503
518
 
504
519
  ## 0.35.1
505
520
 
506
521
  ### Patch Changes
507
522
 
508
523
  - 820898c: Increase undo/redo merge interval from 0s to 1s.
509
- - @pluv/crdt@0.35.1
510
- - @pluv/types@0.35.1
524
+ - @pluv/crdt@0.35.1
525
+ - @pluv/types@0.35.1
511
526
 
512
527
  ## 0.35.0
513
528
 
@@ -633,8 +648,8 @@
633
648
  ### Patch Changes
634
649
 
635
650
  - 7246a9e: Added `CrdtLibraryType` so that `@pluv/crdt-yjs` and `@pluv/crdt-loro` export a new property `kind` containing an identifier for the crdt.
636
- - @pluv/crdt@0.30.0
637
- - @pluv/types@0.30.0
651
+ - @pluv/crdt@0.30.0
652
+ - @pluv/types@0.30.0
638
653
 
639
654
  ## 0.29.0
640
655
 
@@ -747,76 +762,76 @@
747
762
 
748
763
  - 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.
749
764
 
750
- 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.
765
+ 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.
751
766
 
752
- 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.
767
+ 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.
753
768
 
754
- ```ts
755
- // Before
769
+ ```ts
770
+ // Before
756
771
 
757
- import { yjs } from "@pluv/crdt-yjs";
772
+ import { yjs } from "@pluv/crdt-yjs";
758
773
 
759
- yjs.array([]); // Returns CrdtYjsArray
760
- yjs.object([]); // Returns CrdtYjsObject
774
+ yjs.array([]); // Returns CrdtYjsArray
775
+ yjs.object([]); // Returns CrdtYjsObject
761
776
 
762
- const room: PluvRoom = /* ... */;
777
+ const room: PluvRoom = /* ... */;
763
778
 
764
- room.getStorage("messages"); // Returns AbstractCrdtType
779
+ room.getStorage("messages"); // Returns AbstractCrdtType
765
780
 
766
- const [, sharedType] = useStorage("messages"); // sharedType is an AbstractCrdtType
767
- ```
781
+ const [, sharedType] = useStorage("messages"); // sharedType is an AbstractCrdtType
782
+ ```
768
783
 
769
- ```ts
770
- // Now
784
+ ```ts
785
+ // Now
771
786
 
772
- import { yjs } from "@pluv/crdt-yjs";
787
+ import { yjs } from "@pluv/crdt-yjs";
773
788
 
774
- yjs.array([]); // Returns yjs.Array
775
- yjs.object([]); // Returns yjs.Map
789
+ yjs.array([]); // Returns yjs.Array
790
+ yjs.object([]); // Returns yjs.Map
776
791
 
777
- const room: PluvRoom = /* ... */;
792
+ const room: PluvRoom = /* ... */;
778
793
 
779
- room.getStorage("messages"); // Returns yjs.AbstractType
794
+ room.getStorage("messages"); // Returns yjs.AbstractType
780
795
 
781
- const [, sharedType] = useStorage("messages"); // sharedType is a yjs.AbstractType
782
- ```
796
+ const [, sharedType] = useStorage("messages"); // sharedType is a yjs.AbstractType
797
+ ```
783
798
 
784
- 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:
799
+ 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:
785
800
 
786
- ```ts
787
- // Before
801
+ ```ts
802
+ // Before
788
803
 
789
- const [data, container] = useStorage("messages");
804
+ const [data, container] = useStorage("messages");
790
805
 
791
- // This automatically called Loro.commit under the hood and rerendered the page with updated data.
792
- container.push(loro.object({ name: "John Doe", age: 35 }));
793
- ```
806
+ // This automatically called Loro.commit under the hood and rerendered the page with updated data.
807
+ container.push(loro.object({ name: "John Doe", age: 35 }));
808
+ ```
794
809
 
795
- ```ts
796
- // Now
810
+ ```ts
811
+ // Now
797
812
 
798
- const [data, container] = useStorage("messages");
813
+ const [data, container] = useStorage("messages");
799
814
 
800
- const doc = useDoc();
801
- const transact = useTransact();
815
+ const doc = useDoc();
816
+ const transact = useTransact();
802
817
 
803
- // Updates need to be committed back to the doc whenever the changes need to be emitted to other users
804
- // The returned data also will not update until the changes are commited
818
+ // Updates need to be committed back to the doc whenever the changes need to be emitted to other users
819
+ // The returned data also will not update until the changes are commited
805
820
 
806
- // The two operations below are functionally equivalent
807
- transact(() => {
808
- container.push(loro.object({ name: "John Doe", age: 35 }));
809
- });
821
+ // The two operations below are functionally equivalent
822
+ transact(() => {
823
+ container.push(loro.object({ name: "John Doe", age: 35 }));
824
+ });
810
825
 
811
- container.push(loro.object({ name: "John Doe", age: 35 }));
812
- doc.value.commit();
813
- ```
826
+ container.push(loro.object({ name: "John Doe", age: 35 }));
827
+ doc.value.commit();
828
+ ```
814
829
 
815
830
  ### Patch Changes
816
831
 
817
832
  - Updated dependencies [9492085]
818
- - @pluv/crdt@0.20.0
819
- - @pluv/types@0.20.0
833
+ - @pluv/crdt@0.20.0
834
+ - @pluv/types@0.20.0
820
835
 
821
836
  ## 0.19.0
822
837
 
@@ -830,8 +845,8 @@
830
845
  ### Patch Changes
831
846
 
832
847
  - Updated dependencies [99b5ca9]
833
- - @pluv/types@0.18.0
834
- - @pluv/crdt@0.18.0
848
+ - @pluv/types@0.18.0
849
+ - @pluv/crdt@0.18.0
835
850
 
836
851
  ## 0.17.3
837
852
 
@@ -859,8 +874,8 @@
859
874
  ### Patch Changes
860
875
 
861
876
  - Updated dependencies [507bc00]
862
- - @pluv/types@0.17.0
863
- - @pluv/crdt@0.17.0
877
+ - @pluv/types@0.17.0
878
+ - @pluv/crdt@0.17.0
864
879
 
865
880
  ## 0.16.3
866
881
 
@@ -919,7 +934,7 @@
919
934
  ### Patch Changes
920
935
 
921
936
  - da9f600: Upgraded dependencies
922
- - @pluv/types@0.12.3
937
+ - @pluv/types@0.12.3
923
938
 
924
939
  ## 0.12.2
925
940
 
@@ -939,233 +954,232 @@
939
954
 
940
955
  - 436040b: Added ability to undo and redo changes to storage.
941
956
 
942
- ## @pluv/crdt-yjs
957
+ ## @pluv/crdt-yjs
958
+
959
+ `@pluv/crdt-yjs` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `trackOrigins`.
960
+
961
+ Refer to the code-example below to better understand how to undo and redo with your doc.
962
+
963
+ ```ts
964
+ // Example
965
+ import { array, doc } from "@pluv/crdt-yjs";
966
+
967
+ // Create your doc with your shared-types
968
+ const myDoc = doc({
969
+ messages: array<string>([]),
970
+ });
971
+
972
+ /**
973
+ * @description Track origins to enable undos and redos for your document.
974
+ * trackOrigins must be called before any storage mutations, to enable those
975
+ * mutations to be undone/redone.
976
+ */
977
+ myDoc.trackOrigins({
978
+ /**
979
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
980
+ * This specifies a number in ms, during which edits are merged together to be
981
+ * undone together. Set this to 0, to track each transacted change individually.
982
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
983
+ * @default 500
984
+ */
985
+ captureTimeout: 500,
986
+ /**
987
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
988
+ * This specifies transaction origins (strings only) to filter which transactions
989
+ * can be undone.
990
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
991
+ * @default undefined
992
+ */
993
+ trackedOrigins: ["user-123"],
994
+ });
995
+
996
+ /**
997
+ * @description Check whether calling undo will mutate storage
998
+ * @returns boolean
999
+ */
1000
+ myDoc.canUndo();
1001
+ /**
1002
+ * @description Check whether calling redo will mutate storage
1003
+ * @returns boolean
1004
+ */
1005
+ myDoc.canRedo();
1006
+
1007
+ // Perform a storage mutation within a transaction so that it can be affected
1008
+ // by undo/redo operations.
1009
+ myDoc.transact(() => {
1010
+ myDoc.get("messages").push(["hello world!"]);
1011
+ }, "user-123");
1012
+
1013
+ /**
1014
+ * @description Undoes the last valid mutation to storage
1015
+ */
1016
+ myDoc.undo();
1017
+
1018
+ /**
1019
+ * @description Re-applies the last undone mutation to storage
1020
+ */
1021
+ myDoc.redo();
1022
+ ```
1023
+
1024
+ ## @pluv/client
943
1025
 
944
- `@pluv/crdt-yjs` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `trackOrigins`.
1026
+ `@pluv/client`'s `PluvRoom` and `MockedRoom` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `transact`.
945
1027
 
946
- Refer to the code-example below to better understand how to undo and redo with your doc.
1028
+ Refer to the code-example below to better understand how to undo and redo with your `PluvRoom`.
947
1029
 
948
- ```ts
949
- // Example
950
- import { array, doc } from "@pluv/crdt-yjs";
1030
+ ```ts
1031
+ import { createClient, y } from "@pluv/client";
951
1032
 
952
- // Create your doc with your shared-types
953
- const myDoc = doc({
954
- messages: array<string>([]),
955
- });
1033
+ const client = createClient({});
956
1034
 
957
- /**
958
- * @description Track origins to enable undos and redos for your document.
959
- * trackOrigins must be called before any storage mutations, to enable those
960
- * mutations to be undone/redone.
961
- */
962
- myDoc.trackOrigins({
963
1035
  /**
964
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
965
- * This specifies a number in ms, during which edits are merged together to be
966
- * undone together. Set this to 0, to track each transacted change individually.
967
- * @see (@link https://docs.yjs.dev/api/undo-manager)
968
- * @default 500
1036
+ * @description When a room is created, undo/redo will automatically
1037
+ * be configured to filter for changes made by the connected user
1038
+ * (so that users only undo/redo their changes).
969
1039
  */
970
- captureTimeout: 500,
1040
+ const room = client.createRoom("my-room", {
1041
+ initialStorage: () => ({
1042
+ messages: y.array<string>([]),
1043
+ }),
1044
+ /**
1045
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
1046
+ * This specifies a number in ms, during which edits are merged together to be
1047
+ * undone together. Set this to 0, to track each transacted change individually.
1048
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1049
+ * @default 500
1050
+ */
1051
+ captureTimeout: 500,
1052
+ /**
1053
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1054
+ * This specifies transaction origins (strings only) to filter which transactions
1055
+ * can be undone.
1056
+ * When omitted, the user's connection id will be tracked. When provided,
1057
+ * specifies additional tracked origins besides the user's connection id.
1058
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1059
+ * @default undefined
1060
+ */
1061
+ trackedOrigins: ["user-123"],
1062
+ });
1063
+
971
1064
  /**
972
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
973
- * This specifies transaction origins (strings only) to filter which transactions
974
- * can be undone.
975
- * @see (@link https://docs.yjs.dev/api/undo-manager)
976
- * @default undefined
1065
+ * @description Check whether calling undo will mutate storage
1066
+ * @returns boolean
977
1067
  */
978
- trackedOrigins: ["user-123"],
979
- });
980
-
981
- /**
982
- * @description Check whether calling undo will mutate storage
983
- * @returns boolean
984
- */
985
- myDoc.canUndo();
986
- /**
987
- * @description Check whether calling redo will mutate storage
988
- * @returns boolean
989
- */
990
- myDoc.canRedo();
991
-
992
- // Perform a storage mutation within a transaction so that it can be affected
993
- // by undo/redo operations.
994
- myDoc.transact(() => {
995
- myDoc.get("messages").push(["hello world!"]);
996
- }, "user-123");
997
-
998
- /**
999
- * @description Undoes the last valid mutation to storage
1000
- */
1001
- myDoc.undo();
1002
-
1003
- /**
1004
- * @description Re-applies the last undone mutation to storage
1005
- */
1006
- myDoc.redo();
1007
- ```
1008
-
1009
- ## @pluv/client
1010
-
1011
- `@pluv/client`'s `PluvRoom` and `MockedRoom` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `transact`.
1012
-
1013
- Refer to the code-example below to better understand how to undo and redo with your `PluvRoom`.
1014
-
1015
- ```ts
1016
- import { createClient, y } from "@pluv/client";
1017
-
1018
- const client = createClient({});
1019
-
1020
- /**
1021
- * @description When a room is created, undo/redo will automatically
1022
- * be configured to filter for changes made by the connected user
1023
- * (so that users only undo/redo their changes).
1024
- */
1025
- const room = client.createRoom("my-room", {
1026
- initialStorage: () => ({
1027
- messages: y.array<string>([]),
1028
- }),
1068
+ room.canUndo();
1029
1069
  /**
1030
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
1031
- * This specifies a number in ms, during which edits are merged together to be
1032
- * undone together. Set this to 0, to track each transacted change individually.
1033
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1034
- * @default 500
1070
+ * @description Check whether calling redo will mutate storage
1071
+ * @returns boolean
1035
1072
  */
1036
- captureTimeout: 500,
1073
+ room.canRedo();
1074
+
1037
1075
  /**
1038
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1039
- * This specifies transaction origins (strings only) to filter which transactions
1040
- * can be undone.
1041
- * When omitted, the user's connection id will be tracked. When provided,
1042
- * specifies additional tracked origins besides the user's connection id.
1043
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1044
- * @default undefined
1076
+ * @description Calling transact will enable a storage mutation to be undone/redone.
1077
+ * When called without an origin, the origin will default to the user's connection
1078
+ * id.
1079
+ *
1080
+ * You can specify a 2nd parameter to transact with a different transaction origin.
1045
1081
  */
1046
- trackedOrigins: ["user-123"],
1047
- });
1048
-
1049
- /**
1050
- * @description Check whether calling undo will mutate storage
1051
- * @returns boolean
1052
- */
1053
- room.canUndo();
1054
- /**
1055
- * @description Check whether calling redo will mutate storage
1056
- * @returns boolean
1057
- */
1058
- room.canRedo();
1059
-
1060
- /**
1061
- * @description Calling transact will enable a storage mutation to be undone/redone.
1062
- * When called without an origin, the origin will default to the user's connection
1063
- * id.
1064
- *
1065
- * You can specify a 2nd parameter to transact with a different transaction origin.
1066
- */
1067
- room.transact(() => {
1068
- room.get("messages").push(["hello world!"]);
1069
- });
1070
-
1071
- // This will also be undoable because `"user-123"` is a tracked origin.
1072
- room.transact(() => {
1073
- room.get("messages").push(["hello world!"]);
1074
- }, "user-123");
1075
-
1076
- /**
1077
- * @description Undoes the last valid mutation to storage
1078
- */
1079
- room.undo();
1080
-
1081
- /**
1082
- * @description Re-applies the last undone mutation to storage
1083
- */
1084
- room.redo();
1085
- ```
1086
-
1087
- ## @pluv/react
1088
-
1089
- `@pluv/react`'s `createRoomBundle` now exposes 5 new react hooks: `useCanRedo`, `useCanUndo`, `useRedo`, `useUndo` and `useTransact`.
1090
-
1091
- Refer to the code-example below to better understand how to undo and redo with your `createRoomBundle`.
1092
-
1093
- ```tsx
1094
- import { createBundle, createClient, y } from "@pluv/react";
1095
- import { type io } from "./io";
1096
-
1097
- const client = createClient<typeof io>();
1098
-
1099
- const { createRoomBundle } = createBundle(client);
1100
-
1101
- const { useCanRedo, useCanUndo, useRedo, useStorage, useTransact, useUndo } =
1102
- createRoomBundle({
1103
- initialStorage: () => ({
1104
- messages: y.array<string>([]),
1105
- }),
1106
- /**
1107
- * @description This is the same `captureTimeout` option from yjs's UndoManager.
1108
- * This specifies a number in ms, during which edits are merged together to be
1109
- * undone together. Set this to 0, to track each transacted change individually.
1110
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1111
- * @default 500
1112
- */
1113
- captureTimeout: 500,
1114
- /**
1115
- * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1116
- * This specifies transaction origins (strings only) to filter which transactions
1117
- * can be undone.
1118
- * When omitted, the user's connection id will be tracked. When provided,
1119
- * specifies additional tracked origins besides the user's connection id.
1120
- * @see (@link https://docs.yjs.dev/api/undo-manager)
1121
- * @default undefined
1122
- */
1123
- trackedOrigins: ["user-123"],
1082
+ room.transact(() => {
1083
+ room.get("messages").push(["hello world!"]);
1124
1084
  });
1125
1085
 
1126
- /**
1127
- * @description Check whether calling undo will mutate storage
1128
- */
1129
- const canUndo: boolean = useCanUndo();
1130
- /**
1131
- * @description Check whether calling redo will mutate storage
1132
- */
1133
- const canRedo: boolean = useCanRedo();
1086
+ // This will also be undoable because `"user-123"` is a tracked origin.
1087
+ room.transact(() => {
1088
+ room.get("messages").push(["hello world!"]);
1089
+ }, "user-123");
1134
1090
 
1135
- const [messages, sharedType] = useStorage("messages");
1091
+ /**
1092
+ * @description Undoes the last valid mutation to storage
1093
+ */
1094
+ room.undo();
1136
1095
 
1137
- /**
1138
- * @description Calling transact will enable a storage mutation to be undone/redone.
1139
- * When called without an origin, the origin will default to the user's connection
1140
- * id.
1141
- *
1142
- * You can specify a 2nd parameter to transact with a different transaction origin.
1143
- */
1144
- const transact = useTransact();
1096
+ /**
1097
+ * @description Re-applies the last undone mutation to storage
1098
+ */
1099
+ room.redo();
1100
+ ```
1145
1101
 
1146
- transact(() => {
1147
- sharedType.push(["hello world!"]);
1148
- });
1102
+ ## @pluv/react
1103
+
1104
+ `@pluv/react`'s `createRoomBundle` now exposes 5 new react hooks: `useCanRedo`, `useCanUndo`, `useRedo`, `useUndo` and `useTransact`.
1105
+
1106
+ Refer to the code-example below to better understand how to undo and redo with your `createRoomBundle`.
1107
+
1108
+ ```tsx
1109
+ import { createBundle, createClient, y } from "@pluv/react";
1110
+ import { type io } from "./io";
1111
+
1112
+ const client = createClient<typeof io>();
1113
+
1114
+ const { createRoomBundle } = createBundle(client);
1115
+
1116
+ const { useCanRedo, useCanUndo, useRedo, useStorage, useTransact, useUndo } = createRoomBundle({
1117
+ initialStorage: () => ({
1118
+ messages: y.array<string>([]),
1119
+ }),
1120
+ /**
1121
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
1122
+ * This specifies a number in ms, during which edits are merged together to be
1123
+ * undone together. Set this to 0, to track each transacted change individually.
1124
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1125
+ * @default 500
1126
+ */
1127
+ captureTimeout: 500,
1128
+ /**
1129
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1130
+ * This specifies transaction origins (strings only) to filter which transactions
1131
+ * can be undone.
1132
+ * When omitted, the user's connection id will be tracked. When provided,
1133
+ * specifies additional tracked origins besides the user's connection id.
1134
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1135
+ * @default undefined
1136
+ */
1137
+ trackedOrigins: ["user-123"],
1138
+ });
1149
1139
 
1150
- // This will also be undoable because `"user-123"` is a tracked origin.
1151
- transact(() => {
1152
- sharedType.push(["hello world!"]);
1153
- }, "user-123");
1140
+ /**
1141
+ * @description Check whether calling undo will mutate storage
1142
+ */
1143
+ const canUndo: boolean = useCanUndo();
1144
+ /**
1145
+ * @description Check whether calling redo will mutate storage
1146
+ */
1147
+ const canRedo: boolean = useCanRedo();
1154
1148
 
1155
- /**
1156
- * @description Undoes the last valid mutation to storage
1157
- */
1158
- const undo = useUndo();
1149
+ const [messages, sharedType] = useStorage("messages");
1159
1150
 
1160
- undo();
1151
+ /**
1152
+ * @description Calling transact will enable a storage mutation to be undone/redone.
1153
+ * When called without an origin, the origin will default to the user's connection
1154
+ * id.
1155
+ *
1156
+ * You can specify a 2nd parameter to transact with a different transaction origin.
1157
+ */
1158
+ const transact = useTransact();
1161
1159
 
1162
- /**
1163
- * @description Re-applies the last undone mutation to storage
1164
- */
1165
- const redo = useRedo();
1160
+ transact(() => {
1161
+ sharedType.push(["hello world!"]);
1162
+ });
1166
1163
 
1167
- redo();
1168
- ```
1164
+ // This will also be undoable because `"user-123"` is a tracked origin.
1165
+ transact(() => {
1166
+ sharedType.push(["hello world!"]);
1167
+ }, "user-123");
1168
+
1169
+ /**
1170
+ * @description Undoes the last valid mutation to storage
1171
+ */
1172
+ const undo = useUndo();
1173
+
1174
+ undo();
1175
+
1176
+ /**
1177
+ * @description Re-applies the last undone mutation to storage
1178
+ */
1179
+ const redo = useRedo();
1180
+
1181
+ redo();
1182
+ ```
1169
1183
 
1170
1184
  ### Patch Changes
1171
1185
 
@@ -1176,7 +1190,7 @@
1176
1190
  ### Patch Changes
1177
1191
 
1178
1192
  - 74b3061: Bumped minor and patch dependencies.
1179
- - @pluv/types@0.11.1
1193
+ - @pluv/types@0.11.1
1180
1194
 
1181
1195
  ## 0.11.0
1182
1196
 
@@ -1202,7 +1216,7 @@
1202
1216
 
1203
1217
  - 885835d: remove unnecessary dependency
1204
1218
  - Updated dependencies [885835d]
1205
- - @pluv/types@0.10.1
1219
+ - @pluv/types@0.10.1
1206
1220
 
1207
1221
  ## 0.10.0
1208
1222
 
@@ -1213,7 +1227,7 @@
1213
1227
  ### Patch Changes
1214
1228
 
1215
1229
  - Updated dependencies [f43f1cc]
1216
- - @pluv/types@0.10.0
1230
+ - @pluv/types@0.10.0
1217
1231
 
1218
1232
  ## 0.4.2
1219
1233
 
@@ -1221,18 +1235,18 @@
1221
1235
 
1222
1236
  - f4317ba: \* Renamed type `unstable_YObjectValue` to `YObjectValue`;
1223
1237
 
1224
- - Renamed type `unstable_YObject` to `YObject`.
1225
- - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
1238
+ - Renamed type `unstable_YObject` to `YObject`.
1239
+ - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
1226
1240
 
1227
- ```ts
1228
- import { y } from "@pluv/client";
1229
- // or
1230
- import { y } from "@pluv/react";
1241
+ ```ts
1242
+ import { y } from "@pluv/client";
1243
+ // or
1244
+ import { y } from "@pluv/react";
1231
1245
 
1232
- y.xmlElement("MyElement", {});
1233
- y.xmlFragment({});
1234
- y.xmlText("hello world");
1235
- ```
1246
+ y.xmlElement("MyElement", {});
1247
+ y.xmlFragment({});
1248
+ y.xmlText("hello world");
1249
+ ```
1236
1250
 
1237
1251
  ## 0.4.1
1238
1252
 
@@ -1242,7 +1256,7 @@
1242
1256
  - 8997c65: bumped dependencies
1243
1257
  - Updated dependencies [8fba48b]
1244
1258
  - Updated dependencies [8997c65]
1245
- - @pluv/types@0.2.2
1259
+ - @pluv/types@0.2.2
1246
1260
 
1247
1261
  ## 0.4.0
1248
1262
 
@@ -1250,54 +1264,54 @@
1250
1264
 
1251
1265
  - 829d31b: Added support for defining persistant frontend storage for rooms via a new `addons` option on rooms.
1252
1266
 
1253
- 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:
1267
+ 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:
1254
1268
 
1255
- ```
1256
- npm install @pluv/addon-indexeddb
1257
- ```
1269
+ ```
1270
+ npm install @pluv/addon-indexeddb
1271
+ ```
1258
1272
 
1259
- To use this new addon, simply pass it to options when creating a room:
1273
+ To use this new addon, simply pass it to options when creating a room:
1260
1274
 
1261
- ```ts
1262
- import { addonIndexedDB } from "@pluv/addon-indexeddb";
1263
- import { createClient } from "@pluv/client";
1275
+ ```ts
1276
+ import { addonIndexedDB } from "@pluv/addon-indexeddb";
1277
+ import { createClient } from "@pluv/client";
1264
1278
 
1265
- const client = createClient({
1266
- // ...
1267
- });
1279
+ const client = createClient({
1280
+ // ...
1281
+ });
1268
1282
 
1269
- const room = client.createRoom("my-new-room", {
1270
- addons: [
1271
- // Define your addons in an array like so
1272
- addonIndexedDB(),
1273
- ],
1274
- });
1275
- ```
1283
+ const room = client.createRoom("my-new-room", {
1284
+ addons: [
1285
+ // Define your addons in an array like so
1286
+ addonIndexedDB(),
1287
+ ],
1288
+ });
1289
+ ```
1276
1290
 
1277
- Or when using `@pluv/react`:
1291
+ Or when using `@pluv/react`:
1278
1292
 
1279
- ```ts
1280
- const PluvRoom = createRoomBundle({
1281
- // ...
1282
- addons: [
1283
- // Define your addons in an array like so
1284
- addonIndexedDB(),
1285
- ],
1286
- });
1287
- ```
1293
+ ```ts
1294
+ const PluvRoom = createRoomBundle({
1295
+ // ...
1296
+ addons: [
1297
+ // Define your addons in an array like so
1298
+ addonIndexedDB(),
1299
+ ],
1300
+ });
1301
+ ```
1288
1302
 
1289
1303
  ### Patch Changes
1290
1304
 
1291
1305
  - 8d11672: bumped dependencies to latest
1292
1306
  - Updated dependencies [8d11672]
1293
- - @pluv/types@0.2.1
1307
+ - @pluv/types@0.2.1
1294
1308
 
1295
1309
  ## 0.3.8
1296
1310
 
1297
1311
  ### Patch Changes
1298
1312
 
1299
1313
  - b85a232: bumped dependencies
1300
- - @pluv/types@0.2.0
1314
+ - @pluv/types@0.2.0
1301
1315
 
1302
1316
  ## 0.3.7
1303
1317
 
@@ -1308,7 +1322,7 @@
1308
1322
  - Updated dependencies [0dd847e]
1309
1323
  - Updated dependencies [bb2886b]
1310
1324
  - Updated dependencies [ae679a8]
1311
- - @pluv/types@0.2.0
1325
+ - @pluv/types@0.2.0
1312
1326
 
1313
1327
  ## 0.3.6
1314
1328
 
@@ -1322,7 +1336,7 @@
1322
1336
 
1323
1337
  - 850626e: bumped dependencies
1324
1338
  - Updated dependencies [850626e]
1325
- - @pluv/types@0.1.6
1339
+ - @pluv/types@0.1.6
1326
1340
 
1327
1341
  ## 0.3.4
1328
1342
 
@@ -1336,7 +1350,7 @@
1336
1350
 
1337
1351
  - 74870ee: bumped dependencies
1338
1352
  - Updated dependencies [74870ee]
1339
- - @pluv/types@0.1.5
1353
+ - @pluv/types@0.1.5
1340
1354
 
1341
1355
  ## 0.3.2
1342
1356
 
@@ -1349,7 +1363,7 @@
1349
1363
  - Updated dependencies [9516a4e]
1350
1364
  - Updated dependencies [7b6da1c]
1351
1365
  - Updated dependencies [e9c1514]
1352
- - @pluv/types@0.1.4
1366
+ - @pluv/types@0.1.4
1353
1367
 
1354
1368
  ## 0.3.1
1355
1369
 
@@ -1357,7 +1371,7 @@
1357
1371
 
1358
1372
  - 161e00e: fixed links to other pluv packages in readmes
1359
1373
  - f6c0e65: bumped dependencies
1360
- - @pluv/types@0.1.3
1374
+ - @pluv/types@0.1.3
1361
1375
 
1362
1376
  ## 0.3.0
1363
1377
 
@@ -1374,7 +1388,7 @@
1374
1388
  - Updated dependencies [8bf62cb]
1375
1389
  - Updated dependencies [7e52685]
1376
1390
  - Updated dependencies [8e97fb2]
1377
- - @pluv/types@0.1.3
1391
+ - @pluv/types@0.1.3
1378
1392
 
1379
1393
  ## 0.2.0
1380
1394
 
@@ -1392,7 +1406,7 @@
1392
1406
 
1393
1407
  - fe80d7b: added preview disclaimer about breaking changes in the readme
1394
1408
  - Updated dependencies [fe80d7b]
1395
- - @pluv/types@0.1.2
1409
+ - @pluv/types@0.1.2
1396
1410
 
1397
1411
  ## 0.1.2
1398
1412
 
@@ -1406,7 +1420,7 @@
1406
1420
 
1407
1421
  - 24016e6: Updated dependencies
1408
1422
  - Updated dependencies [24016e6]
1409
- - @pluv/types@0.1.1
1423
+ - @pluv/types@0.1.1
1410
1424
 
1411
1425
  ## 0.1.0
1412
1426
 
@@ -1417,4 +1431,4 @@
1417
1431
  ### Patch Changes
1418
1432
 
1419
1433
  - Updated dependencies [a22f525]
1420
- - @pluv/types@0.1.0
1434
+ - @pluv/types@0.1.0
package/dist/index.d.mts CHANGED
@@ -30,7 +30,7 @@ type AwarenessPresence<TPresence extends Record<string, any>, TField extends key
30
30
  declare const array: <T extends unknown>(value?: T[] | readonly T[]) => YjsType<Array<T>, T[]>;
31
31
 
32
32
  interface PluvYjsAwarenessParams<TIO extends IOLike<any>, TPresence extends Record<string, any>, TStorage extends Record<string, CrdtType$1<any, any>>, TEvents extends PluvRouterEventConfig, TField extends keyof TPresence | null = null> {
33
- field?: TField;
33
+ presenceField?: TField;
34
34
  room: RoomLike<TIO, Doc, TPresence, TStorage, TEvents>;
35
35
  }
36
36
  declare class PluvYjsAwareness<TIO extends IOLike, TPresence extends Record<string, any>, TStorage extends Record<string, CrdtType$1<any, any>>, TEvents extends PluvRouterEventConfig, TField extends keyof TPresence | null = null> extends ObservableV2<{
@@ -130,7 +130,7 @@ declare const map: <T extends unknown>(value?: readonly (readonly [key: string,
130
130
  declare const object: <T extends Record<string, any>>(value?: T) => YjsType<Map$1<T[keyof T]>, T>;
131
131
 
132
132
  interface PluvYjsProviderParams<TIO extends IOLike<any>, TPresence extends Record<string, any>, TStorage extends Record<string, CrdtType$1<any, any>>, TEvents extends PluvRouterEventConfig, TField extends keyof TPresence | null = null> {
133
- field?: TField;
133
+ presenceField?: TField;
134
134
  room: RoomLike<TIO, Doc, TPresence, TStorage, TEvents>;
135
135
  }
136
136
  /**
package/dist/index.d.ts CHANGED
@@ -30,7 +30,7 @@ type AwarenessPresence<TPresence extends Record<string, any>, TField extends key
30
30
  declare const array: <T extends unknown>(value?: T[] | readonly T[]) => YjsType<Array<T>, T[]>;
31
31
 
32
32
  interface PluvYjsAwarenessParams<TIO extends IOLike<any>, TPresence extends Record<string, any>, TStorage extends Record<string, CrdtType$1<any, any>>, TEvents extends PluvRouterEventConfig, TField extends keyof TPresence | null = null> {
33
- field?: TField;
33
+ presenceField?: TField;
34
34
  room: RoomLike<TIO, Doc, TPresence, TStorage, TEvents>;
35
35
  }
36
36
  declare class PluvYjsAwareness<TIO extends IOLike, TPresence extends Record<string, any>, TStorage extends Record<string, CrdtType$1<any, any>>, TEvents extends PluvRouterEventConfig, TField extends keyof TPresence | null = null> extends ObservableV2<{
@@ -130,7 +130,7 @@ declare const map: <T extends unknown>(value?: readonly (readonly [key: string,
130
130
  declare const object: <T extends Record<string, any>>(value?: T) => YjsType<Map$1<T[keyof T]>, T>;
131
131
 
132
132
  interface PluvYjsProviderParams<TIO extends IOLike<any>, TPresence extends Record<string, any>, TStorage extends Record<string, CrdtType$1<any, any>>, TEvents extends PluvRouterEventConfig, TField extends keyof TPresence | null = null> {
133
- field?: TField;
133
+ presenceField?: TField;
134
134
  room: RoomLike<TIO, Doc, TPresence, TStorage, TEvents>;
135
135
  }
136
136
  /**
package/dist/index.js CHANGED
@@ -97,10 +97,10 @@ var PluvYjsAwareness = class extends import_observable.ObservableV2 {
97
97
  */
98
98
  this.meta = /* @__PURE__ */ new Map();
99
99
  this._checkInterval = 0;
100
- const { field, room } = params;
100
+ const { presenceField, room } = params;
101
101
  this.doc = room.getDoc().value;
102
102
  this._room = room;
103
- if (!!field) this._field = field;
103
+ if (!!presenceField) this._field = presenceField;
104
104
  const myPresence = this._room.getMyPresence();
105
105
  const myMeta = (myPresence == null ? void 0 : myPresence[PLUV_PRESENCE_META_KEY]) || {};
106
106
  this._room.updateMyPresence({
@@ -609,8 +609,8 @@ var PluvYjsProvider = class extends import_observable2.ObservableV2 {
609
609
  constructor(params) {
610
610
  super();
611
611
  this._synced = false;
612
- const { field, room } = params;
613
- this.awareness = awareness({ field, room });
612
+ const { presenceField, room } = params;
613
+ this.awareness = awareness({ presenceField, room });
614
614
  this.doc = room.getDoc().value;
615
615
  this._room = room;
616
616
  const subscriptions = [
package/dist/index.mjs CHANGED
@@ -78,10 +78,10 @@ var PluvYjsAwareness = class extends ObservableV2 {
78
78
  */
79
79
  this.meta = /* @__PURE__ */ new Map();
80
80
  this._checkInterval = 0;
81
- const { field, room } = params;
81
+ const { presenceField, room } = params;
82
82
  this.doc = room.getDoc().value;
83
83
  this._room = room;
84
- if (!!field) this._field = field;
84
+ if (!!presenceField) this._field = presenceField;
85
85
  const myPresence = this._room.getMyPresence();
86
86
  const myMeta = (myPresence == null ? void 0 : myPresence[PLUV_PRESENCE_META_KEY]) || {};
87
87
  this._room.updateMyPresence({
@@ -604,8 +604,8 @@ var PluvYjsProvider = class extends ObservableV22 {
604
604
  constructor(params) {
605
605
  super();
606
606
  this._synced = false;
607
- const { field, room } = params;
608
- this.awareness = awareness({ field, room });
607
+ const { presenceField, room } = params;
608
+ this.awareness = awareness({ presenceField, room });
609
609
  this.doc = room.getDoc().value;
610
610
  this._room = room;
611
611
  const subscriptions = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/crdt-yjs",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "yjs for @pluv/io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,22 +17,22 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@types/node": "^22.15.18",
20
+ "@types/node": "^22.15.21",
21
21
  "js-base64": "^3.7.7",
22
22
  "lib0": "^0.2.108",
23
- "@pluv/crdt": "^2.2.1",
24
- "@pluv/types": "^2.2.1"
23
+ "@pluv/crdt": "^2.2.3",
24
+ "@pluv/types": "^2.2.3"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "yjs": "^13.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "eslint": "^9.26.0",
31
- "tsup": "^8.4.0",
30
+ "eslint": "^9.27.0",
31
+ "tsup": "^8.5.0",
32
32
  "typescript": "^5.8.3",
33
33
  "yjs": "^13.6.27",
34
- "@pluv/tsconfig": "^2.2.1",
35
- "eslint-config-pluv": "^2.2.1"
34
+ "@pluv/tsconfig": "^2.2.3",
35
+ "eslint-config-pluv": "^2.2.3"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -18,7 +18,7 @@ export interface PluvYjsAwarenessParams<
18
18
  TEvents extends PluvRouterEventConfig,
19
19
  TField extends keyof TPresence | null = null,
20
20
  > {
21
- field?: TField;
21
+ presenceField?: TField;
22
22
  room: RoomLike<TIO, YDoc, TPresence, TStorage, TEvents>;
23
23
  }
24
24
 
@@ -51,12 +51,12 @@ export class PluvYjsAwareness<
51
51
  constructor(params: PluvYjsAwarenessParams<TIO, TPresence, TStorage, TEvents, TField>) {
52
52
  super();
53
53
 
54
- const { field, room } = params;
54
+ const { presenceField, room } = params;
55
55
 
56
56
  this.doc = room.getDoc().value;
57
57
  this._room = room;
58
58
 
59
- if (!!field) this._field = field;
59
+ if (!!presenceField) this._field = presenceField;
60
60
 
61
61
  const myPresence: any = this._room.getMyPresence();
62
62
  const myMeta = myPresence?.[PLUV_PRESENCE_META_KEY] || {};
@@ -13,7 +13,7 @@ export interface PluvYjsProviderParams<
13
13
  TEvents extends PluvRouterEventConfig,
14
14
  TField extends keyof TPresence | null = null,
15
15
  > {
16
- field?: TField;
16
+ presenceField?: TField;
17
17
  room: RoomLike<TIO, YDoc, TPresence, TStorage, TEvents>;
18
18
  }
19
19
 
@@ -53,9 +53,9 @@ export class PluvYjsProvider<
53
53
  constructor(params: PluvYjsProviderParams<TIO, TPresence, TStorage, TEvents, TField>) {
54
54
  super();
55
55
 
56
- const { field, room } = params;
56
+ const { presenceField, room } = params;
57
57
 
58
- this.awareness = awareness({ field, room });
58
+ this.awareness = awareness({ presenceField, room });
59
59
  this.doc = room.getDoc().value;
60
60
 
61
61
  this._room = room;