class ShareButton extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; this.shadowRoot.querySelector('button').addEventListener('click', () => this.shareContent()); } shareContent() { const title = document.title; const url = window.location.href; const text = "Check out this DevDaRK Shadow AI Pro module"; if (navigator.share) { navigator.share({ title, text, url }).catch(err => { console.log('Error sharing:', err); }); } else { // Fallback for desktop const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}`; window.open(shareUrl, '_blank'); } } } customElements.define('share-button', ShareButton);