From acaa36c01e4a53a73670b28f2a7bac510a72dc25 Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Sat, 11 Nov 2023 23:52:15 +0000 Subject: [PATCH] =?UTF-8?q?[=F0=9F=94=92]=20Use=20ShadowDOM=20for=20apps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/wm.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/wm.ts b/src/wm.ts index 72e579e..198cfe8 100644 --- a/src/wm.ts +++ b/src/wm.ts @@ -57,6 +57,7 @@ export class FlowWindow { element: HTMLElement private readonly header: HTMLElement + private readonly realContent: HTMLElement content: HTMLElement maximized: boolean @@ -109,10 +110,33 @@ export class FlowWindow { (this.header.querySelector('#max') as HTMLElement).onclick = () => this.toggleMax() } - this.content = document.createElement('window-content') + this.realContent = document.createElement('window-content') + const shadow = this.realContent.attachShadow({ mode: 'open' }) + shadow.innerHTML = ` + + ` + const shadowBody = document.createElement('body') + shadowBody.style.margin = '0px' + shadowBody.style.height = '100%' + + shadow.appendChild(shadowBody) + this.content = shadowBody + + console.log(this.content) this.element.appendChild(this.header) - this.element.appendChild(this.content) + this.element.appendChild(this.realContent) dragElement(this.element, (document.querySelector('window-area') as HTMLElement)) }