@pawover/kit 0.0.0-alpha.2 → 0.0.0-alpha.20

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 (57) hide show
  1. package/dist/enums.d.ts +24 -0
  2. package/dist/enums.js +24 -0
  3. package/dist/hooks-alova.d.ts +22 -0
  4. package/dist/hooks-alova.js +38 -0
  5. package/dist/hooks-react.d.ts +87 -0
  6. package/dist/hooks-react.js +295 -0
  7. package/dist/index.d.ts +382 -0
  8. package/dist/index.js +1123 -2
  9. package/dist/vite.d.ts +12 -0
  10. package/dist/vite.js +21 -0
  11. package/dist/zod.d.ts +104 -0
  12. package/dist/zod.js +137 -0
  13. package/metadata.json +139 -0
  14. package/package.json +46 -42
  15. package/dist/enums/index.js +0 -20
  16. package/dist/hooks/react/index.js +0 -5
  17. package/dist/hooks/react/useCreation.js +0 -11
  18. package/dist/hooks/react/useLatest.js +0 -6
  19. package/dist/hooks/react/useMount.js +0 -29
  20. package/dist/hooks/react/useResponsive.js +0 -59
  21. package/dist/hooks/react/useUnmount.js +0 -17
  22. package/dist/types/enums/index.d.ts +0 -20
  23. package/dist/types/hooks/react/index.d.ts +0 -5
  24. package/dist/types/hooks/react/useCreation.d.ts +0 -2
  25. package/dist/types/hooks/react/useLatest.d.ts +0 -1
  26. package/dist/types/hooks/react/useMount.d.ts +0 -11
  27. package/dist/types/hooks/react/useResponsive.d.ts +0 -16
  28. package/dist/types/hooks/react/useUnmount.d.ts +0 -6
  29. package/dist/types/index.d.ts +0 -2
  30. package/dist/types/utils/array.d.ts +0 -76
  31. package/dist/types/utils/index.d.ts +0 -6
  32. package/dist/types/utils/object.d.ts +0 -53
  33. package/dist/types/utils/string.d.ts +0 -13
  34. package/dist/types/utils/to.d.ts +0 -5
  35. package/dist/types/utils/tree/index.d.ts +0 -6
  36. package/dist/types/utils/tree/rowsToTree.d.ts +0 -10
  37. package/dist/types/utils/tree/treeFilter.d.ts +0 -6
  38. package/dist/types/utils/tree/treeFind.d.ts +0 -8
  39. package/dist/types/utils/tree/treeForEach.d.ts +0 -5
  40. package/dist/types/utils/tree/treeMap.d.ts +0 -6
  41. package/dist/types/utils/tree/treeToRows.d.ts +0 -9
  42. package/dist/types/utils/tree/types.d.ts +0 -24
  43. package/dist/types/utils/typeof.d.ts +0 -29
  44. package/dist/utils/array.js +0 -196
  45. package/dist/utils/index.js +0 -6
  46. package/dist/utils/object.js +0 -138
  47. package/dist/utils/string.js +0 -70
  48. package/dist/utils/to.js +0 -16
  49. package/dist/utils/tree/index.js +0 -6
  50. package/dist/utils/tree/rowsToTree.js +0 -35
  51. package/dist/utils/tree/treeFilter.js +0 -92
  52. package/dist/utils/tree/treeFind.js +0 -82
  53. package/dist/utils/tree/treeForEach.js +0 -60
  54. package/dist/utils/tree/treeMap.js +0 -79
  55. package/dist/utils/tree/treeToRows.js +0 -13
  56. package/dist/utils/tree/types.js +0 -10
  57. package/dist/utils/typeof.js +0 -114
