@tanstack/svelte-hotkeys 0.16.0 → 0.17.1

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.
@@ -1,7 +1,7 @@
1
1
  import { AppHotkeysStore } from '@tanstack/hotkeys';
2
2
  import type { AppHotkeys, CustomHotkeys, HotkeyChordRecorderOptions, HotkeySequenceRecorderOptions } from '@tanstack/hotkeys';
3
3
  import type { HotkeysProviderScopeProps } from '@tanstack/hotkeys/adapter';
4
- import type { CreateHotkeyCommonOptions } from './createHotkey.svelte';
4
+ import type { CreateHotkeyCommonOptions } from './createHotkey.svelte.js';
5
5
  import type { Snippet } from 'svelte';
6
6
  export interface HotkeysProviderOptions {
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { createContext, onMount } from 'svelte';
2
2
  import { AppHotkeysStore, publishAppHotkeysStore } from '@tanstack/hotkeys';
3
3
  import { getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults, } from '@tanstack/hotkeys/adapter';
4
- import { activateScopeWhileMounted } from './internal.svelte';
4
+ import { activateScopeWhileMounted } from './internal.svelte.js';
5
5
  export const DEFAULT_OPTIONS = {};
6
6
  const [useHotkeysContext, setHotkeysContextValue] = createContext();
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import { setHotkeysContextSource } from './HotkeysCtx'
2
+ import { setHotkeysContextSource } from './HotkeysCtx.js'
3
3
 
4
- import type { HotkeysProviderProps } from './HotkeysCtx'
4
+ import type { HotkeysProviderProps } from './HotkeysCtx.js'
5
5
 
6
6
  let {
7
7
  children,
@@ -1,4 +1,4 @@
1
- import type { HotkeysProviderProps } from './HotkeysCtx';
1
+ import type { HotkeysProviderProps } from './HotkeysCtx.js';
2
2
  declare const HotkeysProvider: import("svelte").Component<HotkeysProviderProps, {}, "">;
3
3
  type HotkeysProvider = ReturnType<typeof HotkeysProvider>;
4
4
  export default HotkeysProvider;
@@ -1,7 +1,7 @@
1
1
  import type { Attachment } from 'svelte/attachments';
2
2
  import type { AppHotkey, HotkeyCallback, HotkeyCallbackContextFor, RegisterableHotkey } from '@tanstack/hotkeys';
3
3
  import type { AdapterAppHotkeyOptions, AdapterChordOptions, AdapterCommonOptions, AdapterHotkeyOptions, AdapterOptionsFor, AdapterSequenceOptions } from '@tanstack/hotkeys/adapter';
4
- import type { MaybeGetter } from './internal.svelte';
4
+ import type { MaybeGetter } from './internal.svelte.js';
5
5
  /** The document or window to listen on. Use an attachment for elements. */
6
6
  export type CreateHotkeyTarget = Document | Window;
7
7
  /** Options shared by chords and sequences. */
@@ -1,4 +1,4 @@
1
- import { createHotkeys, createHotkeysAttachment } from './createHotkeys.svelte';
1
+ import { createHotkeys, createHotkeysAttachment, } from './createHotkeys.svelte.js';
2
2
  export function createHotkey(hotkey, callback, options = {}) {
3
3
  createHotkeys([{ hotkey, callback, options }]);
4
4
  }
@@ -1,7 +1,6 @@
1
1
  import { HotkeyRecorder } from '@tanstack/hotkeys';
2
- import { onDestroy } from 'svelte';
3
- import { getDefaultHotkeysOptions } from './HotkeysCtx';
4
- import { createStoreSubscriber, resolveMaybeGetter } from './internal.svelte';
2
+ import { getDefaultHotkeysOptions } from './HotkeysCtx.js';
3
+ import { createStoreSubscriber, resolveMaybeGetter } from './internal.svelte.js';
5
4
  class SvelteHotkeyRecorderState {
6
5
  #recorder;
7
6
  #subscribe;
@@ -51,8 +50,9 @@ export function createHotkeyRecorder(options) {
51
50
  $effect(() => {
52
51
  recorder.setOptions(resolve());
53
52
  });
54
- onDestroy(() => {
55
- recorder.destroy();
56
- });
53
+ // Unlike onDestroy, an effect teardown also runs when an $effect.root that
54
+ // owns the recorder is destroyed. $effect.pre runs now, so the teardown is
55
+ // in place even if the root is destroyed before effects flush.
56
+ $effect.pre(() => () => recorder.destroy());
57
57
  return recorder;
58
58
  }
@@ -1,7 +1,7 @@
1
1
  import type { Attachment } from 'svelte/attachments';
2
2
  import type { AppHotkey, HotkeyCallback, RegisterableHotkey, RegisterableHotkeyChord, RegisterableHotkeySequence } from '@tanstack/hotkeys';
3
- import type { MaybeGetter } from './internal.svelte';
4
- import type { CreateAppHotkeyOptions, CreateHotkeyChordOptions, CreateHotkeyCommonOptions, CreateHotkeyOptions, CreateHotkeySequenceOptions } from './createHotkey.svelte';
3
+ import type { MaybeGetter } from './internal.svelte.js';
4
+ import type { CreateAppHotkeyOptions, CreateHotkeyChordOptions, CreateHotkeyCommonOptions, CreateHotkeyOptions, CreateHotkeySequenceOptions } from './createHotkey.svelte.js';
5
5
  /**
6
6
  * One hotkey for `createHotkeys`. The hotkey and options may be getters.
7
7
  * Chords accept `requireReset`; sequences accept `timeout`; hotkeys of unknown
@@ -1,7 +1,6 @@
1
1
  import { createHotkeyBindings, prepareHotkeyDefinitions, } from '@tanstack/hotkeys/adapter';
2
- import { onDestroy } from 'svelte';
3
- import { getHotkeysContext } from './HotkeysCtx';
4
- import { createAppHotkeysSubscriber, resolveMaybeGetter, } from './internal.svelte';
2
+ import { getHotkeysContext } from './HotkeysCtx.js';
3
+ import { createAppHotkeysSubscriber, resolveMaybeGetter, } from './internal.svelte.js';
5
4
  /**
6
5
  * Registers definitions in an effect. With an element, every hotkey listens on
7
6
  * that element; otherwise each uses its own target (document by default).
@@ -55,7 +54,9 @@ function bindHotkeys(hotkeys, commonOptions, element) {
55
54
  */
56
55
  export function createHotkeys(hotkeys, commonOptions = {}) {
57
56
  const bindings = bindHotkeys(hotkeys, commonOptions);
58
- onDestroy(() => bindings.destroy());
57
+ // Unlike onDestroy, an effect teardown also runs when an $effect.root that
58
+ // owns these hotkeys is destroyed.
59
+ $effect(() => () => bindings.destroy());
59
60
  }
60
61
  /**
61
62
  * Create an attachment for element-scoped hotkeys: chords, sequences, and app
@@ -1,6 +1,6 @@
1
- import { getHotkeysContext } from './HotkeysCtx';
2
- import { createStoreSubscriber } from './internal.svelte';
3
- import { getHotkeyRegistrations } from './getHotkeyRegistrations.svelte';
1
+ import { getHotkeysContext } from './HotkeysCtx.js';
2
+ import { createStoreSubscriber } from './internal.svelte.js';
3
+ import { getHotkeyRegistrations } from './getHotkeyRegistrations.svelte.js';
4
4
  function requireStore(name) {
5
5
  const store = getHotkeysContext()?.appHotkeysStore;
6
6
  if (!store) {
@@ -1,5 +1,5 @@
1
1
  import { getKeyStateTracker } from '@tanstack/hotkeys';
2
- import { createStoreSubscriber } from './internal.svelte';
2
+ import { createStoreSubscriber } from './internal.svelte.js';
3
3
  class HeldKeyCodesMapState {
4
4
  #tracker = getKeyStateTracker();
5
5
  #subscribe = createStoreSubscriber(this.#tracker.store);
@@ -1,5 +1,5 @@
1
1
  import { getKeyStateTracker } from '@tanstack/hotkeys';
2
- import { createStoreSubscriber } from './internal.svelte';
2
+ import { createStoreSubscriber } from './internal.svelte.js';
3
3
  class HeldKeysState {
4
4
  #tracker = getKeyStateTracker();
5
5
  #subscribe = createStoreSubscriber(this.#tracker.store);
@@ -1,13 +1,14 @@
1
1
  import type { AppHotkey, HeldModifierOptions, RegisterableHotkey } from '@tanstack/hotkeys';
2
- import type { MaybeGetter } from './internal.svelte';
2
+ import type { MaybeGetter } from './internal.svelte.js';
3
3
  export interface SvelteHotkeyHint {
4
4
  readonly visible: boolean;
5
5
  }
6
6
  /**
7
7
  * Returns an object with a reactive `visible` getter indicating whether held
8
- * modifiers reveal this shortcut. Pass getters to track changing hotkeys and
9
- * options. A sequence reveals its hint from its first step, and an app hotkey
10
- * uses its effective hotkey (false while unbound). This helper does not
11
- * register a shortcut or check whether its target is focused.
8
+ * modifiers reveal this shortcut. The hint shows only while the hotkey can
9
+ * fire: some registration of it is enabled and in an active scope. Pass
10
+ * getters to track changing hotkeys and options. A sequence reveals its hint
11
+ * from its first step, and an app hotkey matches its registrations by id and
12
+ * uses its effective hotkey (false while unbound). This helper does not register a shortcut. A hotkey on an element counts only while focus is inside it.
12
13
  */
13
14
  export declare function getHotkeyHint(hotkey: MaybeGetter<RegisterableHotkey | AppHotkey>, options?: MaybeGetter<HeldModifierOptions>): SvelteHotkeyHint;
@@ -1,16 +1,18 @@
1
1
  import { createSubscriber } from 'svelte/reactivity';
2
- import { getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey, } from '@tanstack/hotkeys';
3
- import { getHotkeysContext } from './HotkeysCtx';
4
- import { resolveMaybeGetter } from './internal.svelte';
2
+ import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey, } from '@tanstack/hotkeys';
3
+ import { getHotkeysContext } from './HotkeysCtx.js';
4
+ import { resolveMaybeGetter } from './internal.svelte.js';
5
5
  /**
6
6
  * Returns an object with a reactive `visible` getter indicating whether held
7
- * modifiers reveal this shortcut. Pass getters to track changing hotkeys and
8
- * options. A sequence reveals its hint from its first step, and an app hotkey
9
- * uses its effective hotkey (false while unbound). This helper does not
10
- * register a shortcut or check whether its target is focused.
7
+ * modifiers reveal this shortcut. The hint shows only while the hotkey can
8
+ * fire: some registration of it is enabled and in an active scope. Pass
9
+ * getters to track changing hotkeys and options. A sequence reveals its hint
10
+ * from its first step, and an app hotkey matches its registrations by id and
11
+ * uses its effective hotkey (false while unbound). This helper does not register a shortcut. A hotkey on an element counts only while focus is inside it.
11
12
  */
12
13
  export function getHotkeyHint(hotkey, options = {}) {
13
14
  const tracker = getKeyStateTracker();
15
+ const manager = getHotkeyManager();
14
16
  const store = getHotkeysContext()?.appHotkeysStore ?? null;
15
17
  // Resolve current reactive arguments without caching a stale hotkey.
16
18
  const read = () => {
@@ -19,7 +21,8 @@ export function getHotkeyHint(hotkey, options = {}) {
19
21
  ? resolveAppHotkey(value, store).hotkey
20
22
  : value;
21
23
  return (resolved !== null &&
22
- matchesHeldModifiers(resolved, tracker.store.state.heldKeys, resolveMaybeGetter(options)));
24
+ matchesHeldModifiers(resolved, tracker.store.state.heldKeys, resolveMaybeGetter(options)) &&
25
+ manager.hasActiveRegistration(value));
23
26
  };
24
27
  let previous = false;
25
28
  // Notify Svelte only when visibility changes, not for every unrelated held key.
@@ -33,9 +36,11 @@ export function getHotkeyHint(hotkey, options = {}) {
33
36
  }
34
37
  };
35
38
  const keys = tracker.store.subscribe(check);
39
+ const registrations = manager.registrations.subscribe(check);
36
40
  const custom = store?.store.subscribe(check);
37
41
  return () => {
38
42
  keys.unsubscribe();
43
+ registrations.unsubscribe();
39
44
  custom?.unsubscribe();
40
45
  };
41
46
  });
