@kodaris/krubble-app-components 1.0.2 → 1.0.3
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/krubble-app.bundled.js +1 -68
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +80 -80
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +5 -73
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +80 -80
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/scaffold.js +1 -1
- package/dist/scaffold.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@kodaris/krubble-components")):"function"==typeof define&&define.amd?define(["exports","@kodaris/krubble-components"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).krApp={},e.kr)}(this,(function(e,t){"use strict";
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@kodaris/krubble-components"),require("@kodaris/krubble-data")):"function"==typeof define&&define.amd?define(["exports","@kodaris/krubble-components","@kodaris/krubble-data"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).krApp={},e.kr,e.krubbleData)}(this,(function(e,t,i){"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const
|
|
6
|
+
*/const r=globalThis,s=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),n=new WeakMap;let o=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(s&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=n.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(t,e))}return e}toString(){return this.cssText}};const l=(e,...t)=>{const i=1===e.length?e[0]:t.reduce(((t,i,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[r+1]),e[0]);return new o(i,e,a)},d=s?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,a))(t)})(e):e
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/,{is:
|
|
11
|
+
*/,{is:c,defineProperty:p,getOwnPropertyDescriptor:h,getOwnPropertyNames:u,getOwnPropertySymbols:v,getPrototypeOf:f}=Object,g=globalThis,m=g.trustedTypes,b=m?m.emptyScript:"",x=g.reactiveElementPolyfillSupport,_=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},k=(e,t)=>!c(e,t),$={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:k};Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);void 0!==r&&p(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:s}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){const a=r?.call(this);s?.call(this,t),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){const e=this.properties,t=[...u(e),...v(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(d(e))}else void 0!==e&&t.push(d(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(s)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const i of t){const t=document.createElement("style"),s=r.litNonce;void 0!==s&&t.setAttribute("nonce",s),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:y).toAttribute(t,i.type);this._$Em=e,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(e,t){const i=this.constructor,r=i._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=i.getPropertyOptions(r),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=r;const a=s.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,i){if(void 0!==e){const r=this.constructor,s=this[e];if(i??=r.getPropertyOptions(e),!((i.hasChanged??k)(s,t)||i.useDefault&&i.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:r,wrapped:s},a){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==s||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,i,r)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[_("elementProperties")]=new Map,w[_("finalized")]=new Map,x?.({ReactiveElement:w}),(g.reactiveElementVersions??=[]).push("2.1.1");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
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,R=`<${N}>`,M=document,D=()=>M.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,z=Array.isArray,P="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,K=/>/g,j=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,L=/"/g,X=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),F=Symbol.for("lit-noChange"),B=Symbol.for("lit-nothing"),Y=new WeakMap,V=M.createTreeWalker(M,129);function W(e,t){if(!z(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Q=(e,t)=>{const i=e.length-1,r=[];let s,a=2===t?"<svg>":3===t?"<math>":"",n=U;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===U?"!--"===l[1]?n=T:void 0!==l[1]?n=K:void 0!==l[2]?(X.test(l[2])&&(s=RegExp("</"+l[2],"g")),n=j):void 0!==l[3]&&(n=j):n===j?">"===l[0]?(n=s??U,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?j:'"'===l[3]?L:H):n===L||n===H?n=j:n===T||n===K?n=U:(n=j,s=void 0);const p=n===j&&e[t+1].startsWith("/>")?" ":"";a+=n===U?i+R:d>=0?(r.push(o),i.slice(0,d)+S+i.slice(d)+C+p):i+C+(-2===d?t:p)}return[W(e,a+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]};class G{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let s=0,a=0;const n=e.length-1,o=this.parts,[l,d]=Q(e,t);if(this.el=G.createElement(l,i),V.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=V.nextNode())&&o.length<n;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(S)){const t=d[a++],i=r.getAttribute(e).split(C),n=/([.?@])?(.*)/.exec(t);o.push({type:1,index:s,name:n[2],strings:i,ctor:"."===n[1]?ie:"?"===n[1]?re:"@"===n[1]?se:te}),r.removeAttribute(e)}else e.startsWith(C)&&(o.push({type:6,index:s}),r.removeAttribute(e));if(X.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],D()),V.nextNode(),o.push({type:2,index:++s});r.append(e[t],D())}}}else if(8===r.nodeType)if(r.data===N)o.push({type:2,index:s});else{let e=-1;for(;-1!==(e=r.data.indexOf(C,e+1));)o.push({type:7,index:s}),e+=C.length-1}s++}}static createElement(e,t){const i=M.createElement("template");return i.innerHTML=e,i}}function J(e,t,i=e,r){if(t===F)return t;let s=void 0!==r?i._$Co?.[r]:i._$Cl;const a=O(t)?void 0:t._$litDirective$;return s?.constructor!==a&&(s?._$AO?.(!1),void 0===a?s=void 0:(s=new a(e),s._$AT(e,i,r)),void 0!==r?(i._$Co??=[])[r]=s:i._$Cl=s),void 0!==s&&(t=J(e,s._$AS(e,t.values),s,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??M).importNode(t,!0);V.currentNode=r;let s=V.nextNode(),a=0,n=0,o=i[0];for(;void 0!==o;){if(a===o.index){let t;2===o.type?t=new ee(s,s.nextSibling,this,e):1===o.type?t=new o.ctor(s,o.name,o.strings,this,e):6===o.type&&(t=new ae(s,this,e)),this._$AV.push(t),o=i[++n]}a!==o?.index&&(s=V.nextNode(),a++)}return V.currentNode=M,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=B,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),O(e)?e===B||null==e||""===e?(this._$AH!==B&&this._$AR(),this._$AH=B):e!==this._$AH&&e!==F&&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!==B&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(M.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(W(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=Y.get(e.strings);return void 0===t&&Y.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 s of e)r===t.length?t.push(i=new ee(this.O(D()),this.O(D()),this,this.options)):i=t[r],i._$AI(s),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,s){this.type=1,this._$AH=B,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=B}_$AI(e,t=this,i,r){const s=this.strings;let a=!1;if(void 0===s)e=J(this,e,t,0),a=!O(e)||e!==this._$AH&&e!==F,a&&(this._$AH=e);else{const r=e;let n,o;for(e=s[0],n=0;n<s.length-1;n++)o=J(this,r[i+n],t,n),o===F&&(o=this._$AH[n]),a||=!O(o)||o!==this._$AH[n],o===B?e=B:e!==B&&(e+=(o??"")+s[n+1]),this._$AH[n]=o}a&&!r&&this.j(e)}j(e){e===B?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===B?void 0:e}}class re extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==B)}}class se extends te{constructor(e,t,i,r,s){super(e,t,i,r,s),this.type=5}_$AI(e,t=this){if((e=J(this,e,t,0)??B)===F)return;const i=this._$AH,r=e===B&&i!==B||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,s=e!==B&&(i===B||r);r&&this.element.removeEventListener(this.name,this,i),s&&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 ae{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.1");const oe=globalThis;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/let
|
|
22
|
+
*/let le=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,i)=>{const r=i?.renderBefore??t;let s=r._$litPart$;if(void 0===s){const e=i?.renderBefore??null;r._$litPart$=s=new ee(t.insertBefore(D(),e),e,void 0,i??{})}return s._$AI(e),s})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}};le._$litElement$=!0,le.finalized=!0,oe.litElementHydrateSupport?.({LitElement:le});const de=oe.litElementPolyfillSupport;de?.({LitElement:le}),(oe.litElementVersions??=[]).push("4.2.1");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)}
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/,
|
|
33
|
+
*/,pe={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:k},he=(e=pe,t,i)=>{const{kind:r,metadata:s}=i;let a=globalThis.litPropertyMetadata.get(s);if(void 0===a&&globalThis.litPropertyMetadata.set(s,a=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),a.set(i.name,e),"accessor"===r){const{name:r}=i;return{set(i){const s=t.get.call(this);t.set.call(this,i),this.requestUpdate(r,s,e)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){const{name:r}=i;return function(i){const s=this[r];t.call(this,i),this.requestUpdate(r,s,e)}}throw Error("Unsupported decorator location: "+r)};function ue(e){return(t,i)=>"object"==typeof i?he(e,t,i):((e,t,i)=>{const r=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),r?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
|
|
34
34
|
/**
|
|
35
35
|
* @license
|
|
36
36
|
* Copyright 2017 Google LLC
|
|
37
37
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
|
-
*/}function
|
|
38
|
+
*/}function ve(e){return ue({...e,state:!0,attribute:!1})}
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/const
|
|
43
|
+
*/const fe=1,ge=2,me=e=>(...t)=>({_$litDirective$:e,values:t});class be{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}
|
|
44
44
|
/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2018 Google LLC
|
|
47
47
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
|
-
*/const
|
|
48
|
+
*/const xe=me(class extends be{constructor(e){if(super(e),e.type!==fe||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const r=!!t[e];r===this.st.has(e)||this.nt?.has(e)||(r?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return F}});
|
|
49
49
|
/**
|
|
50
50
|
* @license
|
|
51
51
|
* Copyright 2017 Google LLC
|
|
52
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
53
|
-
*/class
|
|
53
|
+
*/class _e extends be{constructor(e){if(super(e),this.it=B,e.type!==ge)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===B||null==e)return this._t=void 0,this.it=e;if(e===F)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 s,a=arguments.length,n=a<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--)(s=e[o])&&(n=(a<3?s(n):a>3?s(t,i,n):s(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};e.KRShell=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(){super.connectedCallback(),this.installFetchInterceptor()}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,s=!0,a,n){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,r,s,a,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}))}renderAppsMenu(){return q`
|
|
54
54
|
<div class="appbar-apps">
|
|
55
|
-
${this.isAppsMenuOpen?
|
|
55
|
+
${this.isAppsMenuOpen?q`
|
|
56
56
|
<div class="menu-backdrop" @click=${this.closeAppsMenu}></div>
|
|
57
|
-
`:
|
|
57
|
+
`:B}
|
|
58
58
|
|
|
59
59
|
<button
|
|
60
|
-
class=${
|
|
60
|
+
class=${xe({"appbar-apps-btn":!0,"appbar-apps-btn--open":this.isAppsMenuOpen})}
|
|
61
61
|
@click=${this.toggleAppsMenu}
|
|
62
62
|
>
|
|
63
|
-
<span class="appbar-apps-btn__icon">${
|
|
63
|
+
<span class="appbar-apps-btn__icon">${ye(this.appsGridIcon)}</span>
|
|
64
64
|
</button>
|
|
65
65
|
|
|
66
|
-
<div class=${
|
|
66
|
+
<div class=${xe({"appbar-apps-menu":!0,"appbar-apps-menu--open":this.isAppsMenuOpen})}>
|
|
67
67
|
<div class="appbar-apps-menu__header">
|
|
68
68
|
<h2 class="appbar-apps-menu__title">Applications</h2>
|
|
69
69
|
<button class="appbar-apps-menu__close" @click=${this.closeAppsMenu}>
|
|
70
|
-
${
|
|
70
|
+
${ye(this.closeIcon)}
|
|
71
71
|
</button>
|
|
72
72
|
</div>
|
|
73
73
|
<div class="appbar-apps-menu__content">
|
|
74
74
|
<div class="appbar-apps-menu__list">
|
|
75
|
-
${this.apps.map((e=>
|
|
75
|
+
${this.apps.map((e=>q`
|
|
76
76
|
<a
|
|
77
77
|
class="appbar-apps-menu__item"
|
|
78
78
|
href=${e.url}
|
|
@@ -85,54 +85,54 @@ const de=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 B;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return q`
|
|
89
89
|
<div class="appbar-user">
|
|
90
|
-
${this.isUserMenuOpen?
|
|
90
|
+
${this.isUserMenuOpen?q`
|
|
91
91
|
<div class="menu-backdrop" @click=${this.closeUserMenu}></div>
|
|
92
|
-
`:
|
|
92
|
+
`:B}
|
|
93
93
|
|
|
94
94
|
<div
|
|
95
95
|
class="appbar-user__avatar"
|
|
96
96
|
@click=${this.toggleUserMenu}
|
|
97
97
|
>
|
|
98
|
-
${this.user.avatar?
|
|
98
|
+
${this.user.avatar?q`<img src=${this.user.avatar} alt=${this.user.name} />`:e}
|
|
99
99
|
</div>
|
|
100
100
|
|
|
101
|
-
<div class=${
|
|
101
|
+
<div class=${xe({"appbar-user__menu":!0,"appbar-user__menu--open":this.isUserMenuOpen})}>
|
|
102
102
|
<div class="appbar-user__header">
|
|
103
103
|
<p class="appbar-user__name">${this.user.name}</p>
|
|
104
|
-
${this.user.email?
|
|
104
|
+
${this.user.email?q`
|
|
105
105
|
<p class="appbar-user__email">${this.user.email}</p>
|
|
106
|
-
`:
|
|
106
|
+
`:B}
|
|
107
107
|
</div>
|
|
108
108
|
|
|
109
|
-
${this.menuItems.map((e=>e.divider?
|
|
109
|
+
${this.menuItems.map((e=>e.divider?q`<div class="appbar-user__menu-divider"></div>`:q`
|
|
110
110
|
<button
|
|
111
111
|
class="appbar-user__menu-item"
|
|
112
112
|
@click=${()=>this.handleMenuItemClick(e)}
|
|
113
113
|
>
|
|
114
|
-
${e.icon?
|
|
115
|
-
<span class="appbar-user__menu-item__icon">${
|
|
116
|
-
`:
|
|
114
|
+
${e.icon?q`
|
|
115
|
+
<span class="appbar-user__menu-item__icon">${ye(e.icon)}</span>
|
|
116
|
+
`:B}
|
|
117
117
|
${e.label}
|
|
118
118
|
</button>
|
|
119
119
|
`))}
|
|
120
120
|
|
|
121
|
-
${this.menuItems.length>0?
|
|
121
|
+
${this.menuItems.length>0?q`
|
|
122
122
|
<div class="appbar-user__menu-divider"></div>
|
|
123
|
-
`:
|
|
123
|
+
`:B}
|
|
124
124
|
|
|
125
125
|
<button
|
|
126
126
|
class="appbar-user__menu-item appbar-user__menu-item--danger"
|
|
127
127
|
@click=${this.handleLogout}
|
|
128
128
|
>
|
|
129
|
-
<span class="appbar-user__menu-item__icon">${
|
|
129
|
+
<span class="appbar-user__menu-item__icon">${ye(this.defaultLogoutIcon)}</span>
|
|
130
130
|
Sign Out
|
|
131
131
|
</button>
|
|
132
132
|
</div>
|
|
133
133
|
</div>
|
|
134
|
-
`}render(){return
|
|
135
|
-
<div class=${
|
|
134
|
+
`}render(){return q`
|
|
135
|
+
<div class=${xe({progress:!0,"progress--loading":this.pendingRequests>0})}>
|
|
136
136
|
<div class="progress__track"></div>
|
|
137
137
|
<div class="progress__bar progress__bar--primary">
|
|
138
138
|
<span class="progress__bar-inner"></span>
|
|
@@ -144,12 +144,12 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
144
144
|
|
|
145
145
|
<header class="appbar">
|
|
146
146
|
<!-- Logo -->
|
|
147
|
-
${this.logo?
|
|
147
|
+
${this.logo?q`
|
|
148
148
|
<div class="appbar-logo" @click=${this.handleLogoClick}>
|
|
149
149
|
<img src=${this.logo} alt="Home" />
|
|
150
150
|
</div>
|
|
151
151
|
<div class="appbar-divider"></div>
|
|
152
|
-
`:
|
|
152
|
+
`:B}
|
|
153
153
|
|
|
154
154
|
<!-- App Switcher -->
|
|
155
155
|
${this.renderAppsMenu()}
|
|
@@ -173,7 +173,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
173
173
|
<main class="main">
|
|
174
174
|
<slot></slot>
|
|
175
175
|
</main>
|
|
176
|
-
`}},e.KRShell.styles=
|
|
176
|
+
`}},e.KRShell.styles=l`
|
|
177
177
|
:host {
|
|
178
178
|
display: flex;
|
|
179
179
|
flex-direction: column;
|
|
@@ -699,7 +699,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
699
699
|
transform: scaleX(0.08);
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
|
-
`,
|
|
702
|
+
`,ke([ue({type:String})],e.KRShell.prototype,"logo",void 0),ke([ue({type:Array})],e.KRShell.prototype,"apps",void 0),ke([ue({type:String,attribute:"active-app-id"})],e.KRShell.prototype,"activeAppId",void 0),ke([ue({type:Object})],e.KRShell.prototype,"user",void 0),ke([ue({type:Array,attribute:"menu-items"})],e.KRShell.prototype,"menuItems",void 0),ke([ve()],e.KRShell.prototype,"isUserMenuOpen",void 0),ke([ve()],e.KRShell.prototype,"isAppsMenuOpen",void 0),ke([ve()],e.KRShell.prototype,"pendingRequests",void 0),e.KRShell=ke([ce("kr-shell")],e.KRShell);var $e=function(e,t,i,r){var s,a=arguments.length,n=a<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--)(s=e[o])&&(n=(a<3?s(n):a>3?s(t,i,n):s(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};let we=class extends le{constructor(){super(...arguments),this.label="",this.icon="",this.url="",this.active=!0}connectedCallback(){super.connectedCallback(),this.data&&(this.label=this.data.label||"",this.icon=this.data.icon||"",this.url=this.data.url||"",this.active=!1!==this.data.active)}handleLabelInput(e){const t=e.target;this.label=t.value}handleIconInput(e){const t=e.target;this.icon=t.value}handleUrlInput(e){const t=e.target;this.url=t.value}handleActiveChange(e){this.active=e.target.checked}handleCancel(){this.dialogRef.close(void 0)}handleSave(){this.dialogRef.close({label:this.label,icon:this.icon||void 0,url:this.url||void 0,active:this.active})}handleKeyDown(e){"Enter"===e.key&&this.handleSave()}render(){return q`
|
|
703
703
|
<h2>Edit Navigation Item</h2>
|
|
704
704
|
|
|
705
705
|
<div class="form-group">
|
|
@@ -751,7 +751,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
751
751
|
<button class="btn-cancel" @click=${this.handleCancel}>Cancel</button>
|
|
752
752
|
<button class="btn-save" @click=${this.handleSave}>Save</button>
|
|
753
753
|
</div>
|
|
754
|
-
`}};we.styles=
|
|
754
|
+
`}};we.styles=l`
|
|
755
755
|
:host {
|
|
756
756
|
display: block;
|
|
757
757
|
width: 360px;
|
|
@@ -836,26 +836,26 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
836
836
|
.btn-save:hover {
|
|
837
837
|
background: #d4f472;
|
|
838
838
|
}
|
|
839
|
-
`,ke([ue()],we.prototype,"label",void 0),ke([ue()],we.prototype,"icon",void 0),ke([ue()],we.prototype,"url",void 0),ke([ue()],we.prototype,"active",void 0),we=ke([de("kr-nav-item-edit")],we);var Ie=function(e,t,i,r){var s,a=arguments.length,n=a<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--)(s=e[o])&&(n=(a<3?s(n):a>3?s(t,i,n):s(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};e.KRScaffold=class extends oe{constructor(){super(),this.http=$e.getInstance(),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=!0,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.title="",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,s=!0,a,n){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,r,s,a,n)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}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 s=this.pref.nav[i.id];e.push({...i,...s,order:s?.order??i.order??r,parentId:void 0!==s?.parentId?s.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 e=this.navQuery.toLowerCase(),i=this.getComputedNav();t=t.filter((t=>"group"===t.type?t.label.toLowerCase().includes(e)||i.some((i=>i.parentId===t.id&&!1!==i.active&&i.label.toLowerCase().includes(e))):t.label.toLowerCase().includes(e)))}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}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{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 s of t){const t=s.url;e.startsWith(t)&&t.length>r&&(i=s,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";this.http.fetch({url:e,method:this.pref.uuid?"PUT":"POST",body:JSON.stringify({nav:this.pref.nav})}).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){this.http.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(e,i){this.isEditing&&(e.preventDefault(),t.KRContextMenu.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.KRDialog.open(we,{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)),s=r.findIndex((t=>t.id===e.id)),a="above"===t?s:s+1;r.forEach(((e,t)=>{t>=a&&(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:a,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(),s=t.getAttribute("data-id");if(!s||s===this.draggedNavItemId)return;if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)return;const a=this.getComputedNav().find((e=>e.id===s));if(!a)return;const n=e.clientY-r.top;let o;"group"===a.type?n<r.height/3?(o="above",this.clearNavItemDragExpandTimeout()):n>2*r.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(a.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(a.id)):(o=n<r.height/2?"above":"below",this.clearNavItemDragExpandTimeout());const l="center"===o?a.id:a.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=a.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 s=e.filter((e=>e.parentId===r&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),a=this.pref.nav;let n;if("center"===this.navItemDropPosition)n=s.length>0?Math.max(...s.map((e=>e.order)))+1:0;else{const e=s.findIndex((e=>e.id===i.id));n=-1===e?0:"above"===this.navItemDropPosition?e:e+1,s.forEach(((e,t)=>{a[e.id]||(a[e.id]={}),a[e.id].order=t>=n?t+1:t}))}a[this.draggedNavItemId]||(a[this.draggedNavItemId]={}),a[this.draggedNavItemId].order=n,a[this.draggedNavItemId].parentId=r,this.pref.nav=a,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return F;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return L`
|
|
839
|
+
`,$e([ve()],we.prototype,"label",void 0),$e([ve()],we.prototype,"icon",void 0),$e([ve()],we.prototype,"url",void 0),$e([ve()],we.prototype,"active",void 0),we=$e([ce("kr-nav-item-edit")],we);var Ie=function(e,t,i,r){var s,a=arguments.length,n=a<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--)(s=e[o])&&(n=(a<3?s(n):a>3?s(t,i,n):s(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};e.KRScaffold=class extends le{constructor(){super(),this.http=i.KRClient.getInstance(),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=!0,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.title="",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,s=!0,a,n){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,r,s,a,n)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}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 s=this.pref.nav[i.id];e.push({...i,...s,order:s?.order??i.order??r,parentId:void 0!==s?.parentId?s.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 e=this.navQuery.toLowerCase(),i=this.getComputedNav();t=t.filter((t=>"group"===t.type?t.label.toLowerCase().includes(e)||i.some((i=>i.parentId===t.id&&!1!==i.active&&i.label.toLowerCase().includes(e))):t.label.toLowerCase().includes(e)))}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}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{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 s of t){const t=s.url;e.startsWith(t)&&t.length>r&&(i=s,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";this.http.fetch({url:e,method:this.pref.uuid?"PUT":"POST",body:JSON.stringify({nav:this.pref.nav})}).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){this.http.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(e,i){this.isEditing&&(e.preventDefault(),t.KRContextMenu.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.KRDialog.open(we,{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)),s=r.findIndex((t=>t.id===e.id)),a="above"===t?s:s+1;r.forEach(((e,t)=>{t>=a&&(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:a,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(),s=t.getAttribute("data-id");if(!s||s===this.draggedNavItemId)return;if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)return;const a=this.getComputedNav().find((e=>e.id===s));if(!a)return;const n=e.clientY-r.top;let o;"group"===a.type?n<r.height/3?(o="above",this.clearNavItemDragExpandTimeout()):n>2*r.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(a.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(a.id)):(o=n<r.height/2?"above":"below",this.clearNavItemDragExpandTimeout());const l="center"===o?a.id:a.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=a.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 s=e.filter((e=>e.parentId===r&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),a=this.pref.nav;let n;if("center"===this.navItemDropPosition)n=s.length>0?Math.max(...s.map((e=>e.order)))+1:0;else{const e=s.findIndex((e=>e.id===i.id));n=-1===e?0:"above"===this.navItemDropPosition?e:e+1,s.forEach(((e,t)=>{a[e.id]||(a[e.id]={}),a[e.id].order=t>=n?t+1:t}))}a[this.draggedNavItemId]||(a[this.draggedNavItemId]={}),a[this.draggedNavItemId].order=n,a[this.draggedNavItemId].parentId=r,this.pref.nav=a,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return B;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return q`
|
|
840
840
|
<div class="user-menu-container">
|
|
841
|
-
${this.isUserMenuOpen?
|
|
841
|
+
${this.isUserMenuOpen?q`
|
|
842
842
|
<div class="user-menu">
|
|
843
843
|
<button class="user-menu__item" @click=${this.handleCustomize}>
|
|
844
844
|
Customize Navigation
|
|
845
845
|
</button>
|
|
846
846
|
</div>
|
|
847
|
-
`:
|
|
847
|
+
`:B}
|
|
848
848
|
<div class="user" @click=${this.toggleUserMenu}>
|
|
849
849
|
<div class="user__avatar">
|
|
850
|
-
${this.user.avatar?
|
|
850
|
+
${this.user.avatar?q`<img src=${this.user.avatar} alt=${this.user.name} />`:e}
|
|
851
851
|
</div>
|
|
852
852
|
<div class="user__info">
|
|
853
853
|
<div class="user__name">${this.user.name}</div>
|
|
854
|
-
${this.user.email?
|
|
854
|
+
${this.user.email?q`<div class="user__email">${this.user.email}</div>`:B}
|
|
855
855
|
</div>
|
|
856
856
|
</div>
|
|
857
857
|
</div>
|
|
858
|
-
`}renderEditFooter(){return
|
|
858
|
+
`}renderEditFooter(){return q`
|
|
859
859
|
<div class="edit-actions">
|
|
860
860
|
<button class="edit-actions__btn edit-actions__btn--primary" @click=${this.savePref}>
|
|
861
861
|
Save
|
|
@@ -869,17 +869,17 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
869
869
|
</button>
|
|
870
870
|
</div>
|
|
871
871
|
</div>
|
|
872
|
-
`}renderNavItem(e,t=!1){if("section"===e.type)return
|
|
872
|
+
`}renderNavItem(e,t=!1){if("section"===e.type)return q`
|
|
873
873
|
<div class="nav-section">${e.label}</div>
|
|
874
|
-
`;if("group"===e.type){const t=this.getNavItemChildren(e.id);return
|
|
874
|
+
`;if("group"===e.type){const t=this.getNavItemChildren(e.id);return q`
|
|
875
875
|
<button
|
|
876
|
-
class=${
|
|
876
|
+
class=${xe({"nav-item":!0,"nav-item--expanded":this.navItemsExpanded.has(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,"nav-item--drop-center":this.navItemDropTargetId===e.id&&"center"===this.navItemDropPosition})}
|
|
877
877
|
data-id="${e.id}"
|
|
878
878
|
@mousedown=${t=>this.handleNavItemMouseDown(t,e)}
|
|
879
879
|
@click=${t=>this.handleNavItemClick(t,e)}
|
|
880
880
|
@contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
|
|
881
881
|
>
|
|
882
|
-
${this.navIconsDisplayed?
|
|
882
|
+
${this.navIconsDisplayed?q`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:B}
|
|
883
883
|
<span class="nav-item__label">${e.label}</span>
|
|
884
884
|
<svg
|
|
885
885
|
class="nav-item__chevron"
|
|
@@ -891,23 +891,23 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
891
891
|
<path d="M6 9l6 6 6-6" stroke-linecap="round" stroke-linejoin="round" />
|
|
892
892
|
</svg>
|
|
893
893
|
</button>
|
|
894
|
-
<div class=${
|
|
894
|
+
<div class=${xe({"nav-group":!0,"nav-group--expanded":this.navItemsExpanded.has(e.id)})}>
|
|
895
895
|
${t.map((e=>this.renderNavItem(e,!0)))}
|
|
896
896
|
</div>
|
|
897
|
-
`}return
|
|
897
|
+
`}return q`
|
|
898
898
|
<a
|
|
899
|
-
class=${
|
|
899
|
+
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})}
|
|
900
900
|
data-id="${e.id}"
|
|
901
901
|
href=${e.url||"#"}
|
|
902
902
|
@mousedown=${t=>this.handleNavItemMouseDown(t,e)}
|
|
903
903
|
@click=${t=>this.handleNavItemClick(t,e)}
|
|
904
904
|
@contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
|
|
905
905
|
>
|
|
906
|
-
${this.navIconsDisplayed&&!t?
|
|
906
|
+
${this.navIconsDisplayed&&!t?q`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:B}
|
|
907
907
|
<span class="nav-item__label">${e.label}</span>
|
|
908
908
|
</a>
|
|
909
|
-
`}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return
|
|
910
|
-
<div class=${
|
|
909
|
+
`}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return q`
|
|
910
|
+
<div class=${xe({progress:!0,"progress--loading":this.pendingRequests>0})}>
|
|
911
911
|
<div class="progress__track"></div>
|
|
912
912
|
<div class="progress__bar progress__bar--primary">
|
|
913
913
|
<span class="progress__bar-inner"></span>
|
|
@@ -917,19 +917,19 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
917
917
|
</div>
|
|
918
918
|
</div>
|
|
919
919
|
|
|
920
|
-
${this.subbar?
|
|
920
|
+
${this.subbar?q`
|
|
921
921
|
<kr-subbar menu .breadcrumbs=${this.breadcrumbs} @menu-click=${this.handleMenuClick}>
|
|
922
922
|
<slot name="subbar"></slot>
|
|
923
923
|
</kr-subbar>
|
|
924
|
-
`:
|
|
924
|
+
`:B}
|
|
925
925
|
|
|
926
926
|
<div class="wrapper">
|
|
927
|
-
<nav class=${
|
|
927
|
+
<nav class=${xe({nav:!0,"nav--scrolled":this.isNavScrolled,"nav--opened":!this.subbar||this.isNavOpened})}>
|
|
928
928
|
<div class="nav-header">
|
|
929
|
-
${this.title?
|
|
929
|
+
${this.title?q`<span class="nav-title">${this.title}</span>`:this.logo?q`<img class="nav-logo" src=${this.logo} alt="Logo" />`:B}
|
|
930
930
|
</div>
|
|
931
931
|
<div class="nav-content" @scroll=${this.handleNavScroll}>
|
|
932
|
-
${t>20?
|
|
932
|
+
${t>20?q`
|
|
933
933
|
<div class="nav-search">
|
|
934
934
|
<div class="nav-search__wrapper">
|
|
935
935
|
<span class="nav-search__icon">
|
|
@@ -944,16 +944,16 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
944
944
|
.value=${this.navQuery}
|
|
945
945
|
@input=${this.handleNavQueryChange}
|
|
946
946
|
/>
|
|
947
|
-
${this.navQuery?
|
|
947
|
+
${this.navQuery?q`
|
|
948
948
|
<button class="nav-search__clear" @click=${this.handleNavQueryClear}>
|
|
949
949
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
950
950
|
<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"/>
|
|
951
951
|
</svg>
|
|
952
952
|
</button>
|
|
953
|
-
`:
|
|
953
|
+
`:B}
|
|
954
954
|
</div>
|
|
955
955
|
</div>
|
|
956
|
-
`:
|
|
956
|
+
`:B}
|
|
957
957
|
<div class="nav-items">
|
|
958
958
|
${e.map((e=>this.renderNavItem(e)))}
|
|
959
959
|
</div>
|
|
@@ -968,7 +968,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
968
968
|
</main>
|
|
969
969
|
</div>
|
|
970
970
|
|
|
971
|
-
`}},e.KRScaffold.styles=
|
|
971
|
+
`}},e.KRScaffold.styles=l`
|
|
972
972
|
:host {
|
|
973
973
|
display: flex;
|
|
974
974
|
flex-direction: column;
|
|
@@ -1695,19 +1695,19 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1695
1695
|
transform: scaleX(0.08);
|
|
1696
1696
|
}
|
|
1697
1697
|
}
|
|
1698
|
-
`,Ie([
|
|
1698
|
+
`,Ie([ve()],e.KRScaffold.prototype,"navItemsExpanded",void 0),Ie([ve()],e.KRScaffold.prototype,"navQuery",void 0),Ie([ve()],e.KRScaffold.prototype,"activeNavItemId",void 0),Ie([ve()],e.KRScaffold.prototype,"isNavScrolled",void 0),Ie([ve()],e.KRScaffold.prototype,"isNavOpened",void 0),Ie([ve()],e.KRScaffold.prototype,"isEditing",void 0),Ie([ve()],e.KRScaffold.prototype,"isUserMenuOpen",void 0),Ie([ve()],e.KRScaffold.prototype,"pref",void 0),Ie([ve()],e.KRScaffold.prototype,"draggedNavItemId",void 0),Ie([ve()],e.KRScaffold.prototype,"navItemDropTargetId",void 0),Ie([ve()],e.KRScaffold.prototype,"navItemDropPosition",void 0),Ie([ve()],e.KRScaffold.prototype,"pendingRequests",void 0),Ie([ue({type:String})],e.KRScaffold.prototype,"logo",void 0),Ie([ue({type:String})],e.KRScaffold.prototype,"title",void 0),Ie([ue({type:String,reflect:!0})],e.KRScaffold.prototype,"scheme",void 0),Ie([ue({type:Array})],e.KRScaffold.prototype,"nav",void 0),Ie([ue({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],e.KRScaffold.prototype,"navIconsDisplayed",void 0),Ie([ue({type:Boolean,attribute:"nav-expanded"})],e.KRScaffold.prototype,"navExpanded",void 0),Ie([ue({type:Object})],e.KRScaffold.prototype,"user",void 0),Ie([ue({type:Boolean})],e.KRScaffold.prototype,"subbar",void 0),Ie([ue({type:Array})],e.KRScaffold.prototype,"breadcrumbs",void 0),e.KRScaffold=Ie([ce("kr-scaffold")],e.KRScaffold);var Ae=function(e,t,i,r){var s,a=arguments.length,n=a<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--)(s=e[o])&&(n=(a<3?s(n):a>3?s(t,i,n):s(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};e.KRScreenNav=class extends le{constructor(){super(...arguments),this.title="",this.subtitle="",this.backUrl="",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()}updateActiveNavItem(){const e=window.location.pathname,t=this.navItems.find((t=>{if(!t.url)return!1;if(t.url.startsWith("./")){const i=t.url.replace(/^\.\//,"");return e.endsWith("/"+i)}return e===t.url||e.startsWith(t.url+"/")}));t&&(this.activeId=t.id)}render(){return q`
|
|
1699
1699
|
<nav class="nav">
|
|
1700
|
-
${this.title?
|
|
1700
|
+
${this.title?q`
|
|
1701
1701
|
<div class="nav-header">
|
|
1702
1702
|
<div class="nav-header__text">
|
|
1703
|
-
${this.subtitle?
|
|
1703
|
+
${this.subtitle?q`<div class="nav-header__subtitle">${this.subtitle}</div>`:B}
|
|
1704
1704
|
<div class="nav-header__title">${this.title}</div>
|
|
1705
1705
|
</div>
|
|
1706
1706
|
</div>
|
|
1707
|
-
`:
|
|
1707
|
+
`:B}
|
|
1708
1708
|
<div class="nav-content">
|
|
1709
1709
|
<div class="nav-items">
|
|
1710
|
-
${this.navItems.map((e=>
|
|
1710
|
+
${this.navItems.map((e=>q`
|
|
1711
1711
|
<a
|
|
1712
1712
|
class="nav-item ${e.id===this.activeId?"nav-item--active":""}"
|
|
1713
1713
|
href=${e.url||"#"}
|
|
@@ -1731,7 +1731,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1731
1731
|
<span class="breadcrumbs__current">Acme Corporation</span>
|
|
1732
1732
|
</div>-->
|
|
1733
1733
|
</main>
|
|
1734
|
-
`}},e.KRScreenNav.styles=
|
|
1734
|
+
`}},e.KRScreenNav.styles=l`
|
|
1735
1735
|
:host {
|
|
1736
1736
|
display: flex;
|
|
1737
1737
|
height: 100%;
|
|
@@ -1857,7 +1857,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1857
1857
|
flex: 1;
|
|
1858
1858
|
overflow-y: auto;
|
|
1859
1859
|
}
|
|
1860
|
-
`,Ae([
|
|
1860
|
+
`,Ae([ue({type:String})],e.KRScreenNav.prototype,"title",void 0),Ae([ue({type:String})],e.KRScreenNav.prototype,"subtitle",void 0),Ae([ue({type:String})],e.KRScreenNav.prototype,"backUrl",void 0),Ae([ue({type:Array})],e.KRScreenNav.prototype,"navItems",void 0),Ae([ue({type:String})],e.KRScreenNav.prototype,"activeId",void 0),e.KRScreenNav=Ae([ce("kr-screen-nav")],e.KRScreenNav);var Ee=function(e,t,i,r){var s,a=arguments.length,n=a<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--)(s=e[o])&&(n=(a<3?s(n):a>3?s(t,i,n):s(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};e.KRScreenDetail=class extends le{constructor(){super(...arguments),this.title=""}render(){return q`
|
|
1861
1861
|
<div class="header">
|
|
1862
1862
|
<h2 class="header__title">${this.title}</h2>
|
|
1863
1863
|
<div class="header__actions">
|
|
@@ -1869,7 +1869,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1869
1869
|
<slot></slot>
|
|
1870
1870
|
</div>
|
|
1871
1871
|
</div>
|
|
1872
|
-
`}},e.KRScreenDetail.styles=
|
|
1872
|
+
`}},e.KRScreenDetail.styles=l`
|
|
1873
1873
|
:host {
|
|
1874
1874
|
display: flex;
|
|
1875
1875
|
flex-direction: column;
|
|
@@ -1913,8 +1913,8 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1913
1913
|
width: 100%;
|
|
1914
1914
|
max-width: 700px;
|
|
1915
1915
|
}
|
|
1916
|
-
`,Ee([
|
|
1917
|
-
${this.menu?
|
|
1916
|
+
`,Ee([ue({type:String})],e.KRScreenDetail.prototype,"title",void 0),e.KRScreenDetail=Ee([ce("kr-screen-detail")],e.KRScreenDetail);var Se=function(e,t,i,r){var s,a=arguments.length,n=a<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--)(s=e[o])&&(n=(a<3?s(n):a>3?s(t,i,n):s(t,i))||n);return a>3&&n&&Object.defineProperty(t,i,n),n};e.KRSubbar=class extends le{constructor(){super(...arguments),this.breadcrumbs=[],this.menu=!1}_handleMenuClick(){this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0}))}render(){return q`
|
|
1917
|
+
${this.menu?q`
|
|
1918
1918
|
<div class="menu" @click=${this._handleMenuClick}>
|
|
1919
1919
|
<svg class="menu__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1920
1920
|
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
@@ -1922,12 +1922,12 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1922
1922
|
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
1923
1923
|
</svg>
|
|
1924
1924
|
</div>
|
|
1925
|
-
`:
|
|
1925
|
+
`:B}
|
|
1926
1926
|
<div class="breadcrumbs">
|
|
1927
|
-
${this.breadcrumbs.map(((e,t)=>
|
|
1928
|
-
${t>0?
|
|
1927
|
+
${this.breadcrumbs.map(((e,t)=>q`
|
|
1928
|
+
${t>0?q`<span class="breadcrumb-separator">/</span>`:""}
|
|
1929
1929
|
<a
|
|
1930
|
-
class=${
|
|
1930
|
+
class=${xe({breadcrumb:!0,"breadcrumb--current":t===this.breadcrumbs.length-1})}
|
|
1931
1931
|
href=${e.url||""}
|
|
1932
1932
|
>${e.label}</a>
|
|
1933
1933
|
`))}
|
|
@@ -1936,7 +1936,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
1936
1936
|
<slot></slot>
|
|
1937
1937
|
</div>
|
|
1938
1938
|
|
|
1939
|
-
`}},e.KRSubbar.styles=
|
|
1939
|
+
`}},e.KRSubbar.styles=l`
|
|
1940
1940
|
:host {
|
|
1941
1941
|
display: flex;
|
|
1942
1942
|
flex-direction: row;
|
|
@@ -2001,5 +2001,5 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
|
|
|
2001
2001
|
width: 18px;
|
|
2002
2002
|
height: 18px;
|
|
2003
2003
|
}
|
|
2004
|
-
`,Se([
|
|
2004
|
+
`,Se([ue({type:Array})],e.KRSubbar.prototype,"breadcrumbs",void 0),Se([ue({type:Boolean})],e.KRSubbar.prototype,"menu",void 0),e.KRSubbar=Se([ce("kr-subbar")],e.KRSubbar)})),function(e){Object.keys(e).forEach((function(t){t.startsWith("KR")&&"function"==typeof e[t]&&(e[t.slice(2)]=e[t],delete e[t])}))}(krApp);
|
|
2005
2005
|
//# sourceMappingURL=krubble-app.umd.min.js.map
|