react-simple-keyboard 3.5.30 → 3.5.31

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.
@@ -16,7 +16,7 @@ export interface KeyboardReactInterface extends SimpleKeyboard {
16
16
  export interface SimpleKeyboard {
17
17
  input: KeyboardInput;
18
18
  options: KeyboardOptions;
19
- utilities: any;
19
+ utilities: Utilities;
20
20
  caretPosition: number | null;
21
21
  caretPositionEnd: number | null;
22
22
  keyboardDOM: KeyboardElement;
@@ -315,6 +315,202 @@ export interface PhysicalKeyboard {
315
315
  keyCodeToKey(keyCode: number): string;
316
316
  isMofifierKey: (e: KeyboardEvent) => boolean;
317
317
  }
318
+ /**
319
+ * Utility Service
320
+ */
321
+ export interface Utilities {
322
+ getOptions: () => KeyboardOptions;
323
+ getCaretPosition: () => number | null;
324
+ getCaretPositionEnd: () => number | null;
325
+ dispatch: any;
326
+ maxLengthReached: boolean;
327
+ /**
328
+ * Creates an instance of the Utility service
329
+ */
330
+ constructor: ({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch, }: UtilitiesParams) => any
331
+ /**
332
+ * Retrieve button type
333
+ *
334
+ * @param {string} button The button's layout name
335
+ * @return {string} The button type
336
+ */
337
+ getButtonType(button: string): string;
338
+ /**
339
+ * Adds default classes to a given button
340
+ *
341
+ * @param {string} button The button's layout name
342
+ * @return {string} The classes to be added to the button
343
+ */
344
+ getButtonClass(button: string): string;
345
+ /**
346
+ * Default button display labels
347
+ */
348
+ getDefaultDiplay(): {
349
+ "{bksp}": string;
350
+ "{backspace}": string;
351
+ "{enter}": string;
352
+ "{shift}": string;
353
+ "{shiftleft}": string;
354
+ "{shiftright}": string;
355
+ "{alt}": string;
356
+ "{s}": string;
357
+ "{tab}": string;
358
+ "{lock}": string;
359
+ "{capslock}": string;
360
+ "{accept}": string;
361
+ "{space}": string;
362
+ "{//}": string;
363
+ "{esc}": string;
364
+ "{escape}": string;
365
+ "{f1}": string;
366
+ "{f2}": string;
367
+ "{f3}": string;
368
+ "{f4}": string;
369
+ "{f5}": string;
370
+ "{f6}": string;
371
+ "{f7}": string;
372
+ "{f8}": string;
373
+ "{f9}": string;
374
+ "{f10}": string;
375
+ "{f11}": string;
376
+ "{f12}": string;
377
+ "{numpaddivide}": string;
378
+ "{numlock}": string;
379
+ "{arrowup}": string;
380
+ "{arrowleft}": string;
381
+ "{arrowdown}": string;
382
+ "{arrowright}": string;
383
+ "{prtscr}": string;
384
+ "{scrolllock}": string;
385
+ "{pause}": string;
386
+ "{insert}": string;
387
+ "{home}": string;
388
+ "{pageup}": string;
389
+ "{delete}": string;
390
+ "{forwarddelete}": string;
391
+ "{end}": string;
392
+ "{pagedown}": string;
393
+ "{numpadmultiply}": string;
394
+ "{numpadsubtract}": string;
395
+ "{numpadadd}": string;
396
+ "{numpadenter}": string;
397
+ "{period}": string;
398
+ "{numpaddecimal}": string;
399
+ "{numpad0}": string;
400
+ "{numpad1}": string;
401
+ "{numpad2}": string;
402
+ "{numpad3}": string;
403
+ "{numpad4}": string;
404
+ "{numpad5}": string;
405
+ "{numpad6}": string;
406
+ "{numpad7}": string;
407
+ "{numpad8}": string;
408
+ "{numpad9}": string;
409
+ };
410
+ /**
411
+ * Returns the display (label) name for a given button
412
+ *
413
+ * @param {string} button The button's layout name
414
+ * @param {object} display The provided display option
415
+ * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
416
+ */
417
+ getButtonDisplayName(button: string, display: KeyboardOptions["display"], mergeDisplay?: boolean): string;
418
+ /**
419
+ * Returns the updated input resulting from clicking a given button
420
+ *
421
+ * @param {string} button The button's layout name
422
+ * @param {string} input The input string
423
+ * @param {number} caretPos The cursor's current position
424
+ * @param {number} caretPosEnd The cursor's current end position
425
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
426
+ */
427
+ getUpdatedInput(button: string, input: string, caretPos: any, caretPosEnd?: any, moveCaret?: boolean): string;
428
+ /**
429
+ * Moves the cursor position by a given amount
430
+ *
431
+ * @param {number} length Represents by how many characters the input should be moved
432
+ * @param {boolean} minus Whether the cursor should be moved to the left or not.
433
+ */
434
+ updateCaretPos(length: number, minus?: boolean): void;
435
+ /**
436
+ * Action method of updateCaretPos
437
+ *
438
+ * @param {number} length Represents by how many characters the input should be moved
439
+ * @param {boolean} minus Whether the cursor should be moved to the left or not.
440
+ */
441
+ updateCaretPosAction(length: number, minus?: boolean): number | null;
442
+ /**
443
+ * Adds a string to the input at a given position
444
+ *
445
+ * @param {string} source The source input
446
+ * @param {string} str The string to add
447
+ * @param {number} position The (cursor) position where the string should be added
448
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
449
+ */
450
+ addStringAt(source: string, str: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
451
+ /**
452
+ * Check whether the button is a standard button
453
+ */
454
+ isStandardButton: (button: string) => boolean | "";
455
+ /**
456
+ * Removes an amount of characters before a given position
457
+ *
458
+ * @param {string} source The source input
459
+ * @param {number} position The (cursor) position from where the characters should be removed
460
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
461
+ */
462
+ removeAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
463
+ /**
464
+ * Removes an amount of characters after a given position
465
+ *
466
+ * @param {string} source The source input
467
+ * @param {number} position The (cursor) position from where the characters should be removed
468
+ */
469
+ removeForwardsAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
470
+ /**
471
+ * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.
472
+ *
473
+ * @param {object} inputObj
474
+ * @param {string} updatedInput
475
+ */
476
+ handleMaxLength(inputObj: KeyboardInput, updatedInput: string): boolean | undefined;
477
+ /**
478
+ * Gets the current value of maxLengthReached
479
+ */
480
+ isMaxLengthReached(): boolean;
481
+ /**
482
+ * Determines whether a touch device is being used
483
+ */
484
+ isTouchDevice(): number | true;
485
+ /**
486
+ * Determines whether pointer events are supported
487
+ */
488
+ pointerEventsSupported(): boolean;
489
+ /**
490
+ * Bind all methods in a given class
491
+ */
492
+ /**
493
+ * Transforms an arbitrary string to camelCase
494
+ *
495
+ * @param {string} str The string to transform.
496
+ */
497
+ camelCase(str: string): string;
498
+ /**
499
+ * Split array into chunks
500
+ */
501
+ chunkArray<T>(arr: T[], size: number): T[][];
502
+ /**
503
+ * Escape regex input
504
+ */
505
+ escapeRegex(str: string): string;
506
+ /**
507
+ * Calculate caret position offset when using rtl option
508
+ */
509
+ getRtlOffset(index: number, input: string): number;
510
+ /**
511
+ * Reusable empty function
512
+ */
513
+ }
318
514
  export interface KeyboardLayoutObject {
319
515
  [key: string]: string[];
320
516
  }
@@ -568,199 +764,3 @@ export interface CandidateBox {
568
764
  show({ candidateValue, targetElement, onSelect, }: CandidateBoxShowParams): void;
569
765
  renderPage({ candidateListPages, targetElement, pageIndex, nbPages, onItemSelected, }: CandidateBoxRenderParams): void;
570
766
  }
571
- /**
572
- * Utility Service
573
- */
574
- export interface Utilities {
575
- getOptions: () => KeyboardOptions;
576
- getCaretPosition: () => number | null;
577
- getCaretPositionEnd: () => number | null;
578
- dispatch: any;
579
- maxLengthReached: boolean;
580
- /**
581
- * Creates an instance of the Utility service
582
- */
583
- constructor: ({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch, }: UtilitiesParams) => any
584
- /**
585
- * Retrieve button type
586
- *
587
- * @param {string} button The button's layout name
588
- * @return {string} The button type
589
- */
590
- getButtonType(button: string): string;
591
- /**
592
- * Adds default classes to a given button
593
- *
594
- * @param {string} button The button's layout name
595
- * @return {string} The classes to be added to the button
596
- */
597
- getButtonClass(button: string): string;
598
- /**
599
- * Default button display labels
600
- */
601
- getDefaultDiplay(): {
602
- "{bksp}": string;
603
- "{backspace}": string;
604
- "{enter}": string;
605
- "{shift}": string;
606
- "{shiftleft}": string;
607
- "{shiftright}": string;
608
- "{alt}": string;
609
- "{s}": string;
610
- "{tab}": string;
611
- "{lock}": string;
612
- "{capslock}": string;
613
- "{accept}": string;
614
- "{space}": string;
615
- "{//}": string;
616
- "{esc}": string;
617
- "{escape}": string;
618
- "{f1}": string;
619
- "{f2}": string;
620
- "{f3}": string;
621
- "{f4}": string;
622
- "{f5}": string;
623
- "{f6}": string;
624
- "{f7}": string;
625
- "{f8}": string;
626
- "{f9}": string;
627
- "{f10}": string;
628
- "{f11}": string;
629
- "{f12}": string;
630
- "{numpaddivide}": string;
631
- "{numlock}": string;
632
- "{arrowup}": string;
633
- "{arrowleft}": string;
634
- "{arrowdown}": string;
635
- "{arrowright}": string;
636
- "{prtscr}": string;
637
- "{scrolllock}": string;
638
- "{pause}": string;
639
- "{insert}": string;
640
- "{home}": string;
641
- "{pageup}": string;
642
- "{delete}": string;
643
- "{forwarddelete}": string;
644
- "{end}": string;
645
- "{pagedown}": string;
646
- "{numpadmultiply}": string;
647
- "{numpadsubtract}": string;
648
- "{numpadadd}": string;
649
- "{numpadenter}": string;
650
- "{period}": string;
651
- "{numpaddecimal}": string;
652
- "{numpad0}": string;
653
- "{numpad1}": string;
654
- "{numpad2}": string;
655
- "{numpad3}": string;
656
- "{numpad4}": string;
657
- "{numpad5}": string;
658
- "{numpad6}": string;
659
- "{numpad7}": string;
660
- "{numpad8}": string;
661
- "{numpad9}": string;
662
- };
663
- /**
664
- * Returns the display (label) name for a given button
665
- *
666
- * @param {string} button The button's layout name
667
- * @param {object} display The provided display option
668
- * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
669
- */
670
- getButtonDisplayName(button: string, display: KeyboardOptions["display"], mergeDisplay: boolean): string;
671
- /**
672
- * Returns the updated input resulting from clicking a given button
673
- *
674
- * @param {string} button The button's layout name
675
- * @param {string} input The input string
676
- * @param {number} caretPos The cursor's current position
677
- * @param {number} caretPosEnd The cursor's current end position
678
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
679
- */
680
- getUpdatedInput(button: string, input: string, caretPos: number, caretPosEnd?: number, moveCaret?: boolean): string;
681
- /**
682
- * Moves the cursor position by a given amount
683
- *
684
- * @param {number} length Represents by how many characters the input should be moved
685
- * @param {boolean} minus Whether the cursor should be moved to the left or not.
686
- */
687
- updateCaretPos(length: number, minus?: boolean): void;
688
- /**
689
- * Action method of updateCaretPos
690
- *
691
- * @param {number} length Represents by how many characters the input should be moved
692
- * @param {boolean} minus Whether the cursor should be moved to the left or not.
693
- */
694
- updateCaretPosAction(length: number, minus?: boolean): number | null;
695
- /**
696
- * Adds a string to the input at a given position
697
- *
698
- * @param {string} source The source input
699
- * @param {string} str The string to add
700
- * @param {number} position The (cursor) position where the string should be added
701
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
702
- */
703
- addStringAt(source: string, str: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
704
- /**
705
- * Check whether the button is a standard button
706
- */
707
- isStandardButton: (button: string) => boolean | "";
708
- /**
709
- * Removes an amount of characters before a given position
710
- *
711
- * @param {string} source The source input
712
- * @param {number} position The (cursor) position from where the characters should be removed
713
- * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
714
- */
715
- removeAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
716
- /**
717
- * Removes an amount of characters after a given position
718
- *
719
- * @param {string} source The source input
720
- * @param {number} position The (cursor) position from where the characters should be removed
721
- */
722
- removeForwardsAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
723
- /**
724
- * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.
725
- *
726
- * @param {object} inputObj
727
- * @param {string} updatedInput
728
- */
729
- handleMaxLength(inputObj: KeyboardInput, updatedInput: string): boolean | undefined;
730
- /**
731
- * Gets the current value of maxLengthReached
732
- */
733
- isMaxLengthReached(): boolean;
734
- /**
735
- * Determines whether a touch device is being used
736
- */
737
- isTouchDevice(): number | true;
738
- /**
739
- * Determines whether pointer events are supported
740
- */
741
- pointerEventsSupported(): boolean;
742
- /**
743
- * Bind all methods in a given class
744
- */
745
- /**
746
- * Transforms an arbitrary string to camelCase
747
- *
748
- * @param {string} str The string to transform.
749
- */
750
- camelCase(str: string): string;
751
- /**
752
- * Split array into chunks
753
- */
754
- chunkArray<T>(arr: T[], size: number): T[][];
755
- /**
756
- * Escape regex input
757
- */
758
- escapeRegex(str: string): string;
759
- /**
760
- * Calculate caret position offset when using rtl option
761
- */
762
- getRtlOffset(index: number, input: string): number;
763
- /**
764
- * Reusable empty function
765
- */
766
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-keyboard",
3
- "version": "3.5.30",
3
+ "version": "3.5.31",
4
4
  "description": "React.js Virtual Keyboard",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -74,7 +74,7 @@
74
74
  "postcss-loader": "^7.0.2",
75
75
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0",
76
76
  "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",
77
- "simple-keyboard": "3.5.26",
77
+ "simple-keyboard": "3.5.27",
78
78
  "style-loader": "^3.2.1",
79
79
  "terser-webpack-plugin": "^5.3.6",
80
80
  "typescript": "^4.9.5",