@nuralyui/collapse 0.0.10 → 0.0.12

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.
Files changed (2) hide show
  1. package/bundle.js +34 -100
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,54 +1,10 @@
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(),s=new WeakMap;class o{constructor(t,e,s){if(this._$cssResult$=!0,s!==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=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}}const n=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new o("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 r;const l=window,a=l.trustedTypes,c=a?a.emptyScript:"",h=l.reactiveElementPolyfillSupport,d={toAttribute(t,e){switch(e){case Boolean:t=t?c: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}},u=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:u},p="finalized";class f 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 s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),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,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const o=this[t];this[e]=s,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(p))return!1;this[p]=!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(n(t))}else void 0!==t&&e.push(n(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 s=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{e?i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((e=>{const s=document.createElement("style"),o=t.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=e.cssText,i.appendChild(s)}))})(s,this.constructor.elementStyles),s}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 s;const o=this.constructor._$Ep(t,i);if(void 0!==o&&!0===i.reflect){const n=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:d).toAttribute(e,i.type);this._$El=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,o=s._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=s.getPropertyOptions(o),n="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=o,this[o]=n.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||u)(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))):s=!1),!this.isUpdatePending&&s&&(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 g;f[p]=!0,f.elementProperties=new Map,f.elementStyles=[],f.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:f}),(null!==(r=l.reactiveElementVersions)&&void 0!==r?r:l.reactiveElementVersions=[]).push("1.6.3");const y=window,b=y.trustedTypes,m=b?b.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,x="?"+$,S=`<${x}>`,A=document,k=()=>A.createComment(""),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,_="[ \t\n\f\r]",O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,M=/>/g,T=RegExp(`>|${_}(?:([^\\s"'>=/]+)(${_}*=${_}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,U=/"/g,R=/^(?:script|style|textarea|title)$/i,D=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),N=new WeakMap,P=A.createTreeWalker(A,129,null,!1);function H(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==m?m.createHTML(e):e}class V{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const r=t.length-1,l=this.parts,[a,c]=((t,e)=>{const i=t.length-1,s=[];let o,n=2===e?"<svg>":"",r=O;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,a=r.exec(i),null!==a);)h=r.lastIndex,r===O?"!--"===a[1]?r=j:void 0!==a[1]?r=M:void 0!==a[2]?(R.test(a[2])&&(o=RegExp("</"+a[2],"g")),r=T):void 0!==a[3]&&(r=T):r===T?">"===a[0]?(r=null!=o?o:O,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?T:'"'===a[3]?U:z):r===U||r===z?r=T:r===j||r===M?r=O:(r=T,o=void 0);const d=r===T&&t[e+1].startsWith("/>")?" ":"";n+=r===O?i+S:c>=0?(s.push(l),i.slice(0,c)+w+i.slice(c)+$+d):i+$+(-2===c?(s.push(void 0),e):d)}return[H(t,n+(t[i]||"<?>")+(2===e?"</svg>":"")),s]})(t,e);if(this.el=V.createElement(a,i),P.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=P.nextNode())&&l.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith(w)||e.startsWith($)){const i=c[n++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+w).split($),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?F:"?"===e[1]?Z:"@"===e[1]?J:B})}else l.push({type:6,index:o})}for(const e of t)s.removeAttribute(e)}if(R.test(s.tagName)){const t=s.textContent.split($),e=t.length-1;if(e>0){s.textContent=b?b.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],k()),P.nextNode(),l.push({type:2,index:++o});s.append(t[e],k())}}}else if(8===s.nodeType)if(s.data===x)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf($,t+1));)l.push({type:7,index:o}),t+=$.length-1}o++}}static createElement(t,e){const i=A.createElement("template");return i.innerHTML=t,i}}function q(t,e,i=t,s){var o,n,r,l;if(e===D)return e;let a=void 0!==s?null===(o=i._$Co)||void 0===o?void 0:o[s]:i._$Cl;const c=E(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==c&&(null===(n=null==a?void 0:a._$AO)||void 0===n||n.call(a,!1),void 0===c?a=void 0:(a=new c(t),a._$AT(t,i,s)),void 0!==s?(null!==(r=(l=i)._$Co)&&void 0!==r?r:l._$Co=[])[s]=a:i._$Cl=a),void 0!==a&&(e=q(t,a._$AS(t,e.values),a,s)),e}class L{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:s}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:A).importNode(i,!0);P.currentNode=o;let n=P.nextNode(),r=0,l=0,a=s[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new K(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new G(n,this,t)),this._$AV.push(e),a=s[++l]}r!==(null==a?void 0:a.index)&&(n=P.nextNode(),r++)}return P.currentNode=A,o}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 K{constructor(t,e,i,s){var o;this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}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=q(this,t,e),E(t)?t===I||null==t||""===t?(this._$AH!==I&&this._$AR(),this._$AH=I):t!==this._$AH&&t!==D&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>C(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!==I&&E(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(H(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.v(i);else{const t=new L(o,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=N.get(t.strings);return void 0===e&&N.set(t.strings,e=new V(t)),e}T(t){C(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new K(this.k(k()),this.k(k()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$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 B{constructor(t,e,i,s,o){this.type=1,this._$AH=I,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=I}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(void 0===o)t=q(this,t,e,0),n=!E(t)||t!==this._$AH&&t!==D,n&&(this._$AH=t);else{const s=t;let r,l;for(t=o[0],r=0;r<o.length-1;r++)l=q(this,s[i+r],e,r),l===D&&(l=this._$AH[r]),n||(n=!E(l)||l!==this._$AH[r]),l===I?t=I:t!==I&&(t+=(null!=l?l:"")+o[r+1]),this._$AH[r]=l}n&&!s&&this.j(t)}j(t){t===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class F extends B{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===I?void 0:t}}const W=b?b.emptyScript:"";class Z extends B{constructor(){super(...arguments),this.type=4}j(t){t&&t!==I?this.element.setAttribute(this.name,W):this.element.removeAttribute(this.name)}}class J extends B{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=q(this,t,e,0))&&void 0!==i?i:I)===D)return;const s=this._$AH,o=t===I&&s!==I||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==I&&(s===I||o);o&&this.element.removeEventListener(this.name,this,s),n&&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){q(this,t)}}const Q=y.litHtmlPolyfillSupport;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- var X;null==Q||Q(V,K),(null!==(g=y.litHtmlVersions)&&void 0!==g?g:y.litHtmlVersions=[]).push("2.8.0");const Y=window,tt=Y.trustedTypes,et=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,it="$lit$",st=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+st,nt=`<${ot}>`,rt=document,lt=()=>rt.createComment(""),at=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ct=Array.isArray,ht="[ \t\n\f\r]",dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,vt=/>/g,pt=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ft=/'/g,gt=/"/g,yt=/^(?:script|style|textarea|title)$/i,bt=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),mt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),$t=new WeakMap,xt=rt.createTreeWalker(rt,129,null,!1);function St(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==et?et.createHTML(e):e}const At=(t,e)=>{const i=t.length-1,s=[];let o,n=2===e?"<svg>":"",r=dt;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,a=r.exec(i),null!==a);)h=r.lastIndex,r===dt?"!--"===a[1]?r=ut:void 0!==a[1]?r=vt:void 0!==a[2]?(yt.test(a[2])&&(o=RegExp("</"+a[2],"g")),r=pt):void 0!==a[3]&&(r=pt):r===pt?">"===a[0]?(r=null!=o?o:dt,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?pt:'"'===a[3]?gt:ft):r===gt||r===ft?r=pt:r===ut||r===vt?r=dt:(r=pt,o=void 0);const d=r===pt&&t[e+1].startsWith("/>")?" ":"";n+=r===dt?i+nt:c>=0?(s.push(l),i.slice(0,c)+it+i.slice(c)+st+d):i+st+(-2===c?(s.push(void 0),e):d)}return[St(t,n+(t[i]||"<?>")+(2===e?"</svg>":"")),s]};class kt{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const r=t.length-1,l=this.parts,[a,c]=At(t,e);if(this.el=kt.createElement(a,i),xt.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=xt.nextNode())&&l.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith(it)||e.startsWith(st)){const i=c[n++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+it).split(st),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?jt:"?"===e[1]?Tt:"@"===e[1]?zt:Ot})}else l.push({type:6,index:o})}for(const e of t)s.removeAttribute(e)}if(yt.test(s.tagName)){const t=s.textContent.split(st),e=t.length-1;if(e>0){s.textContent=tt?tt.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],lt()),xt.nextNode(),l.push({type:2,index:++o});s.append(t[e],lt())}}}else if(8===s.nodeType)if(s.data===ot)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(st,t+1));)l.push({type:7,index:o}),t+=st.length-1}o++}}static createElement(t,e){const i=rt.createElement("template");return i.innerHTML=t,i}}function Et(t,e,i=t,s){var o,n,r,l;if(e===mt)return e;let a=void 0!==s?null===(o=i._$Co)||void 0===o?void 0:o[s]:i._$Cl;const c=at(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==c&&(null===(n=null==a?void 0:a._$AO)||void 0===n||n.call(a,!1),void 0===c?a=void 0:(a=new c(t),a._$AT(t,i,s)),void 0!==s?(null!==(r=(l=i)._$Co)&&void 0!==r?r:l._$Co=[])[s]=a:i._$Cl=a),void 0!==a&&(e=Et(t,a._$AS(t,e.values),a,s)),e}class Ct{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:s}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:rt).importNode(i,!0);xt.currentNode=o;let n=xt.nextNode(),r=0,l=0,a=s[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new _t(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new Ut(n,this,t)),this._$AV.push(e),a=s[++l]}r!==(null==a?void 0:a.index)&&(n=xt.nextNode(),r++)}return xt.currentNode=rt,o}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,s){var o;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}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!==mt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>ct(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.$(rt.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=kt.createElement(St(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.v(i);else{const t=new Ct(o,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=$t.get(t.strings);return void 0===e&&$t.set(t.strings,e=new kt(t)),e}T(t){ct(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new _t(this.k(lt()),this.k(lt()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$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 Ot{constructor(t,e,i,s,o){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,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,s){const o=this.strings;let n=!1;if(void 0===o)t=Et(this,t,e,0),n=!at(t)||t!==this._$AH&&t!==mt,n&&(this._$AH=t);else{const s=t;let r,l;for(t=o[0],r=0;r<o.length-1;r++)l=Et(this,s[i+r],e,r),l===mt&&(l=this._$AH[r]),n||(n=!at(l)||l!==this._$AH[r]),l===wt?t=wt:t!==wt&&(t+=(null!=l?l:"")+o[r+1]),this._$AH[r]=l}n&&!s&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class jt extends Ot{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Mt=tt?tt.emptyScript:"";class Tt extends Ot{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Mt):this.element.removeAttribute(this.name)}}class zt extends Ot{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Et(this,t,e,0))&&void 0!==i?i:wt)===mt)return;const s=this._$AH,o=t===wt&&s!==wt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==wt&&(s===wt||o);o&&this.element.removeEventListener(this.name,this,s),n&&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 Ut{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 Rt=Y.litHtmlPolyfillSupport;null==Rt||Rt(kt,_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 Dt,It;class Nt extends f{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 s,o;const n=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=n._$litPart$;if(void 0===r){const t=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:null;n._$litPart$=r=new _t(e.insertBefore(lt(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(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 mt}}Nt.finalized=!0,Nt._$litElement$=!0,null===(Dt=globalThis.litElementHydrateSupport)||void 0===Dt||Dt.call(globalThis,{LitElement:Nt});const Pt=globalThis.litElementPolyfillSupport;null==Pt||Pt({LitElement:Nt}),(null!==(It=globalThis.litElementVersions)&&void 0!==It?It:globalThis.litElementVersions=[]).push("3.3.3");
30
- /**
31
- * @license
32
- * Copyright 2017 Google LLC
33
- * SPDX-License-Identifier: BSD-3-Clause
34
- */
35
- const Ht=(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 Vt(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):Ht(t,e)
41
- /**
42
- * @license
43
- * Copyright 2021 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */}var qt;null===(qt=window.HTMLSlotElement)||void 0===qt||qt.prototype.assignedElements;
1
+ import{css as e,LitElement as o,html as t,nothing as n}from"lit";import{property as i,customElement as a}from"lit/decorators.js";import{NuralyUIBaseMixin as l}from"@nuralyui/common/mixins";import{map as s}from"lit/directives/map.js";import{classMap as r}from"lit/directives/class-map.js";import{ifDefined as c}from"lit/directives/if-defined.js";
46
2
  /**
47
3
  * @license
48
4
  * Copyright 2023 Nuraly, Laabidi Aymen
49
5
  * SPDX-License-Identifier: MIT
50
6
  */
51
- const Lt=((t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>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[s+1]),t[0]);return new o(s,t,i)})`
7
+ const d=e`
52
8
  :host {
53
9
  display: block;
54
10
  width: 100%;
@@ -269,106 +225,84 @@ const Lt=((t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0==
269
225
  outline: 3px solid var(--nuraly-color-collapse-focus-outline);
270
226
  }
271
227
  }
272
- `,Kt=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))}},Bt=()=>{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)},Ft=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Bt())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(!Bt())return!0;let e=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){e=!1;const s=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,s):console.error(s.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)}},Wt=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var i;const s=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}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 s=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,s)}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}};
228
+ `;
273
229
  /**
274
230
  * @license
275
231
  * Copyright 2023 Nuraly, Laabidi Aymen
276
232
  * SPDX-License-Identifier: MIT
277
233
  */
278
- /**
279
- * @license
280
- * Copyright 2017 Google LLC
281
- * SPDX-License-Identifier: BSD-3-Clause
282
- */
283
- const Zt=1;class Jt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
284
- /**
285
- * @license
286
- * Copyright 2018 Google LLC
287
- * SPDX-License-Identifier: BSD-3-Clause
288
- */const Gt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Jt{constructor(t){var e;if(super(t),t.type!==Zt||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var i,s;if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(i=this.nt)||void 0===i?void 0:i.has(t))&&this.it.add(t);return this.render(e)}const o=t.element.classList;this.it.forEach((t=>{t in e||(o.remove(t),this.it.delete(t))}));for(const t in e){const i=!!e[t];i===this.it.has(t)||(null===(s=this.nt)||void 0===s?void 0:s.has(t))||(i?(o.add(t),this.it.add(t)):(o.remove(t),this.it.delete(t)))}return D}});
289
- /**
290
- * @license
291
- * Copyright 2018 Google LLC
292
- * SPDX-License-Identifier: BSD-3-Clause
293
- */
294
234
  /**
295
235
  * @license
296
236
  * Copyright 2023 Nuraly, Laabidi Aymen
297
237
  * SPDX-License-Identifier: MIT
298
238
  */
299
- class Qt{constructor(t){this.host=t,t.addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}getSection(t){return this.host.sections[t]}updateSection(t,e){if(this.host.updateSection)return void this.host.updateSection(t,e);const i=this.getSection(t);if(i){const s=[...this.host.sections];s[t]=Object.assign(Object.assign({},i),e),this.host.sections=s,this.host.requestUpdate()}}updateSections(t){if(this.host.updateSections)return void this.host.updateSections(t);const e=[...this.host.sections];let i=!1;t.forEach((({index:t,updates:s})=>{const o=this.getSection(t);o&&(e[t]=Object.assign(Object.assign({},o),s),i=!0)})),i&&(this.host.sections=e,this.host.requestUpdate())}getOpenSections(){return this.host.sections.map(((t,e)=>t.open?e:-1)).filter((t=>-1!==t))}}
239
+ class p{constructor(e){this.host=e,e.addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}getSection(e){return this.host.sections[e]}updateSection(e,o){if(this.host.updateSection)return void this.host.updateSection(e,o);const t=this.getSection(e);if(t){const n=[...this.host.sections];n[e]=Object.assign(Object.assign({},t),o),this.host.sections=n,this.host.requestUpdate()}}updateSections(e){if(this.host.updateSections)return void this.host.updateSections(e);const o=[...this.host.sections];let t=!1;e.forEach((({index:e,updates:n})=>{const i=this.getSection(e);i&&(o[e]=Object.assign(Object.assign({},i),n),t=!0)})),t&&(this.host.sections=o,this.host.requestUpdate())}getOpenSections(){return this.host.sections.map(((e,o)=>e.open?o:-1)).filter((e=>-1!==e))}}
300
240
  /**
301
241
  * @license
302
242
  * Copyright 2023 Nuraly, Laabidi Aymen
303
243
  * SPDX-License-Identifier: MIT
304
- */var Xt=function(t,e,i,s){return new(i||(i=Promise))((function(o,n){function r(t){try{a(s.next(t))}catch(t){n(t)}}function l(t){try{a(s.throw(t))}catch(t){n(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,l)}a((s=s.apply(t,e||[])).next())}))};class Yt extends Qt{constructor(t){super(t),this.animatingSections=new Set,this.animationDuration=300}animateToggle(t,e){return Xt(this,void 0,void 0,(function*(){if(this.getSection(t)&&!this.animatingSections.has(t)){this.animatingSections.add(t);try{const i=this.getContentElement(t);if(!i)return;e?yield this.animateExpand(i):yield this.animateCollapse(i)}finally{this.animatingSections.delete(t)}}}))}animateExpand(t){return Xt(this,void 0,void 0,(function*(){const e=t.scrollHeight;return t.style.height="0px",t.style.overflow="hidden",t.style.transition=`height ${this.animationDuration}ms ease-out`,t.offsetHeight,t.style.height=`${e}px`,new Promise((e=>{const i=()=>{t.style.height="",t.style.overflow="",t.style.transition="",t.removeEventListener("transitionend",i),e()};t.addEventListener("transitionend",i),setTimeout(i,this.animationDuration+50)}))}))}animateCollapse(t){return Xt(this,void 0,void 0,(function*(){const e=t.scrollHeight;return t.style.height=`${e}px`,t.style.overflow="hidden",t.style.transition=`height ${this.animationDuration}ms ease-out`,t.offsetHeight,t.style.height="0px",new Promise((e=>{const i=()=>{t.style.height="",t.style.overflow="",t.style.transition="",t.removeEventListener("transitionend",i),e()};t.addEventListener("transitionend",i),setTimeout(i,this.animationDuration+50)}))}))}getContentElement(t){var e;return(null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector(`.collapse-content[data-section-index="${t}"]`))||null}isAnimating(t){return this.animatingSections.has(t)}setAnimationDuration(t){this.animationDuration=Math.max(0,t)}}
244
+ */var h=function(e,o,t,n){return new(t||(t=Promise))((function(i,a){function l(e){try{r(n.next(e))}catch(e){a(e)}}function s(e){try{r(n.throw(e))}catch(e){a(e)}}function r(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(l,s)}r((n=n.apply(e,o||[])).next())}))};class u extends p{constructor(e){super(e),this.animatingSections=new Set,this.animationDuration=300}animateToggle(e,o){return h(this,void 0,void 0,(function*(){if(this.getSection(e)&&!this.animatingSections.has(e)){this.animatingSections.add(e);try{const t=this.getContentElement(e);if(!t)return;o?yield this.animateExpand(t):yield this.animateCollapse(t)}finally{this.animatingSections.delete(e)}}}))}animateExpand(e){return h(this,void 0,void 0,(function*(){const o=e.scrollHeight;return e.style.height="0px",e.style.overflow="hidden",e.style.transition=`height ${this.animationDuration}ms ease-out`,e.offsetHeight,e.style.height=`${o}px`,new Promise((o=>{const t=()=>{e.style.height="",e.style.overflow="",e.style.transition="",e.removeEventListener("transitionend",t),o()};e.addEventListener("transitionend",t),setTimeout(t,this.animationDuration+50)}))}))}animateCollapse(e){return h(this,void 0,void 0,(function*(){const o=e.scrollHeight;return e.style.height=`${o}px`,e.style.overflow="hidden",e.style.transition=`height ${this.animationDuration}ms ease-out`,e.offsetHeight,e.style.height="0px",new Promise((o=>{const t=()=>{e.style.height="",e.style.overflow="",e.style.transition="",e.removeEventListener("transitionend",t),o()};e.addEventListener("transitionend",t),setTimeout(t,this.animationDuration+50)}))}))}getContentElement(e){var o;return(null===(o=this.host.shadowRoot)||void 0===o?void 0:o.querySelector(`.collapse-content[data-section-index="${e}"]`))||null}isAnimating(e){return this.animatingSections.has(e)}setAnimationDuration(e){this.animationDuration=Math.max(0,e)}}
305
245
  /**
306
246
  * @license
307
247
  * Copyright 2023 Nuraly, Laabidi Aymen
308
248
  * SPDX-License-Identifier: MIT
309
- */class te extends Qt{constructor(t){super(t)}handleSectionToggle(t,e){this.host.accordion&&e&&!this.host.allowMultiple&&this.closeOtherSections(t)}closeOtherSections(t){this.host.sections.forEach(((e,i)=>{i!==t&&e.open&&!1!==e.collapsible&&this.updateSection(i,{open:!1})}))}enforceAccordionMode(){if(!this.host.accordion||this.host.allowMultiple)return;const t=this.getOpenSections();if(t.length>1){const e=t.slice(1).map((t=>({index:t,updates:{open:!1}})));this.updateSections(e)}}openSection(t){const e=this.getSection(t);e&&!e.disabled&&!1!==e.collapsible&&(this.host.accordion&&!this.host.allowMultiple&&this.closeOtherSections(t),this.updateSection(t,{open:!0}))}closeSection(t){const e=this.getSection(t);e&&!e.disabled&&!1!==e.collapsible&&this.updateSection(t,{open:!1})}closeAllSections(){const t=this.host.sections.map(((t,e)=>({section:t,index:e}))).filter((({section:t})=>t.open&&!1!==t.collapsible&&!t.disabled)).map((({index:t})=>({index:t,updates:{open:!1}})));t.length>0&&this.updateSections(t)}openAllSections(){if(this.host.accordion&&!this.host.allowMultiple){const t=this.host.sections.findIndex((t=>!1!==t.collapsible&&!t.disabled));return void(-1!==t&&this.openSection(t))}const t=this.host.sections.map(((t,e)=>({section:t,index:e}))).filter((({section:t})=>!t.open&&!1!==t.collapsible&&!t.disabled)).map((({index:t})=>({index:t,updates:{open:!0}})));t.length>0&&this.updateSections(t)}getActiveSectionIndex(){if(!this.host.accordion)return-1;const t=this.getOpenSections();return t.length>0?t[0]:-1}isAccordionMode(){return!!this.host.accordion}allowsMultiple(){return!!this.host.allowMultiple}}
249
+ */class v extends p{constructor(e){super(e)}handleSectionToggle(e,o){this.host.accordion&&o&&!this.host.allowMultiple&&this.closeOtherSections(e)}closeOtherSections(e){this.host.sections.forEach(((o,t)=>{t!==e&&o.open&&!1!==o.collapsible&&this.updateSection(t,{open:!1})}))}enforceAccordionMode(){if(!this.host.accordion||this.host.allowMultiple)return;const e=this.getOpenSections();if(e.length>1){const o=e.slice(1).map((e=>({index:e,updates:{open:!1}})));this.updateSections(o)}}openSection(e){const o=this.getSection(e);o&&!o.disabled&&!1!==o.collapsible&&(this.host.accordion&&!this.host.allowMultiple&&this.closeOtherSections(e),this.updateSection(e,{open:!0}))}closeSection(e){const o=this.getSection(e);o&&!o.disabled&&!1!==o.collapsible&&this.updateSection(e,{open:!1})}closeAllSections(){const e=this.host.sections.map(((e,o)=>({section:e,index:o}))).filter((({section:e})=>e.open&&!1!==e.collapsible&&!e.disabled)).map((({index:e})=>({index:e,updates:{open:!1}})));e.length>0&&this.updateSections(e)}openAllSections(){if(this.host.accordion&&!this.host.allowMultiple){const e=this.host.sections.findIndex((e=>!1!==e.collapsible&&!e.disabled));return void(-1!==e&&this.openSection(e))}const e=this.host.sections.map(((e,o)=>({section:e,index:o}))).filter((({section:e})=>!e.open&&!1!==e.collapsible&&!e.disabled)).map((({index:e})=>({index:e,updates:{open:!0}})));e.length>0&&this.updateSections(e)}getActiveSectionIndex(){if(!this.host.accordion)return-1;const e=this.getOpenSections();return e.length>0?e[0]:-1}isAccordionMode(){return!!this.host.accordion}allowsMultiple(){return!!this.host.allowMultiple}}
310
250
  /**
311
251
  * @license
312
252
  * Copyright 2023 Nuraly, Laabidi Aymen
313
253
  * SPDX-License-Identifier: MIT
314
- */var ee=function(t,e,i,s){for(var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r},ie=function(t,e,i,s){return new(i||(i=Promise))((function(o,n){function r(t){try{a(s.next(t))}catch(t){n(t)}}function l(t){try{a(s.throw(t))}catch(t){n(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,l)}a((s=s.apply(t,e||[])).next())}))};let se=class extends((t=>Ft(Kt(Wt(t))))(Nt)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.animationController=new Yt(this),this.accordionController=new te(this),this.sections=[],this.size="medium",this.variant="default",this.animation="slide",this.accordion=!1,this.allowMultiple=!1,this.disabled=!1,this.expandIcon="chevron-right",this.collapseIcon="chevron-down",this.handleToggleRequest=t=>{const{index:e}=t.detail;this.toggleSection(e)}}connectedCallback(){super.connectedCallback(),this.addEventListener("section-toggle-requested",this.handleToggleRequest)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("section-toggle-requested",this.handleToggleRequest)}updated(t){super.updated(t),(t.has("accordion")||t.has("allowMultiple"))&&this.accordionController.enforceAccordionMode()}toggleSection(t){return ie(this,void 0,void 0,(function*(){const e=this.sections[t];if(!e||e.disabled||!1===e.collapsible)return;const i=!!e.open,s=!i,o=new CustomEvent("section-before-toggle",{detail:{index:t,section:e,isOpen:i,preventDefault:()=>o.preventDefault()},cancelable:!0,bubbles:!0});this.dispatchEvent(o)&&(this.accordionController.handleSectionToggle(t,s),this.updateSection(t,{open:s}),"none"!==this.animation&&(yield this.animationController.animateToggle(t,s)),this.dispatchEvent(new CustomEvent("section-toggle",{detail:{index:t,section:this.sections[t],isOpen:s},bubbles:!0})))}))}openSection(t){return ie(this,void 0,void 0,(function*(){const e=this.sections[t];e&&!e.open&&(yield this.toggleSection(t))}))}closeSection(t){return ie(this,void 0,void 0,(function*(){const e=this.sections[t];e&&e.open&&(yield this.toggleSection(t))}))}openAllSections(){this.accordionController.openAllSections()}closeAllSections(){this.accordionController.closeAllSections()}updateSection(t,e){t<0||t>=this.sections.length||(this.sections=this.sections.map(((i,s)=>s===t?Object.assign(Object.assign({},i),e):i)))}updateSections(t){0!==t.length&&(this.sections=this.sections.map(((e,i)=>{const s=t.find((t=>t.index===i));return s?Object.assign(Object.assign({},e),s.updates):e})))}getSectionIcon(t){return t.expandIcon&&t.collapseIcon?t.open?t.collapseIcon:t.expandIcon:t.headerIcon?t.headerIcon:t.open?this.collapseIcon:this.expandIcon}isSectionAnimating(t){return this.animationController.isAnimating(t)}render(){return bt`
315
- <div class="collapse-container ${Gt({[`collapse-${this.size}`]:!0,[`collapse-${this.variant}`]:!0,"collapse-accordion":this.accordion,"collapse-disabled":this.disabled})}">
316
- ${
317
- /**
318
- * @license
319
- * Copyright 2021 Google LLC
320
- * SPDX-License-Identifier: BSD-3-Clause
321
- */
322
- function*(t,e){if(void 0!==t){let i=0;for(const s of t)yield e(s,i++)}}(this.sections,((t,e)=>this.renderSection(t,e)))}
254
+ */var g=function(e,o,t,n){for(var i,a=arguments.length,l=a<3?o:null===n?n=Object.getOwnPropertyDescriptor(o,t):n,s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(o,t,l):i(o,t))||l);return a>3&&l&&Object.defineProperty(o,t,l),l},b=function(e,o,t,n){return new(t||(t=Promise))((function(i,a){function l(e){try{r(n.next(e))}catch(e){a(e)}}function s(e){try{r(n.throw(e))}catch(e){a(e)}}function r(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(l,s)}r((n=n.apply(e,o||[])).next())}))};let y=class extends(l(o)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.animationController=new u(this),this.accordionController=new v(this),this.sections=[],this.size="medium",this.variant="default",this.animation="slide",this.accordion=!1,this.allowMultiple=!1,this.disabled=!1,this.expandIcon="chevron-right",this.collapseIcon="chevron-down",this.handleToggleRequest=e=>{const{index:o}=e.detail;this.toggleSection(o)}}connectedCallback(){super.connectedCallback(),this.addEventListener("section-toggle-requested",this.handleToggleRequest)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("section-toggle-requested",this.handleToggleRequest)}updated(e){super.updated(e),(e.has("accordion")||e.has("allowMultiple"))&&this.accordionController.enforceAccordionMode()}toggleSection(e){return b(this,void 0,void 0,(function*(){const o=this.sections[e];if(!o||o.disabled||!1===o.collapsible)return;const t=!!o.open,n=!t,i=new CustomEvent("section-before-toggle",{detail:{index:e,section:o,isOpen:t,preventDefault:()=>i.preventDefault()},cancelable:!0,bubbles:!0});this.dispatchEvent(i)&&(this.accordionController.handleSectionToggle(e,n),this.updateSection(e,{open:n}),"none"!==this.animation&&(yield this.animationController.animateToggle(e,n)),this.dispatchEvent(new CustomEvent("section-toggle",{detail:{index:e,section:this.sections[e],isOpen:n},bubbles:!0})))}))}openSection(e){return b(this,void 0,void 0,(function*(){const o=this.sections[e];o&&!o.open&&(yield this.toggleSection(e))}))}closeSection(e){return b(this,void 0,void 0,(function*(){const o=this.sections[e];o&&o.open&&(yield this.toggleSection(e))}))}openAllSections(){this.accordionController.openAllSections()}closeAllSections(){this.accordionController.closeAllSections()}updateSection(e,o){e<0||e>=this.sections.length||(this.sections=this.sections.map(((t,n)=>n===e?Object.assign(Object.assign({},t),o):t)))}updateSections(e){0!==e.length&&(this.sections=this.sections.map(((o,t)=>{const n=e.find((e=>e.index===t));return n?Object.assign(Object.assign({},o),n.updates):o})))}getSectionIcon(e){return e.expandIcon&&e.collapseIcon?e.open?e.collapseIcon:e.expandIcon:e.headerIcon?e.headerIcon:e.open?this.collapseIcon:this.expandIcon}isSectionAnimating(e){return this.animationController.isAnimating(e)}render(){return t`
255
+ <div class="collapse-container ${r({[`collapse-${this.size}`]:!0,[`collapse-${this.variant}`]:!0,"collapse-accordion":this.accordion,"collapse-disabled":this.disabled})}">
256
+ ${s(this.sections,((e,o)=>this.renderSection(e,o)))}
323
257
  </div>
324
- `}renderSection(t,e){const i=!!t.open,s=this.disabled||t.disabled,o=!1!==t.collapsible,n=this.isSectionAnimating(e);return bt`
258
+ `}renderSection(e,o){const i=!!e.open,a=this.disabled||e.disabled,l=!1!==e.collapsible,s=this.isSectionAnimating(o);return t`
325
259
  <div
326
- class="collapse-section ${Gt({"collapse-section--open":i,"collapse-section--disabled":null!=s&&s,"collapse-section--non-collapsible":!o,"collapse-section--animating":n,[t.className||""]:!!t.className})}"
327
- data-section-index="${e}"
260
+ class="collapse-section ${r({"collapse-section--open":i,"collapse-section--disabled":null!=a&&a,"collapse-section--non-collapsible":!l,"collapse-section--animating":s,[e.className||""]:!!e.className})}"
261
+ data-section-index="${o}"
328
262
  >
329
263
  <!-- Section Header -->
330
264
  <div
331
- class="collapse-header ${Gt({"collapse-header--expanded":i,"collapse-header--disabled":null!=s&&s,"collapse-header--clickable":o&&!s})}"
332
- data-section-index="${e}"
265
+ class="collapse-header ${r({"collapse-header--expanded":i,"collapse-header--disabled":null!=a&&a,"collapse-header--clickable":l&&!a})}"
266
+ data-section-index="${o}"
333
267
  role="button"
334
- tabindex="${o&&!s?"0":"-1"}"
268
+ tabindex="${l&&!a?"0":"-1"}"
335
269
  aria-expanded="${i}"
336
- aria-controls="collapse-content-${e}"
337
- aria-disabled="${(t=>null!=t?t:I)(s)}"
338
- @click="${o&&!s?()=>this.toggleSection(e):wt}"
270
+ aria-controls="collapse-content-${o}"
271
+ aria-disabled="${c(a)}"
272
+ @click="${l&&!a?()=>this.toggleSection(o):n}"
339
273
  >
340
- ${o?bt`
274
+ ${l?t`
341
275
  <nr-icon
342
- class="collapse-icon ${Gt({"collapse-icon--expanded":i})}"
343
- name="${this.getSectionIcon(t)}"
276
+ class="collapse-icon ${r({"collapse-icon--expanded":i})}"
277
+ name="${this.getSectionIcon(e)}"
344
278
  aria-hidden="true"
345
279
  ></nr-icon>
346
- `:wt}
280
+ `:n}
347
281
 
348
282
  <span class="collapse-header-text">
349
- ${t.headerSlot?bt`<slot name="${t.headerSlot}"></slot>`:t.header}
283
+ ${e.headerSlot?t`<slot name="${e.headerSlot}"></slot>`:e.header}
350
284
  </span>
351
285
 
352
- ${t.headerRight||t.headerRightSlot?bt`
353
- <div class="collapse-header-right" @click="${t=>t.stopPropagation()}">
354
- ${t.headerRightSlot?bt`<slot name="${t.headerRightSlot}"></slot>`:t.headerRight}
286
+ ${e.headerRight||e.headerRightSlot?t`
287
+ <div class="collapse-header-right" @click="${e=>e.stopPropagation()}">
288
+ ${e.headerRightSlot?t`<slot name="${e.headerRightSlot}"></slot>`:e.headerRight}
355
289
  </div>
356
- `:wt}
290
+ `:n}
357
291
  </div>
358
292
 
359
293
  <!-- Section Content -->
360
- ${i?bt`
294
+ ${i?t`
361
295
  <div
362
- id="collapse-content-${e}"
296
+ id="collapse-content-${o}"
363
297
  class="collapse-content"
364
- data-section-index="${e}"
298
+ data-section-index="${o}"
365
299
  role="region"
366
- aria-labelledby="collapse-header-${e}"
300
+ aria-labelledby="collapse-header-${o}"
367
301
  >
368
302
  <div class="collapse-content-inner">
369
- ${t.contentSlot?bt`<slot name="${t.contentSlot}"></slot>`:t.content}
303
+ ${e.contentSlot?t`<slot name="${e.contentSlot}"></slot>`:e.content}
370
304
  </div>
371
305
  </div>
372
- `:wt}
306
+ `:n}
373
307
  </div>
374
- `}};se.styles=Lt,ee([Vt({type:Array})],se.prototype,"sections",void 0),ee([Vt({type:String})],se.prototype,"size",void 0),ee([Vt({type:String})],se.prototype,"variant",void 0),ee([Vt({type:String})],se.prototype,"animation",void 0),ee([Vt({type:Boolean})],se.prototype,"accordion",void 0),ee([Vt({type:Boolean,attribute:"allow-multiple"})],se.prototype,"allowMultiple",void 0),ee([Vt({type:Boolean})],se.prototype,"disabled",void 0),ee([Vt({type:String,attribute:"expand-icon"})],se.prototype,"expandIcon",void 0),ee([Vt({type:String,attribute:"collapse-icon"})],se.prototype,"collapseIcon",void 0),se=ee([(t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:s}=e;return{kind:i,elements:s,finisher(e){customElements.define(t,e)}}})(t,e))("nr-collapse")],se);export{se as HyCollapse};
308
+ `}};y.styles=d,g([i({type:Array})],y.prototype,"sections",void 0),g([i({type:String})],y.prototype,"size",void 0),g([i({type:String})],y.prototype,"variant",void 0),g([i({type:String})],y.prototype,"animation",void 0),g([i({type:Boolean})],y.prototype,"accordion",void 0),g([i({type:Boolean,attribute:"allow-multiple"})],y.prototype,"allowMultiple",void 0),g([i({type:Boolean})],y.prototype,"disabled",void 0),g([i({type:String,attribute:"expand-icon"})],y.prototype,"expandIcon",void 0),g([i({type:String,attribute:"collapse-icon"})],y.prototype,"collapseIcon",void 0),y=g([a("nr-collapse")],y);export{y as HyCollapse};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/collapse",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",