@@ -1,5 +1,5 @@
1
1
  import { getHotkeyManager, toHotkeyRegistrationView } from '@tanstack/hotkeys';
2
- import { createStoreSubscriber } from './internal.svelte';
2
+ import { createStoreSubscriber } from './internal.svelte.js';
3
3
  class HotkeyRegistrationsState {
4
4
  #manager = getHotkeyManager();
5
5
  #subscribe = createStoreSubscriber(this.#manager.registrations);
@@ -0,0 +1,24 @@
1
+ import type { HotkeyScopesState } from '@tanstack/hotkeys';
2
+ export interface SvelteHotkeyScopesState {
3
+ readonly state: HotkeyScopesState;
4
+ }
5
+ /**
6
+ * Svelte function that returns reactive access to the hotkey manager's scope
7
+ * state: the active scopes, the exclusive scope that owns the keyboard, and
8
+ * the scopes it allows or suspends. Updates when scopes activate or release.
9
+ *
10
+ * @returns Object with a reactive `state` property
11
+ *
12
+ * @example
13
+ * ```svelte
14
+ * <script>
15
+ * import { getHotkeyScopesState } from '@tanstack/svelte-hotkeys'
16
+ *
17
+ * const scopes = getHotkeyScopesState()
18
+ * </script>
19
+ * {#if scopes.state.exclusive}
20
+ * <p>Shortcuts belong to {scopes.state.exclusive}</p>
21
+ * {/if}
22
+ * ```
23
+ */
24
+ export declare function getHotkeyScopesState(): SvelteHotkeyScopesState;
@@ -0,0 +1,32 @@
1
+ import { getHotkeyManager } from '@tanstack/hotkeys';
2
+ import { createStoreSubscriber } from './internal.svelte.js';
3
+ class HotkeyScopesStateReader {
4
+ #store = getHotkeyManager().scopes;
5
+ #subscribe = createStoreSubscriber(this.#store);
6
+ get state() {
7
+ this.#subscribe();
8
+ return this.#store.state;
9
+ }
10
+ }
11
+ /**
12
+ * Svelte function that returns reactive access to the hotkey manager's scope
13
+ * state: the active scopes, the exclusive scope that owns the keyboard, and
14
+ * the scopes it allows or suspends. Updates when scopes activate or release.
15
+ *
16
+ * @returns Object with a reactive `state` property
17
+ *
18
+ * @example
19
+ * ```svelte
20
+ * <script>
21
+ * import { getHotkeyScopesState } from '@tanstack/svelte-hotkeys'
22
+ *
23
+ * const scopes = getHotkeyScopesState()
24
+ * </script>
25
+ * {#if scopes.state.exclusive}
26
+ * <p>Shortcuts belong to {scopes.state.exclusive}</p>
27
+ * {/if}
28
+ * ```
29
+ */
30
+ export function getHotkeyScopesState() {
31
+ return new HotkeyScopesStateReader();
32
+ }
@@ -1,5 +1,5 @@
1
1
  import { getKeyStateTracker } from '@tanstack/hotkeys';
2
- import { createStoreSubscriber } from './internal.svelte';
2
+ import { createStoreSubscriber } from './internal.svelte.js';
3
3
  class HeldKeyState {
4
4
  #tracker = getKeyStateTracker();
5
5
  #normalizedKey;
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  export * from '@tanstack/hotkeys';
2
- export * from './createHotkey.svelte';
3
- export * from './createHotkeys.svelte';
4
- export * from './createHotkeyRecorder.svelte';
5
- export * from './getHeldKeys.svelte';
6
- export * from './getHotkeyRegistrations.svelte';
7
- export * from './getHeldKeyCodesMap.svelte';
8
- export * from './getIsKeyHeld.svelte';
9
- export * from './getAppHotkeys.svelte';
2
+ export * from './createHotkey.svelte.js';
3
+ export * from './createHotkeys.svelte.js';
4
+ export * from './createHotkeyRecorder.svelte.js';
5
+ export * from './getHeldKeys.svelte.js';
6
+ export * from './getHotkeyRegistrations.svelte.js';
7
+ export * from './getHotkeyScopesState.svelte.js';
8
+ export * from './getHeldKeyCodesMap.svelte.js';
9
+ export * from './getIsKeyHeld.svelte.js';
10
+ export * from './getAppHotkeys.svelte.js';
10
11
  export { default as HotkeysProvider } from './HotkeysProvider.svelte';
11
- export { DEFAULT_OPTIONS, getDefaultHotkeysOptions, getHotkeysContext, setHotkeysContext, } from './HotkeysCtx';
12
- export type { HotkeysContextOptions, HotkeysProviderOptions, HotkeysProviderProps, } from './HotkeysCtx';
13
- export * from './getHotkeyHint.svelte';
12
+ export { DEFAULT_OPTIONS, getDefaultHotkeysOptions, getHotkeysContext, setHotkeysContext, } from './HotkeysCtx.js';
13
+ export type { HotkeysContextOptions, HotkeysProviderOptions, HotkeysProviderProps, } from './HotkeysCtx.js';
14
+ export * from './getHotkeyHint.svelte.js';
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  // Re-export everything from the core package
2
2
  export * from '@tanstack/hotkeys';
3
- export * from './createHotkey.svelte';
4
- export * from './createHotkeys.svelte';
5
- export * from './createHotkeyRecorder.svelte';
6
- export * from './getHeldKeys.svelte';
7
- export * from './getHotkeyRegistrations.svelte';
8
- export * from './getHeldKeyCodesMap.svelte';
9
- export * from './getIsKeyHeld.svelte';
10
- export * from './getAppHotkeys.svelte';
3
+ export * from './createHotkey.svelte.js';
4
+ export * from './createHotkeys.svelte.js';
5
+ export * from './createHotkeyRecorder.svelte.js';
6
+ export * from './getHeldKeys.svelte.js';
7
+ export * from './getHotkeyRegistrations.svelte.js';
8
+ export * from './getHotkeyScopesState.svelte.js';
9
+ export * from './getHeldKeyCodesMap.svelte.js';
10
+ export * from './getIsKeyHeld.svelte.js';
11
+ export * from './getAppHotkeys.svelte.js';
11
12
  export { default as HotkeysProvider } from './HotkeysProvider.svelte';
12
- export { DEFAULT_OPTIONS, getDefaultHotkeysOptions, getHotkeysContext, setHotkeysContext, } from './HotkeysCtx';
13
- export * from './getHotkeyHint.svelte';
13
+ export { DEFAULT_OPTIONS, getDefaultHotkeysOptions, getHotkeysContext, setHotkeysContext, } from './HotkeysCtx.js';
14
+ export * from './getHotkeyHint.svelte.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/svelte-hotkeys",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "Svelte adapter for TanStack Hotkeys",
5
5
  "author": "Kunal Rao",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "skills"
42
42
  ],
43
43
  "dependencies": {
44
- "@tanstack/hotkeys": "0.17.0"
44
+ "@tanstack/hotkeys": "0.19.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@sveltejs/package": "^3.0.0",
@@ -51,7 +51,7 @@
51
51
  "svelte": "^5.57.1"
52
52
  },
53
53
  "peerDependencies": {
54
- "svelte": "^5.25.0"
54
+ "svelte": "^5.40.0"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=20"
@@ -55,25 +55,26 @@ Before starting, load the `@tanstack/hotkeys#hotkeys-core` skill (`npx @tanstack
55
55
 
56
56
  ## API
57
57
 
58
- | API | What it's for |
59
- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
60
- | `createHotkey(hotkey, callback, options?)` | Register one chord, sequence, or app hotkey on the document while the component is mounted; pass getters for values that change. |
61
- | `createHotkeys(definitions, commonOptions?)` | Register several hotkeys on the document, or a getter of a list built from data. |
62
- | `createHotkeyAttachment(hotkey, callback, options?)` | Create an attachment for `{@attach}` that listens on one element. |
63
- | `createHotkeysAttachment(definitions, commonOptions?)` | Create an attachment that registers several hotkeys on one element. |
64
- | `<HotkeysProvider>` | Set default options, a scope (`exclusive` for dialogs), `enabled`, and app hotkeys for the components inside it. |
65
- | `setHotkeysContext(options)` | Set the same options from a component's script instead of rendering `HotkeysProvider`; they apply to that component too. |
66
- | `getHotkeysContext()` | Read the nearest context's merged defaults and enabled state, or `null` outside one. |
67
- | `getDefaultHotkeysOptions()` | Read the default options merged from every context above. |
68
- | `getAppHotkeys()` | Read `.current`, the declared app hotkeys with the user's custom hotkeys applied. |
69
- | `getAppHotkeyList()` | Read `.current`, every app hotkey with its status, for a cheat sheet or settings screen. |
70
- | `getCustomHotkeys()` | Read the user's custom hotkeys from `.current`, change or reset them, and check a new one for conflicts. |
71
- | `createHotkeyRecorder(options)` | Record a chord or sequence the user presses, for a settings screen. |
72
- | `getHotkeyRegistrations()` | Read `.hotkeys`, every registered hotkey with its options and `meta`. |
73
- | `getHotkeyHint(hotkey, options?)` | Read `.visible`, whether held modifiers should reveal a shortcut's hint. |
74
- | `getIsKeyHeld(key)` | Read `.held`, whether one key is held. |
75
- | `getHeldKeys()` | Read `.keys`, every key that's held right now. |
76
- | `getHeldKeyCodesMap()` | Read `.codes`, which maps each held key to its physical `event.code`. |
58
+ | API | What it's for |
59
+ | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
60
+ | `createHotkey(hotkey, callback, options?)` | Register one chord, sequence, or app hotkey on the document while the component is mounted; pass getters for values that change. |
61
+ | `createHotkeys(definitions, commonOptions?)` | Register several hotkeys on the document, or a getter of a list built from data. |
62
+ | `createHotkeyAttachment(hotkey, callback, options?)` | Create an attachment for `{@attach}` that listens on one element. |
63
+ | `createHotkeysAttachment(definitions, commonOptions?)` | Create an attachment that registers several hotkeys on one element. |
64
+ | `<HotkeysProvider>` | Set default options, a scope (`exclusive` for dialogs), `enabled`, and app hotkeys for the components inside it. |
65
+ | `setHotkeysContext(options)` | Set the same options from a component's script instead of rendering `HotkeysProvider`; they apply to that component too. |
66
+ | `getHotkeysContext()` | Read the nearest context's merged defaults and enabled state, or `null` outside one. |
67
+ | `getDefaultHotkeysOptions()` | Read the default options merged from every context above. |
68
+ | `getAppHotkeys()` | Read `.current`, the declared app hotkeys with the user's custom hotkeys applied. |
69
+ | `getAppHotkeyList()` | Read `.current`, every app hotkey with its status, for a cheat sheet or settings screen. |
70
+ | `getCustomHotkeys()` | Read the user's custom hotkeys from `.current`, change or reset them, and check a new one for conflicts. |
71
+ | `createHotkeyRecorder(options)` | Record a chord or sequence the user presses, for a settings screen. |
72
+ | `getHotkeyRegistrations()` | Read `.hotkeys`, every registered hotkey with its options, `meta`, and `status` (whether it's enabled and in an active scope). |
73
+ | `getHotkeyScopesState()` | Read `.state`, the active scopes and the exclusive scope that owns the keyboard. |
74
+ | `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. |
75
+ | `getIsKeyHeld(key)` | Read `.held`, whether one key is held. |
76
+ | `getHeldKeys()` | Read `.keys`, every key that's held right now. |
77
+ | `getHeldKeyCodesMap()` | Read `.codes`, which maps each held key to its physical `event.code`. |
77
78
 
78
79
  The package also re-exports `@tanstack/hotkeys`, such as `formatForDisplay`, `matchesKeyboardEvent`, and `defineAppHotkeys`.
79
80