Compare commits
2 Commits
e2ee67a888
...
67b2eef7ae
Author | SHA1 | Date | |
---|---|---|---|
67b2eef7ae | |||
1a1d7c4fd8 |
@ -10,17 +10,15 @@ const Configure =
|
|||||||
hash: false
|
hash: false
|
||||||
} as TW.TwindUserConfig;
|
} as TW.TwindUserConfig;
|
||||||
|
|
||||||
export const Shadow =(inElement:HTMLElement, inConfig?:TW.TwindUserConfig)=>
|
export const Shadow =(inElement:HTMLElement, inConfig:TW.TwindUserConfig)=>
|
||||||
{
|
{
|
||||||
const merge = inConfig ? {...Configure, ...inConfig} : Configure;
|
|
||||||
|
|
||||||
const ShadowDOM = inElement.attachShadow({ mode: "open" });
|
const ShadowDOM = inElement.attachShadow({ mode: "open" });
|
||||||
const ShadowDiv = document.createElement("div");
|
const ShadowDiv = document.createElement("div");
|
||||||
const ShadowCSS = document.createElement("style");
|
const ShadowCSS = document.createElement("style");
|
||||||
|
|
||||||
ShadowDOM.append(ShadowCSS);
|
ShadowDOM.append(ShadowCSS);
|
||||||
ShadowDOM.append(ShadowDiv);
|
ShadowDOM.append(ShadowDiv);
|
||||||
TW.observe(TW.twind(merge, TW.cssom(ShadowCSS)), ShadowDiv);
|
TW.observe(TW.twind(inConfig, TW.cssom(ShadowCSS)), ShadowDiv);
|
||||||
return ShadowDiv;
|
return ShadowDiv;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,13 +38,15 @@ export default async(inSelector:string, inModulePath:string, inMemberApp="defaul
|
|||||||
|
|
||||||
const module = await import(inModulePath);
|
const module = await import(inModulePath);
|
||||||
|
|
||||||
|
const merge = inMemberCSS ? {...Configure, ...module[inMemberCSS]} : Configure;
|
||||||
|
|
||||||
if(inShadow)
|
if(inShadow)
|
||||||
{
|
{
|
||||||
dom = Shadow(dom as HTMLElement, module[inMemberCSS]);
|
dom = Shadow(dom as HTMLElement, merge);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TW.install(Configure);
|
TW.install(merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
const app = React.createElement(()=> React.createElement(module[inMemberApp], null), null);
|
const app = React.createElement(()=> React.createElement(module[inMemberApp], null), null);
|
||||||
|
Loading…
Reference in New Issue
Block a user