class CustomSlideshow extends HTMLElement { static get observedAttributes() { return ['image', 'title', 'text', 'current-index', 'total-slides']; } constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { this.render(); feather.replace(); } attributeChangedCallback(name, oldValue, newValue) { this.render(); feather.replace(); } render() { const image = this.getAttribute('image') || 'http://static.photos/pink/1200x630/1'; const title = this.getAttribute('title') || 'Slide Title'; const text = this.getAttribute('text') || 'Slide description goes here'; const currentIndex = this.getAttribute('current-index') || 1; const totalSlides = this.getAttribute('total-slides') || 10; this.shadowRoot.innerHTML = `

${title}

${text}

${currentIndex} / ${totalSlides}
`; } } customElements.define('custom-slideshow', CustomSlideshow);