Compare commits

...

2 commits

Author SHA1 Message Date
3c7c19a3d2 fix 2022-10-09 16:42:40 +02:00
7ac811ff97 include 2022-10-09 16:36:35 +02:00
9 changed files with 155 additions and 5 deletions

23
example/apps.js Normal file
View file

@ -0,0 +1,23 @@
import { Stear, SWindow, _ } from "../stear/main.js";
const call = async (stear, { find, resolve, close, render, call, event }, args) => {
/*event.onloaded = () => { }*/
/*event.onresolve = async () => { }*/
/*event.onclose = async () => { }*/
/*event.onBeforRerender = async () => { }*/
/*event.onAfterRerender = async () => { }*/
return _({
style:{
display:"flex",
alignItems: "center",
justifyContent: "center",
height: "100%",
}
}, [
"Appscreen"
]);
}
export default new SWindow({ call, backgroundColor: "#dde" });

View file

@ -30,7 +30,6 @@ export const call = async (stear, { find, resolve, render, call, event }, {name,
await fadeout(find.main); await fadeout(find.main);
} }
return _({ find: "main" }, [ return _({ find: "main" }, [
_({ _({
type: "p", type: "p",

View file

@ -7,6 +7,7 @@ const call = async (stear, { find, resolve, close, render, call, event }, args)
/*event.onclose = async () => { }*/ /*event.onclose = async () => { }*/
/*event.onBeforRerender = async () => { }*/ /*event.onBeforRerender = async () => { }*/
/*event.onAfterRerender = async () => { }*/ /*event.onAfterRerender = async () => { }*/
/*event.onParentRender = () => { }*/
return _({ return _({

76
example/menu.js Normal file
View file

@ -0,0 +1,76 @@
import { Stear, SWindow, _ } from "../stear/main.js";
import apps from "./apps.js";
import settings from "./settings.js";
import splash from "./splash.js";
const call = async (stear, { find, resolve, close, render, call, include, event }, args) => {
/*event.onloaded = () => { }*/
/*event.onresolve = async () => { }*/
/*event.onclose = async () => { }*/
/*event.onBeforRerender = async () => { }*/
/*event.onAfterRerender = async () => { }*/
let menu = [
include(splash),
include(apps),
include(settings),
];
window.dddd = menu[0];
let show = 0;
return _({
style:{
display: "flex",
height: "100%",
width: "100%",
flexDirection: "column",
}
}, [
_({
style:{
position:"relative",
width: "100%",
height: "100%",
}
},()=>{
menu[show].opts.render();
return menu[show].render({
style: {
height: "100%",
width: "100%"
}
});
}),
_({
style:{
height: "2rem",
width: "calc(100% - 2rem)",
padding: "1rem",
backgroundColor: "#fee",
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "space-evenly",
borderRadius:"2rem 2rem 0 0",
}
},()=>menu.map((m,i)=>{
return _({
event:{
click:()=>{
show = i;
render();
}
},
style:{
height:"1rem",
width:"1rem",
backgroundColor:show == i ? "red":"green"
}
},[]);
})
)
]);
}
export default new SWindow({ call, backgroundColor: "#dde" });

28
example/settings.js Normal file
View file

@ -0,0 +1,28 @@
import prompt from "../stear/extra/Pages/prompt.js";
import { Stear, SWindow, _ } from "../stear/main.js";
const call = async (stear, { find, resolve, close, render, call, event }, args) => {
/*event.onloaded = () => { }*/
/*event.onresolve = async () => { }*/
/*event.onclose = async () => { }*/
/*event.onBeforRerender = async () => { }*/
/*event.onAfterRerender = async () => { }*/
/*event.onParentRender = () => { }*/
event.onParentRender = () => call(prompt, { text: "settings" }).then(console.log);
return _({
style:{
display:"flex",
alignItems: "center",
justifyContent: "center",
height:"100%",
}
}, [
"Settings"
]);
}
export default new SWindow({ call, backgroundColor: "#dde" });

23
example/splash.js Normal file
View file

@ -0,0 +1,23 @@
import { Stear, SWindow, _ } from "../stear/main.js";
const call = async (stear, { find, resolve, close, render, call, event }, args) => {
/*event.onloaded = () => { }*/
/*event.onresolve = async () => { }*/
/*event.onclose = async () => { }*/
/*event.onBeforRerender = async () => { }*/
/*event.onAfterRerender = async () => { }*/
return _({
style:{
display:"flex",
alignItems: "center",
justifyContent: "center",
height: "100%",
}
}, [
"Splashscreen"
]);
}
export default new SWindow({ call, backgroundColor: "#dde" });

View file

@ -1,6 +1,7 @@
import { Stear, SWindow, _ } from "../stear/main.js"; import { Stear, SWindow, _ } from "../stear/main.js";
import { fadein, fadeout, wait } from "../stear/utils.js"; import { fadein, fadeout, wait } from "../stear/utils.js";
import connect from "./connect.js"; import connect from "./connect.js";
import menu from "./menu.js";
export const preRender = true; export const preRender = true;
@ -17,11 +18,10 @@ var wobel = Stear.addAnimation({
}); });
export const call = (stear, { find, resolve, render, call, event }, args) => { export const call = (stear, { find, resolve, render, call, event }, args) => {
event.onloaded = async ()=>{ event.onloaded = async ()=>{
await wait(Math.max(1, 1000 - performance.now())); await wait(Math.max(1, 1000 - performance.now()));
await fadeout(find.main); await fadeout(find.main);
call(connect, { id: "123-456", name: "Device" }); call(menu/*, { id: "123-456", name: "Device" }*/);
resolve(); resolve();
} }

2
stear

@ -1 +1 @@
Subproject commit 4bc4ca5a1651c2d6cdf684c19071d10caea3ba8b Subproject commit 5068141aff6f5c6c993ab18d682ae73e84bdc87c