Dwelling in startup opens the novice menu - #201
Merged
Conversation
Add the novice phase to the navigation state machine: dwelling without significant movement during startup arms and fires a mode-dwell timer, opening novice mode at the root menu and dispatching `open`. Movement past `movementsThreshold` still wins the race first, cancelling the timer; the two outcomes stay mutually exclusive. Introduces the runtime's named timer registry (monotonically increasing tokens, armed/cancelled during commit) and generalizes the shared `finish` helper to carry a phase's owned timer and the currently open menu. `LayoutView` and the renderer gain the menu region and the lower-stroke canvas, splitting the accumulated stroke from the current one; the renderer performs the client-to-parent coordinate conversion so the projector stays DOM-free. Novice hit-testing and submenu descent are out of scope: every release in novice mode cancels for now. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FTh6HiCg6Sr9pa9eV5UAe
- Collapse finish()'s select/cancel branches into a single return path, and spread TimerRef into timer.cancel commands instead of restating its fields. - Extract a shared stroke-layer helper in the renderer instead of duplicating the upper/lower stroke canvas logic. - Cache the menu's active key so the renderer only re-scans the menu DOM when it actually changes, matching the existing stroke reference-equality guards. - Merge the runtime's per-command passes that both run during commit (timer scheduling/cancellation and feedback) into one. - Add a small toLocalPoint utility for the client-to-parent coordinate conversion the renderer already needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FTh6HiCg6Sr9pa9eV5UAe
|
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.
Closes #179
Summary
Adds the
novicephase to the navigation state machine: dwelling without significant movement during startup now opens novice mode at the root menu, dispatchingopen. This is the other branch of the decision the tracer bullet (#177) already made — movement pastmovementsThresholdgoes to expert, dwelling goes to novice, and the two stay mutually exclusive, with the first qualifying input winning.This also introduces the runtime's first real timer: a named registry with monotonically increasing tokens, armed and cancelled strictly during commit (never during dispatch), so a superseded timer firing later is a no-op at the machine level.
Key changes
machine.ts: newnovicephase,timer.elapsedinput, andtimer.schedule/timer.cancelcommands.transitionIdlearms amode-dwelltimer onpointer.down;transitionStartupcancels it on significant movement (→ expert) or opens novice mode when it elapses. The sharedfinish()helper now also cancels a phase's owned timer and carries the currently-open menu, so novice'spointer.up/pointer.cancel(alwayscancelfor now — hit-testing isn't implemented yet) reuse the same terminal-transition logic asstartup/expert.runtime.ts: a named timer registry (Map<TimerKind, handle>) interpretstimer.schedule/timer.cancelduring commit, before layout is projected or anything is dispatched.layout-view.ts:LayoutViewgains themenuregion and acursor: 'none'state, and the stroke splits intoupperStroke(fresh, starting at the menu center) andlowerStroke(the accumulated startup stroke).renderer.ts: renders the menu DOM (recreated only when the menu's model reference changes) and a second stroke canvas forlowerStroke. The renderer performs the one DOM-dependent client-to-parent coordinate conversion the projector deliberately leaves to it.controller.ts: newnoviceDwellingTimeconfig option (default1000 / 3, matching the legacy engine).Scope
Novice hit-testing, submenu descent, and the
submenu-dwelltimer are out of scope — no ticket drives them into existence yet. Every release in novice mode cancels for now, since nothing can be active without hit-testing.Test plan
yarn test— 279 tests passingyarn typecheckyarn lintyarn format:checkyarn test:coverage— all files touched by this change are at 100%; overall coverage is above the repo's thresholds (95%/90%/95%/95%)https://claude.ai/code/session_014FTh6HiCg6Sr9pa9eV5UAe
Generated by Claude Code