Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
44 changes: 44 additions & 0 deletions .changeset/app-hotkeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
'@tanstack/hotkeys': minor
'@tanstack/hotkeys-devtools': minor
'@tanstack/react-hotkeys': minor
'@tanstack/preact-hotkeys': minor
'@tanstack/solid-hotkeys': minor
'@tanstack/vue-hotkeys': minor
'@tanstack/svelte-hotkeys': minor
'@tanstack/angular-hotkeys': minor
'@tanstack/lit-hotkeys': minor
'@tanstack/alpine-hotkeys': minor
'@tanstack/ember-hotkeys': minor
'@tanstack/octane-hotkeys': minor
---

Hotkeys now include sequences everywhere, and app hotkeys can be declared up front and customized by users.

- A hotkey is a chord (`'Mod+S'`) or a sequence (`['G', 'G']`). Every adapter's hotkey and hotkeys APIs, `HotkeyManager.register`, `formatForDisplay`, `areHotkeysEqual`, `validateHotkey`, and hints accept both. A one-step sequence is its chord. Chords accept `requireReset`; sequences accept `timeout`, enforced by types.
- Every adapter's recorder records sequences with `maxSteps` (default 1).
- `defineAppHotkeys` declares every app hotkey. Pass them to the adapter's provider as `appHotkeys`, with optional `customHotkeys` and `onCustomHotkeysChange` to persist user changes. Each adapter can read and change them through its app hotkeys, app hotkey list, and custom hotkeys APIs (for example, React's `useAppHotkeys`, `useAppHotkeyList`, and `useCustomHotkeys`). Lit, Alpine, and Ember, which have no provider, use `provideAppHotkeys`. Devtools list declared hotkeys that are not registered.

Breaking changes (React names shown; other adapters follow their own naming, such as `createHotkey`, `injectHotkey`, or `HotkeyController`):

| Before | After |
| ------------------------------------------------------------------------ | --------------------------------------------------------------- |
| `Hotkey` (one chord) | `HotkeyChord`; `Hotkey` is now a chord or a sequence |
| `SequenceManager`, `getSequenceManager()` | `HotkeyManager`, `getHotkeyManager()` |
| `useHotkeySequence(sequence, cb, options)` | `useHotkey(sequence, cb, options)` |
| `useHotkeySequences([{ sequence, callback }])` | `useHotkeys([{ hotkey: sequence, callback }])` |
| `useHotkeySequenceRecorder(options)`, `HotkeySequenceRecorder` | `useHotkeyRecorder({ maxSteps, ...options })`, `HotkeyRecorder` |
| Lit `@hotkeySequence`, `HotkeySequenceController` | `@hotkey`, `HotkeyController` |
| Lit `HotkeySequenceRecorderController` | `HotkeyRecorderController` with `maxSteps` |
| `useHotkeyRegistrations()` → `{ hotkeys, sequences }` | One list of chords and sequences; narrow with `kind` |
| `SequenceRegistrationView.sequence` | `HotkeySequenceRegistrationView.hotkey` |
| `HotkeyConflict.type` | `HotkeyConflict.registration.kind` |
| Sequence callback `context.hotkey` (`'G G'`) | `context.hotkey` (`['G', 'G']`) |
| `defaultOptions.hotkeySequence`, `defaultOptions.hotkeySequenceRecorder` | `defaultOptions.hotkey`, `defaultOptions.hotkeyRecorder` |
| Vue `provideHotkeysContext(defaultOptions)` | `provideHotkeysContext({ defaultOptions, appHotkeys, ... })` |
| Svelte `setHotkeysContext(defaultOptions)` | `setHotkeysContext({ defaultOptions, appHotkeys, ... })` |
| Angular `provideHotkeys(defaultOptions)` | `provideHotkeys({ defaultOptions, appHotkeys, ... })` |
| `HotkeyDefinition` (core) | Each adapter's definition type, such as `UseHotkeyDefinition` |
| `createHotkeySequenceBindings` (adapter) | `createHotkeyBindings` |
| `formatHotkeySequence`, `formatWithLabels` | `formatForDisplay` |
| `SequenceManager.resetAll()` | `HotkeyManager.resetSequenceProgress()` |
5 changes: 5 additions & 0 deletions .changeset/solid-hotkeys-devtools-production.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/solid-hotkeys-devtools': patch
---

Export the active devtools panel and plugin from `@tanstack/solid-hotkeys-devtools/production` instead of the no-op versions.
Loading
Loading