react-simple-keyboard 3.6.46 → 3.6.48

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.
@@ -292,225 +292,6 @@ export interface SimpleKeyboard {
292
292
  */
293
293
  render(): void;
294
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(e: KeyboardEvent): void;
306
- handleHighlightKeyUp(e: KeyboardEvent): void;
307
- /**
308
- * Transforms a KeyboardEvent's "key.code" string into a simple-keyboard layout format
309
- * @param {object} e The KeyboardEvent
310
- */
311
- getSimpleKeyboardLayoutKey(e: KeyboardEvent): string;
312
- /**
313
- * Retrieve key from keyCode
314
- */
315
- keyCodeToKey(keyCode: number): string;
316
- isMofifierKey: (e: KeyboardEvent) => boolean;
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
- }
514
295
  export interface KeyboardLayoutObject {
515
296
  [key: string]: string[];
516
297
  }
@@ -753,6 +534,225 @@ export interface KeyboardOptions {
753
534
  */
754
535
  [name: string]: any;
755
536
  }
537
+ /**
538
+ * Physical Keyboard Service
539
+ */
540
+ export interface PhysicalKeyboard {
541
+ getOptions: () => KeyboardOptions;
542
+ dispatch: any;
543
+ /**
544
+ * Creates an instance of the PhysicalKeyboard service
545
+ */
546
+ constructor: ({ dispatch, getOptions }: PhysicalKeyboardParams) => any
547
+ handleHighlightKeyDown(e: KeyboardEvent): void;
548
+ handleHighlightKeyUp(e: KeyboardEvent): void;
549
+ /**
550
+ * Transforms a KeyboardEvent's "key.code" string into a simple-keyboard layout format
551
+ * @param {object} e The KeyboardEvent
552
+ */
553
+ getSimpleKeyboardLayoutKey(e: KeyboardEvent): string;
554
+ /**
555
+ * Retrieve key from keyCode
556
+ */
557
+ keyCodeToKey(keyCode: number): string;
558
+ isMofifierKey: (e: KeyboardEvent) => boolean;
559
+ }
560
+ /**
561
+ * Utility Service
562
+ */
563
+ export interface Utilities {
564
+ getOptions: () => KeyboardOptions;
565
+ getCaretPosition: () => number | null;
566
+ getCaretPositionEnd: () => number | null;
567
+ dispatch: any;
568
+ maxLengthReached: boolean;
569
+ /**
570
+ * Creates an instance of the Utility service
571
+ */
572
+ constructor: ({ getOptions, getCaretPosition, getCaretPositionEnd, dispatch, }: UtilitiesParams) => any
573
+ /**
574
+ * Retrieve button type
575
+ *
576
+ * @param {string} button The button's layout name
577
+ * @return {string} The button type
578
+ */
579
+ getButtonType(button: string): string;
580
+ /**
581
+ * Adds default classes to a given button
582
+ *
583
+ * @param {string} button The button's layout name
584
+ * @return {string} The classes to be added to the button
585
+ */
586
+ getButtonClass(button: string): string;
587
+ /**
588
+ * Default button display labels
589
+ */
590
+ getDefaultDiplay(): {
591
+ "{bksp}": string;
592
+ "{backspace}": string;
593
+ "{enter}": string;
594
+ "{shift}": string;
595
+ "{shiftleft}": string;
596
+ "{shiftright}": string;
597
+ "{alt}": string;
598
+ "{s}": string;
599
+ "{tab}": string;
600
+ "{lock}": string;
601
+ "{capslock}": string;
602
+ "{accept}": string;
603
+ "{space}": string;
604
+ "{//}": string;
605
+ "{esc}": string;
606
+ "{escape}": string;
607
+ "{f1}": string;
608
+ "{f2}": string;
609
+ "{f3}": string;
610
+ "{f4}": string;
611
+ "{f5}": string;
612
+ "{f6}": string;
613
+ "{f7}": string;
614
+ "{f8}": string;
615
+ "{f9}": string;
616
+ "{f10}": string;
617
+ "{f11}": string;
618
+ "{f12}": string;
619
+ "{numpaddivide}": string;
620
+ "{numlock}": string;
621
+ "{arrowup}": string;
622
+ "{arrowleft}": string;
623
+ "{arrowdown}": string;
624
+ "{arrowright}": string;
625
+ "{prtscr}": string;
626
+ "{scrolllock}": string;
627
+ "{pause}": string;
628
+ "{insert}": string;
629
+ "{home}": string;
630
+ "{pageup}": string;
631
+ "{delete}": string;
632
+ "{forwarddelete}": string;
633
+ "{end}": string;
634
+ "{pagedown}": string;
635
+ "{numpadmultiply}": string;
636
+ "{numpadsubtract}": string;
637
+ "{numpadadd}": string;
638
+ "{numpadenter}": string;
639
+ "{period}": string;
640
+ "{numpaddecimal}": string;
641
+ "{numpad0}": string;
642
+ "{numpad1}": string;
643
+ "{numpad2}": string;
644
+ "{numpad3}": string;
645
+ "{numpad4}": string;
646
+ "{numpad5}": string;
647
+ "{numpad6}": string;
648
+ "{numpad7}": string;
649
+ "{numpad8}": string;
650
+ "{numpad9}": string;
651
+ };
652
+ /**
653
+ * Returns the display (label) name for a given button
654
+ *
655
+ * @param {string} button The button's layout name
656
+ * @param {object} display The provided display option
657
+ * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.
658
+ */
659
+ getButtonDisplayName(button: string, display: KeyboardOptions["display"], mergeDisplay?: boolean): string;
660
+ /**
661
+ * Returns the updated input resulting from clicking a given button
662
+ *
663
+ * @param {string} button The button's layout name
664
+ * @param {string} input The input string
665
+ * @param {number} caretPos The cursor's current position
666
+ * @param {number} caretPosEnd The cursor's current end position
667
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
668
+ */
669
+ getUpdatedInput(button: string, input: string, caretPos: any, caretPosEnd?: any, moveCaret?: boolean): string;
670
+ /**
671
+ * Moves the cursor position by a given amount
672
+ *
673
+ * @param {number} length Represents by how many characters the input should be moved
674
+ * @param {boolean} minus Whether the cursor should be moved to the left or not.
675
+ */
676
+ updateCaretPos(length: number, minus?: boolean): void;
677
+ /**
678
+ * Action method of updateCaretPos
679
+ *
680
+ * @param {number} length Represents by how many characters the input should be moved
681
+ * @param {boolean} minus Whether the cursor should be moved to the left or not.
682
+ */
683
+ updateCaretPosAction(length: number, minus?: boolean): number | null;
684
+ /**
685
+ * Adds a string to the input at a given position
686
+ *
687
+ * @param {string} source The source input
688
+ * @param {string} str The string to add
689
+ * @param {number} position The (cursor) position where the string should be added
690
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
691
+ */
692
+ addStringAt(source: string, str: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
693
+ /**
694
+ * Check whether the button is a standard button
695
+ */
696
+ isStandardButton: (button: string) => boolean | "";
697
+ /**
698
+ * Removes an amount of characters before a given position
699
+ *
700
+ * @param {string} source The source input
701
+ * @param {number} position The (cursor) position from where the characters should be removed
702
+ * @param {boolean} moveCaret Whether to update simple-keyboard's cursor
703
+ */
704
+ removeAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
705
+ /**
706
+ * Removes an amount of characters after a given position
707
+ *
708
+ * @param {string} source The source input
709
+ * @param {number} position The (cursor) position from where the characters should be removed
710
+ */
711
+ removeForwardsAt(source: string, position?: number, positionEnd?: number, moveCaret?: boolean): string;
712
+ /**
713
+ * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.
714
+ *
715
+ * @param {object} inputObj
716
+ * @param {string} updatedInput
717
+ */
718
+ handleMaxLength(inputObj: KeyboardInput, updatedInput: string): boolean | undefined;
719
+ /**
720
+ * Gets the current value of maxLengthReached
721
+ */
722
+ isMaxLengthReached(): boolean;
723
+ /**
724
+ * Determines whether a touch device is being used
725
+ */
726
+ isTouchDevice(): number | true;
727
+ /**
728
+ * Determines whether pointer events are supported
729
+ */
730
+ pointerEventsSupported(): boolean;
731
+ /**
732
+ * Bind all methods in a given class
733
+ */
734
+ /**
735
+ * Transforms an arbitrary string to camelCase
736
+ *
737
+ * @param {string} str The string to transform.
738
+ */
739
+ camelCase(str: string): string;
740
+ /**
741
+ * Split array into chunks
742
+ */
743
+ chunkArray<T>(arr: T[], size: number): T[][];
744
+ /**
745
+ * Escape regex input
746
+ */
747
+ escapeRegex(str: string): string;
748
+ /**
749
+ * Calculate caret position offset when using rtl option
750
+ */
751
+ getRtlOffset(index: number, input: string): number;
752
+ /**
753
+ * Reusable empty function
754
+ */
755
+ }
756
756
  export interface CandidateBox {
757
757
  utilities: Utilities;
758
758
  options: KeyboardOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-keyboard",
3
- "version": "3.6.46",
3
+ "version": "3.6.48",
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.3.3",
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.6.36",
77
+ "simple-keyboard": "3.6.39",
78
78
  "style-loader": "^3.2.1",
79
79
  "terser-webpack-plugin": "^5.3.9",
80
80
  "typescript": "^4.9.5",