You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
908 B

2 years ago
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getKeyEventProps = getKeyEventProps;
exports.getMouseEventProps = getMouseEventProps;
function getKeyEventProps(keyDef, state) {
var _keyDef$keyCode, _keyDef$key;
return {
key: keyDef.key,
code: keyDef.code,
altKey: state.modifiers.alt,
ctrlKey: state.modifiers.ctrl,
metaKey: state.modifiers.meta,
shiftKey: state.modifiers.shift,
/** @deprecated use code instead */
keyCode: (_keyDef$keyCode = keyDef.keyCode) != null ? _keyDef$keyCode : // istanbul ignore next
((_keyDef$key = keyDef.key) == null ? void 0 : _keyDef$key.length) === 1 ? keyDef.key.charCodeAt(0) : undefined
};
}
function getMouseEventProps(state) {
return {
altKey: state.modifiers.alt,
ctrlKey: state.modifiers.ctrl,
metaKey: state.modifiers.meta,
shiftKey: state.modifiers.shift
};
}