class CustomThreadCard extends HTMLElement { static get observedAttributes() { return ['title', 'author', 'date', 'comments', 'likes', 'tags', 'category']; } connectedCallback() { this.render(); } attributeChangedCallback() { this.render(); } render() { const title = this.getAttribute('title') || 'Untitled Thread'; const author = this.getAttribute('author') || 'Anonymous'; const date = this.getAttribute('date') || 'Just now'; const comments = this.getAttribute('comments') || '0'; const likes = this.getAttribute('likes') || '0'; const tags = this.getAttribute('tags') || ''; const category = this.getAttribute('category') || 'General'; this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `
${category}

${title}

Posted by ${author} • ${date}
${tags.split(',').map(tag => ` ${tag.trim()} `).join('')}
${comments} comments
${likes} likes
`; } } customElements.define('custom-thread-card', CustomThreadCard);