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:
parent
3c415e9cd3
commit
e9145251a9
2 changed files with 10 additions and 2 deletions
|
@ -1,4 +1,11 @@
|
||||||
class OutfitLayer extends HTMLElement {
|
class OutfitLayer extends HTMLElement {
|
||||||
|
#internals;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.#internals = this.attachInternals();
|
||||||
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
setTimeout(() => this.#initializeImage(), 0);
|
setTimeout(() => this.#initializeImage(), 0);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +23,8 @@ class OutfitLayer extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#setStatus(newStatus) {
|
#setStatus(newStatus) {
|
||||||
this.setAttribute("status", newStatus);
|
this.#internals.states.clear();
|
||||||
|
this.#internals.states.add(newStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ body.items-show
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
||||||
&:has(outfit-layer[status="loading"])
|
&:has(outfit-layer:state(loading))
|
||||||
background: gray
|
background: gray
|
||||||
|
|
||||||
.species-color-picker
|
.species-color-picker
|
||||||
|
|
Loading…
Reference in a new issue