@coaction/yjs 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
 [](https://www.npmjs.com/package/@coaction/yjs) 
|
|
4
4
|
|
|
5
|
+
[English documentation](https://coactionjs.github.io/coaction/en/docs/) · [中文文档](https://coactionjs.github.io/coaction/zh/docs/)
|
|
6
|
+
|
|
5
7
|
A Coaction integration tool for Yjs.
|
|
6
8
|
|
|
7
9
|
## Installation
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
let
|
|
24
|
+
let coaction_adapter = require("coaction/adapter");
|
|
25
25
|
let yjs = require("yjs");
|
|
26
26
|
yjs = __toESM(yjs);
|
|
27
27
|
//#region packages/coaction-yjs/src/shared.ts
|
|
@@ -148,7 +148,7 @@ function toArrayIndex(segment) {
|
|
|
148
148
|
function assertCanSetPathSegment(target, key, path) {
|
|
149
149
|
if (Object.prototype.hasOwnProperty.call(target, key)) return;
|
|
150
150
|
if (Object.isExtensible(target)) return;
|
|
151
|
-
throw new
|
|
151
|
+
throw new coaction_adapter.StateSchemaError(`Unknown state key '${path.map((segment) => String(segment)).join(".")}' cannot be added after store initialization. Coaction state schema is fixed.`);
|
|
152
152
|
}
|
|
153
153
|
function clearObjectKey(target, key) {
|
|
154
154
|
if (!Object.prototype.hasOwnProperty.call(target, key)) return;
|
|
@@ -473,7 +473,7 @@ const bindYjs = (store, options = {}) => {
|
|
|
473
473
|
const applyReplacementState = (next) => {
|
|
474
474
|
if (store.share === "main") {
|
|
475
475
|
store.setState(next, () => {
|
|
476
|
-
return (0,
|
|
476
|
+
return (0, coaction_adapter.applyRootReplacementWithPatches)(store, next);
|
|
477
477
|
});
|
|
478
478
|
return;
|
|
479
479
|
}
|
|
@@ -543,7 +543,7 @@ const bindYjs = (store, options = {}) => {
|
|
|
543
543
|
setTimeout(scheduleFlushFromYjs, 0);
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
546
|
-
if (isYjsSerializableStateError(error) || (0,
|
|
546
|
+
if (isYjsSerializableStateError(error) || (0, coaction_adapter.isStateSchemaError)(error)) {
|
|
547
547
|
restoreRootState();
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
@@ -561,7 +561,7 @@ const bindYjs = (store, options = {}) => {
|
|
|
561
561
|
setTimeout(scheduleFlushFromYjs, 0);
|
|
562
562
|
return;
|
|
563
563
|
}
|
|
564
|
-
if (isYjsSerializableStateError(error) || (0,
|
|
564
|
+
if (isYjsSerializableStateError(error) || (0, coaction_adapter.isStateSchemaError)(error)) {
|
|
565
565
|
restoreRootState();
|
|
566
566
|
return;
|
|
567
567
|
}
|
|
@@ -634,7 +634,7 @@ const bindYjs = (store, options = {}) => {
|
|
|
634
634
|
try {
|
|
635
635
|
applyRemoteState(state);
|
|
636
636
|
} catch (error) {
|
|
637
|
-
if (isYjsSerializableStateError(error) || (0,
|
|
637
|
+
if (isYjsSerializableStateError(error) || (0, coaction_adapter.isStateSchemaError)(error)) {
|
|
638
638
|
restoreRootState();
|
|
639
639
|
return;
|
|
640
640
|
}
|
|
@@ -708,7 +708,7 @@ const bindYjs = (store, options = {}) => {
|
|
|
708
708
|
};
|
|
709
709
|
const yjs$1 = (options = {}) => (store) => {
|
|
710
710
|
let binding;
|
|
711
|
-
const cancelBinding = (0,
|
|
711
|
+
const cancelBinding = (0, coaction_adapter.onStoreReady)(store, () => {
|
|
712
712
|
binding = bindYjs(store, options);
|
|
713
713
|
});
|
|
714
714
|
const baseDestroy = store.destroy;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StateSchemaError, applyRootReplacementWithPatches, isStateSchemaError, onStoreReady } from "coaction";
|
|
1
|
+
import { StateSchemaError, applyRootReplacementWithPatches, isStateSchemaError, onStoreReady } from "coaction/adapter";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
export * from "yjs";
|
|
4
4
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coaction/yjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A Coaction integration tool for Yjs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coaction",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"yjs": "^13.6.27",
|
|
49
|
-
"coaction": "
|
|
49
|
+
"coaction": "3.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"coaction": "
|
|
52
|
+
"coaction": "^3.0.0",
|
|
53
53
|
"yjs": "^13.6.0"
|
|
54
54
|
},
|
|
55
55
|
"authors": [
|