closed shadowRoot and changed pages, components, layout to extend base class

This commit is contained in:
Fran Jurmanović
2021-06-02 13:19:32 +02:00
parent f01c328716
commit 91032927fd
25 changed files with 206 additions and 109 deletions

View File

@@ -1,19 +1,24 @@
import { controller } from "@github/catalyst";
import style from "styles/main.scss";
@controller
class AppShadowElement extends HTMLElement {
constructor() {
super();
}
(function () {
const _shadow = new WeakMap();
connectedCallback() {
this.attachShadow({ mode: "open" });
const _appMain = document.createElement("app-main");
const _style = document.createElement("style");
_style.innerHTML = style;
@controller
class AppShadowElement extends HTMLElement {
constructor() {
super();
_shadow.set(this, this.attachShadow({ mode: "closed" }));
}
this.shadowRoot.appendChild(_style);
this.shadowRoot.appendChild(_appMain);
connectedCallback() {
const _root = _shadow.get(this);
const _appMain = document.createElement("app-main");
const _style = document.createElement("style");
_style.innerHTML = style;
_root.appendChild(_style);
_root.appendChild(_appMain);
}
}
}
})();