/** * Toast Notification System Component */ export class Toast { static container = null; static init() { this.container = document.getElementById('toast-container'); if (!this.container) { this.container = document.createElement('div'); this.container.id = 'toast-container'; this.container.className = 'toast-container'; this.container.setAttribute('role', 'status'); this.container.setAttribute('aria-live', 'polite'); document.body.appendChild(this.container); } } static show({ message, type = 'info', duration = 4000, vibrate = false }) { if (!this.container) this.init(); const toast = document.createElement('div'); toast.className = `toast toast--${type}`; toast.textContent = message; if (vibrate && typeof navigator !== 'undefined' && 'vibrate' in navigator) { try { navigator.vibrate([200, 100, 200]); } catch { // Ignore } } this.container.appendChild(toast); if (duration > 0) { setTimeout(() => { toast.style.opacity = '0'; toast.style.transition = 'opacity 0.3s ease'; setTimeout(() => toast.remove(), 300); }, duration); } } }