package/dist/vite.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { ProxyOptions } from "vite";
2
+
3
+ //#region src/vite/proxy.d.ts
4
+
5
+ /**
6
+ * 开发服务器反向代理配置
7
+ *
8
+ * @param proxyList 代理配置项
9
+ */
10
+ declare function resolveViteProxy<L extends [string, string][]>(proxyList: L): Record<string, ProxyOptions>;
11
+ //#endregion
12
+ export { resolveViteProxy };
package/dist/vite.js ADDED
@@ -0,0 +1,21 @@
1
+ //#region src/vite/proxy.ts
2
+ /**
3
+ * 开发服务器反向代理配置
4
+ *
5
+ * @param proxyList 代理配置项
6
+ */
7
+ function resolveViteProxy(proxyList) {
8
+ const httpsRE = /^https:\/\//;
9
+ const result = {};
10
+ if (typeof proxyList === "object") for (const [prefix, target] of proxyList) result[prefix] = {
11
+ target,
12
+ changeOrigin: true,
13
+ ws: true,
14
+ rewrite: (path) => path.replace(/* @__PURE__ */ new RegExp(`^${prefix}`), ""),
15
+ ...httpsRE.test(target) ? { secure: false } : {}
16
+ };
17
+ return result;
18
+ }
19
+
20
+ //#endregion
21
+ export { resolveViteProxy };
package/dist/zod.d.ts ADDED
@@ -0,0 +1,104 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/zod/primitive.d.ts
4
+ /** 空 */
5
+ declare const empty: z.ZodUnion<readonly [z.ZodNull, z.ZodUndefined]>;
6
+ /** 字符串 */
7
+ declare const string: z.ZodString;
8
+ /** 字符串-空 */
9
+ declare const stringEmpty: z.ZodOptional<z.ZodNullable<z.ZodLiteral<"">>>;
10
+ /** 字符串-非空 */
11
+ declare const stringNoEmpty: z.ZodString;
12
+ /** 字符串-可空 */
13
+ declare const stringAllowEmpty: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ /** 数字 */
15
+ declare const number: z.ZodNumber;
16
+ /** 数字-可空 */
17
+ declare const numberAllowEmpty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
18
+ /** 整数 */
19
+ declare const int: z.ZodNumber;
20
+ /** 整数-可空 */
21
+ declare const intAllowEmpty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
22
+ /** 自然数 */
23
+ declare const natural: z.ZodNumber;
24
+ /** 自然数-可空 */
25
+ declare const naturalAllowEmpty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
26
+ /** 布尔值 */
27
+ declare const boolean: z.ZodBoolean;
28
+ /** 布尔值-可空 */
29
+ declare const booleanAllowEmpty: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
30
+ declare const bigint: z.ZodBigInt;
31
+ declare const symbol: z.ZodSymbol;
32
+ declare const any: z.ZodAny;
33
+ declare const unknown: z.ZodUnknown;
34
+ declare const never: z.ZodNever;
35
+ //#endregion
36
+ //#region src/zod/validator/input.d.ts
37
+ /** 字母 */
38
+ declare const alphabet: z.ZodString;
39
+ /** 小写字母 */
40
+ declare const alphabetLowercase: z.ZodString;
41
+ /** 大写字母 */
42
+ declare const alphabetUppercase: z.ZodString;
43
+ /** 不包含字母 */
44
+ declare const alphabetOmit: z.ZodString;
45
+ /** 数字和字母 */
46
+ declare const numberAlphabet: z.ZodString;
47
+ /** 有符号十进制浮点数字符串 */
48
+ declare const stringSignedDecimalismFloat: z.ZodString;
49
+ /** 无符号十进制浮点数字符串 */
50
+ declare const stringUnsignedDecimalismFloat: z.ZodString;
51
+ /** 有符号十进制整数字符串 */
52
+ declare const stringSignedDecimalismInt: z.ZodString;
53
+ /** 无符号十进制整数字符串 */
54
+ declare const stringUnsignedDecimalismInt: z.ZodString;
55
+ /** 包含空格 */
56
+ declare const spaceInclude: z.ZodString;
57
+ /** 首空格 */
58
+ declare const spaceStart: z.ZodString;
59
+ /** 尾空格 */
60
+ declare const spaceEnd: z.ZodString;
61
+ /** 首尾空格 */
62
+ declare const spaceStartEnd: z.ZodIntersection<z.ZodString, z.ZodString>;
63
+ //#endregion
64
+ //#region src/zod/validator/societal.d.ts
65
+ /** 手机号码 */
66
+ declare const phone: z.ZodString;
67
+ /** 固定电话 */
68
+ declare const telephone: z.ZodString;
69
+ /** 电子邮箱 */
70
+ declare const email: z.ZodString;
71
+ /** 中文姓名 */
72
+ declare const chineseName: z.ZodString;
73
+ /** 手机机身码 */
74
+ declare const IMEI: z.ZodString;
75
+ /** 身份证号 */
76
+ declare const ID: z.ZodString;
77
+ /** 链接 */
78
+ declare const link: z.ZodString;
79
+ /** 端口号网址 */
80
+ declare const linkPort: z.ZodString;
81
+ /** 统一社会信用代码 */
82
+ declare const USCC_S: z.ZodString;
83
+ /** 统一社会信用代码 - 15位/18位/20位数字/字母 */
84
+ declare const USCC: z.ZodString;
85
+ /** 迅雷链接 */
86
+ declare const thunder: z.ZodString;
87
+ /** windows 文件夹路径 */
88
+ declare const dirPathWindows: z.ZodString;
89
+ /** windows 文件路径 */
90
+ declare const filePathWindows: z.ZodString;
91
+ /** linux 文件夹路径 */
92
+ declare const dirPathLinux: z.ZodString;
93
+ /** linux 文件路径 */
94
+ declare const filePathLinux: z.ZodString;
95
+ /** 车牌号 新能源 */
96
+ declare const carCodeGreen: z.ZodString;
97
+ /** 车牌号 非新能源 */
98
+ declare const carCodeNotGreen: z.ZodString;
99
+ /** 中国省份 */
100
+ declare const chinaProvince: z.ZodString;
101
+ /** 民族 */
102
+ declare const nation: z.ZodString;
103
+ //#endregion
104
+ export { ID, IMEI, USCC, USCC_S, alphabet, alphabetLowercase, alphabetOmit, alphabetUppercase, any, bigint, boolean, booleanAllowEmpty, carCodeGreen, carCodeNotGreen, chinaProvince, chineseName, dirPathLinux, dirPathWindows, email, empty, filePathLinux, filePathWindows, int, intAllowEmpty, link, linkPort, nation, natural, naturalAllowEmpty, never, number, numberAllowEmpty, numberAlphabet, phone, spaceEnd, spaceInclude, spaceStart, spaceStartEnd, string, stringAllowEmpty, stringEmpty, stringNoEmpty, stringSignedDecimalismFloat, stringSignedDecimalismInt, stringUnsignedDecimalismFloat, stringUnsignedDecimalismInt, symbol, telephone, thunder, unknown };
package/dist/zod.js ADDED
@@ -0,0 +1,137 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/zod/primitive.ts
4
+ /** 空 */
5
+ const empty = z.union([z.null(), z.undefined()]);
6
+ /** 字符串 */
7
+ const string = z.string();
8
+ /** 字符串-空 */
9
+ const stringEmpty = z.literal("").nullish();
10
+ /** 字符串-非空 */
11
+ const stringNoEmpty = z.string().min(1);
12
+ /** 字符串-可空 */
13
+ const stringAllowEmpty = z.string().nullish();
14
+ /** 数字 */
15
+ const number = z.number();
16
+ /** 数字-可空 */
17
+ const numberAllowEmpty = number.nullish();
18
+ /** 整数 */
19
+ const int = z.number().int({ error: "应为整数" });
20
+ /** 整数-可空 */
21
+ const intAllowEmpty = int.nullish();
22
+ /** 自然数 */
23
+ const natural = int.nonnegative({ error: "应为非负数" });
24
+ /** 自然数-可空 */
25
+ const naturalAllowEmpty = natural.nullish();
26
+ /** 布尔值 */
27
+ const boolean = z.boolean();
28
+ /** 布尔值-可空 */
29
+ const booleanAllowEmpty = z.boolean().nullish();
30
+ const bigint = z.bigint();
31
+ const symbol = z.symbol();
32
+ const any = z.any();
33
+ const unknown = z.unknown();
34
+ const never = z.never();
35
+
36
+ //#endregion
37
+ //#region src/zod/validator/input.ts
38
+ const _alphabet = /^[a-z]+$/i;
39
+ /** 字母 */
40
+ const alphabet = z.string().regex(_alphabet, { error: "应为字母" });
41
+ const _alphabetLowercase = /^[a-z]+$/;
42
+ /** 小写字母 */
43
+ const alphabetLowercase = z.string().regex(_alphabetLowercase, { error: "应为小写字母" });
44
+ const _alphabetUppercase = /^[A-Z]+$/;
45
+ /** 大写字母 */
46
+ const alphabetUppercase = z.string().regex(_alphabetUppercase, { error: "应为大写字母" });
47
+ const _alphabetOmit = /^[^A-Z]*$/i;
48
+ /** 不包含字母 */
49
+ const alphabetOmit = z.string().regex(_alphabetOmit, { error: "应不包含字母" });
50
+ const _numberAlphabet = /^[A-Z0-9]+$/i;
51
+ /** 数字和字母 */
52
+ const numberAlphabet = z.string().regex(_numberAlphabet, { error: "应为数字和字母组合" });
53
+ const _stringSignedDecimalismFloat = /^[+-]?(\d+(\.\d+)?|\.\d+)$/;
54
+ /** 有符号十进制浮点数字符串 */
55
+ const stringSignedDecimalismFloat = z.string().regex(_stringSignedDecimalismFloat, { error: "应为十进制数字" });
56
+ const _stringUnsignedDecimalismFloat = /^\+?(\d+(\.\d+)?|\.\d+)$/;
57
+ /** 无符号十进制浮点数字符串 */
58
+ const stringUnsignedDecimalismFloat = z.string().regex(_stringUnsignedDecimalismFloat, { error: "应为十进制正数" });
59
+ const _stringSignedDecimalismInt = /^[+-]?\d+$/;
60
+ /** 有符号十进制整数字符串 */
61
+ const stringSignedDecimalismInt = z.string().regex(_stringSignedDecimalismInt, { error: "应为十进制整数" });
62
+ const _stringUnsignedDecimalismInt = /^\+?\d+$/;
63
+ /** 无符号十进制整数字符串 */
64
+ const stringUnsignedDecimalismInt = z.string().regex(_stringUnsignedDecimalismInt, { error: "应为十进制正整数" });
65
+ const _spaceInclude = /^[^ ]+$/;
66
+ /** 包含空格 */
67
+ const spaceInclude = z.string().regex(_spaceInclude, { error: "应不包含空格" });
68
+ const _spaceStart = /^\S/g;
69
+ /** 首空格 */
70
+ const spaceStart = z.string().regex(_spaceStart, { error: "应不包含首空格" });
71
+ const _spaceEnd = /\s$/g;
72
+ /** 尾空格 */
73
+ const spaceEnd = z.string().regex(_spaceEnd, { error: "应不包含尾空格" });
74
+ /** 首尾空格 */
75
+ const spaceStartEnd = spaceStart.and(spaceEnd);
76
+
77
+ //#endregion
78
+ //#region src/zod/validator/societal.ts
79
+ const _phone = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
80
+ /** 手机号码 */
81
+ const phone = z.string().regex(_phone, { error: "手机号码格式错误" });
82
+ const _telephone = /0\d{2,3}-\d{7,9}$/;
83
+ /** 固定电话 */
84
+ const telephone = z.string().regex(_telephone, { error: "电话号码格式错误" });
85
+ const _email = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-0-9]+\.)+[a-z]{2,}))$/i;
86
+ /** 电子邮箱 */
87
+ const email = z.string().regex(_email, { error: "电子邮箱格式错误" });
88
+ const _chineseName = /^[一-龢][一·-龢]*$/;
89
+ /** 中文姓名 */
90
+ const chineseName = z.string().regex(_chineseName, { error: "应为中文姓名" });
91
+ /** 手机机身码 */
92
+ const IMEI = z.string().regex(/^\d{15,17}$/, { error: "手机机身码格式错误" });
93
+ const _ID = /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))([\dX])$/i;
94
+ /** 身份证号 */
95
+ const ID = z.string().regex(_ID, { error: "身份证号格式错误" });
96
+ const _link = /^(((ht|f)tps?):\/\/)?(([\w-]+(\.[\w-]+)*\.[a-z]{2,6})|((\d{1,3}\.){3}\d{1,3}))(:\d+)?(\/\S*)?$/;
97
+ /** 链接 */
98
+ const link = z.string().regex(_link, { error: "链接格式错误" });
99
+ const _linkPort = /^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/;
100
+ /** 端口号网址 */
101
+ const linkPort = z.string().regex(_linkPort, { error: "网址格式错误" });
102
+ const _USCC_S = /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/;
103
+ /** 统一社会信用代码 */
104
+ const USCC_S = z.string().regex(_USCC_S, { error: "统一社会信用代码格式错误" });
105
+ const _USCC = /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/;
106
+ /** 统一社会信用代码 - 15位/18位/20位数字/字母 */
107
+ const USCC = z.string().regex(_USCC, { error: "统一社会信用代码格式错误" });
108
+ const _thunder = /^thunderx?:\/\/[a-zA-Z\d]+=$/;
109
+ /** 迅雷链接 */
110
+ const thunder = z.string().regex(_thunder, { error: "迅雷链接格式错误" });
111
+ const _dirPathWindows = /^[a-z]:\\(?:\w+\\?)*$/i;
112
+ /** windows 文件夹路径 */
113
+ const dirPathWindows = z.string().regex(_dirPathWindows, { error: "路径格式错误" });
114
+ const _filePathWindows = /^[a-z]:\\(?:\w+\\)*\w+\.\w+$/i;
115
+ /** windows 文件路径 */
116
+ const filePathWindows = z.string().regex(_filePathWindows, { error: "路径格式错误" });
117
+ const _dirPathLinux = /^\/(?:[^\\/\s]+\/)*$/;
118
+ /** linux 文件夹路径 */
119
+ const dirPathLinux = z.string().regex(_dirPathLinux, { error: "路径格式错误" });
120
+ const _filePathLinux = /^(\/$|\/(?:[^\\/\s]+\/)*[^\\/\s]+$)/;
121
+ /** linux 文件路径 */
122
+ const filePathLinux = z.string().regex(_filePathLinux, { error: "路径格式错误" });
123
+ const _carCodeGreen = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))\d{4})|(\d{5}[DF]))$/;
124
+ /** 车牌号 新能源 */
125
+ const carCodeGreen = z.string().regex(_carCodeGreen, { error: "车牌号格式错误" });
126
+ const _carCodeNotGreen = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/;
127
+ /** 车牌号 非新能源 */
128
+ const carCodeNotGreen = z.string().regex(_carCodeNotGreen, { error: "车牌号格式错误" });
129
+ const _chinaProvince = /^安徽|澳门|北京|重庆|福建|甘肃|广东|广西|贵州|海南|河北|河南|黑龙江|湖北|湖南|吉林|江苏|江西|辽宁|内蒙古|宁夏|青海|山东|山西|陕西|上海|四川|台湾|天津|西藏|香港|新疆|云南|浙江$/;
130
+ /** 中国省份 */
131
+ const chinaProvince = z.string().regex(_chinaProvince, { error: "应为中国省份" });
132
+ const _nation = /^汉族|蒙古族|回族|藏族|维吾尔族|苗族|彝族|壮族|布依族|朝鲜族|满族|侗族|瑶族|白族|土家族|哈尼族|哈萨克族|傣族|黎族|傈僳族|佤族|畲族|高山族|拉祜族|水族|东乡族|纳西族|景颇族|柯尔克孜族|土族|达斡尔族|仫佬族|羌族|布朗族|撒拉族|毛南族|仡佬族|锡伯族|阿昌族|普米族|塔吉克族|怒族|乌孜别克族|俄罗斯族|鄂温克族|德昂族|保安族|裕固族|京族|塔塔尔族|独龙族|鄂伦春族|赫哲族|门巴族|珞巴族|基诺族|其它未识别民族|外国人入中国籍$/;
133
+ /** 民族 */
134
+ const nation = z.string().regex(_nation, { error: "应为民族" });
135
+
136
+ //#endregion
137
+ export { ID, IMEI, USCC, USCC_S, alphabet, alphabetLowercase, alphabetOmit, alphabetUppercase, any, bigint, boolean, booleanAllowEmpty, carCodeGreen, carCodeNotGreen, chinaProvince, chineseName, dirPathLinux, dirPathWindows, email, empty, filePathLinux, filePathWindows, int, intAllowEmpty, link, linkPort, nation, natural, naturalAllowEmpty, never, number, numberAllowEmpty, numberAlphabet, phone, spaceEnd, spaceInclude, spaceStart, spaceStartEnd, string, stringAllowEmpty, stringEmpty, stringNoEmpty, stringSignedDecimalismFloat, stringSignedDecimalismInt, stringUnsignedDecimalismFloat, stringUnsignedDecimalismInt, symbol, telephone, thunder, unknown };
package/metadata.json ADDED
@@ -0,0 +1,139 @@
1
+ {
2
+ "index": [
3
+ "arrayCast",
4
+ "arrayCompete",
5
+ "arrayCounting",
6
+ "arrayDifference",
7
+ "arrayFirst",
8
+ "arrayFork",
9
+ "arrayIntersection",
10
+ "arrayLast",
11
+ "arrayMerge",
12
+ "arrayPick",
13
+ "arrayReplace",
14
+ "arraySplit",
15
+ "cloneDeep",
16
+ "enumEntries",
17
+ "enumKeys",
18
+ "enumTypeCheck",
19
+ "enumValues",
20
+ "isArray",
21
+ "isAsyncFunction",
22
+ "isBigInt",
23
+ "isBoolean",
24
+ "isClass",
25
+ "isDate",
26
+ "isEqual",
27
+ "isError",
28
+ "isFile",
29
+ "isFunction",
30
+ "isGeneratorFunction",
31
+ "isInteger",
32
+ "isIterable",
33
+ "isMap",
34
+ "isNull",
35
+ "isNumber",
36
+ "isObject",
37
+ "isPromise",
38
+ "isPromiseLike",
39
+ "isRegExp",
40
+ "isSet",
41
+ "isString",
42
+ "isSymbol",
43
+ "isURLSearchParams",
44
+ "isUndefined",
45
+ "isWeakMap",
46
+ "isWeakSet",
47
+ "isWebSocket",
48
+ "isWindow",
49
+ "mapEntries",
50
+ "objectAssign",
51
+ "objectEntries",
52
+ "objectKeys",
53
+ "objectPick",
54
+ "objectSwitch",
55
+ "objectValues",
56
+ "rowsToTree",
57
+ "stringInitialCase",
58
+ "stringReplace",
59
+ "stringToJson",
60
+ "stringToValues",
61
+ "to",
62
+ "treeFilter",
63
+ "treeFind",
64
+ "treeForEach",
65
+ "treeMap",
66
+ "treeToRows"
67
+ ],
68
+ "vite": [
69
+ "resolveViteProxy"
70
+ ],
71
+ "zod": [
72
+ "ID",
73
+ "IMEI",
74
+ "USCC",
75
+ "USCC_S",
76
+ "alphabet",
77
+ "alphabetLowercase",
78
+ "alphabetOmit",
79
+ "alphabetUppercase",
80
+ "any",
81
+ "bigint",
82
+ "boolean",
83
+ "booleanAllowEmpty",
84
+ "carCodeGreen",
85
+ "carCodeNotGreen",
86
+ "chinaProvince",
87
+ "chineseName",
88
+ "dirPathLinux",
89
+ "dirPathWindows",
90
+ "email",
91
+ "empty",
92
+ "filePathLinux",
93
+ "filePathWindows",
94
+ "int",
95
+ "intAllowEmpty",
96
+ "link",
97
+ "linkPort",
98
+ "nation",
99
+ "natural",
100
+ "naturalAllowEmpty",
101
+ "never",
102
+ "number",
103
+ "numberAllowEmpty",
104
+ "numberAlphabet",
105
+ "phone",
106
+ "spaceEnd",
107
+ "spaceInclude",
108
+ "spaceStart",
109
+ "spaceStartEnd",
110
+ "string",
111
+ "stringAllowEmpty",
112
+ "stringEmpty",
113
+ "stringNoEmpty",
114
+ "stringSignedDecimalismFloat",
115
+ "stringSignedDecimalismInt",
116
+ "stringUnsignedDecimalismFloat",
117
+ "stringUnsignedDecimalismInt",
118
+ "symbol",
119
+ "telephone",
120
+ "thunder",
121
+ "unknown"
122
+ ],
123
+ "enums": [
124
+ "BREAK_POINT_TOKENS"
125
+ ],
126
+ "hooks": {
127
+ "alova": [
128
+ "useAlovaRequest",
129
+ "useAlovaWatcher"
130
+ ],
131
+ "react": [
132
+ "useCreation",
133
+ "useLatest",
134
+ "useMount",
135
+ "useResponsive",
136
+ "useUnmount"
137
+ ]
138
+ }
139
+ }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "pawover's kit",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "version": "0.0.0-alpha.2",
7
+ "version": "0.0.0-alpha.20",
8
8
  "packageManager": "pnpm@10.20.0",
