): void {
super.willUpdate(changedProperties);
if (changedProperties.has("show")) {
if (this.timeout) {
window.clearTimeout(this.timeout);
this.timeout = undefined;
}
if (this.show && this.duration > 0 && this.duration < Infinity) {
this.timeout = window.setTimeout(() => this.close(true), this.duration);
}
}
}
override render() {
return html`
{ e.stopPropagation(); this.hide() }}
@close=${() => this.close()}
@keyup=${clickOnEnterAndSpace}
>
`;
}
protected override firstUpdated(): void {
requestAnimationFrame(() => {
this.show = true;
});
}
override disconnectedCallback(): void {
super.disconnectedCallback();
if (this.timeout) {
window.clearTimeout(this.timeout);
this.timeout = undefined;
}
}
}