little-dizzy 1.0.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.en.md +36 -0
- package/README.md +162 -0
- package/dist/little-dizzy.css +1 -0
- package/dist/little-dizzy.js +269 -0
- package/dist/little-dizzy.umd.cjs +45 -0
- package/dist/vite.svg +1 -0
- package/package.json +55 -0
- package/src/components/Button.vue +176 -0
- package/src/components/Card.vue +98 -0
- package/src/components/HelloWorld.vue +43 -0
- package/src/components/Modal.vue +182 -0
- package/src/index.js +55 -0
- package/src/snippets/index.js +166 -0
- package/src/snippets/presets/button.js +19 -0
- package/src/snippets/presets/card.js +25 -0
- package/src/snippets/presets/index.js +22 -0
- package/src/snippets/presets/modal.js +30 -0
- package/src/styles/_variables.scss +293 -0
- package/src/styles/main.scss +17 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button 按钮组件示例代码
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
name: 'Button',
|
|
6
|
+
type: 'vue',
|
|
7
|
+
label: 'Button 按钮',
|
|
8
|
+
code: `<template>
|
|
9
|
+
<Button type="primary">主要按钮</Button>
|
|
10
|
+
<Button type="success">成功按钮</Button>
|
|
11
|
+
<Button type="warning">警告按钮</Button>
|
|
12
|
+
<Button type="danger">危险按钮</Button>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup>
|
|
16
|
+
import { Button } from 'little-dizzy'
|
|
17
|
+
</script>`
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card 卡片组件示例代码
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
name: 'Card',
|
|
6
|
+
type: 'vue',
|
|
7
|
+
label: 'Card 卡片',
|
|
8
|
+
code: `<template>
|
|
9
|
+
<Card title="卡片标题">
|
|
10
|
+
<template #header>
|
|
11
|
+
<Button type="primary" size="small">操作</Button>
|
|
12
|
+
</template>
|
|
13
|
+
<div>卡片内容区域</div>
|
|
14
|
+
<template #footer>
|
|
15
|
+
<Button type="secondary" size="small">关闭</Button>
|
|
16
|
+
<Button type="primary" size="small">确认</Button>
|
|
17
|
+
</template>
|
|
18
|
+
</Card>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { Card, Button } from 'little-dizzy'
|
|
23
|
+
</script>`
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 预设代码片段
|
|
3
|
+
*
|
|
4
|
+
* 这些是 LittleDizzy 组件库自带的示例代码片段
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import buttonSnippet from './button.js'
|
|
8
|
+
import cardSnippet from './card.js'
|
|
9
|
+
import modalSnippet from './modal.js'
|
|
10
|
+
|
|
11
|
+
// 所有预设代码片段
|
|
12
|
+
export const presetSnippets = [
|
|
13
|
+
buttonSnippet,
|
|
14
|
+
cardSnippet,
|
|
15
|
+
modalSnippet
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
// 单独导出
|
|
19
|
+
export { buttonSnippet, cardSnippet, modalSnippet }
|
|
20
|
+
|
|
21
|
+
export default presetSnippets
|
|
22
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal 模态框组件示例代码
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
name: 'Modal',
|
|
6
|
+
type: 'vue',
|
|
7
|
+
label: 'Modal 模态框',
|
|
8
|
+
code: `<template>
|
|
9
|
+
<div>
|
|
10
|
+
<Button type="primary" @click="visible = true">
|
|
11
|
+
打开模态框
|
|
12
|
+
</Button>
|
|
13
|
+
<Modal
|
|
14
|
+
:visible="visible"
|
|
15
|
+
title="模态框标题"
|
|
16
|
+
@close="visible = false"
|
|
17
|
+
>
|
|
18
|
+
<div>模态框内容区域</div>
|
|
19
|
+
</Modal>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import { ref } from 'vue'
|
|
25
|
+
import { Modal, Button } from 'little-dizzy'
|
|
26
|
+
|
|
27
|
+
const visible = ref(false)
|
|
28
|
+
</script>`
|
|
29
|
+
}
|
|
30
|
+
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
|
|
3
|
+
// 全局样式变量
|
|
4
|
+
$primary-color: #409EFF;
|
|
5
|
+
$success-color: #67C23A;
|
|
6
|
+
$warning-color: #E6A23C;
|
|
7
|
+
$danger-color: #F56C6C;
|
|
8
|
+
$info-color: #909399;
|
|
9
|
+
|
|
10
|
+
// 字体变量
|
|
11
|
+
$font-size-small: 12px;
|
|
12
|
+
$font-size-base: 14px;
|
|
13
|
+
$font-size-large: 16px;
|
|
14
|
+
|
|
15
|
+
// 间距变量
|
|
16
|
+
$spacing-xs: 4px;
|
|
17
|
+
$spacing-sm: 8px;
|
|
18
|
+
$spacing-md: 16px;
|
|
19
|
+
$spacing-lg: 24px;
|
|
20
|
+
$spacing-xl: 32px;
|
|
21
|
+
|
|
22
|
+
// 边框变量
|
|
23
|
+
$border-radius-sm: 2px;
|
|
24
|
+
$border-radius-md: 4px;
|
|
25
|
+
$border-radius-lg: 8px;
|
|
26
|
+
|
|
27
|
+
// 阴影变量
|
|
28
|
+
$shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
29
|
+
$shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
30
|
+
$shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.2);
|
|
31
|
+
|
|
32
|
+
// 全局重置样式
|
|
33
|
+
* {
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
body {
|
|
40
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
41
|
+
font-size: $font-size-base;
|
|
42
|
+
color: #303133;
|
|
43
|
+
background-color: #f5f7fa;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 基础按钮样式
|
|
47
|
+
.btn {
|
|
48
|
+
display: inline-block;
|
|
49
|
+
padding: 8px 16px;
|
|
50
|
+
border: 1px solid transparent;
|
|
51
|
+
border-radius: $border-radius-md;
|
|
52
|
+
font-size: $font-size-base;
|
|
53
|
+
font-weight: 400;
|
|
54
|
+
line-height: 1.5;
|
|
55
|
+
text-align: center;
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
vertical-align: middle;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: all 0.3s;
|
|
60
|
+
|
|
61
|
+
&:hover {
|
|
62
|
+
opacity: 0.9;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:active {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:disabled {
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
opacity: 0.6;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 主要按钮
|
|
75
|
+
&-primary {
|
|
76
|
+
color: #fff;
|
|
77
|
+
background-color: $primary-color;
|
|
78
|
+
border-color: $primary-color;
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
background-color: color.adjust($primary-color, $lightness: -10%);
|
|
82
|
+
border-color: color.adjust($primary-color, $lightness: -10%);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 成功按钮
|
|
87
|
+
&-success {
|
|
88
|
+
color: #fff;
|
|
89
|
+
background-color: $success-color;
|
|
90
|
+
border-color: $success-color;
|
|
91
|
+
|
|
92
|
+
&:hover {
|
|
93
|
+
background-color: color.adjust($success-color, $lightness: -10%);
|
|
94
|
+
border-color: color.adjust($success-color, $lightness: -10%);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 警告按钮
|
|
99
|
+
&-warning {
|
|
100
|
+
color: #fff;
|
|
101
|
+
background-color: $warning-color;
|
|
102
|
+
border-color: $warning-color;
|
|
103
|
+
|
|
104
|
+
&:hover {
|
|
105
|
+
background-color: color.adjust($warning-color, $lightness: -10%);
|
|
106
|
+
border-color: color.adjust($warning-color, $lightness: -10%);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 危险按钮
|
|
111
|
+
&-danger {
|
|
112
|
+
color: #fff;
|
|
113
|
+
background-color: $danger-color;
|
|
114
|
+
border-color: $danger-color;
|
|
115
|
+
|
|
116
|
+
&:hover {
|
|
117
|
+
background-color: color.adjust($danger-color, $lightness: -10%);
|
|
118
|
+
border-color: color.adjust($danger-color, $lightness: -10%);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 信息按钮
|
|
123
|
+
&-info {
|
|
124
|
+
color: #fff;
|
|
125
|
+
background-color: $info-color;
|
|
126
|
+
border-color: $info-color;
|
|
127
|
+
|
|
128
|
+
&:hover {
|
|
129
|
+
background-color: color.adjust($info-color, $lightness: -10%);
|
|
130
|
+
border-color: color.adjust($info-color, $lightness: -10%);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 次要按钮
|
|
135
|
+
&-secondary {
|
|
136
|
+
color: #606266;
|
|
137
|
+
background-color: #fff;
|
|
138
|
+
border-color: #dcdfe6;
|
|
139
|
+
|
|
140
|
+
&:hover {
|
|
141
|
+
color: $primary-color;
|
|
142
|
+
border-color: $primary-color;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 按钮尺寸
|
|
147
|
+
&-small {
|
|
148
|
+
padding: 4px 8px;
|
|
149
|
+
font-size: $font-size-small;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&-large {
|
|
153
|
+
padding: 12px 24px;
|
|
154
|
+
font-size: $font-size-large;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 基础卡片样式
|
|
159
|
+
.card {
|
|
160
|
+
position: relative;
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
min-width: 0;
|
|
164
|
+
word-wrap: break-word;
|
|
165
|
+
background-color: #fff;
|
|
166
|
+
background-clip: border-box;
|
|
167
|
+
border: 1px solid rgba(0, 0, 0, 0.125);
|
|
168
|
+
border-radius: $border-radius-lg;
|
|
169
|
+
box-shadow: $shadow-sm;
|
|
170
|
+
transition: box-shadow 0.3s;
|
|
171
|
+
|
|
172
|
+
&:hover {
|
|
173
|
+
box-shadow: $shadow-md;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&-header {
|
|
177
|
+
padding: 16px;
|
|
178
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
|
|
179
|
+
|
|
180
|
+
&-title {
|
|
181
|
+
margin: 0;
|
|
182
|
+
font-size: $font-size-large;
|
|
183
|
+
font-weight: 600;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&-body {
|
|
188
|
+
flex: 1 1 auto;
|
|
189
|
+
padding: 16px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&-footer {
|
|
193
|
+
padding: 16px;
|
|
194
|
+
border-top: 1px solid rgba(0, 0, 0, 0.125);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// 基础模态框样式
|
|
199
|
+
.modal {
|
|
200
|
+
position: fixed;
|
|
201
|
+
top: 0;
|
|
202
|
+
left: 0;
|
|
203
|
+
z-index: 1050;
|
|
204
|
+
display: none;
|
|
205
|
+
width: 100%;
|
|
206
|
+
height: 100%;
|
|
207
|
+
overflow: hidden;
|
|
208
|
+
outline: 0;
|
|
209
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
210
|
+
|
|
211
|
+
&.show {
|
|
212
|
+
display: flex;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
align-items: center;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&-dialog {
|
|
218
|
+
position: relative;
|
|
219
|
+
width: auto;
|
|
220
|
+
margin: 10px;
|
|
221
|
+
pointer-events: none;
|
|
222
|
+
|
|
223
|
+
@media (min-width: 576px) {
|
|
224
|
+
max-width: 500px;
|
|
225
|
+
margin: 1.75rem auto;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
&-content {
|
|
230
|
+
position: relative;
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
width: 100%;
|
|
234
|
+
pointer-events: auto;
|
|
235
|
+
background-color: #fff;
|
|
236
|
+
background-clip: padding-box;
|
|
237
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
238
|
+
border-radius: $border-radius-lg;
|
|
239
|
+
outline: 0;
|
|
240
|
+
box-shadow: $shadow-lg;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&-header {
|
|
244
|
+
display: flex;
|
|
245
|
+
justify-content: space-between;
|
|
246
|
+
align-items: center;
|
|
247
|
+
padding: 16px;
|
|
248
|
+
border-bottom: 1px solid #dee2e6;
|
|
249
|
+
border-top-left-radius: calc($border-radius-lg - 1px);
|
|
250
|
+
border-top-right-radius: calc($border-radius-lg - 1px);
|
|
251
|
+
|
|
252
|
+
&-title {
|
|
253
|
+
margin: 0;
|
|
254
|
+
font-size: $font-size-large;
|
|
255
|
+
font-weight: 600;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&-close {
|
|
259
|
+
padding: 0;
|
|
260
|
+
background-color: transparent;
|
|
261
|
+
border: 0;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
font-size: 1.5rem;
|
|
264
|
+
line-height: 1;
|
|
265
|
+
color: #6c757d;
|
|
266
|
+
opacity: 0.5;
|
|
267
|
+
|
|
268
|
+
&:hover {
|
|
269
|
+
opacity: 1;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
&-body {
|
|
275
|
+
position: relative;
|
|
276
|
+
flex: 1 1 auto;
|
|
277
|
+
padding: 16px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&-footer {
|
|
281
|
+
display: flex;
|
|
282
|
+
justify-content: flex-end;
|
|
283
|
+
align-items: center;
|
|
284
|
+
padding: 16px;
|
|
285
|
+
border-top: 1px solid #dee2e6;
|
|
286
|
+
border-bottom-left-radius: calc($border-radius-lg - 1px);
|
|
287
|
+
border-bottom-right-radius: calc($border-radius-lg - 1px);
|
|
288
|
+
|
|
289
|
+
> * + * {
|
|
290
|
+
margin-left: 8px;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// 导入变量
|
|
2
|
+
@use './_variables.scss' as *;
|
|
3
|
+
|
|
4
|
+
// 导入其他样式文件
|
|
5
|
+
// @import './_buttons.scss';
|
|
6
|
+
// @import './_cards.scss';
|
|
7
|
+
// @import './_modals.scss';
|
|
8
|
+
|
|
9
|
+
// 全局样式
|
|
10
|
+
body {
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
14
|
+
font-size: $font-size-base;
|
|
15
|
+
color: #303133;
|
|
16
|
+
background-color: #f5f7fa;
|
|
17
|
+
}
|