@coaction/yjs 2.1.0 → 3.1.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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ![Node CI](https://github.com/coactionjs/coaction/workflows/Node%20CI/badge.svg) [![npm](https://img.shields.io/npm/v/@coaction/yjs.svg)](https://www.npmjs.com/package/@coaction/yjs) ![license](https://img.shields.io/npm/l/@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
@@ -1,4 +1,4 @@
1
- import { Middleware, Store } from "coaction";
1
+ import { Middleware, Store } from "coaction/adapter";
2
2
  import * as Y from "yjs";
3
3
  export * from "yjs";
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Middleware, Store } from "coaction";
1
+ import { Middleware, Store } from "coaction/adapter";
2
2
  import * as Y from "yjs";
3
3
  export * from "yjs";
4
4
 
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 coaction = require("coaction");
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 coaction.StateSchemaError(`Unknown state key '${path.map((segment) => String(segment)).join(".")}' cannot be added after store initialization. Coaction state schema is fixed.`);
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, coaction.applyRootReplacementWithPatches)(store, next);
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, coaction.isStateSchemaError)(error)) {
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, coaction.isStateSchemaError)(error)) {
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, coaction.isStateSchemaError)(error)) {
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, coaction.onStoreReady)(store, () => {
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": "2.1.0",
3
+ "version": "3.1.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": "2.1.0"
49
+ "coaction": "3.1.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "coaction": ">=2.1.0 <3",
52
+ "coaction": "^3.1.0",
53
53
  "yjs": "^13.6.0"
54
54
  },
55
55
  "authors": [