class MyComponent extends HTMLElement { constructor() { super() this.attachShadow({ mode: 'open' }) } connectedCallback() { this.render() } render() { this.shadowRoot.innerHTML = ` Tole je testni popup ` } toggle() { this.classList.toggle('show') } changeText(text) { this.shadowRoot.querySelector('.popup-text').textContent = text } } customElements.define('my-component', MyComponent)