Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/numpad-keys-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/hotkeys': minor
---

Add numpad key support with NumpadKey type including Numpad0-9, NumpadAdd, NumpadSubtract, NumpadMultiply, NumpadDivide, NumpadDecimal, and NumpadEnter
2 changes: 1 addition & 1 deletion docs/reference/functions/detectPlatform.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: detectPlatform
function detectPlatform(): "mac" | "windows" | "linux";
```

Defined in: [constants.ts:30](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L30)
Defined in: [constants.ts:31](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L31)

Detects the current platform based on browser navigator properties.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/functions/normalizeKeyName.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: normalizeKeyName
function normalizeKeyName(key): string;
```

Defined in: [constants.ts:422](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L422)
Defined in: [constants.ts:471](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L471)

Normalizes a key name to its canonical form.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/functions/resolveModifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: resolveModifier
function resolveModifier(modifier, platform): CanonicalModifier;
```

Defined in: [constants.ts:155](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L155)
Defined in: [constants.ts:156](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L156)

Resolves the platform-adaptive 'Mod' modifier to the appropriate canonical modifier.

Expand Down
2 changes: 2 additions & 0 deletions docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ title: "@tanstack/hotkeys"
- [Modifier](type-aliases/Modifier.md)
- [NavigationKey](type-aliases/NavigationKey.md)
- [NumberKey](type-aliases/NumberKey.md)
- [NumpadKey](type-aliases/NumpadKey.md)
- [PunctuationKey](type-aliases/PunctuationKey.md)
- [RegisterableHotkey](type-aliases/RegisterableHotkey.md)

Expand All @@ -60,6 +61,7 @@ title: "@tanstack/hotkeys"
- [MODIFIER\_ORDER](variables/MODIFIER_ORDER.md)
- [NAVIGATION\_KEYS](variables/NAVIGATION_KEYS.md)
- [NUMBER\_KEYS](variables/NUMBER_KEYS.md)
- [NUMPAD\_KEYS](variables/NUMPAD_KEYS.md)
- [PUNCTUATION\_KEYS](variables/PUNCTUATION_KEYS.md)
- [STANDARD\_MODIFIER\_LABELS](variables/STANDARD_MODIFIER_LABELS.md)

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/interfaces/FormatDisplayOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: FormatDisplayOptions

# Interface: FormatDisplayOptions

Defined in: [hotkey.ts:367](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L367)
Defined in: [hotkey.ts:390](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L390)

Options for formatting hotkeys for display.

Expand All @@ -17,6 +17,6 @@ Options for formatting hotkeys for display.
optional platform: "mac" | "windows" | "linux";
```

Defined in: [hotkey.ts:369](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L369)
Defined in: [hotkey.ts:392](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L392)

The target platform. Defaults to auto-detection.
6 changes: 3 additions & 3 deletions docs/reference/interfaces/HotkeyCallbackContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: HotkeyCallbackContext

# Interface: HotkeyCallbackContext

Defined in: [hotkey.ts:387](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L387)
Defined in: [hotkey.ts:410](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L410)

Context passed to hotkey callbacks along with the keyboard event.

Expand All @@ -17,7 +17,7 @@ Context passed to hotkey callbacks along with the keyboard event.
hotkey: Hotkey;
```

Defined in: [hotkey.ts:389](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L389)
Defined in: [hotkey.ts:412](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L412)

The original hotkey string that was registered

Expand All @@ -29,6 +29,6 @@ The original hotkey string that was registered
parsedHotkey: ParsedHotkey;
```

Defined in: [hotkey.ts:391](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L391)
Defined in: [hotkey.ts:414](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L414)

The parsed representation of the hotkey
14 changes: 7 additions & 7 deletions docs/reference/interfaces/ParsedHotkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: ParsedHotkey

# Interface: ParsedHotkey

Defined in: [hotkey.ts:308](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L308)
Defined in: [hotkey.ts:331](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L331)

A parsed representation of a hotkey string.

Expand Down Expand Up @@ -33,7 +33,7 @@ useHotkey(parsed, handler) // Works even if userInput isn't in Hotkey type
alt: boolean;
```

Defined in: [hotkey.ts:316](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L316)
Defined in: [hotkey.ts:339](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L339)

Whether the Alt key is required

Expand All @@ -45,7 +45,7 @@ Whether the Alt key is required
ctrl: boolean;
```

Defined in: [hotkey.ts:312](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L312)
Defined in: [hotkey.ts:335](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L335)

Whether the Control key is required

