export function register_web_component(
superclass,
tag_name,
shadow,
constructor,
observedAttributes,
superclassTag
) {
console.log('superclass = ', superclass, tag_name, shadow, constructor, observedAttributes, superclassTag);
customElements.define(
tag_name,
class extends superclass {
static get observedAttributes() {
return observedAttributes;
}
constructor() {
super();
constructor(this);
if (shadow) {
this.attachShadow({ mode: "open" });
this._hydrate(this, this.shadowRoot);
}
}
attributeChangedCallback(name, oldValue, newValue) {
this._attributeChangedCallback(this, name, oldValue || "", newValue);
}
connectedCallback() {
if (!this.hasSetup) {
this.hasSetup = true;
if (!shadow) {
this._hydrate(this, this.shadowRoot);
}
}
}
disconnectedCallback() {
}
adoptedCallback() {
}
},
superclassTag ? { extends: superclassTag } : undefined
);
}