Cleanup the mixin and remove the style caching since it stopped working somehow
This commit is contained in:
parent
b0691e0002
commit
adde24e410
1 changed files with 6 additions and 20 deletions
|
|
@ -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;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue