diff --git a/README.md b/README.md index 98153d0..ed7946e 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ Other Language functions ```javascript var someJSON = Stear.getLanguageFile;//contains all Defaults created yet. 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 diff --git a/example/apps.js b/example/apps.js new file mode 100644 index 0000000..7746400 --- /dev/null +++ b/example/apps.js @@ -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" }); \ No newline at end of file diff --git a/example/connect.js b/example/connect.js index 458731c..b2e93a5 100644 --- a/example/connect.js +++ b/example/connect.js @@ -30,7 +30,6 @@ export const call = async (stear, { find, resolve, render, call, event }, {name, await fadeout(find.main); } - return _({ find: "main" }, [ _({ type: "p", diff --git a/example/empty.js b/example/empty.js index d1e7e56..de190b4 100644 --- a/example/empty.js +++ b/example/empty.js @@ -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 _({ diff --git a/example/menu.js b/example/menu.js new file mode 100644 index 0000000..e9c78d3 --- /dev/null +++ b/example/menu.js @@ -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" }); \ No newline at end of file diff --git a/example/settings.js b/example/settings.js new file mode 100644 index 0000000..0833b57 --- /dev/null +++ b/example/settings.js @@ -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" }); \ No newline at end of file diff --git a/example/splash.js b/example/splash.js new file mode 100644 index 0000000..bab92b5 --- /dev/null +++ b/example/splash.js @@ -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" }); \ No newline at end of file diff --git a/example/start.js b/example/start.js index 528c723..fb7f7f4 100644 --- a/example/start.js +++ b/example/start.js @@ -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(); }