@kodaris/krubble-app-components 1.0.148 → 1.0.150

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.
@@ -4581,7 +4581,7 @@ function ge(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
4581
4581
  width: 18px;
4582
4582
  height: 18px;
4583
4583
  }
4584
- `,si([pe({type:Array})],ni.prototype,"breadcrumbs",void 0),si([pe({type:Boolean})],ni.prototype,"menu",void 0),customElements.get("kr-subbar")||customElements.define("kr-subbar",ni);var oi=function(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r};class ri{static getData(){return ri.data}static configure(e){ri.base=e.base,ri.routes=e.routes,window.addEventListener("click",(e=>{const t=e.composedPath().find((e=>e instanceof HTMLAnchorElement));t&&t.origin===window.location.origin&&t.pathname.startsWith(ri.base)&&"_blank"!==t.target&&(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),ri.navigate(t.pathname)))})),window.addEventListener("popstate",(()=>{ri.handleNavigation()})),Promise.resolve().then((()=>{ri.handleNavigation()}))}static handleNavigation(){const e=ri.matchRoutes();if(!e.routes.length)return;let t=ri.base;e.url&&(t=ri.base+"/"+e.url),window.location.pathname!==t&&window.history.replaceState({},"",t);for(const t of ri.routeCache.keys())e.url.split("/").filter((e=>e)).length<t.split("/").filter((e=>e)).length&&ri.routeCache.delete(t);const i=++ri.navToken;Promise.all(e.routes.map((e=>{const t=ri.routeCache.get(e.url);if(t)return Promise.resolve({el:t.el,data:t.data});const i=document.createElement(e.route.component),s={el:i,scrolls:[],data:null};ri.routeCache.set(e.url,s);const n=customElements.get(e.route.component);return n&&"function"==typeof n.resolve?Promise.resolve(n.resolve(ri.getParams())).then((e=>(s.data=e,{el:i,data:e}))):Promise.resolve({el:i,data:null})}))).then((t=>{if(i!==ri.navToken)return;ri.data={};for(const e of t)e.data&&Object.assign(ri.data,e.data);const s=t.map((e=>e.el)),n=Array.from(ri.outletContexts.keys()).sort(((e,t)=>t-e));for(const e of n){const t=ri.outletContexts.get(e);if(!t?.outlet?.el||t.outlet.el===s[e])continue;const i=ri.routeCache.get(t.url);i&&(i.scrolls=ri.getScrollableElements(t.outlet.el).map((e=>e.scrollTop))),t.outlet.deactivate(),t.element=null,t.url=""}s.forEach(((t,i)=>{let s=ri.outletContexts.get(i);if(s||(s={outlet:null,element:null,url:""},ri.outletContexts.set(i,s)),s.element=t,s.url=e.routes[i].url,s.outlet&&s.outlet.el!==t){s.outlet.activate(t);const e=ri.routeCache.get(s.url);e?.scrolls.length&&setTimeout((()=>{const t=ri.getScrollableElements(e.el);e.scrolls.forEach(((e,i)=>{t[i]&&(t[i].scrollTop=e)}))}),0)}}))}))}static registerOutlet(e,t){let i=ri.outletContexts.get(e);if(i||(i={outlet:null,element:null,url:""},ri.outletContexts.set(e,i)),i.outlet=t,i.element&&t.el!==i.element){t.activate(i.element);const e=ri.routeCache.get(i.url);e?.scrolls.length&&setTimeout((()=>{const t=ri.getScrollableElements(e.el);e.scrolls.forEach(((e,i)=>{t[i]&&(t[i].scrollTop=e)}))}),0)}}static unregisterOutlet(e,t){const i=ri.outletContexts.get(e);i&&i.outlet===t&&(i.outlet=null)}static navigate(e){let t=e;e.startsWith("/")||(t=ri.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=ri.matchRoutes(),t={};for(const i of e.routes)for(const e in i.params)t[e]=decodeURIComponent(i.params[e]);return t}static getScrollableElements(e){const t=[],i=[e];for(;i.length;){const e=i.pop();if(!e)break;const s=getComputedStyle(e);"auto"!==s.overflow&&"scroll"!==s.overflow&&"auto"!==s.overflowY&&"scroll"!==s.overflowY||t.push(e);const n=[];e.shadowRoot&&n.push(...Array.from(e.shadowRoot.children)),n.push(...Array.from(e.children));for(let e=n.length-1;e>=0;e--)i.push(n[e])}return t}static matchRoutes(e=ri.routes,t){if(!t){let e=window.location.pathname;e.startsWith(ri.base)&&(e=e.slice(ri.base.length)),t=e.split("/").filter((e=>e))}for(const i of e){const e=i.path.split("/").filter((e=>e));if(0===e.length&&0===t.length)return{routes:[{route:i,params:{},url:""}],url:""};if(0===e.length)continue;if(t.length<e.length)continue;const s={};let n=!0;for(let i=0;i<e.length;i++)if(e[i].startsWith(":"))s[e[i].slice(1)]=t[i];else if(e[i]!==t[i]){n=!1;break}if(!n)continue;const o=t.slice(e.length),r=t.slice(0,e.length).join("/"),a=[{route:i,params:s,url:r}];if(o.length>0){if(!i.children)continue;const e=ri.matchRoutes(i.children,o);if(e.routes.length>0){for(const t of e.routes)t.url=r+"/"+t.url;return a.push(...e.routes),{routes:a,url:r+"/"+e.url}}}if(i.children&&0===o.length&&i.default){const e=ri.matchRoutes(i.children,[i.default]);if(e.routes.length>0){for(const t of e.routes)t.url=r+"/"+t.url;return a.push(...e.routes),{routes:a,url:r+"/"+e.url}}}return{routes:a,url:r}}return{routes:[],url:""}}}ri.base="",ri.routes=[],ri.routeCache=new Map,ri.outletContexts=new Map,ri.navToken=0,ri.data={},e.RouterOutlet=class extends le{constructor(){super(...arguments),this.level=-1,this.el=null}connectedCallback(){super.connectedCallback();let e=0,t=this;for(;t;)t instanceof ShadowRoot?t=t.host:(t instanceof HTMLElement&&"KR-ROUTER-OUTLET"===t.tagName&&t!==this&&e++,t=t instanceof HTMLElement?t.parentNode:null);this.level=e,ri.registerOutlet(this.level,this)}disconnectedCallback(){super.disconnectedCallback(),ri.unregisterOutlet(this.level,this)}activate(e){this.el=e}deactivate(){this.el=null}render(){return this.el?q`${this.el}`:q``}},e.RouterOutlet.styles=l`
4584
+ `,si([pe({type:Array})],ni.prototype,"breadcrumbs",void 0),si([pe({type:Boolean})],ni.prototype,"menu",void 0),customElements.get("kr-subbar")||customElements.define("kr-subbar",ni);var oi=function(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r};class ri{static getData(){return ri.data}static configure(e){ri.base=e.base,ri.routes=e.routes,window.addEventListener("click",(e=>{const t=e.composedPath().find((e=>e instanceof HTMLAnchorElement));t&&t.origin===window.location.origin&&t.pathname.startsWith(ri.base)&&"_blank"!==t.target&&(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),ri.navigate(t.pathname)))})),window.addEventListener("popstate",(()=>{ri.handleNavigation()})),Promise.resolve().then((()=>{ri.handleNavigation()}))}static handleNavigation(){const e=ri.matchRoutes();if(!e.routes.length)return;let t=ri.base;e.url&&(t=ri.base+"/"+e.url),window.location.pathname!==t&&window.history.replaceState({},"",t);for(const t of ri.routeCache.keys())e.url.split("/").filter((e=>e)).length<t.split("/").filter((e=>e)).length&&ri.routeCache.delete(t);const i=++ri.navToken;Promise.all(e.routes.map((e=>{const t=ri.routeCache.get(e.url);if(t){const i=customElements.get(e.route.component);return"always"===e.route.runResolvers&&i&&"function"==typeof i.resolve?Promise.resolve(i.resolve(ri.getParams())).then((e=>(t.data=e,{el:t.el,data:e}))):Promise.resolve({el:t.el,data:t.data})}const i=document.createElement(e.route.component),s={el:i,scrolls:[],data:null};ri.routeCache.set(e.url,s);const n=customElements.get(e.route.component);return n&&"function"==typeof n.resolve?Promise.resolve(n.resolve(ri.getParams())).then((e=>(s.data=e,{el:i,data:e}))):Promise.resolve({el:i,data:null})}))).then((t=>{if(i!==ri.navToken)return;ri.data={};for(const e of t)e.data&&Object.assign(ri.data,e.data);const s=t.map((e=>e.el)),n=Array.from(ri.outletContexts.keys()).sort(((e,t)=>t-e));for(const e of n){const t=ri.outletContexts.get(e);if(!t?.outlet?.el||t.outlet.el===s[e])continue;const i=ri.routeCache.get(t.url);i&&(i.scrolls=ri.getScrollableElements(t.outlet.el).map((e=>e.scrollTop))),t.outlet.deactivate(),t.element=null,t.url=""}s.forEach(((t,i)=>{let s=ri.outletContexts.get(i);if(s||(s={outlet:null,element:null,url:""},ri.outletContexts.set(i,s)),s.element=t,s.url=e.routes[i].url,s.outlet&&s.outlet.el!==t){s.outlet.activate(t);const e=ri.routeCache.get(s.url);e?.scrolls.length&&setTimeout((()=>{const t=ri.getScrollableElements(e.el);e.scrolls.forEach(((e,i)=>{t[i]&&(t[i].scrollTop=e)}))}),0)}}))}))}static registerOutlet(e,t){let i=ri.outletContexts.get(e);if(i||(i={outlet:null,element:null,url:""},ri.outletContexts.set(e,i)),i.outlet=t,i.element&&t.el!==i.element){t.activate(i.element);const e=ri.routeCache.get(i.url);e?.scrolls.length&&setTimeout((()=>{const t=ri.getScrollableElements(e.el);e.scrolls.forEach(((e,i)=>{t[i]&&(t[i].scrollTop=e)}))}),0)}}static unregisterOutlet(e,t){const i=ri.outletContexts.get(e);i&&i.outlet===t&&(i.outlet=null)}static navigate(e){let t=e;e.startsWith("/")||(t=ri.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=ri.matchRoutes(),t={};for(const i of e.routes)for(const e in i.params)t[e]=decodeURIComponent(i.params[e]);return t}static getScrollableElements(e){const t=[],i=[e];for(;i.length;){const e=i.pop();if(!e)break;const s=getComputedStyle(e);"auto"!==s.overflow&&"scroll"!==s.overflow&&"auto"!==s.overflowY&&"scroll"!==s.overflowY||t.push(e);const n=[];e.shadowRoot&&n.push(...Array.from(e.shadowRoot.children)),n.push(...Array.from(e.children));for(let e=n.length-1;e>=0;e--)i.push(n[e])}return t}static matchRoutes(e=ri.routes,t){if(!t){let e=window.location.pathname;e.startsWith(ri.base)&&(e=e.slice(ri.base.length)),t=e.split("/").filter((e=>e))}for(const i of e){const e=i.path.split("/").filter((e=>e));if(0===e.length&&0===t.length)return{routes:[{route:i,params:{},url:""}],url:""};if(0===e.length)continue;if(t.length<e.length)continue;const s={};let n=!0;for(let i=0;i<e.length;i++)if(e[i].startsWith(":"))s[e[i].slice(1)]=t[i];else if(e[i]!==t[i]){n=!1;break}if(!n)continue;const o=t.slice(e.length),r=t.slice(0,e.length).join("/"),a=[{route:i,params:s,url:r}];if(o.length>0){if(!i.children)continue;const e=ri.matchRoutes(i.children,o);if(e.routes.length>0){for(const t of e.routes)t.url=r+"/"+t.url;return a.push(...e.routes),{routes:a,url:r+"/"+e.url}}}if(i.children&&0===o.length&&i.default){const e=ri.matchRoutes(i.children,[i.default]);if(e.routes.length>0){for(const t of e.routes)t.url=r+"/"+t.url;return a.push(...e.routes),{routes:a,url:r+"/"+e.url}}}return{routes:a,url:r}}return{routes:[],url:""}}}ri.base="",ri.routes=[],ri.routeCache=new Map,ri.outletContexts=new Map,ri.navToken=0,ri.data={},e.RouterOutlet=class extends le{constructor(){super(...arguments),this.level=-1,this.el=null}connectedCallback(){super.connectedCallback();let e=0,t=this;for(;t;)t instanceof ShadowRoot?t=t.host:(t instanceof HTMLElement&&"KR-ROUTER-OUTLET"===t.tagName&&t!==this&&e++,t=t instanceof HTMLElement?t.parentNode:null);this.level=e,ri.registerOutlet(this.level,this)}disconnectedCallback(){super.disconnectedCallback(),ri.unregisterOutlet(this.level,this)}activate(e){this.el=e}deactivate(){this.el=null}render(){return this.el?q`${this.el}`:q``}},e.RouterOutlet.styles=l`
4585
4585
  :host {
4586
4586
  display: block;
4587
4587
  height: 100%;