mam 1.11.964 → 1.11.965

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.test.js CHANGED
@@ -13949,7 +13949,7 @@ var $;
13949
13949
  })($ || ($ = {}));
13950
13950
 
13951
13951
  ;
13952
- ($.$mol_hotkey) = class $mol_hotkey extends ($.$mol_plugin) {
13952
+ ($.$mol_hotkey2) = class $mol_hotkey2 extends ($.$mol_plugin) {
13953
13953
  keydown(next){
13954
13954
  if(next !== undefined) return next;
13955
13955
  return null;
@@ -13957,20 +13957,11 @@ var $;
13957
13957
  event(){
13958
13958
  return {...(super.event()), "keydown": (next) => (this.keydown(next))};
13959
13959
  }
13960
- key(){
13960
+ action(){
13961
13961
  return {};
13962
13962
  }
13963
- mod_ctrl(){
13964
- return false;
13965
- }
13966
- mod_alt(){
13967
- return false;
13968
- }
13969
- mod_shift(){
13970
- return false;
13971
- }
13972
13963
  };
13973
- ($mol_mem(($.$mol_hotkey.prototype), "keydown"));
13964
+ ($mol_mem(($.$mol_hotkey2.prototype), "keydown"));
13974
13965
 
13975
13966
 
13976
13967
  ;
@@ -14100,27 +14091,71 @@ var $;
14100
14091
  * Plugin which adds handlers for keyboard keys.
14101
14092
  * @see [mol_keyboard_code](../keyboard/code/code.ts)
14102
14093
  */
14103
- class $mol_hotkey extends $.$mol_hotkey {
14104
- key() {
14105
- return super.key();
14106
- }
14094
+ class $mol_hotkey2 extends $.$mol_hotkey2 {
14107
14095
  keydown(event) {
14108
14096
  if (!event)
14109
14097
  return;
14110
14098
  if (event.defaultPrevented)
14111
14099
  return;
14112
- let name = $mol_keyboard_code[event.keyCode];
14113
- if (this.mod_ctrl() !== (event.ctrlKey || event.metaKey))
14114
- return;
14115
- if (this.mod_alt() !== event.altKey)
14116
- return;
14117
- if (this.mod_shift() !== event.shiftKey)
14118
- return;
14119
- const handle = this.key()[name];
14120
- if (handle)
14121
- handle(event);
14100
+ const key = [...new Set([
14101
+ ...(event.ctrlKey || event.metaKey) ? ['ctrl'] : [],
14102
+ ...event.altKey ? ['alt'] : [],
14103
+ ...event.shiftKey ? ['shift'] : [],
14104
+ $mol_keyboard_code[event.keyCode] ?? '?',
14105
+ ])].join('_');
14106
+ this.action()[key]?.(event);
14122
14107
  }
14123
14108
  }
14109
+ $$.$mol_hotkey2 = $mol_hotkey2;
14110
+ })($$ = $.$$ || ($.$$ = {}));
14111
+ })($ || ($ = {}));
14112
+
14113
+ ;
14114
+ ($.$mol_hotkey) = class $mol_hotkey extends ($.$mol_hotkey2) {
14115
+ key(){
14116
+ return {};
14117
+ }
14118
+ mod_ctrl(){
14119
+ return false;
14120
+ }
14121
+ mod_alt(){
14122
+ return false;
14123
+ }
14124
+ mod_shift(){
14125
+ return false;
14126
+ }
14127
+ };
14128
+
14129
+
14130
+ ;
14131
+ "use strict";
14132
+
14133
+
14134
+ ;
14135
+ "use strict";
14136
+ var $;
14137
+ (function ($) {
14138
+ var $$;
14139
+ (function ($$) {
14140
+ /**
14141
+ * Plugin which adds handlers for keyboard keys.
14142
+ * @deprecated Use $mol_hotkey2
14143
+ * @see [mol_keyboard_code](../keyboard/code/code.ts)
14144
+ */
14145
+ class $mol_hotkey extends $.$mol_hotkey {
14146
+ action() {
14147
+ const prefix = [...new Set([
14148
+ ...this.mod_ctrl() ? ['ctrl_'] : [],
14149
+ ...this.mod_alt() ? ['alt_'] : [],
14150
+ ...this.mod_shift() ? ['shift_'] : [],
14151
+ ])].join('');
14152
+ return Object.fromEntries(Object.entries(this.key())
14153
+ .map(([key, val]) => [prefix + key, val]));
14154
+ }
14155
+ }
14156
+ __decorate([
14157
+ $mol_mem
14158
+ ], $mol_hotkey.prototype, "action", null);
14124
14159
  $$.$mol_hotkey = $mol_hotkey;
14125
14160
  })($$ = $.$$ || ($.$$ = {}));
14126
14161
  })($ || ($ = {}));