Repository navigation
Add mountMockAreas and note native-link Enter handling - #1
Merged
Merged
Conversation
mountMockAreas re-parents the fictional mock areas under a caller-supplied university so consumers can drop the hand-written seed wiring. The README notes that gridAction is not on the activate path for native links once Enter is removed from the keymap. Co-authored-by: Oskar Freye <oskar@freye.tech>
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.
Summary
mountMockAreasfrom@draht/hex/adapters. Pass a university level (for example{ ref: { kind: 'university', id: 'uni' }, title: 'Uni' }) and it returns aKnowledgeSeedwhose root is that level, with each fictional mock area'sparentset to it. Person levels under those areas, and the cells and links that belong to the areas and persons, are copied.MOCK_KNOWLEDGEand the level you pass in are not mutated. The mock university and the cells on its grid stay out, so the root grid is empty for the app's own cells; the areas are children of the root (listChildren, breadcrumbs).gridActionis not needed foractivateon native links whenEnteris removed from the keymap. This matches the code.lookupBindingtriescodefirst, thenkey, and the default entry is namedEnter, so dropping that entry makeskeyIntentreturn null for the Enter key and for Numpad Enter (code: 'NumpadEnter',key: 'Enter'). A listener that callspreventDefaultandgridActiononly whenkeyIntentis non-null leaves the key to the browser, which follows the link. Space stays anactivatebinding, and a native link does not follow on Space, so Space still goes throughgridAction. The note sits with the keymap rules and next to thegridActionactivate description.Test plan
bun run check: TypeScript 6.x typecheck, TypeScript 5.9 typecheck, andbun test(110 pass, 0 fail), including the newmountMockAreastests and a keymap test that Enter and Numpad Enter are unbound once theEnterentry is removedNo version bump and no publish.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit
New Features
Documentation
Enterfrom a custom keymap affects native link activation.Spaceremains an activation key unless removed separately.