@coaction/xstate 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/xstate.svg)](https://www.npmjs.com/package/@coaction/xstate) ![license](https://img.shields.io/npm/l/@coaction/xstate)
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 XState.
6
8
 
7
9
  ## Installation
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#endregion
3
- let coaction = require("coaction");
3
+ let coaction_adapter = require("coaction/adapter");
4
4
  //#region packages/coaction-xstate/src/index.ts
5
5
  const actorMap = /* @__PURE__ */ new WeakMap();
6
6
  const isUnsafeKey = (key) => typeof key === "string" && (key === "__proto__" || key === "prototype" || key === "constructor");
@@ -15,7 +15,7 @@ const unsupportedMutationMessage = "XState binding state cannot be mutated direc
15
15
  /**
16
16
  * Bind an XState actor to Coaction.
17
17
  */
18
- const bindXState = (0, coaction.createBinder)({
18
+ const bindXState = (0, coaction_adapter.createBinder)({
19
19
  handleStore: (store, rawState, _state, internal) => {
20
20
  const actor = actorMap.get(rawState);
21
21
  if (!actor) throw new Error("xstate actor is not found");
@@ -36,13 +36,13 @@ const bindXState = (0, coaction.createBinder)({
36
36
  const applyActorSnapshot = (context) => {
37
37
  isApplyingActorSnapshot = true;
38
38
  try {
39
- (0, coaction.replaceExternalStoreState)(store, internal, context);
39
+ (0, coaction_adapter.replaceExternalStoreState)(store, internal, context);
40
40
  } finally {
41
41
  isApplyingActorSnapshot = false;
42
42
  }
43
43
  };
44
44
  let subscription;
45
- const cancelReadySubscription = (0, coaction.onStoreReady)(store, () => {
45
+ const cancelReadySubscription = (0, coaction_adapter.onStoreReady)(store, () => {
46
46
  subscription = actor.subscribe((snapshot) => {
47
47
  applyActorSnapshot(snapshot.context);
48
48
  });
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createBinder, onStoreReady, replaceExternalStoreState } from "coaction";
1
+ import { createBinder, onStoreReady, replaceExternalStoreState } from "coaction/adapter";
2
2
  export * from "xstate";
3
3
  //#endregion
4
4
  //#region packages/coaction-xstate/src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coaction/xstate",
3
- "version": "2.1.0",
3
+ "version": "3.1.0",
4
4
  "description": "A Coaction integration tool for XState",
5
5
  "keywords": [
6
6
  "actor",
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "xstate": "^5.23.0",
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
  "xstate": "^5.0.0"
54
54
  },
55
55
  "authors": [