class ProjectCard extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); } static get observedAttributes() { return ['title', 'description', 'image', 'tags', 'demo-url', 'code-url']; } connectedCallback() { this.render(); } attributeChangedCallback() { this.render(); } render() { const title = this.getAttribute('title') || ''; const description = this.getAttribute('description') || ''; const image = this.getAttribute('image') || ''; const tags = JSON.parse(this.getAttribute('tags') || '[]'); const demoUrl = this.getAttribute('demo-url') || '#'; const codeUrl = this.getAttribute('code-url') || '#'; this.shadowRoot.innerHTML = `
`; } } customElements.define('project-card', ProjectCard);