From e60574d56d19be5bab194dc20aed56c7dc76ad28 Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Wed, 28 Nov 2018 08:52:58 -0500 Subject: [PATCH] Build update --- build/css/index.css | 2 +- build/css/index.css.map | 2 +- build/index.d.ts | 183 ++++++++++++++++++++++++++++++++++++++++ build/index.js | 2 +- 4 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 build/index.d.ts diff --git a/build/css/index.css b/build/css/index.css index 305c478e..1387b77c 100644 --- a/build/css/index.css +++ b/build/css/index.css @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v2.11.5 + * simple-keyboard v2.11.6 * https://github.com/hodgef/simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef) diff --git a/build/css/index.css.map b/build/css/index.css.map index ff84f328..aac95d2d 100644 --- a/build/css/index.css.map +++ b/build/css/index.css.map @@ -1 +1 @@ -{"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.11.5\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 +{"version":3,"sources":["index.css","C:/Users/FRAHO/workspace/_tests/simple-keyboard/src/lib/components/C:/Users/FRAHO/workspace/_tests/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.11.6\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.d.ts b/build/index.d.ts new file mode 100644 index 00000000..71b347b6 --- /dev/null +++ b/build/index.d.ts @@ -0,0 +1,183 @@ +declare module 'simple-keyboard' { + interface KeyboardLayoutObject { + default: string[]; + shift?: string[]; + } + + interface KeyboardButtonTheme { + class: string; + buttons: string; + } + + interface KeyboardOptions { + /** + * Modify the keyboard layout. + */ + layout?: KeyboardLayoutObject; + + /** + * Specifies which layout should be used. + */ + layoutName?: string; + + /** + * Replaces variable buttons (such as `{bksp}`) with a human-friendly name (e.g.: `backspace`). + */ + display?: { [button: string]: string }; + + /** + * By default, when you set the display property, you replace the default one. This setting merges them instead. + */ + mergeDisplay?: boolean; + + /** + * A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space. + */ + theme?: string; + + /** + * A prop to add your own css classes to one or several buttons. + */ + buttonTheme?: KeyboardButtonTheme[]; + + /** + * Runs a `console.log` every time a key is pressed. Displays the buttons pressed and the current input. + */ + debug?: boolean; + + /** + * Specifies whether clicking the "ENTER" button will input a newline (`\n`) or not. + */ + newLineOnEnter?: boolean; + + /** + * Specifies whether clicking the "TAB" button will input a tab character (`\t`) or not. + */ + tabCharOnTab?: boolean; + + /** + * Allows you to use a single simple-keyboard instance for several inputs. + */ + inputName?: string; + + /** + * `number`: Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute. + * + * `{ [inputName: string]: number }`: Restrains simple-keyboard’s individual inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute. + */ + maxLength?: + | number + | { + [inputName: string]: number; + }; + + /** + * When set to true, this option synchronizes the internal input of every simple-keyboard instance. + */ + syncInstanceInputs?: boolean; + + /** + * Enable highlighting of keys pressed on physical keyboard. + */ + physicalKeyboardHighlight?: boolean; + + /** + * Calling preventDefault for the mousedown events keeps the focus on the input. + */ + preventMouseDownDefault?: boolean; + + /** + * Define the text color that the physical keyboard highlighted key should have. + */ + physicalKeyboardHighlightTextColor?: string; + + /** + * Define the background color that the physical keyboard highlighted key should have. + */ + physicalKeyboardHighlightBgColor?: string; + + /** + * Executes the callback function on key press. Returns button layout name (i.e.: "{shift}"). + */ + onKeyPress?: (button: string) => string; + + /** + * Executes the callback function on input change. Returns the current input's string. + */ + onChange?: (input: string) => string; + + /** + * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts). + */ + onRender?: () => void; + + /** + * Executes the callback function once simple-keyboard is rendered for the first time (on initialization). + */ + onInit?: () => void; + + /** + * Executes the callback function on input change. Returns the input object with all defined inputs. + */ + onChangeAll?: (inputs: any) => any; + } + + export class Keyboard { + constructor(selector: string, options: KeyboardOptions); + constructor(options: KeyboardOptions); + + /** + * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button. + * @param {string} buttons List of buttons to select (separated by a space). + * @param {string} className Classes to give to the selected buttons (separated by space). + */ + addButtonTheme(buttons: string, className: string): void; + + /** + * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme. + * @param {string} buttons List of buttons to select (separated by a space). + * @param {string} className Classes to give to the selected buttons (separated by space). + */ + removeButtonTheme(buttons: string, className: string): void; + + /** + * Clear the keyboard's input. + * + * @param {string} [inputName] optional - the internal input to select + */ + clearInput(inputName?: string): void; + + /** + * Get the keyboard’s input (You can also get it from the onChange prop). + * @param {string} [inputName] optional - the internal input to select + */ + getInput(inputName?: string): void; + + /** + * Set the keyboard’s input. + * @param {string} input the input value + * @param {string} inputName optional - the internal input to select + */ + setInput(input: string, inputName?: string): void; + + /** + * Set new option or modify existing ones after initialization. + * @param {KeyboardOptions} option The option to set + */ + setOptions(options: KeyboardOptions): void; + + /** + * Send a command to all simple-keyboard instances at once (if you have multiple instances). + * @param {function(instance: object, key: string)} callback Function to run on every instance + */ + dispatch(callback: (instance: any, key: string) => void): void; + + /** + * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned. + * @param {string} button The button layout name to select + */ + getButtonElement(button: string): void; + } + + export default Keyboard; +} diff --git a/build/index.js b/build/index.js index 6b357ecb..1c6133be 100644 --- a/build/index.js +++ b/build/index.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v2.11.5 + * simple-keyboard v2.11.6 * https://github.com/hodgef/simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef)