class CustomProjectCard extends HTMLElement { constructor() { super(); this.title = this.getAttribute('title') || 'Untitled Project'; this.progress = parseInt(this.getAttribute('progress')) || 0; this.dueDate = this.getAttribute('due-date') || ''; this.members = parseInt(this.getAttribute('members')) || 0; this.tasks = parseInt(this.getAttribute('tasks')) || 0; this.color = this.getAttribute('color') || 'primary'; } connectedCallback() { this.attachShadow({ mode: 'open' }); this.render(); } static get observedAttributes() { return ['title', 'progress', 'due-date', 'members', 'tasks', 'color']; } attributeChangedCallback(name, oldValue, newValue) { if (oldValue !== newValue) { if (name === 'progress') { this.progress = parseInt(newValue); } else if (name === 'members' || name === 'tasks') { this[name] = parseInt(newValue); } else { this[name] = newValue; } this.render(); } } render() { const colorClass = this.color === 'primary' ? 'primary' : this.color; const colorMap = { 'primary': { bg: 'bg-primary-100', text: 'text-primary-800', progress: 'bg-primary-600' }, 'blue': { bg: 'bg-blue-100', text: 'text-blue-800', progress: 'bg-blue-600' }, 'green': { bg: 'bg-green-100', text: 'text-green-800', progress: 'bg-green-600' }, 'purple': { bg: 'bg-purple-100', text: 'text-purple-800', progress: 'bg-purple-600' }, 'yellow': { bg: 'bg-yellow-100', text: 'text-yellow-800', progress: 'bg-yellow-600' } }; const colors = colorMap[colorClass] || colorMap.primary; const formattedDate = this.dueDate ? Utils.formatDate(this.dueDate) : 'No due date'; const relativeDate = this.dueDate ? Utils.formatRelativeDate(this.dueDate) : ''; this.shadowRoot.innerHTML = `