mateu-vaadin 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24140,7 +24140,7 @@ Let me know your thoughts!`,userName:"Sam Rivera"}]}"
|
|
|
24140
24140
|
max-width: 1392px;
|
|
24141
24141
|
margin: 0 auto;
|
|
24142
24142
|
}
|
|
24143
|
-
`;__decorateClass$1([n$t()],MateuUx.prototype,"consumedRoute",2);__decorateClass$1([n$t()],MateuUx.prototype,"appServerSideType",2);__decorateClass$1([n$t()],MateuUx.prototype,"uriPrefix",2);__decorateClass$1([n$t()],MateuUx.prototype,"overrides",2);__decorateClass$1([n$t()],MateuUx.prototype,"homeRoute",2);__decorateClass$1([n$t()],MateuUx.prototype,"route",2);__decorateClass$1([n$t()],MateuUx.prototype,"top",2);__decorateClass$1([n$t()],MateuUx.prototype,"instant",2);__decorateClass$1([n$t()],MateuUx.prototype,"appState",2);__decorateClass$1([n$t()],MateuUx.prototype,"appData",2);__decorateClass$1([r$o()],MateuUx.prototype,"fragment",2);MateuUx=__decorateClass$1([t$o("mateu-ux")],MateuUx);var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(te,Q,X,ee)=>{for(var ie=ee>1?void 0:ee?__getOwnPropDesc(Q,X):Q,oe=te.length-1,ne;oe>=0;oe--)(ne=te[oe])&&(ie=(ee?ne(Q,X,ie):ne(ie))||ie);return ee&&ie&&__defProp(Q,X,ie),ie};let MateuUi=class extends i$s{constructor(){super(...arguments),this.baseUrl="",this.route=void 0,this.consumedRoute="_empty",this.config=void 0,this.top="true",this.routeChangedListener=te=>{if(te.preventDefault(),te.stopPropagation(),te instanceof CustomEvent&&this.top=="true"){let Q=te.detail.route,X=this.baseUrl??"";X.indexOf("://")<0&&(X.startsWith("/")||(X="/"+X),X=window.location.origin+X),X.endsWith("/")&&Q.startsWith("/")&&(Q=Q.substring(1));let ee=new URL(X+Q);if((window.location.pathname||ee.pathname)&&window.location.pathname!=ee.pathname){let ie=ee.pathname;ie&&!ie.startsWith("/")&&(ie="/"+ie),window.history.pushState({},"",ie)}}},this.navigateToRequestedListener=te=>{if(te.preventDefault(),te.stopPropagation(),te instanceof CustomEvent){let Q=te.detail.route;const X=this.shadowRoot?.querySelector("mateu-ux");X&&(X.setAttribute("route",Q),X.setAttribute("instant",nanoid()))}}}createRenderRoot(){return componentRenderer.mustUseShadowRoot()?super.createRenderRoot():this}connectedCallback(){if(super.connectedCallback(),window.onpopstate=te=>{const Q=te.target;this.loadUrl(Q)},this.route?this.consumedRoute=""
|
|
24143
|
+
`;__decorateClass$1([n$t()],MateuUx.prototype,"consumedRoute",2);__decorateClass$1([n$t()],MateuUx.prototype,"appServerSideType",2);__decorateClass$1([n$t()],MateuUx.prototype,"uriPrefix",2);__decorateClass$1([n$t()],MateuUx.prototype,"overrides",2);__decorateClass$1([n$t()],MateuUx.prototype,"homeRoute",2);__decorateClass$1([n$t()],MateuUx.prototype,"route",2);__decorateClass$1([n$t()],MateuUx.prototype,"top",2);__decorateClass$1([n$t()],MateuUx.prototype,"instant",2);__decorateClass$1([n$t()],MateuUx.prototype,"appState",2);__decorateClass$1([n$t()],MateuUx.prototype,"appData",2);__decorateClass$1([r$o()],MateuUx.prototype,"fragment",2);MateuUx=__decorateClass$1([t$o("mateu-ux")],MateuUx);var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(te,Q,X,ee)=>{for(var ie=ee>1?void 0:ee?__getOwnPropDesc(Q,X):Q,oe=te.length-1,ne;oe>=0;oe--)(ne=te[oe])&&(ie=(ee?ne(Q,X,ie):ne(ie))||ie);return ee&&ie&&__defProp(Q,X,ie),ie};let MateuUi=class extends i$s{constructor(){super(...arguments),this.baseUrl="",this.route=void 0,this.consumedRoute="_empty",this.config=void 0,this.top="true",this.routeChangedListener=te=>{if(te.preventDefault(),te.stopPropagation(),te instanceof CustomEvent&&this.top=="true"){let Q=te.detail.route,X=this.baseUrl??"";X.indexOf("://")<0&&(X.startsWith("/")||(X="/"+X),X=window.location.origin+X),X.endsWith("/")&&Q.startsWith("/")&&(Q=Q.substring(1));let ee=new URL(X+Q);if((window.location.pathname||ee.pathname)&&window.location.pathname!=ee.pathname){let ie=ee.pathname;ie&&!ie.startsWith("/")&&(ie="/"+ie),window.history.pushState({},"",ie)}}},this.navigateToRequestedListener=te=>{if(te.preventDefault(),te.stopPropagation(),te instanceof CustomEvent){let Q=te.detail.route;const X=this.shadowRoot?.querySelector("mateu-ux");X&&(X.setAttribute("route",Q),X.setAttribute("instant",nanoid()))}}}createRenderRoot(){return componentRenderer.mustUseShadowRoot()?super.createRenderRoot():this}connectedCallback(){if(super.connectedCallback(),window.onpopstate=te=>{const Q=te.target;this.loadUrl(Q)},this.route==null?this.loadUrl(window):this.consumedRoute="",this.config)try{const te=JSON.parse(this.config);appState.value={...appState.value,...te}}catch{appState.value={...appState.value,config:this.config}}this.addEventListener("url-update-requested",this.routeChangedListener),this.addEventListener("navigate-to-requested",this.navigateToRequestedListener)}disconnectedCallback(){super.disconnectedCallback(),this.upstreamSubscription?.unsubscribe(),this.removeEventListener("url-update-requested",this.routeChangedListener),this.removeEventListener("navigate-to-requested",this.navigateToRequestedListener)}loadUrl(te){if(this.route=this.extractRouteFromUrl(te),this.setAttribute("route",this.route),this.instant=nanoid(),te.location.search){const X=new URLSearchParams(te.location.search).get("overrides");if(X&&(this.config=X,this.config))try{const ee=JSON.parse(this.config);appState.value={...appState.value,...ee}}catch{appState.value={...appState.value,config:this.config}}}}extractRouteFromUrl(te){const Q=this.extractGrossRouteFromUrl(te);return Q=="/"?"":Q}extractGrossRouteFromUrl(te){const Q=te.location.pathname,X=this.baseUrl&&(this.baseUrl.startsWith("http://")||this.baseUrl.startsWith("https://"))?this.baseUrl.substring(this.getContextPathStartingIndex(this.baseUrl)):this.baseUrl;return Q.startsWith(X)?Q.substring(X.length):Q}getContextPathStartingIndex(te){return te.startsWith("http:")?te.indexOf("/",7):te.startsWith("https:")?te.indexOf("/",8):0}render(){return x$4`
|
|
24144
24144
|
<mateu-api-caller>
|
|
24145
24145
|
<mateu-ux id="_ux"
|
|
24146
24146
|
baseurl="${this.baseUrl}"
|