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.
Files changed (133) hide show
  1. package/dist/bean/beanBaseSimple.d.ts.map +1 -1
  2. package/dist/bean/beanBaseSimple.js +10 -2
  3. package/dist/bean/beanBaseSimple.js.map +1 -1
  4. package/dist/core/resource.d.ts +6 -6
  5. package/dist/core/resource.d.ts.map +1 -1
  6. package/dist/core/resource.js +2 -6
  7. package/dist/core/resource.js.map +1 -1
  8. package/dist/decorator/class/use.js +8 -5
  9. package/dist/decorator/class/use.js.map +1 -1
  10. package/package.json +4 -3
  11. package/src/bean/beanBase.ts +53 -0
  12. package/src/bean/beanBaseSimple.ts +38 -0
  13. package/src/bean/beanContainer.ts +963 -0
  14. package/src/bean/beanControllerBase.ts +58 -0
  15. package/src/bean/beanControllerLike.ts +29 -0
  16. package/src/bean/beanControllerPageBase.ts +18 -0
  17. package/src/bean/beanRenderBase.ts +7 -0
  18. package/src/bean/beanRenderLike.ts +33 -0
  19. package/src/bean/beanSimple.ts +11 -0
  20. package/src/bean/beanStyleBase.ts +3 -0
  21. package/src/bean/index.ts +13 -0
  22. package/src/bean/resource/component/index.ts +1 -0
  23. package/src/bean/resource/component/type.ts +5 -0
  24. package/src/bean/resource/config/index.ts +1 -0
  25. package/src/bean/resource/config/type.ts +32 -0
  26. package/src/bean/resource/constant/index.ts +1 -0
  27. package/src/bean/resource/constant/type.ts +1 -0
  28. package/src/bean/resource/error/beanScopeError.ts +21 -0
  29. package/src/bean/resource/error/errorClass.ts +57 -0
  30. package/src/bean/resource/error/errorGlobal.ts +7 -0
  31. package/src/bean/resource/error/errorInternal.ts +66 -0
  32. package/src/bean/resource/error/errorObject.ts +4 -0
  33. package/src/bean/resource/error/index.ts +6 -0
  34. package/src/bean/resource/error/type.ts +10 -0
  35. package/src/bean/resource/icon/icon.ts +161 -0
  36. package/src/bean/resource/icon/iconGroup.ts +10 -0
  37. package/src/bean/resource/icon/index.ts +4 -0
  38. package/src/bean/resource/icon/types.ts +21 -0
  39. package/src/bean/resource/icon/useZovaIcon.ts +20 -0
  40. package/src/bean/resource/icon/utils.ts +20 -0
  41. package/src/bean/resource/icon/zovaIcon.ts +52 -0
  42. package/src/bean/resource/index.ts +8 -0
  43. package/src/bean/resource/locale/beanScopeLocale.ts +22 -0
  44. package/src/bean/resource/locale/index.ts +2 -0
  45. package/src/bean/resource/locale/type.ts +21 -0
  46. package/src/bean/resource/page/index.ts +1 -0
  47. package/src/bean/resource/page/type.ts +12 -0
  48. package/src/bean/resource/service/beanScopeService.ts +24 -0
  49. package/src/bean/resource/service/index.ts +2 -0
  50. package/src/bean/resource/service/type.ts +8 -0
  51. package/src/bean/scope/beanScopeBase.ts +74 -0
  52. package/src/bean/scope/index.ts +4 -0
  53. package/src/bean/scope/type.ts +23 -0
  54. package/src/bean/type.ts +31 -0
  55. package/src/composables/index.ts +4 -0
  56. package/src/composables/onControllerMounted.ts +12 -0
  57. package/src/composables/useApp.ts +7 -0
  58. package/src/composables/useContext.ts +7 -0
  59. package/src/composables/useController.ts +125 -0
  60. package/src/core/app/application.ts +76 -0
  61. package/src/core/app/config.ts +68 -0
  62. package/src/core/app/constant.ts +11 -0
  63. package/src/core/app/index.ts +6 -0
  64. package/src/core/app/locale.ts +12 -0
  65. package/src/core/app/meta.ts +44 -0
  66. package/src/core/app/util.ts +31 -0
  67. package/src/core/component/component.ts +44 -0
  68. package/src/core/component/cookie.ts +16 -0
  69. package/src/core/component/error.ts +18 -0
  70. package/src/core/component/event.ts +87 -0
  71. package/src/core/component/index.ts +3 -0
  72. package/src/core/component/locale.ts +97 -0
  73. package/src/core/component/module.ts +281 -0
  74. package/src/core/context/component.ts +34 -0
  75. package/src/core/context/context.ts +38 -0
  76. package/src/core/context/index.ts +4 -0
  77. package/src/core/context/meta.ts +26 -0
  78. package/src/core/context/state.ts +28 -0
  79. package/src/core/context/util.ts +20 -0
  80. package/src/core/index.ts +5 -0
  81. package/src/core/metadata.ts +54 -0
  82. package/src/core/resource.ts +186 -0
  83. package/src/decorator/class/bean.ts +19 -0
  84. package/src/decorator/class/index.ts +12 -0
  85. package/src/decorator/class/local.ts +18 -0
  86. package/src/decorator/class/model.ts +18 -0
  87. package/src/decorator/class/scope.ts +18 -0
  88. package/src/decorator/class/store.ts +18 -0
  89. package/src/decorator/class/style.ts +18 -0
  90. package/src/decorator/class/theme.ts +18 -0
  91. package/src/decorator/class/tool.ts +18 -0
  92. package/src/decorator/class/use.ts +37 -0
  93. package/src/decorator/class/useComposable.ts +16 -0
  94. package/src/decorator/class/useScope.ts +21 -0
  95. package/src/decorator/class/virtual.ts +20 -0
  96. package/src/decorator/index.ts +7 -0
  97. package/src/decorator/interface/beanOptions.ts +80 -0
  98. package/src/decorator/interface/useOptions.ts +37 -0
  99. package/src/decorator/type/constructable.ts +1 -0
  100. package/src/decorator/type/containerScope.ts +1 -0
  101. package/src/decorator/type/functionable.ts +1 -0
  102. package/src/decorator/type/injectionScope.ts +1 -0
  103. package/src/index.ts +9 -0
  104. package/src/plugins/bean.ts +16 -0
  105. package/src/plugins/index.ts +2 -0
  106. package/src/plugins/zova.ts +28 -0
  107. package/src/types/index.ts +2 -0
  108. package/src/types/interface/component.ts +36 -0
  109. package/src/types/interface/event.ts +28 -0
  110. package/src/types/interface/index.ts +6 -0
  111. package/src/types/interface/inject.ts +2 -0
  112. package/src/types/interface/module.ts +38 -0
  113. package/src/types/interface/monkey.ts +38 -0
  114. package/src/types/interface/pluginZova.ts +17 -0
  115. package/src/types/utils/cast.ts +8 -0
  116. package/src/types/utils/env.ts +35 -0
  117. package/src/types/utils/index.ts +3 -0
  118. package/src/types/utils/powerPartial.ts +3 -0
  119. package/src/utils/index.ts +1 -0
  120. package/src/utils/isClass.ts +17 -0
  121. package/src/utils/stateLock.ts +47 -0
  122. package/src/utils/uuid.ts +84 -0
  123. package/src/vue/composable.ts +10 -0
  124. package/src/vue/computed.ts +7 -0
  125. package/src/vue/customRef.ts +5 -0
  126. package/src/vue/index.ts +4 -0
  127. package/src/vue/ref.ts +12 -0
  128. package/src/zod/index.ts +2 -0
  129. package/src/zod/zz.ts +77 -0
  130. package/dist/decorator/class/data.d.ts +0 -3
  131. package/dist/decorator/class/data.d.ts.map +0 -1
  132. package/dist/decorator/class/data.js +0 -18
  133. 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,3 +0,0 @@
1
- import { IDecoratorDataOptions } from '../index.js';
2
- export declare function Data<T>(options?: IDecoratorDataOptions): ClassDecorator;
3
- //# sourceMappingURL=data.d.ts.map
@@ -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"}