@wangtaizong/components 1.0.6 → 1.0.7

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 (80) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.dumirc.ts +28 -0
  4. package/.editorconfig +13 -0
  5. package/.eslintrc.js +3 -0
  6. package/.husky/commit-msg +5 -0
  7. package/.husky/pre-commit +8 -0
  8. package/.husky/pre-push +8 -0
  9. package/.prettierignore +2 -0
  10. package/.prettierrc.js +19 -0
  11. package/.stylelintrc +3 -0
  12. package/.vscode/settings.json +3 -0
  13. package/LICENSE +21 -0
  14. package/README.md +0 -52
  15. package/commitlint.config.js +21 -0
  16. package/docs/changelogs/index.md +9 -0
  17. package/docs/components/index.md +1 -0
  18. package/docs/guide/install.md +39 -0
  19. package/docs/index.md +21 -0
  20. package/docs/utils/index.md +1 -0
  21. package/lerna.json +8 -0
  22. package/package.json +66 -69
  23. package/packages/components/CHANGELOG.md +0 -0
  24. package/packages/components/package.json +48 -0
  25. package/packages/components/rollup.config.mjs +108 -0
  26. package/packages/components/src/Button/index.md +13 -0
  27. package/packages/components/src/Button/index.tsx +34 -0
  28. package/packages/components/src/Icon/index.md +81 -0
  29. package/packages/components/src/Icon/index.tsx +34 -0
  30. package/packages/components/src/Upload/index.md +209 -0
  31. package/packages/components/src/Upload/index.tsx +218 -0
  32. package/packages/components/src/antd/index.md +12 -0
  33. package/packages/components/src/antd/index.tsx +2 -0
  34. package/packages/components/src/index.md +23 -0
  35. package/packages/components/src/index.ts +5 -0
  36. package/packages/components/tsconfig.json +32 -0
  37. package/packages/utils/README.md +11 -0
  38. package/packages/utils/package.json +35 -0
  39. package/packages/utils/rollup.config.mjs +63 -0
  40. package/packages/utils/src/CHRRequest/index.md +59 -0
  41. package/packages/utils/src/CHRRequest/index.ts +94 -0
  42. package/packages/utils/src/index.ts +17 -0
  43. package/packages/utils/tsconfig.json +28 -0
  44. package/pnpm-workspace.yaml +8 -0
  45. package/public/favicon.ico +0 -0
  46. package/public/logo.webp +0 -0
  47. package/tsconfig.json +14 -0
  48. package/dist/Add.d.ts +0 -2
  49. package/dist/base-80a1f760-22b3368a.js +0 -23
  50. package/dist/components/editor/MonacoEditor.d.ts +0 -2
  51. package/dist/components/editor/WEditor.d.ts +0 -13
  52. package/dist/components/editor/sandpack-file-explorer/CreateNewNode.d.ts +0 -3
  53. package/dist/components/editor/sandpack-file-explorer/Example.d.ts +0 -4
  54. package/dist/components/editor/sandpack-file-explorer/FileTreeExplorer.d.ts +0 -1
  55. package/dist/components/editor/sandpack-file-explorer/SandpackFilesProvider.d.ts +0 -24
  56. package/dist/components/editor/sandpack-file-explorer/SingleInputForm.d.ts +0 -8
  57. package/dist/components/editor/sandpack-file-explorer/index.d.ts +0 -6
  58. package/dist/components/editor/sandpack-file-explorer/types.d.ts +0 -18
  59. package/dist/components/editor/sandpack-file-explorer/utils/arrayToObject.d.ts +0 -1
  60. package/dist/components/editor/sandpack-file-explorer/utils/buildPath.d.ts +0 -2
  61. package/dist/components/editor/sandpack-file-explorer/utils/deepMerge.d.ts +0 -2
  62. package/dist/components/editor/sandpack-file-explorer/utils/deleteKeys.d.ts +0 -4
  63. package/dist/components/editor/sandpack-file-explorer/utils/directoryFileMap.d.ts +0 -3
  64. package/dist/components/editor/sandpack-file-explorer/utils/fiindParentPath.d.ts +0 -1
  65. package/dist/components/editor/sandpack-file-explorer/utils/flattenObject.d.ts +0 -2
  66. package/dist/components/editor/sandpack-file-explorer/utils/getEntryFile.d.ts +0 -2
  67. package/dist/components/editor/sandpack-file-explorer/utils/getRemovedKeys.d.ts +0 -5
  68. package/dist/components/editor/sandpack-file-explorer/utils/index.d.ts +0 -12
  69. package/dist/components/editor/sandpack-file-explorer/utils/mergeHierarchicalArray.d.ts +0 -2
  70. package/dist/components/editor/sandpack-file-explorer/utils/removeHiddenEntries.d.ts +0 -3
  71. package/dist/components/editor/sandpack-file-explorer/utils/toHierarchicalArray.d.ts +0 -3
  72. package/dist/components/editor/utils/map.d.ts +0 -4
  73. package/dist/consoleHook-59e792cb-0fba2dba.js +0 -168
  74. package/dist/index-3417dbcd.js +0 -316
  75. package/dist/index-585bceb7-39d610b1.js +0 -8813
  76. package/dist/index-6426660e.js +0 -32172
  77. package/dist/index-a63bd288.js +0 -1104
  78. package/dist/index.d.ts +0 -2
  79. package/dist/index.es.js +0 -5
  80. package/dist/index.umd.js +0 -779
