@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
- primary(item: ToastShow): void;
10
- success(item: ToastShow): void;
11
- info(item: ToastShow): void;
12
- warning(item: ToastShow): void;
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({ ...item, color: 'success' });
41
+ this.show({ title: t('toast_success_title'), color: 'success', ...expand(item) });
43
42
  }
44
43
  info(item) {
45
- this.show({ ...item, color: 'info' });
44
+ this.show({ title: t('toast_info_title'), color: 'info', ...expand(item) });
46
45
  }
47
46
  warning(item) {
48
- this.show({ ...item, color: 'warning' });
47
+ this.show({ title: t('toast_warning_title'), color: 'warning', ...expand(item) });
49
48
  }
50
49
  danger(item) {
51
- this.show({ ...item, color: 'danger' });
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
@@ -180,7 +180,7 @@ export type ToastCustom<T extends Closable = any> = {
180
180
  props: T;
181
181
  };
182
182
  export type ToastShow = {
183
- title: string;
183
+ title?: string;
184
184
  description?: string;
185
185
  color?: Color;
186
186
  shape?: Shape;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "repository": {
6
6
  "type": "git",