@tanstack/lit-hotkeys 0.22.1 → 0.22.2

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,11 +1,10 @@
1
1
  import { getHotkeyManager } from "@tanstack/hotkeys";
2
2
  import { subscribePublishedAppHotkeys as subscribeAppHotkeys } from "@tanstack/hotkeys/adapter";
3
3
 
4
- //#region src/controllers/_app-hotkeys.ts
4
+ // src/controllers/_app-hotkeys.ts
5
5
  /** The app hotkeys store published by `provideAppHotkeys`, if any. */
6
6
  function getAppHotkeysStore() {
7
7
  return getHotkeyManager().appHotkeys.state;
8
8
  }
9
9
 
10
- //#endregion
11
10
  export { getAppHotkeysStore, subscribeAppHotkeys };
@@ -1,4 +1,4 @@
1
- //#region src/controllers/_server.ts
1
+ // src/controllers/_server.ts
2
2
  /**
3
3
  * Whether the code runs on a server. With `@lit-labs/ssr`'s
4
4
  * `connectedCallback: true` option, the server calls `hostConnected` and never
@@ -8,5 +8,4 @@ function isServer() {
8
8
  return typeof document === "undefined";
9
9
  }
10
10
 
11
- //#endregion
12
11
  export { isServer };
@@ -1,6 +1,5 @@
1
1
  import { AppHotkey, AppHotkeyListItem, CustomHotkeys, Hotkey, RegisteredAppHotkeys } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
- //#region src/controllers/app-hotkeys.d.ts
4
3
  /**
5
4
  * A Lit ReactiveController for app hotkeys provided with `provideAppHotkeys`:
6
5
  * the effective app hotkeys, a cheat sheet list with live status, and the
@@ -44,5 +43,4 @@ export declare class AppHotkeysController implements ReactiveController {
44
43
  findConflicts(id: keyof RegisteredAppHotkeys & string, hotkey: Hotkey): Array<AppHotkey>;
45
44
  hostConnected(): void;
46
45
  hostDisconnected(): void;
47
- }
48
- //#endregion
46
+ }
@@ -2,10 +2,10 @@ import { getAppHotkeysStore, subscribeAppHotkeys } from "./_app-hotkeys.js";
2
2
  import { isServer } from "./_server.js";
3
3
  import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
4
4
 
5
- //#region src/controllers/app-hotkeys.ts
5
+ // src/controllers/app-hotkeys.ts
6
6
  function requireStore() {
7
7
  const store = getAppHotkeysStore();
8
- if (!store) throw new Error("AppHotkeysController requires provideAppHotkeys()");
8
+ if (!store) throw new Error("[hotkeys] AppHotkeysController requires provideAppHotkeys()");
9
9
  return store;
10
10
  }
11
11
  /**
@@ -83,5 +83,4 @@ var AppHotkeysController = class {
83
83
  }
84
84
  };
85
85
 
86
- //#endregion
87
86
  export { AppHotkeysController };
@@ -1,5 +1,4 @@
1
1
  import { ReactiveController, ReactiveControllerHost } from "lit";
2
- //#region src/controllers/held-key-codes.d.ts
3
2
  /**
4
3
  * A Lit ReactiveController that tracks all currently held key names to their physical `event.code` values.
5
4
  *
@@ -38,5 +37,4 @@ export declare class HeldKeyCodesController implements ReactiveController {
38
37
  hostConnected(): void;
39
38
  /** Unsubscribes from the tracker store and stops tracking the held key codes. */
40
39
  hostDisconnected(): void;
41
- }
42
- //#endregion
40
+ }
@@ -1,7 +1,7 @@
1
1
  import { isServer } from "./_server.js";
2
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/controllers/held-key-codes.ts
4
+ // src/controllers/held-key-codes.ts
5
5
  /**
6
6
  * A Lit ReactiveController that tracks all currently held key names to their physical `event.code` values.
7
7
  *
@@ -63,5 +63,4 @@ var HeldKeyCodesController = class {
63
63
  }
64
64
  };
65
65
 
66
- //#endregion
67
66
  export { HeldKeyCodesController };
@@ -1,5 +1,4 @@
1
1
  import { ReactiveController, ReactiveControllerHost } from "lit";
2
- //#region src/controllers/held-keys.d.ts
3
2
  /**
4
3
  * A Lit ReactiveController that tracks all currently held keyboard keys.
5
4
  *
@@ -37,5 +36,4 @@ export declare class HeldKeysController implements ReactiveController {
37
36
  hostConnected(): void;
38
37
  /** Unsubscribes from the tracker store and stops tracking the held keys. */
