Add Tauri v2 + Svelte 5 frontend and headless Python backend

Scaffold the cross-platform rewrite from PySide6/Qt to Tauri + Svelte,
following the same architecture as voice-to-notes. The Python backend
runs headless as a sidecar, with a FastAPI control API that the Svelte
frontend connects to via REST and WebSocket.

New files:
- backend/app_controller.py: Headless orchestration (extracted from MainWindow)
- backend/api_server.py: FastAPI control endpoints + /ws/control WebSocket
- backend/main_headless.py: Headless entry point for sidecar mode
- src-tauri/: Tauri v2 Rust shell with sidecar and dialog plugins
- src/: Svelte 5 frontend (App, Settings, Controls, TranscriptionDisplay)
- src/lib/stores/: Reactive stores for backend connection, config, transcriptions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Developer
2026-04-06 10:20:25 -07:00
parent 9ff883e2e3
commit af534bf768
29 changed files with 14008 additions and 0 deletions

99
src/App.svelte Normal file
View File

@@ -0,0 +1,99 @@
<script lang="ts">
import { onMount } from "svelte";
import Header from "$lib/components/Header.svelte";
import StatusBar from "$lib/components/StatusBar.svelte";
import Controls from "$lib/components/Controls.svelte";
import TranscriptionDisplay from "$lib/components/TranscriptionDisplay.svelte";
import Settings from "$lib/components/Settings.svelte";
import { backendStore } from "$lib/stores/backend";
import { configStore } from "$lib/stores/config";
let showSettings = $state(false);
let obsDisplayUrl = $derived(backendStore.obsUrl);
let syncDisplayUrl = $derived(backendStore.syncUrl);
function openSettings() {
showSettings = true;
}
function closeSettings() {
showSettings = false;
}
onMount(() => {
backendStore.connect();
configStore.loadConfig();
return () => {
backendStore.disconnect();
};
});
</script>
<div class="app-shell">
<Header onSettingsClick={openSettings} />
<StatusBar />
<div class="display-links">
<span class="link-label">OBS:</span>
<a href={obsDisplayUrl} target="_blank" rel="noopener">{obsDisplayUrl}</a>
{#if syncDisplayUrl}
<span class="link-separator">|</span>
<span class="link-label">Sync:</span>
<a href={syncDisplayUrl} target="_blank" rel="noopener"
>{syncDisplayUrl}</a
>
{/if}
</div>
<TranscriptionDisplay />
<Controls />
<div class="version-label">v{backendStore.version}</div>
</div>
{#if showSettings}
<Settings onClose={closeSettings} />
{/if}
<style>
.app-shell {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
background-color: var(--bg-primary);
}
.display-links {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 20px;
font-size: 12px;
background-color: var(--bg-primary);
border-bottom: 1px solid var(--border-color);
flex-shrink: 0;
}
.link-label {
color: var(--text-secondary);
font-weight: 500;
}
.link-separator {
color: var(--text-muted);
margin: 0 4px;
}
.version-label {
position: fixed;
bottom: 6px;
right: 12px;
font-size: 11px;
color: var(--text-muted);
pointer-events: none;
z-index: 10;
}
</style>

312
src/app.css Normal file
View File

@@ -0,0 +1,312 @@
/* Global dark theme styles for Local Transcription */
:root {
--bg-primary: #1e1e1e;
--bg-secondary: #2d2d2d;
--bg-tertiary: #3a3a3a;
--bg-hover: #454545;
--text-primary: #e0e0e0;
--text-secondary: #a0a0a0;
--text-muted: #707070;
--accent-green: #4caf50;
--accent-green-hover: #45a049;
--accent-red: #f44336;
--accent-red-hover: #d32f2f;
--accent-blue: #2196f3;
--accent-blue-hover: #1976d2;
--accent-orange: #ff9800;
--border-color: #444;
--border-color-light: #555;
--scrollbar-track: #2d2d2d;
--scrollbar-thumb: #555;
--scrollbar-thumb-hover: #777;
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
background-color: var(--bg-primary);
color: var(--text-primary);
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, sans-serif;
font-size: 14px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#app {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}
/* Buttons */
button {
font-family: inherit;
font-size: 13px;
font-weight: 500;
padding: 8px 16px;
border: 1px solid var(--border-color);
border-radius: 6px;
background-color: var(--bg-secondary);
color: var(--text-primary);
cursor: pointer;
transition: background-color 0.15s ease, border-color 0.15s ease,
transform 0.1s ease;
user-select: none;
}
button:hover {
background-color: var(--bg-hover);
border-color: var(--border-color-light);
}
button:active {
transform: scale(0.98);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
button.primary {
background-color: var(--accent-green);
border-color: var(--accent-green);
color: white;
}
button.primary:hover {
background-color: var(--accent-green-hover);
}
button.danger {
background-color: var(--accent-red);
border-color: var(--accent-red);
color: white;
}
button.danger:hover {
background-color: var(--accent-red-hover);
}
/* Inputs and Selects */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="email"],
select,
textarea {
font-family: inherit;
font-size: 13px;
padding: 8px 12px;
border: 1px solid var(--border-color);
border-radius: 6px;
background-color: var(--bg-secondary);
color: var(--text-primary);
outline: none;
transition: border-color 0.15s ease;
width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
border-color: var(--accent-blue);
}
input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="url"]::placeholder {
color: var(--text-muted);
}
select {
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 10px center;
padding-right: 30px;
}
/* Color input */
input[type="color"] {
width: 50px;
height: 36px;
border: 1px solid var(--border-color);
border-radius: 6px;
background-color: var(--bg-secondary);
cursor: pointer;
padding: 2px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
padding: 2px;
}
input[type="color"]::-webkit-color-swatch {
border: none;
border-radius: 3px;
}
/* Range slider */
input[type="range"] {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 6px;
background: var(--bg-tertiary);
border-radius: 3px;
outline: none;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--accent-blue);
cursor: pointer;
border: 2px solid var(--bg-primary);
}
input[type="range"]::-moz-range-thumb {
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--accent-blue);
cursor: pointer;
border: 2px solid var(--bg-primary);
}
/* Toggle / Checkbox styled as switch */
input[type="checkbox"] {
position: relative;
width: 40px;
height: 22px;
-webkit-appearance: none;
appearance: none;
background-color: var(--bg-tertiary);
border-radius: 11px;
cursor: pointer;
transition: background-color 0.2s ease;
flex-shrink: 0;
}
input[type="checkbox"]::after {
content: "";
position: absolute;
top: 2px;
left: 2px;
width: 18px;
height: 18px;
background-color: var(--text-secondary);
border-radius: 50%;
transition: transform 0.2s ease, background-color 0.2s ease;
}
input[type="checkbox"]:checked {
background-color: var(--accent-green);
}
input[type="checkbox"]:checked::after {
transform: translateX(18px);
background-color: white;
}
/* Radio buttons */
input[type="radio"] {
-webkit-appearance: none;
appearance: none;
width: 18px;
height: 18px;
border: 2px solid var(--border-color);
border-radius: 50%;
background-color: var(--bg-secondary);
cursor: pointer;
position: relative;
flex-shrink: 0;
}
input[type="radio"]:checked {
border-color: var(--accent-blue);
}
input[type="radio"]:checked::after {
content: "";
position: absolute;
top: 3px;
left: 3px;
width: 8px;
height: 8px;
background-color: var(--accent-blue);
border-radius: 50%;
}
/* Scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: var(--scrollbar-track);
border-radius: 4px;
}
::-webkit-scrollbar-thumb {
background: var(--scrollbar-thumb);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--scrollbar-thumb-hover);
}
/* Firefox scrollbar */
* {
scrollbar-width: thin;
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
/* Links */
a {
color: var(--accent-blue);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* Label */
label {
font-size: 13px;
color: var(--text-secondary);
display: flex;
align-items: center;
gap: 8px;
}

6
src/main.ts Normal file
View File

@@ -0,0 +1,6 @@
import App from "./App.svelte";
import { mount } from "svelte";
import "./app.css";
const app = mount(App, { target: document.getElementById("app")! });
export default app;