class CustomAlert extends HTMLElement { connectedCallback() { const type = this.getAttribute('type') || 'info'; const message = this.getAttribute('message') || ''; const dismissible = this.hasAttribute('dismissible'); let icon, bgColor, textColor; switch(type) { case 'success': icon = 'check-circle'; bgColor = 'bg-green-100'; textColor = 'text-green-800'; break; case 'error': icon = 'alert-circle'; bgColor = 'bg-red-100'; textColor = 'text-red-800'; break; case 'warning': icon = 'alert-triangle'; bgColor = 'bg-yellow-100'; textColor = 'text-yellow-800'; break; default: icon = 'info'; bgColor = 'bg-primary-100'; textColor = 'text-primary-800'; } this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `
${message}
${dismissible ? `
` : ''}
`; if (dismissible) { this.shadowRoot.getElementById('dismiss').addEventListener('click', () => { this.remove(); }); } } } customElements.define('custom-alert', CustomAlert);