@inklu/keys 1.4.1 → 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inklu/keys",
3
- "version": "1.4.1",
3
+ "version": "2.0.1",
4
4
  "description": "A command system for the web — typed commands, portable keybindings, scopes, sequences, conflict detection, rebinding, and platform-aware display.",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -32,45 +32,29 @@
32
32
  ],
33
33
  "type": "module",
34
34
  "sideEffects": false,
35
- "main": "./dist/index.js",
36
- "module": "./dist/index.js",
37
- "types": "./dist/index.d.ts",
38
35
  "exports": {
39
- ".": {
40
- "types": "./dist/index.d.ts",
41
- "import": "./dist/index.js",
42
- "default": "./dist/index.js"
43
- },
44
- "./react": {
45
- "types": "./dist/react.d.ts",
46
- "import": "./dist/react.js",
47
- "default": "./dist/react.js"
48
- },
49
- "./attributes": {
50
- "types": "./dist/attributes.d.ts",
51
- "import": "./dist/attributes.js",
52
- "default": "./dist/attributes.js"
53
- },
36
+ ".": "./dist/index.mjs",
37
+ "./attributes": "./dist/attributes.mjs",
38
+ "./react": "./dist/react.mjs",
54
39
  "./package.json": "./package.json"
55
40
  },
56
41
  "publishConfig": {
57
42
  "access": "public"
58
43
  },
59
44
  "dependencies": {
60
- "@tanstack/hotkeys": "0.8.0"
45
+ "@tanstack/hotkeys": "^0.10.0"
61
46
  },
62
47
  "devDependencies": {
63
48
  "@inklu/tsconfig": "1.0.0",
64
- "@testing-library/react": "^16.3.2",
65
- "@types/react": "^19",
66
- "@vitest/coverage-v8": "4.1.11",
67
- "jsdom": "^29.1.1",
68
- "react": "19.2.8",
69
- "react-dom": "19.2.8",
70
- "typescript": "^5.8.2",
71
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
72
- "vite-plus": "0.3.0",
73
- "vitest": "4.1.11"
49
+ "@testing-library/react": "^16.3.3",
50
+ "@types/react": "^19.3.0",
51
+ "@types/react-dom": "^19.3.0",
52
+ "jsdom": "^30.1.1",
53
+ "publint": "^0.3.24",
54
+ "react": "^19.3.0",
55
+ "react-dom": "^19.3.0",
56
+ "typescript": "^7.0.2",
57
+ "vite-plus": "1.0.0-rc.0"
74
58
  },
75
59
  "peerDependencies": {
76
60
  "react": "^18.0.0 || ^19.0.0"
@@ -80,20 +64,9 @@
80
64
  "optional": true
81
65
  }
82
66
  },
83
- "engines": {
84
- "node": ">=18"
85
- },
86
67
  "scripts": {
87
68
  "build": "vp pack",
88
- "lint:exports": "publint",
89
69
  "dev": "vp pack --watch",
90
- "lint": "vp lint",
91
- "check": "vp check",
92
- "format": "vp fmt --write",
93
- "check-types": "tsc --noEmit",
94
- "typecheck": "tsc --noEmit",
95
- "test": "vp test run",
96
- "test:watch": "vp test",
97
- "test:coverage": "vp test run --coverage"
70
+ "test": "vp test"
98
71
  }
