feat: Add SolidJS adapter packages#12
Open
Peyton-Spencer wants to merge 4 commits intoTanStack:mainfrom
Open
Conversation
This PR adds two new packages for SolidJS support: ## @tanstack/solid-hotkeys Full-featured SolidJS adapter for TanStack Hotkeys with reactive primitives: - `createHotkey()` - Register keyboard shortcuts - `createHotkeySequence()` - Vim-style multi-key sequences - `createHeldKeys()` / `createKeyHold()` - Track key state - `createHotkeyRecorder()` - Built-in hotkey recording UI - `HotkeysProvider` - Global configuration context Features: ✅ Type-safe hotkey bindings ✅ Cross-platform `Mod` key support ✅ Sequence support (e.g., `g g`, `d d`) ✅ Key state tracking ✅ Hotkey recording ✅ SolidJS reactive primitives ## @tanstack/solid-hotkeys-devtools Devtools stub for SolidJS (placeholder for future implementation). Currently provides no-op components until @tanstack/devtools-utils adds SolidJS support. Both packages follow TanStack conventions: - Workspace dependencies - tsdown build configuration - Matching structure to react-hotkeys packages - Full TypeScript support with JSX preservation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@tanstack/hotkeys
@tanstack/hotkeys-devtools
@tanstack/react-hotkeys
@tanstack/react-hotkeys-devtools
@tanstack/solid-hotkeys
@tanstack/solid-hotkeys-devtools
commit: |
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
This PR adds two new packages to bring SolidJS support to TanStack Hotkeys:
📦 @tanstack/solid-hotkeys
Full-featured SolidJS adapter with reactive primitives:
createHotkey()- Register keyboard shortcuts with reactive optionscreateHotkeySequence()- Vim-style multi-key sequences (e.g.,g g,d d)createHeldKeys()/createKeyHold()- Track which keys are currently heldcreateHotkeyRecorder()- Built-in UI for letting users define their own shortcutsHotkeysProvider- Global configuration context🛠️ @tanstack/solid-hotkeys-devtools
Devtools stub for SolidJS (placeholder for future implementation). Currently provides no-op components until
@tanstack/devtools-utilsadds SolidJS support.Features
✅ Type-safe hotkey bindings - Template strings or parsed objects
✅ Cross-platform -
Modkey automatically maps to Cmd on macOS, Ctrl on Windows/Linux✅ Sequence support - Multi-key combos like Vim
✅ Key state tracking - Know which keys are held down
✅ Hotkey recording - Built-in UI helpers
✅ SolidJS primitives - Reactive primitives that work seamlessly with SolidJS
Implementation Details
Both packages follow TanStack conventions:
workspace:*tsdownbuild configuration matchingreact-hotkeysThe implementation is based on the existing React adapter but adapted for SolidJS's reactive primitive patterns (
createEffect,createSignal,onCleanup, etc.).Example Usage
```tsx
import { createHotkey } from "@tanstack/solid-hotkeys";
function App() {
createHotkey("Mod+S", (event) => {
event.preventDefault();
console.log("Save!");
});
return
}
```
Testing
The packages build successfully and follow the same patterns as the existing React adapter. Unit tests can be added in a follow-up PR once the core functionality is reviewed.
Related
@tanstack/react-hotkeysadapterNote: The devtools package is a stub awaiting
@tanstack/devtools-utilsto add SolidJS support. Once that's available, we can implement the full devtools panel.