@pawover/kit 0.0.0-alpha.8 → 0.0.0-beta.1
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 +25 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +25 -0
- package/dist/enums.js.map +1 -0
- package/dist/hooks-alova.d.ts +23 -0
- package/dist/hooks-alova.d.ts.map +1 -0
- package/dist/hooks-alova.js +39 -0
- package/dist/hooks-alova.js.map +1 -0
- package/dist/hooks-react.d.ts +89 -0
- package/dist/hooks-react.d.ts.map +1 -0
- package/dist/hooks-react.js +334 -0
- package/dist/hooks-react.js.map +1 -0
- package/dist/index.d.ts +2411 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1375 -0
- package/dist/index.js.map +1 -0
- package/dist/patches-fetchEventSource.d.ts +806 -0
- package/dist/patches-fetchEventSource.d.ts.map +1 -0
- package/dist/patches-fetchEventSource.js +315 -0
- package/dist/patches-fetchEventSource.js.map +1 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +23 -0
- package/dist/vite.js.map +1 -0
- package/dist/zod.d.ts +105 -0
- package/dist/zod.d.ts.map +1 -0
- package/dist/zod.js +138 -0
- package/dist/zod.js.map +1 -0
- package/metadata.json +157 -0
- package/package.json +51 -35
- package/dist/enums/index.js +0 -20
- package/dist/hooks/react/index.js +0 -5
- package/dist/hooks/react/useCreation.js +0 -19
- package/dist/hooks/react/useLatest.js +0 -13
- package/dist/hooks/react/useMount.js +0 -29
- package/dist/hooks/react/useResponsive.js +0 -59
- package/dist/hooks/react/useUnmount.js +0 -18
- package/dist/types/enums/index.d.ts +0 -20
- package/dist/types/hooks/react/index.d.ts +0 -5
- package/dist/types/hooks/react/useCreation.d.ts +0 -10
- package/dist/types/hooks/react/useLatest.d.ts +0 -8
- package/dist/types/hooks/react/useMount.d.ts +0 -11
- package/dist/types/hooks/react/useResponsive.d.ts +0 -16
- package/dist/types/hooks/react/useUnmount.d.ts +0 -7
- package/dist/types/utils/array.d.ts +0 -76
- package/dist/types/utils/clone.d.ts +0 -13
- package/dist/types/utils/index.d.ts +0 -7
- package/dist/types/utils/object.d.ts +0 -54
- package/dist/types/utils/string.d.ts +0 -15
- package/dist/types/utils/to.d.ts +0 -5
- package/dist/types/utils/tree/index.d.ts +0 -6
- package/dist/types/utils/tree/rowsToTree.d.ts +0 -10
- package/dist/types/utils/tree/treeFilter.d.ts +0 -6
- package/dist/types/utils/tree/treeFind.d.ts +0 -8
- package/dist/types/utils/tree/treeForEach.d.ts +0 -5
- package/dist/types/utils/tree/treeMap.d.ts +0 -6
- package/dist/types/utils/tree/treeToRows.d.ts +0 -9
- package/dist/types/utils/tree/types.d.ts +0 -24
- package/dist/types/utils/typeof.d.ts +0 -37
- package/dist/types/zod/index.d.ts +0 -3
- package/dist/types/zod/primitive.d.ts +0 -32
- package/dist/types/zod/validator/input.d.ts +0 -27
- package/dist/types/zod/validator/societal.d.ts +0 -39
- package/dist/utils/array.js +0 -196
- package/dist/utils/clone.js +0 -75
- package/dist/utils/index.js +0 -7
- package/dist/utils/object.js +0 -149
- package/dist/utils/string.js +0 -73
- package/dist/utils/to.js +0 -16
- package/dist/utils/tree/index.js +0 -6
- package/dist/utils/tree/rowsToTree.js +0 -35
- package/dist/utils/tree/treeFilter.js +0 -92
- package/dist/utils/tree/treeFind.js +0 -82
- package/dist/utils/tree/treeForEach.js +0 -60
- package/dist/utils/tree/treeMap.js +0 -79
- package/dist/utils/tree/treeToRows.js +0 -13
- package/dist/utils/tree/types.js +0 -10
- package/dist/utils/typeof.js +0 -149
- package/dist/zod/index.js +0 -3
- package/dist/zod/primitive.js +0 -32
- package/dist/zod/validator/input.js +0 -39
- package/dist/zod/validator/societal.js +0 -57
package/dist/zod.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
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 };
|
|
138
|
+
//# sourceMappingURL=zod.js.map
|
package/dist/zod.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.js","names":[],"sources":["../src/zod/primitive.ts","../src/zod/validator/input.ts","../src/zod/validator/societal.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** 空 */\nexport const empty = z.union([z.null(), z.undefined()]);\n\n/** 字符串 */\nexport const string = z.string();\n/** 字符串-空 */\nexport const stringEmpty = z.literal(\"\").nullish();\n/** 字符串-非空 */\nexport const stringNoEmpty = z.string().min(1);\n/** 字符串-可空 */\nexport const stringAllowEmpty = z.string().nullish();\n\n/** 数字 */\nexport const number = z.number();\n/** 数字-可空 */\nexport const numberAllowEmpty = number.nullish();\n/** 整数 */\nexport const int = z.number().int({ error: \"应为整数\" });\n/** 整数-可空 */\nexport const intAllowEmpty = int.nullish();\n/** 自然数 */\nexport const natural = int.nonnegative({ error: \"应为非负数\" });\n/** 自然数-可空 */\nexport const naturalAllowEmpty = natural.nullish();\n\n/** 布尔值 */\nexport const boolean = z.boolean();\n/** 布尔值-可空 */\nexport const booleanAllowEmpty = z.boolean().nullish();\n\nexport const bigint = z.bigint();\n\nexport const symbol = z.symbol();\n\nexport const any = z.any();\n\nexport const unknown = z.unknown();\n\nexport const never = z.never();\n","import { z } from \"zod\";\n\nconst _alphabet = /^[a-z]+$/i;\n/** 字母 */\nexport const alphabet = z.string().regex(_alphabet, { error: \"应为字母\" });\n\nconst _alphabetLowercase = /^[a-z]+$/;\n/** 小写字母 */\nexport const alphabetLowercase = z.string().regex(_alphabetLowercase, { error: \"应为小写字母\" });\n\nconst _alphabetUppercase = /^[A-Z]+$/;\n/** 大写字母 */\nexport const alphabetUppercase = z.string().regex(_alphabetUppercase, { error: \"应为大写字母\" });\n\nconst _alphabetOmit = /^[^A-Z]*$/i;\n/** 不包含字母 */\nexport const alphabetOmit = z.string().regex(_alphabetOmit, { error: \"应不包含字母\" });\n\nconst _numberAlphabet = /^[A-Z0-9]+$/i;\n/** 数字和字母 */\nexport const numberAlphabet = z.string().regex(_numberAlphabet, { error: \"应为数字和字母组合\" });\n\nconst _stringSignedDecimalismFloat = /^[+-]?(\\d+(\\.\\d+)?|\\.\\d+)$/;\n/** 有符号十进制浮点数字符串 */\nexport const stringSignedDecimalismFloat = z.string().regex(_stringSignedDecimalismFloat, { error: \"应为十进制数字\" });\n\nconst _stringUnsignedDecimalismFloat = /^\\+?(\\d+(\\.\\d+)?|\\.\\d+)$/;\n/** 无符号十进制浮点数字符串 */\nexport const stringUnsignedDecimalismFloat = z.string().regex(_stringUnsignedDecimalismFloat, { error: \"应为十进制正数\" });\n\nconst _stringSignedDecimalismInt = /^[+-]?\\d+$/;\n/** 有符号十进制整数字符串 */\nexport const stringSignedDecimalismInt = z.string().regex(_stringSignedDecimalismInt, { error: \"应为十进制整数\" });\n\nconst _stringUnsignedDecimalismInt = /^\\+?\\d+$/;\n/** 无符号十进制整数字符串 */\nexport const stringUnsignedDecimalismInt = z.string().regex(_stringUnsignedDecimalismInt, { error: \"应为十进制正整数\" });\n\nconst _spaceInclude = /^[^ ]+$/;\n/** 包含空格 */\nexport const spaceInclude = z.string().regex(_spaceInclude, { error: \"应不包含空格\" });\n\nconst _spaceStart = /^\\S/g;\n/** 首空格 */\nexport const spaceStart = z.string().regex(_spaceStart, { error: \"应不包含首空格\" });\n\nconst _spaceEnd = /\\s$/g;\n/** 尾空格 */\nexport const spaceEnd = z.string().regex(_spaceEnd, { error: \"应不包含尾空格\" });\n\n/** 首尾空格 */\nexport const spaceStartEnd = spaceStart.and(spaceEnd);\n","import { z } from \"zod\";\n\nconst _phone = /^1(3\\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$/;\n/** 手机号码 */\nexport const phone = z.string().regex(_phone, { error: \"手机号码格式错误\" });\n\nconst _telephone = /0\\d{2,3}-\\d{7,9}$/;\n/** 固定电话 */\nexport const telephone = z.string().regex(_telephone, { error: \"电话号码格式错误\" });\n\nconst _email = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-z\\-0-9]+\\.)+[a-z]{2,}))$/i;\n/** 电子邮箱 */\nexport const email = z.string().regex(_email, { error: \"电子邮箱格式错误\" });\n\nconst _chineseName = /^[一-龢][一·-龢]*$/;\n/** 中文姓名 */\nexport const chineseName = z.string().regex(_chineseName, { error: \"应为中文姓名\" });\n\n/** 手机机身码 */\nexport const IMEI = z.string().regex(/^\\d{15,17}$/, { error: \"手机机身码格式错误\" });\n\nconst _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;\n/** 身份证号 */\nexport const ID = z.string().regex(_ID, { error: \"身份证号格式错误\" });\n\nconst _link = /^(((ht|f)tps?):\\/\\/)?(([\\w-]+(\\.[\\w-]+)*\\.[a-z]{2,6})|((\\d{1,3}\\.){3}\\d{1,3}))(:\\d+)?(\\/\\S*)?$/;\n/** 链接 */\nexport const link = z.string().regex(_link, { error: \"链接格式错误\" });\n\nconst _linkPort = /^((ht|f)tps?:\\/\\/)?[\\w-]+(\\.[\\w-]+)+:\\d{1,5}\\/?$/;\n/** 端口号网址 */\nexport const linkPort = z.string().regex(_linkPort, { error: \"网址格式错误\" });\n\nconst _USCC_S = /^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/;\n/** 统一社会信用代码 */\nexport const USCC_S = z.string().regex(_USCC_S, { error: \"统一社会信用代码格式错误\" });\n\nconst _USCC = /^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/;\n/** 统一社会信用代码 - 15位/18位/20位数字/字母 */\nexport const USCC = z.string().regex(_USCC, { error: \"统一社会信用代码格式错误\" });\n\nconst _thunder = /^thunderx?:\\/\\/[a-zA-Z\\d]+=$/;\n/** 迅雷链接 */\nexport const thunder = z.string().regex(_thunder, { error: \"迅雷链接格式错误\" });\n\nconst _dirPathWindows = /^[a-z]:\\\\(?:\\w+\\\\?)*$/i;\n/** windows 文件夹路径 */\nexport const dirPathWindows = z.string().regex(_dirPathWindows, { error: \"路径格式错误\" });\n\nconst _filePathWindows = /^[a-z]:\\\\(?:\\w+\\\\)*\\w+\\.\\w+$/i;\n/** windows 文件路径 */\nexport const filePathWindows = z.string().regex(_filePathWindows, { error: \"路径格式错误\" });\n\nconst _dirPathLinux = /^\\/(?:[^\\\\/\\s]+\\/)*$/;\n/** linux 文件夹路径 */\nexport const dirPathLinux = z.string().regex(_dirPathLinux, { error: \"路径格式错误\" });\n\nconst _filePathLinux = /^(\\/$|\\/(?:[^\\\\/\\s]+\\/)*[^\\\\/\\s]+$)/;\n/** linux 文件路径 */\nexport const filePathLinux = z.string().regex(_filePathLinux, { error: \"路径格式错误\" });\n\nconst _carCodeGreen = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))\\d{4})|(\\d{5}[DF]))$/;\n/** 车牌号 新能源 */\nexport const carCodeGreen = z.string().regex(_carCodeGreen, { error: \"车牌号格式错误\" });\n\nconst _carCodeNotGreen = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/;\n/** 车牌号 非新能源 */\nexport const carCodeNotGreen = z.string().regex(_carCodeNotGreen, { error: \"车牌号格式错误\" });\n\nconst _chinaProvince = /^安徽|澳门|北京|重庆|福建|甘肃|广东|广西|贵州|海南|河北|河南|黑龙江|湖北|湖南|吉林|江苏|江西|辽宁|内蒙古|宁夏|青海|山东|山西|陕西|上海|四川|台湾|天津|西藏|香港|新疆|云南|浙江$/;\n/** 中国省份 */\nexport const chinaProvince = z.string().regex(_chinaProvince, { error: \"应为中国省份\" });\n\nconst _nation = /^汉族|蒙古族|回族|藏族|维吾尔族|苗族|彝族|壮族|布依族|朝鲜族|满族|侗族|瑶族|白族|土家族|哈尼族|哈萨克族|傣族|黎族|傈僳族|佤族|畲族|高山族|拉祜族|水族|东乡族|纳西族|景颇族|柯尔克孜族|土族|达斡尔族|仫佬族|羌族|布朗族|撒拉族|毛南族|仡佬族|锡伯族|阿昌族|普米族|塔吉克族|怒族|乌孜别克族|俄罗斯族|鄂温克族|德昂族|保安族|裕固族|京族|塔塔尔族|独龙族|鄂伦春族|赫哲族|门巴族|珞巴族|基诺族|其它未识别民族|外国人入中国籍$/;\n/** 民族 */\nexport const nation = z.string().regex(_nation, { error: \"应为民族\" });\n"],"mappings":"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"}
|
package/metadata.json
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
"isAbortSignal",
|
|
21
|
+
"isArray",
|
|
22
|
+
"isAsyncFunction",
|
|
23
|
+
"isAsyncGeneratorFunction",
|
|
24
|
+
"isBigInt",
|
|
25
|
+
"isBlob",
|
|
26
|
+
"isBoolean",
|
|
27
|
+
"isClass",
|
|
28
|
+
"isDate",
|
|
29
|
+
"isEqual",
|
|
30
|
+
"isError",
|
|
31
|
+
"isFalsy",
|
|
32
|
+
"isFalsyLike",
|
|
33
|
+
"isFile",
|
|
34
|
+
"isFunction",
|
|
35
|
+
"isGeneratorFunction",
|
|
36
|
+
"isInfinity",
|
|
37
|
+
"isInfinityLike",
|
|
38
|
+
"isInteger",
|
|
39
|
+
"isIterable",
|
|
40
|
+
"isMap",
|
|
41
|
+
"isNaN",
|
|
42
|
+
"isNegativeInteger",
|
|
43
|
+
"isNull",
|
|
44
|
+
"isNumber",
|
|
45
|
+
"isObject",
|
|
46
|
+
"isPositiveInteger",
|
|
47
|
+
"isPromise",
|
|
48
|
+
"isPromiseLike",
|
|
49
|
+
"isReadableStream",
|
|
50
|
+
"isRegExp",
|
|
51
|
+
"isSet",
|
|
52
|
+
"isString",
|
|
53
|
+
"isSymbol",
|
|
54
|
+
"isTypedArray",
|
|
55
|
+
"isURLSearchParams",
|
|
56
|
+
"isUndefined",
|
|
57
|
+
"isWeakMap",
|
|
58
|
+
"isWeakSet",
|
|
59
|
+
"isWebSocket",
|
|
60
|
+
"isWindow",
|
|
61
|
+
"mapEntries",
|
|
62
|
+
"objectAssign",
|
|
63
|
+
"objectCrush",
|
|
64
|
+
"objectEntries",
|
|
65
|
+
"objectKeys",
|
|
66
|
+
"objectPick",
|
|
67
|
+
"objectSwitch",
|
|
68
|
+
"objectValues",
|
|
69
|
+
"rowsToTree",
|
|
70
|
+
"stringInitialCase",
|
|
71
|
+
"stringReplace",
|
|
72
|
+
"stringTemplate",
|
|
73
|
+
"stringToJson",
|
|
74
|
+
"stringToNumber",
|
|
75
|
+
"stringToValues",
|
|
76
|
+
"to",
|
|
77
|
+
"toMathBignumber",
|
|
78
|
+
"toMathDecimal",
|
|
79
|
+
"toMathEvaluate",
|
|
80
|
+
"treeFilter",
|
|
81
|
+
"treeFind",
|
|
82
|
+
"treeForEach",
|
|
83
|
+
"treeMap",
|
|
84
|
+
"treeToRows"
|
|
85
|
+
],
|
|
86
|
+
"vite": [
|
|
87
|
+
"resolveViteProxy"
|
|
88
|
+
],
|
|
89
|
+
"zod": [
|
|
90
|
+
"ID",
|
|
91
|
+
"IMEI",
|
|
92
|
+
"USCC",
|
|
93
|
+
"USCC_S",
|
|
94
|
+
"alphabet",
|
|
95
|
+
"alphabetLowercase",
|
|
96
|
+
"alphabetOmit",
|
|
97
|
+
"alphabetUppercase",
|
|
98
|
+
"any",
|
|
99
|
+
"bigint",
|
|
100
|
+
"boolean",
|
|
101
|
+
"booleanAllowEmpty",
|
|
102
|
+
"carCodeGreen",
|
|
103
|
+
"carCodeNotGreen",
|
|
104
|
+
"chinaProvince",
|
|
105
|
+
"chineseName",
|
|
106
|
+
"dirPathLinux",
|
|
107
|
+
"dirPathWindows",
|
|
108
|
+
"email",
|
|
109
|
+
"empty",
|
|
110
|
+
"filePathLinux",
|
|
111
|
+
"filePathWindows",
|
|
112
|
+
"int",
|
|
113
|
+
"intAllowEmpty",
|
|
114
|
+
"link",
|
|
115
|
+
"linkPort",
|
|
116
|
+
"nation",
|
|
117
|
+
"natural",
|
|
118
|
+
"naturalAllowEmpty",
|
|
119
|
+
"never",
|
|
120
|
+
"number",
|
|
121
|
+
"numberAllowEmpty",
|
|
122
|
+
"numberAlphabet",
|
|
123
|
+
"phone",
|
|
124
|
+
"spaceEnd",
|
|
125
|
+
"spaceInclude",
|
|
126
|
+
"spaceStart",
|
|
127
|
+
"spaceStartEnd",
|
|
128
|
+
"string",
|
|
129
|
+
"stringAllowEmpty",
|
|
130
|
+
"stringEmpty",
|
|
131
|
+
"stringNoEmpty",
|
|
132
|
+
"stringSignedDecimalismFloat",
|
|
133
|
+
"stringSignedDecimalismInt",
|
|
134
|
+
"stringUnsignedDecimalismFloat",
|
|
135
|
+
"stringUnsignedDecimalismInt",
|
|
136
|
+
"symbol",
|
|
137
|
+
"telephone",
|
|
138
|
+
"thunder",
|
|
139
|
+
"unknown"
|
|
140
|
+
],
|
|
141
|
+
"enums": [
|
|
142
|
+
"BREAK_POINT_TOKEN_ENUM"
|
|
143
|
+
],
|
|
144
|
+
"hooks": {
|
|
145
|
+
"alova": [
|
|
146
|
+
"useAlovaRequest",
|
|
147
|
+
"useAlovaWatcher"
|
|
148
|
+
],
|
|
149
|
+
"react": [
|
|
150
|
+
"useCreation",
|
|
151
|
+
"useLatest",
|
|
152
|
+
"useMount",
|
|
153
|
+
"useResponsive",
|
|
154
|
+
"useUnmount"
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
}
|
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-
|
|
7
|
+
"version": "0.0.0-beta.1",
|
|
8
8
|
"packageManager": "pnpm@10.20.0",
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=22.20.0"
|
|
@@ -20,25 +20,25 @@
|
|
|
20
20
|
},
|
|
21
21
|
"main": "./dist/index.js",
|
|
22
22
|
"module": "./dist/index.js",
|
|
23
|
-
"types": "./dist/
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"metadata.json"
|
|
26
27
|
],
|
|
27
28
|
"exports": {
|
|
28
|
-
".":
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"require": "./dist/*.js"
|
|
38
|
-
}
|
|
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
|
+
"./patches-fetchEventSource": "./dist/patches-fetchEventSource.js",
|
|
36
|
+
"./metadata.json": "./metadata.json",
|
|
37
|
+
"./package.json": "./package.json"
|
|
39
38
|
},
|
|
40
39
|
"scripts": {
|
|
41
|
-
"build": "
|
|
40
|
+
"build": "tsdown && pnpm build:metadata",
|
|
41
|
+
"build:metadata": "node scripts/metadata.ts",
|
|
42
42
|
"public": "pnpm build && npm publish --access public",
|
|
43
43
|
"check": "pnpm check:types & pnpm check:eslint & pnpm check:format",
|
|
44
44
|
"check:types": "tsc --noEmit",
|
|
@@ -51,39 +51,55 @@
|
|
|
51
51
|
"clean:output": "rimraf dist",
|
|
52
52
|
"lib:up": "taze -I -r --exclude pnpm"
|
|
53
53
|
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"alova": "^3.4.1",
|
|
56
|
+
"mathjs": "^15.1.0",
|
|
57
|
+
"react": "^19.2.3",
|
|
58
|
+
"vite": "^7.3.0",
|
|
59
|
+
"vue": "^3.5.26",
|
|
60
|
+
"zod": "^4.2.1"
|
|
61
|
+
},
|
|
54
62
|
"devDependencies": {
|
|
55
|
-
"@pawover/eslint-rules": "0.0.0-alpha.
|
|
56
|
-
"@pawover/types": "0.0.0-alpha.
|
|
57
|
-
"@stylistic/eslint-plugin": "^5.
|
|
58
|
-
"@types/
|
|
59
|
-
"@types/
|
|
60
|
-
"
|
|
61
|
-
"eslint": "^9.39.
|
|
63
|
+
"@pawover/eslint-rules": "0.0.0-alpha.12",
|
|
64
|
+
"@pawover/types": "0.0.0-alpha.8",
|
|
65
|
+
"@stylistic/eslint-plugin": "^5.6.1",
|
|
66
|
+
"@types/fs-extra": "^11.0.4",
|
|
67
|
+
"@types/node": "^25.0.3",
|
|
68
|
+
"@types/react": "^19.2.7",
|
|
69
|
+
"eslint": "^9.39.2",
|
|
62
70
|
"eslint-plugin-antfu": "^3.1.1",
|
|
63
|
-
"
|
|
64
|
-
"prettier": "^3.
|
|
65
|
-
"
|
|
66
|
-
"rimraf": "^6.1.
|
|
67
|
-
"taze": "^19.9.
|
|
68
|
-
"
|
|
71
|
+
"fs-extra": "^11.3.3",
|
|
72
|
+
"prettier": "^3.7.4",
|
|
73
|
+
"radashi": "^12.7.1",
|
|
74
|
+
"rimraf": "^6.1.2",
|
|
75
|
+
"taze": "^19.9.2",
|
|
76
|
+
"tsdown": "^0.17.4",
|
|
77
|
+
"type-fest": "^5.3.1",
|
|
69
78
|
"typescript": "^5.9.3",
|
|
70
|
-
"typescript-eslint": "^8.
|
|
71
|
-
"vue": "^3.
|
|
72
|
-
"zod": "^4.1.12"
|
|
79
|
+
"typescript-eslint": "^8.50.1",
|
|
80
|
+
"vue-tsc": "^3.2.1"
|
|
73
81
|
},
|
|
74
82
|
"peerDependencies": {
|
|
75
|
-
"
|
|
83
|
+
"alova": ">=3.3.0",
|
|
84
|
+
"mathjs": ">=15.0.0",
|
|
76
85
|
"react": ">=19.2.0",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
86
|
+
"vite": ">=4.0",
|
|
87
|
+
"vue": ">=3.5.0",
|
|
88
|
+
"zod": ">=4.1.0"
|
|
79
89
|
},
|
|
80
90
|
"peerDependenciesMeta": {
|
|
81
|
-
"
|
|
91
|
+
"alova": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"mathjs": {
|
|
82
95
|
"optional": true
|
|
83
96
|
},
|
|
84
97
|
"react": {
|
|
85
98
|
"optional": true
|
|
86
99
|
},
|
|
100
|
+
"vite": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
87
103
|
"vue": {
|
|
88
104
|
"optional": true
|
|
89
105
|
},
|
package/dist/enums/index.js
DELETED
|
@@ -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,19 +0,0 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
2
|
-
import { isEqual } from "src/utils";
|
|
3
|
-
/**
|
|
4
|
-
* useCreation
|
|
5
|
-
* @reference https://ahooks.js.org/zh-CN/hooks/use-creation
|
|
6
|
-
*
|
|
7
|
-
* @template T
|
|
8
|
-
* @param {() => T} factory
|
|
9
|
-
* @param {DependencyList} deps
|
|
10
|
-
*/
|
|
11
|
-
export function useCreation(factory, deps) {
|
|
12
|
-
const { current } = useRef({ deps, result: undefined, isInitialized: false });
|
|
13
|
-
if (current.isInitialized === false || !isEqual(current.deps, deps)) {
|
|
14
|
-
current.deps = deps;
|
|
15
|
-
current.result = factory();
|
|
16
|
-
current.isInitialized = true;
|
|
17
|
-
}
|
|
18
|
-
return current.result;
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* 返回当前最新值的 Hook
|
|
4
|
-
* @reference https://ahooks.js.org/zh-CN/hooks/use-latest
|
|
5
|
-
*
|
|
6
|
-
* @template T
|
|
7
|
-
* @param {T} value
|
|
8
|
-
*/
|
|
9
|
-
export function useLatest(value) {
|
|
10
|
-
const ref = useRef(value);
|
|
11
|
-
ref.current = value;
|
|
12
|
-
return ref;
|
|
13
|
-
}
|
|
@@ -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
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { BREAK_POINT_TOKENS } from "src/enums";
|
|
3
|
-
import { objectKeys } from "src/utils";
|
|
4
|
-
const subscriberList = new Set();
|
|
5
|
-
const { XS, SM, MD, LG, XL, XXL } = BREAK_POINT_TOKENS;
|
|
6
|
-
const defaultResponsiveValues = { xxl: false, xl: false, lg: false, md: false, sm: false, xs: false };
|
|
7
|
-
const responsiveConfig = Object.freeze({ xs: XS, sm: SM, md: MD, lg: LG, xl: XL, xxl: XXL });
|
|
8
|
-
let responsiveValues = { ...defaultResponsiveValues };
|
|
9
|
-
export function useResponsive(options) {
|
|
10
|
-
const { compactBreakPoint = "xl" } = options || {};
|
|
11
|
-
calculate();
|
|
12
|
-
const [responsive, setResponsive] = useState(responsiveValues);
|
|
13
|
-
const isCompact = !responsive[compactBreakPoint];
|
|
14
|
-
const current = objectKeys(defaultResponsiveValues).find((key) => responsive[key] === true) || "xs";
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
addListener();
|
|
17
|
-
const subscriber = () => {
|
|
18
|
-
setResponsive(responsiveValues);
|
|
19
|
-
};
|
|
20
|
-
subscriberList.add(subscriber);
|
|
21
|
-
return () => {
|
|
22
|
-
subscriberList.delete(subscriber);
|
|
23
|
-
if (subscriberList.size === 0) {
|
|
24
|
-
removeListener();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}, []);
|
|
28
|
-
return { responsive, current, isCompact };
|
|
29
|
-
}
|
|
30
|
-
function resizeListener() {
|
|
31
|
-
const oldInfo = responsiveValues;
|
|
32
|
-
calculate();
|
|
33
|
-
if (oldInfo === responsiveValues) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
for (const subscriber of subscriberList) {
|
|
37
|
-
subscriber();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function addListener() {
|
|
41
|
-
window.addEventListener("resize", resizeListener);
|
|
42
|
-
}
|
|
43
|
-
function removeListener() {
|
|
44
|
-
window.removeEventListener("resize", resizeListener);
|
|
45
|
-
}
|
|
46
|
-
function calculate() {
|
|
47
|
-
const width = window.innerWidth;
|
|
48
|
-
const newValues = { ...defaultResponsiveValues };
|
|
49
|
-
let shouldUpdate = false;
|
|
50
|
-
for (const key of objectKeys(responsiveConfig)) {
|
|
51
|
-
newValues[key] = width >= responsiveConfig[key];
|
|
52
|
-
if (newValues[key] !== responsiveValues[key]) {
|
|
53
|
-
shouldUpdate = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (shouldUpdate) {
|
|
57
|
-
responsiveValues = newValues;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { isFunction } from "src/utils";
|
|
3
|
-
import { useLatest } from "./useLatest";
|
|
4
|
-
/**
|
|
5
|
-
* 在组件卸载时执行的 Hook
|
|
6
|
-
* @reference https://ahooks.js.org/zh-CN/hooks/use-unmount
|
|
7
|
-
*
|
|
8
|
-
* @param {Func} effect 副作用函数
|
|
9
|
-
*/
|
|
10
|
-
export function useUnmount(effect) {
|
|
11
|
-
if (!isFunction(effect)) {
|
|
12
|
-
console.error(`useUnmount expected parameter is a function, got ${typeof effect}`);
|
|
13
|
-
}
|
|
14
|
-
const effectRef = useLatest(effect);
|
|
15
|
-
useEffect(() => () => {
|
|
16
|
-
effectRef.current?.();
|
|
17
|
-
}, []);
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** 屏幕响应断点 token 配置 */
|
|
2
|
-
export declare const BREAK_POINT_TOKENS: {
|
|
3
|
-
readonly XS: 576;
|
|
4
|
-
readonly XSMin: 576;
|
|
5
|
-
readonly XSMax: 767;
|
|
6
|
-
readonly SM: 768;
|
|
7
|
-
readonly SMMin: 768;
|
|
8
|
-
readonly SMMax: 991;
|
|
9
|
-
readonly MD: 992;
|
|
10
|
-
readonly MDMin: 992;
|
|
11
|
-
readonly MDMax: 1199;
|
|
12
|
-
readonly LG: 1200;
|
|
13
|
-
readonly LGMin: 1200;
|
|
14
|
-
readonly LGMax: 1599;
|
|
15
|
-
readonly XL: 1600;
|
|
16
|
-
readonly XLMin: 1600;
|
|
17
|
-
readonly XLMax: 1919;
|
|
18
|
-
readonly XXL: 1920;
|
|
19
|
-
readonly XXLMin: 1920;
|
|
20
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type DependencyList } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* useCreation
|
|
4
|
-
* @reference https://ahooks.js.org/zh-CN/hooks/use-creation
|
|
5
|
-
*
|
|
6
|
-
* @template T
|
|
7
|
-
* @param {() => T} factory
|
|
8
|
-
* @param {DependencyList} deps
|
|
9
|
-
*/
|
|
10
|
-
export declare function useCreation<T>(factory: () => T, deps: DependencyList): T;
|