@tanstack/lit-hotkeys 0.17.0 → 0.18.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.
@@ -0,0 +1,12 @@
1
+ //#region src/controllers/_server.ts
2
+ /**
3
+ * Whether the code runs on a server. With `@lit-labs/ssr`'s
4
+ * `connectedCallback: true` option, the server calls `hostConnected` and never
5
+ * calls `hostDisconnected`, so controllers must not subscribe there.
6
+ */
7
+ function isServer() {
8
+ return typeof document === "undefined";
9
+ }
10
+
11
+ //#endregion
12
+ export { isServer };
@@ -1,4 +1,5 @@
1
1
  import { getAppHotkeysStore, subscribeAppHotkeys } from "./_app-hotkeys.js";
2
+ import { isServer } from "./_server.js";
2
3
  import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
3
4
 
4
5
  //#region src/controllers/app-hotkeys.ts
@@ -66,6 +67,7 @@ var AppHotkeysController = class {
66
67
  return requireStore().findConflicts(id, hotkey);
67
68
  }
68
69
  hostConnected() {
70
+ if (isServer()) return;
69
71
  const update = () => this._host.requestUpdate();
70
72
  const unsubscribeAppHotkeys = subscribeAppHotkeys(update);
71
73
  const registrations = getHotkeyManager().registrations.subscribe(update);
@@ -1,3 +1,4 @@
1
+ import { isServer } from "./_server.js";
1
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
3
 
3
4
  //#region src/controllers/held-key-codes.ts
@@ -45,6 +46,7 @@ var HeldKeyCodesController = class {
45
46
  const tracker = getKeyStateTracker();
46
47
  this._value = tracker.store.state.heldCodes;
47
48
  this._host.requestUpdate();
49
+ if (isServer()) return;
48
50
  const subscription = tracker.store.subscribe(() => {
49
51
  const { heldCodes } = tracker.store.state;
50
52
  this._value = heldCodes;
@@ -1,3 +1,4 @@
1
+ import { isServer } from "./_server.js";
1
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
3
 
3
4
  //#region src/controllers/held-keys.ts
@@ -41,6 +42,7 @@ var HeldKeysController = class {
41
42
  }
42
43
  /** Subscribes to the tracker store and updates the internal state when changes occur. */
43
44
  hostConnected() {
45
+ if (isServer()) return;
44
46
  const tracker = getKeyStateTracker();
45
47
  const subscription = tracker.store.subscribe(() => {
46
48
  const { heldKeys } = tracker.store.state;
@@ -10,9 +10,16 @@ export declare class HotkeyHintController implements ReactiveController {
10
10
  private visible;
11
11
  /** Attaches to the host; getter arguments can read changing reactive properties. */
12
12
  constructor(host: ReactiveControllerHost, hotkey: RegisterableHotkey | AppHotkey | (() => RegisterableHotkey | AppHotkey), options?: HeldModifierOptions | (() => HeldModifierOptions));
13
- /** Current visibility; combine with the action’s enabled state when rendering. */
13
+ /**
14
+ * Current visibility. True only while the hotkey can fire: some registration
15
+ * of it is enabled and in an active scope. A hotkey on an element counts only while focus is inside it.
16
+ */
14
17
  get value(): boolean;
15
- /** Subscribes on connection and requests renders only when hint visibility changes. */
18
+ /**
19
+ * Subscribes on connection, then requests renders only when hint visibility
20
+ * changes. Reconnecting always requests one, since the hint may have changed
21
+ * while disconnected.
22
+ */
16
23
  hostConnected(): void;
17
24
  /** Re-evaluates getter arguments when host properties trigger an update. */
18
25
  hostUpdate(): void;
@@ -1,5 +1,6 @@
1
1
  import { getAppHotkeysStore, subscribeAppHotkeys } from "./_app-hotkeys.js";
2
- import { getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
2
+ import { isServer } from "./_server.js";
3
+ import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
3
4
 
4
5
  //#region src/controllers/hotkey-hint.ts
5
6
  /** Modifier hint controller. Getter arguments can read reactive host properties. */
@@ -16,20 +17,31 @@ var HotkeyHintController = class {
16
17
  this.options = options;
17
18
  host.addController(this);
18
19
  }
19
- /** Current visibility; combine with the action’s enabled state when rendering. */
20
+ /**
21
+ * Current visibility. True only while the hotkey can fire: some registration
22
+ * of it is enabled and in an active scope. A hotkey on an element counts only while focus is inside it.
23
+ */
20
24
  get value() {
21
25
  return this.visible;
22
26
  }
23
- /** Subscribes on connection and requests renders only when hint visibility changes. */
27
+ /**
28
+ * Subscribes on connection, then requests renders only when hint visibility
29
+ * changes. Reconnecting always requests one, since the hint may have changed
30
+ * while disconnected.
31
+ */
24
32
  hostConnected() {
25
33
  this.update();
34
+ this.host.requestUpdate();
35
+ if (isServer()) return;
26
36
  const refresh = () => {
27
37
  if (this.update()) this.host.requestUpdate();
28
38
  };
29
39
  const subscription = getKeyStateTracker().store.subscribe(refresh);
40
+ const registrations = getHotkeyManager().registrations.subscribe(refresh);
30
41
  const unsubscribeAppHotkeys = subscribeAppHotkeys(refresh);
31
42
  this.unsubscribe = () => {
32
43
  subscription.unsubscribe();
44
+ registrations.unsubscribe();
33
45
  unsubscribeAppHotkeys();
34
46
  };
35
47
  }
@@ -47,7 +59,7 @@ var HotkeyHintController = class {
47
59
  update() {
48
60
  const value = typeof this.hotkey === "function" ? this.hotkey() : this.hotkey;
49
61
  const hotkey = isAppHotkey(value) ? resolveAppHotkey(value, getAppHotkeysStore()).hotkey : value;
50
- const next = hotkey !== null && matchesHeldModifiers(hotkey, getKeyStateTracker().store.state.heldKeys, typeof this.options === "function" ? this.options() : this.options);
62
+ const next = hotkey !== null && matchesHeldModifiers(hotkey, getKeyStateTracker().store.state.heldKeys, typeof this.options === "function" ? this.options() : this.options) && getHotkeyManager().hasActiveRegistration(value);
51
63
  const changed = next !== this.visible;
52
64
  this.visible = next;
53
65
  return changed;
@@ -1,3 +1,4 @@
1
+ import { isServer } from "./_server.js";
1
2
  import { HotkeyRecorder } from "@tanstack/hotkeys";
2
3
 
3
4
  //#region src/controllers/hotkey-recorder.ts
@@ -75,6 +76,7 @@ var HotkeyRecorderController = class {
75
76
  }
76
77
  /** Subscribes to the recorder store and updates the internal state when changes occur. */
77
78
  hostConnected() {
79
+ if (isServer()) return;
78
80
  const subscription = this._recorder.store.subscribe(() => {
79
81
  const { isRecording, recordedHotkey, steps } = this._recorder.store.state;
80
82
  if (isRecording !== this._isRecording || recordedHotkey !== this._recordedHotkey || steps !== this._steps) {
@@ -1,3 +1,4 @@
1
+ import { isServer } from "./_server.js";
1
2
  import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
2
3
 
3
4
  //#region src/controllers/hotkey-registrations.ts
@@ -36,12 +37,13 @@ var HotkeyRegistrationsController = class {
36
37
  hostConnected() {
37
38
  const manager = getHotkeyManager();
38
39
  const read = () => Array.from(manager.registrations.state.values()).map(toHotkeyRegistrationView);
40
+ this._hotkeys = read();
41
+ if (isServer()) return;
39
42
  const subscription = manager.registrations.subscribe(() => {
40
43
  this._hotkeys = read();
41
44
  this._host.requestUpdate();
42
45
  });
43
46
  this._unsubscribe = () => subscription.unsubscribe();
44
- this._hotkeys = read();
45
47
  }
46
48
  hostDisconnected() {
47
49
  this._unsubscribe?.();
@@ -0,0 +1,40 @@
1
+ import { HotkeyScopesState } from "@tanstack/hotkeys";
2
+ import { ReactiveController, ReactiveControllerHost } from "lit";
3
+ //#region src/controllers/hotkey-scopes-state.d.ts
4
+ /**
5
+ * A Lit ReactiveController that reads the hotkey manager's scope state: the
6
+ * active scopes, the exclusive scope that owns the keyboard, and the scopes it
7
+ * allows or suspends. Triggers host updates when scopes activate or release.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * class KeyboardOwner extends LitElement {
12
+ * private scopes = new HotkeyScopesStateController(this)
13
+ *
14
+ * render() {
15
+ * const { exclusive } = this.scopes.value
16
+ * return exclusive ? html`<p>Shortcuts belong to ${exclusive}</p>` : nothing
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class HotkeyScopesStateController implements ReactiveController {
22
+ private _host;
23
+ /** The unsubscribe function to unsubscribe from the scopes store. */
24
+ private _unsubscribe;
25
+ /** The current scope state. */
26
+ get value(): HotkeyScopesState;
27
+ /**
28
+ * @param _host - The Lit component that owns this controller.
29
+ */
30
+ constructor(_host: ReactiveControllerHost);
31
+ /**
32
+ * Subscribes to the scopes store and updates the host when it changes.
33
+ * Connecting requests an update too, since scopes may have changed while
34
+ * disconnected.
35
+ */
36
+ hostConnected(): void;
37
+ /** Unsubscribes from the scopes store. */
38
+ hostDisconnected(): void;
39
+ }
40
+ //#endregion
@@ -0,0 +1,56 @@
1
+ import { isServer } from "./_server.js";
2
+ import { getHotkeyManager } from "@tanstack/hotkeys";
3
+
4
+ //#region src/controllers/hotkey-scopes-state.ts
5
+ /**
6
+ * A Lit ReactiveController that reads the hotkey manager's scope state: the
7
+ * active scopes, the exclusive scope that owns the keyboard, and the scopes it
8
+ * allows or suspends. Triggers host updates when scopes activate or release.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * class KeyboardOwner extends LitElement {
13
+ * private scopes = new HotkeyScopesStateController(this)
14
+ *
15
+ * render() {
16
+ * const { exclusive } = this.scopes.value
17
+ * return exclusive ? html`<p>Shortcuts belong to ${exclusive}</p>` : nothing
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ var HotkeyScopesStateController = class {
23
+ _host;
24
+ /** The unsubscribe function to unsubscribe from the scopes store. */
25
+ _unsubscribe;
26
+ /** The current scope state. */
27
+ get value() {
28
+ return getHotkeyManager().scopes.state;
29
+ }
30
+ /**
31
+ * @param _host - The Lit component that owns this controller.
32
+ */
33
+ constructor(_host) {
34
+ this._host = _host;
35
+ this._host.addController(this);
36
+ }
37
+ /**
38
+ * Subscribes to the scopes store and updates the host when it changes.
39
+ * Connecting requests an update too, since scopes may have changed while
40
+ * disconnected.
41
+ */
42
+ hostConnected() {
43
+ this._host.requestUpdate();
44
+ if (isServer()) return;
45
+ const subscription = getHotkeyManager().scopes.subscribe(() => this._host.requestUpdate());
46
+ this._unsubscribe = () => subscription.unsubscribe();
47
+ }
48
+ /** Unsubscribes from the scopes store. */
49
+ hostDisconnected() {
50
+ this._unsubscribe?.();
51
+ this._unsubscribe = void 0;
52
+ }
53
+ };
54
+
55
+ //#endregion
56
+ export { HotkeyScopesStateController };
@@ -1,4 +1,5 @@
1
1
  import { getAppHotkeysStore, subscribeAppHotkeys } from "./_app-hotkeys.js";
2
+ import { isServer } from "./_server.js";
2
3
  import { createHotkeyBindings, prepareHotkeyDefinitions } from "@tanstack/hotkeys/adapter";
3
4
 
4
5
  //#region src/controllers/hotkey.ts
@@ -42,6 +43,7 @@ var HotkeyController = class {
42
43
  }
43
44
  /** Registers when connected and a target is available. */
44
45
  hostConnected() {
46
+ if (isServer()) return;
45
47
  this._connected = true;
46
48
  this._unsubscribe = subscribeAppHotkeys(() => this._sync());
47
49
  this._sync();
@@ -6,4 +6,5 @@ import { HotkeyRecorderController } from "./hotkey-recorder.js";
6
6
  import { HotkeyRegistrationsController } from "./hotkey-registrations.js";
7
7
  import { KeyHoldController } from "./key-hold.js";
8
8
  import { HotkeyHintController } from "./hotkey-hint.js";
9
- export { AppHotkeyControllerOptions, AppHotkeysController, HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyControllerChordOptions, HotkeyControllerCommonOptions, HotkeyControllerOptions, HotkeyControllerOptionsFor, HotkeyControllerSequenceOptions, HotkeyControllerTarget, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, KeyHoldController };
9
+ import { HotkeyScopesStateController } from "./hotkey-scopes-state.js";
10
+ export { AppHotkeyControllerOptions, AppHotkeysController, HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyControllerChordOptions, HotkeyControllerCommonOptions, HotkeyControllerOptions, HotkeyControllerOptionsFor, HotkeyControllerSequenceOptions, HotkeyControllerTarget, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, HotkeyScopesStateController, KeyHoldController };
@@ -5,7 +5,9 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
5
5
  * A Lit ReactiveController that tracks whether a specific key is currently held.
6
6
  *
7
7
  * Subscribes to the global KeyStateTracker and triggers host updates
8
- * when the held state of the specified key changes.
8
+ * when the held state of the specified key changes. Pass a getter to track a
9
+ * key that changes, such as a reactive property; it is read again on each
10
+ * host update.
9
11
  *
10
12
  * @example
11
13
  * ```ts
@@ -50,10 +52,14 @@ export declare class KeyHoldController implements ReactiveController {
50
52
  get value(): boolean;
51
53
  /**
52
54
  * @param _host - The Lit component that owns this controller.
53
- * @param _key - The key to track (e.g. 'Shift', 'Control', 'A').
55
+ * @param _key - The key to track (e.g. 'Shift', 'Control', 'A'), or a getter.
54
56
  */
55
- constructor(_host: ReactiveControllerHost, _key: IndividualKey);
57
+ constructor(_host: ReactiveControllerHost, _key: IndividualKey | (() => IndividualKey));
56
58
  hostConnected(): void;
59
+ /** Re-reads a getter key when host properties trigger an update. */
60
+ hostUpdate(): void;
57
61
  hostDisconnected(): void;
62
+ /** Recomputes the held state and reports whether it changed. */
63
+ private _refresh;
58
64
  }
59
65
  //#endregion
@@ -1,3 +1,4 @@
1
+ import { isServer } from "./_server.js";
1
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
3
 
3
4
  //#region src/controllers/key-hold.ts
@@ -5,7 +6,9 @@ import { getKeyStateTracker } from "@tanstack/hotkeys";
5
6
  * A Lit ReactiveController that tracks whether a specific key is currently held.
6
7
  *
7
8
  * Subscribes to the global KeyStateTracker and triggers host updates
8
- * when the held state of the specified key changes.
9
+ * when the held state of the specified key changes. Pass a getter to track a
10
+ * key that changes, such as a reactive property; it is read again on each
11
+ * host update.
9
12
  *
10
13
  * @example
11
14
  * ```ts
@@ -52,7 +55,7 @@ var KeyHoldController = class {
52
55
  }
53
56
  /**
54
57
  * @param _host - The Lit component that owns this controller.
55
- * @param _key - The key to track (e.g. 'Shift', 'Control', 'A').
58
+ * @param _key - The key to track (e.g. 'Shift', 'Control', 'A'), or a getter.
56
59
  */
57
60
  constructor(_host, _key) {
58
61
  this._host = _host;
@@ -60,22 +63,30 @@ var KeyHoldController = class {
60
63
  this._host.addController(this);
61
64
  }
62
65
  hostConnected() {
63
- const tracker = getKeyStateTracker();
64
- const normalizedKey = this._key.toLowerCase();
65
- const subscription = tracker.store.subscribe(() => {
66
- const isHeld = tracker.store.state.heldKeys.some((heldKey) => heldKey.toLowerCase() === normalizedKey);
67
- if (isHeld !== this._value) {
68
- this._value = isHeld;
69
- this._host.requestUpdate();
70
- }
66
+ if (this._refresh()) this._host.requestUpdate();
67
+ if (isServer()) return;
68
+ const subscription = getKeyStateTracker().store.subscribe(() => {
69
+ if (this._refresh()) this._host.requestUpdate();
71
70
  });
72
71
  this._unsubscribe = () => subscription.unsubscribe();
73
72
  }
73
+ /** Re-reads a getter key when host properties trigger an update. */
74
+ hostUpdate() {
75
+ this._refresh();
76
+ }
74
77
  hostDisconnected() {
75
78
  this._unsubscribe?.();
76
79
  this._unsubscribe = void 0;
77
80
  this._value = false;
78
81
  }
82
+ /** Recomputes the held state and reports whether it changed. */
83
+ _refresh() {
84
+ const key = (typeof this._key === "function" ? this._key() : this._key).toLowerCase();
85
+ const next = getKeyStateTracker().store.state.heldKeys.some((heldKey) => heldKey.toLowerCase() === key);
86
+ const changed = next !== this._value;
87
+ this._value = next;
88
+ return changed;
89
+ }
79
90
  };
80
91
 
81
92
  //#endregion
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import { HotkeyRecorderController } from "./controllers/hotkey-recorder.js";
8
8
  import { HotkeyRegistrationsController } from "./controllers/hotkey-registrations.js";
9
9
  import { KeyHoldController } from "./controllers/key-hold.js";
10
10
  import { HotkeyHintController } from "./controllers/hotkey-hint.js";
11
+ import { HotkeyScopesStateController } from "./controllers/hotkey-scopes-state.js";
11
12
  import "./controllers/index.js";
12
13
  export * from "@tanstack/hotkeys";
13
- export { AppHotkeyControllerOptions, AppHotkeysController, HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyControllerChordOptions, HotkeyControllerCommonOptions, HotkeyControllerOptions, HotkeyControllerOptionsFor, HotkeyControllerSequenceOptions, HotkeyControllerTarget, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, KeyHoldController, hotkey };
14
+ export { AppHotkeyControllerOptions, AppHotkeysController, HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyControllerChordOptions, HotkeyControllerCommonOptions, HotkeyControllerOptions, HotkeyControllerOptionsFor, HotkeyControllerSequenceOptions, HotkeyControllerTarget, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, HotkeyScopesStateController, KeyHoldController, hotkey };
package/dist/index.js CHANGED
@@ -7,7 +7,8 @@ import { HotkeyRecorderController } from "./controllers/hotkey-recorder.js";
7
7
  import { HotkeyRegistrationsController } from "./controllers/hotkey-registrations.js";
8
8
  import { KeyHoldController } from "./controllers/key-hold.js";
9
9
  import { HotkeyHintController } from "./controllers/hotkey-hint.js";
10
+ import { HotkeyScopesStateController } from "./controllers/hotkey-scopes-state.js";
10
11
 
11
12
  export * from "@tanstack/hotkeys"
12
13
 
13
- export { AppHotkeysController, HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, KeyHoldController, hotkey };
14
+ export { AppHotkeysController, HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, HotkeyScopesStateController, KeyHoldController, hotkey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/lit-hotkeys",
3
- "version": "0.17.0",
3
+ "version": "0.18.1",
4
4
  "description": "Lit adapter for TanStack Hotkeys",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "skills"
36
36
  ],
37
37
  "dependencies": {
38
- "@tanstack/hotkeys": "0.17.0"
38
+ "@tanstack/hotkeys": "0.19.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "lit": "^3.3.3"
@@ -63,19 +63,20 @@ export class MyEditor extends LitElement {
63
63
 
64
64
  ## API
65
65
 
66
- | API | What it's for |
67
- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
68
- | `@hotkey(hotkey, options?)` | Run the decorated method when the hotkey fires, with options fixed when the class is defined. |
69
- | `new HotkeyController(host, hotkey, callback, options?)` | Register a hotkey whose options can change; add it with `this.addController(...)`. |
70
- | `provideAppHotkeys(appHotkeys, options?)` | Declare app hotkeys and load the user's custom hotkeys once at startup, since Lit has no provider. |
71
- | `getHotkeyManager().activateScope(scope, options?)` | Turn on a scope, such as an exclusive one for a dialog; it returns the function that turns the scope off. |
72
- | `new AppHotkeysController(host)` | Read `appHotkeys`, the cheat sheet `list`, and `customHotkeys`, and change custom hotkeys with `setCustomHotkey`, `resetCustomHotkey`, and `findConflicts`. |
73
- | `new HotkeyRecorderController(host, options)` | Record a chord or sequence the user presses, for a settings screen. |
74
- | `new HotkeyRegistrationsController(host)` | Read `.hotkeys`, every registered hotkey with its options and `meta`. |
75
- | `new HotkeyHintController(host, hotkey, options?)` | Read `.value`, whether held modifiers should reveal a shortcut's hint. |
76
- | `new KeyHoldController(host, key)` | Read `.value`, whether one key is held. |
77
- | `new HeldKeysController(host)` | Read `.value`, every key that's held right now. |
78
- | `new HeldKeyCodesController(host)` | Read `.value`, which maps each held key to its physical `event.code`. |
66
+ | API | What it's for |
67
+ | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
68
+ | `@hotkey(hotkey, options?)` | Run the decorated method when the hotkey fires, with options fixed when the class is defined. |
69
+ | `new HotkeyController(host, hotkey, callback, options?)` | Register a hotkey whose options can change; add it with `this.addController(...)`. |
70
+ | `provideAppHotkeys(appHotkeys, options?)` | Declare app hotkeys and load the user's custom hotkeys once at startup, since Lit has no provider. |
71
+ | `getHotkeyManager().activateScope(scope, options?)` | Turn on a scope, such as an exclusive one for a dialog; it returns the function that turns the scope off. |
72
+ | `new AppHotkeysController(host)` | Read `appHotkeys`, the cheat sheet `list`, and `customHotkeys`, and change custom hotkeys with `setCustomHotkey`, `resetCustomHotkey`, and `findConflicts`. |
73
+ | `new HotkeyRecorderController(host, options)` | Record a chord or sequence the user presses, for a settings screen. |
74
+ | `new HotkeyRegistrationsController(host)` | Read `.hotkeys`, every registered hotkey with its options, `meta`, and `status` (whether it's enabled and in an active scope). |
75
+ | `new HotkeyScopesStateController(host)` | Read `.value`, the active scopes and the exclusive scope that owns the keyboard. |
76
+ | `new HotkeyHintController(host, hotkey, options?)` | Read `.value`, 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. |
77
+ | `new KeyHoldController(host, key)` | Read `.value`, whether one key is held. Pass a getter, such as `() => this.key`, for a key that changes. |
78
+ | `new HeldKeysController(host)` | Read `.value`, every key that's held right now. |
79
+ | `new HeldKeyCodesController(host)` | Read `.value`, which maps each held key to its physical `event.code`. |
79
80
 
80
81
  The package also re-exports `@tanstack/hotkeys`, such as `formatForDisplay`, `matchesKeyboardEvent`, and `defineAppHotkeys`.
81
82