From 8140970edbdae7ffcdadf0304388b4b554776385 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Fri, 13 Mar 2026 11:45:45 +1300 Subject: [PATCH] Use melt combobox over native select --- .../src/lib/components/ComboBox.svelte | 14 +- .../lib/components/settings/Filters.svelte | 162 ++++++++---------- .../lib/components/settings/Interface.svelte | 88 ++++------ .../src/lib/components/settings/Player.svelte | 134 ++++++--------- .../components/settings/SponsorBlock.svelte | 40 ++--- materialious/src/lib/css/global.css | 2 + 6 files changed, 188 insertions(+), 252 deletions(-) diff --git a/materialious/src/lib/components/ComboBox.svelte b/materialious/src/lib/components/ComboBox.svelte index 68163656..0cd920a5 100644 --- a/materialious/src/lib/components/ComboBox.svelte +++ b/materialious/src/lib/components/ComboBox.svelte @@ -7,20 +7,20 @@ let { options, - label, + label = undefined, defaultValue = undefined, onChange = undefined }: { options: ComboOption[]; - label: string; - defaultValue?: string; + label?: string; + defaultValue?: string | null; onChange?: (value: string) => void; } = $props(); let initialValueChange = true; const combobox = new Combobox({ onValueChange: (value) => { - if (initialValueChange && typeof defaultValue !== 'undefined') { + if (initialValueChange && defaultValue) { initialValueChange = false; return; } @@ -53,13 +53,15 @@ }); -
+
- + {#if label} + + {/if} keyboard_arrow_down
diff --git a/materialious/src/lib/components/settings/Filters.svelte b/materialious/src/lib/components/settings/Filters.svelte index 8ae738d0..a432adba 100644 --- a/materialious/src/lib/components/settings/Filters.svelte +++ b/materialious/src/lib/components/settings/Filters.svelte @@ -12,6 +12,7 @@ import { addToast } from '../Toast.svelte'; import { Clipboard } from '@capacitor/clipboard'; import { downloadStringAsFile } from '$lib/misc'; + import ComboBox from '../ComboBox.svelte'; let remoteFilterListUrl: string = $state($filterContentUrlStore ?? ''); let remoteError: string = $state(''); @@ -165,17 +166,21 @@
-
- - - arrow_drop_down -
+ { + return { + label: titleCase(filterType), + value: filterType + }; + })} + onChange={(value) => { + filter.type = value as 'channel' | 'video'; + filterContentListStore.set(contentFilters); + filterContentUrlAutoUpdateStore.set(false); + }} + />
-
- - - arrow_drop_down -
+ { + return { + label: camelCaseToHuman(key), + value: key + }; + })} + onChange={(value) => { + condition.field = value; + filterContentListStore.set(contentFilters); + filterContentUrlAutoUpdateStore.set(false); + }} + /> -
- - - arrow_drop_down -
+ { + return { + label: operator, + value: operator + }; + })} + onChange={(value) => { + condition.operator = value as z.infer; + filterContentListStore.set(contentFilters); + filterContentUrlAutoUpdateStore.set(false); + }} + /> {#each condition.values as conditionValue, index (index)}