dlzn-ui 1.17.0 → 1.20.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/assets/css/element-plus-reset.css +79 -0
- package/assets/css/index.css +5 -0
- package/assets/css/other.css +16 -0
- package/assets/css/tailwindcss-entry.css +20 -0
- package/assets/css/tdesign-chat-reset.css +33 -0
- package/assets/css/tdesign-reset.css +355 -0
- package/package.json +5 -1
- package/prettier-config.mjs +14 -3
- package/vite-config.mjs +47 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* stylelint-disable selector-class-pattern */
|
|
2
|
+
body {
|
|
3
|
+
.el-popper__arrow {
|
|
4
|
+
display: none;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.el-input__icon {
|
|
8
|
+
&.clear-icon {
|
|
9
|
+
font-size: 16px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.el-date-editor {
|
|
14
|
+
&.is-focus .el-input__wrapper {
|
|
15
|
+
/* 非range focus */
|
|
16
|
+
box-shadow: 0 0 0 2px var(--el-input-focus-border-color) inset;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.t-is-success {
|
|
20
|
+
.el-input__wrapper {
|
|
21
|
+
--el-input-border-color: var(--td-success-color);
|
|
22
|
+
--el-input-hover-border-color: var(--td-success-color);
|
|
23
|
+
--el-input-focus-border-color: var(--td-success-color);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.t-is-warning {
|
|
28
|
+
.el-input__wrapper {
|
|
29
|
+
--el-input-border-color: var(--td-warning-color);
|
|
30
|
+
--el-input-hover-border-color: var(--td-warning-color);
|
|
31
|
+
--el-input-focus-border-color: var(--td-warning-color);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.t-is-error {
|
|
36
|
+
.el-input__wrapper {
|
|
37
|
+
--el-input-border-color: var(--td-error-color);
|
|
38
|
+
--el-input-hover-border-color: var(--td-error-color);
|
|
39
|
+
--el-input-focus-border-color: var(--td-error-color);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.el-range-editor {
|
|
45
|
+
&.is-active {
|
|
46
|
+
/* range focus */
|
|
47
|
+
box-shadow: 0 0 0 2px var(--el-input-focus-border-color) inset !important;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.el-input__wrapper {
|
|
52
|
+
&.is-focus {
|
|
53
|
+
/* 时间输入框 focus */
|
|
54
|
+
box-shadow: 0 0 0 2px var(--el-input-focus-border-color) inset;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.t-form__controls {
|
|
59
|
+
&.t-is-error {
|
|
60
|
+
.el-input__wrapper {
|
|
61
|
+
/* TDatePicker */
|
|
62
|
+
--el-input-border-color: var(--td-error-color);
|
|
63
|
+
|
|
64
|
+
/* TDatePicker */
|
|
65
|
+
--el-input-hover-border-color: var(--td-error-color);
|
|
66
|
+
|
|
67
|
+
/* TDatePicker */
|
|
68
|
+
--el-input-focus-border-color: var(--td-error-color);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.el-date-editor {
|
|
73
|
+
--el-date-editor-width: 100%;
|
|
74
|
+
--el-date-editor-monthrange-width: 100%;
|
|
75
|
+
--el-date-editor-daterange-width: 100%;
|
|
76
|
+
--el-date-editor-datetimerange-width: 100%;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
@theme {
|
|
4
|
+
--font-sans: blinkmacsystemfont, -apple-system, 'Segoe UI', roboto, helvetica, arial, sans-serif;
|
|
5
|
+
|
|
6
|
+
/* stylelint-disable-next-line custom-property-pattern */
|
|
7
|
+
--color-*: initial;
|
|
8
|
+
|
|
9
|
+
/* 自定义变量 */
|
|
10
|
+
|
|
11
|
+
/* --color-primary: var(--td-brand-color-active); */
|
|
12
|
+
|
|
13
|
+
/* 同tdesign 保持一致 */
|
|
14
|
+
--breakpoint-xs: 20rem;
|
|
15
|
+
--breakpoint-sm: 48rem;
|
|
16
|
+
--breakpoint-md: 62rem;
|
|
17
|
+
--breakpoint-lg: 75rem;
|
|
18
|
+
--breakpoint-xl: 87.5rem;
|
|
19
|
+
--breakpoint-2xl: 117.5rem;
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* stylelint-disable custom-property-pattern */
|
|
2
|
+
.chatbot_wrapper {
|
|
3
|
+
--td-chat-item-gap: 12px;
|
|
4
|
+
--td-chat-item-left-avatar-margin: 0 8px 0 4px;
|
|
5
|
+
--td-chat-item-right-avatar-margin: 0 4px 0 8px;
|
|
6
|
+
--td-chat-item-content-padding: 6px 0 0;
|
|
7
|
+
--td-chat-font-size: var(--td-font-size-body-medium);
|
|
8
|
+
--td-chat-item-text-padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s);
|
|
9
|
+
|
|
10
|
+
::part(t-chat__input__content) {
|
|
11
|
+
border-radius: var(--td-radius-default);
|
|
12
|
+
|
|
13
|
+
&:focus-within {
|
|
14
|
+
box-shadow: 0 0 0 1px var(--td-brand-color) inset;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
::part(t-chat__text--user) {
|
|
19
|
+
background-color: var(--td-bg-color-container-active);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
::part(t-chat__input) {
|
|
23
|
+
padding: 0 12px 12px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
::part(t-chat__list) {
|
|
27
|
+
padding: 0 12px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
::part(t-chat__item__inner) {
|
|
31
|
+
margin-top: 12px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/* stylelint-disable custom-property-pattern */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--td-radius-default: 4px;
|
|
5
|
+
--td-radius-large: 8px;
|
|
6
|
+
--td-font-family: var(--font-sans);
|
|
7
|
+
--td-font-family-medium: var(--font-sans);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:root,
|
|
11
|
+
:root[theme-mode='light'] {
|
|
12
|
+
--td-font-gray-1: rgb(0 0 0 / 70%);
|
|
13
|
+
--td-brand-color-1: #f2f3ff;
|
|
14
|
+
--td-brand-color-2: #cadffc;
|
|
15
|
+
--td-brand-color-3: #a1cbfa;
|
|
16
|
+
--td-brand-color-4: #79b7f7;
|
|
17
|
+
--td-brand-color-5: #51a2f4;
|
|
18
|
+
--td-brand-color-6: #288ef2;
|
|
19
|
+
--td-brand-color-7: #007aef;
|
|
20
|
+
--td-brand-color-8: #005fbb;
|
|
21
|
+
--td-brand-color-9: #004586;
|
|
22
|
+
--td-brand-color-10: #002a52;
|
|
23
|
+
--td-gray-color-1: #fafafa;
|
|
24
|
+
--td-bg-color-page: rgb(244 245 250);
|
|
25
|
+
--td-shadow-1:
|
|
26
|
+
0 2px 2px -1px rgb(58 53 65 / 8%), 0 1px 5px 1px rgb(58 53 65 / 12%),
|
|
27
|
+
0 1px 8px 1px rgb(58 53 65 / 4%);
|
|
28
|
+
--td-shadow-2:
|
|
29
|
+
0 4px 5px -2px rgb(58 53 65 / 8%), 0 2px 10px 1px rgb(58 53 65 / 12%),
|
|
30
|
+
0 2px 16px 1px rgb(58 53 65 / 4%);
|
|
31
|
+
--td-shadow-3:
|
|
32
|
+
0 5px 7px -3px rgb(58 53 65 / 8%), 0 3px 13px 1px rgb(58 53 65 / 12%),
|
|
33
|
+
0 3px 21px 1px rgb(58 53 65 / 4%);
|
|
34
|
+
--td-mask-active: rgb(58 53 65 / 32%);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
body {
|
|
38
|
+
> .t-loading__overlay {
|
|
39
|
+
background-color: rgb(255 255 255 / 10%);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.t-list-item {
|
|
43
|
+
&:last-child {
|
|
44
|
+
&::after {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.t-radio__input,
|
|
51
|
+
.t-checkbox__input {
|
|
52
|
+
width: 20px;
|
|
53
|
+
height: 20px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.t-radio {
|
|
57
|
+
&.t-is-checked {
|
|
58
|
+
.t-radio__input {
|
|
59
|
+
border-width: 2px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.t-checkbox {
|
|
65
|
+
&.t-is-checked {
|
|
66
|
+
.t-checkbox__input {
|
|
67
|
+
transition: none;
|
|
68
|
+
|
|
69
|
+
&::after {
|
|
70
|
+
top: 8px;
|
|
71
|
+
left: 3px;
|
|
72
|
+
width: 8px;
|
|
73
|
+
height: 14px;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.t-is-indeterminate {
|
|
79
|
+
.t-checkbox__input {
|
|
80
|
+
transition: none;
|
|
81
|
+
|
|
82
|
+
&::after {
|
|
83
|
+
top: 7px;
|
|
84
|
+
left: -4px;
|
|
85
|
+
width: 26px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* 里层的状态干不过外层的状态 */
|
|
92
|
+
.t-input:not(.t-range-input .t-input), /* input select inputNumber tagInput treeSelect */
|
|
93
|
+
.t-range-input, /* rangeInput */
|
|
94
|
+
.t-textarea__inner /* textarea */ {
|
|
95
|
+
&.t-is-focused,
|
|
96
|
+
&.t-input--focused {
|
|
97
|
+
box-shadow: 0 0 0 1px var(--td-brand-color) inset;
|
|
98
|
+
|
|
99
|
+
&.t-is-success {
|
|
100
|
+
box-shadow: 0 0 0 1px var(--td-success-color) inset;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.t-is-warning {
|
|
104
|
+
box-shadow: 0 0 0 1px var(--td-warning-color) inset;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.t-is-error {
|
|
108
|
+
box-shadow: 0 0 0 1px var(--td-error-color) inset;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.t-is-error {
|
|
114
|
+
.t-form__controls-content {
|
|
115
|
+
.t-input:not(.t-range-input .t-input),
|
|
116
|
+
.t-range-input,
|
|
117
|
+
.t-textarea__inner {
|
|
118
|
+
&.t-is-focused,
|
|
119
|
+
&.t-input--focused {
|
|
120
|
+
box-shadow: 0 0 0 1px var(--td-error-color) inset;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.t-tabs {
|
|
127
|
+
overflow: visible;
|
|
128
|
+
|
|
129
|
+
.t-tabs__nav-item {
|
|
130
|
+
/* stylelint-disable-next-line selector-class-pattern */
|
|
131
|
+
.remove-btn {
|
|
132
|
+
position: relative;
|
|
133
|
+
right: 4px;
|
|
134
|
+
padding: 2px;
|
|
135
|
+
margin-left: 0;
|
|
136
|
+
font-size: 22px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:not(.t-is-disabled) {
|
|
140
|
+
/* stylelint-disable-next-line selector-class-pattern */
|
|
141
|
+
.remove-btn {
|
|
142
|
+
&:hover {
|
|
143
|
+
background-color: var(--td-bg-color-container-hover);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:not(.t-is-active) {
|
|
148
|
+
&:hover {
|
|
149
|
+
.t-tabs__nav-item-wrapper {
|
|
150
|
+
background-color: inherit;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.t-tabs__nav-item-wrapper {
|
|
155
|
+
&:hover {
|
|
156
|
+
background-color: var(--td-bg-color-container-hover);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.t-tabs__operations--left,
|
|
164
|
+
.t-tabs__operations--right {
|
|
165
|
+
bottom: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.t-tabs__content {
|
|
169
|
+
overflow: visible;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.t-dialog__ctx {
|
|
174
|
+
.t-dialog__mask {
|
|
175
|
+
background-color: rgb(58 53 65 / 32%);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.t-dialog {
|
|
179
|
+
min-width: 320px;
|
|
180
|
+
max-width: calc(100% - 20px);
|
|
181
|
+
border-radius: var(--td-radius-default);
|
|
182
|
+
box-shadow:
|
|
183
|
+
rgb(58 53 65 / 8%) 0 11px 15px -7px,
|
|
184
|
+
rgb(58 53 65 / 12%) 0 24px 38px 3px,
|
|
185
|
+
rgb(58 53 65 / 4%) 0 9px 46px 8px;
|
|
186
|
+
|
|
187
|
+
&.t-dialog--default {
|
|
188
|
+
padding: var(--td-size-7);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
[class^='t-dialog__body'] {
|
|
192
|
+
&:is(:last-child),
|
|
193
|
+
&:has(> .t-form:is(:last-child)) {
|
|
194
|
+
padding-bottom: 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&:has(> .t-typography:is(:first-child)),
|
|
198
|
+
&:has(> div:is(:first-child) > .t-typography:is(:first-child)),
|
|
199
|
+
&:has(> div:is(:first-child) > div:is(:first-child) > .t-typography:is(:first-child)) {
|
|
200
|
+
padding-top: 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&:has(.no_dialog_pt) {
|
|
204
|
+
padding-top: 0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.t-dialog__footer {
|
|
209
|
+
@apply pt-0;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.t-dialog--draggable {
|
|
214
|
+
.t-dialog__header-content {
|
|
215
|
+
cursor: move;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.t-link {
|
|
221
|
+
display: inline;
|
|
222
|
+
|
|
223
|
+
.t-link__prefix-icon {
|
|
224
|
+
display: inline;
|
|
225
|
+
margin-right: 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.t-link__suffix-icon {
|
|
229
|
+
display: inline;
|
|
230
|
+
margin-left: 0;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.t-tree__icon {
|
|
235
|
+
&:has(> .t-button) {
|
|
236
|
+
display: flex;
|
|
237
|
+
justify-content: center;
|
|
238
|
+
width: 32px;
|
|
239
|
+
|
|
240
|
+
.t-button {
|
|
241
|
+
left: 2px;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
&:empty {
|
|
246
|
+
display: none;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.t-tree__item {
|
|
251
|
+
padding: 0 0 0 calc(32px * var(--level));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.t-tree__line {
|
|
255
|
+
--space: 32px;
|
|
256
|
+
|
|
257
|
+
&::before {
|
|
258
|
+
width: 20px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
left: calc(32px * var(--level) - 14px);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.t-input-adornment__append,
|
|
265
|
+
.t-input-adornment__prepend {
|
|
266
|
+
@apply flex items-center;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.t-list__load {
|
|
270
|
+
font-size: var(--td-font-size-body-small);
|
|
271
|
+
line-height: var(--td-line-height-body-small);
|
|
272
|
+
color: var(--td-text-color-placeholder);
|
|
273
|
+
background: transparent;
|
|
274
|
+
|
|
275
|
+
&:not(:empty) {
|
|
276
|
+
padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-l);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&.t-list__load--load-more {
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.t-list__header,
|
|
285
|
+
.t-list__footer {
|
|
286
|
+
padding: 0;
|
|
287
|
+
background: transparent;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.t-input-adornment {
|
|
291
|
+
.t-input-adornment__prepend,
|
|
292
|
+
.t-input-adornment__append {
|
|
293
|
+
&:has(> .t-button) {
|
|
294
|
+
flex-shrink: 0;
|
|
295
|
+
overflow: hidden;
|
|
296
|
+
border: 1px solid var(--td-border-level-2-color);
|
|
297
|
+
|
|
298
|
+
.t-button {
|
|
299
|
+
margin: -1px;
|
|
300
|
+
border-radius: 0;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
&:has(> .t-button.t-button--theme-primary) {
|
|
305
|
+
border: none;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.t-drawer {
|
|
311
|
+
.t-drawer__body {
|
|
312
|
+
&:has(.no_drawer_body_padding) {
|
|
313
|
+
padding: 0;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.t-drawer__content-wrapper {
|
|
318
|
+
&:has(.no_drawer_content_shadow) {
|
|
319
|
+
box-shadow: none;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.t-popup {
|
|
325
|
+
&.t-is-head-menu {
|
|
326
|
+
.t-menu__item {
|
|
327
|
+
--td-comp-paddingLR-l: var(--td-size-4);
|
|
328
|
+
|
|
329
|
+
.t-menu__content {
|
|
330
|
+
width: 100%;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.t-popup__content {
|
|
337
|
+
border: 1px solid var(--td-border-level-2-color);
|
|
338
|
+
box-shadow: var(--td-shadow-2);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.t-empty {
|
|
342
|
+
@apply flex flex-col justify-center;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
@media (width <= 540px) {
|
|
347
|
+
.t-dialog {
|
|
348
|
+
.t-form__item {
|
|
349
|
+
/* stylelint-disable-next-line selector-class-pattern */
|
|
350
|
+
&[class*='col-span-'] {
|
|
351
|
+
@apply col-span-full;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"import": "./index.mjs",
|
|
11
11
|
"types": "./index.d.ts"
|
|
12
12
|
},
|
|
13
|
+
"./assets/css/index.css": "./assets/css/index.css",
|
|
13
14
|
"./const": {
|
|
14
15
|
"import": "./const/index.mjs",
|
|
15
16
|
"types": "./const/index.d.ts"
|
|
@@ -20,6 +21,9 @@
|
|
|
20
21
|
"./utils": {
|
|
21
22
|
"import": "./utils/index.mjs",
|
|
22
23
|
"types": "./utils/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./vite-config": {
|
|
26
|
+
"import": "./vite-config.mjs"
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
"keywords": [],
|
|
@@ -62,6 +66,6 @@
|
|
|
62
66
|
"**/*.css"
|
|
63
67
|
],
|
|
64
68
|
"type": "module",
|
|
65
|
-
"version": "1.
|
|
69
|
+
"version": "1.20.0",
|
|
66
70
|
"scripts": {}
|
|
67
71
|
}
|
package/prettier-config.mjs
CHANGED
|
@@ -4,9 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// @ts-check
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { existsSync } from 'node:fs'
|
|
8
|
+
import { dirname, resolve } from 'node:path'
|
|
9
|
+
import { fileURLToPath } from 'node:url'
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
12
|
+
|
|
13
|
+
function resolveDefaultCssEntry() {
|
|
14
|
+
const distCss = resolve(here, 'assets/css/tailwindcss-entry.css')
|
|
15
|
+
const srcCss = resolve(here, 'src/assets/css/tailwindcss-entry.css')
|
|
16
|
+
|
|
17
|
+
return existsSync(distCss) ? distCss : srcCss
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
|
10
21
|
export default {
|
|
11
22
|
$schema: 'https://json.schemastore.org/prettierrc',
|
|
12
23
|
arrowParens: 'always', // 单参数箭头函数参数周围使用圆括号-eg: (x) => x
|
|
@@ -26,7 +37,7 @@ export default {
|
|
|
26
37
|
singleAttributePerLine: false, // 会在 HTML、JSX、Vue 和 Angular 中格式化为每个属性单独占一行。
|
|
27
38
|
singleQuote: true, // 使用单引号
|
|
28
39
|
tabWidth: 2, // 缩进长度
|
|
29
|
-
tailwindStylesheet:
|
|
40
|
+
tailwindStylesheet: resolveDefaultCssEntry(),
|
|
30
41
|
trailingComma: 'all',
|
|
31
42
|
useTabs: false, // 使用空格代替tab缩进
|
|
32
43
|
vueIndentScriptAndStyle: false, // 不对vue中的script及style标签缩进
|
package/vite-config.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
5
|
+
import vue from '@vitejs/plugin-vue'
|
|
6
|
+
import tailwindAutoReference from 'vite-plugin-vue-tailwind-auto-reference'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('vite').ConfigEnv} ConfigEnv
|
|
10
|
+
* @typedef {typeof import('vite-plugin-vue-tailwind-auto-reference').default} TailwindAutoReference
|
|
11
|
+
* @typedef {Parameters<TailwindAutoReference>} TailwindAutoReferenceParameters
|
|
12
|
+
* @typedef {{ tailwindAutoReferenceParameters?: TailwindAutoReferenceParameters }} DlznViteOptions
|
|
13
|
+
* @typedef {import('vite').UserConfig} UserConfig
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
17
|
+
|
|
18
|
+
function resolveDefaultCssEntry() {
|
|
19
|
+
const distCss = resolve(here, 'assets/css/tailwindcss-entry.css')
|
|
20
|
+
const srcCss = resolve(here, 'src/assets/css/tailwindcss-entry.css')
|
|
21
|
+
|
|
22
|
+
return existsSync(distCss) ? distCss : srcCss
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {ConfigEnv} env
|
|
27
|
+
* @param {DlznViteOptions} options
|
|
28
|
+
* @returns {UserConfig} Vite config
|
|
29
|
+
*/
|
|
30
|
+
export default (env, options) => {
|
|
31
|
+
const tailwindAutoReferenceParameters = [
|
|
32
|
+
options.tailwindAutoReferenceParameters?.[0] ?? resolveDefaultCssEntry(),
|
|
33
|
+
...(options.tailwindAutoReferenceParameters?.slice(1) ?? []),
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
plugins: [
|
|
38
|
+
vue({
|
|
39
|
+
// features: {
|
|
40
|
+
// optionsAPI: false, // 不能删掉,tdesign 内部使用到了
|
|
41
|
+
// },
|
|
42
|
+
}),
|
|
43
|
+
tailwindAutoReference(...tailwindAutoReferenceParameters),
|
|
44
|
+
tailwindcss(),
|
|
45
|
+
],
|
|
46
|
+
}
|
|
47
|
+
}
|