tutorials/frontend: add 03-japanese-verb-tower build-through#40
Open
jbeshir wants to merge 1 commit into
Open
Conversation
Build-through tutorial covering the pure algorithmic conjugation engine, a Cloudflare Worker AI backend (run_worker_first + Workers AI), debounced abortable fetch with graceful degradation, lazy code-split corpus loading, bidirectional URL state, and romaji input transformation. Adds the README track row. Progressive: references frontend 01 and 02 for known concepts.
This was referenced Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Frontend (Preact) build-through tutorial for the japanese-verb-tower widget — entry 03 in the
tutorials/frontend/track. Live widget: https://japanese-verb-tower.widgets.beshir.orgBuilds on 01-function-plotter and 02-image-comparison-table: concepts in their ledgers (Preact/Vite stack,
render,#widget-ready, hook basics, controlled inputs,ResizeObserver; multi-component composition + lifting state, typedProps, URL-driven read-only view selection, lazyuseStateinitialiser, typed data registry,useLayoutEffect, fit-to-viewport, functionalsetState,<dialog>/showModal(), popover dismissal,document.title,useMemofor stable identity) are named and linked, not re-taught. All CSS/visual concerns are cross-linked to the design track (../design/03).New frontend ground this entry teaches:
Opinterface +reg()self-registration,buildTower()as a left-fold threading aForm, recursive form composition (voice ops return{ type: 'ichidan' }so the whole rule-set reuses with no special cases), stem helpers dispatching onform.type,allowedOps()as a pure structural legal-move guard,finalForm()replay. The centrepiece.run_worker_first+not_found_handling: "single-page-application"), an isolatedtsconfig.worker.json, the Workers AI binding (env.AI.run('@cf/qwen/qwen3-30b-a3b-fp8', …)), and the in-Worker abuse guard (Sec-Fetch-Sitecross-site reject, rate-limit binding, Cache API memoization viactx.waitUntil(), input caps,/no_think+<think>stripping).AbortControllertogether with anactiveflag (and why each alone is insufficient); a synchronous cache short-circuit; a two-tierMap+localStoragecache; best-effort translation that never blocks functionality or#widget-ready.import()of the 26,784-verb corpus after first paint with a silent.catchfallback to the inline 300-verb sample.history.replaceState, restore + re-validate throughallowedOpson load (extends 02's read-only view selection).romajiToKana()wāpuro greedy longest-match (sokuon, ん disambiguation), a tiered search ranking, anddeconjugate()reverse-conjugation that reuses the engine to forward-verify.tsxrunner + committedgolden.json+ forward-verification), the payoff of keeping the engine framework-free.Every code excerpt and
file:lineanchor was verified against the widget's real source by an adversarial review stage (PASS round 2). Round 1 caught a real factual blocker — the demo-verb table had copied the widget's stale README (which lists 見る), but the code actually features 帰る (FEATURED_KANJI,morph.ts:185); the tutorial now follows the code and notes 帰る's godan-in-ichidan-clothing trap.🤖 Generated with Claude Code