9
9
  "engines": {
10
10
  "node": ">=22.20.0"
@@ -20,81 +20,85 @@
20
20
  },
21
21
  "main": "./dist/index.js",
22
22
  "module": "./dist/index.js",
23
- "types": "dist/types/index.d.ts",
23
+ "types": "./dist/index.d.ts",
24
24
  "files": [
25
- "dist"
25
+ "dist",
26
+ "metadata.json"
26
27
  ],
27
28
  "exports": {
28
- ".": {
29
- "types": "./dist/types/index.d.ts",
30
- "import": "./dist/index.js",
31
- "default": "./dist/index.js"
32
- },
33
- "./enums/*": {
34
- "types": "./dist/types/enums/*.d.ts",
35
- "import": "./dist/enums/*.js",
36
- "default": "./dist/enums/*.js"
37
- },
38
- "./utils/*": {
39
- "types": "./dist/types/utils/*.d.ts",
40
- "import": "./dist/utils/*.js",
41
- "default": "./dist/utils/*.js"
42
- },
43
- "./hooks/*": {
44
- "types": "./dist/types/hooks/*.d.ts",
45
- "import": "./dist/hooks/*.js",
46
- "default": "./dist/hooks/*.js"
47
- }
29
+ ".": "./dist/index.js",
30
+ "./enums": "./dist/enums.js",
31
+ "./vite": "./dist/vite.js",
32
+ "./zod": "./dist/zod.js",
33
+ "./hooks-alova": "./dist/hooks-alova.js",
34
+ "./hooks-react": "./dist/hooks-react.js",
35
+ "./metadata.json": "./metadata.json",
36
+ "./package.json": "./package.json"
48
37
  },
