Fix wave round 2: serif toggle actually toggles; empty number settings stay empty
- The session-name-serif toggle looked dead because --font-title was an
@theme INLINE token: the .font-title utility carried a baked copy of the
family, so the runtime var the toggle wrote was never read by any
consumer. Moved --font-title to a plain @theme block — the utility now
reads var(--font-title) and the :root factory default emits — the toggle
flips the session name's computed font (lh-cmu ↔ Source Sans 3).
- Empty reading-font-size and heading-weight commits wrote the clamp
minimum (Number("") is 0 → 12 / 100) instead of unsetting. Empty now
omits the key — absence is the delta schema's unset for numbers — so the
field stays empty, the record unsets, and the hint carries the resolved
default (16px / 900). Typed values still clamp visibly (-5 → 12).
Gates: tsc clean, 866/866, lint 0, build ok. Live-verified on :3001.
This commit is contained in:
@@ -73,6 +73,13 @@ export function AppearanceSection({
|
||||
ariaLabel="prose font size"
|
||||
testid="input-prose-size"
|
||||
onCommit={(v) => {
|
||||
// Empty = factory default (owner, fix wave): omit the key so the record
|
||||
// UNSETS and the field stays empty (absence, not null, is the
|
||||
// unset for numbers). Number("") is 0, so the old clamp wrote 12.
|
||||
if (v === "") {
|
||||
onSectionChange({ ...appearance, proseFontSize: undefined });
|
||||
return;
|
||||
}
|
||||
const n = Number(v);
|
||||
if (!Number.isFinite(n)) return; // bad input: no write, factory stays
|
||||
onSectionChange({ ...appearance, proseFontSize: Math.min(24, Math.max(12, Math.round(n))) });
|
||||
@@ -94,6 +101,12 @@ export function AppearanceSection({
|
||||
ariaLabel="heading weight"
|
||||
testid="input-heading-weight"
|
||||
onCommit={(v) => {
|
||||
// Empty = factory default (owner, fix wave): Number("") is 0, so
|
||||
// Absence is the unset representation — the old clamp wrote 100.
|
||||
if (v === "") {
|
||||
onSectionChange({ ...appearance, mdRendering: { ...md, headingWeight: undefined } });
|
||||
return;
|
||||
}
|
||||
const n = Number(v);
|
||||
if (!Number.isFinite(n)) return;
|
||||
onSectionChange({
|
||||
|
||||
Reference in New Issue
Block a user