simple-keyboard 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,201 +1,201 @@
1
- import { KeyboardInput } from "./../interfaces";
2
- import { KeyboardOptions, UtilitiesParams } from "../interfaces";
3
- /**
4
- * Utility Service
5
- */
6
- declare class Utilities {
7
- getOptions: () => KeyboardOptions;
8
- getCaretPosition: () => number | null;
9
- getCaretPositionEnd: () => number | null;
10
- dispatch: any;
11
- maxLengthReached: boolean;
12
- /**
13
- * Creates an instance of the Utility service
14
- */
15
- constructor({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch, }: UtilitiesParams);
16
- /**
17
- * Retrieve button type
18
- *
19
- * @param {string} button The button's layout name
20
- * @return {string} The button type
21
- */
22
- getButtonType(button: string): string;
23
- /**
24
- * Adds default classes to a given button
25
- *
26
- * @param {string} button The button's layout name
27
- * @return {string} The classes to be added to the button
28
- */
29
- getButtonClass(button: string): string;
30
- /**
31
- * Default button display labels
32
- */
33
- getDefaultDiplay(): {
34
- "{bksp}": string;
35
- "{backspace}": string;
36
- "{enter}": string;
37
- "{shift}": string;
38
- "{shiftleft}": string;
39
- "{shiftright}": string;
40
- "{alt}": string;
41
- "{s}": string;
42
- "{tab}": string;
43
- "{lock}": string;
44
- "{capslock}": string;
45
- "{accept}": string;
46
- "{space}": string;
47
- "{//}": string;
48
- "{esc}": string;
49
- "{escape}": string;
50
- "{f1}": string;
51
- "{f2}": string;
52
- "{f3}": string;
53
- "{f4}": string;
54
- "{f5}": string;
55
- "{f6}": string;
56
- "{f7}": string;
57
- "{f8}": string;
58
- "{f9}": string;
59
- "{f10}": string;
60
- "{f11}": string;
61
- "{f12}": string;
62
- "{numpaddivide}": string;
63
- "{numlock}": string;
64
- "{arrowup}": string;
65
- "{arrowleft}": string;
66
- "{arrowdown}": string;
67
- "{arrowright}": string;
68
- "{prtscr}": string;
69
- "{scrolllock}": string;
70
- "{pause}": string;
71
- "{insert}": string;
72
- "{home}": string;
73
- "{pageup}": string;
74
- "{delete}": string;
75
- "{forwarddelete}": string;
76
- "{end}": string;
77
- "{pagedown}": string;
78
- "{numpadmultiply}": string;
79
- "{numpadsubtract}": string;
80
- "{numpadadd}": string;
81
- "{numpadenter}": string;
82
- "{period}": string;
83
- "{numpaddecimal}": string;
84
- "{numpad0}": string;
85
- "{numpad1}": string;
86
- "{numpad2}": string;
87
- "{numpad3}": string;
88
- "{numpad4}": string;
89
- "{numpad5}": string;
90
- "{numpad6}": string;
91
- "{numpad7}": string;
92
- "{numpad8}": string;
93
- "{numpad9}": string;
94
- };
95
- /**
96
- * Returns the display (label) name for a given button
97
- *
98
- * @param {string} button The button's layout name
99
- * @param {object} display The provided display option
100
- * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
101
- */
102
- getButtonDisplayName(button: string, display: KeyboardOptions["display"], mergeDisplay?: boolean): string;
103
- /**
104
- * Returns the updated input resulting from clicking a given button
105
- *
106
- * @param {string} button The button's layout name
107
- * @param {string} input The input string
108
- * @param {number} caretPos The cursor's current position
109
- * @param {number} caretPosEnd The cursor's current end position
110
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
111
- */
112
- getUpdatedInput(button: string, input: string, caretPos: any, caretPosEnd?: any, moveCaret?: boolean): string;
113
- /**
114
- * Moves the cursor position by a given amount
115
- *
116
- * @param {number} length Represents by how many characters the input should be moved
117
- * @param {boolean} minus Whether the cursor should be moved to the left or not.
118
- */
119
- updateCaretPos(length: number, minus?: boolean): void;
120
- /**
121
- * Action method of updateCaretPos
122
- *
123
- * @param {number} length Represents by how many characters the input should be moved
124
- * @param {boolean} minus Whether the cursor should be moved to the left or not.
125
- */
126
- updateCaretPosAction(length: number, minus?: boolean): number | null;
127
- /**
128
- * Adds a string to the input at a given position
129
- *
130
- * @param {string} source The source input
131
- * @param {string} str The string to add
132
- * @param {number} position The (cursor) position where the string should be added
133
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
134
- */
135
- addStringAt(source: string, str: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
136
- /**
137
- * Check whether the button is a standard button
138
- */
139
- isStandardButton: (button: string) => boolean | "";
140
- /**
141
- * Removes an amount of characters before a given position
142
- *
143
- * @param {string} source The source input
144
- * @param {number} position The (cursor) position from where the characters should be removed
145
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
146
- */
147
- removeAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
148
- /**
149
- * Removes an amount of characters after a given position
150
- *
151
- * @param {string} source The source input
152
- * @param {number} position The (cursor) position from where the characters should be removed
153
- */
154
- removeForwardsAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
155
- /**
156
- * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.
157
- *
158
- * @param {object} inputObj
159
- * @param {string} updatedInput
160
- */
161
- handleMaxLength(inputObj: KeyboardInput, updatedInput: string): boolean | undefined;
162
- /**
163
- * Gets the current value of maxLengthReached
164
- */
165
- isMaxLengthReached(): boolean;
166
- /**
167
- * Determines whether a touch device is being used
168
- */
169
- isTouchDevice(): number | true;
170
- /**
171
- * Determines whether pointer events are supported
172
- */
173
- pointerEventsSupported(): boolean;
174
- /**
175
- * Bind all methods in a given class
176
- */
177
- static bindMethods(myClass: any, instance: any): void;
178
- /**
179
- * Transforms an arbitrary string to camelCase
180
- *
181
- * @param {string} str The string to transform.
182
- */
183
- camelCase(str: string): string;
184
- /**
185
- * Split array into chunks
186
- */
187
- chunkArray<T>(arr: T[], size: number): T[][];
188
- /**
189
- * Escape regex input
190
- */
191
- escapeRegex(str: string): string;
192
- /**
193
- * Calculate caret position offset when using rtl option
194
- */
195
- getRtlOffset(index: number, input: string): number;
196
- /**
197
- * Reusable empty function
198
- */
199
- static noop: () => void;
200
- }
201
- export default Utilities;
1
+ import { KeyboardInput } from "./../interfaces";
2
+ import { KeyboardOptions, UtilitiesParams } from "../interfaces";
3
+ /**
4
+ * Utility Service
5
+ */
6
+ declare class Utilities {
7
+ getOptions: () => KeyboardOptions;
8
+ getCaretPosition: () => number | null;
9
+ getCaretPositionEnd: () => number | null;
10
+ dispatch: any;
11
+ maxLengthReached: boolean;
12
+ /**
13
+ * Creates an instance of the Utility service
14
+ */
15
+ constructor({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch, }: UtilitiesParams);
16
+ /**
17
+ * Retrieve button type
18
+ *
19
+ * @param {string} button The button's layout name
20
+ * @return {string} The button type
21
+ */
22
+ getButtonType(button: string): string;
23
+ /**
24
+ * Adds default classes to a given button
25
+ *
26
+ * @param {string} button The button's layout name
27
+ * @return {string} The classes to be added to the button
28
+ */
29
+ getButtonClass(button: string): string;
30
+ /**
31
+ * Default button display labels
32
+ */
33
+ getDefaultDiplay(): {
34
+ "{bksp}": string;
35
+ "{backspace}": string;
36
+ "{enter}": string;
37
+ "{shift}": string;
38
+ "{shiftleft}": string;
39
+ "{shiftright}": string;
40
+ "{alt}": string;
41
+ "{s}": string;
42
+ "{tab}": string;
43
+ "{lock}": string;
44
+ "{capslock}": string;
45
+ "{accept}": string;
46
+ "{space}": string;
47
+ "{//}": string;
48
+ "{esc}": string;
49
+ "{escape}": string;
50
+ "{f1}": string;
51
+ "{f2}": string;
52
+ "{f3}": string;
53
+ "{f4}": string;
54
+ "{f5}": string;
55
+ "{f6}": string;
56
+ "{f7}": string;
57
+ "{f8}": string;
58
+ "{f9}": string;
59
+ "{f10}": string;
60
+ "{f11}": string;
61
+ "{f12}": string;
62
+ "{numpaddivide}": string;
63
+ "{numlock}": string;
64
+ "{arrowup}": string;
65
+ "{arrowleft}": string;
66
+ "{arrowdown}": string;
67
+ "{arrowright}": string;
68
+ "{prtscr}": string;
69
+ "{scrolllock}": string;
70
+ "{pause}": string;
71
+ "{insert}": string;
72
+ "{home}": string;
73
+ "{pageup}": string;
74
+ "{delete}": string;
75
+ "{forwarddelete}": string;
76
+ "{end}": string;
77
+ "{pagedown}": string;
78
+ "{numpadmultiply}": string;
79
+ "{numpadsubtract}": string;
80
+ "{numpadadd}": string;
81
+ "{numpadenter}": string;
82
+ "{period}": string;
83
+ "{numpaddecimal}": string;
84
+ "{numpad0}": string;
85
+ "{numpad1}": string;
86
+ "{numpad2}": string;
87
+ "{numpad3}": string;
88
+ "{numpad4}": string;
89
+ "{numpad5}": string;
90
+ "{numpad6}": string;
91
+ "{numpad7}": string;
92
+ "{numpad8}": string;
93
+ "{numpad9}": string;
94
+ };
95
+ /**
96
+ * Returns the display (label) name for a given button
97
+ *
98
+ * @param {string} button The button's layout name
99
+ * @param {object} display The provided display option
100
+ * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
101
+ */
102
+ getButtonDisplayName(button: string, display: KeyboardOptions["display"], mergeDisplay?: boolean): string;
103
+ /**
104
+ * Returns the updated input resulting from clicking a given button
105
+ *
106
+ * @param {string} button The button's layout name
107
+ * @param {string} input The input string
108
+ * @param {number} caretPos The cursor's current position
109
+ * @param {number} caretPosEnd The cursor's current end position
110
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
111
+ */
112
+ getUpdatedInput(button: string, input: string, caretPos: any, caretPosEnd?: any, moveCaret?: boolean): string;
113
+ /**
114
+ * Moves the cursor position by a given amount
115
+ *
116
+ * @param {number} length Represents by how many characters the input should be moved
117
+ * @param {boolean} minus Whether the cursor should be moved to the left or not.
118
+ */
119
+ updateCaretPos(length: number, minus?: boolean): void;
120
+ /**
121
+ * Action method of updateCaretPos
122
+ *
123
+ * @param {number} length Represents by how many characters the input should be moved
124
+ * @param {boolean} minus Whether the cursor should be moved to the left or not.
125
+ */
126
+ updateCaretPosAction(length: number, minus?: boolean): number | null;
127
+ /**
128
+ * Adds a string to the input at a given position
129
+ *
130
+ * @param {string} source The source input
131
+ * @param {string} str The string to add
132
+ * @param {number} position The (cursor) position where the string should be added
133
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
134
+ */
135
+ addStringAt(source: string, str: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
136
+ /**
137
+ * Check whether the button is a standard button
138
+ */
139
+ isStandardButton: (button: string) => boolean | "";
140
+ /**
141
+ * Removes an amount of characters before a given position
142
+ *
143
+ * @param {string} source The source input
144
+ * @param {number} position The (cursor) position from where the characters should be removed
145
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
146
+ */
147
+ removeAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
148
+ /**
149
+ * Removes an amount of characters after a given position
150
+ *
151
+ * @param {string} source The source input
152
+ * @param {number} position The (cursor) position from where the characters should be removed
153
+ */
154
+ removeForwardsAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
155
+ /**
156
+ * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.
157
+ *
158
+ * @param {object} inputObj
159
+ * @param {string} updatedInput
160
+ */
161
+ handleMaxLength(inputObj: KeyboardInput, updatedInput: string): boolean | undefined;
162
+ /**
163
+ * Gets the current value of maxLengthReached
164
+ */
165
+ isMaxLengthReached(): boolean;
166
+ /**
167
+ * Determines whether a touch device is being used
168
+ */
169
+ isTouchDevice(): number | true;
170
+ /**
171
+ * Determines whether pointer events are supported
172
+ */
173
+ pointerEventsSupported(): boolean;
174
+ /**
175
+ * Bind all methods in a given class
176
+ */
177
+ static bindMethods(myClass: any, instance: any): void;
178
+ /**
179
+ * Transforms an arbitrary string to camelCase
180
+ *
181
+ * @param {string} str The string to transform.
182
+ */
183
+ camelCase(str: string): string;
184
+ /**
185
+ * Split array into chunks
186
+ */
187
+ chunkArray<T>(arr: T[], size: number): T[][];
188
+ /**
189
+ * Escape regex input
190
+ */
191
+ escapeRegex(str: string): string;
192
+ /**
193
+ * Calculate caret position offset when using rtl option
194
+ */
195
+ getRtlOffset(index: number, input: string): number;
196
+ /**
197
+ * Reusable empty function
198
+ */
199
+ static noop: () => void;
200
+ }
201
+ export default Utilities;
package/package.json CHANGED
@@ -1,114 +1,114 @@
1
- {
2
- "name": "simple-keyboard",
3
- "version": "3.7.0",
4
- "description": "On-screen Javascript Virtual Keyboard",
5
- "main": "build/index.js",
6
- "scripts": {
7
- "start": "webpack serve --config webpack.config.demo.js",
8
- "build": "webpack && npm run build-modern && npm run build-modern-esm && tsc",
9
- "build-modern": "webpack --config webpack.config.modern.js",
10
- "build-modern-esm": "webpack --config webpack.config.modern_esm.js",
11
- "test": "jest --silent",
12
- "coverage": "npm run test -- --coverage",
13
- "prepare": "npm run build",
14
- "trypublish": "npm publish || true"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/hodgef/simple-keyboard"
19
- },
20
- "author": "Francisco Hodge <hello@franciscohodge.com> (https://github.com/hodgef)",
21
- "bugs": {
22
- "url": "https://github.com/hodgef/simple-keyboard/issues"
23
- },
24
- "homepage": "https://virtual-keyboard.js.org/",
25
- "keywords": [
26
- "javascript",
27
- "es6",
28
- "digital",
29
- "keyboard",
30
- "onscreen",
31
- "virtual",
32
- "screen-keyboard",
33
- "component",
34
- "virtual-keyboard",
35
- "touchscreen",
36
- "touch-screen",
37
- "kiosk",
38
- "osk",
39
- "js"
40
- ],
41
- "license": "MIT",
42
- "devDependencies": {
43
- "@babel/cli": "^7.22.10",
44
- "@babel/core": "^7.22.10",
45
- "@babel/plugin-proposal-class-properties": "^7.17.12",
46
- "@babel/plugin-transform-typescript": "^7.22.10",
47
- "@babel/polyfill": "^7.12.1",
48
- "@babel/preset-env": "^7.22.10",
49
- "@types/jest": "^27.5.0",
50
- "@typescript-eslint/eslint-plugin": "^5.60.1",
51
- "@typescript-eslint/parser": "^5.62.0",
52
- "autoprefixer": "^10.4.15",
53
- "babel-eslint": "^10.1.0",
54
- "babel-loader": "^9.1.3",
55
- "babel-preset-minify": "^0.5.2",
56
- "core-js": "^3.32.0",
57
- "css-loader": "^6.8.1",
58
- "css-minimizer-webpack-plugin": "^5.0.1",
59
- "eslint": "^8.47.0",
60
- "file-loader": "^6.2.0",
61
- "html-webpack-plugin": "^5.5.3",
62
- "jest": "^26.6.3",
63
- "mini-css-extract-plugin": "^2.7.6",
64
- "postcss": "^8.4.28",
65
- "postcss-loader": "^7.3.3",
66
- "style-loader": "^3.3.3",
67
- "terser-webpack-plugin": "^5.3.9",
68
- "typescript": "^4.9.5",
69
- "url-loader": "^4.1.1",
70
- "webpack": "^5.88.2",
71
- "webpack-cli": "^5.1.3",
72
- "webpack-dev-server": "4.15.0"
73
- },
74
- "jest": {
75
- "roots": [
76
- "<rootDir>/src"
77
- ],
78
- "collectCoverageFrom": [
79
- "src/**/*.{js,jsx,ts,tsx}",
80
- "!src/**/*.d.ts",
81
- "!src/lib/index.js",
82
- "!src/lib/polyfills.js",
83
- "!src/demo/**",
84
- "!src/utils/**",
85
- "!src/**/*.d.ts",
86
- "!**/tests/**"
87
- ],
88
- "testMatch": [
89
- "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
90
- "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
91
- ],
92
- "transformIgnorePatterns": [
93
- "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
94
- "^.+\\.module\\.(css|sass|scss)$"
95
- ],
96
- "modulePaths": [],
97
- "moduleNameMapper": {
98
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/scripts/testMock.js",
99
- "\\.(css|less)$": "<rootDir>/scripts/testMock.js"
100
- },
101
- "moduleFileExtensions": [
102
- "web.js",
103
- "js",
104
- "web.ts",
105
- "ts",
106
- "web.tsx",
107
- "tsx",
108
- "json",
109
- "web.jsx",
110
- "jsx",
111
- "node"
112
- ]
113
- }
114
- }
1
+ {
2
+ "name": "simple-keyboard",
3
+ "version": "3.7.1",
4
+ "description": "On-screen Javascript Virtual Keyboard",
5
+ "main": "build/index.js",
6
+ "scripts": {
7
+ "start": "webpack serve --config webpack.config.demo.js",
8
+ "build": "webpack && npm run build-modern && npm run build-modern-esm && tsc",
9
+ "build-modern": "webpack --config webpack.config.modern.js",
10
+ "build-modern-esm": "webpack --config webpack.config.modern_esm.js",
11
+ "test": "jest --silent",
12
+ "coverage": "npm run test -- --coverage",
13
+ "prepare": "npm run build",
14
+ "trypublish": "npm publish || true"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/hodgef/simple-keyboard"
19
+ },
20
+ "author": "Francisco Hodge <hello@franciscohodge.com> (https://github.com/hodgef)",
21
+ "bugs": {
22
+ "url": "https://github.com/hodgef/simple-keyboard/issues"
23
+ },
24
+ "homepage": "https://virtual-keyboard.js.org/",
25
+ "keywords": [
26
+ "javascript",
27
+ "es6",
28
+ "digital",
29
+ "keyboard",
30
+ "onscreen",
31
+ "virtual",
32
+ "screen-keyboard",
33
+ "component",
34
+ "virtual-keyboard",
35
+ "touchscreen",
36
+ "touch-screen",
37
+ "kiosk",
38
+ "osk",
39
+ "js"
40
+ ],
41
+ "license": "MIT",
42
+ "devDependencies": {
43
+ "@babel/cli": "^7.22.10",
44
+ "@babel/core": "^7.22.10",
45
+ "@babel/plugin-proposal-class-properties": "^7.17.12",
46
+ "@babel/plugin-transform-typescript": "^7.22.10",
47
+ "@babel/polyfill": "^7.12.1",
48
+ "@babel/preset-env": "^7.22.10",
49
+ "@types/jest": "^27.5.0",
50
+ "@typescript-eslint/eslint-plugin": "^5.60.1",
51
+ "@typescript-eslint/parser": "^5.62.0",
52
+ "autoprefixer": "^10.4.15",
53
+ "babel-eslint": "^10.1.0",
54
+ "babel-loader": "^9.1.3",
55
+ "babel-preset-minify": "^0.5.2",
56
+ "core-js": "^3.32.0",
57
+ "css-loader": "^6.8.1",
58
+ "css-minimizer-webpack-plugin": "^5.0.1",
59
+ "eslint": "^8.47.0",
60
+ "file-loader": "^6.2.0",
61
+ "html-webpack-plugin": "^5.5.3",
62
+ "jest": "^26.6.3",
63
+ "mini-css-extract-plugin": "^2.7.6",
64
+ "postcss": "^8.4.28",
65
+ "postcss-loader": "^7.3.3",
66
+ "style-loader": "^3.3.3",
67
+ "terser-webpack-plugin": "^5.3.9",
68
+ "typescript": "^4.9.5",
69
+ "url-loader": "^4.1.1",
70
+ "webpack": "^5.88.2",
71
+ "webpack-cli": "^5.1.3",
72
+ "webpack-dev-server": "4.15.0"
73
+ },
74
+ "jest": {
75
+ "roots": [
76
+ "<rootDir>/src"
77
+ ],
78
+ "collectCoverageFrom": [
79
+ "src/**/*.{js,jsx,ts,tsx}",
80
+ "!src/**/*.d.ts",
81
+ "!src/lib/index.js",
82
+ "!src/lib/polyfills.js",
83
+ "!src/demo/**",
84
+ "!src/utils/**",
85
+ "!src/**/*.d.ts",
86
+ "!**/tests/**"
87
+ ],
88
+ "testMatch": [
89
+ "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
90
+ "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
91
+ ],
92
+ "transformIgnorePatterns": [
93
+ "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
94
+ "^.+\\.module\\.(css|sass|scss)$"
95
+ ],
96
+ "modulePaths": [],
97
+ "moduleNameMapper": {
98
+ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/scripts/testMock.js",
99
+ "\\.(css|less)$": "<rootDir>/scripts/testMock.js"
100
+ },
101
+ "moduleFileExtensions": [
102
+ "web.js",
103
+ "js",
104
+ "web.ts",
105
+ "ts",
106
+ "web.tsx",
107
+ "tsx",
108
+ "json",
109
+ "web.jsx",
110
+ "jsx",
111
+ "node"
112
+ ]
113
+ }
114
+ }