@kodaris/krubble-app-components 1.0.141 → 1.0.143
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.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/krubble-app.bundled.js +50 -15
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +1 -1
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +50 -15
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +1 -1
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/router.d.ts +11 -4
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +50 -15
- package/dist/router.js.map +1 -1
- package/package.json +1 -1
|
@@ -4574,7 +4574,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
4574
4574
|
width: 18px;
|
|
4575
4575
|
height: 18px;
|
|
4576
4576
|
}
|
|
4577
|
-
`,oi([ge({type:Array})],ri.prototype,"breadcrumbs",void 0),oi([ge({type:Boolean})],ri.prototype,"menu",void 0),customElements.get("kr-subbar")||customElements.define("kr-subbar",ri);var ai=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 li{static configure(e){li.base=e.base,li.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(li.base)&&"_blank"!==t.target&&(e.preventDefault(),li.navigate(t.pathname))})),window.addEventListener("popstate",(()=>{li.handleNavigation()})),Promise.resolve().then((()=>{li.handleNavigation()}))}static handleNavigation(){const e=li.matchRoutes();if(!e.routes.length)return;let t=li.base;e.url&&(t=li.base+"/"+e.url),window.location.pathname!==t&&window.history.replaceState({},"",t);for(const t of li.routeCache.keys())e.url.split("/").filter((e=>e)).length<t.split("/").filter((e=>e)).length&&li.routeCache.delete(t);const i=++li.navToken;Promise.all(e.routes.map((e=>{const t=li.routeCache.get(e.url);if(t)return Promise.resolve(t.el);const i=document.createElement(e.route.component);li.routeCache.set(e.url,
|
|
4577
|
+
`,oi([ge({type:Array})],ri.prototype,"breadcrumbs",void 0),oi([ge({type:Boolean})],ri.prototype,"menu",void 0),customElements.get("kr-subbar")||customElements.define("kr-subbar",ri);var ai=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 li{static getData(){return li.data}static configure(e){li.base=e.base,li.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(li.base)&&"_blank"!==t.target&&(e.preventDefault(),li.navigate(t.pathname))})),window.addEventListener("popstate",(()=>{li.handleNavigation()})),Promise.resolve().then((()=>{li.handleNavigation()}))}static handleNavigation(){const e=li.matchRoutes();if(!e.routes.length)return;let t=li.base;e.url&&(t=li.base+"/"+e.url),window.location.pathname!==t&&window.history.replaceState({},"",t);for(const t of li.routeCache.keys())e.url.split("/").filter((e=>e)).length<t.split("/").filter((e=>e)).length&&li.routeCache.delete(t);const i=++li.navToken;Promise.all(e.routes.map((e=>{const t=li.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};li.routeCache.set(e.url,s);const n=customElements.get(e.route.component);return n&&"function"==typeof n.resolve?Promise.resolve(n.resolve(li.getParams())).then((e=>(s.data=e,{el:i,data:e}))):Promise.resolve({el:i,data:null})}))).then((t=>{if(i!==li.navToken)return;li.data={};for(const e of t)e.data&&Object.assign(li.data,e.data);const s=t.map((e=>e.el)),n=Array.from(li.outletContexts.keys()).sort(((e,t)=>t-e));for(const e of n){const t=li.outletContexts.get(e);if(!t?.outlet?.el||t.outlet.el===s[e])continue;const i=li.routeCache.get(t.url);i&&(i.scrolls=li.getScrollableElements(t.outlet.el).map((e=>e.scrollTop))),t.outlet.deactivate(),t.element=null,t.url=""}s.forEach(((t,i)=>{let s=li.outletContexts.get(i);if(s||(s={outlet:null,element:null,url:""},li.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=li.routeCache.get(s.url);e?.scrolls.length&&setTimeout((()=>{const t=li.getScrollableElements(e.el);e.scrolls.forEach(((e,i)=>{t[i]&&(t[i].scrollTop=e)}))}),0)}}))}))}static registerOutlet(e,t){let i=li.outletContexts.get(e);if(i||(i={outlet:null,element:null,url:""},li.outletContexts.set(e,i)),i.outlet=t,i.element&&t.el!==i.element){t.activate(i.element);const e=li.routeCache.get(i.url);e?.scrolls.length&&setTimeout((()=>{const t=li.getScrollableElements(e.el);e.scrolls.forEach(((e,i)=>{t[i]&&(t[i].scrollTop=e)}))}),0)}}static unregisterOutlet(e,t){const i=li.outletContexts.get(e);i&&i.outlet===t&&(i.outlet=null)}static navigate(e){let t=e;e.startsWith("/")||(t=li.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=li.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=li.routes,t){if(!t){let e=window.location.pathname;e.startsWith(li.base)&&(e=e.slice(li.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=li.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=li.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:""}}}li.base="",li.routes=[],li.routeCache=new Map,li.outletContexts=new Map,li.navToken=0,li.data={};let hi=class extends ce{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,li.registerOutlet(this.level,this)}disconnectedCallback(){super.disconnectedCallback(),li.unregisterOutlet(this.level,this)}activate(e){this.el=e}deactivate(){this.el=null}render(){return this.el?V`${this.el}`:V``}};hi.styles=c`
|
|
4578
4578
|
:host {
|
|
4579
4579
|
display: block;
|
|
4580
4580
|
height: 100%;
|