zova-core 5.0.110 → 5.0.113
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/bean/beanBaseSimple.d.ts.map +1 -1
- package/dist/bean/beanBaseSimple.js +10 -2
- package/dist/bean/beanBaseSimple.js.map +1 -1
- package/dist/core/resource.d.ts +6 -6
- package/dist/core/resource.d.ts.map +1 -1
- package/dist/core/resource.js +2 -6
- package/dist/core/resource.js.map +1 -1
- package/dist/decorator/class/use.js +8 -5
- package/dist/decorator/class/use.js.map +1 -1
- package/package.json +4 -3
- package/src/bean/beanBase.ts +53 -0
- package/src/bean/beanBaseSimple.ts +38 -0
- package/src/bean/beanContainer.ts +963 -0
- package/src/bean/beanControllerBase.ts +58 -0
- package/src/bean/beanControllerLike.ts +29 -0
- package/src/bean/beanControllerPageBase.ts +18 -0
- package/src/bean/beanRenderBase.ts +7 -0
- package/src/bean/beanRenderLike.ts +33 -0
- package/src/bean/beanSimple.ts +11 -0
- package/src/bean/beanStyleBase.ts +3 -0
- package/src/bean/index.ts +13 -0
- package/src/bean/resource/component/index.ts +1 -0
- package/src/bean/resource/component/type.ts +5 -0
- package/src/bean/resource/config/index.ts +1 -0
- package/src/bean/resource/config/type.ts +32 -0
- package/src/bean/resource/constant/index.ts +1 -0
- package/src/bean/resource/constant/type.ts +1 -0
- package/src/bean/resource/error/beanScopeError.ts +21 -0
- package/src/bean/resource/error/errorClass.ts +57 -0
- package/src/bean/resource/error/errorGlobal.ts +7 -0
- package/src/bean/resource/error/errorInternal.ts +66 -0
- package/src/bean/resource/error/errorObject.ts +4 -0
- package/src/bean/resource/error/index.ts +6 -0
- package/src/bean/resource/error/type.ts +10 -0
- package/src/bean/resource/icon/icon.ts +161 -0
- package/src/bean/resource/icon/iconGroup.ts +10 -0
- package/src/bean/resource/icon/index.ts +4 -0
- package/src/bean/resource/icon/types.ts +21 -0
- package/src/bean/resource/icon/useZovaIcon.ts +20 -0
- package/src/bean/resource/icon/utils.ts +20 -0
- package/src/bean/resource/icon/zovaIcon.ts +52 -0
- package/src/bean/resource/index.ts +8 -0
- package/src/bean/resource/locale/beanScopeLocale.ts +22 -0
- package/src/bean/resource/locale/index.ts +2 -0
- package/src/bean/resource/locale/type.ts +21 -0
- package/src/bean/resource/page/index.ts +1 -0
- package/src/bean/resource/page/type.ts +12 -0
- package/src/bean/resource/service/beanScopeService.ts +24 -0
- package/src/bean/resource/service/index.ts +2 -0
- package/src/bean/resource/service/type.ts +8 -0
- package/src/bean/scope/beanScopeBase.ts +74 -0
- package/src/bean/scope/index.ts +4 -0
- package/src/bean/scope/type.ts +23 -0
- package/src/bean/type.ts +31 -0
- package/src/composables/index.ts +4 -0
- package/src/composables/onControllerMounted.ts +12 -0
- package/src/composables/useApp.ts +7 -0
- package/src/composables/useContext.ts +7 -0
- package/src/composables/useController.ts +125 -0
- package/src/core/app/application.ts +76 -0
- package/src/core/app/config.ts +68 -0
- package/src/core/app/constant.ts +11 -0
- package/src/core/app/index.ts +6 -0
- package/src/core/app/locale.ts +12 -0
- package/src/core/app/meta.ts +44 -0
- package/src/core/app/util.ts +31 -0
- package/src/core/component/component.ts +44 -0
- package/src/core/component/cookie.ts +16 -0
- package/src/core/component/error.ts +18 -0
- package/src/core/component/event.ts +87 -0
- package/src/core/component/index.ts +3 -0
- package/src/core/component/locale.ts +97 -0
- package/src/core/component/module.ts +281 -0
- package/src/core/context/component.ts +34 -0
- package/src/core/context/context.ts +38 -0
- package/src/core/context/index.ts +4 -0
- package/src/core/context/meta.ts +26 -0
- package/src/core/context/state.ts +28 -0
- package/src/core/context/util.ts +20 -0
- package/src/core/index.ts +5 -0
- package/src/core/metadata.ts +54 -0
- package/src/core/resource.ts +186 -0
- package/src/decorator/class/bean.ts +19 -0
- package/src/decorator/class/index.ts +12 -0
- package/src/decorator/class/local.ts +18 -0
- package/src/decorator/class/model.ts +18 -0
- package/src/decorator/class/scope.ts +18 -0
- package/src/decorator/class/store.ts +18 -0
- package/src/decorator/class/style.ts +18 -0
- package/src/decorator/class/theme.ts +18 -0
- package/src/decorator/class/tool.ts +18 -0
- package/src/decorator/class/use.ts +37 -0
- package/src/decorator/class/useComposable.ts +16 -0
- package/src/decorator/class/useScope.ts +21 -0
- package/src/decorator/class/virtual.ts +20 -0
- package/src/decorator/index.ts +7 -0
- package/src/decorator/interface/beanOptions.ts +80 -0
- package/src/decorator/interface/useOptions.ts +37 -0
- package/src/decorator/type/constructable.ts +1 -0
- package/src/decorator/type/containerScope.ts +1 -0
- package/src/decorator/type/functionable.ts +1 -0
- package/src/decorator/type/injectionScope.ts +1 -0
- package/src/index.ts +9 -0
- package/src/plugins/bean.ts +16 -0
- package/src/plugins/index.ts +2 -0
- package/src/plugins/zova.ts +28 -0
- package/src/types/index.ts +2 -0
- package/src/types/interface/component.ts +36 -0
- package/src/types/interface/event.ts +28 -0
- package/src/types/interface/index.ts +6 -0
- package/src/types/interface/inject.ts +2 -0
- package/src/types/interface/module.ts +38 -0
- package/src/types/interface/monkey.ts +38 -0
- package/src/types/interface/pluginZova.ts +17 -0
- package/src/types/utils/cast.ts +8 -0
- package/src/types/utils/env.ts +35 -0
- package/src/types/utils/index.ts +3 -0
- package/src/types/utils/powerPartial.ts +3 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/isClass.ts +17 -0
- package/src/utils/stateLock.ts +47 -0
- package/src/utils/uuid.ts +84 -0
- package/src/vue/composable.ts +10 -0
- package/src/vue/computed.ts +7 -0
- package/src/vue/customRef.ts +5 -0
- package/src/vue/index.ts +4 -0
- package/src/vue/ref.ts +12 -0
- package/src/zod/index.ts +2 -0
- package/src/zod/zz.ts +77 -0
- package/dist/decorator/class/data.d.ts +0 -3
- package/dist/decorator/class/data.d.ts.map +0 -1
- package/dist/decorator/class/data.js +0 -18
- package/dist/decorator/class/data.js.map +0 -1
package/src/zod/zz.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// coerce
|
|
4
|
+
export function string(...args: Parameters<typeof z.coerce.string>) {
|
|
5
|
+
return z.coerce.string(...args);
|
|
6
|
+
}
|
|
7
|
+
export function number(...args: Parameters<typeof z.coerce.number>) {
|
|
8
|
+
return z.coerce.number(...args);
|
|
9
|
+
}
|
|
10
|
+
export function bigint(...args: Parameters<typeof z.coerce.bigint>) {
|
|
11
|
+
return z.coerce.bigint(...args);
|
|
12
|
+
}
|
|
13
|
+
export function date(...args: Parameters<typeof z.coerce.date>) {
|
|
14
|
+
return z.coerce.date(...args);
|
|
15
|
+
}
|
|
16
|
+
// export function boolean(...args: Parameters<typeof z.coerce.boolean>) {
|
|
17
|
+
// return z.coerce.boolean(...args);
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
// boolean
|
|
21
|
+
export function boolean(...args: Parameters<typeof z.boolean>) {
|
|
22
|
+
return z.preprocess(
|
|
23
|
+
val => {
|
|
24
|
+
if (val === undefined) return undefined;
|
|
25
|
+
if (val === 'false' || val === 'undefined' || val === 'null' || val === '0') return false;
|
|
26
|
+
return Boolean(val);
|
|
27
|
+
},
|
|
28
|
+
z.boolean(...args),
|
|
29
|
+
) as unknown as z.ZodBoolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// json
|
|
33
|
+
export function json<T extends z.ZodRawShape>(shape: T, params?: z.RawCreateParams) {
|
|
34
|
+
return z.preprocess(
|
|
35
|
+
val => {
|
|
36
|
+
// also undefined even val is 'null'
|
|
37
|
+
if (!val) return undefined;
|
|
38
|
+
if (val === 'undefined' || val === 'null') return undefined;
|
|
39
|
+
return JSON.parse(String(val));
|
|
40
|
+
},
|
|
41
|
+
z.object(shape, params),
|
|
42
|
+
) as unknown as z.ZodObject<
|
|
43
|
+
T,
|
|
44
|
+
'strip',
|
|
45
|
+
z.ZodTypeAny,
|
|
46
|
+
{
|
|
47
|
+
[k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>]: z.objectUtil.addQuestionMarks<
|
|
48
|
+
z.baseObjectOutputType<T>,
|
|
49
|
+
any
|
|
50
|
+
>[k];
|
|
51
|
+
},
|
|
52
|
+
{ [k_1 in keyof z.baseObjectInputType<T>]: z.baseObjectInputType<T>[k_1] }
|
|
53
|
+
>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// array
|
|
57
|
+
export function array<T extends z.ZodTypeAny>(schema: T, params?: z.RawCreateParams) {
|
|
58
|
+
return z.preprocess(
|
|
59
|
+
val => {
|
|
60
|
+
// also undefined even val is 'null'
|
|
61
|
+
if (!val) return undefined;
|
|
62
|
+
if (val === 'undefined' || val === 'null') return undefined;
|
|
63
|
+
return JSON.parse(String(val));
|
|
64
|
+
},
|
|
65
|
+
z.array(schema, params),
|
|
66
|
+
) as unknown as z.ZodArray<T, 'many'>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// object
|
|
70
|
+
export function object<T extends z.ZodRawShape>(shape: T, params?: z.RawCreateParams) {
|
|
71
|
+
return z.object(shape, params);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// infer
|
|
75
|
+
export type infer<T extends z.ZodType<any, any, any>> = z.infer<T>;
|
|
76
|
+
export type input<T extends z.ZodType<any, any, any>> = z.input<T>;
|
|
77
|
+
export type output<T extends z.ZodType<any, any, any>> = z.output<T>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/decorator/class/data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEnE,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAavE"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { appResource } from '../../core/resource.js';
|
|
2
|
-
import { Cast } from '../../types/utils/cast.js';
|
|
3
|
-
export function Data(options) {
|
|
4
|
-
return function (target) {
|
|
5
|
-
if (!options)
|
|
6
|
-
options = {};
|
|
7
|
-
// add
|
|
8
|
-
appResource.addBean({
|
|
9
|
-
module: Cast(options).module,
|
|
10
|
-
scene: options.scene || 'data',
|
|
11
|
-
name: options.name,
|
|
12
|
-
containerScope: 'ctx',
|
|
13
|
-
markReactive: options.markReactive,
|
|
14
|
-
beanClass: target,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../src/decorator/class/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGjD,MAAM,UAAU,IAAI,CAAI,OAA+B;IACrD,OAAO,UAAU,MAAM;QACrB,IAAI,CAAC,OAAO;YAAE,OAAO,GAAG,EAAE,CAAC;QAC3B,MAAM;QACN,WAAW,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;YAC5B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,MAAM;YAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,cAAc,EAAE,KAAK;YACrB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,SAAS,EAAE,MAAqC;SACjD,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|