@cniot/android-pda-components 2.0.0-beta.12 → 2.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -10
- package/doc/all-v2-components/index.jsx +5 -1
- package/es/index.cjs.js +11 -10
- package/es/index.es.js +1318 -191
- package/package.json +2 -1
- package/vite.config.doc.js +5 -0
package/es/index.es.js
CHANGED
|
@@ -31,7 +31,7 @@ function getAugmentedNamespace(n2) {
|
|
|
31
31
|
});
|
|
32
32
|
return a;
|
|
33
33
|
}
|
|
34
|
-
var lib$
|
|
34
|
+
var lib$3 = { exports: {} };
|
|
35
35
|
var locale$1 = {};
|
|
36
36
|
var cookie = {};
|
|
37
37
|
var util$1 = {};
|
|
@@ -625,26 +625,26 @@ function assign$1(target) {
|
|
|
625
625
|
var _default2 = exportObject;
|
|
626
626
|
exports["default"] = _default2;
|
|
627
627
|
module.exports = exportObject;
|
|
628
|
-
})(lib$
|
|
629
|
-
var locale = /* @__PURE__ */ getDefaultExportFromCjs(lib$
|
|
628
|
+
})(lib$3, lib$3.exports);
|
|
629
|
+
var locale = /* @__PURE__ */ getDefaultExportFromCjs(lib$3.exports);
|
|
630
|
+
var lib$2 = {};
|
|
630
631
|
var lib$1 = {};
|
|
631
|
-
|
|
632
|
-
lib.
|
|
633
|
-
lib.isIOS = lib.isAndroid = lib.isWeb = lib.isWechatApp = lib.isMiniApp = lib.isReactNative = lib.isWeex = lib.isNode = void 0;
|
|
632
|
+
lib$1.__esModule = true;
|
|
633
|
+
lib$1.isIOS = lib$1.isAndroid = lib$1.isWeb = lib$1.isWechatApp = lib$1.isMiniApp = lib$1.isReactNative = lib$1.isWeex = lib$1.isNode = void 0;
|
|
634
634
|
var isTaoWebview = typeof __sfc__ !== "undefined";
|
|
635
635
|
var isWebPure = typeof navigator === "object" && (navigator.appCodeName === "Mozilla" || navigator.product === "Gecko");
|
|
636
636
|
var isNode = typeof process !== "undefined" && !!(process.versions && process.versions.node);
|
|
637
|
-
lib.isNode = isNode;
|
|
637
|
+
lib$1.isNode = isNode;
|
|
638
638
|
var isWeex = typeof callNative === "function" || typeof WXEnvironment === "object" && WXEnvironment.platform !== "Web";
|
|
639
|
-
lib.isWeex = isWeex;
|
|
639
|
+
lib$1.isWeex = isWeex;
|
|
640
640
|
var isReactNative = typeof __fbBatchedBridgeConfig !== "undefined";
|
|
641
|
-
lib.isReactNative = isReactNative;
|
|
641
|
+
lib$1.isReactNative = isReactNative;
|
|
642
642
|
var isMiniApp = typeof my === "object" && typeof my.getSystemInfo !== "undefined" && !isTaoWebview;
|
|
643
|
-
lib.isMiniApp = isMiniApp;
|
|
643
|
+
lib$1.isMiniApp = isMiniApp;
|
|
644
644
|
var isWechatApp = typeof wx === "object" && typeof wx.getSystemInfo !== "undefined";
|
|
645
|
-
lib.isWechatApp = isWechatApp;
|
|
645
|
+
lib$1.isWechatApp = isWechatApp;
|
|
646
646
|
var isWeb = isWebPure && !isMiniApp && !isWechatApp || isTaoWebview;
|
|
647
|
-
lib.isWeb = isWeb;
|
|
647
|
+
lib$1.isWeb = isWeb;
|
|
648
648
|
var systemInfo = {};
|
|
649
649
|
if (isMiniApp) {
|
|
650
650
|
systemInfo = my.getSystemInfoSync();
|
|
@@ -664,7 +664,7 @@ var isAndroid = function() {
|
|
|
664
664
|
}
|
|
665
665
|
return false;
|
|
666
666
|
}();
|
|
667
|
-
lib.isAndroid = isAndroid;
|
|
667
|
+
lib$1.isAndroid = isAndroid;
|
|
668
668
|
var isIOS$1 = function() {
|
|
669
669
|
if (isMiniApp || isWechatApp || isWeex) {
|
|
670
670
|
return ["ios", "iOS", "iPhone OS"].indexOf(systemInfo.platform) > -1;
|
|
@@ -673,7 +673,7 @@ var isIOS$1 = function() {
|
|
|
673
673
|
}
|
|
674
674
|
return false;
|
|
675
675
|
}();
|
|
676
|
-
lib.isIOS = isIOS$1;
|
|
676
|
+
lib$1.isIOS = isIOS$1;
|
|
677
677
|
var stringFormat = {};
|
|
678
678
|
var hop = Object.prototype.hasOwnProperty;
|
|
679
679
|
function extend(obj) {
|
|
@@ -2541,13 +2541,13 @@ var StringFormat = /* @__PURE__ */ function() {
|
|
|
2541
2541
|
return StringFormat2;
|
|
2542
2542
|
}();
|
|
2543
2543
|
stringFormat.default = StringFormat;
|
|
2544
|
-
Object.defineProperty(lib$
|
|
2544
|
+
Object.defineProperty(lib$2, "__esModule", {
|
|
2545
2545
|
value: true
|
|
2546
2546
|
});
|
|
2547
|
-
lib$
|
|
2548
|
-
lib$
|
|
2549
|
-
var default_1 = lib$
|
|
2550
|
-
var _universalEnv = lib;
|
|
2547
|
+
lib$2.init = init;
|
|
2548
|
+
lib$2.format = format;
|
|
2549
|
+
var default_1 = lib$2.default = void 0;
|
|
2550
|
+
var _universalEnv = lib$1;
|
|
2551
2551
|
var _stringFormat = _interopRequireDefault(stringFormat);
|
|
2552
2552
|
var _util = util;
|
|
2553
2553
|
function _interopRequireDefault(obj) {
|
|
@@ -2598,7 +2598,7 @@ var _default = {
|
|
|
2598
2598
|
format,
|
|
2599
2599
|
StringFormat: _stringFormat.default
|
|
2600
2600
|
};
|
|
2601
|
-
default_1 = lib$
|
|
2601
|
+
default_1 = lib$2.default = _default;
|
|
2602
2602
|
var enUS = {
|
|
2603
2603
|
"\u786E\u5B9A\u79BB\u5F00\u5F53\u524D\u9875\u9762\u5417\uFF1F": "Are you sure you want to leave the current page?",
|
|
2604
2604
|
"\u8FDC": "Far",
|
|
@@ -2878,9 +2878,9 @@ var _keycode_2_2_1_keycode = { exports: {} };
|
|
|
2878
2878
|
return search.charCodeAt(0);
|
|
2879
2879
|
return void 0;
|
|
2880
2880
|
}
|
|
2881
|
-
keyCode.isEventKey = function isEventKey(
|
|
2882
|
-
if (
|
|
2883
|
-
var keyCode2 =
|
|
2881
|
+
keyCode.isEventKey = function isEventKey(event2, nameOrCode) {
|
|
2882
|
+
if (event2 && "object" === typeof event2) {
|
|
2883
|
+
var keyCode2 = event2.which || event2.keyCode || event2.charCode;
|
|
2884
2884
|
if (keyCode2 === null || keyCode2 === void 0) {
|
|
2885
2885
|
return false;
|
|
2886
2886
|
}
|
|
@@ -3126,11 +3126,11 @@ function getShortcutKeyCodes(shortcutKey) {
|
|
|
3126
3126
|
}).filter((k2) => k2 !== void 0);
|
|
3127
3127
|
}
|
|
3128
3128
|
function bindShortcutKey(keys, callback) {
|
|
3129
|
-
function keyUpCallback(
|
|
3130
|
-
const key =
|
|
3131
|
-
const keyCode = SPECIAL_KEY_MAP.indexOf(key) > -1 ? key :
|
|
3129
|
+
function keyUpCallback(event2) {
|
|
3130
|
+
const key = event2.key.toLowerCase();
|
|
3131
|
+
const keyCode = SPECIAL_KEY_MAP.indexOf(key) > -1 ? key : event2.keyCode;
|
|
3132
3132
|
if (keys.indexOf(keyCode) > -1) {
|
|
3133
|
-
callback && callback(
|
|
3133
|
+
callback && callback(event2);
|
|
3134
3134
|
}
|
|
3135
3135
|
}
|
|
3136
3136
|
document.addEventListener("keyup", keyUpCallback);
|
|
@@ -4668,8 +4668,8 @@ class ImageUploader extends Component {
|
|
|
4668
4668
|
let fileData = e2.target.files[0];
|
|
4669
4669
|
const reader = new FileReader();
|
|
4670
4670
|
reader.readAsDataURL(fileData);
|
|
4671
|
-
reader.onload = (
|
|
4672
|
-
const base64 =
|
|
4671
|
+
reader.onload = (event2) => {
|
|
4672
|
+
const base64 = event2.target.result;
|
|
4673
4673
|
beforeUpload && beforeUpload({
|
|
4674
4674
|
data: base64,
|
|
4675
4675
|
base64
|
|
@@ -6105,8 +6105,8 @@ function index$r(props) {
|
|
|
6105
6105
|
min,
|
|
6106
6106
|
max,
|
|
6107
6107
|
type: "date",
|
|
6108
|
-
onChange: (
|
|
6109
|
-
onChange && onChange(
|
|
6108
|
+
onChange: (event2) => {
|
|
6109
|
+
onChange && onChange(event2.target.value);
|
|
6110
6110
|
},
|
|
6111
6111
|
onKeyUp: (e2) => {
|
|
6112
6112
|
const { keyCode } = e2;
|
|
@@ -7620,18 +7620,18 @@ var _reactFastCompare_3_2_2_reactFastCompare = function isEqual(a, b2) {
|
|
|
7620
7620
|
}
|
|
7621
7621
|
};
|
|
7622
7622
|
}
|
|
7623
|
-
function addEvent(node,
|
|
7623
|
+
function addEvent(node, event2, fn, opt_useCapture) {
|
|
7624
7624
|
if (typeof node.addEventListener == "function") {
|
|
7625
|
-
node.addEventListener(
|
|
7625
|
+
node.addEventListener(event2, fn, opt_useCapture || false);
|
|
7626
7626
|
} else if (typeof node.attachEvent == "function") {
|
|
7627
|
-
node.attachEvent("on" +
|
|
7627
|
+
node.attachEvent("on" + event2, fn);
|
|
7628
7628
|
}
|
|
7629
7629
|
}
|
|
7630
|
-
function removeEvent(node,
|
|
7630
|
+
function removeEvent(node, event2, fn, opt_useCapture) {
|
|
7631
7631
|
if (typeof node.removeEventListener == "function") {
|
|
7632
|
-
node.removeEventListener(
|
|
7632
|
+
node.removeEventListener(event2, fn, opt_useCapture || false);
|
|
7633
7633
|
} else if (typeof node.detachEvent == "function") {
|
|
7634
|
-
node.detachEvent("on" +
|
|
7634
|
+
node.detachEvent("on" + event2, fn);
|
|
7635
7635
|
}
|
|
7636
7636
|
}
|
|
7637
7637
|
function computeRectIntersection(rect1, rect2) {
|
|
@@ -7849,13 +7849,13 @@ function useTouch() {
|
|
|
7849
7849
|
offsetY.current = 0;
|
|
7850
7850
|
direction.current = "";
|
|
7851
7851
|
};
|
|
7852
|
-
const start2 = (
|
|
7852
|
+
const start2 = (event2) => {
|
|
7853
7853
|
reset();
|
|
7854
|
-
startX.current =
|
|
7855
|
-
startY.current =
|
|
7854
|
+
startX.current = event2.touches[0].clientX;
|
|
7855
|
+
startY.current = event2.touches[0].clientY;
|
|
7856
7856
|
};
|
|
7857
|
-
const move = (
|
|
7858
|
-
const touch =
|
|
7857
|
+
const move = (event2) => {
|
|
7858
|
+
const touch = event2.touches[0];
|
|
7859
7859
|
deltaX.current = touch.clientX < 0 ? 0 : touch.clientX - startX.current;
|
|
7860
7860
|
deltaY.current = touch.clientY - startY.current;
|
|
7861
7861
|
offsetX.current = Math.abs(deltaX.current);
|
|
@@ -7928,16 +7928,16 @@ function getScrollableElement(el) {
|
|
|
7928
7928
|
}
|
|
7929
7929
|
function useLockScroll(rootRef, shouldLock) {
|
|
7930
7930
|
const touch = useTouch();
|
|
7931
|
-
const onTouchMove = (
|
|
7932
|
-
touch.move(
|
|
7931
|
+
const onTouchMove = (event2) => {
|
|
7932
|
+
touch.move(event2);
|
|
7933
7933
|
const direction = touch.deltaY.current > 0 ? "10" : "01";
|
|
7934
|
-
const el = getScrollParent(
|
|
7934
|
+
const el = getScrollParent(event2.target, rootRef.current);
|
|
7935
7935
|
if (!el)
|
|
7936
7936
|
return;
|
|
7937
7937
|
if (shouldLock === "strict") {
|
|
7938
|
-
const scrollableParent = getScrollableElement(
|
|
7938
|
+
const scrollableParent = getScrollableElement(event2.target);
|
|
7939
7939
|
if (scrollableParent === document.body || scrollableParent === document.documentElement) {
|
|
7940
|
-
|
|
7940
|
+
event2.preventDefault();
|
|
7941
7941
|
return;
|
|
7942
7942
|
}
|
|
7943
7943
|
}
|
|
@@ -7956,8 +7956,8 @@ function useLockScroll(rootRef, shouldLock) {
|
|
|
7956
7956
|
status = "10";
|
|
7957
7957
|
}
|
|
7958
7958
|
if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
|
|
7959
|
-
if (
|
|
7960
|
-
|
|
7959
|
+
if (event2.cancelable && supportsPassive) {
|
|
7960
|
+
event2.preventDefault();
|
|
7961
7961
|
}
|
|
7962
7962
|
}
|
|
7963
7963
|
};
|
|
@@ -8708,18 +8708,18 @@ const $observers = Symbol.for("FluidValue.observers");
|
|
|
8708
8708
|
const hasFluidValue = (arg) => Boolean(arg && arg[$get]);
|
|
8709
8709
|
const getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg;
|
|
8710
8710
|
const getFluidObservers = (target) => target[$observers] || null;
|
|
8711
|
-
function callFluidObserver(observer,
|
|
8711
|
+
function callFluidObserver(observer, event2) {
|
|
8712
8712
|
if (observer.eventObserved) {
|
|
8713
|
-
observer.eventObserved(
|
|
8713
|
+
observer.eventObserved(event2);
|
|
8714
8714
|
} else {
|
|
8715
|
-
observer(
|
|
8715
|
+
observer(event2);
|
|
8716
8716
|
}
|
|
8717
8717
|
}
|
|
8718
|
-
function callFluidObservers(target,
|
|
8718
|
+
function callFluidObservers(target, event2) {
|
|
8719
8719
|
let observers = target[$observers];
|
|
8720
8720
|
if (observers) {
|
|
8721
8721
|
observers.forEach((observer) => {
|
|
8722
|
-
callFluidObserver(observer,
|
|
8722
|
+
callFluidObserver(observer, event2);
|
|
8723
8723
|
});
|
|
8724
8724
|
}
|
|
8725
8725
|
}
|
|
@@ -9163,8 +9163,8 @@ class PropsObserver {
|
|
|
9163
9163
|
this.update = update2;
|
|
9164
9164
|
this.deps = deps;
|
|
9165
9165
|
}
|
|
9166
|
-
eventObserved(
|
|
9167
|
-
if (
|
|
9166
|
+
eventObserved(event2) {
|
|
9167
|
+
if (event2.type == "change") {
|
|
9168
9168
|
raf.write(this.update);
|
|
9169
9169
|
}
|
|
9170
9170
|
}
|
|
@@ -9961,11 +9961,11 @@ class SpringValue extends FrameValue {
|
|
|
9961
9961
|
reset: true
|
|
9962
9962
|
});
|
|
9963
9963
|
}
|
|
9964
|
-
eventObserved(
|
|
9965
|
-
if (
|
|
9964
|
+
eventObserved(event2) {
|
|
9965
|
+
if (event2.type == "change") {
|
|
9966
9966
|
this._start();
|
|
9967
|
-
} else if (
|
|
9968
|
-
this.priority =
|
|
9967
|
+
} else if (event2.type == "priority") {
|
|
9968
|
+
this.priority = event2.priority + 1;
|
|
9969
9969
|
}
|
|
9970
9970
|
}
|
|
9971
9971
|
_prepareNode(props) {
|
|
@@ -10499,14 +10499,14 @@ class Controller$1 {
|
|
|
10499
10499
|
});
|
|
10500
10500
|
}
|
|
10501
10501
|
}
|
|
10502
|
-
eventObserved(
|
|
10503
|
-
if (
|
|
10504
|
-
this._changed.add(
|
|
10505
|
-
if (!
|
|
10506
|
-
this._active.add(
|
|
10502
|
+
eventObserved(event2) {
|
|
10503
|
+
if (event2.type == "change") {
|
|
10504
|
+
this._changed.add(event2.parent);
|
|
10505
|
+
if (!event2.idle) {
|
|
10506
|
+
this._active.add(event2.parent);
|
|
10507
10507
|
}
|
|
10508
|
-
} else if (
|
|
10509
|
-
this._active.delete(
|
|
10508
|
+
} else if (event2.type == "idle") {
|
|
10509
|
+
this._active.delete(event2.parent);
|
|
10510
10510
|
} else
|
|
10511
10511
|
return;
|
|
10512
10512
|
raf.onFrame(this._onFrame);
|
|
@@ -10935,17 +10935,17 @@ class Interpolation extends FrameValue {
|
|
|
10935
10935
|
this._active.clear();
|
|
10936
10936
|
becomeIdle(this);
|
|
10937
10937
|
}
|
|
10938
|
-
eventObserved(
|
|
10939
|
-
if (
|
|
10940
|
-
if (
|
|
10938
|
+
eventObserved(event2) {
|
|
10939
|
+
if (event2.type == "change") {
|
|
10940
|
+
if (event2.idle) {
|
|
10941
10941
|
this.advance();
|
|
10942
10942
|
} else {
|
|
10943
|
-
this._active.add(
|
|
10943
|
+
this._active.add(event2.parent);
|
|
10944
10944
|
this._start();
|
|
10945
10945
|
}
|
|
10946
|
-
} else if (
|
|
10947
|
-
this._active.delete(
|
|
10948
|
-
} else if (
|
|
10946
|
+
} else if (event2.type == "idle") {
|
|
10947
|
+
this._active.delete(event2.parent);
|
|
10948
|
+
} else if (event2.type == "priority") {
|
|
10949
10949
|
this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
|
|
10950
10950
|
}
|
|
10951
10951
|
}
|
|
@@ -11152,11 +11152,11 @@ class FluidTransform extends FluidValue {
|
|
|
11152
11152
|
if (count == 0)
|
|
11153
11153
|
each(this.inputs, (input2) => each(input2, (value) => hasFluidValue(value) && removeFluidObserver(value, this)));
|
|
11154
11154
|
}
|
|
11155
|
-
eventObserved(
|
|
11156
|
-
if (
|
|
11155
|
+
eventObserved(event2) {
|
|
11156
|
+
if (event2.type == "change") {
|
|
11157
11157
|
this._value = null;
|
|
11158
11158
|
}
|
|
11159
|
-
callFluidObservers(this,
|
|
11159
|
+
callFluidObservers(this, event2);
|
|
11160
11160
|
}
|
|
11161
11161
|
}
|
|
11162
11162
|
const primitives = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
|
|
@@ -11938,47 +11938,47 @@ function toDomEventType(device, action = "") {
|
|
|
11938
11938
|
const actionKey = deviceProps ? deviceProps[action] || action : action;
|
|
11939
11939
|
return device + actionKey;
|
|
11940
11940
|
}
|
|
11941
|
-
function isTouch(
|
|
11942
|
-
return "touches" in
|
|
11941
|
+
function isTouch(event2) {
|
|
11942
|
+
return "touches" in event2;
|
|
11943
11943
|
}
|
|
11944
|
-
function getPointerType(
|
|
11945
|
-
if (isTouch(
|
|
11944
|
+
function getPointerType(event2) {
|
|
11945
|
+
if (isTouch(event2))
|
|
11946
11946
|
return "touch";
|
|
11947
|
-
if ("pointerType" in
|
|
11948
|
-
return
|
|
11947
|
+
if ("pointerType" in event2)
|
|
11948
|
+
return event2.pointerType;
|
|
11949
11949
|
return "mouse";
|
|
11950
11950
|
}
|
|
11951
|
-
function getCurrentTargetTouchList(
|
|
11952
|
-
return Array.from(
|
|
11951
|
+
function getCurrentTargetTouchList(event2) {
|
|
11952
|
+
return Array.from(event2.touches).filter((e2) => {
|
|
11953
11953
|
var _event$currentTarget, _event$currentTarget$;
|
|
11954
|
-
return e2.target ===
|
|
11954
|
+
return e2.target === event2.currentTarget || ((_event$currentTarget = event2.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e2.target));
|
|
11955
11955
|
});
|
|
11956
11956
|
}
|
|
11957
|
-
function getTouchList(
|
|
11958
|
-
return
|
|
11957
|
+
function getTouchList(event2) {
|
|
11958
|
+
return event2.type === "touchend" || event2.type === "touchcancel" ? event2.changedTouches : event2.targetTouches;
|
|
11959
11959
|
}
|
|
11960
|
-
function getValueEvent(
|
|
11961
|
-
return isTouch(
|
|
11960
|
+
function getValueEvent(event2) {
|
|
11961
|
+
return isTouch(event2) ? getTouchList(event2)[0] : event2;
|
|
11962
11962
|
}
|
|
11963
|
-
function touchIds(
|
|
11964
|
-
return getCurrentTargetTouchList(
|
|
11963
|
+
function touchIds(event2) {
|
|
11964
|
+
return getCurrentTargetTouchList(event2).map((touch) => touch.identifier);
|
|
11965
11965
|
}
|
|
11966
|
-
function pointerId(
|
|
11967
|
-
const valueEvent = getValueEvent(
|
|
11968
|
-
return isTouch(
|
|
11966
|
+
function pointerId(event2) {
|
|
11967
|
+
const valueEvent = getValueEvent(event2);
|
|
11968
|
+
return isTouch(event2) ? valueEvent.identifier : valueEvent.pointerId;
|
|
11969
11969
|
}
|
|
11970
|
-
function pointerValues(
|
|
11971
|
-
const valueEvent = getValueEvent(
|
|
11970
|
+
function pointerValues(event2) {
|
|
11971
|
+
const valueEvent = getValueEvent(event2);
|
|
11972
11972
|
return [valueEvent.clientX, valueEvent.clientY];
|
|
11973
11973
|
}
|
|
11974
11974
|
const LINE_HEIGHT = 40;
|
|
11975
11975
|
const PAGE_HEIGHT = 800;
|
|
11976
|
-
function wheelValues(
|
|
11976
|
+
function wheelValues(event2) {
|
|
11977
11977
|
let {
|
|
11978
11978
|
deltaX,
|
|
11979
11979
|
deltaY,
|
|
11980
11980
|
deltaMode
|
|
11981
|
-
} =
|
|
11981
|
+
} = event2;
|
|
11982
11982
|
if (deltaMode === 1) {
|
|
11983
11983
|
deltaX *= LINE_HEIGHT;
|
|
11984
11984
|
deltaY *= LINE_HEIGHT;
|
|
@@ -11988,17 +11988,17 @@ function wheelValues(event) {
|
|
|
11988
11988
|
}
|
|
11989
11989
|
return [deltaX, deltaY];
|
|
11990
11990
|
}
|
|
11991
|
-
function getEventDetails(
|
|
11991
|
+
function getEventDetails(event2) {
|
|
11992
11992
|
const payload = {};
|
|
11993
|
-
if ("buttons" in
|
|
11994
|
-
payload.buttons =
|
|
11995
|
-
if ("shiftKey" in
|
|
11993
|
+
if ("buttons" in event2)
|
|
11994
|
+
payload.buttons = event2.buttons;
|
|
11995
|
+
if ("shiftKey" in event2) {
|
|
11996
11996
|
const {
|
|
11997
11997
|
shiftKey,
|
|
11998
11998
|
altKey,
|
|
11999
11999
|
metaKey,
|
|
12000
12000
|
ctrlKey
|
|
12001
|
-
} =
|
|
12001
|
+
} = event2;
|
|
12002
12002
|
Object.assign(payload, {
|
|
12003
12003
|
shiftKey,
|
|
12004
12004
|
altKey,
|
|
@@ -12100,18 +12100,18 @@ class Engine {
|
|
|
12100
12100
|
state.delta = [0, 0];
|
|
12101
12101
|
state.timeStamp = 0;
|
|
12102
12102
|
}
|
|
12103
|
-
start(
|
|
12103
|
+
start(event2) {
|
|
12104
12104
|
const state = this.state;
|
|
12105
12105
|
const config2 = this.config;
|
|
12106
12106
|
if (!state._active) {
|
|
12107
12107
|
this.reset();
|
|
12108
12108
|
this.computeInitial();
|
|
12109
12109
|
state._active = true;
|
|
12110
|
-
state.target =
|
|
12111
|
-
state.currentTarget =
|
|
12110
|
+
state.target = event2.target;
|
|
12111
|
+
state.currentTarget = event2.currentTarget;
|
|
12112
12112
|
state.lastOffset = config2.from ? call(config2.from, state) : state.offset;
|
|
12113
12113
|
state.offset = state.lastOffset;
|
|
12114
|
-
state.startTime = state.timeStamp =
|
|
12114
|
+
state.startTime = state.timeStamp = event2.timeStamp;
|
|
12115
12115
|
}
|
|
12116
12116
|
}
|
|
12117
12117
|
computeValues(values) {
|
|
@@ -12124,7 +12124,7 @@ class Engine {
|
|
|
12124
12124
|
state._initial = state._values;
|
|
12125
12125
|
state.initial = state.values;
|
|
12126
12126
|
}
|
|
12127
|
-
compute(
|
|
12127
|
+
compute(event2) {
|
|
12128
12128
|
const {
|
|
12129
12129
|
state,
|
|
12130
12130
|
config: config2,
|
|
@@ -12132,17 +12132,17 @@ class Engine {
|
|
|
12132
12132
|
} = this;
|
|
12133
12133
|
state.args = this.args;
|
|
12134
12134
|
let dt = 0;
|
|
12135
|
-
if (
|
|
12136
|
-
state.event =
|
|
12137
|
-
if (config2.preventDefault &&
|
|
12135
|
+
if (event2) {
|
|
12136
|
+
state.event = event2;
|
|
12137
|
+
if (config2.preventDefault && event2.cancelable)
|
|
12138
12138
|
state.event.preventDefault();
|
|
12139
|
-
state.type =
|
|
12139
|
+
state.type = event2.type;
|
|
12140
12140
|
shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;
|
|
12141
12141
|
shared.locked = !!document.pointerLockElement;
|
|
12142
|
-
Object.assign(shared, getEventDetails(
|
|
12142
|
+
Object.assign(shared, getEventDetails(event2));
|
|
12143
12143
|
shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;
|
|
12144
|
-
dt =
|
|
12145
|
-
state.timeStamp =
|
|
12144
|
+
dt = event2.timeStamp - state.timeStamp;
|
|
12145
|
+
state.timeStamp = event2.timeStamp;
|
|
12146
12146
|
state.elapsedTime = state.timeStamp - state.startTime;
|
|
12147
12147
|
}
|
|
12148
12148
|
if (state._active) {
|
|
@@ -12150,7 +12150,7 @@ class Engine {
|
|
|
12150
12150
|
V.addTo(state._distance, _absoluteDelta);
|
|
12151
12151
|
}
|
|
12152
12152
|
if (this.axisIntent)
|
|
12153
|
-
this.axisIntent(
|
|
12153
|
+
this.axisIntent(event2);
|
|
12154
12154
|
const [_m0, _m1] = state._movement;
|
|
12155
12155
|
const [t0, t1] = config2.threshold;
|
|
12156
12156
|
const {
|
|
@@ -12188,7 +12188,7 @@ class Engine {
|
|
|
12188
12188
|
state.first = state._active && !state.active;
|
|
12189
12189
|
state.last = !state._active && state.active;
|
|
12190
12190
|
state.active = shared[this.ingKey] = state._active;
|
|
12191
|
-
if (
|
|
12191
|
+
if (event2) {
|
|
12192
12192
|
if (state.first) {
|
|
12193
12193
|
if ("bounds" in config2)
|
|
12194
12194
|
state._bounds = call(config2.bounds, state);
|
|
@@ -12269,11 +12269,11 @@ class CoordinatesEngine extends Engine {
|
|
|
12269
12269
|
computeMovement() {
|
|
12270
12270
|
this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
|
|
12271
12271
|
}
|
|
12272
|
-
axisIntent(
|
|
12272
|
+
axisIntent(event2) {
|
|
12273
12273
|
const state = this.state;
|
|
12274
12274
|
const config2 = this.config;
|
|
12275
|
-
if (!state.axis &&
|
|
12276
|
-
const threshold = typeof config2.axisThreshold === "object" ? config2.axisThreshold[getPointerType(
|
|
12275
|
+
if (!state.axis && event2) {
|
|
12276
|
+
const threshold = typeof config2.axisThreshold === "object" ? config2.axisThreshold[getPointerType(event2)] : config2.axisThreshold;
|
|
12277
12277
|
state.axis = selectAxis(state._movement, threshold);
|
|
12278
12278
|
}
|
|
12279
12279
|
state._blocked = (config2.lockDirection || !!config2.axis) && !state.axis || !!config2.axis && config2.axis !== state.axis;
|
|
@@ -12420,65 +12420,65 @@ class DragEngine extends CoordinatesEngine {
|
|
|
12420
12420
|
this.state._keyboardActive = false;
|
|
12421
12421
|
super.clean();
|
|
12422
12422
|
}
|
|
12423
|
-
pointerDown(
|
|
12423
|
+
pointerDown(event2) {
|
|
12424
12424
|
const config2 = this.config;
|
|
12425
12425
|
const state = this.state;
|
|
12426
|
-
if (
|
|
12426
|
+
if (event2.buttons != null && (Array.isArray(config2.pointerButtons) ? !config2.pointerButtons.includes(event2.buttons) : config2.pointerButtons !== -1 && config2.pointerButtons !== event2.buttons))
|
|
12427
12427
|
return;
|
|
12428
|
-
const ctrlIds = this.ctrl.setEventIds(
|
|
12428
|
+
const ctrlIds = this.ctrl.setEventIds(event2);
|
|
12429
12429
|
if (config2.pointerCapture) {
|
|
12430
|
-
|
|
12430
|
+
event2.target.setPointerCapture(event2.pointerId);
|
|
12431
12431
|
}
|
|
12432
12432
|
if (ctrlIds && ctrlIds.size > 1 && state._pointerActive)
|
|
12433
12433
|
return;
|
|
12434
|
-
this.start(
|
|
12435
|
-
this.setupPointer(
|
|
12436
|
-
state._pointerId = pointerId(
|
|
12434
|
+
this.start(event2);
|
|
12435
|
+
this.setupPointer(event2);
|
|
12436
|
+
state._pointerId = pointerId(event2);
|
|
12437
12437
|
state._pointerActive = true;
|
|
12438
|
-
this.computeValues(pointerValues(
|
|
12438
|
+
this.computeValues(pointerValues(event2));
|
|
12439
12439
|
this.computeInitial();
|
|
12440
|
-
if (config2.preventScrollAxis && getPointerType(
|
|
12440
|
+
if (config2.preventScrollAxis && getPointerType(event2) !== "mouse") {
|
|
12441
12441
|
state._active = false;
|
|
12442
|
-
this.setupScrollPrevention(
|
|
12442
|
+
this.setupScrollPrevention(event2);
|
|
12443
12443
|
} else if (config2.delay > 0) {
|
|
12444
|
-
this.setupDelayTrigger(
|
|
12444
|
+
this.setupDelayTrigger(event2);
|
|
12445
12445
|
if (config2.triggerAllEvents) {
|
|
12446
|
-
this.compute(
|
|
12446
|
+
this.compute(event2);
|
|
12447
12447
|
this.emit();
|
|
12448
12448
|
}
|
|
12449
12449
|
} else {
|
|
12450
|
-
this.startPointerDrag(
|
|
12450
|
+
this.startPointerDrag(event2);
|
|
12451
12451
|
}
|
|
12452
12452
|
}
|
|
12453
|
-
startPointerDrag(
|
|
12453
|
+
startPointerDrag(event2) {
|
|
12454
12454
|
const state = this.state;
|
|
12455
12455
|
state._active = true;
|
|
12456
12456
|
state._preventScroll = true;
|
|
12457
12457
|
state._delayed = false;
|
|
12458
|
-
this.compute(
|
|
12458
|
+
this.compute(event2);
|
|
12459
12459
|
this.emit();
|
|
12460
12460
|
}
|
|
12461
|
-
pointerMove(
|
|
12461
|
+
pointerMove(event2) {
|
|
12462
12462
|
const state = this.state;
|
|
12463
12463
|
const config2 = this.config;
|
|
12464
12464
|
if (!state._pointerActive)
|
|
12465
12465
|
return;
|
|
12466
|
-
const id = pointerId(
|
|
12466
|
+
const id = pointerId(event2);
|
|
12467
12467
|
if (state._pointerId !== void 0 && id !== state._pointerId)
|
|
12468
12468
|
return;
|
|
12469
|
-
const _values = pointerValues(
|
|
12470
|
-
if (document.pointerLockElement ===
|
|
12471
|
-
state._delta = [
|
|
12469
|
+
const _values = pointerValues(event2);
|
|
12470
|
+
if (document.pointerLockElement === event2.target) {
|
|
12471
|
+
state._delta = [event2.movementX, event2.movementY];
|
|
12472
12472
|
} else {
|
|
12473
12473
|
state._delta = V.sub(_values, state._values);
|
|
12474
12474
|
this.computeValues(_values);
|
|
12475
12475
|
}
|
|
12476
12476
|
V.addTo(state._movement, state._delta);
|
|
12477
|
-
this.compute(
|
|
12477
|
+
this.compute(event2);
|
|
12478
12478
|
if (state._delayed && state.intentional) {
|
|
12479
12479
|
this.timeoutStore.remove("dragDelay");
|
|
12480
12480
|
state.active = false;
|
|
12481
|
-
this.startPointerDrag(
|
|
12481
|
+
this.startPointerDrag(event2);
|
|
12482
12482
|
return;
|
|
12483
12483
|
}
|
|
12484
12484
|
if (config2.preventScrollAxis && !state._preventScroll) {
|
|
@@ -12489,7 +12489,7 @@ class DragEngine extends CoordinatesEngine {
|
|
|
12489
12489
|
return;
|
|
12490
12490
|
} else {
|
|
12491
12491
|
this.timeoutStore.remove("startPointerDrag");
|
|
12492
|
-
this.startPointerDrag(
|
|
12492
|
+
this.startPointerDrag(event2);
|
|
12493
12493
|
return;
|
|
12494
12494
|
}
|
|
12495
12495
|
} else {
|
|
@@ -12498,12 +12498,12 @@ class DragEngine extends CoordinatesEngine {
|
|
|
12498
12498
|
}
|
|
12499
12499
|
this.emit();
|
|
12500
12500
|
}
|
|
12501
|
-
pointerUp(
|
|
12502
|
-
this.ctrl.setEventIds(
|
|
12501
|
+
pointerUp(event2) {
|
|
12502
|
+
this.ctrl.setEventIds(event2);
|
|
12503
12503
|
try {
|
|
12504
|
-
if (this.config.pointerCapture &&
|
|
12504
|
+
if (this.config.pointerCapture && event2.target.hasPointerCapture(event2.pointerId)) {
|
|
12505
12505
|
;
|
|
12506
|
-
|
|
12506
|
+
event2.target.releasePointerCapture(event2.pointerId);
|
|
12507
12507
|
}
|
|
12508
12508
|
} catch (_unused) {
|
|
12509
12509
|
}
|
|
@@ -12511,12 +12511,12 @@ class DragEngine extends CoordinatesEngine {
|
|
|
12511
12511
|
const config2 = this.config;
|
|
12512
12512
|
if (!state._active || !state._pointerActive)
|
|
12513
12513
|
return;
|
|
12514
|
-
const id = pointerId(
|
|
12514
|
+
const id = pointerId(event2);
|
|
12515
12515
|
if (state._pointerId !== void 0 && id !== state._pointerId)
|
|
12516
12516
|
return;
|
|
12517
12517
|
this.state._pointerActive = false;
|
|
12518
12518
|
this.setActive();
|
|
12519
|
-
this.compute(
|
|
12519
|
+
this.compute(event2);
|
|
12520
12520
|
const [dx, dy] = state._distance;
|
|
12521
12521
|
state.tap = dx <= config2.tapsThreshold && dy <= config2.tapsThreshold;
|
|
12522
12522
|
if (state.tap && config2.filterTaps) {
|
|
@@ -12538,17 +12538,17 @@ class DragEngine extends CoordinatesEngine {
|
|
|
12538
12538
|
}
|
|
12539
12539
|
this.emit();
|
|
12540
12540
|
}
|
|
12541
|
-
pointerClick(
|
|
12542
|
-
if (!this.state.tap &&
|
|
12543
|
-
|
|
12544
|
-
|
|
12541
|
+
pointerClick(event2) {
|
|
12542
|
+
if (!this.state.tap && event2.detail > 0) {
|
|
12543
|
+
event2.preventDefault();
|
|
12544
|
+
event2.stopPropagation();
|
|
12545
12545
|
}
|
|
12546
12546
|
}
|
|
12547
|
-
setupPointer(
|
|
12547
|
+
setupPointer(event2) {
|
|
12548
12548
|
const config2 = this.config;
|
|
12549
12549
|
const device = config2.device;
|
|
12550
12550
|
if (config2.pointerLock) {
|
|
12551
|
-
|
|
12551
|
+
event2.currentTarget.requestPointerLock();
|
|
12552
12552
|
}
|
|
12553
12553
|
if (!config2.pointerCapture) {
|
|
12554
12554
|
this.eventStore.add(this.sharedConfig.window, device, "change", this.pointerMove.bind(this));
|
|
@@ -12561,47 +12561,47 @@ class DragEngine extends CoordinatesEngine {
|
|
|
12561
12561
|
document.exitPointerLock();
|
|
12562
12562
|
}
|
|
12563
12563
|
}
|
|
12564
|
-
preventScroll(
|
|
12565
|
-
if (this.state._preventScroll &&
|
|
12566
|
-
|
|
12564
|
+
preventScroll(event2) {
|
|
12565
|
+
if (this.state._preventScroll && event2.cancelable) {
|
|
12566
|
+
event2.preventDefault();
|
|
12567
12567
|
}
|
|
12568
12568
|
}
|
|
12569
|
-
setupScrollPrevention(
|
|
12569
|
+
setupScrollPrevention(event2) {
|
|
12570
12570
|
this.state._preventScroll = false;
|
|
12571
|
-
persistEvent(
|
|
12571
|
+
persistEvent(event2);
|
|
12572
12572
|
const remove = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
|
|
12573
12573
|
passive: false
|
|
12574
12574
|
});
|
|
12575
12575
|
this.eventStore.add(this.sharedConfig.window, "touch", "end", remove);
|
|
12576
12576
|
this.eventStore.add(this.sharedConfig.window, "touch", "cancel", remove);
|
|
12577
|
-
this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay,
|
|
12577
|
+
this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, event2);
|
|
12578
12578
|
}
|
|
12579
|
-
setupDelayTrigger(
|
|
12579
|
+
setupDelayTrigger(event2) {
|
|
12580
12580
|
this.state._delayed = true;
|
|
12581
12581
|
this.timeoutStore.add("dragDelay", () => {
|
|
12582
12582
|
this.state._step = [0, 0];
|
|
12583
|
-
this.startPointerDrag(
|
|
12583
|
+
this.startPointerDrag(event2);
|
|
12584
12584
|
}, this.config.delay);
|
|
12585
12585
|
}
|
|
12586
|
-
keyDown(
|
|
12587
|
-
const deltaFn = KEYS_DELTA_MAP[
|
|
12586
|
+
keyDown(event2) {
|
|
12587
|
+
const deltaFn = KEYS_DELTA_MAP[event2.key];
|
|
12588
12588
|
if (deltaFn) {
|
|
12589
12589
|
const state = this.state;
|
|
12590
|
-
const factor =
|
|
12591
|
-
this.start(
|
|
12590
|
+
const factor = event2.shiftKey ? 10 : event2.altKey ? 0.1 : 1;
|
|
12591
|
+
this.start(event2);
|
|
12592
12592
|
state._delta = deltaFn(this.config.keyboardDisplacement, factor);
|
|
12593
12593
|
state._keyboardActive = true;
|
|
12594
12594
|
V.addTo(state._movement, state._delta);
|
|
12595
|
-
this.compute(
|
|
12595
|
+
this.compute(event2);
|
|
12596
12596
|
this.emit();
|
|
12597
12597
|
}
|
|
12598
12598
|
}
|
|
12599
|
-
keyUp(
|
|
12600
|
-
if (!(
|
|
12599
|
+
keyUp(event2) {
|
|
12600
|
+
if (!(event2.key in KEYS_DELTA_MAP))
|
|
12601
12601
|
return;
|
|
12602
12602
|
this.state._keyboardActive = false;
|
|
12603
12603
|
this.setActive();
|
|
12604
|
-
this.compute(
|
|
12604
|
+
this.compute(event2);
|
|
12605
12605
|
this.emit();
|
|
12606
12606
|
}
|
|
12607
12607
|
bind(bindFunction) {
|
|
@@ -12625,8 +12625,8 @@ class DragEngine extends CoordinatesEngine {
|
|
|
12625
12625
|
}
|
|
12626
12626
|
}
|
|
12627
12627
|
}
|
|
12628
|
-
function persistEvent(
|
|
12629
|
-
"persist" in
|
|
12628
|
+
function persistEvent(event2) {
|
|
12629
|
+
"persist" in event2 && typeof event2.persist === "function" && event2.persist();
|
|
12630
12630
|
}
|
|
12631
12631
|
const isBrowser = typeof window !== "undefined" && window.document && window.document.createElement;
|
|
12632
12632
|
function supportsTouchEvents() {
|
|
@@ -12819,18 +12819,18 @@ class WheelEngine extends CoordinatesEngine {
|
|
|
12819
12819
|
super(...args);
|
|
12820
12820
|
_defineProperty$1(this, "ingKey", "wheeling");
|
|
12821
12821
|
}
|
|
12822
|
-
wheel(
|
|
12822
|
+
wheel(event2) {
|
|
12823
12823
|
if (!this.state._active)
|
|
12824
|
-
this.start(
|
|
12825
|
-
this.wheelChange(
|
|
12824
|
+
this.start(event2);
|
|
12825
|
+
this.wheelChange(event2);
|
|
12826
12826
|
this.timeoutStore.add("wheelEnd", this.wheelEnd.bind(this));
|
|
12827
12827
|
}
|
|
12828
|
-
wheelChange(
|
|
12828
|
+
wheelChange(event2) {
|
|
12829
12829
|
const state = this.state;
|
|
12830
|
-
state._delta = wheelValues(
|
|
12830
|
+
state._delta = wheelValues(event2);
|
|
12831
12831
|
V.addTo(state._movement, state._delta);
|
|
12832
12832
|
clampStateInternalMovementToBounds(state);
|
|
12833
|
-
this.compute(
|
|
12833
|
+
this.compute(event2);
|
|
12834
12834
|
this.emit();
|
|
12835
12835
|
}
|
|
12836
12836
|
wheelEnd() {
|
|
@@ -13037,15 +13037,15 @@ class Controller {
|
|
|
13037
13037
|
});
|
|
13038
13038
|
resolveGestures(this, handlers);
|
|
13039
13039
|
}
|
|
13040
|
-
setEventIds(
|
|
13041
|
-
if (isTouch(
|
|
13042
|
-
this.touchIds = new Set(touchIds(
|
|
13040
|
+
setEventIds(event2) {
|
|
13041
|
+
if (isTouch(event2)) {
|
|
13042
|
+
this.touchIds = new Set(touchIds(event2));
|
|
13043
13043
|
return this.touchIds;
|
|
13044
|
-
} else if ("pointerId" in
|
|
13045
|
-
if (
|
|
13046
|
-
this.pointerIds.delete(
|
|
13047
|
-
else if (
|
|
13048
|
-
this.pointerIds.add(
|
|
13044
|
+
} else if ("pointerId" in event2) {
|
|
13045
|
+
if (event2.type === "pointerup" || event2.type === "pointercancel")
|
|
13046
|
+
this.pointerIds.delete(event2.pointerId);
|
|
13047
|
+
else if (event2.type === "pointerdown")
|
|
13048
|
+
this.pointerIds.add(event2.pointerId);
|
|
13049
13049
|
return this.pointerIds;
|
|
13050
13050
|
}
|
|
13051
13051
|
}
|
|
@@ -13088,8 +13088,8 @@ class Controller {
|
|
|
13088
13088
|
}
|
|
13089
13089
|
const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target);
|
|
13090
13090
|
for (const eventKey in this.nativeHandlers) {
|
|
13091
|
-
nativeBindFunction(eventKey, "", (
|
|
13092
|
-
event,
|
|
13091
|
+
nativeBindFunction(eventKey, "", (event2) => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, {
|
|
13092
|
+
event: event2,
|
|
13093
13093
|
args
|
|
13094
13094
|
})), void 0, true);
|
|
13095
13095
|
}
|
|
@@ -16028,6 +16028,15 @@ function _createClass(e2, r, t2) {
|
|
|
16028
16028
|
writable: false
|
|
16029
16029
|
}), e2;
|
|
16030
16030
|
}
|
|
16031
|
+
var interopRequireDefault = { exports: {} };
|
|
16032
|
+
(function(module) {
|
|
16033
|
+
function _interopRequireDefault2(e2) {
|
|
16034
|
+
return e2 && e2.__esModule ? e2 : {
|
|
16035
|
+
"default": e2
|
|
16036
|
+
};
|
|
16037
|
+
}
|
|
16038
|
+
module.exports = _interopRequireDefault2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
16039
|
+
})(interopRequireDefault);
|
|
16031
16040
|
var input = "";
|
|
16032
16041
|
function useInputHandleKeyDown({
|
|
16033
16042
|
onEnterPress,
|
|
@@ -17052,7 +17061,1105 @@ function TagV2(props) {
|
|
|
17052
17061
|
style: { color, backgroundColor }
|
|
17053
17062
|
}, props.children);
|
|
17054
17063
|
}
|
|
17064
|
+
var lib = {};
|
|
17065
|
+
var keyboard = { exports: {} };
|
|
17066
|
+
(function(module, exports) {
|
|
17067
|
+
(function(global2, factory) {
|
|
17068
|
+
module.exports = factory();
|
|
17069
|
+
})(commonjsGlobal, function() {
|
|
17070
|
+
function _typeof2(obj) {
|
|
17071
|
+
"@babel/helpers - typeof";
|
|
17072
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
17073
|
+
_typeof2 = function(obj2) {
|
|
17074
|
+
return typeof obj2;
|
|
17075
|
+
};
|
|
17076
|
+
} else {
|
|
17077
|
+
_typeof2 = function(obj2) {
|
|
17078
|
+
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
17079
|
+
};
|
|
17080
|
+
}
|
|
17081
|
+
return _typeof2(obj);
|
|
17082
|
+
}
|
|
17083
|
+
function _classCallCheck2(instance, Constructor) {
|
|
17084
|
+
if (!(instance instanceof Constructor)) {
|
|
17085
|
+
throw new TypeError("Cannot call a class as a function");
|
|
17086
|
+
}
|
|
17087
|
+
}
|
|
17088
|
+
function _defineProperties2(target, props) {
|
|
17089
|
+
for (var i = 0; i < props.length; i++) {
|
|
17090
|
+
var descriptor = props[i];
|
|
17091
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
17092
|
+
descriptor.configurable = true;
|
|
17093
|
+
if ("value" in descriptor)
|
|
17094
|
+
descriptor.writable = true;
|
|
17095
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
17096
|
+
}
|
|
17097
|
+
}
|
|
17098
|
+
function _createClass2(Constructor, protoProps, staticProps) {
|
|
17099
|
+
if (protoProps)
|
|
17100
|
+
_defineProperties2(Constructor.prototype, protoProps);
|
|
17101
|
+
if (staticProps)
|
|
17102
|
+
_defineProperties2(Constructor, staticProps);
|
|
17103
|
+
return Constructor;
|
|
17104
|
+
}
|
|
17105
|
+
function _toConsumableArray2(arr) {
|
|
17106
|
+
return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2();
|
|
17107
|
+
}
|
|
17108
|
+
function _arrayWithoutHoles2(arr) {
|
|
17109
|
+
if (Array.isArray(arr))
|
|
17110
|
+
return _arrayLikeToArray2(arr);
|
|
17111
|
+
}
|
|
17112
|
+
function _iterableToArray2(iter) {
|
|
17113
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
|
|
17114
|
+
return Array.from(iter);
|
|
17115
|
+
}
|
|
17116
|
+
function _unsupportedIterableToArray2(o, minLen) {
|
|
17117
|
+
if (!o)
|
|
17118
|
+
return;
|
|
17119
|
+
if (typeof o === "string")
|
|
17120
|
+
return _arrayLikeToArray2(o, minLen);
|
|
17121
|
+
var n2 = Object.prototype.toString.call(o).slice(8, -1);
|
|
17122
|
+
if (n2 === "Object" && o.constructor)
|
|
17123
|
+
n2 = o.constructor.name;
|
|
17124
|
+
if (n2 === "Map" || n2 === "Set")
|
|
17125
|
+
return Array.from(o);
|
|
17126
|
+
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
|
|
17127
|
+
return _arrayLikeToArray2(o, minLen);
|
|
17128
|
+
}
|
|
17129
|
+
function _arrayLikeToArray2(arr, len) {
|
|
17130
|
+
if (len == null || len > arr.length)
|
|
17131
|
+
len = arr.length;
|
|
17132
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
17133
|
+
arr2[i] = arr[i];
|
|
17134
|
+
return arr2;
|
|
17135
|
+
}
|
|
17136
|
+
function _nonIterableSpread2() {
|
|
17137
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
17138
|
+
}
|
|
17139
|
+
var KeyCombo = /* @__PURE__ */ function() {
|
|
17140
|
+
function KeyCombo2(keyComboStr) {
|
|
17141
|
+
_classCallCheck2(this, KeyCombo2);
|
|
17142
|
+
this.sourceStr = keyComboStr;
|
|
17143
|
+
this.subCombos = KeyCombo2.parseComboStr(keyComboStr);
|
|
17144
|
+
this.keyNames = this.subCombos.reduce(function(memo2, nextSubCombo) {
|
|
17145
|
+
return memo2.concat(nextSubCombo);
|
|
17146
|
+
}, []);
|
|
17147
|
+
}
|
|
17148
|
+
_createClass2(KeyCombo2, [{
|
|
17149
|
+
key: "check",
|
|
17150
|
+
value: function check(pressedKeyNames) {
|
|
17151
|
+
var startingKeyNameIndex = 0;
|
|
17152
|
+
for (var i = 0; i < this.subCombos.length; i += 1) {
|
|
17153
|
+
startingKeyNameIndex = this._checkSubCombo(this.subCombos[i], startingKeyNameIndex, pressedKeyNames);
|
|
17154
|
+
if (startingKeyNameIndex === -1) {
|
|
17155
|
+
return false;
|
|
17156
|
+
}
|
|
17157
|
+
}
|
|
17158
|
+
return true;
|
|
17159
|
+
}
|
|
17160
|
+
}, {
|
|
17161
|
+
key: "isEqual",
|
|
17162
|
+
value: function isEqual3(otherKeyCombo) {
|
|
17163
|
+
if (!otherKeyCombo || typeof otherKeyCombo !== "string" && _typeof2(otherKeyCombo) !== "object") {
|
|
17164
|
+
return false;
|
|
17165
|
+
}
|
|
17166
|
+
if (typeof otherKeyCombo === "string") {
|
|
17167
|
+
otherKeyCombo = new KeyCombo2(otherKeyCombo);
|
|
17168
|
+
}
|
|
17169
|
+
if (this.subCombos.length !== otherKeyCombo.subCombos.length) {
|
|
17170
|
+
return false;
|
|
17171
|
+
}
|
|
17172
|
+
for (var i = 0; i < this.subCombos.length; i += 1) {
|
|
17173
|
+
if (this.subCombos[i].length !== otherKeyCombo.subCombos[i].length) {
|
|
17174
|
+
return false;
|
|
17175
|
+
}
|
|
17176
|
+
}
|
|
17177
|
+
for (var _i = 0; _i < this.subCombos.length; _i += 1) {
|
|
17178
|
+
var subCombo = this.subCombos[_i];
|
|
17179
|
+
var otherSubCombo = otherKeyCombo.subCombos[_i].slice(0);
|
|
17180
|
+
for (var j = 0; j < subCombo.length; j += 1) {
|
|
17181
|
+
var keyName = subCombo[j];
|
|
17182
|
+
var index2 = otherSubCombo.indexOf(keyName);
|
|
17183
|
+
if (index2 > -1) {
|
|
17184
|
+
otherSubCombo.splice(index2, 1);
|
|
17185
|
+
}
|
|
17186
|
+
}
|
|
17187
|
+
if (otherSubCombo.length !== 0) {
|
|
17188
|
+
return false;
|
|
17189
|
+
}
|
|
17190
|
+
}
|
|
17191
|
+
return true;
|
|
17192
|
+
}
|
|
17193
|
+
}, {
|
|
17194
|
+
key: "_checkSubCombo",
|
|
17195
|
+
value: function _checkSubCombo(subCombo, startingKeyNameIndex, pressedKeyNames) {
|
|
17196
|
+
subCombo = subCombo.slice(0);
|
|
17197
|
+
pressedKeyNames = pressedKeyNames.slice(startingKeyNameIndex);
|
|
17198
|
+
var endIndex = startingKeyNameIndex;
|
|
17199
|
+
for (var i = 0; i < subCombo.length; i += 1) {
|
|
17200
|
+
var keyName = subCombo[i];
|
|
17201
|
+
if (keyName[0] === "\\") {
|
|
17202
|
+
var escapedKeyName = keyName.slice(1);
|
|
17203
|
+
if (escapedKeyName === KeyCombo2.comboDeliminator || escapedKeyName === KeyCombo2.keyDeliminator) {
|
|
17204
|
+
keyName = escapedKeyName;
|
|
17205
|
+
}
|
|
17206
|
+
}
|
|
17207
|
+
var index2 = pressedKeyNames.indexOf(keyName);
|
|
17208
|
+
if (index2 > -1) {
|
|
17209
|
+
subCombo.splice(i, 1);
|
|
17210
|
+
i -= 1;
|
|
17211
|
+
if (index2 > endIndex) {
|
|
17212
|
+
endIndex = index2;
|
|
17213
|
+
}
|
|
17214
|
+
if (subCombo.length === 0) {
|
|
17215
|
+
return endIndex;
|
|
17216
|
+
}
|
|
17217
|
+
}
|
|
17218
|
+
}
|
|
17219
|
+
return -1;
|
|
17220
|
+
}
|
|
17221
|
+
}]);
|
|
17222
|
+
return KeyCombo2;
|
|
17223
|
+
}();
|
|
17224
|
+
KeyCombo.comboDeliminator = ">";
|
|
17225
|
+
KeyCombo.keyDeliminator = "+";
|
|
17226
|
+
KeyCombo.parseComboStr = function(keyComboStr) {
|
|
17227
|
+
var subComboStrs = KeyCombo._splitStr(keyComboStr, KeyCombo.comboDeliminator);
|
|
17228
|
+
var combo = [];
|
|
17229
|
+
for (var i = 0; i < subComboStrs.length; i += 1) {
|
|
17230
|
+
combo.push(KeyCombo._splitStr(subComboStrs[i], KeyCombo.keyDeliminator));
|
|
17231
|
+
}
|
|
17232
|
+
return combo;
|
|
17233
|
+
};
|
|
17234
|
+
KeyCombo._splitStr = function(str, deliminator) {
|
|
17235
|
+
var s = str;
|
|
17236
|
+
var d2 = deliminator;
|
|
17237
|
+
var c6 = "";
|
|
17238
|
+
var ca = [];
|
|
17239
|
+
for (var ci = 0; ci < s.length; ci += 1) {
|
|
17240
|
+
if (ci > 0 && s[ci] === d2 && s[ci - 1] !== "\\") {
|
|
17241
|
+
ca.push(c6.trim());
|
|
17242
|
+
c6 = "";
|
|
17243
|
+
ci += 1;
|
|
17244
|
+
}
|
|
17245
|
+
c6 += s[ci];
|
|
17246
|
+
}
|
|
17247
|
+
if (c6) {
|
|
17248
|
+
ca.push(c6.trim());
|
|
17249
|
+
}
|
|
17250
|
+
return ca;
|
|
17251
|
+
};
|
|
17252
|
+
var Locale = /* @__PURE__ */ function() {
|
|
17253
|
+
function Locale2(name) {
|
|
17254
|
+
_classCallCheck2(this, Locale2);
|
|
17255
|
+
this.localeName = name;
|
|
17256
|
+
this.activeTargetKeys = [];
|
|
17257
|
+
this.pressedKeys = [];
|
|
17258
|
+
this._appliedMacros = [];
|
|
17259
|
+
this._keyMap = {};
|
|
17260
|
+
this._killKeyCodes = [];
|
|
17261
|
+
this._macros = [];
|
|
17262
|
+
}
|
|
17263
|
+
_createClass2(Locale2, [{
|
|
17264
|
+
key: "bindKeyCode",
|
|
17265
|
+
value: function bindKeyCode(keyCode, keyNames) {
|
|
17266
|
+
if (typeof keyNames === "string") {
|
|
17267
|
+
keyNames = [keyNames];
|
|
17268
|
+
}
|
|
17269
|
+
this._keyMap[keyCode] = keyNames;
|
|
17270
|
+
}
|
|
17271
|
+
}, {
|
|
17272
|
+
key: "bindMacro",
|
|
17273
|
+
value: function bindMacro(keyComboStr, keyNames) {
|
|
17274
|
+
if (typeof keyNames === "string") {
|
|
17275
|
+
keyNames = [keyNames];
|
|
17276
|
+
}
|
|
17277
|
+
var handler = null;
|
|
17278
|
+
if (typeof keyNames === "function") {
|
|
17279
|
+
handler = keyNames;
|
|
17280
|
+
keyNames = null;
|
|
17281
|
+
}
|
|
17282
|
+
var macro = {
|
|
17283
|
+
keyCombo: new KeyCombo(keyComboStr),
|
|
17284
|
+
keyNames,
|
|
17285
|
+
handler
|
|
17286
|
+
};
|
|
17287
|
+
this._macros.push(macro);
|
|
17288
|
+
}
|
|
17289
|
+
}, {
|
|
17290
|
+
key: "getKeyCodes",
|
|
17291
|
+
value: function getKeyCodes(keyName) {
|
|
17292
|
+
var keyCodes = [];
|
|
17293
|
+
for (var keyCode in this._keyMap) {
|
|
17294
|
+
var index2 = this._keyMap[keyCode].indexOf(keyName);
|
|
17295
|
+
if (index2 > -1) {
|
|
17296
|
+
keyCodes.push(keyCode | 0);
|
|
17297
|
+
}
|
|
17298
|
+
}
|
|
17299
|
+
return keyCodes;
|
|
17300
|
+
}
|
|
17301
|
+
}, {
|
|
17302
|
+
key: "getKeyNames",
|
|
17303
|
+
value: function getKeyNames(keyCode) {
|
|
17304
|
+
return this._keyMap[keyCode] || [];
|
|
17305
|
+
}
|
|
17306
|
+
}, {
|
|
17307
|
+
key: "setKillKey",
|
|
17308
|
+
value: function setKillKey(keyCode) {
|
|
17309
|
+
if (typeof keyCode === "string") {
|
|
17310
|
+
var keyCodes = this.getKeyCodes(keyCode);
|
|
17311
|
+
for (var i = 0; i < keyCodes.length; i += 1) {
|
|
17312
|
+
this.setKillKey(keyCodes[i]);
|
|
17313
|
+
}
|
|
17314
|
+
return;
|
|
17315
|
+
}
|
|
17316
|
+
this._killKeyCodes.push(keyCode);
|
|
17317
|
+
}
|
|
17318
|
+
}, {
|
|
17319
|
+
key: "pressKey",
|
|
17320
|
+
value: function pressKey(keyCode) {
|
|
17321
|
+
if (typeof keyCode === "string") {
|
|
17322
|
+
var keyCodes = this.getKeyCodes(keyCode);
|
|
17323
|
+
for (var i = 0; i < keyCodes.length; i += 1) {
|
|
17324
|
+
this.pressKey(keyCodes[i]);
|
|
17325
|
+
}
|
|
17326
|
+
return;
|
|
17327
|
+
}
|
|
17328
|
+
this.activeTargetKeys.length = 0;
|
|
17329
|
+
var keyNames = this.getKeyNames(keyCode);
|
|
17330
|
+
for (var _i = 0; _i < keyNames.length; _i += 1) {
|
|
17331
|
+
this.activeTargetKeys.push(keyNames[_i]);
|
|
17332
|
+
if (this.pressedKeys.indexOf(keyNames[_i]) === -1) {
|
|
17333
|
+
this.pressedKeys.push(keyNames[_i]);
|
|
17334
|
+
}
|
|
17335
|
+
}
|
|
17336
|
+
this._applyMacros();
|
|
17337
|
+
}
|
|
17338
|
+
}, {
|
|
17339
|
+
key: "releaseKey",
|
|
17340
|
+
value: function releaseKey(keyCode) {
|
|
17341
|
+
if (typeof keyCode === "string") {
|
|
17342
|
+
var keyCodes = this.getKeyCodes(keyCode);
|
|
17343
|
+
for (var i = 0; i < keyCodes.length; i += 1) {
|
|
17344
|
+
this.releaseKey(keyCodes[i]);
|
|
17345
|
+
}
|
|
17346
|
+
} else {
|
|
17347
|
+
var keyNames = this.getKeyNames(keyCode);
|
|
17348
|
+
var killKeyCodeIndex = this._killKeyCodes.indexOf(keyCode);
|
|
17349
|
+
if (killKeyCodeIndex !== -1) {
|
|
17350
|
+
this.pressedKeys.length = 0;
|
|
17351
|
+
} else {
|
|
17352
|
+
for (var _i2 = 0; _i2 < keyNames.length; _i2 += 1) {
|
|
17353
|
+
var index2 = this.pressedKeys.indexOf(keyNames[_i2]);
|
|
17354
|
+
if (index2 > -1) {
|
|
17355
|
+
this.pressedKeys.splice(index2, 1);
|
|
17356
|
+
}
|
|
17357
|
+
}
|
|
17358
|
+
}
|
|
17359
|
+
this.activeTargetKeys.length = 0;
|
|
17360
|
+
this._clearMacros();
|
|
17361
|
+
}
|
|
17362
|
+
}
|
|
17363
|
+
}, {
|
|
17364
|
+
key: "_applyMacros",
|
|
17365
|
+
value: function _applyMacros() {
|
|
17366
|
+
var macros = this._macros.slice(0);
|
|
17367
|
+
for (var i = 0; i < macros.length; i += 1) {
|
|
17368
|
+
var macro = macros[i];
|
|
17369
|
+
if (macro.keyCombo.check(this.pressedKeys)) {
|
|
17370
|
+
if (macro.handler) {
|
|
17371
|
+
macro.keyNames = macro.handler(this.pressedKeys);
|
|
17372
|
+
}
|
|
17373
|
+
for (var j = 0; j < macro.keyNames.length; j += 1) {
|
|
17374
|
+
if (this.pressedKeys.indexOf(macro.keyNames[j]) === -1) {
|
|
17375
|
+
this.pressedKeys.push(macro.keyNames[j]);
|
|
17376
|
+
}
|
|
17377
|
+
}
|
|
17378
|
+
this._appliedMacros.push(macro);
|
|
17379
|
+
}
|
|
17380
|
+
}
|
|
17381
|
+
}
|
|
17382
|
+
}, {
|
|
17383
|
+
key: "_clearMacros",
|
|
17384
|
+
value: function _clearMacros() {
|
|
17385
|
+
for (var i = 0; i < this._appliedMacros.length; i += 1) {
|
|
17386
|
+
var macro = this._appliedMacros[i];
|
|
17387
|
+
if (!macro.keyCombo.check(this.pressedKeys)) {
|
|
17388
|
+
for (var j = 0; j < macro.keyNames.length; j += 1) {
|
|
17389
|
+
var index2 = this.pressedKeys.indexOf(macro.keyNames[j]);
|
|
17390
|
+
if (index2 > -1) {
|
|
17391
|
+
this.pressedKeys.splice(index2, 1);
|
|
17392
|
+
}
|
|
17393
|
+
}
|
|
17394
|
+
if (macro.handler) {
|
|
17395
|
+
macro.keyNames = null;
|
|
17396
|
+
}
|
|
17397
|
+
this._appliedMacros.splice(i, 1);
|
|
17398
|
+
i -= 1;
|
|
17399
|
+
}
|
|
17400
|
+
}
|
|
17401
|
+
}
|
|
17402
|
+
}]);
|
|
17403
|
+
return Locale2;
|
|
17404
|
+
}();
|
|
17405
|
+
var Keyboard = /* @__PURE__ */ function() {
|
|
17406
|
+
function Keyboard2(targetWindow, targetElement, targetPlatform, targetUserAgent) {
|
|
17407
|
+
_classCallCheck2(this, Keyboard2);
|
|
17408
|
+
this._locale = null;
|
|
17409
|
+
this._currentContext = "";
|
|
17410
|
+
this._contexts = {};
|
|
17411
|
+
this._listeners = [];
|
|
17412
|
+
this._appliedListeners = [];
|
|
17413
|
+
this._locales = {};
|
|
17414
|
+
this._targetElement = null;
|
|
17415
|
+
this._targetWindow = null;
|
|
17416
|
+
this._targetPlatform = "";
|
|
17417
|
+
this._targetUserAgent = "";
|
|
17418
|
+
this._isModernBrowser = false;
|
|
17419
|
+
this._targetKeyDownBinding = null;
|
|
17420
|
+
this._targetKeyUpBinding = null;
|
|
17421
|
+
this._targetResetBinding = null;
|
|
17422
|
+
this._paused = false;
|
|
17423
|
+
this._contexts.global = {
|
|
17424
|
+
listeners: this._listeners,
|
|
17425
|
+
targetWindow,
|
|
17426
|
+
targetElement,
|
|
17427
|
+
targetPlatform,
|
|
17428
|
+
targetUserAgent
|
|
17429
|
+
};
|
|
17430
|
+
this.setContext("global");
|
|
17431
|
+
}
|
|
17432
|
+
_createClass2(Keyboard2, [{
|
|
17433
|
+
key: "setLocale",
|
|
17434
|
+
value: function setLocale(localeName, localeBuilder) {
|
|
17435
|
+
var locale2 = null;
|
|
17436
|
+
if (typeof localeName === "string") {
|
|
17437
|
+
if (localeBuilder) {
|
|
17438
|
+
locale2 = new Locale(localeName);
|
|
17439
|
+
localeBuilder(locale2, this._targetPlatform, this._targetUserAgent);
|
|
17440
|
+
} else {
|
|
17441
|
+
locale2 = this._locales[localeName] || null;
|
|
17442
|
+
}
|
|
17443
|
+
} else {
|
|
17444
|
+
locale2 = localeName;
|
|
17445
|
+
localeName = locale2._localeName;
|
|
17446
|
+
}
|
|
17447
|
+
this._locale = locale2;
|
|
17448
|
+
this._locales[localeName] = locale2;
|
|
17449
|
+
if (locale2) {
|
|
17450
|
+
this._locale.pressedKeys = locale2.pressedKeys;
|
|
17451
|
+
}
|
|
17452
|
+
return this;
|
|
17453
|
+
}
|
|
17454
|
+
}, {
|
|
17455
|
+
key: "getLocale",
|
|
17456
|
+
value: function getLocale(localName) {
|
|
17457
|
+
localName || (localName = this._locale.localeName);
|
|
17458
|
+
return this._locales[localName] || null;
|
|
17459
|
+
}
|
|
17460
|
+
}, {
|
|
17461
|
+
key: "bind",
|
|
17462
|
+
value: function bind(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault2) {
|
|
17463
|
+
if (keyComboStr === null || typeof keyComboStr === "function") {
|
|
17464
|
+
preventRepeatByDefault2 = releaseHandler;
|
|
17465
|
+
releaseHandler = pressHandler;
|
|
17466
|
+
pressHandler = keyComboStr;
|
|
17467
|
+
keyComboStr = null;
|
|
17468
|
+
}
|
|
17469
|
+
if (keyComboStr && _typeof2(keyComboStr) === "object" && typeof keyComboStr.length === "number") {
|
|
17470
|
+
for (var i = 0; i < keyComboStr.length; i += 1) {
|
|
17471
|
+
this.bind(keyComboStr[i], pressHandler, releaseHandler);
|
|
17472
|
+
}
|
|
17473
|
+
return this;
|
|
17474
|
+
}
|
|
17475
|
+
this._listeners.push({
|
|
17476
|
+
keyCombo: keyComboStr ? new KeyCombo(keyComboStr) : null,
|
|
17477
|
+
pressHandler: pressHandler || null,
|
|
17478
|
+
releaseHandler: releaseHandler || null,
|
|
17479
|
+
preventRepeat: false,
|
|
17480
|
+
preventRepeatByDefault: preventRepeatByDefault2 || false,
|
|
17481
|
+
executingHandler: false
|
|
17482
|
+
});
|
|
17483
|
+
return this;
|
|
17484
|
+
}
|
|
17485
|
+
}, {
|
|
17486
|
+
key: "addListener",
|
|
17487
|
+
value: function addListener(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault2) {
|
|
17488
|
+
return this.bind(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault2);
|
|
17489
|
+
}
|
|
17490
|
+
}, {
|
|
17491
|
+
key: "on",
|
|
17492
|
+
value: function on(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault2) {
|
|
17493
|
+
return this.bind(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault2);
|
|
17494
|
+
}
|
|
17495
|
+
}, {
|
|
17496
|
+
key: "bindPress",
|
|
17497
|
+
value: function bindPress(keyComboStr, pressHandler, preventRepeatByDefault2) {
|
|
17498
|
+
return this.bind(keyComboStr, pressHandler, null, preventRepeatByDefault2);
|
|
17499
|
+
}
|
|
17500
|
+
}, {
|
|
17501
|
+
key: "bindRelease",
|
|
17502
|
+
value: function bindRelease(keyComboStr, releaseHandler) {
|
|
17503
|
+
return this.bind(keyComboStr, null, releaseHandler, preventRepeatByDefault);
|
|
17504
|
+
}
|
|
17505
|
+
}, {
|
|
17506
|
+
key: "unbind",
|
|
17507
|
+
value: function unbind(keyComboStr, pressHandler, releaseHandler) {
|
|
17508
|
+
if (keyComboStr === null || typeof keyComboStr === "function") {
|
|
17509
|
+
releaseHandler = pressHandler;
|
|
17510
|
+
pressHandler = keyComboStr;
|
|
17511
|
+
keyComboStr = null;
|
|
17512
|
+
}
|
|
17513
|
+
if (keyComboStr && _typeof2(keyComboStr) === "object" && typeof keyComboStr.length === "number") {
|
|
17514
|
+
for (var i = 0; i < keyComboStr.length; i += 1) {
|
|
17515
|
+
this.unbind(keyComboStr[i], pressHandler, releaseHandler);
|
|
17516
|
+
}
|
|
17517
|
+
return this;
|
|
17518
|
+
}
|
|
17519
|
+
for (var _i = 0; _i < this._listeners.length; _i += 1) {
|
|
17520
|
+
var listener = this._listeners[_i];
|
|
17521
|
+
var comboMatches = !keyComboStr && !listener.keyCombo || listener.keyCombo && listener.keyCombo.isEqual(keyComboStr);
|
|
17522
|
+
var pressHandlerMatches = !pressHandler && !releaseHandler || !pressHandler && !listener.pressHandler || pressHandler === listener.pressHandler;
|
|
17523
|
+
var releaseHandlerMatches = !pressHandler && !releaseHandler || !releaseHandler && !listener.releaseHandler || releaseHandler === listener.releaseHandler;
|
|
17524
|
+
if (comboMatches && pressHandlerMatches && releaseHandlerMatches) {
|
|
17525
|
+
this._listeners.splice(_i, 1);
|
|
17526
|
+
_i -= 1;
|
|
17527
|
+
}
|
|
17528
|
+
}
|
|
17529
|
+
return this;
|
|
17530
|
+
}
|
|
17531
|
+
}, {
|
|
17532
|
+
key: "removeListener",
|
|
17533
|
+
value: function removeListener(keyComboStr, pressHandler, releaseHandler) {
|
|
17534
|
+
return this.unbind(keyComboStr, pressHandler, releaseHandler);
|
|
17535
|
+
}
|
|
17536
|
+
}, {
|
|
17537
|
+
key: "off",
|
|
17538
|
+
value: function off(keyComboStr, pressHandler, releaseHandler) {
|
|
17539
|
+
return this.unbind(keyComboStr, pressHandler, releaseHandler);
|
|
17540
|
+
}
|
|
17541
|
+
}, {
|
|
17542
|
+
key: "setContext",
|
|
17543
|
+
value: function setContext(contextName) {
|
|
17544
|
+
if (this._locale) {
|
|
17545
|
+
this.releaseAllKeys();
|
|
17546
|
+
}
|
|
17547
|
+
if (!this._contexts[contextName]) {
|
|
17548
|
+
var globalContext = this._contexts.global;
|
|
17549
|
+
this._contexts[contextName] = {
|
|
17550
|
+
listeners: [],
|
|
17551
|
+
targetWindow: globalContext.targetWindow,
|
|
17552
|
+
targetElement: globalContext.targetElement,
|
|
17553
|
+
targetPlatform: globalContext.targetPlatform,
|
|
17554
|
+
targetUserAgent: globalContext.targetUserAgent
|
|
17555
|
+
};
|
|
17556
|
+
}
|
|
17557
|
+
var context = this._contexts[contextName];
|
|
17558
|
+
this._currentContext = contextName;
|
|
17559
|
+
this._listeners = context.listeners;
|
|
17560
|
+
this.stop();
|
|
17561
|
+
this.watch(context.targetWindow, context.targetElement, context.targetPlatform, context.targetUserAgent);
|
|
17562
|
+
return this;
|
|
17563
|
+
}
|
|
17564
|
+
}, {
|
|
17565
|
+
key: "getContext",
|
|
17566
|
+
value: function getContext() {
|
|
17567
|
+
return this._currentContext;
|
|
17568
|
+
}
|
|
17569
|
+
}, {
|
|
17570
|
+
key: "withContext",
|
|
17571
|
+
value: function withContext(contextName, callback) {
|
|
17572
|
+
var previousContextName = this.getContext();
|
|
17573
|
+
this.setContext(contextName);
|
|
17574
|
+
callback();
|
|
17575
|
+
this.setContext(previousContextName);
|
|
17576
|
+
return this;
|
|
17577
|
+
}
|
|
17578
|
+
}, {
|
|
17579
|
+
key: "watch",
|
|
17580
|
+
value: function watch(targetWindow, targetElement, targetPlatform, targetUserAgent) {
|
|
17581
|
+
var _this = this;
|
|
17582
|
+
this.stop();
|
|
17583
|
+
var win = typeof globalThis !== "undefined" ? globalThis : typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : {};
|
|
17584
|
+
if (!targetWindow) {
|
|
17585
|
+
if (!win.addEventListener && !win.attachEvent) {
|
|
17586
|
+
if (this._currentContext === "global") {
|
|
17587
|
+
return;
|
|
17588
|
+
}
|
|
17589
|
+
throw new Error("Cannot find window functions addEventListener or attachEvent.");
|
|
17590
|
+
}
|
|
17591
|
+
targetWindow = win;
|
|
17592
|
+
}
|
|
17593
|
+
if (typeof targetWindow.nodeType === "number") {
|
|
17594
|
+
targetUserAgent = targetPlatform;
|
|
17595
|
+
targetPlatform = targetElement;
|
|
17596
|
+
targetElement = targetWindow;
|
|
17597
|
+
targetWindow = win;
|
|
17598
|
+
}
|
|
17599
|
+
if (!targetWindow.addEventListener && !targetWindow.attachEvent) {
|
|
17600
|
+
throw new Error("Cannot find addEventListener or attachEvent methods on targetWindow.");
|
|
17601
|
+
}
|
|
17602
|
+
this._isModernBrowser = !!targetWindow.addEventListener;
|
|
17603
|
+
var userAgent = targetWindow.navigator && targetWindow.navigator.userAgent || "";
|
|
17604
|
+
var platform = targetWindow.navigator && targetWindow.navigator.platform || "";
|
|
17605
|
+
targetElement && targetElement !== null || (targetElement = targetWindow.document);
|
|
17606
|
+
targetPlatform && targetPlatform !== null || (targetPlatform = platform);
|
|
17607
|
+
targetUserAgent && targetUserAgent !== null || (targetUserAgent = userAgent);
|
|
17608
|
+
this._targetKeyDownBinding = function(event2) {
|
|
17609
|
+
_this.pressKey(event2.keyCode, event2);
|
|
17610
|
+
_this._handleCommandBug(event2, platform);
|
|
17611
|
+
};
|
|
17612
|
+
this._targetKeyUpBinding = function(event2) {
|
|
17613
|
+
_this.releaseKey(event2.keyCode, event2);
|
|
17614
|
+
};
|
|
17615
|
+
this._targetResetBinding = function(event2) {
|
|
17616
|
+
_this.releaseAllKeys(event2);
|
|
17617
|
+
};
|
|
17618
|
+
this._bindEvent(targetElement, "keydown", this._targetKeyDownBinding);
|
|
17619
|
+
this._bindEvent(targetElement, "keyup", this._targetKeyUpBinding);
|
|
17620
|
+
this._bindEvent(targetWindow, "focus", this._targetResetBinding);
|
|
17621
|
+
this._bindEvent(targetWindow, "blur", this._targetResetBinding);
|
|
17622
|
+
this._targetElement = targetElement;
|
|
17623
|
+
this._targetWindow = targetWindow;
|
|
17624
|
+
this._targetPlatform = targetPlatform;
|
|
17625
|
+
this._targetUserAgent = targetUserAgent;
|
|
17626
|
+
var currentContext = this._contexts[this._currentContext];
|
|
17627
|
+
currentContext.targetWindow = this._targetWindow;
|
|
17628
|
+
currentContext.targetElement = this._targetElement;
|
|
17629
|
+
currentContext.targetPlatform = this._targetPlatform;
|
|
17630
|
+
currentContext.targetUserAgent = this._targetUserAgent;
|
|
17631
|
+
return this;
|
|
17632
|
+
}
|
|
17633
|
+
}, {
|
|
17634
|
+
key: "stop",
|
|
17635
|
+
value: function stop2() {
|
|
17636
|
+
if (!this._targetElement || !this._targetWindow) {
|
|
17637
|
+
return;
|
|
17638
|
+
}
|
|
17639
|
+
this._unbindEvent(this._targetElement, "keydown", this._targetKeyDownBinding);
|
|
17640
|
+
this._unbindEvent(this._targetElement, "keyup", this._targetKeyUpBinding);
|
|
17641
|
+
this._unbindEvent(this._targetWindow, "focus", this._targetResetBinding);
|
|
17642
|
+
this._unbindEvent(this._targetWindow, "blur", this._targetResetBinding);
|
|
17643
|
+
this._targetWindow = null;
|
|
17644
|
+
this._targetElement = null;
|
|
17645
|
+
return this;
|
|
17646
|
+
}
|
|
17647
|
+
}, {
|
|
17648
|
+
key: "pressKey",
|
|
17649
|
+
value: function pressKey(keyCode, event2) {
|
|
17650
|
+
if (this._paused) {
|
|
17651
|
+
return this;
|
|
17652
|
+
}
|
|
17653
|
+
if (!this._locale) {
|
|
17654
|
+
throw new Error("Locale not set");
|
|
17655
|
+
}
|
|
17656
|
+
this._locale.pressKey(keyCode);
|
|
17657
|
+
this._applyBindings(event2);
|
|
17658
|
+
return this;
|
|
17659
|
+
}
|
|
17660
|
+
}, {
|
|
17661
|
+
key: "releaseKey",
|
|
17662
|
+
value: function releaseKey(keyCode, event2) {
|
|
17663
|
+
if (this._paused) {
|
|
17664
|
+
return this;
|
|
17665
|
+
}
|
|
17666
|
+
if (!this._locale) {
|
|
17667
|
+
throw new Error("Locale not set");
|
|
17668
|
+
}
|
|
17669
|
+
this._locale.releaseKey(keyCode);
|
|
17670
|
+
this._clearBindings(event2);
|
|
17671
|
+
return this;
|
|
17672
|
+
}
|
|
17673
|
+
}, {
|
|
17674
|
+
key: "releaseAllKeys",
|
|
17675
|
+
value: function releaseAllKeys(event2) {
|
|
17676
|
+
if (this._paused) {
|
|
17677
|
+
return this;
|
|
17678
|
+
}
|
|
17679
|
+
if (!this._locale) {
|
|
17680
|
+
throw new Error("Locale not set");
|
|
17681
|
+
}
|
|
17682
|
+
this._locale.pressedKeys.length = 0;
|
|
17683
|
+
this._clearBindings(event2);
|
|
17684
|
+
return this;
|
|
17685
|
+
}
|
|
17686
|
+
}, {
|
|
17687
|
+
key: "pause",
|
|
17688
|
+
value: function pause() {
|
|
17689
|
+
if (this._paused) {
|
|
17690
|
+
return this;
|
|
17691
|
+
}
|
|
17692
|
+
if (this._locale) {
|
|
17693
|
+
this.releaseAllKeys();
|
|
17694
|
+
}
|
|
17695
|
+
this._paused = true;
|
|
17696
|
+
return this;
|
|
17697
|
+
}
|
|
17698
|
+
}, {
|
|
17699
|
+
key: "resume",
|
|
17700
|
+
value: function resume() {
|
|
17701
|
+
this._paused = false;
|
|
17702
|
+
return this;
|
|
17703
|
+
}
|
|
17704
|
+
}, {
|
|
17705
|
+
key: "reset",
|
|
17706
|
+
value: function reset() {
|
|
17707
|
+
this.releaseAllKeys();
|
|
17708
|
+
this._listeners.length = 0;
|
|
17709
|
+
return this;
|
|
17710
|
+
}
|
|
17711
|
+
}, {
|
|
17712
|
+
key: "_bindEvent",
|
|
17713
|
+
value: function _bindEvent(targetElement, eventName, handler) {
|
|
17714
|
+
return this._isModernBrowser ? targetElement.addEventListener(eventName, handler, false) : targetElement.attachEvent("on" + eventName, handler);
|
|
17715
|
+
}
|
|
17716
|
+
}, {
|
|
17717
|
+
key: "_unbindEvent",
|
|
17718
|
+
value: function _unbindEvent(targetElement, eventName, handler) {
|
|
17719
|
+
return this._isModernBrowser ? targetElement.removeEventListener(eventName, handler, false) : targetElement.detachEvent("on" + eventName, handler);
|
|
17720
|
+
}
|
|
17721
|
+
}, {
|
|
17722
|
+
key: "_getGroupedListeners",
|
|
17723
|
+
value: function _getGroupedListeners() {
|
|
17724
|
+
var listenerGroups = [];
|
|
17725
|
+
var listenerGroupMap = [];
|
|
17726
|
+
var listeners = this._listeners;
|
|
17727
|
+
if (this._currentContext !== "global") {
|
|
17728
|
+
listeners = [].concat(_toConsumableArray2(listeners), _toConsumableArray2(this._contexts.global.listeners));
|
|
17729
|
+
}
|
|
17730
|
+
listeners.sort(function(a, b2) {
|
|
17731
|
+
return (b2.keyCombo ? b2.keyCombo.keyNames.length : 0) - (a.keyCombo ? a.keyCombo.keyNames.length : 0);
|
|
17732
|
+
}).forEach(function(l2) {
|
|
17733
|
+
var mapIndex = -1;
|
|
17734
|
+
for (var i = 0; i < listenerGroupMap.length; i += 1) {
|
|
17735
|
+
if (listenerGroupMap[i] === null && l2.keyCombo === null || listenerGroupMap[i] !== null && listenerGroupMap[i].isEqual(l2.keyCombo)) {
|
|
17736
|
+
mapIndex = i;
|
|
17737
|
+
}
|
|
17738
|
+
}
|
|
17739
|
+
if (mapIndex === -1) {
|
|
17740
|
+
mapIndex = listenerGroupMap.length;
|
|
17741
|
+
listenerGroupMap.push(l2.keyCombo);
|
|
17742
|
+
}
|
|
17743
|
+
if (!listenerGroups[mapIndex]) {
|
|
17744
|
+
listenerGroups[mapIndex] = [];
|
|
17745
|
+
}
|
|
17746
|
+
listenerGroups[mapIndex].push(l2);
|
|
17747
|
+
});
|
|
17748
|
+
return listenerGroups;
|
|
17749
|
+
}
|
|
17750
|
+
}, {
|
|
17751
|
+
key: "_applyBindings",
|
|
17752
|
+
value: function _applyBindings(event2) {
|
|
17753
|
+
var _this2 = this;
|
|
17754
|
+
var preventRepeat = false;
|
|
17755
|
+
event2 || (event2 = {});
|
|
17756
|
+
event2.preventRepeat = function() {
|
|
17757
|
+
preventRepeat = true;
|
|
17758
|
+
};
|
|
17759
|
+
event2.pressedKeys = this._locale.pressedKeys.slice(0);
|
|
17760
|
+
var activeTargetKeys = this._locale.activeTargetKeys;
|
|
17761
|
+
var pressedKeys = this._locale.pressedKeys.slice(0);
|
|
17762
|
+
var listenerGroups = this._getGroupedListeners();
|
|
17763
|
+
var _loop = function _loop2(i2) {
|
|
17764
|
+
var listeners = listenerGroups[i2];
|
|
17765
|
+
var keyCombo = listeners[0].keyCombo;
|
|
17766
|
+
if (keyCombo === null || keyCombo.check(pressedKeys) && activeTargetKeys.some(function(k2) {
|
|
17767
|
+
return keyCombo.keyNames.includes(k2);
|
|
17768
|
+
})) {
|
|
17769
|
+
for (var j = 0; j < listeners.length; j += 1) {
|
|
17770
|
+
var listener = listeners[j];
|
|
17771
|
+
if (!listener.executingHandler && listener.pressHandler && !listener.preventRepeat) {
|
|
17772
|
+
listener.executingHandler = true;
|
|
17773
|
+
listener.pressHandler.call(_this2, event2);
|
|
17774
|
+
listener.executingHandler = false;
|
|
17775
|
+
if (preventRepeat || listener.preventRepeatByDefault) {
|
|
17776
|
+
listener.preventRepeat = true;
|
|
17777
|
+
preventRepeat = false;
|
|
17778
|
+
}
|
|
17779
|
+
}
|
|
17780
|
+
if (_this2._appliedListeners.indexOf(listener) === -1) {
|
|
17781
|
+
_this2._appliedListeners.push(listener);
|
|
17782
|
+
}
|
|
17783
|
+
}
|
|
17784
|
+
if (keyCombo) {
|
|
17785
|
+
for (var _j = 0; _j < keyCombo.keyNames.length; _j += 1) {
|
|
17786
|
+
var index2 = pressedKeys.indexOf(keyCombo.keyNames[_j]);
|
|
17787
|
+
if (index2 !== -1) {
|
|
17788
|
+
pressedKeys.splice(index2, 1);
|
|
17789
|
+
_j -= 1;
|
|
17790
|
+
}
|
|
17791
|
+
}
|
|
17792
|
+
}
|
|
17793
|
+
}
|
|
17794
|
+
};
|
|
17795
|
+
for (var i = 0; i < listenerGroups.length; i += 1) {
|
|
17796
|
+
_loop(i);
|
|
17797
|
+
}
|
|
17798
|
+
}
|
|
17799
|
+
}, {
|
|
17800
|
+
key: "_clearBindings",
|
|
17801
|
+
value: function _clearBindings(event2) {
|
|
17802
|
+
event2 || (event2 = {});
|
|
17803
|
+
event2.pressedKeys = this._locale.pressedKeys.slice(0);
|
|
17804
|
+
for (var i = 0; i < this._appliedListeners.length; i += 1) {
|
|
17805
|
+
var listener = this._appliedListeners[i];
|
|
17806
|
+
var keyCombo = listener.keyCombo;
|
|
17807
|
+
if (keyCombo === null || !keyCombo.check(this._locale.pressedKeys)) {
|
|
17808
|
+
listener.preventRepeat = false;
|
|
17809
|
+
if (keyCombo !== null || event2.pressedKeys.length === 0) {
|
|
17810
|
+
this._appliedListeners.splice(i, 1);
|
|
17811
|
+
i -= 1;
|
|
17812
|
+
}
|
|
17813
|
+
if (!listener.executingHandler && listener.releaseHandler) {
|
|
17814
|
+
listener.executingHandler = true;
|
|
17815
|
+
listener.releaseHandler.call(this, event2);
|
|
17816
|
+
listener.executingHandler = false;
|
|
17817
|
+
}
|
|
17818
|
+
}
|
|
17819
|
+
}
|
|
17820
|
+
}
|
|
17821
|
+
}, {
|
|
17822
|
+
key: "_handleCommandBug",
|
|
17823
|
+
value: function _handleCommandBug(event2, platform) {
|
|
17824
|
+
var modifierKeys = ["shift", "ctrl", "alt", "capslock", "tab", "command"];
|
|
17825
|
+
if (platform.match("Mac") && this._locale.pressedKeys.includes("command") && !modifierKeys.includes(this._locale.getKeyNames(event2.keyCode)[0])) {
|
|
17826
|
+
this._targetKeyUpBinding(event2);
|
|
17827
|
+
}
|
|
17828
|
+
}
|
|
17829
|
+
}]);
|
|
17830
|
+
return Keyboard2;
|
|
17831
|
+
}();
|
|
17832
|
+
function us(locale2, platform, userAgent) {
|
|
17833
|
+
locale2.bindKeyCode(3, ["cancel"]);
|
|
17834
|
+
locale2.bindKeyCode(8, ["backspace"]);
|
|
17835
|
+
locale2.bindKeyCode(9, ["tab"]);
|
|
17836
|
+
locale2.bindKeyCode(12, ["clear"]);
|
|
17837
|
+
locale2.bindKeyCode(13, ["enter"]);
|
|
17838
|
+
locale2.bindKeyCode(16, ["shift"]);
|
|
17839
|
+
locale2.bindKeyCode(17, ["ctrl"]);
|
|
17840
|
+
locale2.bindKeyCode(18, ["alt", "menu"]);
|
|
17841
|
+
locale2.bindKeyCode(19, ["pause", "break"]);
|
|
17842
|
+
locale2.bindKeyCode(20, ["capslock"]);
|
|
17843
|
+
locale2.bindKeyCode(27, ["escape", "esc"]);
|
|
17844
|
+
locale2.bindKeyCode(32, ["space", "spacebar"]);
|
|
17845
|
+
locale2.bindKeyCode(33, ["pageup"]);
|
|
17846
|
+
locale2.bindKeyCode(34, ["pagedown"]);
|
|
17847
|
+
locale2.bindKeyCode(35, ["end"]);
|
|
17848
|
+
locale2.bindKeyCode(36, ["home"]);
|
|
17849
|
+
locale2.bindKeyCode(37, ["left"]);
|
|
17850
|
+
locale2.bindKeyCode(38, ["up"]);
|
|
17851
|
+
locale2.bindKeyCode(39, ["right"]);
|
|
17852
|
+
locale2.bindKeyCode(40, ["down"]);
|
|
17853
|
+
locale2.bindKeyCode(41, ["select"]);
|
|
17854
|
+
locale2.bindKeyCode(42, ["printscreen"]);
|
|
17855
|
+
locale2.bindKeyCode(43, ["execute"]);
|
|
17856
|
+
locale2.bindKeyCode(44, ["snapshot"]);
|
|
17857
|
+
locale2.bindKeyCode(45, ["insert", "ins"]);
|
|
17858
|
+
locale2.bindKeyCode(46, ["delete", "del"]);
|
|
17859
|
+
locale2.bindKeyCode(47, ["help"]);
|
|
17860
|
+
locale2.bindKeyCode(145, ["scrolllock", "scroll"]);
|
|
17861
|
+
locale2.bindKeyCode(188, ["comma", ","]);
|
|
17862
|
+
locale2.bindKeyCode(190, ["period", "."]);
|
|
17863
|
+
locale2.bindKeyCode(191, ["slash", "forwardslash", "/"]);
|
|
17864
|
+
locale2.bindKeyCode(192, ["graveaccent", "`"]);
|
|
17865
|
+
locale2.bindKeyCode(219, ["openbracket", "["]);
|
|
17866
|
+
locale2.bindKeyCode(220, ["backslash", "\\"]);
|
|
17867
|
+
locale2.bindKeyCode(221, ["closebracket", "]"]);
|
|
17868
|
+
locale2.bindKeyCode(222, ["apostrophe", "'"]);
|
|
17869
|
+
locale2.bindKeyCode(48, ["zero", "0"]);
|
|
17870
|
+
locale2.bindKeyCode(49, ["one", "1"]);
|
|
17871
|
+
locale2.bindKeyCode(50, ["two", "2"]);
|
|
17872
|
+
locale2.bindKeyCode(51, ["three", "3"]);
|
|
17873
|
+
locale2.bindKeyCode(52, ["four", "4"]);
|
|
17874
|
+
locale2.bindKeyCode(53, ["five", "5"]);
|
|
17875
|
+
locale2.bindKeyCode(54, ["six", "6"]);
|
|
17876
|
+
locale2.bindKeyCode(55, ["seven", "7"]);
|
|
17877
|
+
locale2.bindKeyCode(56, ["eight", "8"]);
|
|
17878
|
+
locale2.bindKeyCode(57, ["nine", "9"]);
|
|
17879
|
+
locale2.bindKeyCode(96, ["numzero", "num0"]);
|
|
17880
|
+
locale2.bindKeyCode(97, ["numone", "num1"]);
|
|
17881
|
+
locale2.bindKeyCode(98, ["numtwo", "num2"]);
|
|
17882
|
+
locale2.bindKeyCode(99, ["numthree", "num3"]);
|
|
17883
|
+
locale2.bindKeyCode(100, ["numfour", "num4"]);
|
|
17884
|
+
locale2.bindKeyCode(101, ["numfive", "num5"]);
|
|
17885
|
+
locale2.bindKeyCode(102, ["numsix", "num6"]);
|
|
17886
|
+
locale2.bindKeyCode(103, ["numseven", "num7"]);
|
|
17887
|
+
locale2.bindKeyCode(104, ["numeight", "num8"]);
|
|
17888
|
+
locale2.bindKeyCode(105, ["numnine", "num9"]);
|
|
17889
|
+
locale2.bindKeyCode(106, ["nummultiply", "num*"]);
|
|
17890
|
+
locale2.bindKeyCode(107, ["numadd", "num+"]);
|
|
17891
|
+
locale2.bindKeyCode(108, ["numenter"]);
|
|
17892
|
+
locale2.bindKeyCode(109, ["numsubtract", "num-"]);
|
|
17893
|
+
locale2.bindKeyCode(110, ["numdecimal", "num."]);
|
|
17894
|
+
locale2.bindKeyCode(111, ["numdivide", "num/"]);
|
|
17895
|
+
locale2.bindKeyCode(144, ["numlock", "num"]);
|
|
17896
|
+
locale2.bindKeyCode(112, ["f1"]);
|
|
17897
|
+
locale2.bindKeyCode(113, ["f2"]);
|
|
17898
|
+
locale2.bindKeyCode(114, ["f3"]);
|
|
17899
|
+
locale2.bindKeyCode(115, ["f4"]);
|
|
17900
|
+
locale2.bindKeyCode(116, ["f5"]);
|
|
17901
|
+
locale2.bindKeyCode(117, ["f6"]);
|
|
17902
|
+
locale2.bindKeyCode(118, ["f7"]);
|
|
17903
|
+
locale2.bindKeyCode(119, ["f8"]);
|
|
17904
|
+
locale2.bindKeyCode(120, ["f9"]);
|
|
17905
|
+
locale2.bindKeyCode(121, ["f10"]);
|
|
17906
|
+
locale2.bindKeyCode(122, ["f11"]);
|
|
17907
|
+
locale2.bindKeyCode(123, ["f12"]);
|
|
17908
|
+
locale2.bindKeyCode(124, ["f13"]);
|
|
17909
|
+
locale2.bindKeyCode(125, ["f14"]);
|
|
17910
|
+
locale2.bindKeyCode(126, ["f15"]);
|
|
17911
|
+
locale2.bindKeyCode(127, ["f16"]);
|
|
17912
|
+
locale2.bindKeyCode(128, ["f17"]);
|
|
17913
|
+
locale2.bindKeyCode(129, ["f18"]);
|
|
17914
|
+
locale2.bindKeyCode(130, ["f19"]);
|
|
17915
|
+
locale2.bindKeyCode(131, ["f20"]);
|
|
17916
|
+
locale2.bindKeyCode(132, ["f21"]);
|
|
17917
|
+
locale2.bindKeyCode(133, ["f22"]);
|
|
17918
|
+
locale2.bindKeyCode(134, ["f23"]);
|
|
17919
|
+
locale2.bindKeyCode(135, ["f24"]);
|
|
17920
|
+
locale2.bindMacro("shift + `", ["tilde", "~"]);
|
|
17921
|
+
locale2.bindMacro("shift + 1", ["exclamation", "exclamationpoint", "!"]);
|
|
17922
|
+
locale2.bindMacro("shift + 2", ["at", "@"]);
|
|
17923
|
+
locale2.bindMacro("shift + 3", ["number", "#"]);
|
|
17924
|
+
locale2.bindMacro("shift + 4", ["dollar", "dollars", "dollarsign", "$"]);
|
|
17925
|
+
locale2.bindMacro("shift + 5", ["percent", "%"]);
|
|
17926
|
+
locale2.bindMacro("shift + 6", ["caret", "^"]);
|
|
17927
|
+
locale2.bindMacro("shift + 7", ["ampersand", "and", "&"]);
|
|
17928
|
+
locale2.bindMacro("shift + 8", ["asterisk", "*"]);
|
|
17929
|
+
locale2.bindMacro("shift + 9", ["openparen", "("]);
|
|
17930
|
+
locale2.bindMacro("shift + 0", ["closeparen", ")"]);
|
|
17931
|
+
locale2.bindMacro("shift + -", ["underscore", "_"]);
|
|
17932
|
+
locale2.bindMacro("shift + =", ["plus", "+"]);
|
|
17933
|
+
locale2.bindMacro("shift + [", ["opencurlybrace", "opencurlybracket", "{"]);
|
|
17934
|
+
locale2.bindMacro("shift + ]", ["closecurlybrace", "closecurlybracket", "}"]);
|
|
17935
|
+
locale2.bindMacro("shift + \\", ["verticalbar", "|"]);
|
|
17936
|
+
locale2.bindMacro("shift + ;", ["colon", ":"]);
|
|
17937
|
+
locale2.bindMacro("shift + '", ["quotationmark", "'"]);
|
|
17938
|
+
locale2.bindMacro("shift + !,", ["openanglebracket", "<"]);
|
|
17939
|
+
locale2.bindMacro("shift + .", ["closeanglebracket", ">"]);
|
|
17940
|
+
locale2.bindMacro("shift + /", ["questionmark", "?"]);
|
|
17941
|
+
if (platform.match("Mac")) {
|
|
17942
|
+
locale2.bindMacro("command", ["mod", "modifier"]);
|
|
17943
|
+
} else {
|
|
17944
|
+
locale2.bindMacro("ctrl", ["mod", "modifier"]);
|
|
17945
|
+
}
|
|
17946
|
+
for (var keyCode = 65; keyCode <= 90; keyCode += 1) {
|
|
17947
|
+
var keyName = String.fromCharCode(keyCode + 32);
|
|
17948
|
+
var capitalKeyName = String.fromCharCode(keyCode);
|
|
17949
|
+
locale2.bindKeyCode(keyCode, keyName);
|
|
17950
|
+
locale2.bindMacro("shift + " + keyName, capitalKeyName);
|
|
17951
|
+
locale2.bindMacro("capslock + " + keyName, capitalKeyName);
|
|
17952
|
+
}
|
|
17953
|
+
var semicolonKeyCode = userAgent.match("Firefox") ? 59 : 186;
|
|
17954
|
+
var dashKeyCode = userAgent.match("Firefox") ? 173 : 189;
|
|
17955
|
+
var equalKeyCode = userAgent.match("Firefox") ? 61 : 187;
|
|
17956
|
+
var leftCommandKeyCode;
|
|
17957
|
+
var rightCommandKeyCode;
|
|
17958
|
+
if (platform.match("Mac") && (userAgent.match("Safari") || userAgent.match("Chrome"))) {
|
|
17959
|
+
leftCommandKeyCode = 91;
|
|
17960
|
+
rightCommandKeyCode = 93;
|
|
17961
|
+
} else if (platform.match("Mac") && userAgent.match("Opera")) {
|
|
17962
|
+
leftCommandKeyCode = 17;
|
|
17963
|
+
rightCommandKeyCode = 17;
|
|
17964
|
+
} else if (platform.match("Mac") && userAgent.match("Firefox")) {
|
|
17965
|
+
leftCommandKeyCode = 224;
|
|
17966
|
+
rightCommandKeyCode = 224;
|
|
17967
|
+
}
|
|
17968
|
+
locale2.bindKeyCode(semicolonKeyCode, ["semicolon", ";"]);
|
|
17969
|
+
locale2.bindKeyCode(dashKeyCode, ["dash", "-"]);
|
|
17970
|
+
locale2.bindKeyCode(equalKeyCode, ["equal", "equalsign", "="]);
|
|
17971
|
+
locale2.bindKeyCode(leftCommandKeyCode, ["command", "windows", "win", "super", "leftcommand", "leftwindows", "leftwin", "leftsuper"]);
|
|
17972
|
+
locale2.bindKeyCode(rightCommandKeyCode, ["command", "windows", "win", "super", "rightcommand", "rightwindows", "rightwin", "rightsuper"]);
|
|
17973
|
+
locale2.setKillKey("command");
|
|
17974
|
+
}
|
|
17975
|
+
var keyboard2 = new Keyboard();
|
|
17976
|
+
keyboard2.setLocale("us", us);
|
|
17977
|
+
keyboard2.Keyboard = Keyboard;
|
|
17978
|
+
keyboard2.Locale = Locale;
|
|
17979
|
+
keyboard2.KeyCombo = KeyCombo;
|
|
17980
|
+
return keyboard2;
|
|
17981
|
+
});
|
|
17982
|
+
})(keyboard);
|
|
17983
|
+
var inputElement = document.createElement("input");
|
|
17984
|
+
inputElement.onfocus = function(event2) {
|
|
17985
|
+
event2.target.blur();
|
|
17986
|
+
document.body.removeChild(inputElement);
|
|
17987
|
+
};
|
|
17988
|
+
inputElement.style.width = "0px";
|
|
17989
|
+
document.body.appendChild(inputElement);
|
|
17990
|
+
setTimeout(function() {
|
|
17991
|
+
inputElement.focus();
|
|
17992
|
+
});
|
|
17993
|
+
(function(exports) {
|
|
17994
|
+
var _interopRequireDefault2 = interopRequireDefault.exports;
|
|
17995
|
+
exports.__esModule = true;
|
|
17996
|
+
exports["default"] = exports.AllKeyBind = void 0;
|
|
17997
|
+
var _keyboardjs = _interopRequireDefault2(keyboard.exports);
|
|
17998
|
+
var Stack = /* @__PURE__ */ function() {
|
|
17999
|
+
function Stack2() {
|
|
18000
|
+
this.list = void 0;
|
|
18001
|
+
this.list = [];
|
|
18002
|
+
}
|
|
18003
|
+
var _proto = Stack2.prototype;
|
|
18004
|
+
_proto.getHeader = function getHeader() {
|
|
18005
|
+
return this.list[this.list.length - 1];
|
|
18006
|
+
};
|
|
18007
|
+
_proto.findIndex = function findIndex2(element) {
|
|
18008
|
+
var matchIndex = this.list.findIndex(function(item) {
|
|
18009
|
+
return item === element;
|
|
18010
|
+
});
|
|
18011
|
+
return matchIndex;
|
|
18012
|
+
};
|
|
18013
|
+
_proto.put = function put(element) {
|
|
18014
|
+
var matchIndex = this.findIndex(element);
|
|
18015
|
+
if (matchIndex > -1) {
|
|
18016
|
+
this.list.splice(matchIndex, 1);
|
|
18017
|
+
return;
|
|
18018
|
+
}
|
|
18019
|
+
this.list.push(element);
|
|
18020
|
+
};
|
|
18021
|
+
_proto.pop = function pop() {
|
|
18022
|
+
this.list.pop();
|
|
18023
|
+
};
|
|
18024
|
+
_proto.removeItem = function removeItem(element) {
|
|
18025
|
+
var matchIndex = this.findIndex(element);
|
|
18026
|
+
var matchItem = this.list[matchIndex];
|
|
18027
|
+
if (matchIndex > -1) {
|
|
18028
|
+
this.list.splice(matchIndex, 1);
|
|
18029
|
+
}
|
|
18030
|
+
return matchItem;
|
|
18031
|
+
};
|
|
18032
|
+
_proto.getList = function getList() {
|
|
18033
|
+
return this.list;
|
|
18034
|
+
};
|
|
18035
|
+
return Stack2;
|
|
18036
|
+
}();
|
|
18037
|
+
var AllKeyBind = /* @__PURE__ */ function() {
|
|
18038
|
+
function AllKeyBind2() {
|
|
18039
|
+
this.list = [];
|
|
18040
|
+
this.onDocumentKeyDown = this.onDocumentKeyDown.bind(this);
|
|
18041
|
+
}
|
|
18042
|
+
var _proto2 = AllKeyBind2.prototype;
|
|
18043
|
+
_proto2.onDocumentKeyDown = function onDocumentKeyDown(event2) {
|
|
18044
|
+
this.list.forEach(function(itemFunc) {
|
|
18045
|
+
itemFunc instanceof Function && itemFunc(event2);
|
|
18046
|
+
});
|
|
18047
|
+
};
|
|
18048
|
+
_proto2.init = function init2() {
|
|
18049
|
+
document.addEventListener("keydown", this.onDocumentKeyDown, false);
|
|
18050
|
+
};
|
|
18051
|
+
_proto2.findIndex = function findIndex2(element) {
|
|
18052
|
+
var matchIndex = this.list.findIndex(function(item) {
|
|
18053
|
+
return item === element;
|
|
18054
|
+
});
|
|
18055
|
+
return matchIndex;
|
|
18056
|
+
};
|
|
18057
|
+
_proto2.add = function add(handler) {
|
|
18058
|
+
if (this.findIndex(handler) > -1) {
|
|
18059
|
+
return;
|
|
18060
|
+
}
|
|
18061
|
+
this.list.push(handler);
|
|
18062
|
+
};
|
|
18063
|
+
_proto2.bind = function bind(handler) {
|
|
18064
|
+
if (!(handler instanceof Function)) {
|
|
18065
|
+
return;
|
|
18066
|
+
}
|
|
18067
|
+
var beforeSize = this.list.length;
|
|
18068
|
+
this.add(handler);
|
|
18069
|
+
if (beforeSize === 0 && this.list.length === 1) {
|
|
18070
|
+
this.init();
|
|
18071
|
+
}
|
|
18072
|
+
};
|
|
18073
|
+
_proto2.unbind = function unbind(handler) {
|
|
18074
|
+
if (!(handler instanceof Function)) {
|
|
18075
|
+
return;
|
|
18076
|
+
}
|
|
18077
|
+
var mathIndex = this.findIndex(handler);
|
|
18078
|
+
var beforeSize = this.list.length;
|
|
18079
|
+
if (mathIndex > -1) {
|
|
18080
|
+
this.list.splice(mathIndex, 1);
|
|
18081
|
+
return;
|
|
18082
|
+
}
|
|
18083
|
+
if (beforeSize === 1 && this.list.length === 0) {
|
|
18084
|
+
this.destroy();
|
|
18085
|
+
}
|
|
18086
|
+
};
|
|
18087
|
+
_proto2.release = function release() {
|
|
18088
|
+
this.list = [];
|
|
18089
|
+
this.destroy();
|
|
18090
|
+
};
|
|
18091
|
+
_proto2.destroy = function destroy() {
|
|
18092
|
+
document.removeEventListener("keydown", this.onDocumentKeyDown);
|
|
18093
|
+
};
|
|
18094
|
+
return AllKeyBind2;
|
|
18095
|
+
}();
|
|
18096
|
+
exports.AllKeyBind = AllKeyBind;
|
|
18097
|
+
var Event2 = /* @__PURE__ */ function() {
|
|
18098
|
+
function Event3() {
|
|
18099
|
+
this.mapStack = {};
|
|
18100
|
+
this.allBind = new AllKeyBind();
|
|
18101
|
+
_keyboardjs["default"].setContext("operate-event" + Date.now());
|
|
18102
|
+
}
|
|
18103
|
+
var _proto3 = Event3.prototype;
|
|
18104
|
+
_proto3.midBind = function midBind(key, handler) {
|
|
18105
|
+
if (key === "all") {
|
|
18106
|
+
this.allBind.bind(handler);
|
|
18107
|
+
} else {
|
|
18108
|
+
_keyboardjs["default"].bind(key, handler);
|
|
18109
|
+
}
|
|
18110
|
+
};
|
|
18111
|
+
_proto3.midUnBind = function midUnBind(key, handler) {
|
|
18112
|
+
if (key === "all") {
|
|
18113
|
+
this.allBind.unbind(handler);
|
|
18114
|
+
} else {
|
|
18115
|
+
_keyboardjs["default"].unbind(key, handler);
|
|
18116
|
+
}
|
|
18117
|
+
};
|
|
18118
|
+
_proto3.bind = function bind(key, handler) {
|
|
18119
|
+
var lowerKey = key.toLowerCase();
|
|
18120
|
+
if (!(handler instanceof Function)) {
|
|
18121
|
+
return;
|
|
18122
|
+
}
|
|
18123
|
+
if (!this.mapStack[lowerKey]) {
|
|
18124
|
+
this.mapStack[lowerKey] = new Stack();
|
|
18125
|
+
}
|
|
18126
|
+
var stack = this.mapStack[lowerKey];
|
|
18127
|
+
var oldHeader = stack.getHeader();
|
|
18128
|
+
this.midUnBind(lowerKey, oldHeader);
|
|
18129
|
+
this.midBind(lowerKey, handler);
|
|
18130
|
+
stack.put(handler);
|
|
18131
|
+
};
|
|
18132
|
+
_proto3.unbind = function unbind(key, handler) {
|
|
18133
|
+
var lowerKey = key.toLowerCase();
|
|
18134
|
+
var stack = this.mapStack[lowerKey];
|
|
18135
|
+
if (!stack) {
|
|
18136
|
+
return;
|
|
18137
|
+
}
|
|
18138
|
+
var header = stack.getHeader();
|
|
18139
|
+
if (header === handler) {
|
|
18140
|
+
this.midUnBind(lowerKey, header);
|
|
18141
|
+
stack.pop();
|
|
18142
|
+
this.midBind(lowerKey, stack.getHeader());
|
|
18143
|
+
} else {
|
|
18144
|
+
stack.removeItem(handler);
|
|
18145
|
+
}
|
|
18146
|
+
};
|
|
18147
|
+
_proto3.releaseKey = function releaseKey(key) {
|
|
18148
|
+
var lowerKey = key.toLowerCase();
|
|
18149
|
+
this.mapStack[lowerKey] = new Stack();
|
|
18150
|
+
if (lowerKey === "all") {
|
|
18151
|
+
this.allBind.release();
|
|
18152
|
+
} else {
|
|
18153
|
+
_keyboardjs["default"].unbind(lowerKey);
|
|
18154
|
+
}
|
|
18155
|
+
};
|
|
18156
|
+
return Event3;
|
|
18157
|
+
}();
|
|
18158
|
+
exports["default"] = Event2;
|
|
18159
|
+
})(lib);
|
|
18160
|
+
var Event = /* @__PURE__ */ getDefaultExportFromCjs(lib);
|
|
17055
18161
|
var index$n = "";
|
|
18162
|
+
const event = new Event();
|
|
17056
18163
|
function ButtonV2(props) {
|
|
17057
18164
|
if ((props == null ? void 0 : props.type) === "antd")
|
|
17058
18165
|
return /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -17067,13 +18174,33 @@ function ButtonV2(props) {
|
|
|
17067
18174
|
children,
|
|
17068
18175
|
disabled,
|
|
17069
18176
|
fullWidth,
|
|
18177
|
+
hotkey,
|
|
18178
|
+
hotkeyHandler,
|
|
17070
18179
|
...resetProps
|
|
17071
18180
|
} = props;
|
|
17072
18181
|
function handleClick(e2) {
|
|
17073
|
-
|
|
18182
|
+
var _a2;
|
|
18183
|
+
(_a2 = e2 == null ? void 0 : e2.stopPropagation) == null ? void 0 : _a2.call(e2);
|
|
17074
18184
|
if (!disabled && typeof onClick === "function")
|
|
17075
18185
|
onClick();
|
|
17076
18186
|
}
|
|
18187
|
+
React__default.useEffect(() => {
|
|
18188
|
+
const bindHandler = () => {
|
|
18189
|
+
if (hotkeyHandler instanceof Function) {
|
|
18190
|
+
hotkeyHandler();
|
|
18191
|
+
} else {
|
|
18192
|
+
handleClick();
|
|
18193
|
+
}
|
|
18194
|
+
};
|
|
18195
|
+
if (hotkey && (hotkey == null ? void 0 : hotkey.toLowerCase)) {
|
|
18196
|
+
event.bind(hotkey.toLowerCase(), bindHandler);
|
|
18197
|
+
}
|
|
18198
|
+
return () => {
|
|
18199
|
+
if (hotkey && (hotkey == null ? void 0 : hotkey.toLowerCase)) {
|
|
18200
|
+
event.unbind(hotkey.toLowerCase(), bindHandler);
|
|
18201
|
+
}
|
|
18202
|
+
};
|
|
18203
|
+
}, [onClick, hotkeyHandler, hotkey]);
|
|
17077
18204
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
17078
18205
|
...resetProps,
|
|
17079
18206
|
className: classNames({
|