From bef45f9107c0ff39ec0ee9953114e681c62d7298 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Fri, 26 Jan 2024 17:21:47 -0500 Subject: [PATCH] workflow, misc edits --- .github/workflows/deploy.yml | 28 ++++++++++++++++++++++++++++ iso-elements.tsx | 3 ++- iso-menu.tsx | 1 + run-browser.tsx | 34 +++++++++------------------------- 4 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..72970a1 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Setup Deno + uses: denolib/setup-deno@v2 + with: + deno-version: 1.8 + + - name: Run Deno Script + run: deno run -A --no-lock cli.tsx baker + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./.bake \ No newline at end of file diff --git a/iso-elements.tsx b/iso-elements.tsx index af41bdc..f7af3a9 100644 --- a/iso-elements.tsx +++ b/iso-elements.tsx @@ -1,3 +1,4 @@ +//@able-types import React from "react"; type MetasInputs = { [Property in MetaKeys]?: string }; @@ -192,7 +193,7 @@ export const Router = { React.useEffect(()=>{ history.replaceState({...routeGet, URL:undefined}, "", routeGet.URL); - window.addEventListener("popstate", ({state})=> + self.addEventListener("popstate", ({state})=> { dirtySet(true); routeUpdate(state.Path, state.Params, state.Anchor); diff --git a/iso-menu.tsx b/iso-menu.tsx index bf2ebe3..e8984a6 100644 --- a/iso-menu.tsx +++ b/iso-menu.tsx @@ -1,3 +1,4 @@ +//@able-types import React from "react"; type StateArgs = {done?:boolean, open?:boolean}; diff --git a/run-browser.tsx b/run-browser.tsx index 76fbea3..8d51e28 100644 --- a/run-browser.tsx +++ b/run-browser.tsx @@ -3,32 +3,10 @@ import * as TW from "@twind/core"; import TWPreTail from "https://esm.sh/v126/@twind/preset-tailwind@1.1.3/es2022/preset-tailwind.mjs"; import TWPreAuto from "https://esm.sh/v126/@twind/preset-autoprefix@1.0.7/es2022/preset-autoprefix.mjs"; -const Configure = -{ - theme: {}, - presets: [TWPreTail(), TWPreAuto()], - hash: false -} as TW.TwindUserConfig; - -export const Shadow =(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); - TW.observe(TW.twind(inConfig, TW.cssom(ShadowCSS)), ShadowDiv); - return ShadowDiv; -}; +const Configure = { theme: {}, presets: [TWPreTail(), TWPreAuto()], hash: false} as TW.TwindUserConfig; 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) { @@ -37,12 +15,18 @@ export default async(inSelector:string, inModulePath:string, inMemberApp="defaul } const module = await import(inModulePath); - const merge = inMemberCSS ? {...Configure, ...module[inMemberCSS]} : Configure; if(inShadow) { - dom = Shadow(dom as HTMLElement, merge); + const ShadowDOM = dom.attachShadow({ mode: "open" }); + const ShadowDiv = document.createElement("div"); + const ShadowCSS = document.createElement("style"); + + ShadowDOM.append(ShadowCSS); + ShadowDOM.append(ShadowDiv); + TW.observe(TW.twind(merge, TW.cssom(ShadowCSS)), ShadowDiv); + dom = ShadowDiv; } else {