class CommandManager extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `
`; this.shadowRoot.querySelectorAll('.tab').forEach(tab => { tab.addEventListener('click', () => { this.shadowRoot.querySelectorAll('.tab').forEach(t => t.classList.remove('active')); tab.classList.add('active'); this.dispatchEvent(new CustomEvent('tab-change', { detail: { tab: tab.textContent }, bubbles: true, composed: true })); }); }); } } customElements.define('command-manager', CommandManager);