react-simple-kp-lib
Version:
Simple keypress lib to change the block color
1,648 lines (1,377 loc) • 40.8 kB
JavaScript
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(3);
} else {}
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
Keypress version 2.1.5 (c) 2018 David Mauro.
Licensed under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0
*/
(function () {
var o,
u,
x,
y,
z,
r,
v,
A,
E,
B,
F,
G,
q,
s,
p,
k,
t,
C,
H,
D = {}.hasOwnProperty,
j = [].indexOf || function (a) {
for (var c = 0, b = this.length; c < b; c++) {
if (c in this && this[c] === a) return c;
}
return -1;
};
r = {
is_unordered: !1,
is_counting: !1,
is_exclusive: !1,
is_solitary: !1,
prevent_default: !1,
prevent_repeat: !1,
normalize_caps_lock: !1
};
C = "meta alt option ctrl shift cmd".split(" ");
k = "ctrl";
o = {
debug: !1
};
var w = function w(a) {
var c, b;
for (c in a) {
D.call(a, c) && (b = a[c], !1 !== b && (this[c] = b));
}
this.keys = this.keys || [];
this.count = this.count || 0;
};
w.prototype.allows_key_repeat = function () {
return !this.prevent_repeat && "function" === typeof this.on_keydown;
};
w.prototype.reset = function () {
this.count = 0;
return this.keyup_fired = null;
};
var g = function g(a, c) {
var b, d;
"undefined" !== typeof jQuery && null !== jQuery && a instanceof jQuery && (1 !== a.length && p("Warning: your jQuery selector should have exactly one object."), a = a[0]);
this.should_force_event_defaults = this.should_suppress_event_defaults = !1;
this.sequence_delay = 800;
this._registered_combos = [];
this._keys_down = [];
this._active_combos = [];
this._sequence = [];
this._sequence_timer = null;
this._prevent_capture = !1;
this._defaults = c || {};
for (b in r) {
D.call(r, b) && (d = r[b], this._defaults[b] = this._defaults[b] || d);
}
this.element = a || document.body;
b = function b(a, _b, c) {
a.addEventListener ? a.addEventListener(_b, c) : a.attachEvent && a.attachEvent("on" + _b, c);
return c;
};
var e = this;
this.keydown_event = b(this.element, "keydown", function (a) {
a = a || window.event;
e._receive_input(a, true);
return e._bug_catcher(a);
});
var f = this;
this.keyup_event = b(this.element, "keyup", function (a) {
a = a || window.event;
return f._receive_input(a, false);
});
var h = this;
this.blur_event = b(window, "blur", function () {
var a, b, c, d;
d = h._keys_down;
b = 0;
for (c = d.length; b < c; b++) {
a = d[b];
h._key_up(a, {});
}
return h._keys_down = [];
});
};
g.prototype.destroy = function () {
var a;
a = function a(_a, b, d) {
if (null != _a.removeEventListener) return _a.removeEventListener(b, d);
if (null != _a.removeEvent) return _a.removeEvent("on" + b, d);
};
a(this.element, "keydown", this.keydown_event);
a(this.element, "keyup", this.keyup_event);
return a(window, "blur", this.blur_event);
};
g.prototype._bug_catcher = function (a) {
var c, b;
if ("cmd" === k && 0 <= j.call(this._keys_down, "cmd") && "cmd" !== (c = y(null != (b = a.keyCode) ? b : a.key)) && "shift" !== c && "alt" !== c && "caps" !== c && "tab" !== c) return this._receive_input(a, !1);
};
g.prototype._cmd_bug_check = function (a) {
return "cmd" === k && 0 <= j.call(this._keys_down, "cmd") && 0 > j.call(a, "cmd") ? !1 : !0;
};
g.prototype._prevent_default = function (a, c) {
if ((c || this.should_suppress_event_defaults) && !this.should_force_event_defaults) if (a.preventDefault ? a.preventDefault() : a.returnValue = !1, a.stopPropagation) return a.stopPropagation();
};
g.prototype._get_active_combos = function (a) {
var c, b;
c = [];
b = v(this._keys_down, function (b) {
return b !== a;
});
b.push(a);
this._match_combo_arrays(b, function (a) {
return function (b) {
if (a._cmd_bug_check(b.keys)) return c.push(b);
};
}(this));
this._fuzzy_match_combo_arrays(b, function (a) {
return function (b) {
if (!(0 <= j.call(c, b)) && !b.is_solitary && a._cmd_bug_check(b.keys)) return c.push(b);
};
}(this));
return c;
};
g.prototype._get_potential_combos = function (a) {
var c, b, d, e, f;
b = [];
f = this._registered_combos;
d = 0;
for (e = f.length; d < e; d++) {
c = f[d], c.is_sequence || 0 <= j.call(c.keys, a) && this._cmd_bug_check(c.keys) && b.push(c);
}
return b;
};
g.prototype._add_to_active_combos = function (a) {
var c, b, d, e, f, h, i, g, n, l, m;
h = !1;
f = !0;
d = !1;
if (0 <= j.call(this._active_combos, a)) return !0;
if (this._active_combos.length) {
e = i = 0;
for (l = this._active_combos.length; 0 <= l ? i < l : i > l; e = 0 <= l ? ++i : --i) {
if ((c = this._active_combos[e]) && c.is_exclusive && a.is_exclusive) {
c = c.keys;
if (!h) {
g = 0;
for (n = c.length; g < n; g++) {
if (b = c[g], h = !0, 0 > j.call(a.keys, b)) {
h = !1;
break;
}
}
}
if (f && !h) {
m = a.keys;
g = 0;
for (n = m.length; g < n; g++) {
if (b = m[g], f = !1, 0 > j.call(c, b)) {
f = !0;
break;
}
}
}
h && (d ? (c = this._active_combos.splice(e, 1)[0], null != c && c.reset()) : (c = this._active_combos.splice(e, 1, a)[0], null != c && c.reset(), d = !0), f = !1);
}
}
}
f && this._active_combos.unshift(a);
return h || f;
};
g.prototype._remove_from_active_combos = function (a) {
var c, b, d, e;
b = d = 0;
for (e = this._active_combos.length; 0 <= e ? d < e : d > e; b = 0 <= e ? ++d : --d) {
if (c = this._active_combos[b], c === a) {
a = this._active_combos.splice(b, 1)[0];
a.reset();
break;
}
}
};
g.prototype._get_possible_sequences = function () {
var a, c, b, d, e, f, h, i, g, n, l, m;
d = [];
n = this._registered_combos;
f = 0;
for (g = n.length; f < g; f++) {
a = n[f];
c = h = 1;
for (l = this._sequence.length; 1 <= l ? h <= l : h >= l; c = 1 <= l ? ++h : --h) {
if (e = this._sequence.slice(-c), a.is_sequence) {
if (0 > j.call(a.keys, "shift") && (e = v(e, function (a) {
return "shift" !== a;
}), !e.length)) continue;
c = i = 0;
for (m = e.length; 0 <= m ? i < m : i > m; c = 0 <= m ? ++i : --i) {
if (a.keys[c] === e[c]) b = !0;else {
b = !1;
break;
}
}
b && d.push(a);
}
}
}
return d;
};
g.prototype._add_key_to_sequence = function (a, c) {
var b, d, e, f;
this._sequence.push(a);
d = this._get_possible_sequences();
if (d.length) {
e = 0;
for (f = d.length; e < f; e++) {
b = d[e], this._prevent_default(c, b.prevent_default);
}
this._sequence_timer && clearTimeout(this._sequence_timer);
if (-1 < this.sequence_delay) {
var h = this;
this._sequence_timer = setTimeout(function () {
return h._sequence = [];
}, this.sequence_delay);
}
} else this._sequence = [];
};
g.prototype._get_sequence = function (a) {
var c, b, d, e, f, h, i, g, n, l, m, k;
l = this._registered_combos;
h = 0;
for (n = l.length; h < n; h++) {
if (c = l[h], c.is_sequence) {
b = i = 1;
for (m = this._sequence.length; 1 <= m ? i <= m : i >= m; b = 1 <= m ? ++i : --i) {
if (f = v(this._sequence, function (a) {
return 0 <= j.call(c.keys, "shift") ? !0 : "shift" !== a;
}).slice(-b), c.keys.length === f.length) {
b = g = 0;
for (k = f.length; 0 <= k ? g < k : g > k; b = 0 <= k ? ++g : --g) {
if (e = f[b], !(0 > j.call(c.keys, "shift") && "shift" === e) && !("shift" === a && 0 > j.call(c.keys, "shift"))) if (c.keys[b] === e) d = !0;else {
d = !1;
break;
}
}
}
}
if (d) return c.is_exclusive && (this._sequence = []), c;
}
}
return !1;
};
g.prototype._receive_input = function (a, c) {
var b, d;
if (this._prevent_capture) this._keys_down.length && (this._keys_down = []);else if (b = y(null != (d = a.keyCode) ? d : a.key), (c || this._keys_down.length || !("alt" === b || b === k)) && b) return c ? this._key_down(b, a) : this._key_up(b, a);
};
g.prototype._fire = function (a, c, b, d) {
"function" === typeof c["on_" + a] && this._prevent_default(b, !0 !== c["on_" + a].call(c["this"], b, c.count, d));
"release" === a && (c.count = 0);
if ("keyup" === a) return c.keyup_fired = !0;
};
g.prototype._match_combo_arrays = function (a, c) {
var b, d, e, f, h;
h = this._registered_combos;
e = 0;
for (f = h.length; e < f; e++) {
d = h[e], b = a.slice(0), d.normalize_caps_lock && 0 <= j.call(b, "caps") && b.splice(b.indexOf("caps"), 1), (!d.is_unordered && x(b, d.keys) || d.is_unordered && u(b, d.keys)) && c(d);
}
};
g.prototype._fuzzy_match_combo_arrays = function (a, c) {
var b, d, e, f;
f = this._registered_combos;
d = 0;
for (e = f.length; d < e; d++) {
b = f[d], (!b.is_unordered && B(b.keys, a) || b.is_unordered && E(b.keys, a)) && c(b);
}
};
g.prototype._keys_remain = function (a) {
var c, b, d, e;
e = a.keys;
b = 0;
for (d = e.length; b < d; b++) {
if (a = e[b], 0 <= j.call(this._keys_down, a)) {
c = !0;
break;
}
}
return c;
};
g.prototype._key_down = function (a, c) {
var b, d, e, f, h;
(b = z(a, c)) && (a = b);
this._add_key_to_sequence(a, c);
(b = this._get_sequence(a)) && this._fire("keydown", b, c);
for (e in t) {
b = t[e], c[b] && (e === a || 0 <= j.call(this._keys_down, e) || this._keys_down.push(e));
}
for (e in t) {
if (b = t[e], e !== a && 0 <= j.call(this._keys_down, e) && !c[b] && !("cmd" === e && "cmd" !== k)) {
b = d = 0;
for (f = this._keys_down.length; 0 <= f ? d < f : d > f; b = 0 <= f ? ++d : --d) {
this._keys_down[b] === e && this._keys_down.splice(b, 1);
}
}
}
d = this._get_active_combos(a);
e = this._get_potential_combos(a);
f = 0;
for (h = d.length; f < h; f++) {
b = d[f], this._handle_combo_down(b, e, a, c);
}
if (e.length) {
d = 0;
for (f = e.length; d < f; d++) {
b = e[d], this._prevent_default(c, b.prevent_default);
}
}
0 > j.call(this._keys_down, a) && this._keys_down.push(a);
};
g.prototype._handle_combo_down = function (a, c, b, d) {
var e, f, h, g, k;
if (0 > j.call(a.keys, b)) return !1;
this._prevent_default(d, a && a.prevent_default);
e = !1;
if (0 <= j.call(this._keys_down, b) && (e = !0, !a.allows_key_repeat())) return !1;
h = this._add_to_active_combos(a, b);
b = a.keyup_fired = !1;
if (a.is_exclusive) {
g = 0;
for (k = c.length; g < k; g++) {
if (f = c[g], f.is_exclusive && f.keys.length > a.keys.length) {
b = !0;
break;
}
}
}
if (!b && (a.is_counting && "function" === typeof a.on_keydown && (a.count += 1), h)) return this._fire("keydown", a, d, e);
};
g.prototype._key_up = function (a, c) {
var b, d, e, f, h, g;
b = a;
(e = z(a, c)) && (a = e);
e = s[b];
c.shiftKey ? e && 0 <= j.call(this._keys_down, e) || (a = b) : b && 0 <= j.call(this._keys_down, b) || (a = e);
(f = this._get_sequence(a)) && this._fire("keyup", f, c);
if (0 > j.call(this._keys_down, a)) return !1;
f = h = 0;
for (g = this._keys_down.length; 0 <= g ? h < g : h > g; f = 0 <= g ? ++h : --h) {
if ((d = this._keys_down[f]) === a || d === e || d === b) {
this._keys_down.splice(f, 1);
break;
}
}
d = this._active_combos.length;
e = [];
g = this._active_combos;
f = 0;
for (h = g.length; f < h; f++) {
b = g[f], 0 <= j.call(b.keys, a) && e.push(b);
}
f = 0;
for (h = e.length; f < h; f++) {
b = e[f], this._handle_combo_up(b, c, a);
}
if (1 < d) {
h = this._active_combos;
d = 0;
for (f = h.length; d < f; d++) {
b = h[d], void 0 === b || 0 <= j.call(e, b) || this._keys_remain(b) || this._remove_from_active_combos(b);
}
}
};
g.prototype._handle_combo_up = function (a, c, b) {
var d, e;
this._prevent_default(c, a && a.prevent_default);
e = this._keys_remain(a);
if (!a.keyup_fired && (d = this._keys_down.slice(), d.push(b), !a.is_solitary || u(d, a.keys))) this._fire("keyup", a, c), a.is_counting && "function" === typeof a.on_keyup && "function" !== typeof a.on_keydown && (a.count += 1);
e || (this._fire("release", a, c), this._remove_from_active_combos(a));
};
g.prototype.simple_combo = function (a, c) {
return this.register_combo({
keys: a,
on_keydown: c
});
};
g.prototype.counting_combo = function (a, c) {
return this.register_combo({
keys: a,
is_counting: !0,
is_unordered: !1,
on_keydown: c
});
};
g.prototype.sequence_combo = function (a, c) {
return this.register_combo({
keys: a,
on_keydown: c,
is_sequence: !0,
is_exclusive: !0
});
};
g.prototype.register_combo = function (a) {
var c, b, d;
"string" === typeof a.keys && (a.keys = a.keys.split(" "));
d = this._defaults;
for (c in d) {
D.call(d, c) && (b = d[c], void 0 === a[c] && (a[c] = b));
}
a = new w(a);
if (H(a)) return this._registered_combos.push(a), a;
};
g.prototype.register_many = function (a) {
var c, b, d, e;
e = [];
b = 0;
for (d = a.length; b < d; b++) {
c = a[b], e.push(this.register_combo(c));
}
return e;
};
g.prototype.unregister_combo = function (a) {
var c, b, d, e, f, g;
if (!a) return !1;
var i = this;
b = function b(a) {
var b, c, d, e;
e = [];
b = c = 0;
for (d = i._registered_combos.length; 0 <= d ? c < d : c > d; b = 0 <= d ? ++c : --c) {
if (a === i._registered_combos[b]) {
i._registered_combos.splice(b, 1);
break;
} else e.push(void 0);
}
return e;
};
if (a instanceof w) return b(a);
if ("string" === typeof a) {
a = a.split(" ");
c = d = 0;
for (e = a.length; 0 <= e ? d < e : d > e; c = 0 <= e ? ++d : --d) {
"meta" === a[c] && (a[c] = k);
}
}
f = this._registered_combos;
g = [];
d = 0;
for (e = f.length; d < e; d++) {
c = f[d], null != c && (c.is_unordered && u(a, c.keys) || !c.is_unordered && x(a, c.keys) ? g.push(b(c)) : g.push(void 0));
}
return g;
};
g.prototype.unregister_many = function (a) {
var c, b, d, e;
e = [];
b = 0;
for (d = a.length; b < d; b++) {
c = a[b], e.push(this.unregister_combo(c));
}
return e;
};
g.prototype.get_registered_combos = function () {
return this._registered_combos;
};
g.prototype.reset = function () {
return this._registered_combos = [];
};
g.prototype.listen = function () {
return this._prevent_capture = !1;
};
g.prototype.stop_listening = function () {
return this._prevent_capture = !0;
};
g.prototype.get_meta_key = function () {
return k;
};
o.Listener = g;
y = function y(a) {
return q[a];
};
v = function v(a, c) {
var b;
if (a.filter) return a.filter(c);
var d, e, f;
f = [];
d = 0;
for (e = a.length; d < e; d++) {
b = a[d], c(b) && f.push(b);
}
return f;
};
u = function u(a, c) {
var b, d, e;
if (a.length !== c.length) return !1;
d = 0;
for (e = a.length; d < e; d++) {
if (b = a[d], !(0 <= j.call(c, b))) return !1;
}
return !0;
};
x = function x(a, c) {
var b, d, e;
if (a.length !== c.length) return !1;
b = d = 0;
for (e = a.length; 0 <= e ? d < e : d > e; b = 0 <= e ? ++d : --d) {
if (a[b] !== c[b]) return !1;
}
return !0;
};
E = function E(a, c) {
var b, d, e;
d = 0;
for (e = a.length; d < e; d++) {
if (b = a[d], 0 > j.call(c, b)) return !1;
}
return !0;
};
A = Array.prototype.indexOf || function (a, c) {
var b, d, e;
b = d = 0;
for (e = a.length; 0 <= e ? d <= e : d >= e; b = 0 <= e ? ++d : --d) {
if (a[b] === c) return b;
}
return -1;
};
B = function B(a, c) {
var b, d, e, f;
e = d = 0;
for (f = a.length; e < f; e++) {
if (b = a[e], b = A.call(c, b), b >= d) d = b;else return !1;
}
return !0;
};
p = function p() {
if (o.debug) return console.log.apply(console, arguments);
};
F = function F(a) {
var c, b, d;
c = !1;
for (d in q) {
if (b = q[d], a === b) {
c = !0;
break;
}
}
if (!c) for (d in s) {
if (b = s[d], a === b) {
c = !0;
break;
}
}
return c;
};
H = function H(a) {
var c, b, d, e, f, g, i;
f = !0;
a.keys.length || p("You're trying to bind a combo with no keys:", a);
b = g = 0;
for (i = a.keys.length; 0 <= i ? g < i : g > i; b = 0 <= i ? ++g : --g) {
d = a.keys[b], (c = G[d]) && (d = a.keys[b] = c), "meta" === d && a.keys.splice(b, 1, k), "cmd" === d && p('Warning: use the "meta" key rather than "cmd" for Windows compatibility');
}
i = a.keys;
c = 0;
for (g = i.length; c < g; c++) {
d = i[c], F(d) || (p('Do not recognize the key "' + d + '"'), f = !1);
}
if (0 <= j.call(a.keys, "meta") || 0 <= j.call(a.keys, "cmd")) {
c = a.keys.slice();
g = 0;
for (i = C.length; g < i; g++) {
d = C[g], -1 < (b = A.call(c, d)) && c.splice(b, 1);
}
1 < c.length && (p("META and CMD key combos cannot have more than 1 non-modifier keys", a, c), f = !1);
}
for (e in a) {
"undefined" === r[e] && p("The property " + e + " is not a valid combo property. Your combo has still been registered.");
}
return f;
};
z = function z(a, c) {
var b;
if (!c.shiftKey) return !1;
b = s[a];
return null != b ? b : !1;
};
t = {
cmd: "metaKey",
ctrl: "ctrlKey",
shift: "shiftKey",
alt: "altKey"
};
G = {
escape: "esc",
control: "ctrl",
command: "cmd",
"break": "pause",
windows: "cmd",
option: "alt",
caps_lock: "caps",
apostrophe: "'",
semicolon: ";",
tilde: "~",
accent: "`",
scroll_lock: "scroll",
num_lock: "num"
};
s = {
"/": "?",
".": ">",
",": "<",
"'": '"',
";": ":",
"[": "{",
"]": "}",
"\\": "|",
"`": "~",
"=": "+",
"-": "_",
1: "!",
2: "@",
3: "#",
4: "$",
5: "%",
6: "^",
7: "&",
8: "*",
9: "(",
"0": ")"
};
q = {
"0": "\\",
8: "backspace",
9: "tab",
12: "num",
13: "enter",
16: "shift",
17: "ctrl",
18: "alt",
19: "pause",
20: "caps",
27: "esc",
32: "space",
33: "pageup",
34: "pagedown",
35: "end",
36: "home",
37: "left",
38: "up",
39: "right",
40: "down",
44: "print",
45: "insert",
46: "delete",
48: "0",
49: "1",
50: "2",
51: "3",
52: "4",
53: "5",
54: "6",
55: "7",
56: "8",
57: "9",
65: "a",
66: "b",
67: "c",
68: "d",
69: "e",
70: "f",
71: "g",
72: "h",
73: "i",
74: "j",
75: "k",
76: "l",
77: "m",
78: "n",
79: "o",
80: "p",
81: "q",
82: "r",
83: "s",
84: "t",
85: "u",
86: "v",
87: "w",
88: "x",
89: "y",
90: "z",
91: "cmd",
92: "cmd",
93: "cmd",
96: "num_0",
97: "num_1",
98: "num_2",
99: "num_3",
100: "num_4",
101: "num_5",
102: "num_6",
103: "num_7",
104: "num_8",
105: "num_9",
106: "num_multiply",
107: "num_add",
108: "num_enter",
109: "num_subtract",
110: "num_decimal",
111: "num_divide",
112: "f1",
113: "f2",
114: "f3",
115: "f4",
116: "f5",
117: "f6",
118: "f7",
119: "f8",
120: "f9",
121: "f10",
122: "f11",
123: "f12",
124: "print",
144: "num",
145: "scroll",
186: ";",
187: "=",
188: ",",
189: "-",
190: ".",
191: "/",
192: "`",
219: "[",
220: "\\",
221: "]",
222: "'",
223: "`",
224: "cmd",
225: "alt",
57392: "ctrl",
63289: "num",
59: ";",
61: "=",
173: "-"
};
o._keycode_dictionary = q;
o._is_array_in_array_sorted = B;
-1 !== navigator.userAgent.indexOf("Mac OS X") && (k = "cmd");
-1 !== navigator.userAgent.indexOf("Opera") && (q["17"] = "cmd");
true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return o;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
}).call(this);
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(5);
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.0
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var l = __webpack_require__(4),
n = 60103,
p = 60106;
exports.Fragment = 60107;
exports.StrictMode = 60108;
exports.Profiler = 60114;
var q = 60109,
r = 60110,
t = 60112;
exports.Suspense = 60113;
var u = 60115,
v = 60116;
if ("function" === typeof Symbol && Symbol.for) {
var w = Symbol.for;
n = w("react.element");
p = w("react.portal");
exports.Fragment = w("react.fragment");
exports.StrictMode = w("react.strict_mode");
exports.Profiler = w("react.profiler");
q = w("react.provider");
r = w("react.context");
t = w("react.forward_ref");
exports.Suspense = w("react.suspense");
u = w("react.memo");
v = w("react.lazy");
}
var x = "function" === typeof Symbol && Symbol.iterator;
function y(a) {
if (null === a || "object" !== typeof a) return null;
a = x && a[x] || a["@@iterator"];
return "function" === typeof a ? a : null;
}
function z(a) {
for (var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) {
b += "&args[]=" + encodeURIComponent(arguments[c]);
}
return "Minified React error #" + a + "; visit " + b + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var A = {
isMounted: function isMounted() {
return !1;
},
enqueueForceUpdate: function enqueueForceUpdate() {},
enqueueReplaceState: function enqueueReplaceState() {},
enqueueSetState: function enqueueSetState() {}
},
B = {};
function C(a, b, c) {
this.props = a;
this.context = b;
this.refs = B;
this.updater = c || A;
}
C.prototype.isReactComponent = {};
C.prototype.setState = function (a, b) {
if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error(z(85));
this.updater.enqueueSetState(this, a, b, "setState");
};
C.prototype.forceUpdate = function (a) {
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
};
function D() {}
D.prototype = C.prototype;
function E(a, b, c) {
this.props = a;
this.context = b;
this.refs = B;
this.updater = c || A;
}
var F = E.prototype = new D();
F.constructor = E;
l(F, C.prototype);
F.isPureReactComponent = !0;
var G = {
current: null
},
H = Object.prototype.hasOwnProperty,
I = {
key: !0,
ref: !0,
__self: !0,
__source: !0
};
function J(a, b, c) {
var e,
d = {},
k = null,
h = null;
if (null != b) for (e in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) {
H.call(b, e) && !I.hasOwnProperty(e) && (d[e] = b[e]);
}
var g = arguments.length - 2;
if (1 === g) d.children = c;else if (1 < g) {
for (var f = Array(g), m = 0; m < g; m++) {
f[m] = arguments[m + 2];
}
d.children = f;
}
if (a && a.defaultProps) for (e in g = a.defaultProps, g) {
void 0 === d[e] && (d[e] = g[e]);
}
return {
$$typeof: n,
type: a,
key: k,
ref: h,
props: d,
_owner: G.current
};
}
function K(a, b) {
return {
$$typeof: n,
type: a.type,
key: b,
ref: a.ref,
props: a.props,
_owner: a._owner
};
}
function L(a) {
return "object" === typeof a && null !== a && a.$$typeof === n;
}
function escape(a) {
var b = {
"=": "=0",
":": "=2"
};
return "$" + a.replace(/[=:]/g, function (a) {
return b[a];
});
}
var M = /\/+/g;
function N(a, b) {
return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
}
function O(a, b, c, e, d) {
var k = typeof a;
if ("undefined" === k || "boolean" === k) a = null;
var h = !1;
if (null === a) h = !0;else switch (k) {
case "string":
case "number":
h = !0;
break;
case "object":
switch (a.$$typeof) {
case n:
case p:
h = !0;
}
}
if (h) return h = a, d = d(h), a = "" === e ? "." + N(h, 0) : e, Array.isArray(d) ? (c = "", null != a && (c = a.replace(M, "$&/") + "/"), O(d, b, c, "", function (a) {
return a;
})) : null != d && (L(d) && (d = K(d, c + (!d.key || h && h.key === d.key ? "" : ("" + d.key).replace(M, "$&/") + "/") + a)), b.push(d)), 1;
h = 0;
e = "" === e ? "." : e + ":";
if (Array.isArray(a)) for (var g = 0; g < a.length; g++) {
k = a[g];
var f = e + N(k, g);
h += O(k, b, c, f, d);
} else if (f = y(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done;) {
k = k.value, f = e + N(k, g++), h += O(k, b, c, f, d);
} else if ("object" === k) throw b = "" + a, Error(z(31, "[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b));
return h;
}
function P(a, b, c) {
if (null == a) return a;
var e = [],
d = 0;
O(a, e, "", "", function (a) {
return b.call(c, a, d++);
});
return e;
}
function Q(a) {
if (-1 === a._status) {
var b = a._result;
b = b();
a._status = 0;
a._result = b;
b.then(function (b) {
0 === a._status && (b = b.default, a._status = 1, a._result = b);
}, function (b) {
0 === a._status && (a._status = 2, a._result = b);
});
}
if (1 === a._status) return a._result;
throw a._result;
}
var R = {
current: null
};
function S() {
var a = R.current;
if (null === a) throw Error(z(321));
return a;
}
var T = {
ReactCurrentDispatcher: R,
ReactCurrentBatchConfig: {
transition: 0
},
ReactCurrentOwner: G,
IsSomeRendererActing: {
current: !1
},
assign: l
};
exports.Children = {
map: P,
forEach: function forEach(a, b, c) {
P(a, function () {
b.apply(this, arguments);
}, c);
},
count: function count(a) {
var b = 0;
P(a, function () {
b++;
});
return b;
},
toArray: function toArray(a) {
return P(a, function (a) {
return a;
}) || [];
},
only: function only(a) {
if (!L(a)) throw Error(z(143));
return a;
}
};
exports.Component = C;
exports.PureComponent = E;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = T;
exports.cloneElement = function (a, b, c) {
if (null === a || void 0 === a) throw Error(z(267, a));
var e = l({}, a.props),
d = a.key,
k = a.ref,
h = a._owner;
if (null != b) {
void 0 !== b.ref && (k = b.ref, h = G.current);
void 0 !== b.key && (d = "" + b.key);
if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
for (f in b) {
H.call(b, f) && !I.hasOwnProperty(f) && (e[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
}
}
var f = arguments.length - 2;
if (1 === f) e.children = c;else if (1 < f) {
g = Array(f);
for (var m = 0; m < f; m++) {
g[m] = arguments[m + 2];
}
e.children = g;
}
return {
$$typeof: n,
type: a.type,
key: d,
ref: k,
props: e,
_owner: h
};
};
exports.createContext = function (a, b) {
void 0 === b && (b = null);
a = {
$$typeof: r,
_calculateChangedBits: b,
_currentValue: a,
_currentValue2: a,
_threadCount: 0,
Provider: null,
Consumer: null
};
a.Provider = {
$$typeof: q,
_context: a
};
return a.Consumer = a;
};
exports.createElement = J;
exports.createFactory = function (a) {
var b = J.bind(null, a);
b.type = a;
return b;
};
exports.createRef = function () {
return {
current: null
};
};
exports.forwardRef = function (a) {
return {
$$typeof: t,
render: a
};
};
exports.isValidElement = L;
exports.lazy = function (a) {
return {
$$typeof: v,
_payload: {
_status: -1,
_result: a
},
_init: Q
};
};
exports.memo = function (a, b) {
return {
$$typeof: u,
type: a,
compare: void 0 === b ? null : b
};
};
exports.useCallback = function (a, b) {
return S().useCallback(a, b);
};
exports.useContext = function (a, b) {
return S().useContext(a, b);
};
exports.useDebugValue = function () {};
exports.useEffect = function (a, b) {
return S().useEffect(a, b);
};
exports.useImperativeHandle = function (a, b, c) {
return S().useImperativeHandle(a, b, c);
};
exports.useLayoutEffect = function (a, b) {
return S().useLayoutEffect(a, b);
};
exports.useMemo = function (a, b) {
return S().useMemo(a, b);
};
exports.useReducer = function (a, b, c) {
return S().useReducer(a, b, c);
};
exports.useRef = function (a) {
return S().useRef(a);
};
exports.useState = function (a) {
return S().useState(a);
};
exports.version = "17.0.0";
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
} // Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
} // https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
} // https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
// CONCATENATED MODULE: ./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
// CONCATENATED MODULE: ./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
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;
}
// CONCATENATED MODULE: ./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
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(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
// CONCATENATED MODULE: ./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// CONCATENATED MODULE: ./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(0);
var react_default = /*#__PURE__*/__webpack_require__.n(react);
// EXTERNAL MODULE: ./node_modules/keypress.js/keypress-2.1.5.min.js
var keypress_2_1_5_min = __webpack_require__(1);
var keypress_2_1_5_min_default = /*#__PURE__*/__webpack_require__.n(keypress_2_1_5_min);
// CONCATENATED MODULE: ./src/lib/react-keypress.js
var react_keypress_elements=new WeakMap();console.log(keypress_2_1_5_min_default.a);var listener=new keypress_2_1_5_min_default.a.Listener();var keyp=function keyp(keys){console.log("in key");listener.listen();listener.register_many(keys);listener.unregister_many(keys);};/* harmony default export */ var react_keypress = (keyp);
// CONCATENATED MODULE: ./src/index.js
var src_Block=function Block(props){var color=props.color,blockName=props.blockName,desc=props.desc;var _useState=Object(react["useState"])(false),_useState2=_slicedToArray(_useState,2),colorNew=_useState2[0],setColorNew=_useState2[1];Object(react["useEffect"])(function(){console.log(props);react_keypress([{keys:props.shortcutKeyVal,on_keydown:changeColor}]);});var changeColor=function changeColor(e){setColorNew(generateColor);};var generateColor=function generateColor(){return"#"+Math.random().toString(16).substr(-6);};return/*#__PURE__*/react_default.a.createElement("div",{className:"block-sec {{blockName}}",style:{background:colorNew?colorNew:color}},desc);};/* harmony default export */ var src = __webpack_exports__["default"] = (src_Block);
/***/ })
/******/ ]);
//# sourceMappingURL=main.js.map