@mintjamsinc/ichigojs 0.1.62 → 0.1.64

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.
@@ -7597,41 +7597,65 @@ class VBindDirective {
7597
7597
  * Returns true when the target is a custom element and the binding should be
7598
7598
  * delivered as a property rather than an HTML attribute.
7599
7599
  *
7600
- * Two conditions trigger property delivery:
7600
+ * Three conditions trigger property delivery:
7601
7601
  * 1. The value is an object or array — serialising these to a string attribute
7602
7602
  * would lose type information.
7603
7603
  * 2. The element exposes a matching property accessor (e.g. a prop declared via
7604
7604
  * defineComponent), even when the value is a primitive.
7605
+ * 3. The element declares a matching prop in its static _props (case-insensitive
7606
+ * and kebab-case → camelCase tolerant), so primitive values reach the
7607
+ * reactive binding via the generated setter instead of being lost as a
7608
+ * plain HTML attribute that no attributeChangedCallback observes.
7605
7609
  */
7606
7610
  #isCustomElementProperty(element, name, value) {
7607
7611
  if (!element.tagName.includes('-')) {
7608
7612
  return false;
7609
7613
  }
7610
7614
  const isObjectOrArray = Array.isArray(value) || (typeof value === 'object' && value !== null);
7611
- return isObjectOrArray || name in element;
7615
+ if (isObjectOrArray || name in element) {
7616
+ return true;
7617
+ }
7618
+ return this.#findDeclaredProp(element, name) !== undefined;
7612
7619
  }
7613
7620
  /**
7614
7621
  * Resolves the actual property name on a custom element for a given
7615
7622
  * (lowercased) HTML attribute name. HTML attributes are always lowercase,
7616
7623
  * but custom element props are typically camelCase. This method checks the
7617
7624
  * element's declared _props (set by defineComponent) for a case-insensitive
7618
- * match, falling back to scanning the prototype's own property descriptors.
7625
+ * match against both the raw attribute name and its kebab-case → camelCase
7626
+ * conversion (so `user-name` resolves to `userName`), falling back to the
7627
+ * original name when no match is found.
7619
7628
  */
7620
7629
  #resolveCustomElementPropertyName(element, name) {
7621
7630
  // Fast path: exact match already exists
7622
7631
  if (name in element) {
7623
7632
  return name;
7624
7633
  }
7625
- // Check declared _props from defineComponent / IchigoElement
7634
+ return this.#findDeclaredProp(element, name) ?? name;
7635
+ }
7636
+ /**
7637
+ * Looks up a declared prop on a custom element constructor whose name matches
7638
+ * the given attribute name, treating the comparison as case-insensitive and
7639
+ * tolerant of kebab-case → camelCase conversion. Returns the canonical prop
7640
+ * name (as declared) when a match is found, or undefined otherwise.
7641
+ */
7642
+ #findDeclaredProp(element, name) {
7626
7643
  const props = element.constructor._props;
7627
- if (Array.isArray(props)) {
7628
- const lowerName = name.toLowerCase();
7629
- const match = props.find(p => p.toLowerCase() === lowerName);
7630
- if (match) {
7631
- return match;
7632
- }
7644
+ if (!Array.isArray(props)) {
7645
+ return undefined;
7633
7646
  }
7634
- return name;
7647
+ const lowerName = name.toLowerCase();
7648
+ const camelLower = this.#kebabToCamel(lowerName).toLowerCase();
7649
+ return props.find(p => {
7650
+ const lowerProp = p.toLowerCase();
7651
+ return lowerProp === lowerName || lowerProp === camelLower;
7652
+ });
7653
+ }
7654
+ /**
7655
+ * Converts kebab-case to camelCase (e.g. `user-name` → `userName`).
7656
+ */
7657
+ #kebabToCamel(str) {
7658
+ return str.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
7635
7659
  }
7636
7660
  /**
7637
7661
  * Checks if the attribute should be set as a DOM property.