Comparing version 8.2.16 to 8.2.17
{ | ||
"name": "hybrids", | ||
"version": "8.2.16", | ||
"version": "8.2.17", | ||
"description": "A JavaScript framework for creating fully-featured web applications, components libraries, and single web components with unique declarative and functional architecture", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -22,11 +22,22 @@ import * as cache from "./cache.js"; | ||
HybridsElement = class extends globalThis.HTMLElement { | ||
connectedCallback() { | ||
constructor() { | ||
super(); | ||
for (const key of HybridsElement.settable) { | ||
if (!hasOwnProperty.call(this, key)) continue; | ||
const value = this[key]; | ||
delete this[key]; | ||
this[key] = value; | ||
if (hasOwnProperty.call(this, key)) { | ||
const value = this[key]; | ||
delete this[key]; | ||
this[key] = value; | ||
} else { | ||
const attrName = camelToDash(key); | ||
if (this.hasAttribute(attrName)) { | ||
const value = this.getAttribute(attrName); | ||
this[key] = | ||
(value === "" && typeof this[key] === "boolean") || value; | ||
} | ||
} | ||
} | ||
} | ||
connectedCallback() { | ||
const set = new Set(); | ||
@@ -33,0 +44,0 @@ disconnects.set(this, set); |
@@ -41,13 +41,5 @@ import { camelToDash } from "./utils.js"; | ||
const getters = { | ||
string: (host, attrName) => host.getAttribute(attrName), | ||
number: (host, attrName) => Number(host.getAttribute(attrName)) || 0, | ||
boolean: (host, attrName) => host.hasAttribute(attrName), | ||
undefined: (host, attrName) => host.getAttribute(attrName), | ||
}; | ||
export default function value(key, desc) { | ||
const type = typeof desc.value; | ||
const set = setters[type]; | ||
const get = getters[type]; | ||
@@ -63,4 +55,3 @@ if (!set) { | ||
return { | ||
get: (host, value) => | ||
value === undefined ? get(host, attrName) || desc.value : value, | ||
get: (host, value) => (value === undefined ? desc.value : value), | ||
set: (host, value) => set(host, value, attrName), | ||
@@ -67,0 +58,0 @@ connect: |
@@ -152,3 +152,5 @@ export type Property<E, V> = | ||
export type ModelValues<M extends ModelInstance> = { | ||
[property in keyof M]?: NonNullable<M[property]> extends ModelInstance | ||
[property in keyof M]?: NonNullable<M[property]> extends Array<any> | ||
? Array<ModelValues<Unarray<NonNullable<M[property]>>>> | ||
: NonNullable<M[property]> extends ModelInstance | ||
? ModelValues<NonNullable<M[property]>> | ||
@@ -155,0 +157,0 @@ : M[property]; |
205448
6482