@coaction/pinia 3.2.0 → 4.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/dist/index.js CHANGED
@@ -79,7 +79,7 @@ const handleStore = (store, state, _, internal) => {
79
79
  store._destroyers = void 0;
80
80
  baseDestroy();
81
81
  };
82
- store.apply = (nextState = store.getPureState(), patches) => {
82
+ internal.externalApply = (nextState = store.getPureState(), patches) => {
83
83
  internal.assertAlive?.("apply");
84
84
  const previousSnapshot = lastSnapshot ?? (0, coaction_adapter.snapshotMutableAdapterPureState)(store);
85
85
  isApplyingCoactionState = true;
@@ -115,7 +115,7 @@ const handleStore = (store, state, _, internal) => {
115
115
  const change = syncSharedExternalChange();
116
116
  if (change === "ignored") return;
117
117
  if (change === "external") internal.notifyStateChange?.();
118
- store._subscriptions.forEach((callback) => callback(...args));
118
+ store._subscriptions.forEach((callback) => internal.notify(() => callback(...args)));
119
119
  });
120
120
  });
121
121
  const destroy = () => {
@@ -125,9 +125,6 @@ const handleStore = (store, state, _, internal) => {
125
125
  };
126
126
  store._destroyers.add(destroy);
127
127
  };
128
- /**
129
- * Bind a store to Pinia
130
- */
131
128
  const bindPinia = (0, coaction_adapter.createBinder)({
132
129
  handleStore,
133
130
  handleState: ((options) => {
@@ -155,9 +152,6 @@ const bindPinia = (0, coaction_adapter.createBinder)({
155
152
  };
156
153
  })
157
154
  });
158
- /**
159
- * Adapt a store type to Pinia
160
- */
161
155
  const adapt = (store) => {
162
156
  if (typeof store !== "function") return store;
163
157
  const pinia$1 = (0, pinia.createPinia)();
package/dist/index.mjs CHANGED
@@ -79,7 +79,7 @@ const handleStore = (store, state, _, internal) => {
79
79
  store._destroyers = void 0;
80
80
  baseDestroy();
81
81
  };
82
- store.apply = (nextState = store.getPureState(), patches) => {
82
+ internal.externalApply = (nextState = store.getPureState(), patches) => {
83
83
  internal.assertAlive?.("apply");
84
84
  const previousSnapshot = lastSnapshot ?? snapshotMutableAdapterPureState(store);
85
85
  isApplyingCoactionState = true;
@@ -115,7 +115,7 @@ const handleStore = (store, state, _, internal) => {
115
115
  const change = syncSharedExternalChange();
116
116
  if (change === "ignored") return;
117
117
  if (change === "external") internal.notifyStateChange?.();
118
- store._subscriptions.forEach((callback) => callback(...args));
118
+ store._subscriptions.forEach((callback) => internal.notify(() => callback(...args)));
119
119
  });
120
120
  });
121
121
  const destroy = () => {
@@ -125,9 +125,6 @@ const handleStore = (store, state, _, internal) => {
125
125
  };
126
126
  store._destroyers.add(destroy);
127
127
  };
128
- /**
129
- * Bind a store to Pinia
130
- */
131
128
  const bindPinia = createBinder({
132
129
  handleStore,
133
130
  handleState: ((options) => {
@@ -155,9 +152,6 @@ const bindPinia = createBinder({
155
152
  };
156
153
  })
157
154
  });
158
- /**
159
- * Adapt a store type to Pinia
160
- */
161
155
  const adapt = (store) => {
162
156
  if (typeof store !== "function") return store;
163
157
  const pinia = createPinia();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coaction/pinia",
3
- "version": "3.2.0",
3
+ "version": "4.0.0",
4
4
  "description": "A Coaction integration tool for Pinia",
5
5
  "keywords": [
6
6
  "coaction",
@@ -50,10 +50,10 @@
50
50
  "data-transport": "^5.0.3",
51
51
  "mutative": "^1.3.0",
52
52
  "pinia": "^3.0.4",
53
- "coaction": "3.2.0"
53
+ "coaction": "4.0.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "coaction": "^3.2.0",
56
+ "coaction": "^4.0.0",
57
57
  "pinia": "^2.0 || ^3.0.0"
58
58
  },
59
59
  "authors": [