Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

test-keyboard

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-keyboard - npm Package Compare versions

Comparing version 2.0.7-beta.3 to 2.0.7-beta.4

1841

dist/test-keyboard.js

@@ -1,9 +0,22 @@

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
// src/test-keyboard.ts

@@ -18,80 +31,18 @@ import { includes, object, take } from "@remirror/core-helpers";

var rawUSKeyboardLayout = {
"0": {
keyCode: 48,
key: "0",
code: "Digit0"
},
"1": {
keyCode: 49,
key: "1",
code: "Digit1"
},
"2": {
keyCode: 50,
key: "2",
code: "Digit2"
},
"3": {
keyCode: 51,
key: "3",
code: "Digit3"
},
"4": {
keyCode: 52,
key: "4",
code: "Digit4"
},
"5": {
keyCode: 53,
key: "5",
code: "Digit5"
},
"6": {
keyCode: 54,
key: "6",
code: "Digit6"
},
"7": {
keyCode: 55,
key: "7",
code: "Digit7"
},
"8": {
keyCode: 56,
key: "8",
code: "Digit8"
},
"9": {
keyCode: 57,
key: "9",
code: "Digit9"
},
Power: {
key: "Power",
code: "Power"
},
Eject: {
key: "Eject",
code: "Eject"
},
Abort: {
keyCode: 3,
code: "Abort",
key: "Cancel"
},
Help: {
keyCode: 6,
code: "Help",
key: "Help"
},
Backspace: {
keyCode: 8,
code: "Backspace",
key: "Backspace"
},
Tab: {
keyCode: 9,
code: "Tab",
key: "Tab"
},
"0": { keyCode: 48, key: "0", code: "Digit0" },
"1": { keyCode: 49, key: "1", code: "Digit1" },
"2": { keyCode: 50, key: "2", code: "Digit2" },
"3": { keyCode: 51, key: "3", code: "Digit3" },
"4": { keyCode: 52, key: "4", code: "Digit4" },
"5": { keyCode: 53, key: "5", code: "Digit5" },
"6": { keyCode: 54, key: "6", code: "Digit6" },
"7": { keyCode: 55, key: "7", code: "Digit7" },
"8": { keyCode: 56, key: "8", code: "Digit8" },
"9": { keyCode: 57, key: "9", code: "Digit9" },
Power: { key: "Power", code: "Power" },
Eject: { key: "Eject", code: "Eject" },
Abort: { keyCode: 3, code: "Abort", key: "Cancel" },
Help: { keyCode: 6, code: "Help", key: "Help" },
Backspace: { keyCode: 8, code: "Backspace", key: "Backspace" },
Tab: { keyCode: 9, code: "Tab", key: "Tab" },
Numpad5: {

@@ -105,93 +56,18 @@ keyCode: 12,

},
NumpadEnter: {
keyCode: 13,
code: "NumpadEnter",
key: "Enter",
text: "\r",
location: 3
},
Enter: {
keyCode: 13,
code: "Enter",
key: "Enter",
text: "\r"
},
"\r": {
keyCode: 13,
code: "Enter",
key: "Enter",
text: "\r"
},
"\n": {
keyCode: 13,
code: "Enter",
key: "Enter",
text: "\r"
},
ShiftLeft: {
keyCode: 16,
code: "ShiftLeft",
key: "Shift",
location: 1
},
ShiftRight: {
keyCode: 16,
code: "ShiftRight",
key: "Shift",
location: 2
},
ControlLeft: {
keyCode: 17,
code: "ControlLeft",
key: "Control",
location: 1
},
ControlRight: {
keyCode: 17,
code: "ControlRight",
key: "Control",
location: 2
},
AltLeft: {
keyCode: 18,
code: "AltLeft",
key: "Alt",
location: 1
},
AltRight: {
keyCode: 18,
code: "AltRight",
key: "Alt",
location: 2
},
Pause: {
keyCode: 19,
code: "Pause",
key: "Pause"
},
CapsLock: {
keyCode: 20,
code: "CapsLock",
key: "CapsLock"
},
Escape: {
keyCode: 27,
code: "Escape",
key: "Escape"
},
Convert: {
keyCode: 28,
code: "Convert",
key: "Convert"
},
NonConvert: {
keyCode: 29,
code: "NonConvert",
key: "NonConvert"
},
Space: {
keyCode: 32,
code: "Space",
key: " "
},
NumpadEnter: { keyCode: 13, code: "NumpadEnter", key: "Enter", text: "\r", location: 3 },
Enter: { keyCode: 13, code: "Enter", key: "Enter", text: "\r" },
"\r": { keyCode: 13, code: "Enter", key: "Enter", text: "\r" },
"\n": { keyCode: 13, code: "Enter", key: "Enter", text: "\r" },
ShiftLeft: { keyCode: 16, code: "ShiftLeft", key: "Shift", location: 1 },
ShiftRight: { keyCode: 16, code: "ShiftRight", key: "Shift", location: 2 },
ControlLeft: { keyCode: 17, code: "ControlLeft", key: "Control", location: 1 },
ControlRight: { keyCode: 17, code: "ControlRight", key: "Control", location: 2 },
AltLeft: { keyCode: 18, code: "AltLeft", key: "Alt", location: 1 },
AltRight: { keyCode: 18, code: "AltRight", key: "Alt", location: 2 },
Pause: { keyCode: 19, code: "Pause", key: "Pause" },
CapsLock: { keyCode: 20, code: "CapsLock", key: "CapsLock" },
Escape: { keyCode: 27, code: "Escape", key: "Escape" },
Convert: { keyCode: 28, code: "Convert", key: "Convert" },
NonConvert: { keyCode: 29, code: "NonConvert", key: "NonConvert" },
Space: { keyCode: 32, code: "Space", key: " " },
Numpad9: {

@@ -205,7 +81,3 @@ keyCode: 33,

},
PageUp: {
keyCode: 33,
code: "PageUp",
key: "PageUp"
},
PageUp: { keyCode: 33, code: "PageUp", key: "PageUp" },
Numpad3: {

@@ -219,12 +91,4 @@ keyCode: 34,

},
PageDown: {
keyCode: 34,
code: "PageDown",
key: "PageDown"
},
End: {
keyCode: 35,
code: "End",
key: "End"
},
PageDown: { keyCode: 34, code: "PageDown", key: "PageDown" },
End: { keyCode: 35, code: "End", key: "End" },
Numpad1: {

@@ -238,7 +102,3 @@ keyCode: 35,

},
Home: {
keyCode: 36,
code: "Home",
key: "Home"
},
Home: { keyCode: 36, code: "Home", key: "Home" },
Numpad7: {

@@ -252,7 +112,3 @@ keyCode: 36,

},
ArrowLeft: {
keyCode: 37,
code: "ArrowLeft",
key: "ArrowLeft"
},
ArrowLeft: { keyCode: 37, code: "ArrowLeft", key: "ArrowLeft" },
Numpad4: {

@@ -274,12 +130,4 @@ keyCode: 37,

},
ArrowUp: {
keyCode: 38,
code: "ArrowUp",
key: "ArrowUp"
},
ArrowRight: {
keyCode: 39,
code: "ArrowRight",
key: "ArrowRight"
},
ArrowUp: { keyCode: 38, code: "ArrowUp", key: "ArrowUp" },
ArrowRight: { keyCode: 39, code: "ArrowRight", key: "ArrowRight" },
Numpad6: {

@@ -301,27 +149,7 @@ keyCode: 39,

},
ArrowDown: {
keyCode: 40,
code: "ArrowDown",
key: "ArrowDown"
},
Select: {
keyCode: 41,
code: "Select",
key: "Select"
},
Open: {
keyCode: 43,
code: "Open",
key: "Execute"
},
PrintScreen: {
keyCode: 44,
code: "PrintScreen",
key: "PrintScreen"
},
Insert: {
keyCode: 45,
code: "Insert",
key: "Insert"
},
ArrowDown: { keyCode: 40, code: "ArrowDown", key: "ArrowDown" },
Select: { keyCode: 41, code: "Select", key: "Select" },
Open: { keyCode: 43, code: "Open", key: "Execute" },
PrintScreen: { keyCode: 44, code: "PrintScreen", key: "PrintScreen" },
Insert: { keyCode: 45, code: "Insert", key: "Insert" },
Numpad0: {

@@ -335,7 +163,3 @@ keyCode: 45,

},
Delete: {
keyCode: 46,
code: "Delete",
key: "Delete"
},
Delete: { keyCode: 46, code: "Delete", key: "Delete" },
NumpadDecimal: {

@@ -349,1020 +173,259 @@ keyCode: 46,

},
Digit0: {
keyCode: 48,
code: "Digit0",
shiftKey: ")",
key: "0"
},
Digit1: {
keyCode: 49,
code: "Digit1",
shiftKey: "!",
key: "1"
},
Digit2: {
keyCode: 50,
code: "Digit2",
shiftKey: "@",
key: "2"
},
Digit3: {
keyCode: 51,
code: "Digit3",
shiftKey: "#",
key: "3"
},
Digit4: {
keyCode: 52,
code: "Digit4",
shiftKey: "$",
key: "4"
},
Digit5: {
keyCode: 53,
code: "Digit5",
shiftKey: "%",
key: "5"
},
Digit6: {
keyCode: 54,
code: "Digit6",
shiftKey: "^",
key: "6"
},
Digit7: {
keyCode: 55,
code: "Digit7",
shiftKey: "&",
key: "7"
},
Digit8: {
keyCode: 56,
code: "Digit8",
shiftKey: "*",
key: "8"
},
Digit9: {
keyCode: 57,
code: "Digit9",
shiftKey: "(",
key: "9"
},
KeyA: {
keyCode: 65,
code: "KeyA",
shiftKey: "A",
key: "a"
},
KeyB: {
keyCode: 66,
code: "KeyB",
shiftKey: "B",
key: "b"
},
KeyC: {
keyCode: 67,
code: "KeyC",
shiftKey: "C",
key: "c"
},
KeyD: {
keyCode: 68,
code: "KeyD",
shiftKey: "D",
key: "d"
},
KeyE: {
keyCode: 69,
code: "KeyE",
shiftKey: "E",
key: "e"
},
KeyF: {
keyCode: 70,
code: "KeyF",
shiftKey: "F",
key: "f"
},
KeyG: {
keyCode: 71,
code: "KeyG",
shiftKey: "G",
key: "g"
},
KeyH: {
keyCode: 72,
code: "KeyH",
shiftKey: "H",
key: "h"
},
KeyI: {
keyCode: 73,
code: "KeyI",
shiftKey: "I",
key: "i"
},
KeyJ: {
keyCode: 74,
code: "KeyJ",
shiftKey: "J",
key: "j"
},
KeyK: {
keyCode: 75,
code: "KeyK",
shiftKey: "K",
key: "k"
},
KeyL: {
keyCode: 76,
code: "KeyL",
shiftKey: "L",
key: "l"
},
KeyM: {
keyCode: 77,
code: "KeyM",
shiftKey: "M",
key: "m"
},
KeyN: {
keyCode: 78,
code: "KeyN",
shiftKey: "N",
key: "n"
},
KeyO: {
keyCode: 79,
code: "KeyO",
shiftKey: "O",
key: "o"
},
KeyP: {
keyCode: 80,
code: "KeyP",
shiftKey: "P",
key: "p"
},
KeyQ: {
keyCode: 81,
code: "KeyQ",
shiftKey: "Q",
key: "q"
},
KeyR: {
keyCode: 82,
code: "KeyR",
shiftKey: "R",
key: "r"
},
KeyS: {
keyCode: 83,
code: "KeyS",
shiftKey: "S",
key: "s"
},
KeyT: {
keyCode: 84,
code: "KeyT",
shiftKey: "T",
key: "t"
},
KeyU: {
keyCode: 85,
code: "KeyU",
shiftKey: "U",
key: "u"
},
KeyV: {
keyCode: 86,
code: "KeyV",
shiftKey: "V",
key: "v"
},
KeyW: {
keyCode: 87,
code: "KeyW",
shiftKey: "W",
key: "w"
},
KeyX: {
keyCode: 88,
code: "KeyX",
shiftKey: "X",
key: "x"
},
KeyY: {
keyCode: 89,
code: "KeyY",
shiftKey: "Y",
key: "y"
},
KeyZ: {
keyCode: 90,
code: "KeyZ",
shiftKey: "Z",
key: "z"
},
MetaLeft: {
keyCode: 91,
code: "MetaLeft",
key: "Meta",
location: 1
},
MetaRight: {
keyCode: 92,
code: "MetaRight",
key: "Meta",
location: 2
},
ContextMenu: {
keyCode: 93,
code: "ContextMenu",
key: "ContextMenu"
},
NumpadMultiply: {
keyCode: 106,
code: "NumpadMultiply",
key: "*",
location: 3
},
NumpadAdd: {
keyCode: 107,
code: "NumpadAdd",
key: "+",
location: 3
},
NumpadSubtract: {
keyCode: 109,
code: "NumpadSubtract",
key: "-",
location: 3
},
NumpadDivide: {
keyCode: 111,
code: "NumpadDivide",
key: "/",
location: 3
},
F1: {
keyCode: 112,
code: "F1",
key: "F1"
},
F2: {
keyCode: 113,
code: "F2",
key: "F2"
},
F3: {
keyCode: 114,
code: "F3",
key: "F3"
},
F4: {
keyCode: 115,
code: "F4",
key: "F4"
},
F5: {
keyCode: 116,
code: "F5",
key: "F5"
},
F6: {
keyCode: 117,
code: "F6",
key: "F6"
},
F7: {
keyCode: 118,
code: "F7",
key: "F7"
},
F8: {
keyCode: 119,
code: "F8",
key: "F8"
},
F9: {
keyCode: 120,
code: "F9",
key: "F9"
},
F10: {
keyCode: 121,
code: "F10",
key: "F10"
},
F11: {
keyCode: 122,
code: "F11",
key: "F11"
},
F12: {
keyCode: 123,
code: "F12",
key: "F12"
},
F13: {
keyCode: 124,
code: "F13",
key: "F13"
},
F14: {
keyCode: 125,
code: "F14",
key: "F14"
},
F15: {
keyCode: 126,
code: "F15",
key: "F15"
},
F16: {
keyCode: 127,
code: "F16",
key: "F16"
},
F17: {
keyCode: 128,
code: "F17",
key: "F17"
},
F18: {
keyCode: 129,
code: "F18",
key: "F18"
},
F19: {
keyCode: 130,
code: "F19",
key: "F19"
},
F20: {
keyCode: 131,
code: "F20",
key: "F20"
},
F21: {
keyCode: 132,
code: "F21",
key: "F21"
},
F22: {
keyCode: 133,
code: "F22",
key: "F22"
},
F23: {
keyCode: 134,
code: "F23",
key: "F23"
},
F24: {
keyCode: 135,
code: "F24",
key: "F24"
},
NumLock: {
keyCode: 144,
code: "NumLock",
key: "NumLock"
},
ScrollLock: {
keyCode: 145,
code: "ScrollLock",
key: "ScrollLock"
},
AudioVolumeMute: {
keyCode: 173,
code: "AudioVolumeMute",
key: "AudioVolumeMute"
},
AudioVolumeDown: {
keyCode: 174,
code: "AudioVolumeDown",
key: "AudioVolumeDown"
},
AudioVolumeUp: {
keyCode: 175,
code: "AudioVolumeUp",
key: "AudioVolumeUp"
},
MediaTrackNext: {
keyCode: 176,
code: "MediaTrackNext",
key: "MediaTrackNext"
},
MediaTrackPrevious: {
keyCode: 177,
code: "MediaTrackPrevious",
key: "MediaTrackPrevious"
},
MediaStop: {
keyCode: 178,
code: "MediaStop",
key: "MediaStop"
},
MediaPlayPause: {
keyCode: 179,
code: "MediaPlayPause",
key: "MediaPlayPause"
},
Semicolon: {
keyCode: 186,
code: "Semicolon",
shiftKey: ":",
key: ";"
},
Equal: {
keyCode: 187,
code: "Equal",
shiftKey: "+",
key: "="
},
NumpadEqual: {
keyCode: 187,
code: "NumpadEqual",
key: "=",
location: 3
},
Comma: {
keyCode: 188,
code: "Comma",
shiftKey: "<",
key: ","
},
Minus: {
keyCode: 189,
code: "Minus",
shiftKey: "_",
key: "-"
},
Period: {
keyCode: 190,
code: "Period",
shiftKey: ">",
key: "."
},
Slash: {
keyCode: 191,
code: "Slash",
shiftKey: "?",
key: "/"
},
Backquote: {
keyCode: 192,
code: "Backquote",
shiftKey: "~",
key: "`"
},
BracketLeft: {
keyCode: 219,
code: "BracketLeft",
shiftKey: "{",
key: "["
},
Backslash: {
keyCode: 220,
code: "Backslash",
shiftKey: "|",
key: "\\"
},
BracketRight: {
keyCode: 221,
code: "BracketRight",
shiftKey: "}",
key: "]"
},
Quote: {
keyCode: 222,
code: "Quote",
shiftKey: '"',
key: "'"
},
AltGraph: {
keyCode: 225,
code: "AltGraph",
key: "AltGraph"
},
Props: {
keyCode: 247,
code: "Props",
key: "CrSel"
},
Cancel: {
keyCode: 3,
key: "Cancel",
code: "Abort"
},
Clear: {
keyCode: 12,
key: "Clear",
code: "Numpad5",
location: 3
},
Shift: {
keyCode: 16,
key: "Shift",
code: "ShiftLeft",
location: 1
},
Control: {
keyCode: 17,
key: "Control",
code: "ControlLeft",
location: 1
},
Alt: {
keyCode: 18,
key: "Alt",
code: "AltLeft",
location: 1
},
Accept: {
keyCode: 30,
key: "Accept"
},
ModeChange: {
keyCode: 31,
key: "ModeChange"
},
" ": {
keyCode: 32,
key: " ",
code: "Space"
},
Print: {
keyCode: 42,
key: "Print"
},
Execute: {
keyCode: 43,
key: "Execute",
code: "Open"
},
"\0": {
keyCode: 46,
key: "\0",
code: "NumpadDecimal",
location: 3
},
a: {
keyCode: 65,
key: "a",
code: "KeyA"
},
b: {
keyCode: 66,
key: "b",
code: "KeyB"
},
c: {
keyCode: 67,
key: "c",
code: "KeyC"
},
d: {
keyCode: 68,
key: "d",
code: "KeyD"
},
e: {
keyCode: 69,
key: "e",
code: "KeyE"
},
f: {
keyCode: 70,
key: "f",
code: "KeyF"
},
g: {
keyCode: 71,
key: "g",
code: "KeyG"
},
h: {
keyCode: 72,
key: "h",
code: "KeyH"
},
i: {
keyCode: 73,
key: "i",
code: "KeyI"
},
j: {
keyCode: 74,
key: "j",
code: "KeyJ"
},
k: {
keyCode: 75,
key: "k",
code: "KeyK"
},
l: {
keyCode: 76,
key: "l",
code: "KeyL"
},
m: {
keyCode: 77,
key: "m",
code: "KeyM"
},
n: {
keyCode: 78,
key: "n",
code: "KeyN"
},
o: {
keyCode: 79,
key: "o",
code: "KeyO"
},
p: {
keyCode: 80,
key: "p",
code: "KeyP"
},
q: {
keyCode: 81,
key: "q",
code: "KeyQ"
},
r: {
keyCode: 82,
key: "r",
code: "KeyR"
},
s: {
keyCode: 83,
key: "s",
code: "KeyS"
},
t: {
keyCode: 84,
key: "t",
code: "KeyT"
},
u: {
keyCode: 85,
key: "u",
code: "KeyU"
},
v: {
keyCode: 86,
key: "v",
code: "KeyV"
},
w: {
keyCode: 87,
key: "w",
code: "KeyW"
},
x: {
keyCode: 88,
key: "x",
code: "KeyX"
},
y: {
keyCode: 89,
key: "y",
code: "KeyY"
},
z: {
keyCode: 90,
key: "z",
code: "KeyZ"
},
Meta: {
keyCode: 91,
key: "Meta",
code: "MetaLeft",
location: 1
},
"*": {
keyCode: 106,
key: "*",
code: "NumpadMultiply",
location: 3
},
"+": {
keyCode: 107,
key: "+",
code: "NumpadAdd",
location: 3
},
"-": {
keyCode: 109,
key: "-",
code: "NumpadSubtract",
location: 3
},
"/": {
keyCode: 111,
key: "/",
code: "NumpadDivide",
location: 3
},
";": {
keyCode: 186,
key: ";",
code: "Semicolon"
},
"=": {
keyCode: 187,
key: "=",
code: "Equal"
},
",": {
keyCode: 188,
key: ",",
code: "Comma"
},
".": {
keyCode: 190,
key: ".",
code: "Period"
},
"`": {
keyCode: 192,
key: "`",
code: "Backquote"
},
"[": {
keyCode: 219,
key: "[",
code: "BracketLeft"
},
"\\": {
keyCode: 220,
key: "\\",
code: "Backslash"
},
"]": {
keyCode: 221,
key: "]",
code: "BracketRight"
},
"'": {
keyCode: 222,
key: "'",
code: "Quote"
},
Attn: {
keyCode: 246,
key: "Attn"
},
CrSel: {
keyCode: 247,
key: "CrSel",
code: "Props"
},
ExSel: {
keyCode: 248,
key: "ExSel"
},
EraseEof: {
keyCode: 249,
key: "EraseEof"
},
Play: {
keyCode: 250,
key: "Play"
},
ZoomOut: {
keyCode: 251,
key: "ZoomOut"
},
")": {
keyCode: 48,
key: ")",
code: "Digit0"
},
"!": {
keyCode: 49,
key: "!",
code: "Digit1"
},
"@": {
keyCode: 50,
key: "@",
code: "Digit2"
},
"#": {
keyCode: 51,
key: "#",
code: "Digit3"
},
$: {
keyCode: 52,
key: "$",
code: "Digit4"
},
"%": {
keyCode: 53,
key: "%",
code: "Digit5"
},
"^": {
keyCode: 54,
key: "^",
code: "Digit6"
},
"&": {
keyCode: 55,
key: "&",
code: "Digit7"
},
"(": {
keyCode: 57,
key: "(",
code: "Digit9"
},
A: {
keyCode: 65,
key: "A",
code: "KeyA"
},
B: {
keyCode: 66,
key: "B",
code: "KeyB"
},
C: {
keyCode: 67,
key: "C",
code: "KeyC"
},
D: {
keyCode: 68,
key: "D",
code: "KeyD"
},
E: {
keyCode: 69,
key: "E",
code: "KeyE"
},
F: {
keyCode: 70,
key: "F",
code: "KeyF"
},
G: {
keyCode: 71,
key: "G",
code: "KeyG"
},
H: {
keyCode: 72,
key: "H",
code: "KeyH"
},
I: {
keyCode: 73,
key: "I",
code: "KeyI"
},
J: {
keyCode: 74,
key: "J",
code: "KeyJ"
},
K: {
keyCode: 75,
key: "K",
code: "KeyK"
},
L: {
keyCode: 76,
key: "L",
code: "KeyL"
},
M: {
keyCode: 77,
key: "M",
code: "KeyM"
},
N: {
keyCode: 78,
key: "N",
code: "KeyN"
},
O: {
keyCode: 79,
key: "O",
code: "KeyO"
},
P: {
keyCode: 80,
key: "P",
code: "KeyP"
},
Q: {
keyCode: 81,
key: "Q",
code: "KeyQ"
},
R: {
keyCode: 82,
key: "R",
code: "KeyR"
},
S: {
keyCode: 83,
key: "S",
code: "KeyS"
},
T: {
keyCode: 84,
key: "T",
code: "KeyT"
},
U: {
keyCode: 85,
key: "U",
code: "KeyU"
},
V: {
keyCode: 86,
key: "V",
code: "KeyV"
},
W: {
keyCode: 87,
key: "W",
code: "KeyW"
},
X: {
keyCode: 88,
key: "X",
code: "KeyX"
},
Y: {
keyCode: 89,
key: "Y",
code: "KeyY"
},
Z: {
keyCode: 90,
key: "Z",
code: "KeyZ"
},
":": {
keyCode: 186,
key: ":",
code: "Semicolon"
},
"<": {
keyCode: 188,
key: "<",
code: "Comma"
},
_: {
keyCode: 189,
key: "_",
code: "Minus"
},
">": {
keyCode: 190,
key: ">",
code: "Period"
},
"?": {
keyCode: 191,
key: "?",
code: "Slash"
},
"~": {
keyCode: 192,
key: "~",
code: "Backquote"
},
"{": {
keyCode: 219,
key: "{",
code: "BracketLeft"
},
"|": {
keyCode: 220,
key: "|",
code: "Backslash"
},
"}": {
keyCode: 221,
key: "}",
code: "BracketRight"
},
'"': {
keyCode: 222,
key: '"',
code: "Quote"
}
Digit0: { keyCode: 48, code: "Digit0", shiftKey: ")", key: "0" },
Digit1: { keyCode: 49, code: "Digit1", shiftKey: "!", key: "1" },
Digit2: { keyCode: 50, code: "Digit2", shiftKey: "@", key: "2" },
Digit3: { keyCode: 51, code: "Digit3", shiftKey: "#", key: "3" },
Digit4: { keyCode: 52, code: "Digit4", shiftKey: "$", key: "4" },
Digit5: { keyCode: 53, code: "Digit5", shiftKey: "%", key: "5" },
Digit6: { keyCode: 54, code: "Digit6", shiftKey: "^", key: "6" },
Digit7: { keyCode: 55, code: "Digit7", shiftKey: "&", key: "7" },
Digit8: { keyCode: 56, code: "Digit8", shiftKey: "*", key: "8" },
Digit9: { keyCode: 57, code: "Digit9", shiftKey: "(", key: "9" },
KeyA: { keyCode: 65, code: "KeyA", shiftKey: "A", key: "a" },
KeyB: { keyCode: 66, code: "KeyB", shiftKey: "B", key: "b" },
KeyC: { keyCode: 67, code: "KeyC", shiftKey: "C", key: "c" },
KeyD: { keyCode: 68, code: "KeyD", shiftKey: "D", key: "d" },
KeyE: { keyCode: 69, code: "KeyE", shiftKey: "E", key: "e" },
KeyF: { keyCode: 70, code: "KeyF", shiftKey: "F", key: "f" },
KeyG: { keyCode: 71, code: "KeyG", shiftKey: "G", key: "g" },
KeyH: { keyCode: 72, code: "KeyH", shiftKey: "H", key: "h" },
KeyI: { keyCode: 73, code: "KeyI", shiftKey: "I", key: "i" },
KeyJ: { keyCode: 74, code: "KeyJ", shiftKey: "J", key: "j" },
KeyK: { keyCode: 75, code: "KeyK", shiftKey: "K", key: "k" },
KeyL: { keyCode: 76, code: "KeyL", shiftKey: "L", key: "l" },
KeyM: { keyCode: 77, code: "KeyM", shiftKey: "M", key: "m" },
KeyN: { keyCode: 78, code: "KeyN", shiftKey: "N", key: "n" },
KeyO: { keyCode: 79, code: "KeyO", shiftKey: "O", key: "o" },
KeyP: { keyCode: 80, code: "KeyP", shiftKey: "P", key: "p" },
KeyQ: { keyCode: 81, code: "KeyQ", shiftKey: "Q", key: "q" },
KeyR: { keyCode: 82, code: "KeyR", shiftKey: "R", key: "r" },
KeyS: { keyCode: 83, code: "KeyS", shiftKey: "S", key: "s" },
KeyT: { keyCode: 84, code: "KeyT", shiftKey: "T", key: "t" },
KeyU: { keyCode: 85, code: "KeyU", shiftKey: "U", key: "u" },
KeyV: { keyCode: 86, code: "KeyV", shiftKey: "V", key: "v" },
KeyW: { keyCode: 87, code: "KeyW", shiftKey: "W", key: "w" },
KeyX: { keyCode: 88, code: "KeyX", shiftKey: "X", key: "x" },
KeyY: { keyCode: 89, code: "KeyY", shiftKey: "Y", key: "y" },
KeyZ: { keyCode: 90, code: "KeyZ", shiftKey: "Z", key: "z" },
MetaLeft: { keyCode: 91, code: "MetaLeft", key: "Meta", location: 1 },
MetaRight: { keyCode: 92, code: "MetaRight", key: "Meta", location: 2 },
ContextMenu: { keyCode: 93, code: "ContextMenu", key: "ContextMenu" },
NumpadMultiply: { keyCode: 106, code: "NumpadMultiply", key: "*", location: 3 },
NumpadAdd: { keyCode: 107, code: "NumpadAdd", key: "+", location: 3 },
NumpadSubtract: { keyCode: 109, code: "NumpadSubtract", key: "-", location: 3 },
NumpadDivide: { keyCode: 111, code: "NumpadDivide", key: "/", location: 3 },
F1: { keyCode: 112, code: "F1", key: "F1" },
F2: { keyCode: 113, code: "F2", key: "F2" },
F3: { keyCode: 114, code: "F3", key: "F3" },
F4: { keyCode: 115, code: "F4", key: "F4" },
F5: { keyCode: 116, code: "F5", key: "F5" },
F6: { keyCode: 117, code: "F6", key: "F6" },
F7: { keyCode: 118, code: "F7", key: "F7" },
F8: { keyCode: 119, code: "F8", key: "F8" },
F9: { keyCode: 120, code: "F9", key: "F9" },
F10: { keyCode: 121, code: "F10", key: "F10" },
F11: { keyCode: 122, code: "F11", key: "F11" },
F12: { keyCode: 123, code: "F12", key: "F12" },
F13: { keyCode: 124, code: "F13", key: "F13" },
F14: { keyCode: 125, code: "F14", key: "F14" },
F15: { keyCode: 126, code: "F15", key: "F15" },
F16: { keyCode: 127, code: "F16", key: "F16" },
F17: { keyCode: 128, code: "F17", key: "F17" },
F18: { keyCode: 129, code: "F18", key: "F18" },
F19: { keyCode: 130, code: "F19", key: "F19" },
F20: { keyCode: 131, code: "F20", key: "F20" },
F21: { keyCode: 132, code: "F21", key: "F21" },
F22: { keyCode: 133, code: "F22", key: "F22" },
F23: { keyCode: 134, code: "F23", key: "F23" },
F24: { keyCode: 135, code: "F24", key: "F24" },
NumLock: { keyCode: 144, code: "NumLock", key: "NumLock" },
ScrollLock: { keyCode: 145, code: "ScrollLock", key: "ScrollLock" },
AudioVolumeMute: { keyCode: 173, code: "AudioVolumeMute", key: "AudioVolumeMute" },
AudioVolumeDown: { keyCode: 174, code: "AudioVolumeDown", key: "AudioVolumeDown" },
AudioVolumeUp: { keyCode: 175, code: "AudioVolumeUp", key: "AudioVolumeUp" },
MediaTrackNext: { keyCode: 176, code: "MediaTrackNext", key: "MediaTrackNext" },
MediaTrackPrevious: { keyCode: 177, code: "MediaTrackPrevious", key: "MediaTrackPrevious" },
MediaStop: { keyCode: 178, code: "MediaStop", key: "MediaStop" },
MediaPlayPause: { keyCode: 179, code: "MediaPlayPause", key: "MediaPlayPause" },
Semicolon: { keyCode: 186, code: "Semicolon", shiftKey: ":", key: ";" },
Equal: { keyCode: 187, code: "Equal", shiftKey: "+", key: "=" },
NumpadEqual: { keyCode: 187, code: "NumpadEqual", key: "=", location: 3 },
Comma: { keyCode: 188, code: "Comma", shiftKey: "<", key: "," },
Minus: { keyCode: 189, code: "Minus", shiftKey: "_", key: "-" },
Period: { keyCode: 190, code: "Period", shiftKey: ">", key: "." },
Slash: { keyCode: 191, code: "Slash", shiftKey: "?", key: "/" },
Backquote: { keyCode: 192, code: "Backquote", shiftKey: "~", key: "`" },
BracketLeft: { keyCode: 219, code: "BracketLeft", shiftKey: "{", key: "[" },
Backslash: { keyCode: 220, code: "Backslash", shiftKey: "|", key: "\\" },
BracketRight: { keyCode: 221, code: "BracketRight", shiftKey: "}", key: "]" },
Quote: { keyCode: 222, code: "Quote", shiftKey: '"', key: "'" },
AltGraph: { keyCode: 225, code: "AltGraph", key: "AltGraph" },
Props: { keyCode: 247, code: "Props", key: "CrSel" },
Cancel: { keyCode: 3, key: "Cancel", code: "Abort" },
Clear: { keyCode: 12, key: "Clear", code: "Numpad5", location: 3 },
Shift: { keyCode: 16, key: "Shift", code: "ShiftLeft", location: 1 },
Control: { keyCode: 17, key: "Control", code: "ControlLeft", location: 1 },
Alt: { keyCode: 18, key: "Alt", code: "AltLeft", location: 1 },
Accept: { keyCode: 30, key: "Accept" },
ModeChange: { keyCode: 31, key: "ModeChange" },
" ": { keyCode: 32, key: " ", code: "Space" },
Print: { keyCode: 42, key: "Print" },
Execute: { keyCode: 43, key: "Execute", code: "Open" },
"\0": { keyCode: 46, key: "\0", code: "NumpadDecimal", location: 3 },
a: { keyCode: 65, key: "a", code: "KeyA" },
b: { keyCode: 66, key: "b", code: "KeyB" },
c: { keyCode: 67, key: "c", code: "KeyC" },
d: { keyCode: 68, key: "d", code: "KeyD" },
e: { keyCode: 69, key: "e", code: "KeyE" },
f: { keyCode: 70, key: "f", code: "KeyF" },
g: { keyCode: 71, key: "g", code: "KeyG" },
h: { keyCode: 72, key: "h", code: "KeyH" },
i: { keyCode: 73, key: "i", code: "KeyI" },
j: { keyCode: 74, key: "j", code: "KeyJ" },
k: { keyCode: 75, key: "k", code: "KeyK" },
l: { keyCode: 76, key: "l", code: "KeyL" },
m: { keyCode: 77, key: "m", code: "KeyM" },
n: { keyCode: 78, key: "n", code: "KeyN" },
o: { keyCode: 79, key: "o", code: "KeyO" },
p: { keyCode: 80, key: "p", code: "KeyP" },
q: { keyCode: 81, key: "q", code: "KeyQ" },
r: { keyCode: 82, key: "r", code: "KeyR" },
s: { keyCode: 83, key: "s", code: "KeyS" },
t: { keyCode: 84, key: "t", code: "KeyT" },
u: { keyCode: 85, key: "u", code: "KeyU" },
v: { keyCode: 86, key: "v", code: "KeyV" },
w: { keyCode: 87, key: "w", code: "KeyW" },
x: { keyCode: 88, key: "x", code: "KeyX" },
y: { keyCode: 89, key: "y", code: "KeyY" },
z: { keyCode: 90, key: "z", code: "KeyZ" },
Meta: { keyCode: 91, key: "Meta", code: "MetaLeft", location: 1 },
"*": { keyCode: 106, key: "*", code: "NumpadMultiply", location: 3 },
"+": { keyCode: 107, key: "+", code: "NumpadAdd", location: 3 },
"-": { keyCode: 109, key: "-", code: "NumpadSubtract", location: 3 },
"/": { keyCode: 111, key: "/", code: "NumpadDivide", location: 3 },
";": { keyCode: 186, key: ";", code: "Semicolon" },
"=": { keyCode: 187, key: "=", code: "Equal" },
",": { keyCode: 188, key: ",", code: "Comma" },
".": { keyCode: 190, key: ".", code: "Period" },
"`": { keyCode: 192, key: "`", code: "Backquote" },
"[": { keyCode: 219, key: "[", code: "BracketLeft" },
"\\": { keyCode: 220, key: "\\", code: "Backslash" },
"]": { keyCode: 221, key: "]", code: "BracketRight" },
"'": { keyCode: 222, key: "'", code: "Quote" },
Attn: { keyCode: 246, key: "Attn" },
CrSel: { keyCode: 247, key: "CrSel", code: "Props" },
ExSel: { keyCode: 248, key: "ExSel" },
EraseEof: { keyCode: 249, key: "EraseEof" },
Play: { keyCode: 250, key: "Play" },
ZoomOut: { keyCode: 251, key: "ZoomOut" },
")": { keyCode: 48, key: ")", code: "Digit0" },
"!": { keyCode: 49, key: "!", code: "Digit1" },
"@": { keyCode: 50, key: "@", code: "Digit2" },
"#": { keyCode: 51, key: "#", code: "Digit3" },
$: { keyCode: 52, key: "$", code: "Digit4" },
"%": { keyCode: 53, key: "%", code: "Digit5" },
"^": { keyCode: 54, key: "^", code: "Digit6" },
"&": { keyCode: 55, key: "&", code: "Digit7" },
"(": { keyCode: 57, key: "(", code: "Digit9" },
A: { keyCode: 65, key: "A", code: "KeyA" },
B: { keyCode: 66, key: "B", code: "KeyB" },
C: { keyCode: 67, key: "C", code: "KeyC" },
D: { keyCode: 68, key: "D", code: "KeyD" },
E: { keyCode: 69, key: "E", code: "KeyE" },
F: { keyCode: 70, key: "F", code: "KeyF" },
G: { keyCode: 71, key: "G", code: "KeyG" },
H: { keyCode: 72, key: "H", code: "KeyH" },
I: { keyCode: 73, key: "I", code: "KeyI" },
J: { keyCode: 74, key: "J", code: "KeyJ" },
K: { keyCode: 75, key: "K", code: "KeyK" },
L: { keyCode: 76, key: "L", code: "KeyL" },
M: { keyCode: 77, key: "M", code: "KeyM" },
N: { keyCode: 78, key: "N", code: "KeyN" },
O: { keyCode: 79, key: "O", code: "KeyO" },
P: { keyCode: 80, key: "P", code: "KeyP" },
Q: { keyCode: 81, key: "Q", code: "KeyQ" },
R: { keyCode: 82, key: "R", code: "KeyR" },
S: { keyCode: 83, key: "S", code: "KeyS" },
T: { keyCode: 84, key: "T", code: "KeyT" },
U: { keyCode: 85, key: "U", code: "KeyU" },
V: { keyCode: 86, key: "V", code: "KeyV" },
W: { keyCode: 87, key: "W", code: "KeyW" },
X: { keyCode: 88, key: "X", code: "KeyX" },
Y: { keyCode: 89, key: "Y", code: "KeyY" },
Z: { keyCode: 90, key: "Z", code: "KeyZ" },
":": { keyCode: 186, key: ":", code: "Semicolon" },
"<": { keyCode: 188, key: "<", code: "Comma" },
_: { keyCode: 189, key: "_", code: "Minus" },
">": { keyCode: 190, key: ">", code: "Period" },
"?": { keyCode: 191, key: "?", code: "Slash" },
"~": { keyCode: 192, key: "~", code: "Backquote" },
"{": { keyCode: 219, key: "{", code: "BracketLeft" },
"|": { keyCode: 220, key: "|", code: "Backslash" },
"}": { keyCode: 221, key: "}", code: "BracketRight" },
'"': { keyCode: 222, key: '"', code: "Quote" }
};
var noKeyPress = ["Power", "Eject", "Abort", "Help", "Backspace", "Tab", "Numpad5", "NumpadEnter", "Enter", "ShiftLeft", "ShiftRight", "ControlLeft", "ControlRight", "AltLeft", "AltRight", "Pause", "CapsLock", "Escape", "Convert", "NonConvert", "Space", "PageUp", "PageDown", "End", "Home", "ArrowLeft", "ArrowRight", "ArrowDown", "Select", "Open", "PrintScreen", "Delete", "MetaLeft", "MetaRight", "ContextMenu", "NumLock", "ScrollLock", "AudioVolumeMute", "AudioVolumeDown", "AudioVolumeUp", "MediaTrackNext", "MediaTrackPrevious", "MediaStop", "MediaPlayPause", "AltGraph", "Props", "Cancel", "Clear", "Shift", "Control", "Alt", "Accept", "ModeChange", "Print", "Execute", "Meta", "Attn", "CrSel", "ExSel", "EraseEof", "Play", "ZoomOut"];
var noKeyPress = [
"Power",
"Eject",
"Abort",
"Help",
"Backspace",
"Tab",
"Numpad5",
"NumpadEnter",
"Enter",
"ShiftLeft",
"ShiftRight",
"ControlLeft",
"ControlRight",
"AltLeft",
"AltRight",
"Pause",
"CapsLock",
"Escape",
"Convert",
"NonConvert",
"Space",
"PageUp",
"PageDown",
"End",
"Home",
"ArrowLeft",
"ArrowRight",
"ArrowDown",
"Select",
"Open",
"PrintScreen",
"Delete",
"MetaLeft",
"MetaRight",
"ContextMenu",
"NumLock",
"ScrollLock",
"AudioVolumeMute",
"AudioVolumeDown",
"AudioVolumeUp",
"MediaTrackNext",
"MediaTrackPrevious",
"MediaStop",
"MediaPlayPause",
"AltGraph",
"Props",
"Cancel",
"Clear",
"Shift",
"Control",
"Alt",
"Accept",
"ModeChange",
"Print",
"Execute",
"Meta",
"Attn",
"CrSel",
"ExSel",
"EraseEof",
"Play",
"ZoomOut"
];
var noKeyUp = ["CapsLock", "NumLock", "ScrollLock"];

