@tanstack/svelte-hotkeys 0.21.0 → 0.21.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 type { AppHotkeys, AppHotkeysStore, CustomHotkeys, HotkeyChordRecorderOptions, HotkeyPlatform, HotkeySequenceRecorderOptions } from '@tanstack/hotkeys';
2
2
  import type { HotkeysProviderScopeProps } from '@tanstack/hotkeys/adapter';
3
- import type { CreateHotkeyCommonOptions } from './createHotkey.svelte.js';
4
3
  import type { Snippet } from 'svelte';
4
+ import type { CreateHotkeyCommonOptions } from './createHotkey.svelte.js';
5
5
  export interface HotkeysProviderOptions {
6
6
  /**
7
7
  * The user's platform, for labels from `getFormatForDisplay`, hotkeys, and
@@ -29,8 +29,8 @@ export interface HotkeysContextOptions extends HotkeysProviderScopeProps {
29
29
  /**
30
30
  * The user's saved custom hotkeys. When the value changes, such as after
31
31
  * saved data loads or the user signs in, it replaces the current custom
32
- * hotkeys. `undefined` leaves them unchanged; `null` clears them. Invalid
33
- * entries are ignored with a warning.
32
+ * hotkeys. `undefined` leaves them unchanged; `null` clears them. Unknown
33
+ * ids and invalid entries are ignored.
34
34
  */
35
35
  customHotkeys?: CustomHotkeys | null;
36
36
  /** Called with the custom hotkeys after every change, ready to save. */
@@ -1,6 +1,6 @@
1
- import { createContext, onMount } from 'svelte';
2
1
  import { publishAppHotkeysStore } from '@tanstack/hotkeys';
3
2
  import { createAppHotkeysStore, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults, } from '@tanstack/hotkeys/adapter';
3
+ import { createContext, onMount } from 'svelte';
4
4
  import { activateScopeWhileMounted } from './internal.svelte.js';
5
5
  export const DEFAULT_OPTIONS = {};
6
6
  const [useHotkeysContext, setHotkeysContextValue] = createContext();
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import { setHotkeysContextSource } from './HotkeysCtx.js'
3
-
4
3
  import type { HotkeysProviderProps } from './HotkeysCtx.js'
5
4
 
6
5
  let {
@@ -1,6 +1,6 @@
1
- import type { Attachment } from 'svelte/attachments';
2
1
  import type { AppHotkey, HotkeyCallback, HotkeyCallbackContextFor, RegisterableHotkey } from '@tanstack/hotkeys';
3
2
  import type { AdapterAppHotkeyOptions, AdapterChordOptions, AdapterCommonOptions, AdapterHotkeyOptions, AdapterOptionsFor, AdapterSequenceOptions } from '@tanstack/hotkeys/adapter';
3
+ import type { Attachment } from 'svelte/attachments';
4
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;
@@ -1,7 +1,7 @@
1
- import type { Attachment } from 'svelte/attachments';
2
1
  import type { AppHotkey, HotkeyCallback, RegisterableHotkey, RegisterableHotkeyChord, RegisterableHotkeySequence } from '@tanstack/hotkeys';
3
- import type { MaybeGetter } from './internal.svelte.js';
2
+ import type { Attachment } from 'svelte/attachments';
4
3
  import type { CreateAppHotkeyOptions, CreateHotkeyChordOptions, CreateHotkeyCommonOptions, CreateHotkeyOptions, CreateHotkeySequenceOptions } from './createHotkey.svelte.js';
4
+ import type { MaybeGetter } from './internal.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,10 +1,10 @@
1
1
  import { getHotkeysContext } from './HotkeysCtx.js';
2
- import { createStoreSubscriber } from './internal.svelte.js';
3
2
  import { getHotkeyRegistrations } from './getHotkeyRegistrations.svelte.js';
3
+ import { createStoreSubscriber } from './internal.svelte.js';
4
4
  function requireStore(name) {
5
5
  const store = getHotkeysContext()?.appHotkeysStore;
6
6
  if (!store) {
7
- throw new Error(`${name} requires a HotkeysProvider with appHotkeys`);
7
+ throw new Error(`[hotkeys] ${name} requires a HotkeysProvider with appHotkeys`);
8
8
  }
9
9
  return {
10
10
  store: store,
@@ -1,5 +1,5 @@
1
- import { createSubscriber } from 'svelte/reactivity';
2
1
  import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey, } from '@tanstack/hotkeys';
2
+ import { createSubscriber } from 'svelte/reactivity';
3
3
  import { getHotkeysContext } from './HotkeysCtx.js';
4
4
  import { resolveMaybeGetter } from './internal.svelte.js';
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { createSubscriber } from 'svelte/reactivity';
2
1
  import { activateHotkeysProviderScope } from '@tanstack/hotkeys/adapter';
2
+ import { createSubscriber } from 'svelte/reactivity';
3
3
  export function resolveMaybeGetter(value) {
4
4
  return typeof value === 'function' ? value() : value;
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/svelte-hotkeys",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "Svelte adapter for TanStack Hotkeys",
5
5
  "author": "Kunal Rao",
6
6
  "license": "MIT",
@@ -41,14 +41,15 @@
41
41
  "skills"
42
42
  ],
43
43
  "dependencies": {
44
- "@tanstack/hotkeys": "0.24.0"
44
+ "@tanstack/hotkeys": "0.25.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@sveltejs/package": "^3.0.0",
47
+ "@sveltejs/package": "^3.0.2",
48
48
  "@sveltejs/vite-plugin-svelte": "^7.3.1",
49
- "@typescript-eslint/parser": "^8.71.0",
50
- "eslint-plugin-svelte": "^3.23.0",
51
- "svelte": "^5.57.1"
49
+ "@typescript-eslint/parser": "^8.72.1",
50
+ "eslint": "^10.14.0",
51
+ "eslint-plugin-svelte": "^3.24.0",
52
+ "svelte": "^5.57.3"
52
53
  },
53
54
  "peerDependencies": {
54
55
  "svelte": "^5.40.0"
@@ -58,6 +59,7 @@
58
59
  },
59
60
  "scripts": {
60
61
  "clean": "premove ./dist ./coverage",
62
+ "test:oxlint": "oxlint ./src",
61
63
  "test:eslint": "eslint ./src",
62
64
  "test:lib": "vitest --passWithNoTests",
63
65
  "test:lib:dev": "pnpm test:lib --watch",