class CustomSidebar extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; } connectedCallback() { this.shadowRoot.querySelector('#toggle-sidebar').addEventListener('click', () => { const sidebar = this.shadowRoot.querySelector('.sidebar'); sidebar.classList.toggle('w-72'); sidebar.classList.toggle('w-20'); // Toggle text visibility this.shadowRoot.querySelectorAll('.module-btn span:not(:first-child)').forEach(el => { el.classList.toggle('hidden'); }); this.shadowRoot.querySelectorAll('.settings-select, .sidebar-header > div > div:last-child, button span').forEach(el => { el.classList.toggle('hidden'); }); }); // Initialize feather icons feather.replace(); } } customElements.define('custom-sidebar', CustomSidebar);