39
38
  hostDisconnected(): void;
40
- }
41
- //#endregion
39
+ }
@@ -1,7 +1,7 @@
1
1
  import { isServer } from "./_server.js";
2
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/controllers/held-keys.ts
4
+ // src/controllers/held-keys.ts
5
5
  /**
6
6
  * A Lit ReactiveController that tracks all currently held keyboard keys.
7
7
  *
@@ -62,5 +62,4 @@ var HeldKeysController = class {
62
62
  }
63
63
  };
64
64
 
65
- //#endregion
66
65
  export { HeldKeysController };
@@ -1,6 +1,5 @@
1
1
  import { AppHotkey, HeldModifierOptions, RegisterableHotkey } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
- //#region src/controllers/hotkey-hint.d.ts
4
3
  /**
5
4
  * Modifier hint controller. Getter arguments can read reactive host
6
5
  * properties. No hotkey (`undefined`, `null`, or `''`) is never visible.
@@ -30,5 +29,4 @@ export declare class HotkeyHintController implements ReactiveController {
30
29
  hostDisconnected(): void;
31
30
  /** Recomputes visibility and reports whether the host needs another render. */
32
31
  private update;
33
- }
34
- //#endregion
32
+ }
@@ -2,7 +2,7 @@ import { getAppHotkeysStore, subscribeAppHotkeys } from "./_app-hotkeys.js";
2
2
  import { isServer } from "./_server.js";
3
3
  import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
4
4
 
5
- //#region src/controllers/hotkey-hint.ts
5
+ // src/controllers/hotkey-hint.ts
6
6
  /**
7
7
  * Modifier hint controller. Getter arguments can read reactive host
8
8
  * properties. No hotkey (`undefined`, `null`, or `''`) is never visible.
@@ -70,5 +70,4 @@ var HotkeyHintController = class {
70
70
  }
71
71
  };
72
72
 
73
- //#endregion
74
73
  export { HotkeyHintController };
@@ -1,6 +1,5 @@
1
1
  import { Hotkey, HotkeyChordRecorderOptions, HotkeyRecorderOptions, HotkeySequence, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
- //#region src/controllers/hotkey-recorder.d.ts
4
3
  /**
5
4
  * A Lit ReactiveController that records keyboard shortcuts.
6
5
  *
@@ -81,5 +80,4 @@ export declare class HotkeyRecorderController implements ReactiveController {
81
80
  cancelRecording(): void;
82
81
  /** Commit the recorded steps now (multi-step recordings). */
83
82
  commitRecording(): void;
84
- }
85
- //#endregion
83
+ }
@@ -1,7 +1,7 @@
1
1
  import { isServer } from "./_server.js";
2
2
  import { HotkeyRecorder } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/controllers/hotkey-recorder.ts
4
+ // src/controllers/hotkey-recorder.ts
5
5
  /**
6
6
  * A Lit ReactiveController that records keyboard shortcuts.
7
7
  *
@@ -123,5 +123,4 @@ var HotkeyRecorderController = class {
123
123
  }
124
124
  };
125
125
 
126
- //#endregion
127
126
  export { HotkeyRecorderController };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyRegistrationView } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
- //#region src/controllers/hotkey-registrations.d.ts
4
3
  /**
5
4
  * A Lit ReactiveController that reads every hotkey registration, chords and
6
5
  * sequences, from the singleton HotkeyManager and requests an update when
@@ -30,5 +29,4 @@ export declare class HotkeyRegistrationsController implements ReactiveController
30
29
  constructor(_host: ReactiveControllerHost);
31
30
  hostConnected(): void;
32
31
  hostDisconnected(): void;
33
- }
34
- //#endregion
32
+ }
@@ -1,7 +1,7 @@
1
1
  import { isServer } from "./_server.js";
2
2
  import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/controllers/hotkey-registrations.ts
4
+ // src/controllers/hotkey-registrations.ts
5
5
  /**
6
6
  * A Lit ReactiveController that reads every hotkey registration, chords and
7
7
  * sequences, from the singleton HotkeyManager and requests an update when
@@ -53,5 +53,4 @@ var HotkeyRegistrationsController = class {
53
53
  }
54
54
  };
55
55
 
56
- //#endregion
57
56
  export { HotkeyRegistrationsController };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyScopesState } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
- //#region src/controllers/hotkey-scopes-state.d.ts
4
3
  /**
5
4
  * A Lit ReactiveController that reads the hotkey manager's scope state: the
6
5
  * active scopes, the exclusive scope that owns the keyboard, and the scopes it
@@ -36,5 +35,4 @@ export declare class HotkeyScopesStateController implements ReactiveController {
36
35
  hostConnected(): void;
37
36
  /** Unsubscribes from the scopes store. */
