mol_view_tree2_lib 1.0.235 → 1.0.236

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
@@ -10776,7 +10776,7 @@ var $;
10776
10776
  })($ || ($ = {}));
10777
10777
 
10778
10778
  ;
10779
- ($.$mol_hotkey) = class $mol_hotkey extends ($.$mol_plugin) {
10779
+ ($.$mol_hotkey2) = class $mol_hotkey2 extends ($.$mol_plugin) {
10780
10780
  keydown(next){
10781
10781
  if(next !== undefined) return next;
10782
10782
  return null;
@@ -10784,20 +10784,11 @@ var $;
10784
10784
  event(){
10785
10785
  return {...(super.event()), "keydown": (next) => (this.keydown(next))};
10786
10786
  }
10787
- key(){
10787
+ action(){
10788
10788
  return {};
10789
10789
  }
10790
- mod_ctrl(){
10791
- return false;
10792
- }
10793
- mod_alt(){
10794
- return false;
10795
- }
10796
- mod_shift(){
10797
- return false;
10798
- }
10799
10790
  };
10800
- ($mol_mem(($.$mol_hotkey.prototype), "keydown"));
10791
+ ($mol_mem(($.$mol_hotkey2.prototype), "keydown"));
10801
10792
 
10802
10793
 
10803
10794
  ;
@@ -10927,27 +10918,71 @@ var $;
10927
10918
  * Plugin which adds handlers for keyboard keys.
10928
10919
  * @see [mol_keyboard_code](../keyboard/code/code.ts)
10929
10920
  */
10930
- class $mol_hotkey extends $.$mol_hotkey {
10931
- key() {
10932
- return super.key();
10933
- }
10921
+ class $mol_hotkey2 extends $.$mol_hotkey2 {
10934
10922
  keydown(event) {
10935
10923
  if (!event)
10936
10924
  return;
10937
10925
  if (event.defaultPrevented)
10938
10926
  return;
10939
- let name = $mol_keyboard_code[event.keyCode];
10940
- if (this.mod_ctrl() !== (event.ctrlKey || event.metaKey))
10941
- return;
10942
- if (this.mod_alt() !== event.altKey)
10943
- return;
10944
- if (this.mod_shift() !== event.shiftKey)
10945
- return;
10946
- const handle = this.key()[name];
10947
- if (handle)
10948
- handle(event);
10927
+ const key = [...new Set([
10928
+ ...(event.ctrlKey || event.metaKey) ? ['ctrl'] : [],
10929
+ ...event.altKey ? ['alt'] : [],
10930
+ ...event.shiftKey ? ['shift'] : [],
10931
+ $mol_keyboard_code[event.keyCode] ?? '?',
10932
+ ])].join('_');
10933
+ this.action()[key]?.(event);
10949
10934
  }
10950
10935
  }
10936
+ $$.$mol_hotkey2 = $mol_hotkey2;
10937
+ })($$ = $.$$ || ($.$$ = {}));
10938
+ })($ || ($ = {}));
10939
+
10940
+ ;
10941
+ ($.$mol_hotkey) = class $mol_hotkey extends ($.$mol_hotkey2) {
10942
+ key(){
10943
+ return {};
10944
+ }
10945
+ mod_ctrl(){
10946
+ return false;
10947
+ }
10948
+ mod_alt(){
10949
+ return false;
10950
+ }
10951
+ mod_shift(){
10952
+ return false;
10953
+ }
10954
+ };
10955
+
10956
+
10957
+ ;
10958
+ "use strict";
10959
+
10960
+
10961
+ ;
10962
+ "use strict";
10963
+ var $;
10964
+ (function ($) {
10965
+ var $$;
10966
+ (function ($$) {
10967
+ /**
10968
+ * Plugin which adds handlers for keyboard keys.
10969
+ * @deprecated Use $mol_hotkey2
10970
+ * @see [mol_keyboard_code](../keyboard/code/code.ts)
10971
+ */
10972
+ class $mol_hotkey extends $.$mol_hotkey {
10973
+ action() {
10974
+ const prefix = [...new Set([
10975
+ ...this.mod_ctrl() ? ['ctrl_'] : [],
10976
+ ...this.mod_alt() ? ['alt_'] : [],
10977
+ ...this.mod_shift() ? ['shift_'] : [],
10978
+ ])].join('');
10979
+ return Object.fromEntries(Object.entries(this.key())
10980
+ .map(([key, val]) => [prefix + key, val]));
10981
+ }
10982
+ }
10983
+ __decorate([
10984
+ $mol_mem
10985
+ ], $mol_hotkey.prototype, "action", null);
10951
10986
  $$.$mol_hotkey = $mol_hotkey;
10952
10987
  })($$ = $.$$ || ($.$$ = {}));
10953
10988
  })($ || ($ = {}));