Will change this commit message to mean something later

This commit is contained in:
Breadway 2026-07-22 19:53:25 +08:00
parent f1c8b3d0e3
commit 40da0b3517
55 changed files with 55 additions and 17 deletions

View file

@ -1,13 +1,7 @@
<script lang="ts">
let {
label,
value = $bindable(),
suggestions = [],
}: { label: string; value: string[]; suggestions?: string[] } = $props();
let { label, value = $bindable() }: { label: string; value: string[] } = $props();
let text = $state("");
const listId = $props.id();
let available = $derived(suggestions.filter((s) => !value.includes(s)));
function commit() {
const v = text.trim();
@ -42,15 +36,8 @@
<button type="button" class="remove" onclick={() => remove(name)} aria-label={`Remove ${name}`}>×</button>
</span>
{/each}
<input type="text" bind:value={text} onkeydown={onKeydown} placeholder="Type and press Enter…" list={available.length ? listId : undefined} />
<input type="text" bind:value={text} onkeydown={onKeydown} placeholder="Type and press Enter…" />
</div>
{#if available.length}
<datalist id={listId}>
{#each available as s (s)}
<option value={s}></option>
{/each}
</datalist>
{/if}
</div>
<style>

View file

@ -9,6 +9,7 @@
import SelectField from "$lib/components/SelectField.svelte";
import NumberField from "$lib/components/NumberField.svelte";
import TagsField from "$lib/components/TagsField.svelte";
import ChipPickerField from "$lib/components/ChipPickerField.svelte";
import SaveButton from "$lib/components/SaveButton.svelte";
interface BreadConfig {
@ -32,9 +33,14 @@
}
let cfg = $state<BreadConfig | null>(null);
// The daemon's 4 compiled-in modules plus every *.lua file actually
// sitting in the configured module directory — real installed modules,
// not a guess, so picking one to disable is a click.
let knownModules = $state<string[]>([]);
onMount(async () => {
cfg = await invoke<BreadConfig>("get_bread_config");
knownModules = await invoke<string[]>("list_bread_modules");
});
async function save() {
@ -58,10 +64,11 @@
<Group title="Modules">
<SwitchField label="Load built-in modules" bind:value={cfg.modules_builtin} />
<TagsField
<ChipPickerField
label="Disabled modules"
bind:value={cfg.modules_disable}
suggestions={["bread.monitors", "bread.devices", "bread.workspaces", "bread.binds"]}
options={knownModules}
emptyOptionsHint="No other modules found to disable."
/>
</Group>