Files
typo/README.md
Fredrik Johansson 0828ef473d
All checks were successful
Docker / build-and-push (push) Successful in 37s
Expand snippet pool with more code and add lore/flavor text
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

64 lines
2.0 KiB
Markdown

# typo
A typing test built from your own code. Every snippet is real, shipped
code pulled from real repos — flit, wisp, keep, stash, delve-term, goonk
itself — not generic pangrams or Lorem Ipsum.
No backend, no build step — plain HTML/CSS/JS served statically, with
snippets baked into `snippets.json`.
## Stats
- **WPM** — (correct characters / 5) / minutes elapsed, the standard
typing-test formula. Timing starts on the first keystroke, not page load.
- **Accuracy** — correct keystrokes / total keystrokes, including ones you
backspaced over. Tracked at the keydown level (comparing the pressed key
against the exact next expected character), not just diffed after the
fact.
- **Keys/sec** — total keystrokes / elapsed seconds, live.
Mistakes are highlighted in place rather than blocking progress — you can
backspace to fix them or keep going, same as most real typing tests.
Tabs in the original source are shown as two spaces so you never need to
press Tab.
## Adding snippets
Edit `snippets.json` — each entry is `{ repo, file, lang, code }`. Keep
snippets short (10-20 lines), self-contained, and free of exotic
Unicode in comments (em dashes etc. are typeable but annoying) if you
want them pleasant to type.
## Local development
Run with npm:
```bash
npm install
npm run dev
```
This serves the app on `http://localhost:8850`.
Any static file server still works, e.g.:
```bash
python3 -m http.server 8850
```
## Status
Built and verified via simulated typing sessions (not just static
review): focus handling, live character-by-character highlighting,
newline handling for multi-line snippets, and the WPM/accuracy/KPS math
all confirmed against both artificially fast and realistic human-speed
input. Caught and fixed two real bugs in the process — a focus-stealing
issue caused by a stray `tabindex` on the code display, and a modal
overlay that was invisibly covering the whole page and intercepting
every click because its CSS unconditionally overrode the `hidden`
attribute.
## License
MIT.