vanilla-jui 1.7.26 → 1.7.28
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/components/form.ts +1 -2
- package/src/css/gradient.css +64 -129
- package/src/css/themes/default/badge.css +5 -11
- 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 +42 -63
- package/src/css/themes/default/menu.css +35 -89
- 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 +27 -25
- package/src/primitives/toast.ts +15 -18
package/src/css/tokens.css
CHANGED
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
--ui-fg-muted: #6b7280;
|
|
95
95
|
--ui-fg-soft: #9ca3af;
|
|
96
96
|
--ui-fg-subtle: #d1d5db;
|
|
97
|
+
--ui-reverse: #000;
|
|
97
98
|
--ui-border-subtle: rgba(0, 0, 0, 0.06);
|
|
98
99
|
--ui-border: rgba(0, 0, 0, 0.1);
|
|
99
100
|
--ui-border-strong: rgba(0, 0, 0, 0.2);
|
|
@@ -206,17 +207,17 @@
|
|
|
206
207
|
--tone-code-fg: #374151;
|
|
207
208
|
|
|
208
209
|
/* States */
|
|
209
|
-
--state-
|
|
210
|
-
--state-
|
|
211
|
-
--state-
|
|
212
|
-
--state-
|
|
213
|
-
--state-
|
|
214
|
-
--state-
|
|
215
|
-
--state-
|
|
216
|
-
--state-
|
|
217
|
-
--state-
|
|
218
|
-
--state-
|
|
219
|
-
--state-
|
|
210
|
+
--state-error: #ef4444;
|
|
211
|
+
--state-error-hover: #dc2626;
|
|
212
|
+
--state-error-active: #b91c1c;
|
|
213
|
+
--state-error-fg: #ffffff;
|
|
214
|
+
--state-error-text: #dc2626;
|
|
215
|
+
--state-error-subtle: rgba(239, 68, 68, 0.08);
|
|
216
|
+
--state-error-soft: rgba(239, 68, 68, 0.12);
|
|
217
|
+
--state-error-muted: rgba(239, 68, 68, 0.16);
|
|
218
|
+
--state-error-weak: #fce1e1;
|
|
219
|
+
--state-error-border: rgba(239, 68, 68, 0.25);
|
|
220
|
+
--state-error-ring: rgba(239, 68, 68, 0.3);
|
|
220
221
|
|
|
221
222
|
--state-success: #22c55e;
|
|
222
223
|
--state-success-hover: #16a34a;
|
|
@@ -254,8 +255,8 @@
|
|
|
254
255
|
--state-info-ring: rgba(59, 130, 246, 0.3);
|
|
255
256
|
|
|
256
257
|
/* Component Aliases */
|
|
257
|
-
--state-
|
|
258
|
-
--state-
|
|
258
|
+
--state-error-solid: var(--state-error);
|
|
259
|
+
--state-error-surface: var(--state-error-subtle);
|
|
259
260
|
--state-success-solid: var(--state-success);
|
|
260
261
|
--state-success-surface: var(--state-success-subtle);
|
|
261
262
|
--state-warning-solid: var(--state-warning);
|
|
@@ -284,6 +285,7 @@
|
|
|
284
285
|
--ui-fg-muted: #cbd5e1;
|
|
285
286
|
--ui-fg-soft: #94a3b8;
|
|
286
287
|
--ui-fg-subtle: #64748b;
|
|
288
|
+
--ui-reverse: #fff;
|
|
287
289
|
--ui-border-subtle: rgba(148, 163, 184, 0.12);
|
|
288
290
|
--ui-border: rgba(148, 163, 184, 0.18);
|
|
289
291
|
--ui-border-strong: rgba(148, 163, 184, 0.28);
|
|
@@ -396,17 +398,17 @@
|
|
|
396
398
|
--tone-code-fg: #e5e7eb;
|
|
397
399
|
|
|
398
400
|
/* States */
|
|
399
|
-
--state-
|
|
400
|
-
--state-
|
|
401
|
-
--state-
|
|
402
|
-
--state-
|
|
403
|
-
--state-
|
|
404
|
-
--state-
|
|
405
|
-
--state-
|
|
406
|
-
--state-
|
|
407
|
-
--state-
|
|
408
|
-
--state-
|
|
409
|
-
--state-
|
|
401
|
+
--state-error: #f87171;
|
|
402
|
+
--state-error-hover: #fca5a5;
|
|
403
|
+
--state-error-active: #fecaca;
|
|
404
|
+
--state-error-fg: #030712;
|
|
405
|
+
--state-error-text: #fca5a5;
|
|
406
|
+
--state-error-subtle: rgba(248, 113, 113, 0.1);
|
|
407
|
+
--state-error-soft: rgba(248, 113, 113, 0.15);
|
|
408
|
+
--state-error-muted: rgba(248, 113, 113, 0.2);
|
|
409
|
+
--state-error-weak: #291111;
|
|
410
|
+
--state-error-border: rgba(248, 113, 113, 0.25);
|
|
411
|
+
--state-error-ring: rgba(248, 113, 113, 0.4);
|
|
410
412
|
|
|
411
413
|
--state-success: #4ade80;
|
|
412
414
|
--state-success-hover: #86efac;
|
|
@@ -1290,4 +1292,4 @@
|
|
|
1290
1292
|
--el-height-2xl: 3.5rem;
|
|
1291
1293
|
--el-height-3xl: 3.75rem;
|
|
1292
1294
|
}
|
|
1293
|
-
}
|
|
1295
|
+
}
|
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 = {}) =>
|