ts: format finally

formatted with biome, a config file is provided.
This commit is contained in:
Harvey Tindall
2025-12-08 20:38:30 +00:00
parent ca7c553147
commit 817107622a
29 changed files with 3956 additions and 2610 deletions
+19 -15
View File
@@ -9,14 +9,16 @@ export class Modal implements Modal {
this.modal = modal;
this.openEvent = new CustomEvent("modal-open-" + modal.id);
this.closeEvent = new CustomEvent("modal-close-" + modal.id);
const closeButton = this.modal.querySelector('span.modal-close');
const closeButton = this.modal.querySelector("span.modal-close");
if (closeButton !== null) {
this.closeButton = closeButton as HTMLSpanElement;
this.closeButton.onclick = this.close;
}
if (!important) {
window.addEventListener('click', (event: Event) => {
if (event.target == this.modal) { this.close(); }
window.addEventListener("click", (event: Event) => {
if (event.target == this.modal) {
this.close();
}
});
}
}
@@ -26,36 +28,38 @@ export class Modal implements Modal {
if (event) {
event.preventDefault();
}
this.modal.classList.add('animate-fade-out');
this.modal.classList.add("animate-fade-out");
this.modal.classList.remove("animate-fade-in");
const modal = this.modal;
const listenerFunc = () => {
modal.classList.remove('block');
modal.classList.remove('animate-fade-out');
modal.removeEventListener(window.animationEvent, listenerFunc)
modal.classList.remove("block");
modal.classList.remove("animate-fade-out");
modal.removeEventListener(window.animationEvent, listenerFunc);
if (!noDispatch) document.dispatchEvent(this.closeEvent);
};
this.modal.addEventListener(window.animationEvent, listenerFunc, false);
}
};
set onopen(f: () => void) {
document.addEventListener("modal-open-"+this.modal.id, f);
document.addEventListener("modal-open-" + this.modal.id, f);
}
set onclose(f: () => void) {
document.addEventListener("modal-close-"+this.modal.id, f);
document.addEventListener("modal-close-" + this.modal.id, f);
}
show = () => {
this.modal.classList.add('block', 'animate-fade-in');
this.modal.classList.add("block", "animate-fade-in");
document.dispatchEvent(this.openEvent);
}
};
toggle = () => {
if (this.modal.classList.contains('animate-fade-in')) {
if (this.modal.classList.contains("animate-fade-in")) {
this.close();
} else {
this.show();
}
}
};
asElement = () => { return this.modal; }
asElement = () => {
return this.modal;
};
}