@immich/ui 0.61.4 → 0.62.1
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/actions/shortcut.js +6 -2
- package/dist/common/context.svelte.d.ts +0 -6
- package/dist/components/Card/Card.svelte +2 -1
- package/dist/components/Modal/Modal.svelte +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/internal/DatePicker.svelte +4 -1
- package/dist/internal/Select.svelte +2 -1
- package/dist/services/command-palette-manager.svelte.d.ts +1 -1
- package/dist/services/command-palette-manager.svelte.js +7 -1
- package/dist/services/translation.svelte.d.ts +1 -2
- package/dist/services/translation.svelte.js +2 -2
- package/dist/state/locale-state.svelte.d.ts +2 -0
- package/dist/state/locale-state.svelte.js +5 -0
- package/dist/state/modal-state.svelte.d.ts +1 -0
- package/dist/state/modal-state.svelte.js +1 -0
- package/package.json +1 -1
package/dist/actions/shortcut.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { on } from 'svelte/events';
|
|
1
2
|
export const shortcutLabel = (shortcut) => {
|
|
2
3
|
let label = '';
|
|
3
4
|
if (shortcut.ctrl) {
|
|
@@ -71,6 +72,9 @@ export const shortcut = (node, option) => {
|
|
|
71
72
|
/** Binds multiple keyboard shortcuts to node */
|
|
72
73
|
export const shortcuts = (node, options) => {
|
|
73
74
|
function onKeydown(event) {
|
|
75
|
+
if (event.defaultPrevented) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
74
78
|
const ignoreShortcut = shouldIgnoreEvent(event);
|
|
75
79
|
for (const { shortcut, onShortcut, ignoreInputFields = true, preventDefault = true } of options) {
|
|
76
80
|
if (ignoreInputFields && ignoreShortcut) {
|
|
@@ -85,13 +89,13 @@ export const shortcuts = (node, options) => {
|
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
|
-
node
|
|
92
|
+
const off = on(node, 'keydown', onKeydown);
|
|
89
93
|
return {
|
|
90
94
|
update(newOptions) {
|
|
91
95
|
options = newOptions;
|
|
92
96
|
},
|
|
93
97
|
destroy() {
|
|
94
|
-
|
|
98
|
+
off();
|
|
95
99
|
},
|
|
96
100
|
};
|
|
97
101
|
};
|
|
@@ -58,12 +58,6 @@ export declare const getFieldContext: () => () => {
|
|
|
58
58
|
'bind:focused'?: boolean | undefined | null;
|
|
59
59
|
'bind:offsetWidth'?: number | undefined | null;
|
|
60
60
|
'bind:offsetHeight'?: number | undefined | null;
|
|
61
|
-
'data-sveltekit-keepfocus'?: true | "" | "off" | undefined | null;
|
|
62
|
-
'data-sveltekit-noscroll'?: true | "" | "off" | undefined | null;
|
|
63
|
-
'data-sveltekit-preload-code'?: true | "" | "eager" | "viewport" | "hover" | "tap" | "off" | undefined | null;
|
|
64
|
-
'data-sveltekit-preload-data'?: true | "" | "hover" | "tap" | "off" | undefined | null;
|
|
65
|
-
'data-sveltekit-reload'?: true | "" | "off" | undefined | null;
|
|
66
|
-
'data-sveltekit-replacestate'?: true | "" | "off" | undefined | null;
|
|
67
61
|
'aria-activedescendant'?: string | undefined | null;
|
|
68
62
|
'aria-atomic'?: import("svelte/elements").Booleanish | undefined | null;
|
|
69
63
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined | null;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { setChildContext } from '../../common/context.svelte.js';
|
|
3
3
|
import IconButton from '../IconButton/IconButton.svelte';
|
|
4
4
|
import { ChildKey } from '../../constants.js';
|
|
5
|
+
import { t } from '../../services/translation.svelte.js';
|
|
5
6
|
import type { Color } from '../../types.js';
|
|
6
7
|
import { cleanClass } from '../../utilities/internal.js';
|
|
7
8
|
import { mdiChevronDown } from '@mdi/js';
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
variant="ghost"
|
|
115
116
|
shape="round"
|
|
116
117
|
size="large"
|
|
117
|
-
aria-label=
|
|
118
|
+
aria-label={t('expand')}
|
|
118
119
|
/>
|
|
119
120
|
</div>
|
|
120
121
|
</button>
|
|
@@ -89,6 +89,11 @@
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
+
const handleEscapeKeydown = (event: KeyboardEvent) => {
|
|
93
|
+
event.stopImmediatePropagation();
|
|
94
|
+
onEscapeKeydown?.(event);
|
|
95
|
+
};
|
|
96
|
+
|
|
92
97
|
onMount(() => {
|
|
93
98
|
layer = modalState.incrementLayer();
|
|
94
99
|
|
|
@@ -100,7 +105,7 @@
|
|
|
100
105
|
<Dialog.Portal>
|
|
101
106
|
<Dialog.Overlay class="{zIndex.ModalBackdrop} fixed start-0 top-0 flex h-dvh max-h-dvh w-screen bg-black/30" />
|
|
102
107
|
<Dialog.Content
|
|
103
|
-
{
|
|
108
|
+
onEscapeKeydown={handleEscapeKeydown}
|
|
104
109
|
{escapeKeydownBehavior}
|
|
105
110
|
{interactOutsideBehavior}
|
|
106
111
|
class={cleanClass(modalContentStyles({ size }))}
|
package/dist/index.d.ts
CHANGED
|
@@ -102,8 +102,10 @@ export * from './services/modal-manager.svelte.js';
|
|
|
102
102
|
export * from './services/theme.svelte.js';
|
|
103
103
|
export * from './services/toast-manager.svelte.js';
|
|
104
104
|
export * from './services/translation.svelte.js';
|
|
105
|
+
export * from './state/locale-state.svelte.js';
|
|
105
106
|
export * from './types.js';
|
|
106
107
|
export * from './utilities/byte-units.js';
|
|
107
108
|
export * from './utilities/common.js';
|
|
109
|
+
export { isModalOpen } from './state/modal-state.svelte.js';
|
|
108
110
|
export * from './site/constants.js';
|
|
109
111
|
export { default as SiteFooter } from './site/SiteFooter.svelte';
|
package/dist/index.js
CHANGED
|
@@ -105,9 +105,11 @@ export * from './services/modal-manager.svelte.js';
|
|
|
105
105
|
export * from './services/theme.svelte.js';
|
|
106
106
|
export * from './services/toast-manager.svelte.js';
|
|
107
107
|
export * from './services/translation.svelte.js';
|
|
108
|
+
export * from './state/locale-state.svelte.js';
|
|
108
109
|
export * from './types.js';
|
|
109
110
|
export * from './utilities/byte-units.js';
|
|
110
111
|
export * from './utilities/common.js';
|
|
112
|
+
export { isModalOpen } from './state/modal-state.svelte.js';
|
|
111
113
|
// site
|
|
112
114
|
export * from './site/constants.js';
|
|
113
115
|
export { default as SiteFooter } from './site/SiteFooter.svelte';
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import IconButton from '../components/IconButton/IconButton.svelte';
|
|
5
5
|
import Label from '../components/Label/Label.svelte';
|
|
6
6
|
import { zIndex } from '../constants.js';
|
|
7
|
+
import { t } from '../services/translation.svelte.js';
|
|
8
|
+
import { getLocale } from '../state/locale-state.svelte.js';
|
|
7
9
|
import { styleVariants } from '../styles.js';
|
|
8
10
|
import type { Shape, Size } from '../types.js';
|
|
9
11
|
import { cleanClass, generateId } from '../utilities/internal.js';
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
maxValue={maxDate}
|
|
76
78
|
bind:value={date}
|
|
77
79
|
readonly={readOnly}
|
|
80
|
+
locale={getLocale()}
|
|
78
81
|
{disabled}
|
|
79
82
|
>
|
|
80
83
|
<DatePicker.Input
|
|
@@ -102,7 +105,7 @@
|
|
|
102
105
|
{size}
|
|
103
106
|
icon={mdiCalendar}
|
|
104
107
|
{disabled}
|
|
105
|
-
aria-label=
|
|
108
|
+
aria-label={t('open_calendar')}
|
|
106
109
|
/>
|
|
107
110
|
</DatePicker.Trigger>
|
|
108
111
|
{/snippet}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import IconButton from '../components/IconButton/IconButton.svelte';
|
|
5
5
|
import Input from '../components/Input/Input.svelte';
|
|
6
6
|
import { zIndex } from '../constants.js';
|
|
7
|
+
import { t } from '../services/translation.svelte.js';
|
|
7
8
|
import type { SelectCommonProps, SelectOption } from '../types.js';
|
|
8
9
|
import { cleanClass } from '../utilities/internal.js';
|
|
9
10
|
import { mdiArrowDown, mdiArrowUp, mdiCheck, mdiChevronDown } from '@mdi/js';
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
class="m-1"
|
|
108
109
|
icon={mdiChevronDown}
|
|
109
110
|
{disabled}
|
|
110
|
-
aria-label=
|
|
111
|
+
aria-label={t('expand')}
|
|
111
112
|
/>
|
|
112
113
|
{/snippet}
|
|
113
114
|
</Input>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActionItem, MaybePromise, TranslationProps } from '../types.js';
|
|
2
|
-
export type CommandPaletteTranslations = TranslationProps<'search_placeholder' | 'search_no_results' | '
|
|
2
|
+
export type CommandPaletteTranslations = TranslationProps<'search_placeholder' | 'search_no_results' | 'command_palette_prompt_default' | 'command_palette_to_select' | 'command_palette_to_close' | 'command_palette_to_navigate' | 'command_palette_to_show_all'>;
|
|
3
3
|
export type ActionProvider = {
|
|
4
4
|
name: string;
|
|
5
5
|
onSearch: (query?: string) => MaybePromise<ActionItem[]>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { matchesShortcut, shortcuts, shouldIgnoreEvent } from '../actions/shortcut.js';
|
|
2
2
|
import CommandPaletteModal from '../internal/CommandPaletteModal.svelte';
|
|
3
3
|
import { modalManager } from './modal-manager.svelte.js';
|
|
4
|
+
import { isModalOpen } from '../state/modal-state.svelte.js';
|
|
4
5
|
import { isEnabled } from '../utilities/common.js';
|
|
5
6
|
import { asArray, generateId, getSearchString } from '../utilities/internal.js';
|
|
7
|
+
import { on } from 'svelte/events';
|
|
6
8
|
export const defaultProvider = ({ name, actions }) => ({
|
|
7
9
|
name,
|
|
8
10
|
onSearch: (query) => query ? actions.filter((action) => getSearchString(action).includes(query.toLowerCase())) : actions,
|
|
@@ -30,7 +32,7 @@ class CommandPaletteManager {
|
|
|
30
32
|
{ shortcut: { key: 'k', ctrl: true }, onShortcut: () => this.open() },
|
|
31
33
|
{ shortcut: { key: '/' }, preventDefault: true, onShortcut: () => this.open() },
|
|
32
34
|
]);
|
|
33
|
-
document.body
|
|
35
|
+
on(document.body, 'keydown', (event) => this.#handleKeydown(event));
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
setTranslations(translations = {}) {
|
|
@@ -51,6 +53,9 @@ class CommandPaletteManager {
|
|
|
51
53
|
void this.#onSearch(query);
|
|
52
54
|
}
|
|
53
55
|
async #handleKeydown(event) {
|
|
56
|
+
if (event.defaultPrevented || isModalOpen()) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
54
59
|
const actions = await Promise.all(this.#providers.map((provider) => Promise.resolve(provider.onSearch())));
|
|
55
60
|
for (const action of actions.flat()) {
|
|
56
61
|
if (!asArray(action.shortcuts).some((shortcut) => matchesShortcut(event, shortcut))) {
|
|
@@ -67,6 +72,7 @@ class CommandPaletteManager {
|
|
|
67
72
|
event.preventDefault();
|
|
68
73
|
}
|
|
69
74
|
action?.onAction(action);
|
|
75
|
+
return;
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
async #onClose(action) {
|
|
@@ -9,7 +9,6 @@ declare const defaultTranslations: {
|
|
|
9
9
|
code_copied: string;
|
|
10
10
|
search_placeholder: string;
|
|
11
11
|
search_no_results: string;
|
|
12
|
-
search_recently_used: string;
|
|
13
12
|
prompt_default: string;
|
|
14
13
|
show_password: string;
|
|
15
14
|
hide_password: string;
|
|
@@ -22,13 +21,13 @@ declare const defaultTranslations: {
|
|
|
22
21
|
command_palette_to_show_all: string;
|
|
23
22
|
navigate_next: string;
|
|
24
23
|
navigate_previous: string;
|
|
24
|
+
open_calendar: string;
|
|
25
25
|
toast_success_title: string;
|
|
26
26
|
toast_info_title: string;
|
|
27
27
|
toast_warning_title: string;
|
|
28
28
|
toast_danger_title: string;
|
|
29
29
|
save: string;
|
|
30
30
|
supporter: string;
|
|
31
|
-
global: string;
|
|
32
31
|
};
|
|
33
32
|
export type Translations = typeof defaultTranslations;
|
|
34
33
|
export declare const translate: <T extends keyof Translations>(key: T, overrides?: TranslationProps<T>) => string;
|
|
@@ -11,7 +11,6 @@ const defaultTranslations = {
|
|
|
11
11
|
// search
|
|
12
12
|
search_placeholder: 'Search...',
|
|
13
13
|
search_no_results: 'No results',
|
|
14
|
-
search_recently_used: 'Recently used',
|
|
15
14
|
// modal
|
|
16
15
|
prompt_default: 'Are you sure you want to do this?',
|
|
17
16
|
// password input
|
|
@@ -30,13 +29,14 @@ const defaultTranslations = {
|
|
|
30
29
|
// navigation
|
|
31
30
|
navigate_next: 'Next',
|
|
32
31
|
navigate_previous: 'Previous',
|
|
32
|
+
// date picker
|
|
33
|
+
open_calendar: 'Open calendar',
|
|
33
34
|
toast_success_title: 'Success',
|
|
34
35
|
toast_info_title: 'Info',
|
|
35
36
|
toast_warning_title: 'Warning',
|
|
36
37
|
toast_danger_title: 'Error',
|
|
37
38
|
save: 'Save',
|
|
38
39
|
supporter: 'Supporter',
|
|
39
|
-
global: 'Global',
|
|
40
40
|
};
|
|
41
41
|
let translations = $state(defaultTranslations);
|
|
42
42
|
export const translate = (key, overrides) => overrides?.[key] ?? translations[key];
|