@mintjamsinc/ichigojs 0.1.56 → 0.1.57

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/dist/ichigo.cjs CHANGED
@@ -11399,23 +11399,27 @@
11399
11399
  this.#listener = (event) => {
11400
11400
  // Check key modifiers for keyboard events
11401
11401
  if (event instanceof KeyboardEvent) {
11402
- const keyModifiers = ['enter', 'tab', 'delete', 'esc', 'space', 'up', 'down', 'left', 'right'];
11403
- const hasKeyModifier = keyModifiers.some(key => this.#modifiers.has(key));
11402
+ // Map of modifier alias -> KeyboardEvent.key values it matches.
11403
+ // Multiple values allow a single modifier to match several physical keys
11404
+ // (e.g. `.delete` matches both Delete and Backspace, matching Vue's behavior).
11405
+ // Multiple aliases pointing to the same key are allowed (e.g. `.esc` / `.escape`).
11406
+ const keyMap = {
11407
+ 'enter': ['Enter'],
11408
+ 'tab': ['Tab'],
11409
+ 'delete': ['Delete', 'Backspace'],
11410
+ 'esc': ['Escape'],
11411
+ 'escape': ['Escape'],
11412
+ 'space': [' '],
11413
+ 'up': ['ArrowUp'],
11414
+ 'down': ['ArrowDown'],
11415
+ 'left': ['ArrowLeft'],
11416
+ 'right': ['ArrowRight']
11417
+ };
11418
+ const hasKeyModifier = Object.keys(keyMap).some(key => this.#modifiers.has(key));
11404
11419
  if (hasKeyModifier) {
11405
- const keyMap = {
11406
- 'enter': 'Enter',
11407
- 'tab': 'Tab',
11408
- 'delete': 'Delete',
11409
- 'esc': 'Escape',
11410
- 'space': ' ',
11411
- 'up': 'ArrowUp',
11412
- 'down': 'ArrowDown',
11413
- 'left': 'ArrowLeft',
11414
- 'right': 'ArrowRight'
11415
- };
11416
11420
  let keyMatched = false;
11417
- for (const [modifier, keyValue] of Object.entries(keyMap)) {
11418
- if (this.#modifiers.has(modifier) && event.key === keyValue) {
11421
+ for (const [modifier, keyValues] of Object.entries(keyMap)) {
11422
+ if (this.#modifiers.has(modifier) && keyValues.includes(event.key)) {
11419
11423
  keyMatched = true;
11420
11424
  break;
11421
11425
  }