diff --git a/jsconfig.json b/jsconfig.json index 4344710..4c4d1b7 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "allowJs": true, "checkJs": true, + "allowImportingTsExtensions": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, diff --git a/package.json b/package.json index b5751e4..2714236 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Kon — Think out loud", "type": "module", "scripts": { - "dev": "vite dev", + "dev": "npm run dev:frontend", + "dev:frontend": "svelte-kit sync && vite dev", "build": "vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", diff --git a/run.sh b/run.sh index ec0df70..84ea724 100755 --- a/run.sh +++ b/run.sh @@ -8,19 +8,15 @@ cd "$(dirname "$0")" export LIBCLANG_PATH=/usr/lib64/llvm21/lib64 printf 'Starting Vite dev server...\n' >&2 -npm run dev & +npm run dev:frontend & VITE_PID=$! until curl -sf http://localhost:1420 > /dev/null 2>&1; do sleep 0.5; done printf 'Vite ready. Launching Tauri...\n' >&2 -# Blank beforeDevCommand so Tauri doesn't spawn a second Vite -sed -i 's/"beforeDevCommand": "npm run dev"/"beforeDevCommand": ""/' src-tauri/tauri.conf.json - cleanup() { - sed -i 's/"beforeDevCommand": ""/"beforeDevCommand": "npm run dev"/' src-tauri/tauri.conf.json kill "$VITE_PID" 2>/dev/null || true } trap cleanup EXIT INT TERM -npx tauri dev +npx tauri dev --config '{"build":{"beforeDevCommand":""}}' diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3800cc5..32b8aff 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -4,7 +4,7 @@ "version": "0.1.0", "identifier": "uk.co.corbel.kon", "build": { - "beforeDevCommand": "npm run dev", + "beforeDevCommand": "npm run dev:frontend", "devUrl": "http://localhost:1420", "beforeBuildCommand": "npm run build", "frontendDist": "../build" diff --git a/src/app.d.ts b/src/app.d.ts new file mode 100644 index 0000000..02851f3 --- /dev/null +++ b/src/app.d.ts @@ -0,0 +1,44 @@ +declare global { + interface Window { + __TAURI_INTERNALS__?: unknown; + isTauri?: boolean; + } +} + +declare module "@chenglou/pretext" { + export interface PretextLayoutLine { + text: string; + } + + export interface PretextLayoutResult { + height: number; + lineCount: number; + lines: PretextLayoutLine[]; + } + + export function prepare( + text: string, + font: string, + options?: Record, + ): unknown; + + export function prepareWithSegments( + text: string, + font: string, + options?: Record, + ): unknown; + + export function layout( + prepared: unknown, + maxWidth: number, + lineHeight: number, + ): PretextLayoutResult; + + export function layoutWithLines( + prepared: unknown, + maxWidth: number, + lineHeight: number, + ): PretextLayoutResult; +} + +export {}; diff --git a/src/lib/Sidebar.svelte b/src/lib/Sidebar.svelte index 979d792..b32ac54 100644 --- a/src/lib/Sidebar.svelte +++ b/src/lib/Sidebar.svelte @@ -1,4 +1,4 @@ -
@@ -59,7 +64,7 @@ {prefs.accessibility.fontSize}px
updateAccessibility({ fontSize: Number(e.target.value) })} + oninput={(e) => updateAccessibility({ fontSize: rangeValue(e) })} class="w-full accent-accent" /> @@ -70,7 +75,7 @@ {prefs.accessibility.letterSpacing.toFixed(2)}em updateAccessibility({ letterSpacing: Number(e.target.value) })} + oninput={(e) => updateAccessibility({ letterSpacing: rangeValue(e) })} class="w-full accent-accent" /> @@ -81,7 +86,7 @@ {prefs.accessibility.lineHeight.toFixed(1)} updateAccessibility({ lineHeight: Number(e.target.value) })} + oninput={(e) => updateAccessibility({ lineHeight: rangeValue(e) })} class="w-full accent-accent" /> @@ -92,7 +97,7 @@ {prefs.accessibility.transcriptSize}px updateAccessibility({ transcriptSize: Number(e.target.value) })} + oninput={(e) => updateAccessibility({ transcriptSize: rangeValue(e) })} class="w-full accent-accent" /> diff --git a/src/lib/components/HotkeyRecorder.svelte b/src/lib/components/HotkeyRecorder.svelte index bebd144..f9f24c5 100644 --- a/src/lib/components/HotkeyRecorder.svelte +++ b/src/lib/components/HotkeyRecorder.svelte @@ -1,4 +1,4 @@ - {#if enabled} +
startResize(e,"North")}>
+
startResize(e,"South")}>
+
startResize(e,"West")}>
+
startResize(e,"East")}>
+
startResize(e,"NorthWest")}>
+
startResize(e,"NorthEast")}>
+
startResize(e,"SouthWest")}>
+
startResize(e,"SouthEast")}>
{/if} diff --git a/src/lib/components/TaskSidebar.svelte b/src/lib/components/TaskSidebar.svelte index 8f39929..6b4e386 100644 --- a/src/lib/components/TaskSidebar.svelte +++ b/src/lib/components/TaskSidebar.svelte @@ -1,14 +1,14 @@ - +
+ diff --git a/src/lib/components/VirtualSegmentList.svelte b/src/lib/components/VirtualSegmentList.svelte index 8cb6a31..e6894da 100644 --- a/src/lib/components/VirtualSegmentList.svelte +++ b/src/lib/components/VirtualSegmentList.svelte @@ -1,4 +1,5 @@ - diff --git a/src/lib/pages/DictationPage.svelte b/src/lib/pages/DictationPage.svelte index 653e54e..5126c7d 100644 --- a/src/lib/pages/DictationPage.svelte +++ b/src/lib/pages/DictationPage.svelte @@ -1,4 +1,5 @@ -
@@ -297,13 +323,13 @@ {#if editingListId === list.id && !sidebarCollapsed}
{ if (e.key === "Enter") finishRenaming(); if (e.key === "Escape") { editingListId = null; } }} onblur={finishRenaming} data-no-transition - autofocus />
{:else} @@ -356,6 +382,7 @@
{#if showNewList} { showNewList = false; newListName = ""; }} data-no-transition - autofocus /> {:else} + >{effortLabel(e)} {/each} {#if task.createdAt} @@ -457,7 +483,7 @@ class="flex items-center gap-2 text-[12px] text-text-tertiary hover:text-text-secondary mb-2" onclick={() => showCompleted = !showCompleted} > -