class CustomStatsCard extends HTMLElement { static get observedAttributes() { return ['title', 'value', 'icon', 'color']; } constructor() { super(); this.attachShadow({ mode: 'open' }); } attributeChangedCallback(name, oldValue, newValue) { this.render(); } connectedCallback() { this.render(); } render() { const title = this.getAttribute('title') || 'Title'; const value = this.getAttribute('value') || '0'; const icon = this.getAttribute('icon') || 'activity'; const color = this.getAttribute('color') || 'primary'; const colorClasses = { primary: 'from-primary-500 to-primary-600 shadow-primary-500/25', secondary: 'from-secondary-500 to-secondary-600 shadow-secondary-500/25', blue: 'from-blue-500 to-blue-600 shadow-blue-500/25', emerald: 'from-emerald-500 to-emerald-600 shadow-emerald-500/25', rose: 'from-rose-500 to-rose-600 shadow-rose-500/25' }; const iconColors = { primary: 'text-primary-400', secondary: 'text-secondary-400', blue: 'text-blue-400', emerald: 'text-emerald-400', rose: 'text-rose-400' }; this.shadowRoot.innerHTML = `

${title}

${value}

${this.getIconPath(icon)}
Updated just now
`; } getIconPath(icon) { const icons = { 'dollar-sign': '', 'trending-up': '', 'activity': '', 'bar-chart-2': '', 'user': '' }; return icons[icon] || icons['activity']; } } customElements.define('custom-stats-card', CustomStatsCard);