@composy/store-core 0.0.1 → 0.0.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.
- package/CHANGELOG.md +64 -3
- package/README.md +196 -172
- package/dist/index.js +1331 -1115
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +578 -417
- package/dist/index.min.js.map +1 -1
- package/es/.dts-output-manifest.json +1 -0
- package/es/.dts.tsbuildinfo +1 -0
- package/es/core/async-action.d.ts +1 -71
- package/es/core/async-action.js +83 -35
- package/es/core/async-action.js.map +1 -1
- package/es/core/base-store.d.ts +27 -62
- package/es/core/base-store.js +174 -74
- package/es/core/base-store.js.map +1 -1
- package/es/core/batch-manager.d.ts +0 -1
- package/es/core/batch-manager.js +15 -2
- package/es/core/batch-manager.js.map +1 -1
- package/es/core/create-store.d.ts +3 -3
- package/es/core/create-store.js +3 -3
- package/es/core/create-store.js.map +1 -1
- package/es/core/event-bus.d.ts +0 -1
- package/es/core/event-bus.js +1 -1
- package/es/core/event-bus.js.map +1 -1
- package/es/core/index.d.ts +1 -2
- package/es/core/index.js +2 -2
- package/es/core/pub-sub.d.ts +0 -1
- package/es/core/pub-sub.js +1 -1
- package/es/core/pub-sub.js.map +1 -1
- package/es/engine/index.d.ts +0 -1
- package/es/engine/index.js +1 -1
- package/es/engine/plugin.d.ts +0 -1
- package/es/engine/plugin.js +11 -2
- package/es/engine/plugin.js.map +1 -1
- package/es/engine/types.d.ts +0 -1
- package/es/engine/types.js +1 -1
- package/es/errors/index.d.ts +0 -1
- package/es/errors/index.js +17 -1
- package/es/errors/index.js.map +1 -1
- package/es/index.d.ts +3 -4
- package/es/index.js +8 -8
- package/es/index.js.map +1 -1
- package/es/middleware/index.d.ts +3 -4
- package/es/middleware/index.js +2 -2
- package/es/middleware/logger.d.ts +0 -1
- package/es/middleware/logger.js +2 -2
- package/es/middleware/logger.js.map +1 -1
- package/es/middleware/middleware-manager.d.ts +0 -1
- package/es/middleware/middleware-manager.js +5 -2
- package/es/middleware/middleware-manager.js.map +1 -1
- package/es/middleware/persist.d.ts +0 -1
- package/es/middleware/persist.js +3 -3
- package/es/middleware/persist.js.map +1 -1
- package/es/middleware/time-travel.d.ts +0 -1
- package/es/middleware/time-travel.js +1 -1
- package/es/middleware/time-travel.js.map +1 -1
- package/es/middleware/validation.d.ts +0 -1
- package/es/middleware/validation.js +2 -2
- package/es/middleware/validation.js.map +1 -1
- package/es/plugins/define-plugin.d.ts +1 -2
- package/es/plugins/define-plugin.js +2 -2
- package/es/plugins/define-plugin.js.map +1 -1
- package/es/plugins/index.d.ts +0 -1
- package/es/plugins/index.js +2 -2
- package/es/plugins/plugin-manager.d.ts +1 -31
- package/es/plugins/plugin-manager.js +58 -27
- package/es/plugins/plugin-manager.js.map +1 -1
- package/es/types/action.d.ts +2 -0
- package/es/types/action.js +10 -0
- package/es/types/batch.d.ts +2 -0
- package/es/types/batch.js +10 -0
- package/es/types/event.d.ts +2 -0
- package/es/types/event.js +10 -0
- package/es/types/index.d.ts +2 -3
- package/es/types/index.js +1 -1
- package/es/types/middleware.d.ts +10 -2
- package/es/types/middleware.js +1 -1
- package/es/types/mutation.d.ts +2 -0
- package/es/types/mutation.js +10 -0
- package/es/types/plugin.d.ts +4 -1
- package/es/types/plugin.js +1 -1
- package/es/types/state.d.ts +2 -0
- package/es/types/state.js +10 -0
- package/es/types/store.d.ts +19 -1
- package/es/types/store.js +1 -1
- package/es/types/subscription.d.ts +7 -2
- package/es/types/subscription.js +1 -1
- package/es/types/time-travel.d.ts +2 -0
- package/es/types/time-travel.js +10 -0
- package/es/types/utility.d.ts +3 -4
- package/es/types/utility.js +1 -1
- package/es/utils/debounce-throttle.d.ts +0 -1
- package/es/utils/debounce-throttle.js +1 -1
- package/es/utils/debounce-throttle.js.map +1 -1
- package/es/utils/deep-clone.d.ts +0 -1
- package/es/utils/deep-clone.js +1 -1
- package/es/utils/deep-clone.js.map +1 -1
- package/es/utils/index.d.ts +4 -5
- package/es/utils/index.js +1 -1
- package/es/utils/selector.d.ts +0 -1
- package/es/utils/selector.js +1 -1
- package/es/utils/selector.js.map +1 -1
- package/esm/core/async-action.js +83 -35
- package/esm/core/async-action.js.map +1 -1
- package/esm/core/base-store.js +174 -74
- package/esm/core/base-store.js.map +1 -1
- package/esm/core/batch-manager.js +15 -2
- package/esm/core/batch-manager.js.map +1 -1
- package/esm/core/create-store.js +3 -3
- package/esm/core/create-store.js.map +1 -1
- package/esm/core/event-bus.js +1 -1
- package/esm/core/event-bus.js.map +1 -1
- package/esm/core/index.js +2 -2
- package/esm/core/pub-sub.js +1 -1
- package/esm/core/pub-sub.js.map +1 -1
- package/esm/engine/index.js +1 -1
- package/esm/engine/plugin.js +11 -2
- package/esm/engine/plugin.js.map +1 -1
- package/esm/errors/index.js +17 -1
- package/esm/errors/index.js.map +1 -1
- package/esm/index.js +8 -8
- package/esm/index.js.map +1 -1
- package/esm/middleware/logger.js +2 -2
- package/esm/middleware/logger.js.map +1 -1
- package/esm/middleware/middleware-manager.js +5 -2
- package/esm/middleware/middleware-manager.js.map +1 -1
- package/esm/middleware/persist.js +3 -3
- package/esm/middleware/persist.js.map +1 -1
- package/esm/middleware/time-travel.js +1 -1
- package/esm/middleware/time-travel.js.map +1 -1
- package/esm/middleware/validation.js +2 -2
- package/esm/middleware/validation.js.map +1 -1
- package/esm/plugins/define-plugin.js +2 -2
- package/esm/plugins/define-plugin.js.map +1 -1
- package/esm/plugins/plugin-manager.js +58 -27
- package/esm/plugins/plugin-manager.js.map +1 -1
- package/esm/utils/debounce-throttle.js +1 -1
- package/esm/utils/debounce-throttle.js.map +1 -1
- package/esm/utils/deep-clone.js +1 -1
- package/esm/utils/deep-clone.js.map +1 -1
- package/esm/utils/selector.js +1 -1
- package/esm/utils/selector.js.map +1 -1
- package/lib/core/async-action.cjs +83 -35
- package/lib/core/async-action.cjs.map +1 -1
- package/lib/core/async-action.d.cts +25 -0
- package/lib/core/base-store.cjs +174 -74
- package/lib/core/base-store.cjs.map +1 -1
- package/lib/core/base-store.d.cts +50 -0
- package/lib/core/batch-manager.cjs +15 -2
- package/lib/core/batch-manager.cjs.map +1 -1
- package/{esm/core/batch-manager.d.ts → lib/core/batch-manager.d.cts} +0 -1
- package/lib/core/create-store.cjs +3 -3
- package/lib/core/create-store.cjs.map +1 -1
- package/lib/core/{create-store.d.ts → create-store.d.cts} +3 -3
- package/lib/core/event-bus.cjs +1 -1
- package/lib/core/event-bus.cjs.map +1 -1
- package/lib/core/{event-bus.d.ts → event-bus.d.cts} +0 -1
- package/lib/core/index.cjs +2 -2
- package/{esm/core/index.d.ts → lib/core/index.d.cts} +1 -2
- package/lib/core/pub-sub.cjs +1 -1
- package/lib/core/pub-sub.cjs.map +1 -1
- package/lib/core/{pub-sub.d.ts → pub-sub.d.cts} +0 -1
- package/lib/engine/index.cjs +1 -1
- package/{esm/engine/index.d.ts → lib/engine/index.d.cts} +0 -1
- package/lib/engine/plugin.cjs +11 -2
- package/lib/engine/plugin.cjs.map +1 -1
- package/{esm/engine/plugin.d.ts → lib/engine/plugin.d.cts} +0 -1
- package/lib/engine/types.cjs +1 -1
- package/lib/engine/{types.d.ts → types.d.cts} +0 -1
- package/lib/errors/index.cjs +17 -1
- package/lib/errors/index.cjs.map +1 -1
- package/lib/errors/{index.d.ts → index.d.cts} +0 -1
- package/lib/index.cjs +8 -8
- package/lib/index.cjs.map +1 -1
- package/lib/{index.d.ts → index.d.cts} +3 -4
- package/lib/middleware/index.cjs +2 -2
- package/lib/middleware/{index.d.ts → index.d.cts} +3 -4
- package/lib/middleware/logger.cjs +2 -2
- package/lib/middleware/logger.cjs.map +1 -1
- package/lib/middleware/{logger.d.ts → logger.d.cts} +0 -1
- package/lib/middleware/middleware-manager.cjs +5 -2
- package/lib/middleware/middleware-manager.cjs.map +1 -1
- package/lib/middleware/{middleware-manager.d.ts → middleware-manager.d.cts} +0 -1
- package/lib/middleware/persist.cjs +3 -3
- package/lib/middleware/persist.cjs.map +1 -1
- package/{esm/middleware/persist.d.ts → lib/middleware/persist.d.cts} +0 -1
- package/lib/middleware/time-travel.cjs +1 -1
- package/lib/middleware/time-travel.cjs.map +1 -1
- package/{esm/middleware/time-travel.d.ts → lib/middleware/time-travel.d.cts} +0 -1
- package/lib/middleware/validation.cjs +2 -2
- package/lib/middleware/validation.cjs.map +1 -1
- package/{esm/middleware/validation.d.ts → lib/middleware/validation.d.cts} +0 -1
- package/lib/plugins/define-plugin.cjs +2 -2
- package/lib/plugins/define-plugin.cjs.map +1 -1
- package/{esm/plugins/define-plugin.d.ts → lib/plugins/define-plugin.d.cts} +1 -2
- package/lib/plugins/index.cjs +2 -2
- package/{esm/plugins/index.d.ts → lib/plugins/index.d.cts} +0 -1
- package/lib/plugins/plugin-manager.cjs +58 -27
- package/lib/plugins/plugin-manager.cjs.map +1 -1
- package/lib/plugins/plugin-manager.d.cts +5 -0
- package/lib/types/action.cjs +12 -0
- package/lib/types/action.d.cts +2 -0
- package/lib/types/batch.cjs +12 -0
- package/lib/types/batch.d.cts +2 -0
- package/lib/types/event.cjs +12 -0
- package/lib/types/event.d.cts +2 -0
- package/lib/types/index.cjs +1 -1
- package/{esm/types/index.d.ts → lib/types/index.d.cts} +2 -3
- package/lib/types/middleware.cjs +1 -1
- package/lib/types/{middleware.d.ts → middleware.d.cts} +10 -2
- package/lib/types/mutation.cjs +12 -0
- package/lib/types/mutation.d.cts +2 -0
- package/lib/types/plugin.cjs +1 -1
- package/lib/types/{plugin.d.ts → plugin.d.cts} +4 -1
- package/lib/types/state.cjs +12 -0
- package/lib/types/state.d.cts +2 -0
- package/lib/types/store.cjs +1 -1
- package/lib/types/{store.d.ts → store.d.cts} +19 -1
- package/lib/types/subscription.cjs +1 -1
- package/lib/types/{subscription.d.ts → subscription.d.cts} +7 -2
- package/lib/types/time-travel.cjs +12 -0
- package/lib/types/time-travel.d.cts +2 -0
- package/lib/types/utility.cjs +1 -1
- package/lib/types/{utility.d.ts → utility.d.cts} +3 -4
- package/lib/utils/debounce-throttle.cjs +1 -1
- package/lib/utils/debounce-throttle.cjs.map +1 -1
- package/{esm/utils/debounce-throttle.d.ts → lib/utils/debounce-throttle.d.cts} +0 -1
- package/lib/utils/deep-clone.cjs +1 -1
- package/lib/utils/deep-clone.cjs.map +1 -1
- package/lib/utils/{deep-clone.d.ts → deep-clone.d.cts} +0 -1
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/{index.d.ts → index.d.cts} +4 -5
- package/lib/utils/selector.cjs +1 -1
- package/lib/utils/selector.cjs.map +1 -1
- package/lib/utils/{selector.d.ts → selector.d.cts} +0 -1
- package/package.json +14 -11
- package/es/core/async-action.d.ts.map +0 -1
- package/es/core/base-store.d.ts.map +0 -1
- package/es/core/batch-manager.d.ts.map +0 -1
- package/es/core/create-store.d.ts.map +0 -1
- package/es/core/event-bus.d.ts.map +0 -1
- package/es/core/index.d.ts.map +0 -1
- package/es/core/pub-sub.d.ts.map +0 -1
- package/es/engine/index.d.ts.map +0 -1
- package/es/engine/plugin.d.ts.map +0 -1
- package/es/engine/types.d.ts.map +0 -1
- package/es/errors/index.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/middleware/index.d.ts.map +0 -1
- package/es/middleware/logger.d.ts.map +0 -1
- package/es/middleware/middleware-manager.d.ts.map +0 -1
- package/es/middleware/persist.d.ts.map +0 -1
- package/es/middleware/time-travel.d.ts.map +0 -1
- package/es/middleware/validation.d.ts.map +0 -1
- package/es/plugins/define-plugin.d.ts.map +0 -1
- package/es/plugins/index.d.ts.map +0 -1
- package/es/plugins/plugin-manager.d.ts.map +0 -1
- package/es/types/index.d.ts.map +0 -1
- package/es/types/middleware.d.ts.map +0 -1
- package/es/types/plugin.d.ts.map +0 -1
- package/es/types/store.d.ts.map +0 -1
- package/es/types/subscription.d.ts.map +0 -1
- package/es/types/utility.d.ts.map +0 -1
- package/es/utils/debounce-throttle.d.ts.map +0 -1
- package/es/utils/deep-clone.d.ts.map +0 -1
- package/es/utils/index.d.ts.map +0 -1
- package/es/utils/selector.d.ts.map +0 -1
- package/esm/core/async-action.d.ts +0 -95
- package/esm/core/base-store.d.ts +0 -85
- package/esm/core/create-store.d.ts +0 -66
- package/esm/core/event-bus.d.ts +0 -34
- package/esm/core/pub-sub.d.ts +0 -41
- package/esm/engine/types.d.ts +0 -81
- package/esm/errors/index.d.ts +0 -208
- package/esm/index.d.ts +0 -27
- package/esm/middleware/index.d.ts +0 -13
- package/esm/middleware/logger.d.ts +0 -67
- package/esm/middleware/middleware-manager.d.ts +0 -40
- package/esm/plugins/plugin-manager.d.ts +0 -35
- package/esm/types/middleware.d.ts +0 -172
- package/esm/types/plugin.d.ts +0 -136
- package/esm/types/store.d.ts +0 -198
- package/esm/types/subscription.d.ts +0 -158
- package/esm/types/utility.d.ts +0 -312
- package/esm/utils/deep-clone.d.ts +0 -143
- package/esm/utils/index.d.ts +0 -13
- package/esm/utils/selector.d.ts +0 -213
- package/lib/core/async-action.d.ts +0 -95
- package/lib/core/base-store.d.ts +0 -85
- package/lib/core/batch-manager.d.ts +0 -46
- package/lib/core/index.d.ts +0 -14
- package/lib/engine/index.d.ts +0 -10
- package/lib/engine/plugin.d.ts +0 -20
- package/lib/middleware/persist.d.ts +0 -34
- package/lib/middleware/time-travel.d.ts +0 -30
- package/lib/middleware/validation.d.ts +0 -100
- package/lib/plugins/define-plugin.d.ts +0 -74
- package/lib/plugins/index.d.ts +0 -8
- package/lib/plugins/plugin-manager.d.ts +0 -35
- package/lib/types/index.d.ts +0 -12
- package/lib/utils/debounce-throttle.d.ts +0 -86
package/dist/index.min.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/store-core v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:23:58 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
@@ -39,6 +39,275 @@
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function e() {
|
|
42
|
+
return /* @__PURE__ */ new Error("Aborted");
|
|
43
|
+
}
|
|
44
|
+
function r() {
|
|
45
|
+
const t = /* @__PURE__ */ new Map();
|
|
46
|
+
let e = null;
|
|
47
|
+
const r = () => (null === e && (e = Array.from(t.values()).sort((t, e) => (t.priority ?? 100) - (e.priority ?? 100))), e), n = () => {
|
|
48
|
+
e = null;
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
use: (e) => {
|
|
52
|
+
t.has(e.name) && console.warn(`[Middleware] 中间件 "${e.name}" 已存在,将被覆盖`), t.set(e.name, e), n();
|
|
53
|
+
},
|
|
54
|
+
remove: (e) => {
|
|
55
|
+
t.delete(e) && n();
|
|
56
|
+
},
|
|
57
|
+
get: (e) => t.get(e),
|
|
58
|
+
has: (e) => t.has(e),
|
|
59
|
+
execute: async (t) => {
|
|
60
|
+
const e = r();
|
|
61
|
+
if (0 === e.length) return;
|
|
62
|
+
const n = async (r) => {
|
|
63
|
+
const o = e[r];
|
|
64
|
+
if (!o) return void t.meta?.commit?.();
|
|
65
|
+
let s = !1;
|
|
66
|
+
await o.handler(t, async () => {
|
|
67
|
+
if (s) throw new Error(`[Middleware] next() called multiple times in "${o.name}"`);
|
|
68
|
+
s = !0, await n(r + 1);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
await n(0);
|
|
72
|
+
},
|
|
73
|
+
getAll: () => r(),
|
|
74
|
+
clear: () => {
|
|
75
|
+
t.clear(), n();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
80
|
+
let n = null;
|
|
81
|
+
function o() {
|
|
82
|
+
return n || (n = r()), n;
|
|
83
|
+
}
|
|
84
|
+
function s(t, e, r) {
|
|
85
|
+
console.error(`[Plugin] ${t} failed for "${e}":`, r);
|
|
86
|
+
}
|
|
87
|
+
function i() {
|
|
88
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = {
|
|
89
|
+
getStore: (t) => r.get(t),
|
|
90
|
+
hasStore: (t) => r.has(t),
|
|
91
|
+
getStoreIds: () => Array.from(r.keys())
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
use: (o, i) => {
|
|
95
|
+
const a = t.get(o.name), c = e.get(o.name);
|
|
96
|
+
a && c && Promise.resolve(a.uninstall?.(c)).catch((t) => {
|
|
97
|
+
s("uninstall", o.name, t);
|
|
98
|
+
});
|
|
99
|
+
const l = ((t) => ({
|
|
100
|
+
storeManager: n,
|
|
101
|
+
storeId: "",
|
|
102
|
+
store: null,
|
|
103
|
+
options: t || {}
|
|
104
|
+
}))(i);
|
|
105
|
+
t.set(o.name, o), e.set(o.name, l), Promise.resolve(o.install(l, i)).catch((t) => {
|
|
106
|
+
s("install", o.name, t);
|
|
107
|
+
}), r.forEach((t) => o.onStoreCreated?.(t));
|
|
108
|
+
},
|
|
109
|
+
remove: (r) => {
|
|
110
|
+
const n = t.get(r), o = e.get(r);
|
|
111
|
+
n && o && Promise.resolve(n.uninstall?.(o)).catch((t) => {
|
|
112
|
+
s("uninstall", r, t);
|
|
113
|
+
}), t.delete(r), e.delete(r);
|
|
114
|
+
},
|
|
115
|
+
get: (e) => t.get(e),
|
|
116
|
+
has: (e) => t.has(e),
|
|
117
|
+
getAll: () => new Map(t),
|
|
118
|
+
size: () => t.size,
|
|
119
|
+
clear: () => {
|
|
120
|
+
t.forEach((t, r) => {
|
|
121
|
+
const n = e.get(r);
|
|
122
|
+
n && Promise.resolve(t.uninstall?.(n)).catch((t) => {
|
|
123
|
+
s("uninstall", r, t);
|
|
124
|
+
});
|
|
125
|
+
}), t.clear(), e.clear();
|
|
126
|
+
},
|
|
127
|
+
notifyStoreCreated: (e) => {
|
|
128
|
+
const n = a(e);
|
|
129
|
+
n && r.set(n, e), t.forEach((t) => t.onStoreCreated?.(e));
|
|
130
|
+
},
|
|
131
|
+
notifyStoreDisposed: (e) => {
|
|
132
|
+
const n = a(e);
|
|
133
|
+
n && r.delete(n), t.forEach((t) => t.onStoreDisposed?.(e));
|
|
134
|
+
},
|
|
135
|
+
notifyStateChange: (e, r, n) => {
|
|
136
|
+
t.forEach((t) => t.onStateChange?.(e, r, n));
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function a(t) {
|
|
141
|
+
if (!t || "object" != typeof t) return;
|
|
142
|
+
const e = t.$id;
|
|
143
|
+
return "string" == typeof e ? e : void 0;
|
|
144
|
+
}
|
|
145
|
+
let c = null;
|
|
146
|
+
function l() {
|
|
147
|
+
return c || (c = i()), c;
|
|
148
|
+
}
|
|
149
|
+
function u(t, e, r = !1) {
|
|
150
|
+
let n = null, o = null;
|
|
151
|
+
const s = (...s) => {
|
|
152
|
+
o = s, n && clearTimeout(n), r && !n ? (t(...s), n = setTimeout(() => {
|
|
153
|
+
n = null, o = null;
|
|
154
|
+
}, e)) : n = setTimeout(() => {
|
|
155
|
+
t(...s), n = null, o = null;
|
|
156
|
+
}, e);
|
|
157
|
+
};
|
|
158
|
+
return s.cancel = () => {
|
|
159
|
+
n && (clearTimeout(n), n = null, o = null);
|
|
160
|
+
}, s.flush = () => {
|
|
161
|
+
n && o && (clearTimeout(n), t(...o), n = null, o = null);
|
|
162
|
+
}, s.pending = () => null !== n, s;
|
|
163
|
+
}
|
|
164
|
+
const f = Object.prototype.hasOwnProperty;
|
|
165
|
+
function d(t, e) {
|
|
166
|
+
return f.call(t, e);
|
|
167
|
+
}
|
|
168
|
+
function h(t) {
|
|
169
|
+
return null !== t && "object" == typeof t;
|
|
170
|
+
}
|
|
171
|
+
function p(t) {
|
|
172
|
+
if (!h(t)) return !1;
|
|
173
|
+
const e = Object.getPrototypeOf(t);
|
|
174
|
+
return null === e || e === Object.prototype;
|
|
175
|
+
}
|
|
176
|
+
function g(t) {
|
|
177
|
+
return null == t || "boolean" == typeof t || "number" == typeof t || "string" == typeof t || "bigint" == typeof t || "function" != typeof t && "symbol" != typeof t && (t instanceof Date || t instanceof RegExp || t instanceof ArrayBuffer || t instanceof DataView || t instanceof Map || t instanceof Set || !!ArrayBuffer.isView(t) || (Array.isArray(t) ? t.every((t) => g(t)) : !!p(t) && Object.values(t).every((t) => g(t))));
|
|
178
|
+
}
|
|
179
|
+
function y(t, e = {}) {
|
|
180
|
+
const { useStructuredClone: r = !0, cloneFunctions: n = !1, cloneSymbols: o = !1, maxDepth: s = Infinity, customCloner: i } = e;
|
|
181
|
+
if (r && "function" == typeof structuredClone && g(t)) try {
|
|
182
|
+
return structuredClone(t);
|
|
183
|
+
} catch {}
|
|
184
|
+
const a = /* @__PURE__ */ new WeakMap();
|
|
185
|
+
return function t(e, r) {
|
|
186
|
+
if (null == e) return e;
|
|
187
|
+
if ("boolean" == typeof e || "number" == typeof e || "string" == typeof e) return e;
|
|
188
|
+
if ("bigint" == typeof e) return e;
|
|
189
|
+
if ("symbol" == typeof e) return o ? Symbol(e.description) : e;
|
|
190
|
+
if ("function" == typeof e) return n ? e.bind({}) : e;
|
|
191
|
+
if (r > s) return e;
|
|
192
|
+
if (i) {
|
|
193
|
+
const n = i(e, (e) => t(e, r + 1));
|
|
194
|
+
if (void 0 !== n) return n;
|
|
195
|
+
}
|
|
196
|
+
if ("object" == typeof e && null !== e && a.has(e)) return a.get(e);
|
|
197
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
198
|
+
if (e instanceof RegExp) {
|
|
199
|
+
const t = new RegExp(e.source, e.flags);
|
|
200
|
+
return t.lastIndex = e.lastIndex, t;
|
|
201
|
+
}
|
|
202
|
+
if (e instanceof Error) {
|
|
203
|
+
const t = new e.constructor(e.message);
|
|
204
|
+
return t.stack = e.stack, t.name = e.name, t;
|
|
205
|
+
}
|
|
206
|
+
if (e instanceof Map) {
|
|
207
|
+
const n = /* @__PURE__ */ new Map();
|
|
208
|
+
return a.set(e, n), e.forEach((e, o) => {
|
|
209
|
+
n.set(t(o, r + 1), t(e, r + 1));
|
|
210
|
+
}), n;
|
|
211
|
+
}
|
|
212
|
+
if (e instanceof Set) {
|
|
213
|
+
const n = /* @__PURE__ */ new Set();
|
|
214
|
+
return a.set(e, n), e.forEach((e) => {
|
|
215
|
+
n.add(t(e, r + 1));
|
|
216
|
+
}), n;
|
|
217
|
+
}
|
|
218
|
+
if (e instanceof ArrayBuffer) return e.slice(0);
|
|
219
|
+
if (ArrayBuffer.isView(e) && !(e instanceof DataView)) return new e.constructor(e.buffer.slice(0));
|
|
220
|
+
if (Array.isArray(e)) {
|
|
221
|
+
const n = [];
|
|
222
|
+
a.set(e, n);
|
|
223
|
+
for (let o = 0; o < e.length; o++) n[o] = t(e[o], r + 1);
|
|
224
|
+
return n;
|
|
225
|
+
}
|
|
226
|
+
if (p(e)) {
|
|
227
|
+
const n = {};
|
|
228
|
+
a.set(e, n);
|
|
229
|
+
const s = Object.keys(e);
|
|
230
|
+
for (const o of s) n[o] = t(e[o], r + 1);
|
|
231
|
+
if (o) {
|
|
232
|
+
const o = Object.getOwnPropertySymbols(e);
|
|
233
|
+
for (const s of o) n[s] = t(e[s], r + 1);
|
|
234
|
+
}
|
|
235
|
+
return n;
|
|
236
|
+
}
|
|
237
|
+
return e;
|
|
238
|
+
}(t, 0);
|
|
239
|
+
}
|
|
240
|
+
function m(t, e, ...r) {
|
|
241
|
+
const { arrayStrategy: n = "replace", clone: o = !0, maxDepth: s = Infinity } = e;
|
|
242
|
+
function i(t, e, r) {
|
|
243
|
+
if (r > s) return t;
|
|
244
|
+
for (const s of Object.keys(e)) {
|
|
245
|
+
const a = e[s], c = t[s];
|
|
246
|
+
if (Array.isArray(a)) if ("concat" === n && Array.isArray(c)) t[s] = [...c, ...a];
|
|
247
|
+
else if ("merge" === n && Array.isArray(c)) {
|
|
248
|
+
const e = [...c];
|
|
249
|
+
a.forEach((t, n) => {
|
|
250
|
+
p(t) && p(e[n]) ? e[n] = i(e[n], t, r + 1) : e[n] = o ? y(t) : t;
|
|
251
|
+
}), t[s] = e;
|
|
252
|
+
} else t[s] = o ? y(a) : a;
|
|
253
|
+
else p(a) ? p(c) ? t[s] = i(c, a, r + 1) : t[s] = o ? y(a) : a : t[s] = o && h(a) ? y(a) : a;
|
|
254
|
+
}
|
|
255
|
+
return t;
|
|
256
|
+
}
|
|
257
|
+
let a = t;
|
|
258
|
+
for (const t of r) null != t && (a = i(a, t, 0));
|
|
259
|
+
return a;
|
|
260
|
+
}
|
|
261
|
+
const S = /^\d+$/;
|
|
262
|
+
function b(t, e = Object.is) {
|
|
263
|
+
let r, n, o = !1;
|
|
264
|
+
return (s) => {
|
|
265
|
+
if (o && r === s) return n;
|
|
266
|
+
const i = t(s);
|
|
267
|
+
return o && e(i, n) || (n = i), r = s, o = !0, n;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function E(t) {
|
|
271
|
+
let e = 0;
|
|
272
|
+
const r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), o = () => {
|
|
273
|
+
if (n.size > 0) {
|
|
274
|
+
const e = new Set(n);
|
|
275
|
+
n.clear(), t?.(e), r.forEach((t) => {
|
|
276
|
+
try {
|
|
277
|
+
t(e);
|
|
278
|
+
} catch (t) {
|
|
279
|
+
console.error("[Batch] flush listener failed:", t);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}, s = () => {
|
|
284
|
+
e++;
|
|
285
|
+
}, i = () => {
|
|
286
|
+
0 !== e && (e--, 0 === e && o());
|
|
287
|
+
};
|
|
288
|
+
return {
|
|
289
|
+
start: s,
|
|
290
|
+
end: i,
|
|
291
|
+
markDirty: (t) => {
|
|
292
|
+
n.add(t), 0 === e && o();
|
|
293
|
+
},
|
|
294
|
+
batch: (t) => {
|
|
295
|
+
s();
|
|
296
|
+
try {
|
|
297
|
+
return t();
|
|
298
|
+
} finally {
|
|
299
|
+
i();
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
isBatching: () => e > 0,
|
|
303
|
+
onFlush: (t) => (r.add(t), () => r.delete(t))
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
let R = null;
|
|
307
|
+
function w() {
|
|
308
|
+
return R || (R = E()), R;
|
|
309
|
+
}
|
|
310
|
+
function I() {
|
|
42
311
|
const t = /* @__PURE__ */ new Map(), e = (e, r) => {
|
|
43
312
|
const n = ((e) => {
|
|
44
313
|
let r = t.get(e);
|
|
@@ -77,68 +346,149 @@
|
|
|
77
346
|
}
|
|
78
347
|
};
|
|
79
348
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
349
|
+
const A = I();
|
|
350
|
+
var O = Object.defineProperty, M = (t, e, r) => ((t, e, r) => e in t ? O(t, e, {
|
|
351
|
+
enumerable: !0,
|
|
352
|
+
configurable: !0,
|
|
353
|
+
writable: !0,
|
|
354
|
+
value: r
|
|
355
|
+
}) : t[e] = r)(t, "symbol" != typeof e ? e + "" : e, r);
|
|
356
|
+
async function v(t, e) {
|
|
83
357
|
for (const r of t) await r(e);
|
|
84
358
|
}
|
|
85
|
-
var
|
|
86
|
-
constructor(e,
|
|
87
|
-
this
|
|
359
|
+
var P = class {
|
|
360
|
+
constructor(e, r = {}) {
|
|
361
|
+
M(this, "$id"), M(this, "getters"), M(this, "actions"), M(this, "stateSubscribers", t()), M(this, "actionSubscribers", t()), M(this, "initialStateFactory"), M(this, "middlewareManager"), M(this, "pluginManager"), M(this, "batchManager"), M(this, "pendingBatchMutation", null), M(this, "stopBatchFlush"), M(this, "mutationQueue", Promise.resolve()), M(this, "pendingMutations", 0), M(this, "_state"), M(this, "disposed", !1), this.$id = e.id, this.initialStateFactory = e.state, this._state = e.state(), this.middlewareManager = r.middleware ?? o(), this.pluginManager = r.plugins ?? l(), this.batchManager = r.batch ?? w(), this.getters = this.createGetters(e.getters || {}), this.actions = this.createActions(e.actions || {}), this.stopBatchFlush = this.batchManager.onFlush?.((t) => {
|
|
362
|
+
if (!t.has(this.$id) || !this.pendingBatchMutation) return;
|
|
363
|
+
const e = this.pendingBatchMutation;
|
|
364
|
+
this.pendingBatchMutation = null, this.publishStateChange(e);
|
|
365
|
+
}), A.emit("store:created", { storeId: this.$id }), this.notifyPluginStoreCreated();
|
|
88
366
|
}
|
|
89
367
|
get $state() {
|
|
90
368
|
return this._state;
|
|
91
369
|
}
|
|
92
370
|
set $state(t) {
|
|
93
|
-
this.
|
|
371
|
+
this.checkDisposed();
|
|
372
|
+
const e = y(t);
|
|
373
|
+
this.scheduleMutation(() => this.runStateMutation(e, t)).catch((t) => {
|
|
374
|
+
console.error(`[Store] Failed to replace state for "${this.$id}":`, t);
|
|
375
|
+
});
|
|
94
376
|
}
|
|
95
377
|
$reset() {
|
|
96
|
-
this.checkDisposed()
|
|
97
|
-
|
|
98
|
-
this._state = this.initialStateFactory(), this.notifyStateChange({
|
|
99
|
-
type: "direct",
|
|
100
|
-
storeId: this.$id,
|
|
101
|
-
oldState: t
|
|
378
|
+
this.checkDisposed(), this.scheduleMutation(() => this.runStateMutation()).catch((t) => {
|
|
379
|
+
console.error(`[Store] Failed to reset "${this.$id}":`, t);
|
|
102
380
|
});
|
|
103
381
|
}
|
|
104
382
|
$patch(t) {
|
|
105
383
|
this.checkDisposed();
|
|
106
|
-
const e =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
events: Object.keys(t)
|
|
116
|
-
}));
|
|
384
|
+
const e = "function" == typeof t ? t : y(t);
|
|
385
|
+
this.scheduleMutation(() => this.runPatchMutation(e)).catch((t) => {
|
|
386
|
+
console.error(`[Store] Failed to patch "${this.$id}":`, t);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
async $patchAsync(t) {
|
|
390
|
+
this.checkDisposed();
|
|
391
|
+
const e = "function" == typeof t ? t : y(t);
|
|
392
|
+
await this.scheduleMutation(() => this.runPatchMutation(e));
|
|
117
393
|
}
|
|
118
394
|
$subscribe(t, e = {}) {
|
|
119
|
-
|
|
395
|
+
this.checkDisposed();
|
|
396
|
+
const r = this.stateSubscribers.subscribe(({ mutation: e, state: r }) => t(e, r), { immediate: e.immediate });
|
|
397
|
+
if (e.immediate) try {
|
|
398
|
+
t({
|
|
399
|
+
type: "direct",
|
|
400
|
+
storeId: this.$id
|
|
401
|
+
}, y(this._state));
|
|
402
|
+
} catch (t) {
|
|
403
|
+
console.error("[Store] immediate subscriber failed:", t);
|
|
404
|
+
}
|
|
405
|
+
return r;
|
|
120
406
|
}
|
|
121
407
|
$onAction(t) {
|
|
122
408
|
return this.checkDisposed(), this.actionSubscribers.subscribe(t);
|
|
123
409
|
}
|
|
124
410
|
$dispose() {
|
|
125
|
-
this.disposed || (this.disposed = !0, this.stateSubscribers.clear(), this.actionSubscribers.clear(),
|
|
411
|
+
this.disposed || (this.disposed = !0, this.stopBatchFlush?.(), this.stopBatchFlush = void 0, this.mutationQueue = Promise.resolve(), this.pendingMutations = 0, this.stateSubscribers.clear(), this.actionSubscribers.clear(), this.notifyPluginStoreDisposed(), A.emit("store:disposed", { storeId: this.$id }));
|
|
126
412
|
}
|
|
127
413
|
notifyStateChange(t) {
|
|
414
|
+
this.publishStateChange(t);
|
|
415
|
+
}
|
|
416
|
+
publishStateChange(t) {
|
|
417
|
+
const e = y(this._state);
|
|
128
418
|
this.stateSubscribers.publish({
|
|
129
419
|
mutation: t,
|
|
130
|
-
state:
|
|
131
|
-
}),
|
|
420
|
+
state: e
|
|
421
|
+
}), A.emit("state:changed", {
|
|
132
422
|
storeId: this.$id,
|
|
133
|
-
state:
|
|
423
|
+
state: e,
|
|
134
424
|
mutation: t
|
|
135
425
|
});
|
|
136
426
|
}
|
|
137
|
-
|
|
138
|
-
this.
|
|
427
|
+
async runMutation(t, e, r, n) {
|
|
428
|
+
this.checkDisposed();
|
|
429
|
+
let o = !1;
|
|
430
|
+
const s = () => {
|
|
431
|
+
o || this.disposed || (o = !0, this._state = t, this.notifyPluginStateChange(t, n), this.batchManager.isBatching() && this.batchManager.onFlush ? (this.pendingBatchMutation = this.pendingBatchMutation ? {
|
|
432
|
+
...e,
|
|
433
|
+
oldState: this.pendingBatchMutation.oldState
|
|
434
|
+
} : e, this.batchManager.markDirty(this.$id)) : this.publishStateChange(e));
|
|
435
|
+
};
|
|
436
|
+
0 !== this.middlewareManager.getAll().length ? (await this.middlewareManager.execute({
|
|
437
|
+
storeId: this.$id,
|
|
438
|
+
state: t,
|
|
439
|
+
type: "direct" === e.type ? "state:reset" : "state:patch",
|
|
440
|
+
payload: r,
|
|
441
|
+
meta: {
|
|
442
|
+
candidateState: t,
|
|
443
|
+
previousState: n,
|
|
444
|
+
commit: s
|
|
445
|
+
}
|
|
446
|
+
}), s()) : s();
|
|
447
|
+
}
|
|
448
|
+
runStateMutation(t, e) {
|
|
449
|
+
this.checkDisposed();
|
|
450
|
+
const r = y(this._state), n = {
|
|
451
|
+
type: "direct",
|
|
452
|
+
storeId: this.$id,
|
|
453
|
+
oldState: r
|
|
454
|
+
};
|
|
455
|
+
return this.runMutation(y(t ?? this.initialStateFactory()), n, e, r);
|
|
456
|
+
}
|
|
457
|
+
runPatchMutation(t) {
|
|
458
|
+
this.checkDisposed();
|
|
459
|
+
const e = y(this._state), r = y(this._state), n = "function" == typeof t ? {
|
|
460
|
+
type: "patch function",
|
|
461
|
+
storeId: this.$id,
|
|
462
|
+
oldState: e
|
|
463
|
+
} : {
|
|
464
|
+
type: "patch object",
|
|
465
|
+
storeId: this.$id,
|
|
466
|
+
oldState: e,
|
|
467
|
+
events: Object.keys(t)
|
|
468
|
+
};
|
|
469
|
+
return "function" == typeof t ? t(r) : Object.assign(r, t), this.runMutation(r, n, t, e);
|
|
470
|
+
}
|
|
471
|
+
scheduleMutation(t) {
|
|
472
|
+
if (0 === this.pendingMutations && 0 === this.middlewareManager.getAll().length) return t();
|
|
473
|
+
this.pendingMutations += 1;
|
|
474
|
+
const e = this.mutationQueue.then(t);
|
|
475
|
+
return this.mutationQueue = e.catch(() => {}), e.then(() => {
|
|
476
|
+
this.pendingMutations -= 1;
|
|
477
|
+
}, () => {
|
|
478
|
+
this.pendingMutations -= 1;
|
|
479
|
+
}), e;
|
|
480
|
+
}
|
|
481
|
+
notifyPluginStoreCreated() {
|
|
482
|
+
this.pluginManager.notifyStoreCreated ? this.pluginManager.notifyStoreCreated(this) : this.pluginManager.getAll().forEach((t) => t.onStoreCreated?.(this));
|
|
483
|
+
}
|
|
484
|
+
notifyPluginStoreDisposed() {
|
|
485
|
+
this.pluginManager.notifyStoreDisposed ? this.pluginManager.notifyStoreDisposed(this) : this.pluginManager.getAll().forEach((t) => t.onStoreDisposed?.(this));
|
|
486
|
+
}
|
|
487
|
+
notifyPluginStateChange(t, e) {
|
|
488
|
+
this.pluginManager.notifyStateChange ? this.pluginManager.notifyStateChange(this.$id, y(t), y(e)) : this.pluginManager.getAll().forEach((r) => r.onStateChange?.(this.$id, y(t), y(e)));
|
|
139
489
|
}
|
|
140
490
|
checkDisposed() {
|
|
141
|
-
if (this.disposed) throw new Error(`[Store] Store "${this.$id}"
|
|
491
|
+
if (this.disposed) throw new Error(`[Store] Store "${this.$id}" has been disposed`);
|
|
142
492
|
}
|
|
143
493
|
createGetters(t) {
|
|
144
494
|
const e = {};
|
|
@@ -151,85 +501,60 @@
|
|
|
151
501
|
createActions(t) {
|
|
152
502
|
const e = {};
|
|
153
503
|
for (const r of Object.keys(t)) {
|
|
154
|
-
const
|
|
504
|
+
const n = t[r];
|
|
155
505
|
e[r] = (...t) => {
|
|
156
506
|
this.checkDisposed();
|
|
157
|
-
const e = [],
|
|
507
|
+
const e = [], o = [], s = {
|
|
158
508
|
after: (t) => e.push(t),
|
|
159
509
|
args: t,
|
|
160
510
|
name: r,
|
|
161
|
-
onError: (t) =>
|
|
511
|
+
onError: (t) => o.push(t),
|
|
162
512
|
storeId: this.$id
|
|
163
513
|
};
|
|
164
|
-
this.notifyAction(
|
|
514
|
+
this.notifyAction(s);
|
|
165
515
|
try {
|
|
166
|
-
const r =
|
|
167
|
-
return (
|
|
168
|
-
throw await
|
|
169
|
-
}) : (
|
|
516
|
+
const r = n.apply(this, t);
|
|
517
|
+
return (i = r) && "function" == typeof i.then ? r.then(async (t) => (await v(e, t), t)).catch(async (t) => {
|
|
518
|
+
throw await v(o, t), t;
|
|
519
|
+
}) : (v(e, r), r);
|
|
170
520
|
} catch (t) {
|
|
171
|
-
throw
|
|
521
|
+
throw v(o, t), t;
|
|
172
522
|
}
|
|
173
|
-
var
|
|
523
|
+
var i;
|
|
174
524
|
};
|
|
175
525
|
}
|
|
176
526
|
return e;
|
|
177
527
|
}
|
|
528
|
+
notifyAction(t) {
|
|
529
|
+
this.actionSubscribers.publish(t);
|
|
530
|
+
}
|
|
178
531
|
};
|
|
179
|
-
|
|
180
|
-
let e = 0;
|
|
181
|
-
const r = /* @__PURE__ */ new Set(), n = () => {
|
|
182
|
-
if (r.size > 0) {
|
|
183
|
-
const e = new Set(r);
|
|
184
|
-
r.clear(), t?.(e);
|
|
185
|
-
}
|
|
186
|
-
}, o = () => {
|
|
187
|
-
e++;
|
|
188
|
-
}, s = () => {
|
|
189
|
-
0 !== e && (e--, 0 === e && n());
|
|
190
|
-
};
|
|
191
|
-
return {
|
|
192
|
-
start: o,
|
|
193
|
-
end: s,
|
|
194
|
-
markDirty: (t) => {
|
|
195
|
-
r.add(t), 0 === e && n();
|
|
196
|
-
},
|
|
197
|
-
batch: (t) => {
|
|
198
|
-
o();
|
|
199
|
-
try {
|
|
200
|
-
return t();
|
|
201
|
-
} finally {
|
|
202
|
-
s();
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
isBatching: () => e > 0
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
let i = null;
|
|
209
|
-
function a() {
|
|
210
|
-
return i || (i = s()), i;
|
|
211
|
-
}
|
|
212
|
-
const c = {
|
|
532
|
+
const T = {
|
|
213
533
|
BUS: "store:bus",
|
|
214
534
|
PINIA: "store:pinia",
|
|
215
535
|
API: "store:api",
|
|
216
536
|
REGISTRY: "store:registry",
|
|
217
537
|
RUNTIME: "store:runtime"
|
|
218
|
-
},
|
|
538
|
+
}, $ = {
|
|
219
539
|
INSTALLED: "store:installed",
|
|
220
540
|
UNINSTALLED: "store:uninstalled"
|
|
221
541
|
};
|
|
222
|
-
function
|
|
542
|
+
function D(t) {
|
|
223
543
|
const e = t;
|
|
224
544
|
return e && "object" == typeof e && "engine" in e ? e.engine ?? {} : e ?? {};
|
|
225
545
|
}
|
|
226
|
-
function
|
|
546
|
+
function N(t, e, r) {
|
|
227
547
|
const n = r;
|
|
228
548
|
return n?.app ?? n?.framework?.app ?? t.getApp?.() ?? e?.framework?.app;
|
|
229
549
|
}
|
|
230
|
-
var
|
|
550
|
+
var C = Object.defineProperty, _ = (t, e, r) => ((t, e, r) => e in t ? C(t, e, {
|
|
551
|
+
enumerable: !0,
|
|
552
|
+
configurable: !0,
|
|
553
|
+
writable: !0,
|
|
554
|
+
value: r
|
|
555
|
+
}) : t[e] = r)(t, "symbol" != typeof e ? e + "" : e, r), x = ((t) => (t.STORE_DISPOSED = "STORE_DISPOSED", t.STORE_NOT_FOUND = "STORE_NOT_FOUND", t.STORE_ALREADY_EXISTS = "STORE_ALREADY_EXISTS", t.INVALID_STATE = "INVALID_STATE", t.INVALID_ACTION = "INVALID_ACTION", t.SERIALIZATION_ERROR = "SERIALIZATION_ERROR", t.DESERIALIZATION_ERROR = "DESERIALIZATION_ERROR", t.STORAGE_ERROR = "STORAGE_ERROR", t.PLUGIN_ERROR = "PLUGIN_ERROR", t.MIDDLEWARE_ERROR = "MIDDLEWARE_ERROR", t.SUBSCRIPTION_ERROR = "SUBSCRIPTION_ERROR", t.TIMEOUT_ERROR = "TIMEOUT_ERROR", t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t))(x || {}), j = ((t) => (t.WARNING = "warning", t.ERROR = "error", t.FATAL = "fatal", t))(j || {}), k = class t extends Error {
|
|
231
556
|
constructor(e, r = "UNKNOWN_ERROR", n = {}, o = "error", s) {
|
|
232
|
-
super(e), this.name = "StoreError", this.code = r, this.context = {
|
|
557
|
+
super(e), _(this, "code"), _(this, "context"), _(this, "severity"), _(this, "cause"), this.name = "StoreError", this.code = r, this.context = {
|
|
233
558
|
...n,
|
|
234
559
|
timestamp: n.timestamp ?? Date.now()
|
|
235
560
|
}, this.severity = o, this.cause = s, Object.setPrototypeOf(this, t.prototype), Error.captureStackTrace && Error.captureStackTrace(this, t);
|
|
@@ -248,23 +573,23 @@
|
|
|
248
573
|
const t = [`[${this.code}] ${this.message}`];
|
|
249
574
|
return this.context.storeId && t.push(`Store: ${this.context.storeId}`), this.context.action && t.push(`Action: ${this.context.action}`), t.join(" | ");
|
|
250
575
|
}
|
|
251
|
-
},
|
|
576
|
+
}, B = class t extends k {
|
|
252
577
|
constructor(e, r, n) {
|
|
253
578
|
super(e, "MIDDLEWARE_ERROR", { middleware: r }, "error", n), this.name = "MiddlewareError", Object.setPrototypeOf(this, t.prototype);
|
|
254
579
|
}
|
|
255
580
|
};
|
|
256
|
-
const
|
|
257
|
-
isStoreError: (t) => t instanceof
|
|
258
|
-
isErrorCode: (t, e) => t instanceof
|
|
581
|
+
const L = {
|
|
582
|
+
isStoreError: (t) => t instanceof k,
|
|
583
|
+
isErrorCode: (t, e) => t instanceof k && t.code === e,
|
|
259
584
|
wrap(t, e = "UNKNOWN_ERROR", r = {}) {
|
|
260
|
-
if (t instanceof
|
|
261
|
-
return new
|
|
585
|
+
if (t instanceof k) return t;
|
|
586
|
+
return new k(t instanceof Error ? t.message : String(t), e, r, "error", t instanceof Error ? t : void 0);
|
|
262
587
|
},
|
|
263
588
|
async tryCatch(t, e = "UNKNOWN_ERROR", r = {}) {
|
|
264
589
|
try {
|
|
265
590
|
return await t();
|
|
266
591
|
} catch (t) {
|
|
267
|
-
throw
|
|
592
|
+
throw L.wrap(t, e, r);
|
|
268
593
|
}
|
|
269
594
|
},
|
|
270
595
|
createLogger: (t) => ({
|
|
@@ -278,199 +603,41 @@
|
|
|
278
603
|
"fatal" === t.severity || "error" === t.severity ? this.error(t) : this.warn(t);
|
|
279
604
|
}
|
|
280
605
|
})
|
|
281
|
-
}
|
|
282
|
-
function S(t, e, r = !1) {
|
|
283
|
-
let n = null, o = null;
|
|
284
|
-
const s = (...s) => {
|
|
285
|
-
o = s, n && clearTimeout(n), r && !n ? (t(...s), n = setTimeout(() => {
|
|
286
|
-
n = null, o = null;
|
|
287
|
-
}, e)) : n = setTimeout(() => {
|
|
288
|
-
t(...s), n = null, o = null;
|
|
289
|
-
}, e);
|
|
290
|
-
};
|
|
291
|
-
return s.cancel = () => {
|
|
292
|
-
n && (clearTimeout(n), n = null, o = null);
|
|
293
|
-
}, s.flush = () => {
|
|
294
|
-
n && o && (clearTimeout(n), t(...o), n = null, o = null);
|
|
295
|
-
}, s.pending = () => null !== n, s;
|
|
296
|
-
}
|
|
297
|
-
const m = Object.prototype.hasOwnProperty;
|
|
298
|
-
function b(t, e) {
|
|
299
|
-
return m.call(t, e);
|
|
300
|
-
}
|
|
301
|
-
function E(t) {
|
|
302
|
-
return null !== t && "object" == typeof t;
|
|
303
|
-
}
|
|
304
|
-
function R(t) {
|
|
305
|
-
if (!E(t)) return !1;
|
|
306
|
-
const e = Object.getPrototypeOf(t);
|
|
307
|
-
return null === e || e === Object.prototype;
|
|
308
|
-
}
|
|
309
|
-
function w(t) {
|
|
310
|
-
return null == t || "boolean" == typeof t || "number" == typeof t || "string" == typeof t || "bigint" == typeof t || "function" != typeof t && "symbol" != typeof t && (t instanceof Date || t instanceof RegExp || t instanceof ArrayBuffer || t instanceof DataView || t instanceof Map || t instanceof Set || !!ArrayBuffer.isView(t) || (Array.isArray(t) ? t.every((t) => w(t)) : !!R(t) && Object.values(t).every((t) => w(t))));
|
|
311
|
-
}
|
|
312
|
-
function O(t, e = {}) {
|
|
313
|
-
const { useStructuredClone: r = !0, cloneFunctions: n = !1, cloneSymbols: o = !1, maxDepth: s = Infinity, customCloner: i } = e;
|
|
314
|
-
if (r && "function" == typeof structuredClone && w(t)) try {
|
|
315
|
-
return structuredClone(t);
|
|
316
|
-
} catch {}
|
|
317
|
-
const a = /* @__PURE__ */ new WeakMap();
|
|
318
|
-
return function t(e, r) {
|
|
319
|
-
if (null == e) return e;
|
|
320
|
-
if ("boolean" == typeof e || "number" == typeof e || "string" == typeof e) return e;
|
|
321
|
-
if ("bigint" == typeof e) return e;
|
|
322
|
-
if ("symbol" == typeof e) return o ? Symbol(e.description) : e;
|
|
323
|
-
if ("function" == typeof e) return n ? e.bind({}) : e;
|
|
324
|
-
if (r > s) return e;
|
|
325
|
-
if (i) {
|
|
326
|
-
const n = i(e, (e) => t(e, r + 1));
|
|
327
|
-
if (void 0 !== n) return n;
|
|
328
|
-
}
|
|
329
|
-
if ("object" == typeof e && null !== e && a.has(e)) return a.get(e);
|
|
330
|
-
if (e instanceof Date) return new Date(e.getTime());
|
|
331
|
-
if (e instanceof RegExp) {
|
|
332
|
-
const t = new RegExp(e.source, e.flags);
|
|
333
|
-
return t.lastIndex = e.lastIndex, t;
|
|
334
|
-
}
|
|
335
|
-
if (e instanceof Error) {
|
|
336
|
-
const t = new e.constructor(e.message);
|
|
337
|
-
return t.stack = e.stack, t.name = e.name, t;
|
|
338
|
-
}
|
|
339
|
-
if (e instanceof Map) {
|
|
340
|
-
const n = /* @__PURE__ */ new Map();
|
|
341
|
-
return a.set(e, n), e.forEach((e, o) => {
|
|
342
|
-
n.set(t(o, r + 1), t(e, r + 1));
|
|
343
|
-
}), n;
|
|
344
|
-
}
|
|
345
|
-
if (e instanceof Set) {
|
|
346
|
-
const n = /* @__PURE__ */ new Set();
|
|
347
|
-
return a.set(e, n), e.forEach((e) => {
|
|
348
|
-
n.add(t(e, r + 1));
|
|
349
|
-
}), n;
|
|
350
|
-
}
|
|
351
|
-
if (e instanceof ArrayBuffer) return e.slice(0);
|
|
352
|
-
if (ArrayBuffer.isView(e) && !(e instanceof DataView)) return new e.constructor(e.buffer.slice(0));
|
|
353
|
-
if (Array.isArray(e)) {
|
|
354
|
-
const n = [];
|
|
355
|
-
a.set(e, n);
|
|
356
|
-
for (let o = 0; o < e.length; o++) n[o] = t(e[o], r + 1);
|
|
357
|
-
return n;
|
|
358
|
-
}
|
|
359
|
-
if (R(e)) {
|
|
360
|
-
const n = {};
|
|
361
|
-
a.set(e, n);
|
|
362
|
-
const s = Object.keys(e);
|
|
363
|
-
for (const o of s) n[o] = t(e[o], r + 1);
|
|
364
|
-
if (o) {
|
|
365
|
-
const o = Object.getOwnPropertySymbols(e);
|
|
366
|
-
for (const s of o) n[s] = t(e[s], r + 1);
|
|
367
|
-
}
|
|
368
|
-
return n;
|
|
369
|
-
}
|
|
370
|
-
return e;
|
|
371
|
-
}(t, 0);
|
|
372
|
-
}
|
|
373
|
-
function I(t, e, ...r) {
|
|
374
|
-
const { arrayStrategy: n = "replace", clone: o = !0, maxDepth: s = Infinity } = e;
|
|
375
|
-
function i(t, e, r) {
|
|
376
|
-
if (r > s) return t;
|
|
377
|
-
for (const s of Object.keys(e)) {
|
|
378
|
-
const a = e[s], c = t[s];
|
|
379
|
-
if (Array.isArray(a)) if ("concat" === n && Array.isArray(c)) t[s] = [...c, ...a];
|
|
380
|
-
else if ("merge" === n && Array.isArray(c)) {
|
|
381
|
-
const e = [...c];
|
|
382
|
-
a.forEach((t, n) => {
|
|
383
|
-
R(t) && R(e[n]) ? e[n] = i(e[n], t, r + 1) : e[n] = o ? O(t) : t;
|
|
384
|
-
}), t[s] = e;
|
|
385
|
-
} else t[s] = o ? O(a) : a;
|
|
386
|
-
else R(a) ? R(c) ? t[s] = i(c, a, r + 1) : t[s] = o ? O(a) : a : t[s] = o && E(a) ? O(a) : a;
|
|
387
|
-
}
|
|
388
|
-
return t;
|
|
389
|
-
}
|
|
390
|
-
let a = t;
|
|
391
|
-
for (const t of r) null != t && (a = i(a, t, 0));
|
|
392
|
-
return a;
|
|
393
|
-
}
|
|
394
|
-
const A = /^\d+$/;
|
|
395
|
-
function T(t, e = Object.is) {
|
|
396
|
-
let r, n, o = !1;
|
|
397
|
-
return (s) => {
|
|
398
|
-
if (o && r === s) return n;
|
|
399
|
-
const i = t(s);
|
|
400
|
-
return o && e(i, n) || (n = i), r = s, o = !0, n;
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
const v = {
|
|
606
|
+
}, F = {
|
|
404
607
|
logState: !0,
|
|
405
608
|
logAction: !0,
|
|
406
609
|
collapsed: !0,
|
|
407
610
|
timestamp: !0,
|
|
408
611
|
level: "log"
|
|
409
|
-
},
|
|
410
|
-
function
|
|
612
|
+
}, z = "color: #9E9E9E; font-weight: bold", U = "color: #03A9F4; font-weight: bold", G = "color: #4CAF50; font-weight: bold", W = "color: #F44336; font-weight: bold", V = "color: #9C27B0; font-weight: normal", H = "color: inherit; font-weight: bold";
|
|
613
|
+
function K(t) {
|
|
411
614
|
try {
|
|
412
|
-
return
|
|
615
|
+
return y(t);
|
|
413
616
|
} catch {
|
|
414
617
|
return { ...t };
|
|
415
618
|
}
|
|
416
619
|
}
|
|
417
|
-
|
|
418
|
-
const t = /* @__PURE__ */ new Map();
|
|
419
|
-
let e = null;
|
|
420
|
-
const r = () => (null === e && (e = Array.from(t.values()).sort((t, e) => (t.priority ?? 100) - (e.priority ?? 100))), e), n = () => {
|
|
421
|
-
e = null;
|
|
422
|
-
};
|
|
423
|
-
return {
|
|
424
|
-
use: (e) => {
|
|
425
|
-
t.has(e.name) && console.warn(`[Middleware] 中间件 "${e.name}" 已存在,将被覆盖`), t.set(e.name, e), n();
|
|
426
|
-
},
|
|
427
|
-
remove: (e) => {
|
|
428
|
-
t.delete(e) && n();
|
|
429
|
-
},
|
|
430
|
-
get: (e) => t.get(e),
|
|
431
|
-
has: (e) => t.has(e),
|
|
432
|
-
execute: async (t) => {
|
|
433
|
-
const e = r();
|
|
434
|
-
if (0 === e.length) return;
|
|
435
|
-
const n = async (r) => {
|
|
436
|
-
const o = e[r];
|
|
437
|
-
if (!o) return;
|
|
438
|
-
let s = !1;
|
|
439
|
-
await o.handler(t, async () => {
|
|
440
|
-
if (s) throw new Error(`[Middleware] next() called multiple times in "${o.name}"`);
|
|
441
|
-
s = !0, await n(r + 1);
|
|
442
|
-
});
|
|
443
|
-
};
|
|
444
|
-
await n(0);
|
|
445
|
-
},
|
|
446
|
-
getAll: () => r(),
|
|
447
|
-
clear: () => {
|
|
448
|
-
t.clear(), n();
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
let C = null;
|
|
453
|
-
const k = {
|
|
620
|
+
const Y = {
|
|
454
621
|
keyPrefix: "ldesign-store:",
|
|
455
622
|
storage: "localStorage",
|
|
456
623
|
debounce: 100,
|
|
457
|
-
serialize: JSON.stringify,
|
|
458
|
-
deserialize: JSON.parse
|
|
624
|
+
serialize: (t) => JSON.stringify(t),
|
|
625
|
+
deserialize: (t) => JSON.parse(t)
|
|
459
626
|
};
|
|
460
|
-
function
|
|
627
|
+
function Z(t) {
|
|
461
628
|
return {
|
|
462
|
-
...
|
|
629
|
+
...Y,
|
|
463
630
|
...t
|
|
464
631
|
};
|
|
465
632
|
}
|
|
466
|
-
function
|
|
633
|
+
function Q(t) {
|
|
467
634
|
return "undefined" == typeof window ? null : "localStorage" === t ? localStorage : sessionStorage;
|
|
468
635
|
}
|
|
469
|
-
const
|
|
636
|
+
const q = {
|
|
470
637
|
maxHistory: 100,
|
|
471
638
|
enabled: !0
|
|
472
639
|
};
|
|
473
|
-
function
|
|
640
|
+
function J(t) {
|
|
474
641
|
return {
|
|
475
642
|
name: t.name,
|
|
476
643
|
version: t.version,
|
|
@@ -482,83 +649,49 @@
|
|
|
482
649
|
onStateChange: t.onStateChange
|
|
483
650
|
};
|
|
484
651
|
}
|
|
485
|
-
|
|
486
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
|
|
487
|
-
return {
|
|
488
|
-
use: (r, n) => {
|
|
489
|
-
t.has(r.name) && console.warn(`[Plugin] 插件 "${r.name}" 已存在,将被覆盖`), t.set(r.name, r);
|
|
490
|
-
const o = {
|
|
491
|
-
storeManager: {
|
|
492
|
-
getStore: () => null,
|
|
493
|
-
hasStore: () => !1,
|
|
494
|
-
getStoreIds: () => []
|
|
495
|
-
},
|
|
496
|
-
storeId: "",
|
|
497
|
-
store: null,
|
|
498
|
-
options: n || {}
|
|
499
|
-
};
|
|
500
|
-
e.set(r.name, o);
|
|
501
|
-
},
|
|
502
|
-
remove: (r) => {
|
|
503
|
-
const n = t.get(r), o = e.get(r);
|
|
504
|
-
n && o && n.uninstall?.(o), t.delete(r), e.delete(r);
|
|
505
|
-
},
|
|
506
|
-
get: (e) => t.get(e),
|
|
507
|
-
has: (e) => t.has(e),
|
|
508
|
-
getAll: () => new Map(t),
|
|
509
|
-
size: () => t.size,
|
|
510
|
-
clear: () => {
|
|
511
|
-
t.forEach((t, r) => {
|
|
512
|
-
const n = e.get(r);
|
|
513
|
-
n && t.uninstall?.(n);
|
|
514
|
-
}), t.clear(), e.clear();
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
let G = null;
|
|
519
|
-
exports.BaseStore = o, exports.DeserializationError = class t extends g {
|
|
652
|
+
exports.BaseStore = P, exports.DeserializationError = class t extends k {
|
|
520
653
|
constructor(e, r, n) {
|
|
521
654
|
super(e, "DESERIALIZATION_ERROR", { storeId: n }, "error", r), this.name = "DeserializationError", Object.setPrototypeOf(this, t.prototype);
|
|
522
655
|
}
|
|
523
|
-
}, exports.ErrorSeverity =
|
|
656
|
+
}, exports.ErrorSeverity = j, exports.InvalidStateError = class t extends k {
|
|
524
657
|
constructor(e, r, n) {
|
|
525
658
|
super(e, "INVALID_STATE", {
|
|
526
659
|
storeId: r,
|
|
527
660
|
data: n
|
|
528
661
|
}, "error"), this.name = "InvalidStateError", Object.setPrototypeOf(this, t.prototype);
|
|
529
662
|
}
|
|
530
|
-
}, exports.MiddlewareError =
|
|
663
|
+
}, exports.MiddlewareError = B, exports.PluginError = class t extends k {
|
|
531
664
|
constructor(e, r, n) {
|
|
532
665
|
super(e, "PLUGIN_ERROR", { plugin: r }, "error", n), this.name = "PluginError", Object.setPrototypeOf(this, t.prototype);
|
|
533
666
|
}
|
|
534
|
-
}, exports.SerializationError = class t extends
|
|
667
|
+
}, exports.SerializationError = class t extends k {
|
|
535
668
|
constructor(e, r, n) {
|
|
536
669
|
super(e, "SERIALIZATION_ERROR", { storeId: n }, "error", r), this.name = "SerializationError", Object.setPrototypeOf(this, t.prototype);
|
|
537
670
|
}
|
|
538
|
-
}, exports.StorageError = class t extends
|
|
671
|
+
}, exports.StorageError = class t extends k {
|
|
539
672
|
constructor(e, r, n) {
|
|
540
673
|
super(e, "STORAGE_ERROR", { storeId: n }, "error", r), this.name = "StorageError", Object.setPrototypeOf(this, t.prototype);
|
|
541
674
|
}
|
|
542
|
-
}, exports.StoreAlreadyExistsError = class t extends
|
|
675
|
+
}, exports.StoreAlreadyExistsError = class t extends k {
|
|
543
676
|
constructor(e) {
|
|
544
677
|
super(`Store "${e}" 已存在`, "STORE_ALREADY_EXISTS", { storeId: e }, "warning"), this.name = "StoreAlreadyExistsError", Object.setPrototypeOf(this, t.prototype);
|
|
545
678
|
}
|
|
546
|
-
}, exports.StoreDisposedError = class t extends
|
|
679
|
+
}, exports.StoreDisposedError = class t extends k {
|
|
547
680
|
constructor(e, r) {
|
|
548
681
|
super(`Store "${e}" 已被销毁,无法执行操作${r ? `: ${r}` : ""}`, "STORE_DISPOSED", {
|
|
549
682
|
storeId: e,
|
|
550
683
|
action: r
|
|
551
684
|
}, "error"), this.name = "StoreDisposedError", Object.setPrototypeOf(this, t.prototype);
|
|
552
685
|
}
|
|
553
|
-
}, exports.StoreError =
|
|
686
|
+
}, exports.StoreError = k, exports.StoreErrorCode = x, exports.StoreNotFoundError = class t extends k {
|
|
554
687
|
constructor(e) {
|
|
555
688
|
super(`Store "${e}" 不存在`, "STORE_NOT_FOUND", { storeId: e }, "error"), this.name = "StoreNotFoundError", Object.setPrototypeOf(this, t.prototype);
|
|
556
689
|
}
|
|
557
|
-
}, exports.SubscriptionError = class t extends
|
|
690
|
+
}, exports.SubscriptionError = class t extends k {
|
|
558
691
|
constructor(e, r, n) {
|
|
559
692
|
super(e, "SUBSCRIPTION_ERROR", { storeId: n }, "warning", r), this.name = "SubscriptionError", Object.setPrototypeOf(this, t.prototype);
|
|
560
693
|
}
|
|
561
|
-
}, exports.TimeoutError = class t extends
|
|
694
|
+
}, exports.TimeoutError = class t extends k {
|
|
562
695
|
constructor(e, r, n) {
|
|
563
696
|
super(e, "TIMEOUT_ERROR", {
|
|
564
697
|
storeId: r,
|
|
@@ -566,13 +699,13 @@
|
|
|
566
699
|
}, "error"), this.name = "TimeoutError", Object.setPrototypeOf(this, t.prototype);
|
|
567
700
|
}
|
|
568
701
|
}, exports.batch = function(t) {
|
|
569
|
-
return
|
|
702
|
+
return w().batch(t);
|
|
570
703
|
}, exports.combineSelectors = function(t, e) {
|
|
571
704
|
return (r) => e(...t.map((t) => t(r)));
|
|
572
705
|
}, exports.composePlugins = function(t) {
|
|
573
706
|
return {
|
|
574
707
|
name: "composed-plugins",
|
|
575
|
-
version: "
|
|
708
|
+
version: "0.0.1",
|
|
576
709
|
async install(e, r) {
|
|
577
710
|
for (const n of t) await n.install(e, r);
|
|
578
711
|
},
|
|
@@ -589,63 +722,91 @@
|
|
|
589
722
|
t.forEach((t) => t.onStateChange?.(e, r, n));
|
|
590
723
|
}
|
|
591
724
|
};
|
|
592
|
-
}, exports.createAsyncAction = function(
|
|
593
|
-
const { retryCount:
|
|
725
|
+
}, exports.createAsyncAction = function(r, n = {}) {
|
|
726
|
+
const { retryCount: o = 0, retryDelay: s = 1e3, timeout: i = 0, resetOnExecute: a = !0 } = n, c = {
|
|
594
727
|
data: null,
|
|
595
728
|
error: null,
|
|
596
729
|
loading: !1,
|
|
597
730
|
executionCount: 0,
|
|
598
731
|
lastExecutedAt: null
|
|
599
|
-
},
|
|
600
|
-
let
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
}, p = async (t, r) => {
|
|
732
|
+
}, l = t(), u = t(), f = t();
|
|
733
|
+
let d = 0, h = null;
|
|
734
|
+
const p = () => l.publish({ ...c }), g = r, y = async (t, r, n) => {
|
|
735
|
+
if (n.controller.signal.aborted) throw n.abortReason ?? e();
|
|
604
736
|
try {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
737
|
+
const r = await g(...t, n.controller.signal);
|
|
738
|
+
if (n.controller.signal.aborted) throw n.abortReason ?? e();
|
|
739
|
+
return r;
|
|
740
|
+
} catch (a) {
|
|
741
|
+
if (n.controller.signal.aborted) throw n.abortReason ?? e();
|
|
742
|
+
if (r <= 0) throw a;
|
|
743
|
+
return await (o = s, i = n.controller.signal, i.aborted ? Promise.reject(e()) : new Promise((t, r) => {
|
|
744
|
+
let n;
|
|
745
|
+
const s = () => {
|
|
746
|
+
clearTimeout(n), i.removeEventListener("abort", s), r(e());
|
|
747
|
+
};
|
|
748
|
+
n = setTimeout(() => {
|
|
749
|
+
i.removeEventListener("abort", s), t();
|
|
750
|
+
}, o), i.addEventListener("abort", s, { once: !0 });
|
|
751
|
+
})), y(t, r - 1, n);
|
|
612
752
|
}
|
|
613
|
-
var
|
|
753
|
+
var o, i;
|
|
754
|
+
}, m = (t, e) => {
|
|
755
|
+
t.abortReason = e, t.controller.signal.aborted || t.controller.abort(), t.rejectAbort?.(e), t.timeoutId && (clearTimeout(t.timeoutId), t.timeoutId = void 0);
|
|
614
756
|
};
|
|
615
757
|
return {
|
|
616
758
|
get state() {
|
|
617
|
-
return { ...
|
|
759
|
+
return { ...c };
|
|
618
760
|
},
|
|
619
761
|
execute: async (...t) => {
|
|
620
|
-
|
|
762
|
+
h && m(h, e());
|
|
763
|
+
const r = {
|
|
764
|
+
id: ++d,
|
|
765
|
+
controller: new AbortController()
|
|
766
|
+
};
|
|
767
|
+
h = r, a && (c.error = null), c.loading = !0, c.executionCount++, c.lastExecutedAt = Date.now(), p();
|
|
621
768
|
try {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
769
|
+
const e = y(t, o, r), n = new Promise((t, e) => {
|
|
770
|
+
r.rejectAbort = e;
|
|
771
|
+
}), s = i > 0 ? new Promise((t, e) => {
|
|
772
|
+
r.timeoutId = setTimeout(() => {
|
|
773
|
+
const t = /* @__PURE__ */ new Error(`Timeout after ${i}ms`);
|
|
774
|
+
r.abortReason = t, r.controller.abort(), e(t);
|
|
775
|
+
}, i);
|
|
776
|
+
}) : null;
|
|
777
|
+
r.result = s ? Promise.race([
|
|
778
|
+
e,
|
|
779
|
+
n,
|
|
780
|
+
s
|
|
781
|
+
]) : Promise.race([e, n]);
|
|
782
|
+
const a = await r.result;
|
|
783
|
+
return h?.id !== r.id || r.controller.signal.aborted || (c.data = a, c.error = null, c.loading = !1, p(), u.publish(a)), a;
|
|
630
784
|
} catch (t) {
|
|
631
|
-
if (
|
|
785
|
+
if (h?.id === r.id) {
|
|
632
786
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
633
|
-
|
|
787
|
+
c.error = e, c.loading = !1, p(), "Aborted" !== r.abortReason?.message && f.publish(e);
|
|
634
788
|
}
|
|
635
789
|
throw t;
|
|
790
|
+
} finally {
|
|
791
|
+
r.timeoutId && (clearTimeout(r.timeoutId), r.timeoutId = void 0), h?.id === r.id && (h = null);
|
|
636
792
|
}
|
|
637
793
|
},
|
|
638
794
|
reset: () => {
|
|
639
|
-
|
|
795
|
+
if (h) {
|
|
796
|
+
const t = h;
|
|
797
|
+
h = null, m(t, e());
|
|
798
|
+
}
|
|
799
|
+
c.data = null, c.error = null, c.loading = !1, c.executionCount = 0, c.lastExecutedAt = null, p();
|
|
640
800
|
},
|
|
641
801
|
abort: () => {
|
|
642
|
-
|
|
802
|
+
const t = h;
|
|
803
|
+
t && (h = null, m(t, e()), c.loading && (c.loading = !1, c.error = t.abortReason ?? e(), p()));
|
|
643
804
|
},
|
|
644
|
-
subscribe: (t) =>
|
|
645
|
-
onSuccess: (t) =>
|
|
646
|
-
onError: (t) =>
|
|
805
|
+
subscribe: (t) => l.subscribe(t),
|
|
806
|
+
onSuccess: (t) => u.subscribe(t),
|
|
807
|
+
onError: (t) => f.subscribe(t)
|
|
647
808
|
};
|
|
648
|
-
}, exports.createBatchManager =
|
|
809
|
+
}, exports.createBatchManager = E, exports.createCachedSelector = function(t, e = {}) {
|
|
649
810
|
const { maxSize: r = 10 } = e, n = /* @__PURE__ */ new Map(), o = (e) => {
|
|
650
811
|
if (n.has(e)) {
|
|
651
812
|
const t = n.get(e);
|
|
@@ -659,9 +820,9 @@
|
|
|
659
820
|
return n.set(e, o), o;
|
|
660
821
|
};
|
|
661
822
|
return o.clearCache = () => n.clear(), o.getCacheSize = () => n.size, o;
|
|
662
|
-
}, exports.createEventBus =
|
|
823
|
+
}, exports.createEventBus = I, exports.createLoggerMiddleware = function(t = {}) {
|
|
663
824
|
const e = {
|
|
664
|
-
...
|
|
825
|
+
...F,
|
|
665
826
|
...t
|
|
666
827
|
}, r = e.logger ?? console;
|
|
667
828
|
return {
|
|
@@ -674,27 +835,27 @@
|
|
|
674
835
|
if (c && !e.logState || l && !e.logAction) return void await n();
|
|
675
836
|
const u = e.timestamp ? `${(f = /* @__PURE__ */ new Date()).getHours().toString().padStart(2, "0")}:${f.getMinutes().toString().padStart(2, "0")}:${f.getSeconds().toString().padStart(2, "0")}.${f.getMilliseconds().toString().padStart(3, "0")}` : "";
|
|
676
837
|
var f;
|
|
677
|
-
const d = `[Store: ${o}]`,
|
|
678
|
-
e.collapsed && "function" == typeof r.groupCollapsed ? r.groupCollapsed(`%c${
|
|
838
|
+
const d = `[Store: ${o}]`, h = performance.now(), p = K(i), g = u ? `${u} ${d} ${s}` : `${d} ${s}`;
|
|
839
|
+
e.collapsed && "function" == typeof r.groupCollapsed ? r.groupCollapsed(`%c${g}`, H) : "function" == typeof r.group && r.group(`%c${g}`, H);
|
|
679
840
|
try {
|
|
680
841
|
const o = r[e.level ?? "log"] ?? r.log;
|
|
681
|
-
"function" == typeof o && (o.call(r, "%c prev state",
|
|
842
|
+
"function" == typeof o && (o.call(r, "%c prev state", z, p), void 0 !== a && o.call(r, "%c payload", U, a)), await n();
|
|
682
843
|
const s = performance.now();
|
|
683
|
-
"function" == typeof o && (o.call(r, "%c next state",
|
|
844
|
+
"function" == typeof o && (o.call(r, "%c next state", G, K(t.state)), o.call(r, "%c duration", V, function(t, e) {
|
|
684
845
|
const r = e - t;
|
|
685
846
|
return r < 1 ? "< 1ms" : `${r.toFixed(2)}ms`;
|
|
686
|
-
}(
|
|
847
|
+
}(h, s)));
|
|
687
848
|
} catch (t) {
|
|
688
|
-
throw "function" == typeof r.error && r.error("%c error",
|
|
849
|
+
throw "function" == typeof r.error && r.error("%c error", W, t), new B(`日志中间件执行错误: ${t instanceof Error ? t.message : String(t)}`, "logger", t instanceof Error ? t : void 0);
|
|
689
850
|
} finally {
|
|
690
851
|
"function" == typeof r.groupEnd && r.groupEnd();
|
|
691
852
|
}
|
|
692
853
|
}
|
|
693
854
|
};
|
|
694
855
|
}, exports.createMemoizedSelector = function(t, e = {}) {
|
|
695
|
-
return
|
|
696
|
-
}, exports.createMiddlewareManager =
|
|
697
|
-
const e =
|
|
856
|
+
return b(t, e.equalityFn);
|
|
857
|
+
}, exports.createMiddlewareManager = r, exports.createPersistMiddleware = function(t = {}) {
|
|
858
|
+
const e = Z(t), r = Q(e.storage), n = /* @__PURE__ */ new Map(), o = (t, n) => {
|
|
698
859
|
if (r) try {
|
|
699
860
|
const o = ((t, r) => {
|
|
700
861
|
const n = e.paths?.[t];
|
|
@@ -723,13 +884,13 @@
|
|
|
723
884
|
const { storeId: s, type: i, state: a } = t;
|
|
724
885
|
i.startsWith("state:") && (e.stores && !e.stores.includes(s) || ((t) => {
|
|
725
886
|
let r = n.get(t);
|
|
726
|
-
return r || (r =
|
|
887
|
+
return r || (r = u((e) => o(t, e), e.debounce), n.set(t, r)), r;
|
|
727
888
|
})(s)(a));
|
|
728
889
|
}
|
|
729
890
|
};
|
|
730
891
|
}, exports.createPluginFactory = function(t) {
|
|
731
|
-
return (e) =>
|
|
732
|
-
}, exports.createPluginManager =
|
|
892
|
+
return (e) => J(t(e));
|
|
893
|
+
}, exports.createPluginManager = i, exports.createPubSub = t, exports.createPubSubWithValue = function(e) {
|
|
733
894
|
let r = e;
|
|
734
895
|
const n = t();
|
|
735
896
|
return {
|
|
@@ -746,7 +907,7 @@
|
|
|
746
907
|
r = t, n.publish(t, e);
|
|
747
908
|
}
|
|
748
909
|
};
|
|
749
|
-
}, exports.createSelector =
|
|
910
|
+
}, exports.createSelector = b, exports.createSelectorWithDeps = function(t, e, r = {}) {
|
|
750
911
|
const { equalityFn: n = Object.is, trackHitRate: o = !1 } = r;
|
|
751
912
|
let s, i, a = !1, c = 0, l = 0;
|
|
752
913
|
const u = (r) => {
|
|
@@ -776,23 +937,23 @@
|
|
|
776
937
|
e && void 0 !== a ? console.info(c, a) : console.info(c), await o();
|
|
777
938
|
}
|
|
778
939
|
};
|
|
779
|
-
}, exports.createStore = function(t) {
|
|
780
|
-
let
|
|
940
|
+
}, exports.createStore = function(t, e = {}) {
|
|
941
|
+
let r = null;
|
|
781
942
|
return () => {
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
784
|
-
return
|
|
785
|
-
|
|
786
|
-
},
|
|
943
|
+
if (r) return r;
|
|
944
|
+
const n = new P(t, e), o = n.$dispose.bind(n);
|
|
945
|
+
return n.$dispose = () => {
|
|
946
|
+
o(), r = null;
|
|
947
|
+
}, r = n, n;
|
|
787
948
|
};
|
|
788
949
|
}, exports.createStoreEngineBridge = function(t) {
|
|
789
|
-
const { createRuntime: e, debug:
|
|
790
|
-
let
|
|
791
|
-
const
|
|
792
|
-
const
|
|
793
|
-
return
|
|
794
|
-
t.state?.set?.(
|
|
795
|
-
}(
|
|
950
|
+
const { createRuntime: e, debug: r = !1, name: n = "store", onRuntimeChange: o, version: s = "0.0.1" } = t;
|
|
951
|
+
let i, a = {}, c = null, l = null, u = 0, f = null;
|
|
952
|
+
const d = (e, r) => {
|
|
953
|
+
const u = c, f = l;
|
|
954
|
+
return c = e, l = r, o?.(e), function(t, e, r, n) {
|
|
955
|
+
t.state?.set?.(T.RUNTIME, n), t.state?.set?.(T.PINIA, n.pinia), t.state?.set?.(T.API, n.storeAPI), t.state?.set?.(T.REGISTRY, n.registry), t.state?.set?.(T.BUS, A), t.state?.set?.(`plugins.${e}`, n.storeAPI), t.state?.set?.(`plugins.${e}.config`, r);
|
|
956
|
+
}(a, n, t, e), function(t, e, r, n) {
|
|
796
957
|
if (!t.api?.register) return;
|
|
797
958
|
const o = function(t, e, r) {
|
|
798
959
|
return {
|
|
@@ -806,68 +967,72 @@
|
|
|
806
967
|
};
|
|
807
968
|
}(e, r, n);
|
|
808
969
|
t.api.unregister?.(e), t.api.register.length >= 2 ? t.api.register(e, o) : t.api.register(o);
|
|
809
|
-
}(
|
|
970
|
+
}(a, n, s, e), function(t, e) {
|
|
810
971
|
if (t?.container?.singleton) try {
|
|
811
972
|
t.container.singleton("pinia", e.pinia), t.container.singleton("storeAPI", e.storeAPI), t.container.singleton("storeRegistry", e.registry), t.container.singleton("storeRuntime", e);
|
|
812
973
|
} catch {}
|
|
813
|
-
}(
|
|
814
|
-
},
|
|
974
|
+
}(i, e), u && u !== e && "engine" === f && u.dispose?.(), e;
|
|
975
|
+
}, h = () => c && "engine" === l ? c : e(), p = (e) => {
|
|
815
976
|
const r = t.getRuntimeFromApp?.(e);
|
|
816
|
-
if (r) return
|
|
817
|
-
const n =
|
|
818
|
-
return
|
|
977
|
+
if (r) return d(r, "external");
|
|
978
|
+
const n = h(), o = t.attachToApp ? t.attachToApp(e, n) : n;
|
|
979
|
+
return d(o, o === n ? "engine" : "external");
|
|
819
980
|
};
|
|
820
981
|
return {
|
|
821
|
-
attachToApp:
|
|
822
|
-
getRuntime: () =>
|
|
982
|
+
attachToApp: p,
|
|
983
|
+
getRuntime: () => c,
|
|
823
984
|
install: async (e) => {
|
|
824
|
-
|
|
985
|
+
const o = ++u;
|
|
986
|
+
f = null, a = D(e), i = function(t) {
|
|
825
987
|
return t && "object" == typeof t ? t : void 0;
|
|
826
988
|
}(e);
|
|
827
|
-
const
|
|
828
|
-
!
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
989
|
+
const l = t.resolveApp ? t.resolveApp(a, i ?? {}, void 0) : N(a, i);
|
|
990
|
+
!l || t.isApp && !t.isApp(l) ? (d(h(), "engine"), f = o, a.events?.once?.("app:created", (e) => {
|
|
991
|
+
if (f !== o || u !== o || !c) return;
|
|
992
|
+
f = null;
|
|
993
|
+
const r = t.resolveApp ? t.resolveApp(a, i ?? {}, e) : N(a, i, e);
|
|
994
|
+
!r || t.isApp && !t.isApp(r) || p(r);
|
|
995
|
+
})) : p(l), await a.events?.emit?.($.INSTALLED, {
|
|
996
|
+
name: n,
|
|
997
|
+
version: s,
|
|
998
|
+
pinia: c?.pinia,
|
|
999
|
+
storeAPI: c?.storeAPI
|
|
1000
|
+
}), r && a.logger?.info?.("[StoreEngineBridge] installed");
|
|
837
1001
|
},
|
|
838
1002
|
uninstall: async (t) => {
|
|
839
|
-
|
|
840
|
-
e
|
|
841
|
-
|
|
842
|
-
|
|
1003
|
+
u++, f = null;
|
|
1004
|
+
const e = t ? D(t) : a;
|
|
1005
|
+
e.api?.unregister?.(n), function(t, e) {
|
|
1006
|
+
t.state?.delete?.(T.RUNTIME), t.state?.delete?.(T.PINIA), t.state?.delete?.(T.API), t.state?.delete?.(T.REGISTRY), t.state?.delete?.(T.BUS), t.state?.delete?.(`plugins.${e}`), t.state?.delete?.(`plugins.${e}.config`);
|
|
1007
|
+
}(e, n), await e.events?.emit?.($.UNINSTALLED, { name: n }), c && "engine" === l && c.dispose?.(), c = null, l = null, o?.(null), r && e.logger?.info?.("[StoreEngineBridge] uninstalled");
|
|
843
1008
|
}
|
|
844
1009
|
};
|
|
845
1010
|
}, exports.createTimeTravelMiddleware = function(t = {}) {
|
|
846
1011
|
const e = {
|
|
847
|
-
...
|
|
1012
|
+
...q,
|
|
848
1013
|
...t
|
|
849
|
-
}, r = e.maxHistory ??
|
|
1014
|
+
}, r = e.maxHistory ?? q.maxHistory ?? 100, n = [];
|
|
850
1015
|
let o = -1, s = !1, i = () => {};
|
|
851
1016
|
const a = {
|
|
852
1017
|
undo: () => {
|
|
853
1018
|
if (!a.canUndo()) return;
|
|
854
1019
|
s = !0, o--;
|
|
855
1020
|
const t = n[o];
|
|
856
|
-
i(t.storeId,
|
|
1021
|
+
i(t.storeId, y(t.state)), s = !1;
|
|
857
1022
|
},
|
|
858
1023
|
redo: () => {
|
|
859
1024
|
if (!a.canRedo()) return;
|
|
860
1025
|
s = !0, o++;
|
|
861
1026
|
const t = n[o];
|
|
862
|
-
i(t.storeId,
|
|
1027
|
+
i(t.storeId, y(t.state)), s = !1;
|
|
863
1028
|
},
|
|
864
1029
|
goto: (t) => {
|
|
865
1030
|
if (t < 0 || t >= n.length) return;
|
|
866
1031
|
s = !0, o = t;
|
|
867
1032
|
const e = n[o];
|
|
868
|
-
i(e.storeId,
|
|
1033
|
+
i(e.storeId, y(e.state)), s = !1;
|
|
869
1034
|
},
|
|
870
|
-
getHistory: () =>
|
|
1035
|
+
getHistory: () => y(n),
|
|
871
1036
|
getCurrentIndex: () => o,
|
|
872
1037
|
canUndo: () => o > 0,
|
|
873
1038
|
canRedo: () => o < n.length - 1,
|
|
@@ -887,7 +1052,7 @@
|
|
|
887
1052
|
if (!c.startsWith("state:") || s) return void await i();
|
|
888
1053
|
const u = {
|
|
889
1054
|
timestamp: Date.now(),
|
|
890
|
-
state:
|
|
1055
|
+
state: y(l),
|
|
891
1056
|
type: c,
|
|
892
1057
|
storeId: a
|
|
893
1058
|
};
|
|
@@ -938,10 +1103,10 @@
|
|
|
938
1103
|
handler: async (t, a) => {
|
|
939
1104
|
const { storeId: c, type: l, state: u } = t;
|
|
940
1105
|
if (!(o ? "state:patch" === l : l.startsWith("state:")) || !e[c]) return void await a();
|
|
941
|
-
await a();
|
|
942
1106
|
const f = await i(c, u);
|
|
943
1107
|
if (f.valid) s = s.filter((t) => t.storeId !== c);
|
|
944
1108
|
else if (s = f.errors, r?.(f), n) throw new Error(`[Validation] ${c}: ${f.errors.map((t) => t.message).join("; ")}`);
|
|
1109
|
+
await a();
|
|
945
1110
|
}
|
|
946
1111
|
},
|
|
947
1112
|
validate: i,
|
|
@@ -950,7 +1115,7 @@
|
|
|
950
1115
|
s = [];
|
|
951
1116
|
}
|
|
952
1117
|
};
|
|
953
|
-
}, exports.debounce =
|
|
1118
|
+
}, exports.debounce = u, exports.deepClone = y, exports.deepEqual = function t(e, r) {
|
|
954
1119
|
if (e === r) return !0;
|
|
955
1120
|
if (null === e || null === r || void 0 === e || void 0 === r) return e === r;
|
|
956
1121
|
if (typeof e != typeof r) return !1;
|
|
@@ -972,11 +1137,11 @@
|
|
|
972
1137
|
for (let n = 0; n < e.length; n++) if (!t(e[n], r[n])) return !1;
|
|
973
1138
|
return !0;
|
|
974
1139
|
}
|
|
975
|
-
if (
|
|
1140
|
+
if (p(e) && p(r)) {
|
|
976
1141
|
const n = Object.keys(e), o = Object.keys(r);
|
|
977
1142
|
if (n.length !== o.length) return !1;
|
|
978
1143
|
for (const o of n) {
|
|
979
|
-
if (!
|
|
1144
|
+
if (!d(r, o)) return !1;
|
|
980
1145
|
if (!t(e[o], r[o])) return !1;
|
|
981
1146
|
}
|
|
982
1147
|
return !0;
|
|
@@ -990,8 +1155,8 @@
|
|
|
990
1155
|
}
|
|
991
1156
|
return Object.freeze(e);
|
|
992
1157
|
}, exports.deepMerge = function(t, ...e) {
|
|
993
|
-
return
|
|
994
|
-
}, exports.deepMergeWithOptions =
|
|
1158
|
+
return m(t, {}, ...e);
|
|
1159
|
+
}, exports.deepMergeWithOptions = m, exports.defineStorePlugin = J, exports.deleteByPath = function(t, e) {
|
|
995
1160
|
if (!e || 0 === e.length) return !1;
|
|
996
1161
|
const r = e.replace(/\[([^\]]+)\]/g, ".$1").split(".").filter(Boolean);
|
|
997
1162
|
let n = t;
|
|
@@ -1009,7 +1174,7 @@
|
|
|
1009
1174
|
return delete n[o], !0;
|
|
1010
1175
|
}
|
|
1011
1176
|
return !1;
|
|
1012
|
-
}, exports.errorUtils =
|
|
1177
|
+
}, exports.errorUtils = L, exports.getByPath = function(t, e, r) {
|
|
1013
1178
|
if (!e || 0 === e.length) return t;
|
|
1014
1179
|
const n = e.replace(/\[([^\]]+)\]/g, ".$1").split(".").filter(Boolean);
|
|
1015
1180
|
let o = t;
|
|
@@ -1019,11 +1184,7 @@
|
|
|
1019
1184
|
o = o[t];
|
|
1020
1185
|
}
|
|
1021
1186
|
return void 0 === o ? r : o;
|
|
1022
|
-
}, exports.getGlobalBatchManager =
|
|
1023
|
-
return C || (C = j()), C;
|
|
1024
|
-
}, exports.getGlobalPluginManager = function() {
|
|
1025
|
-
return G || (G = F()), G;
|
|
1026
|
-
}, exports.globalEventBus = r, exports.hasPath = function(t, e) {
|
|
1187
|
+
}, exports.getGlobalBatchManager = w, exports.getGlobalMiddlewareManager = o, exports.getGlobalPluginManager = l, exports.globalEventBus = A, exports.hasPath = function(t, e) {
|
|
1027
1188
|
if (!e || 0 === e.length) return !0;
|
|
1028
1189
|
const r = e.replace(/\[([^\]]+)\]/g, ".$1").split(".").filter(Boolean);
|
|
1029
1190
|
let n = t;
|
|
@@ -1034,8 +1195,8 @@
|
|
|
1034
1195
|
n = n[t];
|
|
1035
1196
|
}
|
|
1036
1197
|
return !0;
|
|
1037
|
-
}, exports.isObject =
|
|
1038
|
-
const r =
|
|
1198
|
+
}, exports.isObject = h, exports.isPlainObject = p, exports.name = "@composy/store-core", exports.restoreState = function(t, e = {}) {
|
|
1199
|
+
const r = Z(e), n = Q(r.storage);
|
|
1039
1200
|
if (!n) return null;
|
|
1040
1201
|
try {
|
|
1041
1202
|
const e = `${r.keyPrefix}${t}`, o = n.getItem(e);
|
|
@@ -1049,22 +1210,22 @@
|
|
|
1049
1210
|
const n = e.replace(/\[([^\]]+)\]/g, ".$1").split(".").filter(Boolean);
|
|
1050
1211
|
let o = t;
|
|
1051
1212
|
for (let t = 0; t < n.length - 1; t++) {
|
|
1052
|
-
const e = n[t], r = n[t + 1] ?? "", s = o[e] ?? (
|
|
1213
|
+
const e = n[t], r = n[t + 1] ?? "", s = o[e] ?? (S.test(r) ? [] : {});
|
|
1053
1214
|
o[e] = s, o = o[e];
|
|
1054
1215
|
}
|
|
1055
1216
|
return o[n[n.length - 1]] = r, !0;
|
|
1056
1217
|
}, exports.setGlobalBatchManager = function(t) {
|
|
1057
|
-
|
|
1218
|
+
R = t;
|
|
1058
1219
|
}, exports.setGlobalMiddlewareManager = function(t) {
|
|
1059
|
-
|
|
1220
|
+
n = t;
|
|
1060
1221
|
}, exports.setGlobalPluginManager = function(t) {
|
|
1061
|
-
|
|
1222
|
+
c = t;
|
|
1062
1223
|
}, exports.setRestoreCallback = function(t, e) {
|
|
1063
1224
|
const r = t;
|
|
1064
1225
|
"function" != typeof r.__setRestoreCallback ? console.warn("[TimeTravel] 请使用 createTimeTravelMiddleware 返回的 controller") : r.__setRestoreCallback(e);
|
|
1065
1226
|
}, exports.shallowClone = function(t) {
|
|
1066
1227
|
return null == t || "object" != typeof t ? t : Array.isArray(t) ? [...t] : t instanceof Map ? new Map(t) : t instanceof Set ? new Set(t) : t instanceof Date ? new Date(t.getTime()) : { ...t };
|
|
1067
|
-
}, exports.storeEventKeys =
|
|
1228
|
+
}, exports.storeEventKeys = $, exports.storeStateKeys = T, exports.throttle = function(t, e, r = {}) {
|
|
1068
1229
|
const { leading: n = !0, trailing: o = !0 } = r;
|
|
1069
1230
|
let s = null, i = 0, a = null;
|
|
1070
1231
|
const c = (...r) => {
|
|
@@ -1076,7 +1237,7 @@
|
|
|
1076
1237
|
return c.cancel = () => {
|
|
1077
1238
|
s && (clearTimeout(s), s = null), i = 0, a = null;
|
|
1078
1239
|
}, c;
|
|
1079
|
-
}, exports.version = "
|
|
1240
|
+
}, exports.version = "0.0.1";
|
|
1080
1241
|
});
|
|
1081
1242
|
/*! End of @composy/store-core | Powered by @composy/builder */
|
|
1082
1243
|
//# sourceMappingURL=index.min.js.map
|