@immich/ui 0.42.2 → 0.42.3
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/components/ContextMenu/ContextMenu.svelte +4 -4
- package/dist/services/command-palette-manager.svelte.d.ts +2 -2
- package/dist/services/command-palette-manager.svelte.js +6 -8
- package/dist/services/menu-manager.svelte.d.ts +1 -1
- package/dist/services/menu-manager.svelte.js +1 -2
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
items,
|
|
15
15
|
bottomItems,
|
|
16
16
|
size = 'medium',
|
|
17
|
-
|
|
17
|
+
target,
|
|
18
18
|
position = 'top-left',
|
|
19
19
|
class: className,
|
|
20
20
|
...restProps
|
|
@@ -83,14 +83,14 @@
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
const alignOffset = $derived(
|
|
87
|
-
const sideOffset = $derived(-
|
|
86
|
+
const alignOffset = $derived(target.clientWidth / 2);
|
|
87
|
+
const sideOffset = $derived(-target.clientHeight / 2);
|
|
88
88
|
const { side, align } = $derived(getAlignment(position));
|
|
89
89
|
</script>
|
|
90
90
|
|
|
91
91
|
<DropdownMenu.Root open={true} onOpenChange={() => onClose()}>
|
|
92
92
|
<DropdownMenu.Portal>
|
|
93
|
-
<DropdownMenu.Content forceMount customAnchor={
|
|
93
|
+
<DropdownMenu.Content forceMount customAnchor={target} {side} {align} {alignOffset} {sideOffset}>
|
|
94
94
|
{#snippet child({ wrapperProps, props, open })}
|
|
95
95
|
{#if open}
|
|
96
96
|
<div {...wrapperProps} class={zIndex.ContextMenu}>
|
|
@@ -6,7 +6,7 @@ export type CommandItem = {
|
|
|
6
6
|
type: string;
|
|
7
7
|
title: string;
|
|
8
8
|
description?: string;
|
|
9
|
-
text
|
|
9
|
+
text?: string;
|
|
10
10
|
shortcuts?: MaybeArray<Shortcut>;
|
|
11
11
|
shortcutOptions?: {
|
|
12
12
|
ignoreInputFields?: boolean;
|
|
@@ -15,7 +15,7 @@ export type CommandItem = {
|
|
|
15
15
|
} & ({
|
|
16
16
|
href: string;
|
|
17
17
|
} | {
|
|
18
|
-
action: () => void
|
|
18
|
+
action: (command: CommandItem) => void;
|
|
19
19
|
});
|
|
20
20
|
export type CommandPaletteTranslations = TranslationProps<'search_placeholder' | 'search_no_results' | 'search_recently_used' | 'command_palette_prompt_default'>;
|
|
21
21
|
export declare const asText: (...items: unknown[]) => string;
|
|
@@ -10,11 +10,11 @@ export const asText = (...items) => {
|
|
|
10
10
|
.join('|')
|
|
11
11
|
.toLowerCase();
|
|
12
12
|
};
|
|
13
|
-
const isMatch = (
|
|
13
|
+
const isMatch = ({ title, description, type, text = asText(title, description, type) }, query) => {
|
|
14
14
|
if (!query) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return text.includes(query);
|
|
18
18
|
};
|
|
19
19
|
class CommandPaletteManager {
|
|
20
20
|
query = $state('');
|
|
@@ -73,14 +73,12 @@ class CommandPaletteManager {
|
|
|
73
73
|
if ('href' in command) {
|
|
74
74
|
if (!command.href.startsWith('/')) {
|
|
75
75
|
window.open(command.href, '_blank');
|
|
76
|
+
return;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
await command.action();
|
|
78
|
+
await goto(command.href);
|
|
79
|
+
return;
|
|
83
80
|
}
|
|
81
|
+
command.action(command);
|
|
84
82
|
}
|
|
85
83
|
setTranslations(translations = {}) {
|
|
86
84
|
this.#translations = translations;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContextMenuBaseProps } from '../types.js';
|
|
2
2
|
declare class MenuManager {
|
|
3
|
-
show(
|
|
3
|
+
show(props: ContextMenuBaseProps): Promise<void>;
|
|
4
4
|
}
|
|
5
5
|
export declare const menuManager: MenuManager;
|
|
6
6
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import ContextMenu from '../components/ContextMenu/ContextMenu.svelte';
|
|
2
2
|
import { modalManager } from './modal-manager.svelte.js';
|
|
3
3
|
class MenuManager {
|
|
4
|
-
show(
|
|
4
|
+
show(props) {
|
|
5
5
|
return modalManager.show(ContextMenu, {
|
|
6
6
|
...props,
|
|
7
|
-
anchor: event.currentTarget,
|
|
8
7
|
});
|
|
9
8
|
}
|
|
10
9
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -225,10 +225,10 @@ export type MenuProps = {
|
|
|
225
225
|
} & HTMLAttributes<HTMLDivElement>;
|
|
226
226
|
export type ContextMenuPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
227
227
|
export type ContextMenuBaseProps = MenuProps & {
|
|
228
|
+
target: HTMLElement;
|
|
228
229
|
position?: ContextMenuPosition;
|
|
229
230
|
};
|
|
230
231
|
export type ContextMenuProps = ContextMenuBaseProps & {
|
|
231
232
|
onClose: () => void;
|
|
232
|
-
anchor: HTMLElement;
|
|
233
233
|
};
|
|
234
234
|
export {};
|