@@ -1376,11 +439,7 @@ var usKeyboardLayout = rawUSKeyboardLayout;

function createKeyboardEvent(type, options) {
return new KeyboardEvent(type, _objectSpread(_objectSpread({}, options), {}, {
bubbles: true
}));
return new KeyboardEvent(type, __spreadProps(__spreadValues({}, options), { bubbles: true }));
}
function getModifierInformation(props) {
var modifiers = props.modifiers,
_props$isMac = props.isMac,
isMac = _props$isMac === void 0 ? false : _props$isMac;
var info = {
const { modifiers, isMac = false } = props;
const info = {
altKey: false,

@@ -1391,29 +450,20 @@ ctrlKey: false,

};
var _iterator = _createForOfIteratorHelper(modifiers),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var modifier = _step.value;
if (/^(cmd|meta|m)$/i.test(modifier)) {
for (const modifier of modifiers) {
if (/^(cmd|meta|m)$/i.test(modifier)) {
info.metaKey = true;
} else if (/^a(lt)?$/i.test(modifier)) {
info.altKey = true;
} else if (/^(c|ctrl|control)$/i.test(modifier)) {
info.ctrlKey = true;
} else if (/^s(hift)?$/i.test(modifier)) {
info.shiftKey = true;
} else if (/^mod$/i.test(modifier)) {
if (isMac) {
info.metaKey = true;
} else if (/^a(lt)?$/i.test(modifier)) {
info.altKey = true;
} else if (/^(c|ctrl|control)$/i.test(modifier)) {
} else {
info.ctrlKey = true;
} else if (/^s(hift)?$/i.test(modifier)) {
info.shiftKey = true;
} else if (/^mod$/i.test(modifier)) {
if (isMac) {
info.metaKey = true;
} else {
info.ctrlKey = true;
}
} else {
throw new Error("Unrecognized modifier name: ".concat(modifier));
}
} else {
throw new Error("Unrecognized modifier name: ".concat(modifier));
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}

@@ -1428,31 +478,16 @@ return info;

var Keyboard = class _Keyboard {
static create(props) {
return new _Keyboard(props);
}
static get defaultOptions() {
return {
bubbles: true,
cancelable: true,
composed: true
};
}
get started() {
return this.status === "started";
}
constructor(_ref) {
var target = _ref.target,
_ref$defaultOptions = _ref.defaultOptions,
defaultOptions = _ref$defaultOptions === void 0 ? _Keyboard.defaultOptions : _ref$defaultOptions,
_ref$isMac = _ref.isMac,
isMac = _ref$isMac === void 0 ? false : _ref$isMac,
_ref$batch = _ref.batch,
batch = _ref$batch === void 0 ? false : _ref$batch,
onEventDispatch = _ref.onEventDispatch;
_defineProperty(this, "status", "idle");
_defineProperty(this, "target", void 0);
_defineProperty(this, "defaultOptions", void 0);
_defineProperty(this, "isMac", void 0);
_defineProperty(this, "batch", void 0);
_defineProperty(this, "onEventDispatch", void 0);
_defineProperty(this, "actions", []);
constructor({
target,
defaultOptions = _Keyboard.defaultOptions,
isMac = false,
batch = false,
onEventDispatch
}) {
__publicField(this, "status", "idle");
__publicField(this, "target");
__publicField(this, "defaultOptions");
__publicField(this, "isMac");
__publicField(this, "batch");
__publicField(this, "onEventDispatch");
__publicField(this, "actions", []);
/**

@@ -1463,6 +498,3 @@ * Triggers a keydown event with provided options

*/
_defineProperty(this, "keyDown", _ref2 => {
var options = _ref2.options;
return this.dispatchEvent("keydown", options);
});
__publicField(this, "keyDown", ({ options }) => this.dispatchEvent("keydown", options));
/**

@@ -1473,6 +505,3 @@ * Trigger a keypress event with the provided options

*/
_defineProperty(this, "keyPress", _ref3 => {
var options = _ref3.options;
return this.dispatchEvent("keypress", options);
});
__publicField(this, "keyPress", ({ options }) => this.dispatchEvent("keypress", options));
/**

@@ -1483,6 +512,3 @@ * Trigger a keyup event with the provided options

*/
_defineProperty(this, "keyUp", _ref4 => {
var options = _ref4.options;
return this.dispatchEvent("keyup", options);
});
__publicField(this, "keyUp", ({ options }) => this.dispatchEvent("keyup", options));
this.target = target;

@@ -1494,2 +520,15 @@ this.defaultOptions = defaultOptions;

}
static create(props) {
return new _Keyboard(props);
}
static get defaultOptions() {
return {
bubbles: true,
cancelable: true,
composed: true
};
}
get started() {
return this.status === "started";
}
/**

@@ -1539,3 +578,3 @@ * Starts the fake timers and sets the keyboard status to 'started'

runBatchedEvents() {
this.actions.forEach(action => {
this.actions.forEach((action) => {
action.dispatch();

@@ -1550,16 +589,9 @@ });

*/
usChar(_ref5) {
var text = _ref5.text,
_ref5$options = _ref5.options,
options = _ref5$options === void 0 ? object() : _ref5$options,
_ref5$typing = _ref5.typing,
typing = _ref5$typing === void 0 ? false : _ref5$typing;
usChar({ text, options = object(), typing = false }) {
if (!isUSKeyboardCharacter(text)) {
throw new Error("This is not a supported character. For generic characters use the `keyboard.char` method instead");
throw new Error(
"This is not a supported character. For generic characters use the `keyboard.char` method instead"
);
}
return this.char({
text,
options,
typing
});
return this.char({ text, options, typing });
}

@@ -1571,13 +603,5 @@ /**

*/
char(_ref6) {
var text = _ref6.text,
options = _ref6.options,
typing = _ref6.typing;
options = _objectSpread(_objectSpread({}, options), isUSKeyboardCharacter(text) ? cleanKey(text) : {
key: text
});
this.fireAllEvents({
options,
typing
});
char({ text, options, typing }) {
options = __spreadValues(__spreadValues({}, options), isUSKeyboardCharacter(text) ? cleanKey(text) : { key: text });
this.fireAllEvents({ options, typing });
return this;

@@ -1591,21 +615,5 @@ }

*/
type(_ref7) {
var text = _ref7.text,
_ref7$options = _ref7.options,
options = _ref7$options === void 0 ? object() : _ref7$options;
var _iterator2 = _createForOfIteratorHelper(text),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var char = _step2.value;
this.char({
text: char,
options,
typing: true
});
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
type({ text, options = object() }) {
for (const char of text) {
this.char({ text: char, options, typing: true });
}

@@ -1627,9 +635,6 @@ return this;

*/
mod(_ref8) {
var _modifiers;
var text = _ref8.text,
_ref8$options = _ref8.options,
options = _ref8$options === void 0 ? object() : _ref8$options;
var modifiers = text.split(/-(?!$)/);
var result = (_modifiers = modifiers[modifiers.length - 1]) !== null && _modifiers !== void 0 ? _modifiers : "";
mod({ text, options = object() }) {
var _a;
let modifiers = text.split(/-(?!$)/);
let result = (_a = modifiers[modifiers.length - 1]) != null ? _a : "";
modifiers = take(modifiers, modifiers.length - 1);

@@ -1639,11 +644,5 @@ if (result === "Space") {

}
var info = getModifierInformation({
modifiers,
isMac: this.isMac
});
const info = getModifierInformation({ modifiers, isMac: this.isMac });
this.fireModifierEvents(info, "keydown");
this.type({
text: result,
options: _objectSpread(_objectSpread({}, options), info)
});
this.type({ text: result, options: __spreadValues(__spreadValues({}, options), info) });
this.fireModifierEvents(info, "keyup");

@@ -1657,18 +656,9 @@ return this;

*/
fireAllEvents(_ref9) {
var options = _ref9.options,
_ref9$typing = _ref9.typing,
typing = _ref9$typing === void 0 ? false : _ref9$typing;
this.keyDown({
options
});
fireAllEvents({ options, typing = false }) {
this.keyDown({ options });
if (!includes(noKeyPress, options.key) || typing && isUSKeyboardCharacter(options.key) && usKeyboardLayout[options.key].text) {
this.keyPress({
options
});
this.keyPress({ options });
}
if (!includes(noKeyUp, options.key)) {
this.keyUp({
options
});
this.keyUp({ options });
}

@@ -1685,33 +675,19 @@ return this;

*/
fireModifierEvents(_ref10, type) {
var altKey = _ref10.altKey,
ctrlKey = _ref10.ctrlKey,
metaKey = _ref10.metaKey,
shiftKey = _ref10.shiftKey;
var event = type === "keydown" ? this.keyDown : this.keyUp;
fireModifierEvents({ altKey, ctrlKey, metaKey, shiftKey }, type) {
const event = type === "keydown" ? this.keyDown : this.keyUp;
if (shiftKey) {
event({
options: _objectSpread(_objectSpread({}, this.defaultOptions), cleanKey("Shift"))
});
event({ options: __spreadValues(__spreadValues({}, this.defaultOptions), cleanKey("Shift")) });
}
if (metaKey) {
if (this.isMac) {
event({
options: _objectSpread(_objectSpread({}, this.defaultOptions), cleanKey("Meta"))
});
event({ options: __spreadValues(__spreadValues({}, this.defaultOptions), cleanKey("Meta")) });
} else {
event({
options: _objectSpread(_objectSpread({}, this.defaultOptions), cleanKey("Control"))
});
event({ options: __spreadValues(__spreadValues({}, this.defaultOptions), cleanKey("Control")) });
}
}
if (ctrlKey) {
event({
options: _objectSpread(_objectSpread({}, this.defaultOptions), cleanKey("Control"))
});
event({ options: __spreadValues(__spreadValues({}, this.defaultOptions), cleanKey("Control")) });
}
if (altKey) {
event({
options: _objectSpread(_objectSpread({}, this.defaultOptions), cleanKey("Alt"))
});
event({ options: __spreadValues(__spreadValues({}, this.defaultOptions), cleanKey("Alt")) });
}

@@ -1730,4 +706,4 @@ }

}
var event = createKeyboardEvent(type, _objectSpread(_objectSpread({}, this.defaultOptions), options));
var dispatch = () => {
const event = createKeyboardEvent(type, __spreadValues(__spreadValues({}, this.defaultOptions), options));
const dispatch = () => {
this.target.dispatchEvent(event);

@@ -1739,7 +715,3 @@ if (this.onEventDispatch) {

if (this.batch) {
this.actions.push({
dispatch,
event,
type
});
this.actions.push({ dispatch, event, type });
} else {

@@ -1751,2 +723,11 @@ dispatch();

};
export { Keyboard, cleanKey, createKeyboardEvent, getModifierInformation, isUSKeyboardCharacter, noKeyPress, noKeyUp, usKeyboardLayout };
export {
Keyboard,
cleanKey,
createKeyboardEvent,
getModifierInformation,
isUSKeyboardCharacter,
noKeyPress,
noKeyUp,
usKeyboardLayout
};
{
"name": "test-keyboard",
"version": "2.0.7-beta.3",
"version": "2.0.7-beta.4",
"description": "A test keyboard for composing fake keyboard events",

@@ -40,7 +40,7 @@ "keywords": [

"@babel/runtime": "^7.22.3",
"@remirror/core-helpers": "4.0.0-beta.2",
"@remirror/core-types": "3.0.0-beta.3"
"@remirror/core-helpers": "4.0.0-beta.3",
"@remirror/core-types": "3.0.0-beta.4"
},
"devDependencies": {
"@remirror/cli": "1.0.1"
"@remirror/cli": "1.1.0-beta.0"
},

@@ -47,0 +47,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc