@pluv/crdt-yjs 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.2 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
+ CJS dist/index.js 23.19 KB
12
+ CJS ⚡️ Build success in 123ms
13
+ ESM dist/index.mjs 22.25 KB
14
+ ESM ⚡️ Build success in 124ms
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 4915ms
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,13 @@
1
1
  # @pluv/crdt-yjs
2
2
 
3
+ ## 2.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 289d71d: Updated `yjs.provider` field to `presenceField`.
8
+ - @pluv/crdt@2.2.2
9
+ - @pluv/types@2.2.2
10
+
3
11
  ## 2.2.1
4
12
 
5
13
  ### Patch Changes
@@ -13,71 +21,71 @@
13
21
 
14
22
  - 745f6df: Added a `provider` function that satisfies Yjs's provider interface.
15
23
 
16
- ```ts
17
- import { createClient } from "@pluv/client";
18
- import { yjs } from "@pluv/crdt-yjs";
24
+ ```ts
25
+ import { createClient } from "@pluv/client";
26
+ import { yjs } from "@pluv/crdt-yjs";
19
27
 
20
- const client = createClient({
21
- /* ... */
22
- });
23
- const room = client.createRoom("example-room");
28
+ const client = createClient({
29
+ /* ... */
30
+ });
31
+ const room = client.createRoom("example-room");
24
32
 
25
- // Yjs Provider
26
- yjs.provider({ room });
27
- ```
33
+ // Yjs Provider
34
+ yjs.provider({ room });
35
+ ```
28
36
 
29
37
  - df4ceed: Update `yjs.awareness` and `yjs.provider` to allow for a `field` parameter to use awareness on a nested presence field.