49
38
  "scripts": {
50
- "build": "tsc",
39
+ "build": "tsdown && pnpm build:metadata",
40
+ "build:metadata": "node scripts/metadata.ts",
51
41
  "public": "pnpm build && npm publish --access public",
52
42
  "check": "pnpm check:types & pnpm check:eslint & pnpm check:format",
53
43
  "check:types": "tsc --noEmit",
54
- "check:eslint": "eslint --fix \"**/*.{js,cjs,mjs,ts,cts,mts,jsx,tsx,vue}\" --cache-location=eslint.cache.json --cache",
55
- "check:format": "prettier --write \"**/*.{html,json}\" !.vscode/settings.json --cache-location=prettier.cache.json --cache",
44
+ "check:eslint": "eslint --fix \"**/*.{js,cjs,mjs,ts,cts,mts,jsx,tsx,vue}\" --cache-location=.cache/eslint.cache.json --cache",
45
+ "check:format": "prettier --write \"**/*.{html,json}\" !.vscode/settings.json --cache-location=.cache/prettier.cache.json --cache",
56
46
  "check:pack": "attw --pack .",
57
47
  "clean": "pnpm clean:cache & pnpm clean:lib & pnpm clean:output",
58
- "clean:cache": "rimraf -g **/*.cache.json **/auto-*.json **/auto-*.d.ts",
48
+ "clean:cache": "rimraf -g **/.cache",
59
49
  "clean:lib": "rimraf -g **/node_modules",
60
50
  "clean:output": "rimraf dist",
61
51
  "lib:up": "taze -I -r --exclude pnpm"
62
52
  },
