[ui] LetterSlot: Add the page for A Letter from the Gardener, shown once the author writes it

docs/LETTER.md holds slots as comments only, so the player sees no change
until the author writes. The app bundles the letter at build time, a small
Markdown subset renders without {@html}, only https: and tel: become links,
and lint:copy now reads the letter. Review found turbo replaying a stale
build after the letter changed; docs/LETTER.md is now in its cache key.
This commit is contained in:
2026-11-01 15:39:17 +01:00
parent b871ab9899
commit a200832cfb
23 changed files with 639 additions and 21 deletions
+15
View File
@@ -20,3 +20,18 @@ fixed the same way. Check with `grep -n $'\xc2\xa0' file` (the two UTF-8 bytes)
`sed -n Np file | od -c`. Do not use `grep -P '\xA0'`: it matches the last byte of `≠`
and other characters, and raised a false alarm on the review document. Keep
`no-irregular-whitespace` on.
## A Svelte 5 effect that short-circuits never tracks what it skipped
**What happened.** `Shell.svelte` moved focus with
`$effect(() => { if (moved) heading?.focus(); })`. `moved` is a plain variable and was
`false` on the first run, so the effect never read `heading` and had no dependencies.
When the view changed and `heading` was bound to the new `<h1>`, nothing re-ran. The
Shell test caught it: the focus stayed on `<body>`.
**Why it bit.** An effect tracks only the state it actually reads on each run. A
condition that returns early hides every read after it.
**How to apply it.** In an effect, read the state you depend on before any early
return or `&&` (`const target = heading; if (moved) target?.focus();`). Test the
re-run, not just the first run.