Add files

This commit is contained in:
DoomRye 2022-07-26 10:06:20 -07:00
commit bb80829159
18195 changed files with 2122994 additions and 0 deletions

View file

@ -0,0 +1,59 @@
/* eslint-env node, browser */
'use strict'
/**
* takes the event and returns the key character
*
* @param {Event} e
* @return {string}
*/
module.exports = function (e) {
var SPECIAL_KEYS_MAP,
SPECIAL_CHARACTERS_MAP
SPECIAL_KEYS_MAP = require('./special-keys-map')
SPECIAL_CHARACTERS_MAP = require('./special-characters-map')
// for keypress events we should return the character as is
if (e.type === 'keypress') {
var character = String.fromCharCode(e.which)
// if the shift key is not pressed then it is safe to assume
// that we want the character to be lowercase. this means if
// you accidentally have caps lock on then your key bindings
// will continue to work
//
// the only side effect that might not be desired is if you
// bind something like 'A' cause you want to trigger an
// event when capital A is pressed caps lock will no longer
// trigger the event. shift+a will though.
if (!e.shiftKey) {
character = character.toLowerCase()
}
return character
}
// for non keypress events the special maps are needed
if (SPECIAL_KEYS_MAP[e.which]) {
return SPECIAL_KEYS_MAP[e.which]
}
if (SPECIAL_CHARACTERS_MAP[e.which]) {
return SPECIAL_CHARACTERS_MAP[e.which]
}
// if it is not in the special map
// with keydown and keyup events the character seems to always
// come in as an uppercase character whether you are pressing shift
// or not. we should make sure it is always lowercase for comparisons
return String.fromCharCode(e.which).toLowerCase()
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/characterFromEvent.js
// module id = 860
// module chunks = 4

View file

@ -0,0 +1,38 @@
/* eslint-env node, browser */
'use strict'
/**
* takes a key event and figures out what the modifiers are
*
* @param {Event} e
* @returns {Array}
*/
module.exports = function (e) {
var modifiers = []
if (e.shiftKey) {
modifiers.push('shift')
}
if (e.altKey) {
modifiers.push('alt')
}
if (e.ctrlKey) {
modifiers.push('ctrl')
}
if (e.metaKey) {
modifiers.push('meta')
}
return modifiers
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/eventModifiers.js
// module id = 1763
// module chunks = 4

View file

@ -0,0 +1,20 @@
/* eslint-env node, browser */
'use strict'
/**
* determines if the keycode specified is a modifier key or not
*
* @param {string} key
* @returns {boolean}
*/
module.exports = function (key) {
return key === 'shift' || key === 'ctrl' || key === 'alt' || key === 'meta'
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/isModifier.js
// module id = 547
// module chunks = 4

View file

@ -0,0 +1,24 @@
/* eslint-env node, browser */
'use strict'
/**
* Converts from a string key combination to an array
*
* @param {string} combination like "command+shift+l"
* @return {Array}
*/
module.exports = function (combination) {
if (combination === '+') {
return ['+']
}
return combination.split('+')
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/keysFromString.js
// module id = 1764
// module chunks = 4

View file

@ -0,0 +1,25 @@
/* eslint-env node, browser */
'use strict'
/**
* prevents default for this event
*
* @param {Event} e
* @returns void
*/
module.exports = function (e) {
if (e.preventDefault) {
e.preventDefault()
return
}
e.returnValue = false
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/preventDefault.js
// module id = 1765
// module chunks = 4

View file

@ -0,0 +1,41 @@
/* eslint-env node, browser */
'use strict'
/**
* this is a mapping of keys that require shift on a US keypad
* back to the non shift equivelents
*
* this is so you can use keyup events with these keys
*
* note that this will only work reliably on US keyboards
*
* @type {Object}
*/
module.exports = {
'~': '`',
'!': '1',
'@': '2',
'#': '3',
'$': '4',
'%': '5',
'^': '6',
'&': '7',
'*': '8',
'(': '9',
')': '0',
'_': '-',
'+': '=',
':': ';',
'"': "'",
'<': ',',
'>': '.',
'?': '/',
'|': '\\'
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/shift-map.js
// module id = 1766
// module chunks = 4

View file

@ -0,0 +1,23 @@
/* eslint-env node, browser */
'use strict'
/**
* this is a list of special strings you can use to map
* to modifier keys when you specify your keyboard shortcuts
*
* @type {Object}
*/
module.exports = {
'option': 'alt',
'command': 'meta',
'return': 'enter',
'escape': 'esc',
'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/special-aliases.js
// module id = 1767
// module chunks = 4

View file

@ -0,0 +1,36 @@
/* eslint-env node, browser */
'use strict'
/**
* mapping for special characters so they can support
*
* this dictionary is only used incase you want to bind a
* keyup or keydown event to one of these keys
*
* @type {Object}
*/
module.exports = {
106: '*',
107: '+',
109: '-',
110: '.',
111: '/',
186: ';',
187: '=',
188: ',',
189: '-',
190: '.',
191: '/',
192: '`',
219: '[',
220: '\\',
221: ']',
222: "'"
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/special-characters-map.js
// module id = 1768
// module chunks = 4

View file

@ -0,0 +1,60 @@
/* eslint-env node, browser */
'use strict'
/**
* mapping of special keycodes to their corresponding keys
*
* everything in this dictionary cannot use keypress events
* so it has to be here to map to the correct keycodes for
* keyup/keydown events
*
* @type {Object}
*/
module.exports = {
8: 'backspace',
9: 'tab',
13: 'enter',
16: 'shift',
17: 'ctrl',
18: 'alt',
20: 'capslock',
27: 'esc',
32: 'space',
33: 'pageup',
34: 'pagedown',
35: 'end',
36: 'home',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
45: 'ins',
46: 'del',
91: 'meta',
93: 'meta',
187: 'plus',
189: 'minus',
224: 'meta'
}
/**
* loop through the f keys, f1 to f19 and add them to the map
* programatically
*/
for (var i = 1; i < 20; ++i) {
module.exports[111 + i] = 'f' + i
}
/**
* loop through to map numbers on the numeric keypad
*/
for (i = 0; i <= 9; ++i) {
module.exports[i + 96] = i
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/special-keys-map.js
// module id = 861
// module chunks = 4

View file

@ -0,0 +1,25 @@
/* eslint-env node, browser */
'use strict'
/**
* stops propogation for this event
*
* @param {Event} e
* @returns void
*/
module.exports = function (e) {
if (e.stopPropagation) {
e.stopPropagation()
return
}
e.cancelBubble = true
}
//////////////////
// WEBPACK FOOTER
// ./~/combokeys/helpers/stopPropagation.js
// module id = 1769
// module chunks = 4