@m3e/nav-menu 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +23 -21
- package/dist/index.min.js.map +1 -1
- package/dist/src/NavMenuItemElement.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -3,29 +3,29 @@
|
|
|
3
3
|
* Copyright (c) 2025 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import{LitElement as
|
|
6
|
+
import{LitElement as t,html as e,unsafeCSS as s,css as i}from"lit";import{Selected as n,Disabled as o,EventAttribute as r,AttachInternals as a,Role as l,DesignToken as h,hasAssignedNodes as c,scrollIntoViewIfNeeded as d,PressedController as m,FocusController as p}from"@m3e/core";import{selectionManager as u,SelectionManager as f}from"@m3e/core/a11y";function v(t,e,s,i){var n,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,s,r):n(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r}function g(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function $(t,e,s,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,s):n?n.value=s:e.set(t,s),s}"function"==typeof SuppressedError&&SuppressedError;
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
11
|
*/
|
|
12
|
-
const b=
|
|
12
|
+
const b=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},y=globalThis,_=y.ShadowRoot&&(void 0===y.ShadyCSS||y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,A=Symbol(),w=new WeakMap;
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2019 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/let E=class{constructor(e,
|
|
17
|
+
*/let E=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==A)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(_&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=w.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&w.set(e,t))}return t}toString(){return this.cssText}};const S=_?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new E("string"==typeof t?t:t+"",void 0,A))(e)})(t):t,{is:C,defineProperty:k,getOwnPropertyDescriptor:x,getOwnPropertyNames:I,getOwnPropertySymbols:P,getPrototypeOf:M}=Object,T=globalThis,U=T.trustedTypes,O=U?U.emptyScript:"",H=T.reactiveElementPolyfillSupport,R=(t,e)=>t,L={toAttribute(t,e){switch(e){case Boolean:t=t?O:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},N=(t,e)=>!C(t,e),j={attribute:!0,type:String,converter:L,reflect:!1,useDefault:!1,hasChanged:N};
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/Symbol.metadata??=Symbol("metadata"),T.litPropertyMetadata??=new WeakMap;class W extends HTMLElement{static addInitializer(
|
|
22
|
+
*/Symbol.metadata??=Symbol("metadata"),T.litPropertyMetadata??=new WeakMap;class W extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=j){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&k(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=x(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const o=i?.call(this);n?.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??j}static _$Ei(){if(this.hasOwnProperty(R("elementProperties")))return;const t=M(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(R("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(R("properties"))){const t=this.properties,e=[...I(t),...P(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(S(t))}else void 0!==t&&e.push(S(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(_)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),i=y.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const n=(void 0!==s.converter?.toAttribute?s.converter:L).toAttribute(e,s.type);this._$Em=t,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:L;this._$Em=i;const o=n.fromAttribute(e,t.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,n=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??N)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}W.elementStyles=[],W.shadowRootOptions={mode:"open"},W[R("elementProperties")]=new Map,W[R("finalized")]=new Map,H?.({ReactiveElement:W}),(T.reactiveElementVersions??=[]).push("2.1.1");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
27
|
*/
|
|
28
|
-
const D={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:N},z=(
|
|
28
|
+
const D={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:N},z=(t=D,e,s)=>{const{kind:i,metadata:n}=s;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),o.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const n=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,n,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const n=this[i];e.call(this,s),this.requestUpdate(i,n,t)}}throw Error("Unsupported decorator location: "+i)};function B(t){return(e,s)=>"object"==typeof s?z(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
@@ -36,18 +36,18 @@ const D={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:N},z=(e=D,t,
|
|
|
36
36
|
* Copyright 2017 Google LLC
|
|
37
37
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
38
|
*/
|
|
39
|
-
function q(e
|
|
39
|
+
function q(t,e){return(e,s,i)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2017 Google LLC
|
|
43
43
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/const V=globalThis,K=V.trustedTypes,Z=K?K.createPolicy("lit-html",{createHTML:
|
|
44
|
+
*/const V=globalThis,K=V.trustedTypes,Z=K?K.createPolicy("lit-html",{createHTML:t=>t}):void 0,F="$lit$",J=`lit$${Math.random().toFixed(9).slice(2)}$`,G="?"+J,Q=`<${G}>`,X=document,Y=()=>X.createComment(""),tt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,et=Array.isArray,st="[ \t\n\f\r]",it=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nt=/-->/g,ot=/>/g,rt=RegExp(`>|${st}(?:([^\\s"'>=/]+)(${st}*=${st}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),at=/'/g,lt=/"/g,ht=/^(?:script|style|textarea|title)$/i,ct=Symbol.for("lit-noChange"),dt=Symbol.for("lit-nothing"),mt=new WeakMap,pt=X.createTreeWalker(X,129);function ut(t,e){if(!et(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Z?Z.createHTML(e):e}const ft=(t,e)=>{const s=t.length-1,i=[];let n,o=2===e?"<svg>":3===e?"<math>":"",r=it;for(let e=0;e<s;e++){const s=t[e];let a,l,h=-1,c=0;for(;c<s.length&&(r.lastIndex=c,l=r.exec(s),null!==l);)c=r.lastIndex,r===it?"!--"===l[1]?r=nt:void 0!==l[1]?r=ot:void 0!==l[2]?(ht.test(l[2])&&(n=RegExp("</"+l[2],"g")),r=rt):void 0!==l[3]&&(r=rt):r===rt?">"===l[0]?(r=n??it,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?rt:'"'===l[3]?lt:at):r===lt||r===at?r=rt:r===nt||r===ot?r=it:(r=rt,n=void 0);const d=r===rt&&t[e+1].startsWith("/>")?" ":"";o+=r===it?s+Q:h>=0?(i.push(a),s.slice(0,h)+F+s.slice(h)+J+d):s+J+(-2===h?e:d)}return[ut(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class vt{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const r=t.length-1,a=this.parts,[l,h]=ft(t,e);if(this.el=vt.createElement(l,s),pt.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=pt.nextNode())&&a.length<r;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(F)){const e=h[o++],s=i.getAttribute(t).split(J),r=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:r[2],strings:s,ctor:"."===r[1]?_t:"?"===r[1]?At:"@"===r[1]?wt:yt}),i.removeAttribute(t)}else t.startsWith(J)&&(a.push({type:6,index:n}),i.removeAttribute(t));if(ht.test(i.tagName)){const t=i.textContent.split(J),e=t.length-1;if(e>0){i.textContent=K?K.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],Y()),pt.nextNode(),a.push({type:2,index:++n});i.append(t[e],Y())}}}else if(8===i.nodeType)if(i.data===G)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf(J,t+1));)a.push({type:7,index:n}),t+=J.length-1}n++}}static createElement(t,e){const s=X.createElement("template");return s.innerHTML=t,s}}function gt(t,e,s=t,i){if(e===ct)return e;let n=void 0!==i?s._$Co?.[i]:s._$Cl;const o=tt(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=n:s._$Cl=n),void 0!==n&&(e=gt(t,n._$AS(t,e.values),n,i)),e}class $t{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){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??X).importNode(e,!0);pt.currentNode=i;let n=pt.nextNode(),o=0,r=0,a=s[0];for(;void 0!==a;){if(o===a.index){let e;2===a.type?e=new bt(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new Et(n,this,t)),this._$AV.push(e),a=s[++r]}o!==a?.index&&(n=pt.nextNode(),o++)}return pt.currentNode=X,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class bt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=dt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=gt(this,t,e),tt(t)?t===dt||null==t||""===t?(this._$AH!==dt&&this._$AR(),this._$AH=dt):t!==this._$AH&&t!==ct&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>et(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==dt&&tt(this._$AH)?this._$AA.nextSibling.data=t:this.T(X.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=vt.createElement(ut(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new $t(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=mt.get(t.strings);return void 0===e&&mt.set(t.strings,e=new vt(t)),e}k(t){et(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const n of t)i===e.length?e.push(s=new bt(this.O(Y()),this.O(Y()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class yt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=dt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=dt}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(void 0===n)t=gt(this,t,e,0),o=!tt(t)||t!==this._$AH&&t!==ct,o&&(this._$AH=t);else{const i=t;let r,a;for(t=n[0],r=0;r<n.length-1;r++)a=gt(this,i[s+r],e,r),a===ct&&(a=this._$AH[r]),o||=!tt(a)||a!==this._$AH[r],a===dt?t=dt:t!==dt&&(t+=(a??"")+n[r+1]),this._$AH[r]=a}o&&!i&&this.j(t)}j(t){t===dt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class _t extends yt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===dt?void 0:t}}class At extends yt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==dt)}}class wt extends yt{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=gt(this,t,e,0)??dt)===ct)return;const s=this._$AH,i=t===dt&&s!==dt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==dt&&(s===dt||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Et{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){gt(this,t)}}const St=V.litHtmlPolyfillSupport;St?.(vt,bt),(V.litHtmlVersions??=[]).push("3.3.1");var Ct,kt,xt,It,Pt,Mt,Tt,Ut,Ot,Ht,Rt,Lt;let Nt=Lt=class extends(n(o(r(a(l(t,"treeitem"),!0),"opening","opened","closing","closed")))){constructor(){super(...arguments),Ct.add(this),this._hasChildItems=!1,kt.set(this,[]),xt.set(this,null),It.set(this,new Array),Pt.set(this,null),this.open=!1}get link(){return g(this,Pt,"f")}get label(){return this._base??null}get visible(){return!g(this,It,"f").some(t=>!t.open)}get path(){return[...g(this,It,"f"),this]}get hasChildItems(){return this._hasChildItems}get parentItem(){return g(this,It,"f")[g(this,It,"f").length-1]??null}get childItems(){return g(this,kt,"f")}get level(){return g(this,It,"f").length+1}expand(t=!1){this.hasChildItems&&(this.open=!0,t&&this.childItems.forEach(t=>t.expand(!0)))}collapse(t=!1){this.hasChildItems&&(this.open=!1,t&&this.childItems.forEach(t=>t.collapse(!0)))}toggle(){this.hasChildItems&&(this.open=!this.open)}connectedCallback(){super.connectedCallback(),g(this,It,"f").length=0;for(let t=this.parentElement?.closest("m3e-nav-menu-item");t;t=t.parentElement?.closest("m3e-nav-menu-item"))g(this,It,"f").push(t);g(this,It,"f").reverse(),this.style.setProperty("--_nav-menu-item-level",`${this.level}`),$(this,xt,this.closest("m3e-nav-menu"),"f")}disconnectedCallback(){super.disconnectedCallback(),g(this,It,"f").length=0}update(t){if(super.update(t),t.has("selected")){this.ariaSelected=null,this.ariaCurrent=this.hasChildItems?null:`${this.selected}`;for(const t of this.querySelectorAll(":scope > m3e-icon[slot]"))t.toggleAttribute("filled",this.selected);g(this,It,"f").forEach(t=>t.selected=this.selected),this.selected&&!this.hasChildItems&&this.closest("m3e-nav-menu")?.[u].notifySelectionChange(this)}(t.has("open")||t.has("_hasChildItems"))&&(this.ariaExpanded=this._hasChildItems?`${this.open}`:null),(t.has("_hasChildItems")&&this.disabled||t.has("disabled"))&&g(this,kt,"f").forEach(t=>t.disabled=this.disabled)}firstUpdated(t){super.firstUpdated(t);const e=this._base;e&&[this.focusRing,this.stateLayer,this.ripple].forEach(t=>t?.attach(e))}render(){return e`<div class="base" @click="${g(this,Ct,"m",Ht)}">
|
|
45
45
|
<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer>
|
|
46
46
|
<m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring>
|
|
47
|
-
<m3e-ripple class="ripple"
|
|
48
|
-
<div class="icon" aria-hidden="true">${g(this,
|
|
47
|
+
<m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>
|
|
48
|
+
<div class="icon" aria-hidden="true">${g(this,Ct,"m",Mt).call(this)}</div>
|
|
49
49
|
<div class="label">
|
|
50
|
-
<slot name="label" @slotchange="${g(this,
|
|
50
|
+
<slot name="label" @slotchange="${g(this,Ct,"m",Ut)}"></slot>
|
|
51
51
|
</div>
|
|
52
52
|
<slot name="badge"></slot>
|
|
53
53
|
<div aria-hidden="true" class="toggle">
|
|
@@ -61,24 +61,26 @@ function q(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Refl
|
|
|
61
61
|
<m3e-collapsible
|
|
62
62
|
class="group"
|
|
63
63
|
role="group"
|
|
64
|
-
aria-hidden="${(
|
|
64
|
+
aria-hidden="${(t=>t??dt)(this._hasChildItems?void 0:"true")}"
|
|
65
65
|
?open="${this._hasChildItems&&this.open}"
|
|
66
|
-
@opening="${g(this,
|
|
67
|
-
@opened="${g(this,
|
|
68
|
-
@closing="${g(this,
|
|
69
|
-
@closed="${g(this,
|
|
66
|
+
@opening="${g(this,Ct,"m",Rt)}"
|
|
67
|
+
@opened="${g(this,Ct,"m",Rt)}"
|
|
68
|
+
@closing="${g(this,Ct,"m",Rt)}"
|
|
69
|
+
@closed="${g(this,Ct,"m",Rt)}"
|
|
70
70
|
>
|
|
71
|
-
<slot @slotchange="${g(this,
|
|
72
|
-
</m3e-collapsible>`}};var
|
|
71
|
+
<slot @slotchange="${g(this,Ct,"m",Ot)}"></slot>
|
|
72
|
+
</m3e-collapsible>`}};var jt,Wt,Dt,zt,Bt,qt,Vt,Kt,Zt,Ft,Jt,Gt,Qt,Xt,Yt;kt=new WeakMap,xt=new WeakMap,It=new WeakMap,Pt=new WeakMap,Ct=new WeakSet,Mt=function(){const t=e`<slot name="icon" @slotchange="${g(this,Ct,"m",Tt)}"></slot>`;return this.selected&&!this.hasChildItems?e`<slot name="selected-icon" @slotchange="${g(this,Ct,"m",Tt)}">${t}</slot>`:t},Tt=function(t){this.classList.toggle("-with-icon",c(t.target))},Ut=function(t){$(this,Pt,t.target.assignedElements({flatten:!0}).find(t=>t instanceof HTMLAnchorElement)??null,"f"),g(this,Pt,"f")?.setAttribute("tabindex","-1")},Ot=function(t){$(this,kt,t.target.assignedElements({flatten:!0}).filter(t=>t instanceof Lt),"f");const e=this._hasChildItems;this._hasChildItems=g(this,kt,"f").length>0,this.classList.toggle("-has-items",this._hasChildItems),(e||this._hasChildItems)&&(this.selected=g(this,kt,"f").some(t=>t.selected))},Ht=function(){if(!this.disabled)if(g(this,xt,"f")?.[u].setActiveItem(this),this._hasChildItems)this.toggle();else{g(this,xt,"f")?.[u].select(this),g(this,It,"f").forEach(t=>t.selected=this.selected),g(this,Pt,"f")?.click();const t=this.closest("m3e-drawer-container");if(t){const e=this.closest("[slot='start']")??this.closest("[slot='end')");e&&(t.classList.contains(`-${e.slot}-push`)||t.classList.contains(`-${e.slot}-over`))&&setTimeout(()=>t.removeAttribute(e.slot),300)}}},Rt=function(t){t.stopPropagation(),this.dispatchEvent(new Event(t.type,{bubbles:!0}))},Nt.styles=i`
|
|
73
73
|
:host {
|
|
74
74
|
display: block;
|
|
75
75
|
flex: none;
|
|
76
76
|
outline: none;
|
|
77
|
+
user-select: none;
|
|
77
78
|
position: relative;
|
|
78
79
|
font-size: var(--m3e-nav-menu-item-font-size, ${h.typescale.standard.label.large.fontSize});
|
|
79
80
|
font-weight: var(--m3e-nav-menu-item-font-weight, ${h.typescale.standard.label.large.fontWeight});
|
|
80
81
|
line-height: var(--m3e-nav-menu-item-line-height, ${h.typescale.standard.label.large.lineHeight});
|
|
81
82
|
letter-spacing: var(--m3e-nav-menu-item-tracking, ${h.typescale.standard.label.large.tracking});
|
|
83
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
82
84
|
}
|
|
83
85
|
.base {
|
|
84
86
|
display: flex;
|
|
@@ -243,12 +245,12 @@ function q(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Refl
|
|
|
243
245
|
color: ButtonText;
|
|
244
246
|
}
|
|
245
247
|
}
|
|
246
|
-
`,v([q(".state-layer")],
|
|
248
|
+
`,v([q(".state-layer")],Nt.prototype,"stateLayer",void 0),v([q(".focus-ring")],Nt.prototype,"focusRing",void 0),v([q(".ripple")],Nt.prototype,"ripple",void 0),v([q(".base")],Nt.prototype,"_base",void 0),v([function(t){return B({...t,state:!0,attribute:!1})}
|
|
247
249
|
/**
|
|
248
250
|
* @license
|
|
249
251
|
* Copyright 2017 Google LLC
|
|
250
252
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
251
|
-
*/()],
|
|
253
|
+
*/()],Nt.prototype,"_hasChildItems",void 0),v([B({type:Boolean,reflect:!0})],Nt.prototype,"open",void 0),Nt=Lt=v([b("m3e-nav-menu-item")],Nt);let te=Yt=class extends(l(t,"tree")){constructor(){super(),jt.add(this),Wt.set(this,!1),Dt.set(this,!1),this[Xt]=(new f).withVerticalOrientation().withHomeAndEnd().withTypeahead().withSkipPredicate(t=>t.disabled||!t.visible).disableRovingTabIndex().onActiveItemChange(()=>{this[u].activeItem&&g(this,jt,"m",Jt).call(this,this[u].activeItem)}).onSelectedItemsChange(()=>{const t=this.selected;for(const e of this.items)e!==t&&g(this,jt,"m",Qt).call(this,e,!1,!1);t?.label&&d(t.label,this,{block:"start",behavior:"smooth"})}),zt.set(this,t=>g(this,jt,"m",Kt).call(this,t)),Bt.set(this,t=>g(this,jt,"m",Zt).call(this,t)),qt.set(this,t=>g(this,jt,"m",Ft).call(this,t)),new m(this,{callback:t=>$(this,Dt,t,"f")}),new p(this,{callback:()=>{g(this,Dt,"f")||g(this,jt,"m",Gt).call(this)}})}get selected(){return this[u].selectedItems[0]??null}get items(){return this[u].items}expand(t){(t??this[u].items).forEach(t=>t.expand())}collapse(t){(t??this[u].items).forEach(t=>t.collapse());const e=this[u].activeItem;if(e&&!e.visible)for(let t=e.parentItem;t;t=t.parentItem)if(t.visible){this[u].setActiveItem(t);break}}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.addEventListener("keydown",g(this,zt,"f")),this.addEventListener("keyup",g(this,Bt,"f")),this.addEventListener("pointerdown",g(this,qt,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",g(this,zt,"f")),this.removeEventListener("keyup",g(this,Bt,"f")),this.removeEventListener("pointerdown",g(this,qt,"f"))}render(){return e`<slot @slotchange="${g(this,jt,"m",Vt)}"></slot>`}};var ee,se,ie,ne,oe;Wt=new WeakMap,Dt=new WeakMap,zt=new WeakMap,Bt=new WeakMap,qt=new WeakMap,jt=new WeakSet,Xt=u,Vt=function(){for(const t of this.querySelectorAll("m3e-divider"))t.ariaHidden="true";const{added:t}=this[u].setItems([...this.querySelectorAll("m3e-nav-menu-item")]);for(const e of t)e.id=e.id||"m3e-nav-menu-item-"+Yt.__nextId++;this[u].activeItem?(this.setAttribute("aria-activedescendant",this[u].activeItem.id),g(this,jt,"m",Gt).call(this)):this.removeAttribute("aria-activedescendant")},Kt=function(t){$(this,Wt,!1,"f"),g(this,jt,"m",Gt).call(this);const e=this[u].activeItem;if(!t.defaultPrevented&&e&&!e.disabled)switch(t.key){case"Enter":case" ":t.preventDefault()," "===t.key&&e.ripple&&!e.ripple.visible&&e.ripple.show(0,0,!0),e.hasChildItems?e.toggle():e.selected||(this[u].select(e),e.link?.click());break;case"*":t.preventDefault(),e.expand(!0);break;case"Left":case"ArrowLeft":if(t.preventDefault(),e.hasChildItems&&e.open)e.collapse();else{const t=e.parentItem;t&&(t.collapse(),this[u].setActiveItem(t))}break;case"Right":case"ArrowRight":if(e.hasChildItems)if(e.open)try{this[u].vertical=!1,this[u].onKeyDown(t)}finally{this[u].vertical=!0}else t.preventDefault(),e.expand();else t.preventDefault();break;default:this[u].onKeyDown(t)}},Zt=function(t){const e=this[u].activeItem;t.defaultPrevented||!e||e.disabled||" "!==t.key||e.ripple?.hide()},Ft=function(t){if(!t.defaultPrevented&&!g(this,Wt,"f")){$(this,Wt,!0,"f");const e=t.composedPath().reverse().find(t=>t instanceof Nt);e&&!e.disabled&&g(this,jt,"m",Qt).call(this,e,!0,!1)}},Jt=function(t){this.setAttribute("aria-activedescendant",t.id),t.label&&d(t.label,this,{block:"nearest",behavior:"smooth"}),g(this,jt,"m",Gt).call(this)},Gt=function(){const t=this.matches(":focus")||this.matches(":focus-within"),e=!g(this,Wt,"f")&&this.matches(":focus-visible");this[u].items.forEach(s=>{const i=s===this[u].activeItem;g(this,jt,"m",Qt).call(this,s,i&&t,i&&e)})},Qt=function(t,e,s){e&&s?t.stateLayer?.show("focused"):t.stateLayer?.hide("focused"),s?t.focusRing?.show():t.focusRing?.hide()},te.styles=i`
|
|
252
254
|
:host {
|
|
253
255
|
display: flex;
|
|
254
256
|
flex-direction: column;
|
|
@@ -268,7 +270,7 @@ function q(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Refl
|
|
|
268
270
|
margin-block: var(--m3e-nav-menu-divider-margin, 0.25rem);
|
|
269
271
|
flex: none;
|
|
270
272
|
}
|
|
271
|
-
`,
|
|
273
|
+
`,te.__nextId=0,te=Yt=v([b("m3e-nav-menu")],te);let re=oe=class extends(l(t,"group")){constructor(){super(...arguments),ee.add(this),se.set(this,"m3e-nav-menu-item-group-label-"+oe.__nextId++),ie.set(this,void 0)}connectedCallback(){super.connectedCallback(),this.classList.toggle("-divided","M3E-DIVIDER"===this.previousElementSibling?.tagName)}disconnectedCallback(){super.disconnectedCallback(),this.classList.remove("-divided")}render(){return e`<slot name="label" @slotchange="${g(this,ee,"m",ne)}"></slot><slot></slot>`}};se=new WeakMap,ie=new WeakMap,ee=new WeakSet,ne=function(t){const e=t.target.assignedElements({flatten:!0})[0];e!==g(this,ie,"f")&&(g(this,ie,"f")?.id===g(this,se,"f")&&(g(this,ie,"f").id=""),$(this,ie,e,"f"),g(this,ie,"f")?(g(this,ie,"f").role="none",g(this,ie,"f").id=g(this,ie,"f").id||g(this,se,"f"),this.setAttribute("aria-labelledby",g(this,ie,"f").id)):this.removeAttribute("aria-labelledby"))},re.styles=i`
|
|
272
274
|
:host {
|
|
273
275
|
display: contents;
|
|
274
276
|
}
|
|
@@ -285,5 +287,5 @@ function q(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Refl
|
|
|
285
287
|
:host(:not(.-divided)) ::slotted([slot="label"]) {
|
|
286
288
|
margin-block-start: var(--m3e-nav-menu-item-group-label-space, 1rem);
|
|
287
289
|
}
|
|
288
|
-
`,
|
|
290
|
+
`,re.__nextId=0,re=oe=v([b("m3e-nav-menu-item-group")],re);export{te as M3eNavMenuElement,Nt as M3eNavMenuItemElement,re as M3eNavMenuItemGroupElement};
|
|
289
291
|
//# sourceMappingURL=index.min.js.map
|