main: work in progress [might break]

This commit is contained in:
Leon van Kammen 2024-06-26 12:42:00 +00:00
parent 0bc9b1a989
commit 36391678c7
4 changed files with 41016 additions and 16 deletions

41002
dist/xrfragment.module.js vendored

File diff suppressed because it is too large Load diff

View file

@ -920,10 +920,11 @@ window.frontend = (opts) => new Proxy({
updateHashPosition(randomize){ updateHashPosition(randomize){
const pos = xrf.frag.pos.get() const pos = xrf.frag.pos.get()
xrf.navigator.reactifyHash.enabled = false // prevent teleport xrf.navigator.updateHash.active = false // prevent teleport
xrf.navigator.URI.hash.pos = `${pos.x},${pos.y},${pos.z}` xrf.navigator.URI.hash.pos = `${pos.x},${pos.y},${pos.z}`
xrf.navigator.reactifyHash.enabled = true document.location.hash = `#${xrf.navigator.URI.fragment}`
this.copyToClipboard( window.location.href ); xrf.navigator.updateHash.active = true
return document.location.href
}, },
copyToClipboard(text){ copyToClipboard(text){
@ -941,11 +942,8 @@ window.frontend = (opts) => new Proxy({
if( network.meetingLink && !xrf.navigator.URI.hash.meet ){ if( network.meetingLink && !xrf.navigator.URI.hash.meet ){
xrf.navigator.URI.hash.meet = network.meetingLink xrf.navigator.URI.hash.meet = network.meetingLink
} }
if( !xrf.navigator.URI.hash.pos && (network.posName || network.pos) ){ let url = frontend.updateHashPosition()
xrf.navigator.URI.hash.pos = network.posName || network.pos console.log(url)
}else frontend.updateHashPosition()
let url = window.location.href
if( opts.linkonly ) return url if( opts.linkonly ) return url
this.copyToClipboard( url ) this.copyToClipboard( url )
// End of *TODO* // End of *TODO*

View file

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Jun 25 01:51:16 PM UTC 2024 * v0.5.1 generated at Wed Jun 26 11:16:30 AM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
@ -2122,7 +2122,7 @@ xrf.navigator.init = () => {
xrf.navigator.URI = xrfragment.URI.parse(document.location.href) xrf.navigator.URI = xrfragment.URI.parse(document.location.href)
window.addEventListener('popstate', function (event){ window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) if( xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) xrf.navigator.to( document.location.href.replace(/.*\?/,'') )
} }
}) })
@ -2189,9 +2189,10 @@ xrf.navigator.reactifyHash = ( obj ) => {
get(me,k) { return me[k] }, get(me,k) { return me[k] },
set(me,k,v){ set(me,k,v){
me[k] = v me[k] = v
if( xrf.navigator.reactifyHash.enabled ){ if( xrf.navigator.updateHash.active ){
xrf.navigator.to( "#" + this.toString(me) ) xrf.navigator.to( "#" + this.toString(me) )
} }
xrf.navigator.URI.fragment = this.toString(me)
}, },
toString(me){ toString(me){
let parts = [] let parts = []
@ -2202,7 +2203,6 @@ xrf.navigator.reactifyHash = ( obj ) => {
} }
}) })
} }
xrf.navigator.reactifyHash.enabled = true
/** /**
* *
* navigation, portals & mutations * navigation, portals & mutations

View file

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Jun 25 01:51:16 PM UTC 2024 * v0.5.1 generated at Wed Jun 26 11:16:30 AM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
@ -2122,7 +2122,7 @@ xrf.navigator.init = () => {
xrf.navigator.URI = xrfragment.URI.parse(document.location.href) xrf.navigator.URI = xrfragment.URI.parse(document.location.href)
window.addEventListener('popstate', function (event){ window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) if( xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) xrf.navigator.to( document.location.href.replace(/.*\?/,'') )
} }
}) })
@ -2189,9 +2189,10 @@ xrf.navigator.reactifyHash = ( obj ) => {
get(me,k) { return me[k] }, get(me,k) { return me[k] },
set(me,k,v){ set(me,k,v){
me[k] = v me[k] = v
if( xrf.navigator.reactifyHash.enabled ){ if( xrf.navigator.updateHash.active ){
xrf.navigator.to( "#" + this.toString(me) ) xrf.navigator.to( "#" + this.toString(me) )
} }
xrf.navigator.URI.fragment = this.toString(me)
}, },
toString(me){ toString(me){
let parts = [] let parts = []
@ -2202,7 +2203,6 @@ xrf.navigator.reactifyHash = ( obj ) => {
} }
}) })
} }
xrf.navigator.reactifyHash.enabled = true
/** /**
* *
* navigation, portals & mutations * navigation, portals & mutations