wevu 1.0.0-alpha.2 → 1.0.0-alpha.4
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 +14 -4
- package/dist/compiler.cjs +17 -0
- package/dist/compiler.d.cts +17 -0
- package/dist/compiler.d.mts +17 -0
- package/dist/compiler.mjs +16 -0
- package/dist/index.cjs +1017 -102
- package/dist/index.d.cts +277 -48
- package/dist/index.d.mts +277 -48
- package/dist/index.mjs +953 -51
- package/package.json +15 -1
- package/dist/index-0dF4y5p6.d.mts +0 -80
- package/dist/index-DVEFI-Uo.d.cts +0 -80
- package/dist/store-2q4qcdBi.mjs +0 -726
- package/dist/store-D0GD8ulz.cjs +0 -888
- package/dist/store.cjs +0 -5
- package/dist/store.d.cts +0 -2
- package/dist/store.d.mts +0 -2
- package/dist/store.mjs +0 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wevu",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.4",
|
|
5
5
|
"description": "Vue 3 风格的小程序运行时,包含响应式、diff+setData 与轻量状态管理",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,6 +37,17 @@
|
|
|
37
37
|
"types": "./dist/index.d.cts",
|
|
38
38
|
"default": "./dist/index.cjs"
|
|
39
39
|
}
|
|
40
|
+
},
|
|
41
|
+
"./compiler": {
|
|
42
|
+
"types": "./dist/compiler.d.mts",
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/compiler.d.mts",
|
|
45
|
+
"default": "./dist/compiler.mjs"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/compiler.d.cts",
|
|
49
|
+
"default": "./dist/compiler.cjs"
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
52
|
},
|
|
42
53
|
"main": "./dist/index.cjs",
|
|
@@ -52,6 +63,9 @@
|
|
|
52
63
|
"engines": {
|
|
53
64
|
"node": ">=20.19.0"
|
|
54
65
|
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"miniprogram-api-typings": "^4.1.2"
|
|
68
|
+
},
|
|
55
69
|
"scripts": {
|
|
56
70
|
"dev": "tsdown -w",
|
|
57
71
|
"build": "tsdown",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
//#region src/reactivity/ref.d.ts
|
|
2
|
-
interface Ref<T = any, S = T> {
|
|
3
|
-
get value(): T;
|
|
4
|
-
set value(_: S);
|
|
5
|
-
[key: symbol]: any;
|
|
6
|
-
}
|
|
7
|
-
declare function isRef(value: unknown): value is Ref<any>;
|
|
8
|
-
declare function ref<T>(value: T): Ref<T>;
|
|
9
|
-
declare function unref<T>(value: T | Ref<T>): T;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/store/types.d.ts
|
|
12
|
-
type MutationType = 'patch object' | 'patch function';
|
|
13
|
-
interface SubscriptionCallback<S = any> {
|
|
14
|
-
(mutation: {
|
|
15
|
-
type: MutationType;
|
|
16
|
-
storeId: string;
|
|
17
|
-
}, state: S): void;
|
|
18
|
-
}
|
|
19
|
-
interface ActionSubscriber<TStore = any> {
|
|
20
|
-
(context: {
|
|
21
|
-
name: string;
|
|
22
|
-
store: TStore;
|
|
23
|
-
args: any[];
|
|
24
|
-
after: (cb: (result: any) => void) => void;
|
|
25
|
-
onError: (cb: (error: any) => void) => void;
|
|
26
|
-
}): void;
|
|
27
|
-
}
|
|
28
|
-
interface StoreManager {
|
|
29
|
-
install: (app: any) => void;
|
|
30
|
-
_stores: Map<string, any>;
|
|
31
|
-
use: (plugin: (context: {
|
|
32
|
-
store: any;
|
|
33
|
-
}) => void) => StoreManager;
|
|
34
|
-
_plugins: Array<(context: {
|
|
35
|
-
store: any;
|
|
36
|
-
}) => void>;
|
|
37
|
-
}
|
|
38
|
-
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
39
|
-
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
|
|
40
|
-
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
41
|
-
state: () => S;
|
|
42
|
-
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
43
|
-
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/store/define.d.ts
|
|
47
|
-
type SetupDefinition<T> = () => T;
|
|
48
|
-
declare function defineStore<T extends Record<string, any>>(id: string, setup: SetupDefinition<T>): () => T & {
|
|
49
|
-
$id: string;
|
|
50
|
-
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
51
|
-
$subscribe: (cb: (mutation: {
|
|
52
|
-
type: MutationType;
|
|
53
|
-
storeId: string;
|
|
54
|
-
}, state: any) => void, opts?: {
|
|
55
|
-
detached?: boolean;
|
|
56
|
-
}) => () => void;
|
|
57
|
-
$onAction: (cb: (context: any) => void) => () => void;
|
|
58
|
-
};
|
|
59
|
-
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 & {
|
|
60
|
-
$id: string;
|
|
61
|
-
$state: S;
|
|
62
|
-
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
63
|
-
$reset: () => void;
|
|
64
|
-
$subscribe: (cb: (mutation: {
|
|
65
|
-
type: MutationType;
|
|
66
|
-
storeId: string;
|
|
67
|
-
}, state: S) => void, opts?: {
|
|
68
|
-
detached?: boolean;
|
|
69
|
-
}) => () => void;
|
|
70
|
-
$onAction: (cb: (context: any) => () => void) => () => void;
|
|
71
|
-
};
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/store/manager.d.ts
|
|
74
|
-
declare function createStore(): StoreManager;
|
|
75
|
-
//#endregion
|
|
76
|
-
//#region src/store/storeToRefs.d.ts
|
|
77
|
-
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]> };
|
|
78
|
-
declare function storeToRefs<T extends Record<string, any>>(store: T): StoreToRefsResult<T>;
|
|
79
|
-
//#endregion
|
|
80
|
-
export { DefineStoreOptions as a, SubscriptionCallback as c, ref as d, unref as f, ActionSubscriber as i, Ref as l, createStore as n, MutationType as o, defineStore as r, StoreManager as s, storeToRefs as t, isRef as u };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
//#region src/reactivity/ref.d.ts
|
|
2
|
-
interface Ref<T = any, S = T> {
|
|
3
|
-
get value(): T;
|
|
4
|
-
set value(_: S);
|
|
5
|
-
[key: symbol]: any;
|
|
6
|
-
}
|
|
7
|
-
declare function isRef(value: unknown): value is Ref<any>;
|
|
8
|
-
declare function ref<T>(value: T): Ref<T>;
|
|
9
|
-
declare function unref<T>(value: T | Ref<T>): T;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/store/types.d.ts
|
|
12
|
-
type MutationType = 'patch object' | 'patch function';
|
|
13
|
-
interface SubscriptionCallback<S = any> {
|
|
14
|
-
(mutation: {
|
|
15
|
-
type: MutationType;
|
|
16
|
-
storeId: string;
|
|
17
|
-
}, state: S): void;
|
|
18
|
-
}
|
|
19
|
-
interface ActionSubscriber<TStore = any> {
|
|
20
|
-
(context: {
|
|
21
|
-
name: string;
|
|
22
|
-
store: TStore;
|
|
23
|
-
args: any[];
|
|
24
|
-
after: (cb: (result: any) => void) => void;
|
|
25
|
-
onError: (cb: (error: any) => void) => void;
|
|
26
|
-
}): void;
|
|
27
|
-
}
|
|
28
|
-
interface StoreManager {
|
|
29
|
-
install: (app: any) => void;
|
|
30
|
-
_stores: Map<string, any>;
|
|
31
|
-
use: (plugin: (context: {
|
|
32
|
-
store: any;
|
|
33
|
-
}) => void) => StoreManager;
|
|
34
|
-
_plugins: Array<(context: {
|
|
35
|
-
store: any;
|
|
36
|
-
}) => void>;
|
|
37
|
-
}
|
|
38
|
-
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
39
|
-
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
|
|
40
|
-
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
41
|
-
state: () => S;
|
|
42
|
-
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
43
|
-
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/store/define.d.ts
|
|
47
|
-
type SetupDefinition<T> = () => T;
|
|
48
|
-
declare function defineStore<T extends Record<string, any>>(id: string, setup: SetupDefinition<T>): () => T & {
|
|
49
|
-
$id: string;
|
|
50
|
-
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
51
|
-
$subscribe: (cb: (mutation: {
|
|
52
|
-
type: MutationType;
|
|
53
|
-
storeId: string;
|
|
54
|
-
}, state: any) => void, opts?: {
|
|
55
|
-
detached?: boolean;
|
|
56
|
-
}) => () => void;
|
|
57
|
-
$onAction: (cb: (context: any) => void) => () => void;
|
|
58
|
-
};
|
|
59
|
-
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 & {
|
|
60
|
-
$id: string;
|
|
61
|
-
$state: S;
|
|
62
|
-
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
63
|
-
$reset: () => void;
|
|
64
|
-
$subscribe: (cb: (mutation: {
|
|
65
|
-
type: MutationType;
|
|
66
|
-
storeId: string;
|
|
67
|
-
}, state: S) => void, opts?: {
|
|
68
|
-
detached?: boolean;
|
|
69
|
-
}) => () => void;
|
|
70
|
-
$onAction: (cb: (context: any) => () => void) => () => void;
|
|
71
|
-
};
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/store/manager.d.ts
|
|
74
|
-
declare function createStore(): StoreManager;
|
|
75
|
-
//#endregion
|
|
76
|
-
//#region src/store/storeToRefs.d.ts
|
|
77
|
-
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]> };
|
|
78
|
-
declare function storeToRefs<T extends Record<string, any>>(store: T): StoreToRefsResult<T>;
|
|
79
|
-
//#endregion
|
|
80
|
-
export { DefineStoreOptions as a, SubscriptionCallback as c, ref as d, unref as f, ActionSubscriber as i, Ref as l, createStore as n, MutationType as o, defineStore as r, StoreManager as s, storeToRefs as t, isRef as u };
|