diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..e67c2da --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,47 @@ +version: 2 +jobs: + build: + working_directory: ~/iFgR/vue-shortkey + parallelism: 1 + shell: /bin/bash --login + + environment: + CIRCLE_ARTIFACTS: /tmp/circleci-artifacts + CIRCLE_TEST_REPORTS: /tmp/circleci-test-results + + docker: + - image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37 + command: /sbin/init + + steps: + - checkout + - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS + - run: + working_directory: ~/iFgR/vue-shortkey + command: nvm install 7 && nvm alias default 7 + + - restore_cache: + keys: + - v1-dep-{{ .Branch }}- + - v1-dep-master- + - v1-dep- + + - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + - run: if [ -z "${NODE_ENV:-}" ]; then export NODE_ENV=test; fi + - run: export PATH="~/iFgR/vue-shortkey/node_modules/.bin:$PATH" + - run: npm install + + - save_cache: + key: v1-dep-{{ .Branch }}-{{ epoch }} + paths: + - ./node_modules + + - run: npm test + + - store_test_results: + path: /tmp/circleci-test-results + + - store_artifacts: + path: /tmp/circleci-artifacts + - store_artifacts: + path: /tmp/circleci-test-results diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 63f0201..0000000 --- a/circle.yml +++ /dev/null @@ -1,14 +0,0 @@ -machine: - node: - version: 7 - -dependencies: - pre: - - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - -deployment: - production: - tag: /v[0-9]+(\.[0-9]+)*/ - commands: - - npm run build - - npm publish diff --git a/dist/index.js b/dist/index.js index c71fe1a..2ee0f11 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("VueShortkey",[],t):"object"==typeof exports?exports.VueShortkey=t():e.VueShortkey=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="../dist/",t(t.s=0)}([function(e,t,n){"use strict";(function(r){function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&o>-1?c[r].el.splice(o,1):delete c[r],a=a.filter(function(e){return!e===t})}};u.install=function(e,t){s=[].concat(o(t&&t.prevent?t.prevent:[])),e.directive("shortkey",{bind:function(e,t,n){var r=f(t.value);p(r,e,t,n)},update:function(e,t,n){var r=f(t.oldValue);y(r,e);var o=f(t.value);p(o,e,t,n)},unbind:function(e,t){var n=f(t.value);y(n,e)}})},u.decodeKey=function(e){var t="";return("Shift"===e.key||e.shiftKey)&&(t+="shift"),("Control"===e.key||e.ctrlKey)&&(t+="ctrl"),("Meta"===e.key||e.metaKey)&&(t+="meta"),("Alt"===e.key||e.altKey)&&(t+="alt"),"ArrowUp"===e.key&&(t+="arrowup"),"ArrowLeft"===e.key&&(t+="arrowleft"),"ArrowRight"===e.key&&(t+="arrowright"),"ArrowDown"===e.key&&(t+="arrowdown"),"AltGraph"===e.key&&(t+="altgraph"),"Escape"===e.key&&(t+="esc"),"Enter"===e.key&&(t+="enter"),"Tab"===e.key&&(t+="tab")," "===e.key&&(t+="space"),"PageUp"===e.key&&(t+="pageup"),"PageDown"===e.key&&(t+="pagedown"),"Home"===e.key&&(t+="home"),"End"===e.key&&(t+="end"),"Delete"===e.key&&(t+="del"),"Insert"===e.key&&(t+="insert"),"NumLock"===e.key&&(t+="numlock"),"CapsLock"===e.key&&(t+="capslock"),"Pause"===e.key&&(t+="pause"),"ContextMenu"===e.key&&(t+="contextmenu"),"ScrollLock"===e.key&&(t+="scrolllock"),"BrowserHome"===e.key&&(t+="browserhome"),"MediaSelect"===e.key&&(t+="mediaselect"),(e.key&&" "!==e.key&&1===e.key.length||/F\d{1,2}|\//g.test(e.key))&&(t+=e.key.toLowerCase()),t};var d=function(e){var t=new Event("shortkey",{bubbles:!1});c[e].key&&(t.srcKey=c[e].key);var n=c[e].el;n[n.length-1].dispatchEvent(t)};u.keyDown=function(e){(!c[e].once&&!c[e].push||c[e].push&&!l)&&d(e)},r&&Object({NODE_ENV:"production"})&&function(){document.addEventListener("keydown",function(e){var t=u.decodeKey(e);if(m(e))if(e.preventDefault(),e.stopPropagation(),c[t].focus)u.keyDown(t),l=!0;else if(!l){var n=c[t].el;n[n.length-1].focus(),l=!0}},!0),document.addEventListener("keyup",function(e){var t=u.decodeKey(e);m(e)&&(e.preventDefault(),e.stopPropagation(),(c[t].once||c[t].push)&&d(t)),l=!1},!0)}();var h=function(e){var t=e.b,n=e.push,r=e.once,o=e.focus,i=e.el;for(var u in t){var a=t[u].join(""),s=c[a]&&c[a].el?c[a].el:[];s.push(i),c[a]={push:n,once:r,focus:o,key:u,el:s}}},m=function(e){var t=u.decodeKey(e),n=a.find(function(e){return e===document.activeElement}),r=s.find(function(e){return document.activeElement&&document.activeElement.matches(e)});return!n&&c[t]&&!r};void 0!==e&&e.exports?e.exports=u:void 0!==(i=function(){return u}.call(t,n,t,e))&&(e.exports=i)}).call(t,n(1))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function u(){h&&y&&(h=!1,y.length?d=y.concat(d):m=-1,d.length&&c())}function c(){if(!h){var e=o(u);h=!0;for(var t=d.length;t;){for(y=d,d=[];++m1)for(var n=1;n1&&o>-1?u[r].el.splice(o,1):delete u[r]}};c.install=function(e,t){l=[].concat(o(t&&t.prevent?t.prevent:[])),e.directive("shortkey",{bind:function(e,t,n){var r=f(t.value);y(r,e,t,n)},update:function(e,t,n){var r=f(t.oldValue);p(r,e);var o=f(t.value);y(o,e,t,n)},unbind:function(e,t){var n=f(t.value);p(n,e)}})},c.decodeKey=function(e){return d(e)},c.encodeKey=function(e){var t={};t.shiftKey=e.includes("shift"),t.ctrlKey=e.includes("ctrl"),t.metaKey=e.includes("meta"),t.altKey=e.includes("alt");var n=d(t);return n+=e.filter(function(e){return!["shift","ctrl","meta","alt"].includes(e)}).join("")};var d=function(e){var t="";return("Shift"===e.key||e.shiftKey)&&(t+="shift"),("Control"===e.key||e.ctrlKey)&&(t+="ctrl"),("Meta"===e.key||e.metaKey)&&(t+="meta"),("Alt"===e.key||e.altKey)&&(t+="alt"),"ArrowUp"===e.key&&(t+="arrowup"),"ArrowLeft"===e.key&&(t+="arrowleft"),"ArrowRight"===e.key&&(t+="arrowright"),"ArrowDown"===e.key&&(t+="arrowdown"),"AltGraph"===e.key&&(t+="altgraph"),"Escape"===e.key&&(t+="esc"),"Enter"===e.key&&(t+="enter"),"Tab"===e.key&&(t+="tab")," "===e.key&&(t+="space"),"PageUp"===e.key&&(t+="pageup"),"PageDown"===e.key&&(t+="pagedown"),"Home"===e.key&&(t+="home"),"End"===e.key&&(t+="end"),"Delete"===e.key&&(t+="del"),"Insert"===e.key&&(t+="insert"),"NumLock"===e.key&&(t+="numlock"),"CapsLock"===e.key&&(t+="capslock"),"Pause"===e.key&&(t+="pause"),"ContextMenu"===e.key&&(t+="contextmenu"),"ScrollLock"===e.key&&(t+="scrolllock"),"BrowserHome"===e.key&&(t+="browserhome"),"MediaSelect"===e.key&&(t+="mediaselect"),(e.key&&" "!==e.key&&1===e.key.length||/F\d{1,2}|\//g.test(e.key))&&(t+=e.key.toLowerCase()),t},h=function(e){var t=new Event("shortkey",{bubbles:!1});u[e].key&&(t.srcKey=u[e].key);var n=u[e].el;n[n.length-1].dispatchEvent(t)};c.keyDown=function(e){(!u[e].once&&!u[e].push||u[e].push&&!s)&&h(e)},r&&Object({NODE_ENV:"production"})&&function(){document.addEventListener("keydown",function(e){var t=c.decodeKey(e);if(v(t))if(e.preventDefault(),e.stopPropagation(),u[t].focus)c.keyDown(t),s=!0;else if(!s){var n=u[t].el;n[n.length-1].focus(),s=!0}},!0),document.addEventListener("keyup",function(e){var t=c.decodeKey(e);v(t)&&(e.preventDefault(),e.stopPropagation(),(u[t].once||u[t].push)&&h(t)),s=!1},!0)}();var m=function(e){var t=e.b,n=e.push,r=e.once,o=e.focus,i=e.el;for(var a in t){var l=c.encodeKey(t[a]),s=u[l]&&u[l].el?u[l].el:[];s.push(i),u[l]={push:n,once:r,focus:o,key:a,el:s}}},v=function(e){var t=!!a.find(function(e){return e===document.activeElement}),n=!!l.find(function(e){return document.activeElement&&document.activeElement.matches(e)});return!!u[e]&&!(t||n)};void 0!==e&&e.exports?e.exports=c:void 0!==(i=function(){return c}.call(t,n,t,e))&&(e.exports=i)}).call(t,n(1))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(s===setTimeout)return setTimeout(e,0);if((s===n||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function c(){h&&p&&(h=!1,p.length?d=p.concat(d):m=-1,d.length&&u())}function u(){if(!h){var e=o(c);h=!0;for(var t=d.length;t;){for(p=d,d=[];++m1)for(var n=1;n 1 && idxElm > -1) {\n mapFunctions[k].el.splice(idxElm, 1);\n } else {\n delete mapFunctions[k];\n }\n\n objAvoided = objAvoided.filter(function (itm) {\n return !itm === el;\n });\n }\n};\n\nShortKey.install = function (Vue, options) {\n elementAvoided = [].concat(_toConsumableArray(options && options.prevent ? options.prevent : []));\n Vue.directive('shortkey', {\n bind: function bind(el, binding, vnode) {\n // Mapping the commands\n var value = parseValue(binding.value);\n bindValue(value, el, binding, vnode);\n },\n update: function update(el, binding, vnode) {\n var oldValue = parseValue(binding.oldValue);\n unbindValue(oldValue, el);\n\n var newValue = parseValue(binding.value);\n bindValue(newValue, el, binding, vnode);\n },\n unbind: function unbind(el, binding) {\n var value = parseValue(binding.value);\n unbindValue(value, el);\n }\n });\n};\n\nShortKey.decodeKey = function (pKey) {\n var k = '';\n if (pKey.key === 'Shift' || pKey.shiftKey) {\n k += 'shift';\n }\n if (pKey.key === 'Control' || pKey.ctrlKey) {\n k += 'ctrl';\n }\n if (pKey.key === 'Meta' || pKey.metaKey) {\n k += 'meta';\n }\n if (pKey.key === 'Alt' || pKey.altKey) {\n k += 'alt';\n }\n if (pKey.key === 'ArrowUp') {\n k += 'arrowup';\n }\n if (pKey.key === 'ArrowLeft') {\n k += 'arrowleft';\n }\n if (pKey.key === 'ArrowRight') {\n k += 'arrowright';\n }\n if (pKey.key === 'ArrowDown') {\n k += 'arrowdown';\n }\n if (pKey.key === 'AltGraph') {\n k += 'altgraph';\n }\n if (pKey.key === 'Escape') {\n k += 'esc';\n }\n if (pKey.key === 'Enter') {\n k += 'enter';\n }\n if (pKey.key === 'Tab') {\n k += 'tab';\n }\n if (pKey.key === ' ') {\n k += 'space';\n }\n if (pKey.key === 'PageUp') {\n k += 'pageup';\n }\n if (pKey.key === 'PageDown') {\n k += 'pagedown';\n }\n if (pKey.key === 'Home') {\n k += 'home';\n }\n if (pKey.key === 'End') {\n k += 'end';\n }\n if (pKey.key === 'Delete') {\n k += 'del';\n }\n if (pKey.key === 'Insert') {\n k += 'insert';\n }\n if (pKey.key === 'NumLock') {\n k += 'numlock';\n }\n if (pKey.key === 'CapsLock') {\n k += 'capslock';\n }\n if (pKey.key === 'Pause') {\n k += 'pause';\n }\n if (pKey.key === 'ContextMenu') {\n k += 'contextmenu';\n }\n if (pKey.key === 'ScrollLock') {\n k += 'scrolllock';\n }\n if (pKey.key === 'BrowserHome') {\n k += 'browserhome';\n }\n if (pKey.key === 'MediaSelect') {\n k += 'mediaselect';\n }\n if (pKey.key && pKey.key !== ' ' && pKey.key.length === 1 || /F\\d{1,2}|\\//g.test(pKey.key)) k += pKey.key.toLowerCase();\n return k;\n};\n\nvar dispatchShortkeyEvent = function dispatchShortkeyEvent(pKey) {\n var e = new Event('shortkey', { bubbles: false });\n if (mapFunctions[pKey].key) e.srcKey = mapFunctions[pKey].key;\n var elm = mapFunctions[pKey].el;\n elm[elm.length - 1].dispatchEvent(e);\n};\n\nShortKey.keyDown = function (pKey) {\n if (!mapFunctions[pKey].once && !mapFunctions[pKey].push || mapFunctions[pKey].push && !keyPressed) {\n dispatchShortkeyEvent(pKey);\n }\n};\n\nif (process && Object({\"NODE_ENV\":\"production\"}) && \"production\" !== 'test') {\n ;(function () {\n document.addEventListener('keydown', function (pKey) {\n var decodedKey = ShortKey.decodeKey(pKey);\n\n // Check evict\n if (filteringElement(pKey)) {\n pKey.preventDefault();\n pKey.stopPropagation();\n if (mapFunctions[decodedKey].focus) {\n ShortKey.keyDown(decodedKey);\n keyPressed = true;\n } else if (!keyPressed) {\n var elm = mapFunctions[decodedKey].el;\n elm[elm.length - 1].focus();\n keyPressed = true;\n }\n }\n }, true);\n\n document.addEventListener('keyup', function (pKey) {\n var decodedKey = ShortKey.decodeKey(pKey);\n if (filteringElement(pKey)) {\n pKey.preventDefault();\n pKey.stopPropagation();\n if (mapFunctions[decodedKey].once || mapFunctions[decodedKey].push) {\n dispatchShortkeyEvent(decodedKey);\n }\n }\n keyPressed = false;\n }, true);\n })();\n}\n\nvar mappingFunctions = function mappingFunctions(_ref) {\n var b = _ref.b,\n push = _ref.push,\n once = _ref.once,\n focus = _ref.focus,\n el = _ref.el;\n\n for (var key in b) {\n var k = b[key].join('');\n var elm = mapFunctions[k] && mapFunctions[k].el ? mapFunctions[k].el : [];\n elm.push(el);\n mapFunctions[k] = {\n push: push,\n once: once,\n focus: focus,\n key: key,\n el: elm\n };\n }\n};\n\nvar filteringElement = function filteringElement(pKey) {\n var decodedKey = ShortKey.decodeKey(pKey);\n var objectAvoid = objAvoided.find(function (r) {\n return r === document.activeElement;\n });\n\n var filterAvoid = elementAvoided.find(function (selector) {\n return document.activeElement && document.activeElement.matches(selector);\n });\n return !objectAvoid && mapFunctions[decodedKey] && !filterAvoid;\n};\n\nif (typeof module != 'undefined' && module.exports) {\n module.exports = ShortKey;\n} else if (true) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return ShortKey;\n }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n window.ShortKey = ShortKey;\n}\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nif (!Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n}\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// index.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"../dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7d54d763ecc51bedc2f0","import 'element-matches';\n\nlet ShortKey = {}\nlet mapFunctions = {}\nlet objAvoided = []\nlet elementAvoided = []\nlet keyPressed = false\n\nconst parseValue = (value) => {\n value = typeof value === 'string' ? JSON.parse(value.replace(/\\'/gi, '\"')) : value\n if (value instanceof Array) {\n return {'': value};\n }\n return value\n}\n\nconst bindValue = (value, el, binding, vnode) => {\n const push = binding.modifiers.push === true\n const avoid = binding.modifiers.avoid === true\n const focus = !binding.modifiers.focus === true\n const once = binding.modifiers.once === true\n if (avoid) {\n objAvoided.push(el)\n } else {\n mappingFunctions({b: value, push, once, focus, el: vnode.elm})\n }\n}\n\nconst unbindValue = (value, el) => {\n for (let item in value) {\n const k = value[item].join('')\n const idxElm = mapFunctions[k].el.indexOf(el)\n if (mapFunctions[k].el.length > 1 && idxElm > -1) {\n mapFunctions[k].el.splice(idxElm, 1)\n } else {\n delete mapFunctions[k]\n }\n\n objAvoided = objAvoided.filter((itm) => {\n return !itm === el;\n })\n }\n}\n\nShortKey.install = (Vue, options) => {\n elementAvoided = [...(options && options.prevent ? options.prevent : [])]\n Vue.directive('shortkey', {\n bind: (el, binding, vnode) => {\n // Mapping the commands\n const value = parseValue(binding.value)\n bindValue(value, el, binding, vnode)\n },\n update: (el, binding, vnode) => {\n const oldValue = parseValue(binding.oldValue)\n unbindValue(oldValue, el)\n\n const newValue = parseValue(binding.value)\n bindValue(newValue, el, binding, vnode)\n },\n unbind: (el, binding) => {\n const value = parseValue(binding.value)\n unbindValue(value, el)\n }\n })\n}\n\nShortKey.decodeKey = (pKey) => {\n let k = ''\n if (pKey.key === 'Shift' || pKey.shiftKey) { k += 'shift' }\n if (pKey.key === 'Control' || pKey.ctrlKey) { k += 'ctrl' }\n if (pKey.key === 'Meta'|| pKey.metaKey) { k += 'meta' }\n if (pKey.key === 'Alt' || pKey.altKey) { k += 'alt' }\n if (pKey.key === 'ArrowUp') { k += 'arrowup' }\n if (pKey.key === 'ArrowLeft') { k += 'arrowleft' }\n if (pKey.key === 'ArrowRight') { k += 'arrowright' }\n if (pKey.key === 'ArrowDown') { k += 'arrowdown' }\n if (pKey.key === 'AltGraph') { k += 'altgraph' }\n if (pKey.key === 'Escape') { k += 'esc' }\n if (pKey.key === 'Enter') { k += 'enter' }\n if (pKey.key === 'Tab') { k += 'tab' }\n if (pKey.key === ' ') { k += 'space' }\n if (pKey.key === 'PageUp') { k += 'pageup' }\n if (pKey.key === 'PageDown') { k += 'pagedown' }\n if (pKey.key === 'Home') { k += 'home' }\n if (pKey.key === 'End') { k += 'end' }\n if (pKey.key === 'Delete') { k += 'del' }\n if (pKey.key === 'Insert') { k += 'insert' }\n if (pKey.key === 'NumLock') { k += 'numlock' }\n if (pKey.key === 'CapsLock') { k += 'capslock' }\n if (pKey.key === 'Pause') { k += 'pause' }\n if (pKey.key === 'ContextMenu') { k += 'contextmenu' }\n if (pKey.key === 'ScrollLock') { k += 'scrolllock' }\n if (pKey.key === 'BrowserHome') { k += 'browserhome' }\n if (pKey.key === 'MediaSelect') { k += 'mediaselect' }\n if ((pKey.key && pKey.key !== ' ' && pKey.key.length === 1) || /F\\d{1,2}|\\//g.test(pKey.key)) k += pKey.key.toLowerCase()\n return k\n}\n\nconst dispatchShortkeyEvent = (pKey) => {\n const e = new Event('shortkey', { bubbles: false })\n if (mapFunctions[pKey].key) e.srcKey = mapFunctions[pKey].key\n const elm = mapFunctions[pKey].el\n elm[elm.length - 1].dispatchEvent(e)\n}\n\nShortKey.keyDown = (pKey) => {\n if ((!mapFunctions[pKey].once && !mapFunctions[pKey].push) || (mapFunctions[pKey].push && !keyPressed)) {\n dispatchShortkeyEvent(pKey)\n }\n}\n\nif (process && process.env && process.env.NODE_ENV !== 'test') {\n ;(function () {\n document.addEventListener('keydown', (pKey) => {\n const decodedKey = ShortKey.decodeKey(pKey)\n\n // Check evict\n if (filteringElement(pKey)) {\n pKey.preventDefault()\n pKey.stopPropagation()\n if (mapFunctions[decodedKey].focus) {\n ShortKey.keyDown(decodedKey)\n keyPressed = true\n } else if (!keyPressed) {\n const elm = mapFunctions[decodedKey].el\n elm[elm.length - 1].focus()\n keyPressed = true\n }\n }\n }, true)\n\n document.addEventListener('keyup', (pKey) => {\n const decodedKey = ShortKey.decodeKey(pKey)\n if (filteringElement(pKey)) {\n pKey.preventDefault()\n pKey.stopPropagation()\n if (mapFunctions[decodedKey].once || mapFunctions[decodedKey].push) {\n dispatchShortkeyEvent(decodedKey);\n }\n }\n keyPressed = false\n }, true)\n })()\n}\n\nconst mappingFunctions = ({b, push, once, focus, el}) => {\n for (let key in b) {\n const k = b[key].join('')\n const elm = mapFunctions[k] && mapFunctions[k].el ? mapFunctions[k].el : []\n elm.push(el)\n mapFunctions[k] = {\n push,\n once,\n focus,\n key,\n el: elm\n }\n }\n}\n\nconst filteringElement = (pKey) => {\n const decodedKey = ShortKey.decodeKey(pKey)\n const objectAvoid = objAvoided.find(r => r === document.activeElement)\n\n const filterAvoid = elementAvoided.find(selector => document.activeElement && document.activeElement.matches(selector))\n return !objectAvoid && mapFunctions[decodedKey] && !filterAvoid\n}\n\nif (typeof module != 'undefined' && module.exports) {\n module.exports = ShortKey;\n} else if (typeof define == 'function' && define.amd) {\n define( function () { return ShortKey; } );\n} else {\n window.ShortKey = ShortKey;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/process/browser.js\n// module id = 1\n// module chunks = 0","if (!Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/element-matches/index.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///index.js","webpack:///webpack/bootstrap 8ac9085d223905f92bdf","webpack:///./src/index.js","webpack:///./node_modules/process/browser.js","webpack:///./node_modules/element-matches/index.js"],"names":["root","factory","exports","module","define","amd","self","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","process","_toConsumableArray","arr","Array","isArray","arr2","length","from","__WEBPACK_AMD_DEFINE_RESULT__","ShortKey","mapFunctions","objAvoided","elementAvoided","keyPressed","parseValue","value","JSON","parse","replace","","bindValue","el","binding","vnode","push","modifiers","avoid","focus","once","filter","itm","mappingFunctions","b","elm","unbindValue","key","k","encodeKey","idxElm","indexOf","splice","install","Vue","options","prevent","directive","bind","update","oldValue","newValue","unbind","decodeKey","pKey","createShortcutIndex","shortKey","shiftKey","includes","ctrlKey","metaKey","altKey","indexedKeys","item","join","test","toLowerCase","dispatchShortkeyEvent","e","Event","bubbles","srcKey","dispatchEvent","keyDown","NODE_ENV","document","addEventListener","decodedKey","availableElement","preventDefault","stopPropagation","_ref","objectIsAvoided","find","r","activeElement","filterAvoided","selector","matches","undefined","defaultSetTimout","Error","defaultClearTimeout","runTimeout","fun","cachedSetTimeout","setTimeout","runClearTimeout","marker","cachedClearTimeout","clearTimeout","cleanUpNextTick","draining","currentQueue","queue","concat","queueIndex","drainQueue","timeout","len","run","Item","array","noop","nextTick","args","arguments","apply","title","browser","env","argv","version","versions","on","addListener","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","cwd","chdir","dir","umask","Element","matchesSelector","msMatchesSelector","webkitMatchesSelector"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,iBAAAH,GACA,gBAAAC,SACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,KACC,mBAAAK,WAAAC,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAR,OAGA,IAAAC,GAAAQ,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAX,WAUA,OANAM,GAAAE,GAAAI,KAAAX,EAAAD,QA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EAAA8H,mBAAAf,EACA/G,EAAA+H,KAAAhB,EACA/G,EAAAgI,gBAAAjB,EACA/G,EAAAiI,oBAAAlB,EAEA/G,EAAAkI,UAAA,SAAAlJ,GAAqC,UAErCgB,EAAAsB,QAAA,SAAAtC,GACA,SAAAyG,OAAA,qCAGAzF,EAAAmI,IAAA,WAA2B,WAC3BnI,EAAAoI,MAAA,SAAAC,GACA,SAAA5C,OAAA,mCAEAzF,EAAAsI,MAAA,WAA4B,WH4VtB,SAAUrK,EAAQD,GInhBxBuK,QAAA3I,UAAA0F,UACAiD,QAAA3I,UAAA0F,QACAiD,QAAA3I,UAAA4I,iBACAD,QAAA3I,UAAA6I,mBACAF,QAAA3I,UAAA8I","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueShortkey\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueShortkey\"] = factory();\n\telse\n\t\troot[\"VueShortkey\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueShortkey\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueShortkey\"] = factory();\n\telse\n\t\troot[\"VueShortkey\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"../dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(process) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n__webpack_require__(2);\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar ShortKey = {};\nvar mapFunctions = {};\nvar objAvoided = [];\nvar elementAvoided = [];\nvar keyPressed = false;\n\nvar parseValue = function parseValue(value) {\n value = typeof value === 'string' ? JSON.parse(value.replace(/\\'/gi, '\"')) : value;\n if (value instanceof Array) {\n return { '': value };\n }\n return value;\n};\n\nvar bindValue = function bindValue(value, el, binding, vnode) {\n var push = binding.modifiers.push === true;\n var avoid = binding.modifiers.avoid === true;\n var focus = !binding.modifiers.focus === true;\n var once = binding.modifiers.once === true;\n if (avoid) {\n objAvoided = objAvoided.filter(function (itm) {\n return !itm === el;\n });\n objAvoided.push(el);\n } else {\n mappingFunctions({ b: value, push: push, once: once, focus: focus, el: vnode.elm });\n }\n};\n\nvar unbindValue = function unbindValue(value, el) {\n for (var key in value) {\n var k = ShortKey.encodeKey(value[key]);\n var idxElm = mapFunctions[k].el.indexOf(el);\n if (mapFunctions[k].el.length > 1 && idxElm > -1) {\n mapFunctions[k].el.splice(idxElm, 1);\n } else {\n delete mapFunctions[k];\n }\n }\n};\n\nShortKey.install = function (Vue, options) {\n elementAvoided = [].concat(_toConsumableArray(options && options.prevent ? options.prevent : []));\n Vue.directive('shortkey', {\n bind: function bind(el, binding, vnode) {\n // Mapping the commands\n var value = parseValue(binding.value);\n bindValue(value, el, binding, vnode);\n },\n update: function update(el, binding, vnode) {\n var oldValue = parseValue(binding.oldValue);\n unbindValue(oldValue, el);\n\n var newValue = parseValue(binding.value);\n bindValue(newValue, el, binding, vnode);\n },\n unbind: function unbind(el, binding) {\n var value = parseValue(binding.value);\n unbindValue(value, el);\n }\n });\n};\n\nShortKey.decodeKey = function (pKey) {\n return createShortcutIndex(pKey);\n};\nShortKey.encodeKey = function (pKey) {\n var shortKey = {};\n shortKey.shiftKey = pKey.includes('shift');\n shortKey.ctrlKey = pKey.includes('ctrl');\n shortKey.metaKey = pKey.includes('meta');\n shortKey.altKey = pKey.includes('alt');\n var indexedKeys = createShortcutIndex(shortKey);\n var vKey = pKey.filter(function (item) {\n return !['shift', 'ctrl', 'meta', 'alt'].includes(item);\n });\n indexedKeys += vKey.join('');\n return indexedKeys;\n};\n\nvar createShortcutIndex = function createShortcutIndex(pKey) {\n var k = '';\n if (pKey.key === 'Shift' || pKey.shiftKey) {\n k += 'shift';\n }\n if (pKey.key === 'Control' || pKey.ctrlKey) {\n k += 'ctrl';\n }\n if (pKey.key === 'Meta' || pKey.metaKey) {\n k += 'meta';\n }\n if (pKey.key === 'Alt' || pKey.altKey) {\n k += 'alt';\n }\n if (pKey.key === 'ArrowUp') {\n k += 'arrowup';\n }\n if (pKey.key === 'ArrowLeft') {\n k += 'arrowleft';\n }\n if (pKey.key === 'ArrowRight') {\n k += 'arrowright';\n }\n if (pKey.key === 'ArrowDown') {\n k += 'arrowdown';\n }\n if (pKey.key === 'AltGraph') {\n k += 'altgraph';\n }\n if (pKey.key === 'Escape') {\n k += 'esc';\n }\n if (pKey.key === 'Enter') {\n k += 'enter';\n }\n if (pKey.key === 'Tab') {\n k += 'tab';\n }\n if (pKey.key === ' ') {\n k += 'space';\n }\n if (pKey.key === 'PageUp') {\n k += 'pageup';\n }\n if (pKey.key === 'PageDown') {\n k += 'pagedown';\n }\n if (pKey.key === 'Home') {\n k += 'home';\n }\n if (pKey.key === 'End') {\n k += 'end';\n }\n if (pKey.key === 'Delete') {\n k += 'del';\n }\n if (pKey.key === 'Insert') {\n k += 'insert';\n }\n if (pKey.key === 'NumLock') {\n k += 'numlock';\n }\n if (pKey.key === 'CapsLock') {\n k += 'capslock';\n }\n if (pKey.key === 'Pause') {\n k += 'pause';\n }\n if (pKey.key === 'ContextMenu') {\n k += 'contextmenu';\n }\n if (pKey.key === 'ScrollLock') {\n k += 'scrolllock';\n }\n if (pKey.key === 'BrowserHome') {\n k += 'browserhome';\n }\n if (pKey.key === 'MediaSelect') {\n k += 'mediaselect';\n }\n if (pKey.key && pKey.key !== ' ' && pKey.key.length === 1 || /F\\d{1,2}|\\//g.test(pKey.key)) k += pKey.key.toLowerCase();\n return k;\n};\n\nvar dispatchShortkeyEvent = function dispatchShortkeyEvent(pKey) {\n var e = new Event('shortkey', { bubbles: false });\n if (mapFunctions[pKey].key) e.srcKey = mapFunctions[pKey].key;\n var elm = mapFunctions[pKey].el;\n elm[elm.length - 1].dispatchEvent(e);\n};\n\nShortKey.keyDown = function (pKey) {\n if (!mapFunctions[pKey].once && !mapFunctions[pKey].push || mapFunctions[pKey].push && !keyPressed) {\n dispatchShortkeyEvent(pKey);\n }\n};\n\nif (process && Object({\"NODE_ENV\":\"production\"}) && \"production\" !== 'test') {\n ;(function () {\n document.addEventListener('keydown', function (pKey) {\n var decodedKey = ShortKey.decodeKey(pKey);\n // Check avoidable elements\n if (availableElement(decodedKey)) {\n pKey.preventDefault();\n pKey.stopPropagation();\n if (mapFunctions[decodedKey].focus) {\n ShortKey.keyDown(decodedKey);\n keyPressed = true;\n } else if (!keyPressed) {\n var elm = mapFunctions[decodedKey].el;\n elm[elm.length - 1].focus();\n keyPressed = true;\n }\n }\n }, true);\n\n document.addEventListener('keyup', function (pKey) {\n var decodedKey = ShortKey.decodeKey(pKey);\n if (availableElement(decodedKey)) {\n pKey.preventDefault();\n pKey.stopPropagation();\n if (mapFunctions[decodedKey].once || mapFunctions[decodedKey].push) {\n dispatchShortkeyEvent(decodedKey);\n }\n }\n keyPressed = false;\n }, true);\n })();\n}\n\nvar mappingFunctions = function mappingFunctions(_ref) {\n var b = _ref.b,\n push = _ref.push,\n once = _ref.once,\n focus = _ref.focus,\n el = _ref.el;\n\n for (var key in b) {\n var k = ShortKey.encodeKey(b[key]);\n var elm = mapFunctions[k] && mapFunctions[k].el ? mapFunctions[k].el : [];\n elm.push(el);\n mapFunctions[k] = {\n push: push,\n once: once,\n focus: focus,\n key: key,\n el: elm\n };\n }\n};\n\nvar availableElement = function availableElement(decodedKey) {\n var objectIsAvoided = !!objAvoided.find(function (r) {\n return r === document.activeElement;\n });\n var filterAvoided = !!elementAvoided.find(function (selector) {\n return document.activeElement && document.activeElement.matches(selector);\n });\n return !!mapFunctions[decodedKey] && !(objectIsAvoided || filterAvoided);\n};\n\nif (typeof module != 'undefined' && module.exports) {\n module.exports = ShortKey;\n} else if (true) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return ShortKey;\n }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n window.ShortKey = ShortKey;\n}\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nif (!Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n}\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// index.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"../dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 8ac9085d223905f92bdf","import 'element-matches';\n\nlet ShortKey = {}\nlet mapFunctions = {}\nlet objAvoided = []\nlet elementAvoided = []\nlet keyPressed = false\n\nconst parseValue = (value) => {\n value = typeof value === 'string' ? JSON.parse(value.replace(/\\'/gi, '\"')) : value\n if (value instanceof Array) {\n return {'': value};\n }\n return value\n}\n\nconst bindValue = (value, el, binding, vnode) => {\n const push = binding.modifiers.push === true\n const avoid = binding.modifiers.avoid === true\n const focus = !binding.modifiers.focus === true\n const once = binding.modifiers.once === true\n if (avoid) {\n objAvoided = objAvoided.filter((itm) => {\n return !itm === el;\n })\n objAvoided.push(el)\n } else {\n mappingFunctions({b: value, push, once, focus, el: vnode.elm})\n }\n}\n\nconst unbindValue = (value, el) => {\n for (let key in value) {\n const k = ShortKey.encodeKey(value[key])\n const idxElm = mapFunctions[k].el.indexOf(el)\n if (mapFunctions[k].el.length > 1 && idxElm > -1) {\n mapFunctions[k].el.splice(idxElm, 1)\n } else {\n delete mapFunctions[k]\n }\n }\n}\n\nShortKey.install = (Vue, options) => {\n elementAvoided = [...(options && options.prevent ? options.prevent : [])]\n Vue.directive('shortkey', {\n bind: (el, binding, vnode) => {\n // Mapping the commands\n const value = parseValue(binding.value)\n bindValue(value, el, binding, vnode)\n },\n update: (el, binding, vnode) => {\n const oldValue = parseValue(binding.oldValue)\n unbindValue(oldValue, el)\n\n const newValue = parseValue(binding.value)\n bindValue(newValue, el, binding, vnode)\n },\n unbind: (el, binding) => {\n const value = parseValue(binding.value)\n unbindValue(value, el)\n }\n })\n}\n\nShortKey.decodeKey = (pKey) => createShortcutIndex(pKey)\nShortKey.encodeKey = (pKey) => {\n const shortKey = {}\n shortKey.shiftKey = pKey.includes('shift')\n shortKey.ctrlKey = pKey.includes('ctrl')\n shortKey.metaKey = pKey.includes('meta')\n shortKey.altKey = pKey.includes('alt')\n let indexedKeys = createShortcutIndex(shortKey)\n const vKey = pKey.filter((item) => !['shift', 'ctrl', 'meta', 'alt'].includes(item))\n indexedKeys += vKey.join('')\n return indexedKeys\n}\n\nconst createShortcutIndex = (pKey) => {\n let k = ''\n if (pKey.key === 'Shift' || pKey.shiftKey) { k += 'shift' }\n if (pKey.key === 'Control' || pKey.ctrlKey) { k += 'ctrl' }\n if (pKey.key === 'Meta'|| pKey.metaKey) { k += 'meta' }\n if (pKey.key === 'Alt' || pKey.altKey) { k += 'alt' }\n if (pKey.key === 'ArrowUp') { k += 'arrowup' }\n if (pKey.key === 'ArrowLeft') { k += 'arrowleft' }\n if (pKey.key === 'ArrowRight') { k += 'arrowright' }\n if (pKey.key === 'ArrowDown') { k += 'arrowdown' }\n if (pKey.key === 'AltGraph') { k += 'altgraph' }\n if (pKey.key === 'Escape') { k += 'esc' }\n if (pKey.key === 'Enter') { k += 'enter' }\n if (pKey.key === 'Tab') { k += 'tab' }\n if (pKey.key === ' ') { k += 'space' }\n if (pKey.key === 'PageUp') { k += 'pageup' }\n if (pKey.key === 'PageDown') { k += 'pagedown' }\n if (pKey.key === 'Home') { k += 'home' }\n if (pKey.key === 'End') { k += 'end' }\n if (pKey.key === 'Delete') { k += 'del' }\n if (pKey.key === 'Insert') { k += 'insert' }\n if (pKey.key === 'NumLock') { k += 'numlock' }\n if (pKey.key === 'CapsLock') { k += 'capslock' }\n if (pKey.key === 'Pause') { k += 'pause' }\n if (pKey.key === 'ContextMenu') { k += 'contextmenu' }\n if (pKey.key === 'ScrollLock') { k += 'scrolllock' }\n if (pKey.key === 'BrowserHome') { k += 'browserhome' }\n if (pKey.key === 'MediaSelect') { k += 'mediaselect' }\n if ((pKey.key && pKey.key !== ' ' && pKey.key.length === 1) || /F\\d{1,2}|\\//g.test(pKey.key)) k += pKey.key.toLowerCase()\n return k\n}\n\nconst dispatchShortkeyEvent = (pKey) => {\n const e = new Event('shortkey', { bubbles: false })\n if (mapFunctions[pKey].key) e.srcKey = mapFunctions[pKey].key\n const elm = mapFunctions[pKey].el\n elm[elm.length - 1].dispatchEvent(e)\n}\n\nShortKey.keyDown = (pKey) => {\n if ((!mapFunctions[pKey].once && !mapFunctions[pKey].push) || (mapFunctions[pKey].push && !keyPressed)) {\n dispatchShortkeyEvent(pKey)\n }\n}\n\nif (process && process.env && process.env.NODE_ENV !== 'test') {\n ;(function () {\n document.addEventListener('keydown', (pKey) => {\n const decodedKey = ShortKey.decodeKey(pKey)\n // Check avoidable elements\n if (availableElement(decodedKey)) {\n pKey.preventDefault()\n pKey.stopPropagation()\n if (mapFunctions[decodedKey].focus) {\n ShortKey.keyDown(decodedKey)\n keyPressed = true\n } else if (!keyPressed) {\n const elm = mapFunctions[decodedKey].el\n elm[elm.length - 1].focus()\n keyPressed = true\n }\n }\n }, true)\n\n document.addEventListener('keyup', (pKey) => {\n const decodedKey = ShortKey.decodeKey(pKey)\n if (availableElement(decodedKey)) {\n pKey.preventDefault()\n pKey.stopPropagation()\n if (mapFunctions[decodedKey].once || mapFunctions[decodedKey].push) {\n dispatchShortkeyEvent(decodedKey);\n }\n }\n keyPressed = false\n }, true)\n })()\n}\n\nconst mappingFunctions = ({b, push, once, focus, el}) => {\n for (let key in b) {\n const k = ShortKey.encodeKey(b[key])\n const elm = mapFunctions[k] && mapFunctions[k].el ? mapFunctions[k].el : []\n elm.push(el)\n mapFunctions[k] = {\n push,\n once,\n focus,\n key,\n el: elm\n }\n }\n}\n\nconst availableElement = (decodedKey) => {\n const objectIsAvoided = !!objAvoided.find(r => r === document.activeElement)\n const filterAvoided = !!(elementAvoided.find(selector => document.activeElement && document.activeElement.matches(selector)))\n return !!mapFunctions[decodedKey] && !(objectIsAvoided || filterAvoided)\n}\n\nif (typeof module != 'undefined' && module.exports) {\n module.exports = ShortKey;\n} else if (typeof define == 'function' && define.amd) {\n define( function () { return ShortKey; } );\n} else {\n window.ShortKey = ShortKey;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/process/browser.js\n// module id = 1\n// module chunks = 0","if (!Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/element-matches/index.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/index.js b/src/index.js index 7524583..d94d82a 100644 --- a/src/index.js +++ b/src/index.js @@ -175,7 +175,6 @@ const availableElement = (decodedKey) => { return !!mapFunctions[decodedKey] && !(objectIsAvoided || filterAvoided) } -export default ShortKey if (typeof module != 'undefined' && module.exports) { module.exports = ShortKey; } else if (typeof define == 'function' && define.amd) {