@cloudcome/utils-vue 1.13.2 → 1.13.3
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 +1 -1
- package/dist/async.cjs +65 -65
- package/dist/async.cjs.map +1 -1
- package/dist/async.mjs +66 -67
- package/dist/async.mjs.map +1 -1
- package/dist/component/self.d.ts +4 -4
- package/dist/component.cjs +110 -13
- package/dist/component.cjs.map +1 -1
- package/dist/component.d.ts +1 -1
- package/dist/component.mjs +108 -17
- package/dist/component.mjs.map +1 -1
- package/dist/event.cjs +39 -32
- package/dist/event.cjs.map +1 -1
- package/dist/event.mjs +39 -33
- package/dist/event.mjs.map +1 -1
- package/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/dist/request.cjs +72 -74
- package/dist/request.cjs.map +1 -1
- package/dist/request.d.ts +1 -1
- package/dist/request.mjs +71 -74
- package/dist/request.mjs.map +1 -1
- package/dist/shared.cjs +87 -26
- package/dist/shared.cjs.map +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.mjs +87 -28
- package/dist/shared.mjs.map +1 -1
- package/dist/state.cjs +26 -25
- package/dist/state.cjs.map +1 -1
- package/dist/state.mjs +27 -27
- package/dist/state.mjs.map +1 -1
- package/dist/time.cjs +45 -35
- package/dist/time.cjs.map +1 -1
- package/dist/time.mjs +45 -37
- package/dist/time.mjs.map +1 -1
- package/dist/types.cjs +0 -2
- package/dist/types.mjs +0 -2
- package/package.json +42 -43
- package/dist/life.cjs +0 -16
- package/dist/life.cjs.map +0 -1
- package/dist/life.mjs +0 -17
- package/dist/life.mjs.map +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.mjs.map +0 -1
package/dist/component.mjs
CHANGED
|
@@ -1,20 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { _runLifeHook } from "./shared.mjs";
|
|
2
|
+
import { onActivated, onBeforeMount, onBeforeUnmount, onDeactivated, onMounted, onUnmounted, ref } from "vue";
|
|
3
|
+
//#region src/component/life.ts
|
|
4
|
+
/**
|
|
5
|
+
* 页面挂载前生命周期钩子
|
|
6
|
+
*
|
|
7
|
+
* @param beforeMount - 在组件挂载前执行的回调函数,可以返回一个清理函数
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* useMount(() => {
|
|
12
|
+
* console.log('组件即将挂载');
|
|
13
|
+
* // 可以返回一个清理函数,在组件卸载前执行
|
|
14
|
+
* return () => {
|
|
15
|
+
* console.log('组件即将卸载');
|
|
16
|
+
* };
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function useMount(beforeMount) {
|
|
21
|
+
_runLifeHook(onBeforeMount, onBeforeUnmount, beforeMount);
|
|
5
22
|
}
|
|
6
|
-
|
|
7
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 页面挂载后生命周期钩子
|
|
25
|
+
*
|
|
26
|
+
* @param mounted - 在组件挂载后执行的回调函数,可以返回一个清理函数
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* useMounted(() => {
|
|
31
|
+
* console.log('组件已挂载');
|
|
32
|
+
* // 可以返回一个清理函数,在组件卸载前执行
|
|
33
|
+
* return () => {
|
|
34
|
+
* console.log('组件即将卸载');
|
|
35
|
+
* };
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function useMounted(mounted) {
|
|
40
|
+
_runLifeHook(onMounted, onUnmounted, mounted);
|
|
8
41
|
}
|
|
9
|
-
|
|
10
|
-
|
|
42
|
+
/**
|
|
43
|
+
* 页面激活时生命周期钩子
|
|
44
|
+
*
|
|
45
|
+
* @param activated - 在组件被激活时执行的回调函数,可以返回一个清理函数
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* useActivated(() => {
|
|
50
|
+
* console.log('组件已激活');
|
|
51
|
+
* // 可以返回一个清理函数,在组件失活前执行
|
|
52
|
+
* return () => {
|
|
53
|
+
* console.log('组件即将失活');
|
|
54
|
+
* };
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
function useActivated(activated) {
|
|
59
|
+
_runLifeHook(onActivated, onDeactivated, activated);
|
|
11
60
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/component/self.ts
|
|
63
|
+
/**
|
|
64
|
+
* 创建一个响应式引用,用于暴露组件实例
|
|
65
|
+
* @template T 组件类型
|
|
66
|
+
* @param {T} Comp 组件定义
|
|
67
|
+
* @returns 返回一个可响应式访问的组件实例引用
|
|
68
|
+
* @example
|
|
69
|
+
* const compRef = useExpose(MyComponent)
|
|
70
|
+
*/
|
|
71
|
+
function useExpose(_Comp) {
|
|
72
|
+
return ref(null);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 创建一个组件emit事件监听器
|
|
76
|
+
* @template T 组件类型
|
|
77
|
+
* @template E 从组件props中提取的事件类型
|
|
78
|
+
* @template K 事件名
|
|
79
|
+
* @param {T} Comp 组件定义
|
|
80
|
+
* @param {K} event 事件名称
|
|
81
|
+
* @param {E[K]} listener 事件监听函数
|
|
82
|
+
* @returns {E[K]} 返回传入的事件监听函数
|
|
83
|
+
* @example
|
|
84
|
+
* const handleClick = useEmit(MyComponent, 'click', (payload) => {
|
|
85
|
+
* console.log('click event', payload)
|
|
86
|
+
* })
|
|
87
|
+
*/
|
|
88
|
+
function useEmit(_Comp, _event, listener) {
|
|
89
|
+
return listener;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 从组件props中提取方法并返回指定方法
|
|
93
|
+
* @template T 组件类型
|
|
94
|
+
* @template M 从组件props中提取的方法类型
|
|
95
|
+
* @template K 方法名类型
|
|
96
|
+
* @param {T} Comp 组件定义
|
|
97
|
+
* @param {K} name 方法名称
|
|
98
|
+
* @param {M[K]} method 要返回的方法
|
|
99
|
+
* @returns {M[K]} 返回传入的方法
|
|
100
|
+
* @example
|
|
101
|
+
* const handleUpdate = useMethod(MyComponent, 'update', (value) => {
|
|
102
|
+
* console.log('update value', value)
|
|
103
|
+
* })
|
|
104
|
+
*/
|
|
105
|
+
function useMethod(_Comp, _name, method) {
|
|
106
|
+
return method;
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { useActivated, useEmit, useExpose, useMethod, useMount, useMounted };
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=component.mjs.map
|
package/dist/component.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.mjs","sources":["../src/component/self.ts"],"sourcesContent":["import { type Ref, ref } from 'vue';\nimport type {
|
|
1
|
+
{"version":3,"file":"component.mjs","names":[],"sources":["../src/component/life.ts","../src/component/self.ts"],"sourcesContent":["import type { MaybePromise } from '@cloudcome/utils-core/types';\nimport {\n onActivated,\n onBeforeMount,\n onBeforeUnmount,\n onDeactivated,\n onMounted,\n onUnmounted,\n} from 'vue';\nimport { _runLifeHook } from '@/shared';\n\nexport type HookListener = () => MaybePromise<unknown>;\nexport type HookListenerWithDispose = () => MaybePromise<\n undefined | HookListener\n>;\n\n/**\n * 页面挂载前生命周期钩子\n *\n * @param beforeMount - 在组件挂载前执行的回调函数,可以返回一个清理函数\n *\n * @example\n * ```ts\n * useMount(() => {\n * console.log('组件即将挂载');\n * // 可以返回一个清理函数,在组件卸载前执行\n * return () => {\n * console.log('组件即将卸载');\n * };\n * });\n * ```\n */\nexport function useMount(beforeMount: HookListenerWithDispose) {\n _runLifeHook(onBeforeMount, onBeforeUnmount, beforeMount);\n}\n\n/**\n * 页面挂载后生命周期钩子\n *\n * @param mounted - 在组件挂载后执行的回调函数,可以返回一个清理函数\n *\n * @example\n * ```ts\n * useMounted(() => {\n * console.log('组件已挂载');\n * // 可以返回一个清理函数,在组件卸载前执行\n * return () => {\n * console.log('组件即将卸载');\n * };\n * });\n * ```\n */\nexport function useMounted(mounted: HookListenerWithDispose) {\n _runLifeHook(onMounted, onUnmounted, mounted);\n}\n\n/**\n * 页面激活时生命周期钩子\n *\n * @param activated - 在组件被激活时执行的回调函数,可以返回一个清理函数\n *\n * @example\n * ```ts\n * useActivated(() => {\n * console.log('组件已激活');\n * // 可以返回一个清理函数,在组件失活前执行\n * return () => {\n * console.log('组件即将失活');\n * };\n * });\n * ```\n */\nexport function useActivated(activated: HookListenerWithDispose) {\n _runLifeHook(onActivated, onDeactivated, activated);\n}\n","import { type Ref, ref } from 'vue';\nimport type {\n ComponentExposed,\n ComponentProps,\n} from 'vue-component-type-helpers';\n\n/**\n * 创建一个响应式引用,用于暴露组件实例\n * @template T 组件类型\n * @param {T} Comp 组件定义\n * @returns 返回一个可响应式访问的组件实例引用\n * @example\n * const compRef = useExpose(MyComponent)\n */\nexport function useExpose<T>(_Comp: T) {\n // 这里必须类型断言,否则构建会失败\n return ref<ComponentExposed<T> | null>(\n null,\n ) as Ref<ComponentExposed<T> | null>;\n}\n\n/**\n * 将字符串的首字母转换为小写\n * @template S 字符串类型\n * @typedef {S extends `${infer First}${infer Rest}` ? `${Lowercase<First>}${Rest}` : S} LowercaseFirst\n */\ntype LowercaseFirst<S extends string> = S extends `${infer First}${infer Rest}`\n ? `${Lowercase<First>}${Rest}`\n : S;\n\n/**\n * 从组件props中提取事件类型\n * @template T 组件props类型\n * @typedef {Object} PickEmits\n * @property {Object} [K in keyof T as K extends `on${infer Rest}`...] 转换后的emit事件名\n * - @property {Function} [...args: P] 事件回调函数\n */\ntype PickEmits<T> = {\n [K in keyof T as K extends `on${infer Rest}`\n ? // biome-ignore lint/suspicious/noExplicitAny: 必须使用 any\n T[K] extends (...args: any[]) => any\n ? LowercaseFirst<Rest>\n : never\n : // biome-ignore lint/suspicious/noExplicitAny: 必须使用 any\n never]: T[K] extends (...args: infer P) => any\n ? (...args: P) => unknown\n : never;\n};\n\n/**\n * 创建一个组件emit事件监听器\n * @template T 组件类型\n * @template E 从组件props中提取的事件类型\n * @template K 事件名\n * @param {T} Comp 组件定义\n * @param {K} event 事件名称\n * @param {E[K]} listener 事件监听函数\n * @returns {E[K]} 返回传入的事件监听函数\n * @example\n * const handleClick = useEmit(MyComponent, 'click', (payload) => {\n * console.log('click event', payload)\n * })\n */\nexport function useEmit<\n T,\n E extends PickEmits<Required<ComponentProps<T>>>,\n K extends keyof E,\n>(_Comp: T, _event: K, listener: E[K]) {\n return listener;\n}\n\ntype PickMethods<T> = {\n // biome-ignore lint/suspicious/noExplicitAny: 必须使用 any\n [K in keyof T]: T[K] extends (...args: unknown[]) => any ? T[K] : never;\n};\n\n/**\n * 从组件props中提取方法并返回指定方法\n * @template T 组件类型\n * @template M 从组件props中提取的方法类型\n * @template K 方法名类型\n * @param {T} Comp 组件定义\n * @param {K} name 方法名称\n * @param {M[K]} method 要返回的方法\n * @returns {M[K]} 返回传入的方法\n * @example\n * const handleUpdate = useMethod(MyComponent, 'update', (value) => {\n * console.log('update value', value)\n * })\n */\nexport function useMethod<\n T,\n M extends PickMethods<Required<ComponentProps<T>>>,\n K extends keyof M,\n>(_Comp: T, _name: K, method: M[K]) {\n return method;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,SAAS,aAAsC;CAC7D,aAAa,eAAe,iBAAiB,YAAY;;;;;;;;;;;;;;;;;;AAmB3D,SAAgB,WAAW,SAAkC;CAC3D,aAAa,WAAW,aAAa,QAAQ;;;;;;;;;;;;;;;;;;AAmB/C,SAAgB,aAAa,WAAoC;CAC/D,aAAa,aAAa,eAAe,UAAU;;;;;;;;;;;;AC3DrD,SAAgB,UAAa,OAAU;CAErC,OAAO,IACL,KACD;;;;;;;;;;;;;;;;AA6CH,SAAgB,QAId,OAAU,QAAW,UAAgB;CACrC,OAAO;;;;;;;;;;;;;;;;AAsBT,SAAgB,UAId,OAAU,OAAU,QAAc;CAClC,OAAO"}
|
package/dist/event.cjs
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
let _cloudcome_utils_core_emitter = require("@cloudcome/utils-core/emitter");
|
|
4
|
+
//#region src/event.ts
|
|
5
5
|
function createEventHook(options = {}) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
const emitter = options.emitter || new _cloudcome_utils_core_emitter.Emitter();
|
|
7
|
+
const on = (event, listener) => {
|
|
8
|
+
emitter.on(event, listener);
|
|
9
|
+
};
|
|
10
|
+
const off = (event, listener) => {
|
|
11
|
+
emitter.off(event, listener);
|
|
12
|
+
};
|
|
13
|
+
const emit = (event, ...payloads) => {
|
|
14
|
+
emitter.emit(event, ...payloads);
|
|
15
|
+
};
|
|
16
|
+
const useEvent = (event, fn) => {
|
|
17
|
+
if (options.stage === "mounted") {
|
|
18
|
+
(0, vue.onMounted)(() => {
|
|
19
|
+
on(event, fn);
|
|
20
|
+
});
|
|
21
|
+
(0, vue.onUnmounted)(() => {
|
|
22
|
+
off(event, fn);
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
(0, vue.onBeforeMount)(() => {
|
|
26
|
+
on(event, fn);
|
|
27
|
+
});
|
|
28
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
29
|
+
off(event, fn);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
on,
|
|
35
|
+
off,
|
|
36
|
+
emit,
|
|
37
|
+
useEvent
|
|
38
|
+
};
|
|
34
39
|
}
|
|
40
|
+
//#endregion
|
|
35
41
|
exports.createEventHook = createEventHook;
|
|
36
|
-
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=event.cjs.map
|
package/dist/event.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.cjs","sources":["../src/event.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"event.cjs","names":[],"sources":["../src/event.ts"],"sourcesContent":["import {\n Emitter,\n type EmitterListener,\n type EmitterMap,\n} from '@cloudcome/utils-core/emitter';\nimport { onBeforeMount, onBeforeUnmount, onMounted, onUnmounted } from 'vue';\n\nexport type EventEmitter = {\n on: (event: string, listener: (...payloads: unknown[]) => unknown) => unknown;\n off: (\n event: string,\n listener: (...payloads: unknown[]) => unknown,\n ) => unknown;\n emit: (event: string, ...payloads: unknown[]) => unknown;\n};\n\nexport type CreateEventCenterOptions = {\n emitter?: EventEmitter;\n stage?: 'mount' | 'mounted';\n};\n\nexport function createEventHook<E extends EmitterMap>(\n options: CreateEventCenterOptions = {},\n) {\n const emitter = options.emitter || new Emitter();\n\n const on = <K extends keyof E>(event: K, listener: EmitterListener<E, K>) => {\n // @ts-expect-error\n emitter.on(event as string, listener);\n };\n\n const off = <K extends keyof E>(\n event: K,\n listener: EmitterListener<E, K>,\n ) => {\n // @ts-expect-error\n emitter.off(event as string, listener);\n };\n\n const emit = <K extends keyof E>(event: K, ...payloads: E[K]) => {\n emitter.emit(event as string, ...payloads);\n };\n\n const useEvent = <K extends keyof E>(\n event: K,\n fn: (...payloads: E[K]) => unknown,\n ) => {\n if (options.stage === 'mounted') {\n onMounted(() => {\n on(event, fn);\n });\n onUnmounted(() => {\n off(event, fn);\n });\n } else {\n onBeforeMount(() => {\n on(event, fn);\n });\n onBeforeUnmount(() => {\n off(event, fn);\n });\n }\n };\n\n return { on, off, emit, useEvent };\n}\n"],"mappings":";;;;AAqBA,SAAgB,gBACd,UAAoC,EAAE,EACtC;CACA,MAAM,UAAU,QAAQ,WAAW,IAAI,8BAAA,SAAS;CAEhD,MAAM,MAAyB,OAAU,aAAoC;EAE3E,QAAQ,GAAG,OAAiB,SAAS;;CAGvC,MAAM,OACJ,OACA,aACG;EAEH,QAAQ,IAAI,OAAiB,SAAS;;CAGxC,MAAM,QAA2B,OAAU,GAAG,aAAmB;EAC/D,QAAQ,KAAK,OAAiB,GAAG,SAAS;;CAG5C,MAAM,YACJ,OACA,OACG;EACH,IAAI,QAAQ,UAAU,WAAW;GAC/B,CAAA,GAAA,IAAA,iBAAgB;IACd,GAAG,OAAO,GAAG;KACb;GACF,CAAA,GAAA,IAAA,mBAAkB;IAChB,IAAI,OAAO,GAAG;KACd;SACG;GACL,CAAA,GAAA,IAAA,qBAAoB;IAClB,GAAG,OAAO,GAAG;KACb;GACF,CAAA,GAAA,IAAA,uBAAsB;IACpB,IAAI,OAAO,GAAG;KACd;;;CAIN,OAAO;EAAE;EAAI;EAAK;EAAM;EAAU"}
|
package/dist/event.mjs
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
|
+
import { onBeforeMount, onBeforeUnmount, onMounted, onUnmounted } from "vue";
|
|
1
2
|
import { Emitter } from "@cloudcome/utils-core/emitter";
|
|
2
|
-
|
|
3
|
+
//#region src/event.ts
|
|
3
4
|
function createEventHook(options = {}) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
const emitter = options.emitter || new Emitter();
|
|
6
|
+
const on = (event, listener) => {
|
|
7
|
+
emitter.on(event, listener);
|
|
8
|
+
};
|
|
9
|
+
const off = (event, listener) => {
|
|
10
|
+
emitter.off(event, listener);
|
|
11
|
+
};
|
|
12
|
+
const emit = (event, ...payloads) => {
|
|
13
|
+
emitter.emit(event, ...payloads);
|
|
14
|
+
};
|
|
15
|
+
const useEvent = (event, fn) => {
|
|
16
|
+
if (options.stage === "mounted") {
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
on(event, fn);
|
|
19
|
+
});
|
|
20
|
+
onUnmounted(() => {
|
|
21
|
+
off(event, fn);
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
onBeforeMount(() => {
|
|
25
|
+
on(event, fn);
|
|
26
|
+
});
|
|
27
|
+
onBeforeUnmount(() => {
|
|
28
|
+
off(event, fn);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
on,
|
|
34
|
+
off,
|
|
35
|
+
emit,
|
|
36
|
+
useEvent
|
|
37
|
+
};
|
|
32
38
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=event.mjs.map
|
|
39
|
+
//#endregion
|
|
40
|
+
export { createEventHook };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=event.mjs.map
|
package/dist/event.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.mjs","sources":["../src/event.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"event.mjs","names":[],"sources":["../src/event.ts"],"sourcesContent":["import {\n Emitter,\n type EmitterListener,\n type EmitterMap,\n} from '@cloudcome/utils-core/emitter';\nimport { onBeforeMount, onBeforeUnmount, onMounted, onUnmounted } from 'vue';\n\nexport type EventEmitter = {\n on: (event: string, listener: (...payloads: unknown[]) => unknown) => unknown;\n off: (\n event: string,\n listener: (...payloads: unknown[]) => unknown,\n ) => unknown;\n emit: (event: string, ...payloads: unknown[]) => unknown;\n};\n\nexport type CreateEventCenterOptions = {\n emitter?: EventEmitter;\n stage?: 'mount' | 'mounted';\n};\n\nexport function createEventHook<E extends EmitterMap>(\n options: CreateEventCenterOptions = {},\n) {\n const emitter = options.emitter || new Emitter();\n\n const on = <K extends keyof E>(event: K, listener: EmitterListener<E, K>) => {\n // @ts-expect-error\n emitter.on(event as string, listener);\n };\n\n const off = <K extends keyof E>(\n event: K,\n listener: EmitterListener<E, K>,\n ) => {\n // @ts-expect-error\n emitter.off(event as string, listener);\n };\n\n const emit = <K extends keyof E>(event: K, ...payloads: E[K]) => {\n emitter.emit(event as string, ...payloads);\n };\n\n const useEvent = <K extends keyof E>(\n event: K,\n fn: (...payloads: E[K]) => unknown,\n ) => {\n if (options.stage === 'mounted') {\n onMounted(() => {\n on(event, fn);\n });\n onUnmounted(() => {\n off(event, fn);\n });\n } else {\n onBeforeMount(() => {\n on(event, fn);\n });\n onBeforeUnmount(() => {\n off(event, fn);\n });\n }\n };\n\n return { on, off, emit, useEvent };\n}\n"],"mappings":";;;AAqBA,SAAgB,gBACd,UAAoC,EAAE,EACtC;CACA,MAAM,UAAU,QAAQ,WAAW,IAAI,SAAS;CAEhD,MAAM,MAAyB,OAAU,aAAoC;EAE3E,QAAQ,GAAG,OAAiB,SAAS;;CAGvC,MAAM,OACJ,OACA,aACG;EAEH,QAAQ,IAAI,OAAiB,SAAS;;CAGxC,MAAM,QAA2B,OAAU,GAAG,aAAmB;EAC/D,QAAQ,KAAK,OAAiB,GAAG,SAAS;;CAG5C,MAAM,YACJ,OACA,OACG;EACH,IAAI,QAAQ,UAAU,WAAW;GAC/B,gBAAgB;IACd,GAAG,OAAO,GAAG;KACb;GACF,kBAAkB;IAChB,IAAI,OAAO,GAAG;KACd;SACG;GACL,oBAAoB;IAClB,GAAG,OAAO,GAAG;KACb;GACF,sBAAsB;IACpB,IAAI,OAAO,GAAG;KACd;;;CAIN,OAAO;EAAE;EAAI;EAAK;EAAM;EAAU"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* `@cloudcome/utils-vue` 版本号
|
|
5
|
+
*/
|
|
6
|
+
var VERSION = "1.13.3";
|
|
7
|
+
//#endregion
|
|
4
8
|
exports.VERSION = VERSION;
|
|
5
|
-
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-vue` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-vue` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"mappings":";;;;;AAGA,IAAa,UAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* `@cloudcome/utils-vue` 版本号
|
|
4
|
+
*/
|
|
5
|
+
var VERSION = "1.13.3";
|
|
6
|
+
//#endregion
|
|
7
|
+
export { VERSION };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-vue` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-vue` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"mappings":";;;;AAGA,IAAa,UAAA"}
|
package/dist/request.cjs
CHANGED
|
@@ -1,78 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
const require_async = require("./async.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let _cloudcome_utils_core_type = require("@cloudcome/utils-core/type");
|
|
5
|
+
let _cloudcome_utils_core_cache = require("@cloudcome/utils-core/cache");
|
|
6
|
+
let _cloudcome_utils_core_try = require("@cloudcome/utils-core/try");
|
|
7
|
+
//#region src/request.ts
|
|
8
|
+
var defaultCacheStorage = new _cloudcome_utils_core_cache.MemoryCache();
|
|
9
|
+
var defaultShareStorage = new _cloudcome_utils_core_cache.MemoryCache();
|
|
10
10
|
function useRequest(fn, options) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
sendAsync,
|
|
73
|
-
hitShare,
|
|
74
|
-
hitCache
|
|
75
|
-
};
|
|
11
|
+
const { id, cache, share, onCacheHit } = options || {};
|
|
12
|
+
const shareStorage = defaultShareStorage;
|
|
13
|
+
const shareAble = (0, _cloudcome_utils_core_type.isObject)(share) ? !share.disabled : share;
|
|
14
|
+
const shareOptions = (0, _cloudcome_utils_core_type.isObject)(share) ? share : {};
|
|
15
|
+
const hitShare = (0, vue.ref)(false);
|
|
16
|
+
const _cached = defaultCacheStorage;
|
|
17
|
+
const cacheStorage = (0, _cloudcome_utils_core_type.isObject)(cache) ? cache.storage || _cached : _cached;
|
|
18
|
+
const cacheAble = (0, _cloudcome_utils_core_type.isObject)(cache) ? !cache.disabled : cache;
|
|
19
|
+
const cacheOptions = (0, _cloudcome_utils_core_type.isObject)(cache) ? cache : {};
|
|
20
|
+
const hitCache = (0, vue.ref)(false);
|
|
21
|
+
const cacheableFn = async (...inputs) => {
|
|
22
|
+
const requestId = (0, _cloudcome_utils_core_type.isFunction)(id) ? id() : id;
|
|
23
|
+
hitShare.value = false;
|
|
24
|
+
hitCache.value = false;
|
|
25
|
+
if (requestId && shareAble) {
|
|
26
|
+
const shared = shareStorage.get(requestId);
|
|
27
|
+
if (shared) {
|
|
28
|
+
hitShare.value = true;
|
|
29
|
+
const [err, data] = await (0, _cloudcome_utils_core_try.tryFlatten)(shared.data);
|
|
30
|
+
if (err) {
|
|
31
|
+
shareStorage.del(requestId);
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
38
|
+
if (requestId && shareAble) shareStorage.set(requestId, promise, shareOptions);
|
|
39
|
+
if (requestId && cacheAble) {
|
|
40
|
+
const cached = await cacheStorage.get(requestId);
|
|
41
|
+
if (cached) {
|
|
42
|
+
const data = cached.data;
|
|
43
|
+
resolve(data);
|
|
44
|
+
hitCache.value = true;
|
|
45
|
+
await onCacheHit?.(cached);
|
|
46
|
+
return promise;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const [err, data] = await (0, _cloudcome_utils_core_try.tryFlatten)(fn(...inputs));
|
|
50
|
+
if (err) {
|
|
51
|
+
reject(err);
|
|
52
|
+
return promise;
|
|
53
|
+
}
|
|
54
|
+
if (requestId && cacheAble) cacheStorage.set(requestId, data, cacheOptions);
|
|
55
|
+
resolve(data);
|
|
56
|
+
return promise;
|
|
57
|
+
};
|
|
58
|
+
const { state: asyncState, run: send, runAsync: sendAsync, ...async } = require_async.useAsync(cacheableFn, options);
|
|
59
|
+
const state = (0, vue.computed)(() => ({
|
|
60
|
+
...asyncState.value,
|
|
61
|
+
hitShare: hitShare.value,
|
|
62
|
+
hitCache: hitCache.value
|
|
63
|
+
}));
|
|
64
|
+
return {
|
|
65
|
+
...async,
|
|
66
|
+
state,
|
|
67
|
+
send,
|
|
68
|
+
sendAsync,
|
|
69
|
+
hitShare,
|
|
70
|
+
hitCache
|
|
71
|
+
};
|
|
76
72
|
}
|
|
73
|
+
//#endregion
|
|
77
74
|
exports.useRequest = useRequest;
|
|
78
|
-
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=request.cjs.map
|
package/dist/request.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.cjs","sources":["../src/request.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"request.cjs","names":[],"sources":["../src/request.ts"],"sourcesContent":["import {\n type Cache,\n type Cached,\n type CacheOptions,\n MemoryCache,\n} from '@cloudcome/utils-core/cache';\nimport type { DateValue } from '@cloudcome/utils-core/date';\nimport { tryFlatten } from '@cloudcome/utils-core/try';\nimport { isFunction, isObject } from '@cloudcome/utils-core/type';\nimport type { AnyArray, MaybeCallable } from '@cloudcome/utils-core/types';\nimport type { ComputedRef, Ref } from 'vue';\nimport { computed, ref } from 'vue';\nimport {\n type UseAsyncOptions,\n type UseAsyncOutput,\n type UseAsyncOutputFilled,\n type UseAsyncState,\n type UseAsyncStateFilled,\n useAsync,\n} from './async';\n\n/**\n * 请求缓存配置选项。\n * @template T 缓存数据的类型。\n */\nexport type RequestCacheOptions<T> = CacheOptions & {\n /**\n * 是否禁用缓存,默认为 false。\n * 如果设置为 true,则不会使用缓存。\n */\n disabled?: boolean;\n\n /**\n * 自定义缓存存储实现。\n * 可以传入自定义的缓存类来替代默认的内存缓存。\n */\n storage?: Cache<T>;\n};\n\nexport type RequestShareOptions = {\n /**\n * 是否禁用共享请求,默认为 false。\n * 如果设置为 true,则不会共享请求结果。\n */\n disabled?: boolean;\n\n /**\n * 共享的最大时长(毫秒),为 0 时表示永久共享。\n * 超过该时长后,共享的请求结果将被清除。\n */\n maxAge?: number;\n\n /**\n * 共享的过期时间(时间戳、日期字符串、日期对象等)。\n * 优先级比 maxAge 更高,指定具体的过期时间。\n */\n expiredAt?: DateValue;\n};\n\nexport type RetryOptions = {\n /**\n * 是否禁用重试,默认为 false。\n * 如果设置为 true,则不会重试。\n */\n disabled?: boolean;\n};\n\n/**\n * 请求选项,扩展了异步操作的选项。\n * @template T 请求返回的数据类型。\n * @template I 请求参数的类型。\n */\nexport type UseRequestOptions<I extends AnyArray, O> = UseAsyncOptions<I, O> & {\n /**\n * 请求的唯一标识符,可以是字符串或函数返回的字符串。\n * 用于缓存和共享的键值。\n */\n id?: MaybeCallable<string>;\n\n /**\n * 缓存配置,可以是布尔值或完整的缓存选项。\n * 如果为 true,则启用默认缓存;如果为对象,则可以自定义缓存行为。\n */\n cache?: boolean | RequestCacheOptions<O>;\n\n /**\n * 共享配置,可以是布尔值或完整的共享选项。\n * 共享时,相同的请求 ID 会复用第一次发出且没有响应完成的请求。\n *\n * 例如,10 组件同时或先后发起 10 次请求用于获取用户信息,\n * 那么这 10 个组件会共同等待第一次发起的请求,直到完成。\n *\n * 共享与缓存是不同的概念,共享是进行时,缓存是过去时,即:\n * - 共享是共享**正在发送**的请求\n * - 缓存是缓存**已经发送**的请求\n *\n * 如果为 true,则启用默认共享;如果为对象,则可以自定义共享行为。\n */\n share?: boolean | RequestShareOptions;\n\n /**\n * 当命中缓存时的回调函数。\n * 在缓存命中时触发,接收缓存的数据作为参数。\n */\n onCacheHit?: (cached: Cached<O>) => unknown;\n};\n\nexport type UseRequestState<O> = UseAsyncState<O> & {\n /**\n * 是否命中共享数据\n */\n hitShare: boolean;\n\n /**\n * 是否命中缓存\n */\n hitCache: boolean;\n};\n\nexport type UseRequestStateFilled<O> = UseAsyncStateFilled<O> & {\n /**\n * 是否命中共享数据\n */\n hitShare: boolean;\n\n /**\n * 是否命中缓存\n */\n hitCache: boolean;\n};\n\nexport type UseRequestOutput<I extends AnyArray, O> = Omit<\n UseAsyncOutput<I, O>,\n 'run' | 'runAsync' | 'state'\n> & {\n state: ComputedRef<UseRequestState<O>>;\n send: (...inputs: I) => void;\n sendAsync: (...inputs: I) => Promise<O>;\n hitShare: Ref<boolean>;\n hitCache: Ref<boolean>;\n};\n\nexport type UseRequestOutputFilled<I extends AnyArray, O> = Omit<\n UseAsyncOutputFilled<I, O>,\n 'run' | 'runAsync' | 'state'\n> & {\n state: ComputedRef<UseRequestStateFilled<O>>;\n send: (...inputs: I) => void;\n sendAsync: (...inputs: I) => Promise<O>;\n hitShare: Ref<boolean>;\n hitCache: Ref<boolean>;\n};\n\nconst defaultCacheStorage = new MemoryCache();\nconst defaultShareStorage = new MemoryCache();\n\n/**\n * 使用请求功能的组合式函数。\n * 支持缓存和异步操作的封装。\n *\n * @template O 请求返回的数据类型。\n * @template I 请求参数的类型。\n * @param {() => Promise<O>} fn 实际的请求函数,返回一个 Promise。\n * @param {UseRequestOptions<I, O>} [options] 请求选项,包括缓存和回调配置。\n * @returns 返回一个对象,包含以下内容:\n * - 异步操作的状态(如 loading、error 等)。\n * - 是否命中缓存(hitCache)。\n * - 是否命中共享请求(hitShare)。\n */\nexport function useRequest<I extends AnyArray, O>(\n fn: (...inputs: I) => Promise<O>,\n options: Omit<UseRequestOptions<I, O>, 'placeholder'> & {\n placeholder: () => O;\n },\n): UseRequestOutputFilled<I, O>;\nexport function useRequest<I extends AnyArray, O>(\n fn: (...inputs: I) => Promise<O>,\n options?: UseRequestOptions<I, O>,\n): UseRequestOutput<I, O>;\nexport function useRequest<I extends AnyArray, O>(\n fn: (...inputs: I) => Promise<O>,\n options?: UseRequestOptions<I, O>,\n): UseRequestOutput<I, O> {\n const { id, cache, share, onCacheHit } = options || {};\n\n const shareStorage = defaultShareStorage as MemoryCache<Promise<O>>;\n const shareAble = isObject(share) ? !share.disabled : share;\n const shareOptions = isObject(share) ? share : {};\n const hitShare = ref(false);\n\n const _cached = defaultCacheStorage as Cache<O>;\n const cacheStorage = isObject(cache) ? cache.storage || _cached : _cached;\n const cacheAble = isObject(cache) ? !cache.disabled : cache;\n const cacheOptions = isObject(cache) ? cache : {};\n const hitCache = ref(false);\n\n const cacheableFn = async (...inputs: I) => {\n const requestId = isFunction(id) ? id() : id;\n\n hitShare.value = false;\n hitCache.value = false;\n\n if (requestId && shareAble) {\n const shared = shareStorage.get(requestId);\n if (shared) {\n hitShare.value = true;\n const [err, data] = await tryFlatten(shared.data);\n if (err) {\n shareStorage.del(requestId);\n throw err;\n }\n\n return data;\n }\n }\n\n // 这里不能先执行,因为如果要缓存的话,必须用缓存结果\n const { promise, resolve, reject } = Promise.withResolvers<O>();\n\n if (requestId && shareAble) {\n shareStorage.set(requestId, promise, shareOptions);\n }\n\n if (requestId && cacheAble) {\n const cached = await cacheStorage.get(requestId);\n\n if (cached) {\n const data = cached.data;\n resolve(data);\n hitCache.value = true;\n await onCacheHit?.(cached);\n return promise;\n }\n }\n\n const [err, data] = await tryFlatten(fn(...inputs));\n\n if (err) {\n reject(err);\n return promise;\n }\n\n if (requestId && cacheAble) {\n cacheStorage.set(requestId, data, cacheOptions);\n }\n\n resolve(data);\n return promise;\n };\n const {\n state: asyncState,\n run: send,\n runAsync: sendAsync,\n ...async\n } = useAsync(cacheableFn, options);\n\n const state = computed(() => ({\n ...asyncState.value,\n hitShare: hitShare.value,\n hitCache: hitCache.value,\n }));\n\n return {\n ...async,\n state,\n send,\n sendAsync,\n hitShare,\n hitCache,\n };\n}\n"],"mappings":";;;;;;;AAyJA,IAAM,sBAAsB,IAAI,4BAAA,aAAa;AAC7C,IAAM,sBAAsB,IAAI,4BAAA,aAAa;AAyB7C,SAAgB,WACd,IACA,SACwB;CACxB,MAAM,EAAE,IAAI,OAAO,OAAO,eAAe,WAAW,EAAE;CAEtD,MAAM,eAAe;CACrB,MAAM,aAAA,GAAA,2BAAA,UAAqB,MAAM,GAAG,CAAC,MAAM,WAAW;CACtD,MAAM,gBAAA,GAAA,2BAAA,UAAwB,MAAM,GAAG,QAAQ,EAAE;CACjD,MAAM,YAAA,GAAA,IAAA,KAAe,MAAM;CAE3B,MAAM,UAAU;CAChB,MAAM,gBAAA,GAAA,2BAAA,UAAwB,MAAM,GAAG,MAAM,WAAW,UAAU;CAClE,MAAM,aAAA,GAAA,2BAAA,UAAqB,MAAM,GAAG,CAAC,MAAM,WAAW;CACtD,MAAM,gBAAA,GAAA,2BAAA,UAAwB,MAAM,GAAG,QAAQ,EAAE;CACjD,MAAM,YAAA,GAAA,IAAA,KAAe,MAAM;CAE3B,MAAM,cAAc,OAAO,GAAG,WAAc;EAC1C,MAAM,aAAA,GAAA,2BAAA,YAAuB,GAAG,GAAG,IAAI,GAAG;EAE1C,SAAS,QAAQ;EACjB,SAAS,QAAQ;EAEjB,IAAI,aAAa,WAAW;GAC1B,MAAM,SAAS,aAAa,IAAI,UAAU;GAC1C,IAAI,QAAQ;IACV,SAAS,QAAQ;IACjB,MAAM,CAAC,KAAK,QAAQ,OAAA,GAAA,0BAAA,YAAiB,OAAO,KAAK;IACjD,IAAI,KAAK;KACP,aAAa,IAAI,UAAU;KAC3B,MAAM;;IAGR,OAAO;;;EAKX,MAAM,EAAE,SAAS,SAAS,WAAW,QAAQ,eAAkB;EAE/D,IAAI,aAAa,WACf,aAAa,IAAI,WAAW,SAAS,aAAa;EAGpD,IAAI,aAAa,WAAW;GAC1B,MAAM,SAAS,MAAM,aAAa,IAAI,UAAU;GAEhD,IAAI,QAAQ;IACV,MAAM,OAAO,OAAO;IACpB,QAAQ,KAAK;IACb,SAAS,QAAQ;IACjB,MAAM,aAAa,OAAO;IAC1B,OAAO;;;EAIX,MAAM,CAAC,KAAK,QAAQ,OAAA,GAAA,0BAAA,YAAiB,GAAG,GAAG,OAAO,CAAC;EAEnD,IAAI,KAAK;GACP,OAAO,IAAI;GACX,OAAO;;EAGT,IAAI,aAAa,WACf,aAAa,IAAI,WAAW,MAAM,aAAa;EAGjD,QAAQ,KAAK;EACb,OAAO;;CAET,MAAM,EACJ,OAAO,YACP,KAAK,MACL,UAAU,WACV,GAAG,UACD,cAAA,SAAS,aAAa,QAAQ;CAElC,MAAM,SAAA,GAAA,IAAA,iBAAwB;EAC5B,GAAG,WAAW;EACd,UAAU,SAAS;EACnB,UAAU,SAAS;EACpB,EAAE;CAEH,OAAO;EACL,GAAG;EACH;EACA;EACA;EACA;EACA;EACD"}
|
package/dist/request.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cache,
|
|
1
|
+
import { Cache, Cached, CacheOptions } from '@cloudcome/utils-core/cache';
|
|
2
2
|
import { DateValue } from '@cloudcome/utils-core/date';
|
|
3
3
|
import { AnyArray, MaybeCallable } from '@cloudcome/utils-core/types';
|
|
4
4
|
import { ComputedRef, Ref } from 'vue';
|