From 6c68f2bf200d87099135453ab54c6134ed68e0ed Mon Sep 17 00:00:00 2001 From: jusax23 Date: Sun, 11 Dec 2022 22:23:21 +0100 Subject: [PATCH] basic menu, colors, else --- html/index.html | 1 + index.js | 8 ++++--- js/color.js | 36 ++++++++++++++++++++++++++++ pages/elems/mode.jsx | 26 ++++++++++++++++++++ pages/led/system.jsx | 13 ++++++++++ pages/menu.jsx | 31 +++++++++++++++++------- pages/remote/connect.jsx | 51 ++++++++++++++++++++++++++++++++++++++++ pages/remote/remote.jsx | 12 ++++++++-- pages/start.jsx | 5 +++- pages/system/led.jsx | 13 ++++++++++ 10 files changed, 182 insertions(+), 14 deletions(-) create mode 100644 pages/led/system.jsx create mode 100644 pages/remote/connect.jsx create mode 100644 pages/system/led.jsx diff --git a/html/index.html b/html/index.html index 434c18e..2b861e0 100644 --- a/html/index.html +++ b/html/index.html @@ -23,6 +23,7 @@ *{ font-family: 'Comfortaa', cursive; font-size: 1rem; + transition: background-color 1000ms linear; } diff --git a/index.js b/index.js index b54265a..157a7ed 100644 --- a/index.js +++ b/index.js @@ -1,16 +1,16 @@ import { Stear, SWindow } from "./stear/main.js"; import {applyScrollBarCss1} from "./stear/extra/Style/scrollBar1.js" import start from "./pages/start.jsx"; - +import * as color from "./js/color.js" var stear = new Stear(document.querySelector("#stear")); stear.style({ - backgroundColor: "#dde", + backgroundColor: color.bg(), fontFamily: "Helvetica Neue", fontWeight: "lighter", fontSize: "0.9em", - color: "#2a2a2a", + color: color.text(), }); applyScrollBarCss1(); @@ -22,3 +22,5 @@ Stear.addLanguageFile({ }, "de"); Stear.lang = "de"; + +window.stear = stear; \ No newline at end of file diff --git a/js/color.js b/js/color.js index e69de29..62da3b5 100644 --- a/js/color.js +++ b/js/color.js @@ -0,0 +1,36 @@ +let dark = true; + +export const text = () =>{ + return "#2a2a2a"; +} +export const bg = () =>{ + if(dark) return "#4b6584"; + else return "#d1d8e0"; +} +export const mainBar = () =>{ + if(dark) return "#3867d6"; + else return "#45aaf2"; +} +export const modeInUse = () =>{ + if(dark) return "#27ae60"; + else return "#2ecc71"; +} +export const modeNotInUse = () =>{ + if(dark) return "#c0392b"; + else return "#e74c3c"; +} +export const floatingBtn = () =>{ + return mainBar(); +} +export const floatingMenu = ()=>{ + return bg(); +} +export const cancleBtn = () =>{ + if(dark) return "#eb3b5a"; + else return "#fc5c65"; +} + +export const setMode = (m)=> { + if(m==-1) dark = !dark; + else dark = m; +} \ No newline at end of file diff --git a/pages/elems/mode.jsx b/pages/elems/mode.jsx index e69de29..2d332a7 100644 --- a/pages/elems/mode.jsx +++ b/pages/elems/mode.jsx @@ -0,0 +1,26 @@ +import { SFrame, Stear, s } from "../../stear/main"; +import * as color from "../../js/color.js"; + +export const LightMode = new SFrame({ + call: (stear, { find, resolve, render, call, event }, args) => { + + return
{color.setMode(-1);stear.rerenderGlobal()}}}> + ☼ +
+ + } +}); \ No newline at end of file diff --git a/pages/led/system.jsx b/pages/led/system.jsx new file mode 100644 index 0000000..9cb1958 --- /dev/null +++ b/pages/led/system.jsx @@ -0,0 +1,13 @@ +import { bg } from "../../js/color"; +import { SWindow, s } from "../../stear/main"; + + +export default new SWindow({ + call: async (stear,{find, resolve, close, render, call, event, include},args)=>{ + call(connect,{},false); + return
+ system Main +
; + }, + backgroundColor: "transparent" +}) \ No newline at end of file diff --git a/pages/menu.jsx b/pages/menu.jsx index 594b806..0f8e664 100644 --- a/pages/menu.jsx +++ b/pages/menu.jsx @@ -1,5 +1,7 @@ +import * as color from "../js/color.js"; import { Stear, SWindow, _, s } from "../stear/main.js"; import { fadein } from "../stear/utils.js"; +import remote from "./remote/remote.jsx"; const pool = Stear.addLanguagePool("home"); const connected = pool.add("conncted", "Connected to: {}"); @@ -17,18 +19,23 @@ export default new SWindow({ let window = 0; let wins = [ - include - ] + include(remote) + ]; + let show = 0; return
-
+
{() => { console.log("rerender"); return ["#0f0", "#00f", "#ff0"].map((d, i) => { return
{ mode = i; @@ -39,11 +46,19 @@ export default new SWindow({ }}
-
rigth
+
rigth
-
- +
+ {()=>{ + wins[show].opts.render(); + return wins[show].render({ + style: { + height: "100%", + width: "100%" + } + }); + }}
; - }, backgroundColor: "#dde" + }, backgroundColor: color.bg }); diff --git a/pages/remote/connect.jsx b/pages/remote/connect.jsx new file mode 100644 index 0000000..cd768a1 --- /dev/null +++ b/pages/remote/connect.jsx @@ -0,0 +1,51 @@ +import { bg, floatingBtn, floatingMenu, text } from "../../js/color"; +import { SWindow, s, SFrame } from "../../stear/main"; +import { fadein, fadeout,subCancel } from "../../stear/utils"; + + +export default new SFrame({ + call: async (stear, { find, resolve, close, render, call, event, include }, args) => { + event.onloaded = ()=>{ + fadein(find.main,200,true); + } + event.onresolve = async () => { + await fadeout(find.main); + } + + let cancelSub = subCancel(()=>{ + resolve(false); + }) + + return
+
+
+
{ + cancelSub(); + resolve(false); + }}}>❌
+ +
+
+
; + } +}) \ No newline at end of file diff --git a/pages/remote/remote.jsx b/pages/remote/remote.jsx index 26e90c9..bdb4e0a 100644 --- a/pages/remote/remote.jsx +++ b/pages/remote/remote.jsx @@ -1,9 +1,17 @@ -import { SWindow } from "../../stear/main"; +import { bg } from "../../js/color"; +import { SWindow, s } from "../../stear/main"; +import connect from "./connect"; export default new SWindow({ call: async (stear,{find, resolve, close, render, call, event, include},args)=>{ + return
+ remote Main + +
; }, - backgroundColor: "#dde" + backgroundColor: "transparent" }) \ No newline at end of file diff --git a/pages/start.jsx b/pages/start.jsx index cf12dd9..e391965 100644 --- a/pages/start.jsx +++ b/pages/start.jsx @@ -1,5 +1,7 @@ +import { bg } from "../js/color.js"; import { Stear, SWindow, _,s } from "../stear/main.js"; import { fadein, fadeout, wait } from "../stear/utils.js"; +import { LightMode } from "./elems/mode.jsx"; import menu from "./menu.jsx"; @@ -22,6 +24,7 @@ export default new SWindow({call: (stear, { find, resolve, render, call, event } await wait(Math.max(1, 1000 - performance.now())); await fadeout(find.main); call(menu); + stear.call(LightMode,{},1000); resolve(); } @@ -37,4 +40,4 @@ export default new SWindow({call: (stear, { find, resolve, render, call, event } animation: `${wobel} 1s ease-in-out 0s infinite`, }}/>
; -}, preRender: true, backgroundColor:"#dde"}); \ No newline at end of file +}, preRender: true, backgroundColor:bg}); \ No newline at end of file diff --git a/pages/system/led.jsx b/pages/system/led.jsx new file mode 100644 index 0000000..4c89b40 --- /dev/null +++ b/pages/system/led.jsx @@ -0,0 +1,13 @@ +import { bg } from "../../js/color"; +import { SWindow, s } from "../../stear/main"; + + +export default new SWindow({ + call: async (stear,{find, resolve, close, render, call, event, include},args)=>{ + call(connect,{},false); + return
+ led Main +
; + }, + backgroundColor: "transparent" +}) \ No newline at end of file