include
This commit is contained in:
parent
fa8fbfe1ff
commit
7ac811ff97
8 changed files with 154 additions and 4 deletions
23
example/apps.js
Normal file
23
example/apps.js
Normal 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" });
|
|
@ -30,7 +30,6 @@ export const call = async (stear, { find, resolve, render, call, event }, {name,
|
|||
await fadeout(find.main);
|
||||
}
|
||||
|
||||
|
||||
return _({ find: "main" }, [
|
||||
_({
|
||||
type: "p",
|
||||
|
|
|
@ -7,6 +7,7 @@ const call = async (stear, { find, resolve, close, render, call, event }, args)
|
|||
/*event.onclose = async () => { }*/
|
||||
/*event.onBeforRerender = async () => { }*/
|
||||
/*event.onAfterRerender = async () => { }*/
|
||||
/*event.onParentRender = () => { }*/
|
||||
|
||||
return _({
|
||||
|
||||
|
|
76
example/menu.js
Normal file
76
example/menu.js
Normal 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
28
example/settings.js
Normal 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
23
example/splash.js
Normal 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" });
|
|
@ -1,6 +1,7 @@
|
|||
import { Stear, SWindow, _ } from "../stear/main.js";
|
||||
import { fadein, fadeout, wait } from "../stear/utils.js";
|
||||
import connect from "./connect.js";
|
||||
import menu from "./menu.js";
|
||||
|
||||
export const preRender = true;
|
||||
|
||||
|
@ -17,11 +18,10 @@ var wobel = Stear.addAnimation({
|
|||
});
|
||||
|
||||
export const call = (stear, { find, resolve, render, call, event }, args) => {
|
||||
|
||||
event.onloaded = async ()=>{
|
||||
await wait(Math.max(1, 1000 - performance.now()));
|
||||
await fadeout(find.main);
|
||||
call(connect, { id: "123-456", name: "Device" });
|
||||
call(menu/*, { id: "123-456", name: "Device" }*/);
|
||||
resolve();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue