class CustomDecisionNode extends HTMLElement { constructor() { super(); this.answerOptions = ['Yes', 'No']; } connectedCallback() { const nodeId = this.getAttribute('node-id') || `node-${Math.random().toString(36).substr(2, 9)}`; this.setAttribute('node-id', nodeId); const isRoot = this.hasAttribute('is-root'); this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `

${isRoot ? 'Root Question' : 'Decision Point'}

${this.answerOptions.map(answer => ` `).join('')}
`; // Replace feather icons after rendering setTimeout(() => { if (this.shadowRoot.querySelector('[data-feather]')) { feather.replace({ class: 'inline-block', width: 16, height: 16 }); } }, 0); } } customElements.define('custom-decision-node', CustomDecisionNode);