2 Commits

Author SHA1 Message Date
Fredrik Johansson
0828ef473d Expand snippet pool with more code and add lore/flavor text
All checks were successful
Docker / build-and-push (push) Successful in 37s
8 more entries (16 total, up from 8): three more code snippets across
delve-term/stash/goonk for variety, plus five real lore/flavor text
fragments -- two from adventure's Chronicle of the Keepers (English)
and three from djupet's event log (Swedish, on purpose -- genuinely
different character set, and it's real shipped content, not filler).

Added a `type` field (code/lore) to every entry for future use (could
filter by type later) and updated the header/help-modal copy to stop
saying "code" exclusively now that it isn't.

Verified via simulated typing: a full Swedish snippet (öäå included)
types and finishes correctly with 100% accuracy, and a lore snippet
renders and completes the same as any code one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-15 14:33:54 +02:00
Fredrik Johansson
4192a05a78 Initial build: typo, a typing test built from your own code
No backend, no build step -- static HTML/CSS/JS, themed identically to
flit/wisp (same CSS vars, same "> " title prefix, same dark/mono/green
aesthetic). Snippets are real, shipped code pulled from six repos in
this family (flit, wisp, keep, stash, delve-term, goonk) rather than
generic pangrams.

Stats: WPM = (correct chars / 5) / minutes elapsed, timing from first
keystroke not page load. Accuracy = correct keystrokes / total
keystrokes tracked at the keydown level (comparing the pressed key
against the exact next expected character before it's inserted), so
backspaced-over mistakes still count against it rather than only
diffing the final text. Keys/sec updates live via a 200ms tick.
Tabs in source are rendered as two spaces so players never need to
press Tab -- sidesteps a browser default-Tab-moves-focus fight
entirely rather than fighting it with preventDefault.

Verified via simulated typing sessions (puppeteer), not just static
review -- both an artificially fast pass (confirms the math is
internally consistent: 308 correct/310 total keystrokes -> 99%,
matches displayed) and a realistic ~60wpm-paced pass (confirms no
unit-conversion bug that only a slow, deliberate typist would hit
tests-at-lightspeed wouldn't surface). That process caught two real
bugs before they'd have hit a real player:

1. A stray `tabindex="0"` on the code display let the browser's
   native click-to-focus behavior steal focus away from the hidden
   textarea before our own focus() call ran -- typing silently did
   nothing. Fixed by removing the tabindex and switching to a
   mousedown+preventDefault handler instead of click.
2. The help modal's CSS set `display: flex` unconditionally, which
   (author CSS always beats the UA stylesheet) overrode the `hidden`
   attribute's default `display: none` -- the modal was invisibly
   covering the entire viewport and intercepting every click, at all
   times, whether or not it had been opened. Fixed with an explicit
   `.modal-overlay:not([hidden])` rule.

Also verified the actual Docker image builds and serves correctly
(nginx, no build stage needed since there's nothing to compile).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-15 14:12:44 +02:00