Phase 2: core converter, live conversion, URL state, highlight interaction

This commit is contained in:
Falkan
2026-03-16 21:34:16 -04:00
parent 65f8bc1b9f
commit 8f835c35d2
9 changed files with 430 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
<script lang="ts">
/**
* UnitInput — controlled numeric input.
* Phase 2: number input only. NL field added in Phase 3.
*/
let {
value,
onchange
}: {
value: number;
onchange: (v: number) => void;
} = $props();
function handleInput(e: Event) {
const input = e.currentTarget as HTMLInputElement;
const parsed = parseFloat(input.value);
if (!isNaN(parsed)) {
onchange(parsed);
}
}
</script>
<input
type="number"
step="any"
value={value}
oninput={handleInput}
aria-label="Input value"
/>