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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mol_view_tree2_lib",
3
- "version": "1.0.235",
3
+ "version": "1.0.236",
4
4
  "exports": {
5
5
  "node": {
6
6
  "import": "./node.mjs",
package/web.test.js CHANGED
@@ -4962,7 +4962,7 @@ var $;
4962
4962
  })($ || ($ = {}));
4963
4963
 
4964
4964
  ;
4965
- ($.$mol_hotkey) = class $mol_hotkey extends ($.$mol_plugin) {
4965
+ ($.$mol_hotkey2) = class $mol_hotkey2 extends ($.$mol_plugin) {
4966
4966
  keydown(next){
4967
4967
  if(next !== undefined) return next;
4968
4968
  return null;
@@ -4970,6 +4970,48 @@ var $;
4970
4970
  event(){
4971
4971
  return {...(super.event()), "keydown": (next) => (this.keydown(next))};
4972
4972
  }
4973
+ action(){
4974
+ return {};
4975
+ }
4976
+ };
4977
+ ($mol_mem(($.$mol_hotkey2.prototype), "keydown"));
4978
+
4979
+
4980
+ ;
4981
+ "use strict";
4982
+
4983
+
4984
+ ;
4985
+ "use strict";
4986
+ var $;
4987
+ (function ($) {
4988
+ var $$;
4989
+ (function ($$) {
4990
+ /**
4991
+ * Plugin which adds handlers for keyboard keys.
4992
+ * @see [mol_keyboard_code](../keyboard/code/code.ts)
4993
+ */
4994
+ class $mol_hotkey2 extends $.$mol_hotkey2 {
4995
+ keydown(event) {
4996
+ if (!event)
4997
+ return;
4998
+ if (event.defaultPrevented)
4999
+ return;
5000
+ const key = [...new Set([
5001
+ ...(event.ctrlKey || event.metaKey) ? ['ctrl'] : [],
5002
+ ...event.altKey ? ['alt'] : [],
5003
+ ...event.shiftKey ? ['shift'] : [],
5004
+ $mol_keyboard_code[event.keyCode] ?? '?',
5005
+ ])].join('_');
5006
+ this.action()[key]?.(event);
5007
+ }
5008
+ }
5009
+ $$.$mol_hotkey2 = $mol_hotkey2;
5010
+ })($$ = $.$$ || ($.$$ = {}));
5011
+ })($ || ($ = {}));
5012
+
5013
+ ;
5014
+ ($.$mol_hotkey) = class $mol_hotkey extends ($.$mol_hotkey2) {
4973
5015
  key(){
4974
5016
  return {};
4975
5017
  }
@@ -4983,7 +5025,6 @@ var $;
4983
5025
  return false;
4984
5026
  }
4985
5027
  };
4986
- ($mol_mem(($.$mol_hotkey.prototype), "keydown"));
4987
5028
 
4988
5029
 
4989
5030
  ;
@@ -4998,29 +5039,23 @@ var $;
4998
5039
  (function ($$) {
4999
5040
  /**
5000
5041
  * Plugin which adds handlers for keyboard keys.
5042
+ * @deprecated Use $mol_hotkey2
5001
5043
  * @see [mol_keyboard_code](../keyboard/code/code.ts)
5002
5044
  */
5003
5045
  class $mol_hotkey extends $.$mol_hotkey {
5004
- key() {
5005
- return super.key();
5006
- }
5007
- keydown(event) {
5008
- if (!event)
5009
- return;
5010
- if (event.defaultPrevented)
5011
- return;
5012
- let name = $mol_keyboard_code[event.keyCode];
5013
- if (this.mod_ctrl() !== (event.ctrlKey || event.metaKey))
5014
- return;
5015
- if (this.mod_alt() !== event.altKey)
5016
- return;
5017
- if (this.mod_shift() !== event.shiftKey)
5018
- return;
5019
- const handle = this.key()[name];
5020
- if (handle)
5021
- handle(event);
5046
+ action() {
5047
+ const prefix = [...new Set([
5048
+ ...this.mod_ctrl() ? ['ctrl_'] : [],
5049
+ ...this.mod_alt() ? ['alt_'] : [],
5050
+ ...this.mod_shift() ? ['shift_'] : [],
5051
+ ])].join('');
5052
+ return Object.fromEntries(Object.entries(this.key())
5053
+ .map(([key, val]) => [prefix + key, val]));
5022
5054
  }
5023
5055
  }
5056
+ __decorate([
5057
+ $mol_mem
5058
+ ], $mol_hotkey.prototype, "action", null);
5024
5059
  $$.$mol_hotkey = $mol_hotkey;
5025
5060
  })($$ = $.$$ || ($.$$ = {}));
5026
5061
  })($ || ($ = {}));