sa2kit 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +93 -94
  2. package/dist/AliyunOSSProvider-2UZRIGT3.mjs +6 -0
  3. package/dist/{AliyunOSSProvider-GQMSDJGZ.mjs.map → AliyunOSSProvider-2UZRIGT3.mjs.map} +1 -1
  4. package/dist/AliyunOSSProvider-XCTK3QQA.js +15 -0
  5. package/dist/{AliyunOSSProvider-7JLMJDXK.js.map → AliyunOSSProvider-XCTK3QQA.js.map} +1 -1
  6. package/dist/audioDetection/index.js.map +1 -1
  7. package/dist/audioDetection/index.mjs.map +1 -1
  8. package/dist/{chunk-5XUE72Y3.mjs → chunk-6LEA37ZM.mjs} +2 -2
  9. package/dist/{chunk-5XUE72Y3.mjs.map → chunk-6LEA37ZM.mjs.map} +1 -1
  10. package/dist/chunk-EBP7AE6F.js +167 -0
  11. package/dist/chunk-EBP7AE6F.js.map +1 -0
  12. package/dist/{chunk-3RFBUDRA.js → chunk-EXT3IKQA.js} +39 -6
  13. package/dist/chunk-EXT3IKQA.js.map +1 -0
  14. package/dist/chunk-MBG4DBGP.mjs +154 -0
  15. package/dist/chunk-MBG4DBGP.mjs.map +1 -0
  16. package/dist/{chunk-YVBU7QDJ.mjs → chunk-OHUE7EL6.mjs} +34 -5
  17. package/dist/chunk-OHUE7EL6.mjs.map +1 -0
  18. package/dist/{chunk-DQVPZTVC.js → chunk-QKXKXAAV.js} +2 -2
  19. package/dist/{chunk-DQVPZTVC.js.map → chunk-QKXKXAAV.js.map} +1 -1
  20. package/dist/imageCrop/index.js.map +1 -1
  21. package/dist/imageCrop/index.mjs.map +1 -1
  22. package/dist/index-DtLpANUB.d.mts +70 -0
  23. package/dist/index-DtLpANUB.d.ts +70 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/mmd/admin/index.d.mts +1 -1
  27. package/dist/mmd/admin/index.d.ts +1 -1
  28. package/dist/mmd/admin/index.js +7 -1
  29. package/dist/mmd/admin/index.js.map +1 -1
  30. package/dist/mmd/admin/index.mjs +7 -1
  31. package/dist/mmd/admin/index.mjs.map +1 -1
  32. package/dist/mmd/index.d.mts +34 -3
  33. package/dist/mmd/index.d.ts +34 -3
  34. package/dist/mmd/index.js +477 -169
  35. package/dist/mmd/index.js.map +1 -1
  36. package/dist/mmd/index.mjs +478 -170
  37. package/dist/mmd/index.mjs.map +1 -1
  38. package/dist/mmd/server/index.d.mts +1 -1
  39. package/dist/mmd/server/index.d.ts +1 -1
  40. package/dist/music/index.d.mts +30 -0
  41. package/dist/music/index.d.ts +30 -0
  42. package/dist/music/index.js +458 -0
  43. package/dist/music/index.js.map +1 -0
  44. package/dist/music/index.mjs +427 -0
  45. package/dist/music/index.mjs.map +1 -0
  46. package/dist/music/server/index.d.mts +1 -0
  47. package/dist/music/server/index.d.ts +1 -0
  48. package/dist/music/server/index.js +29 -0
  49. package/dist/music/server/index.js.map +1 -0
  50. package/dist/music/server/index.mjs +4 -0
  51. package/dist/music/server/index.mjs.map +1 -0
  52. package/dist/testYourself/admin/index.js +3 -3
  53. package/dist/testYourself/admin/index.mjs +1 -1
  54. package/dist/testYourself/index.js +7 -7
  55. package/dist/testYourself/index.js.map +1 -1
  56. package/dist/testYourself/index.mjs +2 -2
  57. package/dist/testYourself/index.mjs.map +1 -1
  58. package/dist/{types-CsTSddwu.d.mts → types-B60F7EZZ.d.mts} +49 -2
  59. package/dist/{types-CsTSddwu.d.ts → types-B60F7EZZ.d.ts} +49 -2
  60. package/dist/universalFile/server/index.d.mts +15 -0
  61. package/dist/universalFile/server/index.d.ts +15 -0
  62. package/dist/universalFile/server/index.js +6 -6
  63. package/dist/universalFile/server/index.mjs +2 -2
  64. package/package.json +35 -19
  65. package/tailwind.animations.js +5 -0
  66. package/dist/AliyunOSSProvider-7JLMJDXK.js +0 -15
  67. package/dist/AliyunOSSProvider-GQMSDJGZ.mjs +0 -6
  68. package/dist/chunk-3RFBUDRA.js.map +0 -1
  69. package/dist/chunk-YVBU7QDJ.mjs.map +0 -1
