From 6a556b69407db457ca77d839025b13dd6a5ae0a1 Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Tue, 1 Apr 2025 18:19:45 +1100 Subject: [PATCH] feat: further interface tweaks --- .../built-in/globalSearch/Calculator.svelte | 22 ++++++++++--------- .../built-in/globalSearch/SearchBar.svelte | 21 +++++++++--------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/plugins/built-in/globalSearch/Calculator.svelte b/src/plugins/built-in/globalSearch/Calculator.svelte index c7acf596..90c119c6 100644 --- a/src/plugins/built-in/globalSearch/Calculator.svelte +++ b/src/plugins/built-in/globalSearch/Calculator.svelte @@ -48,20 +48,20 @@ if (evaluated !== undefined) { if (math.typeOf(evaluated) === 'Unit') { // Handle unit conversion results - result = math.format(evaluated, { precision: 14 }); + result = math.format(evaluated, { precision: 14, lowerExp: -15, upperExp: 15 }); inputUnit = detectUnit(input); outputUnit = detectUnit(result); } else if (typeof evaluated === 'number') { // Handle regular numbers if (math.round(evaluated) === evaluated) { - result = math.format(evaluated, { precision: 14 }); + result = math.format(evaluated, { precision: 14, lowerExp: -15, upperExp: 15 }); } else { - result = math.format(evaluated, { precision: 14 }); + result = math.format(evaluated, { precision: 14, lowerExp: -15, upperExp: 15 }); } inputUnit = ''; outputUnit = ''; } else { - result = math.format(evaluated, { precision: 14 }); + result = math.format(evaluated, { precision: 14, lowerExp: -15, upperExp: 15 }); inputUnit = ''; outputUnit = ''; } @@ -94,10 +94,11 @@ {#if result !== null}
-

Calculator

+

Calculator

-
-
+
+
{searchTerm}
@@ -105,7 +106,7 @@
-
+
→ @@ -114,8 +115,9 @@
{#if !isCalculating} -
-
+
+
{result}
diff --git a/src/plugins/built-in/globalSearch/SearchBar.svelte b/src/plugins/built-in/globalSearch/SearchBar.svelte index bd2a31bf..95d2d94f 100644 --- a/src/plugins/built-in/globalSearch/SearchBar.svelte +++ b/src/plugins/built-in/globalSearch/SearchBar.svelte @@ -3,8 +3,8 @@ import { settingsState } from '@/seqta/utils/listeners/SettingsState' import { fade, scale } from 'svelte/transition'; import { circOut, quintOut } from 'svelte/easing'; - import { getStaticCommands, type StaticCommandItem } from './commands'; - import { getAllDynamicItems, type DynamicContentItem } from './dynamicSearch'; + import { type StaticCommandItem } from './commands'; + import { type DynamicContentItem } from './dynamicSearch'; import type { CombinedResult } from './types'; import { createSearchIndexes, performSearch as doSearch } from './searchUtils'; import { highlightMatch, highlightSnippet } from './highlightUtils'; @@ -33,7 +33,6 @@ console.debug(`[Global Search] Indexed ${commands.length} command items and ${dynamicItems.length} dynamic items.`); } - let commandPalleteOpen = $state(false); let searchTerm = $state(''); let selectedIndex = $state(0); @@ -171,7 +170,7 @@ role="button" tabindex="0">
{ e.stopPropagation(); @@ -203,7 +202,7 @@ /> {#if combinedResults.length > 0} -
    +
      {#each combinedResults as result, i (result.id)} {@const isSelected = selectedIndex === (calculatorResult ? i + 1 : i)} {@const item = result.item} @@ -221,9 +220,9 @@ {@html highlightMatch(staticItem.text, searchTerm, result.matches)} {#if staticItem.keybindLabel} - - {staticItem.keybindLabel} - +
      + {@render Shortcut({ text: '', keybind: staticItem.keybindLabel })} +
      {/if} {:else if result.type === 'dynamic'} @@ -266,7 +265,7 @@ {/if}
{/if} -
+
{#if combinedResults.length > 0 || calculatorResult}
@@ -274,7 +273,7 @@ {#if selectedIndex >= 0 && selectedIndex < combinedResults.length} {@const item = combinedResults[selectedIndex].item} {#if 'keybind' in item && item.keybind} - {@render Shortcut({ text: 'Shortcut', keybind: item.keybindLabel })} + {@render Shortcut({ text: 'Shortcut', keybind: [ ...(item?.keybindLabel ?? []) ] })} {/if} {/if} {/if} @@ -299,7 +298,7 @@
{#each keybind as key} - {key} + {key} {/each}
{text}