@mintjamsinc/ichigojs 0.1.61 → 0.1.62

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.
@@ -11316,6 +11316,10 @@ class VModelDirective {
11316
11316
  * The `v-on` directive supports event modifiers such as `.stop`, `.prevent`, `.capture`, `.self`, and `.once` to modify the behavior of the event listener.
11317
11317
  * For example, `v-on:click.stop="handleClick"` will stop the event from propagating up the DOM tree.
11318
11318
  *
11319
+ * Key modifiers (KeyboardEvent): `.enter`, `.tab`, `.delete` (Delete/Backspace), `.esc` / `.escape`, `.space`, `.up`, `.down`, `.left`, `.right`.
11320
+ * Mouse button modifiers (MouseEvent): `.left`, `.middle`, `.right`.
11321
+ * System modifiers (KeyboardEvent and MouseEvent): `.shift`, `.ctrl`, `.alt`, `.meta`, plus `.exact` to require that no other system modifiers are held.
11322
+ *
11319
11323
  * Additionally, this directive supports lifecycle hooks:
11320
11324
  * @mount="onMount" - Called before the VNode is mounted to the DOM element
11321
11325
  * @mounted="onMounted" - Called after the VNode is mounted to the DOM element
@@ -11508,14 +11512,14 @@ class VOnDirective {
11508
11512
  const eventName = this.#eventName;
11509
11513
  const useCapture = this.#modifiers.has('capture');
11510
11514
  const isOnce = this.#modifiers.has('once');
11515
+ // System modifier keys (held during the event) shared by KeyboardEvent and MouseEvent.
11516
+ const systemModifiers = ['shift', 'ctrl', 'alt', 'meta'];
11511
11517
  // Create the event listener function
11512
11518
  this.#listener = (event) => {
11513
- // Check key modifiers for keyboard events
11519
+ // Check key modifiers for keyboard events.
11520
+ // The `.left` / `.right` aliases here mean ArrowLeft / ArrowRight; the same tokens
11521
+ // map to mouse buttons further below, dispatched by event type to avoid ambiguity.
11514
11522
  if (event instanceof KeyboardEvent) {
11515
- // Map of modifier alias -> KeyboardEvent.key values it matches.
11516
- // Multiple values allow a single modifier to match several physical keys
11517
- // (e.g. `.delete` matches both Delete and Backspace, matching Vue's behavior).
11518
- // Multiple aliases pointing to the same key are allowed (e.g. `.esc` / `.escape`).
11519
11523
  const keyMap = {
11520
11524
  'enter': ['Enter'],
11521
11525
  'tab': ['Tab'],
@@ -11543,6 +11547,46 @@ class VOnDirective {
11543
11547
  }
11544
11548
  }
11545
11549
  }
11550
+ // Check mouse button modifiers for mouse events.
11551
+ // `.left` / `.middle` / `.right` map to MouseEvent.button values 0 / 1 / 2.
11552
+ if (event instanceof MouseEvent) {
11553
+ const buttonMap = {
11554
+ 'left': 0,
11555
+ 'middle': 1,
11556
+ 'right': 2
11557
+ };
11558
+ const hasButtonModifier = Object.keys(buttonMap).some(b => this.#modifiers.has(b));
11559
+ if (hasButtonModifier) {
11560
+ let buttonMatched = false;
11561
+ for (const [modifier, buttonValue] of Object.entries(buttonMap)) {
11562
+ if (this.#modifiers.has(modifier) && event.button === buttonValue) {
11563
+ buttonMatched = true;
11564
+ break;
11565
+ }
11566
+ }
11567
+ if (!buttonMatched) {
11568
+ return;
11569
+ }
11570
+ }
11571
+ }
11572
+ // Check system modifier keys (shift / ctrl / alt / meta) and `.exact`.
11573
+ // These properties exist on both KeyboardEvent and MouseEvent.
11574
+ if (event instanceof KeyboardEvent || event instanceof MouseEvent) {
11575
+ // Required system modifiers must be held.
11576
+ for (const mod of systemModifiers) {
11577
+ if (this.#modifiers.has(mod) && !event[`${mod}Key`]) {
11578
+ return;
11579
+ }
11580
+ }
11581
+ // `.exact` rejects events with extra system modifiers held that weren't listed.
11582
+ if (this.#modifiers.has('exact')) {
11583
+ for (const mod of systemModifiers) {
11584
+ if (event[`${mod}Key`] && !this.#modifiers.has(mod)) {
11585
+ return;
11586
+ }
11587
+ }
11588
+ }
11589
+ }
11546
11590
  // Apply event modifiers
11547
11591
  if (this.#modifiers.has('stop')) {
11548
11592
  event.stopPropagation();