@mintjamsinc/ichigojs 0.1.63 → 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.
package/dist/ichigo.cjs CHANGED
@@ -7603,18 +7603,25 @@
7603
7603
  * Returns true when the target is a custom element and the binding should be
7604
7604
  * delivered as a property rather than an HTML attribute.
7605
7605
  *
7606
- * Two conditions trigger property delivery:
7606
+ * Three conditions trigger property delivery:
7607
7607
  * 1. The value is an object or array — serialising these to a string attribute
7608
7608
  * would lose type information.
7609
7609
  * 2. The element exposes a matching property accessor (e.g. a prop declared via
7610
7610
  * defineComponent), even when the value is a primitive.
7611
+ * 3. The element declares a matching prop in its static _props (case-insensitive
7612
+ * and kebab-case → camelCase tolerant), so primitive values reach the
7613
+ * reactive binding via the generated setter instead of being lost as a
7614
+ * plain HTML attribute that no attributeChangedCallback observes.
7611
7615
  */
7612
7616
  #isCustomElementProperty(element, name, value) {
7613
7617
  if (!element.tagName.includes('-')) {
7614
7618
  return false;
7615
7619
  }
7616
7620
  const isObjectOrArray = Array.isArray(value) || (typeof value === 'object' && value !== null);
7617
- return isObjectOrArray || name in element;
7621
+ if (isObjectOrArray || name in element) {
7622
+ return true;
7623
+ }
7624
+ return this.#findDeclaredProp(element, name) !== undefined;
7618
7625
  }
7619
7626
  /**
7620
7627
  * Resolves the actual property name on a custom element for a given
@@ -7630,20 +7637,25 @@
7630
7637
  if (name in element) {
7631
7638
  return name;
7632
7639
  }
7633
- // Check declared _props from defineComponent / IchigoElement
7640
+ return this.#findDeclaredProp(element, name) ?? name;
7641
+ }
7642
+ /**
7643
+ * Looks up a declared prop on a custom element constructor whose name matches
7644
+ * the given attribute name, treating the comparison as case-insensitive and
7645
+ * tolerant of kebab-case → camelCase conversion. Returns the canonical prop
7646
+ * name (as declared) when a match is found, or undefined otherwise.
7647
+ */
7648
+ #findDeclaredProp(element, name) {
7634
7649
  const props = element.constructor._props;
7635
- if (Array.isArray(props)) {
7636
- const lowerName = name.toLowerCase();
7637
- const camelName = this.#kebabToCamel(lowerName);
7638
- const match = props.find(p => {
7639
- const lowerProp = p.toLowerCase();
7640
- return lowerProp === lowerName || lowerProp === camelName.toLowerCase() || p === camelName;
7641
- });
7642
- if (match) {
7643
- return match;
7644
- }
7650
+ if (!Array.isArray(props)) {
7651
+ return undefined;
7645
7652
  }
7646
- return name;
7653
+ const lowerName = name.toLowerCase();
7654
+ const camelLower = this.#kebabToCamel(lowerName).toLowerCase();
7655
+ return props.find(p => {
7656
+ const lowerProp = p.toLowerCase();
7657
+ return lowerProp === lowerName || lowerProp === camelLower;
7658
+ });
7647
7659
  }
7648
7660
  /**
7649
7661
  * Converts kebab-case to camelCase (e.g. `user-name` → `userName`).