30
38
 
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
- ```
39
+ ```ts
40
+ createClient({
41
+ presence: z.object({
42
+ topField: z.number(),
43
+ forAwareness: z.object({
44
+ nestedField: z.number(),
45
+ }),
46
+ }),
47
+ });
48
+
49
+ yjs.provider({
50
+ // ...
51
+ // Optional field to use a nested field, instead of the presence root
52
+ field: "forAwareness",
53
+ });
54
+
55
+ yjs.awareness({
56
+ // ...
57
+ // Optional field to use a nested field, instead of the presence root
58
+ field: "forAwareness",
59
+ });
60
+ ```
61
+
62
+ This allows better integrations with [lexical](https://lexical.dev), since they have their own presence types.
63
+
64
+ ```tsx
65
+ createClient({
66
+ presence: z.object({
67
+ topField: z.number(),
68
+ lexical: z.any(),
69
+ }),
70
+ });
71
+
72
+ yjs.provider({ field: "lexical" /* ... */ });
73
+ ```
66
74
 
67
75
  - 6323979: Added an `awareness` function that satisfies Yjs's [awareness interface](https://github.com/yjs/y-protocols/blob/master/awareness.js).
68
76
 
69
- ```ts
70
- import { createClient } from "@pluv/client";
71
- import { yjs } from "@pluv/crdt-yjs";
77
+ ```ts
78
+ import { createClient } from "@pluv/client";
79
+ import { yjs } from "@pluv/crdt-yjs";
72
80
 
73
- const client = createClient({
74
- /* ... */
75
- });
76
- const room = client.createRoom("example-room");
81
+ const client = createClient({
82
+ /* ... */
83
+ });
84
+ const room = client.createRoom("example-room");
77
85
 
78
- // Yjs Awareness
79
- yjs.awareness({ room /* ... */ });
80
- ```
86
+ // Yjs Awareness
87
+ yjs.awareness({ room /* ... */ });
88
+ ```
81
89
 
82
90
  ### Patch Changes
83
91
 
@@ -97,10 +105,10 @@
97
105
 
98
106
  - 945c47d: Updated deprecation warnings to read that features will be removed in v3 instead of v2.
99
107
 
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.
108
+ 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
109
 
102
- - @pluv/crdt@2.0.2
103
- - @pluv/types@2.0.2
110
+ - @pluv/crdt@2.0.2
111
+ - @pluv/types@2.0.2
104
112
 
105
113
  ## 2.0.1
106
114
 
@@ -115,43 +123,43 @@
115
123
 
116
124
  - 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
125
 
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.
126
+ ```ts
127
+ import { yjs } from "@pluv/crdt-yjs";
128
+
129
+ // Before
130
+ yjs.doc(() => ({
131
+ // Using the `yjs` utility (in this case `yjs.map`) when declaring
132
+ // top-level types is now deprecated
133
+ topType: yjs.map([
134
+ ["key1", yjs.text("")],
135
+ ["key2", yjs.text("")],
136
+ ]),
137
+ }));
138
+
139
+ // After
140
+ yjs.doc((t) => ({
141
+ // Top-level properties must now use the builder (in this case `t`).
142
+ // This effectively calls `yjs.getMap("topType")` to instantiate the type on
143
+ // the root document.
144
+ // This simply returns the native Yjs shared-types (e.g. Y.Map), which
145
+ // allows you operate on your yjs shared-typess in a more native way.
146
+ topType: t.map("topType", [
147
+ // Declaring nested types should continue to use the `yjs` utilities
148
+ // you've used before
149
+ ["key1", yjs.text("")],
150
+ ["key2", yjs.text("")],
151
+ ]),
152
+ }));
153
+ ```
154
+
155
+ 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
156
 
149
157
  ### Patch Changes
150
158
 
151
159
  - 0b234d1: Fixed `Y.XmlText` types transforming into `Y.Text` types on the initial initializaion of storage states.
152
160
  - Updated dependencies [047a1d8]
153
- - @pluv/types@2.0.0
154
- - @pluv/crdt@2.0.0
161
+ - @pluv/types@2.0.0
162
+ - @pluv/crdt@2.0.0
155
163
 
156
164
  ## 1.0.2
157
165
 
@@ -173,15 +181,15 @@
173
181
 
174
182
  - af94706: pluv.io is now stable and production ready!
175
183
 
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.
184
+ 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
185
 
178
- Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
186
+ Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
179
187
 
180
188
  ### Patch Changes
181
189
 
182
190
  - Updated dependencies [af94706]
183
- - @pluv/crdt@1.0.0
184
- - @pluv/types@1.0.0
191
+ - @pluv/crdt@1.0.0
192
+ - @pluv/types@1.0.0
185
193
 
186
194
  ## 0.44.2
187
195
 
@@ -202,8 +210,8 @@
202
210
  ### Patch Changes
203
211
 
204
212
  - 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
213
+ - @pluv/crdt@0.44.0
214
+ - @pluv/types@0.44.0
207
215
 
208
216
  ## 0.43.0
209
217
 
@@ -413,8 +421,8 @@
413
421
  ### Patch Changes
414
422
 
415
423
  - Updated dependencies [f4ceca3]
416
- - @pluv/types@0.38.0
417
- - @pluv/crdt@0.38.0
424
+ - @pluv/types@0.38.0
425
+ - @pluv/crdt@0.38.0
418
426
 
419
427
  ## 0.37.7
420
428
 
@@ -498,16 +506,16 @@
498
506
  ### Patch Changes
499
507
 
500
508
  - Updated dependencies [81cb692]
501
- - @pluv/types@0.35.2
502
- - @pluv/crdt@0.35.2
509
+ - @pluv/types@0.35.2
510
+ - @pluv/crdt@0.35.2
503
511
 
504
512
  ## 0.35.1
505
513
 
506
514
  ### Patch Changes
507
515
 
508
516
  - 820898c: Increase undo/redo merge interval from 0s to 1s.
509
- - @pluv/crdt@0.35.1
510
- - @pluv/types@0.35.1
517
+ - @pluv/crdt@0.35.1
518
+ - @pluv/types@0.35.1
511
519
 
512
520
  ## 0.35.0
513
521
 
@@ -633,8 +641,8 @@
633
641
  ### Patch Changes
634
642
 
635
643
  - 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
644
+ - @pluv/crdt@0.30.0
645
+ - @pluv/types@0.30.0
638
646
 
639
647
  ## 0.29.0
640
648
 
@@ -747,76 +755,76 @@
747
755
 
748
756
  - 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
757
 
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.
758
+ 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
759
 
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.
760
+ 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
761
 
754
- ```ts
755
- // Before
762
+ ```ts
763
+ // Before
764
+
765
+ import { yjs } from "@pluv/crdt-yjs";
756
766
 
757
- import { yjs } from "@pluv/crdt-yjs";
767
+ yjs.array([]); // Returns CrdtYjsArray
768
+ yjs.object([]); // Returns CrdtYjsObject
758
769
 
759
- yjs.array([]); // Returns CrdtYjsArray
760
- yjs.object([]); // Returns CrdtYjsObject
770
+ const room: PluvRoom = /* ... */;
761
771
 
762
- const room: PluvRoom = /* ... */;
772
+ room.getStorage("messages"); // Returns AbstractCrdtType
763
773
 
764
- room.getStorage("messages"); // Returns AbstractCrdtType
774
+ const [, sharedType] = useStorage("messages"); // sharedType is an AbstractCrdtType
775
+ ```
765
776
 
