@kodaris/krubble-app-components 1.0.35 → 1.0.37
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/breaking-changes.json +1 -1
- package/dist/krubble-app.bundled.js +21 -92
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +36 -78
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +21 -92
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +34 -76
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/screen-nav.d.ts +8 -19
- package/dist/screen-nav.d.ts.map +1 -1
- package/dist/screen-nav.js +21 -92
- package/dist/screen-nav.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const I=globalThis,A=I.trustedTypes,E=A?A.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+C,M=`<${N}>`,D=document,O=()=>D.createComment(""),
|
|
17
|
+
const I=globalThis,A=I.trustedTypes,E=A?A.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+C,M=`<${N}>`,D=document,O=()=>D.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,z=Array.isArray,U="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,j=/>/g,H=RegExp(`>|${U}(?:([^\\s"'>=/]+)(${U}*=${U}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,X=/"/g,q=/^(?:script|style|textarea|title)$/i,F=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),B=Symbol.for("lit-noChange"),Y=Symbol.for("lit-nothing"),V=new WeakMap,W=D.createTreeWalker(D,129);function Q(e,t){if(!z(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const K=(e,t)=>{const i=e.length-1,r=[];let a,s=2===t?"<svg>":3===t?"<math>":"",n=T;for(let t=0;t<i;t++){const i=e[t];let o,l,d=-1,c=0;for(;c<i.length&&(n.lastIndex=c,l=n.exec(i),null!==l);)c=n.lastIndex,n===T?"!--"===l[1]?n=R:void 0!==l[1]?n=j:void 0!==l[2]?(q.test(l[2])&&(a=RegExp("</"+l[2],"g")),n=H):void 0!==l[3]&&(n=H):n===H?">"===l[0]?(n=a??T,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?H:'"'===l[3]?X:L):n===X||n===L?n=H:n===R||n===j?n=T:(n=H,a=void 0);const p=n===H&&e[t+1].startsWith("/>")?" ":"";s+=n===T?i+M:d>=0?(r.push(o),i.slice(0,d)+S+i.slice(d)+C+p):i+C+(-2===d?t:p)}return[Q(e,s+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]};class G{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let a=0,s=0;const n=e.length-1,o=this.parts,[l,d]=K(e,t);if(this.el=G.createElement(l,i),W.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=W.nextNode())&&o.length<n;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(S)){const t=d[s++],i=r.getAttribute(e).split(C),n=/([.?@])?(.*)/.exec(t);o.push({type:1,index:a,name:n[2],strings:i,ctor:"."===n[1]?ie:"?"===n[1]?re:"@"===n[1]?ae:te}),r.removeAttribute(e)}else e.startsWith(C)&&(o.push({type:6,index:a}),r.removeAttribute(e));if(q.test(r.tagName)){const e=r.textContent.split(C),t=e.length-1;if(t>0){r.textContent=A?A.emptyScript:"";for(let i=0;i<t;i++)r.append(e[i],O()),W.nextNode(),o.push({type:2,index:++a});r.append(e[t],O())}}}else if(8===r.nodeType)if(r.data===N)o.push({type:2,index:a});else{let e=-1;for(;-1!==(e=r.data.indexOf(C,e+1));)o.push({type:7,index:a}),e+=C.length-1}a++}}static createElement(e,t){const i=D.createElement("template");return i.innerHTML=e,i}}function J(e,t,i=e,r){if(t===B)return t;let a=void 0!==r?i._$Co?.[r]:i._$Cl;const s=P(t)?void 0:t._$litDirective$;return a?.constructor!==s&&(a?._$AO?.(!1),void 0===s?a=void 0:(a=new s(e),a._$AT(e,i,r)),void 0!==r?(i._$Co??=[])[r]=a:i._$Cl=a),void 0!==a&&(t=J(e,a._$AS(e,t.values),a,r)),t}class Z{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);W.currentNode=r;let a=W.nextNode(),s=0,n=0,o=i[0];for(;void 0!==o;){if(s===o.index){let t;2===o.type?t=new ee(a,a.nextSibling,this,e):1===o.type?t=new o.ctor(a,o.name,o.strings,this,e):6===o.type&&(t=new se(a,this,e)),this._$AV.push(t),o=i[++n]}s!==o?.index&&(a=W.nextNode(),s++)}return W.currentNode=D,r}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class ee{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=Y,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=J(this,e,t),P(e)?e===Y||null==e||""===e?(this._$AH!==Y&&this._$AR(),this._$AH=Y):e!==this._$AH&&e!==B&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>z(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Y&&P(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,r="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=G.createElement(Q(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new Z(r,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new G(e)),t}k(e){z(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const a of e)r===t.length?t.push(i=new ee(this.O(O()),this.O(O()),this,this.options)):i=t[r],i._$AI(a),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,a){this.type=1,this._$AH=Y,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=a,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Y}_$AI(e,t=this,i,r){const a=this.strings;let s=!1;if(void 0===a)e=J(this,e,t,0),s=!P(e)||e!==this._$AH&&e!==B,s&&(this._$AH=e);else{const r=e;let n,o;for(e=a[0],n=0;n<a.length-1;n++)o=J(this,r[i+n],t,n),o===B&&(o=this._$AH[n]),s||=!P(o)||o!==this._$AH[n],o===Y?e=Y:e!==Y&&(e+=(o??"")+a[n+1]),this._$AH[n]=o}s&&!r&&this.j(e)}j(e){e===Y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ie extends te{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Y?void 0:e}}class re extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Y)}}class ae extends te{constructor(e,t,i,r,a){super(e,t,i,r,a),this.type=5}_$AI(e,t=this){if((e=J(this,e,t,0)??Y)===B)return;const i=this._$AH,r=e===Y&&i!==Y||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,a=e!==Y&&(i===Y||r);r&&this.element.removeEventListener(this.name,this,i),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class se{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){J(this,e)}}const ne=I.litHtmlPolyfillSupport;ne?.(G,ee),(I.litHtmlVersions??=[]).push("3.3.2");const oe=globalThis;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
@@ -50,11 +50,11 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
50
50
|
* @license
|
|
51
51
|
* Copyright 2017 Google LLC
|
|
52
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
53
|
-
*/class _e extends be{constructor(e){if(super(e),this.it=
|
|
53
|
+
*/class _e extends be{constructor(e){if(super(e),this.it=Y,e.type!==ge)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Y||null==e)return this._t=void 0,this.it=e;if(e===B)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}_e.directiveName="unsafeHTML",_e.resultType=1;const ye=me(_e);var ke=function(e,t,i,r){var a,s=arguments.length,n=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(n=(s<3?a(n):s>3?a(t,i,n):a(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};e.Shell=class extends le{constructor(){super(...arguments),this.logo="https://s3.amazonaws.com/kodariscom/kodariscom/content/website/kodaris-logo-icon-light-53.png",this.apps=[],this.activeAppId="",this.user=null,this.menuItems=[],this.isUserMenuOpen=!1,this.isAppsMenuOpen=!1,this.pendingRequests=0,this.originalFetch=null,this.originalXhrOpen=null,this.defaultLogoutIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"/></svg>',this.appsGridIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/></svg>',this.closeIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>'}connectedCallback(){if(super.connectedCallback(),this.installFetchInterceptor(),!document.getElementById("chatlio-widget-styles")){const e=document.createElement("style");e.id="chatlio-widget-styles",e.textContent="\n .chatlio-title-bar {\n display: none !important;\n }\n \n .chatlio-widget-body {\n bottom: 36px !important;\n }\n ",document.head.appendChild(e)}}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...i){return e.pendingRequests++,t(...i).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const i=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,r,a=!0,s,n){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,r,a,s,n)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}handleLogoClick(){this.dispatchEvent(new CustomEvent("logo-click",{bubbles:!0,composed:!0}))}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen,this.isAppsMenuOpen=!1}closeUserMenu(){this.isUserMenuOpen=!1}toggleAppsMenu(){this.isAppsMenuOpen=!this.isAppsMenuOpen,this.isUserMenuOpen=!1}closeAppsMenu(){this.isAppsMenuOpen=!1}handleMenuItemClick(e){this.closeUserMenu(),this.dispatchEvent(new CustomEvent("menu-item-click",{detail:{item:e},bubbles:!0,composed:!0}))}handleLogout(){this.closeUserMenu(),this.dispatchEvent(new CustomEvent("logout",{bubbles:!0,composed:!0}))}handleChatClick(){void 0!==window._chatlio&&window._chatlio.showOrHide()}renderAppsMenu(){return F`
|
|
54
54
|
<div class="appbar-apps">
|
|
55
55
|
${this.isAppsMenuOpen?F`
|
|
56
56
|
<div class="menu-backdrop" @click=${this.closeAppsMenu}></div>
|
|
57
|
-
`:
|
|
57
|
+
`:Y}
|
|
58
58
|
|
|
59
59
|
<button
|
|
60
60
|
class=${xe({"appbar-apps-btn":!0,"appbar-apps-btn--open":this.isAppsMenuOpen})}
|
|
@@ -85,11 +85,11 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
85
85
|
</div>
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
|
-
`}renderUserMenu(){if(!this.user)return
|
|
88
|
+
`}renderUserMenu(){if(!this.user)return Y;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return F`
|
|
89
89
|
<div class="appbar-user">
|
|
90
90
|
${this.isUserMenuOpen?F`
|
|
91
91
|
<div class="menu-backdrop" @click=${this.closeUserMenu}></div>
|
|
92
|
-
`:
|
|
92
|
+
`:Y}
|
|
93
93
|
|
|
94
94
|
<div
|
|
95
95
|
class="appbar-user__avatar"
|
|
@@ -103,7 +103,7 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
103
103
|
<p class="appbar-user__name">${this.user.name}</p>
|
|
104
104
|
${this.user.email?F`
|
|
105
105
|
<p class="appbar-user__email">${this.user.email}</p>
|
|
106
|
-
`:
|
|
106
|
+
`:Y}
|
|
107
107
|
</div>
|
|
108
108
|
|
|
109
109
|
${this.menuItems.map((e=>e.divider?F`<div class="appbar-user__menu-divider"></div>`:F`
|
|
@@ -113,14 +113,14 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
113
113
|
>
|
|
114
114
|
${e.icon?F`
|
|
115
115
|
<span class="appbar-user__menu-item__icon">${ye(e.icon)}</span>
|
|
116
|
-
`:
|
|
116
|
+
`:Y}
|
|
117
117
|
${e.label}
|
|
118
118
|
</button>
|
|
119
119
|
`))}
|
|
120
120
|
|
|
121
121
|
${this.menuItems.length>0?F`
|
|
122
122
|
<div class="appbar-user__menu-divider"></div>
|
|
123
|
-
`:
|
|
123
|
+
`:Y}
|
|
124
124
|
|
|
125
125
|
<button
|
|
126
126
|
class="appbar-user__menu-item appbar-user__menu-item--danger"
|
|
@@ -149,7 +149,7 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
149
149
|
<img src=${this.logo} alt="Home" />
|
|
150
150
|
</div>
|
|
151
151
|
<div class="appbar-divider"></div>
|
|
152
|
-
`:
|
|
152
|
+
`:Y}
|
|
153
153
|
|
|
154
154
|
<!-- App Switcher -->
|
|
155
155
|
${this.renderAppsMenu()}
|
|
@@ -916,7 +916,7 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
916
916
|
.btn-save:hover {
|
|
917
917
|
background: #d4f472;
|
|
918
918
|
}
|
|
919
|
-
`,we([ve()],$e.prototype,"label",void 0),we([ve()],$e.prototype,"icon",void 0),we([ve()],$e.prototype,"url",void 0),we([ve()],$e.prototype,"active",void 0),$e=we([ce("kr-nav-item-edit")],$e);var Ie=function(e,t,i,r){var a,s=arguments.length,n=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(n=(s<3?a(n):s>3?a(t,i,n):a(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};e.Scaffold=class extends le{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.breadcrumbs=[],this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.loadPref(),this.installFetchInterceptor()}updated(e){super.updated(e),e.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((e=>"group"===e.type)).forEach((e=>this.navItemsExpanded.add(e.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...i){return e.pendingRequests++,t(...i).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const i=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,r,a=!0,s,n){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,r,a,s,n)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(e){if(!e.url)return"#";if(e.external)return e.url;const t=e.url.startsWith("/")?e.url.slice(1):e.url,i=document.querySelector("base")?.getAttribute("href")||"/";return(i.endsWith("/")?i:i+"/")+t}getComputedNav(){const e=[];return this.nav.forEach(((t,i)=>{const r=this.pref.nav[t.id];e.push({...t,...r,order:r?.order??t.order??i,parentId:r?.parentId??null}),"group"===t.type&&t.children&&t.children.forEach(((i,r)=>{const a=this.pref.nav[i.id];e.push({...i,...a,order:a?.order??i.order??r,parentId:void 0!==a?.parentId?a.parentId:t.id})}))})),Object.entries(this.pref.nav).forEach((([t,i])=>{t.startsWith("custom")&&i.type&&i.label&&e.push({id:t,type:i.type,label:i.label,icon:i.icon,url:i.url,active:i.active,order:i.order??e.length,parentId:i.parentId??null})})),e}getNavItemChildren(e){let t=this.getComputedNav().filter((t=>t.parentId===e)).sort(((e,t)=>e.order-t.order));if(this.isEditing||(t=t.filter((e=>!1!==e.active))),this.navQuery){const i=this.navQuery.toLowerCase(),r=this.getComputedNav();if(null!==e){const a=r.find((t=>t.id===e));if(a?.label.toLowerCase().includes(i))return t}t=t.filter((e=>"group"===e.type?e.label.toLowerCase().includes(i)||r.some((t=>t.parentId===e.id&&!1!==t.active&&t.label.toLowerCase().includes(i))):e.label.toLowerCase().includes(i)))}return t}handleNavQueryChange(e){this.navQuery=e.target.value,this.navQuery?this.getComputedNav().forEach((e=>{"group"===e.type&&this.navItemsExpanded.add(e.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const e=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(e){this.isNavScrolled=e.target.scrollTop>0}toggleNavItem(e){const t=this.shadowRoot?.querySelector(`.nav-item[data-id="${e}"]`),i=t?.nextElementSibling;i&&(this.navItemsExpanded.has(e)?(this.navItemsExpanded.delete(e),i.animate([{height:`${i.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{i.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(e),i.classList.add("nav-group--expanded"),i.animate([{height:"0px"},{height:`${i.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate())}handleNavItemClick(e,t){if("group"===t.type)this.toggleNavItem(t.id);else{if(e.ctrlKey||e.metaKey||1===e.button)return;this.activeNavItemId=t.id;const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault()}}updateActiveNavItem(){const e=window.location.pathname,t=this.getComputedNav().filter((e=>"item"===e.type&&e.url));let i=null,r=0;for(const a of t){const t=this.resolveUrl(a);e.startsWith(t)&&t.length>r&&(i=a,r=t.length)}i?(this.activeNavItemId=i.id,i.parentId&&this.navItemsExpanded.add(i.parentId)):this.activeNavItemId=null}startEditing(){this.isEditing=!0}cancelEditing(){this.isEditing=!1,this.loadPref()}resetPref(){this.pref.nav={}}savePref(){const e=this.pref.uuid?`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`:"/api/system/preference/json/scaffold?global=true";i.Http.fetch({url:e,method:this.pref.uuid?"PUT":"POST",body:JSON.stringify({nav:this.pref.nav})}).then((e=>e.json())).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){i.Http.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>e.json())).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(e,i){this.isEditing&&(e.preventDefault(),t.ContextMenu.open({x:e.clientX,y:e.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((e=>{if(e)switch(e.id){case"edit":this.openNavItemEdit(i);break;case"add-above":this.addNavItem(i,"above");break;case"add-below":this.addNavItem(i,"below")}})))}openNavItemEdit(e){t.Dialog.open($e,{data:e}).afterClosed().then((t=>{const i=t;i&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id]={...this.pref.nav[e.id],...i},this.requestUpdate())}))}addNavItem(e,t){const i=`custom-${Date.now()}`,r=this.getComputedNav().filter((t=>t.parentId===e.parentId)).sort(((e,t)=>e.order-t.order)),a=r.findIndex((t=>t.id===e.id)),s="above"===t?a:a+1;r.forEach(((e,t)=>{t>=s&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id].order=t+1)}));const n={id:i,type:"item",label:"New Item",order:s,parentId:e.parentId,active:!0};this.pref.nav[i]=n,this.requestUpdate(),this.openNavItemEdit(n)}handleNavItemMouseDown(e,t){this.isEditing&&(e.preventDefault(),this.draggedNavItemId=t.id,this.navItemDragStartY=e.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(e){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(e.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const t=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));t&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=t.label,this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px"),this.updateNavItemDropTarget(e))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(e){const t=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!t)return;let i=!1;t.forEach((t=>{const r=t.getBoundingClientRect(),a=t.getAttribute("data-id");if(!a||a===this.draggedNavItemId)return;if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)return;const s=this.getComputedNav().find((e=>e.id===a));if(!s)return;const n=e.clientY-r.top;let o;"group"===s.type?n<r.height/3?(o="above",this.clearNavItemDragExpandTimeout()):n>2*r.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(s.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(s.id)):(o=n<r.height/2?"above":"below",this.clearNavItemDragExpandTimeout());const l="center"===o?s.id:s.parentId,d=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===d?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=s.id,this.navItemDropPosition=o,i=!0})),i||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}expandNavGroupOnDrag(e){this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===e&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(e),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const e=this.getComputedNav(),t=e.find((e=>e.id===this.draggedNavItemId)),i=e.find((e=>e.id===this.navItemDropTargetId));if(!t||!i)return;let r;if("center"===this.navItemDropPosition&&"group"===i.type){if(i.id===this.draggedNavItemId)return;r=i.id}else r=i.parentId;if(r===this.draggedNavItemId)return;const a=e.filter((e=>e.parentId===r&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),s=this.pref.nav;let n;if("center"===this.navItemDropPosition)n=a.length>0?Math.max(...a.map((e=>e.order)))+1:0;else{const e=a.findIndex((e=>e.id===i.id));n=-1===e?0:"above"===this.navItemDropPosition?e:e+1,a.forEach(((e,t)=>{s[e.id]||(s[e.id]={}),s[e.id].order=t>=n?t+1:t}))}s[this.draggedNavItemId]||(s[this.draggedNavItemId]={}),s[this.draggedNavItemId].order=n,s[this.draggedNavItemId].parentId=r,this.pref.nav=s,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return W;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return F`
|
|
919
|
+
`,we([ve()],$e.prototype,"label",void 0),we([ve()],$e.prototype,"icon",void 0),we([ve()],$e.prototype,"url",void 0),we([ve()],$e.prototype,"active",void 0),$e=we([ce("kr-nav-item-edit")],$e);var Ie=function(e,t,i,r){var a,s=arguments.length,n=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(n=(s<3?a(n):s>3?a(t,i,n):a(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};e.Scaffold=class extends le{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.breadcrumbs=[],this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.loadPref(),this.installFetchInterceptor()}updated(e){super.updated(e),e.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((e=>"group"===e.type)).forEach((e=>this.navItemsExpanded.add(e.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...i){return e.pendingRequests++,t(...i).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const i=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,r,a=!0,s,n){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,r,a,s,n)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(e){if(!e.url)return"#";if(e.external)return e.url;const t=e.url.startsWith("/")?e.url.slice(1):e.url,i=document.querySelector("base")?.getAttribute("href")||"/";return(i.endsWith("/")?i:i+"/")+t}getComputedNav(){const e=[];return this.nav.forEach(((t,i)=>{const r=this.pref.nav[t.id];e.push({...t,...r,order:r?.order??t.order??i,parentId:r?.parentId??null}),"group"===t.type&&t.children&&t.children.forEach(((i,r)=>{const a=this.pref.nav[i.id];e.push({...i,...a,order:a?.order??i.order??r,parentId:void 0!==a?.parentId?a.parentId:t.id})}))})),Object.entries(this.pref.nav).forEach((([t,i])=>{t.startsWith("custom")&&i.type&&i.label&&e.push({id:t,type:i.type,label:i.label,icon:i.icon,url:i.url,active:i.active,order:i.order??e.length,parentId:i.parentId??null})})),e}getNavItemChildren(e){let t=this.getComputedNav().filter((t=>t.parentId===e)).sort(((e,t)=>e.order-t.order));if(this.isEditing||(t=t.filter((e=>!1!==e.active))),this.navQuery){const i=this.navQuery.toLowerCase(),r=this.getComputedNav();if(null!==e){const a=r.find((t=>t.id===e));if(a?.label.toLowerCase().includes(i))return t}t=t.filter((e=>"group"===e.type?e.label.toLowerCase().includes(i)||r.some((t=>t.parentId===e.id&&!1!==t.active&&t.label.toLowerCase().includes(i))):e.label.toLowerCase().includes(i)))}return t}handleNavQueryChange(e){this.navQuery=e.target.value,this.navQuery?this.getComputedNav().forEach((e=>{"group"===e.type&&this.navItemsExpanded.add(e.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const e=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(e){this.isNavScrolled=e.target.scrollTop>0}toggleNavItem(e){const t=this.shadowRoot?.querySelector(`.nav-item[data-id="${e}"]`),i=t?.nextElementSibling;i&&(this.navItemsExpanded.has(e)?(this.navItemsExpanded.delete(e),i.animate([{height:`${i.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{i.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(e),i.classList.add("nav-group--expanded"),i.animate([{height:"0px"},{height:`${i.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate())}handleNavItemClick(e,t){if("group"===t.type)this.toggleNavItem(t.id);else{if(e.ctrlKey||e.metaKey||1===e.button)return;this.activeNavItemId=t.id;const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault()}}updateActiveNavItem(){const e=window.location.pathname,t=this.getComputedNav().filter((e=>"item"===e.type&&e.url));let i=null,r=0;for(const a of t){const t=this.resolveUrl(a);e.startsWith(t)&&t.length>r&&(i=a,r=t.length)}i?(this.activeNavItemId=i.id,i.parentId&&this.navItemsExpanded.add(i.parentId)):this.activeNavItemId=null}startEditing(){this.isEditing=!0}cancelEditing(){this.isEditing=!1,this.loadPref()}resetPref(){this.pref.nav={}}savePref(){const e=this.pref.uuid?`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`:"/api/system/preference/json/scaffold?global=true";i.Http.fetch({url:e,method:this.pref.uuid?"PUT":"POST",body:JSON.stringify({nav:this.pref.nav})}).then((e=>e.json())).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){i.Http.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>e.json())).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(e,i){this.isEditing&&(e.preventDefault(),t.ContextMenu.open({x:e.clientX,y:e.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((e=>{if(e)switch(e.id){case"edit":this.openNavItemEdit(i);break;case"add-above":this.addNavItem(i,"above");break;case"add-below":this.addNavItem(i,"below")}})))}openNavItemEdit(e){t.Dialog.open($e,{data:e}).afterClosed().then((t=>{const i=t;i&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id]={...this.pref.nav[e.id],...i},this.requestUpdate())}))}addNavItem(e,t){const i=`custom-${Date.now()}`,r=this.getComputedNav().filter((t=>t.parentId===e.parentId)).sort(((e,t)=>e.order-t.order)),a=r.findIndex((t=>t.id===e.id)),s="above"===t?a:a+1;r.forEach(((e,t)=>{t>=s&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id].order=t+1)}));const n={id:i,type:"item",label:"New Item",order:s,parentId:e.parentId,active:!0};this.pref.nav[i]=n,this.requestUpdate(),this.openNavItemEdit(n)}handleNavItemMouseDown(e,t){this.isEditing&&(e.preventDefault(),this.draggedNavItemId=t.id,this.navItemDragStartY=e.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(e){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(e.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const t=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));t&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=t.label,this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px"),this.updateNavItemDropTarget(e))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(e){const t=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!t)return;let i=!1;t.forEach((t=>{const r=t.getBoundingClientRect(),a=t.getAttribute("data-id");if(!a||a===this.draggedNavItemId)return;if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)return;const s=this.getComputedNav().find((e=>e.id===a));if(!s)return;const n=e.clientY-r.top;let o;"group"===s.type?n<r.height/3?(o="above",this.clearNavItemDragExpandTimeout()):n>2*r.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(s.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(s.id)):(o=n<r.height/2?"above":"below",this.clearNavItemDragExpandTimeout());const l="center"===o?s.id:s.parentId,d=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===d?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=s.id,this.navItemDropPosition=o,i=!0})),i||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}expandNavGroupOnDrag(e){this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===e&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(e),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const e=this.getComputedNav(),t=e.find((e=>e.id===this.draggedNavItemId)),i=e.find((e=>e.id===this.navItemDropTargetId));if(!t||!i)return;let r;if("center"===this.navItemDropPosition&&"group"===i.type){if(i.id===this.draggedNavItemId)return;r=i.id}else r=i.parentId;if(r===this.draggedNavItemId)return;const a=e.filter((e=>e.parentId===r&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),s=this.pref.nav;let n;if("center"===this.navItemDropPosition)n=a.length>0?Math.max(...a.map((e=>e.order)))+1:0;else{const e=a.findIndex((e=>e.id===i.id));n=-1===e?0:"above"===this.navItemDropPosition?e:e+1,a.forEach(((e,t)=>{s[e.id]||(s[e.id]={}),s[e.id].order=t>=n?t+1:t}))}s[this.draggedNavItemId]||(s[this.draggedNavItemId]={}),s[this.draggedNavItemId].order=n,s[this.draggedNavItemId].parentId=r,this.pref.nav=s,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return Y;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return F`
|
|
920
920
|
<div class="user-menu-container">
|
|
921
921
|
${this.isUserMenuOpen?F`
|
|
922
922
|
<div class="user-menu">
|
|
@@ -924,14 +924,14 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
924
924
|
Customize Navigation
|
|
925
925
|
</button>
|
|
926
926
|
</div>
|
|
927
|
-
`:
|
|
927
|
+
`:Y}
|
|
928
928
|
<div class="user" @click=${this.toggleUserMenu}>
|
|
929
929
|
<div class="user__avatar">
|
|
930
930
|
${this.user.avatar?F`<img src=${this.user.avatar} alt=${this.user.name} />`:e}
|
|
931
931
|
</div>
|
|
932
932
|
<div class="user__info">
|
|
933
933
|
<div class="user__name">${this.user.name}</div>
|
|
934
|
-
${this.user.email?F`<div class="user__email">${this.user.email}</div>`:
|
|
934
|
+
${this.user.email?F`<div class="user__email">${this.user.email}</div>`:Y}
|
|
935
935
|
</div>
|
|
936
936
|
</div>
|
|
937
937
|
</div>
|
|
@@ -959,7 +959,7 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
959
959
|
@click=${t=>this.handleNavItemClick(t,e)}
|
|
960
960
|
@contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
|
|
961
961
|
>
|
|
962
|
-
${this.navIconsDisplayed?F`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:
|
|
962
|
+
${this.navIconsDisplayed?F`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:Y}
|
|
963
963
|
<span class="nav-item__label">${e.label}</span>
|
|
964
964
|
<svg
|
|
965
965
|
class="nav-item__chevron"
|
|
@@ -979,12 +979,12 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
979
979
|
class=${xe({"nav-item":!0,"nav-item--active":this.activeNavItemId===e.id,"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition})}
|
|
980
980
|
data-id="${e.id}"
|
|
981
981
|
href=${this.resolveUrl(e)}
|
|
982
|
-
target=${e.external?"_blank":
|
|
982
|
+
target=${e.external?"_blank":Y}
|
|
983
983
|
@mousedown=${t=>this.handleNavItemMouseDown(t,e)}
|
|
984
984
|
@click=${t=>this.handleNavItemClick(t,e)}
|
|
985
985
|
@contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
|
|
986
986
|
>
|
|
987
|
-
${this.navIconsDisplayed&&!t?F`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:
|
|
987
|
+
${this.navIconsDisplayed&&!t?F`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:Y}
|
|
988
988
|
<span class="nav-item__label">${e.label}</span>
|
|
989
989
|
</a>
|
|
990
990
|
`}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return F`
|
|
@@ -1002,12 +1002,12 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1002
1002
|
<kr-subbar menu .breadcrumbs=${this.breadcrumbs} @menu-click=${this.handleMenuClick}>
|
|
1003
1003
|
<slot name="subbar"></slot>
|
|
1004
1004
|
</kr-subbar>
|
|
1005
|
-
`:
|
|
1005
|
+
`:Y}
|
|
1006
1006
|
|
|
1007
1007
|
<div class="wrapper">
|
|
1008
1008
|
<nav class=${xe({nav:!0,"nav--scrolled":this.isNavScrolled,"nav--opened":!this.subbar||this.isNavOpened})}>
|
|
1009
1009
|
<div class="nav-header" @click=${this.handleNavHeaderClick}>
|
|
1010
|
-
${this.label?F`<span class="nav-title">${this.label}</span>`:this.logo?F`<img class="nav-logo" src=${this.logo} alt="Logo" />`:
|
|
1010
|
+
${this.label?F`<span class="nav-title">${this.label}</span>`:this.logo?F`<img class="nav-logo" src=${this.logo} alt="Logo" />`:Y}
|
|
1011
1011
|
</div>
|
|
1012
1012
|
<div class="nav-content" @scroll=${this.handleNavScroll}>
|
|
1013
1013
|
${t>20?F`
|
|
@@ -1031,10 +1031,10 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1031
1031
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
1032
1032
|
</svg>
|
|
1033
1033
|
</button>
|
|
1034
|
-
`:
|
|
1034
|
+
`:Y}
|
|
1035
1035
|
</div>
|
|
1036
1036
|
</div>
|
|
1037
|
-
`:
|
|
1037
|
+
`:Y}
|
|
1038
1038
|
<div class="nav-items">
|
|
1039
1039
|
${e.map((e=>this.renderNavItem(e)))}
|
|
1040
1040
|
</div>
|
|
@@ -1774,16 +1774,16 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1774
1774
|
transform: scaleX(0.08);
|
|
1775
1775
|
}
|
|
1776
1776
|
}
|
|
1777
|
-
`,Ie([ve()],e.Scaffold.prototype,"navItemsExpanded",void 0),Ie([ve()],e.Scaffold.prototype,"navQuery",void 0),Ie([ve()],e.Scaffold.prototype,"activeNavItemId",void 0),Ie([ve()],e.Scaffold.prototype,"isNavScrolled",void 0),Ie([ve()],e.Scaffold.prototype,"isNavOpened",void 0),Ie([ve()],e.Scaffold.prototype,"isEditing",void 0),Ie([ve()],e.Scaffold.prototype,"isUserMenuOpen",void 0),Ie([ve()],e.Scaffold.prototype,"pref",void 0),Ie([ve()],e.Scaffold.prototype,"draggedNavItemId",void 0),Ie([ve()],e.Scaffold.prototype,"navItemDropTargetId",void 0),Ie([ve()],e.Scaffold.prototype,"navItemDropPosition",void 0),Ie([ve()],e.Scaffold.prototype,"pendingRequests",void 0),Ie([ue({type:String})],e.Scaffold.prototype,"logo",void 0),Ie([ue({type:String})],e.Scaffold.prototype,"label",void 0),Ie([ue({type:String,attribute:"home-url"})],e.Scaffold.prototype,"homeUrl",void 0),Ie([ue({type:String,reflect:!0})],e.Scaffold.prototype,"scheme",void 0),Ie([ue({type:Array})],e.Scaffold.prototype,"nav",void 0),Ie([ue({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],e.Scaffold.prototype,"navIconsDisplayed",void 0),Ie([ue({type:Boolean,attribute:"nav-expanded"})],e.Scaffold.prototype,"navExpanded",void 0),Ie([ue({type:Object})],e.Scaffold.prototype,"user",void 0),Ie([ue({type:Boolean})],e.Scaffold.prototype,"subbar",void 0),Ie([ue({type:Array})],e.Scaffold.prototype,"breadcrumbs",void 0),e.Scaffold=Ie([ce("kr-scaffold")],e.Scaffold);var Ae=function(e,t,i,r){var a,s=arguments.length,n=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(n=(s<3?a(n):s>3?a(t,i,n):a(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};e.ScreenNav=class extends le{constructor(){super(...arguments),this.
|
|
1777
|
+
`,Ie([ve()],e.Scaffold.prototype,"navItemsExpanded",void 0),Ie([ve()],e.Scaffold.prototype,"navQuery",void 0),Ie([ve()],e.Scaffold.prototype,"activeNavItemId",void 0),Ie([ve()],e.Scaffold.prototype,"isNavScrolled",void 0),Ie([ve()],e.Scaffold.prototype,"isNavOpened",void 0),Ie([ve()],e.Scaffold.prototype,"isEditing",void 0),Ie([ve()],e.Scaffold.prototype,"isUserMenuOpen",void 0),Ie([ve()],e.Scaffold.prototype,"pref",void 0),Ie([ve()],e.Scaffold.prototype,"draggedNavItemId",void 0),Ie([ve()],e.Scaffold.prototype,"navItemDropTargetId",void 0),Ie([ve()],e.Scaffold.prototype,"navItemDropPosition",void 0),Ie([ve()],e.Scaffold.prototype,"pendingRequests",void 0),Ie([ue({type:String})],e.Scaffold.prototype,"logo",void 0),Ie([ue({type:String})],e.Scaffold.prototype,"label",void 0),Ie([ue({type:String,attribute:"home-url"})],e.Scaffold.prototype,"homeUrl",void 0),Ie([ue({type:String,reflect:!0})],e.Scaffold.prototype,"scheme",void 0),Ie([ue({type:Array})],e.Scaffold.prototype,"nav",void 0),Ie([ue({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],e.Scaffold.prototype,"navIconsDisplayed",void 0),Ie([ue({type:Boolean,attribute:"nav-expanded"})],e.Scaffold.prototype,"navExpanded",void 0),Ie([ue({type:Object})],e.Scaffold.prototype,"user",void 0),Ie([ue({type:Boolean})],e.Scaffold.prototype,"subbar",void 0),Ie([ue({type:Array})],e.Scaffold.prototype,"breadcrumbs",void 0),e.Scaffold=Ie([ce("kr-scaffold")],e.Scaffold);var Ae=function(e,t,i,r){var a,s=arguments.length,n=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(n=(s<3?a(n):s>3?a(t,i,n):a(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};e.ScreenNav=class extends le{constructor(){super(...arguments),this.label="",this.subLabel="",this.navItems=[],this.activeId=""}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()}render(){return F`
|
|
1778
1778
|
<nav class="nav">
|
|
1779
|
-
${this.
|
|
1779
|
+
${this.label?F`
|
|
1780
1780
|
<div class="nav-header">
|
|
1781
1781
|
<div class="nav-header__text">
|
|
1782
|
-
${this.
|
|
1783
|
-
<div class="nav-header__title">${this.
|
|
1782
|
+
${this.subLabel?F`<div class="nav-header__subtitle">${this.subLabel}</div>`:Y}
|
|
1783
|
+
<div class="nav-header__title">${this.label}</div>
|
|
1784
1784
|
</div>
|
|
1785
1785
|
</div>
|
|
1786
|
-
`:
|
|
1786
|
+
`:Y}
|
|
1787
1787
|
<div class="nav-content">
|
|
1788
1788
|
<div class="nav-items">
|
|
1789
1789
|
${this.navItems.map((e=>F`
|
|
@@ -1802,13 +1802,6 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1802
1802
|
<div class="content__main">
|
|
1803
1803
|
<slot></slot>
|
|
1804
1804
|
</div>
|
|
1805
|
-
<!--<div class="breadcrumbs">
|
|
1806
|
-
<a href="/crm">CRM</a>
|
|
1807
|
-
<span class="breadcrumbs__separator">/</span>
|
|
1808
|
-
<a href="/crm/companies">Companies</a>
|
|
1809
|
-
<span class="breadcrumbs__separator">/</span>
|
|
1810
|
-
<span class="breadcrumbs__current">Acme Corporation</span>
|
|
1811
|
-
</div>-->
|
|
1812
1805
|
</main>
|
|
1813
1806
|
`}},e.ScreenNav.styles=l`
|
|
1814
1807
|
:host {
|
|
@@ -1867,13 +1860,14 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1867
1860
|
.nav-item {
|
|
1868
1861
|
display: block;
|
|
1869
1862
|
padding: 0 12px;
|
|
1870
|
-
height:
|
|
1871
|
-
line-height:
|
|
1872
|
-
letter-spacing: 0.
|
|
1863
|
+
height: 32px;
|
|
1864
|
+
line-height: 32px;
|
|
1865
|
+
letter-spacing: 0.01em;
|
|
1873
1866
|
color: rgb(32, 33, 36);
|
|
1874
1867
|
text-decoration: none;
|
|
1875
1868
|
font-size: 13px;
|
|
1876
|
-
font-weight:
|
|
1869
|
+
font-weight: 400;
|
|
1870
|
+
font-family: inherit;
|
|
1877
1871
|
border-radius: 8px;
|
|
1878
1872
|
transition: all 0.15s ease;
|
|
1879
1873
|
}
|
|
@@ -1884,9 +1878,9 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1884
1878
|
}
|
|
1885
1879
|
|
|
1886
1880
|
.nav-item--active {
|
|
1887
|
-
background:
|
|
1888
|
-
color: #
|
|
1889
|
-
font-weight:
|
|
1881
|
+
background: #e1e9f6;
|
|
1882
|
+
color: #1a2332;
|
|
1883
|
+
font-weight: 700;
|
|
1890
1884
|
}
|
|
1891
1885
|
|
|
1892
1886
|
.content {
|
|
@@ -1896,47 +1890,11 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1896
1890
|
flex-direction: column;
|
|
1897
1891
|
}
|
|
1898
1892
|
|
|
1899
|
-
.breadcrumbs {
|
|
1900
|
-
height: 32px;
|
|
1901
|
-
padding: 0 1rem;
|
|
1902
|
-
display: flex;
|
|
1903
|
-
align-items: center;
|
|
1904
|
-
gap: 6px;
|
|
1905
|
-
font-size: 12px;
|
|
1906
|
-
color: #6b7280;
|
|
1907
|
-
//background: #f9fafb;
|
|
1908
|
-
background: #beea4e;
|
|
1909
|
-
border-top: 1px solid #e5e7eb;
|
|
1910
|
-
flex-shrink: 0;
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
.breadcrumbs a {
|
|
1914
|
-
//color: #6b7280;
|
|
1915
|
-
color: #10172a;
|
|
1916
|
-
font-size: 13px;
|
|
1917
|
-
font-weight: 600;
|
|
1918
|
-
text-decoration: none;
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
.breadcrumbs a:hover {
|
|
1922
|
-
color: #111827;
|
|
1923
|
-
text-decoration: underline;
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
.breadcrumbs__separator {
|
|
1927
|
-
color: #d1d5db;
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
.breadcrumbs__current {
|
|
1931
|
-
color: #111827;
|
|
1932
|
-
font-weight: 500;
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
1893
|
.content__main {
|
|
1936
1894
|
flex: 1;
|
|
1937
1895
|
overflow-y: auto;
|
|
1938
1896
|
}
|
|
1939
|
-
`,Ae([ue({type:String})],e.ScreenNav.prototype,"
|
|
1897
|
+
`,Ae([ue({type:String})],e.ScreenNav.prototype,"label",void 0),Ae([ue({type:String})],e.ScreenNav.prototype,"subLabel",void 0),Ae([ue({type:Array})],e.ScreenNav.prototype,"navItems",void 0),Ae([ue({type:String})],e.ScreenNav.prototype,"activeId",void 0),e.ScreenNav=Ae([ce("kr-screen-nav")],e.ScreenNav);var Ee=function(e,t,i,r){var a,s=arguments.length,n=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(n=(s<3?a(n):s>3?a(t,i,n):a(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};e.ScreenDetail=class extends le{constructor(){super(...arguments),this.title=""}render(){return F`
|
|
1940
1898
|
<div class="header">
|
|
1941
1899
|
<h2 class="header__title">${this.title}</h2>
|
|
1942
1900
|
<div class="header__actions">
|
|
@@ -2001,7 +1959,7 @@ const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
2001
1959
|
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
2002
1960
|
</svg>
|
|
2003
1961
|
</div>
|
|
2004
|
-
`:
|
|
1962
|
+
`:Y}
|
|
2005
1963
|
<div class="breadcrumbs">
|
|
2006
1964
|
${this.breadcrumbs.map(((e,t)=>{const i=t===this.breadcrumbs.length-1;return F`
|
|
2007
1965
|
${t>0?F`<span class="breadcrumb-separator">/</span>`:""}
|