Wholesale JS -> TS migration of the frontend — stores, utils, actions,
and all Svelte component scripts adopt type annotations. Compile-time
surfaces (app.d.ts, lib/types/) added for shared DTO types.
Build plumbing:
- package.json: dev:frontend script that runs svelte-kit sync first
- tauri.conf.json: beforeDevCommand points at dev:frontend
- run.sh: dropped the sed-hack that temporarily blanked beforeDevCommand;
now relies on npm run dev:frontend to avoid double-Vite
- jsconfig.json: allowImportingTsExtensions
Preserves all Group 1 behaviour:
- page.svelte.ts keeps loadHistory / loadTasks Tauri-first, no
localStorage; saveTranscriptMeta + mapTranscriptRow + mapTaskRow
intact; update_task_cmd and update_transcript_meta_cmd invocations
carry the correct payload shape.
- Toasts, preferences stores typed without behaviour change.
- Viewer still routes segment edits through saveTranscriptMeta; the
Task 1.5 TODO markers are gone.
taskExtractor.ts is functionally improved during the migration:
- multi-task matches in the same sentence
- list-style shopping-verb expansion (get bread, milk, and cheese)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import type { AccessibilityPreferences, FontFamily } from "$lib/types/app";
|
|
|
|
const PRETEXT_FONT_FAMILIES = {
|
|
lexend: "'Lexend'",
|
|
atkinson: "'Atkinson Hyperlegible Next'",
|
|
opendyslexic: "'OpenDyslexic'",
|
|
} satisfies Record<FontFamily, string>;
|
|
|
|
export function pretextFontFamily(fontFamily: FontFamily = "lexend"): string {
|
|
return PRETEXT_FONT_FAMILIES[fontFamily] || PRETEXT_FONT_FAMILIES.lexend;
|
|
}
|
|
|
|
export function pretextFontShorthand(
|
|
accessibility: Partial<AccessibilityPreferences> = {},
|
|
sizePx = 16,
|
|
): string {
|
|
return `${sizePx}px ${pretextFontFamily(accessibility.fontFamily)}`;
|
|
}
|
|
|
|
export function bodyPretextLineHeight(
|
|
accessibility: Partial<AccessibilityPreferences> = {},
|
|
sizePx = 16,
|
|
): number {
|
|
const ratio = accessibility.lineHeight || 1.5;
|
|
return Math.round(sizePx * ratio);
|
|
}
|
|
|
|
export function transcriptPretextFont(
|
|
accessibility: Partial<AccessibilityPreferences> = {},
|
|
): string {
|
|
const sizePx = accessibility.transcriptSize || accessibility.fontSize || 16;
|
|
return pretextFontShorthand(accessibility, sizePx);
|
|
}
|
|
|
|
export function transcriptPretextLineHeight(
|
|
accessibility: Partial<AccessibilityPreferences> = {},
|
|
ratio = 1.85,
|
|
): number {
|
|
const sizePx = accessibility.transcriptSize || accessibility.fontSize || 16;
|
|
return Math.round(sizePx * ratio);
|
|
}
|