feat(electrobun): port all Tauri features — full settings, popup menus, provider capabilities

New components (8):
- provider-capabilities.ts: per-provider feature flags (claude/codex/ollama)
- settings/AppearanceSettings.svelte: theme, fonts, cursor, scrollback
- settings/AgentSettings.svelte: shell, CWD, permissions, providers
- settings/SecuritySettings.svelte: keyring, secrets, branch policies
- settings/ProjectSettings.svelte: per-project provider/model/worktree/sandbox
- settings/OrchestrationSettings.svelte: wake strategy, notifications, anchors
- settings/AdvancedSettings.svelte: logging, OTLP, plugins, import/export

Updated:
- ChatInput: radial context indicator (78% demo, color-coded arc),
  4 popup menus (upload/context/web/slash), provider-gated icons
- SettingsDrawer: 6-category sidebar shell
- AgentPane: passes provider + contextPct to ChatInput
This commit is contained in:
Hibryda 2026-03-20 04:50:57 +01:00
parent 54d6f0b94a
commit 0b9e8b305a
15 changed files with 1510 additions and 441 deletions

View file

@ -0,0 +1,199 @@
<script lang="ts">
const THEMES = [
{ id: 'mocha', label: 'Catppuccin Mocha', group: 'Catppuccin' },
{ id: 'macchiato', label: 'Catppuccin Macchiato', group: 'Catppuccin' },
{ id: 'frappe', label: 'Catppuccin Frappé', group: 'Catppuccin' },
{ id: 'latte', label: 'Catppuccin Latte', group: 'Catppuccin' },
];
const UI_FONTS = [
{ value: '', label: 'System Default' },
{ value: 'Inter', label: 'Inter' },
{ value: 'IBM Plex Sans', label: 'IBM Plex Sans' },
{ value: 'Noto Sans', label: 'Noto Sans' },
{ value: 'Roboto', label: 'Roboto' },
{ value: 'Ubuntu', label: 'Ubuntu' },
];
const TERM_FONTS = [
{ value: '', label: 'Default (JetBrains Mono)' },
{ value: 'JetBrains Mono', label: 'JetBrains Mono' },
{ value: 'Fira Code', label: 'Fira Code' },
{ value: 'Cascadia Code', label: 'Cascadia Code' },
{ value: 'Source Code Pro', label: 'Source Code Pro' },
{ value: 'IBM Plex Mono', label: 'IBM Plex Mono' },
{ value: 'monospace', label: 'monospace' },
];
let themeId = $state('mocha');
let uiFont = $state('');
let uiFontSize = $state(14);
let termFont = $state('');
let termFontSize = $state(13);
let cursorStyle = $state('block');
let cursorBlink = $state(true);
let scrollback = $state(1000);
let themeOpen = $state(false);
let uiFontOpen = $state(false);
let termFontOpen = $state(false);
let themeLabel = $derived(THEMES.find(t => t.id === themeId)?.label ?? 'Catppuccin Mocha');
let uiFontLabel = $derived(UI_FONTS.find(f => f.value === uiFont)?.label ?? 'System Default');
let termFontLabel = $derived(TERM_FONTS.find(f => f.value === termFont)?.label ?? 'Default (JetBrains Mono)');
function closeAll() { themeOpen = false; uiFontOpen = false; termFontOpen = false; }
function handleOutsideClick(e: MouseEvent) {
if (!(e.target as HTMLElement).closest('.dd-wrap')) closeAll();
}
function handleKey(e: KeyboardEvent) {
if (e.key === 'Escape') closeAll();
}
</script>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div class="section" onclick={handleOutsideClick} onkeydown={handleKey}>
<h3 class="sh">Theme</h3>
<div class="field">
<div class="dd-wrap">
<button class="dd-btn" onclick={() => { themeOpen = !themeOpen; uiFontOpen = false; termFontOpen = false; }}>
{themeLabel}
<svg class="chev" class:open={themeOpen} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
</button>
{#if themeOpen}
<ul class="dd-list" role="listbox">
{#each THEMES as t}
<li class="dd-item" class:sel={themeId === t.id} role="option" aria-selected={themeId === t.id}
tabindex="0"
onclick={() => { themeId = t.id; themeOpen = false; }}
onkeydown={e => (e.key === 'Enter' || e.key === ' ') && (themeId = t.id, themeOpen = false)}
>{t.label}</li>
{/each}
</ul>
{/if}
</div>
</div>
<h3 class="sh">UI Font</h3>
<div class="field row">
<div class="dd-wrap flex1">
<button class="dd-btn" onclick={() => { uiFontOpen = !uiFontOpen; themeOpen = false; termFontOpen = false; }}>
{uiFontLabel}
<svg class="chev" class:open={uiFontOpen} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
</button>
{#if uiFontOpen}
<ul class="dd-list" role="listbox">
{#each UI_FONTS as f}
<li class="dd-item" class:sel={uiFont === f.value} role="option" aria-selected={uiFont === f.value}
tabindex="0"
onclick={() => { uiFont = f.value; uiFontOpen = false; }}
onkeydown={e => (e.key === 'Enter' || e.key === ' ') && (uiFont = f.value, uiFontOpen = false)}
>{f.label}</li>
{/each}
</ul>
{/if}
</div>
<div class="stepper">
<button onclick={() => uiFontSize = Math.max(8, uiFontSize - 1)} aria-label="Decrease UI font size"></button>
<span>{uiFontSize}px</span>
<button onclick={() => uiFontSize = Math.min(24, uiFontSize + 1)} aria-label="Increase UI font size">+</button>
</div>
</div>
<h3 class="sh">Terminal Font</h3>
<div class="field row">
<div class="dd-wrap flex1">
<button class="dd-btn" onclick={() => { termFontOpen = !termFontOpen; themeOpen = false; uiFontOpen = false; }}>
{termFontLabel}
<svg class="chev" class:open={termFontOpen} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
</button>
{#if termFontOpen}
<ul class="dd-list" role="listbox">
{#each TERM_FONTS as f}
<li class="dd-item" class:sel={termFont === f.value} role="option" aria-selected={termFont === f.value}
tabindex="0"
onclick={() => { termFont = f.value; termFontOpen = false; }}
onkeydown={e => (e.key === 'Enter' || e.key === ' ') && (termFont = f.value, termFontOpen = false)}
>{f.label}</li>
{/each}
</ul>
{/if}
</div>
<div class="stepper">
<button onclick={() => termFontSize = Math.max(8, termFontSize - 1)} aria-label="Decrease terminal font size"></button>
<span>{termFontSize}px</span>
<button onclick={() => termFontSize = Math.min(24, termFontSize + 1)} aria-label="Increase terminal font size">+</button>
</div>
</div>
<h3 class="sh">Terminal Cursor</h3>
<div class="field row">
<div class="seg">
{#each ['block', 'line', 'underline'] as s}
<button class:active={cursorStyle === s} onclick={() => cursorStyle = s}>{s[0].toUpperCase() + s.slice(1)}</button>
{/each}
</div>
<label class="toggle-row">
<span>Blink</span>
<button class="toggle" class:on={cursorBlink} onclick={() => cursorBlink = !cursorBlink}>{cursorBlink ? 'On' : 'Off'}</button>
</label>
</div>
<h3 class="sh">Scrollback</h3>
<div class="field row">
<input type="number" class="num-in" min="100" max="100000" step="100" bind:value={scrollback} aria-label="Scrollback lines" />
<span class="hint">lines (100100k)</span>
</div>
</div>
<style>
.section { display: flex; flex-direction: column; gap: 0.5rem; }
.sh { margin: 0.375rem 0 0.125rem; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ctp-overlay0); }
.field { position: relative; }
.row { display: flex; align-items: center; gap: 0.5rem; }
.flex1 { flex: 1; min-width: 0; }
.dd-wrap { position: relative; }
.dd-btn {
width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.375rem;
background: var(--ctp-surface0); border: 1px solid var(--ctp-surface1); border-radius: 0.25rem;
padding: 0.3rem 0.5rem; color: var(--ctp-text); font-family: var(--ui-font-family);
font-size: 0.8125rem; cursor: pointer; text-align: left;
}
.dd-btn:hover { border-color: var(--ctp-surface2); }
.chev { width: 0.75rem; height: 0.75rem; color: var(--ctp-overlay1); transition: transform 0.15s; flex-shrink: 0; }
.chev.open { transform: rotate(180deg); }
.dd-list {
position: absolute; top: calc(100% + 0.125rem); left: 0; right: 0; z-index: 50;
list-style: none; margin: 0; padding: 0.25rem;
background: var(--ctp-mantle); border: 1px solid var(--ctp-surface1); border-radius: 0.3rem;
max-height: 12rem; overflow-y: auto;
box-shadow: 0 0.5rem 1rem color-mix(in srgb, var(--ctp-crust) 60%, transparent);
}
.dd-item {
padding: 0.3rem 0.5rem; border-radius: 0.2rem; font-size: 0.8125rem; color: var(--ctp-subtext1);
cursor: pointer; outline: none; list-style: none;
}
.dd-item:hover, .dd-item:focus { background: var(--ctp-surface0); color: var(--ctp-text); }
.dd-item.sel { background: color-mix(in srgb, var(--ctp-mauve) 15%, transparent); color: var(--ctp-mauve); font-weight: 500; }
.stepper { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.stepper button { width: 1.375rem; height: 1.375rem; background: var(--ctp-surface0); border: 1px solid var(--ctp-surface1); border-radius: 0.2rem; color: var(--ctp-text); font-size: 0.875rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.stepper button:hover { background: var(--ctp-surface1); }
.stepper span { font-size: 0.8125rem; color: var(--ctp-text); min-width: 2.5rem; text-align: center; }
.seg { display: flex; border-radius: 0.25rem; overflow: hidden; border: 1px solid var(--ctp-surface1); }
.seg button { flex: 1; padding: 0.25rem 0.5rem; background: var(--ctp-surface0); border: none; color: var(--ctp-overlay1); font-size: 0.75rem; cursor: pointer; }
.seg button:hover { background: var(--ctp-surface1); color: var(--ctp-subtext1); }
.seg button.active { background: var(--ctp-blue); color: var(--ctp-base); }
.toggle-row { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; color: var(--ctp-subtext0); cursor: pointer; }
.toggle { padding: 0.1875rem 0.5rem; background: var(--ctp-surface0); border: none; border-radius: 0.2rem; color: var(--ctp-subtext0); cursor: pointer; font-size: 0.75rem; }
.toggle.on { background: var(--ctp-green); color: var(--ctp-base); }
.num-in { width: 5rem; padding: 0.3rem 0.5rem; background: var(--ctp-surface0); border: 1px solid var(--ctp-surface1); border-radius: 0.25rem; color: var(--ctp-text); font-size: 0.8125rem; }
.num-in:focus { outline: none; border-color: var(--ctp-blue); }
.hint { font-size: 0.6875rem; color: var(--ctp-overlay0); }
</style>