vanilla-jui 1.7.27 → 1.7.29
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/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/css/gradient.css +64 -129
- package/src/css/themes/default/badge.css +6 -12
- package/src/css/themes/default/button.css +24 -36
- package/src/css/themes/default/captcha.css +2 -2
- package/src/css/themes/default/editor.css +13 -13
- package/src/css/themes/default/form.css +15 -15
- package/src/css/themes/default/menu.css +36 -90
- package/src/css/themes/default/swiper.css +5 -7
- package/src/css/themes/default/tip.css +8 -8
- package/src/css/themes/default/toast.css +22 -18
- package/src/css/themes/default/tooltip.css +4 -4
- package/src/css/tokens.css +30 -25
- package/src/primitives/toast.ts +15 -18
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
text-decoration: underline;
|
|
47
47
|
text-decoration-style: wavy;
|
|
48
|
-
text-decoration-color: var(--state-
|
|
48
|
+
text-decoration-color: var(--state-error);
|
|
49
49
|
text-underline-offset: 4px;
|
|
50
50
|
padding: 4px 1rem;
|
|
51
51
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.j-menu .menu .menu-item:not(:has(a)):hover {
|
|
57
|
-
background: var(--state-
|
|
57
|
+
background: var(--state-error-subtle);
|
|
58
58
|
border-radius: 4px;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
position: absolute;
|
|
64
64
|
top: 0;
|
|
65
65
|
right: 0;
|
|
66
|
-
background: var(--state-
|
|
67
|
-
color: var(--state-
|
|
66
|
+
background: var(--state-error);
|
|
67
|
+
color: var(--state-error-fg);
|
|
68
68
|
font-size: 12px;
|
|
69
69
|
padding: 0 4px;
|
|
70
70
|
border-radius: 4px;
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
height: var(--menu-item-icon-size);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.j-menu .menu .menu-item.menu-item-has-children
|
|
98
|
+
.j-menu .menu .menu-item.menu-item-has-children>a {
|
|
99
99
|
position: relative;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.j-menu .menu .menu-item.menu-item-has-children
|
|
102
|
+
.j-menu .menu .menu-item.menu-item-has-children>a::after {
|
|
103
103
|
/* width: 0; */
|
|
104
104
|
/* height: 0; */
|
|
105
105
|
/* vertical-align: middle; */
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
border-top: 4px solid currentColor;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.j-menu .menu .menu-item.menu-item-has-children:hover
|
|
114
|
+
.j-menu .menu .menu-item.menu-item-has-children:hover>a::after {
|
|
115
115
|
transform: rotate(180deg);
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -124,11 +124,9 @@
|
|
|
124
124
|
background-color: var(--ui-bg-subtle);
|
|
125
125
|
|
|
126
126
|
@supports (color: color-mix(in srgb, red 50%, blue)) {
|
|
127
|
-
background-color: color-mix(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
transparent
|
|
131
|
-
);
|
|
127
|
+
background-color: color-mix(in srgb,
|
|
128
|
+
var(--ui-bg-subtle) 75%,
|
|
129
|
+
transparent);
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
backdrop-filter: blur(4px);
|
|
@@ -150,36 +148,23 @@
|
|
|
150
148
|
white-space: normal;
|
|
151
149
|
}
|
|
152
150
|
|
|
153
|
-
.j-menu .menu
|
|
154
|
-
.j-menu .menu
|
|
151
|
+
.j-menu .menu>.menu-item.current-menu-item>a,
|
|
152
|
+
.j-menu .menu>.menu-item.current-menu-ancestor>a {
|
|
155
153
|
color: var(--tone-solid);
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
.j-menu
|
|
159
|
-
.menu
|
|
160
|
-
.menu-item.current-menu-item
|
|
161
|
-
> .sub-menu
|
|
162
|
-
> .menu-item:not(.current-menu-item)
|
|
163
|
-
a {
|
|
156
|
+
.j-menu .menu .menu-item.current-menu-item>.sub-menu>.menu-item:not(.current-menu-item) a {
|
|
164
157
|
color: inherit;
|
|
165
158
|
}
|
|
166
159
|
|
|
167
|
-
.j-menu
|
|
168
|
-
.menu-item.current-menu-item
|
|
169
|
-
> .sub-menu
|
|
170
|
-
> .menu-item:not(.current-menu-item):hover
|
|
171
|
-
a {
|
|
160
|
+
.j-menu .menu-item.current-menu-item>.sub-menu>.menu-item:not(.current-menu-item):hover a {
|
|
172
161
|
color: var(--tone-fg);
|
|
173
162
|
}
|
|
174
163
|
|
|
175
164
|
.j-menu .menu .menu-item .sub-menu .menu-item:hover a,
|
|
176
165
|
.j-menu .menu .menu-item a:hover,
|
|
177
|
-
.j-menu .menu .menu-item.menu-item-has-children:hover
|
|
178
|
-
.j-menu
|
|
179
|
-
.menu-item.menu-item-has-children:hover
|
|
180
|
-
> .sub-menu
|
|
181
|
-
> .menu-item.current-menu-item
|
|
182
|
-
a {
|
|
166
|
+
.j-menu .menu .menu-item.menu-item-has-children:hover>a,
|
|
167
|
+
.j-menu .menu-item.menu-item-has-children:hover>.sub-menu>.menu-item.current-menu-item a {
|
|
183
168
|
background: var(--tone-soft);
|
|
184
169
|
color: var(--tone-text);
|
|
185
170
|
}
|
|
@@ -189,21 +174,18 @@
|
|
|
189
174
|
z-index: var(--z-submenu);
|
|
190
175
|
}
|
|
191
176
|
|
|
192
|
-
.j-menu:not([data-menu-type='mobile']):not([data-menu-type='bottom'])
|
|
193
|
-
.menu
|
|
194
|
-
.menu-item.menu-item-has-children
|
|
195
|
-
> a {
|
|
177
|
+
.j-menu:not([data-menu-type='mobile']):not([data-menu-type='bottom']) .menu .menu-item.menu-item-has-children>a {
|
|
196
178
|
pointer-events: none;
|
|
197
179
|
}
|
|
198
180
|
|
|
199
181
|
/* list card menu */
|
|
200
|
-
.j-menu .menu-item.menu-item-has-children.list-menu:hover
|
|
182
|
+
.j-menu .menu-item.menu-item-has-children.list-menu:hover>.sub-menu {
|
|
201
183
|
width: auto;
|
|
202
184
|
display: grid;
|
|
203
185
|
grid-template-columns: repeat(2, 1fr);
|
|
204
186
|
}
|
|
205
187
|
|
|
206
|
-
.j-menu .menu-item.list-menu
|
|
188
|
+
.j-menu .menu-item.list-menu>.sub-menu>.menu-item>a {
|
|
207
189
|
overflow: hidden;
|
|
208
190
|
display: -webkit-box;
|
|
209
191
|
-webkit-box-orient: vertical;
|
|
@@ -211,14 +193,14 @@
|
|
|
211
193
|
line-clamp: 1;
|
|
212
194
|
}
|
|
213
195
|
|
|
214
|
-
.j-menu .menu-item.menu-item-has-children.list-menu:hover
|
|
196
|
+
.j-menu .menu-item.menu-item-has-children.list-menu:hover>.sub-menu {
|
|
215
197
|
min-width: 240px;
|
|
216
198
|
max-width: 360px;
|
|
217
199
|
transform: translateX(-20%) translateY(1px);
|
|
218
200
|
}
|
|
219
201
|
|
|
220
|
-
.j-menu .menu-item.list-menu
|
|
221
|
-
padding: calc(var(--space) * 1.25)
|
|
202
|
+
.j-menu .menu-item.list-menu>.sub-menu>.menu-item>a {
|
|
203
|
+
padding: calc(var(--space) * 1.25) var(--s2d5);
|
|
222
204
|
line-height: 1.75;
|
|
223
205
|
}
|
|
224
206
|
|
|
@@ -265,10 +247,7 @@
|
|
|
265
247
|
line-height: var(--line-height-paragraph);
|
|
266
248
|
}
|
|
267
249
|
|
|
268
|
-
.j-menu[data-menu-type='mobile']
|
|
269
|
-
.menu
|
|
270
|
-
.menu-item.menu-item-has-children
|
|
271
|
-
> a::after {
|
|
250
|
+
.j-menu[data-menu-type='mobile'] .menu .menu-item.menu-item-has-children>a::after {
|
|
272
251
|
vertical-align: middle;
|
|
273
252
|
position: absolute;
|
|
274
253
|
right: 1rem;
|
|
@@ -278,10 +257,7 @@
|
|
|
278
257
|
border-top: 4px solid transparent;
|
|
279
258
|
}
|
|
280
259
|
|
|
281
|
-
.j-menu[data-menu-type='mobile']
|
|
282
|
-
.menu
|
|
283
|
-
.menu-item.menu-item-has-children:hover
|
|
284
|
-
> a::after {
|
|
260
|
+
.j-menu[data-menu-type='mobile'] .menu .menu-item.menu-item-has-children:hover>a::after {
|
|
285
261
|
transform: none;
|
|
286
262
|
}
|
|
287
263
|
|
|
@@ -299,10 +275,7 @@
|
|
|
299
275
|
}
|
|
300
276
|
|
|
301
277
|
.j-menu[data-menu-type='mobile'] .menu .menu-item a:hover,
|
|
302
|
-
.j-menu[data-menu-type='mobile']
|
|
303
|
-
.menu
|
|
304
|
-
.menu-item.menu-item-has-children:hover
|
|
305
|
-
> a,
|
|
278
|
+
.j-menu[data-menu-type='mobile'] .menu .menu-item.menu-item-has-children:hover>a,
|
|
306
279
|
.j-menu[data-menu-type='mobile'] .menu .sub-menu .menu-item:hover a {
|
|
307
280
|
background: inherit;
|
|
308
281
|
color: inherit;
|
|
@@ -312,10 +285,7 @@
|
|
|
312
285
|
background: var(--menu-item-active-bg);
|
|
313
286
|
}
|
|
314
287
|
|
|
315
|
-
.j-menu[data-menu-type='mobile']
|
|
316
|
-
.menu
|
|
317
|
-
.menu-item.menu-item-has-children.is-active
|
|
318
|
-
> .sub-menu {
|
|
288
|
+
.j-menu[data-menu-type='mobile'] .menu .menu-item.menu-item-has-children.is-active>.sub-menu {
|
|
319
289
|
visibility: visible;
|
|
320
290
|
opacity: 1;
|
|
321
291
|
z-index: var(--z-submenu);
|
|
@@ -356,10 +326,7 @@
|
|
|
356
326
|
color: var(--ui-fg);
|
|
357
327
|
}
|
|
358
328
|
|
|
359
|
-
.j-menu[data-menu-type='bottom']
|
|
360
|
-
> .menu
|
|
361
|
-
> .menu-item.menu-item-has-children
|
|
362
|
-
> a::after {
|
|
329
|
+
.j-menu[data-menu-type='bottom']>.menu>.menu-item.menu-item-has-children>a::after {
|
|
363
330
|
content: '☰';
|
|
364
331
|
font-size: var(--font-size-sm);
|
|
365
332
|
margin-left: unset;
|
|
@@ -369,26 +336,17 @@
|
|
|
369
336
|
transition: unset;
|
|
370
337
|
}
|
|
371
338
|
|
|
372
|
-
.j-menu[data-menu-type='bottom']
|
|
373
|
-
> .menu
|
|
374
|
-
.menu-item.menu-item-has-children:hover
|
|
375
|
-
> a::after {
|
|
339
|
+
.j-menu[data-menu-type='bottom']>.menu .menu-item.menu-item-has-children:hover>a::after {
|
|
376
340
|
transform: none;
|
|
377
341
|
}
|
|
378
342
|
|
|
379
|
-
.j-menu[data-menu-type='bottom'] .menu .menu-item.current-menu-parent
|
|
380
|
-
.j-menu[data-menu-type='bottom'] .menu .menu-item.current-menu-item
|
|
381
|
-
.j-menu[data-menu-type='bottom']
|
|
382
|
-
.menu
|
|
383
|
-
.menu-item.menu-item-has-children.is-active
|
|
384
|
-
> a {
|
|
343
|
+
.j-menu[data-menu-type='bottom'] .menu .menu-item.current-menu-parent>a,
|
|
344
|
+
.j-menu[data-menu-type='bottom'] .menu .menu-item.current-menu-item>a,
|
|
345
|
+
.j-menu[data-menu-type='bottom'] .menu .menu-item.menu-item-has-children.is-active>a {
|
|
385
346
|
color: var(--tone-solid);
|
|
386
347
|
}
|
|
387
348
|
|
|
388
|
-
.j-menu[data-menu-type='bottom']
|
|
389
|
-
.menu
|
|
390
|
-
.menu-item.menu-item-has-children
|
|
391
|
-
> .sub-menu {
|
|
349
|
+
.j-menu[data-menu-type='bottom'] .menu .menu-item.menu-item-has-children>.sub-menu {
|
|
392
350
|
opacity: 0;
|
|
393
351
|
visibility: hidden;
|
|
394
352
|
display: flex;
|
|
@@ -407,29 +365,17 @@
|
|
|
407
365
|
z-index: -1;
|
|
408
366
|
}
|
|
409
367
|
|
|
410
|
-
.j-menu[data-menu-type='bottom']
|
|
411
|
-
.menu
|
|
412
|
-
.menu-item.menu-item-has-children.is-active
|
|
413
|
-
> .sub-menu {
|
|
368
|
+
.j-menu[data-menu-type='bottom'] .menu .menu-item.menu-item-has-children.is-active>.sub-menu {
|
|
414
369
|
opacity: 1;
|
|
415
370
|
visibility: visible;
|
|
416
371
|
transform: translateX(-50%) translateY(0%);
|
|
417
372
|
}
|
|
418
373
|
|
|
419
|
-
.j-menu[data-menu-type='bottom']
|
|
420
|
-
.menu
|
|
421
|
-
.menu-item.menu-item-has-children
|
|
422
|
-
> .sub-menu
|
|
423
|
-
> .menu-item {
|
|
374
|
+
.j-menu[data-menu-type='bottom'] .menu .menu-item.menu-item-has-children>.sub-menu>.menu-item {
|
|
424
375
|
white-space: normal;
|
|
425
376
|
}
|
|
426
377
|
|
|
427
|
-
.j-menu[data-menu-type='bottom']
|
|
428
|
-
.menu
|
|
429
|
-
.menu-item.menu-item-has-children
|
|
430
|
-
> .sub-menu
|
|
431
|
-
> .menu-item
|
|
432
|
-
> a {
|
|
378
|
+
.j-menu[data-menu-type='bottom'] .menu .menu-item.menu-item-has-children>.sub-menu>.menu-item>a {
|
|
433
379
|
min-height: var(--el-height-2xl);
|
|
434
380
|
justify-content: center;
|
|
435
381
|
}
|
|
@@ -493,4 +439,4 @@
|
|
|
493
439
|
color: var(--ui-fg-soft);
|
|
494
440
|
font-size: var(--font-size-sm);
|
|
495
441
|
}
|
|
496
|
-
}
|
|
442
|
+
}
|
|
@@ -42,11 +42,9 @@
|
|
|
42
42
|
color: var(--ui-fg-soft);
|
|
43
43
|
font-size: var(--font-size-md);
|
|
44
44
|
background-color: var(--tone-wash);
|
|
45
|
-
background-image: radial-gradient(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
transparent 1px
|
|
49
|
-
);
|
|
45
|
+
background-image: radial-gradient(circle,
|
|
46
|
+
var(--ui-border) 1px,
|
|
47
|
+
transparent 1px);
|
|
50
48
|
background-size: 20px 20px;
|
|
51
49
|
|
|
52
50
|
position: absolute;
|
|
@@ -79,7 +77,7 @@
|
|
|
79
77
|
right: var(--swiper-title-inset);
|
|
80
78
|
bottom: var(--swiper-title-inset);
|
|
81
79
|
left: var(--swiper-title-inset);
|
|
82
|
-
padding:
|
|
80
|
+
padding: var(--s1d5) var(--s2);
|
|
83
81
|
color: #fff;
|
|
84
82
|
font-size: var(--swiper-title-font-size);
|
|
85
83
|
font-weight: var(--font-bold);
|
|
@@ -194,4 +192,4 @@
|
|
|
194
192
|
--swiper-navigation-size: 32px;
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
|
-
}
|
|
195
|
+
}
|
|
@@ -65,15 +65,15 @@
|
|
|
65
65
|
margin: 6px 0;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.j-tip .tip-content
|
|
68
|
+
.j-tip .tip-content>*:first-child {
|
|
69
69
|
margin-top: 0;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.j-tip .tip-content
|
|
72
|
+
.j-tip .tip-content>*:last-child {
|
|
73
73
|
margin-bottom: 0;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.j-tip.is-
|
|
76
|
+
.j-tip.is-info {
|
|
77
77
|
--tip-border-color: var(--state-info-border);
|
|
78
78
|
--tip-bg: var(--state-info-soft);
|
|
79
79
|
--tip-fg: var(--state-info-text);
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
--tip-fg: var(--state-warning-text);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.j-tip.is-
|
|
95
|
-
--tip-border-color: var(--state-
|
|
96
|
-
--tip-bg: var(--state-
|
|
97
|
-
--tip-fg: var(--state-
|
|
94
|
+
.j-tip.is-error {
|
|
95
|
+
--tip-border-color: var(--state-error-border);
|
|
96
|
+
--tip-bg: var(--state-error-soft);
|
|
97
|
+
--tip-fg: var(--state-error-text);
|
|
98
98
|
}
|
|
99
|
-
}
|
|
99
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
.j-toast {
|
|
18
18
|
--toast-fg: var(--ui-fg);
|
|
19
19
|
--toast-bg: var(--ui-bg);
|
|
20
|
-
--toast-border-color: var(--ui-border);
|
|
20
|
+
--toast-border-color: var(--ui-border-subtle);
|
|
21
21
|
|
|
22
22
|
gap: var(--s2);
|
|
23
23
|
padding: var(--s3) var(--s4);
|
|
@@ -52,31 +52,35 @@
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.j-toast.is-info {
|
|
55
|
-
--toast-
|
|
56
|
-
|
|
55
|
+
/* --toast-fg: var(--state-info-text); */
|
|
56
|
+
/* --toast-bg: var(--state-info-soft); */
|
|
57
|
+
/* --toast-border-color: var(--state-info-ring); */
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
--toast-fg: var(--state-info-text);
|
|
60
|
-
--toast-bg: var(--state-info-soft);
|
|
61
|
-
--toast-border-color: var(--state-info-ring);
|
|
59
|
+
--toast-fg: var(--state-info);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
.j-toast.is-success {
|
|
65
|
-
--toast-fg: var(--state-success-text);
|
|
66
|
-
--toast-bg: var(--state-success-soft);
|
|
67
|
-
--toast-border-color: var(--state-success-ring);
|
|
63
|
+
/* --toast-fg: var(--state-success-text); */
|
|
64
|
+
/* --toast-bg: var(--state-success-soft); */
|
|
65
|
+
/* --toast-border-color: var(--state-success-ring); */
|
|
66
|
+
|
|
67
|
+
--toast-fg: var(--state-success);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.j-toast.is-warning {
|
|
71
|
-
--toast-fg: var(--state-warning-text);
|
|
72
|
-
--toast-bg: var(--state-warning-soft);
|
|
73
|
-
--toast-border-color: var(--state-warning-ring);
|
|
71
|
+
/* --toast-fg: var(--state-warning-text); */
|
|
72
|
+
/* --toast-bg: var(--state-warning-soft); */
|
|
73
|
+
/* --toast-border-color: var(--state-warning-ring); */
|
|
74
|
+
|
|
75
|
+
--toast-fg: var(--state-warning);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
.j-toast.is-error {
|
|
77
|
-
--toast-fg: var(--state-
|
|
78
|
-
--toast-bg: var(--state-
|
|
79
|
-
--toast-border-color: var(--state-
|
|
79
|
+
/* --toast-fg: var(--state-error-text); */
|
|
80
|
+
/* --toast-bg: var(--state-error-soft); */
|
|
81
|
+
/* --toast-border-color: var(--state-error-ring); */
|
|
82
|
+
|
|
83
|
+
--toast-fg: var(--state-error);
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
.j-toast-lite {
|
|
@@ -99,7 +103,7 @@
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
.j-toast.is-confirm {
|
|
102
|
-
--toast-bg: color-mix(in srgb, var(--ui-bg) 50%, transparent);
|
|
106
|
+
/* --toast-bg: color-mix(in srgb, var(--ui-bg) 50%, transparent); */
|
|
103
107
|
|
|
104
108
|
gap: var(--s4);
|
|
105
109
|
min-width: 280px;
|
|
@@ -117,4 +121,4 @@
|
|
|
117
121
|
justify-content: flex-end;
|
|
118
122
|
position: relative;
|
|
119
123
|
}
|
|
120
|
-
}
|
|
124
|
+
}
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.j-tooltip.is-error {
|
|
44
|
-
--tooltip-fg: var(--state-
|
|
45
|
-
--tooltip-bg: var(--state-
|
|
46
|
-
--tooltip-border-color: var(--state-
|
|
44
|
+
--tooltip-fg: var(--state-error-fg);
|
|
45
|
+
--tooltip-bg: var(--state-error-text);
|
|
46
|
+
--tooltip-border-color: var(--state-error-border);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.j-tooltip .el-text {
|
|
@@ -60,4 +60,4 @@
|
|
|
60
60
|
background: unset;
|
|
61
61
|
box-shadow: unset;
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|
package/src/css/tokens.css
CHANGED
|
@@ -18,8 +18,11 @@
|
|
|
18
18
|
|
|
19
19
|
/* --- Spacing --- */
|
|
20
20
|
--space: 0.25rem;
|
|
21
|
+
--s1d5: 0.375rem;
|
|
21
22
|
--s2: 0.5rem;
|
|
23
|
+
--s2d5: 0.625rem;
|
|
22
24
|
--s3: 0.75rem;
|
|
25
|
+
--s3d5: 0.875rem;
|
|
23
26
|
--s4: 1rem;
|
|
24
27
|
--s5: 1.25rem;
|
|
25
28
|
--s6: 1.5rem;
|
|
@@ -94,6 +97,7 @@
|
|
|
94
97
|
--ui-fg-muted: #6b7280;
|
|
95
98
|
--ui-fg-soft: #9ca3af;
|
|
96
99
|
--ui-fg-subtle: #d1d5db;
|
|
100
|
+
--ui-reverse: #000;
|
|
97
101
|
--ui-border-subtle: rgba(0, 0, 0, 0.06);
|
|
98
102
|
--ui-border: rgba(0, 0, 0, 0.1);
|
|
99
103
|
--ui-border-strong: rgba(0, 0, 0, 0.2);
|
|
@@ -206,17 +210,17 @@
|
|
|
206
210
|
--tone-code-fg: #374151;
|
|
207
211
|
|
|
208
212
|
/* States */
|
|
209
|
-
--state-
|
|
210
|
-
--state-
|
|
211
|
-
--state-
|
|
212
|
-
--state-
|
|
213
|
-
--state-
|
|
214
|
-
--state-
|
|
215
|
-
--state-
|
|
216
|
-
--state-
|
|
217
|
-
--state-
|
|
218
|
-
--state-
|
|
219
|
-
--state-
|
|
213
|
+
--state-error: #ef4444;
|
|
214
|
+
--state-error-hover: #dc2626;
|
|
215
|
+
--state-error-active: #b91c1c;
|
|
216
|
+
--state-error-fg: #ffffff;
|
|
217
|
+
--state-error-text: #dc2626;
|
|
218
|
+
--state-error-subtle: rgba(239, 68, 68, 0.08);
|
|
219
|
+
--state-error-soft: rgba(239, 68, 68, 0.12);
|
|
220
|
+
--state-error-muted: rgba(239, 68, 68, 0.16);
|
|
221
|
+
--state-error-weak: #fce1e1;
|
|
222
|
+
--state-error-border: rgba(239, 68, 68, 0.25);
|
|
223
|
+
--state-error-ring: rgba(239, 68, 68, 0.3);
|
|
220
224
|
|
|
221
225
|
--state-success: #22c55e;
|
|
222
226
|
--state-success-hover: #16a34a;
|
|
@@ -254,8 +258,8 @@
|
|
|
254
258
|
--state-info-ring: rgba(59, 130, 246, 0.3);
|
|
255
259
|
|
|
256
260
|
/* Component Aliases */
|
|
257
|
-
--state-
|
|
258
|
-
--state-
|
|
261
|
+
--state-error-solid: var(--state-error);
|
|
262
|
+
--state-error-surface: var(--state-error-subtle);
|
|
259
263
|
--state-success-solid: var(--state-success);
|
|
260
264
|
--state-success-surface: var(--state-success-subtle);
|
|
261
265
|
--state-warning-solid: var(--state-warning);
|
|
@@ -284,6 +288,7 @@
|
|
|
284
288
|
--ui-fg-muted: #cbd5e1;
|
|
285
289
|
--ui-fg-soft: #94a3b8;
|
|
286
290
|
--ui-fg-subtle: #64748b;
|
|
291
|
+
--ui-reverse: #fff;
|
|
287
292
|
--ui-border-subtle: rgba(148, 163, 184, 0.12);
|
|
288
293
|
--ui-border: rgba(148, 163, 184, 0.18);
|
|
289
294
|
--ui-border-strong: rgba(148, 163, 184, 0.28);
|
|
@@ -396,17 +401,17 @@
|
|
|
396
401
|
--tone-code-fg: #e5e7eb;
|
|
397
402
|
|
|
398
403
|
/* States */
|
|
399
|
-
--state-
|
|
400
|
-
--state-
|
|
401
|
-
--state-
|
|
402
|
-
--state-
|
|
403
|
-
--state-
|
|
404
|
-
--state-
|
|
405
|
-
--state-
|
|
406
|
-
--state-
|
|
407
|
-
--state-
|
|
408
|
-
--state-
|
|
409
|
-
--state-
|
|
404
|
+
--state-error: #f87171;
|
|
405
|
+
--state-error-hover: #fca5a5;
|
|
406
|
+
--state-error-active: #fecaca;
|
|
407
|
+
--state-error-fg: #030712;
|
|
408
|
+
--state-error-text: #fca5a5;
|
|
409
|
+
--state-error-subtle: rgba(248, 113, 113, 0.1);
|
|
410
|
+
--state-error-soft: rgba(248, 113, 113, 0.15);
|
|
411
|
+
--state-error-muted: rgba(248, 113, 113, 0.2);
|
|
412
|
+
--state-error-weak: #291111;
|
|
413
|
+
--state-error-border: rgba(248, 113, 113, 0.25);
|
|
414
|
+
--state-error-ring: rgba(248, 113, 113, 0.4);
|
|
410
415
|
|
|
411
416
|
--state-success: #4ade80;
|
|
412
417
|
--state-success-hover: #86efac;
|
|
@@ -1290,4 +1295,4 @@
|
|
|
1290
1295
|
--el-height-2xl: 3.5rem;
|
|
1291
1296
|
--el-height-3xl: 3.75rem;
|
|
1292
1297
|
}
|
|
1293
|
-
}
|
|
1298
|
+
}
|
package/src/primitives/toast.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { mergeShallowConfig } from '../utilities/merge.ts';
|
|
|
16
16
|
import { timer } from '../utilities/timer.ts';
|
|
17
17
|
import { validateParam } from '../utilities/types.ts';
|
|
18
18
|
|
|
19
|
-
export type ToastTheme = '
|
|
19
|
+
export type ToastTheme = '' | 'info' | 'success' | 'warning' | 'error';
|
|
20
20
|
|
|
21
21
|
export interface ToastClassNames {
|
|
22
22
|
container: string;
|
|
@@ -33,7 +33,6 @@ export interface ToastClassNames {
|
|
|
33
33
|
success: string;
|
|
34
34
|
warning: string;
|
|
35
35
|
error: string;
|
|
36
|
-
primary: string;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
export type ToastClassNameConfig = Partial<ToastClassNames>;
|
|
@@ -77,9 +76,8 @@ const DEFAULT_CLASS_NAMES: ToastClassNames = {
|
|
|
77
76
|
buttons: 'toast-buttons',
|
|
78
77
|
button: 'j-button is-sm',
|
|
79
78
|
closeBtn: 'is-ghost',
|
|
80
|
-
confirmBtn: 'is-
|
|
79
|
+
confirmBtn: 'is-reverse',
|
|
81
80
|
info: 'is-info',
|
|
82
|
-
primary: 'is-primary',
|
|
83
81
|
success: 'is-success',
|
|
84
82
|
warning: 'is-warning',
|
|
85
83
|
error: 'is-error',
|
|
@@ -87,7 +85,7 @@ const DEFAULT_CLASS_NAMES: ToastClassNames = {
|
|
|
87
85
|
|
|
88
86
|
const TOAST_THEME_RULE = {
|
|
89
87
|
type: 'string',
|
|
90
|
-
enum: ['info', 'success', 'warning', 'error'
|
|
88
|
+
enum: ['', 'info', 'success', 'warning', 'error'],
|
|
91
89
|
};
|
|
92
90
|
const TOAST_DURATION_RULE = { type: 'number', min: 0 };
|
|
93
91
|
const LITE_DURATION_RULE = { type: 'number', greaterThan: 0 };
|
|
@@ -135,10 +133,6 @@ function isToastLoading(options: ToastOptions): boolean {
|
|
|
135
133
|
return !!access(options.loading ?? false);
|
|
136
134
|
}
|
|
137
135
|
|
|
138
|
-
function toastIconName(theme: ToastTheme): ToastTheme {
|
|
139
|
-
return theme === 'primary' ? 'info' : theme;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
136
|
function toastIconStyle(options: ToastOptions): Record<string, string> {
|
|
143
137
|
return isToastLoading(options)
|
|
144
138
|
? {
|
|
@@ -156,9 +150,9 @@ function toastIconStyle(options: ToastOptions): Record<string, string> {
|
|
|
156
150
|
function toastIconContent(
|
|
157
151
|
theme: ToastTheme,
|
|
158
152
|
options: ToastOptions
|
|
159
|
-
): HTMLElement | SVGElement {
|
|
153
|
+
): HTMLElement | SVGElement | null {
|
|
160
154
|
if (isToastLoading(options)) return createLoading();
|
|
161
|
-
return icon(
|
|
155
|
+
return theme ? icon(theme) : null;
|
|
162
156
|
}
|
|
163
157
|
|
|
164
158
|
function toastMessage(message: string, options: ToastOptions): string {
|
|
@@ -188,6 +182,11 @@ function bindToastStatus(
|
|
|
188
182
|
): void {
|
|
189
183
|
const id = element.dataset.toast || randomId();
|
|
190
184
|
const dispose = createRoot((dispose) => {
|
|
185
|
+
insert(
|
|
186
|
+
element,
|
|
187
|
+
() => (theme || isToastLoading(options) ? iconElement : null),
|
|
188
|
+
messageElement
|
|
189
|
+
);
|
|
191
190
|
insert(iconElement, () => toastIconContent(theme, options));
|
|
192
191
|
insert(messageElement, () => toastMessage(message, options));
|
|
193
192
|
createEffect(() => {
|
|
@@ -366,7 +365,7 @@ function show(message = '', options: ToastOptions = {}): HTMLElement {
|
|
|
366
365
|
}
|
|
367
366
|
validateParam('message', message, 'string', 'Toast.show');
|
|
368
367
|
const duration = options.duration ?? 3000;
|
|
369
|
-
const theme = options.theme
|
|
368
|
+
const theme = options.theme ?? '';
|
|
370
369
|
validateParam('once', once, 'boolean', 'Toast.show');
|
|
371
370
|
validateParam('duration', duration, TOAST_DURATION_RULE, 'Toast.show');
|
|
372
371
|
validateParam('theme', theme, TOAST_THEME_RULE, 'Toast.show');
|
|
@@ -386,11 +385,11 @@ function show(message = '', options: ToastOptions = {}): HTMLElement {
|
|
|
386
385
|
'data-toast-message': id,
|
|
387
386
|
}) as HTMLElement;
|
|
388
387
|
const toast = jsx('div', {
|
|
389
|
-
className: joinClasses(names.toast, names[theme]),
|
|
388
|
+
className: joinClasses(names.toast, theme ? names[theme] : ''),
|
|
390
389
|
'data-toast': id,
|
|
391
390
|
role: 'alert',
|
|
392
391
|
'aria-atomic': 'true',
|
|
393
|
-
children:
|
|
392
|
+
children: messageElement,
|
|
394
393
|
}) as HTMLElement;
|
|
395
394
|
bindToastStatus(
|
|
396
395
|
toast,
|
|
@@ -533,12 +532,10 @@ export const Toast = {
|
|
|
533
532
|
return { className: classNames };
|
|
534
533
|
},
|
|
535
534
|
show,
|
|
536
|
-
success: (message = '', options: ToastOptions = {}) =>
|
|
537
|
-
show(message, { ...options, theme: 'success' }),
|
|
538
535
|
info: (message = '', options: ToastOptions = {}) =>
|
|
539
536
|
show(message, { ...options, theme: 'info' }),
|
|
540
|
-
|
|
541
|
-
show(message, { ...options, theme: '
|
|
537
|
+
success: (message = '', options: ToastOptions = {}) =>
|
|
538
|
+
show(message, { ...options, theme: 'success' }),
|
|
542
539
|
warning: (message = '', options: ToastOptions = {}) =>
|
|
543
540
|
show(message, { ...options, theme: 'warning' }),
|
|
544
541
|
error: (message = '', options: ToastOptions = {}) =>
|