Repository navigation
feat(hotkeys): Add hotkey scopes, chord and sequence naming, and new guides - #189
Conversation
…guides - Add hotkey scopes: HotkeyManager.activateScope, exclusive scopes, scope state, and scope props on every framework provider. - Name types and functions by chord or sequence, and give callbacks a chord or sequence context. - Sequences call preventDefault on every step and clear their progress when the timeout passes. - Restructure the guides for every framework, add Hotkey Manager, Cheat Sheet UI Helpers, Hotkey Hints, and provider and scopes guides, and rename guide files to match their sidebar labels.
🦋 Changeset detectedLatest commit: cd950eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedToo many files! This PR contains 357 files, which is 207 over the limit of 150. To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files. ⚙️ Run configuration
⛔ Files ignored due to path filters: 252
📒 Files selected for processing: 357
You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Changeset Version Preview12 package(s) bumped directly, 6 bumped as dependents. 🟥 Major bumps
🟨 Minor bumps
🟩 Patch bumps
|
@tanstack/alpine-hotkeys
@tanstack/angular-hotkeys
@tanstack/angular-hotkeys-devtools
@tanstack/ember-hotkeys
@tanstack/hotkeys
@tanstack/hotkeys-devtools
@tanstack/lit-hotkeys
@tanstack/octane-hotkeys
@tanstack/preact-hotkeys
@tanstack/preact-hotkeys-devtools
@tanstack/react-hotkeys
@tanstack/react-hotkeys-devtools
@tanstack/solid-hotkeys
@tanstack/solid-hotkeys-devtools
@tanstack/svelte-hotkeys
@tanstack/svelte-hotkeys-devtools
@tanstack/vue-hotkeys
@tanstack/vue-hotkeys-devtools
commit: |
- Bump the scopes examples to the hotkeys and devtools versions the other examples use, so sherif passes after merging main. - Change "alpha" to "beta" in the README status notes and the docs overview.
🎯 Changes
Hotkey scopes
'global'is the default and is always active. Passscopeto put a hotkey in another scope.HotkeyManager.activateScope(scope, { exclusive, parent })activates a scope until you call the function it returns. When two active scopes match the same key, a nested scope beats the scopes around it, and otherwise the newest scope wins.'global'.exclusive: { allow: [...] }keeps some scopes working.HotkeyManager.scopespublishes active, suspended, allowed, and exclusive scopes.isScopeActive(scope)reports whether a scope can fire.HotkeysProvidertakesscope,exclusive, andenabledin React, Preact, Solid, Vue, Svelte, and Octane. Angular'sprovideHotkeys, Vue'sprovideHotkeysContext, and Svelte'ssetHotkeysContexttake the same options. Lit, Alpine, and Ember activate scopes through the manager.scope. App hotkeys in different scopes can share a key, and the app hotkey list reports'suspended'for app hotkeys whose registrations are all in inactive scopes.scopesexamples for React, Preact, Solid, Vue, Svelte, Angular, and Octane.Chord and sequence naming (breaking, beta)
RawHotkey→RawHotkeyChord,ParsedHotkey→ParsedHotkeyChord,parsedHotkey→parsedChord, and the handler helpers gainChordin their names.{ kind: 'chord', hotkey, parsedChord }or{ kind: 'sequence', hotkey, parsedSequence }. Single-hotkey APIs type the context from the hotkey you pass. The recorder'svalidatecontext is split the same way.parseHotkey,normalizeHotkey, andformatHotkeyaccept chords and sequences, replacing several near-duplicate functions.Sequence behavior
preventDefault, soMod+Kin['Mod+K', 'Mod+C']no longer reaches the browser.stopPropagationstill applies only on the last step.Docs
hotkey-recordingandkey-state-trackingare nowcustom-hotkey-recordingandheld-key-state-helpers, withredirect_fromfor the old URLs.maxStepsas1(chord) orInfinity(sequence).Changesets:
chord-and-sequence-naming.mdandhotkey-scopes.md.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact