From 9f3d26d779eec6390a43c75d4bf5249b154c993a Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Tue, 31 Oct 2023 09:14:22 -0400 Subject: [PATCH] make shadow dom optional --- run-browser.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/run-browser.tsx b/run-browser.tsx index cf064c4..8e47d2c 100644 --- a/run-browser.tsx +++ b/run-browser.tsx @@ -24,15 +24,13 @@ export const Shadow =(inElement:HTMLElement, inConfig?:TW.TwindUserConfig)=> return ShadowDiv; }; -export default async(inSelector:string, inModulePath:string, inMemberApp="default", inMemberCSS="CSS"):Promise<(()=>void)|false>=> +export default async(inSelector:string, inModulePath:string, inMemberApp="default", inMemberCSS="CSS", inShadow=false):Promise<(()=>void)|false>=> { - if(!inModulePath) { return false; } - let dom = document.querySelector(inSelector); if(!dom) { @@ -41,7 +39,15 @@ export default async(inSelector:string, inModulePath:string, inMemberApp="defaul } const module = await import(inModulePath); - dom = Shadow(dom as HTMLElement, module[inMemberCSS]) + + if(inShadow) + { + dom = Shadow(dom as HTMLElement, module[inMemberCSS]); + } + else + { + TW.install(Configure); + } const app = React.createElement(()=> React.createElement(module[inMemberApp], null), null); if(React.render) @@ -56,5 +62,4 @@ export default async(inSelector:string, inModulePath:string, inMemberApp="defaul root.render(app); return root.unmount; } - };