aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/z-component.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/z-component.js')
-rw-r--r--src/frontend/z-component.js17
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);
+ }
+ }
+);