hotkey-router 0.3.1 → 0.3.3
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 +129 -11
- package/dist/auto.js +5 -1031
- package/dist/auto.js.map +4 -4
- package/dist/auto.min.js +2 -2
- package/dist/format.js +394 -0
- package/dist/format.js.map +7 -0
- package/dist/hotkey-router.cjs +270 -127
- package/dist/hotkey-router.cjs.map +4 -4
- package/dist/hotkey-router.js +269 -128
- package/dist/hotkey-router.js.map +4 -4
- package/dist/hotkey-router.min.js +2 -2
- package/dist/reservations.js +128 -62
- package/dist/reservations.js.map +4 -4
- package/dist/sites.js +195 -80
- package/dist/sites.js.map +4 -4
- package/dist/types/format.d.ts +128 -0
- package/dist/types/hotkey-router.d.ts +19 -20
- package/dist/types/parse.d.ts +125 -0
- package/dist/types/platform.d.ts +23 -0
- package/dist/types/reservations.d.ts +11 -6
- package/dist/types/sites.d.ts +6 -1
- package/dist/types/validate.d.ts +2 -2
- package/dist/validate.js +202 -8
- package/dist/validate.js.map +3 -3
- package/package.json +12 -2
package/dist/format.js
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
// hotkey-router v0.3.3 | SEE LICENSE IN LICENSE
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// platform.js
|
|
5
|
+
function fromPlatformString(s) {
|
|
6
|
+
if (!s) return null;
|
|
7
|
+
if (/Chrome ?OS|CrOS/i.test(s)) return "chromeos";
|
|
8
|
+
if (/Mac|iPhone|iPad|iPod/i.test(s)) return "mac";
|
|
9
|
+
if (/Win/i.test(s)) return "windows";
|
|
10
|
+
if (/Linux|X11/i.test(s)) return "linux";
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
function detectPlatform(nav = typeof navigator !== "undefined" ? navigator : null, { chromeos = false } = {}) {
|
|
14
|
+
if (!nav) return null;
|
|
15
|
+
const ua = nav.userAgent || "";
|
|
16
|
+
const found = (/\bCrOS\b/.test(ua) ? "chromeos" : null) || fromPlatformString(nav.userAgentData?.platform) || fromPlatformString(nav.platform) || (/Mac OS X/i.test(ua) ? "mac" : /Windows/i.test(ua) ? "windows" : /Linux|X11/i.test(ua) ? "linux" : null);
|
|
17
|
+
if (found === "chromeos" && !chromeos) return "linux";
|
|
18
|
+
return found;
|
|
19
|
+
}
|
|
20
|
+
var PLATFORM_LABELS = { mac: "macOS", windows: "Windows", linux: "Linux", chromeos: "ChromeOS" };
|
|
21
|
+
var BROWSER_LABELS = { chrome: "Chrome", firefox: "Firefox", edge: "Edge", safari: "Safari" };
|
|
22
|
+
function platformLabel(platform) {
|
|
23
|
+
return PLATFORM_LABELS[platform] || platform;
|
|
24
|
+
}
|
|
25
|
+
function browserLabel(browser) {
|
|
26
|
+
return BROWSER_LABELS[browser] || browser;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// parse.js
|
|
30
|
+
var DEFAULT_PLATFORM = detectPlatform();
|
|
31
|
+
var modifierTokens = /* @__PURE__ */ new Set(["ctrl", "shift", "alt", "meta", "mod"]);
|
|
32
|
+
var ahkPrefixMap = /* @__PURE__ */ new Map([
|
|
33
|
+
["^", "ctrl"],
|
|
34
|
+
// Ctrl
|
|
35
|
+
["!", "alt"],
|
|
36
|
+
// Alt
|
|
37
|
+
["+", "shift"],
|
|
38
|
+
// Shift
|
|
39
|
+
["#", "meta"]
|
|
40
|
+
// Win / Command
|
|
41
|
+
]);
|
|
42
|
+
var keyAliases = Object.freeze({
|
|
43
|
+
// common
|
|
44
|
+
esc: "escape",
|
|
45
|
+
escape: "escape",
|
|
46
|
+
space: " ",
|
|
47
|
+
spacebar: " ",
|
|
48
|
+
enter: "enter",
|
|
49
|
+
return: "enter",
|
|
50
|
+
del: "delete",
|
|
51
|
+
delete: "delete",
|
|
52
|
+
backspace: "backspace",
|
|
53
|
+
tab: "tab",
|
|
54
|
+
// arrows
|
|
55
|
+
up: "arrowup",
|
|
56
|
+
down: "arrowdown",
|
|
57
|
+
left: "arrowleft",
|
|
58
|
+
right: "arrowright",
|
|
59
|
+
// navigation
|
|
60
|
+
home: "home",
|
|
61
|
+
end: "end",
|
|
62
|
+
pageup: "pageup",
|
|
63
|
+
pagedown: "pagedown",
|
|
64
|
+
pgup: "pageup",
|
|
65
|
+
pgdn: "pagedown",
|
|
66
|
+
// modifiers (words)
|
|
67
|
+
cmd: "meta",
|
|
68
|
+
command: "meta",
|
|
69
|
+
win: "meta",
|
|
70
|
+
meta: "meta",
|
|
71
|
+
control: "ctrl",
|
|
72
|
+
ctrl: "ctrl",
|
|
73
|
+
option: "alt",
|
|
74
|
+
opt: "alt",
|
|
75
|
+
alt: "alt",
|
|
76
|
+
shift: "shift",
|
|
77
|
+
// modifiers (symbols)
|
|
78
|
+
"\u2318": "meta",
|
|
79
|
+
"\u2303": "ctrl",
|
|
80
|
+
"\u2325": "alt",
|
|
81
|
+
"\u21E7": "shift",
|
|
82
|
+
// cross-platform "mod", resolved per platform while parsing
|
|
83
|
+
mod: "mod",
|
|
84
|
+
// plus key ergonomics
|
|
85
|
+
plus: "+"
|
|
86
|
+
});
|
|
87
|
+
function normalizeKey(key) {
|
|
88
|
+
const original = String(key ?? "");
|
|
89
|
+
if (original === " ") return " ";
|
|
90
|
+
const trimmed = original.trim();
|
|
91
|
+
const k = trimmed.toLowerCase();
|
|
92
|
+
return keyAliases[k] ?? k;
|
|
93
|
+
}
|
|
94
|
+
function isModifierToken(token) {
|
|
95
|
+
return modifierTokens.has(normalizeKey(token));
|
|
96
|
+
}
|
|
97
|
+
var CODE_TOKEN_RE = /(^|\+)code:([A-Za-z][A-Za-z0-9_]*)/;
|
|
98
|
+
function readHotkey(hotkeyStr, { platform = DEFAULT_PLATFORM } = {}) {
|
|
99
|
+
const raw = String(hotkeyStr || "").trim();
|
|
100
|
+
let error = null;
|
|
101
|
+
const fail = (msg) => {
|
|
102
|
+
error = error || `Invalid hotkey "${hotkeyStr}": ${msg}`;
|
|
103
|
+
};
|
|
104
|
+
const isUp = /\s+up$/i.test(raw);
|
|
105
|
+
const baseRaw = isUp ? raw.replace(/\s+up$/i, "").trim() : raw;
|
|
106
|
+
const combo = {
|
|
107
|
+
ctrl: false,
|
|
108
|
+
shift: false,
|
|
109
|
+
alt: false,
|
|
110
|
+
meta: false,
|
|
111
|
+
key: null,
|
|
112
|
+
code: null,
|
|
113
|
+
bareModifier: null
|
|
114
|
+
};
|
|
115
|
+
const setMod = (mod) => {
|
|
116
|
+
if (mod === "mod") combo[platform === "mac" ? "meta" : "ctrl"] = true;
|
|
117
|
+
else combo[mod] = true;
|
|
118
|
+
};
|
|
119
|
+
let stripped = baseRaw;
|
|
120
|
+
while (stripped.length) {
|
|
121
|
+
const mod = ahkPrefixMap.get(stripped[0]) ?? null;
|
|
122
|
+
if (!mod) break;
|
|
123
|
+
setMod(mod);
|
|
124
|
+
stripped = stripped.slice(1).trimStart();
|
|
125
|
+
}
|
|
126
|
+
const codeMatches = stripped.match(/code:[A-Za-z][A-Za-z0-9_]*/g);
|
|
127
|
+
if (codeMatches && codeMatches.length > 1) {
|
|
128
|
+
fail(`multiple code: tokens not supported (got ${codeMatches.length}).`);
|
|
129
|
+
}
|
|
130
|
+
let codeValue = null;
|
|
131
|
+
const scrubbed = stripped.replace(CODE_TOKEN_RE, (_, sep, val) => {
|
|
132
|
+
codeValue = val;
|
|
133
|
+
return sep + "__code__";
|
|
134
|
+
});
|
|
135
|
+
const cleanStr = scrubbed.toLowerCase();
|
|
136
|
+
const rawParts = cleanStr.split("+").map((p) => p.trim());
|
|
137
|
+
const parts = rawParts.filter(Boolean);
|
|
138
|
+
const impliedPlusKey = rawParts.some((p) => p === "") && cleanStr.includes("++");
|
|
139
|
+
if (!impliedPlusKey) {
|
|
140
|
+
let seenBase = false;
|
|
141
|
+
for (const part of parts) {
|
|
142
|
+
if (isModifierToken(part)) {
|
|
143
|
+
if (seenBase) fail('modifiers must come before the base key (e.g. "ctrl+k", not "k+ctrl")');
|
|
144
|
+
} else {
|
|
145
|
+
seenBase = true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
for (const part of parts) {
|
|
150
|
+
if (part === "__code__") {
|
|
151
|
+
combo.code = codeValue;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const actual = keyAliases[part] ?? part;
|
|
155
|
+
if (modifierTokens.has(actual)) setMod(actual);
|
|
156
|
+
else combo.key = normalizeKey(actual);
|
|
157
|
+
}
|
|
158
|
+
if (!combo.key && !combo.code && impliedPlusKey) combo.key = "+";
|
|
159
|
+
if (!combo.key && !combo.code) {
|
|
160
|
+
const modCount = (combo.ctrl ? 1 : 0) + (combo.shift ? 1 : 0) + (combo.alt ? 1 : 0) + (combo.meta ? 1 : 0);
|
|
161
|
+
if (modCount === 1) {
|
|
162
|
+
combo.bareModifier = combo.ctrl ? "ctrl" : combo.shift ? "shift" : combo.alt ? "alt" : "meta";
|
|
163
|
+
} else if (modCount > 1) {
|
|
164
|
+
fail('multi-modifier bare bindings not supported. Add a base key (e.g. "ctrl+alt+x").');
|
|
165
|
+
} else {
|
|
166
|
+
error = error || `Invalid hotkey "${hotkeyStr}" (missing base key)`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return { combo, type: isUp ? "keyup" : "keydown", raw: hotkeyStr, error };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// format.js
|
|
173
|
+
var MAC_MODIFIERS = {
|
|
174
|
+
ctrl: { label: "Control", glyph: "\u2303", name: "Control" },
|
|
175
|
+
alt: { label: "Option", glyph: "\u2325", name: "Option" },
|
|
176
|
+
shift: { label: "Shift", glyph: "\u21E7", name: "Shift" },
|
|
177
|
+
meta: { label: "Cmd", glyph: "\u2318", name: "Command" }
|
|
178
|
+
};
|
|
179
|
+
var PC_MODIFIERS = {
|
|
180
|
+
ctrl: { label: "Ctrl", name: "Control" },
|
|
181
|
+
alt: { label: "Alt", name: "Alt" },
|
|
182
|
+
shift: { label: "Shift", name: "Shift" },
|
|
183
|
+
meta: { label: "Win", name: "Windows" }
|
|
184
|
+
};
|
|
185
|
+
var META_BY_PLATFORM = {
|
|
186
|
+
linux: { label: "Super", name: "Super" },
|
|
187
|
+
chromeos: { label: "Search", name: "Search" }
|
|
188
|
+
};
|
|
189
|
+
var ORDER = {
|
|
190
|
+
mac: ["ctrl", "alt", "shift", "meta"],
|
|
191
|
+
pc: ["meta", "ctrl", "alt", "shift"]
|
|
192
|
+
};
|
|
193
|
+
var KEY_LABELS = Object.freeze({
|
|
194
|
+
Period: { label: ".", name: "Period" },
|
|
195
|
+
Comma: { label: ",", name: "Comma" },
|
|
196
|
+
Semicolon: { label: ";", name: "Semicolon" },
|
|
197
|
+
Quote: { label: "'", name: "Quote" },
|
|
198
|
+
Slash: { label: "/", name: "Slash" },
|
|
199
|
+
Backslash: { label: "\\", name: "Backslash" },
|
|
200
|
+
IntlBackslash: { label: "\\", name: "Backslash" },
|
|
201
|
+
BracketLeft: { label: "[", name: "Left Bracket" },
|
|
202
|
+
BracketRight: { label: "]", name: "Right Bracket" },
|
|
203
|
+
Minus: { label: "-", name: "Minus" },
|
|
204
|
+
Equal: { label: "=", name: "Equals" },
|
|
205
|
+
Backquote: { label: "`", name: "Backquote" },
|
|
206
|
+
Space: { label: "Space", name: "Space" },
|
|
207
|
+
Enter: { label: "Enter", name: "Enter", mac: "Return", glyph: "\u21A9" },
|
|
208
|
+
NumpadEnter: { label: "Enter", name: "Enter", mac: "Enter", glyph: "\u2324" },
|
|
209
|
+
Tab: { label: "Tab", name: "Tab", glyph: "\u21E5" },
|
|
210
|
+
Backspace: { label: "Backspace", name: "Backspace", mac: "Delete", glyph: "\u232B" },
|
|
211
|
+
Delete: { label: "Delete", name: "Delete", mac: "Forward Delete", glyph: "\u2326" },
|
|
212
|
+
Escape: { label: "Esc", name: "Escape", glyph: "\u238B" },
|
|
213
|
+
Insert: { label: "Insert", name: "Insert" },
|
|
214
|
+
Home: { label: "Home", name: "Home", glyph: "\u2196" },
|
|
215
|
+
End: { label: "End", name: "End", glyph: "\u2198" },
|
|
216
|
+
PageUp: { label: "Page Up", name: "Page Up", glyph: "\u21DE" },
|
|
217
|
+
PageDown: { label: "Page Down", name: "Page Down", glyph: "\u21DF" },
|
|
218
|
+
ArrowUp: { label: "Up", name: "Up Arrow", glyph: "\u2191" },
|
|
219
|
+
ArrowDown: { label: "Down", name: "Down Arrow", glyph: "\u2193" },
|
|
220
|
+
ArrowLeft: { label: "Left", name: "Left Arrow", glyph: "\u2190" },
|
|
221
|
+
ArrowRight: { label: "Right", name: "Right Arrow", glyph: "\u2192" },
|
|
222
|
+
CapsLock: { label: "Caps Lock", name: "Caps Lock", glyph: "\u21EA" },
|
|
223
|
+
ContextMenu: { label: "Menu", name: "Menu" },
|
|
224
|
+
NumpadAdd: { label: "Num +", name: "Numpad Plus" },
|
|
225
|
+
NumpadSubtract: { label: "Num -", name: "Numpad Minus" },
|
|
226
|
+
NumpadMultiply: { label: "Num *", name: "Numpad Multiply" },
|
|
227
|
+
NumpadDivide: { label: "Num /", name: "Numpad Divide" },
|
|
228
|
+
NumpadDecimal: { label: "Num .", name: "Numpad Decimal" }
|
|
229
|
+
});
|
|
230
|
+
var KEY_TO_CODE = {
|
|
231
|
+
".": "Period",
|
|
232
|
+
",": "Comma",
|
|
233
|
+
";": "Semicolon",
|
|
234
|
+
"'": "Quote",
|
|
235
|
+
"/": "Slash",
|
|
236
|
+
"\\": "Backslash",
|
|
237
|
+
"[": "BracketLeft",
|
|
238
|
+
"]": "BracketRight",
|
|
239
|
+
"-": "Minus",
|
|
240
|
+
"=": "Equal",
|
|
241
|
+
"`": "Backquote",
|
|
242
|
+
" ": "Space",
|
|
243
|
+
enter: "Enter",
|
|
244
|
+
tab: "Tab",
|
|
245
|
+
backspace: "Backspace",
|
|
246
|
+
delete: "Delete",
|
|
247
|
+
escape: "Escape",
|
|
248
|
+
insert: "Insert",
|
|
249
|
+
home: "Home",
|
|
250
|
+
end: "End",
|
|
251
|
+
pageup: "PageUp",
|
|
252
|
+
pagedown: "PageDown",
|
|
253
|
+
arrowup: "ArrowUp",
|
|
254
|
+
arrowdown: "ArrowDown",
|
|
255
|
+
arrowleft: "ArrowLeft",
|
|
256
|
+
arrowright: "ArrowRight",
|
|
257
|
+
capslock: "CapsLock",
|
|
258
|
+
contextmenu: "ContextMenu"
|
|
259
|
+
};
|
|
260
|
+
var KEY_NAMES = { "+": "Plus", "*": "Asterisk", "?": "Question Mark", "!": "Exclamation Mark" };
|
|
261
|
+
function resolvePlatform(platform) {
|
|
262
|
+
return platform || detectPlatform(void 0, { chromeos: true }) || "windows";
|
|
263
|
+
}
|
|
264
|
+
function modifierInfo(mod, platform) {
|
|
265
|
+
if (platform === "mac") return MAC_MODIFIERS[mod];
|
|
266
|
+
if (mod === "meta" && META_BY_PLATFORM[platform]) return META_BY_PLATFORM[platform];
|
|
267
|
+
return PC_MODIFIERS[mod];
|
|
268
|
+
}
|
|
269
|
+
function keyInfo({ key, code }, platform) {
|
|
270
|
+
const mac = platform === "mac";
|
|
271
|
+
let c = code;
|
|
272
|
+
if (!c && key != null) {
|
|
273
|
+
c = KEY_TO_CODE[key];
|
|
274
|
+
if (!c && /^[a-z]$/.test(key)) c = "Key" + key.toUpperCase();
|
|
275
|
+
if (!c && /^\d$/.test(key)) c = "Digit" + key;
|
|
276
|
+
if (!c && /^f\d{1,2}$/.test(key)) c = key.toUpperCase();
|
|
277
|
+
}
|
|
278
|
+
if (c) {
|
|
279
|
+
const known = KEY_LABELS[c];
|
|
280
|
+
if (known) {
|
|
281
|
+
const label = mac && known.mac ? known.mac : known.label;
|
|
282
|
+
return { label, name: mac && known.mac ? known.mac : known.name, glyph: mac ? known.glyph : void 0 };
|
|
283
|
+
}
|
|
284
|
+
const letter = /^Key([A-Z])$/.exec(c);
|
|
285
|
+
if (letter) return { label: letter[1], name: letter[1] };
|
|
286
|
+
const digit = /^Digit(\d)$/.exec(c);
|
|
287
|
+
if (digit) return { label: digit[1], name: digit[1] };
|
|
288
|
+
const numpad = /^Numpad(\d)$/.exec(c);
|
|
289
|
+
if (numpad) return { label: `Num ${numpad[1]}`, name: `Numpad ${numpad[1]}` };
|
|
290
|
+
if (/^F\d{1,2}$/.test(c)) return { label: c, name: c };
|
|
291
|
+
if (code) return { label: code, name: code };
|
|
292
|
+
}
|
|
293
|
+
const k = String(key ?? "");
|
|
294
|
+
if (k.length === 1) return { label: k.toUpperCase(), name: KEY_NAMES[k] || k.toUpperCase() };
|
|
295
|
+
const word = k.charAt(0).toUpperCase() + k.slice(1);
|
|
296
|
+
return { label: word, name: word };
|
|
297
|
+
}
|
|
298
|
+
function partsOf(combo, platform, order) {
|
|
299
|
+
let c = combo;
|
|
300
|
+
let written = null;
|
|
301
|
+
if (typeof combo === "string") {
|
|
302
|
+
c = readHotkey(combo, { platform }).combo;
|
|
303
|
+
if (order === "combo") written = writtenModifiers(combo, platform);
|
|
304
|
+
}
|
|
305
|
+
if (!c) return null;
|
|
306
|
+
const mods = (
|
|
307
|
+
/** @type {Modifier[]} */
|
|
308
|
+
["ctrl", "alt", "shift", "meta"].filter((m) => c[m] || c.bareModifier === m)
|
|
309
|
+
);
|
|
310
|
+
const sequence = written ? [...written.filter((m) => mods.includes(m)), ...mods.filter((m) => !written.includes(m))] : (platform === "mac" ? ORDER.mac : ORDER.pc).filter((m) => mods.includes(m));
|
|
311
|
+
const hasKey = !c.bareModifier && (c.key != null || c.code != null);
|
|
312
|
+
return { mods: sequence, key: hasKey ? { key: c.key ?? null, code: c.code ?? null } : null };
|
|
313
|
+
}
|
|
314
|
+
function writtenModifiers(str, platform) {
|
|
315
|
+
const out = [];
|
|
316
|
+
const raw = String(str).replace(/\s+up$/i, "");
|
|
317
|
+
let i = 0;
|
|
318
|
+
const ahk = { "^": "ctrl", "!": "alt", "+": "shift", "#": "meta" };
|
|
319
|
+
while (i < raw.length && ahk[raw[i]] && raw[i + 1] !== void 0) {
|
|
320
|
+
out.push(ahk[raw[i]]);
|
|
321
|
+
i++;
|
|
322
|
+
}
|
|
323
|
+
for (const token of raw.slice(i).split("+")) {
|
|
324
|
+
const t = normalizeKey(token);
|
|
325
|
+
const m = t === "mod" ? platform === "mac" ? "meta" : "ctrl" : t;
|
|
326
|
+
if (["ctrl", "alt", "shift", "meta"].includes(m) && !out.includes(m)) out.push(m);
|
|
327
|
+
}
|
|
328
|
+
return out;
|
|
329
|
+
}
|
|
330
|
+
function modifierLabel(name, { platform, style = "text" } = {}) {
|
|
331
|
+
const plat = resolvePlatform(platform);
|
|
332
|
+
let mod = normalizeKey(name);
|
|
333
|
+
if (mod === "mod") mod = plat === "mac" ? "meta" : "ctrl";
|
|
334
|
+
const info = modifierInfo(mod, plat);
|
|
335
|
+
if (!info) return String(name);
|
|
336
|
+
if (style === "glyphs" && info.glyph) return info.glyph;
|
|
337
|
+
if (style === "both" && info.glyph) return `${info.glyph} ${info.label}`;
|
|
338
|
+
return info.label;
|
|
339
|
+
}
|
|
340
|
+
function modifierName(name, { platform } = {}) {
|
|
341
|
+
const plat = resolvePlatform(platform);
|
|
342
|
+
let mod = normalizeKey(name);
|
|
343
|
+
if (mod === "mod") mod = plat === "mac" ? "meta" : "ctrl";
|
|
344
|
+
return modifierInfo(mod, plat)?.name ?? String(name);
|
|
345
|
+
}
|
|
346
|
+
function keyLabel(key, { platform, style = "text" } = {}) {
|
|
347
|
+
const plat = resolvePlatform(platform);
|
|
348
|
+
const info = keyInfo(toKeyRef(key), plat);
|
|
349
|
+
return style === "glyphs" && info.glyph ? info.glyph : info.label;
|
|
350
|
+
}
|
|
351
|
+
function toKeyRef(key) {
|
|
352
|
+
const s = String(key ?? "");
|
|
353
|
+
const code = /^code:(.+)$/.exec(s)?.[1] ?? (/^[A-Z][A-Za-z0-9]+$/.test(s) && (KEY_LABELS[s] || /^(Key[A-Z]|Digit\d|Numpad\d|F\d{1,2})$/.test(s)) ? s : null);
|
|
354
|
+
return code ? { code } : { key: normalizeKey(s) };
|
|
355
|
+
}
|
|
356
|
+
function comboTokens(combo, { platform, style = "glyphs", order = "platform" } = {}) {
|
|
357
|
+
if (combo == null || combo === "") return [];
|
|
358
|
+
const plat = resolvePlatform(platform);
|
|
359
|
+
const parts = partsOf(combo, plat, order);
|
|
360
|
+
if (!parts) return [];
|
|
361
|
+
const glyphs = style === "glyphs" && plat === "mac";
|
|
362
|
+
const tokens = parts.mods.map((m) => {
|
|
363
|
+
const info = modifierInfo(m, plat);
|
|
364
|
+
return { label: glyphs ? info.glyph : info.label, name: info.name, modifier: m };
|
|
365
|
+
});
|
|
366
|
+
if (parts.key) {
|
|
367
|
+
const info = keyInfo(parts.key, plat);
|
|
368
|
+
tokens.push({ label: glyphs && info.glyph ? info.glyph : info.label, name: info.name, key: parts.key.code ?? parts.key.key });
|
|
369
|
+
}
|
|
370
|
+
return tokens;
|
|
371
|
+
}
|
|
372
|
+
function formatCombo(combo, { platform, style = "text", order = "platform", separator } = {}) {
|
|
373
|
+
const plat = resolvePlatform(platform);
|
|
374
|
+
const tokens = comboTokens(combo, { platform: plat, style, order });
|
|
375
|
+
const sep = separator ?? (style === "glyphs" && plat === "mac" ? "" : "+");
|
|
376
|
+
return tokens.map((t) => t.label).join(sep);
|
|
377
|
+
}
|
|
378
|
+
function listModifiers(names, { platform, conjunction = "or" } = {}) {
|
|
379
|
+
const labels = names.map((n) => modifierLabel(n, { platform }));
|
|
380
|
+
if (labels.length <= 1) return labels.join("");
|
|
381
|
+
return `${labels.slice(0, -1).join(", ")} ${conjunction} ${labels[labels.length - 1]}`;
|
|
382
|
+
}
|
|
383
|
+
export {
|
|
384
|
+
KEY_LABELS,
|
|
385
|
+
browserLabel,
|
|
386
|
+
comboTokens,
|
|
387
|
+
formatCombo,
|
|
388
|
+
keyLabel,
|
|
389
|
+
listModifiers,
|
|
390
|
+
modifierLabel,
|
|
391
|
+
modifierName,
|
|
392
|
+
platformLabel
|
|
393
|
+
};
|
|
394
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../platform.js", "../parse.js", "../format.js"],
|
|
4
|
+
"sourcesContent": ["// platform.js\r\n// The one platform/browser detector for hotkey-router. The core router (for\r\n// `mod`), reservations, sites, validate and format all use it, so they never\r\n// disagree about what machine they are on.\r\n//\r\n// Sources, most to least reliable: a ChromeOS user agent (Chromebooks report\r\n// navigator.platform as Linux), navigator.userAgentData.platform (Chromium),\r\n// navigator.platform, then the user agent string.\r\n\r\n/** @typedef {'mac' | 'windows' | 'linux' | 'chromeos'} Platform */\r\n/** @typedef {'chrome' | 'firefox' | 'safari' | 'edge'} Browser */\r\n\r\nfunction fromPlatformString(s) {\r\n if (!s) return null\r\n if (/Chrome ?OS|CrOS/i.test(s)) return 'chromeos'\r\n if (/Mac|iPhone|iPad|iPod/i.test(s)) return 'mac'\r\n if (/Win/i.test(s)) return 'windows'\r\n if (/Linux|X11/i.test(s)) return 'linux'\r\n return null\r\n}\r\n\r\n/**\r\n * The platform a navigator reports: 'mac', 'windows' or 'linux' (ChromeOS\r\n * counts as 'linux' unless `{ chromeos: true }`). Null when it can't tell,\r\n * or outside a browser.\r\n *\r\n * @param {Navigator | null} [nav]\r\n * @param {{ chromeos?: boolean }} [opts]\r\n * @returns {Platform | null}\r\n */\r\nexport function detectPlatform(nav = (typeof navigator !== 'undefined' ? navigator : null), { chromeos = false } = {}) {\r\n if (!nav) return null\r\n const ua = nav.userAgent || ''\r\n const found =\r\n (/\\bCrOS\\b/.test(ua) ? 'chromeos' : null) ||\r\n fromPlatformString(nav.userAgentData?.platform) ||\r\n fromPlatformString(nav.platform) ||\r\n (/Mac OS X/i.test(ua) ? 'mac' : /Windows/i.test(ua) ? 'windows' : /Linux|X11/i.test(ua) ? 'linux' : null)\r\n if (found === 'chromeos' && !chromeos) return 'linux'\r\n return found\r\n}\r\n\r\n/**\r\n * @param {Navigator | null} [nav]\r\n * @returns {Browser | null}\r\n */\r\nexport function detectBrowser(nav = (typeof navigator !== 'undefined' ? navigator : null)) {\r\n if (!nav) return null\r\n const ua = nav.userAgent || ''\r\n // Order matters: Edge UA contains 'Chrome', Chrome UA contains 'Safari'.\r\n if (/Edg\\//.test(ua)) return 'edge'\r\n if (/Firefox/.test(ua)) return 'firefox'\r\n if (/Chrome/.test(ua)) return 'chrome'\r\n if (/Safari/.test(ua)) return 'safari'\r\n return null\r\n}\r\n\r\nconst PLATFORM_LABELS = { mac: 'macOS', windows: 'Windows', linux: 'Linux', chromeos: 'ChromeOS' }\r\nconst BROWSER_LABELS = { chrome: 'Chrome', firefox: 'Firefox', edge: 'Edge', safari: 'Safari' }\r\n\r\n/** 'mac' -> 'macOS'. Unknown names come back as given. @param {string} platform @returns {string} */\r\nexport function platformLabel(platform) {\r\n return PLATFORM_LABELS[platform] || platform\r\n}\r\n\r\n/** 'chrome' -> 'Chrome'. Unknown names come back as given. @param {string} browser @returns {string} */\r\nexport function browserLabel(browser) {\r\n return BROWSER_LABELS[browser] || browser\r\n}\r\n", "// parse.js\r\n// The one hotkey-string parser. The core router binds with it; sites,\r\n// validate and format read combos with it, so `opt`, `ctrl++`, `^k` and\r\n// `mod` mean the same thing everywhere. No state, no side effects.\r\n\r\nimport { detectPlatform } from './platform.js'\r\n\r\n// `mod` is the platform's primary modifier: meta on macOS, ctrl elsewhere.\r\nconst DEFAULT_PLATFORM = detectPlatform()\r\n\r\nconst modifierTokens = new Set(['ctrl', 'shift', 'alt', 'meta', 'mod'])\r\n\r\nconst ahkPrefixMap = new Map([\r\n ['^', 'ctrl'], // Ctrl\r\n ['!', 'alt'], // Alt\r\n ['+', 'shift'], // Shift\r\n ['#', 'meta'], // Win / Command\r\n])\r\n\r\nexport const keyAliases = Object.freeze({\r\n // common\r\n esc: 'escape',\r\n escape: 'escape',\r\n space: ' ',\r\n spacebar: ' ',\r\n enter: 'enter',\r\n return: 'enter',\r\n del: 'delete',\r\n delete: 'delete',\r\n backspace: 'backspace',\r\n tab: 'tab',\r\n\r\n // arrows\r\n up: 'arrowup',\r\n down: 'arrowdown',\r\n left: 'arrowleft',\r\n right: 'arrowright',\r\n\r\n // navigation\r\n home: 'home',\r\n end: 'end',\r\n pageup: 'pageup',\r\n pagedown: 'pagedown',\r\n pgup: 'pageup',\r\n pgdn: 'pagedown',\r\n\r\n // modifiers (words)\r\n cmd: 'meta',\r\n command: 'meta',\r\n win: 'meta',\r\n meta: 'meta',\r\n control: 'ctrl',\r\n ctrl: 'ctrl',\r\n option: 'alt',\r\n opt: 'alt',\r\n alt: 'alt',\r\n shift: 'shift',\r\n\r\n // modifiers (symbols)\r\n '\u2318': 'meta',\r\n '\u2303': 'ctrl',\r\n '\u2325': 'alt',\r\n '\u21E7': 'shift',\r\n\r\n // cross-platform \"mod\", resolved per platform while parsing\r\n mod: 'mod',\r\n\r\n // plus key ergonomics\r\n plus: '+',\r\n})\r\n\r\nexport function normalizeKey(key) {\r\n const original = String(key ?? '')\r\n // A lone space IS the spacebar key \u2014 `.trim()` would erase it to '', so guard\r\n // on the ORIGINAL before trimming. (The `space`/`spacebar` aliases resolve to\r\n // ' ' and land here; without this, `space` bindings collapse to no base key.)\r\n if (original === ' ') return ' '\r\n const trimmed = original.trim()\r\n const k = trimmed.toLowerCase()\r\n return keyAliases[k] ?? k\r\n}\r\n\r\nfunction isModifierToken(token) {\r\n return modifierTokens.has(normalizeKey(token))\r\n}\r\n\r\n// Matches `code:KeyX` (case-sensitive value). Used to extract code tokens BEFORE\r\n// the rest of the parser lowercases everything, since KeyboardEvent.code values\r\n// are camelCase (KeyA, Digit1, ArrowLeft) and must be preserved.\r\nconst CODE_TOKEN_RE = /(^|\\+)code:([A-Za-z][A-Za-z0-9_]*)/\r\n\r\n/**\r\n * Lenient parse: never throws. `error` holds the message `parseHotkey` would\r\n * throw; the combo is filled in as far as the string allows.\r\n *\r\n * @param {string} hotkeyStr\r\n * @param {{ platform?: string | null }} [opts]\r\n */\r\nexport function readHotkey(hotkeyStr, { platform = DEFAULT_PLATFORM } = {}) {\r\n const raw = String(hotkeyStr || '').trim()\r\n let error = null\r\n const fail = (msg) => { error = error || `Invalid hotkey \"${hotkeyStr}\": ${msg}` }\r\n\r\n // Detect ' up' suffix case-insensitively so 'Alt UP' works the same as 'alt up'.\r\n const isUp = /\\s+up$/i.test(raw)\r\n const baseRaw = isUp ? raw.replace(/\\s+up$/i, '').trim() : raw\r\n\r\n const combo = {\r\n ctrl: false, shift: false, alt: false, meta: false,\r\n key: null, code: null, bareModifier: null,\r\n }\r\n const setMod = (mod) => {\r\n if (mod === 'mod') combo[platform === 'mac' ? 'meta' : 'ctrl'] = true\r\n else combo[mod] = true\r\n }\r\n\r\n // --- AHK-style prefix modifiers ---\r\n // Examples:\r\n // ^k => ctrl+k\r\n // !k => alt+k\r\n // +k => shift+k\r\n // #k => meta+k\r\n // ^!k => ctrl+alt+k\r\n // !code:KeyX => alt+code:KeyX\r\n //\r\n // We strip these BEFORE both the code-token extraction AND the lowercase\r\n // pass, because the AHK prefix chars (^ ! + #) are case-stable, and the\r\n // remainder may contain a case-sensitive `code:KeyX` token that must survive.\r\n let stripped = baseRaw\r\n while (stripped.length) {\r\n const mod = ahkPrefixMap.get(stripped[0]) ?? null\r\n if (!mod) break\r\n setMod(mod)\r\n stripped = stripped.slice(1).trimStart()\r\n }\r\n\r\n // Pull out a code:XXX token before lowercasing; preserve the camelCase value.\r\n // Reject multiple code: tokens to avoid silent loss of intent.\r\n const codeMatches = stripped.match(/code:[A-Za-z][A-Za-z0-9_]*/g)\r\n if (codeMatches && codeMatches.length > 1) {\r\n fail(`multiple code: tokens not supported (got ${codeMatches.length}).`)\r\n }\r\n let codeValue = null\r\n const scrubbed = stripped.replace(CODE_TOKEN_RE, (_, sep, val) => {\r\n codeValue = val\r\n return sep + '__code__'\r\n })\r\n\r\n const cleanStr = scrubbed.toLowerCase()\r\n\r\n // Allow plus key:\r\n // - \"ctrl++\" => ctrl + \"+\"\r\n // - \"++\" => shift + \"+\" (AHK '+' prefix sets shift, remaining '+' becomes the base key)\r\n // `split('+')` produces empties; we keep that signal.\r\n const rawParts = cleanStr.split('+').map((p) => p.trim())\r\n const parts = rawParts.filter(Boolean)\r\n const impliedPlusKey = rawParts.some((p) => p === '') && cleanStr.includes('++')\r\n\r\n // Enforce: modifiers must come before the base key.\r\n // Example: \"ctrl+k\" \u2705 | \"k+ctrl\" \u274C\r\n // We ignore the special \"+ key\" case (ctrl++) since it has no explicit base token.\r\n if (!impliedPlusKey) {\r\n let seenBase = false\r\n for (const part of parts) {\r\n if (isModifierToken(part)) {\r\n if (seenBase) fail('modifiers must come before the base key (e.g. \"ctrl+k\", not \"k+ctrl\")')\r\n } else {\r\n seenBase = true\r\n }\r\n }\r\n }\r\n\r\n // Continue parsing the remaining tokens (words/symbols/aliases)\r\n for (const part of parts) {\r\n if (part === '__code__') {\r\n combo.code = codeValue\r\n continue\r\n }\r\n const actual = keyAliases[part] ?? part\r\n if (modifierTokens.has(actual)) setMod(actual)\r\n else combo.key = normalizeKey(actual)\r\n }\r\n\r\n if (!combo.key && !combo.code && impliedPlusKey) combo.key = '+'\r\n\r\n // If no base key/code is set, this might be a bare-modifier binding ('alt' / 'ctrl').\r\n // Allow exactly ONE modifier with no other tokens. Multi-modifier bare bindings\r\n // (e.g. 'ctrl+alt') are intentionally rejected \u2014 add a base key for those.\r\n if (!combo.key && !combo.code) {\r\n const modCount =\r\n (combo.ctrl ? 1 : 0) + (combo.shift ? 1 : 0) +\r\n (combo.alt ? 1 : 0) + (combo.meta ? 1 : 0)\r\n\r\n if (modCount === 1) {\r\n combo.bareModifier =\r\n combo.ctrl ? 'ctrl' :\r\n combo.shift ? 'shift' :\r\n combo.alt ? 'alt' : 'meta'\r\n } else if (modCount > 1) {\r\n fail('multi-modifier bare bindings not supported. Add a base key (e.g. \"ctrl+alt+x\").')\r\n } else {\r\n error = error || `Invalid hotkey \"${hotkeyStr}\" (missing base key)`\r\n }\r\n }\r\n\r\n return { combo, type: isUp ? 'keyup' : 'keydown', raw: hotkeyStr, error }\r\n}\r\n\r\n/**\r\n * Parse a hotkey string into modifier flags plus a `key` (normalized\r\n * `KeyboardEvent.key`), a `code` (`KeyboardEvent.code`) or a bare modifier.\r\n * `mod` resolves for `opts.platform` (default: this machine). Throws on\r\n * strings the router can't bind.\r\n *\r\n * @param {string} hotkeyStr\r\n * @param {{ platform?: 'mac' | 'windows' | 'linux' | 'chromeos' | null }} [opts]\r\n * @returns {{\r\n * combo: { ctrl: boolean, shift: boolean, alt: boolean, meta: boolean, key: string | null, code: string | null, bareModifier: 'ctrl' | 'shift' | 'alt' | 'meta' | null },\r\n * type: 'keydown' | 'keyup',\r\n * raw: string\r\n * }}\r\n */\r\nexport function parseHotkey(hotkeyStr, opts) {\r\n const { combo, type, raw, error } = readHotkey(hotkeyStr, opts)\r\n if (error) throw new Error(error)\r\n return { combo, type, raw }\r\n}\r\n\r\n// --- shifted punctuation -----------------------------------------------------\r\n\r\n// Punctuation whose Shift character differs on a US layout. With Shift held,\r\n// `event.key` is the shifted character, so a key-based `ctrl+shift+,` waits\r\n// for a ',' that never arrives (the event says '<').\r\nconst SHIFTED_PUNCT = {\r\n ',': ['<', 'Comma'], '.': ['>', 'Period'], '/': ['?', 'Slash'],\r\n ';': [':', 'Semicolon'], \"'\": ['\"', 'Quote'], '[': ['{', 'BracketLeft'],\r\n ']': ['}', 'BracketRight'], '\\\\': ['|', 'Backslash'], '-': ['_', 'Minus'],\r\n '=': ['+', 'Equal'], '`': ['~', 'Backquote'],\r\n}\r\n\r\n/**\r\n * For a key-based combo with Shift and one of `, . / ; ' [ ] \\ - = \\``, the\r\n * message explaining it never fires on US layouts and the `code:` spelling\r\n * to bind instead (written the way the input was). Null for anything else,\r\n * including strings that do not parse.\r\n *\r\n * @param {string} hotkeyStr\r\n * @returns {{ message: string, suggestion: string } | null}\r\n */\r\nexport function shiftedPunctuationHint(hotkeyStr) {\r\n const { combo, type, error } = readHotkey(hotkeyStr)\r\n if (error || !combo.shift || combo.code) return null\r\n const shifted = SHIFTED_PUNCT[combo.key]\r\n if (!shifted) return null\r\n const [typed, code] = shifted\r\n\r\n // The base key is the last character before any ' up'; swap just that.\r\n const base = String(hotkeyStr).trim().replace(/\\s+up$/i, '')\r\n const suggestion = base.slice(0, -1) + 'code:' + code + (type === 'keyup' ? ' up' : '')\r\n return {\r\n message: `\"${hotkeyStr}\" never fires on US layouts: Shift turns \"${combo.key}\" into \"${typed}\". Bind \"${suggestion}\" instead.`,\r\n suggestion,\r\n }\r\n}\r\n\r\n// --- canonical lookup names (reservation + site tables) ----------------------\r\n\r\n// Punctuation typed as `event.key` maps to the names the data tables use for\r\n// `code:` values, so `meta+shift+/` and `meta+shift+code:Slash` find the same\r\n// row. `+` is Shift+= on most layouts, and browsers treat Ctrl++ as Ctrl+=\r\n// (zoom in), so it looks up as `equal`.\r\nconst PUNCT_NAMES = {\r\n '.': 'period', ',': 'comma', ';': 'semicolon', \"'\": 'quote', '/': 'slash',\r\n '\\\\': 'backslash', '[': 'bracketleft', ']': 'bracketright', '-': 'minus',\r\n '=': 'equal', '`': 'backquote', ' ': 'space', '+': 'equal',\r\n}\r\n\r\n/** `KeyA` -> `a`, `Digit1`/`Numpad1` -> `1`, `ArrowLeft` -> `arrowleft`. */\r\nexport function codeToBase(code) {\r\n if (!code) return null\r\n const letter = /^Key([A-Za-z])$/.exec(code)\r\n if (letter) return letter[1].toLowerCase()\r\n const digit = /^(?:Digit|Numpad)(\\d)$/.exec(code)\r\n if (digit) return digit[1]\r\n return code.toLowerCase()\r\n}\r\n\r\n/** `'.'` -> `period`, `'Esc'` -> `escape`, `'K'` -> `k`. */\r\nexport function keyToBase(key) {\r\n if (key == null || key === '') return null\r\n if (PUNCT_NAMES[key]) return PUNCT_NAMES[key]\r\n const k = normalizeKey(key)\r\n return PUNCT_NAMES[k] || k || null\r\n}\r\n\r\n/**\r\n * The canonical lookup key for a parsed combo: modifiers in the order ctrl,\r\n * meta, alt, shift, then the base name (`ctrl+shift+period`). Null for a bare\r\n * modifier or no key.\r\n *\r\n * @param {{ ctrl?: boolean, meta?: boolean, alt?: boolean, shift?: boolean, key?: string | null, code?: string | null, bareModifier?: string | null } | null} combo\r\n * @returns {string | null}\r\n */\r\nexport function lookupKey(combo) {\r\n if (!combo || combo.bareModifier) return null\r\n const base = combo.code ? codeToBase(combo.code) : keyToBase(combo.key)\r\n if (!base) return null\r\n const parts = []\r\n if (combo.ctrl) parts.push('ctrl')\r\n if (combo.meta) parts.push('meta')\r\n if (combo.alt) parts.push('alt')\r\n if (combo.shift) parts.push('shift')\r\n parts.push(base)\r\n return parts.join('+')\r\n}\r\n", "// format.js\r\n// Show a hotkey to people: `mod+shift+code:Period` -> \"Ctrl+Shift+.\" on\r\n// Windows and Linux, \"\u21E7\u2318.\" (glyphs) or \"Shift+Cmd+.\" (text) on macOS, plus\r\n// keycap tokens with names a screen reader can say.\r\n//\r\n// import { formatCombo, comboTokens, modifierLabel } from 'hotkey-router/format'\r\n//\r\n// formatCombo('mod+shift+code:Period') // 'Ctrl+Shift+.'\r\n// formatCombo('mod+shift+code:Period', { platform: 'mac', style: 'glyphs' }) // '\u21E7\u2318.'\r\n// comboTokens('mod+code:KeyK', { platform: 'mac' })\r\n// // [{ label: '\u2318', name: 'Command', modifier: 'meta' }, { label: 'K', name: 'K', key: 'KeyK' }]\r\n// modifierLabel('alt', { platform: 'mac', style: 'both' }) // '\u2325 Option'\r\n//\r\n// Modifier order. By default modifiers come in the platform's own order,\r\n// whatever order the string was written in: on macOS Apple's \u2303\u2325\u21E7\u2318\r\n// (Control, Option, Shift, Command), the order every Mac menu shows; on\r\n// Windows, Linux and ChromeOS Win/Super/Search, Ctrl, Alt, Shift. Pass\r\n// `{ order: 'combo' }` to keep the order the string was written in.\r\n//\r\n// Styles. 'text' (default for formatCombo): words joined by '+'. 'glyphs'\r\n// (default for comboTokens): macOS modifier and key symbols (\u2318 \u21E7 \u2325 \u2303 \u21A9 \u232B \u2190),\r\n// joined with no separator; Windows, Linux and ChromeOS have no such\r\n// symbols, so 'glyphs' there gives the same words as 'text'. 'both'\r\n// (modifierLabel only): glyph and word, '\u2325 Option'.\r\n//\r\n// Imports only the shared parser and detector, never the core router.\r\n\r\nimport { readHotkey, normalizeKey } from './parse.js'\r\nimport { detectPlatform, platformLabel, browserLabel } from './platform.js'\r\n\r\nexport { platformLabel, browserLabel }\r\n\r\n/** @typedef {'mac' | 'windows' | 'linux' | 'chromeos'} FormatPlatform */\r\n/** @typedef {'text' | 'glyphs'} FormatStyle */\r\n/** @typedef {'ctrl' | 'alt' | 'shift' | 'meta'} Modifier */\r\n\r\n// label: on-screen word; glyph: macOS symbol; name: what a screen reader says.\r\nconst MAC_MODIFIERS = {\r\n ctrl: { label: 'Control', glyph: '\u2303', name: 'Control' },\r\n alt: { label: 'Option', glyph: '\u2325', name: 'Option' },\r\n shift: { label: 'Shift', glyph: '\u21E7', name: 'Shift' },\r\n meta: { label: 'Cmd', glyph: '\u2318', name: 'Command' },\r\n}\r\nconst PC_MODIFIERS = {\r\n ctrl: { label: 'Ctrl', name: 'Control' },\r\n alt: { label: 'Alt', name: 'Alt' },\r\n shift: { label: 'Shift', name: 'Shift' },\r\n meta: { label: 'Win', name: 'Windows' },\r\n}\r\nconst META_BY_PLATFORM = {\r\n linux: { label: 'Super', name: 'Super' },\r\n chromeos: { label: 'Search', name: 'Search' },\r\n}\r\n\r\nconst ORDER = {\r\n mac: ['ctrl', 'alt', 'shift', 'meta'],\r\n pc: ['meta', 'ctrl', 'alt', 'shift'],\r\n}\r\n\r\n/**\r\n * Display names for `KeyboardEvent.code` values (the `code:` part of a\r\n * hotkey). `label` is the on-screen text, `name` what a screen reader says;\r\n * `mac`/`macName` replace them on macOS, `glyph` is the macOS symbol.\r\n * Letters (`KeyA`), digits (`Digit1`, `Numpad1`) and `F1`-`F24` are derived,\r\n * not listed.\r\n *\r\n * @type {Readonly<Record<string, Readonly<{ label: string, name: string, mac?: string, macName?: string, glyph?: string }>>>}\r\n */\r\nexport const KEY_LABELS = Object.freeze({\r\n Period: { label: '.', name: 'Period' },\r\n Comma: { label: ',', name: 'Comma' },\r\n Semicolon: { label: ';', name: 'Semicolon' },\r\n Quote: { label: \"'\", name: 'Quote' },\r\n Slash: { label: '/', name: 'Slash' },\r\n Backslash: { label: '\\\\', name: 'Backslash' },\r\n IntlBackslash: { label: '\\\\', name: 'Backslash' },\r\n BracketLeft: { label: '[', name: 'Left Bracket' },\r\n BracketRight: { label: ']', name: 'Right Bracket' },\r\n Minus: { label: '-', name: 'Minus' },\r\n Equal: { label: '=', name: 'Equals' },\r\n Backquote: { label: '`', name: 'Backquote' },\r\n Space: { label: 'Space', name: 'Space' },\r\n Enter: { label: 'Enter', name: 'Enter', mac: 'Return', glyph: '\u21A9' },\r\n NumpadEnter: { label: 'Enter', name: 'Enter', mac: 'Enter', glyph: '\u2324' },\r\n Tab: { label: 'Tab', name: 'Tab', glyph: '\u21E5' },\r\n Backspace: { label: 'Backspace', name: 'Backspace', mac: 'Delete', glyph: '\u232B' },\r\n Delete: { label: 'Delete', name: 'Delete', mac: 'Forward Delete', glyph: '\u2326' },\r\n Escape: { label: 'Esc', name: 'Escape', glyph: '\u238B' },\r\n Insert: { label: 'Insert', name: 'Insert' },\r\n Home: { label: 'Home', name: 'Home', glyph: '\u2196' },\r\n End: { label: 'End', name: 'End', glyph: '\u2198' },\r\n PageUp: { label: 'Page Up', name: 'Page Up', glyph: '\u21DE' },\r\n PageDown: { label: 'Page Down', name: 'Page Down', glyph: '\u21DF' },\r\n ArrowUp: { label: 'Up', name: 'Up Arrow', glyph: '\u2191' },\r\n ArrowDown: { label: 'Down', name: 'Down Arrow', glyph: '\u2193' },\r\n ArrowLeft: { label: 'Left', name: 'Left Arrow', glyph: '\u2190' },\r\n ArrowRight: { label: 'Right', name: 'Right Arrow', glyph: '\u2192' },\r\n CapsLock: { label: 'Caps Lock', name: 'Caps Lock', glyph: '\u21EA' },\r\n ContextMenu: { label: 'Menu', name: 'Menu' },\r\n NumpadAdd: { label: 'Num +', name: 'Numpad Plus' },\r\n NumpadSubtract: { label: 'Num -', name: 'Numpad Minus' },\r\n NumpadMultiply: { label: 'Num *', name: 'Numpad Multiply' },\r\n NumpadDivide: { label: 'Num /', name: 'Numpad Divide' },\r\n NumpadDecimal: { label: 'Num .', name: 'Numpad Decimal' },\r\n})\r\n\r\n// `event.key` values (as the parser normalizes them) that name a code above.\r\nconst KEY_TO_CODE = {\r\n '.': 'Period', ',': 'Comma', ';': 'Semicolon', \"'\": 'Quote', '/': 'Slash',\r\n '\\\\': 'Backslash', '[': 'BracketLeft', ']': 'BracketRight', '-': 'Minus',\r\n '=': 'Equal', '`': 'Backquote', ' ': 'Space', enter: 'Enter', tab: 'Tab',\r\n backspace: 'Backspace', delete: 'Delete', escape: 'Escape', insert: 'Insert',\r\n home: 'Home', end: 'End', pageup: 'PageUp', pagedown: 'PageDown',\r\n arrowup: 'ArrowUp', arrowdown: 'ArrowDown', arrowleft: 'ArrowLeft',\r\n arrowright: 'ArrowRight', capslock: 'CapsLock', contextmenu: 'ContextMenu',\r\n}\r\n\r\nconst KEY_NAMES = { '+': 'Plus', '*': 'Asterisk', '?': 'Question Mark', '!': 'Exclamation Mark' }\r\n\r\nfunction resolvePlatform(platform) {\r\n return platform || detectPlatform(undefined, { chromeos: true }) || 'windows'\r\n}\r\n\r\nfunction modifierInfo(mod, platform) {\r\n if (platform === 'mac') return MAC_MODIFIERS[mod]\r\n if (mod === 'meta' && META_BY_PLATFORM[platform]) return META_BY_PLATFORM[platform]\r\n return PC_MODIFIERS[mod]\r\n}\r\n\r\n// A key or code as { label, name, glyph? } for the platform.\r\nfunction keyInfo({ key, code }, platform) {\r\n const mac = platform === 'mac'\r\n let c = code\r\n if (!c && key != null) {\r\n c = KEY_TO_CODE[key]\r\n if (!c && /^[a-z]$/.test(key)) c = 'Key' + key.toUpperCase()\r\n if (!c && /^\\d$/.test(key)) c = 'Digit' + key\r\n if (!c && /^f\\d{1,2}$/.test(key)) c = key.toUpperCase()\r\n }\r\n if (c) {\r\n const known = KEY_LABELS[c]\r\n if (known) {\r\n const label = mac && known.mac ? known.mac : known.label\r\n return { label, name: mac && known.mac ? known.mac : known.name, glyph: mac ? known.glyph : undefined }\r\n }\r\n const letter = /^Key([A-Z])$/.exec(c)\r\n if (letter) return { label: letter[1], name: letter[1] }\r\n const digit = /^Digit(\\d)$/.exec(c)\r\n if (digit) return { label: digit[1], name: digit[1] }\r\n const numpad = /^Numpad(\\d)$/.exec(c)\r\n if (numpad) return { label: `Num ${numpad[1]}`, name: `Numpad ${numpad[1]}` }\r\n if (/^F\\d{1,2}$/.test(c)) return { label: c, name: c }\r\n if (code) return { label: code, name: code }\r\n }\r\n // Any other `event.key` value: a character as typed, a word capitalized.\r\n const k = String(key ?? '')\r\n if (k.length === 1) return { label: k.toUpperCase(), name: KEY_NAMES[k] || k.toUpperCase() }\r\n const word = k.charAt(0).toUpperCase() + k.slice(1)\r\n return { label: word, name: word }\r\n}\r\n\r\n// Parse a string (or take a parsed combo) into ordered parts.\r\nfunction partsOf(combo, platform, order) {\r\n let c = combo\r\n let written = null\r\n if (typeof combo === 'string') {\r\n c = readHotkey(combo, { platform }).combo\r\n if (order === 'combo') written = writtenModifiers(combo, platform)\r\n }\r\n if (!c) return null\r\n const mods = /** @type {Modifier[]} */ (['ctrl', 'alt', 'shift', 'meta'].filter((m) => c[m] || c.bareModifier === m))\r\n const sequence = written\r\n ? [...written.filter((m) => mods.includes(m)), ...mods.filter((m) => !written.includes(m))]\r\n : (platform === 'mac' ? ORDER.mac : ORDER.pc).filter((m) => mods.includes(m))\r\n const hasKey = !c.bareModifier && (c.key != null || c.code != null)\r\n return { mods: sequence, key: hasKey ? { key: c.key ?? null, code: c.code ?? null } : null }\r\n}\r\n\r\n// Modifiers in the order the string names them (`shift+mod+k` -> shift, meta).\r\nfunction writtenModifiers(str, platform) {\r\n const out = []\r\n const raw = String(str).replace(/\\s+up$/i, '')\r\n // AHK prefixes first, then '+'-separated tokens.\r\n let i = 0\r\n const ahk = { '^': 'ctrl', '!': 'alt', '+': 'shift', '#': 'meta' }\r\n while (i < raw.length && ahk[raw[i]] && raw[i + 1] !== undefined) {\r\n out.push(ahk[raw[i]])\r\n i++\r\n }\r\n for (const token of raw.slice(i).split('+')) {\r\n const t = normalizeKey(token)\r\n const m = t === 'mod' ? (platform === 'mac' ? 'meta' : 'ctrl') : t\r\n if (['ctrl', 'alt', 'shift', 'meta'].includes(m) && !out.includes(m)) out.push(m)\r\n }\r\n return out\r\n}\r\n\r\n/**\r\n * A modifier as this platform names it. Accepts `ctrl`, `alt`, `shift`,\r\n * `meta`, `mod` (Cmd on macOS, Ctrl elsewhere) and their aliases (`cmd`,\r\n * `option`, `opt`, `win`, `control`, `\u2318`).\r\n *\r\n * @param {string} name\r\n * @param {{ platform?: FormatPlatform, style?: 'text' | 'glyphs' | 'both' }} [opts]\r\n * @returns {string}\r\n */\r\nexport function modifierLabel(name, { platform, style = 'text' } = {}) {\r\n const plat = resolvePlatform(platform)\r\n let mod = normalizeKey(name)\r\n if (mod === 'mod') mod = plat === 'mac' ? 'meta' : 'ctrl'\r\n const info = modifierInfo(mod, plat)\r\n if (!info) return String(name)\r\n if (style === 'glyphs' && info.glyph) return info.glyph\r\n if (style === 'both' && info.glyph) return `${info.glyph} ${info.label}`\r\n return info.label\r\n}\r\n\r\n/**\r\n * What a screen reader should say for a modifier: 'Command', 'Option',\r\n * 'Control', 'Shift', 'Alt', 'Windows', 'Super', 'Search'.\r\n *\r\n * @param {string} name\r\n * @param {{ platform?: FormatPlatform }} [opts]\r\n * @returns {string}\r\n */\r\nexport function modifierName(name, { platform } = {}) {\r\n const plat = resolvePlatform(platform)\r\n let mod = normalizeKey(name)\r\n if (mod === 'mod') mod = plat === 'mac' ? 'meta' : 'ctrl'\r\n return modifierInfo(mod, plat)?.name ?? String(name)\r\n}\r\n\r\n/**\r\n * The label for one key: a `code:` value (`code:Period`, `KeyK`) or an\r\n * `event.key` value (`.`, `k`, `Enter`, `ArrowUp`).\r\n *\r\n * @param {string} key\r\n * @param {{ platform?: FormatPlatform, style?: FormatStyle }} [opts]\r\n * @returns {string}\r\n */\r\nexport function keyLabel(key, { platform, style = 'text' } = {}) {\r\n const plat = resolvePlatform(platform)\r\n const info = keyInfo(toKeyRef(key), plat)\r\n return style === 'glyphs' && info.glyph ? info.glyph : info.label\r\n}\r\n\r\nfunction toKeyRef(key) {\r\n const s = String(key ?? '')\r\n const code = /^code:(.+)$/.exec(s)?.[1] ?? (/^[A-Z][A-Za-z0-9]+$/.test(s) && (KEY_LABELS[s] || /^(Key[A-Z]|Digit\\d|Numpad\\d|F\\d{1,2})$/.test(s)) ? s : null)\r\n return code ? { code } : { key: normalizeKey(s) }\r\n}\r\n\r\n/**\r\n * @typedef {{\r\n * label: string,\r\n * name: string,\r\n * modifier?: Modifier,\r\n * key?: string\r\n * }} ComboToken\r\n *\r\n * `label` is what the keycap shows; `name` what a screen reader should say\r\n * (put it in visually hidden text or `aria-label` when `label` is a glyph).\r\n * `modifier` is set on modifier tokens; `key` on the base key token (the\r\n * `code` value, or the `event.key` value for key-based combos).\r\n */\r\n\r\n/**\r\n * One keycap per key, modifiers first. Default style 'glyphs': \u2318 \u21E7 \u2325 \u2303 on\r\n * macOS, words elsewhere.\r\n *\r\n * @param {string | object | null} combo hotkey string or parsed combo\r\n * @param {{ platform?: FormatPlatform, style?: FormatStyle, order?: 'platform' | 'combo' }} [opts]\r\n * @returns {ComboToken[]}\r\n */\r\nexport function comboTokens(combo, { platform, style = 'glyphs', order = 'platform' } = {}) {\r\n if (combo == null || combo === '') return []\r\n const plat = resolvePlatform(platform)\r\n const parts = partsOf(combo, plat, order)\r\n if (!parts) return []\r\n const glyphs = style === 'glyphs' && plat === 'mac'\r\n const tokens = parts.mods.map((m) => {\r\n const info = modifierInfo(m, plat)\r\n return { label: glyphs ? info.glyph : info.label, name: info.name, modifier: m }\r\n })\r\n if (parts.key) {\r\n const info = keyInfo(parts.key, plat)\r\n tokens.push({ label: glyphs && info.glyph ? info.glyph : info.label, name: info.name, key: parts.key.code ?? parts.key.key })\r\n }\r\n return tokens\r\n}\r\n\r\n/**\r\n * A hotkey as one string: 'Ctrl+Shift+.' (text) or '\u21E7\u2318.' (glyphs, macOS).\r\n * Empty string for an empty combo.\r\n *\r\n * @param {string | object | null} combo hotkey string or parsed combo\r\n * @param {{\r\n * platform?: FormatPlatform,\r\n * style?: FormatStyle,\r\n * order?: 'platform' | 'combo',\r\n * separator?: string // default '+' ('' for macOS glyphs)\r\n * }} [opts]\r\n * @returns {string}\r\n */\r\nexport function formatCombo(combo, { platform, style = 'text', order = 'platform', separator } = {}) {\r\n const plat = resolvePlatform(platform)\r\n const tokens = comboTokens(combo, { platform: plat, style, order })\r\n const sep = separator ?? (style === 'glyphs' && plat === 'mac' ? '' : '+')\r\n return tokens.map((t) => t.label).join(sep)\r\n}\r\n\r\n/**\r\n * The words for a list of modifiers, for sentences: ['ctrl', 'alt', 'shift']\r\n * -> 'Ctrl, Alt or Shift'.\r\n *\r\n * @param {string[]} names\r\n * @param {{ platform?: FormatPlatform, conjunction?: string }} [opts]\r\n * @returns {string}\r\n */\r\nexport function listModifiers(names, { platform, conjunction = 'or' } = {}) {\r\n const labels = names.map((n) => modifierLabel(n, { platform }))\r\n if (labels.length <= 1) return labels.join('')\r\n return `${labels.slice(0, -1).join(', ')} ${conjunction} ${labels[labels.length - 1]}`\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;AAYA,SAAS,mBAAmB,GAAG;AAC7B,MAAI,CAAC,EAAG,QAAO;AACf,MAAI,mBAAmB,KAAK,CAAC,EAAG,QAAO;AACvC,MAAI,wBAAwB,KAAK,CAAC,EAAG,QAAO;AAC5C,MAAI,OAAO,KAAK,CAAC,EAAG,QAAO;AAC3B,MAAI,aAAa,KAAK,CAAC,EAAG,QAAO;AACjC,SAAO;AACT;AAWO,SAAS,eAAe,MAAO,OAAO,cAAc,cAAc,YAAY,MAAO,EAAE,WAAW,MAAM,IAAI,CAAC,GAAG;AACrH,MAAI,CAAC,IAAK,QAAO;AACjB,Q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