svelte-ui-plus 1.0.0 → 1.1.0
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/README.md +214 -496
- package/README.zh-CN.md +375 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# svelte-ui-plus
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A comprehensive UI component library built on **Svelte 5** (Runes), providing 78+ components for the Svelte ecosystem.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[中文文档](./README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **78 个组�?*覆盖基础、表单、数据展示、反馈、导航、其他六大类
|
|
9
|
-
- **CSS 变量主题**系统,轻松定制主题色
|
|
10
|
-
- **BEM 命名规范**(`su-*` 前缀),样式隔离
|
|
11
|
-
- 支持**全量引用**�?*按需引用**,天�?Tree-shaking 友好
|
|
12
|
-
- **TypeScript** 完整类型支持
|
|
13
|
-
- 每个组件自带 Scoped 样式,无需额外引入组件样式文件
|
|
14
|
-
- 内置 **20+ SVG 图标**
|
|
7
|
+
## Features
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
- Built on **Svelte 5 Runes** syntax (`$state`, `$props`, `$derived`, `$effect`, `$bindable`)
|
|
10
|
+
- **78+ components** covering Basic, Form, Data Display, Feedback, Navigation, and Other categories
|
|
11
|
+
- **CSS variable theming** system for easy theme customization
|
|
12
|
+
- **BEM naming convention** (`su-*` prefix) for style isolation
|
|
13
|
+
- Supports both **full import** and **tree-shakable on-demand import**
|
|
14
|
+
- Full **TypeScript** support
|
|
15
|
+
- Each component includes scoped styles — no extra style imports needed
|
|
16
|
+
- Built-in **20+ SVG icons**
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## Installation
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npm install svelte-ui-plus
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## CDN Usage
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
27
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/svelte-ui-plus/dist/styles.css" />
|
|
28
28
|
<script src="https://cdn.jsdelivr.net/npm/svelte-ui-plus/dist/svelte-ui-plus.iife.js"></script>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### Full Import
|
|
32
34
|
|
|
33
35
|
```ts
|
|
34
|
-
//
|
|
36
|
+
// Import global styles (CSS variables + base reset) in main.ts
|
|
35
37
|
import 'svelte-ui-plus/styles/index.scss'
|
|
36
38
|
```
|
|
37
39
|
|
|
@@ -41,278 +43,154 @@ import 'svelte-ui-plus/styles/index.scss'
|
|
|
41
43
|
</script>
|
|
42
44
|
|
|
43
45
|
<Button type="primary" onclick={() => message.success('Hello!')}>
|
|
44
|
-
|
|
46
|
+
Click Me
|
|
45
47
|
</Button>
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
###
|
|
50
|
+
### On-Demand Import
|
|
49
51
|
|
|
50
52
|
```svelte
|
|
51
53
|
<script lang="ts">
|
|
52
|
-
//
|
|
54
|
+
// Import only what you need
|
|
53
55
|
import { Button } from 'svelte-ui-plus/components/Button'
|
|
54
|
-
//
|
|
56
|
+
// Import only CSS variables (without global reset)
|
|
55
57
|
import 'svelte-ui-plus/styles/var.scss'
|
|
56
58
|
</script>
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
##
|
|
60
|
-
|
|
61
|
-
###
|
|
62
|
-
|
|
63
|
-
|
|
|
64
|
-
|
|
65
|
-
| `Icon` | SVG
|
|
66
|
-
| `Button` |
|
|
67
|
-
| `ButtonGroup` |
|
|
68
|
-
| `Link` |
|
|
69
|
-
| `Text` |
|
|
70
|
-
| `Scrollbar` |
|
|
71
|
-
| `Divider` |
|
|
72
|
-
| `Space` |
|
|
73
|
-
| `Row` |
|
|
74
|
-
| `Col` |
|
|
75
|
-
| `Container` |
|
|
76
|
-
| `Header` |
|
|
77
|
-
| `Footer` |
|
|
78
|
-
| `Main` |
|
|
79
|
-
| `Aside` |
|
|
80
|
-
| `CheckTag` |
|
|
81
|
-
| `ConfigProvider` |
|
|
82
|
-
|
|
83
|
-
###
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
|
|
87
|
-
| `Input` |
|
|
88
|
-
| `InputNumber` |
|
|
89
|
-
| `InputTag` |
|
|
90
|
-
| `Autocomplete` |
|
|
91
|
-
| `Select` |
|
|
92
|
-
| `TreeSelect` |
|
|
93
|
-
| `Cascader` |
|
|
94
|
-
| `Switch` |
|
|
95
|
-
| `Slider` |
|
|
96
|
-
| `Checkbox` |
|
|
97
|
-
| `CheckboxGroup` |
|
|
98
|
-
| `Radio` |
|
|
99
|
-
| `RadioGroup` |
|
|
100
|
-
| `Rate` |
|
|
101
|
-
| `ColorPicker` |
|
|
102
|
-
| `DatePicker` |
|
|
103
|
-
| `TimePicker` |
|
|
104
|
-
| `TimeSelect` |
|
|
105
|
-
| `Transfer` |
|
|
106
|
-
| `Upload` |
|
|
107
|
-
| `Form` |
|
|
108
|
-
| `FormItem` |
|
|
109
|
-
| `Mention` |
|
|
110
|
-
|
|
111
|
-
###
|
|
112
|
-
|
|
113
|
-
|
|
|
114
|
-
|
|
115
|
-
| `Tag` |
|
|
116
|
-
| `Badge` |
|
|
117
|
-
| `Avatar` |
|
|
118
|
-
| `Card` |
|
|
119
|
-
| `Empty` |
|
|
120
|
-
| `Progress` |
|
|
121
|
-
| `Skeleton` |
|
|
122
|
-
| `Table` |
|
|
123
|
-
| `Pagination` |
|
|
124
|
-
| `Descriptions` |
|
|
125
|
-
| `DescriptionsItem` |
|
|
126
|
-
| `Result` |
|
|
127
|
-
| `Statistic` |
|
|
128
|
-
| `Countdown` |
|
|
129
|
-
| `Segmented` |
|
|
130
|
-
| `Tree` |
|
|
131
|
-
| `Calendar` |
|
|
132
|
-
| `Carousel` |
|
|
133
|
-
| `CarouselItem` |
|
|
134
|
-
| `Timeline` |
|
|
135
|
-
| `TimelineItem` |
|
|
136
|
-
| `Watermark` |
|
|
137
|
-
| `Image` |
|
|
138
|
-
| `Collapse` |
|
|
139
|
-
| `CollapseItem` |
|
|
140
|
-
| `VirtualList` |
|
|
141
|
-
| `InfiniteScroll` |
|
|
142
|
-
|
|
143
|
-
###
|
|
144
|
-
|
|
145
|
-
|
|
|
146
|
-
|
|
147
|
-
| `Alert` |
|
|
148
|
-
| `Dialog` |
|
|
149
|
-
| `Drawer` |
|
|
150
|
-
| `Tooltip` |
|
|
151
|
-
| `Popover` |
|
|
152
|
-
| `Popconfirm` |
|
|
153
|
-
| `Message` |
|
|
154
|
-
| `MessageBox` |
|
|
155
|
-
| `Notification` |
|
|
156
|
-
| `Loading` |
|
|
157
|
-
| `Tour` |
|
|
158
|
-
| `TourStep` |
|
|
159
|
-
| `Overlay` |
|
|
160
|
-
| `CollapseTransition` |
|
|
161
|
-
|
|
162
|
-
###
|
|
163
|
-
|
|
164
|
-
|
|
|
165
|
-
|
|
166
|
-
| `Tabs` |
|
|
167
|
-
| `Breadcrumb` |
|
|
168
|
-
| `BreadcrumbItem` |
|
|
169
|
-
| `Dropdown` |
|
|
170
|
-
| `Menu` |
|
|
171
|
-
| `MenuItem` |
|
|
172
|
-
| `MenuItemGroup` |
|
|
173
|
-
| `SubMenu` |
|
|
174
|
-
| `PageHeader` |
|
|
175
|
-
| `Steps` |
|
|
176
|
-
| `Step` |
|
|
177
|
-
| `Affix` |
|
|
178
|
-
| `Backtop` |
|
|
179
|
-
| `Anchor` |
|
|
180
|
-
| `AnchorLink` |
|
|
181
|
-
|
|
182
|
-
###
|
|
183
|
-
|
|
184
|
-
|
|
|
185
|
-
|
|
186
|
-
| `Splitter` |
|
|
187
|
-
| `SplitterPanel` |
|
|
188
|
-
|
|
189
|
-
##
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
### Menu 导航菜单
|
|
194
|
-
|
|
195
|
-
```svelte
|
|
196
|
-
<Menu bind:activeKey mode="vertical" collapse={false}>
|
|
197
|
-
<MenuItem index="home">首页</MenuItem>
|
|
198
|
-
<SubMenu index="settings">
|
|
199
|
-
{#snippet title()}设置{/snippet}
|
|
200
|
-
<MenuItem index="profile">个人设置</MenuItem>
|
|
201
|
-
<MenuItem index="system">系统设置</MenuItem>
|
|
202
|
-
</SubMenu>
|
|
203
|
-
<MenuItemGroup title="其他">
|
|
204
|
-
<MenuItem index="about">关于</MenuItem>
|
|
205
|
-
</MenuItemGroup>
|
|
206
|
-
</Menu>
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
| 属�?| 类型 | 默认�?| 说明 |
|
|
210
|
-
|------|------|--------|------|
|
|
211
|
-
| activeKey | string | '' | 当前激活菜�?key |
|
|
212
|
-
| openKeys | string[] | [] | 展开的子菜单 |
|
|
213
|
-
| mode | 'horizontal' \| 'vertical' | 'vertical' | 菜单模式 |
|
|
214
|
-
| collapse | boolean | false | 是否折叠 |
|
|
215
|
-
| backgroundColor | string | '' | 背景�?|
|
|
216
|
-
| textColor | string | '' | 文字颜色 |
|
|
217
|
-
| activeTextColor | string | '' | 激活文字颜�?|
|
|
218
|
-
|
|
219
|
-
### Steps 步骤�?
|
|
220
|
-
|
|
221
|
-
```svelte
|
|
222
|
-
<Steps active={1} direction="horizontal">
|
|
223
|
-
<Step stepIndex={0} title="完成" description="第一�? />
|
|
224
|
-
<Step stepIndex={1} title="进行�? description="第二�? />
|
|
225
|
-
<Step stepIndex={2} title="等待" description="第三�? />
|
|
226
|
-
</Steps>
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Affix 固钉
|
|
230
|
-
|
|
231
|
-
```svelte
|
|
232
|
-
<Affix offset={100} position="top" onchange={(fixed) => console.log(fixed)}>
|
|
233
|
-
<Button>固定在顶�?/Button>
|
|
234
|
-
</Affix>
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Popconfirm 气泡确认�?
|
|
238
|
-
|
|
239
|
-
```svelte
|
|
240
|
-
<Popconfirm title="确认删除�? onconfirm={handleDelete}>
|
|
241
|
-
<Button type="danger">删除</Button>
|
|
242
|
-
</Popconfirm>
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### MessageBox 消息弹框(函数式�?
|
|
246
|
-
|
|
247
|
-
```ts
|
|
248
|
-
import { msgAlert, msgConfirm, msgPrompt } from 'svelte-ui-plus'
|
|
249
|
-
|
|
250
|
-
await msgAlert('提示消息', '标题')
|
|
251
|
-
|
|
252
|
-
try {
|
|
253
|
-
await msgConfirm('确定要删除吗�?, '警告')
|
|
254
|
-
} catch { /* 取消 */ }
|
|
255
|
-
|
|
256
|
-
const { value } = await msgPrompt('请输入名�?, '输入')
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Notification 通知(函数式�?
|
|
260
|
-
|
|
261
|
-
```ts
|
|
262
|
-
import { notify } from 'svelte-ui-plus'
|
|
263
|
-
|
|
264
|
-
notify({ title: '通知', message: '内容', type: 'success' })
|
|
265
|
-
notify.success('操作成功')
|
|
266
|
-
notify.error({ title: '错误', message: '失败', duration: 0 })
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Tour 漫游式引�?
|
|
270
|
-
|
|
271
|
-
```svelte
|
|
272
|
-
<Tour bind:open bind:current onfinish={handleFinish}>
|
|
273
|
-
<TourStep title="步骤一" description="欢迎使用" />
|
|
274
|
-
<TourStep title="步骤�? description="功能介绍" />
|
|
275
|
-
</Tour>
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Descriptions 描述列表
|
|
279
|
-
|
|
280
|
-
```svelte
|
|
281
|
-
<Descriptions title="用户信息" column={3} border>
|
|
282
|
-
<DescriptionsItem label="姓名">张三</DescriptionsItem>
|
|
283
|
-
<DescriptionsItem label="电话">13800138000</DescriptionsItem>
|
|
284
|
-
</Descriptions>
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Watermark 水印
|
|
288
|
-
|
|
289
|
-
```svelte
|
|
290
|
-
<Watermark content="机密文档" fontSize={16} rotate={-22}>
|
|
291
|
-
<!-- 内容 -->
|
|
292
|
-
</Watermark>
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### VirtualList 虚拟列表
|
|
296
|
-
|
|
297
|
-
```svelte
|
|
298
|
-
<VirtualList items={bigList} height={400} itemHeight={40}>
|
|
299
|
-
{#snippet item({ item, index })}
|
|
300
|
-
<div>�?{index} �? {item.name}</div>
|
|
301
|
-
{/snippet}
|
|
302
|
-
</VirtualList>
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### InfiniteScroll 无限滚动
|
|
306
|
-
|
|
307
|
-
```svelte
|
|
308
|
-
<InfiniteScroll bind:loading noMore={noMore} onload={loadMore}>
|
|
309
|
-
{#each list as item}
|
|
310
|
-
<div>{item.name}</div>
|
|
311
|
-
{/each}
|
|
312
|
-
</InfiniteScroll>
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
---
|
|
61
|
+
## Component List
|
|
62
|
+
|
|
63
|
+
### Basic Components
|
|
64
|
+
|
|
65
|
+
| Component | Description | Import Path |
|
|
66
|
+
|-----------|-------------|-------------|
|
|
67
|
+
| `Icon` | SVG icons | `svelte-ui-plus/components/Icon` |
|
|
68
|
+
| `Button` | Button | `svelte-ui-plus/components/Button` |
|
|
69
|
+
| `ButtonGroup` | Button group | `svelte-ui-plus/components/Button` |
|
|
70
|
+
| `Link` | Link | `svelte-ui-plus/components/Link` |
|
|
71
|
+
| `Text` | Text | `svelte-ui-plus/components/Text` |
|
|
72
|
+
| `Scrollbar` | Scrollbar | `svelte-ui-plus/components/Scrollbar` |
|
|
73
|
+
| `Divider` | Divider | `svelte-ui-plus/components/Divider` |
|
|
74
|
+
| `Space` | Space | `svelte-ui-plus/components/Space` |
|
|
75
|
+
| `Row` | Row layout | `svelte-ui-plus/components/Row` |
|
|
76
|
+
| `Col` | Column layout | `svelte-ui-plus/components/Col` |
|
|
77
|
+
| `Container` | Layout container | `svelte-ui-plus/components/Container` |
|
|
78
|
+
| `Header` | Header container | `svelte-ui-plus/components/Container` |
|
|
79
|
+
| `Footer` | Footer container | `svelte-ui-plus/components/Container` |
|
|
80
|
+
| `Main` | Main content container | `svelte-ui-plus/components/Container` |
|
|
81
|
+
| `Aside` | Sidebar container | `svelte-ui-plus/components/Container` |
|
|
82
|
+
| `CheckTag` | Selectable tag | `svelte-ui-plus/components/CheckTag` |
|
|
83
|
+
| `ConfigProvider` | Global configuration | `svelte-ui-plus/components/ConfigProvider` |
|
|
84
|
+
|
|
85
|
+
### Form Components
|
|
86
|
+
|
|
87
|
+
| Component | Description | Import Path |
|
|
88
|
+
|-----------|-------------|-------------|
|
|
89
|
+
| `Input` | Input (includes textarea) | `svelte-ui-plus/components/Input` |
|
|
90
|
+
| `InputNumber` | Number input | `svelte-ui-plus/components/InputNumber` |
|
|
91
|
+
| `InputTag` | Tag input | `svelte-ui-plus/components/InputTag` |
|
|
92
|
+
| `Autocomplete` | Autocomplete | `svelte-ui-plus/components/Autocomplete` |
|
|
93
|
+
| `Select` | Select | `svelte-ui-plus/components/Select` |
|
|
94
|
+
| `TreeSelect` | Tree select | `svelte-ui-plus/components/TreeSelect` |
|
|
95
|
+
| `Cascader` | Cascader | `svelte-ui-plus/components/Cascader` |
|
|
96
|
+
| `Switch` | Switch | `svelte-ui-plus/components/Switch` |
|
|
97
|
+
| `Slider` | Slider | `svelte-ui-plus/components/Slider` |
|
|
98
|
+
| `Checkbox` | Checkbox | `svelte-ui-plus/components/Checkbox` |
|
|
99
|
+
| `CheckboxGroup` | Checkbox group | `svelte-ui-plus/components/Checkbox` |
|
|
100
|
+
| `Radio` | Radio | `svelte-ui-plus/components/Radio` |
|
|
101
|
+
| `RadioGroup` | Radio group | `svelte-ui-plus/components/Radio` |
|
|
102
|
+
| `Rate` | Rating | `svelte-ui-plus/components/Rate` |
|
|
103
|
+
| `ColorPicker` | Color picker | `svelte-ui-plus/components/ColorPicker` |
|
|
104
|
+
| `DatePicker` | Date picker | `svelte-ui-plus/components/DatePicker` |
|
|
105
|
+
| `TimePicker` | Time picker | `svelte-ui-plus/components/TimePicker` |
|
|
106
|
+
| `TimeSelect` | Time select | `svelte-ui-plus/components/TimeSelect` |
|
|
107
|
+
| `Transfer` | Transfer | `svelte-ui-plus/components/Transfer` |
|
|
108
|
+
| `Upload` | Upload | `svelte-ui-plus/components/Upload` |
|
|
109
|
+
| `Form` | Form | `svelte-ui-plus/components/Form` |
|
|
110
|
+
| `FormItem` | Form item | `svelte-ui-plus/components/Form` |
|
|
111
|
+
| `Mention` | Mention | `svelte-ui-plus/components/Mention` |
|
|
112
|
+
|
|
113
|
+
### Data Display Components
|
|
114
|
+
|
|
115
|
+
| Component | Description | Import Path |
|
|
116
|
+
|-----------|-------------|-------------|
|
|
117
|
+
| `Tag` | Tag | `svelte-ui-plus/components/Tag` |
|
|
118
|
+
| `Badge` | Badge | `svelte-ui-plus/components/Badge` |
|
|
119
|
+
| `Avatar` | Avatar | `svelte-ui-plus/components/Avatar` |
|
|
120
|
+
| `Card` | Card | `svelte-ui-plus/components/Card` |
|
|
121
|
+
| `Empty` | Empty state | `svelte-ui-plus/components/Empty` |
|
|
122
|
+
| `Progress` | Progress bar (line / circle) | `svelte-ui-plus/components/Progress` |
|
|
123
|
+
| `Skeleton` | Skeleton | `svelte-ui-plus/components/Skeleton` |
|
|
124
|
+
| `Table` | Table | `svelte-ui-plus/components/Table` |
|
|
125
|
+
| `Pagination` | Pagination | `svelte-ui-plus/components/Pagination` |
|
|
126
|
+
| `Descriptions` | Descriptions list | `svelte-ui-plus/components/Descriptions` |
|
|
127
|
+
| `DescriptionsItem` | Descriptions item | `svelte-ui-plus/components/Descriptions` |
|
|
128
|
+
| `Result` | Result | `svelte-ui-plus/components/Result` |
|
|
129
|
+
| `Statistic` | Statistic | `svelte-ui-plus/components/Statistic` |
|
|
130
|
+
| `Countdown` | Countdown | `svelte-ui-plus/components/Countdown` |
|
|
131
|
+
| `Segmented` | Segmented control | `svelte-ui-plus/components/Segmented` |
|
|
132
|
+
| `Tree` | Tree | `svelte-ui-plus/components/Tree` |
|
|
133
|
+
| `Calendar` | Calendar | `svelte-ui-plus/components/Calendar` |
|
|
134
|
+
| `Carousel` | Carousel | `svelte-ui-plus/components/Carousel` |
|
|
135
|
+
| `CarouselItem` | Carousel item | `svelte-ui-plus/components/Carousel` |
|
|
136
|
+
| `Timeline` | Timeline | `svelte-ui-plus/components/Timeline` |
|
|
137
|
+
| `TimelineItem` | Timeline item | `svelte-ui-plus/components/Timeline` |
|
|
138
|
+
| `Watermark` | Watermark | `svelte-ui-plus/components/Watermark` |
|
|
139
|
+
| `Image` | Image | `svelte-ui-plus/components/Image` |
|
|
140
|
+
| `Collapse` | Collapse | `svelte-ui-plus/components/Collapse` |
|
|
141
|
+
| `CollapseItem` | Collapse item | `svelte-ui-plus/components/Collapse` |
|
|
142
|
+
| `VirtualList` | Virtual list | `svelte-ui-plus/components/VirtualList` |
|
|
143
|
+
| `InfiniteScroll` | Infinite scroll | `svelte-ui-plus/components/InfiniteScroll` |
|
|
144
|
+
|
|
145
|
+
### Feedback Components
|
|
146
|
+
|
|
147
|
+
| Component | Description | Import Path |
|
|
148
|
+
|-----------|-------------|-------------|
|
|
149
|
+
| `Alert` | Alert | `svelte-ui-plus/components/Alert` |
|
|
150
|
+
| `Dialog` | Dialog | `svelte-ui-plus/components/Dialog` |
|
|
151
|
+
| `Drawer` | Drawer | `svelte-ui-plus/components/Drawer` |
|
|
152
|
+
| `Tooltip` | Tooltip | `svelte-ui-plus/components/Tooltip` |
|
|
153
|
+
| `Popover` | Popover | `svelte-ui-plus/components/Popover` |
|
|
154
|
+
| `Popconfirm` | Popconfirm | `svelte-ui-plus/components/Popconfirm` |
|
|
155
|
+
| `Message` | Message (imperative) | `svelte-ui-plus/components/Message` |
|
|
156
|
+
| `MessageBox` | Message box | `svelte-ui-plus/components/MessageBox` |
|
|
157
|
+
| `Notification` | Notification | `svelte-ui-plus/components/Notification` |
|
|
158
|
+
| `Loading` | Loading | `svelte-ui-plus/components/Loading` |
|
|
159
|
+
| `Tour` | Tour guide | `svelte-ui-plus/components/Tour` |
|
|
160
|
+
| `TourStep` | Tour step | `svelte-ui-plus/components/Tour` |
|
|
161
|
+
| `Overlay` | Overlay | `svelte-ui-plus/components/Overlay` |
|
|
162
|
+
| `CollapseTransition` | Collapse transition | `svelte-ui-plus/components/CollapseTransition` |
|
|
163
|
+
|
|
164
|
+
### Navigation Components
|
|
165
|
+
|
|
166
|
+
| Component | Description | Import Path |
|
|
167
|
+
|-----------|-------------|-------------|
|
|
168
|
+
| `Tabs` | Tabs | `svelte-ui-plus/components/Tabs` |
|
|
169
|
+
| `Breadcrumb` | Breadcrumb | `svelte-ui-plus/components/Breadcrumb` |
|
|
170
|
+
| `BreadcrumbItem` | Breadcrumb item | `svelte-ui-plus/components/Breadcrumb` |
|
|
171
|
+
| `Dropdown` | Dropdown | `svelte-ui-plus/components/Dropdown` |
|
|
172
|
+
| `Menu` | Menu | `svelte-ui-plus/components/Menu` |
|
|
173
|
+
| `MenuItem` | Menu item | `svelte-ui-plus/components/Menu` |
|
|
174
|
+
| `MenuItemGroup` | Menu item group | `svelte-ui-plus/components/Menu` |
|
|
175
|
+
| `SubMenu` | Sub menu | `svelte-ui-plus/components/Menu` |
|
|
176
|
+
| `PageHeader` | Page header | `svelte-ui-plus/components/PageHeader` |
|
|
177
|
+
| `Steps` | Steps | `svelte-ui-plus/components/Steps` |
|
|
178
|
+
| `Step` | Step | `svelte-ui-plus/components/Steps` |
|
|
179
|
+
| `Affix` | Affix | `svelte-ui-plus/components/Affix` |
|
|
180
|
+
| `Backtop` | Back to top | `svelte-ui-plus/components/Backtop` |
|
|
181
|
+
| `Anchor` | Anchor | `svelte-ui-plus/components/Anchor` |
|
|
182
|
+
| `AnchorLink` | Anchor link | `svelte-ui-plus/components/Anchor` |
|
|
183
|
+
|
|
184
|
+
### Other Components
|
|
185
|
+
|
|
186
|
+
| Component | Description | Import Path |
|
|
187
|
+
|-----------|-------------|-------------|
|
|
188
|
+
| `Splitter` | Splitter | `svelte-ui-plus/components/Splitter` |
|
|
189
|
+
| `SplitterPanel` | Splitter panel | `svelte-ui-plus/components/Splitter` |
|
|
190
|
+
|
|
191
|
+
## Usage Examples
|
|
192
|
+
|
|
193
|
+
### Button
|
|
316
194
|
|
|
317
195
|
```svelte
|
|
318
196
|
<Button
|
|
@@ -326,17 +204,17 @@ notify.error({ title: '错误', message: '失败', duration: 0 })
|
|
|
326
204
|
icon="search"
|
|
327
205
|
onclick={handler}
|
|
328
206
|
>
|
|
329
|
-
|
|
207
|
+
Button Text
|
|
330
208
|
</Button>
|
|
331
209
|
```
|
|
332
210
|
|
|
333
|
-
### Input
|
|
211
|
+
### Input
|
|
334
212
|
|
|
335
213
|
```svelte
|
|
336
214
|
<Input
|
|
337
215
|
bind:value={text}
|
|
338
216
|
type="text | password | number | email | textarea"
|
|
339
|
-
placeholder="
|
|
217
|
+
placeholder="Please enter"
|
|
340
218
|
clearable
|
|
341
219
|
showPassword
|
|
342
220
|
disabled={false}
|
|
@@ -344,290 +222,130 @@ notify.error({ title: '错误', message: '失败', duration: 0 })
|
|
|
344
222
|
maxlength={100}
|
|
345
223
|
showWordLimit
|
|
346
224
|
prefixIcon="search"
|
|
347
|
-
oninput={(val) => console.log(val)}
|
|
348
|
-
onenter={() => console.log('enter')}
|
|
349
225
|
/>
|
|
350
226
|
```
|
|
351
227
|
|
|
352
|
-
### Select
|
|
228
|
+
### Select
|
|
353
229
|
|
|
354
230
|
```svelte
|
|
355
231
|
<Select
|
|
356
232
|
bind:value={selected}
|
|
357
233
|
options={[
|
|
358
|
-
{ label: '
|
|
359
|
-
{ label: '
|
|
360
|
-
{ label: '
|
|
234
|
+
{ label: 'Option 1', value: 1 },
|
|
235
|
+
{ label: 'Option 2', value: 2 },
|
|
236
|
+
{ label: 'Option 3', value: 3, disabled: true },
|
|
361
237
|
]}
|
|
362
|
-
placeholder="
|
|
238
|
+
placeholder="Please select"
|
|
363
239
|
clearable
|
|
364
240
|
multiple={false}
|
|
365
|
-
onchange={(val) => console.log(val)}
|
|
366
241
|
/>
|
|
367
242
|
```
|
|
368
243
|
|
|
369
|
-
###
|
|
244
|
+
### Dialog
|
|
370
245
|
|
|
371
246
|
```svelte
|
|
372
|
-
<
|
|
373
|
-
|
|
374
|
-
activeText="开"
|
|
375
|
-
inactiveText="�?
|
|
376
|
-
activeColor="#13ce66"
|
|
377
|
-
inactiveColor="#ff4949"
|
|
378
|
-
/>
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
### Dialog 对话�?
|
|
382
|
-
|
|
383
|
-
```svelte
|
|
384
|
-
<Dialog bind:open={showDialog} title="提示" width="500px">
|
|
385
|
-
<p>这是一段内�?/p>
|
|
386
|
-
|
|
247
|
+
<Dialog bind:open={showDialog} title="Notice" width="500px">
|
|
248
|
+
<p>Dialog content here</p>
|
|
387
249
|
{#snippet footer()}
|
|
388
|
-
<Button onclick={() => showDialog = false}
|
|
389
|
-
<Button type="primary" onclick={confirm}
|
|
250
|
+
<Button onclick={() => showDialog = false}>Cancel</Button>
|
|
251
|
+
<Button type="primary" onclick={confirm}>OK</Button>
|
|
390
252
|
{/snippet}
|
|
391
253
|
</Dialog>
|
|
392
254
|
```
|
|
393
255
|
|
|
394
|
-
###
|
|
395
|
-
|
|
396
|
-
```svelte
|
|
397
|
-
<Drawer bind:open={showDrawer} title="抽屉" direction="rtl" size="400px">
|
|
398
|
-
<p>抽屉内容</p>
|
|
399
|
-
</Drawer>
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
### Table 表格
|
|
256
|
+
### Table
|
|
403
257
|
|
|
404
258
|
```svelte
|
|
405
259
|
<Table
|
|
406
260
|
data={tableData}
|
|
407
261
|
columns={[
|
|
408
|
-
{ key: 'name', title: '
|
|
409
|
-
{ key: 'age', title: '
|
|
410
|
-
{ key: 'email', title: '
|
|
262
|
+
{ key: 'name', title: 'Name', width: '120px' },
|
|
263
|
+
{ key: 'age', title: 'Age', width: '80px', align: 'center' },
|
|
264
|
+
{ key: 'email', title: 'Email' },
|
|
411
265
|
]}
|
|
412
266
|
stripe
|
|
413
267
|
border
|
|
414
|
-
onrowclick={(row, idx) => console.log(row)}
|
|
415
268
|
/>
|
|
416
269
|
```
|
|
417
270
|
|
|
418
|
-
###
|
|
419
|
-
|
|
420
|
-
```svelte
|
|
421
|
-
<Tabs
|
|
422
|
-
bind:activeKey
|
|
423
|
-
items={[
|
|
424
|
-
{ key: 'tab1', label: '用户管理' },
|
|
425
|
-
{ key: 'tab2', label: '角色管理' },
|
|
426
|
-
{ key: 'tab3', label: '权限配置', disabled: true },
|
|
427
|
-
]}
|
|
428
|
-
type="card"
|
|
429
|
-
>
|
|
430
|
-
{#snippet children(activeKey)}
|
|
431
|
-
{#if activeKey === 'tab1'}
|
|
432
|
-
<p>用户管理内容</p>
|
|
433
|
-
{:else if activeKey === 'tab2'}
|
|
434
|
-
<p>角色管理内容</p>
|
|
435
|
-
{/if}
|
|
436
|
-
{/snippet}
|
|
437
|
-
</Tabs>
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
### Pagination 分页
|
|
441
|
-
|
|
442
|
-
```svelte
|
|
443
|
-
<Pagination
|
|
444
|
-
total={100}
|
|
445
|
-
bind:currentPage
|
|
446
|
-
pageSize={10}
|
|
447
|
-
showTotal
|
|
448
|
-
showJumper
|
|
449
|
-
onchange={(page) => loadData(page)}
|
|
450
|
-
/>
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### Message 消息提示(函数式�?
|
|
271
|
+
### Message (Imperative)
|
|
454
272
|
|
|
455
273
|
```ts
|
|
456
274
|
import { message } from 'svelte-ui-plus'
|
|
457
275
|
|
|
458
|
-
message.success('
|
|
459
|
-
message.error('
|
|
460
|
-
message.warning('
|
|
461
|
-
message.info('
|
|
276
|
+
message.success('Operation successful')
|
|
277
|
+
message.error('Operation failed')
|
|
278
|
+
message.warning('Warning')
|
|
279
|
+
message.info('Info')
|
|
462
280
|
|
|
463
|
-
//
|
|
464
|
-
const { close } = message.success('
|
|
465
|
-
close()
|
|
281
|
+
// Advanced
|
|
282
|
+
const { close } = message.success('Manual close', { duration: 0, showClose: true })
|
|
283
|
+
close()
|
|
466
284
|
```
|
|
467
285
|
|
|
468
|
-
### Form
|
|
286
|
+
### Form
|
|
469
287
|
|
|
470
288
|
```svelte
|
|
471
289
|
<Form labelWidth="100px" labelPosition="right">
|
|
472
|
-
<FormItem label="
|
|
290
|
+
<FormItem label="Username" required error={errors.username}>
|
|
473
291
|
<Input bind:value={form.username} />
|
|
474
292
|
</FormItem>
|
|
475
|
-
|
|
476
|
-
<FormItem label="密码" required>
|
|
293
|
+
<FormItem label="Password" required>
|
|
477
294
|
<Input bind:value={form.password} type="password" showPassword />
|
|
478
295
|
</FormItem>
|
|
479
|
-
|
|
480
296
|
<FormItem>
|
|
481
|
-
<Button type="primary" onclick={submit}
|
|
297
|
+
<Button type="primary" onclick={submit}>Submit</Button>
|
|
482
298
|
</FormItem>
|
|
483
299
|
</Form>
|
|
484
300
|
```
|
|
485
301
|
|
|
486
|
-
##
|
|
302
|
+
## Built-in Icons
|
|
487
303
|
|
|
488
|
-
|
|
304
|
+
Use icons via `<Icon name="xxx" />`:
|
|
489
305
|
|
|
490
|
-
|
|
|
491
|
-
|
|
492
|
-
| `close` |
|
|
493
|
-
| `circle-check` |
|
|
494
|
-
| `info` |
|
|
495
|
-
| `search` |
|
|
496
|
-
| `arrow-up` |
|
|
497
|
-
| `arrow-left` |
|
|
498
|
-
| `eye` |
|
|
499
|
-
| `plus` |
|
|
500
|
-
| `delete` |
|
|
501
|
-
| `more` |
|
|
502
|
-
| `setting` |
|
|
306
|
+
| Name | Description | Name | Description |
|
|
307
|
+
|------|-------------|------|-------------|
|
|
308
|
+
| `close` | Close | `check` | Check |
|
|
309
|
+
| `circle-check` | Circle check | `circle-close` | Circle close |
|
|
310
|
+
| `info` | Info | `warning` | Warning |
|
|
311
|
+
| `search` | Search | `loading` | Loading |
|
|
312
|
+
| `arrow-up` | Arrow up | `arrow-down` | Arrow down |
|
|
313
|
+
| `arrow-left` | Arrow left | `arrow-right` | Arrow right |
|
|
314
|
+
| `eye` | Visible | `eye-off` | Hidden |
|
|
315
|
+
| `plus` | Plus | `minus` | Minus |
|
|
316
|
+
| `delete` | Delete | `edit` | Edit |
|
|
317
|
+
| `more` | More | `refresh` | Refresh |
|
|
318
|
+
| `setting` | Settings | `fullscreen` | Fullscreen |
|
|
503
319
|
|
|
504
320
|
```svelte
|
|
505
321
|
<Icon name="search" size={20} color="var(--su-color-primary)" />
|
|
506
322
|
```
|
|
507
323
|
|
|
508
|
-
##
|
|
324
|
+
## Theme Customization
|
|
509
325
|
|
|
510
|
-
|
|
326
|
+
Override CSS variables to customize the theme:
|
|
511
327
|
|
|
512
328
|
```scss
|
|
513
329
|
:root {
|
|
514
|
-
--su-color-primary: #722ed1;
|
|
330
|
+
--su-color-primary: #722ed1;
|
|
515
331
|
--su-color-success: #52c41a;
|
|
516
332
|
--su-color-warning: #faad14;
|
|
517
333
|
--su-color-danger: #ff4d4f;
|
|
518
|
-
--su-border-radius-base: 8px;
|
|
519
|
-
--su-font-size-base: 15px;
|
|
334
|
+
--su-border-radius-base: 8px;
|
|
335
|
+
--su-font-size-base: 15px;
|
|
520
336
|
}
|
|
521
337
|
```
|
|
522
338
|
|
|
523
|
-
##
|
|
524
|
-
|
|
525
|
-
```
|
|
526
|
-
svelte-ui-plus/
|
|
527
|
-
├── package.json # 包配�?
|
|
528
|
-
├── index.ts # 全量引用入口
|
|
529
|
-
├── README.md # 组件库文�?
|
|
530
|
-
├── components/ # 组件目录�?8 个组件)
|
|
531
|
-
�? ├── index.ts # 组件统一导出
|
|
532
|
-
�? ├── Affix/ # 固钉
|
|
533
|
-
�? ├── Alert/ # 警告
|
|
534
|
-
�? ├── Anchor/ # 锚点 + AnchorLink
|
|
535
|
-
�? ├── Autocomplete/ # 自动补全
|
|
536
|
-
�? ├── Avatar/ # 头像
|
|
537
|
-
�? ├── Backtop/ # 回到顶部
|
|
538
|
-
�? ├── Badge/ # 徽章
|
|
539
|
-
�? ├── Breadcrumb/ # 面包�?+ BreadcrumbItem
|
|
540
|
-
�? ├── Button/ # 按钮 + ButtonGroup
|
|
541
|
-
�? ├── Calendar/ # 日历
|
|
542
|
-
�? ├── Card/ # 卡片
|
|
543
|
-
�? ├── Carousel/ # 走马�?+ CarouselItem
|
|
544
|
-
�? ├── Cascader/ # 级联选择�?
|
|
545
|
-
�? ├── Checkbox/ # 复选框 + CheckboxGroup
|
|
546
|
-
�? ├── CheckTag/ # 可选标�?
|
|
547
|
-
�? ├── Col/ # 列布局
|
|
548
|
-
�? ├── Collapse/ # 折叠面板 + CollapseItem
|
|
549
|
-
�? ├── CollapseTransition/ # 折叠过渡
|
|
550
|
-
�? ├── ColorPicker/ # 颜色选择�?
|
|
551
|
-
�? ├── ConfigProvider/ # 全局配置
|
|
552
|
-
�? ├── Container/ # 布局容器 + Header/Footer/Main/Aside
|
|
553
|
-
�? ├── Countdown/ # 倒计�?
|
|
554
|
-
�? ├── DatePicker/ # 日期选择�?
|
|
555
|
-
�? ├── Descriptions/ # 描述列表 + DescriptionsItem
|
|
556
|
-
�? ├── Dialog/ # 对话�?
|
|
557
|
-
�? ├── Divider/ # 分割�?
|
|
558
|
-
�? ├── Drawer/ # 抽屉
|
|
559
|
-
�? ├── Dropdown/ # 下拉菜单
|
|
560
|
-
�? ├── Empty/ # 空状�?
|
|
561
|
-
�? ├── Form/ # 表单 + FormItem
|
|
562
|
-
�? ├── Icon/ # 图标
|
|
563
|
-
�? ├── Image/ # 图片
|
|
564
|
-
�? ├── InfiniteScroll/ # 无限滚动
|
|
565
|
-
�? ├── Input/ # 输入�?
|
|
566
|
-
�? ├── InputNumber/ # 数字输入
|
|
567
|
-
�? ├── InputTag/ # 标签输入
|
|
568
|
-
�? ├── Link/ # 链接
|
|
569
|
-
�? ├── Loading/ # 加载
|
|
570
|
-
�? ├── Mention/ # 提及
|
|
571
|
-
�? ├── Menu/ # 菜单 + MenuItem/MenuItemGroup/SubMenu
|
|
572
|
-
�? ├── Message/ # 消息提示
|
|
573
|
-
�? ├── MessageBox/ # 消息弹框
|
|
574
|
-
�? ├── Notification/ # 通知
|
|
575
|
-
�? ├── Overlay/ # 遮罩�?
|
|
576
|
-
�? ├── PageHeader/ # 页头
|
|
577
|
-
�? ├── Pagination/ # 分页
|
|
578
|
-
�? ├── Popconfirm/ # 气泡确认�?
|
|
579
|
-
�? ├── Popover/ # 弹出�?
|
|
580
|
-
�? ├── Progress/ # 进度�?
|
|
581
|
-
�? ├── Radio/ # 单选框 + RadioGroup
|
|
582
|
-
�? ├── Rate/ # 评分
|
|
583
|
-
�? ├── Result/ # 结果�?
|
|
584
|
-
�? ├── Row/ # 行布局
|
|
585
|
-
�? ├── Scrollbar/ # 滚动�?
|
|
586
|
-
�? ├── Segmented/ # 分段控制�?
|
|
587
|
-
�? ├── Select/ # 选择�?
|
|
588
|
-
�? ├── Skeleton/ # 骨架�?
|
|
589
|
-
�? ├── Slider/ # 滑块
|
|
590
|
-
�? ├── Space/ # 间距
|
|
591
|
-
�? ├── Splitter/ # 分割面板 + SplitterPanel
|
|
592
|
-
�? ├── Statistic/ # 统计数�?
|
|
593
|
-
�? ├── Steps/ # 步骤�?+ Step
|
|
594
|
-
�? ├── Switch/ # 开�?
|
|
595
|
-
�? ├── Table/ # 表格
|
|
596
|
-
�? ├── Tabs/ # 标签�?
|
|
597
|
-
�? ├── Tag/ # 标签
|
|
598
|
-
�? ├── Text/ # 文本
|
|
599
|
-
�? ├── Timeline/ # 时间�?+ TimelineItem
|
|
600
|
-
�? ├── TimePicker/ # 时间选择�?
|
|
601
|
-
�? ├── TimeSelect/ # 时间选择
|
|
602
|
-
�? ├── Tooltip/ # 文字提示
|
|
603
|
-
�? ├── Tour/ # 漫游引导 + TourStep
|
|
604
|
-
�? ├── Transfer/ # 穿梭�?
|
|
605
|
-
�? ├── Tree/ # 树形控件
|
|
606
|
-
�? ├── TreeSelect/ # 树选择�?
|
|
607
|
-
�? ├── Upload/ # 上传
|
|
608
|
-
�? ├── VirtualList/ # 虚拟列表
|
|
609
|
-
�? └── Watermark/ # 水印
|
|
610
|
-
├── styles/
|
|
611
|
-
�? ├── index.scss # 全局样式入口
|
|
612
|
-
�? └── var.scss # CSS 变量定义
|
|
613
|
-
└── utils/
|
|
614
|
-
├── types.ts # 公共类型
|
|
615
|
-
├── bem.ts # BEM 命名工具
|
|
616
|
-
└── icons.ts # 内置图标数据
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
### 设计思想
|
|
620
|
-
|
|
621
|
-
1. **组件丰富**:组�?API 设计简洁、BEM 命名规范、主题系统完�?
|
|
622
|
-
2. **Svelte 5 原生**:使�?Runes 语法,支�?`$bindable` 双向绑定,使�?Snippet 替代 Slot
|
|
623
|
-
3. **样式内聚**:每�?`.svelte` 文件内含 scoped 样式,无需单独引入 CSS
|
|
624
|
-
4. **TypeScript 优先**:所�?Props 定义�?TypeScript 接口,IDE 智能提示友好
|
|
625
|
-
5. **轻量无依�?*:仅依赖 `svelte` 核心,无第三方运行时依赖
|
|
626
|
-
|
|
627
|
-
## 完整 API 参�?
|
|
339
|
+
## Compatibility
|
|
628
340
|
|
|
629
|
-
|
|
341
|
+
| Format | File | Usage |
|
|
342
|
+
|--------|------|-------|
|
|
343
|
+
| ESM | `dist/svelte-ui-plus.mjs` | `import` syntax |
|
|
344
|
+
| CJS | `dist/svelte-ui-plus.cjs` | `require()` syntax |
|
|
345
|
+
| IIFE | `dist/svelte-ui-plus.iife.js` | CDN / `<script>` tag |
|
|
346
|
+
| CSS | `dist/styles.css` | Global styles |
|
|
347
|
+
| Svelte Source | `index.ts` | Direct Svelte project import |
|
|
630
348
|
|
|
631
|
-
##
|
|
349
|
+
## License
|
|
632
350
|
|
|
633
|
-
|
|
351
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# SvelteUI 组件库
|
|
2
|
+
|
|
3
|
+
基于 **Svelte 5** (Runes) 的 UI 组件库,为 Svelte 生态提供一套完整的 UI 解决方案。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- 基于 **Svelte 5 Runes** 语法(`$state`、`$props`、`$derived`、`$effect`、`$bindable`)
|
|
10
|
+
- **78 个组件**覆盖基础、表单、数据展示、反馈、导航、其他六大类
|
|
11
|
+
- **CSS 变量主题**系统,轻松定制主题色
|
|
12
|
+
- **BEM 命名规范**(`su-*` 前缀),样式隔离
|
|
13
|
+
- 支持**全量引用**和**按需引用**,天然 Tree-shaking 友好
|
|
14
|
+
- **TypeScript** 完整类型支持
|
|
15
|
+
- 每个组件自带 Scoped 样式,无需额外引入组件样式文件
|
|
16
|
+
- 内置 **20+ SVG 图标**
|
|
17
|
+
|
|
18
|
+
## 快速开始
|
|
19
|
+
|
|
20
|
+
### 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install svelte-ui-plus
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### CDN 使用
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/svelte-ui-plus/dist/styles.css" />
|
|
30
|
+
<script src="https://cdn.jsdelivr.net/npm/svelte-ui-plus/dist/svelte-ui-plus.iife.js"></script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 全量引用
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// main.ts 中引入全局样式(CSS 变量 + 基础重置)
|
|
37
|
+
import 'svelte-ui-plus/styles/index.scss'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```svelte
|
|
41
|
+
<script lang="ts">
|
|
42
|
+
import { Button, Input, Dialog, message } from 'svelte-ui-plus'
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<Button type="primary" onclick={() => message.success('Hello!')}>
|
|
46
|
+
点击我
|
|
47
|
+
</Button>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 按需引用
|
|
51
|
+
|
|
52
|
+
```svelte
|
|
53
|
+
<script lang="ts">
|
|
54
|
+
// 仅引入需要的组件
|
|
55
|
+
import { Button } from 'svelte-ui-plus/components/Button'
|
|
56
|
+
// 仅引入 CSS 变量(不含全局重置)
|
|
57
|
+
import 'svelte-ui-plus/styles/var.scss'
|
|
58
|
+
</script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 组件列表
|
|
62
|
+
|
|
63
|
+
### 基础组件 (Basic)
|
|
64
|
+
|
|
65
|
+
| 组件 | 说明 | 引用路径 |
|
|
66
|
+
|------|------|----------|
|
|
67
|
+
| `Icon` | SVG 图标 | `svelte-ui-plus/components/Icon` |
|
|
68
|
+
| `Button` | 按钮 | `svelte-ui-plus/components/Button` |
|
|
69
|
+
| `ButtonGroup` | 按钮组 | `svelte-ui-plus/components/Button` |
|
|
70
|
+
| `Link` | 链接 | `svelte-ui-plus/components/Link` |
|
|
71
|
+
| `Text` | 文本 | `svelte-ui-plus/components/Text` |
|
|
72
|
+
| `Scrollbar` | 滚动条 | `svelte-ui-plus/components/Scrollbar` |
|
|
73
|
+
| `Divider` | 分割线 | `svelte-ui-plus/components/Divider` |
|
|
74
|
+
| `Space` | 间距 | `svelte-ui-plus/components/Space` |
|
|
75
|
+
| `Row` | 行布局 | `svelte-ui-plus/components/Row` |
|
|
76
|
+
| `Col` | 列布局 | `svelte-ui-plus/components/Col` |
|
|
77
|
+
| `Container` | 布局容器 | `svelte-ui-plus/components/Container` |
|
|
78
|
+
| `Header` | 顶部容器 | `svelte-ui-plus/components/Container` |
|
|
79
|
+
| `Footer` | 底部容器 | `svelte-ui-plus/components/Container` |
|
|
80
|
+
| `Main` | 主内容容器 | `svelte-ui-plus/components/Container` |
|
|
81
|
+
| `Aside` | 侧边容器 | `svelte-ui-plus/components/Container` |
|
|
82
|
+
| `CheckTag` | 可选标签 | `svelte-ui-plus/components/CheckTag` |
|
|
83
|
+
| `ConfigProvider` | 全局配置 | `svelte-ui-plus/components/ConfigProvider` |
|
|
84
|
+
|
|
85
|
+
### 表单组件 (Form)
|
|
86
|
+
|
|
87
|
+
| 组件 | 说明 | 引用路径 |
|
|
88
|
+
|------|------|----------|
|
|
89
|
+
| `Input` | 输入框(含文本域) | `svelte-ui-plus/components/Input` |
|
|
90
|
+
| `InputNumber` | 数字输入框 | `svelte-ui-plus/components/InputNumber` |
|
|
91
|
+
| `InputTag` | 标签输入 | `svelte-ui-plus/components/InputTag` |
|
|
92
|
+
| `Autocomplete` | 自动补全 | `svelte-ui-plus/components/Autocomplete` |
|
|
93
|
+
| `Select` | 选择器 | `svelte-ui-plus/components/Select` |
|
|
94
|
+
| `TreeSelect` | 树选择器 | `svelte-ui-plus/components/TreeSelect` |
|
|
95
|
+
| `Cascader` | 级联选择器 | `svelte-ui-plus/components/Cascader` |
|
|
96
|
+
| `Switch` | 开关 | `svelte-ui-plus/components/Switch` |
|
|
97
|
+
| `Slider` | 滑块 | `svelte-ui-plus/components/Slider` |
|
|
98
|
+
| `Checkbox` | 复选框 | `svelte-ui-plus/components/Checkbox` |
|
|
99
|
+
| `CheckboxGroup` | 复选框组 | `svelte-ui-plus/components/Checkbox` |
|
|
100
|
+
| `Radio` | 单选框 | `svelte-ui-plus/components/Radio` |
|
|
101
|
+
| `RadioGroup` | 单选框组 | `svelte-ui-plus/components/Radio` |
|
|
102
|
+
| `Rate` | 评分 | `svelte-ui-plus/components/Rate` |
|
|
103
|
+
| `ColorPicker` | 颜色选择器 | `svelte-ui-plus/components/ColorPicker` |
|
|
104
|
+
| `DatePicker` | 日期选择器 | `svelte-ui-plus/components/DatePicker` |
|
|
105
|
+
| `TimePicker` | 时间选择器 | `svelte-ui-plus/components/TimePicker` |
|
|
106
|
+
| `TimeSelect` | 时间选择 | `svelte-ui-plus/components/TimeSelect` |
|
|
107
|
+
| `Transfer` | 穿梭框 | `svelte-ui-plus/components/Transfer` |
|
|
108
|
+
| `Upload` | 上传 | `svelte-ui-plus/components/Upload` |
|
|
109
|
+
| `Form` | 表单 | `svelte-ui-plus/components/Form` |
|
|
110
|
+
| `FormItem` | 表单项 | `svelte-ui-plus/components/Form` |
|
|
111
|
+
| `Mention` | 提及 | `svelte-ui-plus/components/Mention` |
|
|
112
|
+
|
|
113
|
+
### 数据展示组件 (Data Display)
|
|
114
|
+
|
|
115
|
+
| 组件 | 说明 | 引用路径 |
|
|
116
|
+
|------|------|----------|
|
|
117
|
+
| `Tag` | 标签 | `svelte-ui-plus/components/Tag` |
|
|
118
|
+
| `Badge` | 徽章 | `svelte-ui-plus/components/Badge` |
|
|
119
|
+
| `Avatar` | 头像 | `svelte-ui-plus/components/Avatar` |
|
|
120
|
+
| `Card` | 卡片 | `svelte-ui-plus/components/Card` |
|
|
121
|
+
| `Empty` | 空状态 | `svelte-ui-plus/components/Empty` |
|
|
122
|
+
| `Progress` | 进度条(线 / 圆) | `svelte-ui-plus/components/Progress` |
|
|
123
|
+
| `Skeleton` | 骨架屏 | `svelte-ui-plus/components/Skeleton` |
|
|
124
|
+
| `Table` | 表格 | `svelte-ui-plus/components/Table` |
|
|
125
|
+
| `Pagination` | 分页 | `svelte-ui-plus/components/Pagination` |
|
|
126
|
+
| `Descriptions` | 描述列表 | `svelte-ui-plus/components/Descriptions` |
|
|
127
|
+
| `DescriptionsItem` | 描述列表项 | `svelte-ui-plus/components/Descriptions` |
|
|
128
|
+
| `Result` | 结果页 | `svelte-ui-plus/components/Result` |
|
|
129
|
+
| `Statistic` | 统计数值 | `svelte-ui-plus/components/Statistic` |
|
|
130
|
+
| `Countdown` | 倒计时 | `svelte-ui-plus/components/Countdown` |
|
|
131
|
+
| `Segmented` | 分段控制器 | `svelte-ui-plus/components/Segmented` |
|
|
132
|
+
| `Tree` | 树形控件 | `svelte-ui-plus/components/Tree` |
|
|
133
|
+
| `Calendar` | 日历 | `svelte-ui-plus/components/Calendar` |
|
|
134
|
+
| `Carousel` | 走马灯 | `svelte-ui-plus/components/Carousel` |
|
|
135
|
+
| `CarouselItem` | 走马灯子项 | `svelte-ui-plus/components/Carousel` |
|
|
136
|
+
| `Timeline` | 时间线 | `svelte-ui-plus/components/Timeline` |
|
|
137
|
+
| `TimelineItem` | 时间线节点 | `svelte-ui-plus/components/Timeline` |
|
|
138
|
+
| `Watermark` | 水印 | `svelte-ui-plus/components/Watermark` |
|
|
139
|
+
| `Image` | 图片 | `svelte-ui-plus/components/Image` |
|
|
140
|
+
| `Collapse` | 折叠面板 | `svelte-ui-plus/components/Collapse` |
|
|
141
|
+
| `CollapseItem` | 折叠面板项 | `svelte-ui-plus/components/Collapse` |
|
|
142
|
+
| `VirtualList` | 虚拟列表 | `svelte-ui-plus/components/VirtualList` |
|
|
143
|
+
| `InfiniteScroll` | 无限滚动 | `svelte-ui-plus/components/InfiniteScroll` |
|
|
144
|
+
|
|
145
|
+
### 反馈组件 (Feedback)
|
|
146
|
+
|
|
147
|
+
| 组件 | 说明 | 引用路径 |
|
|
148
|
+
|------|------|----------|
|
|
149
|
+
| `Alert` | 警告 | `svelte-ui-plus/components/Alert` |
|
|
150
|
+
| `Dialog` | 对话框 | `svelte-ui-plus/components/Dialog` |
|
|
151
|
+
| `Drawer` | 抽屉 | `svelte-ui-plus/components/Drawer` |
|
|
152
|
+
| `Tooltip` | 文字提示 | `svelte-ui-plus/components/Tooltip` |
|
|
153
|
+
| `Popover` | 弹出框 | `svelte-ui-plus/components/Popover` |
|
|
154
|
+
| `Popconfirm` | 气泡确认框 | `svelte-ui-plus/components/Popconfirm` |
|
|
155
|
+
| `Message` | 消息提示(函数式) | `svelte-ui-plus/components/Message` |
|
|
156
|
+
| `MessageBox` | 消息弹框 | `svelte-ui-plus/components/MessageBox` |
|
|
157
|
+
| `Notification` | 通知 | `svelte-ui-plus/components/Notification` |
|
|
158
|
+
| `Loading` | 加载 | `svelte-ui-plus/components/Loading` |
|
|
159
|
+
| `Tour` | 漫游式引导 | `svelte-ui-plus/components/Tour` |
|
|
160
|
+
| `TourStep` | 引导步骤 | `svelte-ui-plus/components/Tour` |
|
|
161
|
+
| `Overlay` | 遮罩层 | `svelte-ui-plus/components/Overlay` |
|
|
162
|
+
| `CollapseTransition` | 折叠过渡 | `svelte-ui-plus/components/CollapseTransition` |
|
|
163
|
+
|
|
164
|
+
### 导航组件 (Navigation)
|
|
165
|
+
|
|
166
|
+
| 组件 | 说明 | 引用路径 |
|
|
167
|
+
|------|------|----------|
|
|
168
|
+
| `Tabs` | 标签页 | `svelte-ui-plus/components/Tabs` |
|
|
169
|
+
| `Breadcrumb` | 面包屑 | `svelte-ui-plus/components/Breadcrumb` |
|
|
170
|
+
| `BreadcrumbItem` | 面包屑项 | `svelte-ui-plus/components/Breadcrumb` |
|
|
171
|
+
| `Dropdown` | 下拉菜单 | `svelte-ui-plus/components/Dropdown` |
|
|
172
|
+
| `Menu` | 导航菜单 | `svelte-ui-plus/components/Menu` |
|
|
173
|
+
| `MenuItem` | 菜单项 | `svelte-ui-plus/components/Menu` |
|
|
174
|
+
| `MenuItemGroup` | 菜单分组 | `svelte-ui-plus/components/Menu` |
|
|
175
|
+
| `SubMenu` | 子菜单 | `svelte-ui-plus/components/Menu` |
|
|
176
|
+
| `PageHeader` | 页头 | `svelte-ui-plus/components/PageHeader` |
|
|
177
|
+
| `Steps` | 步骤条 | `svelte-ui-plus/components/Steps` |
|
|
178
|
+
| `Step` | 步骤 | `svelte-ui-plus/components/Steps` |
|
|
179
|
+
| `Affix` | 固钉 | `svelte-ui-plus/components/Affix` |
|
|
180
|
+
| `Backtop` | 回到顶部 | `svelte-ui-plus/components/Backtop` |
|
|
181
|
+
| `Anchor` | 锚点 | `svelte-ui-plus/components/Anchor` |
|
|
182
|
+
| `AnchorLink` | 锚点链接 | `svelte-ui-plus/components/Anchor` |
|
|
183
|
+
|
|
184
|
+
### 其他组件 (Other)
|
|
185
|
+
|
|
186
|
+
| 组件 | 说明 | 引用路径 |
|
|
187
|
+
|------|------|----------|
|
|
188
|
+
| `Splitter` | 分割面板 | `svelte-ui-plus/components/Splitter` |
|
|
189
|
+
| `SplitterPanel` | 分割面板子项 | `svelte-ui-plus/components/Splitter` |
|
|
190
|
+
|
|
191
|
+
## 使用示例
|
|
192
|
+
|
|
193
|
+
### Button 按钮
|
|
194
|
+
|
|
195
|
+
```svelte
|
|
196
|
+
<Button
|
|
197
|
+
type="primary | success | warning | danger | info | default"
|
|
198
|
+
size="large | default | small"
|
|
199
|
+
plain={false}
|
|
200
|
+
round={false}
|
|
201
|
+
circle={false}
|
|
202
|
+
disabled={false}
|
|
203
|
+
loading={false}
|
|
204
|
+
icon="search"
|
|
205
|
+
onclick={handler}
|
|
206
|
+
>
|
|
207
|
+
按钮文字
|
|
208
|
+
</Button>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Input 输入框
|
|
212
|
+
|
|
213
|
+
```svelte
|
|
214
|
+
<Input
|
|
215
|
+
bind:value={text}
|
|
216
|
+
type="text | password | number | email | textarea"
|
|
217
|
+
placeholder="请输入"
|
|
218
|
+
clearable
|
|
219
|
+
showPassword
|
|
220
|
+
disabled={false}
|
|
221
|
+
size="large | default | small"
|
|
222
|
+
maxlength={100}
|
|
223
|
+
showWordLimit
|
|
224
|
+
prefixIcon="search"
|
|
225
|
+
/>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Select 选择器
|
|
229
|
+
|
|
230
|
+
```svelte
|
|
231
|
+
<Select
|
|
232
|
+
bind:value={selected}
|
|
233
|
+
options={[
|
|
234
|
+
{ label: '选项一', value: 1 },
|
|
235
|
+
{ label: '选项二', value: 2 },
|
|
236
|
+
{ label: '选项三', value: 3, disabled: true },
|
|
237
|
+
]}
|
|
238
|
+
placeholder="请选择"
|
|
239
|
+
clearable
|
|
240
|
+
multiple={false}
|
|
241
|
+
/>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Dialog 对话框
|
|
245
|
+
|
|
246
|
+
```svelte
|
|
247
|
+
<Dialog bind:open={showDialog} title="提示" width="500px">
|
|
248
|
+
<p>这是一段内容</p>
|
|
249
|
+
{#snippet footer()}
|
|
250
|
+
<Button onclick={() => showDialog = false}>取消</Button>
|
|
251
|
+
<Button type="primary" onclick={confirm}>确定</Button>
|
|
252
|
+
{/snippet}
|
|
253
|
+
</Dialog>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Table 表格
|
|
257
|
+
|
|
258
|
+
```svelte
|
|
259
|
+
<Table
|
|
260
|
+
data={tableData}
|
|
261
|
+
columns={[
|
|
262
|
+
{ key: 'name', title: '姓名', width: '120px' },
|
|
263
|
+
{ key: 'age', title: '年龄', width: '80px', align: 'center' },
|
|
264
|
+
{ key: 'email', title: '邮箱' },
|
|
265
|
+
]}
|
|
266
|
+
stripe
|
|
267
|
+
border
|
|
268
|
+
/>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Message 消息提示(函数式)
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
import { message } from 'svelte-ui-plus'
|
|
275
|
+
|
|
276
|
+
message.success('操作成功')
|
|
277
|
+
message.error('操作失败')
|
|
278
|
+
message.warning('请注意')
|
|
279
|
+
message.info('提示信息')
|
|
280
|
+
|
|
281
|
+
// 高级用法
|
|
282
|
+
const { close } = message.success('手动关闭', { duration: 0, showClose: true })
|
|
283
|
+
close() // 手动关闭
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### MessageBox 消息弹框(函数式)
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
import { msgAlert, msgConfirm, msgPrompt } from 'svelte-ui-plus'
|
|
290
|
+
|
|
291
|
+
await msgAlert('提示消息', '标题')
|
|
292
|
+
|
|
293
|
+
try {
|
|
294
|
+
await msgConfirm('确定要删除吗?', '警告')
|
|
295
|
+
} catch { /* 取消 */ }
|
|
296
|
+
|
|
297
|
+
const { value } = await msgPrompt('请输入名称', '输入')
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Notification 通知(函数式)
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
import { notify } from 'svelte-ui-plus'
|
|
304
|
+
|
|
305
|
+
notify({ title: '通知', message: '内容', type: 'success' })
|
|
306
|
+
notify.success('操作成功')
|
|
307
|
+
notify.error({ title: '错误', message: '失败', duration: 0 })
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Form 表单
|
|
311
|
+
|
|
312
|
+
```svelte
|
|
313
|
+
<Form labelWidth="100px" labelPosition="right">
|
|
314
|
+
<FormItem label="用户名" required error={errors.username}>
|
|
315
|
+
<Input bind:value={form.username} />
|
|
316
|
+
</FormItem>
|
|
317
|
+
<FormItem label="密码" required>
|
|
318
|
+
<Input bind:value={form.password} type="password" showPassword />
|
|
319
|
+
</FormItem>
|
|
320
|
+
<FormItem>
|
|
321
|
+
<Button type="primary" onclick={submit}>提交</Button>
|
|
322
|
+
</FormItem>
|
|
323
|
+
</Form>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## 内置图标
|
|
327
|
+
|
|
328
|
+
通过 `<Icon name="xxx" />` 使用内置图标:
|
|
329
|
+
|
|
330
|
+
| 名称 | 说明 | 名称 | 说明 |
|
|
331
|
+
|------|------|------|------|
|
|
332
|
+
| `close` | 关闭 | `check` | 勾选 |
|
|
333
|
+
| `circle-check` | 圆形勾选 | `circle-close` | 圆形关闭 |
|
|
334
|
+
| `info` | 信息 | `warning` | 警告 |
|
|
335
|
+
| `search` | 搜索 | `loading` | 加载中 |
|
|
336
|
+
| `arrow-up` | 向上箭头 | `arrow-down` | 向下箭头 |
|
|
337
|
+
| `arrow-left` | 向左箭头 | `arrow-right` | 向右箭头 |
|
|
338
|
+
| `eye` | 可见 | `eye-off` | 不可见 |
|
|
339
|
+
| `plus` | 加号 | `minus` | 减号 |
|
|
340
|
+
| `delete` | 删除 | `edit` | 编辑 |
|
|
341
|
+
| `more` | 更多 | `refresh` | 刷新 |
|
|
342
|
+
| `setting` | 设置 | `fullscreen` | 全屏 |
|
|
343
|
+
|
|
344
|
+
```svelte
|
|
345
|
+
<Icon name="search" size={20} color="var(--su-color-primary)" />
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## 主题定制
|
|
349
|
+
|
|
350
|
+
覆盖 CSS 变量即可自定义主题:
|
|
351
|
+
|
|
352
|
+
```scss
|
|
353
|
+
:root {
|
|
354
|
+
--su-color-primary: #722ed1; // 品牌色
|
|
355
|
+
--su-color-success: #52c41a;
|
|
356
|
+
--su-color-warning: #faad14;
|
|
357
|
+
--su-color-danger: #ff4d4f;
|
|
358
|
+
--su-border-radius-base: 8px; // 更圆的圆角
|
|
359
|
+
--su-font-size-base: 15px; // 更大字号
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## 兼容性
|
|
364
|
+
|
|
365
|
+
| 格式 | 文件 | 用途 |
|
|
366
|
+
|------|------|------|
|
|
367
|
+
| ESM | `dist/svelte-ui-plus.mjs` | `import` 语法 |
|
|
368
|
+
| CJS | `dist/svelte-ui-plus.cjs` | `require()` 语法 |
|
|
369
|
+
| IIFE | `dist/svelte-ui-plus.iife.js` | CDN / `<script>` 标签 |
|
|
370
|
+
| CSS | `dist/styles.css` | 全局样式 |
|
|
371
|
+
| Svelte 源码 | `index.ts` | Svelte 项目直接引用 |
|
|
372
|
+
|
|
373
|
+
## 许可证
|
|
374
|
+
|
|
375
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-ui-plus",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "基于 Svelte 5 的 UI 组件库,提供 78+ 组件",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"styles",
|
|
41
41
|
"utils",
|
|
42
42
|
"index.ts",
|
|
43
|
-
"README.md"
|
|
43
|
+
"README.md","README.zh-CN.md"
|
|
44
44
|
],
|
|
45
45
|
"sideEffects": [
|
|
46
46
|
"**/*.css",
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
"sass": "^1.98.0",
|
|
59
59
|
"svelte": "^5.55.1"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|