Cleanup the mixin and remove the style caching since it stopped working somehow

This commit is contained in:
Oliver-Akins 2025-02-06 21:14:47 -07:00
parent b0691e0002
commit adde24e410

View file

@ -24,12 +24,6 @@ export function StyledShadowElement(Base) {
/** @type {ShadowRoot} */ /** @type {ShadowRoot} */
_shadow; _shadow;
/**
* The hook ID for this element's CSS hot reload
* @type {number}
*/
#cssHmr;
constructor() { constructor() {
super(); super();
@ -49,24 +43,16 @@ export function StyledShadowElement(Base) {
disconnectedCallback() { disconnectedCallback() {
if (!this.#mounted) { return }; if (!this.#mounted) { return };
if (this.#cssHmr != null) {
Hooks.off(`dd-hmr:css`, this.#cssHmr);
this.#cssHmr = null;
};
this.#mounted = false; this.#mounted = false;
}; };
_getStyles() { _getStyles() {
if (this.constructor._styles) { // TODO: Cache the CSS content in a more sane way that doesn't break
this._style.innerHTML = this.constructor._styles; fetch(`./systems/${game.system.id}/templates/${this.constructor._stylePath}`)
} else { .then(r => r.text())
fetch(`./systems/${game.system.id}/templates/${this.constructor._stylePath}`) .then(t => {
.then(r => r.text()) this._style.innerHTML = t;
.then(t => { });
this.constructor._styles = t;
this._style.innerHTML = t;
});
}
}; };
}; };
}; };