fox-mini-x 1.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 +202 -0
- package/dist/index.cjs +517 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.d.cts +122 -0
- package/dist/index.d.d.ts +122 -0
- package/dist/index.js +485 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.js
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
createLogger: () => createLogger,
|
|
23
|
+
createNamespacedHelpers: () => createNamespacedHelpers,
|
|
24
|
+
createStore: () => createStore,
|
|
25
|
+
mapActions: () => mapActions,
|
|
26
|
+
mapGetters: () => mapGetters,
|
|
27
|
+
mapMutations: () => mapMutations,
|
|
28
|
+
mapState: () => mapState
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
|
|
32
|
+
// src/utils.js
|
|
33
|
+
function isObject(value) {
|
|
34
|
+
return value !== null && typeof value === "object";
|
|
35
|
+
}
|
|
36
|
+
function isPromise(value) {
|
|
37
|
+
return value && typeof value.then === "function";
|
|
38
|
+
}
|
|
39
|
+
function assert(condition, message) {
|
|
40
|
+
if (!condition) {
|
|
41
|
+
throw new Error(`[mini-x] ${message}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function forEachValue(target, handler) {
|
|
45
|
+
Object.keys(target || {}).forEach((key) => handler(target[key], key));
|
|
46
|
+
}
|
|
47
|
+
function getNestedState(rootState, path) {
|
|
48
|
+
return path.reduce((state, key) => state[key], rootState);
|
|
49
|
+
}
|
|
50
|
+
function unifyObjectStyle(type, payload, options) {
|
|
51
|
+
if (isObject(type) && type.type) {
|
|
52
|
+
const payloadObject = { ...type };
|
|
53
|
+
delete payloadObject.type;
|
|
54
|
+
return {
|
|
55
|
+
type: type.type,
|
|
56
|
+
payload: payloadObject,
|
|
57
|
+
options: payload
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return { type, payload, options };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/modules.js
|
|
64
|
+
function createModuleCollection(rawRootModule) {
|
|
65
|
+
const root = createModule(rawRootModule);
|
|
66
|
+
installChildren(root, rawRootModule);
|
|
67
|
+
return root;
|
|
68
|
+
}
|
|
69
|
+
function getNamespaceFromPath(rootModule, path) {
|
|
70
|
+
let module2 = rootModule;
|
|
71
|
+
return path.reduce((namespace, key) => {
|
|
72
|
+
module2 = module2.children[key];
|
|
73
|
+
return namespace + (module2.namespaced ? `${key}/` : "");
|
|
74
|
+
}, "");
|
|
75
|
+
}
|
|
76
|
+
function getRawModuleByPath(rootModule, path) {
|
|
77
|
+
return path.reduce((module2, key) => module2.children[key], rootModule);
|
|
78
|
+
}
|
|
79
|
+
function registerRuntimeModule(rootModule, path, rawModule) {
|
|
80
|
+
const parentPath = path.slice(0, -1);
|
|
81
|
+
const moduleName = path[path.length - 1];
|
|
82
|
+
const parent = getRawModuleByPath(rootModule, parentPath);
|
|
83
|
+
parent.children[moduleName] = createModule(rawModule);
|
|
84
|
+
installChildren(parent.children[moduleName], rawModule);
|
|
85
|
+
}
|
|
86
|
+
function unregisterRuntimeModule(rootModule, path) {
|
|
87
|
+
const parentPath = path.slice(0, -1);
|
|
88
|
+
const moduleName = path[path.length - 1];
|
|
89
|
+
const parent = getRawModuleByPath(rootModule, parentPath);
|
|
90
|
+
const module2 = parent.children[moduleName];
|
|
91
|
+
if (!module2 || !module2.runtime) return;
|
|
92
|
+
delete parent.children[moduleName];
|
|
93
|
+
}
|
|
94
|
+
function updateModuleTree(targetModule, newModule) {
|
|
95
|
+
targetModule.namespaced = !!newModule.namespaced;
|
|
96
|
+
targetModule.raw = newModule;
|
|
97
|
+
if (newModule.modules) {
|
|
98
|
+
forEachValue(newModule.modules, (child, key) => {
|
|
99
|
+
if (!targetModule.children[key]) return;
|
|
100
|
+
updateModuleTree(targetModule.children[key], child);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function createModule(rawModule, runtime = false) {
|
|
105
|
+
return {
|
|
106
|
+
runtime,
|
|
107
|
+
raw: rawModule,
|
|
108
|
+
namespaced: !!rawModule.namespaced,
|
|
109
|
+
state: typeof rawModule.state === "function" ? rawModule.state() : rawModule.state || {},
|
|
110
|
+
children: {}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function installChildren(module2, rawModule) {
|
|
114
|
+
forEachValue(rawModule.modules, (childRawModule, key) => {
|
|
115
|
+
module2.children[key] = createModule(childRawModule, true);
|
|
116
|
+
installChildren(module2.children[key], childRawModule);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function normalizeModulePath(path) {
|
|
120
|
+
if (typeof path === "string") return [path];
|
|
121
|
+
assert(Array.isArray(path), "module path \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u6216\u6570\u7EC4");
|
|
122
|
+
return path;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/install.js
|
|
126
|
+
function installModule(store, rootState, path, moduleNode) {
|
|
127
|
+
const isRoot = path.length === 0;
|
|
128
|
+
const namespace = getNamespaceFromPath(store._modules, path);
|
|
129
|
+
if (!isRoot) {
|
|
130
|
+
const parentState = getNestedState(rootState, path.slice(0, -1));
|
|
131
|
+
const moduleName = path[path.length - 1];
|
|
132
|
+
store._withCommit(() => {
|
|
133
|
+
parentState[moduleName] = moduleNode.state;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (moduleNode.namespaced) {
|
|
137
|
+
store._modulesNamespaceMap[namespace] = moduleNode;
|
|
138
|
+
}
|
|
139
|
+
const local = makeLocalContext(store, namespace, path);
|
|
140
|
+
registerModuleMutations(store, namespace, moduleNode, local);
|
|
141
|
+
registerModuleActions(store, namespace, moduleNode, local);
|
|
142
|
+
registerModuleGetters(store, namespace, moduleNode, local);
|
|
143
|
+
forEachValue(moduleNode.children, (child, key) => {
|
|
144
|
+
installModule(store, rootState, path.concat(key), child);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function registerModuleMutations(store, namespace, moduleNode, local) {
|
|
148
|
+
forEachValue(moduleNode.raw.mutations, (mutationHandler, key) => {
|
|
149
|
+
const type = namespace + key;
|
|
150
|
+
registerMutation(store, type, (payload) => {
|
|
151
|
+
mutationHandler.call(store, local.state, payload);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function registerModuleActions(store, namespace, moduleNode, local) {
|
|
156
|
+
forEachValue(moduleNode.raw.actions, (actionHandler, key) => {
|
|
157
|
+
const hasRootConfig = typeof actionHandler === "object" && actionHandler.root;
|
|
158
|
+
const type = hasRootConfig ? key : namespace + key;
|
|
159
|
+
const handler = hasRootConfig ? actionHandler.handler : actionHandler;
|
|
160
|
+
registerAction(store, type, (payload) => {
|
|
161
|
+
const result = handler.call(store, local, payload);
|
|
162
|
+
return result;
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function registerModuleGetters(store, namespace, moduleNode, local) {
|
|
167
|
+
forEachValue(moduleNode.raw.getters, (getterHandler, key) => {
|
|
168
|
+
const type = namespace + key;
|
|
169
|
+
if (store._wrappedGetters[type]) {
|
|
170
|
+
throw new Error(`[mini-x] getter \u91CD\u590D\u5B9A\u4E49: ${type}`);
|
|
171
|
+
}
|
|
172
|
+
store._wrappedGetters[type] = () => getterHandler(
|
|
173
|
+
local.state,
|
|
174
|
+
local.getters,
|
|
175
|
+
store.state,
|
|
176
|
+
store.getters
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function registerMutation(store, type, handler) {
|
|
181
|
+
const list = store._mutations[type] || (store._mutations[type] = []);
|
|
182
|
+
list.push(handler);
|
|
183
|
+
}
|
|
184
|
+
function registerAction(store, type, handler) {
|
|
185
|
+
const list = store._actions[type] || (store._actions[type] = []);
|
|
186
|
+
list.push(handler);
|
|
187
|
+
}
|
|
188
|
+
function makeLocalContext(store, namespace, path) {
|
|
189
|
+
const noNamespace = namespace === "";
|
|
190
|
+
const local = {
|
|
191
|
+
dispatch: noNamespace ? store.dispatch : (type, payload, options) => {
|
|
192
|
+
const finalType = options && options.root ? type : namespace + type;
|
|
193
|
+
return store.dispatch(finalType, payload);
|
|
194
|
+
},
|
|
195
|
+
commit: noNamespace ? store.commit : (type, payload, options) => {
|
|
196
|
+
const finalType = options && options.root ? type : namespace + type;
|
|
197
|
+
store.commit(finalType, payload);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
Object.defineProperties(local, {
|
|
201
|
+
getters: {
|
|
202
|
+
get: noNamespace ? () => store.getters : () => makeLocalGettersProxy(store, namespace)
|
|
203
|
+
},
|
|
204
|
+
state: {
|
|
205
|
+
get: () => getNestedState(store.state, path)
|
|
206
|
+
},
|
|
207
|
+
rootState: {
|
|
208
|
+
get: () => store.state
|
|
209
|
+
},
|
|
210
|
+
rootGetters: {
|
|
211
|
+
get: () => store.getters
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return local;
|
|
215
|
+
}
|
|
216
|
+
function makeLocalGettersProxy(store, namespace) {
|
|
217
|
+
const result = {};
|
|
218
|
+
Object.keys(store.getters).forEach((type) => {
|
|
219
|
+
if (!type.startsWith(namespace)) return;
|
|
220
|
+
const localType = type.slice(namespace.length);
|
|
221
|
+
Object.defineProperty(result, localType, {
|
|
222
|
+
get: () => store.getters[type],
|
|
223
|
+
enumerable: true
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
function resetStoreVM(store) {
|
|
229
|
+
store.getters = {};
|
|
230
|
+
Object.keys(store._wrappedGetters).forEach((type) => {
|
|
231
|
+
Object.defineProperty(store.getters, type, {
|
|
232
|
+
get: () => store._wrappedGetters[type](),
|
|
233
|
+
enumerable: true
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function assertHandlerExists(map, type, kind) {
|
|
238
|
+
assert(map[type], `\u672A\u77E5 ${kind}: ${type}`);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/state.js
|
|
242
|
+
function createStrictState(rootState, store) {
|
|
243
|
+
const proxyCache = /* @__PURE__ */ new WeakMap();
|
|
244
|
+
return deepProxy(rootState, store, proxyCache);
|
|
245
|
+
}
|
|
246
|
+
function replaceStoreState(store, newState) {
|
|
247
|
+
store._withCommit(() => {
|
|
248
|
+
store._state = createStrictState(newState, store);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function deepProxy(target, store, proxyCache) {
|
|
252
|
+
if (!isObject(target)) return target;
|
|
253
|
+
if (proxyCache.has(target)) return proxyCache.get(target);
|
|
254
|
+
const proxy = new Proxy(target, {
|
|
255
|
+
get(obj, key, receiver) {
|
|
256
|
+
const value = Reflect.get(obj, key, receiver);
|
|
257
|
+
return deepProxy(value, store, proxyCache);
|
|
258
|
+
},
|
|
259
|
+
set(obj, key, value, receiver) {
|
|
260
|
+
if (store.strict && !store._committing) {
|
|
261
|
+
throw new Error(
|
|
262
|
+
`[mini-x] \u4E25\u683C\u6A21\u5F0F\u4E0B\u4E0D\u80FD\u5728 mutation \u4E4B\u5916\u4FEE\u6539\u72B6\u6001: ${String(key)}`
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
const nextValue = deepProxy(value, store, proxyCache);
|
|
266
|
+
return Reflect.set(obj, key, nextValue, receiver);
|
|
267
|
+
},
|
|
268
|
+
deleteProperty(obj, key) {
|
|
269
|
+
if (store.strict && !store._committing) {
|
|
270
|
+
throw new Error(
|
|
271
|
+
`[mini-x] \u4E25\u683C\u6A21\u5F0F\u4E0B\u4E0D\u80FD\u5728 mutation \u4E4B\u5916\u5220\u9664\u72B6\u6001: ${String(key)}`
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
return Reflect.deleteProperty(obj, key);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
proxyCache.set(target, proxy);
|
|
278
|
+
return proxy;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/createStore.js
|
|
282
|
+
function createStore(options = {}) {
|
|
283
|
+
const store = {
|
|
284
|
+
strict: !!options.strict,
|
|
285
|
+
_committing: false,
|
|
286
|
+
_actions: /* @__PURE__ */ Object.create(null),
|
|
287
|
+
_mutations: /* @__PURE__ */ Object.create(null),
|
|
288
|
+
_wrappedGetters: /* @__PURE__ */ Object.create(null),
|
|
289
|
+
_modulesNamespaceMap: /* @__PURE__ */ Object.create(null),
|
|
290
|
+
_subscribers: [],
|
|
291
|
+
_actionSubscribers: [],
|
|
292
|
+
_modules: createModuleCollection(options),
|
|
293
|
+
getters: {}
|
|
294
|
+
};
|
|
295
|
+
bindStoreMethods(store);
|
|
296
|
+
const rootState = store._modules.state;
|
|
297
|
+
installModule(store, rootState, [], store._modules);
|
|
298
|
+
store._state = createStrictState(rootState, store);
|
|
299
|
+
resetStoreVM(store);
|
|
300
|
+
applyPlugins(store, options.plugins);
|
|
301
|
+
return store;
|
|
302
|
+
}
|
|
303
|
+
function bindStoreMethods(store) {
|
|
304
|
+
const commit = storeCommit.bind(null, store);
|
|
305
|
+
const dispatch = storeDispatch.bind(null, store);
|
|
306
|
+
store.commit = commit;
|
|
307
|
+
store.dispatch = dispatch;
|
|
308
|
+
store._withCommit = (fn) => {
|
|
309
|
+
const prev = store._committing;
|
|
310
|
+
store._committing = true;
|
|
311
|
+
fn();
|
|
312
|
+
store._committing = prev;
|
|
313
|
+
};
|
|
314
|
+
Object.defineProperty(store, "state", {
|
|
315
|
+
get: () => store._state,
|
|
316
|
+
set: () => {
|
|
317
|
+
throw new Error("[mini-x] \u8BF7\u4F7F\u7528 replaceState() \u66FF\u6362\u6839\u72B6\u6001");
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
store.subscribe = (subscriber) => genericSubscribe(subscriber, store._subscribers);
|
|
321
|
+
store.subscribeAction = (subscriber) => {
|
|
322
|
+
const normalized = normalizeActionSubscriber(subscriber);
|
|
323
|
+
return genericSubscribe(normalized, store._actionSubscribers);
|
|
324
|
+
};
|
|
325
|
+
store.replaceState = (newState) => replaceStoreState(store, newState);
|
|
326
|
+
store.registerModule = (path, module2, options = {}) => registerModule(store, path, module2, options);
|
|
327
|
+
store.unregisterModule = (path) => unregisterModule(store, path);
|
|
328
|
+
store.hasModule = (path) => hasModule(store, path);
|
|
329
|
+
store.hotUpdate = (newOptions) => hotUpdate(store, newOptions);
|
|
330
|
+
}
|
|
331
|
+
function storeCommit(store, type, payload, options) {
|
|
332
|
+
const normalized = unifyObjectStyle(type, payload, options);
|
|
333
|
+
const entry = store._mutations[normalized.type];
|
|
334
|
+
assertHandlerExists(store._mutations, normalized.type, "mutation");
|
|
335
|
+
store._withCommit(() => {
|
|
336
|
+
entry.forEach((handler) => handler(normalized.payload));
|
|
337
|
+
});
|
|
338
|
+
store._subscribers.slice().forEach(
|
|
339
|
+
(subscriber) => subscriber(
|
|
340
|
+
{ type: normalized.type, payload: normalized.payload },
|
|
341
|
+
store.state
|
|
342
|
+
)
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
function storeDispatch(store, type, payload) {
|
|
346
|
+
const normalized = unifyObjectStyle(type, payload);
|
|
347
|
+
assertHandlerExists(store._actions, normalized.type, "action");
|
|
348
|
+
const entry = store._actions[normalized.type];
|
|
349
|
+
const action = { type: normalized.type, payload: normalized.payload };
|
|
350
|
+
const beforeSubscribers = store._actionSubscribers.slice().map((subscriber) => subscriber.before).filter(Boolean);
|
|
351
|
+
const afterSubscribers = store._actionSubscribers.slice().map((subscriber) => subscriber.after).filter(Boolean);
|
|
352
|
+
const errorSubscribers = store._actionSubscribers.slice().map((subscriber) => subscriber.error).filter(Boolean);
|
|
353
|
+
beforeSubscribers.forEach((handler) => handler(action, store.state));
|
|
354
|
+
const result = entry.length > 1 ? Promise.all(entry.map((handler) => handler(normalized.payload))) : entry[0](normalized.payload);
|
|
355
|
+
const finalPromise = isPromise(result) ? result : Promise.resolve(result);
|
|
356
|
+
return finalPromise.then((response) => {
|
|
357
|
+
afterSubscribers.forEach((handler) => handler(action, store.state));
|
|
358
|
+
return response;
|
|
359
|
+
}).catch((error) => {
|
|
360
|
+
errorSubscribers.forEach((handler) => handler(action, store.state, error));
|
|
361
|
+
throw error;
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
function genericSubscribe(subscriber, targetList) {
|
|
365
|
+
if (targetList.includes(subscriber)) return () => void 0;
|
|
366
|
+
targetList.push(subscriber);
|
|
367
|
+
return () => {
|
|
368
|
+
const index = targetList.indexOf(subscriber);
|
|
369
|
+
if (index > -1) targetList.splice(index, 1);
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function applyPlugins(store, plugins = []) {
|
|
373
|
+
plugins.forEach((plugin) => plugin(store));
|
|
374
|
+
}
|
|
375
|
+
function registerModule(store, path, rawModule, options) {
|
|
376
|
+
const normalizedPath = normalizeModulePath(path);
|
|
377
|
+
assert(normalizedPath.length > 0, "\u6839\u6A21\u5757\u4E0D\u80FD\u901A\u8FC7 registerModule \u6CE8\u518C");
|
|
378
|
+
registerRuntimeModule(store._modules, normalizedPath, rawModule);
|
|
379
|
+
if (!options.preserveState) {
|
|
380
|
+
const parentState = getNestedState(store.state, normalizedPath.slice(0, -1));
|
|
381
|
+
store._withCommit(() => {
|
|
382
|
+
parentState[normalizedPath[normalizedPath.length - 1]] = typeof rawModule.state === "function" ? rawModule.state() : rawModule.state || {};
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
resetStore(store);
|
|
386
|
+
}
|
|
387
|
+
function unregisterModule(store, path) {
|
|
388
|
+
const normalizedPath = normalizeModulePath(path);
|
|
389
|
+
assert(normalizedPath.length > 0, "\u6839\u6A21\u5757\u4E0D\u80FD\u88AB\u5378\u8F7D");
|
|
390
|
+
const parentState = getNestedState(store.state, normalizedPath.slice(0, -1));
|
|
391
|
+
const moduleName = normalizedPath[normalizedPath.length - 1];
|
|
392
|
+
store._withCommit(() => {
|
|
393
|
+
delete parentState[moduleName];
|
|
394
|
+
});
|
|
395
|
+
unregisterRuntimeModule(store._modules, normalizedPath);
|
|
396
|
+
resetStore(store);
|
|
397
|
+
}
|
|
398
|
+
function hasModule(store, path) {
|
|
399
|
+
const normalizedPath = normalizeModulePath(path);
|
|
400
|
+
try {
|
|
401
|
+
return !!getRawModuleByPath(store._modules, normalizedPath);
|
|
402
|
+
} catch (_error) {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function hotUpdate(store, newOptions) {
|
|
407
|
+
updateModuleTree(store._modules, newOptions);
|
|
408
|
+
resetStore(store);
|
|
409
|
+
}
|
|
410
|
+
function resetStore(store) {
|
|
411
|
+
store._actions = /* @__PURE__ */ Object.create(null);
|
|
412
|
+
store._mutations = /* @__PURE__ */ Object.create(null);
|
|
413
|
+
store._wrappedGetters = /* @__PURE__ */ Object.create(null);
|
|
414
|
+
store._modulesNamespaceMap = /* @__PURE__ */ Object.create(null);
|
|
415
|
+
installModule(store, store.state, [], store._modules);
|
|
416
|
+
resetStoreVM(store);
|
|
417
|
+
}
|
|
418
|
+
function createLogger(options = {}) {
|
|
419
|
+
const logger = options.logger || console;
|
|
420
|
+
const logMutations = options.logMutations !== false;
|
|
421
|
+
const logActions = options.logActions !== false;
|
|
422
|
+
return (store) => {
|
|
423
|
+
if (logMutations) {
|
|
424
|
+
store.subscribe((mutation, state) => {
|
|
425
|
+
logger.log("[mini-x][mutation]", mutation.type, mutation.payload, state);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
if (logActions) {
|
|
429
|
+
store.subscribeAction({
|
|
430
|
+
before: (action, state) => {
|
|
431
|
+
logger.log("[mini-x][action][before]", action.type, action.payload, state);
|
|
432
|
+
},
|
|
433
|
+
after: (action, state) => {
|
|
434
|
+
logger.log("[mini-x][action][after]", action.type, action.payload, state);
|
|
435
|
+
},
|
|
436
|
+
error: (action, _state, error) => {
|
|
437
|
+
logger.error("[mini-x][action][error]", action.type, error);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function mapState(namespace, mappings) {
|
|
444
|
+
return normalizeMap("state", namespace, mappings, (store, key, value, ns) => {
|
|
445
|
+
const state = ns ? getNestedState(store.state, ns.split("/").filter(Boolean)) : store.state;
|
|
446
|
+
return typeof value === "function" ? value(state) : state[value];
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function mapGetters(namespace, mappings) {
|
|
450
|
+
return normalizeMap("getter", namespace, mappings, (store, _key, value, ns) => {
|
|
451
|
+
const type = ns ? ns + value : value;
|
|
452
|
+
return store.getters[type];
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
function mapMutations(namespace, mappings) {
|
|
456
|
+
return normalizeMap("mutation", namespace, mappings, (store, _key, value, ns, args) => {
|
|
457
|
+
const type = ns ? ns + value : value;
|
|
458
|
+
return store.commit(type, ...args);
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
function mapActions(namespace, mappings) {
|
|
462
|
+
return normalizeMap("action", namespace, mappings, (store, _key, value, ns, args) => {
|
|
463
|
+
const type = ns ? ns + value : value;
|
|
464
|
+
return store.dispatch(type, ...args);
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
function createNamespacedHelpers(namespace) {
|
|
468
|
+
const normalizedNamespace = normalizeNamespace(namespace);
|
|
469
|
+
return {
|
|
470
|
+
mapState: (mappings) => mapState(normalizedNamespace, mappings),
|
|
471
|
+
mapGetters: (mappings) => mapGetters(normalizedNamespace, mappings),
|
|
472
|
+
mapMutations: (mappings) => mapMutations(normalizedNamespace, mappings),
|
|
473
|
+
mapActions: (mappings) => mapActions(normalizedNamespace, mappings)
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function normalizeMap(kind, namespace, mappings, resolver) {
|
|
477
|
+
const normalizedNamespace = typeof namespace === "string" ? normalizeNamespace(namespace) : "";
|
|
478
|
+
const rawMappings = typeof namespace === "string" ? mappings : namespace;
|
|
479
|
+
const result = {};
|
|
480
|
+
if (Array.isArray(rawMappings)) {
|
|
481
|
+
rawMappings.forEach((key) => {
|
|
482
|
+
result[key] = function mappedHandler(...args) {
|
|
483
|
+
const store = this.$store || this.store;
|
|
484
|
+
return resolver(store, key, key, normalizedNamespace, args);
|
|
485
|
+
};
|
|
486
|
+
});
|
|
487
|
+
} else {
|
|
488
|
+
forEachValue(rawMappings, (value, key) => {
|
|
489
|
+
result[key] = function mappedHandler(...args) {
|
|
490
|
+
const store = this.$store || this.store;
|
|
491
|
+
return resolver(store, key, value, normalizedNamespace, args);
|
|
492
|
+
};
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
return result;
|
|
496
|
+
}
|
|
497
|
+
function normalizeNamespace(namespace = "") {
|
|
498
|
+
if (!namespace) return "";
|
|
499
|
+
return namespace.endsWith("/") ? namespace : `${namespace}/`;
|
|
500
|
+
}
|
|
501
|
+
function normalizeActionSubscriber(subscriber) {
|
|
502
|
+
if (typeof subscriber === "function") {
|
|
503
|
+
return { before: subscriber };
|
|
504
|
+
}
|
|
505
|
+
return subscriber || {};
|
|
506
|
+
}
|
|
507
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
508
|
+
0 && (module.exports = {
|
|
509
|
+
createLogger,
|
|
510
|
+
createNamespacedHelpers,
|
|
511
|
+
createStore,
|
|
512
|
+
mapActions,
|
|
513
|
+
mapGetters,
|
|
514
|
+
mapMutations,
|
|
515
|
+
mapState
|
|
516
|
+
});
|
|
517
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.js","../src/utils.js","../src/modules.js","../src/install.js","../src/state.js","../src/createStore.js"],"sourcesContent":["export {\r\n createStore,\r\n createLogger,\r\n mapState,\r\n mapGetters,\r\n mapMutations,\r\n mapActions,\r\n createNamespacedHelpers,\r\n} from \"./createStore.js\";\r\n","export function isObject(value) {\r\n return value !== null && typeof value === \"object\";\r\n}\r\n\r\nexport function isPromise(value) {\r\n return value && typeof value.then === \"function\";\r\n}\r\n\r\nexport function assert(condition, message) {\r\n if (!condition) {\r\n throw new Error(`[mini-x] ${message}`);\r\n }\r\n}\r\n\r\nexport function forEachValue(target, handler) {\r\n Object.keys(target || {}).forEach((key) => handler(target[key], key));\r\n}\r\n\r\nexport function getNestedState(rootState, path) {\r\n return path.reduce((state, key) => state[key], rootState);\r\n}\r\n\r\nexport function unifyObjectStyle(type, payload, options) {\r\n if (isObject(type) && type.type) {\r\n const payloadObject = { ...type };\r\n delete payloadObject.type;\r\n return {\r\n type: type.type,\r\n payload: payloadObject,\r\n options: payload,\r\n };\r\n }\r\n return { type, payload, options };\r\n}\r\n","import { assert, forEachValue } from \"./utils.js\";\r\n\r\nexport function createModuleCollection(rawRootModule) {\r\n const root = createModule(rawRootModule);\r\n installChildren(root, rawRootModule);\r\n return root;\r\n}\r\n\r\nexport function getNamespaceFromPath(rootModule, path) {\r\n let module = rootModule;\r\n return path.reduce((namespace, key) => {\r\n module = module.children[key];\r\n return namespace + (module.namespaced ? `${key}/` : \"\");\r\n }, \"\");\r\n}\r\n\r\nexport function getRawModuleByPath(rootModule, path) {\r\n return path.reduce((module, key) => module.children[key], rootModule);\r\n}\r\n\r\nexport function registerRuntimeModule(rootModule, path, rawModule) {\r\n const parentPath = path.slice(0, -1);\r\n const moduleName = path[path.length - 1];\r\n const parent = getRawModuleByPath(rootModule, parentPath);\r\n parent.children[moduleName] = createModule(rawModule);\r\n installChildren(parent.children[moduleName], rawModule);\r\n}\r\n\r\nexport function unregisterRuntimeModule(rootModule, path) {\r\n const parentPath = path.slice(0, -1);\r\n const moduleName = path[path.length - 1];\r\n const parent = getRawModuleByPath(rootModule, parentPath);\r\n const module = parent.children[moduleName];\r\n if (!module || !module.runtime) return;\r\n delete parent.children[moduleName];\r\n}\r\n\r\nexport function updateModuleTree(targetModule, newModule) {\r\n targetModule.namespaced = !!newModule.namespaced;\r\n targetModule.raw = newModule;\r\n if (newModule.modules) {\r\n forEachValue(newModule.modules, (child, key) => {\r\n if (!targetModule.children[key]) return;\r\n updateModuleTree(targetModule.children[key], child);\r\n });\r\n }\r\n}\r\n\r\nfunction createModule(rawModule, runtime = false) {\r\n return {\r\n runtime,\r\n raw: rawModule,\r\n namespaced: !!rawModule.namespaced,\r\n state: typeof rawModule.state === \"function\" ? rawModule.state() : rawModule.state || {},\r\n children: {},\r\n };\r\n}\r\n\r\nfunction installChildren(module, rawModule) {\r\n forEachValue(rawModule.modules, (childRawModule, key) => {\r\n module.children[key] = createModule(childRawModule, true);\r\n installChildren(module.children[key], childRawModule);\r\n });\r\n}\r\n\r\nexport function normalizeModulePath(path) {\r\n if (typeof path === \"string\") return [path];\r\n assert(Array.isArray(path), \"module path 必须是字符串或数组\");\r\n return path;\r\n}\r\n","import { forEachValue, getNestedState, assert } from \"./utils.js\";\r\nimport { getNamespaceFromPath } from \"./modules.js\";\r\n\r\nexport function installModule(store, rootState, path, moduleNode) {\r\n const isRoot = path.length === 0;\r\n const namespace = getNamespaceFromPath(store._modules, path);\r\n\r\n if (!isRoot) {\r\n const parentState = getNestedState(rootState, path.slice(0, -1));\r\n const moduleName = path[path.length - 1];\r\n store._withCommit(() => {\r\n parentState[moduleName] = moduleNode.state;\r\n });\r\n }\r\n\r\n if (moduleNode.namespaced) {\r\n store._modulesNamespaceMap[namespace] = moduleNode;\r\n }\r\n\r\n const local = makeLocalContext(store, namespace, path);\r\n\r\n registerModuleMutations(store, namespace, moduleNode, local);\r\n registerModuleActions(store, namespace, moduleNode, local);\r\n registerModuleGetters(store, namespace, moduleNode, local);\r\n\r\n forEachValue(moduleNode.children, (child, key) => {\r\n installModule(store, rootState, path.concat(key), child);\r\n });\r\n}\r\n\r\nfunction registerModuleMutations(store, namespace, moduleNode, local) {\r\n forEachValue(moduleNode.raw.mutations, (mutationHandler, key) => {\r\n const type = namespace + key;\r\n registerMutation(store, type, (payload) => {\r\n mutationHandler.call(store, local.state, payload);\r\n });\r\n });\r\n}\r\n\r\nfunction registerModuleActions(store, namespace, moduleNode, local) {\r\n forEachValue(moduleNode.raw.actions, (actionHandler, key) => {\r\n const hasRootConfig = typeof actionHandler === \"object\" && actionHandler.root;\r\n const type = hasRootConfig ? key : namespace + key;\r\n const handler = hasRootConfig ? actionHandler.handler : actionHandler;\r\n\r\n registerAction(store, type, (payload) => {\r\n const result = handler.call(store, local, payload);\r\n return result;\r\n });\r\n });\r\n}\r\n\r\nfunction registerModuleGetters(store, namespace, moduleNode, local) {\r\n forEachValue(moduleNode.raw.getters, (getterHandler, key) => {\r\n const type = namespace + key;\r\n if (store._wrappedGetters[type]) {\r\n throw new Error(`[mini-x] getter 重复定义: ${type}`);\r\n }\r\n store._wrappedGetters[type] = () =>\r\n getterHandler(\r\n local.state,\r\n local.getters,\r\n store.state,\r\n store.getters\r\n );\r\n });\r\n}\r\n\r\nfunction registerMutation(store, type, handler) {\r\n const list = store._mutations[type] || (store._mutations[type] = []);\r\n list.push(handler);\r\n}\r\n\r\nfunction registerAction(store, type, handler) {\r\n const list = store._actions[type] || (store._actions[type] = []);\r\n list.push(handler);\r\n}\r\n\r\nfunction makeLocalContext(store, namespace, path) {\r\n const noNamespace = namespace === \"\";\r\n\r\n const local = {\r\n dispatch: noNamespace\r\n ? store.dispatch\r\n : (type, payload, options) => {\r\n const finalType = options && options.root ? type : namespace + type;\r\n return store.dispatch(finalType, payload);\r\n },\r\n commit: noNamespace\r\n ? store.commit\r\n : (type, payload, options) => {\r\n const finalType = options && options.root ? type : namespace + type;\r\n store.commit(finalType, payload);\r\n },\r\n };\r\n\r\n Object.defineProperties(local, {\r\n getters: {\r\n get: noNamespace\r\n ? () => store.getters\r\n : () => makeLocalGettersProxy(store, namespace),\r\n },\r\n state: {\r\n get: () => getNestedState(store.state, path),\r\n },\r\n rootState: {\r\n get: () => store.state,\r\n },\r\n rootGetters: {\r\n get: () => store.getters,\r\n },\r\n });\r\n\r\n return local;\r\n}\r\n\r\nfunction makeLocalGettersProxy(store, namespace) {\r\n const result = {};\r\n Object.keys(store.getters).forEach((type) => {\r\n if (!type.startsWith(namespace)) return;\r\n const localType = type.slice(namespace.length);\r\n Object.defineProperty(result, localType, {\r\n get: () => store.getters[type],\r\n enumerable: true,\r\n });\r\n });\r\n return result;\r\n}\r\n\r\nexport function resetStoreVM(store) {\r\n store.getters = {};\r\n Object.keys(store._wrappedGetters).forEach((type) => {\r\n Object.defineProperty(store.getters, type, {\r\n get: () => store._wrappedGetters[type](),\r\n enumerable: true,\r\n });\r\n });\r\n}\r\n\r\nexport function assertHandlerExists(map, type, kind) {\r\n assert(map[type], `未知 ${kind}: ${type}`);\r\n}\r\n","import { isObject } from \"./utils.js\";\r\n\r\nexport function createStrictState(rootState, store) {\r\n const proxyCache = new WeakMap();\r\n return deepProxy(rootState, store, proxyCache);\r\n}\r\n\r\nexport function replaceStoreState(store, newState) {\r\n store._withCommit(() => {\r\n store._state = createStrictState(newState, store);\r\n });\r\n}\r\n\r\nfunction deepProxy(target, store, proxyCache) {\r\n if (!isObject(target)) return target;\r\n if (proxyCache.has(target)) return proxyCache.get(target);\r\n\r\n const proxy = new Proxy(target, {\r\n get(obj, key, receiver) {\r\n const value = Reflect.get(obj, key, receiver);\r\n return deepProxy(value, store, proxyCache);\r\n },\r\n set(obj, key, value, receiver) {\r\n if (store.strict && !store._committing) {\r\n throw new Error(\r\n `[mini-x] 严格模式下不能在 mutation 之外修改状态: ${String(key)}`\r\n );\r\n }\r\n const nextValue = deepProxy(value, store, proxyCache);\r\n return Reflect.set(obj, key, nextValue, receiver);\r\n },\r\n deleteProperty(obj, key) {\r\n if (store.strict && !store._committing) {\r\n throw new Error(\r\n `[mini-x] 严格模式下不能在 mutation 之外删除状态: ${String(key)}`\r\n );\r\n }\r\n return Reflect.deleteProperty(obj, key);\r\n },\r\n });\r\n\r\n proxyCache.set(target, proxy);\r\n return proxy;\r\n}\r\n","import {\r\n assert,\r\n forEachValue,\r\n getNestedState,\r\n isPromise,\r\n unifyObjectStyle,\r\n} from \"./utils.js\";\r\nimport {\r\n createModuleCollection,\r\n normalizeModulePath,\r\n registerRuntimeModule,\r\n unregisterRuntimeModule,\r\n getRawModuleByPath,\r\n updateModuleTree,\r\n} from \"./modules.js\";\r\nimport { installModule, resetStoreVM, assertHandlerExists } from \"./install.js\";\r\nimport { createStrictState, replaceStoreState } from \"./state.js\";\r\n\r\nexport function createStore(options = {}) {\r\n const store = {\r\n strict: !!options.strict,\r\n _committing: false,\r\n _actions: Object.create(null),\r\n _mutations: Object.create(null),\r\n _wrappedGetters: Object.create(null),\r\n _modulesNamespaceMap: Object.create(null),\r\n _subscribers: [],\r\n _actionSubscribers: [],\r\n _modules: createModuleCollection(options),\r\n getters: {},\r\n };\r\n\r\n bindStoreMethods(store);\r\n const rootState = store._modules.state;\r\n installModule(store, rootState, [], store._modules);\r\n store._state = createStrictState(rootState, store);\r\n resetStoreVM(store);\r\n applyPlugins(store, options.plugins);\r\n\r\n return store;\r\n}\r\n\r\nfunction bindStoreMethods(store) {\r\n const commit = storeCommit.bind(null, store);\r\n const dispatch = storeDispatch.bind(null, store);\r\n\r\n store.commit = commit;\r\n store.dispatch = dispatch;\r\n store._withCommit = (fn) => {\r\n const prev = store._committing;\r\n store._committing = true;\r\n fn();\r\n store._committing = prev;\r\n };\r\n\r\n Object.defineProperty(store, \"state\", {\r\n get: () => store._state,\r\n set: () => {\r\n throw new Error(\"[mini-x] 请使用 replaceState() 替换根状态\");\r\n },\r\n });\r\n\r\n store.subscribe = (subscriber) => genericSubscribe(subscriber, store._subscribers);\r\n store.subscribeAction = (subscriber) => {\r\n const normalized = normalizeActionSubscriber(subscriber);\r\n return genericSubscribe(normalized, store._actionSubscribers);\r\n };\r\n store.replaceState = (newState) => replaceStoreState(store, newState);\r\n store.registerModule = (path, module, options = {}) =>\r\n registerModule(store, path, module, options);\r\n store.unregisterModule = (path) => unregisterModule(store, path);\r\n store.hasModule = (path) => hasModule(store, path);\r\n store.hotUpdate = (newOptions) => hotUpdate(store, newOptions);\r\n}\r\n\r\nfunction storeCommit(store, type, payload, options) {\r\n const normalized = unifyObjectStyle(type, payload, options);\r\n const entry = store._mutations[normalized.type];\r\n assertHandlerExists(store._mutations, normalized.type, \"mutation\");\r\n\r\n store._withCommit(() => {\r\n entry.forEach((handler) => handler(normalized.payload));\r\n });\r\n\r\n store._subscribers.slice().forEach((subscriber) =>\r\n subscriber(\r\n { type: normalized.type, payload: normalized.payload },\r\n store.state\r\n )\r\n );\r\n}\r\n\r\nfunction storeDispatch(store, type, payload) {\r\n const normalized = unifyObjectStyle(type, payload);\r\n assertHandlerExists(store._actions, normalized.type, \"action\");\r\n const entry = store._actions[normalized.type];\r\n const action = { type: normalized.type, payload: normalized.payload };\r\n const beforeSubscribers = store._actionSubscribers\r\n .slice()\r\n .map((subscriber) => subscriber.before)\r\n .filter(Boolean);\r\n const afterSubscribers = store._actionSubscribers\r\n .slice()\r\n .map((subscriber) => subscriber.after)\r\n .filter(Boolean);\r\n const errorSubscribers = store._actionSubscribers\r\n .slice()\r\n .map((subscriber) => subscriber.error)\r\n .filter(Boolean);\r\n\r\n beforeSubscribers.forEach((handler) => handler(action, store.state));\r\n\r\n const result =\r\n entry.length > 1\r\n ? Promise.all(entry.map((handler) => handler(normalized.payload)))\r\n : entry[0](normalized.payload);\r\n const finalPromise = isPromise(result) ? result : Promise.resolve(result);\r\n return finalPromise\r\n .then((response) => {\r\n afterSubscribers.forEach((handler) => handler(action, store.state));\r\n return response;\r\n })\r\n .catch((error) => {\r\n errorSubscribers.forEach((handler) => handler(action, store.state, error));\r\n throw error;\r\n });\r\n}\r\n\r\nfunction genericSubscribe(subscriber, targetList) {\r\n if (targetList.includes(subscriber)) return () => undefined;\r\n targetList.push(subscriber);\r\n return () => {\r\n const index = targetList.indexOf(subscriber);\r\n if (index > -1) targetList.splice(index, 1);\r\n };\r\n}\r\n\r\nfunction applyPlugins(store, plugins = []) {\r\n plugins.forEach((plugin) => plugin(store));\r\n}\r\n\r\nfunction registerModule(store, path, rawModule, options) {\r\n const normalizedPath = normalizeModulePath(path);\r\n assert(normalizedPath.length > 0, \"根模块不能通过 registerModule 注册\");\r\n\r\n registerRuntimeModule(store._modules, normalizedPath, rawModule);\r\n\r\n if (!options.preserveState) {\r\n const parentState = getNestedState(store.state, normalizedPath.slice(0, -1));\r\n store._withCommit(() => {\r\n parentState[normalizedPath[normalizedPath.length - 1]] =\r\n typeof rawModule.state === \"function\" ? rawModule.state() : rawModule.state || {};\r\n });\r\n }\r\n\r\n resetStore(store);\r\n}\r\n\r\nfunction unregisterModule(store, path) {\r\n const normalizedPath = normalizeModulePath(path);\r\n assert(normalizedPath.length > 0, \"根模块不能被卸载\");\r\n\r\n const parentState = getNestedState(store.state, normalizedPath.slice(0, -1));\r\n const moduleName = normalizedPath[normalizedPath.length - 1];\r\n store._withCommit(() => {\r\n delete parentState[moduleName];\r\n });\r\n\r\n unregisterRuntimeModule(store._modules, normalizedPath);\r\n resetStore(store);\r\n}\r\n\r\nfunction hasModule(store, path) {\r\n const normalizedPath = normalizeModulePath(path);\r\n try {\r\n return !!getRawModuleByPath(store._modules, normalizedPath);\r\n } catch (_error) {\r\n return false;\r\n }\r\n}\r\n\r\nfunction hotUpdate(store, newOptions) {\r\n updateModuleTree(store._modules, newOptions);\r\n resetStore(store);\r\n}\r\n\r\nfunction resetStore(store) {\r\n store._actions = Object.create(null);\r\n store._mutations = Object.create(null);\r\n store._wrappedGetters = Object.create(null);\r\n store._modulesNamespaceMap = Object.create(null);\r\n\r\n installModule(store, store.state, [], store._modules);\r\n resetStoreVM(store);\r\n}\r\n\r\nexport function createLogger(options = {}) {\r\n const logger = options.logger || console;\r\n const logMutations = options.logMutations !== false;\r\n const logActions = options.logActions !== false;\r\n\r\n return (store) => {\r\n if (logMutations) {\r\n store.subscribe((mutation, state) => {\r\n logger.log(\"[mini-x][mutation]\", mutation.type, mutation.payload, state);\r\n });\r\n }\r\n if (logActions) {\r\n store.subscribeAction({\r\n before: (action, state) => {\r\n logger.log(\"[mini-x][action][before]\", action.type, action.payload, state);\r\n },\r\n after: (action, state) => {\r\n logger.log(\"[mini-x][action][after]\", action.type, action.payload, state);\r\n },\r\n error: (action, _state, error) => {\r\n logger.error(\"[mini-x][action][error]\", action.type, error);\r\n },\r\n });\r\n }\r\n };\r\n}\r\n\r\nexport function mapState(namespace, mappings) {\r\n return normalizeMap(\"state\", namespace, mappings, (store, key, value, ns) => {\r\n const state = ns\r\n ? getNestedState(store.state, ns.split(\"/\").filter(Boolean))\r\n : store.state;\r\n return typeof value === \"function\" ? value(state) : state[value];\r\n });\r\n}\r\n\r\nexport function mapGetters(namespace, mappings) {\r\n return normalizeMap(\"getter\", namespace, mappings, (store, _key, value, ns) => {\r\n const type = ns ? ns + value : value;\r\n return store.getters[type];\r\n });\r\n}\r\n\r\nexport function mapMutations(namespace, mappings) {\r\n return normalizeMap(\"mutation\", namespace, mappings, (store, _key, value, ns, args) => {\r\n const type = ns ? ns + value : value;\r\n return store.commit(type, ...args);\r\n });\r\n}\r\n\r\nexport function mapActions(namespace, mappings) {\r\n return normalizeMap(\"action\", namespace, mappings, (store, _key, value, ns, args) => {\r\n const type = ns ? ns + value : value;\r\n return store.dispatch(type, ...args);\r\n });\r\n}\r\n\r\nexport function createNamespacedHelpers(namespace) {\r\n const normalizedNamespace = normalizeNamespace(namespace);\r\n return {\r\n mapState: (mappings) => mapState(normalizedNamespace, mappings),\r\n mapGetters: (mappings) => mapGetters(normalizedNamespace, mappings),\r\n mapMutations: (mappings) => mapMutations(normalizedNamespace, mappings),\r\n mapActions: (mappings) => mapActions(normalizedNamespace, mappings),\r\n };\r\n}\r\n\r\nfunction normalizeMap(kind, namespace, mappings, resolver) {\r\n const normalizedNamespace =\r\n typeof namespace === \"string\" ? normalizeNamespace(namespace) : \"\";\r\n const rawMappings = typeof namespace === \"string\" ? mappings : namespace;\r\n const result = {};\r\n\r\n if (Array.isArray(rawMappings)) {\r\n rawMappings.forEach((key) => {\r\n result[key] = function mappedHandler(...args) {\r\n const store = this.$store || this.store;\r\n return resolver(store, key, key, normalizedNamespace, args);\r\n };\r\n });\r\n } else {\r\n forEachValue(rawMappings, (value, key) => {\r\n result[key] = function mappedHandler(...args) {\r\n const store = this.$store || this.store;\r\n return resolver(store, key, value, normalizedNamespace, args);\r\n };\r\n });\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction normalizeNamespace(namespace = \"\") {\r\n if (!namespace) return \"\";\r\n return namespace.endsWith(\"/\") ? namespace : `${namespace}/`;\r\n}\r\n\r\nfunction normalizeActionSubscriber(subscriber) {\r\n if (typeof subscriber === \"function\") {\r\n return { before: subscriber };\r\n }\r\n return subscriber || {};\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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