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.
@@ -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-danger: #ef4444;
210
- --state-danger-hover: #dc2626;
211
- --state-danger-active: #b91c1c;
212
- --state-danger-fg: #ffffff;
213
- --state-danger-text: #dc2626;
214
- --state-danger-subtle: rgba(239, 68, 68, 0.08);
215
- --state-danger-soft: rgba(239, 68, 68, 0.12);
216
- --state-danger-muted: rgba(239, 68, 68, 0.16);
217
- --state-danger-weak: #fce1e1;
218
- --state-danger-border: rgba(239, 68, 68, 0.25);
219
- --state-danger-ring: rgba(239, 68, 68, 0.3);
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-danger-solid: var(--state-danger);
258
- --state-danger-surface: var(--state-danger-subtle);
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-danger: #f87171;
400
- --state-danger-hover: #fca5a5;
401
- --state-danger-active: #fecaca;
402
- --state-danger-fg: #030712;
403
- --state-danger-text: #fca5a5;
404
- --state-danger-subtle: rgba(248, 113, 113, 0.1);
405
- --state-danger-soft: rgba(248, 113, 113, 0.15);
406
- --state-danger-muted: rgba(248, 113, 113, 0.2);
407
- --state-danger-weak: #291111;
408
- --state-danger-border: rgba(248, 113, 113, 0.25);
409
- --state-danger-ring: rgba(248, 113, 113, 0.4);
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
+ }
@@ -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 = 'info' | 'success' | 'warning' | 'error' | 'primary';
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-outline',
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', 'primary'],
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(toastIconName(theme));
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 || 'info';
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: [iconElement, messageElement],
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
- primary: (message = '', options: ToastOptions = {}) =>
541
- show(message, { ...options, theme: 'primary' }),
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 = {}) =>