function stack() { let el = document.querySelector(".toast-stack"); if (!el) { el = document.createElement("div"); el.className = "toast-stack"; el.setAttribute("aria-live", "polite"); document.body.append(el); } return el; } export function showToast(text, type = "") { const toast = document.createElement("div"); toast.className = `toast ${type}`.trim(); toast.textContent = text; stack().append(toast); setTimeout(() => toast.remove(), 4500); }