make shadow dom optional
This commit is contained in:
parent
559d4d0ecd
commit
9f3d26d779
@ -24,15 +24,13 @@ export const Shadow =(inElement:HTMLElement, inConfig?:TW.TwindUserConfig)=>
|
|||||||
return ShadowDiv;
|
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)
|
if(!inModulePath)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let dom = document.querySelector(inSelector);
|
let dom = document.querySelector(inSelector);
|
||||||
if(!dom)
|
if(!dom)
|
||||||
{
|
{
|
||||||
@ -41,7 +39,15 @@ export default async(inSelector:string, inModulePath:string, inMemberApp="defaul
|
|||||||
}
|
}
|
||||||
|
|
||||||
const module = await import(inModulePath);
|
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);
|
const app = React.createElement(()=> React.createElement(module[inMemberApp], null), null);
|
||||||
if(React.render)
|
if(React.render)
|
||||||
@ -56,5 +62,4 @@ export default async(inSelector:string, inModulePath:string, inMemberApp="defaul
|
|||||||
root.render(app);
|
root.render(app);
|
||||||
return root.unmount;
|
return root.unmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user