1
0
Fork 0
forked from OpenNeo/impress

Refactor outfit-layer component to use internal state API, not attrs

Oh right okay, attributes like `status="loading"` are more of an API
for the caller, whereas the internal state API is where you wanna put
things that are meant to be used in CSS selectors and stuff.
This commit is contained in:
Emi Matchu 2024-07-02 22:34:51 -07:00
parent 3c415e9cd3
commit e9145251a9
2 changed files with 10 additions and 2 deletions

View file

@ -1,4 +1,11 @@
class OutfitLayer extends HTMLElement {
#internals;
constructor() {
super();
this.#internals = this.attachInternals();
}
connectedCallback() {
setTimeout(() => this.#initializeImage(), 0);
}
@ -16,7 +23,8 @@ class OutfitLayer extends HTMLElement {
}
#setStatus(newStatus) {
this.setAttribute("status", newStatus);
this.#internals.states.clear();
this.#internals.states.add(newStatus);
}
}

View file

@ -58,7 +58,7 @@ body.items-show
width: 100%
height: 100%
&:has(outfit-layer[status="loading"])
&:has(outfit-layer:state(loading))
background: gray
.species-color-picker