aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/CommandPalette/CommandPalette.svelte2
-rw-r--r--src/lib/CommandPalette/actions.ts1
-rw-r--r--src/lib/Tools/tools.ts10
-rw-r--r--src/routes/+layout.svelte4
4 files changed, 6 insertions, 11 deletions
diff --git a/src/lib/CommandPalette/CommandPalette.svelte b/src/lib/CommandPalette/CommandPalette.svelte
index f039a250..332def8e 100644
--- a/src/lib/CommandPalette/CommandPalette.svelte
+++ b/src/lib/CommandPalette/CommandPalette.svelte
@@ -2,7 +2,7 @@
import { onMount } from 'svelte';
import { fly, fade } from 'svelte/transition';
import { flip } from 'svelte/animate';
- import { CommandPaletteAction } from './actions';
+ import type { CommandPaletteAction } from './actions';
export let items: CommandPaletteAction[] = [];
export let open = false;
diff --git a/src/lib/CommandPalette/actions.ts b/src/lib/CommandPalette/actions.ts
index a62ae529..acbc3629 100644
--- a/src/lib/CommandPalette/actions.ts
+++ b/src/lib/CommandPalette/actions.ts
@@ -4,6 +4,7 @@ export interface CommandPaletteAction {
onClick?: () => void;
preventDefault?: boolean;
tags?: string[];
+ actions?: CommandPaletteAction[];
}
export const defaultActions: CommandPaletteAction[] = [
diff --git a/src/lib/Tools/tools.ts b/src/lib/Tools/tools.ts
index 82ffef96..c5af7e34 100644
--- a/src/lib/Tools/tools.ts
+++ b/src/lib/Tools/tools.ts
@@ -1,14 +1,8 @@
+import type { CommandPaletteAction } from '$lib/CommandPalette/actions';
import locale from '$stores/locale';
import { get } from 'svelte/store';
-interface CommandPaletteItem {
- name: string;
- url: string;
- onClick?: () => void;
- preventDefault?: boolean;
-}
-
-export const toolsAsCommandPaletteItemSet = () =>
+export const toolsAsCommandPaletteActions = (): CommandPaletteAction[] =>
Object.entries(tools)
.filter(([id, tool]) => id !== 'default' && !tool.hidden)
.map(([id, tool]) => ({
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index f5adcb68..92300d76 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -32,7 +32,7 @@
import { database as userDatabase } from '$lib/Database/IDB/user';
import CommandPalette from '$lib/CommandPalette/CommandPalette.svelte';
import { defaultActions } from '$lib/CommandPalette/actions';
- import { toolsAsCommandPaletteItemSet } from '$lib/Tools/tools';
+ import { toolsAsCommandPaletteActions } from '$lib/Tools/tools';
injectSpeedInsights();
@@ -157,7 +157,7 @@
<HeadTitle />
-<CommandPalette items={defaultActions.concat(toolsAsCommandPaletteItemSet())} />
+<CommandPalette items={defaultActions.concat(toolsAsCommandPaletteActions())} />
{#if !$locales.includes('en') || !$locale().navigation}
<Message />