From 7698e293731c74fb1f5ad1619cfdad00cd29cd9b Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Fri, 9 Nov 2018 11:06:46 -0500 Subject: [PATCH] 2.8.0 - Webpack 4, Babel 7 --- .gitignore | 4 +- build/css/index.css | 7 +- build/css/index.css.map | 2 +- build/index.js | 4 +- build/index.js.map | 2 +- config/env.js | 15 +- config/jest/cssTransform.js | 2 +- config/jest/fileTransform.js | 22 +- config/paths.js | 65 +- config/polyfills.js | 22 - config/webpack.config.demo.js | 550 +- config/webpack.config.dev.js | 290 +- config/webpack.config.prod.js | 522 +- config/webpackDevServer.config.js | 37 +- docs/ast/source/demo/App.js.json | 4882 ++- .../source/lib/components/Keyboard.js.json | 25374 ++++++++-------- .../lib/services/PhysicalKeyboard.js.json | 2165 +- docs/class/src/demo/App.js~App.html | 6 +- .../Keyboard.js~SimpleKeyboard.html | 20 +- docs/file/src/demo/App.js.html | 6 +- docs/file/src/lib/components/Keyboard.js.html | 6 +- .../src/lib/services/PhysicalKeyboard.js.html | 2 +- docs/index.json | 34 +- docs/source.html | 16 +- package-lock.json | 23124 ++++++++------ package.json | 140 +- scripts/build.js | 82 +- scripts/demo.js | 88 +- scripts/start.js | 34 +- scripts/test.js | 36 +- src/lib/components/Keyboard.js | 6 +- src/lib/services/PhysicalKeyboard.js | 2 +- 32 files changed, 30841 insertions(+), 26726 deletions(-) delete mode 100644 config/polyfills.js diff --git a/.gitignore b/.gitignore index 081e3227..24391ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules +/.pnp +.pnp.js # production /demo diff --git a/build/css/index.css b/build/css/index.css index b466042f..eef0bad7 100644 --- a/build/css/index.css +++ b/build/css/index.css @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v2.7.12 + * simple-keyboard v2.8.0 * https://github.com/hodgef/simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef) @@ -8,6 +8,5 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - */ -body,html{margin:0;padding:0}.simple-keyboard{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;-ms-touch-action:manipulation;touch-action:manipulation}.simple-keyboard .hg-row{display:-ms-flexbox;display:flex}.simple-keyboard .hg-row:not(:last-child){margin-bottom:5px}.simple-keyboard .hg-row .hg-button:not(:last-child){margin-right:5px}.simple-keyboard .hg-button{display:inline-block;-ms-flex-positive:1;flex-grow:1;cursor:pointer}.hg-standardBtn{max-width:100px}.simple-keyboard.hg-theme-default{background-color:rgba(0,0,0,.1);padding:5px;border-radius:5px}.simple-keyboard.hg-theme-default .hg-button{-webkit-box-shadow:0 0 3px -1px rgba(0,0,0,.3);box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.simple-keyboard.hg-theme-default .hg-button:active{background:#e4e4e4}.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd,.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.simple-keyboard.hg-theme-default .hg-button.hg-button-com{max-width:85px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn="@"]{max-width:60px} -/*# sourceMappingURL=index.css.map*/ \ No newline at end of file + */body,html{margin:0;padding:0}.simple-keyboard{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;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}.simple-keyboard .hg-row{display:flex}.simple-keyboard .hg-row:not(:last-child){margin-bottom:5px}.simple-keyboard .hg-row .hg-button:not(:last-child){margin-right:5px}.simple-keyboard .hg-button{display:inline-block;flex-grow:1;cursor:pointer}.hg-standardBtn{max-width:100px}.simple-keyboard.hg-theme-default{background-color:rgba(0,0,0,.1);padding:5px;border-radius:5px}.simple-keyboard.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}.simple-keyboard.hg-theme-default .hg-button:active{background:#e4e4e4}.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd,.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.simple-keyboard.hg-theme-default .hg-button.hg-button-com{max-width:85px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.simple-keyboard.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 1790834d..3c41b2de 100644 --- a/build/css/index.css.map +++ b/build/css/index.css.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///./src/lib/components/Keyboard.css"],"names":[],"mappings":";;;;;;;;;;;AAAA,UACE,SACA,SAAW,CAGb,iBACE,6GACA,WACA,yBACG,sBACC,qBACI,iBACR,8BACQ,sBACR,gBACA,8BACI,yBAA2B,CAGjC,yBACE,oBACA,YAAc,CAGhB,0CACE,iBAAmB,CAGrB,qDACE,gBAAkB,CAGpB,4BACE,qBACA,oBACI,YACJ,cAAgB,CAGlB,gBACE,eAAiB,CAMnB,kCACE,gCACA,YACA,iBAAmB,CAGrB,6CACE,+CACQ,uCACR,YACA,kBACA,8BACQ,sBACR,YACA,gBACA,gCACA,eACA,oBACA,aACA,sBACI,mBACJ,qBACI,sBAAwB,CAG7B,oDACC,kBAAoB,CAGtB,+DACE,YACA,YACA,sBACI,mBACJ,oBACA,aACA,qBACI,sBAAwB,CAO9B,oIACE,WAAa,CAGf,+DACE,WAAa,CAGf,2DACE,cAAgB,CAGlB,yEACE,cAAgB,CAGlB,+DACE,6BACA,UAAa,CAGf,+EACE,cAAgB,CAGlB,4EACE,cAAgB","file":"css/index.css","sourcesContent":["body, html {\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.simple-keyboard {\r\n font-family: \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\r\n width: 100%;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n -ms-touch-action: manipulation;\r\n touch-action: manipulation;\r\n}\r\n\r\n.simple-keyboard .hg-row {\r\n display: -ms-flexbox;\r\n display: flex;\r\n}\r\n\r\n.simple-keyboard .hg-row:not(:last-child) {\r\n margin-bottom: 5px;\r\n}\r\n\r\n.simple-keyboard .hg-row .hg-button:not(:last-child) {\r\n margin-right: 5px;\r\n}\r\n\r\n.simple-keyboard .hg-button {\r\n display: inline-block;\r\n -ms-flex-positive: 1;\r\n flex-grow: 1;\r\n cursor: pointer;\r\n}\r\n\r\n.hg-standardBtn {\r\n max-width: 100px;\r\n}\r\n\r\n/**\r\n * hg-theme-default theme\r\n */\r\n.simple-keyboard.hg-theme-default {\r\n background-color: rgba(0,0,0,0.1);\r\n padding: 5px;\r\n border-radius: 5px;\r\n }\r\n\r\n.simple-keyboard.hg-theme-default .hg-button {\r\n -webkit-box-shadow: 0px 0px 3px -1px rgba(0,0,0,0.3);\r\n box-shadow: 0px 0px 3px -1px rgba(0,0,0,0.3);\r\n height: 40px;\r\n border-radius: 5px;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: 5px;\r\n background: white;\r\n border-bottom: 1px solid #b5b5b5;\r\n cursor: pointer;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n }\r\n\r\n .simple-keyboard.hg-theme-default .hg-button:active {\r\n background: #e4e4e4;\r\n }\r\n\r\n.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button {\r\n width: 33.3%;\r\n height: 60px;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd {\r\n height: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter {\r\n height: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0 {\r\n width: 105px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-com {\r\n max-width: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at {\r\n max-width: 45px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton {\r\n background: rgba(5, 25, 70, 0.53);\r\n color: white;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"] {\r\n max-width: 82px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"] {\r\n max-width: 60px;\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/lib/components/Keyboard.css"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["index.css","X:/Dev/simple-keyboard/src/lib/components/X:/Dev/simple-keyboard/src/lib/components/Keyboard.css"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG,ACVH,UACE,SAAU,AACV,SAAW,CACZ,AAED,iBACE,6GAA4H,AAC5H,WAAY,AACZ,yBAAkB,AAAlB,sBAAkB,AAAlB,qBAAkB,AAAlB,iBAAkB,AAClB,sBAAuB,AACvB,gBAAiB,AACjB,yBAA2B,CAC5B,AAED,yBACE,YAAc,CACf,AAED,0CACE,iBAAmB,CACpB,AAED,qDACE,gBAAkB,CACnB,AAED,4BACE,qBAAsB,AACtB,YAAa,AACb,cAAgB,CACjB,AAED,gBACE,eAAiB,CAClB,AAKD,kCACE,gCAAkC,AAClC,YAAa,AACb,iBAAmB,CACnB,AAEF,6CACE,uCAA6C,AAC7C,YAAa,AACb,kBAAmB,AACnB,sBAAuB,AACvB,YAAa,AACb,gBAAkB,AAClB,gCAAiC,AACjC,eAAgB,AAChB,aAAc,AACd,mBAAoB,AACpB,sBAAwB,CACxB,AAED,oDACC,kBAAoB,CACpB,AAEF,+DACE,YAAa,AACb,YAAa,AACb,mBAAoB,AACpB,aAAc,AACd,sBAAwB,CACzB,AAMD,oIACE,WAAa,CACd,AAED,+DACE,WAAa,CACd,AAED,2DACE,cAAgB,CACjB,AAED,yEACE,cAAgB,CACjB,AAED,+DACE,6BAAkC,AAClC,UAAa,CACd,AAED,+EACE,cAAgB,CACjB,AAED,4EACE,cAAgB,CDejB","file":"index.css","sourcesContent":["/*!\n * \n * simple-keyboard v2.8.0\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 */\nbody, html {\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.simple-keyboard {\r\n font-family: \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\r\n width: 100%;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n touch-action: manipulation;\r\n}\r\n\r\n.simple-keyboard .hg-row {\r\n display: flex;\r\n}\r\n\r\n.simple-keyboard .hg-row:not(:last-child) {\r\n margin-bottom: 5px;\r\n}\r\n\r\n.simple-keyboard .hg-row .hg-button:not(:last-child) {\r\n margin-right: 5px;\r\n}\r\n\r\n.simple-keyboard .hg-button {\r\n display: inline-block;\r\n flex-grow: 1;\r\n cursor: pointer;\r\n}\r\n\r\n.hg-standardBtn {\r\n max-width: 100px;\r\n}\r\n\r\n/**\r\n * hg-theme-default theme\r\n */\r\n.simple-keyboard.hg-theme-default {\r\n background-color: rgba(0,0,0,0.1);\r\n padding: 5px;\r\n border-radius: 5px;\r\n }\r\n\r\n.simple-keyboard.hg-theme-default .hg-button {\r\n box-shadow: 0px 0px 3px -1px rgba(0,0,0,0.3);\r\n height: 40px;\r\n border-radius: 5px;\r\n box-sizing: border-box;\r\n padding: 5px;\r\n background: white;\r\n border-bottom: 1px solid #b5b5b5;\r\n cursor: pointer;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n .simple-keyboard.hg-theme-default .hg-button:active {\r\n background: #e4e4e4;\r\n }\r\n\r\n.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button {\r\n width: 33.3%;\r\n height: 60px;\r\n align-items: center;\r\n display: flex;\r\n justify-content: center;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd {\r\n height: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter {\r\n height: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0 {\r\n width: 105px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-com {\r\n max-width: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at {\r\n max-width: 45px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton {\r\n background: rgba(5, 25, 70, 0.53);\r\n color: white;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"] {\r\n max-width: 82px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"] {\r\n max-width: 60px;\r\n}\n","body, html {\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.simple-keyboard {\r\n font-family: \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\r\n width: 100%;\r\n user-select: none;\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n touch-action: manipulation;\r\n}\r\n\r\n.simple-keyboard .hg-row {\r\n display: flex;\r\n}\r\n\r\n.simple-keyboard .hg-row:not(:last-child) {\r\n margin-bottom: 5px;\r\n}\r\n\r\n.simple-keyboard .hg-row .hg-button:not(:last-child) {\r\n margin-right: 5px;\r\n}\r\n\r\n.simple-keyboard .hg-button {\r\n display: inline-block;\r\n flex-grow: 1;\r\n cursor: pointer;\r\n}\r\n\r\n.hg-standardBtn {\r\n max-width: 100px;\r\n}\r\n\r\n/**\r\n * hg-theme-default theme\r\n */\r\n.simple-keyboard.hg-theme-default {\r\n background-color: rgba(0,0,0,0.1);\r\n padding: 5px;\r\n border-radius: 5px;\r\n }\r\n\r\n.simple-keyboard.hg-theme-default .hg-button {\r\n box-shadow: 0px 0px 3px -1px rgba(0,0,0,0.3);\r\n height: 40px;\r\n border-radius: 5px;\r\n box-sizing: border-box;\r\n padding: 5px;\r\n background: white;\r\n border-bottom: 1px solid #b5b5b5;\r\n cursor: pointer;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n .simple-keyboard.hg-theme-default .hg-button:active {\r\n background: #e4e4e4;\r\n }\r\n\r\n.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button {\r\n width: 33.3%;\r\n height: 60px;\r\n align-items: center;\r\n display: flex;\r\n justify-content: center;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd {\r\n height: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter {\r\n height: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0 {\r\n width: 105px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-button-com {\r\n max-width: 85px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at {\r\n max-width: 45px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton {\r\n background: rgba(5, 25, 70, 0.53);\r\n color: white;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\".com\"] {\r\n max-width: 82px;\r\n}\r\n\r\n.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\"@\"] {\r\n max-width: 60px;\r\n}"]} \ No newline at end of file diff --git a/build/index.js b/build/index.js index c1af831e..615d7a90 100644 --- a/build/index.js +++ b/build/index.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v2.7.12 + * simple-keyboard v2.8.0 * https://github.com/hodgef/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(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports.SimpleKeyboard=e():t.SimpleKeyboard=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2);e.default=i.a},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=n(3),s=(n.n(o),n(4)),a=n(5),u=n(6),r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n1?n:n[0]),e}},{key:"handleCaret",value:function(){this.options.debug&&console.log("Caret handling started"),document.addEventListener("keyup",this.caretEventHandler),document.addEventListener("mouseup",this.caretEventHandler),document.addEventListener("touchend",this.caretEventHandler)}},{key:"caretEventHandler",value:function(t){var e=t.target.tagName.toLowerCase();"textarea"!==e&&"input"!==e||this.options.disableCaretPositioning||(this.caretPosition=t.target.selectionStart,this.options.debug&&console.log("Caret at: ",t.target.selectionStart,t.target.tagName.toLowerCase()))}},{key:"onInit",value:function(){this.options.debug&&console.log("Initialized"),this.handleCaret(),"function"===typeof this.options.onInit&&this.options.onInit()}},{key:"onRender",value:function(){"function"===typeof this.options.onRender&&this.options.onRender()}},{key:"onModulesLoaded",value:function(){"function"===typeof this.options.onModulesLoaded&&this.options.onModulesLoaded()}},{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 i="module-"+t.utilities.camelCase(n.constructor.name);t.keyboardPluginClasses=t.keyboardPluginClasses+" "+i}n.init(t)}),this.keyboardPluginClasses=this.keyboardPluginClasses+" modules-loaded",this.render(),this.onModulesLoaded())}},{key:"render",value:function(){var t=this;this.clear();var e=this.options.layout?"hg-layout-custom":"hg-layout-"+this.options.layoutName,n=this.options.layout||a.a.getDefaultLayout(),i={};Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.forEach(function(e){if(e.buttons&&e.class){var n=void 0;"string"===typeof e.buttons&&(n=e.buttons.split(" ")),n&&n.forEach(function(n){var o=i[n];o?t.utilities.countInArray(o.split(" "),e.class)||(i[n]=o+" "+e.class):i[n]=e.class})}else console.warn('buttonTheme row is missing the "buttons" or the "class". Please check the documentation.')}),this.keyboardDOM.className+=" "+this.options.theme+" "+e+" "+this.keyboardPluginClasses,n[this.options.layoutName].forEach(function(e,n){var o=e.split(" "),s=document.createElement("div");s.className+="hg-row",o.forEach(function(e,o){var a=t.utilities.getButtonClass(e),u=i[e],r=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),h=document.createElement("div");h.className+="hg-button "+a+(u?" "+u:""),h.onclick=function(){t.isMouseHold=!1,t.handleButtonClicked(e)},h.onmousedown=function(n){return t.handleButtonMouseDown(e,n)},h.setAttribute("data-skBtn",e);var l=t.options.layoutName+"-r"+n+"b"+o;h.setAttribute("data-skBtnUID",l),h.setAttribute("data-displayLabel",r);var d=document.createElement("span");d.innerHTML=r,h.appendChild(d),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(h),s.appendChild(h)}),t.keyboardDOM.appendChild(s)}),this.onRender(),document.onmouseup=function(){return t.handleButtonMouseUp()},this.initialized||(this.initialized=!0,this.onInit())}}]),t}();e.a=l},function(t,e){},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var n=0;n ? {shift}",".com @ {space}"]}}}]),t}();e.a=s},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(){function t(t,e){for(var n=0;n0?s=this.removeAt(s,i,o):"{space}"===t?s=this.addStringAt(s," ",i,o):"{tab}"!==t||"boolean"===typeof n.tabCharOnTab&&!1===n.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!n.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?s=this.addStringAt(s,t[t.length-2],i):"{numpaddivide}"===t?s=this.addStringAt(s,"/",i,o):"{numpadmultiply}"===t?s=this.addStringAt(s,"*",i,o):"{numpadsubtract}"===t?s=this.addStringAt(s,"-",i,o):"{numpadadd}"===t?s=this.addStringAt(s,"+",i,o):"{numpaddecimal}"===t?s=this.addStringAt(s,".",i,o):"{"===t||"}"===t?s=this.addStringAt(s,t,i,o):t.includes("{")||t.includes("}")||(s=this.addStringAt(s,t,i,o)):s=this.addStringAt(s,"\n",i,o):s=this.addStringAt(s,"\t",i,o),s}},{key:"updateCaretPos",value:function(t,e){e?this.simpleKeyboardInstance.caretPosition>0&&(this.simpleKeyboardInstance.caretPosition=this.simpleKeyboardInstance.caretPosition-t):this.simpleKeyboardInstance.caretPosition=this.simpleKeyboardInstance.caretPosition+t}},{key:"addStringAt",value:function(t,e,n,i){var o=void 0;return n||0===n?(o=[t.slice(0,n),e,t.slice(n)].join(""),this.isMaxLengthReached()||i&&this.updateCaretPos(e.length)):o=t+e,this.simpleKeyboardInstance.options.debug&&i&&console.log("Caret at:",n),o}},{key:"removeAt",value:function(t,e,n){if(0===this.simpleKeyboardInstance.caretPosition)return t;var i=void 0,o=void 0,s=void 0,a=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;return e&&e>=0?(o=t.substring(e-2,e),s=o.match(a),s?(i=t.substr(0,e-2)+t.substr(e),n&&this.updateCaretPos(2,!0)):(i=t.substr(0,e-1)+t.substr(e),n&&this.updateCaretPos(1,!0))):(o=t.slice(-2),s=o.match(a),s?(i=t.slice(0,-2),n&&this.updateCaretPos(2,!0)):(i=t.slice(0,-1),n&&this.updateCaretPos(1,!0))),this.simpleKeyboardInstance.options.debug&&n&&console.log("Caret at:",this.simpleKeyboardInstance.caretPosition),i}},{key:"handleMaxLength",value:function(t,e,n){var i=e.maxLength,s=t[e.inputName],a=s.length===i;if(n.length<=s.length)return!1;if(Number.isInteger(i))return e.debug&&console.log("maxLength (num) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===("undefined"===typeof i?"undefined":o(i))){var u=s.length===i[e.inputName];return e.debug&&console.log("maxLength (obj) reached:",u),u?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"camelCase",value:function(t){return t.toLowerCase().trim().split(/[.\-_\s]/g).reduce(function(t,e){return t+e[0].toUpperCase()+e.slice(1)})}},{key:"countInArray",value:function(t,e){return t.reduce(function(t,n){return t+(n===e)},0)}}]),t}();e.a=a}])}); +!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define("SimpleKeyboard",[],e):"object"===typeof exports?exports.SimpleKeyboard=e():t.SimpleKeyboard=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(3)},function(t,e,n){},,function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n ? {shift}",".com @ {space}"]}}}]),t}(),r=function(){function t(e){i(this,t),this.simpleKeyboardInstance=e,this.getButtonClass=this.getButtonClass.bind(this),this.getButtonDisplayName=this.getButtonDisplayName.bind(this),this.getUpdatedInput=this.getUpdatedInput.bind(this),this.updateCaretPos=this.updateCaretPos.bind(this),this.isMaxLengthReached=this.isMaxLengthReached.bind(this),this.camelCase=this.camelCase.bind(this),this.countInArray=this.countInArray.bind(this)}return o(t,[{key:"getButtonClass",value:function(t){var e=t.includes("{")&&t.includes("}")&&"{//}"!==t?"functionBtn":"standardBtn",n=t.replace("{","").replace("}",""),i="";return"standardBtn"!==e&&(i=" hg-button-".concat(n)),"hg-".concat(e).concat(i)}},{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,i,s){var o=e;return("{bksp}"===t||"{backspace}"===t)&&o.length>0?o=this.removeAt(o,i,s):"{space}"===t?o=this.addStringAt(o," ",i,s):"{tab}"!==t||"boolean"===typeof n.tabCharOnTab&&!1===n.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!n.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?o=this.addStringAt(o,t[t.length-2],i):"{numpaddivide}"===t?o=this.addStringAt(o,"/",i,s):"{numpadmultiply}"===t?o=this.addStringAt(o,"*",i,s):"{numpadsubtract}"===t?o=this.addStringAt(o,"-",i,s):"{numpadadd}"===t?o=this.addStringAt(o,"+",i,s):"{numpaddecimal}"===t?o=this.addStringAt(o,".",i,s):"{"===t||"}"===t?o=this.addStringAt(o,t,i,s):t.includes("{")||t.includes("}")||(o=this.addStringAt(o,t,i,s)):o=this.addStringAt(o,"\n",i,s):o=this.addStringAt(o,"\t",i,s),o}},{key:"updateCaretPos",value:function(t,e){e?this.simpleKeyboardInstance.caretPosition>0&&(this.simpleKeyboardInstance.caretPosition=this.simpleKeyboardInstance.caretPosition-t):this.simpleKeyboardInstance.caretPosition=this.simpleKeyboardInstance.caretPosition+t}},{key:"addStringAt",value:function(t,e,n,i){var s;return n||0===n?(s=[t.slice(0,n),e,t.slice(n)].join(""),this.isMaxLengthReached()||i&&this.updateCaretPos(e.length)):s=t+e,this.simpleKeyboardInstance.options.debug&&i&&console.log("Caret at:",n),s}},{key:"removeAt",value:function(t,e,n){if(0===this.simpleKeyboardInstance.caretPosition)return t;var i,s=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;return e&&e>=0?t.substring(e-2,e).match(s)?(i=t.substr(0,e-2)+t.substr(e),n&&this.updateCaretPos(2,!0)):(i=t.substr(0,e-1)+t.substr(e),n&&this.updateCaretPos(1,!0)):t.slice(-2).match(s)?(i=t.slice(0,-2),n&&this.updateCaretPos(2,!0)):(i=t.slice(0,-1),n&&this.updateCaretPos(1,!0)),this.simpleKeyboardInstance.options.debug&&n&&console.log("Caret at:",this.simpleKeyboardInstance.caretPosition),i}},{key:"handleMaxLength",value:function(t,e,n){var i=e.maxLength,s=t[e.inputName],o=s.length===i;if(n.length<=s.length)return!1;if(Number.isInteger(i))return e.debug&&console.log("maxLength (num) reached:",o),o?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===typeof i){var a=s.length===i[e.inputName];return e.debug&&console.log("maxLength (obj) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"camelCase",value:function(t){return t.toLowerCase().trim().split(/[.\-_\s]/g).reduce(function(t,e){return t+e[0].toUpperCase()+e.slice(1)})}},{key:"countInArray",value:function(t,e){return t.reduce(function(t,n){return t+(n===e)},0)}}]),t}(),h=function(){function t(){var e=this;i(this,t),this.setOptions=function(t){t=t||{},e.options=Object.assign(e.options,t),e.render()},this.registerModule=function(t,n){e.modules[t]||(e.modules[t]={}),n(e.modules[t])},this.getModuleProp=function(t,n){return!!e.modules[t]&&e.modules[t][n]},this.getModulesList=function(){return Object.keys(e.modules)};var n="string"===typeof(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:".simple-keyboard",s="object"===typeof(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:arguments.length<=1?void 0:arguments[1];if(s||(s={}),this.utilities=new r(this),this.keyboardDOM=document.querySelector(n),this.options=s,this.options.layoutName=this.options.layoutName||"default",this.options.theme=this.options.theme||"hg-theme-default",this.options.inputName=this.options.inputName||"default",this.keyboardPluginClasses="",this.handleButtonClicked=this.handleButtonClicked.bind(this),this.syncInstanceInputs=this.syncInstanceInputs.bind(this),this.clearInput=this.clearInput.bind(this),this.getInput=this.getInput.bind(this),this.setInput=this.setInput.bind(this),this.replaceInput=this.replaceInput.bind(this),this.clear=this.clear.bind(this),this.dispatch=this.dispatch.bind(this),this.addButtonTheme=this.addButtonTheme.bind(this),this.removeButtonTheme=this.removeButtonTheme.bind(this),this.getButtonElement=this.getButtonElement.bind(this),this.handleCaret=this.handleCaret.bind(this),this.caretEventHandler=this.caretEventHandler.bind(this),this.onInit=this.onInit.bind(this),this.onRender=this.onRender.bind(this),this.render=this.render.bind(this),this.loadModules=this.loadModules.bind(this),this.handleButtonMouseUp=this.handleButtonMouseUp.bind(this),this.handleButtonMouseDown=this.handleButtonMouseDown.bind(this),this.handleButtonHold=this.handleButtonHold.bind(this),this.onModulesLoaded=this.onModulesLoaded.bind(this),this.input={},this.input[this.options.inputName]="",this.keyboardDOMClass=n.split(".").join(""),this.buttonElements={},!this.keyboardDOM)throw console.warn('"'.concat(n,'" was not found in the DOM.')),new Error("KEYBOARD_DOM_ERROR");this.render(),window.SimpleKeyboardInstances||(window.SimpleKeyboardInstances={}),window.SimpleKeyboardInstances[this.utilities.camelCase(this.keyboardDOMClass)]=this,this.physicalKeyboardInterface=new a(this),this.modules={},this.loadModules()}return o(t,[{key:"handleButtonClicked",value:function(t){var e=this.options.debug;if("{//}"===t)return!1;"function"===typeof this.options.onKeyPress&&this.options.onKeyPress(t),this.input[this.options.inputName]||(this.input[this.options.inputName]="");var n=this.utilities.getUpdatedInput(t,this.input[this.options.inputName],this.options,this.caretPosition);if(this.input[this.options.inputName]!==n){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,this.options,n))return!1;this.input[this.options.inputName]=this.utilities.getUpdatedInput(t,this.input[this.options.inputName],this.options,this.caretPosition,!0),e&&console.log("Input changed:",this.input),this.options.syncInstanceInputs&&this.syncInstanceInputs(this.input),"function"===typeof this.options.onChange&&this.options.onChange(this.input[this.options.inputName])}e&&console.log("Key pressed:",t)}},{key:"handleButtonMouseDown",value:function(t,e){var n=this;this.isMouseHold=!0,this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.holdTimeout=setTimeout(function(){!n.isMouseHold||(t.includes("{")||t.includes("}"))&&"{bksp}"!==t&&"{space}"!==t&&"{tab}"!==t||(n.options.debug&&console.log("Button held:",t),n.handleButtonHold(t,e)),clearTimeout(n.holdTimeout)},500)}},{key:"handleButtonMouseUp",value:function(){this.isMouseHold=!1,this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout)}},{key:"handleButtonHold",value:function(t){var e=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=setTimeout(function(){e.isMouseHold?(e.handleButtonClicked(t),e.handleButtonHold(t)):clearTimeout(e.holdInteractionTimeout)},100)}},{key:"syncInstanceInputs",value:function(){var t=this;this.dispatch(function(e){e.replaceInput(t.input)})}},{key:"clearInput",value:function(t){t=t||this.options.inputName,this.input[this.options.inputName]="",this.options.syncInstanceInputs&&this.syncInstanceInputs(this.input)}},{key:"getInput",value:function(t){return t=t||this.options.inputName,this.options.syncInstanceInputs&&this.syncInstanceInputs(this.input),this.input[this.options.inputName]}},{key:"setInput",value:function(t,e){e=e||this.options.inputName,this.input[e]=t,this.options.syncInstanceInputs&&this.syncInstanceInputs(this.input)}},{key:"replaceInput",value:function(t){this.input=t}},{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(i){e.split(" ").forEach(function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var s=!1;n.options.buttonTheme.map(function(t){if(t.class.split(" ").includes(e)){s=!0;var n=t.buttons.split(" ");n.includes(i)||(s=!0,n.push(i),t.buttons=n.join(" "))}return t}),s||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,i){n.options.buttonTheme.map(function(i,s){if(e&&e.includes(i.class)||!e){var o=i.buttons.split(" ").filter(function(e){return e!==t});o.length?i.buttons=o.join(" "):(n.options.buttonTheme.splice(s,1),i=null)}return i})}),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"handleCaret",value:function(){this.options.debug&&console.log("Caret handling started"),document.addEventListener("keyup",this.caretEventHandler),document.addEventListener("mouseup",this.caretEventHandler),document.addEventListener("touchend",this.caretEventHandler)}},{key:"caretEventHandler",value:function(t){var e;t.target.tagName&&(e=t.target.tagName.toLowerCase()),"textarea"!==e&&"input"!==e||this.options.disableCaretPositioning||(this.caretPosition=t.target.selectionStart,this.options.debug&&console.log("Caret at: ",t.target.selectionStart,t.target.tagName.toLowerCase()))}},{key:"onInit",value:function(){this.options.debug&&console.log("Initialized"),this.handleCaret(),"function"===typeof this.options.onInit&&this.options.onInit()}},{key:"onRender",value:function(){"function"===typeof this.options.onRender&&this.options.onRender()}},{key:"onModulesLoaded",value:function(){"function"===typeof this.options.onModulesLoaded&&this.options.onModulesLoaded()}},{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 i="module-".concat(t.utilities.camelCase(n.constructor.name));t.keyboardPluginClasses=t.keyboardPluginClasses+" ".concat(i)}n.init(t)}),this.keyboardPluginClasses=this.keyboardPluginClasses+" modules-loaded",this.render(),this.onModulesLoaded())}},{key:"render",value:function(){var t=this;this.clear();var e=this.options.layout?"hg-layout-custom":"hg-layout-".concat(this.options.layoutName),n=this.options.layout||u.getDefaultLayout(),i={};Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.forEach(function(e){var n;e.buttons&&e.class?("string"===typeof e.buttons&&(n=e.buttons.split(" ")),n&&n.forEach(function(n){var s=i[n];s?t.utilities.countInArray(s.split(" "),e.class)||(i[n]="".concat(s," ").concat(e.class)):i[n]=e.class})):console.warn('buttonTheme row is missing the "buttons" or the "class". Please check the documentation.')}),this.keyboardDOM.className+=" ".concat(this.options.theme," ").concat(e," ").concat(this.keyboardPluginClasses),n[this.options.layoutName].forEach(function(e,n){var s=e.split(" "),o=document.createElement("div");o.className+="hg-row",s.forEach(function(e,s){var a=t.utilities.getButtonClass(e),u=i[e],r=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),h=document.createElement("div");h.className+="hg-button ".concat(a).concat(u?" "+u:""),h.onclick=function(){t.isMouseHold=!1,t.handleButtonClicked(e)},h.onmousedown=function(n){return t.handleButtonMouseDown(e,n)},h.setAttribute("data-skBtn",e);var d="".concat(t.options.layoutName,"-r").concat(n,"b").concat(s);h.setAttribute("data-skBtnUID",d),h.setAttribute("data-displayLabel",r);var l=document.createElement("span");l.innerHTML=r,h.appendChild(l),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(h),o.appendChild(h)}),t.keyboardDOM.appendChild(o)}),this.onRender(),document.onmouseup=function(){return t.handleButtonMouseUp()},this.initialized||(this.initialized=!0,this.onInit())}}]),t}();e.default=h}])}); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map index 8fb3fed1..9f1ce120 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///index.js","webpack:///webpack/bootstrap cd8116905394981a6a3a","webpack:///./src/lib/index.js","webpack:///./src/lib/components/Keyboard.js","webpack:///./src/lib/services/PhysicalKeyboard.js","webpack:///./src/lib/services/KeyboardLayout.js","webpack:///./src/lib/services/Utilities.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","value","__WEBPACK_IMPORTED_MODULE_0__components_Keyboard__","_classCallCheck","instance","Constructor","TypeError","__WEBPACK_IMPORTED_MODULE_0__Keyboard_css__","__WEBPACK_IMPORTED_MODULE_1__services_PhysicalKeyboard__","__WEBPACK_IMPORTED_MODULE_2__services_KeyboardLayout__","__WEBPACK_IMPORTED_MODULE_3__services_Utilities__","_typeof","Symbol","iterator","obj","constructor","_createClass","defineProperties","target","props","length","descriptor","writable","key","protoProps","staticProps","SimpleKeyboard","_this","setOptions","option","options","assign","render","registerModule","initCallback","getModuleProp","prop","getModulesList","keys","keyboardDOMQuery","arguments","undefined","utilities","keyboardDOM","document","querySelector","layoutName","theme","inputName","keyboardPluginClasses","handleButtonClicked","bind","syncInstanceInputs","clearInput","getInput","setInput","replaceInput","clear","dispatch","addButtonTheme","removeButtonTheme","getButtonElement","handleCaret","caretEventHandler","onInit","onRender","loadModules","handleButtonMouseUp","handleButtonMouseDown","handleButtonHold","onModulesLoaded","input","keyboardDOMClass","split","join","buttonElements","console","warn","Error","window","camelCase","physicalKeyboardInterface","button","debug","onKeyPress","updatedInput","getUpdatedInput","caretPosition","maxLength","handleMaxLength","log","onChange","e","_this2","isMouseHold","holdInteractionTimeout","clearTimeout","holdTimeout","setTimeout","includes","_this3","_this4","inputObj","innerHTML","className","callback","forEach","buttons","_this5","classNameItem","buttonTheme","classNameFound","map","class","buttonThemeArray","push","_this6","Array","isArray","index","filteredButtonArray","filter","item","splice","output","buttonArr","addEventListener","event","targetTagName","tagName","toLowerCase","disableCaretPositioning","selectionStart","_this7","Module","classStr","init","_this8","layoutClass","layout","getDefaultLayout","buttonThemesParsed","themeObj","themeButtons","themeButton","themeParsed","countInArray","row","rIndex","rowArray","rowDOM","createElement","bIndex","fctBtnClass","getButtonClass","buttonThemeClass","buttonDisplayName","getButtonDisplayName","display","mergeDisplay","buttonDOM","onclick","onmousedown","setAttribute","buttonUID","buttonSpanDOM","appendChild","onmouseup","initialized","PhysicalKeyboard","simpleKeyboardInstance","initKeyboardListener","getSimpleKeyboardLayoutKey","physicalKeyboardHighlight","buttonPressed","style","backgroundColor","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","removeAttribute","code","toUpperCase","Number","isInteger","KeyboardLayout","default","shift","Utilities","updateCaretPos","isMaxLengthReached","buttonTypeClass","buttonWithoutBraces","replace","buttonNormalized","{bksp}","{backspace}","{enter}","{shift}","{shiftleft}","{shiftright}","{alt}","{s}","{tab}","{lock}","{capslock}","{accept}","{space}","{//}","{esc}","{escape}","{f1}","{f2}","{f3}","{f4}","{f5}","{f6}","{f7}","{f8}","{f9}","{f10}","{f11}","{f12}","{numpaddivide}","{numlock}","{arrowup}","{arrowleft}","{arrowdown}","{arrowright}","{prtscr}","{scrolllock}","{pause}","{insert}","{home}","{pageup}","{delete}","{end}","{pagedown}","{numpadmultiply}","{numpadsubtract}","{numpadadd}","{numpadenter}","{period}","{numpaddecimal}","{numpad0}","{numpad1}","{numpad2}","{numpad3}","{numpad4}","{numpad5}","{numpad6}","{numpad7}","{numpad8}","{numpad9}","getDefaultDiplay","caretPos","moveCaret","removeAt","addStringAt","tabCharOnTab","newLineOnEnter","minus","source","string","position","slice","prevTwoChars","emojiMatched","emojiMatchedReg","substring","match","substr","currentInput","condition","maxLengthReached","Boolean","trim","reduce","word","array","x"],"mappings":";;;;;;;;;;;CAAA,SAAAA,EAAAC,GACA,iBAAAC,UAAA,iBAAAC,QACAA,OAAAD,QAAAD,IACA,mBAAAG,gBAAAC,IACAD,UAAAH,GACA,iBAAAC,SACAA,QAAA,eAAAD,IAEAD,EAAA,eAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAtB,GACA,GAAAe,GAAAf,KAAAuB,WACA,WAA2B,MAAAvB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAK,GAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAA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FhB3P,IAAI,YAAYtB,MAAM,SMvFlBsQ,GACR,MAAOA,GAAOrI,cAAckJ,OAAO3M,MAAM,aAAa4M,OAAO,SAACd,EAAQe,GAAT,MAAkBf,GAASe,EAAK,GAAGhG,cAAgBgG,EAAKb,MAAM,QNsFsElP,IAAI,eAKpMtB,MAAM,SMlFIsR,EAAOtR,GAClB,MAAOsR,GAAMF,OAAO,SAAC7R,EAAGgS,GAAJ,MAAUhS,IAAKgS,IAAMvR,IAAQ,ONiFiE2L,IM5EtH5L,GAAA","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SimpleKeyboard\"] = factory();\n\telse\n\t\troot[\"SimpleKeyboard\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SimpleKeyboard\"] = factory();\n\telse\n\t\troot[\"SimpleKeyboard\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(1);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_Keyboard__ = __webpack_require__(2);\n/* harmony default export */ __webpack_exports__[\"default\"] = (__WEBPACK_IMPORTED_MODULE_0__components_Keyboard__[\"a\" /* default */]);\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Keyboard_css__ = __webpack_require__(3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Keyboard_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__Keyboard_css__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_PhysicalKeyboard__ = __webpack_require__(4);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__services_KeyboardLayout__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__services_Utilities__ = __webpack_require__(6);\nvar _typeof=typeof Symbol===\"function\"&&typeof Symbol.iterator===\"symbol\"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol===\"function\"&&obj.constructor===Symbol&&obj!==Symbol.prototype?\"symbol\":typeof obj;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i1){output=buttonArr;}else{output=buttonArr[0];}}return output;}/**\r\n * Retrieves the current cursor position within a input or textarea (if any)\r\n */},{key:'handleCaret',value:function handleCaret(){if(this.options.debug){console.log(\"Caret handling started\");}document.addEventListener(\"keyup\",this.caretEventHandler);document.addEventListener(\"mouseup\",this.caretEventHandler);document.addEventListener(\"touchend\",this.caretEventHandler);}/**\r\n * Called by {@link handleCaret} when an event that warrants a cursor position update is triggered\r\n */},{key:'caretEventHandler',value:function caretEventHandler(event){var targetTagName=event.target.tagName.toLowerCase();if((targetTagName===\"textarea\"||targetTagName===\"input\")&&!this.options.disableCaretPositioning){/**\r\n * Tracks current cursor position\r\n * As keys are pressed, text will be added/removed at that position within the input.\r\n */this.caretPosition=event.target.selectionStart;if(this.options.debug){console.log('Caret at: ',event.target.selectionStart,event.target.tagName.toLowerCase());}}}/**\r\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\r\n */},{key:'onInit',value:function onInit(){if(this.options.debug){console.log(\"Initialized\");}/**\r\n * Caret handling\r\n */this.handleCaret();if(typeof this.options.onInit===\"function\")this.options.onInit();}/**\r\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\r\n */},{key:'onRender',value:function onRender(){if(typeof this.options.onRender===\"function\")this.options.onRender();}/**\r\n * Executes the callback function once all modules have been loaded\r\n */},{key:'onModulesLoaded',value:function onModulesLoaded(){if(typeof this.options.onModulesLoaded===\"function\")this.options.onModulesLoaded();}/**\r\n * Register module\r\n */},{key:'loadModules',/**\r\n * Load modules\r\n */value:function loadModules(){var _this7=this;if(Array.isArray(this.options.modules)){this.options.modules.forEach(function(Module){var module=new Module();/* istanbul ignore next */if(module.constructor.name&&module.constructor.name!==\"Function\"){var classStr='module-'+_this7.utilities.camelCase(module.constructor.name);_this7.keyboardPluginClasses=_this7.keyboardPluginClasses+(' '+classStr);}module.init(_this7);});this.keyboardPluginClasses=this.keyboardPluginClasses+' modules-loaded';this.render();this.onModulesLoaded();}}/**\r\n * Get module prop\r\n *//**\r\n * getModulesList\r\n */},{key:'render',/**\r\n * Renders rows and buttons as per options\r\n */value:function render(){var _this8=this;/**\r\n * Clear keyboard\r\n */this.clear();var layoutClass=this.options.layout?\"hg-layout-custom\":'hg-layout-'+this.options.layoutName;var layout=this.options.layout||__WEBPACK_IMPORTED_MODULE_2__services_KeyboardLayout__[\"a\" /* default */].getDefaultLayout();/**\r\n * Account for buttonTheme, if set\r\n */var buttonThemesParsed={};if(Array.isArray(this.options.buttonTheme)){this.options.buttonTheme.forEach(function(themeObj){if(themeObj.buttons&&themeObj.class){var themeButtons=void 0;if(typeof themeObj.buttons===\"string\"){themeButtons=themeObj.buttons.split(' ');}if(themeButtons){themeButtons.forEach(function(themeButton){var themeParsed=buttonThemesParsed[themeButton];// If the button has already been added\nif(themeParsed){// Making sure we don't add duplicate classes, even when buttonTheme has duplicates\nif(!_this8.utilities.countInArray(themeParsed.split(\" \"),themeObj.class)){buttonThemesParsed[themeButton]=themeParsed+' '+themeObj.class;}}else{buttonThemesParsed[themeButton]=themeObj.class;}});}}else{console.warn('buttonTheme row is missing the \"buttons\" or the \"class\". Please check the documentation.');}});}/**\r\n * Adding themeClass, layoutClass to keyboardDOM\r\n */this.keyboardDOM.className+=' '+this.options.theme+' '+layoutClass+' '+this.keyboardPluginClasses;/**\r\n * Iterating through each row\r\n */layout[this.options.layoutName].forEach(function(row,rIndex){var rowArray=row.split(' ');/**\r\n * Creating empty row\r\n */var rowDOM=document.createElement('div');rowDOM.className+=\"hg-row\";/**\r\n * Iterating through each button in row\r\n */rowArray.forEach(function(button,bIndex){var fctBtnClass=_this8.utilities.getButtonClass(button);var buttonThemeClass=buttonThemesParsed[button];var buttonDisplayName=_this8.utilities.getButtonDisplayName(button,_this8.options.display,_this8.options.mergeDisplay);/**\r\n * Creating button\r\n */var buttonDOM=document.createElement('div');buttonDOM.className+='hg-button '+fctBtnClass+(buttonThemeClass?\" \"+buttonThemeClass:\"\");buttonDOM.onclick=function(){_this8.isMouseHold=false;_this8.handleButtonClicked(button);};buttonDOM.onmousedown=function(e){return _this8.handleButtonMouseDown(button,e);};/**\r\n * Adding identifier\r\n */buttonDOM.setAttribute(\"data-skBtn\",button);/**\r\n * Adding unique id\r\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\r\n */var buttonUID=_this8.options.layoutName+'-r'+rIndex+'b'+bIndex;buttonDOM.setAttribute(\"data-skBtnUID\",buttonUID);/**\r\n * Adding display label\r\n */buttonDOM.setAttribute(\"data-displayLabel\",buttonDisplayName);/**\r\n * Adding button label to button\r\n */var buttonSpanDOM=document.createElement('span');buttonSpanDOM.innerHTML=buttonDisplayName;buttonDOM.appendChild(buttonSpanDOM);/**\r\n * Adding to buttonElements\r\n */if(!_this8.buttonElements[button])_this8.buttonElements[button]=[];_this8.buttonElements[button].push(buttonDOM);/**\r\n * Appending button to row\r\n */rowDOM.appendChild(buttonDOM);});/**\r\n * Appending row to keyboard\r\n */_this8.keyboardDOM.appendChild(rowDOM);});/**\r\n * Calling onRender\r\n */this.onRender();/**\r\n * Handling mouseup\r\n */document.onmouseup=function(){return _this8.handleButtonMouseUp();};if(!this.initialized){/**\r\n * Ensures that onInit is only called once per instantiation\r\n */this.initialized=true;/**\r\n * Calling onInit\r\n */this.onInit();}}}]);return SimpleKeyboard;}();/* harmony default export */ __webpack_exports__[\"a\"] = (SimpleKeyboard);\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass=function(){function defineProperties(target,props){for(var i=0;i ? {shift}','.com @ {space}']};}}]);return KeyboardLayout;}();/* harmony default export */ __webpack_exports__[\"a\"] = (KeyboardLayout);\n\n/***/ }),\n/* 6 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _typeof=typeof Symbol===\"function\"&&typeof Symbol.iterator===\"symbol\"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol===\"function\"&&obj.constructor===Symbol&&obj!==Symbol.prototype?\"symbol\":typeof obj;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){output=this.removeAt(output,caretPos,moveCaret);}else if(button===\"{space}\")output=this.addStringAt(output,\" \",caretPos,moveCaret);else if(button===\"{tab}\"&&!(typeof options.tabCharOnTab===\"boolean\"&&options.tabCharOnTab===false)){output=this.addStringAt(output,\"\\t\",caretPos,moveCaret);}else if((button===\"{enter}\"||button===\"{numpadenter}\")&&options.newLineOnEnter)output=this.addStringAt(output,\"\\n\",caretPos,moveCaret);else if(button.includes(\"numpad\")&&Number.isInteger(Number(button[button.length-2]))){output=this.addStringAt(output,button[button.length-2],caretPos);}else if(button===\"{numpaddivide}\")output=this.addStringAt(output,'/',caretPos,moveCaret);else if(button===\"{numpadmultiply}\")output=this.addStringAt(output,'*',caretPos,moveCaret);else if(button===\"{numpadsubtract}\")output=this.addStringAt(output,'-',caretPos,moveCaret);else if(button===\"{numpadadd}\")output=this.addStringAt(output,'+',caretPos,moveCaret);else if(button===\"{numpaddecimal}\")output=this.addStringAt(output,'.',caretPos,moveCaret);else if(button===\"{\"||button===\"}\")output=this.addStringAt(output,button,caretPos,moveCaret);else if(!button.includes(\"{\")&&!button.includes(\"}\"))output=this.addStringAt(output,button,caretPos,moveCaret);return output;}/**\r\n * Moves the cursor position by a given amount\r\n * \r\n * @param {number} length Represents by how many characters the input should be moved\r\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\r\n */},{key:\"updateCaretPos\",value:function updateCaretPos(length,minus){if(minus){if(this.simpleKeyboardInstance.caretPosition>0)this.simpleKeyboardInstance.caretPosition=this.simpleKeyboardInstance.caretPosition-length;}else{this.simpleKeyboardInstance.caretPosition=this.simpleKeyboardInstance.caretPosition+length;}}/**\r\n * Adds a string to the input at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {string} string The string to add\r\n * @param {number} position The (cursor) position where the string should be added\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */},{key:\"addStringAt\",value:function addStringAt(source,string,position,moveCaret){var output=void 0;if(!position&&position!==0){output=source+string;}else{output=[source.slice(0,position),string,source.slice(position)].join('');/**\r\n * Avoid caret position change when maxLength is set\r\n */if(!this.isMaxLengthReached()){if(moveCaret)this.updateCaretPos(string.length);}}if(this.simpleKeyboardInstance.options.debug&&moveCaret){console.log(\"Caret at:\",position);}return output;}/**\r\n * Removes an amount of characters at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {number} position The (cursor) position from where the characters should be removed\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */},{key:\"removeAt\",value:function removeAt(source,position,moveCaret){if(this.simpleKeyboardInstance.caretPosition===0){return source;}var output=void 0;var prevTwoChars=void 0;var emojiMatched=void 0;var emojiMatchedReg=/([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;/**\r\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\r\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\r\n */if(position&&position>=0){prevTwoChars=source.substring(position-2,position);emojiMatched=prevTwoChars.match(emojiMatchedReg);if(emojiMatched){output=source.substr(0,position-2)+source.substr(position);if(moveCaret)this.updateCaretPos(2,true);}else{output=source.substr(0,position-1)+source.substr(position);if(moveCaret)this.updateCaretPos(1,true);}}else{prevTwoChars=source.slice(-2);emojiMatched=prevTwoChars.match(emojiMatchedReg);if(emojiMatched){output=source.slice(0,-2);if(moveCaret)this.updateCaretPos(2,true);}else{output=source.slice(0,-1);if(moveCaret)this.updateCaretPos(1,true);}}if(this.simpleKeyboardInstance.options.debug&&moveCaret){console.log(\"Caret at:\",this.simpleKeyboardInstance.caretPosition);}return output;}/**\r\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\r\n * \r\n * @param {object} inputObj\r\n * @param {object} options\r\n * @param {string} updatedInput\r\n */},{key:\"handleMaxLength\",value:function handleMaxLength(inputObj,options,updatedInput){var maxLength=options.maxLength;var currentInput=inputObj[options.inputName];var condition=currentInput.length===maxLength;if(/**\r\n * If pressing this button won't add more characters\r\n * We exit out of this limiter function\r\n */updatedInput.length<=currentInput.length){return false;}if(Number.isInteger(maxLength)){if(options.debug){console.log(\"maxLength (num) reached:\",condition);}if(condition){/**\r\n * @type {boolean} Boolean value that shows whether maxLength has been reached\r\n */this.maxLengthReached=true;return true;}else{this.maxLengthReached=false;return false;}}if((typeof maxLength===\"undefined\"?\"undefined\":_typeof(maxLength))===\"object\"){var _condition=currentInput.length===maxLength[options.inputName];if(options.debug){console.log(\"maxLength (obj) reached:\",_condition);}if(_condition){this.maxLengthReached=true;return true;}else{this.maxLengthReached=false;return false;}}}/**\r\n * Gets the current value of maxLengthReached\r\n */},{key:\"isMaxLengthReached\",value:function isMaxLengthReached(){return Boolean(this.maxLengthReached);}/**\r\n * Transforms an arbitrary string to camelCase\r\n * \r\n * @param {string} string The string to transform.\r\n */},{key:\"camelCase\",value:function camelCase(string){return string.toLowerCase().trim().split(/[.\\-_\\s]/g).reduce(function(string,word){return string+word[0].toUpperCase()+word.slice(1);});}},{key:\"countInArray\",/**\r\n * Counts the number of duplicates in a given array\r\n * \r\n * @param {Array} array The haystack to search in\r\n * @param {string} value The needle to search for\r\n */value:function countInArray(array,value){return array.reduce(function(n,x){return n+(x===value);},0);}}]);return Utilities;}();/* harmony default export */ __webpack_exports__[\"a\"] = (Utilities);\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// index.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap cd8116905394981a6a3a","import SimpleKeyboard from './components/Keyboard';\r\nexport default SimpleKeyboard;\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/index.js","import './Keyboard.css';\r\n\r\n// Services\r\nimport PhysicalKeyboard from '../services/PhysicalKeyboard';\r\nimport KeyboardLayout from '../services/KeyboardLayout';\r\nimport Utilities from '../services/Utilities';\r\n\r\n/**\r\n * Root class for simple-keyboard\r\n * This class:\r\n * - Parses the options\r\n * - Renders the rows and buttons\r\n * - Handles button functionality\r\n */\r\nclass SimpleKeyboard {\r\n /**\r\n * Creates an instance of SimpleKeyboard\r\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.\r\n */\r\n constructor(...params){\r\n let keyboardDOMQuery = typeof params[0] === \"string\" ? params[0] : '.simple-keyboard';\r\n let options = typeof params[0] === \"object\" ? params[0] : params[1];\r\n\r\n if(!options)\r\n options = {};\r\n\r\n /**\r\n * Initializing Utilities\r\n */\r\n this.utilities = new Utilities(this);\r\n\r\n /**\r\n * Processing options\r\n */\r\n this.keyboardDOM = document.querySelector(keyboardDOMQuery);\r\n\r\n /**\r\n * @type {object}\r\n * @property {object} layout Modify the keyboard layout.\r\n * @property {string} layoutName Specifies which layout should be used.\r\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\r\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\r\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.\r\n * @property {Array} buttonTheme A prop to add your own css classes to one or several buttons.\r\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\r\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\r\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\r\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\r\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.\r\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.\r\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\r\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\r\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\r\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have. \r\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\r\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\r\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\r\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\r\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\r\n */\r\n this.options = options;\r\n this.options.layoutName = this.options.layoutName || \"default\";\r\n this.options.theme = this.options.theme || \"hg-theme-default\";\r\n this.options.inputName = this.options.inputName || \"default\";\r\n\r\n /**\r\n * @type {object} Classes identifying loaded plugins\r\n */\r\n this.keyboardPluginClasses = '';\r\n\r\n /**\r\n * Bindings\r\n */\r\n this.handleButtonClicked = this.handleButtonClicked.bind(this);\r\n this.syncInstanceInputs = this.syncInstanceInputs.bind(this);\r\n this.clearInput = this.clearInput.bind(this);\r\n this.getInput = this.getInput.bind(this);\r\n this.setInput = this.setInput.bind(this);\r\n this.replaceInput = this.replaceInput.bind(this);\r\n this.clear = this.clear.bind(this);\r\n this.dispatch = this.dispatch.bind(this);\r\n this.addButtonTheme = this.addButtonTheme.bind(this);\r\n this.removeButtonTheme = this.removeButtonTheme.bind(this);\r\n this.getButtonElement = this.getButtonElement.bind(this);\r\n this.handleCaret = this.handleCaret.bind(this);\r\n this.caretEventHandler = this.caretEventHandler.bind(this);\r\n this.onInit = this.onInit.bind(this);\r\n this.onRender = this.onRender.bind(this);\r\n this.render = this.render.bind(this);\r\n this.loadModules = this.loadModules.bind(this);\r\n this.handleButtonMouseUp = this.handleButtonMouseUp.bind(this);\r\n this.handleButtonMouseDown = this.handleButtonMouseDown.bind(this);\r\n this.handleButtonHold = this.handleButtonHold.bind(this);\r\n this.onModulesLoaded = this.onModulesLoaded.bind(this);\r\n\r\n /**\r\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\r\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\r\n * @example\r\n * // To get entered input\r\n * let input = keyboard.getInput();\r\n * \r\n * // To clear entered input.\r\n * keyboard.clearInput();\r\n * \r\n * @type {object}\r\n * @property {object} default Default SimpleKeyboard internal input.\r\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\r\n */\r\n this.input = {};\r\n this.input[this.options.inputName] = '';\r\n\r\n /**\r\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\r\n */\r\n this.keyboardDOMClass = keyboardDOMQuery.split('.').join(\"\");\r\n\r\n /**\r\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\r\n */\r\n this.buttonElements = {};\r\n\r\n /**\r\n * Rendering keyboard\r\n */\r\n if(this.keyboardDOM)\r\n this.render();\r\n else {\r\n console.warn(`\"${keyboardDOMQuery}\" was not found in the DOM.`);\r\n throw new Error(\"KEYBOARD_DOM_ERROR\");\r\n }\r\n\r\n /**\r\n * Saving instance\r\n * This enables multiple simple-keyboard support with easier management\r\n */\r\n if(!window['SimpleKeyboardInstances'])\r\n window['SimpleKeyboardInstances'] = {};\r\n \r\n window['SimpleKeyboardInstances'][this.utilities.camelCase(this.keyboardDOMClass)] = this;\r\n\r\n /**\r\n * Physical Keyboard support\r\n */\r\n this.physicalKeyboardInterface = new PhysicalKeyboard(this);\r\n\r\n /**\r\n * Modules\r\n */\r\n this.modules = {};\r\n this.loadModules();\r\n }\r\n\r\n /**\r\n * Handles clicks made to keyboard buttons\r\n * @param {string} button The button's layout name.\r\n */\r\n handleButtonClicked(button){\r\n let debug = this.options.debug;\r\n\r\n /**\r\n * Ignoring placeholder buttons\r\n */\r\n if(button === '{//}')\r\n return false;\r\n\r\n /**\r\n * Calling onKeyPress\r\n */\r\n if(typeof this.options.onKeyPress === \"function\")\r\n this.options.onKeyPress(button);\r\n \r\n if(!this.input[this.options.inputName])\r\n this.input[this.options.inputName] = '';\r\n\r\n let updatedInput = this.utilities.getUpdatedInput(\r\n button, this.input[this.options.inputName], this.options, this.caretPosition\r\n );\r\n\r\n if(this.input[this.options.inputName] !== updatedInput){\r\n\r\n /**\r\n * If maxLength and handleMaxLength yield true, halting\r\n */\r\n if(this.options.maxLength && this.utilities.handleMaxLength(this.input, this.options, updatedInput)){\r\n return false;\r\n }\r\n\r\n this.input[this.options.inputName] = this.utilities.getUpdatedInput(\r\n button, this.input[this.options.inputName], this.options, this.caretPosition, true\r\n );\r\n\r\n if(debug)\r\n console.log('Input changed:', this.input);\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n\r\n /**\r\n * Calling onChange\r\n */\r\n if(typeof this.options.onChange === \"function\")\r\n this.options.onChange(this.input[this.options.inputName]);\r\n }\r\n \r\n if(debug){\r\n console.log(\"Key pressed:\", button);\r\n }\r\n }\r\n\r\n /**\r\n * Handles button mousedown\r\n */\r\n /* istanbul ignore next */\r\n handleButtonMouseDown(button, e){\r\n /**\r\n * @type {boolean} Whether the mouse is being held onKeyPress\r\n */\r\n this.isMouseHold = true;\r\n\r\n if(this.holdInteractionTimeout)\r\n clearTimeout(this.holdInteractionTimeout);\r\n\r\n if(this.holdTimeout)\r\n clearTimeout(this.holdTimeout);\r\n\r\n /**\r\n * @type {object} Time to wait until a key hold is detected\r\n */\r\n this.holdTimeout = setTimeout(() => {\r\n if(\r\n this.isMouseHold &&\r\n (\r\n (!button.includes(\"{\") && !button.includes(\"}\")) ||\r\n button === \"{bksp}\" ||\r\n button === \"{space}\" ||\r\n button === \"{tab}\"\r\n )\r\n ){\r\n if(this.options.debug)\r\n console.log(\"Button held:\", button);\r\n\r\n this.handleButtonHold(button, e);\r\n }\r\n clearTimeout(this.holdTimeout);\r\n }, 500);\r\n }\r\n\r\n /**\r\n * Handles button mouseup\r\n */\r\n handleButtonMouseUp(){\r\n this.isMouseHold = false;\r\n if(this.holdInteractionTimeout)\r\n clearTimeout(this.holdInteractionTimeout);\r\n }\r\n\r\n /**\r\n * Handles button hold\r\n */\r\n /* istanbul ignore next */\r\n handleButtonHold(button){\r\n if(this.holdInteractionTimeout)\r\n clearTimeout(this.holdInteractionTimeout);\r\n\r\n /**\r\n * @type {object} Timeout dictating the speed of key hold iterations\r\n */\r\n this.holdInteractionTimeout = setTimeout(() => {\r\n if(this.isMouseHold){\r\n this.handleButtonClicked(button);\r\n this.handleButtonHold(button);\r\n } else {\r\n clearTimeout(this.holdInteractionTimeout);\r\n }\r\n }, 100);\r\n }\r\n\r\n /**\r\n * Send a command to all simple-keyboard instances (if you have several instances).\r\n */\r\n syncInstanceInputs(){\r\n this.dispatch((instance) => {\r\n instance.replaceInput(this.input);\r\n });\r\n }\r\n \r\n /**\r\n * Clear the keyboard’s input.\r\n * @param {string} [inputName] optional - the internal input to select\r\n */\r\n clearInput(inputName){\r\n inputName = inputName || this.options.inputName;\r\n this.input[this.options.inputName] = '';\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n }\r\n\r\n /**\r\n * Get the keyboard’s input (You can also get it from the onChange prop).\r\n * @param {string} [inputName] optional - the internal input to select\r\n */\r\n getInput(inputName){\r\n inputName = inputName || this.options.inputName;\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n\r\n return this.input[this.options.inputName];\r\n }\r\n\r\n /**\r\n * Set the keyboard’s input.\r\n * @param {string} input the input value\r\n * @param {string} inputName optional - the internal input to select\r\n */\r\n setInput(input, inputName){\r\n inputName = inputName || this.options.inputName;\r\n this.input[inputName] = input;\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n }\r\n \r\n /**\r\n * Replace the input object (`keyboard.input`)\r\n * @param {object} inputObj The input object\r\n */\r\n replaceInput(inputObj){\r\n this.input = inputObj;\r\n }\r\n\r\n /**\r\n * Set new option or modify existing ones after initialization. \r\n * @param {object} option The option to set\r\n */\r\n setOptions = option => {\r\n option = option || {};\r\n this.options = Object.assign(this.options, option);\r\n this.render();\r\n }\r\n\r\n /**\r\n * Remove all keyboard rows and reset keyboard values.\r\n * Used interally between re-renders.\r\n */\r\n clear(){\r\n this.keyboardDOM.innerHTML = '';\r\n this.keyboardDOM.className = this.keyboardDOMClass;\r\n this.buttonElements = {};\r\n }\r\n\r\n /**\r\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\r\n * @param {function(instance: object, key: string)} callback Function to run on every instance\r\n */\r\n dispatch(callback){\r\n if(!window['SimpleKeyboardInstances']){\r\n console.warn(`SimpleKeyboardInstances is not defined. Dispatch cannot be called.`);\r\n throw new Error(\"INSTANCES_VAR_ERROR\");\r\n }\r\n \r\n return Object.keys(window['SimpleKeyboardInstances']).forEach((key) => {\r\n callback(window['SimpleKeyboardInstances'][key], key);\r\n })\r\n }\r\n\r\n /**\r\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\r\n * @param {string} buttons List of buttons to select (separated by a space).\r\n * @param {string} className Classes to give to the selected buttons (separated by space).\r\n */\r\n addButtonTheme(buttons, className){\r\n if(!className || !buttons)\r\n return false;\r\n\r\n buttons.split(\" \").forEach(button => {\r\n className.split(\" \").forEach(classNameItem => {\r\n if(!this.options.buttonTheme)\r\n this.options.buttonTheme = [];\r\n\r\n let classNameFound = false;\r\n \r\n /**\r\n * If class is already defined, we add button to class definition\r\n */\r\n this.options.buttonTheme.map(buttonTheme => {\r\n\r\n if(buttonTheme.class.split(\" \").includes(classNameItem)){\r\n classNameFound = true;\r\n \r\n let buttonThemeArray = buttonTheme.buttons.split(\" \");\r\n if(!buttonThemeArray.includes(button)){\r\n classNameFound = true;\r\n buttonThemeArray.push(button);\r\n buttonTheme.buttons = buttonThemeArray.join(\" \");\r\n }\r\n }\r\n return buttonTheme;\r\n });\r\n\r\n /**\r\n * If class is not defined, we create a new entry\r\n */\r\n if(!classNameFound){\r\n this.options.buttonTheme.push({\r\n class: classNameItem,\r\n buttons: buttons\r\n });\r\n }\r\n\r\n });\r\n });\r\n\r\n this.render();\r\n }\r\n\r\n /**\r\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\r\n * @param {string} buttons List of buttons to select (separated by a space).\r\n * @param {string} className Classes to give to the selected buttons (separated by space).\r\n */\r\n removeButtonTheme(buttons, className){\r\n /**\r\n * When called with empty parameters, remove all button themes\r\n */\r\n if(!buttons && !className){\r\n this.options.buttonTheme = [];\r\n this.render();\r\n return false;\r\n }\r\n\r\n /**\r\n * If buttons are passed and buttonTheme has items\r\n */\r\n if(buttons && Array.isArray(this.options.buttonTheme) && this.options.buttonTheme.length){\r\n let buttonArray = buttons.split(\" \");\r\n buttonArray.forEach((button, key) => {\r\n this.options.buttonTheme.map((buttonTheme, index) => {\r\n\r\n /**\r\n * If className is set, we affect the buttons only for that class\r\n * Otherwise, we afect all classes\r\n */\r\n if(\r\n (className && className.includes(buttonTheme.class)) ||\r\n !className\r\n ){\r\n let filteredButtonArray = buttonTheme.buttons.split(\" \").filter(item => item !== button);\r\n\r\n /**\r\n * If buttons left, return them, otherwise, remove button Theme\r\n */\r\n if(filteredButtonArray.length){\r\n buttonTheme.buttons = filteredButtonArray.join(\" \");\r\n } else {\r\n this.options.buttonTheme.splice(index, 1);\r\n buttonTheme = null;\r\n }\r\n \r\n }\r\n\r\n return buttonTheme;\r\n });\r\n });\r\n\r\n this.render();\r\n }\r\n }\r\n\r\n /**\r\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.\r\n * @param {string} button The button layout name to select\r\n */\r\n getButtonElement(button){\r\n let output;\r\n\r\n let buttonArr = this.buttonElements[button];\r\n if(buttonArr){\r\n if(buttonArr.length > 1){\r\n output = buttonArr;\r\n } else {\r\n output = buttonArr[0];\r\n }\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Retrieves the current cursor position within a input or textarea (if any)\r\n */\r\n handleCaret(){\r\n if(this.options.debug){\r\n console.log(\"Caret handling started\");\r\n }\r\n\r\n document.addEventListener(\"keyup\", this.caretEventHandler);\r\n document.addEventListener(\"mouseup\", this.caretEventHandler);\r\n document.addEventListener(\"touchend\", this.caretEventHandler);\r\n }\r\n\r\n /**\r\n * Called by {@link handleCaret} when an event that warrants a cursor position update is triggered\r\n */\r\n caretEventHandler(event){\r\n let targetTagName = event.target.tagName.toLowerCase();\r\n\r\n if(\r\n (targetTagName === \"textarea\" ||\r\n targetTagName === \"input\") &&\r\n !this.options.disableCaretPositioning\r\n ){\r\n /**\r\n * Tracks current cursor position\r\n * As keys are pressed, text will be added/removed at that position within the input.\r\n */\r\n this.caretPosition = event.target.selectionStart;\r\n\r\n if(this.options.debug){\r\n console.log('Caret at: ', event.target.selectionStart, event.target.tagName.toLowerCase());\r\n } \r\n }\r\n }\r\n\r\n /**\r\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\r\n */\r\n onInit(){\r\n if(this.options.debug){\r\n console.log(\"Initialized\");\r\n }\r\n\r\n /**\r\n * Caret handling\r\n */\r\n this.handleCaret();\r\n\r\n if(typeof this.options.onInit === \"function\")\r\n this.options.onInit();\r\n }\r\n\r\n /**\r\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\r\n */\r\n onRender(){\r\n if(typeof this.options.onRender === \"function\")\r\n this.options.onRender();\r\n }\r\n\r\n /**\r\n * Executes the callback function once all modules have been loaded\r\n */\r\n onModulesLoaded(){\r\n if(typeof this.options.onModulesLoaded === \"function\")\r\n this.options.onModulesLoaded();\r\n }\r\n\r\n /**\r\n * Register module\r\n */\r\n registerModule = (name, initCallback) => {\r\n if(!this.modules[name])\r\n this.modules[name] = {};\r\n\r\n initCallback(this.modules[name]);\r\n }\r\n\r\n /**\r\n * Load modules\r\n */\r\n loadModules(){\r\n if(Array.isArray(this.options.modules)){\r\n this.options.modules.forEach(Module => {\r\n let module = new Module();\r\n\r\n /* istanbul ignore next */\r\n if(module.constructor.name && module.constructor.name !== \"Function\"){\r\n let classStr = `module-${this.utilities.camelCase(module.constructor.name)}`;\r\n this.keyboardPluginClasses = this.keyboardPluginClasses + ` ${classStr}`;\r\n }\r\n\r\n module.init(this);\r\n });\r\n\r\n this.keyboardPluginClasses = this.keyboardPluginClasses + ' modules-loaded';\r\n\r\n this.render();\r\n this.onModulesLoaded();\r\n }\r\n }\r\n\r\n /**\r\n * Get module prop\r\n */\r\n getModuleProp = (name, prop) => {\r\n if(!this.modules[name])\r\n return false;\r\n \r\n return this.modules[name][prop];\r\n }\r\n\r\n /**\r\n * getModulesList\r\n */\r\n getModulesList = () => {\r\n return Object.keys(this.modules);\r\n }\r\n\r\n /**\r\n * Renders rows and buttons as per options\r\n */\r\n render(){\r\n /**\r\n * Clear keyboard\r\n */\r\n this.clear();\r\n\r\n let layoutClass = this.options.layout ? \"hg-layout-custom\" : `hg-layout-${this.options.layoutName}`;\r\n let layout = this.options.layout || KeyboardLayout.getDefaultLayout();\r\n\r\n /**\r\n * Account for buttonTheme, if set\r\n */\r\n let buttonThemesParsed = {};\r\n if(Array.isArray(this.options.buttonTheme)){\r\n this.options.buttonTheme.forEach(themeObj => {\r\n if(themeObj.buttons && themeObj.class){\r\n let themeButtons;\r\n\r\n if(typeof themeObj.buttons === \"string\"){\r\n themeButtons = themeObj.buttons.split(' ');\r\n }\r\n\r\n if(themeButtons){\r\n themeButtons.forEach(themeButton => {\r\n let themeParsed = buttonThemesParsed[themeButton];\r\n\r\n // If the button has already been added\r\n if(themeParsed){\r\n // Making sure we don't add duplicate classes, even when buttonTheme has duplicates\r\n if(!this.utilities.countInArray(themeParsed.split(\" \"), themeObj.class)){\r\n buttonThemesParsed[themeButton] = `${themeParsed} ${themeObj.class}`;\r\n }\r\n } else {\r\n buttonThemesParsed[themeButton] = themeObj.class;\r\n }\r\n });\r\n }\r\n } else {\r\n console.warn(`buttonTheme row is missing the \"buttons\" or the \"class\". Please check the documentation.`)\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Adding themeClass, layoutClass to keyboardDOM\r\n */\r\n this.keyboardDOM.className += ` ${this.options.theme} ${layoutClass} ${this.keyboardPluginClasses}`;\r\n\r\n /**\r\n * Iterating through each row\r\n */\r\n layout[this.options.layoutName].forEach((row, rIndex) => {\r\n let rowArray = row.split(' ');\r\n\r\n /**\r\n * Creating empty row\r\n */\r\n var rowDOM = document.createElement('div');\r\n rowDOM.className += \"hg-row\";\r\n\r\n /**\r\n * Iterating through each button in row\r\n */\r\n rowArray.forEach((button, bIndex) => {\r\n let fctBtnClass = this.utilities.getButtonClass(button);\r\n let buttonThemeClass = buttonThemesParsed[button];\r\n let buttonDisplayName = this.utilities.getButtonDisplayName(button, this.options.display, this.options.mergeDisplay);\r\n\r\n /**\r\n * Creating button\r\n */\r\n var buttonDOM = document.createElement('div');\r\n buttonDOM.className += `hg-button ${fctBtnClass}${buttonThemeClass ? \" \"+buttonThemeClass : \"\"}`;\r\n buttonDOM.onclick = () => {\r\n this.isMouseHold = false;\r\n this.handleButtonClicked(button);\r\n }\r\n buttonDOM.onmousedown = (e) => this.handleButtonMouseDown(button, e);\r\n\r\n /**\r\n * Adding identifier\r\n */\r\n buttonDOM.setAttribute(\"data-skBtn\", button);\r\n\r\n /**\r\n * Adding unique id\r\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\r\n */\r\n let buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\r\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\r\n\r\n /**\r\n * Adding display label\r\n */\r\n buttonDOM.setAttribute(\"data-displayLabel\", buttonDisplayName);\r\n\r\n /**\r\n * Adding button label to button\r\n */\r\n var buttonSpanDOM = document.createElement('span');\r\n buttonSpanDOM.innerHTML = buttonDisplayName;\r\n buttonDOM.appendChild(buttonSpanDOM);\r\n\r\n /**\r\n * Adding to buttonElements\r\n */\r\n if(!this.buttonElements[button])\r\n this.buttonElements[button] = [];\r\n\r\n this.buttonElements[button].push(buttonDOM);\r\n\r\n /**\r\n * Appending button to row\r\n */\r\n rowDOM.appendChild(buttonDOM);\r\n\r\n });\r\n\r\n /**\r\n * Appending row to keyboard\r\n */\r\n this.keyboardDOM.appendChild(rowDOM);\r\n });\r\n\r\n /**\r\n * Calling onRender\r\n */\r\n this.onRender();\r\n\r\n /**\r\n * Handling mouseup\r\n */\r\n document.onmouseup = () => this.handleButtonMouseUp();\r\n\r\n if(!this.initialized){\r\n /**\r\n * Ensures that onInit is only called once per instantiation\r\n */\r\n this.initialized = true;\r\n\r\n /**\r\n * Calling onInit\r\n */\r\n this.onInit();\r\n }\r\n }\r\n}\r\n\r\nexport default SimpleKeyboard;\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/components/Keyboard.js","/**\r\n * Physical Keyboard Service\r\n */\r\nclass PhysicalKeyboard {\r\n /**\r\n * Creates an instance of the PhysicalKeyboard service\r\n */\r\n constructor(simpleKeyboardInstance){\r\n /**\r\n * @type {object} A simple-keyboard instance\r\n */\r\n this.simpleKeyboardInstance = simpleKeyboardInstance;\r\n\r\n /**\r\n * Bindings\r\n */\r\n this.initKeyboardListener = this.initKeyboardListener.bind(this);\r\n this.getSimpleKeyboardLayoutKey = this.getSimpleKeyboardLayoutKey.bind(this);\r\n\r\n /**\r\n * Initialize key listeners\r\n */\r\n this.initKeyboardListener();\r\n }\r\n\r\n /**\r\n * Initializes key event listeners\r\n */\r\n initKeyboardListener(){\r\n // Adding button style on keydown\r\n document.addEventListener(\"keydown\", (event) => {\r\n if(this.simpleKeyboardInstance.options.physicalKeyboardHighlight){\r\n let buttonPressed = this.getSimpleKeyboardLayoutKey(event);\r\n\r\n this.simpleKeyboardInstance.dispatch(instance => {\r\n let buttonDOM = instance.getButtonElement(buttonPressed) || instance.getButtonElement(`{${buttonPressed}}`);\r\n\r\n if(buttonDOM){\r\n buttonDOM.style.backgroundColor = this.simpleKeyboardInstance.options.physicalKeyboardHighlightBgColor || \"#9ab4d0\";\r\n buttonDOM.style.color = this.simpleKeyboardInstance.options.physicalKeyboardHighlightTextColor || \"white\";\r\n }\r\n });\r\n }\r\n });\r\n\r\n // Removing button style on keyup\r\n document.addEventListener(\"keyup\", (event) => {\r\n if(this.simpleKeyboardInstance.options.physicalKeyboardHighlight){\r\n let buttonPressed = this.getSimpleKeyboardLayoutKey(event);\r\n\r\n this.simpleKeyboardInstance.dispatch(instance => {\r\n let buttonDOM = instance.getButtonElement(buttonPressed) || instance.getButtonElement(`{${buttonPressed}}`);\r\n\r\n if(buttonDOM){\r\n buttonDOM.removeAttribute(\"style\");\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\r\n * @param {object} event The KeyboardEvent\r\n */\r\n getSimpleKeyboardLayoutKey(event){\r\n let output;\r\n\r\n if(\r\n event.code.includes(\"Numpad\") ||\r\n event.code.includes(\"Shift\") ||\r\n event.code.includes(\"Space\") ||\r\n event.code.includes(\"Backspace\") ||\r\n event.code.includes(\"Control\") ||\r\n event.code.includes(\"Alt\") ||\r\n event.code.includes(\"Meta\")\r\n ){\r\n output = event.code;\r\n } else {\r\n output = event.key;\r\n }\r\n\r\n /**\r\n * If button is not uppercase, casting to lowercase\r\n */\r\n if (\r\n output !== output.toUpperCase() ||\r\n (event.code[0] === \"F\" && Number.isInteger(Number(event.code[1])) && event.code.length <= 3)\r\n ) {\r\n output = output.toLowerCase();\r\n }\r\n\r\n return output;\r\n }\r\n}\r\n\r\nexport default PhysicalKeyboard;\n\n\n// WEBPACK FOOTER //\n// ./src/lib/services/PhysicalKeyboard.js","/**\r\n * Keyboard Layout Service\r\n */\r\nclass KeyboardLayout {\r\n /**\r\n * Get default simple-keyboard layout\r\n * @return {object} The default layout (US-QWERTY)\r\n */\r\n static getDefaultLayout(){\r\n return {\r\n 'default': [\r\n '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',\r\n '{tab} q w e r t y u i o p [ ] \\\\',\r\n '{lock} a s d f g h j k l ; \\' {enter}',\r\n '{shift} z x c v b n m , . / {shift}',\r\n '.com @ {space}'\r\n ],\r\n 'shift': [\r\n '~ ! @ # $ % ^ & * ( ) _ + {bksp}',\r\n '{tab} Q W E R T Y U I O P { } |',\r\n '{lock} A S D F G H J K L : \" {enter}',\r\n '{shift} Z X C V B N M < > ? {shift}',\r\n '.com @ {space}'\r\n ]\r\n } \r\n }\r\n}\r\n\r\nexport default KeyboardLayout;\n\n\n// WEBPACK FOOTER //\n// ./src/lib/services/KeyboardLayout.js","/**\r\n * Utility Service\r\n */\r\nclass Utilities {\r\n /**\r\n * Creates an instance of the Utility service\r\n */\r\n constructor(simpleKeyboardInstance){\r\n /**\r\n * @type {object} A simple-keyboard instance\r\n */\r\n this.simpleKeyboardInstance = simpleKeyboardInstance;\r\n\r\n /**\r\n * Bindings\r\n */\r\n this.getButtonClass = this.getButtonClass.bind(this);\r\n this.getButtonDisplayName = this.getButtonDisplayName.bind(this);\r\n this.getUpdatedInput = this.getUpdatedInput.bind(this);\r\n this.updateCaretPos = this.updateCaretPos.bind(this);\r\n this.isMaxLengthReached = this.isMaxLengthReached.bind(this);\r\n this.camelCase = this.camelCase.bind(this);\r\n this.countInArray = this.countInArray.bind(this);\r\n }\r\n\r\n /**\r\n * Adds default classes to a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @return {string} The classes to be added to the button\r\n */\r\n getButtonClass(button){\r\n let buttonTypeClass = (button.includes(\"{\") && button.includes(\"}\") && button !== '{//}') ? \"functionBtn\" : \"standardBtn\";\r\n let buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\r\n let buttonNormalized = '';\r\n\r\n if(buttonTypeClass !== \"standardBtn\")\r\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\r\n\r\n return `hg-${buttonTypeClass}${buttonNormalized}`;\r\n }\r\n\r\n /**\r\n * Default button display labels\r\n */\r\n getDefaultDiplay(){\r\n return {\r\n '{bksp}': 'backspace',\r\n '{backspace}': 'backspace',\r\n '{enter}': '< enter',\r\n '{shift}': 'shift',\r\n '{shiftleft}': 'shift',\r\n '{shiftright}': 'shift',\r\n '{alt}': 'alt',\r\n '{s}': 'shift',\r\n '{tab}': 'tab',\r\n '{lock}': 'caps',\r\n '{capslock}': 'caps',\r\n '{accept}': 'Submit',\r\n '{space}': ' ',\r\n '{//}': ' ',\r\n \"{esc}\": \"esc\",\r\n \"{escape}\": \"esc\",\r\n \"{f1}\": \"f1\",\r\n \"{f2}\": \"f2\",\r\n \"{f3}\": \"f3\",\r\n \"{f4}\": \"f4\",\r\n \"{f5}\": \"f5\",\r\n \"{f6}\": \"f6\",\r\n \"{f7}\": \"f7\",\r\n \"{f8}\": \"f8\",\r\n \"{f9}\": \"f9\",\r\n \"{f10}\": \"f10\",\r\n \"{f11}\": \"f11\",\r\n \"{f12}\": \"f12\",\r\n '{numpaddivide}': '/',\r\n '{numlock}': 'lock',\r\n \"{arrowup}\": \"↑\",\r\n \"{arrowleft}\": \"←\",\r\n \"{arrowdown}\": \"↓\",\r\n \"{arrowright}\": \"→\",\r\n \"{prtscr}\": \"print\",\r\n \"{scrolllock}\": \"scroll\",\r\n \"{pause}\": \"pause\",\r\n \"{insert}\": \"ins\",\r\n \"{home}\": \"home\",\r\n \"{pageup}\": \"up\",\r\n \"{delete}\": \"del\",\r\n \"{end}\": \"end\",\r\n \"{pagedown}\": \"down\",\r\n \"{numpadmultiply}\": \"*\",\r\n \"{numpadsubtract}\": \"-\",\r\n \"{numpadadd}\": \"+\",\r\n \"{numpadenter}\": \"enter\",\r\n \"{period}\": \".\",\r\n \"{numpaddecimal}\": \".\",\r\n \"{numpad0}\": \"0\",\r\n \"{numpad1}\": \"1\",\r\n \"{numpad2}\": \"2\",\r\n \"{numpad3}\": \"3\",\r\n \"{numpad4}\": \"4\",\r\n \"{numpad5}\": \"5\",\r\n \"{numpad6}\": \"6\",\r\n \"{numpad7}\": \"7\",\r\n \"{numpad8}\": \"8\",\r\n \"{numpad9}\": \"9\",\r\n };\r\n }\r\n /**\r\n * Returns the display (label) name for a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @param {object} display The provided display option\r\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\r\n */\r\n getButtonDisplayName(button, display, mergeDisplay){\r\n if(mergeDisplay){\r\n display = Object.assign({}, this.getDefaultDiplay(), display);\r\n } else {\r\n display = display || this.getDefaultDiplay();\r\n }\r\n\r\n return display[button] || button;\r\n }\r\n\r\n \r\n /**\r\n * Returns the updated input resulting from clicking a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @param {string} input The input string\r\n * @param {object} options The simple-keyboard options object\r\n * @param {number} caretPos The cursor's current position\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */\r\n getUpdatedInput(button, input, options, caretPos, moveCaret){\r\n \r\n let output = input;\r\n\r\n if((button === \"{bksp}\" || button === \"{backspace}\") && output.length > 0){\r\n output = this.removeAt(output, caretPos, moveCaret);\r\n\r\n } else if(button === \"{space}\")\r\n output = this.addStringAt(output, \" \", caretPos, moveCaret);\r\n\r\n else if(button === \"{tab}\" && !(typeof options.tabCharOnTab === \"boolean\" && options.tabCharOnTab === false)){\r\n output = this.addStringAt(output, \"\\t\", caretPos, moveCaret);\r\n\r\n } else if((button === \"{enter}\" || button === \"{numpadenter}\") && options.newLineOnEnter)\r\n output = this.addStringAt(output, \"\\n\", caretPos, moveCaret);\r\n\r\n else if(button.includes(\"numpad\") && Number.isInteger(Number(button[button.length - 2]))){\r\n output = this.addStringAt(output, button[button.length - 2], caretPos);\r\n }\r\n else if(button === \"{numpaddivide}\")\r\n output = this.addStringAt(output, '/', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpadmultiply}\")\r\n output = this.addStringAt(output, '*', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpadsubtract}\")\r\n output = this.addStringAt(output, '-', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpadadd}\")\r\n output = this.addStringAt(output, '+', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpaddecimal}\")\r\n output = this.addStringAt(output, '.', caretPos, moveCaret);\r\n\r\n else if(button === \"{\" || button === \"}\")\r\n output = this.addStringAt(output, button, caretPos, moveCaret);\r\n\r\n else if(!button.includes(\"{\") && !button.includes(\"}\"))\r\n output = this.addStringAt(output, button, caretPos, moveCaret);\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Moves the cursor position by a given amount\r\n * \r\n * @param {number} length Represents by how many characters the input should be moved\r\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\r\n */\r\n updateCaretPos(length, minus){\r\n if(minus){\r\n if(this.simpleKeyboardInstance.caretPosition > 0)\r\n this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition - length;\r\n } else {\r\n this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition + length;\r\n }\r\n }\r\n\r\n /**\r\n * Adds a string to the input at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {string} string The string to add\r\n * @param {number} position The (cursor) position where the string should be added\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */\r\n addStringAt(source, string, position, moveCaret){\r\n let output;\r\n\r\n if(!position && position !== 0){\r\n output = source + string;\r\n } else {\r\n output = [source.slice(0, position), string, source.slice(position)].join('');\r\n\r\n /**\r\n * Avoid caret position change when maxLength is set\r\n */\r\n if(!this.isMaxLengthReached()){\r\n if(moveCaret) this.updateCaretPos(string.length);\r\n }\r\n\r\n }\r\n\r\n if(this.simpleKeyboardInstance.options.debug && moveCaret){\r\n console.log(\"Caret at:\", position);\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Removes an amount of characters at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {number} position The (cursor) position from where the characters should be removed\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */\r\n removeAt(source, position, moveCaret){\r\n if(this.simpleKeyboardInstance.caretPosition === 0){\r\n return source;\r\n }\r\n\r\n let output;\r\n let prevTwoChars;\r\n let emojiMatched;\r\n let emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\r\n\r\n /**\r\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\r\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\r\n */\r\n if(position && position >= 0){\r\n prevTwoChars = source.substring(position - 2, position)\r\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\r\n\r\n if(emojiMatched){\r\n output = source.substr(0, (position - 2)) + source.substr(position);\r\n if(moveCaret) this.updateCaretPos(2, true);\r\n } else {\r\n output = source.substr(0, (position - 1)) + source.substr(position);\r\n if(moveCaret) this.updateCaretPos(1, true);\r\n }\r\n } else {\r\n prevTwoChars = source.slice(-2);\r\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\r\n\r\n if(emojiMatched){\r\n output = source.slice(0, -2);\r\n if(moveCaret) this.updateCaretPos(2, true);\r\n } else {\r\n output = source.slice(0, -1);\r\n if(moveCaret) this.updateCaretPos(1, true);\r\n }\r\n }\r\n\r\n if(this.simpleKeyboardInstance.options.debug && moveCaret){\r\n console.log(\"Caret at:\", this.simpleKeyboardInstance.caretPosition);\r\n }\r\n\r\n return output;\r\n }\r\n /**\r\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\r\n * \r\n * @param {object} inputObj\r\n * @param {object} options\r\n * @param {string} updatedInput\r\n */\r\n handleMaxLength(inputObj, options, updatedInput){\r\n let maxLength = options.maxLength;\r\n let currentInput = inputObj[options.inputName];\r\n let condition = currentInput.length === maxLength;\r\n\r\n if(\r\n /**\r\n * If pressing this button won't add more characters\r\n * We exit out of this limiter function\r\n */\r\n updatedInput.length <= currentInput.length\r\n ){\r\n return false;\r\n }\r\n\r\n if(Number.isInteger(maxLength)){\r\n if(options.debug){\r\n console.log(\"maxLength (num) reached:\", condition);\r\n }\r\n\r\n if(condition){\r\n /**\r\n * @type {boolean} Boolean value that shows whether maxLength has been reached\r\n */\r\n this.maxLengthReached = true;\r\n return true;\r\n } else {\r\n this.maxLengthReached = false;\r\n return false;\r\n }\r\n }\r\n\r\n if(typeof maxLength === \"object\"){\r\n let condition = currentInput.length === maxLength[options.inputName];\r\n\r\n if(options.debug){\r\n console.log(\"maxLength (obj) reached:\", condition);\r\n }\r\n\r\n if(condition){\r\n this.maxLengthReached = true;\r\n return true;\r\n } else {\r\n this.maxLengthReached = false;\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current value of maxLengthReached\r\n */\r\n isMaxLengthReached(){\r\n return Boolean(this.maxLengthReached);\r\n }\r\n\r\n /**\r\n * Transforms an arbitrary string to camelCase\r\n * \r\n * @param {string} string The string to transform.\r\n */\r\n camelCase(string){\r\n return string.toLowerCase().trim().split(/[.\\-_\\s]/g).reduce((string, word) => string + word[0].toUpperCase() + word.slice(1));\r\n };\r\n\r\n /**\r\n * Counts the number of duplicates in a given array\r\n * \r\n * @param {Array} array The haystack to search in\r\n * @param {string} value The needle to search for\r\n */\r\n countInArray(array, value){\r\n return array.reduce((n, x) => n + (x === value), 0);\r\n }\r\n\r\n}\r\n\r\nexport default Utilities;\n\n\n// WEBPACK FOOTER //\n// ./src/lib/services/Utilities.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["../../webpack/universalModuleDefinition","../../webpack/bootstrap","../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../node_modules/@babel/runtime/helpers/esm/createClass.js","services/PhysicalKeyboard.js","services/KeyboardLayout.js","services/Utilities.js","components/Keyboard.js","index.js"],"names":["root","factory","exports","module","define","amd","window","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","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","length","descriptor","configurable","writable","_createClass","protoProps","staticProps","PhysicalKeyboard","simpleKeyboardInstance","this","initKeyboardListener","getSimpleKeyboardLayoutKey","_this","document","addEventListener","event","options","physicalKeyboardHighlight","buttonPressed","dispatch","buttonDOM","getButtonElement","concat","style","backgroundColor","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","removeAttribute","output","code","includes","toUpperCase","Number","isInteger","toLowerCase","KeyboardLayout","default","shift","Utilities","getButtonClass","getButtonDisplayName","getUpdatedInput","updateCaretPos","isMaxLengthReached","camelCase","countInArray","button","buttonTypeClass","buttonWithoutBraces","replace","buttonNormalized","{bksp}","{backspace}","{enter}","{shift}","{shiftleft}","{shiftright}","{alt}","{s}","{tab}","{lock}","{capslock}","{accept}","{space}","{//}","{esc}","{escape}","{f1}","{f2}","{f3}","{f4}","{f5}","{f6}","{f7}","{f8}","{f9}","{f10}","{f11}","{f12}","{numpaddivide}","{numlock}","{arrowup}","{arrowleft}","{arrowdown}","{arrowright}","{prtscr}","{scrolllock}","{pause}","{insert}","{home}","{pageup}","{delete}","{end}","{pagedown}","{numpadmultiply}","{numpadsubtract}","{numpadadd}","{numpadenter}","{period}","{numpaddecimal}","{numpad0}","{numpad1}","{numpad2}","{numpad3}","{numpad4}","{numpad5}","{numpad6}","{numpad7}","{numpad8}","{numpad9}","display","mergeDisplay","assign","getDefaultDiplay","input","caretPos","moveCaret","removeAt","addStringAt","tabCharOnTab","newLineOnEnter","minus","caretPosition","source","string","position","slice","join","debug","console","log","emojiMatchedReg","substring","match","substr","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","Boolean","trim","split","reduce","word","array","x","SimpleKeyboard","setOptions","option","render","registerModule","initCallback","getModuleProp","prop","getModulesList","keys","keyboardDOMQuery","arguments","undefined","utilities","keyboardDOM","querySelector","layoutName","theme","keyboardPluginClasses","handleButtonClicked","syncInstanceInputs","clearInput","getInput","setInput","replaceInput","clear","addButtonTheme","removeButtonTheme","handleCaret","caretEventHandler","onInit","onRender","loadModules","handleButtonMouseUp","handleButtonMouseDown","handleButtonHold","onModulesLoaded","keyboardDOMClass","buttonElements","warn","Error","physicalKeyboardInterface","onKeyPress","handleMaxLength","onChange","e","_this2","isMouseHold","holdInteractionTimeout","clearTimeout","holdTimeout","setTimeout","_this3","_this4","innerHTML","className","callback","forEach","buttons","_this5","classNameItem","buttonTheme","classNameFound","map","class","buttonThemeArray","push","_this6","Array","isArray","index","filteredButtonArray","filter","item","splice","buttonArr","targetTagName","tagName","disableCaretPositioning","selectionStart","_this7","Module","constructor","classStr","init","_this8","layoutClass","layout","getDefaultLayout","buttonThemesParsed","themeObj","themeButtons","themeButton","themeParsed","row","rIndex","rowArray","rowDOM","createElement","bIndex","fctBtnClass","buttonThemeClass","buttonDisplayName","onclick","onmousedown","setAttribute","buttonUID","buttonSpanDOM","appendChild","onmouseup","initialized"],"mappings":";;;;;;;;;;;CAAA,SAAAA,EAAAC,GACA,kBAAAC,SAAA,kBAAAC,OACAA,OAAAD,QAAAD,IACA,oBAAAG,eAAAC,IACAD,OAA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AU2O,aAAa,gBAAiBC,GAKxC5O,EAAU2O,aAAa,oBAAqBH,GAK5C,IAAIK,EAAgBpP,SAAS2O,cAAc,QAC3CS,EAAcrD,UAAYgD,EAC1BxO,EAAU8O,YAAYD,GAKlBtB,EAAK/C,eAAe7I,KACtB4L,EAAK/C,eAAe7I,GAAU,IAEhC4L,EAAK/C,eAAe7I,GAAQyK,KAAKpM,GAKjCmO,EAAOW,YAAY9O,KAOrBuN,EAAKvE,YAAY8F,YAAYX,KAM/B9O,KAAK4K,WAKLxK,SAASsP,UAAY,kBAAMxB,EAAKpD,uBAE5B9K,KAAK2P,cAIP3P,KAAK2P,aAAc,EAKnB3P,KAAK2K,mBCnwBI9B","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"SimpleKeyboard\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SimpleKeyboard\"] = factory();\n\telse\n\t\troot[\"SimpleKeyboard\"] = factory();\n})(window, 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","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","/**\r\n * Physical Keyboard Service\r\n */\r\nclass PhysicalKeyboard {\r\n /**\r\n * Creates an instance of the PhysicalKeyboard service\r\n */\r\n constructor(simpleKeyboardInstance){\r\n /**\r\n * @type {object} A simple-keyboard instance\r\n */\r\n this.simpleKeyboardInstance = simpleKeyboardInstance;\r\n\r\n /**\r\n * Bindings\r\n */\r\n this.initKeyboardListener = this.initKeyboardListener.bind(this);\r\n this.getSimpleKeyboardLayoutKey = this.getSimpleKeyboardLayoutKey.bind(this);\r\n\r\n /**\r\n * Initialize key listeners\r\n */\r\n this.initKeyboardListener();\r\n }\r\n\r\n /**\r\n * Initializes key event listeners\r\n */\r\n initKeyboardListener(){\r\n // Adding button style on keydown\r\n document.addEventListener(\"keydown\", (event) => {\r\n if(this.simpleKeyboardInstance.options.physicalKeyboardHighlight){\r\n let buttonPressed = this.getSimpleKeyboardLayoutKey(event);\r\n\r\n this.simpleKeyboardInstance.dispatch(instance => {\r\n let buttonDOM = instance.getButtonElement(buttonPressed) || instance.getButtonElement(`{${buttonPressed}}`);\r\n\r\n if(buttonDOM){\r\n buttonDOM.style.backgroundColor = this.simpleKeyboardInstance.options.physicalKeyboardHighlightBgColor || \"#9ab4d0\";\r\n buttonDOM.style.color = this.simpleKeyboardInstance.options.physicalKeyboardHighlightTextColor || \"white\";\r\n }\r\n });\r\n }\r\n });\r\n\r\n // Removing button style on keyup\r\n document.addEventListener(\"keyup\", (event) => {\r\n if(this.simpleKeyboardInstance.options.physicalKeyboardHighlight){\r\n let buttonPressed = this.getSimpleKeyboardLayoutKey(event);\r\n\r\n this.simpleKeyboardInstance.dispatch(instance => {\r\n let buttonDOM = instance.getButtonElement(buttonPressed) || instance.getButtonElement(`{${buttonPressed}}`);\r\n\r\n if(buttonDOM && buttonDOM.removeAttribute){\r\n buttonDOM.removeAttribute(\"style\");\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\r\n * @param {object} event The KeyboardEvent\r\n */\r\n getSimpleKeyboardLayoutKey(event){\r\n let output;\r\n\r\n if(\r\n event.code.includes(\"Numpad\") ||\r\n event.code.includes(\"Shift\") ||\r\n event.code.includes(\"Space\") ||\r\n event.code.includes(\"Backspace\") ||\r\n event.code.includes(\"Control\") ||\r\n event.code.includes(\"Alt\") ||\r\n event.code.includes(\"Meta\")\r\n ){\r\n output = event.code;\r\n } else {\r\n output = event.key;\r\n }\r\n\r\n /**\r\n * If button is not uppercase, casting to lowercase\r\n */\r\n if (\r\n output !== output.toUpperCase() ||\r\n (event.code[0] === \"F\" && Number.isInteger(Number(event.code[1])) && event.code.length <= 3)\r\n ) {\r\n output = output.toLowerCase();\r\n }\r\n\r\n return output;\r\n }\r\n}\r\n\r\nexport default PhysicalKeyboard;","/**\r\n * Keyboard Layout Service\r\n */\r\nclass KeyboardLayout {\r\n /**\r\n * Get default simple-keyboard layout\r\n * @return {object} The default layout (US-QWERTY)\r\n */\r\n static getDefaultLayout(){\r\n return {\r\n 'default': [\r\n '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',\r\n '{tab} q w e r t y u i o p [ ] \\\\',\r\n '{lock} a s d f g h j k l ; \\' {enter}',\r\n '{shift} z x c v b n m , . / {shift}',\r\n '.com @ {space}'\r\n ],\r\n 'shift': [\r\n '~ ! @ # $ % ^ & * ( ) _ + {bksp}',\r\n '{tab} Q W E R T Y U I O P { } |',\r\n '{lock} A S D F G H J K L : \" {enter}',\r\n '{shift} Z X C V B N M < > ? {shift}',\r\n '.com @ {space}'\r\n ]\r\n } \r\n }\r\n}\r\n\r\nexport default KeyboardLayout;","/**\r\n * Utility Service\r\n */\r\nclass Utilities {\r\n /**\r\n * Creates an instance of the Utility service\r\n */\r\n constructor(simpleKeyboardInstance){\r\n /**\r\n * @type {object} A simple-keyboard instance\r\n */\r\n this.simpleKeyboardInstance = simpleKeyboardInstance;\r\n\r\n /**\r\n * Bindings\r\n */\r\n this.getButtonClass = this.getButtonClass.bind(this);\r\n this.getButtonDisplayName = this.getButtonDisplayName.bind(this);\r\n this.getUpdatedInput = this.getUpdatedInput.bind(this);\r\n this.updateCaretPos = this.updateCaretPos.bind(this);\r\n this.isMaxLengthReached = this.isMaxLengthReached.bind(this);\r\n this.camelCase = this.camelCase.bind(this);\r\n this.countInArray = this.countInArray.bind(this);\r\n }\r\n\r\n /**\r\n * Adds default classes to a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @return {string} The classes to be added to the button\r\n */\r\n getButtonClass(button){\r\n let buttonTypeClass = (button.includes(\"{\") && button.includes(\"}\") && button !== '{//}') ? \"functionBtn\" : \"standardBtn\";\r\n let buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\r\n let buttonNormalized = '';\r\n\r\n if(buttonTypeClass !== \"standardBtn\")\r\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\r\n\r\n return `hg-${buttonTypeClass}${buttonNormalized}`;\r\n }\r\n\r\n /**\r\n * Default button display labels\r\n */\r\n getDefaultDiplay(){\r\n return {\r\n '{bksp}': 'backspace',\r\n '{backspace}': 'backspace',\r\n '{enter}': '< enter',\r\n '{shift}': 'shift',\r\n '{shiftleft}': 'shift',\r\n '{shiftright}': 'shift',\r\n '{alt}': 'alt',\r\n '{s}': 'shift',\r\n '{tab}': 'tab',\r\n '{lock}': 'caps',\r\n '{capslock}': 'caps',\r\n '{accept}': 'Submit',\r\n '{space}': ' ',\r\n '{//}': ' ',\r\n \"{esc}\": \"esc\",\r\n \"{escape}\": \"esc\",\r\n \"{f1}\": \"f1\",\r\n \"{f2}\": \"f2\",\r\n \"{f3}\": \"f3\",\r\n \"{f4}\": \"f4\",\r\n \"{f5}\": \"f5\",\r\n \"{f6}\": \"f6\",\r\n \"{f7}\": \"f7\",\r\n \"{f8}\": \"f8\",\r\n \"{f9}\": \"f9\",\r\n \"{f10}\": \"f10\",\r\n \"{f11}\": \"f11\",\r\n \"{f12}\": \"f12\",\r\n '{numpaddivide}': '/',\r\n '{numlock}': 'lock',\r\n \"{arrowup}\": \"↑\",\r\n \"{arrowleft}\": \"←\",\r\n \"{arrowdown}\": \"↓\",\r\n \"{arrowright}\": \"→\",\r\n \"{prtscr}\": \"print\",\r\n \"{scrolllock}\": \"scroll\",\r\n \"{pause}\": \"pause\",\r\n \"{insert}\": \"ins\",\r\n \"{home}\": \"home\",\r\n \"{pageup}\": \"up\",\r\n \"{delete}\": \"del\",\r\n \"{end}\": \"end\",\r\n \"{pagedown}\": \"down\",\r\n \"{numpadmultiply}\": \"*\",\r\n \"{numpadsubtract}\": \"-\",\r\n \"{numpadadd}\": \"+\",\r\n \"{numpadenter}\": \"enter\",\r\n \"{period}\": \".\",\r\n \"{numpaddecimal}\": \".\",\r\n \"{numpad0}\": \"0\",\r\n \"{numpad1}\": \"1\",\r\n \"{numpad2}\": \"2\",\r\n \"{numpad3}\": \"3\",\r\n \"{numpad4}\": \"4\",\r\n \"{numpad5}\": \"5\",\r\n \"{numpad6}\": \"6\",\r\n \"{numpad7}\": \"7\",\r\n \"{numpad8}\": \"8\",\r\n \"{numpad9}\": \"9\",\r\n };\r\n }\r\n /**\r\n * Returns the display (label) name for a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @param {object} display The provided display option\r\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\r\n */\r\n getButtonDisplayName(button, display, mergeDisplay){\r\n if(mergeDisplay){\r\n display = Object.assign({}, this.getDefaultDiplay(), display);\r\n } else {\r\n display = display || this.getDefaultDiplay();\r\n }\r\n\r\n return display[button] || button;\r\n }\r\n\r\n \r\n /**\r\n * Returns the updated input resulting from clicking a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @param {string} input The input string\r\n * @param {object} options The simple-keyboard options object\r\n * @param {number} caretPos The cursor's current position\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */\r\n getUpdatedInput(button, input, options, caretPos, moveCaret){\r\n \r\n let output = input;\r\n\r\n if((button === \"{bksp}\" || button === \"{backspace}\") && output.length > 0){\r\n output = this.removeAt(output, caretPos, moveCaret);\r\n\r\n } else if(button === \"{space}\")\r\n output = this.addStringAt(output, \" \", caretPos, moveCaret);\r\n\r\n else if(button === \"{tab}\" && !(typeof options.tabCharOnTab === \"boolean\" && options.tabCharOnTab === false)){\r\n output = this.addStringAt(output, \"\\t\", caretPos, moveCaret);\r\n\r\n } else if((button === \"{enter}\" || button === \"{numpadenter}\") && options.newLineOnEnter)\r\n output = this.addStringAt(output, \"\\n\", caretPos, moveCaret);\r\n\r\n else if(button.includes(\"numpad\") && Number.isInteger(Number(button[button.length - 2]))){\r\n output = this.addStringAt(output, button[button.length - 2], caretPos);\r\n }\r\n else if(button === \"{numpaddivide}\")\r\n output = this.addStringAt(output, '/', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpadmultiply}\")\r\n output = this.addStringAt(output, '*', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpadsubtract}\")\r\n output = this.addStringAt(output, '-', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpadadd}\")\r\n output = this.addStringAt(output, '+', caretPos, moveCaret);\r\n\r\n else if(button === \"{numpaddecimal}\")\r\n output = this.addStringAt(output, '.', caretPos, moveCaret);\r\n\r\n else if(button === \"{\" || button === \"}\")\r\n output = this.addStringAt(output, button, caretPos, moveCaret);\r\n\r\n else if(!button.includes(\"{\") && !button.includes(\"}\"))\r\n output = this.addStringAt(output, button, caretPos, moveCaret);\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Moves the cursor position by a given amount\r\n * \r\n * @param {number} length Represents by how many characters the input should be moved\r\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\r\n */\r\n updateCaretPos(length, minus){\r\n if(minus){\r\n if(this.simpleKeyboardInstance.caretPosition > 0)\r\n this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition - length;\r\n } else {\r\n this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition + length;\r\n }\r\n }\r\n\r\n /**\r\n * Adds a string to the input at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {string} string The string to add\r\n * @param {number} position The (cursor) position where the string should be added\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */\r\n addStringAt(source, string, position, moveCaret){\r\n let output;\r\n\r\n if(!position && position !== 0){\r\n output = source + string;\r\n } else {\r\n output = [source.slice(0, position), string, source.slice(position)].join('');\r\n\r\n /**\r\n * Avoid caret position change when maxLength is set\r\n */\r\n if(!this.isMaxLengthReached()){\r\n if(moveCaret) this.updateCaretPos(string.length);\r\n }\r\n\r\n }\r\n\r\n if(this.simpleKeyboardInstance.options.debug && moveCaret){\r\n console.log(\"Caret at:\", position);\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Removes an amount of characters at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {number} position The (cursor) position from where the characters should be removed\r\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\r\n */\r\n removeAt(source, position, moveCaret){\r\n if(this.simpleKeyboardInstance.caretPosition === 0){\r\n return source;\r\n }\r\n\r\n let output;\r\n let prevTwoChars;\r\n let emojiMatched;\r\n let emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\r\n\r\n /**\r\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\r\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\r\n */\r\n if(position && position >= 0){\r\n prevTwoChars = source.substring(position - 2, position)\r\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\r\n\r\n if(emojiMatched){\r\n output = source.substr(0, (position - 2)) + source.substr(position);\r\n if(moveCaret) this.updateCaretPos(2, true);\r\n } else {\r\n output = source.substr(0, (position - 1)) + source.substr(position);\r\n if(moveCaret) this.updateCaretPos(1, true);\r\n }\r\n } else {\r\n prevTwoChars = source.slice(-2);\r\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\r\n\r\n if(emojiMatched){\r\n output = source.slice(0, -2);\r\n if(moveCaret) this.updateCaretPos(2, true);\r\n } else {\r\n output = source.slice(0, -1);\r\n if(moveCaret) this.updateCaretPos(1, true);\r\n }\r\n }\r\n\r\n if(this.simpleKeyboardInstance.options.debug && moveCaret){\r\n console.log(\"Caret at:\", this.simpleKeyboardInstance.caretPosition);\r\n }\r\n\r\n return output;\r\n }\r\n /**\r\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\r\n * \r\n * @param {object} inputObj\r\n * @param {object} options\r\n * @param {string} updatedInput\r\n */\r\n handleMaxLength(inputObj, options, updatedInput){\r\n let maxLength = options.maxLength;\r\n let currentInput = inputObj[options.inputName];\r\n let condition = currentInput.length === maxLength;\r\n\r\n if(\r\n /**\r\n * If pressing this button won't add more characters\r\n * We exit out of this limiter function\r\n */\r\n updatedInput.length <= currentInput.length\r\n ){\r\n return false;\r\n }\r\n\r\n if(Number.isInteger(maxLength)){\r\n if(options.debug){\r\n console.log(\"maxLength (num) reached:\", condition);\r\n }\r\n\r\n if(condition){\r\n /**\r\n * @type {boolean} Boolean value that shows whether maxLength has been reached\r\n */\r\n this.maxLengthReached = true;\r\n return true;\r\n } else {\r\n this.maxLengthReached = false;\r\n return false;\r\n }\r\n }\r\n\r\n if(typeof maxLength === \"object\"){\r\n let condition = currentInput.length === maxLength[options.inputName];\r\n\r\n if(options.debug){\r\n console.log(\"maxLength (obj) reached:\", condition);\r\n }\r\n\r\n if(condition){\r\n this.maxLengthReached = true;\r\n return true;\r\n } else {\r\n this.maxLengthReached = false;\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current value of maxLengthReached\r\n */\r\n isMaxLengthReached(){\r\n return Boolean(this.maxLengthReached);\r\n }\r\n\r\n /**\r\n * Transforms an arbitrary string to camelCase\r\n * \r\n * @param {string} string The string to transform.\r\n */\r\n camelCase(string){\r\n return string.toLowerCase().trim().split(/[.\\-_\\s]/g).reduce((string, word) => string + word[0].toUpperCase() + word.slice(1));\r\n };\r\n\r\n /**\r\n * Counts the number of duplicates in a given array\r\n * \r\n * @param {Array} array The haystack to search in\r\n * @param {string} value The needle to search for\r\n */\r\n countInArray(array, value){\r\n return array.reduce((n, x) => n + (x === value), 0);\r\n }\r\n\r\n}\r\n\r\nexport default Utilities;","import './Keyboard.css';\r\n\r\n// Services\r\nimport PhysicalKeyboard from '../services/PhysicalKeyboard';\r\nimport KeyboardLayout from '../services/KeyboardLayout';\r\nimport Utilities from '../services/Utilities';\r\n\r\n/**\r\n * Root class for simple-keyboard\r\n * This class:\r\n * - Parses the options\r\n * - Renders the rows and buttons\r\n * - Handles button functionality\r\n */\r\nclass SimpleKeyboard {\r\n /**\r\n * Creates an instance of SimpleKeyboard\r\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.\r\n */\r\n constructor(...params){\r\n let keyboardDOMQuery = typeof params[0] === \"string\" ? params[0] : '.simple-keyboard';\r\n let options = typeof params[0] === \"object\" ? params[0] : params[1];\r\n\r\n if(!options)\r\n options = {};\r\n\r\n /**\r\n * Initializing Utilities\r\n */\r\n this.utilities = new Utilities(this);\r\n\r\n /**\r\n * Processing options\r\n */\r\n this.keyboardDOM = document.querySelector(keyboardDOMQuery);\r\n\r\n /**\r\n * @type {object}\r\n * @property {object} layout Modify the keyboard layout.\r\n * @property {string} layoutName Specifies which layout should be used.\r\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\r\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\r\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.\r\n * @property {Array} buttonTheme A prop to add your own css classes to one or several buttons.\r\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\r\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\r\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\r\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\r\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.\r\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.\r\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\r\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\r\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\r\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have. \r\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\r\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\r\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\r\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\r\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\r\n */\r\n this.options = options;\r\n this.options.layoutName = this.options.layoutName || \"default\";\r\n this.options.theme = this.options.theme || \"hg-theme-default\";\r\n this.options.inputName = this.options.inputName || \"default\";\r\n\r\n /**\r\n * @type {object} Classes identifying loaded plugins\r\n */\r\n this.keyboardPluginClasses = '';\r\n\r\n /**\r\n * Bindings\r\n */\r\n this.handleButtonClicked = this.handleButtonClicked.bind(this);\r\n this.syncInstanceInputs = this.syncInstanceInputs.bind(this);\r\n this.clearInput = this.clearInput.bind(this);\r\n this.getInput = this.getInput.bind(this);\r\n this.setInput = this.setInput.bind(this);\r\n this.replaceInput = this.replaceInput.bind(this);\r\n this.clear = this.clear.bind(this);\r\n this.dispatch = this.dispatch.bind(this);\r\n this.addButtonTheme = this.addButtonTheme.bind(this);\r\n this.removeButtonTheme = this.removeButtonTheme.bind(this);\r\n this.getButtonElement = this.getButtonElement.bind(this);\r\n this.handleCaret = this.handleCaret.bind(this);\r\n this.caretEventHandler = this.caretEventHandler.bind(this);\r\n this.onInit = this.onInit.bind(this);\r\n this.onRender = this.onRender.bind(this);\r\n this.render = this.render.bind(this);\r\n this.loadModules = this.loadModules.bind(this);\r\n this.handleButtonMouseUp = this.handleButtonMouseUp.bind(this);\r\n this.handleButtonMouseDown = this.handleButtonMouseDown.bind(this);\r\n this.handleButtonHold = this.handleButtonHold.bind(this);\r\n this.onModulesLoaded = this.onModulesLoaded.bind(this);\r\n\r\n /**\r\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\r\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\r\n * @example\r\n * // To get entered input\r\n * let input = keyboard.getInput();\r\n * \r\n * // To clear entered input.\r\n * keyboard.clearInput();\r\n * \r\n * @type {object}\r\n * @property {object} default Default SimpleKeyboard internal input.\r\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\r\n */\r\n this.input = {};\r\n this.input[this.options.inputName] = '';\r\n\r\n /**\r\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\r\n */\r\n this.keyboardDOMClass = keyboardDOMQuery.split('.').join(\"\");\r\n\r\n /**\r\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\r\n */\r\n this.buttonElements = {};\r\n\r\n /**\r\n * Rendering keyboard\r\n */\r\n if(this.keyboardDOM)\r\n this.render();\r\n else {\r\n console.warn(`\"${keyboardDOMQuery}\" was not found in the DOM.`);\r\n throw new Error(\"KEYBOARD_DOM_ERROR\");\r\n }\r\n\r\n /**\r\n * Saving instance\r\n * This enables multiple simple-keyboard support with easier management\r\n */\r\n if(!window['SimpleKeyboardInstances'])\r\n window['SimpleKeyboardInstances'] = {};\r\n \r\n window['SimpleKeyboardInstances'][this.utilities.camelCase(this.keyboardDOMClass)] = this;\r\n\r\n /**\r\n * Physical Keyboard support\r\n */\r\n this.physicalKeyboardInterface = new PhysicalKeyboard(this);\r\n\r\n /**\r\n * Modules\r\n */\r\n this.modules = {};\r\n this.loadModules();\r\n }\r\n\r\n /**\r\n * Handles clicks made to keyboard buttons\r\n * @param {string} button The button's layout name.\r\n */\r\n handleButtonClicked(button){\r\n let debug = this.options.debug;\r\n\r\n /**\r\n * Ignoring placeholder buttons\r\n */\r\n if(button === '{//}')\r\n return false;\r\n\r\n /**\r\n * Calling onKeyPress\r\n */\r\n if(typeof this.options.onKeyPress === \"function\")\r\n this.options.onKeyPress(button);\r\n \r\n if(!this.input[this.options.inputName])\r\n this.input[this.options.inputName] = '';\r\n\r\n let updatedInput = this.utilities.getUpdatedInput(\r\n button, this.input[this.options.inputName], this.options, this.caretPosition\r\n );\r\n\r\n if(this.input[this.options.inputName] !== updatedInput){\r\n\r\n /**\r\n * If maxLength and handleMaxLength yield true, halting\r\n */\r\n if(this.options.maxLength && this.utilities.handleMaxLength(this.input, this.options, updatedInput)){\r\n return false;\r\n }\r\n\r\n this.input[this.options.inputName] = this.utilities.getUpdatedInput(\r\n button, this.input[this.options.inputName], this.options, this.caretPosition, true\r\n );\r\n\r\n if(debug)\r\n console.log('Input changed:', this.input);\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n\r\n /**\r\n * Calling onChange\r\n */\r\n if(typeof this.options.onChange === \"function\")\r\n this.options.onChange(this.input[this.options.inputName]);\r\n }\r\n \r\n if(debug){\r\n console.log(\"Key pressed:\", button);\r\n }\r\n }\r\n\r\n /**\r\n * Handles button mousedown\r\n */\r\n /* istanbul ignore next */\r\n handleButtonMouseDown(button, e){\r\n /**\r\n * @type {boolean} Whether the mouse is being held onKeyPress\r\n */\r\n this.isMouseHold = true;\r\n\r\n if(this.holdInteractionTimeout)\r\n clearTimeout(this.holdInteractionTimeout);\r\n\r\n if(this.holdTimeout)\r\n clearTimeout(this.holdTimeout);\r\n\r\n /**\r\n * @type {object} Time to wait until a key hold is detected\r\n */\r\n this.holdTimeout = setTimeout(() => {\r\n if(\r\n this.isMouseHold &&\r\n (\r\n (!button.includes(\"{\") && !button.includes(\"}\")) ||\r\n button === \"{bksp}\" ||\r\n button === \"{space}\" ||\r\n button === \"{tab}\"\r\n )\r\n ){\r\n if(this.options.debug)\r\n console.log(\"Button held:\", button);\r\n\r\n this.handleButtonHold(button, e);\r\n }\r\n clearTimeout(this.holdTimeout);\r\n }, 500);\r\n }\r\n\r\n /**\r\n * Handles button mouseup\r\n */\r\n handleButtonMouseUp(){\r\n this.isMouseHold = false;\r\n if(this.holdInteractionTimeout)\r\n clearTimeout(this.holdInteractionTimeout);\r\n }\r\n\r\n /**\r\n * Handles button hold\r\n */\r\n /* istanbul ignore next */\r\n handleButtonHold(button){\r\n if(this.holdInteractionTimeout)\r\n clearTimeout(this.holdInteractionTimeout);\r\n\r\n /**\r\n * @type {object} Timeout dictating the speed of key hold iterations\r\n */\r\n this.holdInteractionTimeout = setTimeout(() => {\r\n if(this.isMouseHold){\r\n this.handleButtonClicked(button);\r\n this.handleButtonHold(button);\r\n } else {\r\n clearTimeout(this.holdInteractionTimeout);\r\n }\r\n }, 100);\r\n }\r\n\r\n /**\r\n * Send a command to all simple-keyboard instances (if you have several instances).\r\n */\r\n syncInstanceInputs(){\r\n this.dispatch((instance) => {\r\n instance.replaceInput(this.input);\r\n });\r\n }\r\n \r\n /**\r\n * Clear the keyboard’s input.\r\n * @param {string} [inputName] optional - the internal input to select\r\n */\r\n clearInput(inputName){\r\n inputName = inputName || this.options.inputName;\r\n this.input[this.options.inputName] = '';\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n }\r\n\r\n /**\r\n * Get the keyboard’s input (You can also get it from the onChange prop).\r\n * @param {string} [inputName] optional - the internal input to select\r\n */\r\n getInput(inputName){\r\n inputName = inputName || this.options.inputName;\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n\r\n return this.input[this.options.inputName];\r\n }\r\n\r\n /**\r\n * Set the keyboard’s input.\r\n * @param {string} input the input value\r\n * @param {string} inputName optional - the internal input to select\r\n */\r\n setInput(input, inputName){\r\n inputName = inputName || this.options.inputName;\r\n this.input[inputName] = input;\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n }\r\n \r\n /**\r\n * Replace the input object (`keyboard.input`)\r\n * @param {object} inputObj The input object\r\n */\r\n replaceInput(inputObj){\r\n this.input = inputObj;\r\n }\r\n\r\n /**\r\n * Set new option or modify existing ones after initialization. \r\n * @param {object} option The option to set\r\n */\r\n setOptions = option => {\r\n option = option || {};\r\n this.options = Object.assign(this.options, option);\r\n this.render();\r\n }\r\n\r\n /**\r\n * Remove all keyboard rows and reset keyboard values.\r\n * Used interally between re-renders.\r\n */\r\n clear(){\r\n this.keyboardDOM.innerHTML = '';\r\n this.keyboardDOM.className = this.keyboardDOMClass;\r\n this.buttonElements = {};\r\n }\r\n\r\n /**\r\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\r\n * @param {function(instance: object, key: string)} callback Function to run on every instance\r\n */\r\n dispatch(callback){\r\n if(!window['SimpleKeyboardInstances']){\r\n console.warn(`SimpleKeyboardInstances is not defined. Dispatch cannot be called.`);\r\n throw new Error(\"INSTANCES_VAR_ERROR\");\r\n }\r\n \r\n return Object.keys(window['SimpleKeyboardInstances']).forEach((key) => {\r\n callback(window['SimpleKeyboardInstances'][key], key);\r\n })\r\n }\r\n\r\n /**\r\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\r\n * @param {string} buttons List of buttons to select (separated by a space).\r\n * @param {string} className Classes to give to the selected buttons (separated by space).\r\n */\r\n addButtonTheme(buttons, className){\r\n if(!className || !buttons)\r\n return false;\r\n\r\n buttons.split(\" \").forEach(button => {\r\n className.split(\" \").forEach(classNameItem => {\r\n if(!this.options.buttonTheme)\r\n this.options.buttonTheme = [];\r\n\r\n let classNameFound = false;\r\n \r\n /**\r\n * If class is already defined, we add button to class definition\r\n */\r\n this.options.buttonTheme.map(buttonTheme => {\r\n\r\n if(buttonTheme.class.split(\" \").includes(classNameItem)){\r\n classNameFound = true;\r\n \r\n let buttonThemeArray = buttonTheme.buttons.split(\" \");\r\n if(!buttonThemeArray.includes(button)){\r\n classNameFound = true;\r\n buttonThemeArray.push(button);\r\n buttonTheme.buttons = buttonThemeArray.join(\" \");\r\n }\r\n }\r\n return buttonTheme;\r\n });\r\n\r\n /**\r\n * If class is not defined, we create a new entry\r\n */\r\n if(!classNameFound){\r\n this.options.buttonTheme.push({\r\n class: classNameItem,\r\n buttons: buttons\r\n });\r\n }\r\n\r\n });\r\n });\r\n\r\n this.render();\r\n }\r\n\r\n /**\r\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\r\n * @param {string} buttons List of buttons to select (separated by a space).\r\n * @param {string} className Classes to give to the selected buttons (separated by space).\r\n */\r\n removeButtonTheme(buttons, className){\r\n /**\r\n * When called with empty parameters, remove all button themes\r\n */\r\n if(!buttons && !className){\r\n this.options.buttonTheme = [];\r\n this.render();\r\n return false;\r\n }\r\n\r\n /**\r\n * If buttons are passed and buttonTheme has items\r\n */\r\n if(buttons && Array.isArray(this.options.buttonTheme) && this.options.buttonTheme.length){\r\n let buttonArray = buttons.split(\" \");\r\n buttonArray.forEach((button, key) => {\r\n this.options.buttonTheme.map((buttonTheme, index) => {\r\n\r\n /**\r\n * If className is set, we affect the buttons only for that class\r\n * Otherwise, we afect all classes\r\n */\r\n if(\r\n (className && className.includes(buttonTheme.class)) ||\r\n !className\r\n ){\r\n let filteredButtonArray = buttonTheme.buttons.split(\" \").filter(item => item !== button);\r\n\r\n /**\r\n * If buttons left, return them, otherwise, remove button Theme\r\n */\r\n if(filteredButtonArray.length){\r\n buttonTheme.buttons = filteredButtonArray.join(\" \");\r\n } else {\r\n this.options.buttonTheme.splice(index, 1);\r\n buttonTheme = null;\r\n }\r\n \r\n }\r\n\r\n return buttonTheme;\r\n });\r\n });\r\n\r\n this.render();\r\n }\r\n }\r\n\r\n /**\r\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.\r\n * @param {string} button The button layout name to select\r\n */\r\n getButtonElement(button){\r\n let output;\r\n\r\n let buttonArr = this.buttonElements[button];\r\n if(buttonArr){\r\n if(buttonArr.length > 1){\r\n output = buttonArr;\r\n } else {\r\n output = buttonArr[0];\r\n }\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Retrieves the current cursor position within a input or textarea (if any)\r\n */\r\n handleCaret(){\r\n if(this.options.debug){\r\n console.log(\"Caret handling started\");\r\n }\r\n\r\n document.addEventListener(\"keyup\", this.caretEventHandler);\r\n document.addEventListener(\"mouseup\", this.caretEventHandler);\r\n document.addEventListener(\"touchend\", this.caretEventHandler);\r\n }\r\n\r\n /**\r\n * Called by {@link handleCaret} when an event that warrants a cursor position update is triggered\r\n */\r\n caretEventHandler(event){\r\n let targetTagName;\r\n\r\n if(event.target.tagName){\r\n targetTagName = event.target.tagName.toLowerCase();\r\n }\r\n\r\n if(\r\n (targetTagName === \"textarea\" ||\r\n targetTagName === \"input\") &&\r\n !this.options.disableCaretPositioning\r\n ){\r\n /**\r\n * Tracks current cursor position\r\n * As keys are pressed, text will be added/removed at that position within the input.\r\n */\r\n this.caretPosition = event.target.selectionStart;\r\n\r\n if(this.options.debug){\r\n console.log('Caret at: ', event.target.selectionStart, event.target.tagName.toLowerCase());\r\n } \r\n }\r\n }\r\n\r\n /**\r\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\r\n */\r\n onInit(){\r\n if(this.options.debug){\r\n console.log(\"Initialized\");\r\n }\r\n\r\n /**\r\n * Caret handling\r\n */\r\n this.handleCaret();\r\n\r\n if(typeof this.options.onInit === \"function\")\r\n this.options.onInit();\r\n }\r\n\r\n /**\r\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\r\n */\r\n onRender(){\r\n if(typeof this.options.onRender === \"function\")\r\n this.options.onRender();\r\n }\r\n\r\n /**\r\n * Executes the callback function once all modules have been loaded\r\n */\r\n onModulesLoaded(){\r\n if(typeof this.options.onModulesLoaded === \"function\")\r\n this.options.onModulesLoaded();\r\n }\r\n\r\n /**\r\n * Register module\r\n */\r\n registerModule = (name, initCallback) => {\r\n if(!this.modules[name])\r\n this.modules[name] = {};\r\n\r\n initCallback(this.modules[name]);\r\n }\r\n\r\n /**\r\n * Load modules\r\n */\r\n loadModules(){\r\n if(Array.isArray(this.options.modules)){\r\n this.options.modules.forEach(Module => {\r\n let module = new Module();\r\n\r\n /* istanbul ignore next */\r\n if(module.constructor.name && module.constructor.name !== \"Function\"){\r\n let classStr = `module-${this.utilities.camelCase(module.constructor.name)}`;\r\n this.keyboardPluginClasses = this.keyboardPluginClasses + ` ${classStr}`;\r\n }\r\n\r\n module.init(this);\r\n });\r\n\r\n this.keyboardPluginClasses = this.keyboardPluginClasses + ' modules-loaded';\r\n\r\n this.render();\r\n this.onModulesLoaded();\r\n }\r\n }\r\n\r\n /**\r\n * Get module prop\r\n */\r\n getModuleProp = (name, prop) => {\r\n if(!this.modules[name])\r\n return false;\r\n \r\n return this.modules[name][prop];\r\n }\r\n\r\n /**\r\n * getModulesList\r\n */\r\n getModulesList = () => {\r\n return Object.keys(this.modules);\r\n }\r\n\r\n /**\r\n * Renders rows and buttons as per options\r\n */\r\n render(){\r\n /**\r\n * Clear keyboard\r\n */\r\n this.clear();\r\n\r\n let layoutClass = this.options.layout ? \"hg-layout-custom\" : `hg-layout-${this.options.layoutName}`;\r\n let layout = this.options.layout || KeyboardLayout.getDefaultLayout();\r\n\r\n /**\r\n * Account for buttonTheme, if set\r\n */\r\n let buttonThemesParsed = {};\r\n if(Array.isArray(this.options.buttonTheme)){\r\n this.options.buttonTheme.forEach(themeObj => {\r\n if(themeObj.buttons && themeObj.class){\r\n let themeButtons;\r\n\r\n if(typeof themeObj.buttons === \"string\"){\r\n themeButtons = themeObj.buttons.split(' ');\r\n }\r\n\r\n if(themeButtons){\r\n themeButtons.forEach(themeButton => {\r\n let themeParsed = buttonThemesParsed[themeButton];\r\n\r\n // If the button has already been added\r\n if(themeParsed){\r\n // Making sure we don't add duplicate classes, even when buttonTheme has duplicates\r\n if(!this.utilities.countInArray(themeParsed.split(\" \"), themeObj.class)){\r\n buttonThemesParsed[themeButton] = `${themeParsed} ${themeObj.class}`;\r\n }\r\n } else {\r\n buttonThemesParsed[themeButton] = themeObj.class;\r\n }\r\n });\r\n }\r\n } else {\r\n console.warn(`buttonTheme row is missing the \"buttons\" or the \"class\". Please check the documentation.`)\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Adding themeClass, layoutClass to keyboardDOM\r\n */\r\n this.keyboardDOM.className += ` ${this.options.theme} ${layoutClass} ${this.keyboardPluginClasses}`;\r\n\r\n /**\r\n * Iterating through each row\r\n */\r\n layout[this.options.layoutName].forEach((row, rIndex) => {\r\n let rowArray = row.split(' ');\r\n\r\n /**\r\n * Creating empty row\r\n */\r\n var rowDOM = document.createElement('div');\r\n rowDOM.className += \"hg-row\";\r\n\r\n /**\r\n * Iterating through each button in row\r\n */\r\n rowArray.forEach((button, bIndex) => {\r\n let fctBtnClass = this.utilities.getButtonClass(button);\r\n let buttonThemeClass = buttonThemesParsed[button];\r\n let buttonDisplayName = this.utilities.getButtonDisplayName(button, this.options.display, this.options.mergeDisplay);\r\n\r\n /**\r\n * Creating button\r\n */\r\n var buttonDOM = document.createElement('div');\r\n buttonDOM.className += `hg-button ${fctBtnClass}${buttonThemeClass ? \" \"+buttonThemeClass : \"\"}`;\r\n buttonDOM.onclick = () => {\r\n this.isMouseHold = false;\r\n this.handleButtonClicked(button);\r\n }\r\n buttonDOM.onmousedown = (e) => this.handleButtonMouseDown(button, e);\r\n\r\n /**\r\n * Adding identifier\r\n */\r\n buttonDOM.setAttribute(\"data-skBtn\", button);\r\n\r\n /**\r\n * Adding unique id\r\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\r\n */\r\n let buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\r\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\r\n\r\n /**\r\n * Adding display label\r\n */\r\n buttonDOM.setAttribute(\"data-displayLabel\", buttonDisplayName);\r\n\r\n /**\r\n * Adding button label to button\r\n */\r\n var buttonSpanDOM = document.createElement('span');\r\n buttonSpanDOM.innerHTML = buttonDisplayName;\r\n buttonDOM.appendChild(buttonSpanDOM);\r\n\r\n /**\r\n * Adding to buttonElements\r\n */\r\n if(!this.buttonElements[button])\r\n this.buttonElements[button] = [];\r\n\r\n this.buttonElements[button].push(buttonDOM);\r\n\r\n /**\r\n * Appending button to row\r\n */\r\n rowDOM.appendChild(buttonDOM);\r\n\r\n });\r\n\r\n /**\r\n * Appending row to keyboard\r\n */\r\n this.keyboardDOM.appendChild(rowDOM);\r\n });\r\n\r\n /**\r\n * Calling onRender\r\n */\r\n this.onRender();\r\n\r\n /**\r\n * Handling mouseup\r\n */\r\n document.onmouseup = () => this.handleButtonMouseUp();\r\n\r\n if(!this.initialized){\r\n /**\r\n * Ensures that onInit is only called once per instantiation\r\n */\r\n this.initialized = true;\r\n\r\n /**\r\n * Calling onInit\r\n */\r\n this.onInit();\r\n }\r\n }\r\n}\r\n\r\nexport default SimpleKeyboard;\r\n","import SimpleKeyboard from './components/Keyboard';\r\nexport default SimpleKeyboard;\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/config/env.js b/config/env.js index 8b39b6c6..b0344c5a 100644 --- a/config/env.js +++ b/config/env.js @@ -27,24 +27,27 @@ var dotenvFiles = [ // Load environment variables from .env* files. Suppress warnings using silent // if this file is missing. dotenv will never modify any environment variables -// that have already been set. +// that have already been set. Variable expansion is supported in .env files. // https://github.com/motdotla/dotenv +// https://github.com/motdotla/dotenv-expand dotenvFiles.forEach(dotenvFile => { if (fs.existsSync(dotenvFile)) { - require('dotenv').config({ - path: dotenvFile, - }); + require('dotenv-expand')( + require('dotenv').config({ + path: dotenvFile, + }) + ); } }); // We support resolving modules according to `NODE_PATH`. // This lets you use absolute paths in imports inside large monorepos: -// https://github.com/facebookincubator/create-react-app/issues/253. +// https://github.com/facebook/create-react-app/issues/253. // 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. -// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 +// 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()); process.env.NODE_PATH = (process.env.NODE_PATH || '') diff --git a/config/jest/cssTransform.js b/config/jest/cssTransform.js index f1534f6f..8f651148 100644 --- a/config/jest/cssTransform.js +++ b/config/jest/cssTransform.js @@ -1,7 +1,7 @@ 'use strict'; // This is a custom Jest transformer turning style imports into empty objects. -// http://facebook.github.io/jest/docs/tutorial-webpack.html +// http://facebook.github.io/jest/docs/en/webpack.html module.exports = { process() { diff --git a/config/jest/fileTransform.js b/config/jest/fileTransform.js index ffce0da2..07010e33 100644 --- a/config/jest/fileTransform.js +++ b/config/jest/fileTransform.js @@ -3,10 +3,28 @@ const path = require('path'); // This is a custom Jest transformer turning file imports into filenames. -// http://facebook.github.io/jest/docs/tutorial-webpack.html +// http://facebook.github.io/jest/docs/en/webpack.html module.exports = { process(src, filename) { - return `module.exports = ${JSON.stringify(path.basename(filename))};`; + const assetFilename = JSON.stringify(path.basename(filename)); + + if (filename.match(/\.svg$/)) { + return `module.exports = { + __esModule: true, + default: ${assetFilename}, + ReactComponent: (props) => ({ + $$typeof: Symbol.for('react.element'), + type: 'svg', + ref: null, + key: null, + props: Object.assign({}, props, { + children: ${assetFilename} + }) + }), + };`; + } + + return `module.exports = ${assetFilename};`; }, }; diff --git a/config/paths.js b/config/paths.js index b5ebb1d9..7605a4d4 100644 --- a/config/paths.js +++ b/config/paths.js @@ -5,20 +5,20 @@ const fs = require('fs'); const url = require('url'); // Make sure any symlinks in the project folder are resolved: -// https://github.com/facebookincubator/create-react-app/issues/637 +// 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(path, needsSlash) { - const hasSlash = path.endsWith('/'); +function ensureSlash(inputPath, needsSlash) { + const hasSlash = inputPath.endsWith('/'); if (hasSlash && !needsSlash) { - return path.substr(path, path.length - 1); + return inputPath.substr(0, inputPath.length - 1); } else if (!hasSlash && needsSlash) { - return `${path}/`; + return `${inputPath}/`; } else { - return path; + return inputPath; } } @@ -38,27 +38,56 @@ function getServedPath(appPackageJson) { return ensureSlash(servedUrl, true); } +const moduleFileExtensions = [ + 'web.mjs', + 'mjs', + 'web.js', + 'js', + 'web.ts', + 'ts', + 'web.tsx', + 'tsx', + 'json', + 'web.jsx', + 'jsx', +]; + +// Resolve file paths in the same order as webpack +const resolveModule = (resolveFn, filePath) => { + const extension = moduleFileExtensions.find(extension => + fs.existsSync(resolveFn(`${filePath}.${extension}`)) + ); + + if (extension) { + return resolveFn(`${filePath}.${extension}`); + } + + return resolveFn(`${filePath}.js`); +}; + // config after eject: we're in ./config/ module.exports = { dotenv: resolveApp('.env'), + appPath: resolveApp('.'), appBuild: resolveApp('build'), - appDemoBuild: resolveApp('demo'), + appDemo: resolveApp('demo'), appPublic: resolveApp('public'), appHtml: resolveApp('public/index.html'), - appIndexJs: resolveApp('src/demo/index.js'), // CRL: Updated for demo purposes + appIndexJs: resolveModule(resolveApp, 'src/demo/index'), + appLibIndexJs: resolveModule(resolveApp, 'src/lib/index'), + appDemoIndexJs: resolveModule(resolveApp, 'src/demo/index'), appPackageJson: resolveApp('package.json'), appSrc: resolveApp('src'), + appSrcLib: resolveApp('src/lib'), + appSrcDemo: resolveApp('src/demo'), + appTsConfig: resolveApp('tsconfig.json'), yarnLockFile: resolveApp('yarn.lock'), - testsSetup: resolveApp('src/setupTests.js'), + testsSetup: resolveModule(resolveApp, 'src/setupTests'), + proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), publicUrl: getPublicUrl(resolveApp('package.json')), - servedPath: getServedPath(resolveApp('package.json')), - - // CRL: New paths for demo build - appDemoIndexJs: resolveApp('src/demo/index.js'), - appDemoSrc: resolveApp('src/demo'), - - // CRL: New paths for library - appLibIndexJs: resolveApp('src/lib/index.js'), - appLibSrc: resolveApp('src/lib'), + //servedPath: getServedPath(resolveApp('package.json')), + servedPath: '' }; + +module.exports.moduleFileExtensions = moduleFileExtensions; diff --git a/config/polyfills.js b/config/polyfills.js deleted file mode 100644 index 66dff0a8..00000000 --- a/config/polyfills.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -if (typeof Promise === 'undefined') { - // Rejection tracking prevents a common issue where React gets into an - // inconsistent state due to an error, but it gets swallowed by a Promise, - // and the user has no idea what causes React's erratic future behavior. - require('promise/lib/rejection-tracking').enable(); - window.Promise = require('promise/lib/es6-extensions.js'); -} - -// fetch() polyfill for making API calls. -require('whatwg-fetch'); - -// Object.assign() is commonly used with React. -// It will use the native implementation if it's present and isn't buggy. -Object.assign = require('object-assign'); - -// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet. -// We don't polyfill it in the browser--this is user's responsibility. -if (process.env.NODE_ENV === 'test') { - require('raf').polyfill(global); -} diff --git a/config/webpack.config.demo.js b/config/webpack.config.demo.js index c5e8ebee..f94e69df 100644 --- a/config/webpack.config.demo.js +++ b/config/webpack.config.demo.js @@ -1,16 +1,27 @@ +'use strict'; - -const autoprefixer = require('autoprefixer'); +const fs = require('fs'); const path = require('path'); const webpack = require('webpack'); +const resolve = require('resolve'); +const PnpWebpackPlugin = require('pnp-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); +const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin'); +const TerserPlugin = require('terser-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const safePostCssParser = require('postcss-safe-parser'); +const ManifestPlugin = require('webpack-manifest-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const eslintFormatter = require('react-dev-utils/eslintFormatter'); +const WorkboxWebpackPlugin = require('workbox-webpack-plugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); +const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent'); const paths = require('./paths'); const getClientEnvironment = require('./env'); +const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin-alt'); +const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); + // Webpack uses `publicPath` to determine where the app is being served from. // It requires a trailing slash, or the file assets will get an incorrect path. @@ -20,10 +31,13 @@ const publicPath = paths.servedPath; const shouldUseRelativeAssetPaths = publicPath === './'; // Source maps are resource heavy and can cause out of memory issue for large source files. const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; +// Some apps do not need the benefits of saving a web request, so not inlining the chunk +// makes for a smoother build process. +const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false'; // `publicUrl` is just like `publicPath`, but we will provide it to our app // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz. -const publicUrl = '.'; +const publicUrl = publicPath.slice(0, -1); // Get environment variables to inject into our app. const env = getClientEnvironment(publicUrl); @@ -33,88 +47,228 @@ if (env.stringified['process.env'].NODE_ENV !== '"production"') { throw new Error('Production builds must have NODE_ENV=production.'); } -// Note: defined here because it will be used more than once. -const cssFilename = 'css/index.css'; +// Check if TypeScript is setup +const useTypeScript = fs.existsSync(paths.appTsConfig); -// ExtractTextPlugin expects the build output to be flat. -// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27) -// However, our output is structured with css, js and media folders. -// To have this structure working with relative paths, we have to use custom options. -const extractTextPluginOptions = shouldUseRelativeAssetPaths - ? // Making sure that the publicPath goes back to to build folder. - { publicPath: Array(cssFilename.split('/').length).join('../') } - : {}; +// style files regexes +const cssRegex = /\.css$/; +const cssModuleRegex = /\.module\.css$/; +const sassRegex = /\.(scss|sass)$/; +const sassModuleRegex = /\.module\.(scss|sass)$/; + +// common function to get style loaders +const getStyleLoaders = (cssOptions, preProcessor) => { + const loaders = [ + { + loader: MiniCssExtractPlugin.loader, + options: Object.assign( + {}, + shouldUseRelativeAssetPaths ? { publicPath: '../../' } : undefined + ), + }, + { + loader: require.resolve('css-loader'), + options: cssOptions, + }, + { + // Options for PostCSS as we reference these options twice + // Adds vendor prefixing based on your specified browser support in + // package.json + loader: require.resolve('postcss-loader'), + options: { + // Necessary for external CSS imports to work + // https://github.com/facebook/create-react-app/issues/2677 + ident: 'postcss', + plugins: () => [ + require('postcss-flexbugs-fixes'), + require('postcss-preset-env')({ + autoprefixer: { + flexbox: 'no-2009', + }, + stage: 3, + }), + ], + sourceMap: shouldUseSourceMap, + }, + }, + ]; + if (preProcessor) { + loaders.push({ + loader: require.resolve(preProcessor), + options: { + sourceMap: shouldUseSourceMap, + }, + }); + } + return loaders; +}; // This is the production configuration. // It compiles slowly and is focused on producing a fast and minimal bundle. // The development configuration is different and lives in a separate file. module.exports = { + mode: 'production', // Don't attempt to continue if there are any errors. bail: true, // We generate sourcemaps in production. This is slow but gives good results. // You can exclude the *.map files from the build during deployment. devtool: shouldUseSourceMap ? 'source-map' : false, // In production, we only want to load the app code. - entry: [paths.appDemoIndexJs], // CRL: library index file instead of app index + entry: [paths.appDemoIndexJs], output: { - // CRL: Updated whole block with library specific info - path: paths.appDemoBuild, + // The build folder. + path: paths.appDemo, + // Generated JS file names (with nested folders). + // There will be one main bundle, and one file per asynchronous chunk. + // We don't currently advertise code splitting but Webpack supports it. filename: 'index.js', - libraryTarget: 'umd', - library: 'SimpleKeyboard' + chunkFilename: 'index.[chunkhash:8].chunk.js', + // We inferred the "public path" (such as / or /my-project) from homepage. + publicPath: publicPath, + // Point sourcemap entries to original disk location (format as URL on Windows) + devtoolModuleFilenameTemplate: info => + path + .relative(paths.appSrcDemo, info.absoluteResourcePath) + .replace(/\\/g, '/'), + }, + optimization: { + minimizer: [ + new TerserPlugin({ + terserOptions: { + parse: { + // we want terser to parse ecma 8 code. However, we don't want it + // to apply any minfication steps that turns valid ecma 5 code + // into invalid ecma 5 code. This is why the 'compress' and 'output' + // sections only apply transformations that are ecma 5 safe + // https://github.com/facebook/create-react-app/pull/4234 + ecma: 8, + }, + compress: { + ecma: 5, + warnings: false, + // Disabled because of an issue with Uglify breaking seemingly valid code: + // https://github.com/facebook/create-react-app/issues/2376 + // Pending further investigation: + // https://github.com/mishoo/UglifyJS2/issues/2011 + comparisons: false, + // Disabled because of an issue with Terser breaking valid code: + // https://github.com/facebook/create-react-app/issues/5250 + // Pending futher investigation: + // https://github.com/terser-js/terser/issues/120 + inline: 2, + }, + mangle: { + safari10: true, + }, + output: { + ecma: 5, + comments: false, + // Turned on because emoji and regex is not minified properly using default + // https://github.com/facebook/create-react-app/issues/2488 + ascii_only: true, + }, + }, + // Use multi-process parallel running to improve the build speed + // Default number of concurrent runs: os.cpus().length - 1 + parallel: true, + // Enable file caching + cache: true, + sourceMap: shouldUseSourceMap, + }), + new OptimizeCSSAssetsPlugin({ + cssProcessorOptions: { + parser: safePostCssParser, + map: shouldUseSourceMap + ? { + // `inline: false` forces the sourcemap to be output into a + // separate file + inline: false, + // `annotation: true` appends the sourceMappingURL to the end of + // the css file, helping the browser find the sourcemap + annotation: true, + } + : false, + }, + }), + ], + // Automatically split vendor and commons + // https://twitter.com/wSokra/status/969633336732905474 + // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366 + splitChunks: { + /*chunks: 'all', + name: false,*/ + cacheGroups: { + default: false, + } + }, + // Keep the runtime chunk seperated to enable long term caching + // https://twitter.com/wSokra/status/969679223278505985 + runtimeChunk: false, }, resolve: { // This allows you to set a fallback for where Webpack should look for modules. // We placed these paths second because we want `node_modules` to "win" // if there are any conflicts. This matches Node resolution mechanism. - // https://github.com/facebookincubator/create-react-app/issues/253 - modules: ['node_modules', paths.appNodeModules].concat( + // https://github.com/facebook/create-react-app/issues/253 + modules: ['node_modules'].concat( // It is guaranteed to exist because we tweak it in `env.js` process.env.NODE_PATH.split(path.delimiter).filter(Boolean) ), // These are the reasonable defaults supported by the Node ecosystem. // We also include JSX as a common component filename extension to support // some tools, although we do not recommend using it, see: - // https://github.com/facebookincubator/create-react-app/issues/290 + // https://github.com/facebook/create-react-app/issues/290 // `web` extension prefixes have been added for better support // for React Native Web. - extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'], + extensions: paths.moduleFileExtensions + .map(ext => `.${ext}`) + .filter(ext => useTypeScript || !ext.includes('ts')), alias: { // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ - 'react-native': 'react-native-web' + 'react-native': 'react-native-web', }, plugins: [ + // Adds support for installing with Plug'n'Play, leading to faster installs and adding + // guards against forgotten dependencies and such. + PnpWebpackPlugin, // Prevents users from importing files from outside of src/ (or node_modules/). // This often causes confusion because we only process files within src/ with babel. // To fix this, we prevent you from importing files out of src/ -- if you'd like to, // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. - new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]) - ] + new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), + ], + }, + resolveLoader: { + plugins: [ + // Also related to Plug'n'Play, but this time it tells Webpack to load its loaders + // from the current package. + PnpWebpackPlugin.moduleLoader(module), + ], }, module: { strictExportPresence: true, rules: [ - // TODO: Disable require.ensure as it's not a standard language feature. - // We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176. - // { parser: { requireEnsure: false } }, + // Disable require.ensure as it's not a standard language feature. + { parser: { requireEnsure: false } }, // First, run the linter. // It's important to do this before Babel processes the JS. { - test: /\.(js|jsx|mjs)$/, + test: /\.(js|mjs|jsx)$/, enforce: 'pre', use: [ { options: { - formatter: eslintFormatter, - eslintPath: require.resolve('eslint') + formatter: require.resolve('react-dev-utils/eslintFormatter'), + eslintPath: require.resolve('eslint'), + }, - loader: require.resolve('eslint-loader') - } + loader: require.resolve('eslint-loader'), + }, ], - include: paths.appDemoSrc // CRL: updated with library src folder + include: paths.appSrcDemo, }, { // "oneOf" will traverse all following loaders until one will @@ -128,76 +282,129 @@ module.exports = { loader: require.resolve('url-loader'), options: { limit: 10000, - name: 'media/[name].[ext]' - } + name: 'static/media/[name].[hash:8].[ext]', + }, }, - // Process JS with Babel. + // Process application JS with Babel. + // The preset includes JSX, Flow, TypeScript and some ESnext features. { - test: /\.(js|jsx|mjs)$/, - include: [paths.appLibSrc, paths.appDemoSrc], // CRL: updated with library src folder + test: /\.(js|mjs|jsx|ts|tsx)$/, + include: paths.appSrcDemo, + loader: require.resolve('babel-loader'), options: { - compact: true - } + customize: require.resolve( + 'babel-preset-react-app/webpack-overrides' + ), + + plugins: [ + [ + require.resolve('babel-plugin-named-asset-import'), + { + loaderMap: { + svg: { + ReactComponent: '@svgr/webpack?-prettier,-svgo![path]', + }, + }, + }, + ], + ], + cacheDirectory: true, + // Save disk space when time isn't as important + cacheCompression: true, + compact: true, + }, + }, + // Process any JS outside of the app with Babel. + // Unlike the application JS, we only compile the standard ES features. + { + test: /\.(js|mjs)$/, + exclude: /@babel(?:\/|\\{1,2})runtime/, + loader: require.resolve('babel-loader'), + options: { + babelrc: false, + configFile: false, + compact: false, + presets: [ + [ + require.resolve('babel-preset-react-app/dependencies'), + { helpers: true }, + ], + ], + cacheDirectory: true, + // Save disk space when time isn't as important + cacheCompression: true, + + // If an error happens in a package, it's possible to be + // because it was compiled. Thus, we don't want the browser + // debugger to show the original code. Instead, the code + // being evaluated would be much more helpful. + sourceMaps: false, + }, }, - // The notation here is somewhat confusing. // "postcss" loader applies autoprefixer to our CSS. // "css" loader resolves paths in CSS and adds assets as dependencies. - // "style" loader normally turns CSS into JS modules injecting