Expand All @@ -57,7 +57,7 @@ Whether the Control key is required
key: Key | string & object;
```

Defined in: [hotkey.ts:310](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L310)
Defined in: [hotkey.ts:333](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L333)

The non-modifier key (e.g., 'S', 'Escape', 'F1', '/', '['). Can be any string for flexibility.

Expand All @@ -69,7 +69,7 @@ The non-modifier key (e.g., 'S', 'Escape', 'F1', '/', '['). Can be any string fo
meta: boolean;
```

Defined in: [hotkey.ts:318](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L318)
Defined in: [hotkey.ts:341](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L341)

Whether the Meta (Command) key is required

Expand All @@ -81,7 +81,7 @@ Whether the Meta (Command) key is required
modifiers: CanonicalModifier[];
```

Defined in: [hotkey.ts:320](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L320)
Defined in: [hotkey.ts:343](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L343)

List of canonical modifier names that are required, in canonical order

Expand All @@ -93,6 +93,6 @@ List of canonical modifier names that are required, in canonical order
shift: boolean;
```

Defined in: [hotkey.ts:314](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L314)
Defined in: [hotkey.ts:337](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L337)

Whether the Shift key is required
14 changes: 7 additions & 7 deletions docs/reference/interfaces/RawHotkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: RawHotkey

# Interface: RawHotkey

Defined in: [hotkey.ts:343](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L343)
Defined in: [hotkey.ts:366](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L366)

A raw hotkey object for programmatic registration.

Expand Down Expand Up @@ -35,7 +35,7 @@ useHotkey({ key: 'S', mod: true, shift: true }, handler) // Mod+Shift+S
optional alt: boolean;
```

Defined in: [hotkey.ts:353](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L353)
Defined in: [hotkey.ts:376](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L376)

Whether the Alt key is required. Defaults to false.

Expand All @@ -47,7 +47,7 @@ Whether the Alt key is required. Defaults to false.
optional ctrl: boolean;
```

Defined in: [hotkey.ts:349](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L349)
Defined in: [hotkey.ts:372](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L372)

Whether the Control key is required. Defaults to false.

Expand All @@ -59,7 +59,7 @@ Whether the Control key is required. Defaults to false.
key: Key | string & object;
```

Defined in: [hotkey.ts:345](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L345)
Defined in: [hotkey.ts:368](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L368)

The non-modifier key (e.g., 'S', 'Escape', 'F1').

Expand All @@ -71,7 +71,7 @@ The non-modifier key (e.g., 'S', 'Escape', 'F1').
optional meta: boolean;
```

Defined in: [hotkey.ts:355](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L355)
Defined in: [hotkey.ts:378](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L378)

Whether the Meta (Command) key is required. Defaults to false.

Expand All @@ -83,7 +83,7 @@ Whether the Meta (Command) key is required. Defaults to false.
optional mod: boolean;
```

Defined in: [hotkey.ts:347](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L347)
Defined in: [hotkey.ts:370](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L370)

Platform-adaptive modifier: Command on macOS, Control on Windows/Linux. Defaults to false.

Expand All @@ -95,6 +95,6 @@ Platform-adaptive modifier: Command on macOS, Control on Windows/Linux. Defaults
optional shift: boolean;
```

Defined in: [hotkey.ts:351](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L351)
Defined in: [hotkey.ts:374](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L374)

Whether the Shift key is required. Defaults to false.
8 changes: 4 additions & 4 deletions docs/reference/interfaces/ValidationResult.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: ValidationResult

# Interface: ValidationResult

Defined in: [hotkey.ts:375](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L375)
Defined in: [hotkey.ts:398](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L398)

Result of validating a hotkey string.

Expand All @@ -17,7 +17,7 @@ Result of validating a hotkey string.
errors: string[];
```

Defined in: [hotkey.ts:381](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L381)
Defined in: [hotkey.ts:404](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L404)

Error messages about invalid syntax

Expand All @@ -29,7 +29,7 @@ Error messages about invalid syntax
valid: boolean;
```

Defined in: [hotkey.ts:377](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L377)
Defined in: [hotkey.ts:400](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L400)

Whether the hotkey is valid (can still have warnings)

Expand All @@ -41,6 +41,6 @@ Whether the hotkey is valid (can still have warnings)
warnings: string[];
```

Defined in: [hotkey.ts:379](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L379)
Defined in: [hotkey.ts:402](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L402)

Warning messages about potential issues
2 changes: 1 addition & 1 deletion docs/reference/type-aliases/HeldKey.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: HeldKey
type HeldKey = CanonicalModifier | Key;
```

