react-simple-keyboard 3.4.252 → 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.
@@ -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
- export type CandidateBoxShowParams = {
336
- candidateValue: string;
337
- targetElement: KeyboardElement;
338
- onSelect: (selectedCandidate: string, e: MouseEvent) => void;
339
- };
340
- export type CandidateBoxRenderParams = {
341
- candidateListPages: string[][];
342
- targetElement: KeyboardElement;
343
- pageIndex: number;
344
- nbPages: number;
345
- onItemSelected: (selectedCandidate: string, e: MouseEvent) => void;
346
- };
347
- export type KeyboardElement = HTMLDivElement | HTMLButtonElement;
348
- export type KeyboardHandlerEvent = any;
349
- export interface KeyboardButtonElements {
350
- [key: string]: KeyboardElement[];
351
- }
352
- export interface UtilitiesParams {
353
- getOptions: () => KeyboardOptions;
354
- getCaretPosition: () => number | null;
355
- getCaretPositionEnd: () => number | null;
356
- dispatch: any;
357
- }
358
- export interface PhysicalKeyboardParams {
359
- getOptions: () => KeyboardOptions;
360
- dispatch: any;
361
- }
362
- export interface KeyboardOptions {
363
- /**
364
- * Modify the keyboard layout.
365
- */
366
- layout?: KeyboardLayoutObject;
367
- /**
368
- * Specifies which layout should be used.
369
- */
370
- layoutName?: string;
371
- /**
372
- * Replaces variable buttons (such as `{bksp}`) with a human-friendly name (e.g.: `backspace`).
373
- */
374
- display?: {
375
- [button: string]: string;
376
- };
377
- /**
378
- * By default, when you set the display property, you replace the default one. This setting merges them instead.
379
- */
380
- mergeDisplay?: boolean;
381
- /**
382
- * A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.
383
- */
384
- theme?: string;
385
- /**
386
- * A prop to add your own css classes to one or several buttons.
387
- */
388
- buttonTheme?: KeyboardButtonTheme[];
389
- /**
390
- * A prop to add your own attributes to one or several buttons.
391
- */
392
- buttonAttributes?: KeyboardButtonAttributes[];
393
- /**
394
- * Runs a `console.log` every time a key is pressed. Displays the buttons pressed and the current input.
395
- */
396
- debug?: boolean;
397
- /**
398
- * Specifies whether clicking the "ENTER" button will input a newline (`\n`) or not.
399
- */
400
- newLineOnEnter?: boolean;
401
- /**
402
- * Specifies whether clicking the "TAB" button will input a tab character (`\t`) or not.
403
- */
404
- tabCharOnTab?: boolean;
405
- /**
406
- * Allows you to use a single simple-keyboard instance for several inputs.
407
- */
408
- inputName?: string;
409
- /**
410
- * `number`: Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.
411
- *
412
- * `{ [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.
413
- */
414
- maxLength?: any;
415
- /**
416
- * When set to true, this option synchronizes the internal input of every simple-keyboard instance.
417
- */
418
- syncInstanceInputs?: boolean;
419
- /**
420
- * Enable highlighting of keys pressed on physical keyboard.
421
- */
422
- physicalKeyboardHighlight?: boolean;
423
- /**
424
- * Calls handler for a button highlighted by physicalKeyboardHighlight
425
- * In other words, this calls keyboard.handleButtonClicked(buttonName) on the highlighted button
426
- */
427
- physicalKeyboardHighlightPress?: boolean;
428
- /**
429
- * Trigger click on a button's element when using physicalKeyboardHighlightPress
430
- * In other words, this calls button.click() on the highlighted button
431
- */
432
- physicalKeyboardHighlightPressUseClick?: boolean;
433
- /**
434
- * Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.
435
- */
436
- physicalKeyboardHighlightPressUsePointerEvents?: boolean;
437
- /**
438
- * Define the text color that the physical keyboard highlighted key should have.
439
- */
440
- physicalKeyboardHighlightTextColor?: string;
441
- /**
442
- * Define the background color that the physical keyboard highlighted key should have.
443
- */
444
- physicalKeyboardHighlightBgColor?: string;
445
- /**
446
- * Calling preventDefault for the mousedown events keeps the focus on the input.
447
- */
448
- preventMouseDownDefault?: boolean;
449
- /**
450
- * Calling preventDefault for the mouseup events.
451
- */
452
- preventMouseUpDefault?: boolean;
453
- /**
454
- * Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.
455
- */
456
- stopMouseDownPropagation?: boolean;
457
- /**
458
- * Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.
459
- */
460
- stopMouseUpPropagation?: boolean;
461
- /**
462
- * Render buttons as a button element instead of a div element.
463
- */
464
- useButtonTag?: boolean;
465
- /**
466
- * A prop to ensure characters are always be added/removed at the end of the string.
467
- */
468
- disableCaretPositioning?: boolean;
469
- /**
470
- * Restrains input(s) change to the defined regular expression pattern.
471
- */
472
- inputPattern?: any;
473
- /**
474
- * Instructs simple-keyboard to use touch events instead of click events.
475
- */
476
- useTouchEvents?: boolean;
477
- /**
478
- * Enable useTouchEvents automatically when touch device is detected.
479
- */
480
- autoUseTouchEvents?: boolean;
481
- /**
482
- * Opt out of PointerEvents handling, falling back to the prior mouse event logic.
483
- */
484
- useMouseEvents?: boolean;
485
- /**
486
- * Disable button hold action.
487
- */
488
- disableButtonHold?: boolean;
489
- /**
490
- * Adds unicode right-to-left control characters to input return values.
491
- */
492
- rtl?: boolean;
493
- /**
494
- * Enable input method editor candidate list support.
495
- */
496
- enableLayoutCandidates?: boolean;
497
- /**
498
- * Character suggestions to be shown on certain key presses
499
- */
500
- layoutCandidates?: {
501
- [key: string]: string;
502
- };
503
- /**
504
- * Exclude buttons from layout
505
- */
506
- excludeFromLayout?: {
507
- [key: string]: string[];
508
- };
509
- /**
510
- * Determines size of layout candidate list
511
- */
512
- layoutCandidatesPageSize?: number;
513
- /**
514
- * Determines whether layout candidate match should be case sensitive.
515
- */
516
- layoutCandidatesCaseSensitiveMatch?: boolean;
517
- /**
518
- * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).
519
- */
520
- onRender?: (instance?: SimpleKeyboard) => void;
521
- /**
522
- * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).
523
- */
524
- onInit?: (instance?: SimpleKeyboard) => void;
525
- /**
526
- * Retrieves the current input
527
- */
528
- onChange?: (input: string, e?: MouseEvent) => any;
529
- /**
530
- * Retrieves all inputs
531
- */
532
- onChangeAll?: (inputObj: KeyboardInput, e?: MouseEvent) => any;
533
- /**
534
- * Module options can have any format
535
- */
536
- [name: string]: any;
537
- }
538
- export interface CandidateBox {
539
- utilities: Utilities;
540
- candidateBoxElement: HTMLDivElement;
541
- pageIndex: number;
542
- pageSize: number;
543
- constructor: ({ utilities }: CandidateBoxParams) => any
544
- destroy(): void;
545
- show({ candidateValue, targetElement, onSelect, }: CandidateBoxShowParams): void;
546
- renderPage({ candidateListPages, targetElement, pageIndex, nbPages, onItemSelected, }: CandidateBoxRenderParams): void;
547
- }
548
- /**
549
- * Utility Service
550
- */
551
- export interface Utilities {
552
- getOptions: () => KeyboardOptions;
553
- getCaretPosition: () => number | null;
554
- getCaretPositionEnd: () => number | null;
555
- dispatch: any;
556
- maxLengthReached: boolean;
557
- /**
558
- * Creates an instance of the Utility service
559
- */
560
- constructor: ({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch, }: UtilitiesParams) => any
561
- /**
562
- * Retrieve button type
563
- *
564
- * @param {string} button The button's layout name
565
- * @return {string} The button type
566
- */
567
- getButtonType(button: string): string;
568
- /**
569
- * Adds default classes to a given button
570
- *
571
- * @param {string} button The button's layout name
572
- * @return {string} The classes to be added to the button
573
- */
574
- getButtonClass(button: string): string;
575
- /**
576
- * Default button display labels
577
- */
578
- getDefaultDiplay(): {
579
- "{bksp}": string;
580
- "{backspace}": string;
581
- "{enter}": string;
582
- "{shift}": string;
583
- "{shiftleft}": string;
584
- "{shiftright}": string;
585
- "{alt}": string;
586
- "{s}": string;
587
- "{tab}": string;
588
- "{lock}": string;
589
- "{capslock}": string;
590
- "{accept}": string;
591
- "{space}": string;
592
- "{//}": string;
593
- "{esc}": string;
594
- "{escape}": string;
595
- "{f1}": string;
596
- "{f2}": string;
597
- "{f3}": string;
598
- "{f4}": string;
599
- "{f5}": string;
600
- "{f6}": string;
601
- "{f7}": string;
602
- "{f8}": string;
603
- "{f9}": string;
604
- "{f10}": string;
605
- "{f11}": string;
606
- "{f12}": string;
607
- "{numpaddivide}": string;
608
- "{numlock}": string;
609
- "{arrowup}": string;
610
- "{arrowleft}": string;
611
- "{arrowdown}": string;
612
- "{arrowright}": string;
613
- "{prtscr}": string;
614
- "{scrolllock}": string;
615
- "{pause}": string;
616
- "{insert}": string;
617
- "{home}": string;
618
- "{pageup}": string;
619
- "{delete}": string;
620
- "{forwarddelete}": string;
621
- "{end}": string;
622
- "{pagedown}": string;
623
- "{numpadmultiply}": string;
624
- "{numpadsubtract}": string;
625
- "{numpadadd}": string;
626
- "{numpadenter}": string;
627
- "{period}": string;
628
- "{numpaddecimal}": string;
629
- "{numpad0}": string;
630
- "{numpad1}": string;
631
- "{numpad2}": string;
632
- "{numpad3}": string;
633
- "{numpad4}": string;
634
- "{numpad5}": string;
635
- "{numpad6}": string;
636
- "{numpad7}": string;
637
- "{numpad8}": string;
638
- "{numpad9}": string;
639
- };
640
- /**
641
- * Returns the display (label) name for a given button
642
- *
643
- * @param {string} button The button's layout name
644
- * @param {object} display The provided display option
645
- * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
646
- */
647
- getButtonDisplayName(button: string, display: KeyboardOptions["display"], mergeDisplay: boolean): string;
648
- /**
649
- * Returns the updated input resulting from clicking a given button
650
- *
651
- * @param {string} button The button's layout name
652
- * @param {string} input The input string
653
- * @param {number} caretPos The cursor's current position
654
- * @param {number} caretPosEnd The cursor's current end position
655
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
656
- */
657
- getUpdatedInput(button: string, input: string, caretPos: number, caretPosEnd?: number, moveCaret?: boolean): string;
658
- /**
659
- * Moves the cursor position by a given amount
660
- *
661
- * @param {number} length Represents by how many characters the input should be moved
662
- * @param {boolean} minus Whether the cursor should be moved to the left or not.
663
- */
664
- updateCaretPos(length: number, minus?: boolean): void;
665
- /**
666
- * Action method of updateCaretPos
667
- *
668
- * @param {number} length Represents by how many characters the input should be moved
669
- * @param {boolean} minus Whether the cursor should be moved to the left or not.
670
- */
671
- updateCaretPosAction(length: number, minus?: boolean): number | null;
672
- /**
673
- * Adds a string to the input at a given position
674
- *
675
- * @param {string} source The source input
676
- * @param {string} str The string to add
677
- * @param {number} position The (cursor) position where the string should be added
678
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
679
- */
680
- addStringAt(source: string, str: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
681
- /**
682
- * Check whether the button is a standard button
683
- */
684
- isStandardButton: (button: string) => boolean | "";
685
- /**
686
- * Removes an amount of characters before a given position
687
- *
688
- * @param {string} source The source input
689
- * @param {number} position The (cursor) position from where the characters should be removed
690
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
691
- */
692
- removeAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
693
- /**
694
- * Removes an amount of characters after a given position
695
- *
696
- * @param {string} source The source input
697
- * @param {number} position The (cursor) position from where the characters should be removed
698
- */
699
- removeForwardsAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
700
- /**
701
- * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.
702
- *
703
- * @param {object} inputObj
704
- * @param {string} updatedInput
705
- */
706
- handleMaxLength(inputObj: KeyboardInput, updatedInput: string): boolean | undefined;
707
- /**
708
- * Gets the current value of maxLengthReached
709
- */
710
- isMaxLengthReached(): boolean;
711
- /**
712
- * Determines whether a touch device is being used
713
- */
714
- isTouchDevice(): number | true;
715
- /**
716
- * Determines whether pointer events are supported
717
- */
718
- pointerEventsSupported(): boolean;
719
- /**
720
- * Bind all methods in a given class
721
- */
722
- /**
723
- * Transforms an arbitrary string to camelCase
724
- *
725
- * @param {string} str The string to transform.
726
- */
727
- camelCase(str: string): string;
728
- /**
729
- * Split array into chunks
730
- */
731
- chunkArray<T>(arr: T[], size: number): T[][];
732
- /**
733
- * Escape regex input
734
- */
735
- escapeRegex(str: string): string;
736
- /**
737
- * Reusable empty function
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
+ }