@tuidom/core 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/input/tokenize.js +52 -0
- package/package.json +1 -1
package/dist/input/tokenize.js
CHANGED
|
@@ -408,6 +408,55 @@ function parseCodepointParam(paramStr) {
|
|
|
408
408
|
return { codepoint, shiftedKey, baseLayoutKey };
|
|
409
409
|
}
|
|
410
410
|
// ─── Code inference ───
|
|
411
|
+
/**
|
|
412
|
+
* Физическая клавиша US-раскладки под буквой кириллической ЙЦУКЕН: русская целиком,
|
|
413
|
+
* плюс украинские і/ї/є/ґ и белорусская ў. Нужна легаси-вводу (tmux, терминалы без
|
|
414
|
+
* kitty-флага alternate keys): там приходит только символ, а мнемоники и Alt-кейбинды
|
|
415
|
+
* ищут клавишу по `code` — в браузере `code` тоже физический (`а` → `KeyF`).
|
|
416
|
+
*
|
|
417
|
+
* Белорусская `і` стоит на месте латинской B, украинская — на S; `і` одна, выбрана
|
|
418
|
+
* украинская позиция (на B у русской и украинской раскладок `и`).
|
|
419
|
+
*/
|
|
420
|
+
const cyrillicCodes = {
|
|
421
|
+
й: "KeyQ",
|
|
422
|
+
ц: "KeyW",
|
|
423
|
+
у: "KeyE",
|
|
424
|
+
к: "KeyR",
|
|
425
|
+
е: "KeyT",
|
|
426
|
+
н: "KeyY",
|
|
427
|
+
г: "KeyU",
|
|
428
|
+
ш: "KeyI",
|
|
429
|
+
щ: "KeyO",
|
|
430
|
+
ў: "KeyO",
|
|
431
|
+
з: "KeyP",
|
|
432
|
+
х: "BracketLeft",
|
|
433
|
+
ъ: "BracketRight",
|
|
434
|
+
ї: "BracketRight",
|
|
435
|
+
ф: "KeyA",
|
|
436
|
+
ы: "KeyS",
|
|
437
|
+
і: "KeyS",
|
|
438
|
+
в: "KeyD",
|
|
439
|
+
а: "KeyF",
|
|
440
|
+
п: "KeyG",
|
|
441
|
+
р: "KeyH",
|
|
442
|
+
о: "KeyJ",
|
|
443
|
+
л: "KeyK",
|
|
444
|
+
д: "KeyL",
|
|
445
|
+
ж: "Semicolon",
|
|
446
|
+
э: "Quote",
|
|
447
|
+
є: "Quote",
|
|
448
|
+
я: "KeyZ",
|
|
449
|
+
ч: "KeyX",
|
|
450
|
+
с: "KeyC",
|
|
451
|
+
м: "KeyV",
|
|
452
|
+
и: "KeyB",
|
|
453
|
+
т: "KeyN",
|
|
454
|
+
ь: "KeyM",
|
|
455
|
+
б: "Comma",
|
|
456
|
+
ю: "Period",
|
|
457
|
+
ё: "Backquote",
|
|
458
|
+
ґ: "Backslash",
|
|
459
|
+
};
|
|
411
460
|
/**
|
|
412
461
|
* Infer a DOM-style `code` from a key value.
|
|
413
462
|
* Best-effort for traditional terminal mode (no physical key info available).
|
|
@@ -417,6 +466,9 @@ export function inferCode(key) {
|
|
|
417
466
|
const upper = key.toUpperCase();
|
|
418
467
|
if (upper >= "A" && upper <= "Z")
|
|
419
468
|
return `Key${upper}`;
|
|
469
|
+
const cyrillic = cyrillicCodes[key.toLowerCase()];
|
|
470
|
+
if (cyrillic !== undefined)
|
|
471
|
+
return cyrillic;
|
|
420
472
|
if (key >= "0" && key <= "9")
|
|
421
473
|
return `Digit${key}`;
|
|
422
474
|
if (key === " ")
|
package/package.json
CHANGED