@tanstack/hotkeys-devtools 1.8.1 → 1.9.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.
- package/dist/HotkeysContextProvider.js +2 -3
- package/dist/_issues.js +23 -0
- package/dist/_registrations.js +2 -3
- package/dist/_scopes.js +1 -2
- package/dist/_trigger.js +1 -2
- package/dist/components/ActionButtons.js +2 -3
- package/dist/components/DetailsPanel.js +420 -358
- package/dist/components/HeldKeysTopbar.js +2 -3
- package/dist/components/HotkeyList.js +4 -5
- package/dist/components/Shell.js +2 -3
- package/dist/components/index.js +1 -2
- package/dist/core.d.ts +1 -3
- package/dist/core.js +1 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -2
- package/dist/production.d.ts +1 -1
- package/dist/sequence-progress.js +1 -2
- package/dist/styles/tokens.js +1 -2
- package/dist/styles/use-styles.js +9 -2
- package/dist/types.d.ts +1 -3
- package/package.json +7 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { needsSequenceProgressClock } from "./sequence-progress.js";
|
|
2
2
|
import { createComponent } from "solid-js/web";
|
|
3
|
-
import { createContext, createEffect, createMemo, createSignal, onCleanup, useContext } from "solid-js";
|
|
4
3
|
import { HotkeyManager, KeyStateTracker, toHotkeyRegistrationView } from "@tanstack/hotkeys";
|
|
4
|
+
import { createContext, createEffect, createMemo, createSignal, onCleanup, useContext } from "solid-js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/HotkeysContextProvider.tsx
|
|
7
7
|
const HotkeysDevtoolsContext = createContext({
|
|
8
8
|
registrations: () => [],
|
|
9
9
|
appHotkeys: () => [],
|
|
@@ -104,5 +104,4 @@ function useHotkeysDevtoolsState() {
|
|
|
104
104
|
return useContext(HotkeysDevtoolsContext);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
//#endregion
|
|
108
107
|
export { HotkeysContextProvider, useHotkeysDevtoolsState };
|
package/dist/_issues.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { validateHotkey } from "@tanstack/hotkeys";
|
|
2
|
+
|
|
3
|
+
// src/_issues.ts
|
|
4
|
+
const DESCRIPTIONS = {
|
|
5
|
+
empty: () => "The hotkey is empty, so it registers nothing.",
|
|
6
|
+
"empty-part": () => "A part between + signs is empty, so the hotkey registers nothing.",
|
|
7
|
+
"unknown-modifier": (part) => `'${part}' isn't a modifier, so the hotkey registers nothing. Use Control, Alt, Shift, Meta, or Mod.`,
|
|
8
|
+
"invalid-physical-key": (part) => `'${part}' isn't a KeyboardEvent.code. Write physical keys like [KeyS].`,
|
|
9
|
+
"modifier-only": (part) => `'${part}' is a modifier, so the hotkey registers nothing. Add a key that isn't a modifier.`,
|
|
10
|
+
"unknown-key": (part) => `'${part}' isn't a known key name, so the hotkey may never fire. Key names are case-sensitive, such as Escape and F1.`
|
|
11
|
+
};
|
|
12
|
+
/** A readable sentence for one issue from `validateHotkey`. */
|
|
13
|
+
function describeHotkeyIssue(issue) {
|
|
14
|
+
const text = DESCRIPTIONS[issue.reason](issue.part ?? "");
|
|
15
|
+
return issue.step === void 0 ? text : `Step ${issue.step + 1}: ${text}`;
|
|
16
|
+
}
|
|
17
|
+
/** Readable errors and warnings for a hotkey, errors first. */
|
|
18
|
+
function describeHotkeyIssues(hotkey) {
|
|
19
|
+
const { errors, warnings } = validateHotkey(hotkey);
|
|
20
|
+
return [...errors, ...warnings].map(describeHotkeyIssue);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { describeHotkeyIssues };
|
package/dist/_registrations.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useHotkeysDevtoolsState } from "./HotkeysContextProvider.js";
|
|
2
|
-
import { createMemo } from "solid-js";
|
|
3
2
|
import { findHotkeyConflicts, formatForDisplay } from "@tanstack/hotkeys";
|
|
3
|
+
import { createMemo } from "solid-js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/_registrations.ts
|
|
6
6
|
/** Refresh shared conflict reporting when either registry changes. */
|
|
7
7
|
function useRegistrationConflicts(registration) {
|
|
8
8
|
const state = useHotkeysDevtoolsState();
|
|
@@ -46,5 +46,4 @@ function getBindingKind(reg) {
|
|
|
46
46
|
return codes === 0 ? "Key" : codes === parsed.length ? "Code" : "Mixed";
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
//#endregion
|
|
50
49
|
export { formatRegistration, getBindingKind, useRegistrationConflicts };
|
package/dist/_scopes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/_scopes.ts
|
|
2
2
|
const scopeStatusDescriptions = {
|
|
3
3
|
exclusive: "Exclusive: only hotkeys in this scope, scopes nested in it, and scopes it allows fire",
|
|
4
4
|
allowed: "Allowed: the exclusive scope lets hotkeys in this scope fire",
|
|
@@ -37,5 +37,4 @@ function groupByScope(registrations, state) {
|
|
|
37
37
|
}));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
export { getScopeStatus, groupByScope, scopeStatusDescriptions };
|
package/dist/_trigger.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HotkeyManager } from "@tanstack/hotkeys";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/_trigger.ts
|
|
4
4
|
/**
|
|
5
5
|
* Runs a registration's callback as if its hotkey, or a sequence's last step,
|
|
6
6
|
* was pressed, and counts it like a real press. The event names the physical
|
|
@@ -37,5 +37,4 @@ function triggerRegistration(id, manager = HotkeyManager.getInstance()) {
|
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
export { triggerRegistration };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useStyles } from "../styles/use-styles.js";
|
|
2
1
|
import { triggerRegistration } from "../_trigger.js";
|
|
2
|
+
import { useStyles } from "../styles/use-styles.js";
|
|
3
3
|
import { className, delegateEvents, effect, template } from "solid-js/web";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/components/ActionButtons.tsx
|
|
6
6
|
var _tmpl$ = /*#__PURE__*/ template(`<div><button><span></span>Trigger`);
|
|
7
7
|
function ActionButtons(props) {
|
|
8
8
|
const styles = useStyles();
|
|
@@ -28,5 +28,4 @@ function ActionButtons(props) {
|
|
|
28
28
|
}
|
|
29
29
|
delegateEvents(["mousedown"]);
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
31
|
export { ActionButtons };
|