2022-12-04 16:19:22 -05:00
|
|
|
import * as TW from "./twind.js";
|
2022-12-03 19:05:26 -05:00
|
|
|
import * as UI from "./ui.js";
|
2022-12-05 23:22:37 -05:00
|
|
|
import * as Store from "./store.js";
|
2022-12-03 19:05:26 -05:00
|
|
|
import React from "https://esm.sh/preact@10.11.3/compat";
|
2022-12-03 22:51:22 -05:00
|
|
|
import {html} from "https://esm.sh/htm@3.1.1/preact";
|
2022-12-03 19:05:26 -05:00
|
|
|
|
2022-12-04 16:19:22 -05:00
|
|
|
const ShadowDOM = document.querySelector("#app").attachShadow({mode: "open"});
|
|
|
|
const ShadowDiv = document.createElement("div");
|
|
|
|
const ShadowCSS = document.createElement("style");
|
|
|
|
ShadowDOM.append(ShadowCSS);
|
|
|
|
ShadowDOM.append(ShadowDiv);
|
|
|
|
|
|
|
|
TW.Init(ShadowCSS, ShadowDiv);
|
|
|
|
|
2022-12-05 23:22:37 -05:00
|
|
|
const Audiogram =()=>
|
|
|
|
{
|
|
|
|
const [State, Dispatch] = Store.Consumer();
|
|
|
|
|
|
|
|
const testL = State.Draw.TestL.Points.map(p=>html`<${UI.Mark} x=${p.X} y=${p.Y} response=${p.Mark.Resp} right=${false}/>`);
|
|
|
|
const testR = State.Draw.TestR.Points.map(p=>html`<${UI.Mark} x=${p.X} y=${p.Y} response=${p.Mark.Resp} right=${true} />`);
|
|
|
|
const userL = State.Draw.UserL.Points.map(p=>html`<${UI.Mark} x=${p.X} y=${p.Y} response=${p.Mark.Resp} right=${false}/>`);
|
|
|
|
const userR = State.Draw.UserR.Points.map(p=>html`<${UI.Mark} x=${p.X} y=${p.Y} response=${p.Mark.Resp} right=${true} />`);
|
|
|
|
|
|
|
|
return html`
|
|
|
|
<svg class="absolute top-0 w-full h-full overflow-visible stroke(blue-700 bold draw)">
|
|
|
|
${testL}
|
|
|
|
${testR}
|
|
|
|
</svg>`;
|
|
|
|
};
|
|
|
|
|
2022-12-03 19:05:26 -05:00
|
|
|
React.render(html`
|
2022-12-05 23:22:37 -05:00
|
|
|
<${Store.Provider}>
|
2022-12-03 19:05:26 -05:00
|
|
|
<${UI.Button} icon="+">hey!<//>
|
|
|
|
<${UI.Button} light>Left<//>
|
|
|
|
<${UI.Button} inactive>Right<//>
|
|
|
|
<${UI.Button} disabled>Right<//>
|
|
|
|
<${UI.Chart}>
|
2022-12-05 23:22:37 -05:00
|
|
|
<${Audiogram}/>
|
2022-12-03 19:05:26 -05:00
|
|
|
<//>
|
2022-11-27 16:57:06 -05:00
|
|
|
<//>
|
2022-11-25 15:51:27 -05:00
|
|
|
`, ShadowDiv);
|