@mintjamsinc/ichigojs 0.1.61 → 0.1.63

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.
@@ -7615,7 +7615,9 @@ class VBindDirective {
7615
7615
  * (lowercased) HTML attribute name. HTML attributes are always lowercase,
7616
7616
  * but custom element props are typically camelCase. This method checks the
7617
7617
  * element's declared _props (set by defineComponent) for a case-insensitive
7618
- * match, falling back to scanning the prototype's own property descriptors.
7618
+ * match against both the raw attribute name and its kebab-case → camelCase
7619
+ * conversion (so `user-name` resolves to `userName`), falling back to the
7620
+ * original name when no match is found.
7619
7621
  */
7620
7622
  #resolveCustomElementPropertyName(element, name) {
7621
7623
  // Fast path: exact match already exists
@@ -7626,13 +7628,23 @@ class VBindDirective {
7626
7628
  const props = element.constructor._props;
7627
7629
  if (Array.isArray(props)) {
7628
7630
  const lowerName = name.toLowerCase();
7629
- const match = props.find(p => p.toLowerCase() === lowerName);
7631
+ const camelName = this.#kebabToCamel(lowerName);
7632
+ const match = props.find(p => {
7633
+ const lowerProp = p.toLowerCase();
7634
+ return lowerProp === lowerName || lowerProp === camelName.toLowerCase() || p === camelName;
7635
+ });
7630
7636
  if (match) {
7631
7637
  return match;
7632
7638
  }
7633
7639
  }
7634
7640
  return name;
7635
7641
  }
7642
+ /**
7643
+ * Converts kebab-case to camelCase (e.g. `user-name` → `userName`).
7644
+ */
7645
+ #kebabToCamel(str) {
7646
+ return str.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
7647
+ }
7636
7648
  /**
7637
7649
  * Checks if the attribute should be set as a DOM property.
7638
7650
  */
@@ -11316,6 +11328,10 @@ class VModelDirective {
11316
11328
  * The `v-on` directive supports event modifiers such as `.stop`, `.prevent`, `.capture`, `.self`, and `.once` to modify the behavior of the event listener.
11317
11329
  * For example, `v-on:click.stop="handleClick"` will stop the event from propagating up the DOM tree.
11318
11330
  *
11331
+ * Key modifiers (KeyboardEvent): `.enter`, `.tab`, `.delete` (Delete/Backspace), `.esc` / `.escape`, `.space`, `.up`, `.down`, `.left`, `.right`.
11332
+ * Mouse button modifiers (MouseEvent): `.left`, `.middle`, `.right`.
11333
+ * System modifiers (KeyboardEvent and MouseEvent): `.shift`, `.ctrl`, `.alt`, `.meta`, plus `.exact` to require that no other system modifiers are held.
11334
+ *
11319
11335
  * Additionally, this directive supports lifecycle hooks:
11320
11336
  * @mount="onMount" - Called before the VNode is mounted to the DOM element
11321
11337
  * @mounted="onMounted" - Called after the VNode is mounted to the DOM element
@@ -11508,14 +11524,14 @@ class VOnDirective {
11508
11524
  const eventName = this.#eventName;
11509
11525
  const useCapture = this.#modifiers.has('capture');
11510
11526
  const isOnce = this.#modifiers.has('once');
11527
+ // System modifier keys (held during the event) shared by KeyboardEvent and MouseEvent.
11528
+ const systemModifiers = ['shift', 'ctrl', 'alt', 'meta'];
11511
11529
  // Create the event listener function
11512
11530
  this.#listener = (event) => {
11513
- // Check key modifiers for keyboard events
11531
+ // Check key modifiers for keyboard events.
11532
+ // The `.left` / `.right` aliases here mean ArrowLeft / ArrowRight; the same tokens
11533
+ // map to mouse buttons further below, dispatched by event type to avoid ambiguity.
11514
11534
  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
11535
  const keyMap = {
11520
11536
  'enter': ['Enter'],
11521
11537
  'tab': ['Tab'],
@@ -11543,6 +11559,46 @@ class VOnDirective {
11543
11559
  }
11544
11560
  }
11545
11561
  }
11562
+ // Check mouse button modifiers for mouse events.
11563
+ // `.left` / `.middle` / `.right` map to MouseEvent.button values 0 / 1 / 2.
11564
+ if (event instanceof MouseEvent) {
11565
+ const buttonMap = {
11566
+ 'left': 0,
11567
+ 'middle': 1,
11568
+ 'right': 2
11569
+ };
11570
+ const hasButtonModifier = Object.keys(buttonMap).some(b => this.#modifiers.has(b));
11571
+ if (hasButtonModifier) {
11572
+ let buttonMatched = false;
11573
+ for (const [modifier, buttonValue] of Object.entries(buttonMap)) {
11574
+ if (this.#modifiers.has(modifier) && event.button === buttonValue) {
11575
+ buttonMatched = true;
11576
+ break;
11577
+ }
11578
+ }
11579
+ if (!buttonMatched) {
11580
+ return;
11581
+ }
11582
+ }
11583
+ }
11584
+ // Check system modifier keys (shift / ctrl / alt / meta) and `.exact`.
11585
+ // These properties exist on both KeyboardEvent and MouseEvent.
11586
+ if (event instanceof KeyboardEvent || event instanceof MouseEvent) {
11587
+ // Required system modifiers must be held.
11588
+ for (const mod of systemModifiers) {
11589
+ if (this.#modifiers.has(mod) && !event[`${mod}Key`]) {
11590
+ return;
11591
+ }
11592
+ }
11593
+ // `.exact` rejects events with extra system modifiers held that weren't listed.
11594
+ if (this.#modifiers.has('exact')) {
11595
+ for (const mod of systemModifiers) {
11596
+ if (event[`${mod}Key`] && !this.#modifiers.has(mod)) {
11597
+ return;
11598
+ }
11599
+ }
11600
+ }
11601
+ }
11546
11602
  // Apply event modifiers
11547
11603
  if (this.#modifiers.has('stop')) {
11548
11604
  event.stopPropagation();