react-simple-keyboard 3.4.251 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +13 -0
- package/README.md +75 -75
- package/build/components/Keyboard.d.ts +5 -5
- package/build/components/KeyboardModern.d.ts +5 -5
- package/build/css/index.css +2 -2
- package/build/index.d.ts +5 -5
- package/build/index.js +3 -3
- package/build/index.modern.d.ts +4 -4
- package/build/index.modern.js +3 -3
- package/build/index.modern.js.map +1 -1
- package/build/interfaces.d.ts +742 -732
- package/build/services/Utilities.d.ts +52 -51
- package/package.json +130 -130
- package/webpack.config.modern.js +95 -95
package/build/interfaces.d.ts
CHANGED
|
@@ -5,735 +5,745 @@ export interface KeyboardReactInterface extends SimpleKeyboard {
|
|
|
5
5
|
keyboardRef?: (r: any) => void;
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
|
-
// Generated by dts-bundle v0.7.3
|
|
9
|
-
/**
|
|
10
|
-
* Root class for simple-keyboard.
|
|
11
|
-
* This class:
|
|
12
|
-
* - Parses the options
|
|
13
|
-
* - Renders the rows and buttons
|
|
14
|
-
* - Handles button functionality
|
|
15
|
-
*/
|
|
16
|
-
export interface SimpleKeyboard {
|
|
17
|
-
input: KeyboardInput;
|
|
18
|
-
options: KeyboardOptions;
|
|
19
|
-
utilities: any;
|
|
20
|
-
caretPosition: number | null;
|
|
21
|
-
caretPositionEnd: number | null;
|
|
22
|
-
keyboardDOM: KeyboardElement;
|
|
23
|
-
keyboardPluginClasses: string;
|
|
24
|
-
keyboardDOMClass: string;
|
|
25
|
-
buttonElements: KeyboardButtonElements;
|
|
26
|
-
currentInstanceName: string;
|
|
27
|
-
allKeyboardInstances: {
|
|
28
|
-
[key: string]: SimpleKeyboard;
|
|
29
|
-
};
|
|
30
|
-
keyboardInstanceNames: string[];
|
|
31
|
-
isFirstKeyboardInstance: boolean;
|
|
32
|
-
physicalKeyboard: PhysicalKeyboard;
|
|
33
|
-
modules: {
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
};
|
|
36
|
-
activeButtonClass: string;
|
|
37
|
-
holdInteractionTimeout: number;
|
|
38
|
-
holdTimeout: number;
|
|
39
|
-
isMouseHold: boolean;
|
|
40
|
-
initialized: boolean;
|
|
41
|
-
candidateBox: CandidateBox | null;
|
|
42
|
-
keyboardRowsDOM: KeyboardElement;
|
|
43
|
-
defaultName: string;
|
|
44
|
-
activeInputElement: HTMLInputElement | HTMLTextAreaElement | null;
|
|
45
|
-
/**
|
|
46
|
-
* Creates an instance of SimpleKeyboard
|
|
47
|
-
* @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.
|
|
48
|
-
*/
|
|
49
|
-
constructor: (selectorOrOptions?: string | HTMLDivElement | KeyboardOptions, keyboardOptions?: KeyboardOptions) => any
|
|
50
|
-
/**
|
|
51
|
-
* parseParams
|
|
52
|
-
*/
|
|
53
|
-
handleParams: (selectorOrOptions?: string | HTMLDivElement | KeyboardOptions, keyboardOptions?: KeyboardOptions) => {
|
|
54
|
-
keyboardDOMClass: string;
|
|
55
|
-
keyboardDOM: KeyboardElement;
|
|
56
|
-
options: Partial<KeyboardOptions | undefined>;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Getters
|
|
60
|
-
*/
|
|
61
|
-
getOptions: () => KeyboardOptions;
|
|
62
|
-
getCaretPosition: () => number | null;
|
|
63
|
-
getCaretPositionEnd: () => number | null;
|
|
64
|
-
/**
|
|
65
|
-
* Changes the internal caret position
|
|
66
|
-
* @param {number} position The caret's start position
|
|
67
|
-
* @param {number} positionEnd The caret's end position
|
|
68
|
-
*/
|
|
69
|
-
setCaretPosition(position: number | null, endPosition?: number | null): void;
|
|
70
|
-
/**
|
|
71
|
-
* Retrieve the candidates for a given input
|
|
72
|
-
* @param input The input string to check
|
|
73
|
-
*/
|
|
74
|
-
getInputCandidates(input: string): {
|
|
75
|
-
candidateKey: string;
|
|
76
|
-
candidateValue: string;
|
|
77
|
-
} | Record<string, never>;
|
|
78
|
-
/**
|
|
79
|
-
* Shows a suggestion box with a list of candidate words
|
|
80
|
-
* @param candidates The chosen candidates string as defined in the layoutCandidates option
|
|
81
|
-
* @param targetElement The element next to which the candidates box will be shown
|
|
82
|
-
*/
|
|
83
|
-
showCandidatesBox(candidateKey: string, candidateValue: string, targetElement: KeyboardElement): void;
|
|
84
|
-
/**
|
|
85
|
-
* Handles clicks made to keyboard buttons
|
|
86
|
-
* @param {string} button The button's layout name.
|
|
87
|
-
*/
|
|
88
|
-
handleButtonClicked(button: string, e?: KeyboardHandlerEvent): void;
|
|
89
|
-
/**
|
|
90
|
-
* Get mouse hold state
|
|
91
|
-
*/
|
|
92
|
-
getMouseHold(): boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Mark mouse hold state as set
|
|
95
|
-
*/
|
|
96
|
-
setMouseHold(value: boolean): void;
|
|
97
|
-
/**
|
|
98
|
-
* Handles button mousedown
|
|
99
|
-
*/
|
|
100
|
-
handleButtonMouseDown(button: string, e: KeyboardHandlerEvent): void;
|
|
101
|
-
/**
|
|
102
|
-
* Handles button mouseup
|
|
103
|
-
*/
|
|
104
|
-
handleButtonMouseUp(button?: string, e?: KeyboardHandlerEvent): void;
|
|
105
|
-
/**
|
|
106
|
-
* Handles container mousedown
|
|
107
|
-
*/
|
|
108
|
-
handleKeyboardContainerMouseDown(e: KeyboardHandlerEvent): void;
|
|
109
|
-
/**
|
|
110
|
-
* Handles button hold
|
|
111
|
-
*/
|
|
112
|
-
handleButtonHold(button: string): void;
|
|
113
|
-
/**
|
|
114
|
-
* Send a command to all simple-keyboard instances (if you have several instances).
|
|
115
|
-
*/
|
|
116
|
-
syncInstanceInputs(): void;
|
|
117
|
-
/**
|
|
118
|
-
* Clear the keyboard’s input.
|
|
119
|
-
* @param {string} [inputName] optional - the internal input to select
|
|
120
|
-
*/
|
|
121
|
-
clearInput(inputName?: string): void;
|
|
122
|
-
/**
|
|
123
|
-
* Get the keyboard’s input (You can also get it from the onChange prop).
|
|
124
|
-
* @param {string} [inputName] optional - the internal input to select
|
|
125
|
-
*/
|
|
126
|
-
getInput(inputName?: string, skipSync?: boolean): string;
|
|
127
|
-
/**
|
|
128
|
-
* Get all simple-keyboard inputs
|
|
129
|
-
*/
|
|
130
|
-
getAllInputs(): KeyboardInput;
|
|
131
|
-
/**
|
|
132
|
-
* Set the keyboard’s input.
|
|
133
|
-
* @param {string} input the input value
|
|
134
|
-
* @param {string} inputName optional - the internal input to select
|
|
135
|
-
*/
|
|
136
|
-
setInput(input: string, inputName?: string, skipSync?: boolean): void;
|
|
137
|
-
/**
|
|
138
|
-
* Replace the input object (`keyboard.input`)
|
|
139
|
-
* @param {object} inputObj The input object
|
|
140
|
-
*/
|
|
141
|
-
replaceInput(inputObj: KeyboardInput): void;
|
|
142
|
-
/**
|
|
143
|
-
* Set new option or modify existing ones after initialization.
|
|
144
|
-
* @param {object} options The options to set
|
|
145
|
-
*/
|
|
146
|
-
setOptions(options?: {}): void;
|
|
147
|
-
/**
|
|
148
|
-
* Detecting changes to non-function options
|
|
149
|
-
* This allows us to ascertain whether a button re-render is needed
|
|
150
|
-
*/
|
|
151
|
-
changedOptions(newOptions: Partial<KeyboardOptions>): string[];
|
|
152
|
-
/**
|
|
153
|
-
* Executing actions depending on changed options
|
|
154
|
-
* @param {object} options The options to set
|
|
155
|
-
*/
|
|
156
|
-
onSetOptions(changedOptions?: string[]): void;
|
|
157
|
-
/**
|
|
158
|
-
* Remove all keyboard rows and reset keyboard values.
|
|
159
|
-
* Used internally between re-renders.
|
|
160
|
-
*/
|
|
161
|
-
resetRows(): void;
|
|
162
|
-
/**
|
|
163
|
-
* Send a command to all simple-keyboard instances at once (if you have multiple instances).
|
|
164
|
-
* @param {function(instance: object, key: string)} callback Function to run on every instance
|
|
165
|
-
*/
|
|
166
|
-
dispatch(callback: (instance: SimpleKeyboard, key?: string) => void): void;
|
|
167
|
-
/**
|
|
168
|
-
* Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.
|
|
169
|
-
* @param {string} buttons List of buttons to select (separated by a space).
|
|
170
|
-
* @param {string} className Classes to give to the selected buttons (separated by space).
|
|
171
|
-
*/
|
|
172
|
-
addButtonTheme(buttons: string, className: string): void;
|
|
173
|
-
/**
|
|
174
|
-
* Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.
|
|
175
|
-
* @param {string} buttons List of buttons to select (separated by a space).
|
|
176
|
-
* @param {string} className Classes to give to the selected buttons (separated by space).
|
|
177
|
-
*/
|
|
178
|
-
removeButtonTheme(buttons: string, className: string): void;
|
|
179
|
-
/**
|
|
180
|
-
* Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.
|
|
181
|
-
* @param {string} button The button layout name to select
|
|
182
|
-
*/
|
|
183
|
-
getButtonElement(button: string): KeyboardElement | KeyboardElement[] | undefined;
|
|
184
|
-
/**
|
|
185
|
-
* This handles the "inputPattern" option
|
|
186
|
-
* by checking if the provided inputPattern passes
|
|
187
|
-
*/
|
|
188
|
-
inputPatternIsValid(inputVal: string): boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Handles simple-keyboard event listeners
|
|
191
|
-
*/
|
|
192
|
-
setEventListeners(): void;
|
|
193
|
-
/**
|
|
194
|
-
* Event Handler: KeyUp
|
|
195
|
-
*/
|
|
196
|
-
handleKeyUp(event: KeyboardHandlerEvent): void;
|
|
197
|
-
/**
|
|
198
|
-
* Event Handler: KeyDown
|
|
199
|
-
*/
|
|
200
|
-
handleKeyDown(event: KeyboardHandlerEvent): void;
|
|
201
|
-
/**
|
|
202
|
-
* Event Handler: MouseUp
|
|
203
|
-
*/
|
|
204
|
-
handleMouseUp(event: KeyboardHandlerEvent): void;
|
|
205
|
-
/**
|
|
206
|
-
* Event Handler: TouchEnd
|
|
207
|
-
*/
|
|
208
|
-
handleTouchEnd(event: KeyboardHandlerEvent): void;
|
|
209
|
-
/**
|
|
210
|
-
* Event Handler: Select
|
|
211
|
-
*/
|
|
212
|
-
handleSelect(event: KeyboardHandlerEvent): void;
|
|
213
|
-
/**
|
|
214
|
-
* Event Handler: SelectionChange
|
|
215
|
-
*/
|
|
216
|
-
handleSelectionChange(event: KeyboardHandlerEvent): void;
|
|
217
|
-
/**
|
|
218
|
-
* Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered
|
|
219
|
-
*/
|
|
220
|
-
caretEventHandler(event: KeyboardHandlerEvent): void;
|
|
221
|
-
/**
|
|
222
|
-
* Execute an operation on each button
|
|
223
|
-
*/
|
|
224
|
-
recurseButtons(fn: any): void;
|
|
225
|
-
/**
|
|
226
|
-
* Destroy keyboard listeners and DOM elements
|
|
227
|
-
*/
|
|
228
|
-
destroy(): void;
|
|
229
|
-
/**
|
|
230
|
-
* Process buttonTheme option
|
|
231
|
-
*/
|
|
232
|
-
getButtonThemeClasses(button: string): string[];
|
|
233
|
-
/**
|
|
234
|
-
* Process buttonAttributes option
|
|
235
|
-
*/
|
|
236
|
-
setDOMButtonAttributes(button: string, callback: any): void;
|
|
237
|
-
onTouchDeviceDetected(): void;
|
|
238
|
-
/**
|
|
239
|
-
* Disabling contextual window for hg-button
|
|
240
|
-
*/
|
|
241
|
-
disableContextualWindow(): void;
|
|
242
|
-
/**
|
|
243
|
-
* Process autoTouchEvents option
|
|
244
|
-
*/
|
|
245
|
-
processAutoTouchEvents(): void;
|
|
246
|
-
/**
|
|
247
|
-
* Executes the callback function once simple-keyboard is rendered for the first time (on initialization).
|
|
248
|
-
*/
|
|
249
|
-
onInit(): void;
|
|
250
|
-
/**
|
|
251
|
-
* Executes the callback function before a simple-keyboard render.
|
|
252
|
-
*/
|
|
253
|
-
beforeFirstRender(): void;
|
|
254
|
-
/**
|
|
255
|
-
* Executes the callback function before a simple-keyboard render.
|
|
256
|
-
*/
|
|
257
|
-
beforeRender(): void;
|
|
258
|
-
/**
|
|
259
|
-
* Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).
|
|
260
|
-
*/
|
|
261
|
-
onRender(): void;
|
|
262
|
-
/**
|
|
263
|
-
* Executes the callback function once all modules have been loaded
|
|
264
|
-
*/
|
|
265
|
-
onModulesLoaded(): void;
|
|
266
|
-
/**
|
|
267
|
-
* Register module
|
|
268
|
-
*/
|
|
269
|
-
registerModule: (name: string, initCallback: any) => void;
|
|
270
|
-
/**
|
|
271
|
-
* Load modules
|
|
272
|
-
*/
|
|
273
|
-
loadModules(): void;
|
|
274
|
-
/**
|
|
275
|
-
* Get module prop
|
|
276
|
-
*/
|
|
277
|
-
getModuleProp(name: string, prop: string): any;
|
|
278
|
-
/**
|
|
279
|
-
* getModulesList
|
|
280
|
-
*/
|
|
281
|
-
getModulesList(): string[];
|
|
282
|
-
/**
|
|
283
|
-
* Parse Row DOM containers
|
|
284
|
-
*/
|
|
285
|
-
parseRowDOMContainers(rowDOM: HTMLDivElement, rowIndex: number, containerStartIndexes: number[], containerEndIndexes: number[]): HTMLDivElement;
|
|
286
|
-
/**
|
|
287
|
-
* getKeyboardClassString
|
|
288
|
-
*/
|
|
289
|
-
getKeyboardClassString: (...baseDOMClasses: any[]) => string;
|
|
290
|
-
/**
|
|
291
|
-
* Renders rows and buttons as per options
|
|
292
|
-
*/
|
|
293
|
-
render(): void;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Physical Keyboard Service
|
|
297
|
-
*/
|
|
298
|
-
export interface PhysicalKeyboard {
|
|
299
|
-
getOptions: () => KeyboardOptions;
|
|
300
|
-
dispatch: any;
|
|
301
|
-
/**
|
|
302
|
-
* Creates an instance of the PhysicalKeyboard service
|
|
303
|
-
*/
|
|
304
|
-
constructor: ({ dispatch, getOptions }: PhysicalKeyboardParams) => any
|
|
305
|
-
handleHighlightKeyDown(event: KeyboardEvent): void;
|
|
306
|
-
handleHighlightKeyUp(event: KeyboardEvent): void;
|
|
307
|
-
/**
|
|
308
|
-
* Transforms a KeyboardEvent's "key.code" string into a simple-keyboard layout format
|
|
309
|
-
* @param {object} event The KeyboardEvent
|
|
310
|
-
*/
|
|
311
|
-
getSimpleKeyboardLayoutKey(event: KeyboardEvent): string;
|
|
312
|
-
/**
|
|
313
|
-
* Retrieve key from keyCode
|
|
314
|
-
*/
|
|
315
|
-
keyCodeToKey(keyCode: number): string | undefined;
|
|
316
|
-
}
|
|
317
|
-
export interface KeyboardLayoutObject {
|
|
318
|
-
[key: string]: string[];
|
|
319
|
-
}
|
|
320
|
-
export type KeyboardButtonTheme = {
|
|
321
|
-
class: string;
|
|
322
|
-
buttons: string;
|
|
323
|
-
} | null;
|
|
324
|
-
export interface KeyboardButtonAttributes {
|
|
325
|
-
attribute: string;
|
|
326
|
-
value: string;
|
|
327
|
-
buttons: string;
|
|
328
|
-
}
|
|
329
|
-
export interface KeyboardInput {
|
|
330
|
-
[key: string]: string;
|
|
331
|
-
}
|
|
332
|
-
export type CandidateBoxParams = {
|
|
333
|
-
utilities: Utilities;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
export type
|
|
349
|
-
export
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
*
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
*
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
*
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
* @
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
*
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
"{
|
|
586
|
-
"{
|
|
587
|
-
"{
|
|
588
|
-
"{
|
|
589
|
-
"{
|
|
590
|
-
"{
|
|
591
|
-
"{
|
|
592
|
-
"{
|
|
593
|
-
"{
|
|
594
|
-
"{
|
|
595
|
-
"{
|
|
596
|
-
"{
|
|
597
|
-
"{
|
|
598
|
-
"{
|
|
599
|
-
"{
|
|
600
|
-
"{
|
|
601
|
-
"{
|
|
602
|
-
"{
|
|
603
|
-
"{
|
|
604
|
-
"{
|
|
605
|
-
"{
|
|
606
|
-
"{
|
|
607
|
-
"{
|
|
608
|
-
"{
|
|
609
|
-
"{
|
|
610
|
-
"{
|
|
611
|
-
"{
|
|
612
|
-
"{
|
|
613
|
-
"{
|
|
614
|
-
"{
|
|
615
|
-
"{
|
|
616
|
-
"{
|
|
617
|
-
"{
|
|
618
|
-
"{
|
|
619
|
-
"{
|
|
620
|
-
"{
|
|
621
|
-
"{
|
|
622
|
-
"{
|
|
623
|
-
"{
|
|
624
|
-
"{
|
|
625
|
-
"{
|
|
626
|
-
"{
|
|
627
|
-
"{
|
|
628
|
-
"{
|
|
629
|
-
"{
|
|
630
|
-
"{
|
|
631
|
-
"{
|
|
632
|
-
"{
|
|
633
|
-
"{
|
|
634
|
-
"{
|
|
635
|
-
"{
|
|
636
|
-
"{
|
|
637
|
-
"{
|
|
638
|
-
"{
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
* @param {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
*
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
* @param {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
* @param {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
* @param {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
*
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
*
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
* @param {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
* @param {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
*
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
*
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
8
|
+
// Generated by dts-bundle v0.7.3
|
|
9
|
+
/**
|
|
10
|
+
* Root class for simple-keyboard.
|
|
11
|
+
* This class:
|
|
12
|
+
* - Parses the options
|
|
13
|
+
* - Renders the rows and buttons
|
|
14
|
+
* - Handles button functionality
|
|
15
|
+
*/
|
|
16
|
+
export interface SimpleKeyboard {
|
|
17
|
+
input: KeyboardInput;
|
|
18
|
+
options: KeyboardOptions;
|
|
19
|
+
utilities: any;
|
|
20
|
+
caretPosition: number | null;
|
|
21
|
+
caretPositionEnd: number | null;
|
|
22
|
+
keyboardDOM: KeyboardElement;
|
|
23
|
+
keyboardPluginClasses: string;
|
|
24
|
+
keyboardDOMClass: string;
|
|
25
|
+
buttonElements: KeyboardButtonElements;
|
|
26
|
+
currentInstanceName: string;
|
|
27
|
+
allKeyboardInstances: {
|
|
28
|
+
[key: string]: SimpleKeyboard;
|
|
29
|
+
};
|
|
30
|
+
keyboardInstanceNames: string[];
|
|
31
|
+
isFirstKeyboardInstance: boolean;
|
|
32
|
+
physicalKeyboard: PhysicalKeyboard;
|
|
33
|
+
modules: {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
};
|
|
36
|
+
activeButtonClass: string;
|
|
37
|
+
holdInteractionTimeout: number;
|
|
38
|
+
holdTimeout: number;
|
|
39
|
+
isMouseHold: boolean;
|
|
40
|
+
initialized: boolean;
|
|
41
|
+
candidateBox: CandidateBox | null;
|
|
42
|
+
keyboardRowsDOM: KeyboardElement;
|
|
43
|
+
defaultName: string;
|
|
44
|
+
activeInputElement: HTMLInputElement | HTMLTextAreaElement | null;
|
|
45
|
+
/**
|
|
46
|
+
* Creates an instance of SimpleKeyboard
|
|
47
|
+
* @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.
|
|
48
|
+
*/
|
|
49
|
+
constructor: (selectorOrOptions?: string | HTMLDivElement | KeyboardOptions, keyboardOptions?: KeyboardOptions) => any
|
|
50
|
+
/**
|
|
51
|
+
* parseParams
|
|
52
|
+
*/
|
|
53
|
+
handleParams: (selectorOrOptions?: string | HTMLDivElement | KeyboardOptions, keyboardOptions?: KeyboardOptions) => {
|
|
54
|
+
keyboardDOMClass: string;
|
|
55
|
+
keyboardDOM: KeyboardElement;
|
|
56
|
+
options: Partial<KeyboardOptions | undefined>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Getters
|
|
60
|
+
*/
|
|
61
|
+
getOptions: () => KeyboardOptions;
|
|
62
|
+
getCaretPosition: () => number | null;
|
|
63
|
+
getCaretPositionEnd: () => number | null;
|
|
64
|
+
/**
|
|
65
|
+
* Changes the internal caret position
|
|
66
|
+
* @param {number} position The caret's start position
|
|
67
|
+
* @param {number} positionEnd The caret's end position
|
|
68
|
+
*/
|
|
69
|
+
setCaretPosition(position: number | null, endPosition?: number | null): void;
|
|
70
|
+
/**
|
|
71
|
+
* Retrieve the candidates for a given input
|
|
72
|
+
* @param input The input string to check
|
|
73
|
+
*/
|
|
74
|
+
getInputCandidates(input: string): {
|
|
75
|
+
candidateKey: string;
|
|
76
|
+
candidateValue: string;
|
|
77
|
+
} | Record<string, never>;
|
|
78
|
+
/**
|
|
79
|
+
* Shows a suggestion box with a list of candidate words
|
|
80
|
+
* @param candidates The chosen candidates string as defined in the layoutCandidates option
|
|
81
|
+
* @param targetElement The element next to which the candidates box will be shown
|
|
82
|
+
*/
|
|
83
|
+
showCandidatesBox(candidateKey: string, candidateValue: string, targetElement: KeyboardElement): void;
|
|
84
|
+
/**
|
|
85
|
+
* Handles clicks made to keyboard buttons
|
|
86
|
+
* @param {string} button The button's layout name.
|
|
87
|
+
*/
|
|
88
|
+
handleButtonClicked(button: string, e?: KeyboardHandlerEvent): void;
|
|
89
|
+
/**
|
|
90
|
+
* Get mouse hold state
|
|
91
|
+
*/
|
|
92
|
+
getMouseHold(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Mark mouse hold state as set
|
|
95
|
+
*/
|
|
96
|
+
setMouseHold(value: boolean): void;
|
|
97
|
+
/**
|
|
98
|
+
* Handles button mousedown
|
|
99
|
+
*/
|
|
100
|
+
handleButtonMouseDown(button: string, e: KeyboardHandlerEvent): void;
|
|
101
|
+
/**
|
|
102
|
+
* Handles button mouseup
|
|
103
|
+
*/
|
|
104
|
+
handleButtonMouseUp(button?: string, e?: KeyboardHandlerEvent): void;
|
|
105
|
+
/**
|
|
106
|
+
* Handles container mousedown
|
|
107
|
+
*/
|
|
108
|
+
handleKeyboardContainerMouseDown(e: KeyboardHandlerEvent): void;
|
|
109
|
+
/**
|
|
110
|
+
* Handles button hold
|
|
111
|
+
*/
|
|
112
|
+
handleButtonHold(button: string): void;
|
|
113
|
+
/**
|
|
114
|
+
* Send a command to all simple-keyboard instances (if you have several instances).
|
|
115
|
+
*/
|
|
116
|
+
syncInstanceInputs(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Clear the keyboard’s input.
|
|
119
|
+
* @param {string} [inputName] optional - the internal input to select
|
|
120
|
+
*/
|
|
121
|
+
clearInput(inputName?: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* Get the keyboard’s input (You can also get it from the onChange prop).
|
|
124
|
+
* @param {string} [inputName] optional - the internal input to select
|
|
125
|
+
*/
|
|
126
|
+
getInput(inputName?: string, skipSync?: boolean): string;
|
|
127
|
+
/**
|
|
128
|
+
* Get all simple-keyboard inputs
|
|
129
|
+
*/
|
|
130
|
+
getAllInputs(): KeyboardInput;
|
|
131
|
+
/**
|
|
132
|
+
* Set the keyboard’s input.
|
|
133
|
+
* @param {string} input the input value
|
|
134
|
+
* @param {string} inputName optional - the internal input to select
|
|
135
|
+
*/
|
|
136
|
+
setInput(input: string, inputName?: string, skipSync?: boolean): void;
|
|
137
|
+
/**
|
|
138
|
+
* Replace the input object (`keyboard.input`)
|
|
139
|
+
* @param {object} inputObj The input object
|
|
140
|
+
*/
|
|
141
|
+
replaceInput(inputObj: KeyboardInput): void;
|
|
142
|
+
/**
|
|
143
|
+
* Set new option or modify existing ones after initialization.
|
|
144
|
+
* @param {object} options The options to set
|
|
145
|
+
*/
|
|
146
|
+
setOptions(options?: {}): void;
|
|
147
|
+
/**
|
|
148
|
+
* Detecting changes to non-function options
|
|
149
|
+
* This allows us to ascertain whether a button re-render is needed
|
|
150
|
+
*/
|
|
151
|
+
changedOptions(newOptions: Partial<KeyboardOptions>): string[];
|
|
152
|
+
/**
|
|
153
|
+
* Executing actions depending on changed options
|
|
154
|
+
* @param {object} options The options to set
|
|
155
|
+
*/
|
|
156
|
+
onSetOptions(changedOptions?: string[]): void;
|
|
157
|
+
/**
|
|
158
|
+
* Remove all keyboard rows and reset keyboard values.
|
|
159
|
+
* Used internally between re-renders.
|
|
160
|
+
*/
|
|
161
|
+
resetRows(): void;
|
|
162
|
+
/**
|
|
163
|
+
* Send a command to all simple-keyboard instances at once (if you have multiple instances).
|
|
164
|
+
* @param {function(instance: object, key: string)} callback Function to run on every instance
|
|
165
|
+
*/
|
|
166
|
+
dispatch(callback: (instance: SimpleKeyboard, key?: string) => void): void;
|
|
167
|
+
/**
|
|
168
|
+
* Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.
|
|
169
|
+
* @param {string} buttons List of buttons to select (separated by a space).
|
|
170
|
+
* @param {string} className Classes to give to the selected buttons (separated by space).
|
|
171
|
+
*/
|
|
172
|
+
addButtonTheme(buttons: string, className: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.
|
|
175
|
+
* @param {string} buttons List of buttons to select (separated by a space).
|
|
176
|
+
* @param {string} className Classes to give to the selected buttons (separated by space).
|
|
177
|
+
*/
|
|
178
|
+
removeButtonTheme(buttons: string, className: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.
|
|
181
|
+
* @param {string} button The button layout name to select
|
|
182
|
+
*/
|
|
183
|
+
getButtonElement(button: string): KeyboardElement | KeyboardElement[] | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* This handles the "inputPattern" option
|
|
186
|
+
* by checking if the provided inputPattern passes
|
|
187
|
+
*/
|
|
188
|
+
inputPatternIsValid(inputVal: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Handles simple-keyboard event listeners
|
|
191
|
+
*/
|
|
192
|
+
setEventListeners(): void;
|
|
193
|
+
/**
|
|
194
|
+
* Event Handler: KeyUp
|
|
195
|
+
*/
|
|
196
|
+
handleKeyUp(event: KeyboardHandlerEvent): void;
|
|
197
|
+
/**
|
|
198
|
+
* Event Handler: KeyDown
|
|
199
|
+
*/
|
|
200
|
+
handleKeyDown(event: KeyboardHandlerEvent): void;
|
|
201
|
+
/**
|
|
202
|
+
* Event Handler: MouseUp
|
|
203
|
+
*/
|
|
204
|
+
handleMouseUp(event: KeyboardHandlerEvent): void;
|
|
205
|
+
/**
|
|
206
|
+
* Event Handler: TouchEnd
|
|
207
|
+
*/
|
|
208
|
+
handleTouchEnd(event: KeyboardHandlerEvent): void;
|
|
209
|
+
/**
|
|
210
|
+
* Event Handler: Select
|
|
211
|
+
*/
|
|
212
|
+
handleSelect(event: KeyboardHandlerEvent): void;
|
|
213
|
+
/**
|
|
214
|
+
* Event Handler: SelectionChange
|
|
215
|
+
*/
|
|
216
|
+
handleSelectionChange(event: KeyboardHandlerEvent): void;
|
|
217
|
+
/**
|
|
218
|
+
* Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered
|
|
219
|
+
*/
|
|
220
|
+
caretEventHandler(event: KeyboardHandlerEvent): void;
|
|
221
|
+
/**
|
|
222
|
+
* Execute an operation on each button
|
|
223
|
+
*/
|
|
224
|
+
recurseButtons(fn: any): void;
|
|
225
|
+
/**
|
|
226
|
+
* Destroy keyboard listeners and DOM elements
|
|
227
|
+
*/
|
|
228
|
+
destroy(): void;
|
|
229
|
+
/**
|
|
230
|
+
* Process buttonTheme option
|
|
231
|
+
*/
|
|
232
|
+
getButtonThemeClasses(button: string): string[];
|
|
233
|
+
/**
|
|
234
|
+
* Process buttonAttributes option
|
|
235
|
+
*/
|
|
236
|
+
setDOMButtonAttributes(button: string, callback: any): void;
|
|
237
|
+
onTouchDeviceDetected(): void;
|
|
238
|
+
/**
|
|
239
|
+
* Disabling contextual window for hg-button
|
|
240
|
+
*/
|
|
241
|
+
disableContextualWindow(): void;
|
|
242
|
+
/**
|
|
243
|
+
* Process autoTouchEvents option
|
|
244
|
+
*/
|
|
245
|
+
processAutoTouchEvents(): void;
|
|
246
|
+
/**
|
|
247
|
+
* Executes the callback function once simple-keyboard is rendered for the first time (on initialization).
|
|
248
|
+
*/
|
|
249
|
+
onInit(): void;
|
|
250
|
+
/**
|
|
251
|
+
* Executes the callback function before a simple-keyboard render.
|
|
252
|
+
*/
|
|
253
|
+
beforeFirstRender(): void;
|
|
254
|
+
/**
|
|
255
|
+
* Executes the callback function before a simple-keyboard render.
|
|
256
|
+
*/
|
|
257
|
+
beforeRender(): void;
|
|
258
|
+
/**
|
|
259
|
+
* Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).
|
|
260
|
+
*/
|
|
261
|
+
onRender(): void;
|
|
262
|
+
/**
|
|
263
|
+
* Executes the callback function once all modules have been loaded
|
|
264
|
+
*/
|
|
265
|
+
onModulesLoaded(): void;
|
|
266
|
+
/**
|
|
267
|
+
* Register module
|
|
268
|
+
*/
|
|
269
|
+
registerModule: (name: string, initCallback: any) => void;
|
|
270
|
+
/**
|
|
271
|
+
* Load modules
|
|
272
|
+
*/
|
|
273
|
+
loadModules(): void;
|
|
274
|
+
/**
|
|
275
|
+
* Get module prop
|
|
276
|
+
*/
|
|
277
|
+
getModuleProp(name: string, prop: string): any;
|
|
278
|
+
/**
|
|
279
|
+
* getModulesList
|
|
280
|
+
*/
|
|
281
|
+
getModulesList(): string[];
|
|
282
|
+
/**
|
|
283
|
+
* Parse Row DOM containers
|
|
284
|
+
*/
|
|
285
|
+
parseRowDOMContainers(rowDOM: HTMLDivElement, rowIndex: number, containerStartIndexes: number[], containerEndIndexes: number[]): HTMLDivElement;
|
|
286
|
+
/**
|
|
287
|
+
* getKeyboardClassString
|
|
288
|
+
*/
|
|
289
|
+
getKeyboardClassString: (...baseDOMClasses: any[]) => string;
|
|
290
|
+
/**
|
|
291
|
+
* Renders rows and buttons as per options
|
|
292
|
+
*/
|
|
293
|
+
render(): void;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Physical Keyboard Service
|
|
297
|
+
*/
|
|
298
|
+
export interface PhysicalKeyboard {
|
|
299
|
+
getOptions: () => KeyboardOptions;
|
|
300
|
+
dispatch: any;
|
|
301
|
+
/**
|
|
302
|
+
* Creates an instance of the PhysicalKeyboard service
|
|
303
|
+
*/
|
|
304
|
+
constructor: ({ dispatch, getOptions }: PhysicalKeyboardParams) => any
|
|
305
|
+
handleHighlightKeyDown(event: KeyboardEvent): void;
|
|
306
|
+
handleHighlightKeyUp(event: KeyboardEvent): void;
|
|
307
|
+
/**
|
|
308
|
+
* Transforms a KeyboardEvent's "key.code" string into a simple-keyboard layout format
|
|
309
|
+
* @param {object} event The KeyboardEvent
|
|
310
|
+
*/
|
|
311
|
+
getSimpleKeyboardLayoutKey(event: KeyboardEvent): string;
|
|
312
|
+
/**
|
|
313
|
+
* Retrieve key from keyCode
|
|
314
|
+
*/
|
|
315
|
+
keyCodeToKey(keyCode: number): string | undefined;
|
|
316
|
+
}
|
|
317
|
+
export interface KeyboardLayoutObject {
|
|
318
|
+
[key: string]: string[];
|
|
319
|
+
}
|
|
320
|
+
export type KeyboardButtonTheme = {
|
|
321
|
+
class: string;
|
|
322
|
+
buttons: string;
|
|
323
|
+
} | null;
|
|
324
|
+
export interface KeyboardButtonAttributes {
|
|
325
|
+
attribute: string;
|
|
326
|
+
value: string;
|
|
327
|
+
buttons: string;
|
|
328
|
+
}
|
|
329
|
+
export interface KeyboardInput {
|
|
330
|
+
[key: string]: string;
|
|
331
|
+
}
|
|
332
|
+
export type CandidateBoxParams = {
|
|
333
|
+
utilities: Utilities;
|
|
334
|
+
options: KeyboardOptions;
|
|
335
|
+
};
|
|
336
|
+
export type CandidateBoxShowParams = {
|
|
337
|
+
candidateValue: string;
|
|
338
|
+
targetElement: KeyboardElement;
|
|
339
|
+
onSelect: (selectedCandidate: string, e: MouseEvent) => void;
|
|
340
|
+
};
|
|
341
|
+
export type CandidateBoxRenderParams = {
|
|
342
|
+
candidateListPages: string[][];
|
|
343
|
+
targetElement: KeyboardElement;
|
|
344
|
+
pageIndex: number;
|
|
345
|
+
nbPages: number;
|
|
346
|
+
onItemSelected: (selectedCandidate: string, e: MouseEvent) => void;
|
|
347
|
+
};
|
|
348
|
+
export type KeyboardElement = HTMLDivElement | HTMLButtonElement;
|
|
349
|
+
export type KeyboardHandlerEvent = any;
|
|
350
|
+
export interface KeyboardButtonElements {
|
|
351
|
+
[key: string]: KeyboardElement[];
|
|
352
|
+
}
|
|
353
|
+
export interface UtilitiesParams {
|
|
354
|
+
getOptions: () => KeyboardOptions;
|
|
355
|
+
getCaretPosition: () => number | null;
|
|
356
|
+
getCaretPositionEnd: () => number | null;
|
|
357
|
+
dispatch: any;
|
|
358
|
+
}
|
|
359
|
+
export interface PhysicalKeyboardParams {
|
|
360
|
+
getOptions: () => KeyboardOptions;
|
|
361
|
+
dispatch: any;
|
|
362
|
+
}
|
|
363
|
+
export interface KeyboardOptions {
|
|
364
|
+
/**
|
|
365
|
+
* Modify the keyboard layout.
|
|
366
|
+
*/
|
|
367
|
+
layout?: KeyboardLayoutObject;
|
|
368
|
+
/**
|
|
369
|
+
* Specifies which layout should be used.
|
|
370
|
+
*/
|
|
371
|
+
layoutName?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Replaces variable buttons (such as `{bksp}`) with a human-friendly name (e.g.: `backspace`).
|
|
374
|
+
*/
|
|
375
|
+
display?: {
|
|
376
|
+
[button: string]: string;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* By default, when you set the display property, you replace the default one. This setting merges them instead.
|
|
380
|
+
*/
|
|
381
|
+
mergeDisplay?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.
|
|
384
|
+
*/
|
|
385
|
+
theme?: string;
|
|
386
|
+
/**
|
|
387
|
+
* A prop to add your own css classes to one or several buttons.
|
|
388
|
+
*/
|
|
389
|
+
buttonTheme?: KeyboardButtonTheme[];
|
|
390
|
+
/**
|
|
391
|
+
* A prop to add your own attributes to one or several buttons.
|
|
392
|
+
*/
|
|
393
|
+
buttonAttributes?: KeyboardButtonAttributes[];
|
|
394
|
+
/**
|
|
395
|
+
* Runs a `console.log` every time a key is pressed. Displays the buttons pressed and the current input.
|
|
396
|
+
*/
|
|
397
|
+
debug?: boolean;
|
|
398
|
+
/**
|
|
399
|
+
* Specifies whether clicking the "ENTER" button will input a newline (`\n`) or not.
|
|
400
|
+
*/
|
|
401
|
+
newLineOnEnter?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Specifies whether clicking the "TAB" button will input a tab character (`\t`) or not.
|
|
404
|
+
*/
|
|
405
|
+
tabCharOnTab?: boolean;
|
|
406
|
+
/**
|
|
407
|
+
* Allows you to use a single simple-keyboard instance for several inputs.
|
|
408
|
+
*/
|
|
409
|
+
inputName?: string;
|
|
410
|
+
/**
|
|
411
|
+
* `number`: Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.
|
|
412
|
+
*
|
|
413
|
+
* `{ [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.
|
|
414
|
+
*/
|
|
415
|
+
maxLength?: any;
|
|
416
|
+
/**
|
|
417
|
+
* When set to true, this option synchronizes the internal input of every simple-keyboard instance.
|
|
418
|
+
*/
|
|
419
|
+
syncInstanceInputs?: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* Enable highlighting of keys pressed on physical keyboard.
|
|
422
|
+
*/
|
|
423
|
+
physicalKeyboardHighlight?: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Calls handler for a button highlighted by physicalKeyboardHighlight
|
|
426
|
+
* In other words, this calls keyboard.handleButtonClicked(buttonName) on the highlighted button
|
|
427
|
+
*/
|
|
428
|
+
physicalKeyboardHighlightPress?: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Trigger click on a button's element when using physicalKeyboardHighlightPress
|
|
431
|
+
* In other words, this calls button.click() on the highlighted button
|
|
432
|
+
*/
|
|
433
|
+
physicalKeyboardHighlightPressUseClick?: boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.
|
|
436
|
+
*/
|
|
437
|
+
physicalKeyboardHighlightPressUsePointerEvents?: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* Define the text color that the physical keyboard highlighted key should have.
|
|
440
|
+
*/
|
|
441
|
+
physicalKeyboardHighlightTextColor?: string;
|
|
442
|
+
/**
|
|
443
|
+
* Define the background color that the physical keyboard highlighted key should have.
|
|
444
|
+
*/
|
|
445
|
+
physicalKeyboardHighlightBgColor?: string;
|
|
446
|
+
/**
|
|
447
|
+
* Calling preventDefault for the mousedown events keeps the focus on the input.
|
|
448
|
+
*/
|
|
449
|
+
preventMouseDownDefault?: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Calling preventDefault for the mouseup events.
|
|
452
|
+
*/
|
|
453
|
+
preventMouseUpDefault?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.
|
|
456
|
+
*/
|
|
457
|
+
stopMouseDownPropagation?: boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.
|
|
460
|
+
*/
|
|
461
|
+
stopMouseUpPropagation?: boolean;
|
|
462
|
+
/**
|
|
463
|
+
* Render buttons as a button element instead of a div element.
|
|
464
|
+
*/
|
|
465
|
+
useButtonTag?: boolean;
|
|
466
|
+
/**
|
|
467
|
+
* A prop to ensure characters are always be added/removed at the end of the string.
|
|
468
|
+
*/
|
|
469
|
+
disableCaretPositioning?: boolean;
|
|
470
|
+
/**
|
|
471
|
+
* Restrains input(s) change to the defined regular expression pattern.
|
|
472
|
+
*/
|
|
473
|
+
inputPattern?: any;
|
|
474
|
+
/**
|
|
475
|
+
* Instructs simple-keyboard to use touch events instead of click events.
|
|
476
|
+
*/
|
|
477
|
+
useTouchEvents?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Enable useTouchEvents automatically when touch device is detected.
|
|
480
|
+
*/
|
|
481
|
+
autoUseTouchEvents?: boolean;
|
|
482
|
+
/**
|
|
483
|
+
* Opt out of PointerEvents handling, falling back to the prior mouse event logic.
|
|
484
|
+
*/
|
|
485
|
+
useMouseEvents?: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Disable button hold action.
|
|
488
|
+
*/
|
|
489
|
+
disableButtonHold?: boolean;
|
|
490
|
+
/**
|
|
491
|
+
* Adds unicode right-to-left control characters to input return values.
|
|
492
|
+
*/
|
|
493
|
+
rtl?: boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Enable input method editor candidate list support.
|
|
496
|
+
*/
|
|
497
|
+
enableLayoutCandidates?: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Character suggestions to be shown on certain key presses
|
|
500
|
+
*/
|
|
501
|
+
layoutCandidates?: {
|
|
502
|
+
[key: string]: string;
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* Exclude buttons from layout
|
|
506
|
+
*/
|
|
507
|
+
excludeFromLayout?: {
|
|
508
|
+
[key: string]: string[];
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Determines size of layout candidate list
|
|
512
|
+
*/
|
|
513
|
+
layoutCandidatesPageSize?: number;
|
|
514
|
+
/**
|
|
515
|
+
* Determines whether layout candidate match should be case sensitive.
|
|
516
|
+
*/
|
|
517
|
+
layoutCandidatesCaseSensitiveMatch?: boolean;
|
|
518
|
+
/**
|
|
519
|
+
* Disables the automatic normalization for selected layout candidates
|
|
520
|
+
*/
|
|
521
|
+
disableCandidateNormalization?: boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).
|
|
524
|
+
*/
|
|
525
|
+
onRender?: (instance?: SimpleKeyboard) => void;
|
|
526
|
+
/**
|
|
527
|
+
* Executes the callback function once simple-keyboard is rendered for the first time (on initialization).
|
|
528
|
+
*/
|
|
529
|
+
onInit?: (instance?: SimpleKeyboard) => void;
|
|
530
|
+
/**
|
|
531
|
+
* Retrieves the current input
|
|
532
|
+
*/
|
|
533
|
+
onChange?: (input: string, e?: MouseEvent) => any;
|
|
534
|
+
/**
|
|
535
|
+
* Retrieves all inputs
|
|
536
|
+
*/
|
|
537
|
+
onChangeAll?: (inputObj: KeyboardInput, e?: MouseEvent) => any;
|
|
538
|
+
/**
|
|
539
|
+
* Module options can have any format
|
|
540
|
+
*/
|
|
541
|
+
[name: string]: any;
|
|
542
|
+
}
|
|
543
|
+
export interface CandidateBox {
|
|
544
|
+
utilities: Utilities;
|
|
545
|
+
options: KeyboardOptions;
|
|
546
|
+
candidateBoxElement: HTMLDivElement;
|
|
547
|
+
pageIndex: number;
|
|
548
|
+
pageSize: number;
|
|
549
|
+
constructor: ({ utilities, options }: CandidateBoxParams) => any
|
|
550
|
+
destroy(): void;
|
|
551
|
+
show({ candidateValue, targetElement, onSelect, }: CandidateBoxShowParams): void;
|
|
552
|
+
renderPage({ candidateListPages, targetElement, pageIndex, nbPages, onItemSelected, }: CandidateBoxRenderParams): void;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Utility Service
|
|
556
|
+
*/
|
|
557
|
+
export interface Utilities {
|
|
558
|
+
getOptions: () => KeyboardOptions;
|
|
559
|
+
getCaretPosition: () => number | null;
|
|
560
|
+
getCaretPositionEnd: () => number | null;
|
|
561
|
+
dispatch: any;
|
|
562
|
+
maxLengthReached: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Creates an instance of the Utility service
|
|
565
|
+
*/
|
|
566
|
+
constructor: ({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch, }: UtilitiesParams) => any
|
|
567
|
+
/**
|
|
568
|
+
* Retrieve button type
|
|
569
|
+
*
|
|
570
|
+
* @param {string} button The button's layout name
|
|
571
|
+
* @return {string} The button type
|
|
572
|
+
*/
|
|
573
|
+
getButtonType(button: string): string;
|
|
574
|
+
/**
|
|
575
|
+
* Adds default classes to a given button
|
|
576
|
+
*
|
|
577
|
+
* @param {string} button The button's layout name
|
|
578
|
+
* @return {string} The classes to be added to the button
|
|
579
|
+
*/
|
|
580
|
+
getButtonClass(button: string): string;
|
|
581
|
+
/**
|
|
582
|
+
* Default button display labels
|
|
583
|
+
*/
|
|
584
|
+
getDefaultDiplay(): {
|
|
585
|
+
"{bksp}": string;
|
|
586
|
+
"{backspace}": string;
|
|
587
|
+
"{enter}": string;
|
|
588
|
+
"{shift}": string;
|
|
589
|
+
"{shiftleft}": string;
|
|
590
|
+
"{shiftright}": string;
|
|
591
|
+
"{alt}": string;
|
|
592
|
+
"{s}": string;
|
|
593
|
+
"{tab}": string;
|
|
594
|
+
"{lock}": string;
|
|
595
|
+
"{capslock}": string;
|
|
596
|
+
"{accept}": string;
|
|
597
|
+
"{space}": string;
|
|
598
|
+
"{//}": string;
|
|
599
|
+
"{esc}": string;
|
|
600
|
+
"{escape}": string;
|
|
601
|
+
"{f1}": string;
|
|
602
|
+
"{f2}": string;
|
|
603
|
+
"{f3}": string;
|
|
604
|
+
"{f4}": string;
|
|
605
|
+
"{f5}": string;
|
|
606
|
+
"{f6}": string;
|
|
607
|
+
"{f7}": string;
|
|
608
|
+
"{f8}": string;
|
|
609
|
+
"{f9}": string;
|
|
610
|
+
"{f10}": string;
|
|
611
|
+
"{f11}": string;
|
|
612
|
+
"{f12}": string;
|
|
613
|
+
"{numpaddivide}": string;
|
|
614
|
+
"{numlock}": string;
|
|
615
|
+
"{arrowup}": string;
|
|
616
|
+
"{arrowleft}": string;
|
|
617
|
+
"{arrowdown}": string;
|
|
618
|
+
"{arrowright}": string;
|
|
619
|
+
"{prtscr}": string;
|
|
620
|
+
"{scrolllock}": string;
|
|
621
|
+
"{pause}": string;
|
|
622
|
+
"{insert}": string;
|
|
623
|
+
"{home}": string;
|
|
624
|
+
"{pageup}": string;
|
|
625
|
+
"{delete}": string;
|
|
626
|
+
"{forwarddelete}": string;
|
|
627
|
+
"{end}": string;
|
|
628
|
+
"{pagedown}": string;
|
|
629
|
+
"{numpadmultiply}": string;
|
|
630
|
+
"{numpadsubtract}": string;
|
|
631
|
+
"{numpadadd}": string;
|
|
632
|
+
"{numpadenter}": string;
|
|
633
|
+
"{period}": string;
|
|
634
|
+
"{numpaddecimal}": string;
|
|
635
|
+
"{numpad0}": string;
|
|
636
|
+
"{numpad1}": string;
|
|
637
|
+
"{numpad2}": string;
|
|
638
|
+
"{numpad3}": string;
|
|
639
|
+
"{numpad4}": string;
|
|
640
|
+
"{numpad5}": string;
|
|
641
|
+
"{numpad6}": string;
|
|
642
|
+
"{numpad7}": string;
|
|
643
|
+
"{numpad8}": string;
|
|
644
|
+
"{numpad9}": string;
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Returns the display (label) name for a given button
|
|
648
|
+
*
|
|
649
|
+
* @param {string} button The button's layout name
|
|
650
|
+
* @param {object} display The provided display option
|
|
651
|
+
* @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
|
|
652
|
+
*/
|
|
653
|
+
getButtonDisplayName(button: string, display: KeyboardOptions["display"], mergeDisplay: boolean): string;
|
|
654
|
+
/**
|
|
655
|
+
* Returns the updated input resulting from clicking a given button
|
|
656
|
+
*
|
|
657
|
+
* @param {string} button The button's layout name
|
|
658
|
+
* @param {string} input The input string
|
|
659
|
+
* @param {number} caretPos The cursor's current position
|
|
660
|
+
* @param {number} caretPosEnd The cursor's current end position
|
|
661
|
+
* @param {boolean} moveCaret Whether to update simple-keyboard's cursor
|
|
662
|
+
*/
|
|
663
|
+
getUpdatedInput(button: string, input: string, caretPos: number, caretPosEnd?: number, moveCaret?: boolean): string;
|
|
664
|
+
/**
|
|
665
|
+
* Moves the cursor position by a given amount
|
|
666
|
+
*
|
|
667
|
+
* @param {number} length Represents by how many characters the input should be moved
|
|
668
|
+
* @param {boolean} minus Whether the cursor should be moved to the left or not.
|
|
669
|
+
*/
|
|
670
|
+
updateCaretPos(length: number, minus?: boolean): void;
|
|
671
|
+
/**
|
|
672
|
+
* Action method of updateCaretPos
|
|
673
|
+
*
|
|
674
|
+
* @param {number} length Represents by how many characters the input should be moved
|
|
675
|
+
* @param {boolean} minus Whether the cursor should be moved to the left or not.
|
|
676
|
+
*/
|
|
677
|
+
updateCaretPosAction(length: number, minus?: boolean): number | null;
|
|
678
|
+
/**
|
|
679
|
+
* Adds a string to the input at a given position
|
|
680
|
+
*
|
|
681
|
+
* @param {string} source The source input
|
|
682
|
+
* @param {string} str The string to add
|
|
683
|
+
* @param {number} position The (cursor) position where the string should be added
|
|
684
|
+
* @param {boolean} moveCaret Whether to update simple-keyboard's cursor
|
|
685
|
+
*/
|
|
686
|
+
addStringAt(source: string, str: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
|
|
687
|
+
/**
|
|
688
|
+
* Check whether the button is a standard button
|
|
689
|
+
*/
|
|
690
|
+
isStandardButton: (button: string) => boolean | "";
|
|
691
|
+
/**
|
|
692
|
+
* Removes an amount of characters before a given position
|
|
693
|
+
*
|
|
694
|
+
* @param {string} source The source input
|
|
695
|
+
* @param {number} position The (cursor) position from where the characters should be removed
|
|
696
|
+
* @param {boolean} moveCaret Whether to update simple-keyboard's cursor
|
|
697
|
+
*/
|
|
698
|
+
removeAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
|
|
699
|
+
/**
|
|
700
|
+
* Removes an amount of characters after a given position
|
|
701
|
+
*
|
|
702
|
+
* @param {string} source The source input
|
|
703
|
+
* @param {number} position The (cursor) position from where the characters should be removed
|
|
704
|
+
*/
|
|
705
|
+
removeForwardsAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
|
|
706
|
+
/**
|
|
707
|
+
* Determines whether the maxLength has been reached. This function is called when the maxLength option it set.
|
|
708
|
+
*
|
|
709
|
+
* @param {object} inputObj
|
|
710
|
+
* @param {string} updatedInput
|
|
711
|
+
*/
|
|
712
|
+
handleMaxLength(inputObj: KeyboardInput, updatedInput: string): boolean | undefined;
|
|
713
|
+
/**
|
|
714
|
+
* Gets the current value of maxLengthReached
|
|
715
|
+
*/
|
|
716
|
+
isMaxLengthReached(): boolean;
|
|
717
|
+
/**
|
|
718
|
+
* Determines whether a touch device is being used
|
|
719
|
+
*/
|
|
720
|
+
isTouchDevice(): number | true;
|
|
721
|
+
/**
|
|
722
|
+
* Determines whether pointer events are supported
|
|
723
|
+
*/
|
|
724
|
+
pointerEventsSupported(): boolean;
|
|
725
|
+
/**
|
|
726
|
+
* Bind all methods in a given class
|
|
727
|
+
*/
|
|
728
|
+
/**
|
|
729
|
+
* Transforms an arbitrary string to camelCase
|
|
730
|
+
*
|
|
731
|
+
* @param {string} str The string to transform.
|
|
732
|
+
*/
|
|
733
|
+
camelCase(str: string): string;
|
|
734
|
+
/**
|
|
735
|
+
* Split array into chunks
|
|
736
|
+
*/
|
|
737
|
+
chunkArray<T>(arr: T[], size: number): T[][];
|
|
738
|
+
/**
|
|
739
|
+
* Escape regex input
|
|
740
|
+
*/
|
|
741
|
+
escapeRegex(str: string): string;
|
|
742
|
+
/**
|
|
743
|
+
* Calculate caret position offset when using rtl option
|
|
744
|
+
*/
|
|
745
|
+
getRtlOffset(index: number, input: string): number;
|
|
746
|
+
/**
|
|
747
|
+
* Reusable empty function
|
|
748
|
+
*/
|
|
749
|
+
}
|