38
37
  hostDisconnected(): void;
39
- }
40
- //#endregion
38
+ }
@@ -1,7 +1,7 @@
1
1
  import { isServer } from "./_server.js";
2
2
  import { getHotkeyManager } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/controllers/hotkey-scopes-state.ts
4
+ // src/controllers/hotkey-scopes-state.ts
5
5
  /**
6
6
  * A Lit ReactiveController that reads the hotkey manager's scope state: the
7
7
  * active scopes, the exclusive scope that owns the keyboard, and the scopes it
@@ -53,5 +53,4 @@ var HotkeyScopesStateController = class {
53
53
  }
54
54
  };
55
55
 
56
- //#endregion
57
56
  export { HotkeyScopesStateController };
@@ -1,7 +1,6 @@
1
1
  import { AppHotkey, HotkeyCallback, RegisterableHotkey, Target } from "@tanstack/hotkeys";
2
2
  import { AdapterAppHotkeyOptions, AdapterChordOptions, AdapterCommonOptions, AdapterHotkeyOptions, AdapterOptionsFor, AdapterSequenceOptions } from "@tanstack/hotkeys/adapter";
3
3
  import { ReactiveController, ReactiveControllerHost } from "lit";
4
- //#region src/controllers/hotkey.d.ts
5
4
  /** The element to listen on. A `null` target skips registration until it is set. */
6
5
  export type HotkeyControllerTarget = Target | null;
7
6
  /** Options shared by chords and sequences. */
@@ -59,4 +58,4 @@ export declare class HotkeyController implements ReactiveController {
59
58
  /** Releases registrations when the host disconnects. */
60
59
  hostDisconnected(): void;
61
60
  }
62
- //#endregion
61
+ export {};
@@ -2,7 +2,7 @@ import { getAppHotkeysStore, subscribeAppHotkeys } from "./_app-hotkeys.js";
2
2
  import { isServer } from "./_server.js";
3
3
  import { createHotkeyBindings, prepareHotkeyDefinitions } from "@tanstack/hotkeys/adapter";
4
4
 
5
- //#region src/controllers/hotkey.ts
5
+ // src/controllers/hotkey.ts
6
6
  /**
7
7
  * A Lit ReactiveController that registers a hotkey when the host element is
8
8
  * connected and unregisters it when the host is disconnected. The hotkey can
@@ -67,5 +67,4 @@ var HotkeyController = class {
67
67
  }
68
68
  };
69
69
 
70
- //#endregion
71
70
  export { HotkeyController };
@@ -1,7 +1,7 @@
1
- import { AppHotkeyControllerOptions, HotkeyController, HotkeyControllerChordOptions, HotkeyControllerCommonOptions, HotkeyControllerOptions, HotkeyControllerOptionsFor, HotkeyControllerSequenceOptions, HotkeyControllerTarget } from "./hotkey.js";
2
1
  import { AppHotkeysController } from "./app-hotkeys.js";
3
2
  import { HeldKeyCodesController } from "./held-key-codes.js";
4
3
  import { HeldKeysController } from "./held-keys.js";
4
+ import { AppHotkeyControllerOptions, HotkeyController, HotkeyControllerChordOptions, HotkeyControllerCommonOptions, HotkeyControllerOptions, HotkeyControllerOptionsFor, HotkeyControllerSequenceOptions, HotkeyControllerTarget } from "./hotkey.js";
5
5
  import { HotkeyRecorderController } from "./hotkey-recorder.js";
6
6
  import { HotkeyRegistrationsController } from "./hotkey-registrations.js";
7
7
  import { KeyHoldController } from "./key-hold.js";
@@ -1,6 +1,5 @@
1
1
  import { IndividualKey } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
- //#region src/controllers/key-hold.d.ts
4
3
  /**
5
4
  * A Lit ReactiveController that tracks whether a specific key is currently held.
6
5
  *
@@ -61,5 +60,4 @@ export declare class KeyHoldController implements ReactiveController {
61
60
  hostDisconnected(): void;
62
61
  /** Recomputes the held state and reports whether it changed. */
63
62
  private _refresh;
64
- }
65
- //#endregion
63
+ }
@@ -1,7 +1,7 @@
1
1
  import { isServer } from "./_server.js";
