canvasengine 2.0.0-beta.4 → 2.0.0-beta.41

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.
Files changed (142) hide show
  1. package/dist/DebugRenderer-BxfW34YG.js +172 -0
  2. package/dist/DebugRenderer-BxfW34YG.js.map +1 -0
  3. package/dist/components/Button.d.ts +183 -0
  4. package/dist/components/Button.d.ts.map +1 -0
  5. package/dist/components/Canvas.d.ts +18 -0
  6. package/dist/components/Canvas.d.ts.map +1 -0
  7. package/dist/components/DOMElement.d.ts +44 -0
  8. package/dist/components/DOMElement.d.ts.map +1 -0
  9. package/dist/components/Graphic.d.ts +65 -0
  10. package/dist/components/Graphic.d.ts.map +1 -0
  11. package/dist/components/Joystick.d.ts +36 -0
  12. package/dist/components/Joystick.d.ts.map +1 -0
  13. package/dist/components/NineSliceSprite.d.ts +17 -0
  14. package/dist/components/NineSliceSprite.d.ts.map +1 -0
  15. package/dist/components/ParticleEmitter.d.ts +5 -0
  16. package/dist/components/ParticleEmitter.d.ts.map +1 -0
  17. package/dist/components/Scene.d.ts +2 -0
  18. package/dist/components/Scene.d.ts.map +1 -0
  19. package/dist/components/Text.d.ts +26 -0
  20. package/dist/components/Text.d.ts.map +1 -0
  21. package/dist/components/TilingSprite.d.ts +18 -0
  22. package/dist/components/TilingSprite.d.ts.map +1 -0
  23. package/dist/components/Video.d.ts +15 -0
  24. package/dist/components/Video.d.ts.map +1 -0
  25. package/dist/components/index.d.ts +18 -0
  26. package/dist/components/index.d.ts.map +1 -0
  27. package/dist/components/types/DisplayObject.d.ts +110 -0
  28. package/dist/components/types/DisplayObject.d.ts.map +1 -0
  29. package/dist/components/types/MouseEvent.d.ts +4 -0
  30. package/dist/components/types/MouseEvent.d.ts.map +1 -0
  31. package/dist/components/types/Spritesheet.d.ts +248 -0
  32. package/dist/components/types/Spritesheet.d.ts.map +1 -0
  33. package/dist/components/types/index.d.ts +5 -0
  34. package/dist/components/types/index.d.ts.map +1 -0
  35. package/dist/directives/Controls.d.ts +113 -0
  36. package/dist/directives/Controls.d.ts.map +1 -0
  37. package/dist/directives/ControlsBase.d.ts +198 -0
  38. package/dist/directives/ControlsBase.d.ts.map +1 -0
  39. package/dist/directives/Drag.d.ts +70 -0
  40. package/dist/directives/Drag.d.ts.map +1 -0
  41. package/dist/directives/Flash.d.ts +117 -0
  42. package/dist/directives/Flash.d.ts.map +1 -0
  43. package/dist/directives/GamepadControls.d.ts +225 -0
  44. package/dist/directives/GamepadControls.d.ts.map +1 -0
  45. package/dist/directives/JoystickControls.d.ts +172 -0
  46. package/dist/directives/JoystickControls.d.ts.map +1 -0
  47. package/dist/directives/KeyboardControls.d.ts +219 -0
  48. package/dist/directives/KeyboardControls.d.ts.map +1 -0
  49. package/dist/directives/Scheduler.d.ts +36 -0
  50. package/dist/directives/Scheduler.d.ts.map +1 -0
  51. package/dist/directives/Shake.d.ts +98 -0
  52. package/dist/directives/Shake.d.ts.map +1 -0
  53. package/dist/directives/Sound.d.ts +26 -0
  54. package/dist/directives/Sound.d.ts.map +1 -0
  55. package/dist/directives/Transition.d.ts +11 -0
  56. package/dist/directives/Transition.d.ts.map +1 -0
  57. package/dist/directives/ViewportCull.d.ts +12 -0
  58. package/dist/directives/ViewportCull.d.ts.map +1 -0
  59. package/dist/directives/ViewportFollow.d.ts +19 -0
  60. package/dist/directives/ViewportFollow.d.ts.map +1 -0
  61. package/dist/directives/index.d.ts +13 -0
  62. package/dist/directives/index.d.ts.map +1 -0
  63. package/dist/engine/animation.d.ts +73 -0
  64. package/dist/engine/animation.d.ts.map +1 -0
  65. package/dist/engine/bootstrap.d.ts +16 -0
  66. package/dist/engine/bootstrap.d.ts.map +1 -0
  67. package/dist/engine/directive.d.ts +14 -0
  68. package/dist/engine/directive.d.ts.map +1 -0
  69. package/dist/engine/reactive.d.ts +105 -0
  70. package/dist/engine/reactive.d.ts.map +1 -0
  71. package/dist/engine/signal.d.ts +72 -0
  72. package/dist/engine/signal.d.ts.map +1 -0
  73. package/dist/engine/trigger.d.ts +54 -0
  74. package/dist/engine/trigger.d.ts.map +1 -0
  75. package/dist/engine/utils.d.ts +90 -0
  76. package/dist/engine/utils.d.ts.map +1 -0
  77. package/dist/hooks/addContext.d.ts +2 -0
  78. package/dist/hooks/addContext.d.ts.map +1 -0
  79. package/dist/hooks/useProps.d.ts +42 -0
  80. package/dist/hooks/useProps.d.ts.map +1 -0
  81. package/dist/hooks/useRef.d.ts +5 -0
  82. package/dist/hooks/useRef.d.ts.map +1 -0
  83. package/dist/index-BnuKipxl.js +12568 -0
  84. package/dist/index-BnuKipxl.js.map +1 -0
  85. package/dist/index.d.ts +15 -1083
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.global.js +29 -0
  88. package/dist/index.global.js.map +1 -0
  89. package/dist/index.js +81 -3041
  90. package/dist/index.js.map +1 -1
  91. package/dist/utils/Ease.d.ts +17 -0
  92. package/dist/utils/Ease.d.ts.map +1 -0
  93. package/dist/utils/GlobalAssetLoader.d.ts +141 -0
  94. package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
  95. package/dist/utils/RadialGradient.d.ts +58 -0
  96. package/dist/utils/RadialGradient.d.ts.map +1 -0
  97. package/dist/utils/functions.d.ts +2 -0
  98. package/dist/utils/functions.d.ts.map +1 -0
  99. package/package.json +13 -7
  100. package/src/components/Button.ts +396 -0
  101. package/src/components/Canvas.ts +61 -45
  102. package/src/components/Container.ts +21 -2
  103. package/src/components/DOMContainer.ts +123 -0
  104. package/src/components/DOMElement.ts +421 -0
  105. package/src/components/DisplayObject.ts +350 -197
  106. package/src/components/Graphic.ts +200 -34
  107. package/src/components/Joystick.ts +363 -0
  108. package/src/components/Mesh.ts +222 -0
  109. package/src/components/NineSliceSprite.ts +4 -1
  110. package/src/components/ParticleEmitter.ts +12 -8
  111. package/src/components/Sprite.ts +306 -30
  112. package/src/components/Text.ts +125 -18
  113. package/src/components/Video.ts +110 -0
  114. package/src/components/Viewport.ts +59 -43
  115. package/src/components/index.ts +8 -2
  116. package/src/components/types/DisplayObject.ts +34 -0
  117. package/src/components/types/Spritesheet.ts +0 -118
  118. package/src/directives/Controls.ts +254 -0
  119. package/src/directives/ControlsBase.ts +266 -0
  120. package/src/directives/Drag.ts +357 -52
  121. package/src/directives/Flash.ts +419 -0
  122. package/src/directives/GamepadControls.ts +537 -0
  123. package/src/directives/JoystickControls.ts +396 -0
  124. package/src/directives/KeyboardControls.ts +66 -424
  125. package/src/directives/Shake.ts +295 -0
  126. package/src/directives/Sound.ts +94 -31
  127. package/src/directives/ViewportFollow.ts +35 -7
  128. package/src/directives/index.ts +12 -6
  129. package/src/engine/animation.ts +175 -21
  130. package/src/engine/bootstrap.ts +23 -3
  131. package/src/engine/directive.ts +2 -2
  132. package/src/engine/reactive.ts +780 -177
  133. package/src/engine/signal.ts +35 -4
  134. package/src/engine/trigger.ts +34 -7
  135. package/src/engine/utils.ts +19 -3
  136. package/src/hooks/useProps.ts +1 -1
  137. package/src/index.ts +4 -2
  138. package/src/utils/GlobalAssetLoader.ts +257 -0
  139. package/src/utils/functions.ts +7 -0
  140. package/testing/index.ts +12 -0
  141. package/tsconfig.json +17 -0
  142. package/vite.config.ts +39 -0