Defined in: [hotkey.ts:154](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L154)
Defined in: [hotkey.ts:177](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L177)

Keys that can be tracked as "held" (pressed down).
Includes both modifier keys and regular keys.
2 changes: 1 addition & 1 deletion docs/reference/type-aliases/Hotkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Hotkey =
| FourModifierHotkey;
```

Defined in: [hotkey.ts:283](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L283)
Defined in: [hotkey.ts:306](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L306)

A type-safe hotkey string.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/type-aliases/HotkeyCallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: HotkeyCallback
type HotkeyCallback = (event, context) => void;
```

Defined in: [hotkey.ts:408](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L408)
Defined in: [hotkey.ts:431](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L431)

Callback function type for hotkey handlers.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/type-aliases/Key.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ title: Key
type Key = NonPunctuationKey | PunctuationKey;
```

Defined in: [hotkey.ts:148](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L148)
Defined in: [hotkey.ts:171](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L171)

All supported non-modifier keys.
31 changes: 31 additions & 0 deletions docs/reference/type-aliases/NumpadKey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
id: NumpadKey
title: NumpadKey
---

# Type Alias: NumpadKey

```ts
type NumpadKey =
| "Numpad0"
| "Numpad1"
| "Numpad2"
| "Numpad3"
| "Numpad4"
| "Numpad5"
| "Numpad6"
| "Numpad7"
| "Numpad8"
| "Numpad9"
| "NumpadAdd"
| "NumpadSubtract"
| "NumpadMultiply"
| "NumpadDivide"
| "NumpadDecimal"
| "NumpadEnter";
```

Defined in: [hotkey.ts:132](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L132)

Numpad keys for numeric keypad operations.
These keys are commonly used for data entry and calculator-style input.
2 changes: 1 addition & 1 deletion docs/reference/type-aliases/RegisterableHotkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: RegisterableHotkey
type RegisterableHotkey = Hotkey | RawHotkey;
```

Defined in: [hotkey.ts:362](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L362)
Defined in: [hotkey.ts:385](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey.ts#L385)

A hotkey that can be passed to `HotkeyManager.register()` and `useHotkey()`.
Either a type-safe string (`Hotkey`) or a raw object (`RawHotkey`).
5 changes: 3 additions & 2 deletions docs/reference/variables/ALL_KEYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ const ALL_KEYS: Set<
| FunctionKey
| NavigationKey
| EditingKey
| PunctuationKey>;
| PunctuationKey
| NumpadKey>;
```

Defined in: [constants.ts:317](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L317)
Defined in: [constants.ts:347](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L347)

Set of all valid non-modifier keys.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/variables/EDITING_KEYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: EDITING_KEYS
const EDITING_KEYS: Set<EditingKey>;
```

Defined in: [constants.ts:270](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L270)
Defined in: [constants.ts:271](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L271)

Set of all valid editing and special keys.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/variables/FUNCTION_KEYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: FUNCTION_KEYS
const FUNCTION_KEYS: Set<FunctionKey>;
```

Defined in: [constants.ts:230](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L230)
Defined in: [constants.ts:231](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L231)

Set of all valid function keys (F1-F12).

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/variables/KEY_DISPLAY_SYMBOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: KEY_DISPLAY_SYMBOLS
const KEY_DISPLAY_SYMBOLS: Record<string, string>;
```

Defined in: [constants.ts:505](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L505)
Defined in: [constants.ts:554](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L554)

Special key symbols for display formatting.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/variables/LETTER_KEYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: LETTER_KEYS
const LETTER_KEYS: Set<LetterKey>;
```

Defined in: [constants.ts:175](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L175)
Defined in: [constants.ts:176](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L176)

Set of all valid letter keys (A-Z).

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/variables/MAC_MODIFIER_SYMBOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: MAC_MODIFIER_SYMBOLS
const MAC_MODIFIER_SYMBOLS: Record<CanonicalModifier, string>;
```

Defined in: [constants.ts:461](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L461)
Defined in: [constants.ts:510](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L510)

Modifier key symbols for macOS display.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/variables/MODIFIER_ALIASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: MODIFIER_ALIASES
const MODIFIER_ALIASES: Record<string, CanonicalModifier | "Mod">;
```

Defined in: [constants.ts:102](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L102)
Defined in: [constants.ts:103](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/constants.ts#L103)

Maps modifier key aliases to their canonical form or platform-adaptive 'Mod'.

Expand Down
Loading
Loading