Components
Two kinds of component:
- Astro components render to HTML at build time and ship no JavaScript.
- Effect UI components (
effect/ui) are interactive. Their logic is Effect code: a pureupdate, Commands for side effects, Queries for data, Layers for services. Each one is mounted into the page bysrc/ui/mount.ts.
Callouts, steps, tabs and code blocks come from Starlight and are themed, not rebuilt.
Exercise · Effect UI
Section titled “Exercise · Effect UI”Pure update, no side effects. Each exercise is one component in src/ui/exercises/, registered in src/ui/mount.ts.
<Exercise name="exhaustive-switch" />Playground · Effect UI
Section titled “Playground · Effect UI”Monaco in an Effect UI mount (AttachEditor). Live errors and hover types come from TypeScript
itself, running in Monaco’s worker. Run (or ⌘ ↵) compiles with the
Compiler service and executes in the Sandbox service: a throwaway Web Worker with a 5 second
limit. With tests, a hidden tests.ts is type-checked against your code and its bun:test
tests run against it. The .js and .d.ts tabs show TypeScript’s own emit.
import starter from "../exercises/m2-exhaustive/main.starter.ts?raw"import tests from "../exercises/m2-exhaustive/main.test.ts?raw"
<Playground id="m2-exhaustive" title="Exercise" file="relay/events.ts" code={starter} tests={tests} />ModuleProgress · Effect UI
Section titled “ModuleProgress · Effect UI”Reads progress through a Query (GetProgress) and writes it with a Command (ToggleLesson),
both backed by a ProgressStore service over KeyValueStore (localStorage in the browser,
memory in tests). The toggle invalidates the query, so the list refreshes itself.
<ModuleProgress module="m2" title="M2 · Modeling the domain" current="m2/discriminated-unions" />Starlight built-ins, themed
Section titled “Starlight built-ins, themed”- Write the failing test.
- Make it pass.
- Run
tsc --noEmit.
bun testbunx tsc --noEmitKeys use the native element: ⌘ K opens search.