wevu 6.13.4 → 6.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{defineProperty-BZYESRfZ.mjs → defineProperty-doi4xRTi.mjs} +4 -4
- package/dist/fetch.mjs +1 -1
- package/dist/index-BZkMfL_L.d.mts +112 -0
- package/dist/{index-0h8h6MwA.d.mts → index-Dqp4s9KD.d.mts} +6 -523
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/{ref-DvvlGmiL.mjs → ref-Ber-NAmk.mjs} +1 -1
- package/dist/{router-BeMj67ue.mjs → router-B9F-WroF.mjs} +1 -1
- package/dist/router.d.mts +1 -1
- package/dist/router.mjs +2 -2
- package/dist/{src-CHSW2A0i.mjs → src--JCUFfO-.mjs} +78 -27
- package/dist/{store-C-Eil5IU.mjs → store-DTHoZy79.mjs} +1 -1
- package/dist/store.d.mts +1 -1
- package/dist/store.mjs +1 -1
- package/dist/vue-demi.d.mts +3 -3
- package/dist/vue-demi.mjs +4 -4
- package/dist/vue-types-CxI8OQhB.d.mts +699 -0
- package/package.json +3 -3
- package/dist/index-BPZxNlC8.d.mts +0 -246
- package/dist/router-DW4Yf9Yj.d.mts +0 -46
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.123.0/helpers/typeof.js
|
|
2
2
|
function _typeof(o) {
|
|
3
3
|
"@babel/helpers - typeof";
|
|
4
4
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -8,7 +8,7 @@ function _typeof(o) {
|
|
|
8
8
|
}, _typeof(o);
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
11
|
-
//#region \0@oxc-project+runtime@0.
|
|
11
|
+
//#region \0@oxc-project+runtime@0.123.0/helpers/toPrimitive.js
|
|
12
12
|
function toPrimitive(t, r) {
|
|
13
13
|
if ("object" != _typeof(t) || !t) return t;
|
|
14
14
|
var e = t[Symbol.toPrimitive];
|
|
@@ -20,13 +20,13 @@ function toPrimitive(t, r) {
|
|
|
20
20
|
return ("string" === r ? String : Number)(t);
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
-
//#region \0@oxc-project+runtime@0.
|
|
23
|
+
//#region \0@oxc-project+runtime@0.123.0/helpers/toPropertyKey.js
|
|
24
24
|
function toPropertyKey(t) {
|
|
25
25
|
var i = toPrimitive(t, "string");
|
|
26
26
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region \0@oxc-project+runtime@0.
|
|
29
|
+
//#region \0@oxc-project+runtime@0.123.0/helpers/defineProperty.js
|
|
30
30
|
function _defineProperty(e, r, t) {
|
|
31
31
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
32
32
|
value: t,
|
package/dist/fetch.mjs
CHANGED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Zt as Ref } from "./vue-types-CxI8OQhB.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/store/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @description Store 变更类型
|
|
6
|
+
*/
|
|
7
|
+
type MutationType = 'patch object' | 'patch function' | 'direct';
|
|
8
|
+
/**
|
|
9
|
+
* @description Store 订阅回调签名
|
|
10
|
+
*/
|
|
11
|
+
interface SubscriptionCallback<S = any> {
|
|
12
|
+
(mutation: {
|
|
13
|
+
type: MutationType;
|
|
14
|
+
storeId: string;
|
|
15
|
+
}, state: S): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @description Store 订阅选项
|
|
19
|
+
*/
|
|
20
|
+
interface StoreSubscribeOptions {
|
|
21
|
+
/**
|
|
22
|
+
* @description 是否在卸载后仍保留订阅(适用于跨页面生命周期的订阅)
|
|
23
|
+
*/
|
|
24
|
+
detached?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @description Action 订阅回调上下文
|
|
28
|
+
*/
|
|
29
|
+
interface ActionContext<TStore = any> {
|
|
30
|
+
name: string;
|
|
31
|
+
store: TStore;
|
|
32
|
+
args: any[];
|
|
33
|
+
after: (cb: (result: any) => void) => void;
|
|
34
|
+
onError: (cb: (error: any) => void) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @description Action 订阅回调类型
|
|
38
|
+
*/
|
|
39
|
+
interface ActionSubscriber<TStore = any> {
|
|
40
|
+
(context: ActionContext<TStore>): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @description Store 管理器(插件与共享实例)
|
|
44
|
+
*/
|
|
45
|
+
interface StoreManager {
|
|
46
|
+
install: (app: any) => void;
|
|
47
|
+
_stores: Map<string, any>;
|
|
48
|
+
use: (plugin: (context: {
|
|
49
|
+
store: any;
|
|
50
|
+
}) => void) => StoreManager;
|
|
51
|
+
_plugins: Array<(context: {
|
|
52
|
+
store: any;
|
|
53
|
+
}) => void>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @description Getter 定义集合
|
|
57
|
+
*/
|
|
58
|
+
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
59
|
+
/**
|
|
60
|
+
* @description 从 Getter 定义中推导返回类型
|
|
61
|
+
*/
|
|
62
|
+
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
|
|
63
|
+
/**
|
|
64
|
+
* @description defineStore(options) 的配置类型
|
|
65
|
+
*/
|
|
66
|
+
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
67
|
+
state: () => S;
|
|
68
|
+
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
69
|
+
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/store/define.d.ts
|
|
73
|
+
type SetupDefinition<T> = () => T;
|
|
74
|
+
/**
|
|
75
|
+
* @description 定义一个 setup 风格的 store
|
|
76
|
+
*/
|
|
77
|
+
declare function defineStore<T extends Record<string, any>>(id: string, setup: SetupDefinition<T>): () => T & {
|
|
78
|
+
$id: string;
|
|
79
|
+
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
80
|
+
$reset: () => void;
|
|
81
|
+
$subscribe: (cb: SubscriptionCallback<any>, opts?: StoreSubscribeOptions) => () => void;
|
|
82
|
+
$onAction: (cb: ActionSubscriber<any>) => () => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* @description 定义一个 options 风格的 store
|
|
86
|
+
*/
|
|
87
|
+
declare function defineStore<S extends Record<string, any>, G extends Record<string, any>, A extends Record<string, any>>(id: string, options: DefineStoreOptions<S, G, A>): () => S & StoreGetters<G> & A & {
|
|
88
|
+
$id: string;
|
|
89
|
+
$state: S;
|
|
90
|
+
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
91
|
+
$reset: () => void;
|
|
92
|
+
$subscribe: (cb: SubscriptionCallback<S>, opts?: StoreSubscribeOptions) => () => void;
|
|
93
|
+
$onAction: (cb: ActionSubscriber<S & StoreGetters<G> & A>) => () => void;
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/store/manager.d.ts
|
|
97
|
+
/**
|
|
98
|
+
* @description 创建 store 管理器(插件与共享实例入口)
|
|
99
|
+
*/
|
|
100
|
+
declare function createStore(): StoreManager;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/store/storeToRefs.d.ts
|
|
103
|
+
/**
|
|
104
|
+
* @description storeToRefs 返回类型推导
|
|
105
|
+
*/
|
|
106
|
+
type StoreToRefsResult<T extends Record<string, any>> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? T[K] : T[K] extends Ref<infer V> ? Ref<V> : Ref<T[K]> };
|
|
107
|
+
/**
|
|
108
|
+
* @description 将 store 状态转换为 Ref
|
|
109
|
+
*/
|
|
110
|
+
declare function storeToRefs<T extends Record<string, any>>(store: T): StoreToRefsResult<T>;
|
|
111
|
+
//#endregion
|
|
112
|
+
export { ActionContext as a, MutationType as c, SubscriptionCallback as d, defineStore as i, StoreManager as l, storeToRefs as n, ActionSubscriber as o, createStore as r, DefineStoreOptions as s, StoreToRefsResult as t, StoreSubscribeOptions as u };
|