@pawover/kit 0.0.0-beta.41 → 0.0.0-beta.43
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/enums.d.ts +1 -1
- package/dist/enums.js +144 -2
- package/dist/enums.js.map +1 -0
- package/dist/{except-MacUK44u.d.ts → except-6l9Qdmn1.d.ts} +53 -38
- package/dist/except-6l9Qdmn1.d.ts.map +1 -0
- package/dist/hooks-alova.d.ts.map +1 -1
- package/dist/hooks-alova.js +1 -4
- package/dist/hooks-alova.js.map +1 -1
- package/dist/hooks-react.d.ts +43 -12
- package/dist/hooks-react.d.ts.map +1 -1
- package/dist/hooks-react.js +52 -49
- package/dist/hooks-react.js.map +1 -1
- package/dist/{index-DBPmnr4a.d.ts → index-D0_YLsqN.d.ts} +2 -5
- package/dist/index-D0_YLsqN.d.ts.map +1 -0
- package/dist/index-JKtXbRi8.d.ts +149 -0
- package/dist/index-JKtXbRi8.d.ts.map +1 -0
- package/dist/index.d.ts +400 -111
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/patches-fetchEventSource.d.ts +2 -2
- package/dist/patches-fetchEventSource.d.ts.map +1 -1
- package/dist/patches-fetchEventSource.js +2 -4
- package/dist/patches-fetchEventSource.js.map +1 -1
- package/dist/{utils-_dtCs-qa.js → utils-DvWLCdYR.js} +282 -356
- package/dist/utils-DvWLCdYR.js.map +1 -0
- package/dist/{value-of-DUmTbnuw.d.ts → value-of-Dz22arsm.d.ts} +2 -2
- package/dist/value-of-Dz22arsm.d.ts.map +1 -0
- package/dist/vite.d.ts +0 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +2 -2
- package/dist/vite.js.map +1 -1
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +31 -69
- package/dist/zod.js.map +1 -1
- package/metadata.json +0 -3
- package/package.json +18 -12
- package/dist/enums-BL6w5-mS.js +0 -148
- package/dist/enums-BL6w5-mS.js.map +0 -1
- package/dist/except-MacUK44u.d.ts.map +0 -1
- package/dist/index-Bn_PNnsM.d.ts +0 -212
- package/dist/index-Bn_PNnsM.d.ts.map +0 -1
- package/dist/index-DBPmnr4a.d.ts.map +0 -1
- package/dist/utils-_dtCs-qa.js.map +0 -1
- package/dist/value-of-DUmTbnuw.d.ts.map +0 -1
package/dist/hooks-react.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
|
|
1
|
+
import { D as stringToUpperCase, Mt as isEqual, Rt as isFunction, V as arrayZipToObject, ct as isString, d as objectKeys, h as objectMapEntries, m as objectAssign, pt as isPromise, z as isBrowser } from "./utils-DvWLCdYR.js";
|
|
2
|
+
import { BREAK_POINT_TOKEN_ENUM } from "./enums.js";
|
|
3
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
4
|
//#region src/hooks/react/useCreation.ts
|
|
6
5
|
/**
|
|
7
6
|
* useCreation
|
|
@@ -23,7 +22,6 @@ function useCreation(factory, deps) {
|
|
|
23
22
|
}
|
|
24
23
|
return current.result;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
//#region src/hooks/react/useLatest.ts
|
|
29
27
|
/**
|
|
@@ -37,31 +35,44 @@ function useLatest(value) {
|
|
|
37
35
|
ref.current = value;
|
|
38
36
|
return ref;
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
//#endregion
|
|
42
39
|
//#region src/hooks/react/useMount.ts
|
|
43
40
|
/**
|
|
44
41
|
* 在组件初始化时执行的 Hook
|
|
45
|
-
* -
|
|
42
|
+
* - 即使在严格模式(React StrictMode)也只执行一次
|
|
43
|
+
* - 自动使用最新版 effect 函数
|
|
46
44
|
*
|
|
47
|
-
* @param effect
|
|
45
|
+
* @param effect 副作用函数(必须为同步函数;若为异步函数,清理逻辑需自行处理)
|
|
46
|
+
* @example
|
|
47
|
+
* useMount(() => {
|
|
48
|
+
* console.log('组件挂载');
|
|
49
|
+
* return () => console.log('组件卸载');
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* useMount(async () => {
|
|
53
|
+
* const data = await fetchData();
|
|
54
|
+
* // 清理逻辑需通过 ref/AbortController 自行管理
|
|
55
|
+
* // ❌ 不要 return cleanupFn(async 函数返回 Promise,无法作为清理函数)
|
|
56
|
+
* });
|
|
48
57
|
*/
|
|
49
58
|
function useMount(effect) {
|
|
50
59
|
const isMountedRef = useRef(false);
|
|
51
60
|
const effectRef = useLatest(effect);
|
|
52
61
|
useEffect(() => {
|
|
53
|
-
if (!isFunction(effectRef.current))
|
|
62
|
+
if (!isFunction(effectRef.current)) {
|
|
63
|
+
console.error(`[useMount] Expected parameter to be a function, but got ${typeof effectRef.current}. This effect will not execute.`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
54
66
|
if (isMountedRef.current) return;
|
|
55
67
|
isMountedRef.current = true;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
return result;
|
|
68
|
+
const cleanup = effectRef.current?.();
|
|
69
|
+
return isFunction(cleanup) && !isPromise(cleanup) ? cleanup : void 0;
|
|
59
70
|
}, [effectRef]);
|
|
60
71
|
}
|
|
61
|
-
|
|
62
72
|
//#endregion
|
|
63
73
|
//#region src/hooks/react/useResponsive.ts
|
|
64
|
-
const
|
|
74
|
+
const SUBSCRIBER_SET = /* @__PURE__ */ new Set();
|
|
75
|
+
const BREAK_POINTS = [
|
|
65
76
|
"xxxl",
|
|
66
77
|
"xxl",
|
|
67
78
|
"xl",
|
|
@@ -70,41 +81,24 @@ const tuple = [
|
|
|
70
81
|
"sm",
|
|
71
82
|
"xs"
|
|
72
83
|
];
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"XL",
|
|
77
|
-
"LG",
|
|
78
|
-
"MD",
|
|
79
|
-
"SM",
|
|
80
|
-
"XS"
|
|
81
|
-
];
|
|
82
|
-
const defaultValues = arrayZipToObject(tuple, tuple.map(() => false));
|
|
84
|
+
const DEFAULT_VALUES = Object.freeze(arrayZipToObject(BREAK_POINTS, false));
|
|
85
|
+
let responsiveValues = { ...DEFAULT_VALUES };
|
|
86
|
+
let responsiveTokens = BREAK_POINT_TOKEN_ENUM;
|
|
83
87
|
function useResponsive(options) {
|
|
84
88
|
const { breakPointTokens = {} } = options || {};
|
|
85
|
-
const responsiveValuesRef = useRef({ ...defaultValues });
|
|
86
|
-
const [responsive, setResponsive] = useState({ ...defaultValues });
|
|
87
89
|
const tokens = useMemo(() => objectAssign(BREAK_POINT_TOKEN_ENUM, breakPointTokens), [breakPointTokens]);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const responsiveConfig = arrayZipToObject(tuple, TUPLE.map((t) => tokens[t]));
|
|
93
|
-
let shouldUpdate = false;
|
|
94
|
-
for (const key of tuple) {
|
|
95
|
-
newValues[key] = window.innerWidth >= responsiveConfig[key];
|
|
96
|
-
if (newValues[key] !== responsiveValuesRef.current[key]) shouldUpdate = true;
|
|
97
|
-
}
|
|
98
|
-
if (shouldUpdate) responsiveValuesRef.current = newValues;
|
|
99
|
-
}
|
|
100
|
-
function resizeListener() {
|
|
101
|
-
const oldInfo = responsiveValuesRef.current;
|
|
102
|
-
calculate();
|
|
103
|
-
if (oldInfo !== responsiveValuesRef.current) setResponsive(responsiveValuesRef.current);
|
|
104
|
-
}
|
|
90
|
+
const [responsive, setResponsive] = useState(() => calculateResponsive(tokens));
|
|
91
|
+
const current = objectKeys(DEFAULT_VALUES).find((key) => responsive[key] === true) || "xs";
|
|
92
|
+
useLayoutEffect(() => {
|
|
93
|
+
responsiveTokens = tokens;
|
|
105
94
|
window.addEventListener("resize", resizeListener);
|
|
95
|
+
const subscriber = () => {
|
|
96
|
+
setResponsive(responsiveValues);
|
|
97
|
+
};
|
|
98
|
+
SUBSCRIBER_SET.add(subscriber);
|
|
106
99
|
return () => {
|
|
107
|
-
|
|
100
|
+
SUBSCRIBER_SET.delete(subscriber);
|
|
101
|
+
if (!SUBSCRIBER_SET.size) window.removeEventListener("resize", resizeListener);
|
|
108
102
|
};
|
|
109
103
|
}, [tokens]);
|
|
110
104
|
return {
|
|
@@ -113,7 +107,17 @@ function useResponsive(options) {
|
|
|
113
107
|
breakPointTokens: tokens
|
|
114
108
|
};
|
|
115
109
|
}
|
|
116
|
-
|
|
110
|
+
function resizeListener() {
|
|
111
|
+
const newValues = calculateResponsive(responsiveTokens);
|
|
112
|
+
if (!isEqual(responsiveValues, newValues)) {
|
|
113
|
+
responsiveValues = newValues;
|
|
114
|
+
for (const subscriber of SUBSCRIBER_SET) subscriber();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function calculateResponsive(tokens) {
|
|
118
|
+
const config = arrayZipToObject(BREAK_POINTS, BREAK_POINTS.map((t) => tokens[stringToUpperCase(t)]));
|
|
119
|
+
return objectMapEntries(DEFAULT_VALUES, (key) => [key, window.innerWidth >= config[key]]);
|
|
120
|
+
}
|
|
117
121
|
//#endregion
|
|
118
122
|
//#region src/hooks/react/useUnmount.ts
|
|
119
123
|
/**
|
|
@@ -126,13 +130,12 @@ function useUnmount(effect) {
|
|
|
126
130
|
const effectRef = useLatest(effect);
|
|
127
131
|
useEffect(() => () => {
|
|
128
132
|
if (!isFunction(effectRef.current)) {
|
|
129
|
-
console.error(`useUnmount
|
|
133
|
+
console.error(`[useUnmount] Expected parameter to be a function, but got ${typeof effectRef.current}. This effect will not execute.`);
|
|
130
134
|
return;
|
|
131
135
|
}
|
|
132
136
|
effectRef.current?.();
|
|
133
137
|
}, [effectRef]);
|
|
134
138
|
}
|
|
135
|
-
|
|
136
139
|
//#endregion
|
|
137
140
|
//#region src/hooks/react/useTitle.ts
|
|
138
141
|
/**
|
|
@@ -148,7 +151,7 @@ function useTitle(title, options) {
|
|
|
148
151
|
const titleRef = useRef(isBrowser() ? document.title : "");
|
|
149
152
|
useEffect(() => {
|
|
150
153
|
if (!isString(title)) {
|
|
151
|
-
console.error(`useTitle
|
|
154
|
+
console.error(`[useTitle] Expected parameter to be a string, but got ${typeof title}. This effect will not execute.`);
|
|
152
155
|
return;
|
|
153
156
|
}
|
|
154
157
|
if (isBrowser()) document.title = title;
|
|
@@ -157,7 +160,7 @@ function useTitle(title, options) {
|
|
|
157
160
|
if (isBrowser() && options?.isRestoreOnUnmount) document.title = titleRef.current;
|
|
158
161
|
});
|
|
159
162
|
}
|
|
160
|
-
|
|
161
163
|
//#endregion
|
|
162
164
|
export { useCreation, useLatest, useMount, useResponsive, useTitle, useUnmount };
|
|
165
|
+
|
|
163
166
|
//# sourceMappingURL=hooks-react.js.map
|
package/dist/hooks-react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-react.js","names":[
|
|
1
|
+
{"version":3,"file":"hooks-react.js","names":[],"sources":["../src/hooks/react/useCreation.ts","../src/hooks/react/useLatest.ts","../src/hooks/react/useMount.ts","../src/hooks/react/useResponsive.ts","../src/hooks/react/useUnmount.ts","../src/hooks/react/useTitle.ts"],"sourcesContent":["import { useRef, type DependencyList } from \"react\";\nimport { isEqual } from \"../../utils\";\n\ninterface RefObject<T> {\n deps: DependencyList;\n result: T;\n isInitialized: boolean;\n}\n\n/**\n * useCreation\n * @reference https://ahooks.js.org/zh-CN/hooks/use-creation\n *\n * @param factory\n * @param deps\n */\nexport function useCreation<T> (factory: () => T, deps: DependencyList) {\n const { current } = useRef<RefObject<T>>({ deps, result: undefined!, isInitialized: false });\n\n if (current.isInitialized === false || !isEqual(current.deps, deps)) {\n current.deps = deps;\n current.result = factory();\n current.isInitialized = true;\n }\n\n return current.result;\n}\n","import { useRef, type RefObject } from \"react\";\n\n/**\n * 返回当前最新值的 Hook\n * @reference https://ahooks.js.org/zh-CN/hooks/use-latest\n *\n * @param value\n */\nexport function useLatest<T> (value: T): RefObject<T> {\n const ref = useRef(value);\n // eslint-disable-next-line react-x/refs\n ref.current = value;\n\n return ref;\n}\n","import { useEffect, useRef, type EffectCallback } from \"react\";\nimport { isFunction, isPromise } from \"../../utils\";\nimport { useLatest } from \"./useLatest\";\nimport type { AnyAsyncFunction } from \"@pawover/types\";\n\n/**\n * 在组件初始化时执行的 Hook\n * - 即使在严格模式(React StrictMode)也只执行一次\n * - 自动使用最新版 effect 函数\n *\n * @param effect 副作用函数(必须为同步函数;若为异步函数,清理逻辑需自行处理)\n * @example\n * useMount(() => {\n * console.log('组件挂载');\n * return () => console.log('组件卸载');\n * });\n *\n * useMount(async () => {\n * const data = await fetchData();\n * // 清理逻辑需通过 ref/AbortController 自行管理\n * // ❌ 不要 return cleanupFn(async 函数返回 Promise,无法作为清理函数)\n * });\n */\nexport function useMount (effect: EffectCallback | AnyAsyncFunction) {\n const isMountedRef = useRef(false);\n const effectRef = useLatest(effect);\n\n useEffect(() => {\n if (!isFunction(effectRef.current)) {\n console.error(`[useMount] Expected parameter to be a function, but got ${typeof effectRef.current}. This effect will not execute.`);\n\n return;\n }\n if (isMountedRef.current) {\n return;\n }\n\n isMountedRef.current = true;\n const cleanup = effectRef.current?.();\n\n return isFunction(cleanup) && !isPromise(cleanup) ? cleanup : undefined;\n }, [effectRef]);\n}\n","import type { AnyFunction } from \"@pawover/types\";\nimport { arrayZipToObject, objectAssign, objectKeys, stringToUpperCase, objectMapEntries, isEqual } from \"../../utils\";\nimport { useMemo, useState, useLayoutEffect } from \"react\";\nimport type { TupleToUnion } from \"type-fest\";\nimport { BREAK_POINT_TOKEN_ENUM, type BREAK_POINT_TOKEN_TYPE } from \"../../enums\";\n\ntype Breakpoint = TupleToUnion<typeof BREAK_POINTS>;\ntype ResponsiveValues = Record<Breakpoint, boolean>;\n\nconst SUBSCRIBER_SET = new Set<AnyFunction>();\nconst BREAK_POINTS = [\"xxxl\", \"xxl\", \"xl\", \"lg\", \"md\", \"sm\", \"xs\"] as const;\nconst DEFAULT_VALUES: ResponsiveValues = Object.freeze(arrayZipToObject(BREAK_POINTS, false));\nlet responsiveValues: ResponsiveValues = { ...DEFAULT_VALUES };\nlet responsiveTokens: BREAK_POINT_TOKEN_TYPE = BREAK_POINT_TOKEN_ENUM;\n\nexport interface ResponsiveHookOptions {\n /** 屏幕响应断点 token 配置 */\n breakPointTokens?: BREAK_POINT_TOKEN_TYPE;\n}\nexport function useResponsive (options?: ResponsiveHookOptions | undefined) {\n const { breakPointTokens = {} } = options || {};\n const tokens = useMemo(() => objectAssign(BREAK_POINT_TOKEN_ENUM, breakPointTokens), [breakPointTokens]);\n const [responsive, setResponsive] = useState<ResponsiveValues>(() => calculateResponsive(tokens));\n const current = objectKeys(DEFAULT_VALUES).find((key) => responsive[key] === true) || \"xs\";\n\n useLayoutEffect(() => {\n responsiveTokens = tokens;\n window.addEventListener(\"resize\", resizeListener);\n\n const subscriber = () => {\n setResponsive(responsiveValues);\n };\n\n SUBSCRIBER_SET.add(subscriber);\n\n return () => {\n SUBSCRIBER_SET.delete(subscriber);\n\n if (!SUBSCRIBER_SET.size) {\n window.removeEventListener(\"resize\", resizeListener);\n }\n };\n }, [tokens]);\n\n return { responsive, current, breakPointTokens: tokens };\n}\n\nfunction resizeListener () {\n const newValues = calculateResponsive(responsiveTokens);\n\n if (!isEqual(responsiveValues, newValues)) {\n responsiveValues = newValues;\n\n for (const subscriber of SUBSCRIBER_SET) {\n subscriber();\n }\n }\n}\n\nfunction calculateResponsive (tokens: BREAK_POINT_TOKEN_TYPE) {\n const config = arrayZipToObject(BREAK_POINTS, BREAK_POINTS.map((t) => tokens[stringToUpperCase(t)]));\n\n return objectMapEntries(DEFAULT_VALUES, (key) => [key, window.innerWidth >= config[key]]);\n}\n","import type { AnyFunction } from \"@pawover/types\";\nimport { useEffect } from \"react\";\nimport { isFunction } from \"../../utils\";\nimport { useLatest } from \"./useLatest\";\n\n/**\n * 在组件卸载时执行的 Hook\n * @reference https://ahooks.js.org/zh-CN/hooks/use-unmount\n *\n * @param effect 副作用函数\n */\nexport function useUnmount (effect: AnyFunction) {\n const effectRef = useLatest(effect);\n\n useEffect(\n () => () => {\n if (!isFunction(effectRef.current)) {\n console.error(`[useUnmount] Expected parameter to be a function, but got ${typeof effectRef.current}. This effect will not execute.`);\n\n return;\n }\n effectRef.current?.();\n },\n [effectRef],\n );\n}\n","import { useEffect, useRef } from \"react\";\nimport { isBrowser, isString } from \"../../utils\";\nimport { useUnmount } from \"./useUnmount\";\n\ninterface TitleHookOptions {\n /** 件卸载时是否恢复原始标题 */\n isRestoreOnUnmount?: boolean;\n}\n\n/**\n * 设置页面标题\n * - 轻量级,适用于无路由库时设置页面标题\n * - 多个 `useTitle` 实例会互相干扰,需在顶层组件使用\n * - 无法处理 `document.title` 固有的竞态问题\n *\n * @param title 页面标题\n * @param options 配置选项\n */\nexport function useTitle (title: string, options?: TitleHookOptions | undefined) {\n const titleRef = useRef(isBrowser() ? document.title : \"\");\n\n useEffect(() => {\n if (!isString(title)) {\n console.error(`[useTitle] Expected parameter to be a string, but got ${typeof title}. This effect will not execute.`);\n\n return;\n }\n if (isBrowser()) {\n document.title = title;\n }\n }, [title]);\n\n useUnmount(() => {\n if (isBrowser() && options?.isRestoreOnUnmount) {\n document.title = titleRef.current;\n }\n });\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,YAAgB,SAAkB,MAAsB;CACtE,MAAM,EAAE,YAAY,OAAqB;EAAE;EAAM,QAAQ,KAAA;EAAY,eAAe;EAAO,CAAC;AAE5F,KAAI,QAAQ,kBAAkB,SAAS,CAAC,QAAQ,QAAQ,MAAM,KAAK,EAAE;AACnE,UAAQ,OAAO;AACf,UAAQ,SAAS,SAAS;AAC1B,UAAQ,gBAAgB;;AAG1B,QAAO,QAAQ;;;;;;;;;;ACjBjB,SAAgB,UAAc,OAAwB;CACpD,MAAM,MAAM,OAAO,MAAM;AAEzB,KAAI,UAAU;AAEd,QAAO;;;;;;;;;;;;;;;;;;;;;;ACUT,SAAgB,SAAU,QAA2C;CACnE,MAAM,eAAe,OAAO,MAAM;CAClC,MAAM,YAAY,UAAU,OAAO;AAEnC,iBAAgB;AACd,MAAI,CAAC,WAAW,UAAU,QAAQ,EAAE;AAClC,WAAQ,MAAM,2DAA2D,OAAO,UAAU,QAAQ,iCAAiC;AAEnI;;AAEF,MAAI,aAAa,QACf;AAGF,eAAa,UAAU;EACvB,MAAM,UAAU,UAAU,WAAW;AAErC,SAAO,WAAW,QAAQ,IAAI,CAAC,UAAU,QAAQ,GAAG,UAAU,KAAA;IAC7D,CAAC,UAAU,CAAC;;;;AChCjB,MAAM,iCAAiB,IAAI,KAAkB;AAC7C,MAAM,eAAe;CAAC;CAAQ;CAAO;CAAM;CAAM;CAAM;CAAM;CAAK;AAClE,MAAM,iBAAmC,OAAO,OAAO,iBAAiB,cAAc,MAAM,CAAC;AAC7F,IAAI,mBAAqC,EAAE,GAAG,gBAAgB;AAC9D,IAAI,mBAA2C;AAM/C,SAAgB,cAAe,SAA6C;CAC1E,MAAM,EAAE,mBAAmB,EAAE,KAAK,WAAW,EAAE;CAC/C,MAAM,SAAS,cAAc,aAAa,wBAAwB,iBAAiB,EAAE,CAAC,iBAAiB,CAAC;CACxG,MAAM,CAAC,YAAY,iBAAiB,eAAiC,oBAAoB,OAAO,CAAC;CACjG,MAAM,UAAU,WAAW,eAAe,CAAC,MAAM,QAAQ,WAAW,SAAS,KAAK,IAAI;AAEtF,uBAAsB;AACpB,qBAAmB;AACnB,SAAO,iBAAiB,UAAU,eAAe;EAEjD,MAAM,mBAAmB;AACvB,iBAAc,iBAAiB;;AAGjC,iBAAe,IAAI,WAAW;AAE9B,eAAa;AACX,kBAAe,OAAO,WAAW;AAEjC,OAAI,CAAC,eAAe,KAClB,QAAO,oBAAoB,UAAU,eAAe;;IAGvD,CAAC,OAAO,CAAC;AAEZ,QAAO;EAAE;EAAY;EAAS,kBAAkB;EAAQ;;AAG1D,SAAS,iBAAkB;CACzB,MAAM,YAAY,oBAAoB,iBAAiB;AAEvD,KAAI,CAAC,QAAQ,kBAAkB,UAAU,EAAE;AACzC,qBAAmB;AAEnB,OAAK,MAAM,cAAc,eACvB,aAAY;;;AAKlB,SAAS,oBAAqB,QAAgC;CAC5D,MAAM,SAAS,iBAAiB,cAAc,aAAa,KAAK,MAAM,OAAO,kBAAkB,EAAE,EAAE,CAAC;AAEpG,QAAO,iBAAiB,iBAAiB,QAAQ,CAAC,KAAK,OAAO,cAAc,OAAO,KAAK,CAAC;;;;;;;;;;ACnD3F,SAAgB,WAAY,QAAqB;CAC/C,MAAM,YAAY,UAAU,OAAO;AAEnC,uBACc;AACV,MAAI,CAAC,WAAW,UAAU,QAAQ,EAAE;AAClC,WAAQ,MAAM,6DAA6D,OAAO,UAAU,QAAQ,iCAAiC;AAErI;;AAEF,YAAU,WAAW;IAEvB,CAAC,UAAU,CACZ;;;;;;;;;;;;;ACNH,SAAgB,SAAU,OAAe,SAAwC;CAC/E,MAAM,WAAW,OAAO,WAAW,GAAG,SAAS,QAAQ,GAAG;AAE1D,iBAAgB;AACd,MAAI,CAAC,SAAS,MAAM,EAAE;AACpB,WAAQ,MAAM,yDAAyD,OAAO,MAAM,iCAAiC;AAErH;;AAEF,MAAI,WAAW,CACb,UAAS,QAAQ;IAElB,CAAC,MAAM,CAAC;AAEX,kBAAiB;AACf,MAAI,WAAW,IAAI,SAAS,mBAC1B,UAAS,QAAQ,SAAS;GAE5B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region node_modules/.pnpm/@pawover+types@0.0.0-alpha._d6a4faea50420a71bc77e0a59520b8b6/node_modules/@pawover/types/dist/index.d.ts
|
|
2
|
-
|
|
3
2
|
//#endregion
|
|
4
3
|
//#region src/index.d.ts
|
|
5
4
|
/** 任意对象类型 */
|
|
@@ -13,9 +12,7 @@ type AnyFunction<P extends any[] = any[], R$1 = any> = (...arg: P) => R$1;
|
|
|
13
12
|
/** 描述异步函数类型 */
|
|
14
13
|
type AnyAsyncFunction<P extends any[] = any[], R$1 = any> = (...args: P) => Promise<R$1>;
|
|
15
14
|
type AnyGeneratorFunction<P extends any[] = any[], T = any, R$1 = any, N = any> = (...args: P) => Generator<T, R$1, N>;
|
|
16
|
-
type AnyAsyncGeneratorFunction<P extends any[] = any[], T = any, R$1 = any, N = any> = (...args: P) => AsyncGenerator<T, R$1, N>;
|
|
17
|
-
//#endregion
|
|
18
|
-
|
|
15
|
+
type AnyAsyncGeneratorFunction<P extends any[] = any[], T = any, R$1 = any, N = any> = (...args: P) => AsyncGenerator<T, R$1, N>; //#endregion
|
|
19
16
|
//#endregion
|
|
20
17
|
export { AnyObject as a, AnyGeneratorFunction as i, AnyAsyncGeneratorFunction as n, PlainObject as o, AnyFunction as r, TreeLike as s, AnyAsyncFunction as t };
|
|
21
|
-
//# sourceMappingURL=index-
|
|
18
|
+
//# sourceMappingURL=index-D0_YLsqN.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D0_YLsqN.d.ts","names":["Split","TupleToUnion","ALPHABET","Alphabet","ValidChar","ApiNameCheck","N","P","R","L","S","AdvancedRecordMode","AdvancedRecord","K","A","mode","PropertyKey","W","AnyObject","T","Record","PlainObject","TreeLike","CK","AnyFunction","R$1","arg","AnyAsyncFunction","Promise","args","AnyGeneratorFunction","Generator","AnyAsyncGeneratorFunction","AsyncGenerator"],"sources":["../node_modules/.pnpm/@pawover+types@0.0.0-alpha._d6a4faea50420a71bc77e0a59520b8b6/node_modules/@pawover/types/dist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;;;KA2BKkB,SAAAA,WAAoBF,WAAAA,GAAcA,WAAAA,aAAwBI,MAAAA,CAAOP,CAAAA,EAAGM,CAAAA;;KAEpEE,WAAAA,WAAsBL,WAAAA,GAAcA,WAAAA,iBAA4BI,MAAAA,CAAOP,CAAAA,EAAGM,CAAAA;;KAE1EG,QAAAA,WAAmBJ,SAAAA,oCAA6CC,CAAAA,GAAIC,MAAAA,CAAOG,EAAAA,EAAID,QAAAA,CAASH,CAAAA,EAAGI,EAAAA;;KAE3FC,WAAAA,2CAAsDE,GAAAA,EAAKnB,CAAAA,KAAMkB,GAAAA;;KAEjEE,gBAAAA,2CAA2DE,IAAAA,EAAMtB,CAAAA,KAAMqB,OAAAA,CAAQH,GAAAA;AAAAA,KAC/EK,oBAAAA,6DAAiFD,IAAAA,EAAMtB,CAAAA,KAAMwB,SAAAA,CAAUZ,CAAAA,EAAGM,GAAAA,EAAKnB,CAAAA;AAAAA,KAC/G0B,yBAAAA,6DAAsFH,IAAAA,EAAMtB,CAAAA,KAAM0B,cAAAA,CAAed,CAAAA,EAAGM,GAAAA,EAAKnB,CAAAA"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { t as ValueOf } from "./value-of-Dz22arsm.js";
|
|
2
|
+
|
|
3
|
+
//#region src/enums/date.d.ts
|
|
4
|
+
declare const DATE_FORMAT: {
|
|
5
|
+
readonly ISO_DATE: "yyyy-MM-dd";
|
|
6
|
+
readonly ISO_TIME: "HH:mm:ss";
|
|
7
|
+
readonly ISO_DATE_TIME: "yyyy-MM-dd HH:mm:ss";
|
|
8
|
+
readonly ISO_DATE_TIME_MS: "yyyy-MM-dd HH:mm:ss.SSS";
|
|
9
|
+
readonly ISO_DATETIME_TZ: "yyyy-MM-dd'T'HH:mm:ssXXX";
|
|
10
|
+
readonly ISO_DATETIME_TZ_MS: "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
|
11
|
+
readonly US_DATE: "MM/dd/yyyy";
|
|
12
|
+
readonly US_DATE_TIME: "MM/dd/yyyy HH:mm:ss";
|
|
13
|
+
readonly US_DATE_SHORT_YEAR: "MM/dd/yy";
|
|
14
|
+
readonly EU_DATE: "dd/MM/yyyy";
|
|
15
|
+
readonly EU_DATE_TIME: "dd/MM/yyyy HH:mm:ss";
|
|
16
|
+
readonly CN_DATE: "yyyy年MM月dd日";
|
|
17
|
+
readonly CN_DATE_TIME: "yyyy年MM月dd日 HH时mm分ss秒";
|
|
18
|
+
readonly CN_DATE_WEEKDAY: "yyyy年MM月dd日 EEE";
|
|
19
|
+
readonly CN_WEEKDAY_FULL: "EEEE";
|
|
20
|
+
readonly SHORT_DATE: "yy-MM-dd";
|
|
21
|
+
readonly SHORT_DATE_SLASH: "yy/MM/dd";
|
|
22
|
+
readonly MONTH_DAY: "MM-dd";
|
|
23
|
+
readonly MONTH_DAY_CN: "MM月dd日";
|
|
24
|
+
readonly DATE_WITH_WEEKDAY_SHORT: "yyyy-MM-dd (EEE)";
|
|
25
|
+
readonly DATE_WITH_WEEKDAY_FULL: "yyyy-MM-dd (EEEE)";
|
|
26
|
+
readonly TIME_24: "HH:mm:ss";
|
|
27
|
+
readonly TIME_24_NO_SEC: "HH:mm";
|
|
28
|
+
readonly TIME_12: "hh:mm:ss a";
|
|
29
|
+
readonly TIME_12_NO_SEC: "hh:mm a";
|
|
30
|
+
readonly TIMESTAMP: "yyyyMMddHHmmss";
|
|
31
|
+
readonly TIMESTAMP_MS: "yyyyMMddHHmmssSSS";
|
|
32
|
+
readonly RFC2822: "EEE, dd MMM yyyy HH:mm:ss xxx";
|
|
33
|
+
readonly READABLE_DATE: "MMM dd, yyyy";
|
|
34
|
+
readonly READABLE_DATE_TIME: "MMM dd, yyyy HH:mm";
|
|
35
|
+
readonly COMPACT_DATETIME: "yyyyMMdd_HHmmss";
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/enums/grid.d.ts
|
|
39
|
+
type BREAK_POINT_TOKEN_TYPE = Record<keyof typeof BREAK_POINT_TOKEN_ENUM, number>;
|
|
40
|
+
/** 屏幕响应断点 token 配置 */
|
|
41
|
+
declare const BREAK_POINT_TOKEN_ENUM: {
|
|
42
|
+
readonly XS: 480;
|
|
43
|
+
readonly XSMax: 575;
|
|
44
|
+
readonly XSMin: 480;
|
|
45
|
+
readonly SM: 576;
|
|
46
|
+
readonly SMMax: 767;
|
|
47
|
+
readonly SMMin: 576;
|
|
48
|
+
readonly MD: 768;
|
|
49
|
+
readonly MDMax: 991;
|
|
50
|
+
readonly MDMin: 768;
|
|
51
|
+
readonly LG: 992;
|
|
52
|
+
readonly LGMax: 1199;
|
|
53
|
+
readonly LGMin: 992;
|
|
54
|
+
readonly XL: 1200;
|
|
55
|
+
readonly XLMax: 1599;
|
|
56
|
+
readonly XLMin: 1200;
|
|
57
|
+
readonly XXL: 1600;
|
|
58
|
+
readonly XXLMax: 1919;
|
|
59
|
+
readonly XXLMin: 1600;
|
|
60
|
+
readonly XXXL: 1920;
|
|
61
|
+
readonly XXXLMin: 1920;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/enums/mime.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* 标准 MIME 类型常量,用于文件类型标识和 HTTP Content-Type 头部
|
|
67
|
+
* 基于 IANA 注册标准和浏览器兼容性验证
|
|
68
|
+
*/
|
|
69
|
+
declare const MIME: {
|
|
70
|
+
/** 普通文本文件 */readonly TEXT: "text/plain"; /** 超文本标记语言文档 */
|
|
71
|
+
readonly HTML: "text/html"; /** 层叠样式表文件 */
|
|
72
|
+
readonly CSS: "text/css"; /** 逗号分隔值文件(表格数据) */
|
|
73
|
+
readonly CSV: "text/csv"; /** 制表符分隔值文件 */
|
|
74
|
+
readonly TSV: "text/tab-separated-values"; /** XML 文档 */
|
|
75
|
+
readonly XML: "text/xml"; /** XHTML 文档(XML 严格格式的 HTML) */
|
|
76
|
+
readonly XHTML: "application/xhtml+xml"; /** JavaScript 脚本文件(标准推荐) */
|
|
77
|
+
readonly JS: "text/javascript"; /** Markdown 格式文档 */
|
|
78
|
+
readonly MARKDOWN: "text/markdown"; /** 富文本格式文档(.rtf) */
|
|
79
|
+
readonly RTF: "application/rtf"; /** iCalendar 日历格式(.ics) */
|
|
80
|
+
readonly CALENDAR: "text/calendar"; /** JPEG 图像(.jpg/.jpeg) */
|
|
81
|
+
readonly JPEG: "image/jpeg"; /** PNG 图像(无损压缩,支持透明) */
|
|
82
|
+
readonly PNG: "image/png"; /** GIF 图像(支持动画) */
|
|
83
|
+
readonly GIF: "image/gif"; /** Windows 位图(.bmp) */
|
|
84
|
+
readonly BMP: "image/bmp"; /** SVG 向量图形(.svg) */
|
|
85
|
+
readonly SVG: "image/svg+xml"; /** APNG 动态图像(.apng) */
|
|
86
|
+
readonly APNG: "image/apng"; /** AVIF 图像(高效压缩) */
|
|
87
|
+
readonly AVIF: "image/avif"; /** 图标文件格式(.ico) */
|
|
88
|
+
readonly ICO: "image/vnd.microsoft.icon"; /** WebP 图像(高效压缩) */
|
|
89
|
+
readonly WEBP: "image/webp"; /** MP3 音频(.mp3) */
|
|
90
|
+
readonly MP3: "audio/mpeg"; /** AAC 音频(.aac) */
|
|
91
|
+
readonly AAC: "audio/aac"; /** MIDI 音乐文件(.mid/.midi) */
|
|
92
|
+
readonly MIDI: "audio/midi"; /** OGG 音频(.oga) */
|
|
93
|
+
readonly OGG_AUDIO: "audio/ogg"; /** Opus 音频(.opus) */
|
|
94
|
+
readonly OPUS: "audio/opus"; /** WAV 音频(.wav) */
|
|
95
|
+
readonly WAV: "audio/wav"; /** RealAudio 音频(.ra/.ram) */
|
|
96
|
+
readonly REAL_AUDIO: "audio/x-pn-realaudio"; /** MP4 视频(.mp4) */
|
|
97
|
+
readonly MP4: "video/mp4"; /** MPEG 视频(.mpeg/.mpg) */
|
|
98
|
+
readonly MPEG: "video/mpeg"; /** OGG 视频(.ogv) */
|
|
99
|
+
readonly OGG_VIDEO: "video/ogg"; /** AVI 视频(.avi) */
|
|
100
|
+
readonly AVI: "video/x-msvideo"; /** 3GPP 视频(.3gp) */
|
|
101
|
+
readonly THREE_GPP: "video/3gpp"; /** 3GPP2 视频(.3g2) */
|
|
102
|
+
readonly THREE_GPP2: "video/3gpp2"; /** WebM 视频(.webm) */
|
|
103
|
+
readonly WEBM: "video/webm"; /** PDF 文档 */
|
|
104
|
+
readonly PDF: "application/pdf"; /** Word 97-2003 文档(.doc) */
|
|
105
|
+
readonly DOC: "application/msword"; /** Word 2007+ 文档(.docx) */
|
|
106
|
+
readonly DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; /** Excel 2007+ 工作簿(.xlsx) */
|
|
107
|
+
readonly XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; /** 启用宏的Excel工作簿(.xlsm) */
|
|
108
|
+
readonly XLSM: "application/vnd.ms-excel.sheet.macroEnabled.12"; /** Excel模板文件(.xltx) */
|
|
109
|
+
readonly XLTX: "application/vnd.openxmlformats-officedocument.spreadsheetml.template"; /** PowerPoint 2007+ 演示文稿(.pptx) */
|
|
110
|
+
readonly PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation"; /** PowerPoint 97-2003 演示文稿(.ppt) */
|
|
111
|
+
readonly PPT: "application/vnd.ms-powerpoint"; /** OpenDocument 文本文档(.odt) */
|
|
112
|
+
readonly ODT: "application/vnd.oasis.opendocument.text"; /** OpenDocument 表格文档(.ods) */
|
|
113
|
+
readonly ODS: "application/vnd.oasis.opendocument.spreadsheet"; /** OpenDocument 演示文稿(.odp) */
|
|
114
|
+
readonly ODP: "application/vnd.oasis.opendocument.presentation"; /** EPUB 电子书(.epub) */
|
|
115
|
+
readonly EPUB: "application/epub+zip"; /** Kindle 电子书(.azw) */
|
|
116
|
+
readonly AZW: "application/vnd.amazon.ebook"; /** ZIP 压缩文件(.zip) */
|
|
117
|
+
readonly ZIP: "application/zip"; /** GZIP 压缩文件(.gz) */
|
|
118
|
+
readonly GZIP: "application/gzip"; /** GZIP 压缩文件(旧格式) */
|
|
119
|
+
readonly X_GZIP: "application/x-gzip"; /** TAR 归档文件(.tar) */
|
|
120
|
+
readonly TAR: "application/x-tar"; /** BZip 归档(.bz) */
|
|
121
|
+
readonly BZIP: "application/x-bzip"; /** BZip2 归档(.bz2) */
|
|
122
|
+
readonly BZIP2: "application/x-bzip2"; /** 7-Zip 压缩文件(.7z) */
|
|
123
|
+
readonly SEVEN_Z: "application/x-7z-compressed"; /** 通用二进制数据(默认类型) */
|
|
124
|
+
readonly OCTET_STREAM: "application/octet-stream"; /** JSON 数据格式(.json) */
|
|
125
|
+
readonly JSON: "application/json"; /** JSON-LD 格式(.jsonld) */
|
|
126
|
+
readonly LD_JSON: "application/ld+json"; /** Java 归档文件(.jar) */
|
|
127
|
+
readonly JAR: "application/java-archive"; /** MS 嵌入式 OpenType 字体(.eot) */
|
|
128
|
+
readonly EOT: "application/vnd.ms-fontobject"; /** OpenType 字体(.otf) */
|
|
129
|
+
readonly OTF: "font/otf"; /** Excel 97-2003 工作簿(.xls) */
|
|
130
|
+
readonly XLS: "application/vnd.ms-excel"; /** Microsoft XPS 文档(.xps) */
|
|
131
|
+
readonly XPS: "application/vnd.ms-xpsdocument"; /** Word 启用宏文档(.docm) */
|
|
132
|
+
readonly DOCM: "application/vnd.ms-word.document.macroEnabled.12";
|
|
133
|
+
};
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/enums/theme.d.ts
|
|
136
|
+
type THEME_TYPE = ValueOf<typeof THEME_ENUM>;
|
|
137
|
+
declare const THEME_ENUM: {
|
|
138
|
+
readonly LIGHT: "light";
|
|
139
|
+
readonly DARK: "dark";
|
|
140
|
+
};
|
|
141
|
+
type THEME_MODE_TYPE = ValueOf<typeof THEME_MODE_ENUM>;
|
|
142
|
+
declare const THEME_MODE_ENUM: {
|
|
143
|
+
readonly LIGHT: "light";
|
|
144
|
+
readonly DARK: "dark";
|
|
145
|
+
readonly SYSTEM: "system";
|
|
146
|
+
};
|
|
147
|
+
//#endregion
|
|
148
|
+
export { MIME as a, DATE_FORMAT as c, THEME_TYPE as i, THEME_MODE_ENUM as n, BREAK_POINT_TOKEN_ENUM as o, THEME_MODE_TYPE as r, BREAK_POINT_TOKEN_TYPE as s, THEME_ENUM as t };
|
|
149
|
+
//# sourceMappingURL=index-JKtXbRi8.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-JKtXbRi8.d.ts","names":[],"sources":["../src/enums/date.ts","../src/enums/grid.ts","../src/enums/mime.ts","../src/enums/theme.ts"],"mappings":";;;cAAa,WAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCAD,sBAAA,GAAyB,MAAA,cAAoB,sBAAA;;cAE5C,sBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ADFb;cEIa,IAAA;;;;;;;;;;;;;;;;;;;4CDJD;EAAA;8BAAmE;EAAA,2BA6BrE;EAAA,6BAAA;EAAA;;;;;;;;;;;;sCCzBG;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCFD,UAAA,GAAa,OAAA,QAAe,UAAA;AAAA,cAC3B,UAAA;EAAA,SAGH,KAAA;EAAA,SAAA,IAAA;AAAA;AAAA,KAEE,eAAA,GAAkB,OAAA,QAAe,eAAA;AAAA,cAChC,eAAA;EAAA"}
|