aboutsummaryrefslogtreecommitdiff
path: root/priv/static/lustre-server-component.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'priv/static/lustre-server-component.mjs')
-rw-r--r--priv/static/lustre-server-component.mjs18
1 files changed, 17 insertions, 1 deletions
diff --git a/priv/static/lustre-server-component.mjs b/priv/static/lustre-server-component.mjs
index 8913469..0892fb5 100644
--- a/priv/static/lustre-server-component.mjs
+++ b/priv/static/lustre-server-component.mjs
@@ -353,8 +353,10 @@ var LustreServerComponent = class extends HTMLElement {
#observer = null;
#root = null;
#socket = null;
+ #shadow = null;
constructor() {
super();
+ this.#shadow = this.attachShadow({ mode: "closed" });
this.#observer = new MutationObserver((mutations) => {
const changed = [];
for (const mutation of mutations) {
@@ -377,7 +379,15 @@ var LustreServerComponent = class extends HTMLElement {
}
connectedCallback() {
this.#root = document.createElement("div");
- this.appendChild(this.#root);
+ this.#shadow.appendChild(this.#root);
+ const sheet = new CSSStyleSheet();
+ for (const { cssRules } of document.styleSheets) {
+ for (const rule of cssRules) {
+ console.log(rule);
+ sheet.insertRule(rule.cssText);
+ }
+ }
+ this.#shadow.adoptedStyleSheets = [sheet];
}
attributeChangedCallback(name, prev, next) {
switch (name) {
@@ -471,6 +481,12 @@ var LustreServerComponent = class extends HTMLElement {
disconnectedCallback() {
this.#socket?.close();
}
+ get adoptedStyleSheets() {
+ return this.#shadow.adoptedStyleSheets;
+ }
+ set adoptedStyleSheets(value) {
+ this.#shadow.adoptedStyleSheets = value;
+ }
};
window.customElements.define("lustre-server-component", LustreServerComponent);
export {