@immich/ui 0.61.4 → 0.62.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.
- package/dist/actions/shortcut.js +6 -2
- package/dist/common/context.svelte.d.ts +0 -6
- 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 +2 -0
- package/dist/services/command-palette-manager.svelte.js +7 -1
- 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;
|
|
@@ -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,7 @@
|
|
|
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 { getLocale } from '../state/locale-state.svelte.js';
|
|
7
8
|
import { styleVariants } from '../styles.js';
|
|
8
9
|
import type { Shape, Size } from '../types.js';
|
|
9
10
|
import { cleanClass, generateId } from '../utilities/internal.js';
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
maxValue={maxDate}
|
|
76
77
|
bind:value={date}
|
|
77
78
|
readonly={readOnly}
|
|
79
|
+
locale={getLocale()}
|
|
78
80
|
{disabled}
|
|
79
81
|
>
|
|
80
82
|
<DatePicker.Input
|
|
@@ -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) {
|