@@ -0,0 +1,81 @@
1
+ # CHRIcon
2
+
3
+ ## 代码演示
4
+
5
+ ### 基本用法
6
+
7
+ 通过 icon 属性指定图标名称(使用 Ant Design 图标组件的导出名)。
8
+
9
+ ```jsx
10
+ import { CHRIcon } from '@chr/components';
11
+
12
+ export default () => {
13
+ return (
14
+ <div style={{ display: 'flex', gap: 12 }}>
15
+ <CHRIcon icon="HomeOutlined" />
16
+ <CHRIcon icon="UserOutlined" />
17
+ <CHRIcon icon="SearchOutlined" />
18
+ </div>
19
+ );
20
+ };
21
+ ```
22
+
23
+ ### 自定义尺寸
24
+
25
+ 通过 fontSize 属性设置图标大小(单位:px)。
26
+
27
+ ```jsx
28
+ import { CHRIcon } from '@chr/components';
29
+
30
+ export default () => {
31
+ return (
32
+ <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
33
+ <CHRIcon icon="MessageOutlined" fontSize={16} />
34
+ <CHRIcon icon="MessageOutlined" fontSize={24} />
35
+ <CHRIcon icon="MessageOutlined" fontSize={32} />
36
+ <CHRIcon icon="MessageOutlined" fontSize={40} />
37
+ </div>
38
+ );
39
+ };
40
+ ```
41
+
42
+ ### 自定义样式
43
+
44
+ 通过 className 和 style 属性自定义样式。
45
+
46
+ ```jsx
47
+ import { CHRIcon } from '@chr/components';
48
+
49
+ export default () => {
50
+ return (
51
+ <div style={{ display: 'flex', gap: 12 }}>
52
+ <CHRIcon icon="HeartOutlined" style={{ color: '#ff4d4f' }} />
53
+ <CHRIcon icon="StarOutlined" style={{ color: '#faad14' }} />
54
+ <CHRIcon icon="CheckCircleOutlined" style={{ color: '#52c41a' }} />
55
+ </div>
56
+ );
57
+ };
58
+ ```
59
+
60
+ ### 未找到 icon
61
+
62
+ ```jsx
63
+ import { CHRIcon } from '@chr/components';
64
+
65
+ export default () => {
66
+ return (
67
+ <div style={{ display: 'flex', gap: 12 }}>
68
+ <CHRIcon icon="HeartOutlined1" style={{ color: '#ff4d4f' }} />
69
+ </div>
70
+ );
71
+ };
72
+ ```
73
+
74
+ ## API
75
+
76
+ | 属性 | 说明 | 类型 | 默认值 |
77
+ | --------- | --------------------------------------------------------------------------- | ------------------- | ------ |
78
+ | icon | 图标名称,对应 Ant Design 图标组件的导出名(如 HomeOutlined、UserOutlined) | - | - |
79
+ | fontSize | 图标大小,单位:px | number | 20 |
80
+ | className | 自定义 CSS 类名 | string | - |
81
+ | style | 自定义内联样式 | React.CSSProperties | - |
@@ -0,0 +1,34 @@
1
+ import * as Icons from '@ant-design/icons';
2
+ import React, { FC } from 'react';
3
+
4
+ interface ChrIconProps {
5
+ icon: string;
6
+ fontSize?: number;
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ }
10
+
11
+ const CHRIcon: FC<ChrIconProps> = ({
12
+ icon,
13
+ fontSize = 20,
14
+ className,
15
+ style,
16
+ }) => {
17
+ const IconComponent = (Icons as any)[icon];
18
+ if (!IconComponent) {
19
+ console.warn(`Icon "${icon}" is not a valid icon component`);
20
+ return <></>;
21
+ }
22
+ return (
23
+ <IconComponent
24
+ className={className}
25
+ style={{
26
+ fontSize: fontSize + 'px',
27
+ cursor: 'pointer',
28
+ ...style,
29
+ }}
30
+ />
31
+ );
32
+ };
33
+
34
+ export default CHRIcon;
@@ -0,0 +1,209 @@
1
+ # CHRUpload 上传
2
+
3
+ 文件上传组件,基于 Ant Design Upload 封装,支持文件/头像上传、大小限制、数量限制、认证等功能。
4
+
5
+ ## 代码演示
6
+
7
+ ### 基本用法
8
+
9
+ 文件上传的基本用法,支持限制文件数量和大小。
10
+
11
+ ```jsx
12
+ import { CHRUpload } from '@chr/components';
13
+ import { useState } from 'react';
14
+
15
+ export default () => {
16
+ const [fileList, setFileList] = useState([
17
+ {
18
+ name: 'example.txt',
19
+ url: 'http://localhost:3000/uploads/example.txt',
20
+ },
21
+ ]);
22
+
23
+ const handleChange = (file, newFileList) => {
24
+ setFileList(newFileList);
25
+ };
26
+
27
+ return (
28
+ <CHRUpload
29
+ url="http://localhost:3000/upload"
30
+ value={fileList}
31
+ handleChange={handleChange}
32
+ maxCount={3}
33
+ limit={20}
34
+ />
35
+ );
36
+ };
37
+ ```
38
+
39
+ ### 头像上传
40
+
41
+ 设置 `uploadType="avatar"`,组件会展示为头像上传样式,限制只能上传图片,且最多一张。
42
+
43
+ ```jsx
44
+ import { CHRUpload } from '@chr/components';
45
+ import { useState } from 'react';
46
+
47
+ export default () => {
48
+ const [fileList, setFileList] = useState([]);
49
+
50
+ const handleChange = (file, newFileList) => {
51
+ setFileList(newFileList);
52
+ };
53
+
54
+ return (
55
+ <CHRUpload
56
+ value={fileList}
57
+ uploadType="avatar"
58
+ url="http://localhost:3000/upload"
59
+ handleChange={handleChange}
60
+ />
61
+ );
62
+ };
63
+ ```
64
+
65
+ ### 限制数量
66
+
67
+ 通过 `maxCount` 限制上传文件数量。
68
+
69
+ ```jsx
70
+ import { CHRUpload } from '@chr/components';
71
+ import { useState } from 'react';
72
+
73
+ export default () => {
74
+ const [fileList, setFileList] = useState([]);
75
+
76
+ const handleChange = (file, newFileList) => {
77
+ setFileList(newFileList);
78
+ };
79
+
80
+ return (
81
+ <CHRUpload
82
+ url="http://localhost:3000/upload"
83
+ value={fileList}
84
+ handleChange={handleChange}
85
+ maxCount={2}
86
+ />
87
+ );
88
+ };
89
+ ```
90
+
91
+ ### 限制大小
92
+
93
+ 通过 `limit` 限制单个文件大小(MB)。
94
+
95
+ ```jsx
96
+ import { CHRUpload } from '@chr/components';
97
+ import { useState } from 'react';
98
+
99
+ export default () => {
100
+ const [fileList, setFileList] = useState([]);
101
+
102
+ const handleChange = (file, newFileList) => {
103
+ setFileList(newFileList);
104
+ };
105
+
106
+ return (
107
+ <CHRUpload
108
+ url="http://localhost:3000/upload"
109
+ value={fileList}
110
+ handleChange={handleChange}
111
+ limit={5}
112
+ />
113
+ );
114
+ };
115
+ ```
116
+
117
+ ### 自定义接受类型
118
+
119
+ 通过 `accept` 限制文件类型。
120
+
121
+ ```jsx
122
+ import { CHRUpload } from '@chr/components';
123
+ import { useState } from 'react';
124
+
125
+ export default () => {
126
+ const [fileList, setFileList] = useState([]);
127
+
128
+ const handleChange = (file, newFileList) => {
129
+ setFileList(newFileList);
130
+ };
131
+
132
+ return (
133
+ <CHRUpload
134
+ url="http://localhost:3000/upload"
135
+ value={fileList}
136
+ handleChange={handleChange}
137
+ accept=".jpg,.png"
138
+ />
139
+ );
140
+ };
141
+ ```
142
+
143
+ ### 携带 Token
144
+
145
+ 通过 `token` 添加认证头。
146
+
147
+ ```jsx
148
+ import { CHRUpload } from '@chr/components';
149
+ import { useState } from 'react';
150
+
151
+ export default () => {
152
+ const [fileList, setFileList] = useState([]);
153
+
154
+ const handleChange = (file, newFileList) => {
155
+ setFileList(newFileList);
156
+ };
157
+
158
+ return (
159
+ <CHRUpload
160
+ url="http://localhost:3000/upload"
161
+ value={fileList}
162
+ handleChange={handleChange}
163
+ token="your-jwt-token"
164
+ />
165
+ );
166
+ };
167
+ ```
168
+
169
+ ### 自定义上传按钮
170
+
171
+ 通过 `children` 自定义上传触发器。
172
+
173
+ ```jsx
174
+ import { CHRUpload } from '@chr/components';
175
+ import { useState } from 'react';
176
+ import { Button } from 'antd';
177
+
178
+ export default () => {
179
+ const [fileList, setFileList] = useState([]);
180
+
181
+ const handleChange = (file, newFileList) => {
182
+ setFileList(newFileList);
183
+ };
184
+
185
+ return (
186
+ <CHRUpload
187
+ url="http://localhost:3000/upload"
188
+ value={fileList}
189
+ handleChange={handleChange}
190
+ >
191
+ <Button type="primary">点击上传</Button>
192
+ </CHRUpload>
193
+ );
194
+ };
195
+ ```
196
+
197
+ ## API
198
+
199
+ | 属性 | 说明 | 类型 | 默认值 |
200
+ | ------------ | ---------------------------- | ------------------------ | --------------------------- |
201
+ | uploadType | 上传类型,`avatar` 或 `file` | string | `'file'` |
202
+ | url | 上传地址 | string | - |
203
+ | token | 认证 token,会添加到请求头 | string | - |
204
+ | maxCount | 最大上传数量 | number | `1` |
205
+ | limit | 文件大小限制(MB) | number | `10`(file)/ `2`(avatar) |
206
+ | accept | 接受的文件类型 | string | - |
207
+ | handleChange | 文件变化时的回调 | (file, fileList) => void | - |
208
+ | value | 文件列表,受控属性 | UploadFile[] | [] |
209
+ | children | 自定义上传触发器 | ReactNode | - |
@@ -0,0 +1,218 @@
1
+ import { Image } from 'antd';
2
+ import type { UploadProps } from 'antd/es/upload';
3
+ import type { UploadChangeParam, UploadFile } from 'antd/es/upload/interface';
4
+ import { ReactNode, useCallback, useMemo, useState } from 'react';
5
+ import { antd, CHRButton, CHRIcon } from '..';
6
+
7
+ interface CHRUploadProps {
8
+ children?: ReactNode;
9
+ uploadType?: 'avatar' | 'file';
10
+ url?: string;
11
+ token?: string;
12
+ maxCount?: number;
13
+ limit?: number;
14
+ accept?: string;
15
+ handleChange?: (file: UploadFile, fileList: UploadFile[]) => void;
16
+ value: UploadFile[];
17
+ }
18
+
19
+ const CHRUpload = ({
20
+ value,
21
+ children,
22
+ uploadType = 'file',
23
+ url,
24
+ token,
25
+ maxCount = 1,
26
+ limit,
27
+ accept: acceptProp,
28
+ handleChange,
29
+ ...restProps
30
+ }: CHRUploadProps &
31
+ Omit<
32
+ UploadProps,
33
+ 'onChange' | 'fileList' | 'action' | 'headers' | 'accept' | 'maxCount'
34
+ >) => {
35
+ const className = restProps.className;
36
+ const [fileList, setFileList] = useState<UploadFile[]>(value || []);
37
+ const [previewOpen, setPreviewOpen] = useState(false);
38
+ const [previewImage, setPreviewImage] = useState('');
39
+
40
+ const getDefaultAccept = useCallback(() => {
41
+ if (uploadType === 'avatar') return 'image/*';
42
+ return undefined;
43
+ }, [uploadType]);
44
+
45
+ const getDefaultLimit = useCallback(() => {
46
+ if (uploadType === 'avatar') return 2;
47
+ if (uploadType === 'file') return 10;
48
+ return undefined;
49
+ }, [uploadType]);
50
+
51
+ const finalAccept = acceptProp ?? getDefaultAccept();
52
+ const finalLimit = limit ?? getDefaultLimit();
53
+
54
+ const beforeUpload = useCallback(
55
+ (file: File) => {
56
+ if (finalLimit) {
57
+ const isLimit = file.size / 1024 / 1024 < finalLimit;
58
+ if (!isLimit) {
59
+ antd.message.error(`文件大小不能超过 ${finalLimit}MB`);
60
+ return antd.Upload.LIST_IGNORE;
61
+ }
62
+ }
63
+ if (finalAccept) {
64
+ const acceptList = finalAccept.split(',').map((item) => item.trim());
65
+ const fileType = file.type;
66
+ const fileName = file.name;
67
+ const isAccept = acceptList.some((accept) => {
68
+ if (accept.endsWith('/*')) {
69
+ const mainType = accept.replace('/*', '');
70
+ return fileType.startsWith(mainType + '/');
71
+ }
72
+ if (accept.startsWith('.')) {
73
+ return fileName.endsWith(accept);
74
+ }
75
+ return fileType === accept;
76
+ });
77
+ if (!isAccept && acceptList.length > 0) {
78
+ antd.message.error(`不支持的文件类型,仅支持 ${finalAccept}`);
79
+ return antd.Upload.LIST_IGNORE;
80
+ }
81
+ }
82
+ return true;
83
+ },
84
+ [finalLimit, finalAccept],
85
+ );
86
+
87
+ const handleUploadChange = useCallback(
88
+ (info: UploadChangeParam<UploadFile>) => {
89
+ const { file, fileList: newFileList } = info;
90
+
91
+ let fileUrl = file.url;
92
+ if (file.response) {
93
+ fileUrl = file.response.file?.url || file.response.url;
94
+ }
95
+
96
+ // 1. 状态提示
97
+ if (file.status === 'done') {
98
+ antd.message.success(`${file.name} 上传成功`);
99
+ file.url = fileUrl;
100
+ } else if (file.status === 'error') {
101
+ antd.message.error(`${file.name} 上传失败`);
102
+ file.status = 'error';
103
+ }
104
+
105
+ let finalFileList = maxCount ? newFileList.slice(-maxCount) : newFileList;
106
+
107
+ finalFileList = finalFileList.map((item) => {
108
+ if (item.uid === file.uid) {
109
+ return { ...item, url: fileUrl, status: file.status };
110
+ }
111
+ return item;
112
+ });
113
+
114
+ setFileList(finalFileList);
115
+
116
+ const simplifiedList = finalFileList.map((e: UploadFile) => ({
117
+ uid: e.uid,
118
+ name: e.name,
119
+ url: e.url || '',
120
+ status: e.status,
121
+ }));
122
+ handleChange?.(file, simplifiedList);
123
+ },
124
+ [maxCount, handleChange],
125
+ );
126
+
127
+ const headers = useMemo(() => {
128
+ if (token) {
129
+ return { Authorization: `Bearer ${token}` };
130
+ }
131
+ return undefined;
132
+ }, [token]);
133
+
134
+ const getBase64 = (file: File): Promise<string> =>
135
+ new Promise((resolve, reject) => {
136
+ const reader = new FileReader();
137
+ reader.readAsDataURL(file);
138
+ reader.onload = () => resolve(reader.result as string);
139
+ reader.onerror = (error) => reject(error);
140
+ });
141
+
142
+ const handlePreview = useCallback(async (file: UploadFile) => {
143
+ if (!file.url && !file.preview && file.originFileObj) {
144
+ file.preview = await getBase64(file.originFileObj as File);
145
+ }
146
+ setPreviewImage(file.url || (file.preview as string));
147
+ setPreviewOpen(true);
148
+ }, []);
149
+
150
+ const avatarUploadButton = (
151
+ <button style={{ border: 0, background: 'none' }} type="button">
152
+ <CHRIcon icon="PlusOutlined" />
153
+ <div style={{ marginTop: 8 }}>上传</div>
154
+ </button>
155
+ );
156
+
157
+ const renderByType = () => {
158
+ if (uploadType === 'avatar') {
159
+ return (
160
+ <>
161
+ <antd.Upload
162
+ name="file"
163
+ listType="picture-card"
164
+ className={className}
165
+ action={url}
166
+ headers={headers}
167
+ accept={finalAccept}
168
+ fileList={fileList}
169
+ beforeUpload={beforeUpload}
170
+ onChange={handleUploadChange}
171
+ onPreview={handlePreview}
172
+ maxCount={1}
173
+ {...restProps}
174
+ >
175
+ {fileList.length >= 1 ? null : avatarUploadButton}
176
+ </antd.Upload>
177
+ {previewImage && (
178
+ <Image
179
+ style={{ display: 'none' }}
180
+ preview={{
181
+ open: previewOpen,
182
+ onOpenChange: (visible) => setPreviewOpen(visible),
183
+ afterOpenChange: (visible) => !visible && setPreviewImage(''),
184
+ }}
185
+ src={previewImage}
186
+ />
187
+ )}
188
+ </>
189
+ );
190
+ }
191
+
192
+ return (
193
+ <antd.Upload
194
+ className={className}
195
+ action={url}
196
+ headers={headers}
197
+ accept={finalAccept}
198
+ beforeUpload={beforeUpload}
199
+ fileList={fileList}
200
+ onChange={handleUploadChange}
201
+ maxCount={maxCount}
202
+ multiple={maxCount > 1}
203
+ {...restProps}
204
+ >
205
+ {children || (
206
+ <CHRButton>
207
+ <CHRIcon icon="UploadOutlined" />
208
+ 上传文件
209
+ </CHRButton>
210
+ )}
211
+ </antd.Upload>
212
+ );
213
+ };
214
+
215
+ return renderByType();
216
+ };
217
+
218
+ export default CHRUpload;
@@ -0,0 +1,12 @@
1
+ # antd
2
+
3
+ This is an example component.
4
+
5
+ ```jsx
6
+ import { Switch } from 'antd';
7
+
8
+ const onChange = (checked) => {
9
+ console.log(`switch to ${checked}`);
10
+ };
11
+ export default () => <Switch defaultChecked onChange={onChange} />;
12
+ ```
@@ -0,0 +1,2 @@
1
+ import * as antd from 'antd';
2
+ export default antd;
@@ -0,0 +1,23 @@
1
+ ---
2
+ nav:
3
+ title: 基础组件
4
+ order: 0
5
+ ---
6
+
7
+ # 快速开始
8
+
9
+ :::code-group
10
+
11
+ ```bash [npm]
12
+ npm install @kc-components
13
+ ```
14
+
15
+ ```bash [yarn]
16
+ yarn add @kc-components
17
+ ```
18
+
19
+ ```bash [pnpm]
20
+ pnpm add @kc-components
21
+ ```
22
+
23
+ :::
@@ -0,0 +1,5 @@
1
+ import CHRButton from './Button';
2
+ import CHRIcon from './Icon';
3
+ import CHRUpload from './Upload';
4
+ import antd from './antd';
5
+ export { CHRButton, CHRIcon, CHRUpload, antd };
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES5",
4
+ "module": "ESNext",
5
+ "moduleResolution": "node",
6
+ "baseUrl": ".",
7
+ "paths": {
8
+ "@kc-components/*": ["packages/*/src"]
9
+ },
10
+
11
+ "jsx": "react-jsx",
12
+ "jsxImportSource": "react",
13
+
14
+ "skipLibCheck": true,
15
+ "types": ["react", "react-dom"],
16
+
17
+ "strict": true,
18
+ "noImplicitAny": false,
19
+ "forceConsistentCasingInFileNames": true,
20
+
21
+ "esModuleInterop": true,
22
+ "allowSyntheticDefaultImports": true,
23
+
24
+ "sourceMap": true,
25
+ "inlineSources": true,
26
+ "importHelpers": false
27
+ },
28
+
29
+ /* 文件范围控制 */
30
+ "include": ["src/**/*"],
31
+ "exclude": ["node_modules", "dist", "es", "lib"]
32
+ }
@@ -0,0 +1,11 @@
1
+ # `utils`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const utils = require('utils');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@chr/utils",
3
+ "version": "1.0.0",
4
+ "description": "通用方法",
5
+ "keywords": [
6
+ "util"
7
+ ],
8
+ "license": "MIT",
9
+ "sideEffects": false,
10
+ "main": "lib/index.js",
11
+ "unpkg": "dist/index.min.js",
12
+ "module": "es/index.js",
13
+ "types": "es/index.d.ts",
14
+ "files": [
15
+ "es",
16
+ "lib",
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "rollup -c"
21
+ },
22
+ "devDependencies": {
23
+ "@rollup/plugin-commonjs": "^28.0.3",
24
+ "@rollup/plugin-node-resolve": "^16.0.1",
25
+ "@rollup/plugin-typescript": "^12.1.2",
26
+ "rollup": "^4.38.0",
27
+ "rollup-plugin-terser": "^7.0.2",
28
+ "@chr/components": "workspace:*",
29
+ "alova": "catalog:"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ }
35
+ }