53
+ "dependencies": {
54
+ "alova": "^3.4.0",
55
+ "react": "^19.2.0",
56
+ "vite": "^7.2.4",
57
+ "vue": "^3.5.25",
58
+ "zod": "^4.1.13"
59
+ },
63
60
  "devDependencies": {
64
- "@pawover/eslint-rules": "0.0.0-alpha.3",
61
+ "@pawover/eslint-rules": "0.0.0-alpha.8",
65
62
  "@pawover/types": "0.0.0-alpha.6",
66
- "@stylistic/eslint-plugin": "^5.5.0",
63
+ "@stylistic/eslint-plugin": "^5.6.1",
64
+ "@types/fs-extra": "^11.0.4",
67
65
  "@types/node": "^24.10.1",
68
- "@types/react": "^19.2.4",
69
- "ahooks": "^3.9.6",
66
+ "@types/react": "^19.2.7",
70
67
  "eslint": "^9.39.1",
71
68
  "eslint-plugin-antfu": "^3.1.1",
69
+ "fs-extra": "^11.3.2",
72
70
  "globals": "^16.5.0",
73
- "prettier": "^3.6.2",
74
- "radashi": "^12.7.0",
75
- "react": "^19.2.0",
76
- "rimraf": "^6.1.0",
77
- "taze": "^19.9.0",
71
+ "prettier": "^3.7.3",
72
+ "radashi": "^12.7.1",
73
+ "rimraf": "^6.1.2",
74
+ "taze": "^19.9.2",
75
+ "tsdown": "^0.16.8",
78
76
  "type-fest": "^5.2.0",
79
77
  "typescript": "^5.9.3",
80
- "typescript-eslint": "^8.46.4",
81
- "vue": "^3.5.24"
78
+ "typescript-eslint": "^8.48.0"
82
79
  },
