@kodaris/krubble-app-components 1.0.137 → 1.0.139

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.
@@ -25,7 +25,12 @@ const C=globalThis,E=C.trustedTypes,A=E?E.createPolicy("lit-html",{createHTML:e=
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
27
  */
28
- const pe={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:$},ue=(e=pe,t,i)=>{const{kind:s,metadata:n}=i;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),o.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const n=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,n,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const n=this[s];t.call(this,i),this.requestUpdate(s,n,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function ge(e){return(t,i)=>"object"==typeof i?ue(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
28
+ const pe={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:$},ue=(e=pe,t,i)=>{const{kind:s,metadata:n}=i;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),o.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const n=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,n,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const n=this[s];t.call(this,i),this.requestUpdate(s,n,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};
29
+ /**
30
+ * @license
31
+ * Copyright 2017 Google LLC
32
+ * SPDX-License-Identifier: BSD-3-Clause
33
+ */function ge(e){return(t,i)=>"object"==typeof i?ue(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
29
34
  /**
30
35
  * @license
31
36
  * Copyright 2017 Google LLC
@@ -4245,7 +4250,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
4245
4250
  transform: scaleX(0.08);
4246
4251
  }
4247
4252
  }
4248
- `,Gt([ge({type:String})],ei.prototype,"logo",void 0),Gt([ge({type:String})],ei.prototype,"label",void 0),Gt([ge({type:String,attribute:"home-url"})],ei.prototype,"homeUrl",void 0),Gt([ge({type:String,reflect:!0})],ei.prototype,"scheme",void 0),Gt([ge({type:Array})],ei.prototype,"nav",void 0),Gt([ge({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],ei.prototype,"navIconsDisplayed",void 0),Gt([ge({type:Boolean,attribute:"nav-expanded"})],ei.prototype,"navExpanded",void 0),Gt([ge({type:Object})],ei.prototype,"user",void 0),Gt([ge({type:Boolean})],ei.prototype,"subbar",void 0),Gt([ge({type:Boolean,attribute:"nav-enabled"})],ei.prototype,"navEnabled",void 0),Gt([ge({type:String,attribute:"user-type"})],ei.prototype,"userType",void 0),Gt([ge({type:Array})],ei.prototype,"breadcrumbs",void 0),Gt([me()],ei.prototype,"isDev",void 0),Gt([me()],ei.prototype,"navItemsExpanded",void 0),Gt([me()],ei.prototype,"navQuery",void 0),Gt([me()],ei.prototype,"activeNavItemId",void 0),Gt([me()],ei.prototype,"isNavScrolled",void 0),Gt([me()],ei.prototype,"isNavOpened",void 0),Gt([me()],ei.prototype,"isEditing",void 0),Gt([me()],ei.prototype,"isUserMenuOpen",void 0),Gt([me()],ei.prototype,"pref",void 0),Gt([me()],ei.prototype,"draggedNavItemId",void 0),Gt([me()],ei.prototype,"navItemDropTargetId",void 0),Gt([me()],ei.prototype,"navItemDropPosition",void 0),Gt([me()],ei.prototype,"pendingRequests",void 0),customElements.get("kr-scaffold")||customElements.define("kr-scaffold",ei);var ti=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 ii extends ce{constructor(){super(...arguments),this.label="",this.subLabel="",this.items=[],this.activeId="",this.actions=[],this.maxVisibleActions=3,this.handlePopstate=()=>{this.syncActiveFromUrl()}}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>this.syncActiveFromUrl())),window.addEventListener("popstate",this.handlePopstate)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopstate)}handleNavItemClick(e,t){const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault(),this.activeId=t.id}syncActiveFromUrl(){const e=window.location.pathname,t=this.items.find((t=>!!t.url&&(t.url.startsWith("/")?e===t.url:e.endsWith("/"+t.url))));t&&(this.activeId=t.id)}handleActionClick(e,t){this.dispatchEvent(new CustomEvent("action-click",{detail:{action:t.id},bubbles:!0,composed:!0}))}handleMoreSelect(e){this.dispatchEvent(new CustomEvent("action-click",{detail:{action:e.detail.id},bubbles:!0,composed:!0}))}render(){const e=this.actions.length>this.maxVisibleActions;let t=this.actions,i=[];return e&&(t=this.actions.slice(0,this.maxVisibleActions-1),i=this.actions.slice(this.maxVisibleActions-1).map((e=>({id:e.id,label:e.label})))),V`
4253
+ `,Gt([ge({type:String})],ei.prototype,"logo",void 0),Gt([ge({type:String})],ei.prototype,"label",void 0),Gt([ge({type:String,attribute:"home-url"})],ei.prototype,"homeUrl",void 0),Gt([ge({type:String,reflect:!0})],ei.prototype,"scheme",void 0),Gt([ge({type:Array})],ei.prototype,"nav",void 0),Gt([ge({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],ei.prototype,"navIconsDisplayed",void 0),Gt([ge({type:Boolean,attribute:"nav-expanded"})],ei.prototype,"navExpanded",void 0),Gt([ge({type:Object})],ei.prototype,"user",void 0),Gt([ge({type:Boolean})],ei.prototype,"subbar",void 0),Gt([ge({type:Boolean,attribute:"nav-enabled"})],ei.prototype,"navEnabled",void 0),Gt([ge({type:String,attribute:"user-type"})],ei.prototype,"userType",void 0),Gt([ge({type:Array})],ei.prototype,"breadcrumbs",void 0),Gt([me()],ei.prototype,"isDev",void 0),Gt([me()],ei.prototype,"navItemsExpanded",void 0),Gt([me()],ei.prototype,"navQuery",void 0),Gt([me()],ei.prototype,"activeNavItemId",void 0),Gt([me()],ei.prototype,"isNavScrolled",void 0),Gt([me()],ei.prototype,"isNavOpened",void 0),Gt([me()],ei.prototype,"isEditing",void 0),Gt([me()],ei.prototype,"isUserMenuOpen",void 0),Gt([me()],ei.prototype,"pref",void 0),Gt([me()],ei.prototype,"draggedNavItemId",void 0),Gt([me()],ei.prototype,"navItemDropTargetId",void 0),Gt([me()],ei.prototype,"navItemDropPosition",void 0),Gt([me()],ei.prototype,"pendingRequests",void 0),customElements.get("kr-scaffold")||customElements.define("kr-scaffold",ei);var ti=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 ii extends ce{constructor(){super(...arguments),this.label="",this.subLabel="",this.items=[],this.activeId="",this.actions=[],this.maxVisibleActions=5,this.handlePopstate=()=>{this.syncActiveFromUrl()}}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>this.syncActiveFromUrl())),window.addEventListener("popstate",this.handlePopstate)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopstate)}handleNavItemClick(e,t){const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault(),this.activeId=t.id}syncActiveFromUrl(){const e=window.location.pathname,t=this.items.find((t=>!!t.url&&(t.url.startsWith("/")?e===t.url:e.endsWith("/"+t.url))));t&&(this.activeId=t.id)}handleActionClick(e,t){this.dispatchEvent(new CustomEvent("action-click",{detail:{action:t.id},bubbles:!0,composed:!0}))}handleMoreSelect(e){this.dispatchEvent(new CustomEvent("action-click",{detail:{action:e.detail.id},bubbles:!0,composed:!0}))}render(){const e=this.actions.length>this.maxVisibleActions;let t=this.actions,i=[];return e&&(t=this.actions.slice(0,this.maxVisibleActions-1),i=this.actions.slice(this.maxVisibleActions-1).map((e=>({id:e.id,label:e.label})))),V`
4249
4254
  <nav class="nav">
4250
4255
  ${this.label?V`
4251
4256
  <div class="nav-header">
@@ -4569,10 +4574,10 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
4569
4574
  width: 18px;
4570
4575
  height: 18px;
4571
4576
  }
4572
- `,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);class ai{static configure(e){ai.base=e.base,ai.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(ai.base)&&(e.preventDefault(),ai.navigate(t.pathname))}))}static navigate(e){let t=e;e.startsWith("/")||(t=ai.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=ai.matchAll(),t={};for(const i of e)for(const e in i.params)t[e]=decodeURIComponent(i.params[e]);return t}static outlet(e){const t=ai.matchAll();if(e>=t.length)return null;const i=t[e].route.component,s=ai.elementCache.get(e+":"+i);if(s)return s;for(const t of ai.elementCache.keys())t.startsWith(e+":")&&ai.elementCache.delete(t);const n=document.createElement(i);return ai.elementCache.set(e+":"+i,n),n}static matchAll(){const e=window.location.pathname;let t=e;e.startsWith(ai.base)&&(t=e.slice(ai.base.length));const i=t.split("/").filter((e=>e));return ai.matchRoutes(ai.routes,i)}static matchRoutes(e,t){for(const i of e){const e=i.path.split("/").filter((e=>e));if(0===e.length&&0===t.length)return[{route:i,params:{}}];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);if(o.length>0&&!i.children)continue;const r=[{route:i,params:s}];if(i.children&&o.length>0){const e=ai.matchRoutes(i.children,o);if(e.length>0)return r.push(...e),r}if(i.children&&0===o.length&&i.default){window.history.replaceState({},"",window.location.pathname+"/"+i.default);const e=ai.matchRoutes(i.children,[i.default]);if(e.length>0)return r.push(...e),r}return r}return[]}}ai.base="",ai.routes=[],ai.elementCache=new Map;class li extends ce{constructor(){super(...arguments),this.level=-1,this.handlePopState=()=>{this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.level=this.detectLevel(),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopState)}detectLevel(){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);return e}render(){const e=ai.outlet(this.level);return e?V`${e}`:V``}}li.styles=c`
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,{el:i,scrolls:[]});const s=customElements.get(e.route.component);return s&&"function"==typeof s.resolve?Promise.resolve(s.resolve(li.getParams())).then((t=>{const s=Object.freeze({params:e.params,data:t});return i.routeSnapshot=s,i})):Promise.resolve(i)}))).then((t=>{if(i!==li.navToken)return;const s=Array.from(li.outletContexts.keys()).sort(((e,t)=>t-e));for(const e of s){const i=li.outletContexts.get(e);if(!i?.outlet?.el||i.outlet.el===t[e])continue;const s=li.routeCache.get(i.url);s&&(s.scrolls=li.getScrollableElements(i.outlet.el).map((e=>e.scrollTop))),i.outlet.deactivate(),i.element=null,i.url=""}t.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;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`
4573
4578
  :host {
4574
4579
  display: block;
4575
4580
  height: 100%;
4576
4581
  }
4577
- `,customElements.get("kr-router-outlet")||customElements.define("kr-router-outlet",li);export{Jt as KRChatbot,ai as KRRouter,li as KRRouterOutlet,ei as KRScaffold,ni as KRScreenDetail,ii as KRScreenNav,ri as KRSubbar};
4582
+ `,ai([me()],hi.prototype,"el",void 0),hi=ai([(e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)})("kr-router-outlet")],hi);export{Jt as KRChatbot,li as KRRouter,hi as KRRouterOutlet,ei as KRScaffold,ni as KRScreenDetail,ii as KRScreenNav,ri as KRSubbar};
4578
4583
  //# sourceMappingURL=krubble-app.bundled.min.js.map