This commit is contained in:
jusax23 2022-10-09 16:36:35 +02:00
parent fa8fbfe1ff
commit 7ac811ff97
8 changed files with 154 additions and 4 deletions

View file

@ -170,7 +170,7 @@ Other Language functions
```javascript ```javascript
var someJSON = Stear.getLanguageFile;//contains all Defaults created yet. var someJSON = Stear.getLanguageFile;//contains all Defaults created yet.
Stear.lang = "de"; //change Language Stear.lang = "de"; //change Language
Stear.addLanguageFile(fileJSON/*like some JSON*/,lang); //Language code like. Stear.addLanguageFile(fileJSON/*like someJSON*/,lang); //Language code like.
``` ```
### Utils ### Utils

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();
} }