99
72
  }
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { A as Platform, C as CommandDefinition, D as HotkeySequence, E as Hotkey, M as SequenceBinding, N as SerializedBinding, O as KeymapPersistence, S as CommandContext, T as Conflict, _ as formatBinding, a as Commands, b as Chord, c as PendingSequence, d as createCommands, f as CommandKeymap, g as bindingTokens, h as ariaKeyShortcuts, i as CommandId, j as ScopeOptions, k as KeymapStorage, l as RunBlockReason, m as DisplayOptions, n as observe, o as CommandsOptions, p as SerializedKeymap, r as CommandHandle, s as ConflictOptions, t as ObserveOptions, u as RunOptions, v as Binding, w as CommandSource, x as Command, y as BindingInput } from "./attributes-O6bXNKT9.js";
2
- import { a as Rebinder, c as seq, i as RebindState, l as validateBinding, n as RebindMode, o as createRebinder, r as RebindOptions, s as BindingValidation, t as ALWAYS_SCOPE } from "./index-B5iiRwCy.js";
3
- export { ALWAYS_SCOPE, type Binding, type BindingInput, type BindingValidation, type Chord, type Command, type CommandContext, type CommandDefinition, type CommandHandle, type CommandId, type CommandKeymap, type CommandSource, type Commands, type CommandsOptions, type Conflict, type ConflictOptions, type DisplayOptions, type Hotkey, type HotkeySequence, type KeymapPersistence, type KeymapStorage, type ObserveOptions, type PendingSequence, type Platform, type RebindMode, type RebindOptions, type RebindState, type Rebinder, type RunBlockReason, type RunOptions, type ScopeOptions, type SequenceBinding, type SerializedBinding, type SerializedKeymap, ariaKeyShortcuts, bindingTokens, createCommands, createRebinder, formatBinding, observe, seq, validateBinding };
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- import { observe } from "./attributes.js";
2
- import { a as bindingTokens, c as seq, i as ariaKeyShortcuts, n as ALWAYS_SCOPE, o as formatBinding, r as createRebinder, t as createCommands, u as validateBinding } from "./src-DWmUPZSL.js";
3
- export { ALWAYS_SCOPE, ariaKeyShortcuts, bindingTokens, createCommands, createRebinder, formatBinding, observe, seq, validateBinding };
package/dist/react.d.ts DELETED
@@ -1,77 +0,0 @@
1
- import { A as Platform, C as CommandDefinition, D as HotkeySequence, E as Hotkey, M as SequenceBinding, N as SerializedBinding, O as KeymapPersistence, S as CommandContext, T as Conflict, _ as formatBinding, a as Commands, b as Chord, c as PendingSequence, d as createCommands, f as CommandKeymap, g as bindingTokens, h as ariaKeyShortcuts, i as CommandId, j as ScopeOptions, k as KeymapStorage, l as RunBlockReason, m as DisplayOptions, n as observe, o as CommandsOptions, p as SerializedKeymap, r as CommandHandle, s as ConflictOptions, t as ObserveOptions, u as RunOptions, v as Binding, w as CommandSource, x as Command, y as BindingInput } from "./attributes-O6bXNKT9.js";
2
- import { a as Rebinder, c as seq, i as RebindState, l as validateBinding, n as RebindMode, o as createRebinder, r as RebindOptions, s as BindingValidation, t as ALWAYS_SCOPE } from "./index-B5iiRwCy.js";
3
- //#region src/react/hooks.d.ts
4
- /**
5
- * Mounts a commands registry for the lifecycle of the component.
6
- *
7
- * @example
8
- * ```tsx
9
- * function App() {
10
- * useMountCommands(commands);
11
- * return <Shortcuts />;
12
- * }
13
- * ```
14
- */
15
- declare function useMountCommands<Id extends string>(registry: Commands<Id>): void;
16
- /** Returns all registered commands, re-rendering when the registry changes. */
17
- declare function useCommands<Id extends string>(registry: Commands<Id>): ReadonlyArray<Command<Id>>;
18
- /** Returns a specific command snapshot by ID. */
19
- declare function useCommand<Id extends string>(registry: Commands<Id>, id: NoInfer<Id>): Command<Id> | undefined;
20
- /** Returns display and accessibility shortcuts for a command. */
21
- declare function useShortcut<Id extends string>(registry: Commands<Id>, id: NoInfer<Id>): {
22
- display: string;
23
- tokens: ReadonlyArray<string>;
24
- aria: string;
25
- };
26
- /**
27
- * Activates a scope for the lifecycle of the component.
28
- *
29
- * @example
30
- * ```tsx
31
- * useScope(commands, "dialog", isOpen, { exclusive: true });
32
- * ```
33
- */
34
- declare function useScope<Id extends string>(registry: Commands<Id>, name: string, active?: boolean, options?: ScopeOptions): void;
35
- /** Registers a dynamic command for the lifecycle of the component. */
36
- declare function useRegisterCommand<Id extends string>(registry: Commands<Id>, id: NoInfer<Id> | (string & {}), definition: CommandDefinition): void;
37
- /** State and actions for rebinding a command. */
38
- interface UseRebindResult<Id extends string = string> extends RebindState<Id> {
39
- /** Active display string for the shortcut. */
40
- display: string;
41
- /** Display tokens for rendering `<kbd>` elements. */
42
- tokens: ReadonlyArray<string>;
43
- /** Whether the shortcut has been customized by the user. */
44
- overridden: boolean;
45
- start: () => void;
46
- stop: () => void;
47
- cancel: () => void;
48
- commit: () => void;
49
- clear: () => void;
50
- reset: () => void;
51
- }
52
- /** Hook for recording and configuring a command's keybindings. */
53
- declare function useRebind<Id extends string>(registry: Commands<Id>, id: NoInfer<Id>, options?: RebindOptions<Id>): UseRebindResult<Id>;
54
- /** Returns an array of keys currently held down. */
55
- declare function useHeldKeys(): ReadonlyArray<string>;
56
- /**
57
- * Checks whether a specific key is currently held down.
58
- *
59
- * @example
60
- * ```tsx
61
- * const shift = useKeyHold("Shift");
62
- * ```
63
- */
64
- declare function useKeyHold(key: string): boolean;
65
- /** Returns a map of held key identifiers to physical event codes. */
66
- declare function useHeldKeyCodes(): Readonly<Record<string, string>>;
67
- /**
68
- * Returns currently active partially-typed sequences.
69
- *
70
- * @example
71
- * ```tsx
72
- * const pending = usePendingSequences(commands);
73
- * ```
74
- */
75
- declare function usePendingSequences<Id extends string>(registry: Commands<Id>): ReadonlyArray<PendingSequence<Id>>;
76
- //#endregion
77
- export { ALWAYS_SCOPE, type Binding, type BindingInput, type BindingValidation, type Chord, type Command, type CommandContext, type CommandDefinition, type CommandHandle, type CommandId, type CommandKeymap, type CommandSource, type Commands, type CommandsOptions, type Conflict, type ConflictOptions, type DisplayOptions, type Hotkey, type HotkeySequence, type KeymapPersistence, type KeymapStorage, type ObserveOptions, type PendingSequence, type Platform, type RebindMode, type RebindOptions, type RebindState, type Rebinder, type RunBlockReason, type RunOptions, type ScopeOptions, type SequenceBinding, type SerializedBinding, type SerializedKeymap, type UseRebindResult, ariaKeyShortcuts, bindingTokens, createCommands, createRebinder, formatBinding, observe, seq, useCommand, useCommands, useHeldKeyCodes, useHeldKeys, useKeyHold, useMountCommands, usePendingSequences, useRebind, useRegisterCommand, useScope, useShortcut, validateBinding };