class CustomSidebar extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; } static get observedAttributes() { return ['open']; } attributeChangedCallback(name, oldValue, newValue) { if (name === 'open') { this.shadowRoot.host.style.transform = newValue !== null ? 'translateX(0)' : 'translateX(-100%)'; } } } customElements.define('custom-sidebar', CustomSidebar);