766
- const [, sharedType] = useStorage("messages"); // sharedType is an AbstractCrdtType
767
- ```
777
+ ```ts
778
+ // Now
768
779
 
769
- ```ts
770
- // Now
780
+ import { yjs } from "@pluv/crdt-yjs";
771
781
 
772
- import { yjs } from "@pluv/crdt-yjs";
782
+ yjs.array([]); // Returns yjs.Array
783
+ yjs.object([]); // Returns yjs.Map
773
784
 
774
- yjs.array([]); // Returns yjs.Array
775
- yjs.object([]); // Returns yjs.Map
785
+ const room: PluvRoom = /* ... */;
776
786
 
777
- const room: PluvRoom = /* ... */;
787
+ room.getStorage("messages"); // Returns yjs.AbstractType
778
788
 
779
- room.getStorage("messages"); // Returns yjs.AbstractType
789
+ const [, sharedType] = useStorage("messages"); // sharedType is a yjs.AbstractType
790
+ ```
780
791
 
781
- const [, sharedType] = useStorage("messages"); // sharedType is a yjs.AbstractType
782
- ```
792
+ 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:
783
793
 
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:
794
+ ```ts
795
+ // Before
785
796
 
786
- ```ts
787
- // Before
797
+ const [data, container] = useStorage("messages");
788
798
 
789
- const [data, container] = useStorage("messages");
799
+ // This automatically called Loro.commit under the hood and rerendered the page with updated data.
800
+ container.push(loro.object({ name: "John Doe", age: 35 }));
801
+ ```
790
802
 
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
- ```
803
+ ```ts
804
+ // Now
794
805
 
