antd-solid 0.0.2 → 0.0.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.
- package/.eslintignore +2 -0
- package/.husky/pre-commit +4 -0
- package/.vscode/settings.json +1 -1
- package/docs/.vitepress/components/Code.vue +127 -11
- package/docs/.vitepress/config.ts +39 -1
- package/docs/.vitepress/theme/index.css +4 -0
- package/docs/.vitepress/theme/index.ts +0 -1
- package/docs/components/{Button.tsx → button/Base.tsx} +1 -0
- package/docs/components/button/Danger.tsx +21 -0
- package/docs/components/button.md +19 -7
- package/docs/components/collapse/Base.tsx +25 -0
- package/docs/components/collapse.md +26 -0
- package/docs/components/color-picker/Base.tsx +14 -0
- package/docs/components/color-picker.md +26 -0
- package/docs/components/compact/Base.tsx +27 -0
- package/docs/components/compact.md +26 -0
- package/docs/components/date-picker/Base.tsx +15 -0
- package/docs/components/date-picker.md +26 -0
- package/docs/components/empty/Base.tsx +8 -0
- package/docs/components/empty/PRESENTED_IMAGE_SIMPLE.tsx +8 -0
- package/docs/components/empty.md +32 -0
- package/docs/components/form/Base.tsx +63 -0
- package/docs/components/form.md +27 -0
- package/docs/components/image/Base.tsx +13 -0
- package/docs/components/image.md +26 -0
- package/docs/components/input/AddonBeforeAndAfter.tsx +14 -0
- package/docs/components/input/Base.tsx +15 -0
- package/docs/components/input/Disabled.tsx +19 -0
- package/docs/components/input/PrefixAndSuffix.tsx +14 -0
- package/docs/components/input/Status.tsx +25 -0
- package/docs/components/input/TextArea.tsx +14 -0
- package/docs/components/input-number/Base.tsx +15 -0
- package/docs/components/input-number/MinMax.tsx +17 -0
- package/docs/components/input-number.md +34 -0
- package/docs/components/input.md +57 -0
- package/docs/components/modal/Base.tsx +35 -0
- package/docs/components/modal.md +26 -0
- package/docs/components/popconfirm/Base.tsx +25 -0
- package/docs/components/popconfirm.md +26 -0
- package/docs/components/popover/Base.tsx +19 -0
- package/docs/components/popover.md +26 -0
- package/docs/components/progress/Base.tsx +16 -0
- package/docs/components/progress.md +26 -0
- package/docs/components/radio/Base.tsx +10 -0
- package/docs/components/radio.md +26 -0
- package/docs/components/segmented/Base.tsx +10 -0
- package/docs/components/segmented/Block.tsx +10 -0
- package/docs/components/segmented/Disabled.tsx +28 -0
- package/docs/components/segmented.md +38 -0
- package/docs/components/select/AllowClear.tsx +18 -0
- package/docs/components/select/Base.tsx +17 -0
- package/docs/components/select.md +35 -0
- package/docs/components/switch/Base.tsx +14 -0
- package/docs/components/switch.md +26 -0
- package/docs/components/{Table.tsx → table/Base.tsx} +2 -2
- package/docs/components/table.md +12 -6
- package/docs/components/tabs/Base.tsx +25 -0
- package/docs/components/tabs/Segment.tsx +25 -0
- package/docs/components/tabs.md +33 -0
- package/docs/components/tooltip/Base.tsx +12 -0
- package/docs/components/tooltip/Placement.tsx +90 -0
- package/docs/components/tooltip.md +32 -0
- package/docs/components/tree/Base.tsx +45 -0
- package/docs/components/tree.md +26 -0
- package/global.d.ts +9 -0
- package/package.json +29 -14
- package/patches/vitepress@1.0.0-rc.4.patch +60 -0
- package/rollup.config.js +60 -20
- package/scripts/annotationNonProductionCode.js +30 -0
- package/scripts/cancelAnnotationNonProductionCode.js +30 -0
- package/src/Button.tsx +51 -12
- package/src/Collapse/index.tsx +86 -0
- package/src/ColorPicker.tsx +6 -61
- package/src/Compact.tsx +15 -0
- package/src/Empty/PRESENTED_IMAGE_SIMPLE.tsx +15 -0
- package/src/Empty/assets/EmptySvg.tsx +43 -0
- package/src/Empty/assets/SimpleEmptySvg.tsx +16 -0
- package/src/Empty/index.tsx +20 -0
- package/src/Input.tsx +154 -62
- package/src/InputNumber.tsx +68 -62
- package/src/Modal.tsx +90 -62
- package/src/Popconfirm.tsx +5 -3
- package/src/Segmented/index.tsx +95 -0
- package/src/Select.tsx +125 -3
- package/src/Switch.tsx +1 -1
- package/src/Table.tsx +36 -29
- package/src/Tabs.tsx +88 -45
- package/src/Tooltip.tsx +233 -87
- package/src/Tree.tsx +4 -4
- package/src/form/Form.tsx +94 -0
- package/src/form/FormItem.tsx +139 -0
- package/src/form/context.ts +16 -0
- package/src/form/index.ts +13 -0
- package/src/hooks/createControllableValue.ts +9 -6
- package/src/index.ts +12 -5
- package/src/types/index.ts +5 -0
- package/src/utils/EventEmitter.ts +15 -0
- package/src/utils/component.tsx +1 -1
- package/src/utils/solid.ts +8 -3
- package/src/utils/zh_CN.ts +236 -0
- package/tsconfig.json +6 -4
- package/unocss.config.ts +90 -6
- package/src/Button.css +0 -14
- package/src/Form.tsx +0 -98
- package/src/index.css +0 -21
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Component } from 'solid-js'
|
|
2
|
+
import { Switch } from 'antd-solid'
|
|
3
|
+
|
|
4
|
+
const Index: Component = () => {
|
|
5
|
+
const onChange = (checked: boolean) => {
|
|
6
|
+
console.log(`switch to ${checked}`);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Switch onChange={onChange} />
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Index
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Switch 开关 {#title}
|
|
6
|
+
|
|
7
|
+
开关选择器。
|
|
8
|
+
|
|
9
|
+
## 代码演示
|
|
10
|
+
|
|
11
|
+
### 基本
|
|
12
|
+
|
|
13
|
+
最简单的用法。
|
|
14
|
+
|
|
15
|
+
<Code path="switch/Base" />
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
|
|
19
|
+
### Switch
|
|
20
|
+
|
|
21
|
+
<div class="vp-table">
|
|
22
|
+
|
|
23
|
+
| 参数 | 说明 | 类型 | 默认值
|
|
24
|
+
| ----------- | ----------- | ----------- | ----------- |
|
|
25
|
+
|
|
26
|
+
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type Component } from 'solid-js'
|
|
2
|
-
import { type
|
|
2
|
+
import { type TableColumn, Table } from 'antd-solid'
|
|
3
3
|
|
|
4
4
|
interface Row {
|
|
5
5
|
name: string
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const Index: Component = () => {
|
|
9
|
-
const columns: Array<
|
|
9
|
+
const columns: Array<TableColumn<Row>> = [
|
|
10
10
|
{
|
|
11
11
|
title: '动画',
|
|
12
12
|
render(row) {
|
package/docs/components/table.md
CHANGED
|
@@ -13,11 +13,17 @@ outline: deep
|
|
|
13
13
|
|
|
14
14
|
简单的表格
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
<Code path="table/Base" />
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
import component from './Table.tsx'
|
|
20
|
-
import code from './Table.tsx?raw'
|
|
21
|
-
</script>
|
|
18
|
+
## API
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
### Table
|
|
21
|
+
|
|
22
|
+
<div class="vp-table">
|
|
23
|
+
|
|
24
|
+
| 参数 | 说明 | 类型 | 默认值
|
|
25
|
+
| ----------- | ----------- | ----------- | ----------- |
|
|
26
|
+
| columns | 表格列的配置描述,具体项见下表 | Column[] | - |
|
|
27
|
+
| dataSource | 数据数组 | object[] | - |
|
|
28
|
+
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Component } from 'solid-js'
|
|
2
|
+
import { Tabs } from 'antd-solid'
|
|
3
|
+
|
|
4
|
+
const App: Component = () => {
|
|
5
|
+
const items = [
|
|
6
|
+
{
|
|
7
|
+
key: '1',
|
|
8
|
+
label: () => 'Tab 1',
|
|
9
|
+
children: () => 'Content of Tab Pane 1',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
key: '2',
|
|
13
|
+
label: () => 'Tab 2',
|
|
14
|
+
children: () => 'Content of Tab Pane 2',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: '3',
|
|
18
|
+
label: () => 'Tab 3',
|
|
19
|
+
children: () => 'Content of Tab Pane 3',
|
|
20
|
+
},
|
|
21
|
+
]
|
|
22
|
+
return <Tabs items={items} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default App
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Component } from 'solid-js'
|
|
2
|
+
import { Tabs } from 'antd-solid'
|
|
3
|
+
|
|
4
|
+
const App: Component = () => {
|
|
5
|
+
const items = [
|
|
6
|
+
{
|
|
7
|
+
key: '1',
|
|
8
|
+
label: () => 'Tab 1',
|
|
9
|
+
children: () => 'Content of Tab Pane 1',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
key: '2',
|
|
13
|
+
label: () => 'Tab 2',
|
|
14
|
+
children: () => 'Content of Tab Pane 2',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: '3',
|
|
18
|
+
label: () => 'Tab 3',
|
|
19
|
+
children: () => 'Content of Tab Pane 3',
|
|
20
|
+
},
|
|
21
|
+
]
|
|
22
|
+
return <Tabs type="segment" items={items} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default App
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Tabs 标签页 {#title}
|
|
6
|
+
|
|
7
|
+
选项卡切换组件。
|
|
8
|
+
|
|
9
|
+
## 代码演示
|
|
10
|
+
|
|
11
|
+
### 基本
|
|
12
|
+
|
|
13
|
+
默认选中第一项。
|
|
14
|
+
|
|
15
|
+
<Code path="tabs/Base" />
|
|
16
|
+
|
|
17
|
+
### 分段
|
|
18
|
+
|
|
19
|
+
分段类型的标签页。
|
|
20
|
+
|
|
21
|
+
<Code path="tabs/Segment" />
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### Tabs
|
|
26
|
+
|
|
27
|
+
<div class="vp-table">
|
|
28
|
+
|
|
29
|
+
| 参数 | 说明 | 类型 | 默认值
|
|
30
|
+
| ----------- | ----------- | ----------- | ----------- |
|
|
31
|
+
| type | 页签的基本样式,可选 `line`、`segment` 类型 | string | `line` |
|
|
32
|
+
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Component } from 'solid-js'
|
|
2
|
+
import { Tooltip } from 'antd-solid'
|
|
3
|
+
|
|
4
|
+
const Index: Component = () => {
|
|
5
|
+
return (
|
|
6
|
+
<Tooltip content="prompt text">
|
|
7
|
+
<span>Tooltip will show on mouse enter.</span>
|
|
8
|
+
</Tooltip>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default Index
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type Component } from 'solid-js'
|
|
2
|
+
import { Button, Tooltip } from 'antd-solid'
|
|
3
|
+
|
|
4
|
+
const buttonWidth = 80
|
|
5
|
+
|
|
6
|
+
const text = <span>prompt text</span>
|
|
7
|
+
|
|
8
|
+
const App: Component = () => {
|
|
9
|
+
return (
|
|
10
|
+
<div>
|
|
11
|
+
<div
|
|
12
|
+
style={{
|
|
13
|
+
'margin-inline-start': `${buttonWidth}px`,
|
|
14
|
+
'white-space': 'nowrap',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
gap: '8px',
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
<Tooltip placement="topLeft" content={text}>
|
|
20
|
+
<Button style={{ width: '80px' }}>TL</Button>
|
|
21
|
+
</Tooltip>
|
|
22
|
+
<Tooltip placement="top" content={text}>
|
|
23
|
+
<Button style={{ width: '80px' }}>Top</Button>
|
|
24
|
+
</Tooltip>
|
|
25
|
+
<Tooltip placement="topRight" content={text}>
|
|
26
|
+
<Button style={{ width: '80px' }}>TR</Button>
|
|
27
|
+
</Tooltip>
|
|
28
|
+
</div>
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
width: `${buttonWidth}px`,
|
|
32
|
+
float: 'inline-start',
|
|
33
|
+
display: 'flex',
|
|
34
|
+
'flex-direction': 'column',
|
|
35
|
+
gap: '8px',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<Tooltip placement="leftTop" content={text}>
|
|
39
|
+
<Button style={{ width: '80px' }}>LT</Button>
|
|
40
|
+
</Tooltip>
|
|
41
|
+
<Tooltip placement="left" content={text}>
|
|
42
|
+
<Button style={{ width: '80px' }}>Left</Button>
|
|
43
|
+
</Tooltip>
|
|
44
|
+
<Tooltip placement="leftBottom" content={text}>
|
|
45
|
+
<Button style={{ width: '80px' }}>LB</Button>
|
|
46
|
+
</Tooltip>
|
|
47
|
+
</div>
|
|
48
|
+
<div
|
|
49
|
+
style={{
|
|
50
|
+
width: `${buttonWidth}px`,
|
|
51
|
+
'margin-inline-start': `${buttonWidth * 4 + 24}px`,
|
|
52
|
+
display: 'flex',
|
|
53
|
+
'flex-direction': 'column',
|
|
54
|
+
gap: '8px',
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<Tooltip placement="rightTop" content={text}>
|
|
58
|
+
<Button style={{ width: '80px' }}>RT</Button>
|
|
59
|
+
</Tooltip>
|
|
60
|
+
<Tooltip placement="right" content={text}>
|
|
61
|
+
<Button style={{ width: '80px' }}>Right</Button>
|
|
62
|
+
</Tooltip>
|
|
63
|
+
<Tooltip placement="rightBottom" content={text}>
|
|
64
|
+
<Button style={{ width: '80px' }}>RB</Button>
|
|
65
|
+
</Tooltip>
|
|
66
|
+
</div>
|
|
67
|
+
<div
|
|
68
|
+
style={{
|
|
69
|
+
'margin-inline-start': `${buttonWidth}px`,
|
|
70
|
+
clear: 'both',
|
|
71
|
+
'white-space': 'nowrap',
|
|
72
|
+
display: 'flex',
|
|
73
|
+
gap: '8px',
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<Tooltip placement="bottomLeft" content={text}>
|
|
77
|
+
<Button style={{ width: '80px' }}>BL</Button>
|
|
78
|
+
</Tooltip>
|
|
79
|
+
<Tooltip placement="bottom" content={text}>
|
|
80
|
+
<Button style={{ width: '80px' }}>Bottom</Button>
|
|
81
|
+
</Tooltip>
|
|
82
|
+
<Tooltip placement="bottomRight" content={text}>
|
|
83
|
+
<Button style={{ width: '80px' }}>BR</Button>
|
|
84
|
+
</Tooltip>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default App
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Tooltip 文字提示 {#title}
|
|
6
|
+
|
|
7
|
+
简单的文字提示气泡框。
|
|
8
|
+
|
|
9
|
+
## 代码演示
|
|
10
|
+
|
|
11
|
+
### 基本
|
|
12
|
+
|
|
13
|
+
最简单的用法。
|
|
14
|
+
|
|
15
|
+
<Code path="tooltip/Base" />
|
|
16
|
+
|
|
17
|
+
### 位置
|
|
18
|
+
|
|
19
|
+
位置有 12 个方向。
|
|
20
|
+
|
|
21
|
+
<Code path="tooltip/Placement" />
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### Tooltip
|
|
26
|
+
|
|
27
|
+
<div class="vp-table">
|
|
28
|
+
|
|
29
|
+
| 参数 | 说明 | 类型 | 默认值
|
|
30
|
+
| ----------- | ----------- | ----------- | ----------- |
|
|
31
|
+
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type Component } from 'solid-js'
|
|
2
|
+
import { Tree } from 'antd-solid'
|
|
3
|
+
|
|
4
|
+
const Index: Component = () => {
|
|
5
|
+
const treeData = [
|
|
6
|
+
{
|
|
7
|
+
title: 'parent 1',
|
|
8
|
+
key: '0-0',
|
|
9
|
+
children: [
|
|
10
|
+
{
|
|
11
|
+
title: 'parent 1-0',
|
|
12
|
+
key: '0-0-0',
|
|
13
|
+
disabled: true,
|
|
14
|
+
children: [
|
|
15
|
+
{
|
|
16
|
+
title: 'leaf',
|
|
17
|
+
key: '0-0-0-0',
|
|
18
|
+
disableCheckbox: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: 'leaf',
|
|
22
|
+
key: '0-0-0-1',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
title: 'parent 1-1',
|
|
28
|
+
key: '0-0-1',
|
|
29
|
+
children: [{ title: <span style={{ color: '#1677ff' }}>sss</span>, key: '0-0-1-0' }],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Tree
|
|
37
|
+
blockNode
|
|
38
|
+
titleRender={node => node.title}
|
|
39
|
+
children={node => node.children as any}
|
|
40
|
+
treeData={treeData}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default Index
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Tree 树形控件 {#title}
|
|
6
|
+
|
|
7
|
+
多层次的结构列表。
|
|
8
|
+
|
|
9
|
+
## 代码演示
|
|
10
|
+
|
|
11
|
+
### 基本
|
|
12
|
+
|
|
13
|
+
最简单的用法,展示可勾选,可选中,禁用,默认展开等功能。
|
|
14
|
+
|
|
15
|
+
<Code path="tree/Base" />
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
|
|
19
|
+
### Tree
|
|
20
|
+
|
|
21
|
+
<div class="vp-table">
|
|
22
|
+
|
|
23
|
+
| 参数 | 说明 | 类型 | 默认值
|
|
24
|
+
| ----------- | ----------- | ----------- | ----------- |
|
|
25
|
+
|
|
26
|
+
</div>
|
package/global.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "index.
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"devDependencies": {
|
|
8
9
|
"@iconify-json/ant-design": "^1.1.5",
|
|
9
10
|
"@rollup/plugin-babel": "^6.0.3",
|
|
10
11
|
"@rollup/plugin-commonjs": "^24.1.0",
|
|
12
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
13
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
11
14
|
"@solidjs/testing-library": "^0.7.0",
|
|
12
15
|
"@testing-library/jest-dom": "^5.16.5",
|
|
13
16
|
"@types/lodash-es": "^4.17.7",
|
|
14
17
|
"@types/react": "^18.0.26",
|
|
15
|
-
"@types/react-color": "^3.0.6",
|
|
16
18
|
"@types/react-dom": "^18.0.9",
|
|
17
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
18
|
-
"@typescript-eslint/parser": "^
|
|
19
|
+
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
|
20
|
+
"@typescript-eslint/parser": "^6.16.0",
|
|
19
21
|
"@unocss/cli": "^0.51.8",
|
|
20
22
|
"@unocss/preset-icons": "^0.51.6",
|
|
21
23
|
"@unocss/preset-mini": "^0.51.6",
|
|
24
|
+
"@unocss/reset": "^0.57.1",
|
|
22
25
|
"@unocss/transformer-variant-group": "^0.51.6",
|
|
23
26
|
"@unocss/vite": "^0.51.6",
|
|
24
27
|
"babel-preset-solid": "^1.7.3",
|
|
25
|
-
"eslint": "^8.
|
|
28
|
+
"eslint": "^8.56.0",
|
|
26
29
|
"eslint-config-prettier": "^8.8.0",
|
|
27
|
-
"eslint-config-standard-with-typescript": "^
|
|
30
|
+
"eslint-config-standard-with-typescript": "^43.0.0",
|
|
28
31
|
"eslint-plugin-import": "^2.27.5",
|
|
29
32
|
"eslint-plugin-n": "^15.7.0",
|
|
30
33
|
"eslint-plugin-promise": "^6.1.1",
|
|
31
34
|
"eslint-plugin-solid": "^0.12.1",
|
|
35
|
+
"husky": "^8.0.3",
|
|
32
36
|
"jsdom": "^21.1.1",
|
|
37
|
+
"lint-staged": "^15.2.0",
|
|
33
38
|
"rollup": "^3.21.0",
|
|
39
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
34
40
|
"rollup-plugin-import-css": "^3.2.1",
|
|
35
41
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
36
42
|
"typescript": "^5.1.6",
|
|
@@ -42,21 +48,30 @@
|
|
|
42
48
|
"author": "",
|
|
43
49
|
"license": "ISC",
|
|
44
50
|
"dependencies": {
|
|
45
|
-
"antd": "^5.
|
|
51
|
+
"antd": "^5.10.2",
|
|
46
52
|
"classnames": "^2.3.2",
|
|
47
53
|
"lodash-es": "^4.17.21",
|
|
54
|
+
"nanoid": "^5.0.1",
|
|
48
55
|
"prismjs": "^1.29.0",
|
|
49
56
|
"react": "^18.2.0",
|
|
50
|
-
"react-color": "^2.19.3",
|
|
51
57
|
"react-dom": "^18.2.0",
|
|
52
|
-
"solid-js": "^1.7
|
|
58
|
+
"solid-js": "^1.8.7",
|
|
59
|
+
"solid-transition-group": "^0.2.3",
|
|
60
|
+
"yup": "^1.2.0"
|
|
61
|
+
},
|
|
62
|
+
"lint-staged": {
|
|
63
|
+
"**/*.{js,jsx,ts,tsx}": [
|
|
64
|
+
"prettier --write",
|
|
65
|
+
"eslint --fix"
|
|
66
|
+
]
|
|
53
67
|
},
|
|
54
68
|
"scripts": {
|
|
55
69
|
"docs:dev": "vitepress dev docs",
|
|
56
|
-
"docs:build": "vitepress build docs",
|
|
70
|
+
"docs:build": "node scripts/annotationNonProductionCode && vitepress build docs && node scripts/cancelAnnotationNonProductionCode",
|
|
57
71
|
"docs:preview": "vitepress preview docs",
|
|
58
|
-
"build": "npx rollup -c && npm run build:unocss",
|
|
59
|
-
"build:unocss": "npx unocss './src/**' -o
|
|
60
|
-
"test": "vitest"
|
|
72
|
+
"build": "rm -rf dist && NODE_ENV=production && npx rollup -c && npm run build:unocss",
|
|
73
|
+
"build:unocss": "npx unocss './src/**' -o dist/index.css -m",
|
|
74
|
+
"test": "vitest",
|
|
75
|
+
"preinstall": "husky install"
|
|
61
76
|
}
|
|
62
77
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
diff --git a/dist/client/theme-default/styles/components/vp-doc.css b/dist/client/theme-default/styles/components/vp-doc.css
|
|
2
|
+
index 12c5bf2d6a69f0d63c34b636985984b4ddb067db..fae415af1cf2800f435bab6fa1cb81ee07f95ef3 100644
|
|
3
|
+
--- a/dist/client/theme-default/styles/components/vp-doc.css
|
|
4
|
+
+++ b/dist/client/theme-default/styles/components/vp-doc.css
|
|
5
|
+
@@ -151,29 +151,30 @@
|
|
6
|
+
* Table
|
|
7
|
+
* -------------------------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
-.vp-doc table {
|
|
10
|
+
- display: block;
|
|
11
|
+
+.vp-table table {
|
|
12
|
+
+ width: 100%;
|
|
13
|
+
+ display: table;
|
|
14
|
+
border-collapse: collapse;
|
|
15
|
+
margin: 20px 0;
|
|
16
|
+
overflow-x: auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
-.vp-doc tr {
|
|
20
|
+
+.vp-table tr {
|
|
21
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
22
|
+
transition: background-color 0.5s;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
-.vp-doc tr:nth-child(2n) {
|
|
26
|
+
+.vp-table tr:nth-child(2n) {
|
|
27
|
+
background-color: var(--vp-c-bg-soft);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
-.vp-doc th,
|
|
31
|
+
-.vp-doc td {
|
|
32
|
+
+.vp-table th,
|
|
33
|
+
+.vp-table td {
|
|
34
|
+
border: 1px solid var(--vp-c-divider);
|
|
35
|
+
padding: 8px 16px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
-.vp-doc th {
|
|
39
|
+
+.vp-table th {
|
|
40
|
+
text-align: left;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
@@ -181,7 +182,7 @@
|
|
44
|
+
background-color: var(--vp-c-bg-soft);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
-.vp-doc td {
|
|
48
|
+
+.vp-table td {
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@@ -189,7 +190,7 @@
|
|
53
|
+
* Decorational elements
|
|
54
|
+
* -------------------------------------------------------------------------- */
|
|
55
|
+
|
|
56
|
+
-.vp-doc hr {
|
|
57
|
+
+.vp-table hr {
|
|
58
|
+
margin: 16px 0;
|
|
59
|
+
border: none;
|
|
60
|
+
border-top: 1px solid var(--vp-c-divider);
|
package/rollup.config.js
CHANGED
|
@@ -1,25 +1,65 @@
|
|
|
1
1
|
import ts from "rollup-plugin-typescript2"
|
|
2
|
-
import css from "rollup-plugin-import-css"
|
|
3
2
|
import commonjs from "@rollup/plugin-commonjs"
|
|
4
3
|
import { babel } from "@rollup/plugin-babel"
|
|
4
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
|
5
|
+
import terser from '@rollup/plugin-terser'
|
|
6
|
+
import cleanup from 'rollup-plugin-cleanup'
|
|
5
7
|
|
|
6
|
-
export default
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
input: "src/index.ts",
|
|
11
|
+
output: {
|
|
12
|
+
file: "dist/index.esm.js",
|
|
13
|
+
},
|
|
14
|
+
plugins: [
|
|
15
|
+
ts({
|
|
16
|
+
tsconfig: "./tsconfig.json",
|
|
17
|
+
// include: "src/**/*.ts+(|x)",
|
|
18
|
+
exclude: ["**/*.test.[ts|tsx]"],
|
|
19
|
+
}),
|
|
20
|
+
babel({
|
|
21
|
+
extensions: [".js", ".ts", ".jsx", ".tsx"],
|
|
22
|
+
presets: ["babel-preset-solid"],
|
|
23
|
+
}),
|
|
24
|
+
commonjs(),
|
|
25
|
+
],
|
|
26
|
+
external: ["uno.css"],
|
|
10
27
|
},
|
|
11
|
-
|
|
12
|
-
ts
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
{
|
|
29
|
+
input: "src/index.ts",
|
|
30
|
+
output: {
|
|
31
|
+
name: 'AntdSolid',
|
|
32
|
+
file: "dist/index.umd.js",
|
|
33
|
+
format: 'umd',
|
|
34
|
+
globals: {
|
|
35
|
+
'solid-js': 'SolidJs',
|
|
36
|
+
'solid-js/web': 'SolidJsWeb',
|
|
37
|
+
antd: 'Antd',
|
|
38
|
+
react: 'React',
|
|
39
|
+
'react-dom/client': 'ReactDOM',
|
|
40
|
+
'nanoid': 'Nanoid',
|
|
41
|
+
'classnames': 'Classnames',
|
|
42
|
+
'lodash-es': 'Lodash',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
context: 'window',
|
|
46
|
+
plugins: [
|
|
47
|
+
ts({
|
|
48
|
+
tsconfig: "./tsconfig.json",
|
|
49
|
+
// include: "src/**/*.ts+(|x)",
|
|
50
|
+
exclude: ["**/*.test.[ts|tsx]"],
|
|
51
|
+
}),
|
|
52
|
+
babel({
|
|
53
|
+
extensions: [".js", ".ts", ".jsx", ".tsx"],
|
|
54
|
+
presets: ["babel-preset-solid"],
|
|
55
|
+
}),
|
|
56
|
+
nodeResolve({
|
|
57
|
+
browser: true,
|
|
58
|
+
}),
|
|
59
|
+
commonjs(),
|
|
60
|
+
terser(),
|
|
61
|
+
cleanup(),
|
|
62
|
+
],
|
|
63
|
+
external: ["uno.css", 'solid-js', 'solid-js/web', 'react', 'react-dom/client', 'antd', 'nanoid', 'lodash-es', 'classnames'],
|
|
64
|
+
}
|
|
65
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 注释 Code 组件中的 Non-production 代码
|
|
3
|
+
*/
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import fs from 'fs'
|
|
6
|
+
|
|
7
|
+
const codeComponentPath = path.resolve('docs/.vitepress/components/Code.vue')
|
|
8
|
+
|
|
9
|
+
fs.readFile(codeComponentPath, 'utf8', (err, data) => {
|
|
10
|
+
if (err) {
|
|
11
|
+
console.error(err)
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const reg = /(\/\/ Non-production code start\n)([\s\S]*)(\n.*\/\/ Non-production code end)/
|
|
16
|
+
const match = data.match(reg)
|
|
17
|
+
const annotation = match[2]
|
|
18
|
+
.split('\n')
|
|
19
|
+
.map(s => `// ${s}`)
|
|
20
|
+
.join('\n')
|
|
21
|
+
const newData = data.replace(reg, `$1${annotation}$3`)
|
|
22
|
+
|
|
23
|
+
fs.writeFile(codeComponentPath, newData, err => {
|
|
24
|
+
if (err) {
|
|
25
|
+
console.error(err)
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
console.log('codeComponentPathpath', codeComponentPath)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 取消注释 Code 组件中的 Non-production 代码
|
|
3
|
+
*/
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import fs from 'fs'
|
|
6
|
+
|
|
7
|
+
const codeComponentPath = path.resolve('docs/.vitepress/components/Code.vue')
|
|
8
|
+
|
|
9
|
+
fs.readFile(codeComponentPath, 'utf8', (err, data) => {
|
|
10
|
+
if (err) {
|
|
11
|
+
console.error(err)
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const reg = /(\/\/ Non-production code start\n)([\s\S]*)(\n.*\/\/ Non-production code end)/
|
|
16
|
+
const match = data.match(reg)
|
|
17
|
+
const annotation = match[2]
|
|
18
|
+
.split('\n')
|
|
19
|
+
.map(s => s.replace('// ', ''))
|
|
20
|
+
.join('\n')
|
|
21
|
+
const newData = data.replace(reg, `$1${annotation}$3`)
|
|
22
|
+
|
|
23
|
+
fs.writeFile(codeComponentPath, newData, err => {
|
|
24
|
+
if (err) {
|
|
25
|
+
console.error(err)
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
console.log('codeComponentPathpath', codeComponentPath)
|