sa2kit 1.6.10 → 1.6.11
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/ConfigService-BxK06xP6.d.mts +262 -0
- package/dist/ConfigService-BxK06xP6.d.ts +262 -0
- package/dist/UniversalFileService-BuHN-jrR.d.ts +515 -0
- package/dist/UniversalFileService-CGGzYeeF.d.mts +515 -0
- package/dist/analytics/index.d.mts +1084 -0
- package/dist/analytics/index.d.ts +1084 -0
- package/dist/analytics/server/index.d.mts +499 -0
- package/dist/analytics/server/index.d.ts +499 -0
- package/dist/api/index.d.mts +248 -0
- package/dist/api/index.d.ts +248 -0
- package/dist/audioDetection/index.d.mts +449 -0
- package/dist/audioDetection/index.d.ts +449 -0
- package/dist/auth/client/index.d.mts +32 -0
- package/dist/auth/client/index.d.ts +32 -0
- package/dist/auth/client/index.js +4 -4
- package/dist/auth/client/index.mjs +1 -1
- package/dist/auth/components/index.d.mts +227 -0
- package/dist/auth/components/index.d.ts +227 -0
- package/dist/auth/components/index.js +4 -4
- package/dist/auth/components/index.mjs +1 -1
- package/dist/auth/hooks/index.d.mts +31 -0
- package/dist/auth/hooks/index.d.ts +31 -0
- package/dist/auth/hooks/index.js +3 -3
- package/dist/auth/hooks/index.mjs +1 -1
- package/dist/auth/index.d.mts +41 -0
- package/dist/auth/index.d.ts +41 -0
- package/dist/auth/index.js +17 -36
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/index.mjs +3 -33
- package/dist/auth/index.mjs.map +1 -1
- package/dist/auth/middleware/index.d.mts +75 -0
- package/dist/auth/middleware/index.d.ts +75 -0
- package/dist/auth/routes/index.d.mts +261 -0
- package/dist/auth/routes/index.d.ts +261 -0
- package/dist/auth/schema/index.d.mts +789 -0
- package/dist/auth/schema/index.d.ts +789 -0
- package/dist/auth/services/index.d.mts +48 -0
- package/dist/auth/services/index.d.ts +48 -0
- package/dist/base-api-client-B-yUCal3.d.ts +103 -0
- package/dist/base-api-client-BQ8ZPZjk.d.mts +103 -0
- package/dist/calendar/index.d.mts +1197 -0
- package/dist/calendar/index.d.ts +1197 -0
- package/dist/calendar/index.js +8 -8
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/index.mjs +1 -1
- package/dist/calendar/index.mjs.map +1 -1
- package/dist/calendar/routes/index.d.mts +118 -0
- package/dist/calendar/routes/index.d.ts +118 -0
- package/dist/calendar/server.d.mts +1184 -0
- package/dist/calendar/server.d.ts +1184 -0
- package/dist/{chunk-ROEYW4A7.js → chunk-5QMBZP7S.js} +2 -2
- package/dist/chunk-5QMBZP7S.js.map +1 -0
- package/dist/chunk-6BZ3QFA5.mjs +33 -0
- package/dist/chunk-6BZ3QFA5.mjs.map +1 -0
- package/dist/{chunk-HEMA7SWK.mjs → chunk-6YKMCPQI.mjs} +2 -2
- package/dist/chunk-6YKMCPQI.mjs.map +1 -0
- package/dist/chunk-BH5TLVS5.mjs +1593 -0
- package/dist/chunk-BH5TLVS5.mjs.map +1 -0
- package/dist/chunk-E72D5KHY.js +1723 -0
- package/dist/chunk-E72D5KHY.js.map +1 -0
- package/dist/chunk-FAHLZIYQ.js +36 -0
- package/dist/chunk-FAHLZIYQ.js.map +1 -0
- package/dist/{chunk-KGRQNEIR.mjs → chunk-KW5JH6V6.mjs} +2 -2
- package/dist/chunk-KW5JH6V6.mjs.map +1 -0
- package/dist/{chunk-O26VCNS3.js → chunk-UOFTHYIH.js} +2 -2
- package/dist/chunk-UOFTHYIH.js.map +1 -0
- package/dist/config/index.d.mts +64 -0
- package/dist/config/index.d.ts +64 -0
- package/dist/config/server/index.d.mts +1533 -0
- package/dist/config/server/index.d.ts +1533 -0
- package/dist/drizzle-auth-service-Bxlovhv8.d.ts +145 -0
- package/dist/drizzle-auth-service-DZY2F1sv.d.mts +145 -0
- package/dist/drizzle-schema-BNhqj2AZ.d.mts +1114 -0
- package/dist/drizzle-schema-BNhqj2AZ.d.ts +1114 -0
- package/dist/enums-Dume-V5Y.d.mts +16 -0
- package/dist/enums-Dume-V5Y.d.ts +16 -0
- package/dist/i18n/index.d.mts +417 -0
- package/dist/i18n/index.d.ts +417 -0
- package/dist/imageCrop/index.d.mts +165 -0
- package/dist/imageCrop/index.d.ts +165 -0
- package/dist/index-DSel44Ke.d.mts +93 -0
- package/dist/index-DSel44Ke.d.ts +93 -0
- package/dist/index.d.mts +933 -0
- package/dist/index.d.ts +933 -0
- package/dist/index.js +1626 -2184
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +708 -1543
- package/dist/index.mjs.map +1 -1
- package/dist/logger/index.d.mts +125 -0
- package/dist/logger/index.d.ts +125 -0
- package/dist/mmd/admin/index.d.mts +487 -0
- package/dist/mmd/admin/index.d.ts +487 -0
- package/dist/mmd/index.d.mts +1412 -0
- package/dist/mmd/index.d.ts +1412 -0
- package/dist/mmd/index.js +2695 -625
- package/dist/mmd/index.js.map +1 -1
- package/dist/mmd/index.mjs +2501 -448
- package/dist/mmd/index.mjs.map +1 -1
- package/dist/mmd/server/index.d.mts +138 -0
- package/dist/mmd/server/index.d.ts +138 -0
- package/dist/music/index.d.mts +74 -0
- package/dist/music/index.d.ts +74 -0
- package/dist/music/server/index.d.mts +1 -0
- package/dist/music/server/index.d.ts +1 -0
- package/dist/request/index.d.mts +51 -0
- package/dist/request/index.d.ts +51 -0
- package/dist/storage/index.d.mts +75 -0
- package/dist/storage/index.d.ts +75 -0
- package/dist/testYourself/admin/index.d.mts +58 -0
- package/dist/testYourself/admin/index.d.ts +58 -0
- package/dist/testYourself/index.d.mts +53 -0
- package/dist/testYourself/index.d.ts +53 -0
- package/dist/testYourself/server/index.d.mts +1029 -0
- package/dist/testYourself/server/index.d.ts +1029 -0
- package/dist/types-BB-7_WtE.d.mts +253 -0
- package/dist/types-BB-7_WtE.d.ts +253 -0
- package/dist/types-BINlP9MK.d.mts +286 -0
- package/dist/types-BINlP9MK.d.ts +286 -0
- package/dist/types-BaZccpvk.d.mts +48 -0
- package/dist/types-BaZccpvk.d.ts +48 -0
- package/dist/types-CK4We_aI.d.mts +270 -0
- package/dist/types-CK4We_aI.d.ts +270 -0
- package/dist/types-CbTsi9CZ.d.mts +31 -0
- package/dist/types-CbTsi9CZ.d.ts +31 -0
- package/dist/types-CiYK5Klf.d.mts +99 -0
- package/dist/types-D3R6GzOw.d.mts +70 -0
- package/dist/types-Dlu52uDy.d.ts +99 -0
- package/dist/types-iFeyR443.d.ts +70 -0
- package/dist/universalExport/index.d.mts +235 -0
- package/dist/universalExport/index.d.ts +235 -0
- package/dist/universalExport/server/index.d.mts +1270 -0
- package/dist/universalExport/server/index.d.ts +1270 -0
- package/dist/universalFile/index.d.mts +480 -0
- package/dist/universalFile/index.d.ts +480 -0
- package/dist/universalFile/server/index.d.mts +4516 -0
- package/dist/universalFile/server/index.d.ts +4516 -0
- package/dist/useElectronStorage-Dj0rcorG.d.mts +65 -0
- package/dist/useElectronStorage-DwnNfIhl.d.ts +65 -0
- package/dist/utils/index.d.mts +192 -0
- package/dist/utils/index.d.ts +192 -0
- package/package.json +2 -1
- package/dist/chunk-4FOBBWXW.mjs +0 -179
- package/dist/chunk-4FOBBWXW.mjs.map +0 -1
- package/dist/chunk-G6WRJ2H2.js +0 -187
- package/dist/chunk-G6WRJ2H2.js.map +0 -1
- package/dist/chunk-HEMA7SWK.mjs.map +0 -1
- package/dist/chunk-KGRQNEIR.mjs.map +0 -1
- package/dist/chunk-O26VCNS3.js.map +0 -1
- package/dist/chunk-ROEYW4A7.js.map +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { S as StorageAdapter } from './types-BaZccpvk.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 通用存储 Hook
|
|
5
|
+
* 支持多平台:Web、React Native、小程序
|
|
6
|
+
*
|
|
7
|
+
* 优点:
|
|
8
|
+
* 1. 异步读取,不阻塞渲染
|
|
9
|
+
* 2. 统一的错误处理
|
|
10
|
+
* 3. 类型安全
|
|
11
|
+
* 4. 跨平台支持
|
|
12
|
+
* 5. 自动同步(支持的平台)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
declare function useStorage<T>(storage: StorageAdapter, key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Web 平台 localStorage Hook
|
|
19
|
+
* 基于通用 useStorage 的便捷封装
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Web 平台的 localStorage Hook
|
|
23
|
+
*
|
|
24
|
+
* @param key - 存储键名
|
|
25
|
+
* @param defaultValue - 默认值
|
|
26
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
27
|
+
*/
|
|
28
|
+
declare function useLocalStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* React Native 的 AsyncStorage Hook
|
|
32
|
+
*
|
|
33
|
+
* @param key - 存储键名
|
|
34
|
+
* @param defaultValue - 默认值
|
|
35
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
36
|
+
*/
|
|
37
|
+
declare function useAsyncStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 小程序的 Taro Storage Hook
|
|
41
|
+
*
|
|
42
|
+
* @param key - 存储键名
|
|
43
|
+
* @param defaultValue - 默认值
|
|
44
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
45
|
+
*/
|
|
46
|
+
declare function useTaroStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Electron 桌面端的 Storage Hook
|
|
50
|
+
*
|
|
51
|
+
* 在 Electron 渲染进程中使用 localStorage
|
|
52
|
+
* 支持跨窗口同步
|
|
53
|
+
*
|
|
54
|
+
* @param key - 存储键名
|
|
55
|
+
* @param defaultValue - 默认值
|
|
56
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* const [token, setToken, removeToken] = useElectronStorage('auth-token', '')
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function useElectronStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
64
|
+
|
|
65
|
+
export { useLocalStorage as a, useAsyncStorage as b, useTaroStorage as c, useElectronStorage as d, useStorage as u };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { S as StorageAdapter } from './types-BaZccpvk.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 通用存储 Hook
|
|
5
|
+
* 支持多平台:Web、React Native、小程序
|
|
6
|
+
*
|
|
7
|
+
* 优点:
|
|
8
|
+
* 1. 异步读取,不阻塞渲染
|
|
9
|
+
* 2. 统一的错误处理
|
|
10
|
+
* 3. 类型安全
|
|
11
|
+
* 4. 跨平台支持
|
|
12
|
+
* 5. 自动同步(支持的平台)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
declare function useStorage<T>(storage: StorageAdapter, key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Web 平台 localStorage Hook
|
|
19
|
+
* 基于通用 useStorage 的便捷封装
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Web 平台的 localStorage Hook
|
|
23
|
+
*
|
|
24
|
+
* @param key - 存储键名
|
|
25
|
+
* @param defaultValue - 默认值
|
|
26
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
27
|
+
*/
|
|
28
|
+
declare function useLocalStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* React Native 的 AsyncStorage Hook
|
|
32
|
+
*
|
|
33
|
+
* @param key - 存储键名
|
|
34
|
+
* @param defaultValue - 默认值
|
|
35
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
36
|
+
*/
|
|
37
|
+
declare function useAsyncStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 小程序的 Taro Storage Hook
|
|
41
|
+
*
|
|
42
|
+
* @param key - 存储键名
|
|
43
|
+
* @param defaultValue - 默认值
|
|
44
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
45
|
+
*/
|
|
46
|
+
declare function useTaroStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Electron 桌面端的 Storage Hook
|
|
50
|
+
*
|
|
51
|
+
* 在 Electron 渲染进程中使用 localStorage
|
|
52
|
+
* 支持跨窗口同步
|
|
53
|
+
*
|
|
54
|
+
* @param key - 存储键名
|
|
55
|
+
* @param defaultValue - 默认值
|
|
56
|
+
* @returns [value, setValue, removeValue, isLoading]
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* const [token, setToken, removeToken] = useElectronStorage('auth-token', '')
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function useElectronStorage<T>(key: string, defaultValue: T): [T, (value: T) => void, () => void, boolean];
|
|
64
|
+
|
|
65
|
+
export { useLocalStorage as a, useAsyncStorage as b, useTaroStorage as c, useElectronStorage as d, useStorage as u };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 时间格式化工具
|
|
5
|
+
*/
|
|
6
|
+
declare const formatTime: {
|
|
7
|
+
/**
|
|
8
|
+
* 将秒数转换为 MM:SS 格式
|
|
9
|
+
*/
|
|
10
|
+
toMinutesSeconds(seconds: number): string;
|
|
11
|
+
/**
|
|
12
|
+
* 将秒数转换为 HH:MM:SS 格式
|
|
13
|
+
*/
|
|
14
|
+
toHoursMinutesSeconds(seconds: number): string;
|
|
15
|
+
/**
|
|
16
|
+
* 格式化日期为用户友好的格式
|
|
17
|
+
*/
|
|
18
|
+
formatDate(date: string | Date, locale?: string): string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 日语文本处理工具
|
|
23
|
+
*/
|
|
24
|
+
declare const japaneseUtils: {
|
|
25
|
+
/**
|
|
26
|
+
* 提取文本中的汉字
|
|
27
|
+
*/
|
|
28
|
+
extractKanji(text: string): string[];
|
|
29
|
+
/**
|
|
30
|
+
* 提取文本中的假名
|
|
31
|
+
*/
|
|
32
|
+
extractKana(text: string): string[];
|
|
33
|
+
/**
|
|
34
|
+
* 清理文本,移除特殊字符但保留日语字符
|
|
35
|
+
*/
|
|
36
|
+
cleanText(text: string): string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 验证工具
|
|
41
|
+
*/
|
|
42
|
+
declare const validators: {
|
|
43
|
+
/**
|
|
44
|
+
* 验证邮箱格式
|
|
45
|
+
*/
|
|
46
|
+
isValidEmail(email: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 验证密码强度
|
|
49
|
+
*/
|
|
50
|
+
isValidPassword(password: string): {
|
|
51
|
+
isValid: boolean;
|
|
52
|
+
errors: string[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* 验证用户名格式
|
|
56
|
+
*/
|
|
57
|
+
isValidUsername(username: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 验证文件大小
|
|
60
|
+
*/
|
|
61
|
+
isValidFileSize(size: number, maxSize: number): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 验证文件类型
|
|
64
|
+
*/
|
|
65
|
+
isValidFileType(type: string, supportedTypes: string[]): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 验证 URL 格式
|
|
68
|
+
*/
|
|
69
|
+
isValidUrl(url: string): boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 文件处理工具
|
|
74
|
+
*/
|
|
75
|
+
declare const fileUtils: {
|
|
76
|
+
/**
|
|
77
|
+
* 格式化文件大小
|
|
78
|
+
*/
|
|
79
|
+
formatFileSize(bytes: number): string;
|
|
80
|
+
/**
|
|
81
|
+
* 获取文件扩展名
|
|
82
|
+
*/
|
|
83
|
+
getFileExtension(filename: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* 生成唯一文件名
|
|
86
|
+
*/
|
|
87
|
+
generateUniqueFileName(originalName: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* 验证文件名是否有效
|
|
90
|
+
*/
|
|
91
|
+
isValidFilename(filename: string): boolean;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 数组和对象工具
|
|
96
|
+
*/
|
|
97
|
+
declare const arrayUtils: {
|
|
98
|
+
/**
|
|
99
|
+
* 数组去重
|
|
100
|
+
*/
|
|
101
|
+
unique<T>(array: T[]): T[];
|
|
102
|
+
/**
|
|
103
|
+
* 数组分组
|
|
104
|
+
*/
|
|
105
|
+
groupBy<T>(array: T[], key: keyof T): Record<string, T[]>;
|
|
106
|
+
/**
|
|
107
|
+
* 数组分页
|
|
108
|
+
*/
|
|
109
|
+
paginate<T>(array: T[], page: number, limit: number): {
|
|
110
|
+
data: T[];
|
|
111
|
+
total: number;
|
|
112
|
+
page: number;
|
|
113
|
+
pages: number;
|
|
114
|
+
hasNext: boolean;
|
|
115
|
+
hasPrev: boolean;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 数组随机排序
|
|
119
|
+
*/
|
|
120
|
+
shuffle<T>(array: T[]): T[];
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 字符串工具
|
|
125
|
+
*/
|
|
126
|
+
declare const stringUtils: {
|
|
127
|
+
/**
|
|
128
|
+
* 截断文本
|
|
129
|
+
*/
|
|
130
|
+
truncate(text: string, length: number, suffix?: string): string;
|
|
131
|
+
/**
|
|
132
|
+
* 首字母大写
|
|
133
|
+
*/
|
|
134
|
+
capitalize(text: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* 驼峰转下划线
|
|
137
|
+
*/
|
|
138
|
+
camelToSnake(text: string): string;
|
|
139
|
+
/**
|
|
140
|
+
* 下划线转驼峰
|
|
141
|
+
*/
|
|
142
|
+
snakeToCamel(text: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* 生成随机字符串
|
|
145
|
+
*/
|
|
146
|
+
generateRandom(length: number): string;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 调试工具
|
|
151
|
+
*/
|
|
152
|
+
declare const debugUtils: {
|
|
153
|
+
/**
|
|
154
|
+
* 安全的 JSON 序列化
|
|
155
|
+
*/
|
|
156
|
+
safeStringify(obj: any): string;
|
|
157
|
+
/**
|
|
158
|
+
* 性能计时器
|
|
159
|
+
*/
|
|
160
|
+
createTimer(label?: string): {
|
|
161
|
+
end: () => number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* 内存使用情况(仅在 Node.js 环境)
|
|
165
|
+
*/
|
|
166
|
+
getMemoryUsage(): Record<string, string> | null;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 错误处理工具
|
|
171
|
+
*/
|
|
172
|
+
declare const errorUtils: {
|
|
173
|
+
/**
|
|
174
|
+
* 创建标准化的错误对象
|
|
175
|
+
*/
|
|
176
|
+
createError(code: string, message: string, details?: any): Error & {
|
|
177
|
+
code: string;
|
|
178
|
+
details?: any;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* 安全的错误信息提取
|
|
182
|
+
*/
|
|
183
|
+
extractErrorMessage(error: unknown): string;
|
|
184
|
+
/**
|
|
185
|
+
* 错误重试机制
|
|
186
|
+
*/
|
|
187
|
+
retry<T>(fn: () => Promise<T>, maxAttempts?: number, delay?: number): Promise<T>;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
191
|
+
|
|
192
|
+
export { arrayUtils, cn, debugUtils, errorUtils, fileUtils, formatTime, japaneseUtils, stringUtils, validators };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 时间格式化工具
|
|
5
|
+
*/
|
|
6
|
+
declare const formatTime: {
|
|
7
|
+
/**
|
|
8
|
+
* 将秒数转换为 MM:SS 格式
|
|
9
|
+
*/
|
|
10
|
+
toMinutesSeconds(seconds: number): string;
|
|
11
|
+
/**
|
|
12
|
+
* 将秒数转换为 HH:MM:SS 格式
|
|
13
|
+
*/
|
|
14
|
+
toHoursMinutesSeconds(seconds: number): string;
|
|
15
|
+
/**
|
|
16
|
+
* 格式化日期为用户友好的格式
|
|
17
|
+
*/
|
|
18
|
+
formatDate(date: string | Date, locale?: string): string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 日语文本处理工具
|
|
23
|
+
*/
|
|
24
|
+
declare const japaneseUtils: {
|
|
25
|
+
/**
|
|
26
|
+
* 提取文本中的汉字
|
|
27
|
+
*/
|
|
28
|
+
extractKanji(text: string): string[];
|
|
29
|
+
/**
|
|
30
|
+
* 提取文本中的假名
|
|
31
|
+
*/
|
|
32
|
+
extractKana(text: string): string[];
|
|
33
|
+
/**
|
|
34
|
+
* 清理文本,移除特殊字符但保留日语字符
|
|
35
|
+
*/
|
|
36
|
+
cleanText(text: string): string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 验证工具
|
|
41
|
+
*/
|
|
42
|
+
declare const validators: {
|
|
43
|
+
/**
|
|
44
|
+
* 验证邮箱格式
|
|
45
|
+
*/
|
|
46
|
+
isValidEmail(email: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 验证密码强度
|
|
49
|
+
*/
|
|
50
|
+
isValidPassword(password: string): {
|
|
51
|
+
isValid: boolean;
|
|
52
|
+
errors: string[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* 验证用户名格式
|
|
56
|
+
*/
|
|
57
|
+
isValidUsername(username: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 验证文件大小
|
|
60
|
+
*/
|
|
61
|
+
isValidFileSize(size: number, maxSize: number): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 验证文件类型
|
|
64
|
+
*/
|
|
65
|
+
isValidFileType(type: string, supportedTypes: string[]): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 验证 URL 格式
|
|
68
|
+
*/
|
|
69
|
+
isValidUrl(url: string): boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 文件处理工具
|
|
74
|
+
*/
|
|
75
|
+
declare const fileUtils: {
|
|
76
|
+
/**
|
|
77
|
+
* 格式化文件大小
|
|
78
|
+
*/
|
|
79
|
+
formatFileSize(bytes: number): string;
|
|
80
|
+
/**
|
|
81
|
+
* 获取文件扩展名
|
|
82
|
+
*/
|
|
83
|
+
getFileExtension(filename: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* 生成唯一文件名
|
|
86
|
+
*/
|
|
87
|
+
generateUniqueFileName(originalName: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* 验证文件名是否有效
|
|
90
|
+
*/
|
|
91
|
+
isValidFilename(filename: string): boolean;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 数组和对象工具
|
|
96
|
+
*/
|
|
97
|
+
declare const arrayUtils: {
|
|
98
|
+
/**
|
|
99
|
+
* 数组去重
|
|
100
|
+
*/
|
|
101
|
+
unique<T>(array: T[]): T[];
|
|
102
|
+
/**
|
|
103
|
+
* 数组分组
|
|
104
|
+
*/
|
|
105
|
+
groupBy<T>(array: T[], key: keyof T): Record<string, T[]>;
|
|
106
|
+
/**
|
|
107
|
+
* 数组分页
|
|
108
|
+
*/
|
|
109
|
+
paginate<T>(array: T[], page: number, limit: number): {
|
|
110
|
+
data: T[];
|
|
111
|
+
total: number;
|
|
112
|
+
page: number;
|
|
113
|
+
pages: number;
|
|
114
|
+
hasNext: boolean;
|
|
115
|
+
hasPrev: boolean;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 数组随机排序
|
|
119
|
+
*/
|
|
120
|
+
shuffle<T>(array: T[]): T[];
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 字符串工具
|
|
125
|
+
*/
|
|
126
|
+
declare const stringUtils: {
|
|
127
|
+
/**
|
|
128
|
+
* 截断文本
|
|
129
|
+
*/
|
|
130
|
+
truncate(text: string, length: number, suffix?: string): string;
|
|
131
|
+
/**
|
|
132
|
+
* 首字母大写
|
|
133
|
+
*/
|
|
134
|
+
capitalize(text: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* 驼峰转下划线
|
|
137
|
+
*/
|
|
138
|
+
camelToSnake(text: string): string;
|
|
139
|
+
/**
|
|
140
|
+
* 下划线转驼峰
|
|
141
|
+
*/
|
|
142
|
+
snakeToCamel(text: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* 生成随机字符串
|
|
145
|
+
*/
|
|
146
|
+
generateRandom(length: number): string;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 调试工具
|
|
151
|
+
*/
|
|
152
|
+
declare const debugUtils: {
|
|
153
|
+
/**
|
|
154
|
+
* 安全的 JSON 序列化
|
|
155
|
+
*/
|
|
156
|
+
safeStringify(obj: any): string;
|
|
157
|
+
/**
|
|
158
|
+
* 性能计时器
|
|
159
|
+
*/
|
|
160
|
+
createTimer(label?: string): {
|
|
161
|
+
end: () => number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* 内存使用情况(仅在 Node.js 环境)
|
|
165
|
+
*/
|
|
166
|
+
getMemoryUsage(): Record<string, string> | null;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 错误处理工具
|
|
171
|
+
*/
|
|
172
|
+
declare const errorUtils: {
|
|
173
|
+
/**
|
|
174
|
+
* 创建标准化的错误对象
|
|
175
|
+
*/
|
|
176
|
+
createError(code: string, message: string, details?: any): Error & {
|
|
177
|
+
code: string;
|
|
178
|
+
details?: any;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* 安全的错误信息提取
|
|
182
|
+
*/
|
|
183
|
+
extractErrorMessage(error: unknown): string;
|
|
184
|
+
/**
|
|
185
|
+
* 错误重试机制
|
|
186
|
+
*/
|
|
187
|
+
retry<T>(fn: () => Promise<T>, maxAttempts?: number, delay?: number): Promise<T>;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
191
|
+
|
|
192
|
+
export { arrayUtils, cn, debugUtils, errorUtils, fileUtils, formatTime, japaneseUtils, stringUtils, validators };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sa2kit",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.11",
|
|
4
4
|
"description": "A modern, type-safe React utility library with cross-platform support and platform adapters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -310,6 +310,7 @@
|
|
|
310
310
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
311
311
|
"@radix-ui/react-dialog": "^1.1.6",
|
|
312
312
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
313
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
313
314
|
"@radix-ui/react-popover": "^1.1.6",
|
|
314
315
|
"@radix-ui/react-progress": "^1.1.7",
|
|
315
316
|
"@radix-ui/react-scroll-area": "^1.2.10",
|
package/dist/chunk-4FOBBWXW.mjs
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-3BGPZN4X.mjs';
|
|
2
|
-
import React2, { useEffect } from 'react';
|
|
3
|
-
|
|
4
|
-
var SearchBox = ({
|
|
5
|
-
searchQuery,
|
|
6
|
-
onSearchChange,
|
|
7
|
-
placeholder = "\u641C\u7D22\u5B9E\u9A8C\u9879\u76EE\u7684\u6807\u9898\u3001\u63CF\u8FF0\u6216\u6807\u7B7E...",
|
|
8
|
-
size = "large"
|
|
9
|
-
}) => {
|
|
10
|
-
const getSizeStyles = () => {
|
|
11
|
-
switch (size) {
|
|
12
|
-
case "small":
|
|
13
|
-
return {
|
|
14
|
-
container: "h-10",
|
|
15
|
-
input: "pl-10 pr-10 text-sm",
|
|
16
|
-
icon: "w-4 h-4",
|
|
17
|
-
iconPosition: "left-3",
|
|
18
|
-
clearButton: "right-2 w-6 h-6",
|
|
19
|
-
clearIcon: "w-3 h-3"
|
|
20
|
-
};
|
|
21
|
-
case "medium":
|
|
22
|
-
return {
|
|
23
|
-
container: "h-12",
|
|
24
|
-
input: "pl-12 pr-12 text-base",
|
|
25
|
-
icon: "w-5 h-5",
|
|
26
|
-
iconPosition: "left-3",
|
|
27
|
-
clearButton: "right-3 w-7 h-7",
|
|
28
|
-
clearIcon: "w-4 h-4"
|
|
29
|
-
};
|
|
30
|
-
case "large":
|
|
31
|
-
default:
|
|
32
|
-
return {
|
|
33
|
-
container: "h-16",
|
|
34
|
-
input: "pl-6 pr-16 text-lg",
|
|
35
|
-
icon: "w-6 h-6",
|
|
36
|
-
iconPosition: "left-6",
|
|
37
|
-
clearButton: "right-4 w-8 h-8",
|
|
38
|
-
clearIcon: "w-4 h-4"
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const styles = getSizeStyles();
|
|
43
|
-
const isLarge = size === "large";
|
|
44
|
-
return /* @__PURE__ */ React2.createElement("div", { className: "relative group w-full" }, /* @__PURE__ */ React2.createElement(
|
|
45
|
-
"input",
|
|
46
|
-
{
|
|
47
|
-
type: "text",
|
|
48
|
-
placeholder,
|
|
49
|
-
value: searchQuery,
|
|
50
|
-
onChange: (e) => onSearchChange(e.target.value),
|
|
51
|
-
className: `
|
|
52
|
-
w-full ${styles.container} ${styles.input}
|
|
53
|
-
${isLarge ? "border-2 border-gray-200 rounded-2xl shadow-lg" : "border border-gray-300 rounded-lg shadow-sm"}
|
|
54
|
-
bg-white
|
|
55
|
-
focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500
|
|
56
|
-
hover:border-gray-400 ${isLarge ? "hover:shadow-xl" : "hover:shadow-md"}
|
|
57
|
-
transition-all duration-300 ease-out
|
|
58
|
-
text-gray-800 placeholder-gray-500
|
|
59
|
-
${isLarge ? "font-medium" : "font-normal"}
|
|
60
|
-
`
|
|
61
|
-
}
|
|
62
|
-
), searchQuery && /* @__PURE__ */ React2.createElement(
|
|
63
|
-
"button",
|
|
64
|
-
{
|
|
65
|
-
onClick: () => onSearchChange(""),
|
|
66
|
-
className: `
|
|
67
|
-
absolute top-1/2 ${styles.clearButton} transform -translate-y-1/2
|
|
68
|
-
z-10 group/clear
|
|
69
|
-
`
|
|
70
|
-
},
|
|
71
|
-
/* @__PURE__ */ React2.createElement("div", { className: `
|
|
72
|
-
${styles.clearButton} flex items-center justify-center
|
|
73
|
-
rounded-full
|
|
74
|
-
bg-gray-100 hover:bg-gray-200
|
|
75
|
-
transition-all duration-200
|
|
76
|
-
group-hover/clear:scale-105
|
|
77
|
-
` }, /* @__PURE__ */ React2.createElement(
|
|
78
|
-
"svg",
|
|
79
|
-
{
|
|
80
|
-
className: `${styles.clearIcon} text-gray-500 group-hover/clear:text-gray-700`,
|
|
81
|
-
fill: "none",
|
|
82
|
-
stroke: "currentColor",
|
|
83
|
-
viewBox: "0 0 24 24"
|
|
84
|
-
},
|
|
85
|
-
/* @__PURE__ */ React2.createElement(
|
|
86
|
-
"path",
|
|
87
|
-
{
|
|
88
|
-
strokeLinecap: "round",
|
|
89
|
-
strokeLinejoin: "round",
|
|
90
|
-
strokeWidth: 2,
|
|
91
|
-
d: "M6 18L18 6M6 6l12 12"
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
))
|
|
95
|
-
));
|
|
96
|
-
};
|
|
97
|
-
var Modal = ({
|
|
98
|
-
isOpen,
|
|
99
|
-
onClose,
|
|
100
|
-
title,
|
|
101
|
-
children,
|
|
102
|
-
width = 600,
|
|
103
|
-
height,
|
|
104
|
-
maskClosable = true,
|
|
105
|
-
className = "",
|
|
106
|
-
contentClassName = "",
|
|
107
|
-
showCloseButton = true,
|
|
108
|
-
zIndex
|
|
109
|
-
}) => {
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (isOpen) {
|
|
112
|
-
document.body.style.overflow = "hidden";
|
|
113
|
-
} else {
|
|
114
|
-
document.body.style.overflow = "unset";
|
|
115
|
-
}
|
|
116
|
-
return () => {
|
|
117
|
-
document.body.style.overflow = "unset";
|
|
118
|
-
};
|
|
119
|
-
}, [isOpen]);
|
|
120
|
-
if (!isOpen) return null;
|
|
121
|
-
return /* @__PURE__ */ React2.createElement("div", { className: "fixed inset-0 flex items-center justify-center p-4", style: { zIndex: zIndex || 50 } }, /* @__PURE__ */ React2.createElement(
|
|
122
|
-
"div",
|
|
123
|
-
{
|
|
124
|
-
className: "fixed inset-0 bg-black/50 transition-opacity",
|
|
125
|
-
onClick: () => maskClosable && onClose()
|
|
126
|
-
}
|
|
127
|
-
), /* @__PURE__ */ React2.createElement(
|
|
128
|
-
"div",
|
|
129
|
-
{
|
|
130
|
-
className: cn(
|
|
131
|
-
"bg-white rounded-xl shadow-2xl z-10 overflow-hidden flex flex-col transition-all transform scale-100",
|
|
132
|
-
className
|
|
133
|
-
),
|
|
134
|
-
style: {
|
|
135
|
-
width: typeof width === "number" ? `${width}px` : width,
|
|
136
|
-
height: typeof height === "number" ? `${height}px` : height,
|
|
137
|
-
maxWidth: "100%"
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
(title || showCloseButton) && /* @__PURE__ */ React2.createElement("div", { className: "px-6 py-4 border-b border-gray-200 flex justify-between items-center" }, /* @__PURE__ */ React2.createElement("h3", { className: "text-xl font-semibold text-gray-900" }, title), showCloseButton && /* @__PURE__ */ React2.createElement("button", { onClick: onClose, className: "text-gray-400 hover:text-gray-600 transition-colors" }, /* @__PURE__ */ React2.createElement("span", { className: "text-2xl" }, "\xD7"))),
|
|
141
|
-
/* @__PURE__ */ React2.createElement("div", { className: cn("flex-1 overflow-y-auto", contentClassName) }, children)
|
|
142
|
-
));
|
|
143
|
-
};
|
|
144
|
-
var ConfirmModal = ({
|
|
145
|
-
isOpen,
|
|
146
|
-
onClose,
|
|
147
|
-
onConfirm,
|
|
148
|
-
title,
|
|
149
|
-
message,
|
|
150
|
-
confirmText = "\u786E\u5B9A",
|
|
151
|
-
cancelText = "\u53D6\u6D88",
|
|
152
|
-
isLoading = false,
|
|
153
|
-
className = "",
|
|
154
|
-
zIndex
|
|
155
|
-
}) => {
|
|
156
|
-
if (!isOpen) return null;
|
|
157
|
-
return /* @__PURE__ */ React2.createElement(Modal, { isOpen, onClose, title, width: 400, className, zIndex }, /* @__PURE__ */ React2.createElement("div", { className: "p-6" }, /* @__PURE__ */ React2.createElement("p", { className: "text-gray-600 mb-6" }, message), /* @__PURE__ */ React2.createElement("div", { className: "flex justify-end space-x-3" }, /* @__PURE__ */ React2.createElement(
|
|
158
|
-
"button",
|
|
159
|
-
{
|
|
160
|
-
onClick: onClose,
|
|
161
|
-
className: "px-4 py-2 text-gray-700 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",
|
|
162
|
-
disabled: isLoading
|
|
163
|
-
},
|
|
164
|
-
cancelText
|
|
165
|
-
), /* @__PURE__ */ React2.createElement(
|
|
166
|
-
"button",
|
|
167
|
-
{
|
|
168
|
-
onClick: onConfirm,
|
|
169
|
-
className: "px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors flex items-center",
|
|
170
|
-
disabled: isLoading
|
|
171
|
-
},
|
|
172
|
-
isLoading && /* @__PURE__ */ React2.createElement("div", { className: "mr-2 w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin" }),
|
|
173
|
-
confirmText
|
|
174
|
-
))));
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export { ConfirmModal, Modal, SearchBox };
|
|
178
|
-
//# sourceMappingURL=chunk-4FOBBWXW.mjs.map
|
|
179
|
-
//# sourceMappingURL=chunk-4FOBBWXW.mjs.map
|