@nuralyui/menu 0.0.17 → 0.0.18
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/bundle.js +6 -448
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1,469 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;class s{constructor(t,e,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=n.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(i,t))}return t}toString(){return this.cssText}}const r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,i))(e)})(t):t
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2017 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/;var o;const l=window,a=l.trustedTypes,u=a?a.emptyScript:"",h=l.reactiveElementPolyfillSupport,d={toAttribute(t,e){switch(e){case Boolean:t=t?u:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},c=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:c},m="finalized";class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=v){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const s=this[t];this[e]=n,this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(m))return!1;this[m]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var i;const n=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,n)=>{e?i.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement("style"),s=t.litNonce;void 0!==s&&n.setAttribute("nonce",s),n.textContent=e.cssText,i.appendChild(n)}))})(n,this.constructor.elementStyles),n}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=v){var n;const s=this.constructor._$Ep(t,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:d).toAttribute(e,i.type);this._$El=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,s=n._$Ev.get(t);if(void 0!==s&&this._$El!==s){const t=n.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:d;this._$El=s,this[s]=r.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||c)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
|
|
12
|
-
/**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2017 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/
|
|
17
|
-
var p;b[m]=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:b}),(null!==(o=l.reactiveElementVersions)&&void 0!==o?o:l.reactiveElementVersions=[]).push("1.6.3");const f=window,g=f.trustedTypes,y=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",k=`lit$${(Math.random()+"").slice(9)}$`,$="?"+k,x=`<${$}>`,S=document,A=()=>S.createComment(""),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,_="[ \t\n\f\r]",C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,D=/>/g,j=RegExp(`>|${_}(?:([^\\s"'>=/]+)(${_}*=${_}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),O=/'/g,R=/"/g,U=/^(?:script|style|textarea|title)$/i,N=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),P=new WeakMap,H=S.createTreeWalker(S,129,null,!1);function I(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==y?y.createHTML(e):e}class L{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,r=0;const o=t.length-1,l=this.parts,[a,u]=((t,e)=>{const i=t.length-1,n=[];let s,r=2===e?"<svg>":"",o=C;for(let e=0;e<i;e++){const i=t[e];let l,a,u=-1,h=0;for(;h<i.length&&(o.lastIndex=h,a=o.exec(i),null!==a);)h=o.lastIndex,o===C?"!--"===a[1]?o=T:void 0!==a[1]?o=D:void 0!==a[2]?(U.test(a[2])&&(s=RegExp("</"+a[2],"g")),o=j):void 0!==a[3]&&(o=j):o===j?">"===a[0]?(o=null!=s?s:C,u=-1):void 0===a[1]?u=-2:(u=o.lastIndex-a[2].length,l=a[1],o=void 0===a[3]?j:'"'===a[3]?R:O):o===R||o===O?o=j:o===T||o===D?o=C:(o=j,s=void 0);const d=o===j&&t[e+1].startsWith("/>")?" ":"";r+=o===C?i+x:u>=0?(n.push(l),i.slice(0,u)+w+i.slice(u)+k+d):i+k+(-2===u?(n.push(void 0),e):d)}return[I(t,r+(t[i]||"<?>")+(2===e?"</svg>":"")),n]})(t,e);if(this.el=L.createElement(a,i),H.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=H.nextNode())&&l.length<o;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(w)||e.startsWith(k)){const i=u[r++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+w).split(k),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?W:"?"===e[1]?B:"@"===e[1]?J:V})}else l.push({type:6,index:s})}for(const e of t)n.removeAttribute(e)}if(U.test(n.tagName)){const t=n.textContent.split(k),e=t.length-1;if(e>0){n.textContent=g?g.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],A()),H.nextNode(),l.push({type:2,index:++s});n.append(t[e],A())}}}else if(8===n.nodeType)if(n.data===$)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(k,t+1));)l.push({type:7,index:s}),t+=k.length-1}s++}}static createElement(t,e){const i=S.createElement("template");return i.innerHTML=t,i}}function K(t,e,i=t,n){var s,r,o,l;if(e===N)return e;let a=void 0!==n?null===(s=i._$Co)||void 0===s?void 0:s[n]:i._$Cl;const u=E(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==u&&(null===(r=null==a?void 0:a._$AO)||void 0===r||r.call(a,!1),void 0===u?a=void 0:(a=new u(t),a._$AT(t,i,n)),void 0!==n?(null!==(o=(l=i)._$Co)&&void 0!==o?o:l._$Co=[])[n]=a:i._$Cl=a),void 0!==a&&(e=K(t,a._$AS(t,e.values),a,n)),e}class F{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:n}=this._$AD,s=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:S).importNode(i,!0);H.currentNode=s;let r=H.nextNode(),o=0,l=0,a=n[0];for(;void 0!==a;){if(o===a.index){let e;2===a.type?e=new q(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new G(r,this,t)),this._$AV.push(e),a=n[++l]}o!==(null==a?void 0:a.index)&&(r=H.nextNode(),o++)}return H.currentNode=S,s}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class q{constructor(t,e,i,n){var s;this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cp=null===(s=null==n?void 0:n.isConnected)||void 0===s||s}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=K(this,t,e),E(t)?t===z||null==t||""===t?(this._$AH!==z&&this._$AR(),this._$AH=z):t!==this._$AH&&t!==N&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>M(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==z&&E(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=L.createElement(I(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===s)this._$AH.v(i);else{const t=new F(s,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=P.get(t.strings);return void 0===e&&P.set(t.strings,e=new L(t)),e}T(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new q(this.k(A()),this.k(A()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class V{constructor(t,e,i,n,s){this.type=1,this._$AH=z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=z}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const s=this.strings;let r=!1;if(void 0===s)t=K(this,t,e,0),r=!E(t)||t!==this._$AH&&t!==N,r&&(this._$AH=t);else{const n=t;let o,l;for(t=s[0],o=0;o<s.length-1;o++)l=K(this,n[i+o],e,o),l===N&&(l=this._$AH[o]),r||(r=!E(l)||l!==this._$AH[o]),l===z?t=z:t!==z&&(t+=(null!=l?l:"")+s[o+1]),this._$AH[o]=l}r&&!n&&this.j(t)}j(t){t===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class W extends V{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===z?void 0:t}}const Z=g?g.emptyScript:"";class B extends V{constructor(){super(...arguments),this.type=4}j(t){t&&t!==z?this.element.setAttribute(this.name,Z):this.element.removeAttribute(this.name)}}class J extends V{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=K(this,t,e,0))&&void 0!==i?i:z)===N)return;const n=this._$AH,s=t===z&&n!==z||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==z&&(n===z||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class G{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){K(this,t)}}const Q=f.litHtmlPolyfillSupport;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2017 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/
|
|
23
|
-
var X;null==Q||Q(L,q),(null!==(p=f.litHtmlVersions)&&void 0!==p?p:f.litHtmlVersions=[]).push("2.8.0");const Y=window,tt=Y.trustedTypes,et=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,it="$lit$",nt=`lit$${(Math.random()+"").slice(9)}$`,st="?"+nt,rt=`<${st}>`,ot=document,lt=()=>ot.createComment(""),at=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ut=Array.isArray,ht="[ \t\n\f\r]",dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ct=/-->/g,vt=/>/g,mt=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),bt=/'/g,pt=/"/g,ft=/^(?:script|style|textarea|title)$/i,gt=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),yt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),kt=new WeakMap,$t=ot.createTreeWalker(ot,129,null,!1);function xt(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==et?et.createHTML(e):e}const St=(t,e)=>{const i=t.length-1,n=[];let s,r=2===e?"<svg>":"",o=dt;for(let e=0;e<i;e++){const i=t[e];let l,a,u=-1,h=0;for(;h<i.length&&(o.lastIndex=h,a=o.exec(i),null!==a);)h=o.lastIndex,o===dt?"!--"===a[1]?o=ct:void 0!==a[1]?o=vt:void 0!==a[2]?(ft.test(a[2])&&(s=RegExp("</"+a[2],"g")),o=mt):void 0!==a[3]&&(o=mt):o===mt?">"===a[0]?(o=null!=s?s:dt,u=-1):void 0===a[1]?u=-2:(u=o.lastIndex-a[2].length,l=a[1],o=void 0===a[3]?mt:'"'===a[3]?pt:bt):o===pt||o===bt?o=mt:o===ct||o===vt?o=dt:(o=mt,s=void 0);const d=o===mt&&t[e+1].startsWith("/>")?" ":"";r+=o===dt?i+rt:u>=0?(n.push(l),i.slice(0,u)+it+i.slice(u)+nt+d):i+nt+(-2===u?(n.push(void 0),e):d)}return[xt(t,r+(t[i]||"<?>")+(2===e?"</svg>":"")),n]};class At{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,r=0;const o=t.length-1,l=this.parts,[a,u]=St(t,e);if(this.el=At.createElement(a,i),$t.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=$t.nextNode())&&l.length<o;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(it)||e.startsWith(nt)){const i=u[r++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+it).split(nt),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?Tt:"?"===e[1]?jt:"@"===e[1]?Ot:Ct})}else l.push({type:6,index:s})}for(const e of t)n.removeAttribute(e)}if(ft.test(n.tagName)){const t=n.textContent.split(nt),e=t.length-1;if(e>0){n.textContent=tt?tt.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],lt()),$t.nextNode(),l.push({type:2,index:++s});n.append(t[e],lt())}}}else if(8===n.nodeType)if(n.data===st)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(nt,t+1));)l.push({type:7,index:s}),t+=nt.length-1}s++}}static createElement(t,e){const i=ot.createElement("template");return i.innerHTML=t,i}}function Et(t,e,i=t,n){var s,r,o,l;if(e===yt)return e;let a=void 0!==n?null===(s=i._$Co)||void 0===s?void 0:s[n]:i._$Cl;const u=at(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==u&&(null===(r=null==a?void 0:a._$AO)||void 0===r||r.call(a,!1),void 0===u?a=void 0:(a=new u(t),a._$AT(t,i,n)),void 0!==n?(null!==(o=(l=i)._$Co)&&void 0!==o?o:l._$Co=[])[n]=a:i._$Cl=a),void 0!==a&&(e=Et(t,a._$AS(t,e.values),a,n)),e}class Mt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:n}=this._$AD,s=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:ot).importNode(i,!0);$t.currentNode=s;let r=$t.nextNode(),o=0,l=0,a=n[0];for(;void 0!==a;){if(o===a.index){let e;2===a.type?e=new _t(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new Rt(r,this,t)),this._$AV.push(e),a=n[++l]}o!==(null==a?void 0:a.index)&&(r=$t.nextNode(),o++)}return $t.currentNode=ot,s}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class _t{constructor(t,e,i,n){var s;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cp=null===(s=null==n?void 0:n.isConnected)||void 0===s||s}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Et(this,t,e),at(t)?t===wt||null==t||""===t?(this._$AH!==wt&&this._$AR(),this._$AH=wt):t!==this._$AH&&t!==yt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>ut(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==wt&&at(this._$AH)?this._$AA.nextSibling.data=t:this.$(ot.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=At.createElement(xt(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===s)this._$AH.v(i);else{const t=new Mt(s,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=kt.get(t.strings);return void 0===e&&kt.set(t.strings,e=new At(t)),e}T(t){ut(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new _t(this.k(lt()),this.k(lt()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class Ct{constructor(t,e,i,n,s){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const s=this.strings;let r=!1;if(void 0===s)t=Et(this,t,e,0),r=!at(t)||t!==this._$AH&&t!==yt,r&&(this._$AH=t);else{const n=t;let o,l;for(t=s[0],o=0;o<s.length-1;o++)l=Et(this,n[i+o],e,o),l===yt&&(l=this._$AH[o]),r||(r=!at(l)||l!==this._$AH[o]),l===wt?t=wt:t!==wt&&(t+=(null!=l?l:"")+s[o+1]),this._$AH[o]=l}r&&!n&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Tt extends Ct{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Dt=tt?tt.emptyScript:"";class jt extends Ct{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Dt):this.element.removeAttribute(this.name)}}class Ot extends Ct{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Et(this,t,e,0))&&void 0!==i?i:wt)===yt)return;const n=this._$AH,s=t===wt&&n!==wt||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==wt&&(n===wt||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Rt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}}const Ut=Y.litHtmlPolyfillSupport;null==Ut||Ut(At,_t),(null!==(X=Y.litHtmlVersions)&&void 0!==X?X:Y.litHtmlVersions=[]).push("2.8.0");
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2017 Google LLC
|
|
27
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
-
*/
|
|
29
|
-
var Nt,zt;class Pt extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var n,s;const r=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let o=r._$litPart$;if(void 0===o){const t=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:null;r._$litPart$=o=new _t(e.insertBefore(lt(),t),t,void 0,null!=i?i:{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return yt}}Pt.finalized=!0,Pt._$litElement$=!0,null===(Nt=globalThis.litElementHydrateSupport)||void 0===Nt||Nt.call(globalThis,{LitElement:Pt});const Ht=globalThis.litElementPolyfillSupport;null==Ht||Ht({LitElement:Pt}),(null!==(zt=globalThis.litElementVersions)&&void 0!==zt?zt:globalThis.litElementVersions=[]).push("3.3.3");
|
|
30
|
-
/**
|
|
31
|
-
* @license
|
|
32
|
-
* Copyright 2017 Google LLC
|
|
33
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/
|
|
35
|
-
const It=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
|
|
36
|
-
/**
|
|
37
|
-
* @license
|
|
38
|
-
* Copyright 2017 Google LLC
|
|
39
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/function Lt(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):It(t,e)
|
|
41
|
-
/**
|
|
42
|
-
* @license
|
|
43
|
-
* Copyright 2021 Google LLC
|
|
44
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
-
*/}var Kt;null===(Kt=window.HTMLSlotElement)||void 0===Kt||Kt.prototype.assignedElements;const Ft=((t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new s(n,t,i)})`
|
|
46
|
-
/* Root menu container */
|
|
47
|
-
:host {
|
|
48
|
-
display: block;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.menu-root {
|
|
52
|
-
font-size: var(--nuraly-menu-font-size);
|
|
53
|
-
font-family: var(--nuraly-menu-font-family);
|
|
54
|
-
font-weight: var(--nuraly-menu-font-weight);
|
|
55
|
-
line-height: var(--nuraly-menu-line-height);
|
|
56
|
-
list-style: none;
|
|
57
|
-
margin: 0;
|
|
58
|
-
padding: 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/* Menu Link Styles */
|
|
62
|
-
.menu-link {
|
|
63
|
-
list-style: none;
|
|
64
|
-
display: flex;
|
|
65
|
-
align-items: center;
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
padding: var(--nuraly-menu-link-padding-vertical) var(--nuraly-menu-link-padding-horizontal);
|
|
68
|
-
color: var(--nuraly-menu-link-color);
|
|
69
|
-
background-color: var(--nuraly-menu-link-background-color);
|
|
70
|
-
border-left: 4px solid transparent;
|
|
71
|
-
border-top: 2px solid transparent;
|
|
72
|
-
border-right: 2px solid transparent;
|
|
73
|
-
border-bottom: 2px solid transparent;
|
|
74
|
-
border-radius: var(--nuraly-menu-border-radius);
|
|
75
|
-
transition: background-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),
|
|
76
|
-
color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),
|
|
77
|
-
border-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.menu-link.disabled {
|
|
81
|
-
color: var(--nuraly-menu-disabled-link-color);
|
|
82
|
-
cursor: not-allowed;
|
|
83
|
-
opacity: 0.6;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.menu-link:not(.disabled):not(.selected):hover {
|
|
87
|
-
background-color: var(--nuraly-menu-hover-link-background-color);
|
|
88
|
-
color: var(--nuraly-menu-hover-link-color);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.menu-link.selected {
|
|
92
|
-
background-color: var(--nuraly-menu-selected-link-background-color);
|
|
93
|
-
color: var(--nuraly-menu-selected-color);
|
|
94
|
-
border-left: var(--nuraly-menu-selected-link-border);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.menu-link:not(.disabled):not(.selected):focus {
|
|
98
|
-
outline: none;
|
|
99
|
-
border-left: 4px solid transparent;
|
|
100
|
-
border-top: var(--nuraly-menu-focus-border);
|
|
101
|
-
border-right: var(--nuraly-menu-focus-border);
|
|
102
|
-
border-bottom: var(--nuraly-menu-focus-border);
|
|
103
|
-
color: var(--nuraly-menu-focus-color);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.menu-link.selected:not(.disabled):focus {
|
|
107
|
-
outline: none;
|
|
108
|
-
border-left: var(--nuraly-menu-selected-link-border);
|
|
109
|
-
border-top: var(--nuraly-menu-focus-border);
|
|
110
|
-
border-right: var(--nuraly-menu-focus-border);
|
|
111
|
-
border-bottom: var(--nuraly-menu-focus-border);
|
|
112
|
-
color: var(--nuraly-menu-focus-color);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/* Focus-visible for keyboard navigation */
|
|
116
|
-
.menu-link:not(.disabled):focus-visible {
|
|
117
|
-
outline: none;
|
|
118
|
-
border-top: var(--nuraly-menu-focus-border);
|
|
119
|
-
border-right: var(--nuraly-menu-focus-border);
|
|
120
|
-
border-bottom: var(--nuraly-menu-focus-border);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.menu-link:not(.disabled):not(.selected):focus-visible {
|
|
124
|
-
border-left: var(--nuraly-menu-focus-border);
|
|
125
|
-
color: var(--nuraly-menu-focus-color);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.menu-link.selected:not(.disabled):focus-visible {
|
|
129
|
-
border-left: var(--nuraly-menu-selected-link-border) !important;
|
|
130
|
-
color: var(--nuraly-menu-focus-color);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.menu-link:not(.disabled):not(.selected):active {
|
|
134
|
-
color: var(--nuraly-menu-active-color);
|
|
135
|
-
background-color: var(--nuraly-menu-active-background-color);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.menu-link.selected:not(.disabled):active {
|
|
139
|
-
background-color: var(--nuraly-menu-active-background-color);
|
|
140
|
-
color: var(--nuraly-menu-active-color);
|
|
141
|
-
border-left: var(--nuraly-menu-selected-link-border) !important;
|
|
142
|
-
border-top: 2px solid transparent;
|
|
143
|
-
border-right: 2px solid transparent;
|
|
144
|
-
border-bottom: 2px solid transparent;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.menu-link .action-text-container {
|
|
148
|
-
width: 100%;
|
|
149
|
-
display: flex;
|
|
150
|
-
justify-content: space-between;
|
|
151
|
-
align-items: center;
|
|
152
|
-
position: relative;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.menu-link .text-container {
|
|
156
|
-
flex: 1;
|
|
157
|
-
min-width: 0;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.menu-link nr-icon {
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
--nuraly-icon-color: var(--nuraly-menu-link-icon-color);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.menu-link nr-icon:first-child {
|
|
167
|
-
padding-right: var(--nuraly-menu-icon-padding-right);
|
|
168
|
-
padding-left: var(--nuraly-menu-icon-padding-left);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/* Sub Menu Styles */
|
|
172
|
-
.sub-menu {
|
|
173
|
-
display: flex;
|
|
174
|
-
flex-direction: column;
|
|
175
|
-
padding-left: 0;
|
|
176
|
-
list-style: none;
|
|
177
|
-
color: var(--nuraly-sub-menu-color);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.sub-menu.disabled .sub-menu-header {
|
|
181
|
-
color: var(--nuraly-sub-menu-disabled-color);
|
|
182
|
-
cursor: not-allowed;
|
|
183
|
-
opacity: 0.6;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.sub-menu.highlighted .sub-menu-header {
|
|
187
|
-
background-color: var(--nuraly-sub-menu-highlighted-background-color);
|
|
188
|
-
color: var(--nuraly-sub-menu-highlighted-color);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.sub-menu .sub-menu-header {
|
|
192
|
-
display: flex;
|
|
193
|
-
justify-content: space-between;
|
|
194
|
-
align-items: center;
|
|
195
|
-
cursor: pointer;
|
|
196
|
-
padding: var(--nuraly-sub-menu-padding-vertical) var(--nuraly-sub-menu-padding-horizontal);
|
|
197
|
-
border-left: 4px solid transparent;
|
|
198
|
-
border-top: 2px solid transparent;
|
|
199
|
-
border-right: 2px solid transparent;
|
|
200
|
-
border-bottom: 2px solid transparent;
|
|
201
|
-
border-radius: var(--nuraly-menu-border-radius);
|
|
202
|
-
transition: background-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),
|
|
203
|
-
color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),
|
|
204
|
-
border-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.sub-menu .sub-menu-header span {
|
|
208
|
-
flex: 1;
|
|
209
|
-
min-width: 0;
|
|
210
|
-
padding-left: var(--nuraly-sub-menu-icon-padding-right);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.sub-menu .text-icon {
|
|
214
|
-
flex-shrink: 0;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.sub-menu .icons-container {
|
|
218
|
-
display: flex;
|
|
219
|
-
align-items: center;
|
|
220
|
-
gap: var(--nuraly-sub-menu-icon-padding-right);
|
|
221
|
-
position: relative;
|
|
222
|
-
flex-shrink: 0;
|
|
223
|
-
/* Reserve space for dropdown to prevent layout shift */
|
|
224
|
-
min-width: fit-content;
|
|
225
|
-
/* Fixed height to prevent vertical shifting */
|
|
226
|
-
height: 100%;
|
|
227
|
-
min-height: 24px;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.menu-link .icon-container {
|
|
231
|
-
display: flex;
|
|
232
|
-
align-items: center;
|
|
233
|
-
position: relative;
|
|
234
|
-
flex-shrink: 0;
|
|
235
|
-
/* Fixed height to prevent vertical shifting */
|
|
236
|
-
height: 100%;
|
|
237
|
-
min-height: 24px;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.sub-menu nr-dropdown,
|
|
241
|
-
.menu-link nr-dropdown {
|
|
242
|
-
/* Keep in normal flow but ensure it doesn't grow/shrink */
|
|
243
|
-
display: inline-flex;
|
|
244
|
-
flex-shrink: 0;
|
|
245
|
-
flex-grow: 0;
|
|
246
|
-
align-items: center;
|
|
247
|
-
vertical-align: middle;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.sub-menu .action-icon,
|
|
251
|
-
.menu-link .action-icon {
|
|
252
|
-
flex-shrink: 0;
|
|
253
|
-
cursor: pointer;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.sub-menu .action-icon {
|
|
257
|
-
--nuraly-icon-color: var(--nuraly-sub-menu-action-icon-color);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.sub-menu .status-icon {
|
|
261
|
-
--nuraly-icon-color: var(--nuraly-sub-menu-status-icon-color);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.sub-menu .text-icon {
|
|
265
|
-
--nuraly-icon-color: var(--nuraly-sub-menu-text-icon-color);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.sub-menu #toggle-icon {
|
|
269
|
-
--nuraly-icon-color: var(--nuraly-sub-menu-toggle-icon-color);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.sub-menu:not(.disabled):not(.selected) .sub-menu-header:focus {
|
|
273
|
-
outline: none;
|
|
274
|
-
border-left: 4px solid transparent;
|
|
275
|
-
border-top: var(--nuraly-sub-menu-focus-border);
|
|
276
|
-
border-right: var(--nuraly-sub-menu-focus-border);
|
|
277
|
-
border-bottom: var(--nuraly-sub-menu-focus-border);
|
|
278
|
-
color: var(--nuraly-sub-menu-focus-color);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.sub-menu.selected:not(.disabled) .sub-menu-header:focus {
|
|
282
|
-
outline: none;
|
|
283
|
-
border-left: var(--nuraly-menu-selected-link-border);
|
|
284
|
-
border-top: var(--nuraly-sub-menu-focus-border);
|
|
285
|
-
border-right: var(--nuraly-sub-menu-focus-border);
|
|
286
|
-
border-bottom: var(--nuraly-sub-menu-focus-border);
|
|
287
|
-
color: var(--nuraly-sub-menu-focus-color);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/* Focus-visible for keyboard navigation on submenus */
|
|
291
|
-
.sub-menu:not(.disabled) .sub-menu-header:focus-visible {
|
|
292
|
-
outline: none;
|
|
293
|
-
border-top: var(--nuraly-sub-menu-focus-border);
|
|
294
|
-
border-right: var(--nuraly-sub-menu-focus-border);
|
|
295
|
-
border-bottom: var(--nuraly-sub-menu-focus-border);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.sub-menu:not(.disabled):not(.selected) .sub-menu-header:focus-visible {
|
|
299
|
-
border-left: var(--nuraly-sub-menu-focus-border);
|
|
300
|
-
color: var(--nuraly-sub-menu-focus-color);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.sub-menu.selected:not(.disabled) .sub-menu-header:focus-visible {
|
|
304
|
-
border-left: var(--nuraly-menu-selected-link-border) !important;
|
|
305
|
-
color: var(--nuraly-sub-menu-focus-color);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.sub-menu:not(.disabled) .sub-menu-header:hover {
|
|
309
|
-
background-color: var(--nuraly-sub-menu-hover-background-color);
|
|
310
|
-
color: var(--nuraly-sub-menu-hover-color);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.sub-menu.selected:not(.disabled) .sub-menu-header {
|
|
314
|
-
background-color: var(--nuraly-menu-selected-link-background-color);
|
|
315
|
-
color: var(--nuraly-menu-selected-color);
|
|
316
|
-
border-left: var(--nuraly-menu-selected-link-border);
|
|
317
|
-
border-top: 2px solid transparent;
|
|
318
|
-
border-right: 2px solid transparent;
|
|
319
|
-
border-bottom: 2px solid transparent;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.sub-menu.selected:not(.disabled) .sub-menu-header:active {
|
|
323
|
-
background-color: var(--nuraly-sub-menu-active-background-color);
|
|
324
|
-
color: var(--nuraly-sub-menu-active-color);
|
|
325
|
-
border-left: var(--nuraly-menu-selected-link-border);
|
|
326
|
-
border-top: 2px solid transparent;
|
|
327
|
-
border-right: 2px solid transparent;
|
|
328
|
-
border-bottom: 2px solid transparent;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.sub-menu:not(.disabled):not(.selected) .sub-menu-header:active {
|
|
332
|
-
background-color: var(--nuraly-sub-menu-active-background-color);
|
|
333
|
-
color: var(--nuraly-sub-menu-active-color);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.sub-menu-children {
|
|
337
|
-
padding-left: var(--nuraly-sub-menu-nested-padding-left);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/* Size Variants */
|
|
341
|
-
.menu--small .menu-link {
|
|
342
|
-
padding: var(--nuraly-menu-link-padding-vertical-small) var(--nuraly-menu-link-padding-horizontal-small);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.menu--small .sub-menu .sub-menu-header {
|
|
346
|
-
padding: var(--nuraly-sub-menu-padding-vertical-small) var(--nuraly-sub-menu-padding-horizontal-small);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.menu--medium .menu-link {
|
|
350
|
-
padding: var(--nuraly-menu-link-padding-vertical-medium) var(--nuraly-menu-link-padding-horizontal-medium);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.menu--medium .sub-menu .sub-menu-header {
|
|
354
|
-
padding: var(--nuraly-sub-menu-padding-vertical-medium) var(--nuraly-sub-menu-padding-horizontal-medium);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.menu--large .menu-link {
|
|
358
|
-
padding: var(--nuraly-menu-link-padding-vertical-large) var(--nuraly-menu-link-padding-horizontal-large);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
.menu--large .sub-menu .sub-menu-header {
|
|
362
|
-
padding: var(--nuraly-sub-menu-padding-vertical-large) var(--nuraly-sub-menu-padding-horizontal-large);
|
|
363
|
-
}
|
|
364
|
-
`,qt=[Ft],Vt=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(e=this.designSystemObserver)||void 0===e||e.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,e;const i=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return i||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const e=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===e?e:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver((()=>{this.requestUpdate()})),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver((()=>{this.requestUpdate()})),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},Wt=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},Zt=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Wt())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!Wt())return!0;let e=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){e=!1;const n=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,n):console.error(n.message)}return e}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter((t=>!this.isComponentAvailable(t)))}areDependenciesAvailable(){return this.requiredComponents.every((t=>this.isComponentAvailable(t)))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const e=this.requiredComponents.indexOf(t);e>-1&&this.requiredComponents.splice(e,1)}},Bt=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var i;const n=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,n)}dispatchInputEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,originalEvent:e.originalEvent},e);this.dispatchCustomEvent(t,i)}dispatchFocusEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,focused:e.focused,cursorPosition:e.cursorPosition,selectedText:e.selectedText},e);this.dispatchCustomEvent(t,i)}dispatchValidationEvent(t,e){var i;const n=Object.assign({target:e.target||this,value:e.value,isValid:null!==(i=e.isValid)&&void 0!==i&&i,error:e.error},e);this.dispatchCustomEvent(t,n)}dispatchActionEvent(t,e){const i=Object.assign({target:e.target||this,action:e.action,previousValue:e.previousValue,newValue:e.newValue},e);this.dispatchCustomEvent(t,i)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}};
|
|
1
|
+
import{css as e,LitElement as n,html as t,nothing as r}from"lit";import{property as i,customElement as o}from"lit/decorators.js";import{NuralyUIBaseMixin as s}from"@nuralyui/common/mixins";const a=[e`:host{display:block}.menu-root{font-size:var(--nuraly-menu-font-size);font-family:var(--nuraly-menu-font-family);font-weight:var(--nuraly-menu-font-weight);line-height:var(--nuraly-menu-line-height);list-style:none;margin:0;padding:0}.menu-link{list-style:none;display:flex;align-items:center;cursor:pointer;padding:var(--nuraly-menu-link-padding-vertical) var(--nuraly-menu-link-padding-horizontal);color:var(--nuraly-menu-link-color);background-color:var(--nuraly-menu-link-background-color);border-left:4px solid transparent;border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent;border-radius:var(--nuraly-menu-border-radius);transition:background-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),border-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing)}.menu-link.disabled{color:var(--nuraly-menu-disabled-link-color);cursor:not-allowed;opacity:.6}.menu-link:not(.disabled):not(.selected):hover{background-color:var(--nuraly-menu-hover-link-background-color);color:var(--nuraly-menu-hover-link-color)}.menu-link.selected{background-color:var(--nuraly-menu-selected-link-background-color);color:var(--nuraly-menu-selected-color);border-left:var(--nuraly-menu-selected-link-border)}.menu-link:not(.disabled):not(.selected):focus{outline:0;border-left:4px solid transparent;border-top:var(--nuraly-menu-focus-border);border-right:var(--nuraly-menu-focus-border);border-bottom:var(--nuraly-menu-focus-border);color:var(--nuraly-menu-focus-color)}.menu-link.selected:not(.disabled):focus{outline:0;border-left:var(--nuraly-menu-selected-link-border);border-top:var(--nuraly-menu-focus-border);border-right:var(--nuraly-menu-focus-border);border-bottom:var(--nuraly-menu-focus-border);color:var(--nuraly-menu-focus-color)}.menu-link:not(.disabled):focus-visible{outline:0;border-top:var(--nuraly-menu-focus-border);border-right:var(--nuraly-menu-focus-border);border-bottom:var(--nuraly-menu-focus-border)}.menu-link:not(.disabled):not(.selected):focus-visible{border-left:var(--nuraly-menu-focus-border);color:var(--nuraly-menu-focus-color)}.menu-link.selected:not(.disabled):focus-visible{border-left:var(--nuraly-menu-selected-link-border)!important;color:var(--nuraly-menu-focus-color)}.menu-link:not(.disabled):not(.selected):active{color:var(--nuraly-menu-active-color);background-color:var(--nuraly-menu-active-background-color)}.menu-link.selected:not(.disabled):active{background-color:var(--nuraly-menu-active-background-color);color:var(--nuraly-menu-active-color);border-left:var(--nuraly-menu-selected-link-border)!important;border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent}.menu-link .action-text-container{width:100%;display:flex;justify-content:space-between;align-items:center;position:relative}.menu-link .text-container{flex:1;min-width:0}.menu-link nr-icon{display:flex;align-items:center;--nuraly-icon-color:var(--nuraly-menu-link-icon-color)}.menu-link nr-icon:first-child{padding-right:var(--nuraly-menu-icon-padding-right);padding-left:var(--nuraly-menu-icon-padding-left)}.sub-menu{display:flex;flex-direction:column;padding-left:0;list-style:none;color:var(--nuraly-sub-menu-color)}.sub-menu.disabled .sub-menu-header{color:var(--nuraly-sub-menu-disabled-color);cursor:not-allowed;opacity:.6}.sub-menu.highlighted .sub-menu-header{background-color:var(--nuraly-sub-menu-highlighted-background-color);color:var(--nuraly-sub-menu-highlighted-color)}.sub-menu .sub-menu-header{display:flex;justify-content:space-between;align-items:center;cursor:pointer;padding:var(--nuraly-sub-menu-padding-vertical) var(--nuraly-sub-menu-padding-horizontal);border-left:4px solid transparent;border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent;border-radius:var(--nuraly-menu-border-radius);transition:background-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing),border-color var(--nuraly-menu-transition-duration) var(--nuraly-menu-transition-timing)}.sub-menu .sub-menu-header span{flex:1;min-width:0;padding-left:var(--nuraly-sub-menu-icon-padding-right)}.sub-menu .text-icon{flex-shrink:0}.sub-menu .icons-container{display:flex;align-items:center;gap:var(--nuraly-sub-menu-icon-padding-right);position:relative;flex-shrink:0;min-width:fit-content;height:100%;min-height:24px}.menu-link .icon-container{display:flex;align-items:center;position:relative;flex-shrink:0;height:100%;min-height:24px}.menu-link nr-dropdown,.sub-menu nr-dropdown{display:inline-flex;flex-shrink:0;flex-grow:0;align-items:center;vertical-align:middle}.menu-link .action-icon,.sub-menu .action-icon{flex-shrink:0;cursor:pointer}.sub-menu .action-icon{--nuraly-icon-color:var(--nuraly-sub-menu-action-icon-color)}.sub-menu .status-icon{--nuraly-icon-color:var(--nuraly-sub-menu-status-icon-color)}.sub-menu .text-icon{--nuraly-icon-color:var(--nuraly-sub-menu-text-icon-color)}.sub-menu #toggle-icon{--nuraly-icon-color:var(--nuraly-sub-menu-toggle-icon-color)}.sub-menu:not(.disabled):not(.selected) .sub-menu-header:focus{outline:0;border-left:4px solid transparent;border-top:var(--nuraly-sub-menu-focus-border);border-right:var(--nuraly-sub-menu-focus-border);border-bottom:var(--nuraly-sub-menu-focus-border);color:var(--nuraly-sub-menu-focus-color)}.sub-menu.selected:not(.disabled) .sub-menu-header:focus{outline:0;border-left:var(--nuraly-menu-selected-link-border);border-top:var(--nuraly-sub-menu-focus-border);border-right:var(--nuraly-sub-menu-focus-border);border-bottom:var(--nuraly-sub-menu-focus-border);color:var(--nuraly-sub-menu-focus-color)}.sub-menu:not(.disabled) .sub-menu-header:focus-visible{outline:0;border-top:var(--nuraly-sub-menu-focus-border);border-right:var(--nuraly-sub-menu-focus-border);border-bottom:var(--nuraly-sub-menu-focus-border)}.sub-menu:not(.disabled):not(.selected) .sub-menu-header:focus-visible{border-left:var(--nuraly-sub-menu-focus-border);color:var(--nuraly-sub-menu-focus-color)}.sub-menu.selected:not(.disabled) .sub-menu-header:focus-visible{border-left:var(--nuraly-menu-selected-link-border)!important;color:var(--nuraly-sub-menu-focus-color)}.sub-menu:not(.disabled) .sub-menu-header:hover{background-color:var(--nuraly-sub-menu-hover-background-color);color:var(--nuraly-sub-menu-hover-color)}.sub-menu.selected:not(.disabled) .sub-menu-header{background-color:var(--nuraly-menu-selected-link-background-color);color:var(--nuraly-menu-selected-color);border-left:var(--nuraly-menu-selected-link-border);border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent}.sub-menu.selected:not(.disabled) .sub-menu-header:active{background-color:var(--nuraly-sub-menu-active-background-color);color:var(--nuraly-sub-menu-active-color);border-left:var(--nuraly-menu-selected-link-border);border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent}.sub-menu:not(.disabled):not(.selected) .sub-menu-header:active{background-color:var(--nuraly-sub-menu-active-background-color);color:var(--nuraly-sub-menu-active-color)}.sub-menu-children{padding-left:var(--nuraly-sub-menu-nested-padding-left)}.menu--small .menu-link{padding:var(--nuraly-menu-link-padding-vertical-small) var(--nuraly-menu-link-padding-horizontal-small)}.menu--small .sub-menu .sub-menu-header{padding:var(--nuraly-sub-menu-padding-vertical-small) var(--nuraly-sub-menu-padding-horizontal-small)}.menu--medium .menu-link{padding:var(--nuraly-menu-link-padding-vertical-medium) var(--nuraly-menu-link-padding-horizontal-medium)}.menu--medium .sub-menu .sub-menu-header{padding:var(--nuraly-sub-menu-padding-vertical-medium) var(--nuraly-sub-menu-padding-horizontal-medium)}.menu--large .menu-link{padding:var(--nuraly-menu-link-padding-vertical-large) var(--nuraly-menu-link-padding-horizontal-large)}.menu--large .sub-menu .sub-menu-header{padding:var(--nuraly-sub-menu-padding-vertical-large) var(--nuraly-sub-menu-padding-horizontal-large)}`];
|
|
365
2
|
/**
|
|
366
3
|
* @license
|
|
367
4
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
368
5
|
* SPDX-License-Identifier: MIT
|
|
369
6
|
*/
|
|
370
|
-
class
|
|
7
|
+
class u{constructor(e){this.host=e,e.addController(this)}hostConnected(){}hostDisconnected(){}dispatchEvent(e,n,t={}){try{const r=new CustomEvent(e,Object.assign({detail:n,bubbles:!0,composed:!0,cancelable:!0},t));return this.host.dispatchEvent(r)}catch(e){return this.handleError(e,"dispatchEvent"),!1}}handleError(e,n){console.error(`[MenuController:${n}]`,e),this.dispatchEvent("menu-controller-error",{context:n,error:e.message,stack:e.stack,timestamp:Date.now()})}requestUpdate(){this.host.requestUpdate()}isDisabled(){return!1}getElementByPath(e){var n;return(null===(n=this.host.shadowRoot)||void 0===n?void 0:n.querySelector(`[data-path="${e}"]`))||null}getAllMenuLinks(){var e;return Array.from((null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".menu-link, .sub-menu"))||[])}isElementInteractive(e){if(!e)return!1;const n=e.classList.contains("disabled"),t=null!==e.offsetParent;return!n&&t}}
|
|
371
8
|
/**
|
|
372
9
|
* @license
|
|
373
10
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
374
11
|
* SPDX-License-Identifier: MIT
|
|
375
|
-
*/class
|
|
12
|
+
*/class l extends u{constructor(){super(...arguments),this._selectedPath=[],this._openSubMenus=new Set,this._hoveredSubMenus=new Set,this._highlightedSubMenus=new Set}get selectedPath(){return this._selectedPath}set selectedPath(e){this._selectedPath=e}get openSubMenus(){return this._openSubMenus}get hoveredSubMenus(){return this._hoveredSubMenus}get highlightedSubMenus(){return this._highlightedSubMenus}setSelectedPath(e){try{this._selectedPath=e,this.clearHighlights(),this.requestUpdate(),this.dispatchEvent("selection-changed",{path:e,timestamp:Date.now()})}catch(e){this.handleError(e,"setSelectedPath")}}toggleSubMenu(e){try{const n=e.join("-");this._openSubMenus.has(n)?this.closeSubMenu(e):this.openSubMenu(e)}catch(e){this.handleError(e,"toggleSubMenu")}}openSubMenu(e){try{const n=e.join("-");this._openSubMenus.has(n)||(this._openSubMenus.add(n),this.requestUpdate(),this.dispatchEvent("submenu-opened",{path:e,pathKey:n,timestamp:Date.now()}))}catch(e){this.handleError(e,"openSubMenu")}}closeSubMenu(e){try{const n=e.join("-");this._openSubMenus.has(n)&&(this._openSubMenus.delete(n),this.requestUpdate(),this.dispatchEvent("submenu-closed",{path:e,pathKey:n,timestamp:Date.now()}))}catch(e){this.handleError(e,"closeSubMenu")}}closeAllSubMenus(){try{this._openSubMenus.clear(),this.requestUpdate(),this.dispatchEvent("all-submenus-closed",{timestamp:Date.now()})}catch(e){this.handleError(e,"closeAllSubMenus")}}setHovered(e,n){try{const t=e.join("-");n?this._hoveredSubMenus.add(t):this._hoveredSubMenus.delete(t),this.requestUpdate()}catch(e){this.handleError(e,"setHovered")}}setHighlighted(e,n){try{const t=e.join("-");n?this._highlightedSubMenus.add(t):this._highlightedSubMenus.delete(t),this.requestUpdate()}catch(e){this.handleError(e,"setHighlighted")}}clearHighlights(){try{this._highlightedSubMenus.clear(),this.requestUpdate()}catch(e){this.handleError(e,"clearHighlights")}}isPathSelected(e){return e.length===this._selectedPath.length&&e.every(((e,n)=>e===this._selectedPath[n]))}isSubMenuOpen(e){const n=e.join("-");return this._openSubMenus.has(n)}isSubMenuHovered(e){const n=e.join("-");return this._hoveredSubMenus.has(n)}isSubMenuHighlighted(e){const n=e.join("-");return this._highlightedSubMenus.has(n)}reset(){try{this._selectedPath=[],this._openSubMenus.clear(),this._hoveredSubMenus.clear(),this._highlightedSubMenus.clear(),this.requestUpdate(),this.dispatchEvent("state-reset",{timestamp:Date.now()})}catch(e){this.handleError(e,"reset")}}}
|
|
376
13
|
/**
|
|
377
14
|
* @license
|
|
378
15
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
379
16
|
* SPDX-License-Identifier: MIT
|
|
380
|
-
*/class
|
|
17
|
+
*/class d extends u{constructor(e,n){super(e),this.typeAheadBuffer="",this.typeAheadTimeout=null,this.currentFocusIndex=-1,this.stateController=n}hostConnected(){this.host.addEventListener("keydown",this.handleKeydown.bind(this))}hostDisconnected(){this.host.removeEventListener("keydown",this.handleKeydown.bind(this)),this.typeAheadTimeout&&clearTimeout(this.typeAheadTimeout)}handleKeydown(e){try{const n=e.key;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n))return void this.handleArrowNavigation(e);if("Enter"===n||" "===n)return void this.handleActivation(e);if("Escape"===n)return void this.handleEscape(e);if("Home"===n||"End"===n)return void this.handleHomeEnd(e);if(1===n.length&&!e.ctrlKey&&!e.metaKey&&!e.altKey)return void this.handleTypeAhead(e)}catch(e){this.handleError(e,"handleKeydown")}}handleArrowNavigation(e){var n;try{e.preventDefault();const t=this.getAllMenuLinks(),r=null===(n=this.host.shadowRoot)||void 0===n?void 0:n.activeElement,i=t.indexOf(r);switch(e.key){case"ArrowDown":this.navigateDown(t,i);break;case"ArrowUp":this.navigateUp(t,i);break;case"ArrowRight":this.expandOrNavigate(r);break;case"ArrowLeft":this.collapseOrNavigate(r)}this.dispatchEvent("keyboard-navigation",{key:e.key,currentIndex:i,timestamp:Date.now()})}catch(e){this.handleError(e,"handleArrowNavigation")}}navigateDown(e,n){let t=n+1;for(;t<e.length;){const n=e[t];if(this.isElementInteractive(n))return n.focus(),void(this.currentFocusIndex=t);t++}if(n>=0)for(let n=0;n<e.length;n++)if(this.isElementInteractive(e[n]))return e[n].focus(),void(this.currentFocusIndex=n)}navigateUp(e,n){let t=n-1;for(;t>=0;){const n=e[t];if(this.isElementInteractive(n))return n.focus(),void(this.currentFocusIndex=t);t--}if(n>=0)for(let n=e.length-1;n>=0;n--)if(this.isElementInteractive(e[n]))return e[n].focus(),void(this.currentFocusIndex=n)}expandOrNavigate(e){if(e&&e.classList.contains("sub-menu")){const n=e.getAttribute("data-path");if(n){const e=n.split("-").map(Number);this.stateController.openSubMenu(e)}}}collapseOrNavigate(e){if(e&&e.classList.contains("sub-menu")){const n=e.getAttribute("data-path");if(n){const e=n.split("-").map(Number);this.stateController.closeSubMenu(e)}}}handleActivation(e){var n;try{e.preventDefault();const t=null===(n=this.host.shadowRoot)||void 0===n?void 0:n.activeElement;if(!t||!this.isElementInteractive(t))return;t.click(),this.dispatchEvent("keyboard-activation",{key:e.key,element:t,timestamp:Date.now()})}catch(e){this.handleError(e,"handleActivation")}}handleEscape(e){try{e.preventDefault(),this.stateController.closeAllSubMenus(),this.dispatchEvent("keyboard-escape",{timestamp:Date.now()})}catch(e){this.handleError(e,"handleEscape")}}handleHomeEnd(e){try{e.preventDefault();const n=this.getAllMenuLinks(),t=n.filter((e=>this.isElementInteractive(e)));if(0===t.length)return;if("Home"===e.key)t[0].focus(),this.currentFocusIndex=n.indexOf(t[0]);else{const e=t[t.length-1];e.focus(),this.currentFocusIndex=n.indexOf(e)}this.dispatchEvent("keyboard-home-end",{key:e.key,timestamp:Date.now()})}catch(e){this.handleError(e,"handleHomeEnd")}}handleTypeAhead(e){try{e.preventDefault(),this.typeAheadTimeout&&clearTimeout(this.typeAheadTimeout),this.typeAheadBuffer+=e.key.toLowerCase(),this.typeAheadTimeout=window.setTimeout((()=>{this.typeAheadBuffer="",this.typeAheadTimeout=null}),500);const n=this.getAllMenuLinks(),t=this.currentFocusIndex>=0?this.currentFocusIndex:-1;for(let e=t+1;e<n.length;e++)if(this.matchesTypeAhead(n[e]))return n[e].focus(),void(this.currentFocusIndex=e);for(let e=0;e<=t;e++)if(this.matchesTypeAhead(n[e]))return n[e].focus(),void(this.currentFocusIndex=e);this.dispatchEvent("keyboard-typeahead",{buffer:this.typeAheadBuffer,timestamp:Date.now()})}catch(e){this.handleError(e,"handleTypeAhead")}}matchesTypeAhead(e){var n;if(!this.isElementInteractive(e))return!1;return((null===(n=e.textContent)||void 0===n?void 0:n.trim().toLowerCase())||"").startsWith(this.typeAheadBuffer)}resetTypeAhead(){this.typeAheadBuffer="",this.typeAheadTimeout&&(clearTimeout(this.typeAheadTimeout),this.typeAheadTimeout=null)}}
|
|
381
18
|
/**
|
|
382
19
|
* @license
|
|
383
20
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
384
21
|
* SPDX-License-Identifier: MIT
|
|
385
|
-
*/class
|
|
22
|
+
*/class c extends u{constructor(e,n){super(e),this.announcementElement=null,this.stateController=n}hostConnected(){this.createAnnouncementElement(),this.updateAriaAttributes()}hostDisconnected(){this.removeAnnouncementElement()}createAnnouncementElement(){this.announcementElement||(this.announcementElement=document.createElement("div"),this.announcementElement.setAttribute("role","status"),this.announcementElement.setAttribute("aria-live","polite"),this.announcementElement.setAttribute("aria-atomic","true"),this.announcementElement.style.position="absolute",this.announcementElement.style.left="-10000px",this.announcementElement.style.width="1px",this.announcementElement.style.height="1px",this.announcementElement.style.overflow="hidden",document.body.appendChild(this.announcementElement))}removeAnnouncementElement(){this.announcementElement&&this.announcementElement.parentNode&&(this.announcementElement.parentNode.removeChild(this.announcementElement),this.announcementElement=null)}updateAriaAttributes(){try{this.updateMenuRoot(),this.updateAllMenuItems(),this.updateAllSubMenus()}catch(e){this.handleError(e,"updateAriaAttributes")}}updateMenuRoot(){var e;const n=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector(".menu-root");n&&(n.setAttribute("role","menu"),n.setAttribute("aria-label","Main menu"))}updateAllMenuItems(){var e;const n=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".menu-link");null==n||n.forEach((e=>{e.setAttribute("role","menuitem"),e.setAttribute("tabindex","0");const n=e.getAttribute("data-path");if(n){const t=n.split("-").map(Number),r=this.stateController.isPathSelected(t);this.setAriaSelected(e,r)}e.classList.contains("disabled")&&e.setAttribute("aria-disabled","true")}))}updateAllSubMenus(){var e;const n=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".sub-menu");null==n||n.forEach((e=>{e.setAttribute("role","menuitem"),e.setAttribute("tabindex","0");const n=e.getAttribute("data-path");if(n){const t=n.split("-").map(Number),r=this.stateController.isSubMenuOpen(t),i=e.querySelector(".sub-menu-header");i&&(i.setAttribute("aria-haspopup","true"),this.setAriaExpanded(i,r))}e.classList.contains("disabled")&&e.setAttribute("aria-disabled","true")}))}setAriaExpanded(e,n){try{e.setAttribute("aria-expanded",n.toString())}catch(e){this.handleError(e,"setAriaExpanded")}}setAriaSelected(e,n){try{n?(e.setAttribute("aria-selected","true"),e.setAttribute("aria-current","page")):(e.removeAttribute("aria-selected"),e.removeAttribute("aria-current"))}catch(e){this.handleError(e,"setAriaSelected")}}manageFocus(e){try{this.isElementInteractive(e)&&(e.focus(),e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}))}catch(e){this.handleError(e,"manageFocus")}}announceToScreenReader(e){try{this.announcementElement&&(this.announcementElement.textContent="",setTimeout((()=>{this.announcementElement&&(this.announcementElement.textContent=e)}),100))}catch(e){this.handleError(e,"announceToScreenReader")}}announceSelection(e,n){const t=`Selected ${e}, level ${n.length}`;this.announceToScreenReader(t)}announceSubMenuToggle(e,n){const t=`${e} submenu ${n?"expanded":"collapsed"}`;this.announceToScreenReader(t)}focusFirstItem(){const e=this.getAllMenuLinks().find((e=>this.isElementInteractive(e)));e&&this.manageFocus(e)}focusLastItem(){const e=this.getAllMenuLinks().filter((e=>this.isElementInteractive(e))),n=e[e.length-1];n&&this.manageFocus(n)}}
|
|
386
23
|
/**
|
|
387
24
|
* @license
|
|
388
25
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
389
26
|
* SPDX-License-Identifier: MIT
|
|
390
|
-
*/var
|
|
391
|
-
<li
|
|
392
|
-
class="menu-link ${r?"selected":""} ${t.disabled?"disabled":""}"
|
|
393
|
-
data-path=${s}
|
|
394
|
-
data-index=${o}
|
|
395
|
-
tabindex="0"
|
|
396
|
-
@mousedown=${t.disabled?wt:i=>this._handleLinkClick(e,t.text,i)}
|
|
397
|
-
@click=${t.disabled?wt:i=>this._handleLinkClick(e,t.text,i)}>
|
|
398
|
-
<div class="icon-container">
|
|
399
|
-
${t.icon?gt`
|
|
400
|
-
${t.text?gt`<nr-icon name="${t.icon}"></nr-icon>`:gt`<div class="icon-only"><nr-icon name="${t.icon}"></nr-icon></div>`}
|
|
401
|
-
`:wt}
|
|
402
|
-
</div>
|
|
403
|
-
${t.text?gt`
|
|
404
|
-
<div class="action-text-container">
|
|
405
|
-
<div class="text-container">
|
|
406
|
-
<span>${t.text}</span>
|
|
407
|
-
</div>
|
|
408
|
-
<div class="icon-container">
|
|
409
|
-
${(null===(i=t.status)||void 0===i?void 0:i.icon)?gt`
|
|
410
|
-
<nr-icon name=${t.status.icon} class="status-icon"></nr-icon>
|
|
411
|
-
`:wt}
|
|
412
|
-
${(null===(n=t.menu)||void 0===n?void 0:n.actions)?gt`
|
|
413
|
-
<nr-dropdown
|
|
414
|
-
.items=${this._convertActionsToDropdownItems(t.menu.actions)}
|
|
415
|
-
trigger="click"
|
|
416
|
-
placement="bottom-end"
|
|
417
|
-
@nr-dropdown-item-click=${t=>this._handleActionClick(e,t)}>
|
|
418
|
-
<nr-icon name="${t.menu.icon}" class="action-icon" slot="trigger"></nr-icon>
|
|
419
|
-
</nr-dropdown>
|
|
420
|
-
`:wt}
|
|
421
|
-
</div>
|
|
422
|
-
</div>
|
|
423
|
-
`:wt}
|
|
424
|
-
</li>
|
|
425
|
-
`}_renderSubMenu(t,e){var i,n;const s=e.join("-"),r=this.stateController.isSubMenuOpen(e)||t.opened,o=this.stateController.isSubMenuHovered(e),l=this.stateController.isSubMenuHighlighted(e),a=t.selected;return gt`
|
|
426
|
-
<ul
|
|
427
|
-
class="sub-menu ${l?"highlighted":""} ${t.disabled?"disabled":""} ${a?"selected":""}"
|
|
428
|
-
data-path=${s}
|
|
429
|
-
tabindex="0"
|
|
430
|
-
@mouseenter=${()=>this._handleSubMenuMouseEnter(e)}
|
|
431
|
-
@mouseleave=${()=>this._handleSubMenuMouseLeave(e)}
|
|
432
|
-
@click=${t.disabled?wt:t=>{const i=t;t.target.classList.contains("sub-menu")&&0===i.detail&&(t.stopPropagation(),this.stateController.toggleSubMenu(e),this.requestUpdate())}}>
|
|
433
|
-
<div
|
|
434
|
-
class="sub-menu-header"
|
|
435
|
-
@mousedown=${t.disabled?wt:i=>this._handleSubMenuClick(e,t.text,i)}
|
|
436
|
-
@click=${t.disabled?wt:i=>this._handleSubMenuClick(e,t.text,i)}>
|
|
437
|
-
${t.icon?gt`<nr-icon class="text-icon" name="${t.icon}"></nr-icon>`:wt}
|
|
438
|
-
<span>${t.text}</span>
|
|
439
|
-
<div class="icons-container">
|
|
440
|
-
${(null===(i=t.status)||void 0===i?void 0:i.icon)?gt`
|
|
441
|
-
<nr-icon name=${t.status.icon} class="status-icon"></nr-icon>
|
|
442
|
-
`:wt}
|
|
443
|
-
${(l||o)&&(null===(n=t.menu)||void 0===n?void 0:n.actions)?gt`
|
|
444
|
-
<nr-dropdown
|
|
445
|
-
.items=${this._convertActionsToDropdownItems(t.menu.actions)}
|
|
446
|
-
trigger="click"
|
|
447
|
-
placement="bottom-end"
|
|
448
|
-
@nr-dropdown-item-click=${t=>this._handleActionClick(e,t)}>
|
|
449
|
-
<nr-icon name="${t.menu.icon}" class="action-icon" slot="trigger"></nr-icon>
|
|
450
|
-
</nr-dropdown>
|
|
451
|
-
`:wt}
|
|
452
|
-
${t.children&&t.children.length?gt`
|
|
453
|
-
<nr-icon
|
|
454
|
-
id="toggle-icon"
|
|
455
|
-
name="${r?"angle-up":"angle-down"}"
|
|
456
|
-
@mousedown=${t.disabled?wt:t=>this._toggleSubMenu(e,t)}>
|
|
457
|
-
</nr-icon>
|
|
458
|
-
`:wt}
|
|
459
|
-
</div>
|
|
460
|
-
</div>
|
|
461
|
-
<div class="sub-menu-children" style="display: ${r?"block":"none"}">
|
|
462
|
-
${t.children?this._renderMenuItems(t.children,e):wt}
|
|
463
|
-
</div>
|
|
464
|
-
</ul>
|
|
465
|
-
`}_renderMenuItems(t,e=[]){return t.map(((t,i)=>{const n=[...e,i];return t.children?this._renderSubMenu(t,n):this._renderMenuLink(t,n)}))}render(){return this._linkIndex=0,gt`
|
|
466
|
-
<ul class="menu-root menu--${this.size}">
|
|
467
|
-
${this._renderMenuItems(this.items)}
|
|
468
|
-
</ul>
|
|
469
|
-
`}};te.styles=qt,Yt([Lt({type:Array})],te.prototype,"items",void 0),Yt([Lt({type:String})],te.prototype,"size",void 0),te=Yt([(t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e))("nr-menu")],te);export{te as NrMenuElement};
|
|
27
|
+
*/var h=function(e,n,t,r){for(var i,o=arguments.length,s=o<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,t):r,a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(n,t,s):i(n,t))||s);return o>3&&s&&Object.defineProperty(n,t,s),s};let m=class extends(s(n)){constructor(){super(),this.requiredComponents=["nr-icon","nr-dropdown"],this.items=[],this.size="medium",this._linkIndex=0,this.stateController=new l(this),this.keyboardController=new d(this,this.stateController),this.accessibilityController=new c(this,this.stateController)}firstUpdated(){this._initializeSelectedState(),this.accessibilityController.updateAriaAttributes()}updated(){this.accessibilityController.updateAriaAttributes()}_initializeSelectedState(){this._linkIndex=0,this._findSelectedPath(this.items)}_findSelectedPath(e,n=[]){for(let t=0;t<e.length;t++){const r=e[t],i=[...n,t];if(r.children){if(this._findSelectedPath(r.children,i))return!0}else if(r.selected)return this.stateController.setSelectedPath(i),!0}return!1}_handleLinkClick(e,n,t){var r;if(!(null===(r=null==t?void 0:t.target)||void 0===r?void 0:r.classList.contains("action-icon"))){if("click"===(null==t?void 0:t.type)){if(t.detail>0)return}this.stateController.setSelectedPath(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:e,value:n}})),this.requestUpdate()}}_handleSubMenuClick(e,n,t){const r=t,i=t.target;if("toggle-icon"!==i.id&&!i.closest("#toggle-icon")){if("click"===t.type)return 0===r.detail?(this.stateController.toggleSubMenu(e),void this.requestUpdate()):void 0;this.stateController.setSelectedPath([]),this.stateController.clearHighlights(),this.stateController.setHighlighted(e,!0),this.stateController.toggleSubMenu(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:e,value:n}})),this.requestUpdate()}}_toggleSubMenu(e,n){n.stopPropagation(),this.stateController.toggleSubMenu(e),this.requestUpdate()}_handleSubMenuMouseEnter(e){this.stateController.setHovered(e,!0),this.requestUpdate()}_handleSubMenuMouseLeave(e){this.stateController.setHovered(e,!1),this.requestUpdate()}_handleActionClick(e,n){const t=n.detail.item;this.dispatchEvent(new CustomEvent("action-click",{detail:{value:t.value,path:e,item:t},composed:!0,bubbles:!0}))}_isPathSelected(e){return this.stateController.isPathSelected(e)}_convertActionsToDropdownItems(e){return e.map((e=>({id:e.value,label:e.label,value:e.value})))}_renderMenuLink(e,n){var i,o;const s=n.join("-"),a=this._isPathSelected(n),u=this._linkIndex++;return t`<li class="menu-link ${a?"selected":""} ${e.disabled?"disabled":""}" data-path="${s}" data-index="${u}" tabindex="0" @mousedown="${e.disabled?r:t=>this._handleLinkClick(n,e.text,t)}" @click="${e.disabled?r:t=>this._handleLinkClick(n,e.text,t)}"><div class="icon-container">${e.icon?t`${e.text?t`<nr-icon name="${e.icon}"></nr-icon>`:t`<div class="icon-only"><nr-icon name="${e.icon}"></nr-icon></div>`}`:r}</div>${e.text?t`<div class="action-text-container"><div class="text-container"><span>${e.text}</span></div><div class="icon-container">${(null===(i=e.status)||void 0===i?void 0:i.icon)?t`<nr-icon name="${e.status.icon}" class="status-icon"></nr-icon>`:r} ${(null===(o=e.menu)||void 0===o?void 0:o.actions)?t`<nr-dropdown .items="${this._convertActionsToDropdownItems(e.menu.actions)}" trigger="click" placement="bottom-end" @nr-dropdown-item-click="${e=>this._handleActionClick(n,e)}"><nr-icon name="${e.menu.icon}" class="action-icon" slot="trigger"></nr-icon></nr-dropdown>`:r}</div></div>`:r}</li>`}_renderSubMenu(e,n){var i,o;const s=n.join("-"),a=this.stateController.isSubMenuOpen(n)||e.opened,u=this.stateController.isSubMenuHovered(n),l=this.stateController.isSubMenuHighlighted(n),d=e.selected;return t`<ul class="sub-menu ${l?"highlighted":""} ${e.disabled?"disabled":""} ${d?"selected":""}" data-path="${s}" tabindex="0" @mouseenter="${()=>this._handleSubMenuMouseEnter(n)}" @mouseleave="${()=>this._handleSubMenuMouseLeave(n)}" @click="${e.disabled?r:e=>{const t=e;e.target.classList.contains("sub-menu")&&0===t.detail&&(e.stopPropagation(),this.stateController.toggleSubMenu(n),this.requestUpdate())}}"><div class="sub-menu-header" @mousedown="${e.disabled?r:t=>this._handleSubMenuClick(n,e.text,t)}" @click="${e.disabled?r:t=>this._handleSubMenuClick(n,e.text,t)}">${e.icon?t`<nr-icon class="text-icon" name="${e.icon}"></nr-icon>`:r} <span>${e.text}</span><div class="icons-container">${(null===(i=e.status)||void 0===i?void 0:i.icon)?t`<nr-icon name="${e.status.icon}" class="status-icon"></nr-icon>`:r} ${(l||u)&&(null===(o=e.menu)||void 0===o?void 0:o.actions)?t`<nr-dropdown .items="${this._convertActionsToDropdownItems(e.menu.actions)}" trigger="click" placement="bottom-end" @nr-dropdown-item-click="${e=>this._handleActionClick(n,e)}"><nr-icon name="${e.menu.icon}" class="action-icon" slot="trigger"></nr-icon></nr-dropdown>`:r} ${e.children&&e.children.length?t`<nr-icon id="toggle-icon" name="${a?"angle-up":"angle-down"}" @mousedown="${e.disabled?r:e=>this._toggleSubMenu(n,e)}"></nr-icon>`:r}</div></div><div class="sub-menu-children" style="display:${a?"block":"none"}">${e.children?this._renderMenuItems(e.children,n):r}</div></ul>`}_renderMenuItems(e,n=[]){return e.map(((e,t)=>{const r=[...n,t];return e.children?this._renderSubMenu(e,r):this._renderMenuLink(e,r)}))}render(){return this._linkIndex=0,t`<ul class="menu-root menu--${this.size}">${this._renderMenuItems(this.items)}</ul>`}};m.styles=a,h([i({type:Array})],m.prototype,"items",void 0),h([i({type:String})],m.prototype,"size",void 0),m=h([o("nr-menu")],m);export{m as NrMenuElement};
|