@tanstack/preact-hotkeys 0.20.4 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,8 +43,7 @@ import { getKeyStateTracker } from "@tanstack/hotkeys";
43
43
  */
44
44
  function useKeyHold(key) {
45
45
  const tracker = getKeyStateTracker();
46
- const normalizedKey = key.toLowerCase();
47
- return useSelector(tracker.store, (state) => state.heldKeys.some((heldKey) => heldKey.toLowerCase() === normalizedKey));
46
+ return useSelector(tracker.store, () => tracker.isKeyHeld(key));
48
47
  }
49
48
 
50
49
  export { useKeyHold };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/preact-hotkeys",
3
- "version": "0.20.4",
3
+ "version": "0.21.0",
4
4
  "description": "Preact adapter for TanStack Hotkeys",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -35,10 +35,11 @@
35
35
  "skills"
36
36
  ],
37
37
  "dependencies": {
38
- "@tanstack/hotkeys": "0.26.0"
38
+ "@tanstack/hotkeys": "0.27.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@preact/preset-vite": "^2.10.6",
42
+ "@tanstack/hotkeys-test-utils": "0.0.0",
42
43
  "@testing-library/preact": "^3.2.6",
43
44
  "preact": "^11.2.0"
44
45
  },
@@ -50,8 +51,9 @@
50
51
  "lint": "oxlint ./src",
51
52
  "lint:fix": "oxlint ./src --fix",
52
53
  "test:oxlint": "oxlint ./src",
53
- "test:lib": "vitest --passWithNoTests",
54
+ "test:lib": "vitest",
54
55
  "test:lib:dev": "pnpm test:lib --watch",
56
+ "test:coverage": "vitest --coverage",
55
57
  "test:types": "tsc",
56
58
  "build": "tsdown",
57
59
  "test:build": "publint --strict && node ../../scripts/verify-package.ts"
@@ -60,7 +60,7 @@ export function SaveButton({ onSave }: { onSave: () => void }) {
60
60
  | `useHotkeyRegistrations()` | List every registered hotkey with its options, `meta`, and `status` (whether it's enabled and in an active scope), for a cheat sheet of what's mounted. |
61
61
  | `useHotkeyScopesState()` | Get the active scopes and the exclusive scope that owns the keyboard. |
62
62
  | `useHotkeyHint(hotkey, options?)` | Get whether held modifiers should reveal a shortcut's hint, such as labels that appear while Mod is held. False unless a registration of the hotkey can fire: enabled, in an active scope, and with focus inside its element target. |
63
- | `useKeyHold(key)` | Get whether one key is held, such as Shift for a range-select mode. |
63
+ | `useKeyHold(key)` | Get whether one key is held, such as Shift for a range-select mode. Letters match in any case; other names, such as `Shift`, are case-sensitive. |
64
64
  | `useHeldKeys()` | Get every key that's held right now. |
65
65
  | `useHeldKeyCodes()` | Map each held key to its physical `event.code`. |
66
66