const STATUS_LABELS = { draft: 'Draft', assigned: 'Assigned', scheduled: 'Scheduled', in_progress: 'In Progress', pending_review: 'Pending Review', closed: 'Closed', }; const PRIORITY_LABELS = { low: 'Low', normal: 'Normal', high: 'High', urgent: 'Urgent' }; class UiBadge extends HTMLElement { connectedCallback() { this.#render(); } static get observedAttributes() { return ['type', 'value']; } attributeChangedCallback() { this.#render(); } #render() { const type = this.getAttribute('type') || 'status'; const value = this.getAttribute('value') || ''; const label = type === 'priority' ? (PRIORITY_LABELS[value] || value) : (STATUS_LABELS[value] || value.replace('_', ' ')); this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` ${label} `; } } customElements.define('ui-badge', UiBadge);