2025-02-28 17:05:43 +01:00
|
|
|
AFRAME.registerComponent('helloworld-window', {
|
2024-01-08 13:43:28 +00:00
|
|
|
schema: {
|
|
|
|
|
foo: { type:"string"}
|
|
|
|
|
},
|
|
|
|
|
|
2025-02-28 17:05:43 +01:00
|
|
|
init: function () {
|
|
|
|
|
|
|
|
|
|
},
|
2024-01-08 13:43:28 +00:00
|
|
|
|
|
|
|
|
requires:{
|
2025-02-28 17:05:43 +01:00
|
|
|
window: "com/window.js",
|
|
|
|
|
reactive: "com/data2event.js"
|
2024-01-08 13:43:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
dom: {
|
2025-02-28 17:05:43 +01:00
|
|
|
scale: 0.66,
|
2024-01-08 13:43:28 +00:00
|
|
|
events: ['click','input'],
|
2024-06-14 15:52:44 +02:00
|
|
|
html: (me) => `<div class="htmlform">
|
2024-01-08 13:43:28 +00:00
|
|
|
<fieldset>
|
2025-02-28 17:05:43 +01:00
|
|
|
<legend>Theme</legend>
|
|
|
|
|
<input type="radio" id="theme" name="theme" value="0" checked style=""><label for="theme" style="margin-right:15px;">Normal</label>
|
|
|
|
|
<input type="radio" id="themei" name="theme" value="1"><label for="themei">Invert</label><br>
|
2024-01-08 13:43:28 +00:00
|
|
|
</fieldset>
|
2025-02-28 17:05:43 +01:00
|
|
|
<br>
|
2024-01-08 13:43:28 +00:00
|
|
|
<fieldset>
|
2025-02-28 17:05:43 +01:00
|
|
|
<legend>Welcome to XR Shell</legend>
|
|
|
|
|
A free offline-first morphable<br>
|
|
|
|
|
environment which provides <br>
|
|
|
|
|
<span id="myvalue"></span> XR-friendly shells.<br>
|
|
|
|
|
<ol>
|
|
|
|
|
<li>check the <a href="/" target="_blank">website</a></li>
|
|
|
|
|
<li>check the <a href="https://forgejo.isvery.ninja/xrsh/xrsh-buildroot/src/branch/main/buildroot-v86/board/v86/rootfs_overlay/root/manual.md" target="_blank">manual</a></li>
|
|
|
|
|
</ol>
|
2024-01-08 13:43:28 +00:00
|
|
|
</fieldset>
|
2025-02-28 17:05:43 +01:00
|
|
|
<!--
|
2024-01-08 13:43:28 +00:00
|
|
|
<fieldset>
|
2024-06-14 15:52:44 +02:00
|
|
|
<legend>Size</legend>
|
2024-01-08 13:43:28 +00:00
|
|
|
<input type="range" min="0.1" max="2" value="1" step="0.01" id="myRange" style="background-color: transparent;">
|
|
|
|
|
</fieldset>
|
2024-06-14 15:52:44 +02:00
|
|
|
<button>hello <span id="myvalue"></span></button>
|
2025-02-28 17:05:43 +01:00
|
|
|
-->
|
2024-01-08 13:43:28 +00:00
|
|
|
</div>`,
|
2024-01-22 09:38:16 +00:00
|
|
|
|
2024-06-14 15:52:44 +02:00
|
|
|
css: (me) => `.htmlform { padding:11px; }`
|
2024-01-22 09:38:16 +00:00
|
|
|
|
2024-01-08 13:43:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events:{
|
|
|
|
|
|
|
|
|
|
// component events
|
2025-02-28 17:05:43 +01:00
|
|
|
window: function( ){ console.log("window component mounted") },
|
2024-01-08 13:43:28 +00:00
|
|
|
|
|
|
|
|
// combined AFRAME+DOM reactive events
|
2025-02-28 17:05:43 +01:00
|
|
|
click: function(e){ console.dir(e) }, //
|
2024-01-08 13:43:28 +00:00
|
|
|
input: function(e){
|
|
|
|
|
if( !e.detail.target ) return
|
|
|
|
|
if( e.detail.target.id == 'myRange' ) this.data.myvalue = e.detail.target.value // reactive demonstration
|
2025-02-28 17:05:43 +01:00
|
|
|
if( e.detail.target.name == 'theme' ) document.body.style.filter = `invert(${e.detail.target.value})`
|
|
|
|
|
if( e.detail.target.name == 'cmenu' ) document.querySelector(".iconmenu").style.display = e.detail.target.value == 'on' ? '' : 'none';
|
|
|
|
|
console.dir(e.detail)
|
2024-01-08 13:43:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// reactive events for this.data updates
|
|
|
|
|
myvalue: function(e){ this.el.dom.querySelector('#myvalue').innerText = this.data.myvalue },
|
|
|
|
|
|
2024-06-14 15:52:44 +02:00
|
|
|
launcher: async function(){
|
|
|
|
|
let s = await AFRAME.utils.require(this.requires)
|
|
|
|
|
|
|
|
|
|
// instance this component
|
2025-02-28 17:05:43 +01:00
|
|
|
this.el.setAttribute("dom", "")
|
|
|
|
|
this.el.object3D.quaternion.copy( AFRAME.scenes[0].camera.quaternion ) // face towards camera
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
DOMready: function(){
|
|
|
|
|
this.el.setAttribute("window", `title: Welcome; uid: ${this.el.uid}; attach: #overlay; dom: #${this.el.dom.id}; width:250; height: 360`)
|
|
|
|
|
|
|
|
|
|
// data2event demo
|
|
|
|
|
this.el.setAttribute("data2event","")
|
|
|
|
|
this.data.myvalue = 1001
|
|
|
|
|
this.data.foo = `this.el ${this.el.uid}: `
|
|
|
|
|
setInterval( () => this.data.myvalue++, 500 )
|
|
|
|
|
|
2024-01-08 13:43:28 +00:00
|
|
|
},
|
|
|
|
|
|
2025-02-28 17:05:43 +01:00
|
|
|
"window.oncreate": function(){
|
|
|
|
|
this.el.setAttribute("html-as-texture-in-xr", `domid: .winbox#${this.el.uid}; faceuser: true`)
|
2024-01-08 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
manifest: { // HTML5 manifest to identify app to xrsh
|
2024-06-14 15:52:44 +02:00
|
|
|
"short_name": "Hello world htmlform",
|
|
|
|
|
"name": "Hello world htmlform",
|
2024-01-08 13:43:28 +00:00
|
|
|
"icons": [
|
|
|
|
|
{
|
2024-01-22 09:38:16 +00:00
|
|
|
"src": "https://css.gg/browser.svg",
|
2024-08-06 16:48:29 +02:00
|
|
|
"src": "data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKPgogIDxwYXRoCiAg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
|
2024-01-08 13:43:28 +00:00
|
|
|
"type": "image/svg+xml",
|
|
|
|
|
"sizes": "512x512"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"id": "/?source=pwa",
|
|
|
|
|
"start_url": "/?source=pwa",
|
|
|
|
|
"background_color": "#3367D6",
|
|
|
|
|
"display": "standalone",
|
|
|
|
|
"scope": "/",
|
|
|
|
|
"theme_color": "#3367D6",
|
|
|
|
|
"shortcuts": [
|
|
|
|
|
{
|
|
|
|
|
"name": "What is the latest news?",
|
|
|
|
|
"cli":{
|
|
|
|
|
"usage": "helloworld <type> [options]",
|
|
|
|
|
"example": "helloworld news",
|
|
|
|
|
"args":{
|
|
|
|
|
"--latest": {type:"string"}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"short_name": "Today",
|
|
|
|
|
"description": "View weather information for today",
|
|
|
|
|
"url": "/today?source=pwa",
|
|
|
|
|
"icons": [{ "src": "/images/today.png", "sizes": "192x192" }]
|
|
|
|
|
}
|
|
|
|
|
],
|
2024-06-14 15:52:44 +02:00
|
|
|
"description": "Hello world htmlform",
|
2024-01-08 13:43:28 +00:00
|
|
|
"screenshots": [
|
|
|
|
|
{
|
|
|
|
|
"src": "/images/screenshot1.png",
|
|
|
|
|
"type": "image/png",
|
|
|
|
|
"sizes": "540x720",
|
|
|
|
|
"form_factor": "narrow"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"help":`
|
|
|
|
|
Helloworld application
|
|
|
|
|
|
|
|
|
|
This is a help file which describes the application.
|
|
|
|
|
It will be rendered thru troika text, and will contain
|
|
|
|
|
headers based on non-punctualized lines separated by linebreaks,
|
|
|
|
|
in above's case "\nHelloworld application\n" will qualify as header.
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|