83
80
  "peerDependencies": {
84
- "ahooks": ">=3.9.6",
85
- "radashi": ">=12.7.0",
81
+ "alova": ">=3.3.0",
86
82
  "react": ">=19.2.0",
87
- "vue": ">=3.5.24"
83
+ "vite": ">=6.0",
84
+ "vue": ">=3.5.0",
85
+ "zod": ">=4.1.0"
88
86
  },
89
87
  "peerDependenciesMeta": {
90
- "ahooks": {
88
+ "alova": {
91
89
  "optional": true
92
90
  },
93
91
  "react": {
94
92
  "optional": true
95
93
  },
94
+ "vite": {
95
+ "optional": true
96
+ },
96
97
  "vue": {
97
98
  "optional": true
99
+ },
100
+ "zod": {
101
+ "optional": true
98
102
  }
99
103
  }
100
104
  }
@@ -1,20 +0,0 @@
1
- /** 屏幕响应断点 token 配置 */
2
- export const BREAK_POINT_TOKENS = {
3
- XS: 576,
4
- XSMin: 576,
5
- XSMax: 767,
6
- SM: 768,
7
- SMMin: 768,
8
- SMMax: 991,
9
- MD: 992,
10
- MDMin: 992,
11
- MDMax: 1199,
12
- LG: 1200,
13
- LGMin: 1200,
14
- LGMax: 1599,
15
- XL: 1600,
16
- XLMin: 1600,
17
- XLMax: 1919,
18
- XXL: 1920,
19
- XXLMin: 1920,
20
- };
@@ -1,5 +0,0 @@
1
- export * from "./useCreation";
2
- export * from "./useLatest";
3
- export * from "./useMount";
4
- export * from "./useResponsive";
5
- export * from "./useUnmount";
@@ -1,11 +0,0 @@
1
- import { isEqual } from "radashi";
2
- import { useRef } from "react";
3
- export function useCreation(factory, deps) {
4
- const { current } = useRef({ deps, result: undefined, isInitialized: false });
5
- if (current.isInitialized === false || !isEqual(current.deps, deps)) {
6
- current.deps = deps;
7
- current.result = factory();
8
- current.isInitialized = true;
9
- }
10
- return current.result;
11
- }
@@ -1,6 +0,0 @@
1
- import { useRef } from "react";
2
- export function useLatest(value) {
3
- const ref = useRef(value);
4
- ref.current = value;
5
- return ref;
6
- }
@@ -1,29 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- import { isFunction, isPromiseLike } from "src/utils";
3
- import { useLatest } from "./useLatest";
4
- /**
5
- * 在组件初始化时执行的 Hook
6
- * - 即使在严格模式下也只执行一次
7
- * @reference https://ahooks.js.org/hooks/use-mount
8
- *
9
- * @param {MountCallback} effect 副作用函数
10
- */
11
- export function useMount(effect) {
12
- if (!isFunction(effect)) {
13
- console.error(`useMount expected parameter is a function, but got ${typeof effect}`);
14
- }
15
- const isMountedRef = useRef(false);
16
- const effectRef = useLatest(effect);
17
- useEffect(() => {
18
- if (isMountedRef.current) {
19
- return;
20
- }
21
- isMountedRef.current = true;
22
- const result = effectRef.current?.();
23
- // If fn returns a Promise, don't return it as cleanup function
24
- if (isPromiseLike(result)) {
25
- return;
26
- }
27
- return result;
28
- }, []);
29
- }