795
- ```ts
796
- // Now
806
+ const [data, container] = useStorage("messages");
797
807
 
798
- const [data, container] = useStorage("messages");
808
+ const doc = useDoc();
809
+ const transact = useTransact();
799
810
 
800
- const doc = useDoc();
801
- const transact = useTransact();
811
+ // Updates need to be committed back to the doc whenever the changes need to be emitted to other users
812
+ // The returned data also will not update until the changes are commited
802
813
 
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
814
+ // The two operations below are functionally equivalent
815
+ transact(() => {
816
+ container.push(loro.object({ name: "John Doe", age: 35 }));
817
+ });
805
818
 
806
- // The two operations below are functionally equivalent
807
- transact(() => {
808
819
  container.push(loro.object({ name: "John Doe", age: 35 }));
809
- });
810
-
811
- container.push(loro.object({ name: "John Doe", age: 35 }));
812
- doc.value.commit();
813
- ```
820
+ doc.value.commit();
821
+ ```
814
822
 
815
823
  ### Patch Changes
816
824
 
817
825
  - Updated dependencies [9492085]
818
- - @pluv/crdt@0.20.0
819
- - @pluv/types@0.20.0
826
+ - @pluv/crdt@0.20.0
827
+ - @pluv/types@0.20.0
820
828
 
821
829
  ## 0.19.0
822
830
 
@@ -830,8 +838,8 @@
830
838
  ### Patch Changes
831
839
 
832
840
  - Updated dependencies [99b5ca9]
833
- - @pluv/types@0.18.0
834
- - @pluv/crdt@0.18.0
841
+ - @pluv/types@0.18.0
842
+ - @pluv/crdt@0.18.0
835
843
 
836
844
  ## 0.17.3
837
845
 
@@ -859,8 +867,8 @@
859
867
  ### Patch Changes
860
868
 
861
869
  - Updated dependencies [507bc00]
862
- - @pluv/types@0.17.0
863
- - @pluv/crdt@0.17.0
870
+ - @pluv/types@0.17.0
871
+ - @pluv/crdt@0.17.0
864
872
 
865
873
  ## 0.16.3
866
874
 
@@ -919,7 +927,7 @@
919
927
  ### Patch Changes
920
928
 
921
929
  - da9f600: Upgraded dependencies
922
- - @pluv/types@0.12.3
930
+ - @pluv/types@0.12.3
923
931
 
924
932
  ## 0.12.2
925
933
 
@@ -939,233 +947,232 @@
939
947
 
940
948
  - 436040b: Added ability to undo and redo changes to storage.
941
949
 
942
- ## @pluv/crdt-yjs
950
+ ## @pluv/crdt-yjs
951
+
952
+ `@pluv/crdt-yjs` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `trackOrigins`.
953
+
954
+ Refer to the code-example below to better understand how to undo and redo with your doc.
955
+
956
+ ```ts
957
+ // Example
958
+ import { array, doc } from "@pluv/crdt-yjs";
959
+
960
+ // Create your doc with your shared-types
961
+ const myDoc = doc({
962
+ messages: array<string>([]),
963
+ });
964
+
965
+ /**
966
+ * @description Track origins to enable undos and redos for your document.
967
+ * trackOrigins must be called before any storage mutations, to enable those
968
+ * mutations to be undone/redone.
969
+ */
970
+ myDoc.trackOrigins({
971
+ /**
972
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
973
+ * This specifies a number in ms, during which edits are merged together to be
974
+ * undone together. Set this to 0, to track each transacted change individually.
975
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
976
+ * @default 500
977
+ */
978
+ captureTimeout: 500,
979
+ /**
980
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
981
+ * This specifies transaction origins (strings only) to filter which transactions
982
+ * can be undone.
983
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
984
+ * @default undefined
985
+ */
986
+ trackedOrigins: ["user-123"],
987
+ });
988
+
989
+ /**
990
+ * @description Check whether calling undo will mutate storage
991
+ * @returns boolean
992
+ */
993
+ myDoc.canUndo();
994
+ /**
995
+ * @description Check whether calling redo will mutate storage
996
+ * @returns boolean
997
+ */
998
+ myDoc.canRedo();
999
+
1000
+ // Perform a storage mutation within a transaction so that it can be affected
1001
+ // by undo/redo operations.
1002
+ myDoc.transact(() => {
1003
+ myDoc.get("messages").push(["hello world!"]);
1004
+ }, "user-123");
943
1005
 
944
- `@pluv/crdt-yjs` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `trackOrigins`.
1006
+ /**
1007
+ * @description Undoes the last valid mutation to storage
1008
+ */
1009
+ myDoc.undo();
945
1010
 