@@ -1,6 +1,4 @@
1
- import { Directive, registerDirective } from "../engine/directive";
2
- import { Element } from "../engine/reactive";
3
- import { fps2ms } from "../engine/utils";
1
+ import { ControlsBase, ControlOptions, Controls, BoundKey } from "./ControlsBase";
4
2
 
5
3
  export enum Input {
6
4
  Break = 'break',
@@ -144,19 +142,8 @@ export enum Input {
144
142
  Altgr = 'altgr'
145
143
  }
146
144
 
147
- export interface ControlOptions {
148
- repeat?: boolean;
149
- bind: string | string[];
150
- keyUp?: Function;
151
- keyDown?: Function;
152
- delay?: number | {
153
- duration: number;
154
- otherControls?: (string)[];
155
- };
156
- }
157
- export interface Controls {
158
- [controlName: string]: ControlOptions;
159
- }
145
+ // Re-export for backward compatibility
146
+ export type { ControlOptions, Controls, BoundKey };
160
147
 
161
148
  // keyboard handling
162
149
  const keyCodeTable = {
@@ -335,24 +322,35 @@ const inverse = (obj) => {
335
322
 
336
323
  const inverseKeyCodeTable = inverse(keyCodeTable)
337
324
 
338
- type BoundKey = { actionName: string, options: ControlOptions, parameters?: any }
339
-
340
- export class KeyboardControls extends Directive {
325
+ /**
326
+ * Keyboard input controls implementation
327
+ *
328
+ * Handles keyboard input events and maps them to control actions.
329
+ * Supports composite directions (diagonal movement) and key repeat functionality.
330
+ *
331
+ * @example
332
+ * ```ts
333
+ * const keyboardControls = new KeyboardControls();
334
+ * keyboardControls.setInputs({
335
+ * up: {
336
+ * repeat: true,
337
+ * bind: Input.Up,
338
+ * keyDown() {
339
+ * console.log('Up pressed');
340
+ * }
341
+ * }
342
+ * });
343
+ * keyboardControls.start();
344
+ * ```
345
+ */
346
+ export class KeyboardControls extends ControlsBase {
341
347
  private keyState: {
342
348
  [keyName: string]: {
343
349
  isDown: boolean,
344
350
  count: number
345
351
  } | null
346
352
  } = {}
347
- private boundKeys: {
348
- [keyName: string]: BoundKey
349
- } = {}
350
- private stop: boolean = false
351
353
  private lastKeyPressed: number | null = null
352
- private _controlsOptions: Controls = {}
353
- private interval: any
354
- // TODO: This should be dynamic
355
- private serverFps: number = 60
356
354
  private directionState: {
357
355
  up: boolean,
358
356
  down: boolean,
@@ -365,29 +363,26 @@ export class KeyboardControls extends Directive {
365
363
  right: false
366
364
  };
367
365
 
368
- onInit(element: Element) {
369
- this.setupListeners();
370
- this.setInputs(element.props.controls.value)
371
- // The processing is outside the rendering loop because if the FPS are lower (or higher) then the sending to the server would be slower or faster. Here it is constant
372
- this.interval = setInterval(() => {
373
- this.preStep()
374
- }, fps2ms(this.serverFps ?? 60))
375
- }
376
-
377
- onMount(element: Element) {}
378
-
379
- onUpdate(props) {
380
- this.setInputs(props)
366
+ /**
367
+ * Setup keyboard event listeners
368
+ */
369
+ protected setupListeners(): void {
370
+ document.addEventListener('keydown', (e) => { this.onKeyChange(e, true); });
371
+ document.addEventListener('keyup', (e) => { this.onKeyChange(e, false); });
381
372
  }
382
373
 
383
- onDestroy() {
384
- clearInterval(this.interval)
374
+ /**
375
+ * Cleanup keyboard event listeners
376
+ */
377
+ protected cleanup(): void {
385
378
  document.removeEventListener('keydown', (e) => { this.onKeyChange(e, true); });
386
379
  document.removeEventListener('keyup', (e) => { this.onKeyChange(e, false); });
387
380
  }
388
381
 
389
- /** @internal */
390
- preStep() {
382
+ /**
383
+ * Process keyboard inputs each step
384
+ */
385
+ protected preStep() {
391
386
  if (this.stop) return;
392
387
 
393
388
  const direction = this.getDirection();
@@ -409,40 +404,31 @@ export class KeyboardControls extends Directive {
409
404
  }
410
405
  }
411
406
 
412
- private applyInput(keyName: string) {
407
+ /**
408
+ * Apply input for a keyboard key
409
+ * Overrides base implementation to handle key state and repeat logic
410
+ */
411
+ protected applyInput(keyName: string) {
413
412
  const keyState = this.keyState[keyName];
414
413
  if (!keyState) return;
415
414
  const { isDown, count } = keyState;
416
415
  if (isDown) {
417
- const { repeat, keyDown } = this.boundKeys[keyName].options;
416
+ const boundKey = this.boundKeys[keyName];
417
+ if (!boundKey) return;
418
+ const { repeat, keyDown } = boundKey.options;
418
419
  if ((repeat || count == 0)) {
419
- let parameters = this.boundKeys[keyName].parameters;
420
+ let parameters = boundKey.parameters;
420
421
  if (typeof parameters === "function") {
421
422
  parameters = parameters();
422
423
  }
423
424
  if (keyDown) {
424
- keyDown(this.boundKeys[keyName]);
425
+ keyDown(boundKey);
425
426
  }
426
427
  this.keyState[keyName]!.count++;
427
428
  }
428
429
  }
429
430
  }
430
431
 
431
- private setupListeners() {
432
- document.addEventListener('keydown', (e) => { this.onKeyChange(e, true); });
433
- document.addEventListener('keyup', (e) => { this.onKeyChange(e, false); });
434
- }
435
-
436
- private bindKey(keys: Input | Input[], actionName: string, options: ControlOptions, parameters?: object) {
437
- if (!Array.isArray(keys)) keys = [keys] as Input[]
438
- const keyOptions = Object.assign({
439
- repeat: false
440
- }, options);
441
- (keys as Input[]).forEach(keyName => {
442
- this.boundKeys[keyName] = { actionName, options: keyOptions, parameters }
443
- })
444
- }
445
-
446
432
  private applyKeyDown(name: string) {
447
433
  const code = inverseKeyCodeTable[name]
448
434
  const e: any = new Event('keydown')
@@ -532,65 +518,23 @@ export class KeyboardControls extends Directive {
532
518
  }
533
519
 
534
520
  /**
535
- * From the name of the entry, we retrieve the control information
536
- *
537
- * ```ts
538
- * import { Input, inject, KeyboardControls } from '@rpgjs/client'
539
- *
540
- * const controls = inject(KeyboardControls)
541
- * controls.getControl(Input.Enter)
542
-
543
- * if (control) {
544
- * console.log(control.actionName) // action
545
- * }
546
- * ```
547
- * @title Get Control
548
- * @method getControl(inputName)
549
- * @param {string} inputName
550
- * @returns { { actionName: string, options: any } | undefined }
551
- * @memberof KeyboardControls
552
- */
553
- getControl(inputName: string): BoundKey | undefined {
554
- return this.boundKeys[inputName]
555
- }
556
-
557
- /**
558
- * Returns all controls
559
- *
560
- * @method getControls()
561
- * @since 4.2.0
562
- * @returns { { [key: string]: BoundKey } }
563
- * @memberof KeyboardControls
564
- */
565
- getControls(): { [key: string]: BoundKey } {
566
- return this.boundKeys
567
- }
568
-
569
- /**
570
- * Triggers an input according to the name of the control
571
- *
572
- * ```ts
573
- * import { Control, inject, KeyboardControls } from '@rpgjs/client'
521
+ * Apply a control action programmatically
522
+ * Triggers keyboard events to simulate key presses
574
523
  *
575
- * const controls = inject(KeyboardControls)
576
- * controls.applyControl(Control.Action)
577
- * ```
578
- *
579
- * You can put a second parameter or indicate on whether the key is pressed or released
524
+ * @param controlName - Name of the control
525
+ * @param isDown - Whether the key is pressed (true) or released (false)
526
+ * @returns Promise that resolves when the action is complete
527
+ * @example
528
+ * ```ts
529
+ * // Press a key
530
+ * await keyboardControls.applyControl('action', true);
580
531
  *
581
- * ```ts
582
- * import { Control, inject, KeyboardControls } from '@rpgjs/client'
532
+ * // Release a key
533
+ * await keyboardControls.applyControl('action', false);
583
534
  *
584
- * const controls = inject(KeyboardControls)
585
- * controls.applyControl(Control.Up, true) // keydown
586
- * controls.applyControl(Control.Up, false) // keyup
535
+ * // Press and release (default)
536
+ * await keyboardControls.applyControl('action');
587
537
  * ```
588
- * @title Apply Control
589
- * @method applyControl(controlName,isDown)
590
- * @param {string} controlName
591
- * @param {boolean} [isDown]
592
- * @returns {Promise<void>}
593
- * @memberof KeyboardControls
594
538
  */
595
539
  async applyControl(controlName: string | number, isDown?: boolean | undefined): Promise<void> {
596
540
  const control = this._controlsOptions[controlName]
@@ -609,314 +553,12 @@ export class KeyboardControls extends Directive {
609
553
  }
610
554
 
611
555
  /**
612
- * Stop listening to the inputs. Pressing a key won't do anything
613
- *
614
- * @title Stop Inputs
615
- * @method stopInputs()
616
- * @returns {void}
617
- * @memberof KeyboardControls
618
- */
619
- stopInputs() {
620
- this.stop = true
621
- }
622
-
623
- /**
624
- * Listen to the inputs again
625
- *
626
- * @title Listen Inputs
627
- * @method listenInputs()
628
- * @returns {void}
629
- * @memberof KeyboardControls
556
+ * Resume listening to inputs after stopInputs() was called
557
+ * Also resets keyboard state
630
558
  */
631
559
  listenInputs() {
632
- this.stop = false
560
+ super.listenInputs();
633
561
  this.keyState = {}
634
562
  }
635
563
 
636
- /**
637
- * Assign custom inputs to the scene
638
- *
639
- * The object is the following:
640
- *
641
- * * the key of the object is the name of the control. Either it is existing controls (Up, Dow, Left, Right, Action, Back) or customized controls
642
- * * The value is an object representing control information:
643
- * * repeat {boolean} The key can be held down to repeat the action. (false by default)
644
- * * bind {string | string[]} To which key is linked the control
645
- * * method {Function} Function to be triggered. If you do not set this property, the name of the control is sent directly to the server.
646
- * * delay {object|number} (since v3.2.0) Indicates how long (in milliseconds) the player can press the key again to perform the action
647
- * * delay.duration
648
- * * delay.otherControls {string | string[]} Indicates the other controls that will also have the delay at the same time
649
- *
650
- * ```ts
651
- * import { Control, Input, inject, KeyboardControls } from '@rpgjs/client'
652
- *
653
- * const controls = inject(KeyboardControls)
654
- * controls.setInputs({
655
- [Control.Up]: {
656
- repeat: true,
657
- bind: Input.Up
658
- },
659
- [Control.Down]: {
660
- repeat: true,
661
- bind: Input.Down
662
- },
663
- [Control.Right]: {
664
- repeat: true,
665
- bind: Input.Right
666
- },
667
- [Control.Left]: {
668
- repeat: true,
669
- bind: Input.Left
670
- },
671
- [Control.Action]: {
672
- bind: [Input.Space, Input.Enter]
673
- },
674
- [Control.Back]: {
675
- bind: Input.Escape
676
- },
677
-
678
- // The myscustom1 control is sent to the server when the A key is pressed.
679
- mycustom1: {
680
- bind: Input.A
681
- },
682
-
683
- // the myAction method is executed when the B key is pressed
684
- mycustom2: {
685
- bind: Input.B,
686
- method({ actionName }) {
687
- console.log('cool', actionName)
688
- }
689
- },
690
-
691
- // The player can redo the action after 400ms
692
- mycustom3: {
693
- bind: Input.C,
694
- delay: 400 // ms
695
- },
696
-
697
- // The player can redo the action (mycustom4) and the directions after 400ms
698
- mycustom4: {
699
- bind: Input.C,
700
- delay: {
701
- duration: 400,
702
- otherControls: [Control.Up, Control.Down, Control.Left, Control.Right]
703
- }
704
- }
705
- })
706
- *
707
- * ```
708
- * @enum {string} Control
709
- *
710
- * Control.Up | up
711
- * Control.Down | down
712
- * Control.Left | left
713
- * Control.Right | right
714
- * Control.Action | action
715
- * Control.Back | back
716
- *
717
- * @enum {string} Mouse Event
718
- *
719
- * click | Click
720
- * dblclick | Double Click
721
- * mousedown | Mouse Down
722
- * mouseup | Mouse Up
723
- * mouseover | Mouse Over
724
- * mousemove | Mouse Move
725
- * mouseout | Mouse Out
726
- * contextmenu | Context Menu
727
- *
728
- *
729
- * @enum {string} Input
730
- *
731
- * break | Pause
732
- * backspace | Backspace / Delete
733
- * tab | Tab
734
- * clear | Clear
735
- * enter | Enter
736
- * shift | Shift
737
- * ctrl | Control
738
- * alt | Alt
739
- * pause/break | Pause / Break
740
- * caps lock | Caps Lock
741
- * escape | Escape
742
- * conversion | Conversion
743
- * non-conversion | Non-conversion
744
- * space | Space
745
- * page up | Page Up
746
- * page down | Page Down
747
- * end | End
748
- * home | Home
749
- * left | Left Arrow
750
- * up | Up Arrow
751
- * right | Right Arrow
752
- * down | Down Arrow
753
- * select | Select
754
- * print | Print
755
- * execute | Execute
756
- * Print Screen | Print Screen
757
- * insert | Insert
758
- * delete | Delete
759
- * n0 | 0
760
- * n1 | 1
761
- * n2 | 2
762
- * n3 | 3
763
- * n4 | 4
764
- * n5 | 5
765
- * n6 | 6
766
- * n7 | 7
767
- * n8 | 8
768
- * n9 | 9
769
- * : | Colon
770
- * semicolon (firefox), equals | Semicolon (Firefox), Equals
771
- * < | Less Than
772
- * equals (firefox) | Equals (Firefox)
773
- * ß | Eszett
774
- * @ | At
775
- * a | A
776
- * b | B
777
- * c | C
778
- * d | D
779
- * e | E
780
- * f | F
781
- * g | G
782
- * h | H
783
- * i | I
784
- * j | J
785
- * k | K
786
- * l | L
787
- * m | M
788
- * n | N
789
- * o | O
790
- * p | P
791
- * q | Q
792
- * r | R
793
- * s | S
794
- * t | T
795
- * u | U
796
- * v | V
797
- * w | W
798
- * x | X
799
- * y | Y
800
- * z | Z
801
- * Windows Key / Left ⌘ / Chromebook Search key | Windows Key / Left Command ⌘ / Chromebook Search Key
802
- * right window key | Right Windows Key
803
- * Windows Menu / Right ⌘ | Windows Menu / Right Command ⌘
804
- * numpad 0 | Numpad 0
805
- * numpad 1 | Numpad 1
806
- * numpad 2 | Numpad 2
807
- * numpad 3 | Numpad 3
808
- * numpad 4 | Numpad 4
809
- * numpad 5 | Numpad 5
810
- * numpad 6 | Numpad 6
811
- * numpad 7 | Numpad 7
812
- * numpad 8 | Numpad 8
813
- * numpad 9 | Numpad 9
814
- * multiply | Multiply
815
- * add | Add
816
- * numpad period (firefox) | Numpad Period (Firefox)
817
- * subtract | Subtract
818
- * decimal point | Decimal Point
819
- * divide | Divide
820
- * f1 | F1
821
- * f2 | F2
822
- * f3 | F3
823
- * f4 | F4
824
- * f5 | F5
825
- * f6 | F6
826
- * f7 | F7
827
- * f8 | F8
828
- * f9 | F9
829
- * f10 | F10
830
- * f11 | F11
831
- * f12 | F12
832
- * f13 | F13
833
- * f14 | F14
834
- * f15 | F15
835
- * f16 | F16
836
- * f17 | F17
837
- * f18 | F18
838
- * f19 | F19
839
- * f20 | F20
840
- * f21 | F21
841
- * f22 | F22
842
- * f23 | F23
843
- * f24 | F24
844
- * num lock | Num Lock
845
- * scroll lock | Scroll Lock
846
- * ^ | Caret
847
- * ! | Exclamation Point
848
- * # | Hash
849
- * $ | Dollar Sign
850
- * ù | Grave Accent U
851
- * page backward | Page Backward
852
- * page forward | Page Forward
853
- * closing paren (AZERTY) | Closing Parenthesis (AZERTY)
854
- * * | Asterisk
855
- * ~ + * key | Tilde + Asterisk Key
856
- * minus (firefox), mute/unmute | Minus (Firefox), Mute/Unmute
857
- * decrease volume level | Decrease Volume Level
858
- * increase volume level | Increase Volume Level
859
- * next | Next
860
- * previous | Previous
861
- * stop | Stop
862
- * play/pause | Play/Pause
863
- * e-mail | Email
864
- * mute/unmute (firefox) | Mute/Unmute (Firefox)
865
- * decrease volume level (firefox) | Decrease Volume Level (Firefox)
866
- * increase volume level (firefox) | Increase Volume Level (Firefox)
867
- * semi-colon / ñ | Semicolon / ñ
868
- * equal sign | Equal Sign
869
- * comma | Comma
870
- * dash | Dash
871
- * period | Period
872
- * forward slash / ç | Forward Slash / ç
873
- * grave accent / ñ / æ | Grave Accent / ñ / æ
874
- * ?, / or ° | ?, / or °
875
- * numpad period (chrome) | Numpad Period (Chrome)
876
- * open bracket | Open Bracket
877
- * back slash | Backslash
878
- * close bracket / å | Close Bracket / å
879
- * single quote / ø | Single Quote / ø
880
- * \` | Backtick
881
- * left or right ⌘ key (firefox) | Left or Right Command Key (Firefox)
882
- * altgr | AltGr
883
- * < /git > | < /git >
884
- * GNOME Compose Key | GNOME Compose Key
885
- * ç | ç
886
- * XF86Forward | XF86Forward
887
- * XF86Back | XF86Back
888
- * alphanumeric | Alphanumeric
889
- * hiragana/katakana | Hiragana/Katakana
890
- * half-width/full-width | Half-Width/Full-Width
891
- * kanji | Kanji
892
- * toggle touchpad | Toggle Touchpad
893
- *
894
- * @title Set Inputs
895
- * @method setInputs(inputs)
896
- * @param {object} inputs
897
- * @memberof KeyboardControls
898
- */
899
- setInputs(inputs: Controls) {
900
- if (!inputs) return
901
- this.boundKeys = {}
902
- let inputsTransformed: any = {}
903
- for (let control in inputs) {
904
- const option = inputs[control]
905
- const { bind } = option
906
- let inputsKey: any = bind
907
- if (!Array.isArray(inputsKey)) {
908
- inputsKey = [bind]
909
- }
910
- for (let input of inputsKey) {
911
- this.bindKey(input, control, option)
912
- }
913
- }
914
- this._controlsOptions = inputs
915
- }
916
-
917
- get options(): Controls {
918
- return this._controlsOptions
919
- }
920
- }
921
-
922
- registerDirective('controls', KeyboardControls)
564
+ }