hotkey-router 0.4.0 → 0.5.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/README.md +71 -22
- package/data/browser-hotkeys.json +60 -57
- package/dist/auto.js +1 -1
- package/dist/auto.min.js +2 -2
- package/dist/core.js +1 -1
- package/dist/core.js.map +2 -2
- package/dist/format.js +1 -1
- package/dist/hotkey-router.cjs +1 -1
- package/dist/hotkey-router.cjs.map +2 -2
- package/dist/hotkey-router.js +1 -1
- package/dist/hotkey-router.min.js +1 -1
- package/dist/reservations.js +69 -65
- package/dist/reservations.js.map +2 -2
- package/dist/sites.js +1 -1
- package/dist/types/reservations.d.ts +13 -5
- package/dist/validate.js +2 -2
- package/dist/validate.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,12 +13,15 @@ A tiny, deterministic keyboard routing engine for modern web apps. Not a key uti
|
|
|
13
13
|
|
|
14
14
|
- O(1) dispatch
|
|
15
15
|
- Plugin-safe lifecycle management
|
|
16
|
-
- Deterministic winner selection (priority + recency)
|
|
17
|
-
-
|
|
16
|
+
- Deterministic winner selection (priority + recency); see [Who gets a key](#who-gets-a-key)
|
|
17
|
+
- Separate and scoped routers: per library, dialog, shadow root or iframe (`createRouter`)
|
|
18
|
+
- Input-safe by default, with an opt-in mode that lets chords through on checkboxes, sliders and buttons
|
|
19
|
+
- Works on any keyboard layout: physical-key `code:` bindings, and Ctrl/Cmd shortcuts on non-Latin layouts
|
|
20
|
+
- AltGr and IME aware: no shortcut fires while typing a character
|
|
18
21
|
- Testable via `trigger()`
|
|
19
|
-
- Optional opt-in browser/OS conflict warnings (tree-shakable)
|
|
22
|
+
- Optional opt-in browser/OS conflict warnings and website-shortcut awareness (tree-shakable)
|
|
20
23
|
- Display helpers: `Ctrl+Shift+.` / `⇧⌘.` and accessible keycaps (`hotkey-router/format`)
|
|
21
|
-
- ~4 kB minified + gzipped (core); ~
|
|
24
|
+
- ~4.9 kB minified + gzipped (core); ~9.5 kB with conflict warnings
|
|
22
25
|
- Zero dependencies
|
|
23
26
|
|
|
24
27
|
---
|
|
@@ -26,19 +29,22 @@ A tiny, deterministic keyboard routing engine for modern web apps. Not a key uti
|
|
|
26
29
|
## Install
|
|
27
30
|
|
|
28
31
|
```sh
|
|
29
|
-
|
|
32
|
+
npm install hotkey-router
|
|
30
33
|
```
|
|
31
34
|
|
|
35
|
+
(or `pnpm add hotkey-router`, `yarn add hotkey-router`)
|
|
36
|
+
|
|
32
37
|
ESM:
|
|
33
38
|
|
|
34
39
|
```js
|
|
35
40
|
import hotkeys from 'hotkey-router'
|
|
36
41
|
```
|
|
37
42
|
|
|
38
|
-
CommonJS:
|
|
43
|
+
CommonJS (the router is the `default` export):
|
|
39
44
|
|
|
40
45
|
```js
|
|
41
|
-
const hotkeys = require('hotkey-router')
|
|
46
|
+
const hotkeys = require('hotkey-router').default
|
|
47
|
+
const { createRouter } = require('hotkey-router')
|
|
42
48
|
```
|
|
43
49
|
|
|
44
50
|
CDN (ESM):
|
|
@@ -64,22 +70,19 @@ keys.init() // when your app is ready
|
|
|
64
70
|
```js
|
|
65
71
|
import hotkeys from 'hotkey-router'
|
|
66
72
|
|
|
67
|
-
// Simple keydown
|
|
68
|
-
hotkeys.bind('
|
|
73
|
+
// Simple keydown. `mod` is Cmd on macOS, Ctrl elsewhere.
|
|
74
|
+
hotkeys.bind('mod+shift+space', () => {
|
|
69
75
|
openCommandPalette()
|
|
70
76
|
})
|
|
71
77
|
|
|
72
|
-
// Multi-modifier combos, including the spacebar
|
|
73
|
-
hotkeys.bind('mod+shift+space', summonCommandPalette)
|
|
74
|
-
|
|
75
78
|
// Keyup using " up" suffix
|
|
76
|
-
hotkeys.bind('
|
|
77
|
-
console.log('Released
|
|
79
|
+
hotkeys.bind('mod+shift+x up', () => {
|
|
80
|
+
console.log('Released Ctrl+Shift+X')
|
|
78
81
|
})
|
|
79
82
|
|
|
80
83
|
// AHK-style modifiers also supported
|
|
81
|
-
hotkeys.bind('
|
|
82
|
-
openCommandPalette() // ctrl+k
|
|
84
|
+
hotkeys.bind('^!k', () => {
|
|
85
|
+
openCommandPalette() // ctrl+alt+k
|
|
83
86
|
})
|
|
84
87
|
|
|
85
88
|
// Bare-modifier bindings (Alt-as-mode UX)
|
|
@@ -90,13 +93,19 @@ hotkeys.bind('alt up', exitSelectMode) // fires on Alt keyup
|
|
|
90
93
|
// works on macOS where Option remaps Alt+X to ≈)
|
|
91
94
|
hotkeys.bind('alt+code:KeyX', deleteHovered, null, { preventDefault: true })
|
|
92
95
|
|
|
93
|
-
// Plugin grouping
|
|
96
|
+
// Plugin grouping. Plain keys don't fire while the user types in a field.
|
|
94
97
|
hotkeys.registerPlugin('docs', {
|
|
95
|
-
'
|
|
98
|
+
'/': openSearch,
|
|
96
99
|
'escape': closeSearch,
|
|
97
100
|
})
|
|
98
101
|
```
|
|
99
102
|
|
|
103
|
+
Browsers and the OS keep some shortcuts for themselves (Ctrl+T, Ctrl+W, Cmd+Q
|
|
104
|
+
and more); a page never gets those keys. The examples above use keys that are
|
|
105
|
+
free in every major browser. Before picking your own, see
|
|
106
|
+
[Who gets a key](#who-gets-a-key). `hotkey-router/auto` warns in the console
|
|
107
|
+
when you bind a reserved one.
|
|
108
|
+
|
|
100
109
|
---
|
|
101
110
|
|
|
102
111
|
## API
|
|
@@ -381,6 +390,11 @@ would: the synthetic event has both `key` and `code` (US layout), so
|
|
|
381
390
|
and the same guards apply (`when`, `ignoreInput`/`allowIn` with `target`,
|
|
382
391
|
priority, `once`, `pause()`).
|
|
383
392
|
|
|
393
|
+
Each router's `trigger()` fires only that router's bindings. It doesn't
|
|
394
|
+
check the router's scope: `target` only feeds the input check, so a router
|
|
395
|
+
on a dialog still fires for a `target` outside the dialog, where a real
|
|
396
|
+
keypress would never reach it.
|
|
397
|
+
|
|
384
398
|
---
|
|
385
399
|
|
|
386
400
|
## Notes
|
|
@@ -401,6 +415,38 @@ hotkeys.bind('escape', closeModal, null, {
|
|
|
401
415
|
})
|
|
402
416
|
```
|
|
403
417
|
|
|
418
|
+
### Who gets a key
|
|
419
|
+
|
|
420
|
+
A keypress meets these in order, and each one can stop it before the next:
|
|
421
|
+
|
|
422
|
+
1. **The browser and the OS.** Reserved shortcuts (Ctrl+T, Cmd+Q, Spotlight)
|
|
423
|
+
are taken before the page gets a keydown, and no listener can get them
|
|
424
|
+
back. [Conflict warnings](#conflict-warnings-v020) flag them when you bind.
|
|
425
|
+
2. **The capture phase, from `window` down to the focused element.** Bindings
|
|
426
|
+
with `{ capture: true }`, or every binding of a router started with
|
|
427
|
+
`init({ capture: true })`, run here, at the router's target. That's before
|
|
428
|
+
the page's own listeners below it, so they can stop the key with
|
|
429
|
+
`stopPropagation`. Listeners on the same target run in the order they were
|
|
430
|
+
added.
|
|
431
|
+
3. **The focused element, then the bubble phase back up.** The page's own
|
|
432
|
+
handlers (an editor's keymap, say) run first and can stop the key. Other
|
|
433
|
+
bindings run when it reaches the router's target. For the default router,
|
|
434
|
+
that's `window`, last of all.
|
|
435
|
+
4. **Inside one router**, each time its listener runs:
|
|
436
|
+
- **Lookup:** the bindings for the key (`ctrl+k`) and for the physical key
|
|
437
|
+
(`ctrl+code:KeyK`) are both candidates. The non-Latin fallback (`ctrl+k`
|
|
438
|
+
from Russian Ctrl+K) is tried only when neither has an eligible binding.
|
|
439
|
+
- **Checks per binding:** AltGr typing a character, IME composition, the
|
|
440
|
+
input check (`ignoreInput` / `allowIn`), auto-repeat, then `when`.
|
|
441
|
+
A paused router skips all of this.
|
|
442
|
+
- **One winner:** highest `priority`, then the most recently bound. One
|
|
443
|
+
binding per router fires in each phase.
|
|
444
|
+
- **What the winner can do:** `preventDefault` stops the browser's own action
|
|
445
|
+
(typing the character, scrolling). `stopPropagation` and
|
|
446
|
+
`stopImmediatePropagation` stop the event as in steps 2 and 3.
|
|
447
|
+
5. **Between routers:** each picks its own winner, and both fire if the event
|
|
448
|
+
reaches both. See [Multiple routers](#multiple-routers-v040).
|
|
449
|
+
|
|
404
450
|
### Multiple routers (v0.4.0+)
|
|
405
451
|
|
|
406
452
|
The default export is one router, started on `window` at import. Each
|
|
@@ -458,9 +504,9 @@ The `code:` value is **case-sensitive** (matches the camelCase `KeyboardEvent.co
|
|
|
458
504
|
|
|
459
505
|
### Conflict warnings (v0.2.0+)
|
|
460
506
|
|
|
461
|
-
Some combos are reserved by the browser chrome (find bar, devtools, bookmarks) or the OS (Spotlight, window management).
|
|
507
|
+
Some combos are reserved by the browser chrome (find bar, devtools, bookmarks) or the OS (Spotlight, window management). The hard ones never reach page-world JavaScript, no matter how early you listen or whether you call `preventDefault`: Ctrl+T, Ctrl+N and Ctrl+W on Windows, for example. Others reach the page first, and the browser acts on them too unless the page calls `preventDefault`: most Ctrl+letter shortcuts on Windows and Linux, such as Ctrl+K, Ctrl+F, Ctrl+P and Ctrl+S (checked with real key presses in Chrome, Edge and Firefox on Windows, 2026-10-29). hotkey-router ships an **opt-in** reservation table that emits a warning at bind time, so the silent failure (or the double action) becomes a noisy one.
|
|
462
508
|
|
|
463
|
-
The feature is opt-in by design: the core router is ~
|
|
509
|
+
The feature is opt-in by design: the core router is ~11 KB minified (~4.9 KB gzipped), and the reservation module (~23 KB minified, ~5.5 KB gzipped, mostly data) is tree-shaken out entirely unless you import it.
|
|
464
510
|
|
|
465
511
|
**Two ways to opt in.** One-line ergonomic, use the `auto` entry. Same default export as `hotkey-router`, with warnings pre-installed. It is the same router object, so other files can keep importing `hotkey-router` and their bindings are warned about too (v0.3.3+; earlier versions shipped a second copy of the router in `auto`). The CDN file `dist/auto.min.js` is a standalone build with its own router; don't mix it with other hotkey-router imports.
|
|
466
512
|
|
|
@@ -496,6 +542,7 @@ hotkeys.bind('meta+shift+f', toggleFullscreen)
|
|
|
496
542
|
| `compose` | `info` | macOS Option+letter types a special char in inputs. |
|
|
497
543
|
| `system-text` | `info` | Mac Ctrl+letter cursor controls inside text inputs. |
|
|
498
544
|
| `devtools-open` | `info` | Only relevant when DevTools is already open. |
|
|
545
|
+
| `preventable` | `warn` without `preventDefault: true`, else `info` | The browser's shortcut, but the page sees it first and `preventDefault: true` keeps the browser out. Without it, both act. |
|
|
499
546
|
|
|
500
547
|
**Per-bind opt-out:**
|
|
501
548
|
|
|
@@ -606,8 +653,10 @@ field.addEventListener('keydown', (e) => {
|
|
|
606
653
|
Errors (`ok: false`): no key, no modifier, Alt as the only modifier on
|
|
607
654
|
Windows/Linux, a rule you asked for (`requirePrimary`, `minModifiers`),
|
|
608
655
|
already in `taken`, or reserved by a browser/OS (never reaches the page).
|
|
609
|
-
Warnings (`ok: true`): reserved only in some situations
|
|
610
|
-
|
|
656
|
+
Warnings (`ok: true`): reserved only in some situations; the browser's own
|
|
657
|
+
shortcut that the page can win with `preventDefault` (`details.severity` is
|
|
658
|
+
`'preventable'`; most Ctrl+letter keys on Windows and Linux); Ctrl+Alt acting
|
|
659
|
+
as AltGr on some Windows layouts; and sites that use the same keys.
|
|
611
660
|
|
|
612
661
|
It loads both data tables: with them, about 62 KB minified (~15 KB
|
|
613
662
|
gzipped). Import it in the settings page that records keys, not in code
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Machine-readable companion to docs/browser-hotkeys.md. Each combo entry describes who claims the binding and how strongly. Intended for runtime conflict warnings in keyboard-routing libraries (e.g. hotkey-router) and dev-time validation in apps like WebRadar. Update both this file and the markdown together — the markdown is the human source of truth, this file is the machine projection.",
|
|
3
3
|
"version": {
|
|
4
|
-
"generated": "2026-10-
|
|
4
|
+
"generated": "2026-10-29",
|
|
5
5
|
"schema": "1.0",
|
|
6
6
|
"sources": [
|
|
7
7
|
"https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"system-text": "Only reserved while a text input has focus (terminal-style cursor controls on macOS).",
|
|
24
24
|
"compose": "macOS Option+letter types a special character in text inputs. Outside inputs, free for page world.",
|
|
25
25
|
"os": "Operating system intercepts globally, before any application sees it.",
|
|
26
|
-
"devtools-open": "Only relevant when DevTools is already open; outside DevTools it fires normally."
|
|
26
|
+
"devtools-open": "Only relevant when DevTools is already open; outside DevTools it fires normally.",
|
|
27
|
+
"preventable": "The browser's own shortcut, but keydown reaches the page first: a binding with preventDefault() keeps the browser out, and without one the browser acts. Checked with real keys on Windows (docs/notes/key-check-reserved-2026-10-29.md)."
|
|
27
28
|
},
|
|
28
29
|
"$keyFormat": "Each combo key uses hotkey-router-compatible syntax: modifiers in canonical order (ctrl|meta|alt|shift) joined by '+', then the key (lowercased letter, or symbolic name). Per-platform tables use the platform's native modifier name — `meta` on macOS = Cmd, `meta` on Windows = Win, `ctrl` on Linux/Windows = the primary modifier.",
|
|
29
30
|
"platforms": {
|
|
@@ -168,27 +169,29 @@
|
|
|
168
169
|
"windows": {
|
|
169
170
|
"browsers": {
|
|
170
171
|
"firefox": {
|
|
171
|
-
"ctrl+a": { "action": "Select all", "severity": "
|
|
172
|
-
"ctrl+b": { "action": "Bookmarks sidebar", "severity": "
|
|
173
|
-
"ctrl+c": { "action": "Copy", "severity": "
|
|
174
|
-
"ctrl+d": { "action": "Bookmark this page", "severity": "
|
|
175
|
-
"ctrl+
|
|
176
|
-
"ctrl+
|
|
177
|
-
"ctrl+
|
|
178
|
-
"ctrl+
|
|
179
|
-
"ctrl+
|
|
172
|
+
"ctrl+a": { "action": "Select all", "severity": "preventable" },
|
|
173
|
+
"ctrl+b": { "action": "Bookmarks sidebar", "severity": "preventable" },
|
|
174
|
+
"ctrl+c": { "action": "Copy", "severity": "preventable" },
|
|
175
|
+
"ctrl+d": { "action": "Bookmark this page", "severity": "preventable" },
|
|
176
|
+
"ctrl+e": { "action": "Search from page", "severity": "preventable" },
|
|
177
|
+
"ctrl+f": { "action": "Find in page", "severity": "preventable" },
|
|
178
|
+
"ctrl+g": { "action": "Find next", "severity": "preventable" },
|
|
179
|
+
"ctrl+h": { "action": "History sidebar", "severity": "preventable" },
|
|
180
|
+
"ctrl+j": { "action": "Downloads", "severity": "preventable" },
|
|
181
|
+
"ctrl+k": { "action": "Search from page", "severity": "preventable" },
|
|
182
|
+
"ctrl+l": { "action": "Focus address bar", "severity": "preventable" },
|
|
180
183
|
"ctrl+n": { "action": "New window", "severity": "hard" },
|
|
181
|
-
"ctrl+o": { "action": "Open file", "severity": "
|
|
182
|
-
"ctrl+p": { "action": "Print", "severity": "
|
|
183
|
-
"ctrl+r": { "action": "Reload", "severity": "
|
|
184
|
-
"ctrl+s": { "action": "Save page", "severity": "
|
|
184
|
+
"ctrl+o": { "action": "Open file", "severity": "preventable" },
|
|
185
|
+
"ctrl+p": { "action": "Print", "severity": "preventable" },
|
|
186
|
+
"ctrl+r": { "action": "Reload", "severity": "preventable" },
|
|
187
|
+
"ctrl+s": { "action": "Save page", "severity": "preventable" },
|
|
185
188
|
"ctrl+t": { "action": "New tab", "severity": "hard" },
|
|
186
|
-
"ctrl+u": { "action": "View source", "severity": "
|
|
187
|
-
"ctrl+v": { "action": "Paste", "severity": "
|
|
189
|
+
"ctrl+u": { "action": "View source", "severity": "preventable" },
|
|
190
|
+
"ctrl+v": { "action": "Paste", "severity": "preventable" },
|
|
188
191
|
"ctrl+w": { "action": "Close tab", "severity": "hard" },
|
|
189
|
-
"ctrl+x": { "action": "Cut", "severity": "
|
|
190
|
-
"ctrl+y": { "action": "Redo", "severity": "
|
|
191
|
-
"ctrl+z": { "action": "Undo", "severity": "
|
|
192
|
+
"ctrl+x": { "action": "Cut", "severity": "preventable" },
|
|
193
|
+
"ctrl+y": { "action": "Redo", "severity": "preventable" },
|
|
194
|
+
"ctrl+z": { "action": "Undo", "severity": "preventable" },
|
|
192
195
|
"ctrl+shift+a": { "action": "Add-ons manager", "severity": "hard" },
|
|
193
196
|
"ctrl+shift+b": { "action": "Bookmarks toolbar", "severity": "hard" },
|
|
194
197
|
"ctrl+shift+c": { "action": "Inspector (element picker)", "severity": "hard" },
|
|
@@ -217,27 +220,27 @@
|
|
|
217
220
|
"alt+d": { "action": "Focus address bar", "severity": "hard" }
|
|
218
221
|
},
|
|
219
222
|
"chrome": {
|
|
220
|
-
"ctrl+a": { "action": "Select all", "severity": "
|
|
221
|
-
"ctrl+c": { "action": "Copy", "severity": "
|
|
222
|
-
"ctrl+d": { "action": "Bookmark this page", "severity": "
|
|
223
|
-
"ctrl+e": { "action": "Search from page", "severity": "
|
|
224
|
-
"ctrl+f": { "action": "Find in page", "severity": "
|
|
225
|
-
"ctrl+g": { "action": "Find next", "severity": "
|
|
226
|
-
"ctrl+h": { "action": "History page", "severity": "
|
|
227
|
-
"ctrl+j": { "action": "Downloads", "severity": "
|
|
228
|
-
"ctrl+k": { "action": "Search from page", "severity": "
|
|
229
|
-
"ctrl+l": { "action": "Focus address bar", "severity": "
|
|
223
|
+
"ctrl+a": { "action": "Select all", "severity": "preventable" },
|
|
224
|
+
"ctrl+c": { "action": "Copy", "severity": "preventable" },
|
|
225
|
+
"ctrl+d": { "action": "Bookmark this page", "severity": "preventable" },
|
|
226
|
+
"ctrl+e": { "action": "Search from page", "severity": "preventable" },
|
|
227
|
+
"ctrl+f": { "action": "Find in page", "severity": "preventable" },
|
|
228
|
+
"ctrl+g": { "action": "Find next", "severity": "preventable" },
|
|
229
|
+
"ctrl+h": { "action": "History page", "severity": "preventable" },
|
|
230
|
+
"ctrl+j": { "action": "Downloads", "severity": "preventable" },
|
|
231
|
+
"ctrl+k": { "action": "Search from page", "severity": "preventable" },
|
|
232
|
+
"ctrl+l": { "action": "Focus address bar", "severity": "preventable" },
|
|
230
233
|
"ctrl+n": { "action": "New window", "severity": "hard" },
|
|
231
|
-
"ctrl+o": { "action": "Open file", "severity": "
|
|
232
|
-
"ctrl+p": { "action": "Print", "severity": "
|
|
233
|
-
"ctrl+r": { "action": "Reload", "severity": "
|
|
234
|
-
"ctrl+s": { "action": "Save page", "severity": "
|
|
234
|
+
"ctrl+o": { "action": "Open file", "severity": "preventable" },
|
|
235
|
+
"ctrl+p": { "action": "Print", "severity": "preventable" },
|
|
236
|
+
"ctrl+r": { "action": "Reload", "severity": "preventable" },
|
|
237
|
+
"ctrl+s": { "action": "Save page", "severity": "preventable" },
|
|
235
238
|
"ctrl+t": { "action": "New tab", "severity": "hard" },
|
|
236
|
-
"ctrl+u": { "action": "View source", "severity": "
|
|
237
|
-
"ctrl+v": { "action": "Paste", "severity": "
|
|
239
|
+
"ctrl+u": { "action": "View source", "severity": "preventable" },
|
|
240
|
+
"ctrl+v": { "action": "Paste", "severity": "preventable" },
|
|
238
241
|
"ctrl+w": { "action": "Close tab", "severity": "hard" },
|
|
239
|
-
"ctrl+x": { "action": "Cut", "severity": "
|
|
240
|
-
"ctrl+z": { "action": "Undo", "severity": "
|
|
242
|
+
"ctrl+x": { "action": "Cut", "severity": "preventable" },
|
|
243
|
+
"ctrl+z": { "action": "Undo", "severity": "preventable" },
|
|
241
244
|
"ctrl+shift+b": { "action": "Bookmarks bar toggle", "severity": "hard" },
|
|
242
245
|
"ctrl+shift+d": { "action": "Bookmark all tabs", "severity": "hard" },
|
|
243
246
|
"ctrl+shift+g": { "action": "Find previous", "severity": "find-bar-only" },
|
|
@@ -254,28 +257,28 @@
|
|
|
254
257
|
"alt+f": { "action": "Customize menu (alt)", "severity": "menu-activation" }
|
|
255
258
|
},
|
|
256
259
|
"edge": {
|
|
257
|
-
"ctrl+a": { "action": "Select all", "severity": "
|
|
258
|
-
"ctrl+c": { "action": "Copy", "severity": "
|
|
259
|
-
"ctrl+d": { "action": "Favorite this page", "severity": "
|
|
260
|
-
"ctrl+e": { "action": "Search from page", "severity": "
|
|
261
|
-
"ctrl+f": { "action": "Find in page", "severity": "
|
|
262
|
-
"ctrl+g": { "action": "Find next", "severity": "
|
|
263
|
-
"ctrl+h": { "action": "History", "severity": "
|
|
264
|
-
"ctrl+j": { "action": "Downloads", "severity": "
|
|
265
|
-
"ctrl+k": { "action": "Search from page", "severity": "
|
|
266
|
-
"ctrl+l": { "action": "Focus address bar", "severity": "
|
|
267
|
-
"ctrl+m": { "action": "Mute current tab", "severity": "
|
|
260
|
+
"ctrl+a": { "action": "Select all", "severity": "preventable" },
|
|
261
|
+
"ctrl+c": { "action": "Copy", "severity": "preventable" },
|
|
262
|
+
"ctrl+d": { "action": "Favorite this page", "severity": "preventable" },
|
|
263
|
+
"ctrl+e": { "action": "Search from page", "severity": "preventable" },
|
|
264
|
+
"ctrl+f": { "action": "Find in page", "severity": "preventable" },
|
|
265
|
+
"ctrl+g": { "action": "Find next", "severity": "preventable" },
|
|
266
|
+
"ctrl+h": { "action": "History", "severity": "preventable" },
|
|
267
|
+
"ctrl+j": { "action": "Downloads", "severity": "preventable" },
|
|
268
|
+
"ctrl+k": { "action": "Search from page", "severity": "preventable" },
|
|
269
|
+
"ctrl+l": { "action": "Focus address bar", "severity": "preventable" },
|
|
270
|
+
"ctrl+m": { "action": "Mute current tab", "severity": "preventable" },
|
|
268
271
|
"ctrl+n": { "action": "New window", "severity": "hard" },
|
|
269
|
-
"ctrl+o": { "action": "Open file", "severity": "
|
|
270
|
-
"ctrl+p": { "action": "Print", "severity": "
|
|
271
|
-
"ctrl+r": { "action": "Reload", "severity": "
|
|
272
|
-
"ctrl+s": { "action": "Save page", "severity": "
|
|
272
|
+
"ctrl+o": { "action": "Open file", "severity": "preventable" },
|
|
273
|
+
"ctrl+p": { "action": "Print", "severity": "preventable" },
|
|
274
|
+
"ctrl+r": { "action": "Reload", "severity": "preventable" },
|
|
275
|
+
"ctrl+s": { "action": "Save page", "severity": "preventable" },
|
|
273
276
|
"ctrl+t": { "action": "New tab", "severity": "hard" },
|
|
274
|
-
"ctrl+u": { "action": "View source", "severity": "
|
|
275
|
-
"ctrl+v": { "action": "Paste", "severity": "
|
|
277
|
+
"ctrl+u": { "action": "View source", "severity": "preventable" },
|
|
278
|
+
"ctrl+v": { "action": "Paste", "severity": "preventable" },
|
|
276
279
|
"ctrl+w": { "action": "Close tab", "severity": "hard" },
|
|
277
|
-
"ctrl+x": { "action": "Cut", "severity": "
|
|
278
|
-
"ctrl+z": { "action": "Undo", "severity": "
|
|
280
|
+
"ctrl+x": { "action": "Cut", "severity": "preventable" },
|
|
281
|
+
"ctrl+z": { "action": "Undo", "severity": "preventable" },
|
|
279
282
|
"ctrl+shift+b": { "action": "Favorites bar toggle", "severity": "hard" },
|
|
280
283
|
"ctrl+shift+d": { "action": "Bookmark all tabs in folder", "severity": "hard" },
|
|
281
284
|
"ctrl+shift+e": { "action": "Search in sidebar", "severity": "hard" },
|
package/dist/auto.js
CHANGED
package/dist/auto.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// hotkey-router v0.
|
|
1
|
+
// hotkey-router v0.5.0 | SEE LICENSE IN LICENSE
|
|
2
2
|
|
|
3
|
-
function J(t){return t?/Chrome ?OS|CrOS/i.test(t)?"chromeos":/Mac|iPhone|iPad|iPod/i.test(t)?"mac":/Win/i.test(t)?"windows":/Linux|X11/i.test(t)?"linux":null:null}function E(t=typeof navigator<"u"?navigator:null,{chromeos:e=!1}={}){if(!t)return null;let r=t.userAgent||"",i=(/\bCrOS\b/.test(r)?"chromeos":null)||J(t.userAgentData?.platform)||J(t.platform)||(/Mac OS X/i.test(r)?"mac":/Windows/i.test(r)?"windows":/Linux|X11/i.test(r)?"linux":null);return i==="chromeos"&&!e?"linux":i}function tt(t=typeof navigator<"u"?navigator:null){if(!t)return null;let e=t.userAgent||"";return/Edg\//.test(e)?"edge":/Firefox/.test(e)?"firefox":/Chrome/.test(e)?"chrome":/Safari/.test(e)?"safari":null}var Et={mac:"macOS",windows:"Windows",linux:"Linux",chromeos:"ChromeOS"};function et(t){return Et[t]||t}var At=E(),rt=new Set(["ctrl","shift","alt","meta","mod"]),Pt=new Map([["^","ctrl"],["!","alt"],["+","shift"],["#","meta"]]),it=Object.freeze({esc:"escape",escape:"escape",space:" ",spacebar:" ",enter:"enter",return:"enter",del:"delete",delete:"delete",backspace:"backspace",tab:"tab",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",home:"home",end:"end",pageup:"pageup",pagedown:"pagedown",pgup:"pageup",pgdn:"pagedown",cmd:"meta",command:"meta",win:"meta",meta:"meta",control:"ctrl",ctrl:"ctrl",option:"alt",opt:"alt",alt:"alt",shift:"shift","\u2318":"meta","\u2303":"ctrl","\u2325":"alt","\u21E7":"shift",mod:"mod",plus:"+"});function P(t){let e=String(t??"");if(e===" ")return" ";let i=e.trim().toLowerCase();return it[i]??i}function Tt(t){return rt.has(P(t))}var Ft=/(^|\+)code:([A-Za-z][A-Za-z0-9_]*)/;function ot(t,{platform:e=At}={}){let r=String(t||"").trim(),i=null,a=p=>{i=i||`Invalid hotkey "${t}": ${p}`},d=/\s+up$/i.test(r),y=d?r.replace(/\s+up$/i,"").trim():r,n={ctrl:!1,shift:!1,alt:!1,meta:!1,key:null,code:null,bareModifier:null},w=p=>{p==="mod"?n[e==="mac"?"meta":"ctrl"]=!0:n[p]=!0},g=y;for(;g.length;){let p=Pt.get(g[0])??null;if(!p)break;w(p),g=g.slice(1).trimStart()}let x=g.match(/code:[A-Za-z][A-Za-z0-9_]*/g);x&&x.length>1&&a(`multiple code: tokens not supported (got ${x.length}).`);let L=null,F=g.replace(Ft,(p,S,j)=>(L=j,S+"__code__")).toLowerCase(),R=F.split("+").map(p=>p.trim()),N=R.filter(Boolean),$=R.some(p=>p==="")&&F.includes("++");if(!$){let p=!1;for(let S of N)Tt(S)?p&&a('modifiers must come before the base key (e.g. "ctrl+k", not "k+ctrl")'):p=!0}for(let p of N){if(p==="__code__"){n.code=L;continue}let S=it[p]??p;rt.has(S)?w(S):n.key=P(S)}if(!n.key&&!n.code&&$&&(n.key="+"),!n.key&&!n.code){let p=(n.ctrl?1:0)+(n.shift?1:0)+(n.alt?1:0)+(n.meta?1:0);p===1?n.bareModifier=n.ctrl?"ctrl":n.shift?"shift":n.alt?"alt":"meta":p>1?a('multi-modifier bare bindings not supported. Add a base key (e.g. "ctrl+alt+x").'):i=i||`Invalid hotkey "${t}" (missing base key)`}return{combo:n,type:d?"keyup":"keydown",raw:t,error:i}}function T(t,e){let{combo:r,type:i,raw:a,error:d}=ot(t,e);if(d)throw new Error(d);return{combo:r,type:i,raw:a}}var Kt={",":["<","Comma"],".":[">","Period"],"/":["?","Slash"],";":[":","Semicolon"],"'":['"',"Quote"],"[":["{","BracketLeft"],"]":["}","BracketRight"],"\\":["|","Backslash"],"-":["_","Minus"],"=":["+","Equal"],"`":["~","Backquote"]};function at(t){let{combo:e,type:r,error:i}=ot(t);if(i||!e.shift||e.code)return null;let a=Kt[e.key];if(!a)return null;let[d,y]=a,w=String(t).trim().replace(/\s+up$/i,"").slice(0,-1)+"code:"+y+(r==="keyup"?" up":"");return{message:`"${t}" never fires on US layouts: Shift turns "${e.key}" into "${d}". Bind "${w}" instead.`,suggestion:w}}var W={".":"period",",":"comma",";":"semicolon","'":"quote","/":"slash","\\":"backslash","[":"bracketleft","]":"bracketright","-":"minus","=":"equal","`":"backquote"," ":"space","+":"equal"};function Ot(t){if(!t)return null;let e=/^Key([A-Za-z])$/.exec(t);if(e)return e[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(t);return r?r[1]:t.toLowerCase()}function Rt(t){if(t==null||t==="")return null;if(W[t])return W[t];let e=P(t);return W[e]||e||null}function nt(t){if(!t||t.bareModifier)return null;let e=t.code?Ot(t.code):Rt(t.key);if(!e)return null;let r=[];return t.ctrl&&r.push("ctrl"),t.meta&&r.push("meta"),t.alt&&r.push("alt"),t.shift&&r.push("shift"),r.push(e),r.join("+")}function O(t,e,r,i){return t.addEventListener(e,r,i),()=>t.removeEventListener(e,r,i)}var Bt=E(),q=Object.freeze({Alt:"alt",AltGraph:"alt",Control:"ctrl",Shift:"shift",Meta:"meta",OS:"meta"}),st=new Set;function z({ctrl:t,shift:e,alt:r,meta:i,key:a,code:d,bareModifier:y}){if(y)return`__bare__:${y}`;let n="";return t&&(n+="ctrl+"),e&&(n+="shift+"),r&&(n+="alt+"),i&&(n+="meta+"),d?n+"code:"+d:n?n+a:a}function Mt(t){let e=q[t.key];return e?`__bare__:${e}`:z({ctrl:t.ctrlKey,shift:t.shiftKey,alt:t.altKey,meta:t.metaKey,key:P(t.key)})}function Dt(t){if(!t.code)return null;let e="";return t.ctrlKey&&(e+="ctrl+"),t.shiftKey&&(e+="shift+"),t.altKey&&(e+="alt+"),t.metaKey&&(e+="meta+"),e+"code:"+t.code}var Lt=new Set(["checkbox","radio","range","color","file","button","submit","reset","image"]);function Nt(t){let e=t?.composedPath?.();if(e?.length)return e;let r=[];for(let i=t?.target;i;i=i.parentNode||i.host)r.push(i);return r}function $t(t,e){let r=Nt(t),i=r[0];if(!i)return null;let a=String(i.tagName||"").toUpperCase();if(i.isContentEditable||a==="TEXTAREA"||a==="SELECT"||i.getAttribute?.("role")==="textbox")return"text";if(a==="INPUT"){if(e==="all")return"text";let d=String(i.getAttribute?.("type")||"text").toLowerCase();return Lt.has(d)?"control":"text"}if(e==="text"){for(let d of r)if(String(d.tagName||"").toUpperCase()==="BUTTON"||d.getAttribute?.("role")==="button")return"control"}return null}function _t(t){return!!((t.ctrlKey||t.altKey||t.metaKey)&&!q[t.key])}function ct(t){if(t==="all"||t==="text")return t;if(typeof t=="string")throw new TypeError(`hotkeys.ignoreInput() expects true, false, 'all' or 'text', got "${t}"`);return t?"all":null}function It(t,e){let r=e?{...e}:{};return t==="keydown"&&r.repeat==null&&(r.repeat=!1),r.priority==null&&(r.priority=0),r}function lt(t){let e=null;for(let r of t)e?(r.options.priority>e.options.priority||r.options.priority===e.options.priority&&r.id>e.id)&&(e=r):e=r;return e}function zt(t){return!!(t.ctrlKey&&t.altKey&&typeof t.getModifierState=="function"&&t.getModifierState("AltGraph")&&typeof t.key=="string"&&t.key.length===1)}function ft(t){return!!(t.isComposing||t.keyCode===229)}var jt=/^(?!\p{Script=Latin})\p{L}$/u;function Ht(t){if(!(t.ctrlKey||t.metaKey)||t.altKey||ft(t)||typeof t.getModifierState=="function"&&t.getModifierState("AltGraph"))return null;let e=/^Key([A-Z])$/.exec(t.code||"");return!e||typeof t.key!="string"||!jt.test(t.key)?null:z({ctrl:t.ctrlKey,shift:t.shiftKey,alt:!1,meta:t.metaKey,key:e[1].toLowerCase()})}var Ut={ctrl:"Control",shift:"Shift",alt:"Alt",meta:"Meta"},ht={Period:".",Comma:",",Semicolon:";",Quote:"'",Slash:"/",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Minus:"-",Equal:"=",Backquote:"`",Space:" ",Enter:"Enter",NumpadEnter:"Enter",Tab:"Tab",Escape:"Escape",Backspace:"Backspace",Delete:"Delete",Insert:"Insert",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},I={},dt;for(let[t,e]of Object.entries(ht))I[dt=P(e)]??(I[dt]=t);function Wt(t){if(!t)return null;let e=/^Key([A-Z])$/.exec(t);if(e)return e[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(t);return r?r[1]:/^F\d{1,2}$/.test(t)?t:ht[t]??null}function qt(t){return t?/^[a-z]$/.test(t)?"Key"+t.toUpperCase():/^\d$/.test(t)?"Digit"+t:/^f\d{1,2}$/.test(t)?t.toUpperCase():I[t]??null:null}function ut(t,{physical:e=!0,useMod:r=!1,platform:i=Bt}={}){if(!t||q[t.key])return null;let a=[],d=i==="mac";if(r&&(d?t.metaKey:t.ctrlKey)&&a.push("mod"),t.ctrlKey&&!(r&&!d)&&a.push("ctrl"),t.metaKey&&!(r&&d)&&a.push("meta"),t.altKey&&a.push("alt"),t.shiftKey&&a.push("shift"),e&&t.code)a.push(`code:${t.code}`);else{let y=P(t.key);if(!y)return null;a.push(y===" "?"space":y)}return a.join("+")}function yt({target:t=typeof window<"u"?window:null,capture:e=!1,ignoreInput:r=!0}={}){let i=ct(r),a=t,d=e,y=[],n=new Map,w=new Map,g=new Map,x=!1,L=1;function G(o,l){let c=n.get(o);c||(c=new Map,n.set(o,c));let s=c.get(l);return s||(s=[],c.set(l,s)),s}function F(o){let l=g.get(o);if(!l)return!1;let{comboStr:c,type:s}=l,h=n.get(c),f=h?.get(s);if(!f?.length)return g.delete(o),!1;let u=f.filter(m=>m.id!==o);return u.length?h.set(s,u):h.delete(s),h.size||n.delete(c),g.delete(o),!0}function R(o,l,c=null,s={}){let{combo:h,type:f,raw:u}=T(o),m=z(h),b=It(f,s),k={id:L++,comboStr:m,type:f,combo:h,handler:l,plugin:c,raw:u,options:b};G(m,f).push(k),g.set(k.id,{comboStr:m,type:f});let C=`${m} ${f}`;if(!st.has(C)){let A=at(o);A&&(st.add(C),console.warn(`[hotkey-router] ${A.message}`))}if(y.length)for(let A of y)try{A({combo:h,raw:u,options:b,plugin:c,id:k.id})}catch(_){console.error("[hotkey-router] onBind hook threw:",_)}let v=()=>F(k.id);return v.id=k.id,v.hotkey=u,v}function N(o){if(typeof o!="function")throw new TypeError("hotkeys.onBind(hook) expects a function");return y.push(o),()=>{y=y.filter(l=>l!==o)}}function $(o,l){let{combo:c,type:s}=T(o),h=z(c),f=n.get(h);if(!f)return;let u=f.get(s);if(u?.length){if(l){let m=[];for(let b of u)b.handler===l?g.delete(b.id):m.push(b);m.length?f.set(s,m):f.delete(s)}else{for(let m of u)g.delete(m.id);f.delete(s)}f.size||n.delete(h)}}function p(o,l){if(w.has(o))throw new Error(`Plugin "${o}" already registered`);let c=Object.entries(l);for(let[h]of c)T(h);let s=[];for(let[h,f]of c){let[u,m]=Array.isArray(f)?f:[f,{}],b=R(h,u,o,m);s.push(b.id)}return w.set(o,s),()=>S(o)}function S(o){let l=w.get(o);if(l){for(let c of l)F(c);w.delete(o)}}function j(){x=!0}function bt(){x=!1}function kt(o=!0){i=ct(o)}function St(o){a=o}function Z(o,l,c){let s={altGraphChar:zt(o),composing:ft(o),focus:i&&$t(o,i),chord:_t(o)},h=[],f=new Set;for(let u of[Mt(o),Dt(o)])!u||f.has(u)||(f.add(u),Q(h,u,o,l,c,s));if(!h.length){let u=Ht(o);u&&!f.has(u)&&Q(h,u,o,l,c,s)}return h}function Q(o,l,c,s,h,{altGraphChar:f,composing:u,focus:m,chord:b}){let k=n.get(l)?.get(s);if(k?.length)for(let C of k){let v=C.options;h==="capture"&&!v.capture||h==="bubble"&&v.capture||f&&!v.altGraph||u&&!v.composing||m&&!(m==="control"&&b)&&!v.allowIn?.(c)||s==="keydown"&&v.repeat===!1&&c.repeat||v.when&&v.when(c)===!1||o.push(C)}}function X(o,l){let c=o.options;c.preventDefault&&l.preventDefault(),c.stopImmediatePropagation?l.stopImmediatePropagation():c.stopPropagation&&l.stopPropagation();try{o.handler(l)}finally{c.once&&F(o.id)}}function K(o,l="all"){return c=>{if(x)return;let s=Z(c,o,l);s.length&&X(lt(s),c)}}let B=null,M=null,H=null,U=null;function xt({target:o=a,capture:l=d}={}){if(!o)throw new Error("hotkeys.init() requires a target (e.g. window)");if((B||M)&&Y(),l){B=O(o,"keydown",K("keydown"),{capture:!0}),M=O(o,"keyup",K("keyup"),{capture:!0});return}B=O(o,"keydown",K("keydown","bubble"),{capture:!1}),M=O(o,"keyup",K("keyup","bubble"),{capture:!1}),H=O(o,"keydown",K("keydown","capture"),{capture:!0}),U=O(o,"keyup",K("keyup","capture"),{capture:!0})}function Y(){B?.(),M?.(),H?.(),U?.(),B=null,M=null,H=null,U=null,n.clear(),w.clear(),g.clear()}function Ct(o,{type:l,target:c=null}={}){let{combo:s,type:h}=T(o),f=l||h;if(x)return!1;let u=s.bareModifier?Ut[s.bareModifier]:s.key??Wt(s.code),m=s.bareModifier?null:s.code??qt(s.key),b=!!s.alt,k=!!s.ctrl,C=!!s.shift,v=!!s.meta;s.bareModifier&&f==="keyup"&&(s.bareModifier==="alt"?b=!1:s.bareModifier==="ctrl"?k=!1:s.bareModifier==="shift"?C=!1:s.bareModifier==="meta"&&(v=!1));let A={type:f,key:u,code:m,ctrlKey:k,shiftKey:C,altKey:b,metaKey:v,repeat:!1,isComposing:!1,getModifierState(){return!1},preventDefault(){},stopPropagation(){},stopImmediatePropagation(){},target:c},_=Z(A,f,"all");return _.length?(X(lt(_),A),!0):!1}return{init:xt,destroy:Y,setTarget:St,bind:R,unbind:$,registerPlugin:p,unregisterPlugin:S,onBind:N,pause:j,resume:bt,ignoreInput:kt,trigger:Ct,parseHotkey:T,comboFromEvent:ut,detectPlatform:E}}var pt=yt();typeof window<"u"&&pt.init();var V=pt;var D={$comment:"Machine-readable companion to docs/browser-hotkeys.md. Each combo entry describes who claims the binding and how strongly. Intended for runtime conflict warnings in keyboard-routing libraries (e.g. hotkey-router) and dev-time validation in apps like WebRadar. Update both this file and the markdown together \u2014 the markdown is the human source of truth, this file is the machine projection.",version:{generated:"2026-10-15",schema:"1.0",sources:["https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly","https://firefox-source-docs.mozilla.org/devtools-user/keyboard_shortcuts/index.html","https://support.google.com/chrome/answer/157179","https://developer.chrome.com/docs/devtools/shortcuts","https://support.apple.com/guide/safari/keyboard-shortcuts-and-gestures-cpsh003/mac","https://developer.apple.com/documentation/safari-developer-tools/web-inspector","https://support.microsoft.com/en-us/microsoft-edge/keyboard-shortcuts-in-microsoft-edge-50d3edab-30d9-c7e4-21ce-37fe2713cfad","https://support.apple.com/en-us/102650","https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec","https://help.gnome.org/gnome-help/shell-keyboard-shortcuts.html"]},severityLevels:{hard:"Browser or OS intercepts before page-world keydown fires. preventDefault() can't recover it.","find-bar-only":"Reserved only when the browser's find bar has focus. Fires in page world during normal browsing.","menu-activation":"Win/Linux Alt+letter activates the browser menu bar. Hard to suppress reliably.","system-text":"Only reserved while a text input has focus (terminal-style cursor controls on macOS).",compose:"macOS Option+letter types a special character in text inputs. Outside inputs, free for page world.",os:"Operating system intercepts globally, before any application sees it.","devtools-open":"Only relevant when DevTools is already open; outside DevTools it fires normally."},$keyFormat:"Each combo key uses hotkey-router-compatible syntax: modifiers in canonical order (ctrl|meta|alt|shift) joined by '+', then the key (lowercased letter, or symbolic name). Per-platform tables use the platform's native modifier name \u2014 `meta` on macOS = Cmd, `meta` on Windows = Win, `ctrl` on Linux/Windows = the primary modifier.",platforms:{mac:{browsers:{firefox:{"meta+a":{action:"Select all",severity:"hard"},"meta+b":{action:"Bookmarks sidebar",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search from page",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+u":{action:"View source",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"Redo",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+a":{action:"Add-ons manager",severity:"hard"},"meta+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"meta+shift+c":{action:"Inspector (element picker)",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+e":{action:"Network Monitor",severity:"hard"},"meta+shift+f":{action:"Toggle fullscreen",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Browser Console",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+o":{action:"Bookmarks library",severity:"hard"},"meta+shift+p":{action:"New private window (alt)",severity:"hard"},"meta+shift+q":{action:"Quit (with confirm)",severity:"hard"},"meta+shift+s":{action:"Firefox Screenshot",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Inspector",severity:"hard"},"meta+alt+e":{action:"Network Monitor",severity:"hard"},"meta+alt+i":{action:"DevTools Toolbox",severity:"hard"},"meta+alt+j":{action:"Browser Console",severity:"hard"},"meta+alt+k":{action:"Web Console",severity:"hard"},"meta+alt+m":{action:"Responsive Design Mode",severity:"hard"},"meta+alt+z":{action:"Debugger",severity:"hard"}},chrome:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search selected text",severity:"find-bar-only"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"History page",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"meta+shift+c":{action:"DevTools Inspector",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Downloads page",severity:"hard"},"meta+shift+m":{action:"Switch user / guest",severity:"hard"},"meta+shift+n":{action:"New incognito window",severity:"hard"},"meta+shift+r":{action:"Hard reload",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+i":{action:"DevTools",severity:"hard"},"meta+alt+j":{action:"DevTools (console)",severity:"hard"},"meta+alt+u":{action:"View source",severity:"hard"}},safari:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Add to Reading List",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus Smart Search",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+c":{action:"Inspector pick element",severity:"hard"},"meta+shift+d":{action:"Add Reading List item",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+h":{action:"Go to homepage",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+r":{action:"Reader mode",severity:"hard"},"meta+shift+t":{action:"Reopen last closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Web Inspector pick",severity:"hard"},"meta+alt+i":{action:"Web Inspector",severity:"hard"}}},system:{"meta+space":{action:"Spotlight",severity:"os"},"meta+tab":{action:"App switcher",severity:"os"},"meta+h":{action:"Hide app",severity:"os"},"meta+m":{action:"Minimize window",severity:"os"},"meta+q":{action:"Quit app",severity:"os"},"meta+shift+3":{action:"Screenshot full screen",severity:"os"},"meta+shift+4":{action:"Screenshot selection",severity:"os"},"meta+shift+5":{action:"Screen recording tool",severity:"os"},"meta+shift+q":{action:"Log out",severity:"os"},"meta+ctrl+q":{action:"Lock screen",severity:"os"},"meta+ctrl+space":{action:"Character Viewer",severity:"os"},"meta+alt+esc":{action:"Force-quit dialog",severity:"os"},"meta+shift+slash":{action:"Help menu search (Cmd+?)",severity:"os"},"meta+alt+h":{action:"Hide other apps",severity:"os"},"meta+alt+d":{action:"Show or hide the Dock",severity:"os"},"meta+backquote":{action:"Switch windows of the front app",severity:"os"}},noteForLetterCombos:{"alt+a..z":{behavior:"compose",note:"Option+letter types special characters in text inputs (Option+E\u2192\xB4, Option+A\u2192\xE5, Option+F\u2192\u0192). Outside inputs, free for page world."},"ctrl+a..z":{behavior:"system-text",note:"Mac uses Ctrl+letter as terminal-style cursor controls inside text inputs (Ctrl+A=line start, Ctrl+E=line end, Ctrl+K=delete-to-end, etc.). Outside inputs, free for page world."}}},windows:{browsers:{firefox:{"ctrl+a":{action:"Select all",severity:"hard"},"ctrl+b":{action:"Bookmarks sidebar",severity:"hard"},"ctrl+c":{action:"Copy",severity:"hard"},"ctrl+d":{action:"Bookmark this page",severity:"hard"},"ctrl+f":{action:"Find in page",severity:"hard"},"ctrl+g":{action:"Find next",severity:"hard"},"ctrl+h":{action:"History sidebar",severity:"hard"},"ctrl+j":{action:"Downloads",severity:"hard"},"ctrl+l":{action:"Focus address bar",severity:"hard"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"hard"},"ctrl+p":{action:"Print",severity:"hard"},"ctrl+r":{action:"Reload",severity:"hard"},"ctrl+s":{action:"Save page",severity:"hard"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"hard"},"ctrl+v":{action:"Paste",severity:"hard"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"hard"},"ctrl+y":{action:"Redo",severity:"hard"},"ctrl+z":{action:"Undo",severity:"hard"},"ctrl+shift+a":{action:"Add-ons manager",severity:"hard"},"ctrl+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"ctrl+shift+c":{action:"Inspector (element picker)",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+e":{action:"Network Monitor",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"Developer Tools",severity:"hard"},"ctrl+shift+j":{action:"Browser Console",severity:"hard"},"ctrl+shift+k":{action:"Web Console",severity:"hard"},"ctrl+shift+m":{action:"Responsive Design Mode",severity:"hard"},"ctrl+shift+n":{action:"New private window",severity:"hard"},"ctrl+shift+o":{action:"Bookmarks library",severity:"hard"},"ctrl+shift+p":{action:"New private window (alt)",severity:"hard"},"ctrl+shift+s":{action:"Firefox Screenshot",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Downloads (alt)",severity:"hard"},"ctrl+shift+z":{action:"Debugger",severity:"hard"},"alt+f":{action:"File menu",severity:"menu-activation"},"alt+e":{action:"Edit menu",severity:"menu-activation"},"alt+v":{action:"View menu",severity:"menu-activation"},"alt+b":{action:"Bookmarks menu",severity:"menu-activation"},"alt+t":{action:"Tools menu",severity:"menu-activation"},"alt+h":{action:"Help menu",severity:"menu-activation"},"alt+d":{action:"Focus address bar",severity:"hard"}},chrome:{"ctrl+a":{action:"Select all",severity:"hard"},"ctrl+c":{action:"Copy",severity:"hard"},"ctrl+d":{action:"Bookmark this page",severity:"hard"},"ctrl+e":{action:"Search from page",severity:"hard"},"ctrl+f":{action:"Find in page",severity:"hard"},"ctrl+g":{action:"Find next",severity:"hard"},"ctrl+h":{action:"History page",severity:"hard"},"ctrl+j":{action:"Downloads",severity:"hard"},"ctrl+k":{action:"Search from page",severity:"hard"},"ctrl+l":{action:"Focus address bar",severity:"hard"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"hard"},"ctrl+p":{action:"Print",severity:"hard"},"ctrl+r":{action:"Reload",severity:"hard"},"ctrl+s":{action:"Save page",severity:"hard"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"hard"},"ctrl+v":{action:"Paste",severity:"hard"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"hard"},"ctrl+z":{action:"Undo",severity:"hard"},"ctrl+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"Incognito window",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Customize menu",severity:"menu-activation"},"alt+f":{action:"Customize menu (alt)",severity:"menu-activation"}},edge:{"ctrl+a":{action:"Select all",severity:"hard"},"ctrl+c":{action:"Copy",severity:"hard"},"ctrl+d":{action:"Favorite this page",severity:"hard"},"ctrl+e":{action:"Search from page",severity:"hard"},"ctrl+f":{action:"Find in page",severity:"hard"},"ctrl+g":{action:"Find next",severity:"hard"},"ctrl+h":{action:"History",severity:"hard"},"ctrl+j":{action:"Downloads",severity:"hard"},"ctrl+k":{action:"Search from page",severity:"hard"},"ctrl+l":{action:"Focus address bar",severity:"hard"},"ctrl+m":{action:"Mute current tab",severity:"hard"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"hard"},"ctrl+p":{action:"Print",severity:"hard"},"ctrl+r":{action:"Reload",severity:"hard"},"ctrl+s":{action:"Save page",severity:"hard"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"hard"},"ctrl+v":{action:"Paste",severity:"hard"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"hard"},"ctrl+z":{action:"Undo",severity:"hard"},"ctrl+shift+b":{action:"Favorites bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs in folder",severity:"hard"},"ctrl+shift+e":{action:"Search in sidebar",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+k":{action:"Duplicate tab",severity:"hard"},"ctrl+shift+l":{action:"Paste and search",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"InPrivate window",severity:"hard"},"ctrl+shift+o":{action:"Open favorites",severity:"hard"},"ctrl+shift+p":{action:"Print (system dialog)",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+u":{action:"Read Aloud toggle",severity:"hard"},"ctrl+shift+v":{action:"Paste without formatting",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Collections",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Settings menu",severity:"menu-activation"},"alt+f":{action:"Settings menu (alt)",severity:"menu-activation"},"alt+shift+b":{action:"Focus favorites bar",severity:"hard"},"alt+shift+i":{action:"Send feedback dialog",severity:"hard"},"alt+shift+t":{action:"Focus app bar toolbar",severity:"hard"}}},system:{"meta+a":{action:"Action Center",severity:"os"},"meta+c":{action:"Windows search",severity:"os"},"meta+d":{action:"Show desktop",severity:"os"},"meta+e":{action:"File Explorer",severity:"os"},"meta+g":{action:"Game bar",severity:"os"},"meta+h":{action:"Voice dictation",severity:"os"},"meta+i":{action:"Settings",severity:"os"},"meta+l":{action:"Lock",severity:"os"},"meta+n":{action:"Notification center",severity:"os"},"meta+p":{action:"Project / display mode",severity:"os"},"meta+r":{action:"Run dialog",severity:"os"},"meta+s":{action:"Search",severity:"os"},"meta+v":{action:"Clipboard history",severity:"os"},"meta+w":{action:"Widgets",severity:"os"},"meta+x":{action:"Quick Link menu",severity:"os"},"meta+z":{action:"Snap layouts",severity:"os"},"meta+tab":{action:"Task View",severity:"os"},"meta+shift+s":{action:"Screenshot region",severity:"os"},"ctrl+shift+esc":{action:"Task Manager",severity:"os"},"ctrl+alt+del":{action:"Security screen",severity:"os"},"alt+tab":{action:"Switch windows",severity:"os"},"alt+f4":{action:"Close active window",severity:"os"}}},linux:{browsers:{firefox:"$ref:platforms.windows.browsers.firefox",chrome:"$ref:platforms.windows.browsers.chrome",edge:"$ref:platforms.windows.browsers.edge"},system:{$comment:"GNOME defaults. KDE and other DEs have similar-shaped reservations but vary; this is a conservative baseline.","meta+tab":{action:"Switch windows",severity:"os"},"meta+a":{action:"Show applications",severity:"os"},"meta+l":{action:"Lock screen",severity:"os"},"meta+v":{action:"Notification list",severity:"os"},"alt+tab":{action:"Switch applications",severity:"os"},"alt+esc":{action:"Cycle windows",severity:"os"},"alt+f2":{action:"Run command",severity:"os"},"alt+f4":{action:"Close window",severity:"os"},"ctrl+alt+tab":{action:"Top-bar accessibility switcher",severity:"os"},"ctrl+alt+del":{action:"Power-off dialog",severity:"os"},"ctrl+shift+alt+r":{action:"Toggle screencast recording",severity:"os"}},noteForCtrlAlt:"Some Linux setups map right-Alt (AltGr) to 'compose' for typing accented characters, in which case AltGr+letter is reported as ctrl+alt+letter and types a special character. Avoid the ctrl+alt+letter namespace on Linux."}}};var Gt="1.0",Zt=new Set(["hard","os","menu-activation"]);function Qt(t){let e=String(t).toLowerCase().split("+").map(d=>d.trim()).filter(Boolean);if(!e.length)return"";let r=e[e.length-1],i=new Set(e.slice(0,-1)),a=[];return i.has("ctrl")&&a.push("ctrl"),i.has("meta")&&a.push("meta"),i.has("alt")&&a.push("alt"),i.has("shift")&&a.push("shift"),a.push(r),a.join("+")}function Xt(t,e){if(typeof t!="string"||!t.startsWith("$ref:"))return t;let r=t.slice(5).split("."),i=e;for(let a of r)i=i?.[a];return i}function mt(t){if(!t||typeof t!="object")return null;let e=Object.create(null);for(let[r,i]of Object.entries(t))!i||typeof i!="object"||!("severity"in i)||(e[Qt(r)]=i);return e}function Yt(t){let e={platforms:{}},r=t?.platforms||{};for(let[i,a]of Object.entries(r)){let d={};for(let[y,n]of Object.entries(a.browsers||{}))d[y]=mt(Xt(n,t));e.platforms[i]={browsers:d,system:mt(a.system)}}return e}var vt=D?.version?.schema===Gt,Jt=vt?Yt(D):{platforms:{}},te=nt;function ee(t,{platform:e,browser:r}={}){if(!vt)return null;let i=te(t);if(!i)return null;let a=e&&Jt.platforms[e];if(!a)return null;let y=(r?a.browsers?.[r]:null)?.[i];if(y)return{source:"browser",platform:e,browser:r,lookupKey:i,action:y.action,severity:y.severity};let n=a.system?.[i];return n?{source:"system",platform:e,browser:r,lookupKey:i,action:n.action,severity:n.severity}:null}function wt(t){return Zt.has(t)}function re(t,e){let r=et(t.platform),i=t.source==="browser"?`${t.browser} on ${r}`:r,a=wt(t.severity)?"will not fire":"fires in normal browsing";return`[hotkey-router] "${e}" (${t.lookupKey}) reserved by ${i}: "${t.action}" [${t.severity}] \u2014 ${a}.`}function ie(t,e,r=console){let i=re(t,e);(wt(t.severity)?r.warn:r.info).call(r,i)}function gt(t,e={}){if(!t||typeof t.onBind!="function")throw new TypeError("installReservationWarnings(hotkeys) requires a hotkey-router instance with onBind() (>= v0.2.0)");let r=e.platform!==void 0?e.platform:E(),i=e.browser!==void 0?e.browser:tt(),a=e.console||console;return t.onBind(({combo:d,raw:y,options:n})=>{if(n?.warnOnReserved===!1||!r||!i)return;let w=ee(d,{platform:r,browser:i});w&&ie(w,y,a)})}var me=D?.version?.schema,ve=D?.version?.generated;gt(V);var ke=V;export{ke as default};
|
|
3
|
+
function J(e){return e?/Chrome ?OS|CrOS/i.test(e)?"chromeos":/Mac|iPhone|iPad|iPod/i.test(e)?"mac":/Win/i.test(e)?"windows":/Linux|X11/i.test(e)?"linux":null:null}function E(e=typeof navigator<"u"?navigator:null,{chromeos:t=!1}={}){if(!e)return null;let r=e.userAgent||"",i=(/\bCrOS\b/.test(r)?"chromeos":null)||J(e.userAgentData?.platform)||J(e.platform)||(/Mac OS X/i.test(r)?"mac":/Windows/i.test(r)?"windows":/Linux|X11/i.test(r)?"linux":null);return i==="chromeos"&&!t?"linux":i}function ee(e=typeof navigator<"u"?navigator:null){if(!e)return null;let t=e.userAgent||"";return/Edg\//.test(t)?"edge":/Firefox/.test(t)?"firefox":/Chrome/.test(t)?"chrome":/Safari/.test(t)?"safari":null}var Ee={mac:"macOS",windows:"Windows",linux:"Linux",chromeos:"ChromeOS"};function te(e){return Ee[e]||e}var Ae=E(),re=new Set(["ctrl","shift","alt","meta","mod"]),Pe=new Map([["^","ctrl"],["!","alt"],["+","shift"],["#","meta"]]),ie=Object.freeze({esc:"escape",escape:"escape",space:" ",spacebar:" ",enter:"enter",return:"enter",del:"delete",delete:"delete",backspace:"backspace",tab:"tab",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",home:"home",end:"end",pageup:"pageup",pagedown:"pagedown",pgup:"pageup",pgdn:"pagedown",cmd:"meta",command:"meta",win:"meta",meta:"meta",control:"ctrl",ctrl:"ctrl",option:"alt",opt:"alt",alt:"alt",shift:"shift","\u2318":"meta","\u2303":"ctrl","\u2325":"alt","\u21E7":"shift",mod:"mod",plus:"+"});function P(e){let t=String(e??"");if(t===" ")return" ";let i=t.trim().toLowerCase();return ie[i]??i}function Te(e){return re.has(P(e))}var Fe=/(^|\+)code:([A-Za-z][A-Za-z0-9_]*)/;function oe(e,{platform:t=Ae}={}){let r=String(e||"").trim(),i=null,a=y=>{i=i||`Invalid hotkey "${e}": ${y}`},d=/\s+up$/i.test(r),u=d?r.replace(/\s+up$/i,"").trim():r,n={ctrl:!1,shift:!1,alt:!1,meta:!1,key:null,code:null,bareModifier:null},b=y=>{y==="mod"?n[t==="mac"?"meta":"ctrl"]=!0:n[y]=!0},w=u;for(;w.length;){let y=Pe.get(w[0])??null;if(!y)break;b(y),w=w.slice(1).trimStart()}let x=w.match(/code:[A-Za-z][A-Za-z0-9_]*/g);x&&x.length>1&&a(`multiple code: tokens not supported (got ${x.length}).`);let L=null,F=w.replace(Fe,(y,S,j)=>(L=j,S+"__code__")).toLowerCase(),D=F.split("+").map(y=>y.trim()),N=D.filter(Boolean),$=D.some(y=>y==="")&&F.includes("++");if(!$){let y=!1;for(let S of N)Te(S)?y&&a('modifiers must come before the base key (e.g. "ctrl+k", not "k+ctrl")'):y=!0}for(let y of N){if(y==="__code__"){n.code=L;continue}let S=ie[y]??y;re.has(S)?b(S):n.key=P(S)}if(!n.key&&!n.code&&$&&(n.key="+"),!n.key&&!n.code){let y=(n.ctrl?1:0)+(n.shift?1:0)+(n.alt?1:0)+(n.meta?1:0);y===1?n.bareModifier=n.ctrl?"ctrl":n.shift?"shift":n.alt?"alt":"meta":y>1?a('multi-modifier bare bindings not supported. Add a base key (e.g. "ctrl+alt+x").'):i=i||`Invalid hotkey "${e}" (missing base key)`}return{combo:n,type:d?"keyup":"keydown",raw:e,error:i}}function T(e,t){let{combo:r,type:i,raw:a,error:d}=oe(e,t);if(d)throw new Error(d);return{combo:r,type:i,raw:a}}var Ke={",":["<","Comma"],".":[">","Period"],"/":["?","Slash"],";":[":","Semicolon"],"'":['"',"Quote"],"[":["{","BracketLeft"],"]":["}","BracketRight"],"\\":["|","Backslash"],"-":["_","Minus"],"=":["+","Equal"],"`":["~","Backquote"]};function ae(e){let{combo:t,type:r,error:i}=oe(e);if(i||!t.shift||t.code)return null;let a=Ke[t.key];if(!a)return null;let[d,u]=a,b=String(e).trim().replace(/\s+up$/i,"").slice(0,-1)+"code:"+u+(r==="keyup"?" up":"");return{message:`"${e}" never fires on US layouts: Shift turns "${t.key}" into "${d}". Bind "${b}" instead.`,suggestion:b}}var W={".":"period",",":"comma",";":"semicolon","'":"quote","/":"slash","\\":"backslash","[":"bracketleft","]":"bracketright","-":"minus","=":"equal","`":"backquote"," ":"space","+":"equal"};function Re(e){if(!e)return null;let t=/^Key([A-Za-z])$/.exec(e);if(t)return t[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(e);return r?r[1]:e.toLowerCase()}function De(e){if(e==null||e==="")return null;if(W[e])return W[e];let t=P(e);return W[t]||t||null}function ne(e){if(!e||e.bareModifier)return null;let t=e.code?Re(e.code):De(e.key);if(!t)return null;let r=[];return e.ctrl&&r.push("ctrl"),e.meta&&r.push("meta"),e.alt&&r.push("alt"),e.shift&&r.push("shift"),r.push(t),r.join("+")}function R(e,t,r,i){return e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i)}var Oe=E(),q=Object.freeze({Alt:"alt",AltGraph:"alt",Control:"ctrl",Shift:"shift",Meta:"meta",OS:"meta"}),se=new Set;function z({ctrl:e,shift:t,alt:r,meta:i,key:a,code:d,bareModifier:u}){if(u)return`__bare__:${u}`;let n="";return e&&(n+="ctrl+"),t&&(n+="shift+"),r&&(n+="alt+"),i&&(n+="meta+"),d?n+"code:"+d:n?n+a:a}function Be(e){let t=q[e.key];return t?`__bare__:${t}`:z({ctrl:e.ctrlKey,shift:e.shiftKey,alt:e.altKey,meta:e.metaKey,key:P(e.key)})}function Me(e){if(!e.code)return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+"code:"+e.code}var Le=new Set(["checkbox","radio","range","color","file","button","submit","reset","image"]);function Ne(e){let t=e?.composedPath?.();if(t?.length)return t;let r=[];for(let i=e?.target;i;i=i.parentNode||i.host)r.push(i);return r}function $e(e,t){let r=Ne(e),i=r[0];if(!i)return null;let a=String(i.tagName||"").toUpperCase();if(i.isContentEditable||a==="TEXTAREA"||a==="SELECT"||i.getAttribute?.("role")==="textbox")return"text";if(a==="INPUT"){if(t==="all")return"text";let d=String(i.getAttribute?.("type")||"text").toLowerCase();return Le.has(d)?"control":"text"}if(t==="text"){for(let d of r)if(String(d.tagName||"").toUpperCase()==="BUTTON"||d.getAttribute?.("role")==="button")return"control"}return null}function _e(e){return!!((e.ctrlKey||e.altKey||e.metaKey)&&!q[e.key])}function ce(e){if(e==="all"||e==="text")return e;if(typeof e=="string")throw new TypeError(`hotkeys.ignoreInput() expects true, false, 'all' or 'text', got "${e}"`);return e?"all":null}function Ie(e,t){let r=t?{...t}:{};return e==="keydown"&&r.repeat==null&&(r.repeat=!1),r.priority==null&&(r.priority=0),r}function le(e){let t=null;for(let r of e)t?(r.options.priority>t.options.priority||r.options.priority===t.options.priority&&r.id>t.id)&&(t=r):t=r;return t}function ze(e){return!!(e.ctrlKey&&e.altKey&&typeof e.getModifierState=="function"&&e.getModifierState("AltGraph")&&typeof e.key=="string"&&e.key.length===1)}function fe(e){return!!(e.isComposing||e.keyCode===229)}var je=/^(?!\p{Script=Latin})\p{L}$/u;function He(e){if(!(e.ctrlKey||e.metaKey)||e.altKey||fe(e)||typeof e.getModifierState=="function"&&e.getModifierState("AltGraph"))return null;let t=/^Key([A-Z])$/.exec(e.code||"");return!t||typeof e.key!="string"||!je.test(e.key)?null:z({ctrl:e.ctrlKey,shift:e.shiftKey,alt:!1,meta:e.metaKey,key:t[1].toLowerCase()})}var Ue={ctrl:"Control",shift:"Shift",alt:"Alt",meta:"Meta"},ue={Period:".",Comma:",",Semicolon:";",Quote:"'",Slash:"/",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Minus:"-",Equal:"=",Backquote:"`",Space:" ",Enter:"Enter",NumpadEnter:"Enter",Tab:"Tab",Escape:"Escape",Backspace:"Backspace",Delete:"Delete",Insert:"Insert",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},I={},de;for(let[e,t]of Object.entries(ue))I[de=P(t)]??(I[de]=e);function We(e){if(!e)return null;let t=/^Key([A-Z])$/.exec(e);if(t)return t[1].toLowerCase();let r=/^(?:Digit|Numpad)(\d)$/.exec(e);return r?r[1]:/^F\d{1,2}$/.test(e)?e:ue[e]??null}function qe(e){return e?/^[a-z]$/.test(e)?"Key"+e.toUpperCase():/^\d$/.test(e)?"Digit"+e:/^f\d{1,2}$/.test(e)?e.toUpperCase():I[e]??null:null}function he(e,{physical:t=!0,useMod:r=!1,platform:i=Oe}={}){if(!e||q[e.key])return null;let a=[],d=i==="mac";if(r&&(d?e.metaKey:e.ctrlKey)&&a.push("mod"),e.ctrlKey&&!(r&&!d)&&a.push("ctrl"),e.metaKey&&!(r&&d)&&a.push("meta"),e.altKey&&a.push("alt"),e.shiftKey&&a.push("shift"),t&&e.code)a.push(`code:${e.code}`);else{let u=P(e.key);if(!u)return null;a.push(u===" "?"space":u)}return a.join("+")}function pe({target:e=typeof window<"u"?window:null,capture:t=!1,ignoreInput:r=!0}={}){let i=ce(r),a=e,d=t,u=[],n=new Map,b=new Map,w=new Map,x=!1,L=1;function G(o,l){let c=n.get(o);c||(c=new Map,n.set(o,c));let s=c.get(l);return s||(s=[],c.set(l,s)),s}function F(o){let l=w.get(o);if(!l)return!1;let{comboStr:c,type:s}=l,h=n.get(c),f=h?.get(s);if(!f?.length)return w.delete(o),!1;let p=f.filter(m=>m.id!==o);return p.length?h.set(s,p):h.delete(s),h.size||n.delete(c),w.delete(o),!0}function D(o,l,c=null,s={}){let{combo:h,type:f,raw:p}=T(o),m=z(h),g=Ie(f,s),k={id:L++,comboStr:m,type:f,combo:h,handler:l,plugin:c,raw:p,options:g};G(m,f).push(k),w.set(k.id,{comboStr:m,type:f});let C=`${m} ${f}`;if(!se.has(C)){let A=ae(o);A&&(se.add(C),console.warn(`[hotkey-router] ${A.message}`))}if(u.length)for(let A of u)try{A({combo:h,raw:p,options:g,plugin:c,id:k.id})}catch(_){console.error("[hotkey-router] onBind hook threw:",_)}let v=()=>F(k.id);return v.id=k.id,v.hotkey=p,v}function N(o){if(typeof o!="function")throw new TypeError("hotkeys.onBind(hook) expects a function");return u.push(o),()=>{u=u.filter(l=>l!==o)}}function $(o,l){let{combo:c,type:s}=T(o),h=z(c),f=n.get(h);if(!f)return;let p=f.get(s);if(p?.length){if(l){let m=[];for(let g of p)g.handler===l?w.delete(g.id):m.push(g);m.length?f.set(s,m):f.delete(s)}else{for(let m of p)w.delete(m.id);f.delete(s)}f.size||n.delete(h)}}function y(o,l){if(b.has(o))throw new Error(`Plugin "${o}" already registered`);let c=Object.entries(l);for(let[h]of c)T(h);let s=[];for(let[h,f]of c){let[p,m]=Array.isArray(f)?f:[f,{}],g=D(h,p,o,m);s.push(g.id)}return b.set(o,s),()=>S(o)}function S(o){let l=b.get(o);if(l){for(let c of l)F(c);b.delete(o)}}function j(){x=!0}function ge(){x=!1}function ke(o=!0){i=ce(o)}function Se(o){a=o}function Z(o,l,c){let s={altGraphChar:ze(o),composing:fe(o),focus:i&&$e(o,i),chord:_e(o)},h=[],f=new Set;for(let p of[Be(o),Me(o)])!p||f.has(p)||(f.add(p),Q(h,p,o,l,c,s));if(!h.length){let p=He(o);p&&!f.has(p)&&Q(h,p,o,l,c,s)}return h}function Q(o,l,c,s,h,{altGraphChar:f,composing:p,focus:m,chord:g}){let k=n.get(l)?.get(s);if(k?.length)for(let C of k){let v=C.options;h==="capture"&&!v.capture||h==="bubble"&&v.capture||f&&!v.altGraph||p&&!v.composing||m&&!(m==="control"&&g)&&!v.allowIn?.(c)||s==="keydown"&&v.repeat===!1&&c.repeat||v.when&&v.when(c)===!1||o.push(C)}}function X(o,l){let c=o.options;c.preventDefault&&l.preventDefault(),c.stopImmediatePropagation?l.stopImmediatePropagation():c.stopPropagation&&l.stopPropagation();try{o.handler(l)}finally{c.once&&F(o.id)}}function K(o,l="all"){return c=>{if(x)return;let s=Z(c,o,l);s.length&&X(le(s),c)}}let O=null,B=null,H=null,U=null;function xe({target:o=a,capture:l=d}={}){if(!o)throw new Error("hotkeys.init() requires a target (e.g. window)");if((O||B)&&Y(),l){O=R(o,"keydown",K("keydown"),{capture:!0}),B=R(o,"keyup",K("keyup"),{capture:!0});return}O=R(o,"keydown",K("keydown","bubble"),{capture:!1}),B=R(o,"keyup",K("keyup","bubble"),{capture:!1}),H=R(o,"keydown",K("keydown","capture"),{capture:!0}),U=R(o,"keyup",K("keyup","capture"),{capture:!0})}function Y(){O?.(),B?.(),H?.(),U?.(),O=null,B=null,H=null,U=null,n.clear(),b.clear(),w.clear()}function Ce(o,{type:l,target:c=null}={}){let{combo:s,type:h}=T(o),f=l||h;if(x)return!1;let p=s.bareModifier?Ue[s.bareModifier]:s.key??We(s.code),m=s.bareModifier?null:s.code??qe(s.key),g=!!s.alt,k=!!s.ctrl,C=!!s.shift,v=!!s.meta;s.bareModifier&&f==="keyup"&&(s.bareModifier==="alt"?g=!1:s.bareModifier==="ctrl"?k=!1:s.bareModifier==="shift"?C=!1:s.bareModifier==="meta"&&(v=!1));let A={type:f,key:p,code:m,ctrlKey:k,shiftKey:C,altKey:g,metaKey:v,repeat:!1,isComposing:!1,getModifierState(){return!1},preventDefault(){},stopPropagation(){},stopImmediatePropagation(){},target:c},_=Z(A,f,"all");return _.length?(X(le(_),A),!0):!1}return{init:xe,destroy:Y,setTarget:Se,bind:D,unbind:$,registerPlugin:y,unregisterPlugin:S,onBind:N,pause:j,resume:ge,ignoreInput:ke,trigger:Ce,parseHotkey:T,comboFromEvent:he,detectPlatform:E}}var ye=pe();typeof window<"u"&&ye.init();var V=ye;var M={$comment:"Machine-readable companion to docs/browser-hotkeys.md. Each combo entry describes who claims the binding and how strongly. Intended for runtime conflict warnings in keyboard-routing libraries (e.g. hotkey-router) and dev-time validation in apps like WebRadar. Update both this file and the markdown together \u2014 the markdown is the human source of truth, this file is the machine projection.",version:{generated:"2026-10-29",schema:"1.0",sources:["https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly","https://firefox-source-docs.mozilla.org/devtools-user/keyboard_shortcuts/index.html","https://support.google.com/chrome/answer/157179","https://developer.chrome.com/docs/devtools/shortcuts","https://support.apple.com/guide/safari/keyboard-shortcuts-and-gestures-cpsh003/mac","https://developer.apple.com/documentation/safari-developer-tools/web-inspector","https://support.microsoft.com/en-us/microsoft-edge/keyboard-shortcuts-in-microsoft-edge-50d3edab-30d9-c7e4-21ce-37fe2713cfad","https://support.apple.com/en-us/102650","https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec","https://help.gnome.org/gnome-help/shell-keyboard-shortcuts.html"]},severityLevels:{hard:"Browser or OS intercepts before page-world keydown fires. preventDefault() can't recover it.","find-bar-only":"Reserved only when the browser's find bar has focus. Fires in page world during normal browsing.","menu-activation":"Win/Linux Alt+letter activates the browser menu bar. Hard to suppress reliably.","system-text":"Only reserved while a text input has focus (terminal-style cursor controls on macOS).",compose:"macOS Option+letter types a special character in text inputs. Outside inputs, free for page world.",os:"Operating system intercepts globally, before any application sees it.","devtools-open":"Only relevant when DevTools is already open; outside DevTools it fires normally.",preventable:"The browser's own shortcut, but keydown reaches the page first: a binding with preventDefault() keeps the browser out, and without one the browser acts. Checked with real keys on Windows (docs/notes/key-check-reserved-2026-10-29.md)."},$keyFormat:"Each combo key uses hotkey-router-compatible syntax: modifiers in canonical order (ctrl|meta|alt|shift) joined by '+', then the key (lowercased letter, or symbolic name). Per-platform tables use the platform's native modifier name \u2014 `meta` on macOS = Cmd, `meta` on Windows = Win, `ctrl` on Linux/Windows = the primary modifier.",platforms:{mac:{browsers:{firefox:{"meta+a":{action:"Select all",severity:"hard"},"meta+b":{action:"Bookmarks sidebar",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search from page",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+u":{action:"View source",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"Redo",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+a":{action:"Add-ons manager",severity:"hard"},"meta+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"meta+shift+c":{action:"Inspector (element picker)",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+e":{action:"Network Monitor",severity:"hard"},"meta+shift+f":{action:"Toggle fullscreen",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Browser Console",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+o":{action:"Bookmarks library",severity:"hard"},"meta+shift+p":{action:"New private window (alt)",severity:"hard"},"meta+shift+q":{action:"Quit (with confirm)",severity:"hard"},"meta+shift+s":{action:"Firefox Screenshot",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Inspector",severity:"hard"},"meta+alt+e":{action:"Network Monitor",severity:"hard"},"meta+alt+i":{action:"DevTools Toolbox",severity:"hard"},"meta+alt+j":{action:"Browser Console",severity:"hard"},"meta+alt+k":{action:"Web Console",severity:"hard"},"meta+alt+m":{action:"Responsive Design Mode",severity:"hard"},"meta+alt+z":{action:"Debugger",severity:"hard"}},chrome:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Bookmark this page",severity:"hard"},"meta+e":{action:"Search selected text",severity:"find-bar-only"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+l":{action:"Focus address bar",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+o":{action:"Open file",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+y":{action:"History page",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"meta+shift+c":{action:"DevTools Inspector",severity:"hard"},"meta+shift+d":{action:"Bookmark all tabs",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+j":{action:"Downloads page",severity:"hard"},"meta+shift+m":{action:"Switch user / guest",severity:"hard"},"meta+shift+n":{action:"New incognito window",severity:"hard"},"meta+shift+r":{action:"Hard reload",severity:"hard"},"meta+shift+t":{action:"Reopen closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+i":{action:"DevTools",severity:"hard"},"meta+alt+j":{action:"DevTools (console)",severity:"hard"},"meta+alt+u":{action:"View source",severity:"hard"}},safari:{"meta+a":{action:"Select all",severity:"hard"},"meta+c":{action:"Copy",severity:"hard"},"meta+d":{action:"Add to Reading List",severity:"hard"},"meta+f":{action:"Find in page",severity:"hard"},"meta+g":{action:"Find next",severity:"hard"},"meta+j":{action:"Downloads",severity:"hard"},"meta+l":{action:"Focus Smart Search",severity:"hard"},"meta+n":{action:"New window",severity:"hard"},"meta+p":{action:"Print",severity:"hard"},"meta+r":{action:"Reload",severity:"hard"},"meta+s":{action:"Save page",severity:"hard"},"meta+t":{action:"New tab",severity:"hard"},"meta+v":{action:"Paste",severity:"hard"},"meta+w":{action:"Close tab",severity:"hard"},"meta+x":{action:"Cut",severity:"hard"},"meta+z":{action:"Undo",severity:"hard"},"meta+shift+c":{action:"Inspector pick element",severity:"hard"},"meta+shift+d":{action:"Add Reading List item",severity:"hard"},"meta+shift+g":{action:"Find previous",severity:"find-bar-only"},"meta+shift+h":{action:"Go to homepage",severity:"hard"},"meta+shift+n":{action:"New private window",severity:"hard"},"meta+shift+r":{action:"Reader mode",severity:"hard"},"meta+shift+t":{action:"Reopen last closed tab",severity:"hard"},"meta+shift+v":{action:"Paste as plain text",severity:"hard"},"meta+shift+w":{action:"Close window",severity:"hard"},"meta+shift+z":{action:"Redo",severity:"hard"},"meta+alt+c":{action:"Web Inspector pick",severity:"hard"},"meta+alt+i":{action:"Web Inspector",severity:"hard"}}},system:{"meta+space":{action:"Spotlight",severity:"os"},"meta+tab":{action:"App switcher",severity:"os"},"meta+h":{action:"Hide app",severity:"os"},"meta+m":{action:"Minimize window",severity:"os"},"meta+q":{action:"Quit app",severity:"os"},"meta+shift+3":{action:"Screenshot full screen",severity:"os"},"meta+shift+4":{action:"Screenshot selection",severity:"os"},"meta+shift+5":{action:"Screen recording tool",severity:"os"},"meta+shift+q":{action:"Log out",severity:"os"},"meta+ctrl+q":{action:"Lock screen",severity:"os"},"meta+ctrl+space":{action:"Character Viewer",severity:"os"},"meta+alt+esc":{action:"Force-quit dialog",severity:"os"},"meta+shift+slash":{action:"Help menu search (Cmd+?)",severity:"os"},"meta+alt+h":{action:"Hide other apps",severity:"os"},"meta+alt+d":{action:"Show or hide the Dock",severity:"os"},"meta+backquote":{action:"Switch windows of the front app",severity:"os"}},noteForLetterCombos:{"alt+a..z":{behavior:"compose",note:"Option+letter types special characters in text inputs (Option+E\u2192\xB4, Option+A\u2192\xE5, Option+F\u2192\u0192). Outside inputs, free for page world."},"ctrl+a..z":{behavior:"system-text",note:"Mac uses Ctrl+letter as terminal-style cursor controls inside text inputs (Ctrl+A=line start, Ctrl+E=line end, Ctrl+K=delete-to-end, etc.). Outside inputs, free for page world."}}},windows:{browsers:{firefox:{"ctrl+a":{action:"Select all",severity:"preventable"},"ctrl+b":{action:"Bookmarks sidebar",severity:"preventable"},"ctrl+c":{action:"Copy",severity:"preventable"},"ctrl+d":{action:"Bookmark this page",severity:"preventable"},"ctrl+e":{action:"Search from page",severity:"preventable"},"ctrl+f":{action:"Find in page",severity:"preventable"},"ctrl+g":{action:"Find next",severity:"preventable"},"ctrl+h":{action:"History sidebar",severity:"preventable"},"ctrl+j":{action:"Downloads",severity:"preventable"},"ctrl+k":{action:"Search from page",severity:"preventable"},"ctrl+l":{action:"Focus address bar",severity:"preventable"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"preventable"},"ctrl+p":{action:"Print",severity:"preventable"},"ctrl+r":{action:"Reload",severity:"preventable"},"ctrl+s":{action:"Save page",severity:"preventable"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"preventable"},"ctrl+v":{action:"Paste",severity:"preventable"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"preventable"},"ctrl+y":{action:"Redo",severity:"preventable"},"ctrl+z":{action:"Undo",severity:"preventable"},"ctrl+shift+a":{action:"Add-ons manager",severity:"hard"},"ctrl+shift+b":{action:"Bookmarks toolbar",severity:"hard"},"ctrl+shift+c":{action:"Inspector (element picker)",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+e":{action:"Network Monitor",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"Developer Tools",severity:"hard"},"ctrl+shift+j":{action:"Browser Console",severity:"hard"},"ctrl+shift+k":{action:"Web Console",severity:"hard"},"ctrl+shift+m":{action:"Responsive Design Mode",severity:"hard"},"ctrl+shift+n":{action:"New private window",severity:"hard"},"ctrl+shift+o":{action:"Bookmarks library",severity:"hard"},"ctrl+shift+p":{action:"New private window (alt)",severity:"hard"},"ctrl+shift+s":{action:"Firefox Screenshot",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Downloads (alt)",severity:"hard"},"ctrl+shift+z":{action:"Debugger",severity:"hard"},"alt+f":{action:"File menu",severity:"menu-activation"},"alt+e":{action:"Edit menu",severity:"menu-activation"},"alt+v":{action:"View menu",severity:"menu-activation"},"alt+b":{action:"Bookmarks menu",severity:"menu-activation"},"alt+t":{action:"Tools menu",severity:"menu-activation"},"alt+h":{action:"Help menu",severity:"menu-activation"},"alt+d":{action:"Focus address bar",severity:"hard"}},chrome:{"ctrl+a":{action:"Select all",severity:"preventable"},"ctrl+c":{action:"Copy",severity:"preventable"},"ctrl+d":{action:"Bookmark this page",severity:"preventable"},"ctrl+e":{action:"Search from page",severity:"preventable"},"ctrl+f":{action:"Find in page",severity:"preventable"},"ctrl+g":{action:"Find next",severity:"preventable"},"ctrl+h":{action:"History page",severity:"preventable"},"ctrl+j":{action:"Downloads",severity:"preventable"},"ctrl+k":{action:"Search from page",severity:"preventable"},"ctrl+l":{action:"Focus address bar",severity:"preventable"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"preventable"},"ctrl+p":{action:"Print",severity:"preventable"},"ctrl+r":{action:"Reload",severity:"preventable"},"ctrl+s":{action:"Save page",severity:"preventable"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"preventable"},"ctrl+v":{action:"Paste",severity:"preventable"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"preventable"},"ctrl+z":{action:"Undo",severity:"preventable"},"ctrl+shift+b":{action:"Bookmarks bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"Incognito window",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+v":{action:"Paste as plain text",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Customize menu",severity:"menu-activation"},"alt+f":{action:"Customize menu (alt)",severity:"menu-activation"}},edge:{"ctrl+a":{action:"Select all",severity:"preventable"},"ctrl+c":{action:"Copy",severity:"preventable"},"ctrl+d":{action:"Favorite this page",severity:"preventable"},"ctrl+e":{action:"Search from page",severity:"preventable"},"ctrl+f":{action:"Find in page",severity:"preventable"},"ctrl+g":{action:"Find next",severity:"preventable"},"ctrl+h":{action:"History",severity:"preventable"},"ctrl+j":{action:"Downloads",severity:"preventable"},"ctrl+k":{action:"Search from page",severity:"preventable"},"ctrl+l":{action:"Focus address bar",severity:"preventable"},"ctrl+m":{action:"Mute current tab",severity:"preventable"},"ctrl+n":{action:"New window",severity:"hard"},"ctrl+o":{action:"Open file",severity:"preventable"},"ctrl+p":{action:"Print",severity:"preventable"},"ctrl+r":{action:"Reload",severity:"preventable"},"ctrl+s":{action:"Save page",severity:"preventable"},"ctrl+t":{action:"New tab",severity:"hard"},"ctrl+u":{action:"View source",severity:"preventable"},"ctrl+v":{action:"Paste",severity:"preventable"},"ctrl+w":{action:"Close tab",severity:"hard"},"ctrl+x":{action:"Cut",severity:"preventable"},"ctrl+z":{action:"Undo",severity:"preventable"},"ctrl+shift+b":{action:"Favorites bar toggle",severity:"hard"},"ctrl+shift+d":{action:"Bookmark all tabs in folder",severity:"hard"},"ctrl+shift+e":{action:"Search in sidebar",severity:"hard"},"ctrl+shift+g":{action:"Find previous",severity:"find-bar-only"},"ctrl+shift+i":{action:"DevTools",severity:"hard"},"ctrl+shift+j":{action:"DevTools (console)",severity:"hard"},"ctrl+shift+k":{action:"Duplicate tab",severity:"hard"},"ctrl+shift+l":{action:"Paste and search",severity:"hard"},"ctrl+shift+m":{action:"Switch user / guest",severity:"hard"},"ctrl+shift+n":{action:"InPrivate window",severity:"hard"},"ctrl+shift+o":{action:"Open favorites",severity:"hard"},"ctrl+shift+p":{action:"Print (system dialog)",severity:"hard"},"ctrl+shift+r":{action:"Hard reload",severity:"hard"},"ctrl+shift+t":{action:"Reopen closed tab",severity:"hard"},"ctrl+shift+u":{action:"Read Aloud toggle",severity:"hard"},"ctrl+shift+v":{action:"Paste without formatting",severity:"hard"},"ctrl+shift+w":{action:"Close window",severity:"hard"},"ctrl+shift+y":{action:"Collections",severity:"hard"},"alt+d":{action:"Focus address bar",severity:"hard"},"alt+e":{action:"Settings menu",severity:"menu-activation"},"alt+f":{action:"Settings menu (alt)",severity:"menu-activation"},"alt+shift+b":{action:"Focus favorites bar",severity:"hard"},"alt+shift+i":{action:"Send feedback dialog",severity:"hard"},"alt+shift+t":{action:"Focus app bar toolbar",severity:"hard"}}},system:{"meta+a":{action:"Action Center",severity:"os"},"meta+c":{action:"Windows search",severity:"os"},"meta+d":{action:"Show desktop",severity:"os"},"meta+e":{action:"File Explorer",severity:"os"},"meta+g":{action:"Game bar",severity:"os"},"meta+h":{action:"Voice dictation",severity:"os"},"meta+i":{action:"Settings",severity:"os"},"meta+l":{action:"Lock",severity:"os"},"meta+n":{action:"Notification center",severity:"os"},"meta+p":{action:"Project / display mode",severity:"os"},"meta+r":{action:"Run dialog",severity:"os"},"meta+s":{action:"Search",severity:"os"},"meta+v":{action:"Clipboard history",severity:"os"},"meta+w":{action:"Widgets",severity:"os"},"meta+x":{action:"Quick Link menu",severity:"os"},"meta+z":{action:"Snap layouts",severity:"os"},"meta+tab":{action:"Task View",severity:"os"},"meta+shift+s":{action:"Screenshot region",severity:"os"},"ctrl+shift+esc":{action:"Task Manager",severity:"os"},"ctrl+alt+del":{action:"Security screen",severity:"os"},"alt+tab":{action:"Switch windows",severity:"os"},"alt+f4":{action:"Close active window",severity:"os"}}},linux:{browsers:{firefox:"$ref:platforms.windows.browsers.firefox",chrome:"$ref:platforms.windows.browsers.chrome",edge:"$ref:platforms.windows.browsers.edge"},system:{$comment:"GNOME defaults. KDE and other DEs have similar-shaped reservations but vary; this is a conservative baseline.","meta+tab":{action:"Switch windows",severity:"os"},"meta+a":{action:"Show applications",severity:"os"},"meta+l":{action:"Lock screen",severity:"os"},"meta+v":{action:"Notification list",severity:"os"},"alt+tab":{action:"Switch applications",severity:"os"},"alt+esc":{action:"Cycle windows",severity:"os"},"alt+f2":{action:"Run command",severity:"os"},"alt+f4":{action:"Close window",severity:"os"},"ctrl+alt+tab":{action:"Top-bar accessibility switcher",severity:"os"},"ctrl+alt+del":{action:"Power-off dialog",severity:"os"},"ctrl+shift+alt+r":{action:"Toggle screencast recording",severity:"os"}},noteForCtrlAlt:"Some Linux setups map right-Alt (AltGr) to 'compose' for typing accented characters, in which case AltGr+letter is reported as ctrl+alt+letter and types a special character. Avoid the ctrl+alt+letter namespace on Linux."}}};var Ge="1.0",Ze=new Set(["hard","os","menu-activation"]);function Qe(e){let t=String(e).toLowerCase().split("+").map(d=>d.trim()).filter(Boolean);if(!t.length)return"";let r=t[t.length-1],i=new Set(t.slice(0,-1)),a=[];return i.has("ctrl")&&a.push("ctrl"),i.has("meta")&&a.push("meta"),i.has("alt")&&a.push("alt"),i.has("shift")&&a.push("shift"),a.push(r),a.join("+")}function Xe(e,t){if(typeof e!="string"||!e.startsWith("$ref:"))return e;let r=e.slice(5).split("."),i=t;for(let a of r)i=i?.[a];return i}function me(e){if(!e||typeof e!="object")return null;let t=Object.create(null);for(let[r,i]of Object.entries(e))!i||typeof i!="object"||!("severity"in i)||(t[Qe(r)]=i);return t}function Ye(e){let t={platforms:{}},r=e?.platforms||{};for(let[i,a]of Object.entries(r)){let d={};for(let[u,n]of Object.entries(a.browsers||{}))d[u]=me(Xe(n,e));t.platforms[i]={browsers:d,system:me(a.system)}}return t}var ve=M?.version?.schema===Ge,Je=ve?Ye(M):{platforms:{}},et=ne;function tt(e,{platform:t,browser:r}={}){if(!ve)return null;let i=et(e);if(!i)return null;let a=t&&Je.platforms[t];if(!a)return null;let u=(r?a.browsers?.[r]:null)?.[i];if(u)return{source:"browser",platform:t,browser:r,lookupKey:i,action:u.action,severity:u.severity};let n=a.system?.[i];return n?{source:"system",platform:t,browser:r,lookupKey:i,action:n.action,severity:n.severity}:null}function be(e){return Ze.has(e)}function rt(e,t,r){let i=te(e.platform),a=e.source==="browser"?`${e.browser} on ${i}`:i,d=be(e.severity)?"will not fire":e.severity==="preventable"?r?.preventDefault?"fires first; preventDefault keeps the browser out":"fires, and the browser acts too; bind with preventDefault: true":"fires in normal browsing";return`[hotkey-router] "${t}" (${e.lookupKey}) reserved by ${a}: "${e.action}" [${e.severity}] \u2014 ${d}.`}function it(e,t,r=console,i){let a=rt(e,t,i);(be(e.severity)||e.severity==="preventable"&&!i?.preventDefault?r.warn:r.info).call(r,a)}function we(e,t={}){if(!e||typeof e.onBind!="function")throw new TypeError("installReservationWarnings(hotkeys) requires a hotkey-router instance with onBind() (>= v0.2.0)");let r=t.platform!==void 0?t.platform:E(),i=t.browser!==void 0?t.browser:ee(),a=t.console||console;return e.onBind(({combo:d,raw:u,options:n})=>{if(n?.warnOnReserved===!1||!r||!i)return;let b=tt(d,{platform:r,browser:i});b&&it(b,u,a,n)})}var mt=M?.version?.schema,vt=M?.version?.generated;we(V);var kt=V;export{kt as default};
|
package/dist/core.js
CHANGED