2
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/controllers/key-hold.ts
4
+ // src/controllers/key-hold.ts
5
5
  /**
6
6
  * A Lit ReactiveController that tracks whether a specific key is currently held.
7
7
  *
@@ -90,5 +90,4 @@ var KeyHoldController = class {
90
90
  }
91
91
  };
92
92
 
93
- //#endregion
94
93
  export { KeyHoldController };
@@ -1,7 +1,6 @@
1
1
  import { AppHotkeyControllerOptions, HotkeyControllerOptionsFor } from "../controllers/hotkey.js";
2
2
  import { AppHotkey, HotkeyCallback, HotkeyCallbackContext, HotkeyCallbackContextFor, RegisterableHotkey } from "@tanstack/hotkeys";
3
3
  import { ReactiveElement } from "lit";
4
- //#region src/decorators/hotkey.d.ts
5
4
  /**
6
5
  * A method decorator for legacy (`experimentalDecorators`) and standard
7
6
  * decorators. The method's context parameter can be typed as the context for
@@ -35,5 +34,4 @@ export type HotkeyDecorator<TContext extends HotkeyCallbackContext = HotkeyCallb
35
34
  * ```
36
35
  */
37
36
  export declare function hotkey<T extends AppHotkey>(hotkey: T, options?: AppHotkeyControllerOptions<T>): HotkeyDecorator;
38
- export declare function hotkey<const T extends RegisterableHotkey>(hotkey: T, options?: HotkeyControllerOptionsFor<T>): HotkeyDecorator<HotkeyCallbackContextFor<T>>;
39
- //#endregion
37
+ export declare function hotkey<const T extends RegisterableHotkey>(hotkey: T, options?: HotkeyControllerOptionsFor<T>): HotkeyDecorator<HotkeyCallbackContextFor<T>>;
@@ -1,6 +1,6 @@
1
1
  import { HotkeyController } from "../controllers/hotkey.js";
2
2
 
3
- //#region src/decorators/hotkey.ts
3
+ // src/decorators/hotkey.ts
4
4
  function hotkey(hotkey, options) {
5
5
  return (proto, context) => {
6
6
  const standard = typeof context === "object";
@@ -16,5 +16,4 @@ function hotkey(hotkey, options) {
16
16
  };
17
17
  }
18
18
 
19
- //#endregion
20
19
  export { hotkey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/lit-hotkeys",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
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.24.0"
38
+ "@tanstack/hotkeys": "0.25.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "lit": "^3.3.3"
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "scripts": {
47
47
  "clean": "premove ./build ./dist",
48
- "lint": "eslint ./src",
49
- "lint:fix": "eslint ./src --fix",
50
- "test:eslint": "eslint ./src",
48
+ "lint": "oxlint ./src",
49
+ "lint:fix": "oxlint ./src --fix",
50
+ "test:oxlint": "oxlint ./src",
51
51
  "test:lib": "vitest --passWithNoTests",
52
52
  "test:lib:dev": "pnpm test:lib --watch",
53
53
  "test:types": "tsc",
@@ -30,9 +30,9 @@ requires:
30
30
  Before starting, load the `@tanstack/hotkeys#hotkeys-core` skill (`npx @tanstack/intent@latest load @tanstack/hotkeys#hotkeys-core`).
31
31
 
32
32
  ```ts no-check
33
+ import { HotkeyController, hotkey } from '@tanstack/lit-hotkeys'
33
34
  import { LitElement, html } from 'lit'
34
35
  import { customElement, state } from 'lit/decorators.js'
35
- import { HotkeyController, hotkey } from '@tanstack/lit-hotkeys'
36
36
 
37
37
  @customElement('my-editor')
38
38
  export class MyEditor extends LitElement {
@@ -35,13 +35,13 @@ provideAppHotkeys(appHotkeys, {
35
35
  A settings row records with `HotkeyRecorderController`:
36
36
 
37
37
  ```ts no-check
38
- import { LitElement, html } from 'lit'
39
- import { property } from 'lit/decorators.js'
40
38
  import {
41
39
  AppHotkeysController,
42
40
  HotkeyRecorderController,
43
41
  formatForDisplay,
44
42
  } from '@tanstack/lit-hotkeys'
43
+ import { LitElement, html } from 'lit'
44
+ import { property } from 'lit/decorators.js'
45
45
  import type { AppHotkeyId } from '@tanstack/lit-hotkeys'
46
46
 
47
47
  export class ShortcutRow extends LitElement {