class CustomProfileEditor extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `
Profile
Background
Colors
`; // Tab switching this.shadowRoot.querySelectorAll('.tab').forEach(tab => { tab.addEventListener('click', () => { this.shadowRoot.querySelectorAll('.tab').forEach(t => t.classList.remove('active')); this.shadowRoot.querySelectorAll('.tab-content').forEach(c => c.style.display = 'none'); tab.classList.add('active'); const tabId = tab.getAttribute('data-tab') + '-tab'; this.shadowRoot.getElementById(tabId).style.display = 'block'; }); }); // Background select change this.shadowRoot.getElementById('background-select').addEventListener('change', (e) => { const customGroup = this.shadowRoot.getElementById('custom-bg-group'); customGroup.style.display = e.target.value === 'custom' ? 'block' : 'none'; }); // Color picker this.shadowRoot.querySelectorAll('.color-option').forEach(option => { option.addEventListener('click', (e) => { const color = e.target.getAttribute('data-color'); const pickerGroup = e.target.closest('.form-group'); const label = pickerGroup.querySelector('label').textContent.toLowerCase(); console.log(`Setting ${label} color to: ${color}`); // Would apply this color to the appropriate elements }); }); // Save button this.shadowRoot.querySelector('.save-btn').addEventListener('click', () => { alert('Profile saved! (This is a demo)'); }); } } customElements.define('custom-profile-editor', CustomProfileEditor);