mount started

This commit is contained in:
Seth Trowbridge 2023-06-20 06:51:38 -04:00
parent 19cc54dcea
commit df16163e4b
1 changed files with 27 additions and 0 deletions

27
_lib_/mount.tsx Normal file
View File

@ -0,0 +1,27 @@
import * as TW from "https://esm.sh/@twind/core@1.0.1";
import TWPreTail from "https://esm.sh/@twind/preset-tailwind@1.0.1";
import TWPreAuto from "https://esm.sh/@twind/preset-autoprefix@1.0.1";
const Configure = {
theme: {},
presets:[TWPreTail(), TWPreAuto()]
} as TW.TwindUserConfig;
export default (inElement:HTMLElement, inConfig?:TW.TwindUserConfig)=>
{
const ShadowDOM = inElement.attachShadow({ mode: "open" });
const ShadowDiv = document.createElement("div");
const ShadowCSS = document.createElement("style");
ShadowDOM.append(ShadowCSS);
ShadowDOM.append(ShadowDiv);
const merge = inConfig ? {...Configure, ...inConfig} : Configure;
TW.observe(TW.twind(merge, TW.cssom(ShadowCSS)), ShadowDiv);
return ShadowDiv;
}
import * as App from "app";
import React from "react";
const Wrapper =()=> React.createElement(App.default, null, null);
React.render(React.createElement(Wrapper, null, null), document.querySelector("#app"));