diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-05-20 17:29:28 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-05-20 17:29:28 +0200 |
| commit | a7d0a6c409850b3603abb162fa6fd22d2dfd0177 (patch) | |
| tree | 6ea221fb7b1d314409b897b818a33e7fccd51626 /src/frontend/z-component.js | |
| parent | 755c794883467609e425207f6a543d2e8c6d6b46 (diff) | |
frontend: add comptime bundler
Diffstat (limited to 'src/frontend/z-component.js')
| -rw-r--r-- | src/frontend/z-component.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/frontend/z-component.js b/src/frontend/z-component.js new file mode 100644 index 0000000..e9b63ff --- /dev/null +++ b/src/frontend/z-component.js @@ -0,0 +1,17 @@ +customElements.define( + "z-component", + class extends HTMLElement { + constructor() { + super(); + this.attachShadow({ mode: 'open' }) + } + + connectedCallback() { + const type = this.getAttribute('type'); + const template = document.getElementById(`--${type}`); + const node = document.importNode(template.content, true); + this.shadowRoot.id = 'root'; + this.shadowRoot.appendChild(node); + } + } +); |