@immich/ui 0.53.1 → 0.53.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.
@@ -42,7 +42,9 @@
42
42
  <div class="flex flex-col">
43
43
  <div class="flex place-items-center gap-2">
44
44
  <Text fontWeight="semi-bold">{item.title}</Text>
45
- <Icon icon={item.icon} size="1.25rem" class={item.iconClass} />
45
+ {#if item.icon}
46
+ <Icon icon={item.icon} size="1.25rem" class={item.iconClass} />
47
+ {/if}
46
48
  </div>
47
49
  {#if item.description}
48
50
  <Text
@@ -133,7 +133,9 @@
133
133
  class="px-1"
134
134
  >
135
135
  <div class={itemStyles({ color: item.color })}>
136
- <Icon icon={item.icon} class="m-2 shrink-0" />
136
+ {#if item.icon}
137
+ <Icon icon={item.icon} class="m-2 shrink-0" />
138
+ {/if}
137
139
  <Text class="grow text-start font-medium select-none" size="medium">{item.title}</Text>
138
140
  </div>
139
141
  </DropdownMenu.Item>
@@ -144,16 +146,18 @@
144
146
  <DropdownMenu.Separator class="dark:border-light-300 my-0.5 border-t" />
145
147
  <div class="flex gap-1 px-1">
146
148
  {#each filteredBottomItems as item (item.title)}
147
- <DropdownMenu.Item
148
- textValue={item.title}
149
- closeOnSelect
150
- onSelect={() => item.onAction(item)}
151
- title={item.title}
152
- >
153
- <div class={cleanClass(itemStyles({ color: item.color }))}>
154
- <Icon icon={item.icon} class="m-2 shrink-0" />
155
- </div>
156
- </DropdownMenu.Item>
149
+ {#if item.icon}
150
+ <DropdownMenu.Item
151
+ textValue={item.title}
152
+ closeOnSelect
153
+ onSelect={() => item.onAction(item)}
154
+ title={item.title}
155
+ >
156
+ <div class={cleanClass(itemStyles({ color: item.color }))}>
157
+ <Icon icon={item.icon} class="m-2 shrink-0" />
158
+ </div>
159
+ </DropdownMenu.Item>
160
+ {/if}
157
161
  {/each}
158
162
  </div>
159
163
  {/if}
@@ -19,7 +19,7 @@ declare class CommandPaletteManager {
19
19
  description?: string;
20
20
  type?: string;
21
21
  searchText?: string;
22
- icon: import("../types.js").IconLike;
22
+ icon?: import("../types.js").IconLike;
23
23
  iconClass?: string;
24
24
  color?: import("../types.js").Color;
25
25
  onAction: import("../types.js").ActionItemHandler;
@@ -1,4 +1,4 @@
1
- import { matchesShortcut, shortcuts } from '../actions/shortcut.js';
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
4
  import { asArray, generateId, getSearchString, isEnabled } from '../utilities/internal.js';
@@ -52,10 +52,20 @@ class CommandPaletteManager {
52
52
  async #handleKeydown(event) {
53
53
  const actions = await Promise.all(this.#providers.map((provider) => Promise.resolve(provider.onSearch())));
54
54
  for (const action of actions.flat()) {
55
- const shortcuts = asArray(action.shortcuts);
56
- if (shortcuts.some((shortcut) => matchesShortcut(event, shortcut)) && isEnabled(action)) {
57
- action?.onAction(action);
55
+ if (!asArray(action.shortcuts).some((shortcut) => matchesShortcut(event, shortcut))) {
56
+ continue;
58
57
  }
58
+ if (!isEnabled(action)) {
59
+ continue;
60
+ }
61
+ const { ignoreInputFields = true, preventDefault = true } = action.shortcutOptions || {};
62
+ if (ignoreInputFields && shouldIgnoreEvent(event)) {
63
+ continue;
64
+ }
65
+ if (preventDefault) {
66
+ event.preventDefault();
67
+ }
68
+ action?.onAction(action);
59
69
  }
60
70
  }
61
71
  async #onClose(action) {
package/dist/types.d.ts CHANGED
@@ -250,7 +250,7 @@ export type ActionItem = {
250
250
  description?: string;
251
251
  type?: string;
252
252
  searchText?: string;
253
- icon: IconLike;
253
+ icon?: IconLike;
254
254
  iconClass?: string;
255
255
  color?: Color;
256
256
  onAction: ActionItemHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.53.1",
3
+ "version": "0.53.3",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "repository": {
6
6
  "type": "git",