From de986f131b612e7e3306faf94ab376baff71c05d Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Sat, 3 Jun 2023 11:38:52 -0400 Subject: [PATCH] reorganization --- deno.json | 20 +++++++------------- deno.map.json | 8 -------- index.html | 19 ++++++++++++------- {src => js}/app.js | 24 +++++++++--------------- {src => js}/store.js | 4 ++-- {src => js}/tone.js | 0 {src => js}/twind.js | 2 +- {src => js}/ui.js | 20 +++++++++++++++----- store.d.ts => ts/store.d.ts | 0 store.test.ts => ts/store.test.ts | 0 10 files changed, 46 insertions(+), 51 deletions(-) delete mode 100644 deno.map.json rename {src => js}/app.js (50%) rename {src => js}/store.js (98%) rename {src => js}/tone.js (100%) rename {src => js}/twind.js (98%) rename {src => js}/ui.js (95%) rename store.d.ts => ts/store.d.ts (100%) rename store.test.ts => ts/store.test.ts (100%) diff --git a/deno.json b/deno.json index 6997ddd..538cf72 100644 --- a/deno.json +++ b/deno.json @@ -1,15 +1,9 @@ { - "compilerOptions": { "types": ["./store"], "checkJs": true }, - "importMap": "./deno.map.json", - "fmt": { - "options": { - "lineWidth": 256 - } - }, - "tasks": { - "dev": "deno task serve & deno task test", - "fmt": "deno fmt --watch", - "serve": "deno run -A --unstable --no-check https://deno.land/std@0.167.0/http/file_server.ts", - "test": "deno test store.test.ts --watch --no-lock --no-check" + "compilerOptions": { "types": ["*.d.ts"], "checkJs": true }, + "imports": { + "@twind/": "https://esm.sh/@twind/", + "react": "https://esm.sh/preact@10.11.3/compat", + "htm": "https://esm.sh/htm@3.1.1/preact", + "app": "./js/app.js" } -} +} \ No newline at end of file diff --git a/deno.map.json b/deno.map.json deleted file mode 100644 index 65001b1..0000000 --- a/deno.map.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "imports": { - "@twind/": "https://esm.sh/@twind/", - "react": "https://esm.sh/preact@10.11.3/compat", - "htm": "https://esm.sh/htm@3.1.1/preact", - "app": "./src/app.js" - } -} diff --git a/index.html b/index.html index 11a419f..c9e0a2a 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,12 @@ - - - -
- - - \ No newline at end of file + + + + + + +
+ + + + + \ No newline at end of file diff --git a/src/app.js b/js/app.js similarity index 50% rename from src/app.js rename to js/app.js index 54c6113..fcc2b29 100644 --- a/src/app.js +++ b/js/app.js @@ -15,22 +15,16 @@ TW.Init(ShadowCSS, ShadowDiv); React.render(html` <${Store.Provider}> +
+ <${UI.Select}/> +
-
-
- -
-
- <${UI.Select}/> -
-
- <${UI.Controls}/> -
-
- <${UI.Chart}> - <${UI.Audiogram}/> - -
+ <${UI.Controls}/> + +
+ <${UI.Chart}> + <${UI.Audiogram}/> +
diff --git a/src/store.js b/js/store.js similarity index 98% rename from src/store.js rename to js/store.js index 2269af5..abe8f9a 100644 --- a/src/store.js +++ b/js/store.js @@ -240,8 +240,8 @@ export const Initial = Reducer( ] }, {Name:"Test", Data:0}); -/** @type {preact.Context} */ -export const Context = React.createContext([Initial, (_a)=>{}]); + +export const Context = React.createContext(/** @type {Store.Binding} */([Initial, (_a)=>{}])); /** @type {(props:{children:preact.ComponentChildren})=>preact.VNode} */ export const Provider =(props)=> diff --git a/src/tone.js b/js/tone.js similarity index 100% rename from src/tone.js rename to js/tone.js diff --git a/src/twind.js b/js/twind.js similarity index 98% rename from src/twind.js rename to js/twind.js index 84be560..adca149 100644 --- a/src/twind.js +++ b/js/twind.js @@ -2,7 +2,7 @@ import * as TW from "@twind/core@1.0.1"; import TWPreTail from "@twind/preset-tailwind@1.0.1"; import TWPreAuto from "@twind/preset-autoprefix@1.0.1"; -/** @type {TW.TwindConfig} */ +/** @type {TW.TwindUserConfig} */ export const Configure = { theme: { diff --git a/src/ui.js b/js/ui.js similarity index 95% rename from src/ui.js rename to js/ui.js index 0273993..17b955e 100644 --- a/src/ui.js +++ b/js/ui.js @@ -46,6 +46,11 @@ export const Select =()=> return html`
+
+
+ +
+
Select Test
@@ -104,12 +109,17 @@ export const Controls =()=> const classTitle = "flex-1 text-sm" return html` -
+
-
Channel
-
- <${Button} inactive=${State.Chan.Value == 0} light=${State.Chan.Value == 0} classes="flex-1" onClick=${()=>Dispatch({Name:"Chan", Data:-1})}>Left - <${Button} inactive=${State.Chan.Value == 1} light=${State.Chan.Value == 1} classes="flex-1" onClick=${()=>Dispatch({Name:"Chan", Data:1})}>Right +
+
Channel
+
+ <${Button} inactive=${State.Chan.Value == 0} light=${State.Chan.Value == 0} classes="flex-1" onClick=${()=>Dispatch({Name:"Chan", Data:-1})}>Left + <${Button} inactive=${State.Chan.Value == 1} light=${State.Chan.Value == 1} classes="flex-1" onClick=${()=>Dispatch({Name:"Chan", Data:1})}>Right +
+
+
+
diff --git a/store.d.ts b/ts/store.d.ts similarity index 100% rename from store.d.ts rename to ts/store.d.ts diff --git a/store.test.ts b/ts/store.test.ts similarity index 100% rename from store.test.ts rename to ts/store.test.ts