946
- Refer to the code-example below to better understand how to undo and redo with your doc.
1011
+ /**
1012
+ * @description Re-applies the last undone mutation to storage
1013
+ */
1014
+ myDoc.redo();
1015
+ ```
1016
+
1017
+ ## @pluv/client
947
1018
 
948
- ```ts
949
- // Example
950
- import { array, doc } from "@pluv/crdt-yjs";
1019
+ `@pluv/client`'s `PluvRoom` and `MockedRoom` now exposes 5 new methods: `canRedo`, `canUndo`, `redo`, `undo` and `transact`.
1020
+
1021
+ Refer to the code-example below to better understand how to undo and redo with your `PluvRoom`.
1022
+
1023
+ ```ts
1024
+ import { createClient, y } from "@pluv/client";
951
1025
 
952
- // Create your doc with your shared-types
953
- const myDoc = doc({
954
- messages: array<string>([]),
955
- });
1026
+ const client = createClient({});
956
1027
 
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
1028
  /**
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
1029
+ * @description When a room is created, undo/redo will automatically
1030
+ * be configured to filter for changes made by the connected user
1031
+ * (so that users only undo/redo their changes).
969
1032
  */
970
- captureTimeout: 500,
1033
+ const room = client.createRoom("my-room", {
1034
+ initialStorage: () => ({
1035
+ messages: y.array<string>([]),
1036
+ }),
1037
+ /**
1038
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
1039
+ * This specifies a number in ms, during which edits are merged together to be
1040
+ * undone together. Set this to 0, to track each transacted change individually.
1041
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1042
+ * @default 500
1043
+ */
1044
+ captureTimeout: 500,
1045
+ /**
1046
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1047
+ * This specifies transaction origins (strings only) to filter which transactions
1048
+ * can be undone.
1049
+ * When omitted, the user's connection id will be tracked. When provided,
1050
+ * specifies additional tracked origins besides the user's connection id.
1051
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1052
+ * @default undefined
1053
+ */
1054
+ trackedOrigins: ["user-123"],
1055
+ });
1056
+
971
1057
  /**
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
1058
+ * @description Check whether calling undo will mutate storage
1059
+ * @returns boolean
977
1060
  */
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
- }),
1061
+ room.canUndo();
1029
1062
  /**
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
1063
+ * @description Check whether calling redo will mutate storage
1064
+ * @returns boolean
1035
1065
  */
1036
- captureTimeout: 500,
1066
+ room.canRedo();
1067
+
1037
1068
  /**
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
1069
+ * @description Calling transact will enable a storage mutation to be undone/redone.
1070
+ * When called without an origin, the origin will default to the user's connection
1071
+ * id.
1072
+ *
1073
+ * You can specify a 2nd parameter to transact with a different transaction origin.
1045
1074
  */
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"],
1075
+ room.transact(() => {
1076
+ room.get("messages").push(["hello world!"]);
1124
1077
  });
1125
1078
 
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();
1079
+ // This will also be undoable because `"user-123"` is a tracked origin.
1080
+ room.transact(() => {
1081
+ room.get("messages").push(["hello world!"]);
1082
+ }, "user-123");
1134
1083
 
1135
- const [messages, sharedType] = useStorage("messages");
1084
+ /**
1085
+ * @description Undoes the last valid mutation to storage
1086
+ */
1087
+ room.undo();
1136
1088
 
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();
1089
+ /**
1090
+ * @description Re-applies the last undone mutation to storage
1091
+ */
1092
+ room.redo();
1093
+ ```
1145
1094
 
