diff --git a/cdn/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js b/cdn/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js index 0a6dd75cd..4523095e4 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js +++ b/cdn/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js @@ -1 +1 @@ -import{Router as t}from"../../../../@vaadin/router/dist/vaadin-router.js";import{autorun as e}from"../../../../mobx/dist/mobx.esm.js";import{store as i}from"./haxcms-site-store.js";class HAXCMSSiteRouter extends HTMLElement{get baseURI(){return this.getAttribute("base-uri")}set baseURI(t){this.setAttribute("base-uri",t)}static get tag(){return"haxcms-site-router"}constructor(){super(),this.windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.siteRouter=this;let s={};this.baseURI&&(s.baseUrl=this.baseURI),this.router=new t(this,s),this.__disposer=this.__disposer?this.__disposer:[],e((t=>{this._updateRouter(i.routerManifest),this.__disposer.push(t)})),globalThis.addEventListener("vaadin-router-location-changed",this._routerLocationChanged.bind(this),{signal:this.windowControllers.signal}),globalThis.addEventListener("haxcms-site-router-add",this.addRoutesEvent.bind(this),{signal:this.windowControllers.signal})}disconnectedCallback(){for(var t in this.__disposer)this.__disposer[t].dispose();this.windowControllers.abort()}addRoutesEvent(t){this.addRoutes(t.detail)}addRoutes(t){this.router.addRoutes(t)}_updateRouter(t){if(!t||void 0===t.items)return;const e=t.items.map((t=>({path:t.slug,name:t.id,component:`fake-${t.id}-e`})));this.router.setRoutes([...e,{path:"/",component:"fake-home-e",name:"home"},{path:"/(.*)",component:"fake-404-e",name:"404"}])}lookupRoute(t=null){return!!(t&&i.routerManifest&&i.routerManifest.items&&i.routerManifest.items.filter((e=>e.slug===t)).length>0)&&i.routerManifest.items.filter((e=>e.slug===t))}_routerLocationChanged(t){if(globalThis.dispatchEvent(new CustomEvent("simple-modal-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("haxcms-toast-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("super-daemon-close",{bubbles:!0,cancelable:!0,detail:{}})),i.currentRouterLocation=t.detail.location,"404"===t.detail.location.route.name&&(t.detail.location.params[0].startsWith("files/")||t.detail.location.params[0].startsWith("assets/")))globalThis.location=t.detail.location.pathname;else if("home"===t.detail.location.route.name&&t.detail.location.search.startsWith("?p=/")&&this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])){let e=this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])[0];i.activeId=e.id,globalThis.history.replaceState({},null,t.detail.location.search.replace("?p=/","").split("&")[0]),t.detail.location.search=t.detail.location.search.replace("?p=/","").split("&")[0],i.location=t.detail.location.search}else i.location=t.detail.location}}customElements.define(HAXCMSSiteRouter.tag,HAXCMSSiteRouter);export{HAXCMSSiteRouter}; \ No newline at end of file +import{Router as t}from"../../../../@vaadin/router/dist/vaadin-router.js";import{autorun as e}from"../../../../mobx/dist/mobx.esm.js";import{store as i}from"./haxcms-site-store.js";class HAXCMSSiteRouter extends HTMLElement{get baseURI(){return this.getAttribute("base-uri")}set baseURI(t){this.setAttribute("base-uri",t)}static get tag(){return"haxcms-site-router"}constructor(){super(),this.windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.siteRouter=this;let s={};this.baseURI&&(s.baseUrl=this.baseURI),this.router=new t(this,s),this.__disposer=this.__disposer?this.__disposer:[],e((t=>{this._updateRouter(i.routerManifest),this.__disposer.push(t)})),globalThis.addEventListener("vaadin-router-location-changed",this._routerLocationChanged.bind(this),{signal:this.windowControllers.signal}),globalThis.addEventListener("haxcms-site-router-add",this.addRoutesEvent.bind(this),{signal:this.windowControllers.signal})}disconnectedCallback(){for(var t in this.__disposer)this.__disposer[t].dispose();this.windowControllers.abort()}addRoutesEvent(t){this.addRoutes(t.detail)}addRoutes(t){this.router.addRoutes(t)}_updateRouter(t){if(!t||void 0===t.items)return;const e=t.items.map((t=>({path:t.slug,name:t.id,component:`fake-${t.id}-e`})));this.router.setRoutes([...e,{path:"/",component:"fake-home-e",name:"home"},{path:"/(.*)",component:"fake-404-e",name:"404"}])}lookupRoute(t=null){return!!(t&&i.routerManifest&&i.routerManifest.items&&i.routerManifest.items.filter((e=>e.slug===t)).length>0)&&i.routerManifest.items.filter((e=>e.slug===t))}_routerLocationChanged(t){if(globalThis.dispatchEvent(new CustomEvent("simple-modal-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("haxcms-toast-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("super-daemon-close",{bubbles:!0,cancelable:!0,detail:{}})),i.currentRouterLocation=t.detail.location,"404"===t.detail.location.route.name&&(t.detail.location.params[0].startsWith("files/")||t.detail.location.params[0].startsWith("assets/")))globalThis.location=t.detail.location.pathname;else if("home"===t.detail.location.route.name&&t.detail.location.search.startsWith("?p=/")&&this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])){let e=this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])[0];i.activeId=e.id,globalThis.history.replaceState({},null,t.detail.location.search.replace("?p=/","").split("&")[0]),t.detail.location.search=t.detail.location.search.replace("?p=/","").split("&")[0],i.location=t.detail.location}else i.location=t.detail.location}}customElements.define(HAXCMSSiteRouter.tag,HAXCMSSiteRouter);export{HAXCMSSiteRouter}; \ No newline at end of file diff --git a/haxcms/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js b/haxcms/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js index 0a6dd75cd..4523095e4 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js @@ -1 +1 @@ -import{Router as t}from"../../../../@vaadin/router/dist/vaadin-router.js";import{autorun as e}from"../../../../mobx/dist/mobx.esm.js";import{store as i}from"./haxcms-site-store.js";class HAXCMSSiteRouter extends HTMLElement{get baseURI(){return this.getAttribute("base-uri")}set baseURI(t){this.setAttribute("base-uri",t)}static get tag(){return"haxcms-site-router"}constructor(){super(),this.windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.siteRouter=this;let s={};this.baseURI&&(s.baseUrl=this.baseURI),this.router=new t(this,s),this.__disposer=this.__disposer?this.__disposer:[],e((t=>{this._updateRouter(i.routerManifest),this.__disposer.push(t)})),globalThis.addEventListener("vaadin-router-location-changed",this._routerLocationChanged.bind(this),{signal:this.windowControllers.signal}),globalThis.addEventListener("haxcms-site-router-add",this.addRoutesEvent.bind(this),{signal:this.windowControllers.signal})}disconnectedCallback(){for(var t in this.__disposer)this.__disposer[t].dispose();this.windowControllers.abort()}addRoutesEvent(t){this.addRoutes(t.detail)}addRoutes(t){this.router.addRoutes(t)}_updateRouter(t){if(!t||void 0===t.items)return;const e=t.items.map((t=>({path:t.slug,name:t.id,component:`fake-${t.id}-e`})));this.router.setRoutes([...e,{path:"/",component:"fake-home-e",name:"home"},{path:"/(.*)",component:"fake-404-e",name:"404"}])}lookupRoute(t=null){return!!(t&&i.routerManifest&&i.routerManifest.items&&i.routerManifest.items.filter((e=>e.slug===t)).length>0)&&i.routerManifest.items.filter((e=>e.slug===t))}_routerLocationChanged(t){if(globalThis.dispatchEvent(new CustomEvent("simple-modal-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("haxcms-toast-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("super-daemon-close",{bubbles:!0,cancelable:!0,detail:{}})),i.currentRouterLocation=t.detail.location,"404"===t.detail.location.route.name&&(t.detail.location.params[0].startsWith("files/")||t.detail.location.params[0].startsWith("assets/")))globalThis.location=t.detail.location.pathname;else if("home"===t.detail.location.route.name&&t.detail.location.search.startsWith("?p=/")&&this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])){let e=this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])[0];i.activeId=e.id,globalThis.history.replaceState({},null,t.detail.location.search.replace("?p=/","").split("&")[0]),t.detail.location.search=t.detail.location.search.replace("?p=/","").split("&")[0],i.location=t.detail.location.search}else i.location=t.detail.location}}customElements.define(HAXCMSSiteRouter.tag,HAXCMSSiteRouter);export{HAXCMSSiteRouter}; \ No newline at end of file +import{Router as t}from"../../../../@vaadin/router/dist/vaadin-router.js";import{autorun as e}from"../../../../mobx/dist/mobx.esm.js";import{store as i}from"./haxcms-site-store.js";class HAXCMSSiteRouter extends HTMLElement{get baseURI(){return this.getAttribute("base-uri")}set baseURI(t){this.setAttribute("base-uri",t)}static get tag(){return"haxcms-site-router"}constructor(){super(),this.windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.siteRouter=this;let s={};this.baseURI&&(s.baseUrl=this.baseURI),this.router=new t(this,s),this.__disposer=this.__disposer?this.__disposer:[],e((t=>{this._updateRouter(i.routerManifest),this.__disposer.push(t)})),globalThis.addEventListener("vaadin-router-location-changed",this._routerLocationChanged.bind(this),{signal:this.windowControllers.signal}),globalThis.addEventListener("haxcms-site-router-add",this.addRoutesEvent.bind(this),{signal:this.windowControllers.signal})}disconnectedCallback(){for(var t in this.__disposer)this.__disposer[t].dispose();this.windowControllers.abort()}addRoutesEvent(t){this.addRoutes(t.detail)}addRoutes(t){this.router.addRoutes(t)}_updateRouter(t){if(!t||void 0===t.items)return;const e=t.items.map((t=>({path:t.slug,name:t.id,component:`fake-${t.id}-e`})));this.router.setRoutes([...e,{path:"/",component:"fake-home-e",name:"home"},{path:"/(.*)",component:"fake-404-e",name:"404"}])}lookupRoute(t=null){return!!(t&&i.routerManifest&&i.routerManifest.items&&i.routerManifest.items.filter((e=>e.slug===t)).length>0)&&i.routerManifest.items.filter((e=>e.slug===t))}_routerLocationChanged(t){if(globalThis.dispatchEvent(new CustomEvent("simple-modal-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("haxcms-toast-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("super-daemon-close",{bubbles:!0,cancelable:!0,detail:{}})),i.currentRouterLocation=t.detail.location,"404"===t.detail.location.route.name&&(t.detail.location.params[0].startsWith("files/")||t.detail.location.params[0].startsWith("assets/")))globalThis.location=t.detail.location.pathname;else if("home"===t.detail.location.route.name&&t.detail.location.search.startsWith("?p=/")&&this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])){let e=this.lookupRoute(t.detail.location.search.replace("?p=/","").split("&")[0])[0];i.activeId=e.id,globalThis.history.replaceState({},null,t.detail.location.search.replace("?p=/","").split("&")[0]),t.detail.location.search=t.detail.location.search.replace("?p=/","").split("&")[0],i.location=t.detail.location}else i.location=t.detail.location}}customElements.define(HAXCMSSiteRouter.tag,HAXCMSSiteRouter);export{HAXCMSSiteRouter}; \ No newline at end of file