class ProgressItem extends HTMLElement { static get observedAttributes() { return ['label', 'value', 'progress']; } attributeChangedCallback(name, oldValue, newValue) { if (this.shadowRoot) { this.render(); } } connectedCallback() { this.attachShadow({ mode: 'open' }); this.render(); } render() { const label = this.getAttribute('label') || ''; const value = this.getAttribute('value') || '0%'; const progress = parseInt(this.getAttribute('progress') || '0'); this.shadowRoot.innerHTML = `
${label} ${value}
`; } } customElements.define('progress-item', ProgressItem);