package/README.md CHANGED
@@ -1,67 +1,67 @@
1
1
  # SA2Kit
2
2
 
3
- A modern, type-safe React utility library with cross-platform support for building scalable applications.
3
+ 一个现代的、类型安全的 React 工具库,具有跨平台支持,用于构建可扩展的应用程序。
4
4
 
5
- ## Features
5
+ ## 特性
6
6
 
7
- - 🚀 **Modern TypeScript** - Full type safety and IntelliSense support
8
- - 📦 **Tree-shakeable** - Optimized bundle size with ESM support
9
- - 🔄 **Cross-platform** - Works in browser and Node.js environments
10
- - ⚡ **Zero dependencies** - Minimal footprint (React as peer dependency)
11
- - 🧩 **Modular** - Import only what you need
12
- - 🎯 **React Hooks** - Custom hooks for common patterns
13
- - 📝 **Logger System** - Unified logging with multiple adapters
14
- - 💾 **Storage Adapters** - Universal storage abstraction
15
- - 📁 **File Upload** - Complete file management with progress tracking
16
- - 📊 **Data Export** - Flexible export to CSV, Excel, JSON formats
17
- - 🌍 **i18n** - Complete internationalization solution
18
- - 📈 **Analytics** - Comprehensive event tracking and analytics
7
+ - 🚀 **现代 TypeScript** - 完整的类型安全和 IntelliSense 支持
8
+ - 📦 **Tree-shakeable** - 使用 ESM 支持优化包大小
9
+ - 🔄 **跨平台** - 适用于浏览器和 Node.js 环境
10
+ - ⚡ **零依赖** - 极小的体积(React 作为 peer dependency
11
+ - 🧩 **模块化** - 仅导入你需要的部分
12
+ - 🎯 **React Hooks** - 常用模式的自定义 Hook
13
+ - 📝 **日志系统** - 统一的日志记录,支持多个适配器
14
+ - 💾 **存储适配器** - 通用存储抽象
15
+ - 📁 **文件上传** - 完整的文件管理,支持进度追踪
16
+ - 📊 **数据导出** - 灵活导出为 CSVExcelJSON 格式
17
+ - 🌍 **i18n** - 完整的国际化解决方案
18
+ - 📈 **数据分析** - 全面的事件跟踪和分析
19
19
 
20
- ## Installation
20
+ ## 安装
21
21
 
22
22
  ```bash
23
23
  npm install @qhr123/sa2kit
24
- # or
24
+ #
25
25
  yarn add @qhr123/sa2kit
26
- # or
26
+ #
27
27
  pnpm add @qhr123/sa2kit
28
28
  ```
29
29
 
30
- ## Quick Start
30
+ ## 快速开始
31
31
 
32
- ### Logger
32
+ ### 日志 (Logger)
33
33
 
34
34
  ```typescript
35
35
  import { logger, createLogger, LogLevel } from '@qhr123/sa2kit/logger';
36
36
 
37
- // Use default logger
38
- logger.info('Application started');
39
- logger.debug('Debug information', { user: 'John' });
40
- logger.error('Something went wrong', new Error('Error details'));
37
+ // 使用默认日志记录器
38
+ logger.info('应用程序已启动');
39
+ logger.debug('调试信息', { user: 'John' });
40
+ logger.error('发生错误', new Error('错误详情'));
41
41
 
42
- // Create custom logger with context
42
+ // 创建带有上下文的自定义日志记录器
43
43
  const apiLogger = createLogger('API', {
44
44
  minLevel: LogLevel.INFO,
45
45
  enableTimestamp: true,
46
46
  });
47
47
 
48
- apiLogger.info('API request completed');
48
+ apiLogger.info('API 请求已完成');
49
49
  ```
50
50
 
51
- ### Utility Functions
51
+ ### 工具函数 (Utility Functions)
52
52
 
53
53
  ```typescript
54
54
  import { stringUtils, arrayUtils, fileUtils } from '@qhr123/sa2kit/utils';
55
55
 
56
- // String utilities
56
+ // 字符串工具
57
57
  const capitalized = stringUtils.capitalize('hello world');
58
- const truncated = stringUtils.truncate('Long text...', 10);
58
+ const truncated = stringUtils.truncate('这是一段很长的文本...', 10);
59
59
 
60
- // Array utilities
60
+ // 数组工具
61
61
  const unique = arrayUtils.unique([1, 2, 2, 3, 3, 4]);
62
62
  const grouped = arrayUtils.groupBy(items, 'category');
63
63
 
64
- // File utilities
64
+ // 文件工具
65
65
  const size = fileUtils.formatFileSize(1024000);
66
66
  const isValid = fileUtils.isValidFilename('document.pdf');
67
67
  ```
@@ -72,22 +72,22 @@ const isValid = fileUtils.isValidFilename('document.pdf');
72
72
  import { useLocalStorage, useAsyncStorage } from '@qhr123/sa2kit/hooks';
73
73
 
74
74
  function MyComponent() {
75
- // Persistent state with localStorage
75
+ // 使用 localStorage 进行持久化状态管理
76
76
  const [theme, setTheme] = useLocalStorage('theme', 'light');
77
77
 
78
- // Async storage operations
78
+ // 异步存储操作
79
79
  const { data, loading, error } = useAsyncStorage('user-data');
80
80
 
81
- return <div>Theme: {theme}</div>;
81
+ return <div>当前主题: {theme}</div>;
82
82
  }
83
83
  ```
84
84
 
85
- ### File Upload
85
+ ### 文件上传 (File Upload)
86
86
 
87
87
  ```typescript
88
88
  import { universalFileClient } from '@qhr123/sa2kit/universalFile';
89
89
 
90
- // Upload a file with progress tracking
90
+ // 上传文件并追踪进度
91
91
  const uploadFile = async (file: File) => {
92
92
  const fileMetadata = await universalFileClient.uploadFile(
93
93
  {
@@ -97,31 +97,31 @@ const uploadFile = async (file: File) => {
97
97
  permission: 'public',
98
98
  },
99
99
  (progress) => {
100
- console.log(`Upload progress: ${progress.progress}%`);
101
- console.log(`Speed: ${progress.speed} bytes/sec`);
100
+ console.log(`上传进度: ${progress.progress}%`);
101
+ console.log(`上传速度: ${progress.speed} 字节/秒`);
102
102
  }
103
103
  );
104
104
 
105
- console.log('File uploaded:', fileMetadata.id);
105
+ console.log('文件已上传,ID:', fileMetadata.id);
106
106
  return fileMetadata;
107
107
  };
108
108
 
109
- // Query files
109
+ // 查询文件
110
110
  const files = await universalFileClient.queryFiles({
111
111
  moduleId: 'user-avatars',
112
112
  pageSize: 20,
113
113
  });
114
114
 
115
- // Get file URL
115
+ // 获取文件 URL
116
116
  const fileUrl = await universalFileClient.getFileUrl(fileId);
117
117
  ```
118
118
 
119
- ### Data Export
119
+ ### 数据导出 (Data Export)
120
120
 
121
121
  ```typescript
122
122
  import { universalExportClient } from '@qhr123/sa2kit/universalExport';
123
123
 
124
- // Export data to CSV
124
+ // 导出数据为 CSV
125
125
  const exportData = async () => {
126
126
  const result = await universalExportClient.exportData({
127
127
  configId: 'my-export-config',
@@ -132,11 +132,11 @@ const exportData = async () => {
132
132
  format: 'csv',
133
133
  callbacks: {
134
134
  onProgress: (progress) => {
135
- console.log(`Export progress: ${progress.progress}%`);
135
+ console.log(`导出进度: ${progress.progress}%`);
136
136
  },
137
137
  onSuccess: (result) => {
138
- console.log('Export completed:', result.fileName);
139
- // Download the file
138
+ console.log('导出完成:', result.fileName);
139
+ // 下载文件
140
140
  const url = URL.createObjectURL(result.fileBlob!);
141
141
  const a = document.createElement('a');
142
142
  a.href = url;
@@ -148,13 +148,13 @@ const exportData = async () => {
148
148
  };
149
149
  ```
150
150
 
151
- ### Internationalization (i18n)
151
+ ### 国际化 (i18n)
152
152
 
153
153
  ```typescript
154
154
  import { createI18n, useTranslation } from '@qhr123/sa2kit/i18n';
155
155
  import { zhCN, enUS } from '@qhr123/sa2kit/i18n';
156
156
 
157
- // Create i18n instance
157
+ // 创建 i18n 实例
158
158
  const i18n = createI18n({
159
159
  locale: 'zh-CN',
160
160
  fallbackLocale: 'en-US',
@@ -164,7 +164,7 @@ const i18n = createI18n({
164
164
  },
165
165
  });
166
166
 
167
- // In React component
167
+ // React 组件中使用
168
168
  function MyComponent() {
169
169
  const { t, locale, setLocale } = useTranslation();
170
170
 
@@ -172,51 +172,50 @@ function MyComponent() {
172
172
  <div>
173
173
  <p>{t('common.welcome')}</p>
174
174
  <button onClick={() => setLocale('en-US')}>
175
- Switch to English
175
+ 切换为英文
176
176
  </button>
177
177
  </div>
178
178
  );
179
179
  }
180
180
  ```
181
181
 
182
- #### UI Components (Tailwind CSS)
182
+ #### UI 组件 (Tailwind CSS)
183
183
 
184
184
  ```typescript
185
185
  import { LanguageSwitcher } from '@qhr123/sa2kit/i18n';
186
186
 
187
- // Button group style (default)
187
+ // 按钮组样式 (默认)
188
188
  <LanguageSwitcher variant="buttons" />
189
189
 
190
- // Dropdown style
190
+ // 下拉菜单样式
191
191
  <LanguageSwitcher variant="dropdown" />
192
192
 
193
- // Icon button with dropdown
193
+ // 带有下拉菜单的图标按钮
194
194
  <LanguageSwitcher variant="icon" />
195
195
 
196
- // With custom className and callback
196
+ // 带有自定义类名和回调
197
197
  <LanguageSwitcher
198
198
  variant="buttons"
199
199
  className="my-custom-class"
200
200
  onLanguageChange={(locale) => {
201
- console.log('Language changed to:', locale);
201
+ console.log('语言已切换为:', locale);
202
202
  }}
203
203
  />
204
204
  ```
205
205
 
206
- **Requirements:**
206
+ **要求:**
207
207
  - ✅ React >= 18.0.0
208
- - ✅ Tailwind CSS configured in your project ([Setup Guide](./docs/tailwind-setup.md))
209
- - ✅ Next.js App Router compatible ('use client' included)
210
- ```
208
+ - ✅ 项目中已配置 Tailwind CSS ([设置指南](./docs/tailwind-setup.md))
209
+ - ✅ 兼容 Next.js App Router (已包含 'use client')
211
210
 
212
- **Note:** UI components use Tailwind CSS. See the [Tailwind Setup Guide](./docs/tailwind-setup.md) for configuration instructions.
211
+ **注意:** UI 组件使用 Tailwind CSS。请参阅 [Tailwind 设置指南](./docs/tailwind-setup.md) 获取配置说明。
213
212
 
214
- ### Analytics
213
+ ### 数据分析 (Analytics)
215
214
 
216
215
  ```typescript
217
216
  import { Analytics, createAnalytics } from '@qhr123/sa2kit/analytics';
218
217
 
219
- // Create analytics instance (需要提供适配器)
218
+ // 创建分析实例 (需要提供适配器)
220
219
  const analytics = createAnalytics('my-app', {
221
220
  appId: 'my-app',
222
221
  appVersion: '1.0.0',
@@ -225,74 +224,74 @@ const analytics = createAnalytics('my-app', {
225
224
  adapter: yourPlatformAdapter, // 需要自行实现
226
225
  });
227
226
 
228
- // Track events
227
+ // 追踪事件
229
228
  analytics.trackEvent('button_click', {
230
229
  button_id: 'submit',
231
230
  page: 'home',
232
231
  });
233
232
 
234
- // Use decorators (TypeScript)
233
+ // 使用装饰器 (TypeScript)
235
234
  class MyService {
236
235
  @Track('user_login')
237
236
  async login(username: string) {
238
- // Login logic
237
+ // 登录逻辑
239
238
  }
240
239
 
241
240
  @CatchError()
242
241
  async fetchData() {
243
- // Fetch logic
242
+ // 获取数据逻辑
244
243
  }
245
244
  }
246
245
 
247
- // Use React Hooks
246
+ // 使用 React Hooks
248
247
  function MyComponent() {
249
248
  const trackEvent = useAnalyticsEvent(analytics);
250
249
 
251
- usePageView(analytics); // Auto track page views
250
+ usePageView(analytics); // 自动追踪页面访问
252
251
 
253
252
  const handleClick = () => {
254
253
  trackEvent('button_click', { action: 'submit' });
255
254
  };
256
255
 
257
- return <button onClick={handleClick}>Submit</button>;
256
+ return <button onClick={handleClick}>提交</button>;
258
257
  }
259
258
  ```
260
259
 
261
- ## Documentation
260
+ ## 文档
262
261
 
263
- - [Tailwind CSS Setup](./docs/tailwind-setup.md) - **UI Components Configuration**
264
- - [Logger Documentation](./docs/logger.md)
265
- - [Utility Functions](./docs/utils.md)
266
- - [React Hooks](./docs/hooks.md)
267
- - [Storage Adapters](./docs/storage.md)
268
- - [File Upload Service](./docs/universalFile.md)
269
- - [Data Export Service](./docs/universalExport.md)
270
- - [i18n Internationalization](./docs/i18n.md)
271
- - [Analytics Tracking](./docs/analytics.md)
262
+ - [Tailwind CSS 设置](./docs/tailwind-setup.md) - **UI 组件配置**
263
+ - [日志文档](./docs/logger.md)
264
+ - [工具函数文档](./docs/utils.md)
265
+ - [React Hooks 文档](./docs/hooks.md)
266
+ - [存储适配器文档](./docs/storage.md)
267
+ - [文件上传服务文档](./docs/universalFile.md)
268
+ - [OSS 管理模块文档](./docs/ossManager.md) - **阿里云 OSS 管理界面**
269
+ - [数据导出服务文档](./docs/universalExport.md)
270
+ - [i18n 国际化文档](./docs/i18n.md)
271
+ - [数据分析追踪文档](./docs/analytics.md)
272
272
 
273
- ## Examples
273
+ ## 示例
274
274
 
275
- Check out the [examples](./examples) directory for complete working examples:
275
+ 查看 [examples](./examples) 目录以获取完整的运行示例:
276
276
 
277
- - React App Example
278
- - Next.js Integration
279
- - TypeScript Configuration
277
+ - React 应用示例
278
+ - Next.js 集成
279
+ - TypeScript 配置
280
280
 
281
- ## API Reference
281
+ ## API 参考
282
282
 
283
- Full API documentation is available at [https://react-utils-kit.dev](https://react-utils-kit.dev)
283
+ 完整的 API 文档可在 [https://react-utils-kit.dev](https://react-utils-kit.dev) 找到
284
284
 
285
- ## Contributing
285
+ ## 贡献
286
286
 
287
- We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
287
+ 我们欢迎贡献!详情请参阅 [CONTRIBUTING.md](./CONTRIBUTING.md)
288
288
 
289
- ## License
289
+ ## 许可证
290
290
 
291
291
  MIT © [Your Name](LICENSE)
292
292
 
293
- ## Support
294
-
295
- - 🐛 [Report a bug](https://github.com/your-org/react-utils-kit/issues)
296
- - 💡 [Request a feature](https://github.com/your-org/react-utils-kit/issues)
297
- - 📖 [Documentation](https://react-utils-kit.dev)
293
+ ## 支持
298
294
 
295
+ - 🐛 [报告错误](https://github.com/your-org/react-utils-kit/issues)
296
+ - 💡 [请求特性](https://github.com/your-org/react-utils-kit/issues)
297
+ - 📖 [文档中心](https://react-utils-kit.dev)
@@ -0,0 +1,6 @@
1
+ export { AliyunOSSProvider } from './chunk-OHUE7EL6.mjs';
2
+ import './chunk-ZGVB35L2.mjs';
3
+ import './chunk-KQGP6BTS.mjs';
4
+ import './chunk-BJTO5JO5.mjs';
5
+ //# sourceMappingURL=AliyunOSSProvider-2UZRIGT3.mjs.map
6
+ //# sourceMappingURL=AliyunOSSProvider-2UZRIGT3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"AliyunOSSProvider-GQMSDJGZ.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"AliyunOSSProvider-2UZRIGT3.mjs"}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var chunkEXT3IKQA_js = require('./chunk-EXT3IKQA.js');
4
+ require('./chunk-KH6RQ4J5.js');
5
+ require('./chunk-6PRFP5EG.js');
6
+ require('./chunk-DGUM43GV.js');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "AliyunOSSProvider", {
11
+ enumerable: true,
12
+ get: function () { return chunkEXT3IKQA_js.AliyunOSSProvider; }
13
+ });
14
+ //# sourceMappingURL=AliyunOSSProvider-XCTK3QQA.js.map
15
+ //# sourceMappingURL=AliyunOSSProvider-XCTK3QQA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"AliyunOSSProvider-7JLMJDXK.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"AliyunOSSProvider-XCTK3QQA.js"}