From b513ad8e4700fd8b661a78bde1019a35f5e5e91b Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Thu, 3 Sep 2020 00:46:10 -0400 Subject: [PATCH] 2.4.0 - Input selection support --- .eslintignore | 1 + .eslintrc.json | 35 + .gitignore | 1 + .npmignore | 2 + README.md | 3 +- build/css/index.css | 6 +- build/css/index.css.map | 2 +- build/index.d.ts | 22 + build/index.js | 4 +- build/index.js.map | 2 +- config/env.js | 16 +- config/getHttpsConfig.js | 66 ++ config/jest/fileTransform.js | 4 +- config/modules.js | 55 +- config/paths.js | 32 +- config/webpack.config.demo.js | 168 +-- config/webpack.config.js | 170 ++-- config/webpackDevServer.config.js | 60 +- package-lock.json | 1582 ++++++++++++++++------------- package.json | 38 +- scripts/build.js | 32 +- scripts/demo.js | 32 +- scripts/start.js | 32 +- src/lib/@types/index.d.ts | 22 + src/lib/components/Keyboard.js | 7 +- src/setupTests.js | 5 + 26 files changed, 1430 insertions(+), 969 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json create mode 100644 config/getHttpsConfig.js create mode 100644 src/setupTests.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..07ed7069a --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +build/* \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..61438f6c4 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,35 @@ +{ + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true, + "modules": true, + "experimentalObjectRestSpread": true + } + }, + "plugins": [ + "react" + ], + "extends": ["eslint:recommended", "plugin:react/recommended"], + "rules": { + "comma-dangle": 0, + "no-unused-vars": "warn", + "no-unexpected-multiline": "warn", + "prefer-const": "warn" + }, + "settings": { + "react": { + "pragma": "React", + "version": "15.6.1" + } + }, + "env": { + "browser": true, + "node": true, + "jasmine": true, + "jest": true, + "es6": true + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 24391ff2d..624d579a0 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ .env.development.local .env.test.local .env.production.local +.vscode npm-debug.log* yarn-debug.log* diff --git a/.npmignore b/.npmignore index a5c3b0971..0e163ee84 100644 --- a/.npmignore +++ b/.npmignore @@ -28,3 +28,5 @@ config .travis.yml CHANGELOG.md README.md +.eslintignore +.eslintrc.json \ No newline at end of file diff --git a/README.md b/README.md index 62dc6044b..be99dc6d7 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,7 @@ Feel free to browse the [Questions & Answers](https://simple-keyboard.com/qa-use > Simple-keyboard is intended for modern, standards-compliant browsers. > Internet Explorer is sadly not one of them, and since its market-share is negligible (~2% for IE11), resources won't be spent in trying to support it. > -> To learn more about the rationale for not supporting IE, check out [this link](https://techcommunity.microsoft.com/t5/Windows-IT-Pro-Blog/The-perils-of-using-Internet-Explorer-as-your-default-browser/ba-p/331732). - +> For more information, check out [this Q&A entry](https://hodgef.com/simple-keyboard/questions-answers/internet-explorer-not-supported/). ## Contributing ✅ diff --git a/build/css/index.css b/build/css/index.css index b0b2ae46d..bf9cff452 100644 --- a/build/css/index.css +++ b/build/css/index.css @@ -1,6 +1,6 @@ /*! * - * react-simple-keyboard v2.3.149 + * react-simple-keyboard v2.4.0 * https://github.com/hodgef/react-simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef) @@ -11,7 +11,7 @@ */ /*! * - * simple-keyboard v2.29.111 + * simple-keyboard v2.30.1 * https://github.com/hodgef/simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef) @@ -19,5 +19,5 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - */.hg-theme-default{width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.hg-theme-default .hg-button span{pointer-events:none}.hg-theme-default button.hg-button{border-width:0;outline:0;font-size:inherit}.hg-theme-default{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:#ececec;padding:5px;border-radius:5px}.hg-theme-default .hg-button{display:inline-block;flex-grow:1}.hg-theme-default .hg-row{display:flex}.hg-theme-default .hg-row:not(:last-child){margin-bottom:5px}.hg-theme-default .hg-row .hg-button-container,.hg-theme-default .hg-row .hg-button:not(:last-child){margin-right:5px}.hg-theme-default .hg-row>div:last-child{margin-right:0}.hg-theme-default .hg-row .hg-button-container{display:flex}.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0,0,0,0)}.hg-theme-default .hg-button.hg-activeButton{background:#efefef}.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.hg-theme-default .hg-button.hg-button-numpadadd,.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.hg-theme-default .hg-button.hg-button-com{max-width:85px}.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn="@"]{max-width:60px} + */.hg-theme-default{width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.hg-theme-default .hg-button span{pointer-events:none}.hg-theme-default button.hg-button{border-width:0;outline:0;font-size:inherit}.hg-theme-default{font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;background-color:#ececec;padding:5px;border-radius:5px}.hg-theme-default .hg-button{display:inline-block;flex-grow:1}.hg-theme-default .hg-row{display:flex}.hg-theme-default .hg-row:not(:last-child){margin-bottom:5px}.hg-theme-default .hg-row .hg-button-container,.hg-theme-default .hg-row .hg-button:not(:last-child){margin-right:5px}.hg-theme-default .hg-row>div:last-child{margin-right:0}.hg-theme-default .hg-row .hg-button-container{display:flex}.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0,0,0,0)}.hg-theme-default .hg-button.hg-activeButton{background:#efefef}.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.hg-theme-default .hg-button.hg-button-numpadadd,.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.hg-theme-default .hg-button.hg-button-com{max-width:85px}.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn="@"]{max-width:60px} /*# sourceMappingURL=index.css.map */ \ No newline at end of file diff --git a/build/css/index.css.map b/build/css/index.css.map index b0e0c0922..20d7cdcb3 100644 --- a/build/css/index.css.map +++ b/build/css/index.css.map @@ -1 +1 @@ -{"version":3,"sources":["index.css","webpack://node_modules/simple-keyboard/build/css/index.css","webpack://webpack:/src/lib/components/Keyboard.css"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;ACVF;;;;;;;;;;EAUE,CCNF,kBACE,UAAW,CACX,wBAAiB,CAAjB,qBAAiB,CAAjB,oBAAiB,CAAjB,gBAAiB,CACjB,qBAAsB,CACtB,eAAgB,CAChB,yBACF,CAEA,kCACE,mBACF,CAGA,mCACE,cAAe,CACf,SAAU,CACV,iBACF,CAEA,kBACE,4GAC+C,CAC/C,wBAAyB,CACzB,WAAY,CACZ,iBACF,CAEA,6BACE,oBAAqB,CACrB,WAEF,CAEA,0BACE,YACF,CAEA,2CACE,iBACF,CAMA,qGACE,gBACF,CAEA,yCACE,cACF,CAEA,+CACE,YACF,CAEA,6BACE,sCAA+C,CAC/C,WAAY,CACZ,iBAAkB,CAClB,qBAAsB,CACtB,WAAY,CACZ,eAAiB,CACjB,+BAAgC,CAChC,cAAe,CACf,YAAa,CACb,kBAAmB,CACnB,sBAAuB,CACvB,yCACF,CAEA,6CACE,kBACF,CAEA,+CACE,WAAY,CACZ,WAAY,CACZ,kBAAmB,CACnB,YAAa,CACb,sBACF,CAMA,oGACE,WACF,CAEA,+CACE,WACF,CAEA,2CACE,cACF,CAEA,yDACE,cACF,CAEA,+CACE,4BAAiC,CACjC,UACF,CAEA,+DACE,cACF,CAEA,4DACE,cACF","file":"index.css","sourcesContent":["/*!\n * \n * react-simple-keyboard v2.3.149\n * https://github.com/hodgef/react-simple-keyboard\n * \n * Copyright (c) Francisco Hodge (https://github.com/hodgef)\n * \n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n * \n */\n/*!\n * \n * simple-keyboard v2.29.111\n * https://github.com/hodgef/simple-keyboard\n * \n * Copyright (c) Francisco Hodge (https://github.com/hodgef)\n * \n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n * \n */.hg-theme-default{width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.hg-theme-default .hg-button span{pointer-events:none}.hg-theme-default button.hg-button{border-width:0;outline:0;font-size:inherit}.hg-theme-default{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;background-color:#ececec;padding:5px;border-radius:5px}.hg-theme-default .hg-button{display:inline-block;flex-grow:1}.hg-theme-default .hg-row{display:flex}.hg-theme-default .hg-row:not(:last-child){margin-bottom:5px}.hg-theme-default .hg-row .hg-button-container,.hg-theme-default .hg-row .hg-button:not(:last-child){margin-right:5px}.hg-theme-default .hg-row>div:last-child{margin-right:0}.hg-theme-default .hg-row .hg-button-container{display:flex}.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0,0,0,0)}.hg-theme-default .hg-button.hg-activeButton{background:#efefef}.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.hg-theme-default .hg-button.hg-button-numpadadd,.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.hg-theme-default .hg-button.hg-button-com{max-width:85px}.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"]{max-width:82px}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"]{max-width:60px}\n/*# sourceMappingURL=index.css.map */\n","/*!\n * \n * simple-keyboard v2.29.111\n * https://github.com/hodgef/simple-keyboard\n * \n * Copyright (c) Francisco Hodge (https://github.com/hodgef)\n * \n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n * \n */\n/**\n * simple-keyboard\n * Theme: hg-theme-default\n */\n.hg-theme-default {\n width: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n box-sizing: border-box;\n overflow: hidden;\n touch-action: manipulation;\n}\n\n.hg-theme-default .hg-button span {\n pointer-events: none;\n}\n\n/* When using option \"useButtonTag\" */\n.hg-theme-default button.hg-button {\n border-width: 0;\n outline: 0;\n font-size: inherit;\n}\n\n.hg-theme-default {\n font-family: \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\",\n Helvetica, Arial, \"Lucida Grande\", sans-serif;\n background-color: #ececec;\n padding: 5px;\n border-radius: 5px;\n}\n\n.hg-theme-default .hg-button {\n display: inline-block;\n flex-grow: 1;\n cursor: pointer;\n}\n\n.hg-theme-default .hg-row {\n display: flex;\n}\n\n.hg-theme-default .hg-row:not(:last-child) {\n margin-bottom: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button:not(:last-child) {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row > div:last-child {\n margin-right: 0;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n display: flex;\n}\n\n.hg-theme-default .hg-button {\n box-shadow: 0px 0px 3px -1px rgba(0, 0, 0, 0.3);\n height: 40px;\n border-radius: 5px;\n box-sizing: border-box;\n padding: 5px;\n background: white;\n border-bottom: 1px solid #b5b5b5;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.hg-theme-default .hg-button.hg-activeButton {\n background: #efefef;\n}\n\n.hg-theme-default.hg-layout-numeric .hg-button {\n width: 33.3%;\n height: 60px;\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadadd {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadenter {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpad0 {\n width: 105px;\n}\n\n.hg-theme-default .hg-button.hg-button-com {\n max-width: 85px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn.hg-button-at {\n max-width: 45px;\n}\n\n.hg-theme-default .hg-button.hg-selectedButton {\n background: rgba(5, 25, 70, 0.53);\n color: white;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"] {\n max-width: 82px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"] {\n max-width: 60px;\n}\n\n","/**\n * simple-keyboard\n * Theme: hg-theme-default\n */\n.hg-theme-default {\n width: 100%;\n user-select: none;\n box-sizing: border-box;\n overflow: hidden;\n touch-action: manipulation;\n}\n\n.hg-theme-default .hg-button span {\n pointer-events: none;\n}\n\n/* When using option \"useButtonTag\" */\n.hg-theme-default button.hg-button {\n border-width: 0;\n outline: 0;\n font-size: inherit;\n}\n\n.hg-theme-default {\n font-family: \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\",\n Helvetica, Arial, \"Lucida Grande\", sans-serif;\n background-color: #ececec;\n padding: 5px;\n border-radius: 5px;\n}\n\n.hg-theme-default .hg-button {\n display: inline-block;\n flex-grow: 1;\n cursor: pointer;\n}\n\n.hg-theme-default .hg-row {\n display: flex;\n}\n\n.hg-theme-default .hg-row:not(:last-child) {\n margin-bottom: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button:not(:last-child) {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row > div:last-child {\n margin-right: 0;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n display: flex;\n}\n\n.hg-theme-default .hg-button {\n box-shadow: 0px 0px 3px -1px rgba(0, 0, 0, 0.3);\n height: 40px;\n border-radius: 5px;\n box-sizing: border-box;\n padding: 5px;\n background: white;\n border-bottom: 1px solid #b5b5b5;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.hg-theme-default .hg-button.hg-activeButton {\n background: #efefef;\n}\n\n.hg-theme-default.hg-layout-numeric .hg-button {\n width: 33.3%;\n height: 60px;\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadadd {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadenter {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpad0 {\n width: 105px;\n}\n\n.hg-theme-default .hg-button.hg-button-com {\n max-width: 85px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn.hg-button-at {\n max-width: 45px;\n}\n\n.hg-theme-default .hg-button.hg-selectedButton {\n background: rgba(5, 25, 70, 0.53);\n color: white;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"] {\n max-width: 82px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"] {\n max-width: 60px;\n}\n"]} \ No newline at end of file +{"version":3,"sources":["index.css","webpack://node_modules/simple-keyboard/build/css/index.css","webpack://webpack:/src/lib/components/Keyboard.css"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;ACVF;;;;;;;;;;EAUE,CCNF,kBACE,UAAW,CACX,wBAAiB,CAAjB,qBAAiB,CAAjB,oBAAiB,CAAjB,gBAAiB,CACjB,qBAAsB,CACtB,eAAgB,CAChB,yBACF,CAEA,kCACE,mBACF,CAGA,mCACE,cAAe,CACf,SAAU,CACV,iBACF,CAEA,kBACE,oHAC+C,CAC/C,wBAAyB,CACzB,WAAY,CACZ,iBACF,CAEA,6BACE,oBAAqB,CACrB,WAEF,CAEA,0BACE,YACF,CAEA,2CACE,iBACF,CAMA,qGACE,gBACF,CAEA,yCACE,cACF,CAEA,+CACE,YACF,CAEA,6BACE,sCAA+C,CAC/C,WAAY,CACZ,iBAAkB,CAClB,qBAAsB,CACtB,WAAY,CACZ,eAAiB,CACjB,+BAAgC,CAChC,cAAe,CACf,YAAa,CACb,kBAAmB,CACnB,sBAAuB,CACvB,yCACF,CAEA,6CACE,kBACF,CAEA,+CACE,WAAY,CACZ,WAAY,CACZ,kBAAmB,CACnB,YAAa,CACb,sBACF,CAMA,oGACE,WACF,CAEA,+CACE,WACF,CAEA,2CACE,cACF,CAEA,yDACE,cACF,CAEA,+CACE,4BAAiC,CACjC,UACF,CAEA,+DACE,cACF,CAEA,4DACE,cACF","file":"index.css","sourcesContent":["/*!\n * \n * react-simple-keyboard v2.4.0\n * https://github.com/hodgef/react-simple-keyboard\n * \n * Copyright (c) Francisco Hodge (https://github.com/hodgef)\n * \n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n * \n */\n/*!\n * \n * simple-keyboard v2.30.1\n * https://github.com/hodgef/simple-keyboard\n * \n * Copyright (c) Francisco Hodge (https://github.com/hodgef)\n * \n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n * \n */.hg-theme-default{width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.hg-theme-default .hg-button span{pointer-events:none}.hg-theme-default button.hg-button{border-width:0;outline:0;font-size:inherit}.hg-theme-default{font-family:\"HelveticaNeue-Light\",\"Helvetica Neue Light\",\"Helvetica Neue\",Helvetica,Arial,\"Lucida Grande\",sans-serif;background-color:#ececec;padding:5px;border-radius:5px}.hg-theme-default .hg-button{display:inline-block;flex-grow:1}.hg-theme-default .hg-row{display:flex}.hg-theme-default .hg-row:not(:last-child){margin-bottom:5px}.hg-theme-default .hg-row .hg-button-container,.hg-theme-default .hg-row .hg-button:not(:last-child){margin-right:5px}.hg-theme-default .hg-row>div:last-child{margin-right:0}.hg-theme-default .hg-row .hg-button-container{display:flex}.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0,0,0,0)}.hg-theme-default .hg-button.hg-activeButton{background:#efefef}.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.hg-theme-default .hg-button.hg-button-numpadadd,.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.hg-theme-default .hg-button.hg-button-com{max-width:85px}.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"]{max-width:82px}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"]{max-width:60px}\n/*# sourceMappingURL=index.css.map */\n","/*!\n * \n * simple-keyboard v2.30.1\n * https://github.com/hodgef/simple-keyboard\n * \n * Copyright (c) Francisco Hodge (https://github.com/hodgef)\n * \n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n * \n */\n/**\n * simple-keyboard\n * Theme: hg-theme-default\n */\n.hg-theme-default {\n width: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n box-sizing: border-box;\n overflow: hidden;\n touch-action: manipulation;\n}\n\n.hg-theme-default .hg-button span {\n pointer-events: none;\n}\n\n/* When using option \"useButtonTag\" */\n.hg-theme-default button.hg-button {\n border-width: 0;\n outline: 0;\n font-size: inherit;\n}\n\n.hg-theme-default {\n font-family: \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\",\n Helvetica, Arial, \"Lucida Grande\", sans-serif;\n background-color: #ececec;\n padding: 5px;\n border-radius: 5px;\n}\n\n.hg-theme-default .hg-button {\n display: inline-block;\n flex-grow: 1;\n cursor: pointer;\n}\n\n.hg-theme-default .hg-row {\n display: flex;\n}\n\n.hg-theme-default .hg-row:not(:last-child) {\n margin-bottom: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button:not(:last-child) {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row > div:last-child {\n margin-right: 0;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n display: flex;\n}\n\n.hg-theme-default .hg-button {\n box-shadow: 0px 0px 3px -1px rgba(0, 0, 0, 0.3);\n height: 40px;\n border-radius: 5px;\n box-sizing: border-box;\n padding: 5px;\n background: white;\n border-bottom: 1px solid #b5b5b5;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.hg-theme-default .hg-button.hg-activeButton {\n background: #efefef;\n}\n\n.hg-theme-default.hg-layout-numeric .hg-button {\n width: 33.3%;\n height: 60px;\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadadd {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadenter {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpad0 {\n width: 105px;\n}\n\n.hg-theme-default .hg-button.hg-button-com {\n max-width: 85px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn.hg-button-at {\n max-width: 45px;\n}\n\n.hg-theme-default .hg-button.hg-selectedButton {\n background: rgba(5, 25, 70, 0.53);\n color: white;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"] {\n max-width: 82px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"] {\n max-width: 60px;\n}\n\n","/**\n * simple-keyboard\n * Theme: hg-theme-default\n */\n.hg-theme-default {\n width: 100%;\n user-select: none;\n box-sizing: border-box;\n overflow: hidden;\n touch-action: manipulation;\n}\n\n.hg-theme-default .hg-button span {\n pointer-events: none;\n}\n\n/* When using option \"useButtonTag\" */\n.hg-theme-default button.hg-button {\n border-width: 0;\n outline: 0;\n font-size: inherit;\n}\n\n.hg-theme-default {\n font-family: \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\",\n Helvetica, Arial, \"Lucida Grande\", sans-serif;\n background-color: #ececec;\n padding: 5px;\n border-radius: 5px;\n}\n\n.hg-theme-default .hg-button {\n display: inline-block;\n flex-grow: 1;\n cursor: pointer;\n}\n\n.hg-theme-default .hg-row {\n display: flex;\n}\n\n.hg-theme-default .hg-row:not(:last-child) {\n margin-bottom: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button:not(:last-child) {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n margin-right: 5px;\n}\n\n.hg-theme-default .hg-row > div:last-child {\n margin-right: 0;\n}\n\n.hg-theme-default .hg-row .hg-button-container {\n display: flex;\n}\n\n.hg-theme-default .hg-button {\n box-shadow: 0px 0px 3px -1px rgba(0, 0, 0, 0.3);\n height: 40px;\n border-radius: 5px;\n box-sizing: border-box;\n padding: 5px;\n background: white;\n border-bottom: 1px solid #b5b5b5;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.hg-theme-default .hg-button.hg-activeButton {\n background: #efefef;\n}\n\n.hg-theme-default.hg-layout-numeric .hg-button {\n width: 33.3%;\n height: 60px;\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadadd {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpadenter {\n height: 85px;\n}\n\n.hg-theme-default .hg-button.hg-button-numpad0 {\n width: 105px;\n}\n\n.hg-theme-default .hg-button.hg-button-com {\n max-width: 85px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn.hg-button-at {\n max-width: 45px;\n}\n\n.hg-theme-default .hg-button.hg-selectedButton {\n background: rgba(5, 25, 70, 0.53);\n color: white;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"] {\n max-width: 82px;\n}\n\n.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"] {\n max-width: 60px;\n}\n"]} \ No newline at end of file diff --git a/build/index.d.ts b/build/index.d.ts index dcab54b80..1ad513925 100644 --- a/build/index.d.ts +++ b/build/index.d.ts @@ -218,6 +218,28 @@ declare module 'react-simple-keyboard' { * caretPosition */ caretPosition?: number; + + /** + * caretPositionEnd + */ + caretPositionEnd?: number; + + /** + * Changes the internal caret position + * @param {number} position The caret's start position + * @param {number} positionEnd The caret's end position + */ + setCaretPosition(position: number, positionEnd?: number): void; + + /** + * Retrieves the internal caret position + */ + getCaretPosition(): number; + + /** + * Retrieves the internal end caret position + */ + getCaretPositionEnd(): number; /** * DOM Element diff --git a/build/index.js b/build/index.js index fa41b87d5..861798c81 100644 --- a/build/index.js +++ b/build/index.js @@ -1,6 +1,6 @@ /*! * - * react-simple-keyboard v2.3.149 + * react-simple-keyboard v2.4.0 * https://github.com/hodgef/react-simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef) @@ -9,5 +9,5 @@ * LICENSE file in the root directory of this source tree. * */ -!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("react")):"function"===typeof define&&define.amd?define("ReactSimpleKeyboard",["react"],t):"object"===typeof exports?exports.ReactSimpleKeyboard=t(require("react")):e.ReactSimpleKeyboard=t(e.React)}(window,(function(e){return function(e){var t={};function __webpack_require__(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,__webpack_require__),o.l=!0,o.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},__webpack_require__.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(e,t){if(1&t&&(e=__webpack_require__(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(__webpack_require__.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)__webpack_require__.d(n,o,function(t){return e[t]}.bind(null,o));return n},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(t,n){t.exports=e},function(e,t,n){(function(e){var o,i,r,s,a=n(4);window,s=function(){return function(e){var t={};function __webpack_require__(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,__webpack_require__),o.l=!0,o.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},__webpack_require__.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(e,t){if(1&t&&(e=__webpack_require__(e)),8&t)return e;if(4&t&&"object"===a(e)&&e&&e.__esModule)return e;var n=Object.create(null);if(__webpack_require__.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)__webpack_require__.d(n,o,function(t){return e[t]}.bind(null,o));return n},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(e,t,n){e.exports=n(2)},function(e,t,n){},function(e,t,n){"use strict";function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,r=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return r=e.done,e},e:function(e){s=!0,i=e},f:function(){try{r||null==n.return||n.return()}finally{if(s)throw i}}}}(Object.getOwnPropertyNames(e.prototype));try{for(o.s();!(n=o.n()).done;){var i=n.value;"constructor"===i||"bindMethods"===i||(t[i]=t[i].bind(t))}}catch(r){o.e(r)}finally{o.f()}}}],(t=[{key:"getButtonClass",value:function(e){var t=e.includes("{")&&e.includes("}")&&"{//}"!==e?"functionBtn":"standardBtn",n=e.replace("{","").replace("}",""),o="";return"standardBtn"!==t&&(o=" hg-button-".concat(n)),"hg-".concat(t).concat(o)}},{key:"getDefaultDiplay",value:function(){return{"{bksp}":"backspace","{backspace}":"backspace","{enter}":"< enter","{shift}":"shift","{shiftleft}":"shift","{shiftright}":"shift","{alt}":"alt","{s}":"shift","{tab}":"tab","{lock}":"caps","{capslock}":"caps","{accept}":"Submit","{space}":" ","{//}":" ","{esc}":"esc","{escape}":"esc","{f1}":"f1","{f2}":"f2","{f3}":"f3","{f4}":"f4","{f5}":"f5","{f6}":"f6","{f7}":"f7","{f8}":"f8","{f9}":"f9","{f10}":"f10","{f11}":"f11","{f12}":"f12","{numpaddivide}":"/","{numlock}":"lock","{arrowup}":"\u2191","{arrowleft}":"\u2190","{arrowdown}":"\u2193","{arrowright}":"\u2192","{prtscr}":"print","{scrolllock}":"scroll","{pause}":"pause","{insert}":"ins","{home}":"home","{pageup}":"up","{delete}":"del","{end}":"end","{pagedown}":"down","{numpadmultiply}":"*","{numpadsubtract}":"-","{numpadadd}":"+","{numpadenter}":"enter","{period}":".","{numpaddecimal}":".","{numpad0}":"0","{numpad1}":"1","{numpad2}":"2","{numpad3}":"3","{numpad4}":"4","{numpad5}":"5","{numpad6}":"6","{numpad7}":"7","{numpad8}":"8","{numpad9}":"9"}}},{key:"getButtonDisplayName",value:function(e,t,n){return(t=n?Object.assign({},this.getDefaultDiplay(),t):t||this.getDefaultDiplay())[e]||e}},{key:"getUpdatedInput",value:function(e,t,n,o){var i=this.getOptions(),r=t;return("{bksp}"===e||"{backspace}"===e)&&r.length>0?r=this.removeAt(r,n,o):"{space}"===e?r=this.addStringAt(r," ",n,o):"{tab}"!==e||"boolean"===typeof i.tabCharOnTab&&!1===i.tabCharOnTab?"{enter}"!==e&&"{numpadenter}"!==e||!i.newLineOnEnter?e.includes("numpad")&&Number.isInteger(Number(e[e.length-2]))?r=this.addStringAt(r,e[e.length-2],n,o):"{numpaddivide}"===e?r=this.addStringAt(r,"/",n,o):"{numpadmultiply}"===e?r=this.addStringAt(r,"*",n,o):"{numpadsubtract}"===e?r=this.addStringAt(r,"-",n,o):"{numpadadd}"===e?r=this.addStringAt(r,"+",n,o):"{numpaddecimal}"===e?r=this.addStringAt(r,".",n,o):"{"===e||"}"===e?r=this.addStringAt(r,e,n,o):e.includes("{")||e.includes("}")||(r=this.addStringAt(r,e,n,o)):r=this.addStringAt(r,"\n",n,o):r=this.addStringAt(r,"\t",n,o),r}},{key:"updateCaretPos",value:function(e,t){var n=this.updateCaretPosAction(e,t);this.dispatch((function(e){e.caretPosition=n}))}},{key:"updateCaretPosAction",value:function(e,t){var n=this.getOptions(),o=this.getCaretPosition();return t?o>0&&(o-=e):o+=e,n.debug&&console.log("Caret at:",o,"(".concat(this.keyboardDOMClass,")")),o}},{key:"addStringAt",value:function(e,t,n,o){var i;return n||0===n?(i=[e.slice(0,n),t,e.slice(n)].join(""),this.isMaxLengthReached()||o&&this.updateCaretPos(t.length)):i=e+t,i}},{key:"removeAt",value:function(e,t,n){var o;if(0===this.getCaretPosition())return e;var i=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;return t&&t>=0?e.substring(t-2,t).match(i)?(o=e.substr(0,t-2)+e.substr(t),n&&this.updateCaretPos(2,!0)):(o=e.substr(0,t-1)+e.substr(t),n&&this.updateCaretPos(1,!0)):e.slice(-2).match(i)?(o=e.slice(0,-2),n&&this.updateCaretPos(2,!0)):(o=e.slice(0,-1),n&&this.updateCaretPos(1,!0)),o}},{key:"handleMaxLength",value:function(e,t){var n=this.getOptions(),o=n.maxLength,i=e[n.inputName],r=t.length-1>=o;if(t.length<=i.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",r),r?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===_typeof(o)){var s=i.length===o[n.inputName];return n.debug&&console.log("maxLength (obj) reached:",s),s?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return window.PointerEvent}},{key:"camelCase",value:function(e){return!!e&&e.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(e,t){return t.length?e+t[0].toUpperCase()+t.slice(1):e}))}}])&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Utilities}();function PhysicalKeyboard_defineProperties(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},t=this.changedOptions(e);this.options=Object.assign(this.options,e),t.length&&(this.options.debug&&console.log("changedOptions",t),this.onSetOptions(e),this.render())}},{key:"changedOptions",value:function(e){var t=this;return Object.keys(e).filter((function(n){return JSON.stringify(e[n])!==JSON.stringify(t.options[n])}))}},{key:"onSetOptions",value:function(e){e.inputName&&(this.options.debug&&console.log("inputName changed. caretPosition reset."),this.caretPosition=null)}},{key:"clear",value:function(){this.keyboardDOM.innerHTML="",this.keyboardDOM.className=this.keyboardDOMClass,this.buttonElements={}}},{key:"dispatch",value:function(e){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(t){e(window.SimpleKeyboardInstances[t],t)}))}},{key:"addButtonTheme",value:function(e,t){var n=this;if(!t||!e)return!1;e.split(" ").forEach((function(o){t.split(" ").forEach((function(t){n.options.buttonTheme||(n.options.buttonTheme=[]);var i=!1;n.options.buttonTheme.map((function(e){if(e.class.split(" ").includes(t)){i=!0;var n=e.buttons.split(" ");n.includes(o)||(i=!0,n.push(o),e.buttons=n.join(" "))}return e})),i||n.options.buttonTheme.push({class:t,buttons:e})}))})),this.render()}},{key:"removeButtonTheme",value:function(e,t){var n=this;if(!e&&!t)return this.options.buttonTheme=[],this.render(),!1;e&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(e.split(" ").forEach((function(e){n.options.buttonTheme.map((function(o,i){if(t&&t.includes(o.class)||!t){var r=o.buttons.split(" ").filter((function(t){return t!==e}));r.length?o.buttons=r.join(" "):(n.options.buttonTheme.splice(i,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(e){var t,n=this.buttonElements[e];return n&&(t=n.length>1?n:n[0]),t}},{key:"inputPatternIsValid",value:function(e){var t,n=this.options.inputPattern;if((t=n instanceof RegExp?n:n[this.options.inputName])&&e){var o=t.test(e);return this.options.debug&&console.log('inputPattern ("'.concat(t,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){!this.isFirstKeyboardInstance&&this.allKeyboardInstances||(this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")")),document.addEventListener("keyup",this.handleKeyUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd))}},{key:"handleKeyUp",value:function(e){this.caretEventHandler(e),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(e)}},{key:"handleKeyDown",value:function(e){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(e)}},{key:"handleMouseUp",value:function(e){this.caretEventHandler(e)}},{key:"handleTouchEnd",value:function(e){this.caretEventHandler(e)}},{key:"caretEventHandler",value:function(e){var t;e.target.tagName&&(t=e.target.tagName.toLowerCase()),this.dispatch((function(n){n.isMouseHold&&(n.isMouseHold=!1),"textarea"!==t&&"input"!==t||n.options.disableCaretPositioning?n.options.disableCaretPositioning&&(n.caretPosition=null):(n.caretPosition=e.target.selectionStart,n.options.debug&&console.log("Caret at: ",e.target.selectionStart,e.target.tagName.toLowerCase(),"(".concat(n.keyboardDOMClass,")")))}))}},{key:"recurseButtons",value:function(e){var t=this;if(!e)return!1;Object.keys(this.buttonElements).forEach((function(n){return t.buttonElements[n].forEach(e)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName)),document.removeEventListener("keyup",this.handleKeyUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null;var deleteButton=function(e){e.onpointerdown=null,e.onpointerup=null,e.onpointercancel=null,e.ontouchstart=null,e.ontouchend=null,e.ontouchcancel=null,e.onclick=null,e.onmousedown=null,e.onmouseup=null,e.remove(),e=null};this.recurseButtons(deleteButton),this.recurseButtons=null,deleteButton=null,this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.clear(),window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(e){var t=this.options.buttonTheme,n=[];return Array.isArray(t)&&t.forEach((function(t){if(t.class&&"string"===typeof t.class&&t.buttons&&"string"===typeof t.buttons){var o=t.class.split(" ");t.buttons.split(" ").includes(e)&&(n=[].concat(_toConsumableArray(n),_toConsumableArray(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',t)})),n}},{key:"setDOMButtonAttributes",value:function(e,t){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"===typeof n.attribute&&n.value&&"string"===typeof n.value&&n.buttons&&"string"===typeof n.buttons?n.buttons.split(" ").includes(e)&&t(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(e){if(e.target.classList.contains("hg-button"))return e.preventDefault(),e.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"===typeof this.options.onInit&&this.options.onInit()}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"===typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"===typeof this.options.beforeRender&&this.options.beforeRender()}},{key:"onRender",value:function(){"function"===typeof this.options.onRender&&this.options.onRender()}},{key:"onModulesLoaded",value:function(){"function"===typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var e=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(t){var n=new t;if(n.constructor.name&&"Function"!==n.constructor.name){var o="module-".concat(e.utilities.camelCase(n.constructor.name));e.keyboardPluginClasses=e.keyboardPluginClasses+" ".concat(o)}n.init(e)})),this.keyboardPluginClasses=this.keyboardPluginClasses+" modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(e,t){return!!this.modules[e]&&this.modules[e][t]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(e,t,n,o){var i=this,r=Array.from(e.children),s=0;return r.length&&n.forEach((function(n,a){var u=o[a];if(!u||!(u>n))return!1;var c=n-s,l=u-s,d=document.createElement("div");d.className+="hg-button-container";var p="".concat(i.options.layoutName,"-r").concat(t,"c").concat(a);d.setAttribute("data-skUID",p);var h=r.splice(c,l-c+1);s=l-c,h.forEach((function(e){return d.appendChild(e)})),r.splice(c,0,d),e.innerHTML="",r.forEach((function(t){return e.appendChild(t)})),i.options.debug&&console.log("rowDOMContainer",h,c,l,s+1)})),e}},{key:"render",value:function(){var e=this;this.clear(),this.initialized||this.beforeFirstRender(),this.beforeRender();var t="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,i=o?"hg-touch-events":"",r=this.options.useMouseEvents||!1,s=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,t,this.keyboardPluginClasses,i),n[this.options.layoutName].forEach((function(t,n){var i=t.split(" "),a=document.createElement("div");a.className+="hg-row";var u=[],c=[];i.forEach((function(t,i){var l,d=!s&&"string"===typeof t&&t.length>1&&0===t.indexOf("["),p=!s&&"string"===typeof t&&t.length>1&&t.indexOf("]")===t.length-1;d&&(u.push(i),t=t.replace(/\[/g,"")),p&&(c.push(i),t=t.replace(/\]/g,""));var h=e.utilities.getButtonClass(t),f=e.utilities.getButtonDisplayName(t,e.options.display,e.options.mergeDisplay),y=e.options.useButtonTag?"button":"div",b=document.createElement(y);b.className+="hg-button ".concat(h),(l=b.classList).add.apply(l,_toConsumableArray(e.getButtonThemeClasses(t))),e.setDOMButtonAttributes(t,(function(e,t){b.setAttribute(e,t)})),e.activeButtonClass="hg-activeButton",!e.utilities.pointerEventsSupported()||o||r?o?(b.ontouchstart=function(n){e.handleButtonClicked(t),e.handleButtonMouseDown(t,n)},b.ontouchend=function(){e.handleButtonMouseUp(t)},b.ontouchcancel=function(){e.handleButtonMouseUp(t)}):(b.onclick=function(){e.isMouseHold=!1,e.handleButtonClicked(t)},b.onmousedown=function(n){e.handleButtonMouseDown(t,n)},b.onmouseup=function(){e.handleButtonMouseUp(t)}):(b.onpointerdown=function(n){e.handleButtonClicked(t),e.handleButtonMouseDown(t,n)},b.onpointerup=function(){e.handleButtonMouseUp(t)},b.onpointercancel=function(){e.handleButtonMouseUp(t)}),b.setAttribute("data-skBtn",t);var m="".concat(e.options.layoutName,"-r").concat(n,"b").concat(i);b.setAttribute("data-skBtnUID",m);var g=document.createElement("span");g.innerHTML=f,b.appendChild(g),e.buttonElements[t]||(e.buttonElements[t]=[]),e.buttonElements[t].push(b),a.appendChild(b)})),a=e.parseRowDOMContainers(a,n,u,c),e.keyboardDOM.appendChild(a)})),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||o||r?o?(document.ontouchend=function(){return e.handleButtonMouseUp()},document.ontouchcancel=function(){return e.handleButtonMouseUp()},this.keyboardDOM.ontouchstart=function(t){return e.handleKeyboardContainerMouseDown(t)}):o||(document.onmouseup=function(){return e.handleButtonMouseUp()},this.keyboardDOM.onmousedown=function(t){return e.handleKeyboardContainerMouseDown(t)}):(document.onpointerup=function(){return e.handleButtonMouseUp()},this.keyboardDOM.onpointerdown=function(t){return e.handleKeyboardContainerMouseDown(t)}),this.onInit())}}])&&Keyboard_defineProperties(e.prototype,t),SimpleKeyboard}();t.default=r}])},"object"===a(t)&&"object"===a(e)?e.exports=s():(i=[],void 0===(r="function"===typeof(o=s)?o.apply(t,i):o)||(e.exports=r))}).call(this,n(3)(e))},function(e,t,n){e.exports=n(6)},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){function _typeof(t){return"function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?e.exports=_typeof=function(e){return typeof e}:e.exports=_typeof=function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(t)}e.exports=_typeof},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var o=n(0),i=n.n(o),r=n(1),s=n.n(r);function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _objectSpread(e){for(var t=1;tt.length)&&(e=t.length);for(var n=0,o=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,r=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){r=!0,i=t},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw i}}}}(Object.getOwnPropertyNames(t.prototype));try{for(o.s();!(n=o.n()).done;){var i=n.value;"constructor"===i||"bindMethods"===i||(e[i]=e[i].bind(e))}}catch(s){o.e(s)}finally{o.f()}}}],(e=[{key:"getButtonClass",value:function(t){var e=t.includes("{")&&t.includes("}")&&"{//}"!==t?"functionBtn":"standardBtn",n=t.replace("{","").replace("}",""),o="";return"standardBtn"!==e&&(o=" hg-button-".concat(n)),"hg-".concat(e).concat(o)}},{key:"getDefaultDiplay",value:function(){return{"{bksp}":"backspace","{backspace}":"backspace","{enter}":"< enter","{shift}":"shift","{shiftleft}":"shift","{shiftright}":"shift","{alt}":"alt","{s}":"shift","{tab}":"tab","{lock}":"caps","{capslock}":"caps","{accept}":"Submit","{space}":" ","{//}":" ","{esc}":"esc","{escape}":"esc","{f1}":"f1","{f2}":"f2","{f3}":"f3","{f4}":"f4","{f5}":"f5","{f6}":"f6","{f7}":"f7","{f8}":"f8","{f9}":"f9","{f10}":"f10","{f11}":"f11","{f12}":"f12","{numpaddivide}":"/","{numlock}":"lock","{arrowup}":"\u2191","{arrowleft}":"\u2190","{arrowdown}":"\u2193","{arrowright}":"\u2192","{prtscr}":"print","{scrolllock}":"scroll","{pause}":"pause","{insert}":"ins","{home}":"home","{pageup}":"up","{delete}":"del","{end}":"end","{pagedown}":"down","{numpadmultiply}":"*","{numpadsubtract}":"-","{numpadadd}":"+","{numpadenter}":"enter","{period}":".","{numpaddecimal}":".","{numpad0}":"0","{numpad1}":"1","{numpad2}":"2","{numpad3}":"3","{numpad4}":"4","{numpad5}":"5","{numpad6}":"6","{numpad7}":"7","{numpad8}":"8","{numpad9}":"9"}}},{key:"getButtonDisplayName",value:function(t,e,n){return(e=n?Object.assign({},this.getDefaultDiplay(),e):e||this.getDefaultDiplay())[t]||t}},{key:"getUpdatedInput",value:function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=this.getOptions(),r=[n,o,i],a=e;return("{bksp}"===t||"{backspace}"===t)&&a.length>0?a=this.removeAt.apply(this,[a].concat(r)):"{space}"===t?a=this.addStringAt.apply(this,[a," "].concat(r)):"{tab}"!==t||"boolean"===typeof s.tabCharOnTab&&!1===s.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!s.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?a=this.addStringAt.apply(this,[a,t[t.length-2]].concat(r)):"{numpaddivide}"===t?a=this.addStringAt.apply(this,[a,"/"].concat(r)):"{numpadmultiply}"===t?a=this.addStringAt.apply(this,[a,"*"].concat(r)):"{numpadsubtract}"===t?a=this.addStringAt.apply(this,[a,"-"].concat(r)):"{numpadadd}"===t?a=this.addStringAt.apply(this,[a,"+"].concat(r)):"{numpaddecimal}"===t?a=this.addStringAt.apply(this,[a,"."].concat(r)):"{"===t||"}"===t?a=this.addStringAt.apply(this,[a,t].concat(r)):t.includes("{")||t.includes("}")||(a=this.addStringAt.apply(this,[a,t].concat(r))):a=this.addStringAt.apply(this,[a,"\n"].concat(r)):a=this.addStringAt.apply(this,[a,"\t"].concat(r)),a}},{key:"updateCaretPos",value:function(t,e){var n=this.updateCaretPosAction(t,e);this.dispatch((function(t){t.setCaretPosition(n)}))}},{key:"updateCaretPosAction",value:function(t,e){var n=this.getOptions(),o=this.getCaretPosition();return e?o>0&&(o-=t):o+=t,n.debug&&console.log("Caret at:",o,"(".concat(this.keyboardDOMClass,")")),o}},{key:"addStringAt",value:function(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o||0===o?(n=[t.slice(0,o),e,t.slice(i)].join(""),this.isMaxLengthReached()||s&&this.updateCaretPos(e.length)):n=t+e,n}},{key:"removeAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===n&&0===o)return t;if(n===o){var s=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;n&&n>=0?t.substring(n-2,n).match(s)?(e=t.substr(0,n-2)+t.substr(n),i&&this.updateCaretPos(2,!0)):(e=t.substr(0,n-1)+t.substr(n),i&&this.updateCaretPos(1,!0)):t.slice(-2).match(s)?(e=t.slice(0,-2),i&&this.updateCaretPos(2,!0)):(e=t.slice(0,-1),i&&this.updateCaretPos(1,!0))}else e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}));return e}},{key:"handleMaxLength",value:function(t,e){var n=this.getOptions(),o=n.maxLength,i=t[n.inputName],s=e.length-1>=o;if(e.length<=i.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",s),s?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===_typeof(o)){var r=i.length===o[n.inputName];return n.debug&&console.log("maxLength (obj) reached:",r),r?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return window.PointerEvent}},{key:"camelCase",value:function(t){return!!t&&t.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(t,e){return e.length?t+e[0].toUpperCase()+e.slice(1):t}))}}])&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),Utilities}();function PhysicalKeyboard_defineProperties(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},e=this.changedOptions(t);this.options=Object.assign(this.options,t),e.length&&(this.options.debug&&console.log("changedOptions",e),this.onSetOptions(t),this.render())}},{key:"changedOptions",value:function(t){var e=this;return Object.keys(t).filter((function(n){return JSON.stringify(t[n])!==JSON.stringify(e.options[n])}))}},{key:"onSetOptions",value:function(t){t.inputName&&(this.options.debug&&console.log("inputName changed. caretPosition reset."),this.setCaretPosition(null))}},{key:"clear",value:function(){this.keyboardDOM.innerHTML="",this.keyboardDOM.className=this.keyboardDOMClass,this.buttonElements={}}},{key:"dispatch",value:function(t){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(e){t(window.SimpleKeyboardInstances[e],e)}))}},{key:"addButtonTheme",value:function(t,e){var n=this;if(!e||!t)return!1;t.split(" ").forEach((function(o){e.split(" ").forEach((function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var i=!1;n.options.buttonTheme.map((function(t){if(t.class.split(" ").includes(e)){i=!0;var n=t.buttons.split(" ");n.includes(o)||(i=!0,n.push(o),t.buttons=n.join(" "))}return t})),i||n.options.buttonTheme.push({class:e,buttons:t})}))})),this.render()}},{key:"removeButtonTheme",value:function(t,e){var n=this;if(!t&&!e)return this.options.buttonTheme=[],this.render(),!1;t&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(t.split(" ").forEach((function(t){n.options.buttonTheme.map((function(o,i){if(e&&e.includes(o.class)||!e){var s=o.buttons.split(" ").filter((function(e){return e!==t}));s.length?o.buttons=s.join(" "):(n.options.buttonTheme.splice(i,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"inputPatternIsValid",value:function(t){var e,n=this.options.inputPattern;if((e=n instanceof RegExp?n:n[this.options.inputName])&&t){var o=e.test(t);return this.options.debug&&console.log('inputPattern ("'.concat(e,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){var t=this.options,e=t.useTouchEvents,n=t.useMouseEvents;!this.isFirstKeyboardInstance&&this.allKeyboardInstances||(this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")")),document.onkeyup=this.handleKeyUp,document.onkeydown=this.handleKeyDown,!this.utilities.pointerEventsSupported()||e||n?e?(document.ontouchstart=this.handlePointerDown,document.ontouchend=this.handlePointerUp,document.ontouchcancel=this.handlePointerUp,this.keyboardDOM.ontouchstart=this.handleKeyboardContainerMouseDown):e||(document.onmousedown=this.handlePointerDown,document.onmouseup=this.handlePointerUp,this.keyboardDOM.onmousedown=this.handleKeyboardContainerMouseDown):(document.onpointerdown=this.handlePointerDown,document.onpointerup=this.handlePointerUp,document.onpointercancel=this.handlePointerUp,this.keyboardDOM.onpointerdown=this.handleKeyboardContainerMouseDown))}},{key:"handleKeyUp",value:function(t){this.caretEventHandler(t),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(t)}},{key:"handleKeyDown",value:function(t){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(t)}},{key:"handlePointerDown",value:function(t){this.caretEventHandler(t)}},{key:"handlePointerUp",value:function(t){this.handleButtonMouseUp(),this.caretEventHandler(t)}},{key:"caretEventHandler",value:function(t){var e;this.options.disableCaretPositioning?this.setCaretPosition(null):(t.target.tagName&&(e=t.target.tagName.toLowerCase()),this.dispatch((function(n){var o=t.target===n.keyboardDOM||t.target&&n.keyboardDOM.contains(t.target);"textarea"===e||"input"===e?(n.setCaretPosition(t.target.selectionStart,t.target.selectionEnd),n.options.debug&&console.log("Caret at: ",n.getCaretPosition(),n.getCaretPositionEnd(),t&&t.target.tagName.toLowerCase(),"(".concat(n.keyboardDOMClass,")"))):o||n.setCaretPosition(null)})))}},{key:"recurseButtons",value:function(t){var e=this;if(!t)return!1;Object.keys(this.buttonElements).forEach((function(n){return e.buttonElements[n].forEach(t)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var deleteButton=function(t){t.onpointerdown=null,t.onpointerup=null,t.onpointercancel=null,t.ontouchstart=null,t.ontouchend=null,t.ontouchcancel=null,t.onclick=null,t.onmousedown=null,t.onmouseup=null,t.remove(),t=null};this.recurseButtons(deleteButton),deleteButton=null,this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.clear(),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],Object.keys(window.SimpleKeyboardInstances).length?this.options.debug&&console.log("Destroy: Instances remaining! Document listeners not removed",window.SimpleKeyboardInstances):(document.onkeydown=null,document.onkeyup=null,document.onpointerdown=null,document.onpointerup=null,document.onmousedown=null,document.onmouseup=null,document.ontouchstart=null,document.ontouchend=null,document.ontouchcancel=null,this.options.debug&&console.log("Destroy: No instances remaining. Document listeners removed",window.SimpleKeyboardInstances)),this.initialized=!1}},{key:"getButtonThemeClasses",value:function(t){var e=this.options.buttonTheme,n=[];return Array.isArray(e)&&e.forEach((function(e){if(e.class&&"string"===typeof e.class&&e.buttons&&"string"===typeof e.buttons){var o=e.class.split(" ");e.buttons.split(" ").includes(t)&&(n=[].concat(_toConsumableArray(n),_toConsumableArray(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',e)})),n}},{key:"setDOMButtonAttributes",value:function(t,e){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"===typeof n.attribute&&n.value&&"string"===typeof n.value&&n.buttons&&"string"===typeof n.buttons?n.buttons.split(" ").includes(t)&&e(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(t){if(t.target.classList.contains("hg-button"))return t.preventDefault(),t.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"===typeof this.options.onInit&&this.options.onInit()}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"===typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"===typeof this.options.beforeRender&&this.options.beforeRender()}},{key:"onRender",value:function(){"function"===typeof this.options.onRender&&this.options.onRender()}},{key:"onModulesLoaded",value:function(){"function"===typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var t=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(e){var n=new e;if(n.constructor.name&&"Function"!==n.constructor.name){var o="module-".concat(t.utilities.camelCase(n.constructor.name));t.keyboardPluginClasses=t.keyboardPluginClasses+" ".concat(o)}n.init(t)})),this.keyboardPluginClasses=this.keyboardPluginClasses+" modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(t,e){return!!this.modules[t]&&this.modules[t][e]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(t,e,n,o){var i=this,s=Array.from(t.children),r=0;return s.length&&n.forEach((function(n,a){var u=o[a];if(!u||!(u>n))return!1;var c=n-r,l=u-r,p=document.createElement("div");p.className+="hg-button-container";var h="".concat(i.options.layoutName,"-r").concat(e,"c").concat(a);p.setAttribute("data-skUID",h);var d=s.splice(c,l-c+1);r=l-c,d.forEach((function(t){return p.appendChild(t)})),s.splice(c,0,p),t.innerHTML="",s.forEach((function(e){return t.appendChild(e)})),i.options.debug&&console.log("rowDOMContainer",d,c,l,r+1)})),t}},{key:"render",value:function(){var t=this;this.clear(),this.initialized||this.beforeFirstRender(),this.beforeRender();var e="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,i=o?"hg-touch-events":"",s=this.options.useMouseEvents||!1,r=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,e,this.keyboardPluginClasses,i),n[this.options.layoutName].forEach((function(e,n){var i=e.split(" "),a=document.createElement("div");a.className+="hg-row";var u=[],c=[];i.forEach((function(e,i){var l,p=!r&&"string"===typeof e&&e.length>1&&0===e.indexOf("["),h=!r&&"string"===typeof e&&e.length>1&&e.indexOf("]")===e.length-1;p&&(u.push(i),e=e.replace(/\[/g,"")),h&&(c.push(i),e=e.replace(/\]/g,""));var d=t.utilities.getButtonClass(e),f=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),y=t.options.useButtonTag?"button":"div",b=document.createElement(y);b.className+="hg-button ".concat(d),(l=b.classList).add.apply(l,_toConsumableArray(t.getButtonThemeClasses(e))),t.setDOMButtonAttributes(e,(function(t,e){b.setAttribute(t,e)})),t.activeButtonClass="hg-activeButton",!t.utilities.pointerEventsSupported()||o||s?o?(b.ontouchstart=function(n){t.handleButtonClicked(e),t.handleButtonMouseDown(e,n)},b.ontouchend=function(){t.handleButtonMouseUp(e)},b.ontouchcancel=function(){t.handleButtonMouseUp(e)}):(b.onclick=function(){t.handleButtonClicked(e)},b.onmousedown=function(n){t.handleButtonMouseDown(e,n)},b.onmouseup=function(){t.handleButtonMouseUp(e)}):(b.onpointerdown=function(n){t.handleButtonClicked(e),t.handleButtonMouseDown(e,n)},b.onpointerup=function(){t.handleButtonMouseUp(e)},b.onpointercancel=function(){t.handleButtonMouseUp(e)}),b.setAttribute("data-skBtn",e);var m="".concat(t.options.layoutName,"-r").concat(n,"b").concat(i);b.setAttribute("data-skBtnUID",m);var g=document.createElement("span");g.innerHTML=f,b.appendChild(g),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(b),a.appendChild(b)})),a=t.parseRowDOMContainers(a,n,u,c),t.keyboardDOM.appendChild(a)})),this.onRender(),this.initialized||(this.initialized=!0,this.onInit())}}])&&Keyboard_defineProperties(t.prototype,e),SimpleKeyboard}();e.default=s}])},"object"===a(e)&&"object"===a(t)?t.exports=r():(i=[],void 0===(s="function"===typeof(o=r)?o.apply(e,i):o)||(t.exports=s))}).call(this,n(4)(t))},function(t,e,n){t.exports=n(6)()},function(t,e,n){t.exports=n(9)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function _typeof(e){return"function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?t.exports=_typeof=function(t){return typeof t}:t.exports=_typeof=function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(e)}t.exports=_typeof},function(t,e,n){"use strict";var o=n(7);function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction,t.exports=function(){function shim(t,e,n,i,s,r){if(r!==o){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function getShim(){return shim}shim.isRequired=shim;var t={array:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return t.PropTypes=t,t}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){},function(t,e,n){"use strict";n.r(e);var o=n(0),i=n.n(o),s=n(1),r=n.n(s);function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function _objectSpread(t){for(var e=1;e= t.length ? {\n done: !0\n } : {\n done: !1,\n value: t[o++]\n };\n },\n e: function e(t) {\n throw t;\n },\n f: F\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var i,\n s = !0,\n a = !1;\n return {\n s: function s() {\n _n = t[Symbol.iterator]();\n },\n n: function n() {\n var t = _n.next();\n\n return s = t.done, t;\n },\n e: function e(t) {\n a = !0, i = t;\n },\n f: function f() {\n try {\n s || null == _n.return || _n.return();\n } finally {\n if (a) throw i;\n }\n }\n };\n }\n\n function _arrayLikeToArray(t, e) {\n (null == e || e > t.length) && (e = t.length);\n\n for (var n = 0, o = new Array(e); n < e; n++) {\n o[n] = t[n];\n }\n\n return o;\n }\n\n function _typeof(t) {\n return (_typeof = \"function\" === typeof Symbol && \"symbol\" === _typeof2(Symbol.iterator) ? function (t) {\n return _typeof2(t);\n } : function (t) {\n return t && \"function\" === typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? \"symbol\" : _typeof2(t);\n })(t);\n }\n\n function _defineProperties(t, e) {\n for (var n = 0; n < e.length; n++) {\n var o = e[n];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);\n }\n }\n\n var o = function () {\n function Utilities(t) {\n var e = t.getOptions,\n n = t.getCaretPosition,\n o = t.dispatch;\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, Utilities), this.getOptions = e, this.getCaretPosition = n, this.dispatch = o, Utilities.bindMethods(Utilities, this);\n }\n\n var t, e, n;\n return t = Utilities, n = [{\n key: \"bindMethods\",\n value: function value(t, e) {\n var n,\n o = _createForOfIteratorHelper(Object.getOwnPropertyNames(t.prototype));\n\n try {\n for (o.s(); !(n = o.n()).done;) {\n var i = n.value;\n \"constructor\" === i || \"bindMethods\" === i || (e[i] = e[i].bind(e));\n }\n } catch (s) {\n o.e(s);\n } finally {\n o.f();\n }\n }\n }], (e = [{\n key: \"getButtonClass\",\n value: function value(t) {\n var e = t.includes(\"{\") && t.includes(\"}\") && \"{//}\" !== t ? \"functionBtn\" : \"standardBtn\",\n n = t.replace(\"{\", \"\").replace(\"}\", \"\"),\n o = \"\";\n return \"standardBtn\" !== e && (o = \" hg-button-\".concat(n)), \"hg-\".concat(e).concat(o);\n }\n }, {\n key: \"getDefaultDiplay\",\n value: function value() {\n return {\n \"{bksp}\": \"backspace\",\n \"{backspace}\": \"backspace\",\n \"{enter}\": \"< enter\",\n \"{shift}\": \"shift\",\n \"{shiftleft}\": \"shift\",\n \"{shiftright}\": \"shift\",\n \"{alt}\": \"alt\",\n \"{s}\": \"shift\",\n \"{tab}\": \"tab\",\n \"{lock}\": \"caps\",\n \"{capslock}\": \"caps\",\n \"{accept}\": \"Submit\",\n \"{space}\": \" \",\n \"{//}\": \" \",\n \"{esc}\": \"esc\",\n \"{escape}\": \"esc\",\n \"{f1}\": \"f1\",\n \"{f2}\": \"f2\",\n \"{f3}\": \"f3\",\n \"{f4}\": \"f4\",\n \"{f5}\": \"f5\",\n \"{f6}\": \"f6\",\n \"{f7}\": \"f7\",\n \"{f8}\": \"f8\",\n \"{f9}\": \"f9\",\n \"{f10}\": \"f10\",\n \"{f11}\": \"f11\",\n \"{f12}\": \"f12\",\n \"{numpaddivide}\": \"/\",\n \"{numlock}\": \"lock\",\n \"{arrowup}\": \"\\u2191\",\n \"{arrowleft}\": \"\\u2190\",\n \"{arrowdown}\": \"\\u2193\",\n \"{arrowright}\": \"\\u2192\",\n \"{prtscr}\": \"print\",\n \"{scrolllock}\": \"scroll\",\n \"{pause}\": \"pause\",\n \"{insert}\": \"ins\",\n \"{home}\": \"home\",\n \"{pageup}\": \"up\",\n \"{delete}\": \"del\",\n \"{end}\": \"end\",\n \"{pagedown}\": \"down\",\n \"{numpadmultiply}\": \"*\",\n \"{numpadsubtract}\": \"-\",\n \"{numpadadd}\": \"+\",\n \"{numpadenter}\": \"enter\",\n \"{period}\": \".\",\n \"{numpaddecimal}\": \".\",\n \"{numpad0}\": \"0\",\n \"{numpad1}\": \"1\",\n \"{numpad2}\": \"2\",\n \"{numpad3}\": \"3\",\n \"{numpad4}\": \"4\",\n \"{numpad5}\": \"5\",\n \"{numpad6}\": \"6\",\n \"{numpad7}\": \"7\",\n \"{numpad8}\": \"8\",\n \"{numpad9}\": \"9\"\n };\n }\n }, {\n key: \"getButtonDisplayName\",\n value: function value(t, e, n) {\n return (e = n ? Object.assign({}, this.getDefaultDiplay(), e) : e || this.getDefaultDiplay())[t] || t;\n }\n }, {\n key: \"getUpdatedInput\",\n value: function value(t, e, n, o) {\n var i = this.getOptions(),\n s = e;\n return (\"{bksp}\" === t || \"{backspace}\" === t) && s.length > 0 ? s = this.removeAt(s, n, o) : \"{space}\" === t ? s = this.addStringAt(s, \" \", n, o) : \"{tab}\" !== t || \"boolean\" === typeof i.tabCharOnTab && !1 === i.tabCharOnTab ? \"{enter}\" !== t && \"{numpadenter}\" !== t || !i.newLineOnEnter ? t.includes(\"numpad\") && Number.isInteger(Number(t[t.length - 2])) ? s = this.addStringAt(s, t[t.length - 2], n, o) : \"{numpaddivide}\" === t ? s = this.addStringAt(s, \"/\", n, o) : \"{numpadmultiply}\" === t ? s = this.addStringAt(s, \"*\", n, o) : \"{numpadsubtract}\" === t ? s = this.addStringAt(s, \"-\", n, o) : \"{numpadadd}\" === t ? s = this.addStringAt(s, \"+\", n, o) : \"{numpaddecimal}\" === t ? s = this.addStringAt(s, \".\", n, o) : \"{\" === t || \"}\" === t ? s = this.addStringAt(s, t, n, o) : t.includes(\"{\") || t.includes(\"}\") || (s = this.addStringAt(s, t, n, o)) : s = this.addStringAt(s, \"\\n\", n, o) : s = this.addStringAt(s, \"\\t\", n, o), s;\n }\n }, {\n key: \"updateCaretPos\",\n value: function value(t, e) {\n var n = this.updateCaretPosAction(t, e);\n this.dispatch(function (t) {\n t.caretPosition = n;\n });\n }\n }, {\n key: \"updateCaretPosAction\",\n value: function value(t, e) {\n var n = this.getOptions(),\n o = this.getCaretPosition();\n return e ? o > 0 && (o -= t) : o += t, n.debug && console.log(\"Caret at:\", o, \"(\".concat(this.keyboardDOMClass, \")\")), o;\n }\n }, {\n key: \"addStringAt\",\n value: function value(t, e, n, o) {\n var i;\n return n || 0 === n ? (i = [t.slice(0, n), e, t.slice(n)].join(\"\"), this.isMaxLengthReached() || o && this.updateCaretPos(e.length)) : i = t + e, i;\n }\n }, {\n key: \"removeAt\",\n value: function value(t, e, n) {\n var o;\n if (0 === this.getCaretPosition()) return t;\n var i = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n return e && e >= 0 ? t.substring(e - 2, e).match(i) ? (o = t.substr(0, e - 2) + t.substr(e), n && this.updateCaretPos(2, !0)) : (o = t.substr(0, e - 1) + t.substr(e), n && this.updateCaretPos(1, !0)) : t.slice(-2).match(i) ? (o = t.slice(0, -2), n && this.updateCaretPos(2, !0)) : (o = t.slice(0, -1), n && this.updateCaretPos(1, !0)), o;\n }\n }, {\n key: \"handleMaxLength\",\n value: function value(t, e) {\n var n = this.getOptions(),\n o = n.maxLength,\n i = t[n.inputName],\n s = e.length - 1 >= o;\n if (e.length <= i.length) return !1;\n if (Number.isInteger(o)) return n.debug && console.log(\"maxLength (num) reached:\", s), s ? (this.maxLengthReached = !0, !0) : (this.maxLengthReached = !1, !1);\n\n if (\"object\" === _typeof(o)) {\n var a = i.length === o[n.inputName];\n return n.debug && console.log(\"maxLength (obj) reached:\", a), a ? (this.maxLengthReached = !0, !0) : (this.maxLengthReached = !1, !1);\n }\n }\n }, {\n key: \"isMaxLengthReached\",\n value: function value() {\n return Boolean(this.maxLengthReached);\n }\n }, {\n key: \"isTouchDevice\",\n value: function value() {\n return \"ontouchstart\" in window || navigator.maxTouchPoints;\n }\n }, {\n key: \"pointerEventsSupported\",\n value: function value() {\n return window.PointerEvent;\n }\n }, {\n key: \"camelCase\",\n value: function value(t) {\n return !!t && t.toLowerCase().trim().split(/[.\\-_\\s]/g).reduce(function (t, e) {\n return e.length ? t + e[0].toUpperCase() + e.slice(1) : t;\n });\n }\n }]) && _defineProperties(t.prototype, e), n && _defineProperties(t, n), Utilities;\n }();\n\n function PhysicalKeyboard_defineProperties(t, e) {\n for (var n = 0; n < e.length; n++) {\n var o = e[n];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);\n }\n }\n\n var i = function () {\n function PhysicalKeyboard(t) {\n var e = t.dispatch,\n n = t.getOptions;\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, PhysicalKeyboard), this.dispatch = e, this.getOptions = n, o.bindMethods(PhysicalKeyboard, this);\n }\n\n var t, e, n;\n return t = PhysicalKeyboard, (e = [{\n key: \"handleHighlightKeyDown\",\n value: function value(t) {\n var e = this.getOptions(),\n n = this.getSimpleKeyboardLayoutKey(t);\n this.dispatch(function (t) {\n var o = t.getButtonElement(n) || t.getButtonElement(\"{\".concat(n, \"}\"));\n o && (o.style.backgroundColor = e.physicalKeyboardHighlightBgColor || \"#9ab4d0\", o.style.color = e.physicalKeyboardHighlightTextColor || \"white\");\n });\n }\n }, {\n key: \"handleHighlightKeyUp\",\n value: function value(t) {\n var e = this.getSimpleKeyboardLayoutKey(t);\n this.dispatch(function (t) {\n var n = t.getButtonElement(e) || t.getButtonElement(\"{\".concat(e, \"}\"));\n n && n.removeAttribute && n.removeAttribute(\"style\");\n });\n }\n }, {\n key: \"getSimpleKeyboardLayoutKey\",\n value: function value(t) {\n var e;\n return ((e = t.code.includes(\"Numpad\") || t.code.includes(\"Shift\") || t.code.includes(\"Space\") || t.code.includes(\"Backspace\") || t.code.includes(\"Control\") || t.code.includes(\"Alt\") || t.code.includes(\"Meta\") ? t.code : t.key) !== e.toUpperCase() || \"F\" === t.code[0] && Number.isInteger(Number(t.code[1])) && t.code.length <= 3) && (e = e.toLowerCase()), e;\n }\n }]) && PhysicalKeyboard_defineProperties(t.prototype, e), n && PhysicalKeyboard_defineProperties(t, n), PhysicalKeyboard;\n }();\n\n function _toConsumableArray(t) {\n return function (t) {\n if (Array.isArray(t)) return Keyboard_arrayLikeToArray(t);\n }(t) || function (t) {\n if (\"undefined\" !== typeof Symbol && Symbol.iterator in Object(t)) return Array.from(t);\n }(t) || function (t, e) {\n if (!t) return;\n if (\"string\" === typeof t) return Keyboard_arrayLikeToArray(t, e);\n var n = Object.prototype.toString.call(t).slice(8, -1);\n \"Object\" === n && t.constructor && (n = t.constructor.name);\n if (\"Map\" === n || \"Set\" === n) return Array.from(t);\n if (\"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Keyboard_arrayLikeToArray(t, e);\n }(t) || function () {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n }\n\n function Keyboard_arrayLikeToArray(t, e) {\n (null == e || e > t.length) && (e = t.length);\n\n for (var n = 0, o = new Array(e); n < e; n++) {\n o[n] = t[n];\n }\n\n return o;\n }\n\n function Keyboard_classCallCheck(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n\n function Keyboard_defineProperties(t, e) {\n for (var n = 0; n < e.length; n++) {\n var o = e[n];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);\n }\n }\n\n function _defineProperty(t, e, n) {\n return e in t ? Object.defineProperty(t, e, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : t[e] = n, t;\n }\n\n var s = function () {\n function SimpleKeyboard() {\n var t = this;\n Keyboard_classCallCheck(this, SimpleKeyboard), _defineProperty(this, \"handleParams\", function (t) {\n var e, n, o;\n if (\"string\" === typeof t[0]) e = t[0].split(\".\").join(\"\"), n = document.querySelector(\".\".concat(e)), o = t[1];else if (t[0] instanceof HTMLDivElement) {\n if (!t[0].className) throw console.warn(\"Any DOM element passed as parameter must have a class.\"), new Error(\"KEYBOARD_DOM_CLASS_ERROR\");\n e = t[0].className.split(\" \")[0], n = t[0], o = t[1];\n } else e = \"simple-keyboard\", n = document.querySelector(\".\".concat(e)), o = t[0];\n return {\n keyboardDOMClass: e,\n keyboardDOM: n,\n options: o\n };\n }), _defineProperty(this, \"getOptions\", function () {\n return t.options;\n }), _defineProperty(this, \"getCaretPosition\", function () {\n return t.caretPosition;\n }), _defineProperty(this, \"registerModule\", function (e, n) {\n t.modules[e] || (t.modules[e] = {}), n(t.modules[e]);\n }), _defineProperty(this, \"getKeyboardClassString\", function () {\n for (var e = arguments.length, n = new Array(e), o = 0; o < e; o++) {\n n[o] = arguments[o];\n }\n\n var i = [t.keyboardDOMClass].concat(n).filter(function (t) {\n return !!t;\n });\n return i.join(\" \");\n });\n\n for (var e = arguments.length, n = new Array(e), s = 0; s < e; s++) {\n n[s] = arguments[s];\n }\n\n var a = this.handleParams(n),\n r = a.keyboardDOMClass,\n u = a.keyboardDOM,\n c = a.options,\n l = void 0 === c ? {} : c;\n if (this.utilities = new o({\n getOptions: this.getOptions,\n getCaretPosition: this.getCaretPosition,\n dispatch: this.dispatch\n }), this.caretPosition = null, this.keyboardDOM = u, this.options = l, this.options.layoutName = this.options.layoutName || \"default\", this.options.theme = this.options.theme || \"hg-theme-default\", this.options.inputName = this.options.inputName || \"default\", this.options.preventMouseDownDefault = this.options.preventMouseDownDefault || !1, this.keyboardPluginClasses = \"\", o.bindMethods(SimpleKeyboard, this), this.input = {}, this.input[this.options.inputName] = \"\", this.keyboardDOMClass = r, this.buttonElements = {}, window.SimpleKeyboardInstances || (window.SimpleKeyboardInstances = {}), this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass), window.SimpleKeyboardInstances[this.currentInstanceName] = this, this.allKeyboardInstances = window.SimpleKeyboardInstances, this.keyboardInstanceNames = Object.keys(window.SimpleKeyboardInstances), this.isFirstKeyboardInstance = this.keyboardInstanceNames[0] === this.currentInstanceName, this.physicalKeyboard = new i({\n dispatch: this.dispatch,\n getOptions: this.getOptions\n }), !this.keyboardDOM) throw console.warn('\".'.concat(r, '\" was not found in the DOM.')), new Error(\"KEYBOARD_DOM_ERROR\");\n this.render(), this.modules = {}, this.loadModules();\n }\n\n var t, e, n;\n return t = SimpleKeyboard, (e = [{\n key: \"handleButtonClicked\",\n value: function value(t) {\n var e = this.options.debug;\n if (\"{//}\" === t) return !1;\n \"function\" === typeof this.options.onKeyPress && this.options.onKeyPress(t), this.input[this.options.inputName] || (this.input[this.options.inputName] = \"\");\n var n = this.utilities.getUpdatedInput(t, this.input[this.options.inputName], this.caretPosition);\n\n if (this.input[this.options.inputName] !== n && (!this.options.inputPattern || this.options.inputPattern && this.inputPatternIsValid(n))) {\n if (this.options.maxLength && this.utilities.handleMaxLength(this.input, n)) return !1;\n this.input[this.options.inputName] = this.utilities.getUpdatedInput(t, this.input[this.options.inputName], this.caretPosition, !0), e && console.log(\"Input changed:\", this.input), this.options.syncInstanceInputs && this.syncInstanceInputs(), \"function\" === typeof this.options.onChange && this.options.onChange(this.input[this.options.inputName]), \"function\" === typeof this.options.onChangeAll && this.options.onChangeAll(this.input);\n }\n\n e && console.log(\"Key pressed:\", t);\n }\n }, {\n key: \"handleButtonMouseDown\",\n value: function value(t, e) {\n var n = this;\n this.options.preventMouseDownDefault && e.preventDefault(), this.options.stopMouseDownPropagation && e.stopPropagation(), e && e.target.classList.add(this.activeButtonClass), this.isMouseHold = !0, this.holdInteractionTimeout && clearTimeout(this.holdInteractionTimeout), this.holdTimeout && clearTimeout(this.holdTimeout), this.options.disableButtonHold || (this.holdTimeout = setTimeout(function () {\n (n.isMouseHold && (!t.includes(\"{\") && !t.includes(\"}\") || \"{delete}\" === t || \"{backspace}\" === t || \"{bksp}\" === t || \"{space}\" === t || \"{tab}\" === t) || \"{arrowright}\" === t || \"{arrowleft}\" === t || \"{arrowup}\" === t || \"{arrowdown}\" === t) && (n.options.debug && console.log(\"Button held:\", t), n.handleButtonHold(t, e)), clearTimeout(n.holdTimeout);\n }, 500));\n }\n }, {\n key: \"handleButtonMouseUp\",\n value: function value(t) {\n var e = this;\n this.recurseButtons(function (t) {\n t.classList.remove(e.activeButtonClass);\n }), this.isMouseHold = !1, this.holdInteractionTimeout && clearTimeout(this.holdInteractionTimeout), t && \"function\" === typeof this.options.onKeyReleased && this.options.onKeyReleased(t);\n }\n }, {\n key: \"handleKeyboardContainerMouseDown\",\n value: function value(t) {\n this.options.preventMouseDownDefault && t.preventDefault();\n }\n }, {\n key: \"handleButtonHold\",\n value: function value(t) {\n var e = this;\n this.holdInteractionTimeout && clearTimeout(this.holdInteractionTimeout), this.holdInteractionTimeout = setTimeout(function () {\n e.isMouseHold ? (e.handleButtonClicked(t), e.handleButtonHold(t)) : clearTimeout(e.holdInteractionTimeout);\n }, 100);\n }\n }, {\n key: \"syncInstanceInputs\",\n value: function value() {\n var t = this;\n this.dispatch(function (e) {\n e.replaceInput(t.input), e.caretPosition = t.caretPosition;\n });\n }\n }, {\n key: \"clearInput\",\n value: function value(t) {\n t = t || this.options.inputName, this.input[t] = \"\", this.caretPosition = 0, this.options.syncInstanceInputs && this.syncInstanceInputs();\n }\n }, {\n key: \"getInput\",\n value: function value(t) {\n return t = t || this.options.inputName, this.options.syncInstanceInputs && this.syncInstanceInputs(), this.input[t];\n }\n }, {\n key: \"setInput\",\n value: function value(t, e) {\n e = e || this.options.inputName, this.input[e] = t, this.options.syncInstanceInputs && this.syncInstanceInputs();\n }\n }, {\n key: \"replaceInput\",\n value: function value(t) {\n this.input = t;\n }\n }, {\n key: \"setOptions\",\n value: function value() {\n var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n e = this.changedOptions(t);\n this.options = Object.assign(this.options, t), e.length && (this.options.debug && console.log(\"changedOptions\", e), this.onSetOptions(t), this.render());\n }\n }, {\n key: \"changedOptions\",\n value: function value(t) {\n var e = this;\n return Object.keys(t).filter(function (n) {\n return JSON.stringify(t[n]) !== JSON.stringify(e.options[n]);\n });\n }\n }, {\n key: \"onSetOptions\",\n value: function value(t) {\n t.inputName && (this.options.debug && console.log(\"inputName changed. caretPosition reset.\"), this.caretPosition = null);\n }\n }, {\n key: \"clear\",\n value: function value() {\n this.keyboardDOM.innerHTML = \"\", this.keyboardDOM.className = this.keyboardDOMClass, this.buttonElements = {};\n }\n }, {\n key: \"dispatch\",\n value: function value(t) {\n if (!window.SimpleKeyboardInstances) throw console.warn(\"SimpleKeyboardInstances is not defined. Dispatch cannot be called.\"), new Error(\"INSTANCES_VAR_ERROR\");\n return Object.keys(window.SimpleKeyboardInstances).forEach(function (e) {\n t(window.SimpleKeyboardInstances[e], e);\n });\n }\n }, {\n key: \"addButtonTheme\",\n value: function value(t, e) {\n var n = this;\n if (!e || !t) return !1;\n t.split(\" \").forEach(function (o) {\n e.split(\" \").forEach(function (e) {\n n.options.buttonTheme || (n.options.buttonTheme = []);\n var i = !1;\n n.options.buttonTheme.map(function (t) {\n if (t.class.split(\" \").includes(e)) {\n i = !0;\n var n = t.buttons.split(\" \");\n n.includes(o) || (i = !0, n.push(o), t.buttons = n.join(\" \"));\n }\n\n return t;\n }), i || n.options.buttonTheme.push({\n class: e,\n buttons: t\n });\n });\n }), this.render();\n }\n }, {\n key: \"removeButtonTheme\",\n value: function value(t, e) {\n var n = this;\n if (!t && !e) return this.options.buttonTheme = [], this.render(), !1;\n t && Array.isArray(this.options.buttonTheme) && this.options.buttonTheme.length && (t.split(\" \").forEach(function (t) {\n n.options.buttonTheme.map(function (o, i) {\n if (e && e.includes(o.class) || !e) {\n var s = o.buttons.split(\" \").filter(function (e) {\n return e !== t;\n });\n s.length ? o.buttons = s.join(\" \") : (n.options.buttonTheme.splice(i, 1), o = null);\n }\n\n return o;\n });\n }), this.render());\n }\n }, {\n key: \"getButtonElement\",\n value: function value(t) {\n var e,\n n = this.buttonElements[t];\n return n && (e = n.length > 1 ? n : n[0]), e;\n }\n }, {\n key: \"inputPatternIsValid\",\n value: function value(t) {\n var e,\n n = this.options.inputPattern;\n\n if ((e = n instanceof RegExp ? n : n[this.options.inputName]) && t) {\n var o = e.test(t);\n return this.options.debug && console.log('inputPattern (\"'.concat(e, '\"): ').concat(o ? \"passed\" : \"did not pass!\")), o;\n }\n\n return !0;\n }\n }, {\n key: \"setEventListeners\",\n value: function value() {\n !this.isFirstKeyboardInstance && this.allKeyboardInstances || (this.options.debug && console.log(\"Caret handling started (\".concat(this.keyboardDOMClass, \")\")), document.addEventListener(\"keyup\", this.handleKeyUp), document.addEventListener(\"keydown\", this.handleKeyDown), document.addEventListener(\"mouseup\", this.handleMouseUp), document.addEventListener(\"touchend\", this.handleTouchEnd));\n }\n }, {\n key: \"handleKeyUp\",\n value: function value(t) {\n this.caretEventHandler(t), this.options.physicalKeyboardHighlight && this.physicalKeyboard.handleHighlightKeyUp(t);\n }\n }, {\n key: \"handleKeyDown\",\n value: function value(t) {\n this.options.physicalKeyboardHighlight && this.physicalKeyboard.handleHighlightKeyDown(t);\n }\n }, {\n key: \"handleMouseUp\",\n value: function value(t) {\n this.caretEventHandler(t);\n }\n }, {\n key: \"handleTouchEnd\",\n value: function value(t) {\n this.caretEventHandler(t);\n }\n }, {\n key: \"caretEventHandler\",\n value: function value(t) {\n var e;\n t.target.tagName && (e = t.target.tagName.toLowerCase()), this.dispatch(function (n) {\n n.isMouseHold && (n.isMouseHold = !1), \"textarea\" !== e && \"input\" !== e || n.options.disableCaretPositioning ? n.options.disableCaretPositioning && (n.caretPosition = null) : (n.caretPosition = t.target.selectionStart, n.options.debug && console.log(\"Caret at: \", t.target.selectionStart, t.target.tagName.toLowerCase(), \"(\".concat(n.keyboardDOMClass, \")\")));\n });\n }\n }, {\n key: \"recurseButtons\",\n value: function value(t) {\n var e = this;\n if (!t) return !1;\n Object.keys(this.buttonElements).forEach(function (n) {\n return e.buttonElements[n].forEach(t);\n });\n }\n }, {\n key: \"destroy\",\n value: function value() {\n this.options.debug && console.log(\"Destroying simple-keyboard instance: \".concat(this.currentInstanceName)), document.removeEventListener(\"keyup\", this.handleKeyUp), document.removeEventListener(\"keydown\", this.handleKeyDown), document.removeEventListener(\"mouseup\", this.handleMouseUp), document.removeEventListener(\"touchend\", this.handleTouchEnd), document.onpointerup = null, document.ontouchend = null, document.ontouchcancel = null, document.onmouseup = null;\n\n var deleteButton = function deleteButton(t) {\n t.onpointerdown = null, t.onpointerup = null, t.onpointercancel = null, t.ontouchstart = null, t.ontouchend = null, t.ontouchcancel = null, t.onclick = null, t.onmousedown = null, t.onmouseup = null, t.remove(), t = null;\n };\n\n this.recurseButtons(deleteButton), this.recurseButtons = null, deleteButton = null, this.keyboardDOM.onpointerdown = null, this.keyboardDOM.ontouchstart = null, this.keyboardDOM.onmousedown = null, this.clear(), window.SimpleKeyboardInstances[this.currentInstanceName] = null, delete window.SimpleKeyboardInstances[this.currentInstanceName], this.initialized = !1;\n }\n }, {\n key: \"getButtonThemeClasses\",\n value: function value(t) {\n var e = this.options.buttonTheme,\n n = [];\n return Array.isArray(e) && e.forEach(function (e) {\n if (e.class && \"string\" === typeof e.class && e.buttons && \"string\" === typeof e.buttons) {\n var o = e.class.split(\" \");\n e.buttons.split(\" \").includes(t) && (n = [].concat(_toConsumableArray(n), _toConsumableArray(o)));\n } else console.warn('Incorrect \"buttonTheme\". Please check the documentation.', e);\n }), n;\n }\n }, {\n key: \"setDOMButtonAttributes\",\n value: function value(t, e) {\n var n = this.options.buttonAttributes;\n Array.isArray(n) && n.forEach(function (n) {\n n.attribute && \"string\" === typeof n.attribute && n.value && \"string\" === typeof n.value && n.buttons && \"string\" === typeof n.buttons ? n.buttons.split(\" \").includes(t) && e(n.attribute, n.value) : console.warn('Incorrect \"buttonAttributes\". Please check the documentation.', n);\n });\n }\n }, {\n key: \"onTouchDeviceDetected\",\n value: function value() {\n this.processAutoTouchEvents(), this.disableContextualWindow();\n }\n }, {\n key: \"disableContextualWindow\",\n value: function value() {\n window.oncontextmenu = function (t) {\n if (t.target.classList.contains(\"hg-button\")) return t.preventDefault(), t.stopPropagation(), !1;\n };\n }\n }, {\n key: \"processAutoTouchEvents\",\n value: function value() {\n this.options.autoUseTouchEvents && (this.options.useTouchEvents = !0, this.options.debug && console.log(\"autoUseTouchEvents: Touch device detected, useTouchEvents enabled.\"));\n }\n }, {\n key: \"onInit\",\n value: function value() {\n this.options.debug && console.log(\"\".concat(this.keyboardDOMClass, \" Initialized\")), this.setEventListeners(), \"function\" === typeof this.options.onInit && this.options.onInit();\n }\n }, {\n key: \"beforeFirstRender\",\n value: function value() {\n this.utilities.isTouchDevice() && this.onTouchDeviceDetected(), \"function\" === typeof this.options.beforeFirstRender && this.options.beforeFirstRender(), this.isFirstKeyboardInstance && this.utilities.pointerEventsSupported() && !this.options.useTouchEvents && !this.options.useMouseEvents && this.options.debug && console.log(\"Using PointerEvents as it is supported by this browser\"), this.options.useTouchEvents && this.options.debug && console.log(\"useTouchEvents has been enabled. Only touch events will be used.\");\n }\n }, {\n key: \"beforeRender\",\n value: function value() {\n \"function\" === typeof this.options.beforeRender && this.options.beforeRender();\n }\n }, {\n key: \"onRender\",\n value: function value() {\n \"function\" === typeof this.options.onRender && this.options.onRender();\n }\n }, {\n key: \"onModulesLoaded\",\n value: function value() {\n \"function\" === typeof this.options.onModulesLoaded && this.options.onModulesLoaded(this);\n }\n }, {\n key: \"loadModules\",\n value: function value() {\n var t = this;\n Array.isArray(this.options.modules) && (this.options.modules.forEach(function (e) {\n var n = new e();\n\n if (n.constructor.name && \"Function\" !== n.constructor.name) {\n var o = \"module-\".concat(t.utilities.camelCase(n.constructor.name));\n t.keyboardPluginClasses = t.keyboardPluginClasses + \" \".concat(o);\n }\n\n n.init(t);\n }), this.keyboardPluginClasses = this.keyboardPluginClasses + \" modules-loaded\", this.render(), this.onModulesLoaded());\n }\n }, {\n key: \"getModuleProp\",\n value: function value(t, e) {\n return !!this.modules[t] && this.modules[t][e];\n }\n }, {\n key: \"getModulesList\",\n value: function value() {\n return Object.keys(this.modules);\n }\n }, {\n key: \"parseRowDOMContainers\",\n value: function value(t, e, n, o) {\n var i = this,\n s = Array.from(t.children),\n a = 0;\n return s.length && n.forEach(function (n, r) {\n var u = o[r];\n if (!u || !(u > n)) return !1;\n var c = n - a,\n l = u - a,\n h = document.createElement(\"div\");\n h.className += \"hg-button-container\";\n var d = \"\".concat(i.options.layoutName, \"-r\").concat(e, \"c\").concat(r);\n h.setAttribute(\"data-skUID\", d);\n var p = s.splice(c, l - c + 1);\n a = l - c, p.forEach(function (t) {\n return h.appendChild(t);\n }), s.splice(c, 0, h), t.innerHTML = \"\", s.forEach(function (e) {\n return t.appendChild(e);\n }), i.options.debug && console.log(\"rowDOMContainer\", p, c, l, a + 1);\n }), t;\n }\n }, {\n key: \"render\",\n value: function value() {\n var t = this;\n this.clear(), this.initialized || this.beforeFirstRender(), this.beforeRender();\n var e = \"hg-layout-\".concat(this.options.layoutName),\n n = this.options.layout || {\n default: [\"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}\", \"{tab} q w e r t y u i o p [ ] \\\\\", \"{lock} a s d f g h j k l ; ' {enter}\", \"{shift} z x c v b n m , . / {shift}\", \".com @ {space}\"],\n shift: [\"~ ! @ # $ % ^ & * ( ) _ + {bksp}\", \"{tab} Q W E R T Y U I O P { } |\", '{lock} A S D F G H J K L : \" {enter}', \"{shift} Z X C V B N M < > ? {shift}\", \".com @ {space}\"]\n },\n o = this.options.useTouchEvents || !1,\n i = o ? \"hg-touch-events\" : \"\",\n s = this.options.useMouseEvents || !1,\n a = this.options.disableRowButtonContainers;\n this.keyboardDOM.className = this.getKeyboardClassString(this.options.theme, e, this.keyboardPluginClasses, i), n[this.options.layoutName].forEach(function (e, n) {\n var i = e.split(\" \"),\n r = document.createElement(\"div\");\n r.className += \"hg-row\";\n var u = [],\n c = [];\n i.forEach(function (e, i) {\n var l,\n h = !a && \"string\" === typeof e && e.length > 1 && 0 === e.indexOf(\"[\"),\n d = !a && \"string\" === typeof e && e.length > 1 && e.indexOf(\"]\") === e.length - 1;\n h && (u.push(i), e = e.replace(/\\[/g, \"\")), d && (c.push(i), e = e.replace(/\\]/g, \"\"));\n var p = t.utilities.getButtonClass(e),\n f = t.utilities.getButtonDisplayName(e, t.options.display, t.options.mergeDisplay),\n y = t.options.useButtonTag ? \"button\" : \"div\",\n b = document.createElement(y);\n b.className += \"hg-button \".concat(p), (l = b.classList).add.apply(l, _toConsumableArray(t.getButtonThemeClasses(e))), t.setDOMButtonAttributes(e, function (t, e) {\n b.setAttribute(t, e);\n }), t.activeButtonClass = \"hg-activeButton\", !t.utilities.pointerEventsSupported() || o || s ? o ? (b.ontouchstart = function (n) {\n t.handleButtonClicked(e), t.handleButtonMouseDown(e, n);\n }, b.ontouchend = function () {\n t.handleButtonMouseUp(e);\n }, b.ontouchcancel = function () {\n t.handleButtonMouseUp(e);\n }) : (b.onclick = function () {\n t.isMouseHold = !1, t.handleButtonClicked(e);\n }, b.onmousedown = function (n) {\n t.handleButtonMouseDown(e, n);\n }, b.onmouseup = function () {\n t.handleButtonMouseUp(e);\n }) : (b.onpointerdown = function (n) {\n t.handleButtonClicked(e), t.handleButtonMouseDown(e, n);\n }, b.onpointerup = function () {\n t.handleButtonMouseUp(e);\n }, b.onpointercancel = function () {\n t.handleButtonMouseUp(e);\n }), b.setAttribute(\"data-skBtn\", e);\n var m = \"\".concat(t.options.layoutName, \"-r\").concat(n, \"b\").concat(i);\n b.setAttribute(\"data-skBtnUID\", m);\n var g = document.createElement(\"span\");\n g.innerHTML = f, b.appendChild(g), t.buttonElements[e] || (t.buttonElements[e] = []), t.buttonElements[e].push(b), r.appendChild(b);\n }), r = t.parseRowDOMContainers(r, n, u, c), t.keyboardDOM.appendChild(r);\n }), this.onRender(), this.initialized || (this.initialized = !0, !this.utilities.pointerEventsSupported() || o || s ? o ? (document.ontouchend = function () {\n return t.handleButtonMouseUp();\n }, document.ontouchcancel = function () {\n return t.handleButtonMouseUp();\n }, this.keyboardDOM.ontouchstart = function (e) {\n return t.handleKeyboardContainerMouseDown(e);\n }) : o || (document.onmouseup = function () {\n return t.handleButtonMouseUp();\n }, this.keyboardDOM.onmousedown = function (e) {\n return t.handleKeyboardContainerMouseDown(e);\n }) : (document.onpointerup = function () {\n return t.handleButtonMouseUp();\n }, this.keyboardDOM.onpointerdown = function (e) {\n return t.handleKeyboardContainerMouseDown(e);\n }), this.onInit());\n }\n }]) && Keyboard_defineProperties(t.prototype, e), n && Keyboard_defineProperties(t, n), SimpleKeyboard;\n }();\n\n e.default = s;\n }]);\n});","module.exports = function (module) {\n if (!module.webpackPolyfill) {\n module.deprecate = function () {};\n\n module.paths = []; // module.parent = undefined by default\n\n if (!module.children) module.children = [];\n Object.defineProperty(module, \"loaded\", {\n enumerable: true,\n get: function get() {\n return module.l;\n }\n });\n Object.defineProperty(module, \"id\", {\n enumerable: true,\n get: function get() {\n return module.i;\n }\n });\n module.webpackPolyfill = 1;\n }\n\n return module;\n};","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","export const parseProps = props => ({\n ...props,\n theme: `simple-keyboard ${props.theme || \"hg-theme-default\"}`\n});\n\nconst cleanProps = sourceObj => ({\n ...sourceObj,\n keyboardRef: null,\n stateToIgnore: null\n});\n\nexport const changedProps = (prevProps, props) => {\n const cleanedProps = cleanProps(props);\n const cleanedPrevProps = cleanProps(prevProps);\n\n return Object.keys(cleanedProps).filter(\n propName => cleanedProps[propName] !== cleanedPrevProps[propName]\n );\n};\n","import React, { useEffect, useRef } from \"react\";\nimport Keyboard from \"simple-keyboard\";\nimport { parseProps, changedProps } from \"../services/Utilities\";\nimport \"simple-keyboard/build/css/index.css\";\n\nconst KeyboardReact = props => {\n const cssClass = props.baseClass || \"react-simple-keyboard\";\n const initRef = useRef();\n const keyboardRef = useRef();\n const previousProps = useRef(props);\n\n useEffect(() => {\n const parsedProps = parseProps(props);\n\n /**\n * Initialize simple-keyboard\n */\n if (!initRef.current) {\n initRef.current = true;\n parsedProps.debug && console.log(\"ReactSimpleKeyboard: Init\");\n keyboardRef.current = new Keyboard(`.${cssClass}`, parsedProps);\n parsedProps.keyboardRef && parsedProps.keyboardRef(keyboardRef.current);\n }\n\n const updatedProps = changedProps(previousProps.current, parsedProps);\n\n /**\n * Only trigger render if props changed\n */\n if (updatedProps.length) {\n let keyboard = keyboardRef.current;\n previousProps.current = parsedProps;\n keyboard.setOptions(parsedProps);\n parsedProps.debug &&\n console.log(\n \"ReactSimpleKeyboard - setOptions called due to updated props:\",\n updatedProps\n );\n }\n }, [initRef, cssClass, previousProps, props]);\n\n return
;\n};\n\nexport default KeyboardReact;\n","import Keyboard from \"./components/Keyboard\";\n\nexport default Keyboard;\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["../../webpack/universalModuleDefinition","../../webpack/bootstrap","../../external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\"}","../../../../webpack/universalModuleDefinition","../../../../webpack/bootstrap","../../services/Utilities.js","../../services/PhysicalKeyboard.js","../../components/Keyboard.js","../../services/KeyboardLayout.js","../../index.js","../../node_modules/prop-types/index.js","../../node_modules/webpack/buildin/module.js","../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/prop-types/factoryWithThrowingShims.js","../../node_modules/prop-types/lib/ReactPropTypesSecret.js","services/Utilities.js","components/Keyboard.js","index.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__0__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Utilities","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","bindMethods","myClass","instance","getOwnPropertyNames","myMethod","button","buttonTypeClass","includes","buttonWithoutBraces","replace","buttonNormalized","display","mergeDisplay","assign","getDefaultDiplay","input","caretPos","caretPosEnd","moveCaret","options","commonParams","output","length","removeAt","addStringAt","tabCharOnTab","newLineOnEnter","Number","isInteger","minus","newCaretPos","updateCaretPosAction","setCaretPosition","caretPosition","debug","console","log","keyboardDOMClass","source","str","position","positionEnd","slice","join","isMaxLengthReached","updateCaretPos","emojiMatchedReg","substring","match","substr","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","Boolean","window","navigator","maxTouchPoints","PointerEvent","toLowerCase","trim","split","reduce","word","toUpperCase","PhysicalKeyboard","event","buttonPressed","getSimpleKeyboardLayoutKey","buttonDOM","getButtonElement","style","backgroundColor","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","removeAttribute","code","SimpleKeyboard","keyboardDOM","params","document","querySelector","HTMLDivElement","className","warn","Error","caretPositionEnd","initCallback","baseDOMClasses","keyboardClasses","filter","DOMClass","handleParams","utilities","layoutName","theme","preventMouseDownDefault","keyboardPluginClasses","buttonElements","currentInstanceName","camelCase","allKeyboardInstances","keyboardInstanceNames","keys","isFirstKeyboardInstance","physicalKeyboard","render","loadModules","endPosition","onKeyPress","getUpdatedInput","inputPattern","inputPatternIsValid","handleMaxLength","syncInstanceInputs","onChange","onChangeAll","e","preventDefault","stopMouseDownPropagation","stopPropagation","target","classList","add","activeButtonClass","holdInteractionTimeout","clearTimeout","holdTimeout","isMouseHold","disableButtonHold","setTimeout","handleButtonHold","recurseButtons","buttonElement","remove","onKeyReleased","handleButtonClicked","replaceInput","changedOptions","onSetOptions","newOptions","JSON","stringify","optionName","innerHTML","callback","forEach","buttons","buttonTheme","classNameFound","map","class","classNameItem","buttonThemeArray","push","Array","isArray","index","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","RegExp","didInputMatch","test","useTouchEvents","useMouseEvents","onkeyup","handleKeyUp","onkeydown","handleKeyDown","pointerEventsSupported","ontouchstart","handlePointerDown","ontouchend","handlePointerUp","ontouchcancel","handleKeyboardContainerMouseDown","onmousedown","onmouseup","onpointerdown","onpointerup","onpointercancel","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","handleButtonMouseUp","targetTagName","disableCaretPositioning","tagName","isKeyboard","contains","selectionStart","selectionEnd","fn","buttonName","deleteButton","onclick","clear","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","beforeRender","onRender","onModulesLoaded","keyboardModule","KeyboardModule","constructor","classStr","init","prop","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","createElement","containerUID","setAttribute","containedElements","appendChild","element","layoutClass","layout","default","shift","useTouchEventsClass","disableRowButtonContainers","getKeyboardClassString","row","rIndex","rowArray","bIndex","buttonHasContainerStart","indexOf","buttonHasContainerEnd","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","buttonType","useButtonTag","b","getButtonThemeClasses","setDOMButtonAttributes","handleButtonMouseDown","buttonUID","buttonSpanDOM","parseRowDOMContainers","webpackPolyfill","deprecate","paths","_typeof","obj","iterator","ReactPropTypesSecret","emptyFunction","emptyFunctionWithReset","resetWarningCache","shim","props","propName","componentName","location","propFullName","secret","err","getShim","isRequired","ReactPropTypes","array","bool","func","number","string","symbol","any","arrayOf","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","cleanProps","sourceObj","keyboardRef","stateToIgnore","KeyboardReact","cssClass","baseClass","initRef","useRef","previousProps","useEffect","parsedProps","parseProps","current","Keyboard","updatedProps","prevProps","cleanedProps","cleanedPrevProps","changedProps","keyboard","setOptions","propTypes"],"mappings":";;;;;;;;;;;CAAA,SAA2CA,EAAMC,GAC1B,kBAAZC,SAA0C,kBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,UACR,oBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,sBAAuB,CAAC,SAAUJ,GACf,kBAAZC,QACdA,QAA6B,oBAAID,EAAQG,QAAQ,UAEjDJ,EAA0B,oBAAIC,EAAQD,EAAY,OARpD,CASGO,MAAM,SAASC,GAClB,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,oBAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUT,QAGnC,IAAIC,EAASM,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHX,QAAS,IAUV,OANAY,EAAQH,GAAUI,KAAKZ,EAAOD,QAASC,EAAQA,EAAOD,QAASQ,qBAG/DP,EAAOU,GAAI,EAGJV,EAAOD,QA0Df,OArDAQ,oBAAoBM,EAAIF,EAGxBJ,oBAAoBO,EAAIR,EAGxBC,oBAAoBQ,EAAI,SAAShB,EAASiB,EAAMC,GAC3CV,oBAAoBW,EAAEnB,EAASiB,IAClCG,OAAOC,eAAerB,EAASiB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,oBAAoBgB,EAAI,SAASxB,GACX,qBAAXyB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAerB,EAASyB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAerB,EAAS,aAAc,CAAE2B,OAAO,KAQvDnB,oBAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,oBAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,kBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,G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AhC,GACpB,IAAMiC,EAAWjC,EAAMkC,WAAa,wBAC9BC,EAAUC,mBACVN,EAAcM,mBACdC,EAAgBD,iBAAOpC,GAgC7B,OA9BAsC,qBAAU,WACR,IAAMC,EDbgB,SAAAvC,GAAK,sCAC1BA,GAD0B,IAE7B9L,MAAM,mBAAD,OAAqB8L,EAAM9L,OAAS,sBCWnBsO,CAAWxC,GAK1BmC,EAAQM,UACXN,EAAQM,SAAU,EAClBF,EAAYtS,OAASC,QAAQC,IAAI,6BACjC2R,EAAYW,QAAU,IAAIC,IAAJ,WAAiBT,GAAYM,GACnDA,EAAYT,aAAeS,EAAYT,YAAYA,EAAYW,UAGjE,IAAME,EDdkB,SAACC,EAAW5C,GACtC,IAAM6C,EAAejB,WAAW5B,GAC1B8C,EAAmBlB,WAAWgB,GAEpC,OAAOxW,OAAOsI,KAAKmO,GAAchP,QAC/B,SAAAoM,GAAQ,OAAI4C,EAAa5C,KAAc6C,EAAiB7C,MCSnC8C,CAAaV,EAAcI,QAASF,GAKzD,GAAII,EAAatT,OAAQ,CACvB,IAAM2T,EAAWlB,EAAYW,QAC7BJ,EAAcI,QAAUF,EACxBS,EAASC,WAAWV,GACpBA,EAAYtS,OACVC,QAAQC,IACN,gEACAwS,MAGL,CAACR,EAASF,EAAUI,EAAerC,IAE/B,yBAAK1M,UAAW2O,MAGzBD,EAAckB,UAAY,CACxBhB,UAAWP,IAAUb,QAGRkB,QC/CAU","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ReactSimpleKeyboard\", [\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactSimpleKeyboard\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"ReactSimpleKeyboard\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE__0__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"SimpleKeyboard\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SimpleKeyboard\"] = factory();\n\telse\n\t\troot[\"SimpleKeyboard\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * Utility Service\n */\nclass Utilities {\n /**\n * Creates an instance of the Utility service\n */\n constructor({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch }) {\n this.getOptions = getOptions;\n this.getCaretPosition = getCaretPosition;\n this.getCaretPositionEnd = getCaretPositionEnd;\n this.dispatch = dispatch;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(Utilities, this);\n }\n\n /**\n * Adds default classes to a given button\n *\n * @param {string} button The button's layout name\n * @return {string} The classes to be added to the button\n */\n getButtonClass(button) {\n const buttonTypeClass =\n button.includes(\"{\") && button.includes(\"}\") && button !== \"{//}\"\n ? \"functionBtn\"\n : \"standardBtn\";\n const buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\n let buttonNormalized = \"\";\n\n if (buttonTypeClass !== \"standardBtn\")\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\n\n return `hg-${buttonTypeClass}${buttonNormalized}`;\n }\n\n /**\n * Default button display labels\n */\n getDefaultDiplay() {\n return {\n \"{bksp}\": \"backspace\",\n \"{backspace}\": \"backspace\",\n \"{enter}\": \"< enter\",\n \"{shift}\": \"shift\",\n \"{shiftleft}\": \"shift\",\n \"{shiftright}\": \"shift\",\n \"{alt}\": \"alt\",\n \"{s}\": \"shift\",\n \"{tab}\": \"tab\",\n \"{lock}\": \"caps\",\n \"{capslock}\": \"caps\",\n \"{accept}\": \"Submit\",\n \"{space}\": \" \",\n \"{//}\": \" \",\n \"{esc}\": \"esc\",\n \"{escape}\": \"esc\",\n \"{f1}\": \"f1\",\n \"{f2}\": \"f2\",\n \"{f3}\": \"f3\",\n \"{f4}\": \"f4\",\n \"{f5}\": \"f5\",\n \"{f6}\": \"f6\",\n \"{f7}\": \"f7\",\n \"{f8}\": \"f8\",\n \"{f9}\": \"f9\",\n \"{f10}\": \"f10\",\n \"{f11}\": \"f11\",\n \"{f12}\": \"f12\",\n \"{numpaddivide}\": \"/\",\n \"{numlock}\": \"lock\",\n \"{arrowup}\": \"↑\",\n \"{arrowleft}\": \"←\",\n \"{arrowdown}\": \"↓\",\n \"{arrowright}\": \"→\",\n \"{prtscr}\": \"print\",\n \"{scrolllock}\": \"scroll\",\n \"{pause}\": \"pause\",\n \"{insert}\": \"ins\",\n \"{home}\": \"home\",\n \"{pageup}\": \"up\",\n \"{delete}\": \"del\",\n \"{end}\": \"end\",\n \"{pagedown}\": \"down\",\n \"{numpadmultiply}\": \"*\",\n \"{numpadsubtract}\": \"-\",\n \"{numpadadd}\": \"+\",\n \"{numpadenter}\": \"enter\",\n \"{period}\": \".\",\n \"{numpaddecimal}\": \".\",\n \"{numpad0}\": \"0\",\n \"{numpad1}\": \"1\",\n \"{numpad2}\": \"2\",\n \"{numpad3}\": \"3\",\n \"{numpad4}\": \"4\",\n \"{numpad5}\": \"5\",\n \"{numpad6}\": \"6\",\n \"{numpad7}\": \"7\",\n \"{numpad8}\": \"8\",\n \"{numpad9}\": \"9\"\n };\n }\n /**\n * Returns the display (label) name for a given button\n *\n * @param {string} button The button's layout name\n * @param {object} display The provided display option\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\n */\n getButtonDisplayName(button, display, mergeDisplay) {\n if (mergeDisplay) {\n display = Object.assign({}, this.getDefaultDiplay(), display);\n } else {\n display = display || this.getDefaultDiplay();\n }\n\n return display[button] || button;\n }\n\n /**\n * Returns the updated input resulting from clicking a given button\n *\n * @param {string} button The button's layout name\n * @param {string} input The input string\n * @param {number} caretPos The cursor's current position\n * @param {number} caretPosEnd The cursor's current end position\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n getUpdatedInput(\n button,\n input,\n caretPos,\n caretPosEnd = caretPos,\n moveCaret = false\n ) {\n const options = this.getOptions();\n const commonParams = [caretPos, caretPosEnd, moveCaret];\n\n let output = input;\n\n if (\n (button === \"{bksp}\" || button === \"{backspace}\") &&\n output.length > 0\n ) {\n output = this.removeAt(output, ...commonParams);\n } else if (button === \"{space}\")\n output = this.addStringAt(output, \" \", ...commonParams);\n else if (\n button === \"{tab}\" &&\n !(\n typeof options.tabCharOnTab === \"boolean\" &&\n options.tabCharOnTab === false\n )\n ) {\n output = this.addStringAt(output, \"\\t\", ...commonParams);\n } else if (\n (button === \"{enter}\" || button === \"{numpadenter}\") &&\n options.newLineOnEnter\n )\n output = this.addStringAt(output, \"\\n\", ...commonParams);\n else if (\n button.includes(\"numpad\") &&\n Number.isInteger(Number(button[button.length - 2]))\n ) {\n output = this.addStringAt(\n output,\n button[button.length - 2],\n ...commonParams\n );\n } else if (button === \"{numpaddivide}\")\n output = this.addStringAt(output, \"/\", ...commonParams);\n else if (button === \"{numpadmultiply}\")\n output = this.addStringAt(output, \"*\", ...commonParams);\n else if (button === \"{numpadsubtract}\")\n output = this.addStringAt(output, \"-\", ...commonParams);\n else if (button === \"{numpadadd}\")\n output = this.addStringAt(output, \"+\", ...commonParams);\n else if (button === \"{numpaddecimal}\")\n output = this.addStringAt(output, \".\", ...commonParams);\n else if (button === \"{\" || button === \"}\")\n output = this.addStringAt(output, button, ...commonParams);\n else if (!button.includes(\"{\") && !button.includes(\"}\"))\n output = this.addStringAt(output, button, ...commonParams);\n\n return output;\n }\n\n /**\n * Moves the cursor position by a given amount\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPos(length, minus) {\n const newCaretPos = this.updateCaretPosAction(length, minus);\n\n this.dispatch(instance => {\n instance.setCaretPosition(newCaretPos);\n });\n }\n\n /**\n * Action method of updateCaretPos\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPosAction(length, minus) {\n const options = this.getOptions();\n let caretPosition = this.getCaretPosition();\n\n if (minus) {\n if (caretPosition > 0) caretPosition = caretPosition - length;\n } else {\n caretPosition = caretPosition + length;\n }\n\n if (options.debug) {\n console.log(\"Caret at:\", caretPosition, `(${this.keyboardDOMClass})`);\n }\n\n return caretPosition;\n }\n\n /**\n * Adds a string to the input at a given position\n *\n * @param {string} source The source input\n * @param {string} str The string to add\n * @param {number} position The (cursor) position where the string should be added\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n addStringAt(\n source,\n str,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n let output;\n\n if (!position && position !== 0) {\n output = source + str;\n } else {\n output = [source.slice(0, position), str, source.slice(positionEnd)].join(\n \"\"\n );\n\n /**\n * Avoid caret position change when maxLength is set\n */\n if (!this.isMaxLengthReached()) {\n if (moveCaret) this.updateCaretPos(str.length);\n }\n }\n\n return output;\n }\n\n /**\n * Removes an amount of characters at a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n removeAt(\n source,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n if (position === 0 && positionEnd === 0) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n let prevTwoChars;\n let emojiMatched;\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n if (position && position >= 0) {\n prevTwoChars = source.substring(position - 2, position);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position - 2) + source.substr(position);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.substr(0, position - 1) + source.substr(position);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n } else {\n prevTwoChars = source.slice(-2);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.slice(0, -2);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.slice(0, -1);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch(instance => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n /**\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\n *\n * @param {object} inputObj\n * @param {string} updatedInput\n */\n handleMaxLength(inputObj, updatedInput) {\n const options = this.getOptions();\n const maxLength = options.maxLength;\n const currentInput = inputObj[options.inputName];\n const condition = updatedInput.length - 1 >= maxLength;\n\n if (\n /**\n * If pressing this button won't add more characters\n * We exit out of this limiter function\n */\n updatedInput.length <= currentInput.length\n ) {\n return false;\n }\n\n if (Number.isInteger(maxLength)) {\n if (options.debug) {\n console.log(\"maxLength (num) reached:\", condition);\n }\n\n if (condition) {\n /**\n * @type {boolean} Boolean value that shows whether maxLength has been reached\n */\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n\n if (typeof maxLength === \"object\") {\n const condition = currentInput.length === maxLength[options.inputName];\n\n if (options.debug) {\n console.log(\"maxLength (obj) reached:\", condition);\n }\n\n if (condition) {\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n }\n\n /**\n * Gets the current value of maxLengthReached\n */\n isMaxLengthReached() {\n return Boolean(this.maxLengthReached);\n }\n\n /**\n * Determines whether a touch device is being used\n */\n isTouchDevice() {\n return \"ontouchstart\" in window || navigator.maxTouchPoints;\n }\n\n /**\n * Determines whether pointer events are supported\n */\n pointerEventsSupported() {\n return window.PointerEvent;\n }\n\n /**\n * Bind all methods in a given class\n */\n\n static bindMethods(myClass, instance) {\n // eslint-disable-next-line no-unused-vars\n for (const myMethod of Object.getOwnPropertyNames(myClass.prototype)) {\n const excludeMethod =\n myMethod === \"constructor\" || myMethod === \"bindMethods\";\n if (!excludeMethod) {\n instance[myMethod] = instance[myMethod].bind(instance);\n }\n }\n }\n\n /**\n * Transforms an arbitrary string to camelCase\n *\n * @param {string} str The string to transform.\n */\n camelCase(str) {\n if (!str) return false;\n\n return str\n .toLowerCase()\n .trim()\n .split(/[.\\-_\\s]/g)\n .reduce((str, word) =>\n word.length ? str + word[0].toUpperCase() + word.slice(1) : str\n );\n }\n}\n\nexport default Utilities;\n","import Utilities from \"../services/Utilities\";\n\n/**\n * Physical Keyboard Service\n */\nclass PhysicalKeyboard {\n /**\n * Creates an instance of the PhysicalKeyboard service\n */\n constructor({ dispatch, getOptions }) {\n /**\n * @type {object} A simple-keyboard instance\n */\n this.dispatch = dispatch;\n this.getOptions = getOptions;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(PhysicalKeyboard, this);\n }\n\n handleHighlightKeyDown(event) {\n const options = this.getOptions();\n const buttonPressed = this.getSimpleKeyboardLayoutKey(event);\n\n this.dispatch(instance => {\n const buttonDOM =\n instance.getButtonElement(buttonPressed) ||\n instance.getButtonElement(`{${buttonPressed}}`);\n\n if (buttonDOM) {\n buttonDOM.style.backgroundColor =\n options.physicalKeyboardHighlightBgColor || \"#dadce4\";\n buttonDOM.style.color =\n options.physicalKeyboardHighlightTextColor || \"black\";\n }\n });\n }\n\n handleHighlightKeyUp(event) {\n const buttonPressed = this.getSimpleKeyboardLayoutKey(event);\n\n this.dispatch(instance => {\n const buttonDOM =\n instance.getButtonElement(buttonPressed) ||\n instance.getButtonElement(`{${buttonPressed}}`);\n\n if (buttonDOM && buttonDOM.removeAttribute) {\n buttonDOM.removeAttribute(\"style\");\n }\n });\n }\n\n /**\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\n * @param {object} event The KeyboardEvent\n */\n getSimpleKeyboardLayoutKey(event) {\n let output;\n\n if (\n event.code.includes(\"Numpad\") ||\n event.code.includes(\"Shift\") ||\n event.code.includes(\"Space\") ||\n event.code.includes(\"Backspace\") ||\n event.code.includes(\"Control\") ||\n event.code.includes(\"Alt\") ||\n event.code.includes(\"Meta\")\n ) {\n output = event.code;\n } else {\n output = event.key;\n }\n\n /**\n * If button is not uppercase, casting to lowercase\n */\n if (\n output !== output.toUpperCase() ||\n (event.code[0] === \"F\" &&\n Number.isInteger(Number(event.code[1])) &&\n event.code.length <= 3)\n ) {\n output = output.toLowerCase();\n }\n\n return output;\n }\n}\n\nexport default PhysicalKeyboard;\n","import \"./Keyboard.css\";\n\n// Services\nimport { getDefaultLayout } from \"../services/KeyboardLayout\";\nimport PhysicalKeyboard from \"../services/PhysicalKeyboard\";\nimport Utilities from \"../services/Utilities\";\n\n/**\n * Root class for simple-keyboard\n * This class:\n * - Parses the options\n * - Renders the rows and buttons\n * - Handles button functionality\n */\nclass SimpleKeyboard {\n /**\n * Creates an instance of SimpleKeyboard\n * @param {Array} params If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object.\n */\n constructor(...params) {\n const { keyboardDOMClass, keyboardDOM, options = {} } = this.handleParams(\n params\n );\n\n /**\n * Initializing Utilities\n */\n this.utilities = new Utilities({\n getOptions: this.getOptions,\n getCaretPosition: this.getCaretPosition,\n getCaretPositionEnd: this.getCaretPositionEnd,\n dispatch: this.dispatch\n });\n\n /**\n * Caret position\n */\n this.caretPosition = null;\n\n /**\n * Caret position end\n */\n this.caretPositionEnd = null;\n\n /**\n * Processing options\n */\n this.keyboardDOM = keyboardDOM;\n\n /**\n * @type {object}\n * @property {object} layout Modify the keyboard layout.\n * @property {string} layoutName Specifies which layout should be used.\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\n * @property {string} theme A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.\n * @property {array} buttonTheme A prop to add your own css classes to one or several buttons.\n * @property {array} buttonAttributes A prop to add your own attributes to one or several buttons.\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\n * @property {number} maxLength Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {object} maxLength Restrains simple-keyboard’s individual inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\n * @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.\n * @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\n * @property {boolean} useButtonTag Render buttons as a button element instead of a div element.\n * @property {boolean} disableCaretPositioning A prop to ensure characters are always be added/removed at the end of the string.\n * @property {object} inputPattern Restrains input(s) change to the defined regular expression pattern.\n * @property {boolean} useTouchEvents Instructs simple-keyboard to use touch events instead of click events.\n * @property {boolean} autoUseTouchEvents Enable useTouchEvents automatically when touch device is detected.\n * @property {boolean} useMouseEvents Opt out of PointerEvents handling, falling back to the prior mouse event logic.\n * @property {function} destroy Clears keyboard listeners and DOM elements.\n * @property {boolean} disableButtonHold Disable button hold action.\n * @property {function} onKeyReleased Executes the callback function on key release.\n * @property {array} modules Module classes to be loaded by simple-keyboard.\n */\n this.options = options;\n this.options.layoutName = this.options.layoutName || \"default\";\n this.options.theme = this.options.theme || \"hg-theme-default\";\n this.options.inputName = this.options.inputName || \"default\";\n this.options.preventMouseDownDefault =\n this.options.preventMouseDownDefault || false;\n\n /**\n * @type {object} Classes identifying loaded plugins\n */\n this.keyboardPluginClasses = \"\";\n\n /**\n * Bindings\n */\n Utilities.bindMethods(SimpleKeyboard, this);\n\n /**\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\n * @example\n * // To get entered input\n * const input = keyboard.getInput();\n *\n * // To clear entered input.\n * keyboard.clearInput();\n *\n * @type {object}\n * @property {object} default Default SimpleKeyboard internal input.\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\n */\n this.input = {};\n this.input[this.options.inputName] = \"\";\n\n /**\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\n */\n this.keyboardDOMClass = keyboardDOMClass;\n\n /**\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\n */\n this.buttonElements = {};\n\n /**\n * Simple-keyboard Instances\n * This enables multiple simple-keyboard support with easier management\n */\n if (!window[\"SimpleKeyboardInstances\"])\n window[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = window[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys(window[\"SimpleKeyboardInstances\"]);\n this.isFirstKeyboardInstance =\n this.keyboardInstanceNames[0] === this.currentInstanceName;\n\n /**\n * Physical Keyboard support\n */\n this.physicalKeyboard = new PhysicalKeyboard({\n dispatch: this.dispatch,\n getOptions: this.getOptions\n });\n\n /**\n * Rendering keyboard\n */\n if (this.keyboardDOM) this.render();\n else {\n console.warn(`\".${keyboardDOMClass}\" was not found in the DOM.`);\n throw new Error(\"KEYBOARD_DOM_ERROR\");\n }\n\n /**\n * Modules\n */\n this.modules = {};\n this.loadModules();\n }\n\n /**\n * parseParams\n */\n handleParams = params => {\n let keyboardDOMClass;\n let keyboardDOM;\n let options;\n\n /**\n * If first parameter is a string:\n * Consider it as an element's class\n */\n if (typeof params[0] === \"string\") {\n keyboardDOMClass = params[0].split(\".\").join(\"\");\n keyboardDOM = document.querySelector(`.${keyboardDOMClass}`);\n options = params[1];\n\n /**\n * If first parameter is an HTMLDivElement\n * Consider it as the keyboard DOM element\n */\n } else if (params[0] instanceof HTMLDivElement) {\n /**\n * This element must have a class, otherwise throw\n */\n if (!params[0].className) {\n console.warn(\"Any DOM element passed as parameter must have a class.\");\n throw new Error(\"KEYBOARD_DOM_CLASS_ERROR\");\n }\n\n keyboardDOMClass = params[0].className.split(\" \")[0];\n keyboardDOM = params[0];\n options = params[1];\n\n /**\n * Otherwise, search for .simple-keyboard DOM element\n */\n } else {\n keyboardDOMClass = \"simple-keyboard\";\n keyboardDOM = document.querySelector(`.${keyboardDOMClass}`);\n options = params[0];\n }\n\n return {\n keyboardDOMClass,\n keyboardDOM,\n options\n };\n };\n\n /**\n * Getters\n */\n getOptions = () => this.options;\n getCaretPosition = () => this.caretPosition;\n getCaretPositionEnd = () => this.caretPositionEnd;\n\n /**\n * Setters\n */\n setCaretPosition(position, endPosition) {\n this.caretPosition = position;\n this.caretPositionEnd = endPosition || position;\n }\n\n /**\n * Handles clicks made to keyboard buttons\n * @param {string} button The button's layout name.\n */\n handleButtonClicked(button) {\n const debug = this.options.debug;\n\n /**\n * Ignoring placeholder buttons\n */\n if (button === \"{//}\") return false;\n\n /**\n * Calling onKeyPress\n */\n if (typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(button);\n\n if (!this.input[this.options.inputName])\n this.input[this.options.inputName] = \"\";\n\n const updatedInput = this.utilities.getUpdatedInput(\n button,\n this.input[this.options.inputName],\n this.caretPosition,\n this.caretPositionEnd\n );\n\n if (\n // If input will change as a result of this button press\n this.input[this.options.inputName] !== updatedInput &&\n // This pertains to the \"inputPattern\" option:\n // If inputPattern isn't set\n (!this.options.inputPattern ||\n // Or, if it is set and if the pattern is valid - we proceed.\n (this.options.inputPattern && this.inputPatternIsValid(updatedInput)))\n ) {\n /**\n * If maxLength and handleMaxLength yield true, halting\n */\n if (\n this.options.maxLength &&\n this.utilities.handleMaxLength(this.input, updatedInput)\n ) {\n return false;\n }\n\n this.input[this.options.inputName] = this.utilities.getUpdatedInput(\n button,\n this.input[this.options.inputName],\n this.caretPosition,\n this.caretPositionEnd,\n true\n );\n\n if (debug) console.log(\"Input changed:\", this.input);\n\n if (this.options.debug) {\n console.log(\n \"Caret at: \",\n this.getCaretPosition(),\n this.getCaretPositionEnd(),\n `(${this.keyboardDOMClass})`\n );\n }\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n\n /**\n * Calling onChange\n */\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(this.input[this.options.inputName]);\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.input);\n }\n\n if (debug) {\n console.log(\"Key pressed:\", button);\n }\n }\n\n /**\n * Handles button mousedown\n */\n /* istanbul ignore next */\n handleButtonMouseDown(button, e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n if (this.options.stopMouseDownPropagation) e.stopPropagation();\n\n /**\n * Add active class\n */\n if (e) e.target.classList.add(this.activeButtonClass);\n\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n if (this.holdTimeout) clearTimeout(this.holdTimeout);\n\n /**\n * @type {boolean} Whether the mouse is being held onKeyPress\n */\n this.isMouseHold = true;\n\n /**\n * @type {object} Time to wait until a key hold is detected\n */\n if (!this.options.disableButtonHold) {\n this.holdTimeout = setTimeout(() => {\n if (\n (this.isMouseHold &&\n // TODO: This needs to be configurable through options\n ((!button.includes(\"{\") && !button.includes(\"}\")) ||\n button === \"{delete}\" ||\n button === \"{backspace}\" ||\n button === \"{bksp}\" ||\n button === \"{space}\" ||\n button === \"{tab}\")) ||\n button === \"{arrowright}\" ||\n button === \"{arrowleft}\" ||\n button === \"{arrowup}\" ||\n button === \"{arrowdown}\"\n ) {\n if (this.options.debug) console.log(\"Button held:\", button);\n\n this.handleButtonHold(button, e);\n }\n clearTimeout(this.holdTimeout);\n }, 500);\n }\n }\n\n /**\n * Handles button mouseup\n */\n handleButtonMouseUp(button) {\n this.dispatch(instance => {\n /**\n * Remove active class\n */\n instance.recurseButtons(buttonElement => {\n buttonElement.classList.remove(this.activeButtonClass);\n });\n\n instance.isMouseHold = false;\n if (instance.holdInteractionTimeout)\n clearTimeout(instance.holdInteractionTimeout);\n });\n\n /**\n * Calling onKeyReleased\n */\n if (button && typeof this.options.onKeyReleased === \"function\")\n this.options.onKeyReleased(button);\n }\n\n /**\n * Handles container mousedown\n */\n handleKeyboardContainerMouseDown(e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n }\n\n /**\n * Handles button hold\n */\n /* istanbul ignore next */\n handleButtonHold(button) {\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * @type {object} Timeout dictating the speed of key hold iterations\n */\n this.holdInteractionTimeout = setTimeout(() => {\n if (this.isMouseHold) {\n this.handleButtonClicked(button);\n this.handleButtonHold(button);\n } else {\n clearTimeout(this.holdInteractionTimeout);\n }\n }, 100);\n }\n\n /**\n * Send a command to all simple-keyboard instances (if you have several instances).\n */\n syncInstanceInputs() {\n this.dispatch(instance => {\n instance.replaceInput(this.input);\n instance.setCaretPosition(this.caretPosition, this.caretPositionEnd);\n });\n }\n\n /**\n * Clear the keyboard’s input.\n * @param {string} [inputName] optional - the internal input to select\n */\n clearInput(inputName) {\n inputName = inputName || this.options.inputName;\n this.input[inputName] = \"\";\n\n /**\n * Reset caretPosition\n */\n this.setCaretPosition(0);\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Get the keyboard’s input (You can also get it from the onChange prop).\n * @param {string} [inputName] optional - the internal input to select\n */\n getInput(inputName) {\n inputName = inputName || this.options.inputName;\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n\n return this.input[inputName];\n }\n\n /**\n * Set the keyboard’s input.\n * @param {string} input the input value\n * @param {string} inputName optional - the internal input to select\n */\n setInput(input, inputName) {\n inputName = inputName || this.options.inputName;\n this.input[inputName] = input;\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Replace the input object (`keyboard.input`)\n * @param {object} inputObj The input object\n */\n replaceInput(inputObj) {\n this.input = inputObj;\n }\n\n /**\n * Set new option or modify existing ones after initialization.\n * @param {object} options The options to set\n */\n setOptions(options = {}) {\n const changedOptions = this.changedOptions(options);\n this.options = Object.assign(this.options, options);\n\n if (changedOptions.length) {\n if (this.options.debug) {\n console.log(\"changedOptions\", changedOptions);\n }\n\n /**\n * Some option changes require adjustments before re-render\n */\n this.onSetOptions(options);\n\n /**\n * Rendering\n */\n this.render();\n }\n }\n\n /**\n * Detecting changes to non-function options\n * This allows us to ascertain whether a button re-render is needed\n */\n changedOptions(newOptions) {\n return Object.keys(newOptions).filter(\n optionName =>\n JSON.stringify(newOptions[optionName]) !==\n JSON.stringify(this.options[optionName])\n );\n }\n\n /**\n * Executing actions depending on changed options\n * @param {object} options The options to set\n */\n onSetOptions(options) {\n if (options.inputName) {\n /**\n * inputName changed. This requires a caretPosition reset\n */\n // TODO: Review side-effects\n if (this.options.debug) {\n console.log(\"inputName changed. caretPosition reset.\");\n }\n this.setCaretPosition(null);\n }\n }\n\n /**\n * Remove all keyboard rows and reset keyboard values.\n * Used internally between re-renders.\n */\n clear() {\n this.keyboardDOM.innerHTML = \"\";\n this.keyboardDOM.className = this.keyboardDOMClass;\n this.buttonElements = {};\n }\n\n /**\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\n * @param {function(instance: object, key: string)} callback Function to run on every instance\n */\n dispatch(callback) {\n if (!window[\"SimpleKeyboardInstances\"]) {\n console.warn(\n `SimpleKeyboardInstances is not defined. Dispatch cannot be called.`\n );\n throw new Error(\"INSTANCES_VAR_ERROR\");\n }\n\n return Object.keys(window[\"SimpleKeyboardInstances\"]).forEach(key => {\n callback(window[\"SimpleKeyboardInstances\"][key], key);\n });\n }\n\n /**\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n addButtonTheme(buttons, className) {\n if (!className || !buttons) return false;\n\n buttons.split(\" \").forEach(button => {\n className.split(\" \").forEach(classNameItem => {\n if (!this.options.buttonTheme) this.options.buttonTheme = [];\n\n let classNameFound = false;\n\n /**\n * If class is already defined, we add button to class definition\n */\n this.options.buttonTheme.map(buttonTheme => {\n if (buttonTheme.class.split(\" \").includes(classNameItem)) {\n classNameFound = true;\n\n const buttonThemeArray = buttonTheme.buttons.split(\" \");\n if (!buttonThemeArray.includes(button)) {\n classNameFound = true;\n buttonThemeArray.push(button);\n buttonTheme.buttons = buttonThemeArray.join(\" \");\n }\n }\n return buttonTheme;\n });\n\n /**\n * If class is not defined, we create a new entry\n */\n if (!classNameFound) {\n this.options.buttonTheme.push({\n class: classNameItem,\n buttons: buttons\n });\n }\n });\n });\n\n this.render();\n }\n\n /**\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n removeButtonTheme(buttons, className) {\n /**\n * When called with empty parameters, remove all button themes\n */\n if (!buttons && !className) {\n this.options.buttonTheme = [];\n this.render();\n return false;\n }\n\n /**\n * If buttons are passed and buttonTheme has items\n */\n if (\n buttons &&\n Array.isArray(this.options.buttonTheme) &&\n this.options.buttonTheme.length\n ) {\n const buttonArray = buttons.split(\" \");\n buttonArray.forEach(button => {\n this.options.buttonTheme.map((buttonTheme, index) => {\n /**\n * If className is set, we affect the buttons only for that class\n * Otherwise, we afect all classes\n */\n if (\n (className && className.includes(buttonTheme.class)) ||\n !className\n ) {\n const filteredButtonArray = buttonTheme.buttons\n .split(\" \")\n .filter(item => item !== button);\n\n /**\n * If buttons left, return them, otherwise, remove button Theme\n */\n if (filteredButtonArray.length) {\n buttonTheme.buttons = filteredButtonArray.join(\" \");\n } else {\n this.options.buttonTheme.splice(index, 1);\n buttonTheme = null;\n }\n }\n\n return buttonTheme;\n });\n });\n\n this.render();\n }\n }\n\n /**\n * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.\n * @param {string} button The button layout name to select\n */\n getButtonElement(button) {\n let output;\n\n const buttonArr = this.buttonElements[button];\n if (buttonArr) {\n if (buttonArr.length > 1) {\n output = buttonArr;\n } else {\n output = buttonArr[0];\n }\n }\n\n return output;\n }\n\n /**\n * This handles the \"inputPattern\" option\n * by checking if the provided inputPattern passes\n */\n inputPatternIsValid(inputVal) {\n const inputPatternRaw = this.options.inputPattern;\n let inputPattern;\n\n /**\n * Check if input pattern is global or targeted to individual inputs\n */\n if (inputPatternRaw instanceof RegExp) {\n inputPattern = inputPatternRaw;\n } else {\n inputPattern = inputPatternRaw[this.options.inputName];\n }\n\n if (inputPattern && inputVal) {\n const didInputMatch = inputPattern.test(inputVal);\n\n if (this.options.debug) {\n console.log(\n `inputPattern (\"${inputPattern}\"): ${\n didInputMatch ? \"passed\" : \"did not pass!\"\n }`\n );\n }\n\n return didInputMatch;\n } else {\n /**\n * inputPattern doesn't seem to be set for the current input, or input is empty. Pass.\n */\n return true;\n }\n }\n\n /**\n * Handles simple-keyboard event listeners\n */\n setEventListeners() {\n const { useTouchEvents, useMouseEvents } = this.options;\n\n /**\n * Only first instance should set the event listeners\n */\n if (this.isFirstKeyboardInstance || !this.allKeyboardInstances) {\n if (this.options.debug) {\n console.log(`Caret handling started (${this.keyboardDOMClass})`);\n }\n\n /**\n * Event Listeners\n */\n document.onkeyup = this.handleKeyUp;\n document.onkeydown = this.handleKeyDown;\n\n /**\n * Pointer events\n */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n document.onpointerdown = this.handlePointerDown;\n document.onpointerup = this.handlePointerUp;\n document.onpointercancel = this.handlePointerUp;\n\n this.keyboardDOM.onpointerdown = this.handleKeyboardContainerMouseDown;\n\n /**\n * Touch events\n */\n } else if (useTouchEvents) {\n document.ontouchstart = this.handlePointerDown;\n document.ontouchend = this.handlePointerUp;\n document.ontouchcancel = this.handlePointerUp;\n\n this.keyboardDOM.ontouchstart = this.handleKeyboardContainerMouseDown;\n\n /**\n * Mouse events\n */\n } else if (!useTouchEvents) {\n document.onmousedown = this.handlePointerDown;\n document.onmouseup = this.handlePointerUp;\n\n this.keyboardDOM.onmousedown = this.handleKeyboardContainerMouseDown;\n }\n }\n }\n\n /**\n * Event Handler: KeyUp\n */\n handleKeyUp(event) {\n this.caretEventHandler(event);\n\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyUp(event);\n }\n }\n\n /**\n * Event Handler: KeyDown\n */\n handleKeyDown(event) {\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyDown(event);\n }\n }\n\n /**\n * Event Handler: PointerDown\n */\n handlePointerDown(event) {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: PointerUp\n */\n handlePointerUp(event) {\n this.handleButtonMouseUp();\n this.caretEventHandler(event);\n }\n\n /**\n * Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered\n */\n caretEventHandler(event) {\n if (this.options.disableCaretPositioning) {\n this.setCaretPosition(null);\n return;\n }\n\n let targetTagName;\n\n if (event.target.tagName) {\n targetTagName = event.target.tagName.toLowerCase();\n }\n\n /* istanbul ignore next */\n this.dispatch(instance => {\n const isKeyboard =\n event.target === instance.keyboardDOM ||\n (event.target && instance.keyboardDOM.contains(event.target));\n\n // if (!this.isMouseHold) {\n // instance.isMouseHold = false;\n // }\n\n if (targetTagName === \"textarea\" || targetTagName === \"input\") {\n /**\n * Tracks current cursor position\n * As keys are pressed, text will be added/removed at that position within the input.\n */\n instance.setCaretPosition(\n event.target.selectionStart,\n event.target.selectionEnd\n );\n\n if (instance.options.debug) {\n console.log(\n \"Caret at: \",\n instance.getCaretPosition(),\n instance.getCaretPositionEnd(),\n event && event.target.tagName.toLowerCase(),\n `(${instance.keyboardDOMClass})`\n );\n }\n\n // TODO: Review side-effects\n } else if (!isKeyboard) {\n instance.setCaretPosition(null);\n }\n });\n }\n\n /**\n * Execute an operation on each button\n */\n recurseButtons(fn) {\n if (!fn) return false;\n\n Object.keys(this.buttonElements).forEach(buttonName =>\n this.buttonElements[buttonName].forEach(fn)\n );\n }\n\n /**\n * Destroy keyboard listeners and DOM elements\n */\n destroy() {\n if (this.options.debug)\n console.log(\n `Destroying simple-keyboard instance: ${this.currentInstanceName}`\n );\n\n /**\n * Remove buttons\n */\n let deleteButton = buttonElement => {\n buttonElement.onpointerdown = null;\n buttonElement.onpointerup = null;\n buttonElement.onpointercancel = null;\n buttonElement.ontouchstart = null;\n buttonElement.ontouchend = null;\n buttonElement.ontouchcancel = null;\n buttonElement.onclick = null;\n buttonElement.onmousedown = null;\n buttonElement.onmouseup = null;\n\n buttonElement.remove();\n buttonElement = null;\n };\n\n this.recurseButtons(deleteButton);\n deleteButton = null;\n\n /**\n * Remove wrapper events\n */\n this.keyboardDOM.onpointerdown = null;\n this.keyboardDOM.ontouchstart = null;\n this.keyboardDOM.onmousedown = null;\n\n /**\n * Clearing keyboard wrapper\n */\n this.clear();\n\n /**\n * Remove timouts\n */\n /* istanbul ignore next */\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n /* istanbul ignore next */\n if (this.holdTimeout) clearTimeout(this.holdTimeout);\n\n /**\n * Remove instance\n */\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete window[\"SimpleKeyboardInstances\"][this.currentInstanceName];\n\n /**\n * Removing document listeners if there are no more instances\n */\n if (!Object.keys(window[\"SimpleKeyboardInstances\"]).length) {\n /**\n * Remove document listeners\n */\n document.onkeydown = null;\n document.onkeyup = null;\n\n document.onpointerdown = null;\n document.onpointerup = null;\n\n document.onmousedown = null;\n document.onmouseup = null;\n\n document.ontouchstart = null;\n document.ontouchend = null;\n document.ontouchcancel = null;\n\n if (this.options.debug) {\n console.log(\n \"Destroy: No instances remaining. Document listeners removed\",\n window[\"SimpleKeyboardInstances\"]\n );\n }\n } else {\n if (this.options.debug) {\n console.log(\n \"Destroy: Instances remaining! Document listeners not removed\",\n window[\"SimpleKeyboardInstances\"]\n );\n }\n }\n\n /**\n * Reset initialized flag\n */\n this.initialized = false;\n }\n\n /**\n * Process buttonTheme option\n */\n getButtonThemeClasses(button) {\n const buttonTheme = this.options.buttonTheme;\n let buttonClasses = [];\n\n if (Array.isArray(buttonTheme)) {\n buttonTheme.forEach(themeObj => {\n if (\n themeObj.class &&\n typeof themeObj.class === \"string\" &&\n themeObj.buttons &&\n typeof themeObj.buttons === \"string\"\n ) {\n const themeObjClasses = themeObj.class.split(\" \");\n const themeObjButtons = themeObj.buttons.split(\" \");\n\n if (themeObjButtons.includes(button)) {\n buttonClasses = [...buttonClasses, ...themeObjClasses];\n }\n } else {\n console.warn(\n `Incorrect \"buttonTheme\". Please check the documentation.`,\n themeObj\n );\n }\n });\n }\n\n return buttonClasses;\n }\n\n /**\n * Process buttonAttributes option\n */\n setDOMButtonAttributes(button, callback) {\n const buttonAttributes = this.options.buttonAttributes;\n\n if (Array.isArray(buttonAttributes)) {\n buttonAttributes.forEach(attrObj => {\n if (\n attrObj.attribute &&\n typeof attrObj.attribute === \"string\" &&\n attrObj.value &&\n typeof attrObj.value === \"string\" &&\n attrObj.buttons &&\n typeof attrObj.buttons === \"string\"\n ) {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\n } else {\n console.warn(\n `Incorrect \"buttonAttributes\". Please check the documentation.`,\n attrObj\n );\n }\n });\n }\n }\n\n onTouchDeviceDetected() {\n /**\n * Processing autoTouchEvents\n */\n this.processAutoTouchEvents();\n\n /**\n * Disabling contextual window on touch devices\n */\n this.disableContextualWindow();\n }\n\n /**\n * Disabling contextual window for hg-button\n */\n /* istanbul ignore next */\n disableContextualWindow() {\n window.oncontextmenu = event => {\n if (event.target.classList.contains(\"hg-button\")) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n };\n }\n\n /**\n * Process autoTouchEvents option\n */\n processAutoTouchEvents() {\n if (this.options.autoUseTouchEvents) {\n this.options.useTouchEvents = true;\n\n if (this.options.debug) {\n console.log(\n `autoUseTouchEvents: Touch device detected, useTouchEvents enabled.`\n );\n }\n }\n }\n\n /**\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n */\n onInit() {\n if (this.options.debug) {\n console.log(`${this.keyboardDOMClass} Initialized`);\n }\n\n /**\n * setEventListeners\n */\n this.setEventListeners();\n\n if (typeof this.options.onInit === \"function\") this.options.onInit();\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeFirstRender() {\n /**\n * Performing actions when touch device detected\n */\n if (this.utilities.isTouchDevice()) {\n this.onTouchDeviceDetected();\n }\n\n if (typeof this.options.beforeFirstRender === \"function\")\n this.options.beforeFirstRender();\n\n /**\n * Notify about PointerEvents usage\n */\n if (\n this.isFirstKeyboardInstance &&\n this.utilities.pointerEventsSupported() &&\n !this.options.useTouchEvents &&\n !this.options.useMouseEvents\n ) {\n if (this.options.debug) {\n console.log(\"Using PointerEvents as it is supported by this browser\");\n }\n }\n\n /**\n * Notify about touch events usage\n */\n if (this.options.useTouchEvents) {\n if (this.options.debug) {\n console.log(\n \"useTouchEvents has been enabled. Only touch events will be used.\"\n );\n }\n }\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeRender() {\n if (typeof this.options.beforeRender === \"function\")\n this.options.beforeRender();\n }\n\n /**\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n */\n onRender() {\n if (typeof this.options.onRender === \"function\") this.options.onRender();\n }\n\n /**\n * Executes the callback function once all modules have been loaded\n */\n onModulesLoaded() {\n if (typeof this.options.onModulesLoaded === \"function\")\n this.options.onModulesLoaded(this);\n }\n\n /**\n * Register module\n */\n registerModule = (name, initCallback) => {\n if (!this.modules[name]) this.modules[name] = {};\n\n initCallback(this.modules[name]);\n };\n\n /**\n * Load modules\n */\n loadModules() {\n if (Array.isArray(this.options.modules)) {\n this.options.modules.forEach(KeyboardModule => {\n const keyboardModule = new KeyboardModule();\n\n /* istanbul ignore next */\n if (\n keyboardModule.constructor.name &&\n keyboardModule.constructor.name !== \"Function\"\n ) {\n const classStr = `module-${this.utilities.camelCase(\n keyboardModule.constructor.name\n )}`;\n this.keyboardPluginClasses =\n this.keyboardPluginClasses + ` ${classStr}`;\n }\n\n keyboardModule.init(this);\n });\n\n this.keyboardPluginClasses =\n this.keyboardPluginClasses + \" modules-loaded\";\n\n this.render();\n this.onModulesLoaded();\n }\n }\n\n /**\n * Get module prop\n */\n getModuleProp(name, prop) {\n if (!this.modules[name]) return false;\n\n return this.modules[name][prop];\n }\n\n /**\n * getModulesList\n */\n getModulesList() {\n return Object.keys(this.modules);\n }\n\n /**\n * Parse Row DOM containers\n */\n parseRowDOMContainers(\n rowDOM,\n rowIndex,\n containerStartIndexes,\n containerEndIndexes\n ) {\n const rowDOMArray = Array.from(rowDOM.children);\n let removedElements = 0;\n\n if (rowDOMArray.length) {\n containerStartIndexes.forEach((startIndex, arrIndex) => {\n const endIndex = containerEndIndexes[arrIndex];\n\n /**\n * If there exists a respective end index\n * if end index comes after start index\n */\n if (!endIndex || !(endIndex > startIndex)) {\n return false;\n }\n\n /**\n * Updated startIndex, endIndex\n * This is since the removal of buttons to place a single button container\n * results in a modified array size\n */\n const updated_startIndex = startIndex - removedElements;\n const updated_endIndex = endIndex - removedElements;\n\n /**\n * Create button container\n */\n const containerDOM = document.createElement(\"div\");\n containerDOM.className += \"hg-button-container\";\n const containerUID = `${this.options.layoutName}-r${rowIndex}c${arrIndex}`;\n containerDOM.setAttribute(\"data-skUID\", containerUID);\n\n /**\n * Taking elements due to be inserted into container\n */\n const containedElements = rowDOMArray.splice(\n updated_startIndex,\n updated_endIndex - updated_startIndex + 1\n );\n removedElements = updated_endIndex - updated_startIndex;\n\n /**\n * Inserting elements to container\n */\n containedElements.forEach(element => containerDOM.appendChild(element));\n\n /**\n * Adding container at correct position within rowDOMArray\n */\n rowDOMArray.splice(updated_startIndex, 0, containerDOM);\n\n /**\n * Clearing old rowDOM children structure\n */\n rowDOM.innerHTML = \"\";\n\n /**\n * Appending rowDOM new children list\n */\n rowDOMArray.forEach(element => rowDOM.appendChild(element));\n\n if (this.options.debug) {\n console.log(\n \"rowDOMContainer\",\n containedElements,\n updated_startIndex,\n updated_endIndex,\n removedElements + 1\n );\n }\n });\n }\n\n return rowDOM;\n }\n\n /**\n * getKeyboardClassString\n */\n getKeyboardClassString = (...baseDOMClasses) => {\n const keyboardClasses = [this.keyboardDOMClass, ...baseDOMClasses].filter(\n DOMClass => !!DOMClass\n );\n\n return keyboardClasses.join(\" \");\n };\n\n /**\n * Renders rows and buttons as per options\n */\n render() {\n /**\n * Clear keyboard\n */\n this.clear();\n\n /**\n * Calling beforeFirstRender\n */\n if (!this.initialized) {\n this.beforeFirstRender();\n }\n\n /**\n * Calling beforeRender\n */\n this.beforeRender();\n\n const layoutClass = `hg-layout-${this.options.layoutName}`;\n const layout = this.options.layout || getDefaultLayout();\n const useTouchEvents = this.options.useTouchEvents || false;\n const useTouchEventsClass = useTouchEvents ? \"hg-touch-events\" : \"\";\n const useMouseEvents = this.options.useMouseEvents || false;\n const disableRowButtonContainers = this.options.disableRowButtonContainers;\n\n /**\n * Adding themeClass, layoutClass to keyboardDOM\n */\n this.keyboardDOM.className = this.getKeyboardClassString(\n this.options.theme,\n layoutClass,\n this.keyboardPluginClasses,\n useTouchEventsClass\n );\n\n /**\n * Iterating through each row\n */\n layout[this.options.layoutName].forEach((row, rIndex) => {\n const rowArray = row.split(\" \");\n\n /**\n * Creating empty row\n */\n let rowDOM = document.createElement(\"div\");\n rowDOM.className += \"hg-row\";\n\n /**\n * Tracking container indicators in rows\n */\n const containerStartIndexes = [];\n const containerEndIndexes = [];\n\n /**\n * Iterating through each button in row\n */\n rowArray.forEach((button, bIndex) => {\n /**\n * Check if button has a container indicator\n */\n const buttonHasContainerStart =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"[\") === 0;\n\n const buttonHasContainerEnd =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"]\") === button.length - 1;\n\n /**\n * Save container start index, if applicable\n */\n if (buttonHasContainerStart) {\n containerStartIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\[/g, \"\");\n }\n\n if (buttonHasContainerEnd) {\n containerEndIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\]/g, \"\");\n }\n\n /**\n * Processing button options\n */\n const fctBtnClass = this.utilities.getButtonClass(button);\n const buttonDisplayName = this.utilities.getButtonDisplayName(\n button,\n this.options.display,\n this.options.mergeDisplay\n );\n\n /**\n * Creating button\n */\n const buttonType = this.options.useButtonTag ? \"button\" : \"div\";\n const buttonDOM = document.createElement(buttonType);\n buttonDOM.className += `hg-button ${fctBtnClass}`;\n\n /**\n * Adding buttonTheme\n */\n buttonDOM.classList.add(...this.getButtonThemeClasses(button));\n\n /**\n * Adding buttonAttributes\n */\n this.setDOMButtonAttributes(button, (attribute, value) => {\n buttonDOM.setAttribute(attribute, value);\n });\n\n this.activeButtonClass = \"hg-activeButton\";\n\n /**\n * Handle button click event\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n /**\n * Handle PointerEvents\n */\n buttonDOM.onpointerdown = e => {\n this.handleButtonClicked(button);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onpointerup = () => {\n this.handleButtonMouseUp(button);\n };\n buttonDOM.onpointercancel = () => {\n this.handleButtonMouseUp(button);\n };\n } else {\n /**\n * Fallback for browsers not supporting PointerEvents\n */\n if (useTouchEvents) {\n /**\n * Handle touch events\n */\n buttonDOM.ontouchstart = e => {\n this.handleButtonClicked(button);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.ontouchend = () => {\n this.handleButtonMouseUp(button);\n };\n buttonDOM.ontouchcancel = () => {\n this.handleButtonMouseUp(button);\n };\n } else {\n /**\n * Handle mouse events\n */\n buttonDOM.onclick = () => {\n this.handleButtonClicked(button);\n };\n buttonDOM.onmousedown = e => {\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onmouseup = () => {\n this.handleButtonMouseUp(button);\n };\n }\n }\n\n /**\n * Adding identifier\n */\n buttonDOM.setAttribute(\"data-skBtn\", button);\n\n /**\n * Adding unique id\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\n */\n const buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\n\n /**\n * Adding button label to button\n */\n const buttonSpanDOM = document.createElement(\"span\");\n buttonSpanDOM.innerHTML = buttonDisplayName;\n buttonDOM.appendChild(buttonSpanDOM);\n\n /**\n * Adding to buttonElements\n */\n if (!this.buttonElements[button]) this.buttonElements[button] = [];\n\n this.buttonElements[button].push(buttonDOM);\n\n /**\n * Appending button to row\n */\n rowDOM.appendChild(buttonDOM);\n });\n\n /**\n * Parse containers in row\n */\n rowDOM = this.parseRowDOMContainers(\n rowDOM,\n rIndex,\n containerStartIndexes,\n containerEndIndexes\n );\n\n /**\n * Appending row to keyboard\n */\n this.keyboardDOM.appendChild(rowDOM);\n });\n\n /**\n * Calling onRender\n */\n this.onRender();\n\n if (!this.initialized) {\n /**\n * Ensures that onInit and beforeFirstRender are only called once per instantiation\n */\n this.initialized = true;\n\n /**\n * Calling onInit\n */\n this.onInit();\n }\n }\n}\n\nexport default SimpleKeyboard;\n","export const getDefaultLayout = () => {\n return {\n default: [\n \"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}\",\n \"{tab} q w e r t y u i o p [ ] \\\\\",\n \"{lock} a s d f g h j k l ; ' {enter}\",\n \"{shift} z x c v b n m , . / {shift}\",\n \".com @ {space}\"\n ],\n shift: [\n \"~ ! @ # $ % ^ & * ( ) _ + {bksp}\",\n \"{tab} Q W E R T Y U I O P { } |\",\n '{lock} A S D F G H J K L : \" {enter}',\n \"{shift} Z X C V B N M < > ? {shift}\",\n \".com @ {space}\"\n ]\n };\n};\n","import SimpleKeyboard from \"./components/Keyboard\";\nexport default SimpleKeyboard;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","export const parseProps = props => ({\r\n ...props,\r\n theme: `simple-keyboard ${props.theme || \"hg-theme-default\"}`\r\n});\r\n\r\nconst cleanProps = sourceObj => ({\r\n ...sourceObj,\r\n keyboardRef: null,\r\n stateToIgnore: null\r\n});\r\n\r\nexport const changedProps = (prevProps, props) => {\r\n const cleanedProps = cleanProps(props);\r\n const cleanedPrevProps = cleanProps(prevProps);\r\n\r\n return Object.keys(cleanedProps).filter(\r\n propName => cleanedProps[propName] !== cleanedPrevProps[propName]\r\n );\r\n};\r\n","import React, { useEffect, useRef } from \"react\";\r\nimport Keyboard from \"simple-keyboard\";\r\nimport { parseProps, changedProps } from \"../services/Utilities\";\r\nimport PropTypes from \"prop-types\";\r\nimport \"simple-keyboard/build/css/index.css\";\r\n\r\nconst KeyboardReact = props => {\r\n const cssClass = props.baseClass || \"react-simple-keyboard\";\r\n const initRef = useRef();\r\n const keyboardRef = useRef();\r\n const previousProps = useRef(props);\r\n\r\n useEffect(() => {\r\n const parsedProps = parseProps(props);\r\n\r\n /**\r\n * Initialize simple-keyboard\r\n */\r\n if (!initRef.current) {\r\n initRef.current = true;\r\n parsedProps.debug && console.log(\"ReactSimpleKeyboard: Init\");\r\n keyboardRef.current = new Keyboard(`.${cssClass}`, parsedProps);\r\n parsedProps.keyboardRef && parsedProps.keyboardRef(keyboardRef.current);\r\n }\r\n\r\n const updatedProps = changedProps(previousProps.current, parsedProps);\r\n\r\n /**\r\n * Only trigger render if props changed\r\n */\r\n if (updatedProps.length) {\r\n const keyboard = keyboardRef.current;\r\n previousProps.current = parsedProps;\r\n keyboard.setOptions(parsedProps);\r\n parsedProps.debug &&\r\n console.log(\r\n \"ReactSimpleKeyboard - setOptions called due to updated props:\",\r\n updatedProps\r\n );\r\n }\r\n }, [initRef, cssClass, previousProps, props]);\r\n\r\n return
;\r\n};\r\n\r\nKeyboardReact.propTypes = {\r\n baseClass: PropTypes.string\r\n};\r\n\r\nexport default KeyboardReact;\r\n","import Keyboard from \"./components/Keyboard\";\n\nexport default Keyboard;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/config/env.js b/config/env.js index b0344c5a8..09ec03c5b 100644 --- a/config/env.js +++ b/config/env.js @@ -15,7 +15,7 @@ if (!NODE_ENV) { } // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use -var dotenvFiles = [ +const dotenvFiles = [ `${paths.dotenv}.${NODE_ENV}.local`, `${paths.dotenv}.${NODE_ENV}`, // Don't include `.env.local` for `test` environment @@ -46,7 +46,7 @@ dotenvFiles.forEach(dotenvFile => { // It works similar to `NODE_PATH` in Node itself: // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. -// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. +// Otherwise, we risk importing Node.js core modules into an app instead of webpack shims. // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421 // We also resolve them to make sure all tools using them work consistently. const appDirectory = fs.realpathSync(process.cwd()); @@ -57,7 +57,7 @@ process.env.NODE_PATH = (process.env.NODE_PATH || '') .join(path.delimiter); // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be -// injected into the application via DefinePlugin in Webpack configuration. +// injected into the application via DefinePlugin in webpack configuration. const REACT_APP = /^REACT_APP_/i; function getClientEnvironment(publicUrl) { @@ -77,9 +77,17 @@ function getClientEnvironment(publicUrl) { // This should only be used as an escape hatch. Normally you would put // images into the `src` and `import` them in code to get their paths. PUBLIC_URL: publicUrl, + // We support configuring the sockjs pathname during development. + // These settings let a developer run multiple simultaneous projects. + // They are used as the connection `hostname`, `pathname` and `port` + // in webpackHotDevClient. They are used as the `sockHost`, `sockPath` + // and `sockPort` options in webpack-dev-server. + WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST, + WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH, + WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT, } ); - // Stringify all values so we can feed into Webpack DefinePlugin + // Stringify all values so we can feed into webpack DefinePlugin const stringified = { 'process.env': Object.keys(raw).reduce((env, key) => { env[key] = JSON.stringify(raw[key]); diff --git a/config/getHttpsConfig.js b/config/getHttpsConfig.js new file mode 100644 index 000000000..013d493c1 --- /dev/null +++ b/config/getHttpsConfig.js @@ -0,0 +1,66 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const crypto = require('crypto'); +const chalk = require('react-dev-utils/chalk'); +const paths = require('./paths'); + +// Ensure the certificate and key provided are valid and if not +// throw an easy to debug error +function validateKeyAndCerts({ cert, key, keyFile, crtFile }) { + let encrypted; + try { + // publicEncrypt will throw an error with an invalid cert + encrypted = crypto.publicEncrypt(cert, Buffer.from('test')); + } catch (err) { + throw new Error( + `The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}` + ); + } + + try { + // privateDecrypt will throw an error with an invalid key + crypto.privateDecrypt(key, encrypted); + } catch (err) { + throw new Error( + `The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${ + err.message + }` + ); + } +} + +// Read file and throw an error if it doesn't exist +function readEnvFile(file, type) { + if (!fs.existsSync(file)) { + throw new Error( + `You specified ${chalk.cyan( + type + )} in your env, but the file "${chalk.yellow(file)}" can't be found.` + ); + } + return fs.readFileSync(file); +} + +// Get the https config +// Return cert files if provided in env, otherwise just true or false +function getHttpsConfig() { + const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env; + const isHttps = HTTPS === 'true'; + + if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) { + const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE); + const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE); + const config = { + cert: readEnvFile(crtFile, 'SSL_CRT_FILE'), + key: readEnvFile(keyFile, 'SSL_KEY_FILE'), + }; + + validateKeyAndCerts({ ...config, keyFile, crtFile }); + return config; + } + return isHttps; +} + +module.exports = getHttpsConfig; diff --git a/config/jest/fileTransform.js b/config/jest/fileTransform.js index 74dc1aa94..aab67618c 100644 --- a/config/jest/fileTransform.js +++ b/config/jest/fileTransform.js @@ -13,10 +13,10 @@ module.exports = { if (filename.match(/\.svg$/)) { // Based on how SVGR generates a component name: // https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6 - const pascalCaseFileName = camelcase(path.parse(filename).name, { + const pascalCaseFilename = camelcase(path.parse(filename).name, { pascalCase: true, }); - const componentName = `Svg${pascalCaseFileName}`; + const componentName = `Svg${pascalCaseFilename}`; return `const React = require('react'); module.exports = { __esModule: true, diff --git a/config/modules.js b/config/modules.js index 46d9c9efc..c8efd0dd0 100644 --- a/config/modules.js +++ b/config/modules.js @@ -7,7 +7,7 @@ const chalk = require('react-dev-utils/chalk'); const resolve = require('resolve'); /** - * Get the baseUrl of a compilerOptions object. + * Get additional module paths based on the baseUrl of a compilerOptions object. * * @param {Object} options */ @@ -38,6 +38,15 @@ function getAdditionalModulePaths(options = {}) { return [paths.appSrc]; } + // If the path is equal to the root directory we ignore it here. + // We don't want to allow importing from the root directly as source files are + // not transpiled outside of `src`. We do allow importing them with the + // absolute path (e.g. `src/Components/Button.js`) but we set that up with + // an alias. + if (path.relative(paths.appPath, baseUrlResolved) === '') { + return null; + } + // Otherwise, throw an error. throw new Error( chalk.red.bold( @@ -47,6 +56,48 @@ function getAdditionalModulePaths(options = {}) { ); } +/** + * Get webpack aliases based on the baseUrl of a compilerOptions object. + * + * @param {*} options + */ +function getWebpackAliases(options = {}) { + const baseUrl = options.baseUrl; + + if (!baseUrl) { + return {}; + } + + const baseUrlResolved = path.resolve(paths.appPath, baseUrl); + + if (path.relative(paths.appPath, baseUrlResolved) === '') { + return { + src: paths.appSrc, + }; + } +} + +/** + * Get jest aliases based on the baseUrl of a compilerOptions object. + * + * @param {*} options + */ +function getJestAliases(options = {}) { + const baseUrl = options.baseUrl; + + if (!baseUrl) { + return {}; + } + + const baseUrlResolved = path.resolve(paths.appPath, baseUrl); + + if (path.relative(paths.appPath, baseUrlResolved) === '') { + return { + '^src/(.*)$': '/src/$1', + }; + } +} + function getModules() { // Check if TypeScript is setup const hasTsConfig = fs.existsSync(paths.appTsConfig); @@ -81,6 +132,8 @@ function getModules() { return { additionalModulePaths: additionalModulePaths, + webpackAliases: getWebpackAliases(options), + jestAliases: getJestAliases(options), hasTsConfig, }; } diff --git a/config/paths.js b/config/paths.js index 78509b4a2..9c754687a 100644 --- a/config/paths.js +++ b/config/paths.js @@ -1,42 +1,22 @@ -'use strict'; + const path = require('path'); const fs = require('fs'); -const url = require('url'); +const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath'); // Make sure any symlinks in the project folder are resolved: // https://github.com/facebook/create-react-app/issues/637 const appDirectory = fs.realpathSync(process.cwd()); const resolveApp = relativePath => path.resolve(appDirectory, relativePath); -const envPublicUrl = process.env.PUBLIC_URL; - -function ensureSlash(inputPath, needsSlash) { - const hasSlash = inputPath.endsWith('/'); - if (hasSlash && !needsSlash) { - return inputPath.substr(0, inputPath.length - 1); - } else if (!hasSlash && needsSlash) { - return `${inputPath}/`; - } else { - return inputPath; - } -} - -const getPublicUrl = appPackageJson => - envPublicUrl || require(appPackageJson).homepage; // We use `PUBLIC_URL` environment variable or "homepage" field to infer // "public path" at which the app is served. -// Webpack needs to know it to put the right