@tanstack/svelte-hotkeys 0.21.2 → 0.22.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.
@@ -2,14 +2,14 @@ import { getKeyStateTracker } from '@tanstack/hotkeys';
2
2
  import { createStoreSubscriber } from './internal.svelte.js';
3
3
  class HeldKeyState {
4
4
  #tracker = getKeyStateTracker();
5
- #normalizedKey;
5
+ #key;
6
6
  #subscribe = createStoreSubscriber(this.#tracker.store);
7
7
  constructor(key) {
8
- this.#normalizedKey = key.toLowerCase();
8
+ this.#key = key;
9
9
  }
10
10
  get held() {
11
11
  this.#subscribe();
12
- return this.#tracker.store.state.heldKeys.some((heldKey) => heldKey.toLowerCase() === this.#normalizedKey);
12
+ return this.#tracker.isKeyHeld(this.#key);
13
13
  }
14
14
  }
15
15
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/svelte-hotkeys",
3
- "version": "0.21.2",
3
+ "version": "0.22.0",
4
4
  "description": "Svelte adapter for TanStack Hotkeys",
5
5
  "author": "Kunal Rao",
6
6
  "license": "MIT",
@@ -41,11 +41,12 @@
41
41
  "skills"
42
42
  ],
43
43
  "dependencies": {
44
- "@tanstack/hotkeys": "0.25.1"
44
+ "@tanstack/hotkeys": "0.27.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@sveltejs/package": "^3.0.2",
48
48
  "@sveltejs/vite-plugin-svelte": "^7.3.1",
49
+ "@tanstack/hotkeys-test-utils": "0.0.0",
49
50
  "@typescript-eslint/parser": "^8.72.1",
50
51
  "eslint": "^10.14.0",
51
52
  "eslint-plugin-svelte": "^3.24.0",
@@ -61,8 +62,9 @@
61
62
  "clean": "premove ./dist ./coverage",
62
63
  "test:oxlint": "oxlint ./src",
63
64
  "test:eslint": "eslint ./src",
64
- "test:lib": "vitest --passWithNoTests",
65
+ "test:lib": "vitest",
65
66
  "test:lib:dev": "pnpm test:lib --watch",
67
+ "test:coverage": "vitest --coverage",
66
68
  "test:types": "tsc",
67
69
  "test:build": "publint --strict && node ../../scripts/verify-package.ts",
68
70
  "build": "svelte-package --input ./src --output ./dist"
@@ -73,7 +73,7 @@ Before starting, load the `@tanstack/hotkeys#hotkeys-core` skill (`npx @tanstack
73
73
  | `getHotkeyRegistrations()` | Read `.hotkeys`, every registered hotkey with its options, `meta`, and `status` (whether it's enabled and in an active scope). |
74
74
  | `getHotkeyScopesState()` | Read `.state`, the active scopes and the exclusive scope that owns the keyboard. |
75
75
  | `getHotkeyHint(hotkey, options?)` | Read `.visible`, whether held modifiers should reveal a shortcut's hint. False unless a registration of the hotkey can fire: enabled, in an active scope, and with focus inside its element target. |
76
- | `getIsKeyHeld(key)` | Read `.held`, whether one key is held. |
76
+ | `getIsKeyHeld(key)` | Read `.held`, whether one key is held. Letters match in any case; other names, such as `Shift`, are case-sensitive. |
77
77
  | `getHeldKeys()` | Read `.keys`, every key that's held right now. |
78
78
  | `getHeldKeyCodesMap()` | Read `.codes`, which maps each held key to its physical `event.code`. |
79
79