@tanstack/angular-hotkeys 0.17.0 → 0.18.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.
@@ -0,0 +1,20 @@
1
+ import { DestroyRef, inject, linkedSignal } from "@angular/core";
2
+
3
+ //#region src/_injectSelector.ts
4
+ /**
5
+ * Subscribes to a store until the injection context is destroyed and returns
6
+ * a signal of the selected value, which updates when it changes (by `===`).
7
+ * Must be called in an injection context.
8
+ */
9
+ function injectSelector(store, selector) {
10
+ const destroyRef = inject(DestroyRef);
11
+ const selected = linkedSignal(() => selector(store.get()));
12
+ const { unsubscribe } = store.subscribe((state) => {
13
+ selected.set(selector(state));
14
+ });
15
+ destroyRef.onDestroy(unsubscribe);
16
+ return selected.asReadonly();
17
+ }
18
+
19
+ //#endregion
20
+ export { injectSelector };
@@ -1,6 +1,6 @@
1
- import { AppHotkeysStore, publishAppHotkeysStore } from "@tanstack/hotkeys";
1
+ import { publishAppHotkeysStore } from "@tanstack/hotkeys";
2
2
  import { DestroyRef, InjectionToken, Injector, computed, effect, inject, runInInjectionContext, signal } from "@angular/core";
3
- import { activateHotkeysProviderScope, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
3
+ import { activateHotkeysProviderScope, createAppHotkeysStore, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
4
4
 
5
5
  //#region src/hotkeys-provider.ts
6
6
  const NO_APP_HOTKEYS = signal(null).asReadonly();
@@ -27,7 +27,7 @@ function createHotkeysContext(options) {
27
27
  let store = null;
28
28
  let appHotkeysState = parent.appHotkeysState;
29
29
  if (appHotkeys) {
30
- store = new AppHotkeysStore(appHotkeys, {
30
+ store = createAppHotkeysStore(appHotkeys, {
31
31
  customHotkeys,
32
32
  onCustomHotkeysChange
33
33
  });
@@ -1,5 +1,5 @@
1
+ import { injectSelector } from "./_injectSelector.js";
1
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
- import { injectSelector } from "@tanstack/angular-store";
3
3
 
4
4
  //#region src/injectHeldKeyCodes.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
+ import { injectSelector } from "./_injectSelector.js";
1
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
- import { injectSelector } from "@tanstack/angular-store";
3
3
 
4
4
  //#region src/injectHeldKeys.ts
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  import { injectHotkeysContext } from "./hotkeys-provider.js";
2
+ import { injectSelector } from "./_injectSelector.js";
2
3
  import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
3
4
  import { computed } from "@angular/core";
4
- import { injectSelector } from "@tanstack/angular-store";
5
5
 
6
6
  //#region src/injectHotkeyHint.ts
7
7
  /**
@@ -1,5 +1,5 @@
1
+ import { injectSelector } from "./_injectSelector.js";
1
2
  import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
2
- import { injectSelector } from "@tanstack/angular-store";
3
3
 
4
4
  //#region src/injectHotkeyRegistrations.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
+ import { injectSelector } from "./_injectSelector.js";
1
2
  import { getHotkeyManager } from "@tanstack/hotkeys";
2
- import { injectSelector } from "@tanstack/angular-store";
3
3
 
4
4
  //#region src/injectHotkeyScopesState.ts
5
5
  /**
@@ -1,6 +1,6 @@
1
+ import { injectSelector } from "./_injectSelector.js";
1
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
3
  import { computed } from "@angular/core";
3
- import { injectSelector } from "@tanstack/angular-store";
4
4
 
5
5
  //#region src/injectKeyHold.ts
6
6
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/angular-hotkeys",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Angular adapter for TanStack Hotkeys",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -37,8 +37,7 @@
37
37
  "skills"
38
38
  ],
39
39
  "dependencies": {
40
- "@tanstack/angular-store": "^0.11.2",
41
- "@tanstack/hotkeys": "0.18.0"
40
+ "@tanstack/hotkeys": "0.20.0"
42
41
  },
43
42
  "peerDependencies": {
44
43
  "@angular/common": ">=19.0.0",