1146
- transact(() => {
1147
- sharedType.push(["hello world!"]);
1148
- });
1095
+ ## @pluv/react
1096
+
1097
+ `@pluv/react`'s `createRoomBundle` now exposes 5 new react hooks: `useCanRedo`, `useCanUndo`, `useRedo`, `useUndo` and `useTransact`.
1098
+
1099
+ Refer to the code-example below to better understand how to undo and redo with your `createRoomBundle`.
1100
+
1101
+ ```tsx
1102
+ import { createBundle, createClient, y } from "@pluv/react";
1103
+ import { type io } from "./io";
1104
+
1105
+ const client = createClient<typeof io>();
1106
+
1107
+ const { createRoomBundle } = createBundle(client);
1108
+
1109
+ const { useCanRedo, useCanUndo, useRedo, useStorage, useTransact, useUndo } = createRoomBundle({
1110
+ initialStorage: () => ({
1111
+ messages: y.array<string>([]),
1112
+ }),
1113
+ /**
1114
+ * @description This is the same `captureTimeout` option from yjs's UndoManager.
1115
+ * This specifies a number in ms, during which edits are merged together to be
1116
+ * undone together. Set this to 0, to track each transacted change individually.
1117
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1118
+ * @default 500
1119
+ */
1120
+ captureTimeout: 500,
1121
+ /**
1122
+ * @desription This is the same `trackedOrigins` option from yjs's UndoManager.
1123
+ * This specifies transaction origins (strings only) to filter which transactions
1124
+ * can be undone.
1125
+ * When omitted, the user's connection id will be tracked. When provided,
1126
+ * specifies additional tracked origins besides the user's connection id.
1127
+ * @see (@link https://docs.yjs.dev/api/undo-manager)
1128
+ * @default undefined
1129
+ */
1130
+ trackedOrigins: ["user-123"],
1131
+ });
1149
1132
 
1150
- // This will also be undoable because `"user-123"` is a tracked origin.
1151
- transact(() => {
1152
- sharedType.push(["hello world!"]);
1153
- }, "user-123");
1133
+ /**
1134
+ * @description Check whether calling undo will mutate storage
1135
+ */
1136
+ const canUndo: boolean = useCanUndo();
1137
+ /**
1138
+ * @description Check whether calling redo will mutate storage
1139
+ */
1140
+ const canRedo: boolean = useCanRedo();
1141
+
1142
+ const [messages, sharedType] = useStorage("messages");
1143
+
1144
+ /**
1145
+ * @description Calling transact will enable a storage mutation to be undone/redone.
1146
+ * When called without an origin, the origin will default to the user's connection
1147
+ * id.
1148
+ *
1149
+ * You can specify a 2nd parameter to transact with a different transaction origin.
1150
+ */
1151
+ const transact = useTransact();
1152
+
1153
+ transact(() => {
1154
+ sharedType.push(["hello world!"]);
1155
+ });
1156
+
1157
+ // This will also be undoable because `"user-123"` is a tracked origin.
1158
+ transact(() => {
1159
+ sharedType.push(["hello world!"]);
1160
+ }, "user-123");
1154
1161
 
1155
- /**
1156
- * @description Undoes the last valid mutation to storage
1157
- */
1158
- const undo = useUndo();
1162
+ /**
1163
+ * @description Undoes the last valid mutation to storage
1164
+ */
1165
+ const undo = useUndo();
1159
1166
 
1160
- undo();
1167
+ undo();
1161
1168
 
1162
- /**
1163
- * @description Re-applies the last undone mutation to storage
1164
- */
1165
- const redo = useRedo();
1169
+ /**
1170
+ * @description Re-applies the last undone mutation to storage
1171
+ */
1172
+ const redo = useRedo();
1166
1173
 
1167
- redo();
1168
- ```
1174
+ redo();
1175
+ ```
1169
1176
 
1170
1177
  ### Patch Changes
1171
1178
 
@@ -1176,7 +1183,7 @@
1176
1183
  ### Patch Changes
1177
1184
 
1178
1185
  - 74b3061: Bumped minor and patch dependencies.
1179
- - @pluv/types@0.11.1
1186
+ - @pluv/types@0.11.1
1180
1187
 
1181
1188
  ## 0.11.0
1182
1189
 
@@ -1202,7 +1209,7 @@
1202
1209
 
1203
1210
  - 885835d: remove unnecessary dependency
1204
1211
  - Updated dependencies [885835d]
1205
- - @pluv/types@0.10.1
1212
+ - @pluv/types@0.10.1
1206
1213
 
1207
1214
  ## 0.10.0
1208
1215
 
@@ -1213,7 +1220,7 @@
1213
1220
  ### Patch Changes
1214
1221
 
1215
1222
  - Updated dependencies [f43f1cc]
1216
- - @pluv/types@0.10.0
1223
+ - @pluv/types@0.10.0
1217
1224
 
1218
1225
  ## 0.4.2
1219
1226
 
@@ -1221,18 +1228,18 @@
1221
1228
 
1222
1229
  - f4317ba: \* Renamed type `unstable_YObjectValue` to `YObjectValue`;
1223
1230
 
1224
- - Renamed type `unstable_YObject` to `YObject`.
1225
- - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
1231
+ - Renamed type `unstable_YObject` to `YObject`.
1232
+ - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
1226
1233
 
1227
- ```ts
1228
- import { y } from "@pluv/client";
1229
- // or
1230
- import { y } from "@pluv/react";
1234
+ ```ts
1235
+ import { y } from "@pluv/client";
1236
+ // or
1237
+ import { y } from "@pluv/react";
1231
1238
 
1232
- y.xmlElement("MyElement", {});
1233
- y.xmlFragment({});
1234
- y.xmlText("hello world");
1235
- ```
1239
+ y.xmlElement("MyElement", {});
1240
+ y.xmlFragment({});
1241
+ y.xmlText("hello world");
1242
+ ```
1236
1243
 
1237
1244
  ## 0.4.1
1238
1245
 
@@ -1242,7 +1249,7 @@
1242
1249
  - 8997c65: bumped dependencies
1243
1250
  - Updated dependencies [8fba48b]
1244
1251
  - Updated dependencies [8997c65]
1245
- - @pluv/types@0.2.2
1252
+ - @pluv/types@0.2.2
1246
1253
 
1247
1254
  ## 0.4.0
1248
1255
 
@@ -1250,54 +1257,54 @@
1250
1257
 
1251
1258
  - 829d31b: Added support for defining persistant frontend storage for rooms via a new `addons` option on rooms.
1252
1259
 
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:
1260
+ 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
1261
 
1255
- ```
1256
- npm install @pluv/addon-indexeddb
1257
- ```
1262
+ ```
1263
+ npm install @pluv/addon-indexeddb
1264
+ ```
1258
1265
 
1259
- To use this new addon, simply pass it to options when creating a room:
1266
+ To use this new addon, simply pass it to options when creating a room:
1260
1267
 
1261
- ```ts
1262
- import { addonIndexedDB } from "@pluv/addon-indexeddb";
1263
- import { createClient } from "@pluv/client";
1268
+ ```ts
1269
+ import { addonIndexedDB } from "@pluv/addon-indexeddb";
1270
+ import { createClient } from "@pluv/client";
1264
1271
 
1265
- const client = createClient({
1266
- // ...
1267
- });
1272
+ const client = createClient({
1273
+ // ...
1274
+ });
1268
1275
 
1269
- const room = client.createRoom("my-new-room", {
1270
- addons: [
1271
- // Define your addons in an array like so
1272
- addonIndexedDB(),
1273
- ],
1274
- });
1275
- ```
1276
+ const room = client.createRoom("my-new-room", {
1277
+ addons: [
1278
+ // Define your addons in an array like so
1279
+ addonIndexedDB(),
1280
+ ],
1281
+ });
1282
+ ```
1276
1283
 
1277
- Or when using `@pluv/react`:
1284
+ Or when using `@pluv/react`:
1278
1285
 
1279
- ```ts
1280
- const PluvRoom = createRoomBundle({
1281
- // ...
1282
- addons: [
1283
- // Define your addons in an array like so
1284
- addonIndexedDB(),
1285
- ],
1286
- });
1287
- ```
1286
+ ```ts
1287
+ const PluvRoom = createRoomBundle({
1288
+ // ...
1289
+ addons: [
1290
+ // Define your addons in an array like so
1291
+ addonIndexedDB(),
1292
+ ],
1293
+ });
1294
+ ```
1288
1295
 
1289
1296
  ### Patch Changes
1290
1297
 
1291
1298
  - 8d11672: bumped dependencies to latest
1292
1299
  - Updated dependencies [8d11672]
1293
- - @pluv/types@0.2.1
1300
+ - @pluv/types@0.2.1
1294
1301
 
1295
1302
  ## 0.3.8
1296
1303
 
1297
1304
  ### Patch Changes
1298
1305
 
1299
1306
  - b85a232: bumped dependencies
1300
- - @pluv/types@0.2.0
1307
+ - @pluv/types@0.2.0
1301
1308
 
1302
1309
  ## 0.3.7
1303
1310
 
@@ -1308,7 +1315,7 @@
1308
1315
  - Updated dependencies [0dd847e]
1309
1316
  - Updated dependencies [bb2886b]
1310
1317
  - Updated dependencies [ae679a8]
1311
- - @pluv/types@0.2.0
1318
+ - @pluv/types@0.2.0
1312
1319
 
1313
1320
  ## 0.3.6
1314
1321
 
@@ -1322,7 +1329,7 @@
1322
1329
 
1323
1330
  - 850626e: bumped dependencies
1324
1331
  - Updated dependencies [850626e]
1325
- - @pluv/types@0.1.6
1332
+ - @pluv/types@0.1.6
1326
1333
 
1327
1334
  ## 0.3.4
1328
1335
 
@@ -1336,7 +1343,7 @@
1336
1343
 
1337
1344
  - 74870ee: bumped dependencies
1338
1345
  - Updated dependencies [74870ee]
1339
- - @pluv/types@0.1.5
1346
+ - @pluv/types@0.1.5
1340
1347
 
1341
1348
  ## 0.3.2
1342
1349
 
@@ -1349,7 +1356,7 @@
1349
1356
  - Updated dependencies [9516a4e]
1350
1357
  - Updated dependencies [7b6da1c]
1351
1358
  - Updated dependencies [e9c1514]
1352
- - @pluv/types@0.1.4
1359
+ - @pluv/types@0.1.4
1353
1360
 
1354
1361
  ## 0.3.1
1355
1362
 
@@ -1357,7 +1364,7 @@
1357
1364
 
1358
1365
  - 161e00e: fixed links to other pluv packages in readmes
1359
1366
  - f6c0e65: bumped dependencies
1360
- - @pluv/types@0.1.3
1367
+ - @pluv/types@0.1.3
1361
1368
 
1362
1369
  ## 0.3.0
1363
1370
 
@@ -1374,7 +1381,7 @@
1374
1381
  - Updated dependencies [8bf62cb]
1375
1382
  - Updated dependencies [7e52685]
1376
1383
  - Updated dependencies [8e97fb2]
1377
- - @pluv/types@0.1.3
1384
+ - @pluv/types@0.1.3
1378
1385
 
1379
1386
  ## 0.2.0
1380
1387
 
@@ -1392,7 +1399,7 @@
1392
1399
 
1393
1400
  - fe80d7b: added preview disclaimer about breaking changes in the readme
1394
1401
  - Updated dependencies [fe80d7b]
1395
- - @pluv/types@0.1.2
1402
+ - @pluv/types@0.1.2
1396
1403
 
1397
1404
  ## 0.1.2
1398
1405
 
@@ -1406,7 +1413,7 @@
1406
1413
 
1407
1414
  - 24016e6: Updated dependencies
1408
1415
  - Updated dependencies [24016e6]
1409
- - @pluv/types@0.1.1
1416
+ - @pluv/types@0.1.1
1410
1417
 
1411
1418
  ## 0.1.0
1412
1419
 
@@ -1417,4 +1424,4 @@
1417
1424
  ### Patch Changes
1418
1425
 
1419
1426
  - Updated dependencies [a22f525]
1420
- - @pluv/types@0.1.0
1427
+ - @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.2",
4
4
  "description": "yjs for @pluv/io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -20,19 +20,19 @@
20
20
  "@types/node": "^22.15.18",
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.2",
24
+ "@pluv/types": "^2.2.2"
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.2",
35
+ "eslint-config-pluv": "^2.2.2"
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;