class CustomToast extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
}
show(message, type = 'info', duration = 3000) {
const toast = this.shadowRoot.querySelector('.toast');
toast.textContent = message;
toast.className = 'toast ' + type;
toast.classList.add('visible');
setTimeout(() => {
toast.classList.remove('visible');
setTimeout(() => this.remove(), 300);
}, duration);
}
}
customElements.define('custom-toast', CustomToast);