@immich/ui 0.38.0 → 0.39.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.
|
@@ -6,11 +6,10 @@ declare class ToastManager {
|
|
|
6
6
|
custom(item: ToastCustom, options?: ToastOptions): void;
|
|
7
7
|
open(item: ToastItem, options?: ToastOptions): void;
|
|
8
8
|
unmount(): Promise<void>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
danger(item: ToastShow): void;
|
|
9
|
+
success(item: string | ToastShow): void;
|
|
10
|
+
info(item: string | ToastShow): void;
|
|
11
|
+
warning(item: string | ToastShow): void;
|
|
12
|
+
danger(item: string | ToastShow): void;
|
|
14
13
|
mount(): Promise<void>;
|
|
15
14
|
private remove;
|
|
16
15
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import ToastPanel from '../components/Toast/ToastPanel.svelte';
|
|
2
|
+
import { t } from './translation.svelte.js';
|
|
2
3
|
import { generateId } from '../utilities/internal.js';
|
|
3
4
|
import { mount, unmount } from 'svelte';
|
|
4
5
|
export const isCustomToast = (item) => !!item.component;
|
|
6
|
+
const expand = (item) => (typeof item === 'string' ? { description: item } : item);
|
|
5
7
|
class ToastManager {
|
|
6
8
|
#ref;
|
|
7
9
|
#props = $state({ items: [] });
|
|
@@ -35,20 +37,17 @@ class ToastManager {
|
|
|
35
37
|
await unmount(this.#ref);
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
primary(item) {
|
|
39
|
-
this.show({ ...item, color: 'primary' });
|
|
40
|
-
}
|
|
41
40
|
success(item) {
|
|
42
|
-
this.show({
|
|
41
|
+
this.show({ title: t('toast_success_title'), color: 'success', ...expand(item) });
|
|
43
42
|
}
|
|
44
43
|
info(item) {
|
|
45
|
-
this.show({
|
|
44
|
+
this.show({ title: t('toast_info_title'), color: 'info', ...expand(item) });
|
|
46
45
|
}
|
|
47
46
|
warning(item) {
|
|
48
|
-
this.show({
|
|
47
|
+
this.show({ title: t('toast_warning_title'), color: 'warning', ...expand(item) });
|
|
49
48
|
}
|
|
50
49
|
danger(item) {
|
|
51
|
-
this.show({
|
|
50
|
+
this.show({ title: t('toast_danger_title'), color: 'danger', ...expand(item) });
|
|
52
51
|
}
|
|
53
52
|
async mount() {
|
|
54
53
|
if (!this.#ref) {
|
|
@@ -13,6 +13,10 @@ declare const defaultTranslations: {
|
|
|
13
13
|
hide_password: string;
|
|
14
14
|
dark_theme: string;
|
|
15
15
|
command_palette_prompt_default: string;
|
|
16
|
+
toast_success_title: string;
|
|
17
|
+
toast_info_title: string;
|
|
18
|
+
toast_warning_title: string;
|
|
19
|
+
toast_danger_title: string;
|
|
16
20
|
};
|
|
17
21
|
export type Translations = typeof defaultTranslations;
|
|
18
22
|
export declare const translate: <T extends keyof Translations>(key: T, overrides?: TranslationProps<T>) => string;
|
|
@@ -19,6 +19,10 @@ const defaultTranslations = {
|
|
|
19
19
|
dark_theme: 'Toggle dark theme',
|
|
20
20
|
// command palette
|
|
21
21
|
command_palette_prompt_default: 'Quickly find pages, actions, or commands',
|
|
22
|
+
toast_success_title: 'Success',
|
|
23
|
+
toast_info_title: 'Info',
|
|
24
|
+
toast_warning_title: 'Warning',
|
|
25
|
+
toast_danger_title: 'Error',
|
|
22
26
|
};
|
|
23
27
|
let translations = $state(defaultTranslations);
|
|
24
28
|
export const translate = (key, overrides) => overrides?.[key] ?? translations[key];
|
package/dist/types.d.ts
CHANGED