feat(electrobun): wire persistence — SQLite, 17 themes, font system

Persistence:
- bun:sqlite at ~/.config/agor/settings.db (WAL mode, 500ms busy_timeout)
- 4 tables: schema_version, settings, projects, custom_themes
- 5 RPC handlers: settings.get/set/getAll, projects get/set

Theme system (LIVE switching):
- All 17 themes ported from Tauri (4 Catppuccin + 7 Editor + 6 Deep Dark)
- applyCssVars() sets 26 --ctp-* vars on document.documentElement
- Parallel xterm ITheme mapping per theme
- theme-store.svelte.ts: Svelte 5 rune store, persists to SQLite

Font system:
- font-store.svelte.ts: UI/terminal font family + size
- Live CSS var application (--ui-font-family/size, --term-font-family/size)
- onTermFontChange() callback registry for terminal instances
- Persists all 4 font settings to SQLite

AppearanceSettings wired: 17-theme grouped dropdown, font steppers
Init on startup: restores saved theme + fonts from SQLite
This commit is contained in:
Hibryda 2026-03-20 05:29:03 +01:00
parent 0b9e8b305a
commit 6002a379e4
13 changed files with 1043 additions and 53 deletions

View file

@ -43,6 +43,34 @@ export type PtyRPCRequests = {
params: { sessionId: string };
response: { ok: boolean };
};
// ── Settings RPC ───────────────────────────────────────────────────────────
/** Get a single setting value by key. Returns null if not set. */
"settings.get": {
params: { key: string };
response: { value: string | null };
};
/** Persist a setting key/value pair. */
"settings.set": {
params: { key: string; value: string };
response: { ok: boolean };
};
/** Return all settings as a flat object. */
"settings.getAll": {
params: Record<string, never>;
response: { settings: Record<string, string> };
};
/** Return all persisted projects. */
"settings.getProjects": {
params: Record<string, never>;
response: { projects: Array<{ id: string; config: string }> };
};
/** Persist a project config (JSON-serialised on the caller side). */
"settings.setProject": {
params: { id: string; config: string };
response: { ok: boolean };
};
};
// ── Messages (Bun → WebView, fire-and-forget) ────────────────────────────────