@nuralyui/toast 0.0.12 → 0.0.14

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 +21 -82
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,65 +1,9 @@
1
+ import{css as t,LitElement as o,html as a,nothing as r}from"lit";import{property as s,state as n,customElement as i}from"lit/decorators.js";import{repeat as e}from"lit/directives/repeat.js";import{classMap as l}from"lit/directives/class-map.js";import{NuralyUIBaseMixin as c}from"@nuralyui/common/mixins";
1
2
  /**
2
3
  * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- const t=window,s=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),o=new WeakMap;class e{constructor(t,s,o){if(this._$cssResult$=!0,o!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o;const i=this.t;if(s&&void 0===t){const s=void 0!==i&&1===i.length;s&&(t=o.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&o.set(i,t))}return t}toString(){return this.cssText}}const n=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let s="";for(const i of t.cssRules)s+=i.cssText;return(t=>new e("string"==typeof t?t:t+"",void 0,i))(s)})(t):t
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */;var r;const a=window,l=a.trustedTypes,h=l?l.emptyScript:"",c=a.reactiveElementPolyfillSupport,u={toAttribute(t,s){switch(s){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){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}},d=(t,s)=>s!==t&&(s==s||t==t),v={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:d},f="finalized";class p extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var s;this.finalize(),(null!==(s=this.h)&&void 0!==s?s:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((s,i)=>{const o=this._$Ep(i,s);void 0!==o&&(this._$Ev.set(o,i),t.push(o))})),t}static createProperty(t,s=v){if(s.state&&(s.attribute=!1),this.finalize(),this.elementProperties.set(t,s),!s.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,s);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,s,i){return{get(){return this[s]},set(o){const e=this[t];this[s]=o,this.requestUpdate(t,e,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(f))return!1;this[f]=!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,s=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of s)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const s=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)s.unshift(n(t))}else void 0!==t&&s.push(n(t));return s}static _$Ep(t,s){const i=s.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 s,i;(null!==(s=this._$ES)&&void 0!==s?s:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var s;null===(s=this._$ES)||void 0===s||s.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,s)=>{this.hasOwnProperty(s)&&(this._$Ei.set(s,this[s]),delete this[s])}))}createRenderRoot(){var i;const o=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,o)=>{s?i.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((s=>{const o=document.createElement("style"),e=t.litNonce;void 0!==e&&o.setAttribute("nonce",e),o.textContent=s.cssText,i.appendChild(o)}))})(o,this.constructor.elementStyles),o}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 s;return null===(s=t.hostConnected)||void 0===s?void 0:s.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var s;return null===(s=t.hostDisconnected)||void 0===s?void 0:s.call(t)}))}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$EO(t,s,i=v){var o;const e=this.constructor._$Ep(t,i);if(void 0!==e&&!0===i.reflect){const n=(void 0!==(null===(o=i.converter)||void 0===o?void 0:o.toAttribute)?i.converter:u).toAttribute(s,i.type);this._$El=t,null==n?this.removeAttribute(e):this.setAttribute(e,n),this._$El=null}}_$AK(t,s){var i;const o=this.constructor,e=o._$Ev.get(t);if(void 0!==e&&this._$El!==e){const t=o.getPropertyOptions(e),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:u;this._$El=e,this[e]=n.fromAttribute(s,t.type),this._$El=null}}requestUpdate(t,s,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||d)(this[t],s)?(this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(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,s)=>this[s]=t)),this._$Ei=void 0);let s=!1;const i=this._$AL;try{s=this.shouldUpdate(i),s?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var s;return null===(s=t.hostUpdate)||void 0===s?void 0:s.call(t)})),this.update(i)):this._$Ek()}catch(t){throw s=!1,this._$Ek(),t}s&&this._$AE(i)}willUpdate(t){}_$AE(t){var s;null===(s=this._$ES)||void 0===s||s.forEach((t=>{var s;return null===(s=t.hostUpdated)||void 0===s?void 0:s.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,s)=>this._$EO(s,this[s],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 y;p[f]=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:p}),(null!==(r=a.reactiveElementVersions)&&void 0!==r?r:a.reactiveElementVersions=[]).push("1.6.3");const m=window,g=m.trustedTypes,b=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,x="?"+$,_=`<${x}>`,k=document,A=()=>k.createComment(""),S=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,E=t=>C(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),T="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,M=/>/g,O=RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,z=/"/g,R=/^(?:script|style|textarea|title)$/i,N=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),P=new WeakMap,X=k.createTreeWalker(k,129,null,!1);function L(t,s){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(s):s}const q=(t,s)=>{const i=t.length-1,o=[];let e,n=2===s?"<svg>":"",r=j;for(let s=0;s<i;s++){const i=t[s];let a,l,h=-1,c=0;for(;c<i.length&&(r.lastIndex=c,l=r.exec(i),null!==l);)c=r.lastIndex,r===j?"!--"===l[1]?r=U:void 0!==l[1]?r=M:void 0!==l[2]?(R.test(l[2])&&(e=RegExp("</"+l[2],"g")),r=O):void 0!==l[3]&&(r=O):r===O?">"===l[0]?(r=null!=e?e:j,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?O:'"'===l[3]?z:D):r===z||r===D?r=O:r===U||r===M?r=j:(r=O,e=void 0);const u=r===O&&t[s+1].startsWith("/>")?" ":"";n+=r===j?i+_:h>=0?(o.push(a),i.slice(0,h)+w+i.slice(h)+$+u):i+$+(-2===h?(o.push(void 0),s):u)}return[L(t,n+(t[i]||"<?>")+(2===s?"</svg>":"")),o]};class H{constructor({strings:t,_$litType$:s},i){let o;this.parts=[];let e=0,n=0;const r=t.length-1,a=this.parts,[l,h]=q(t,s);if(this.el=H.createElement(l,i),X.currentNode=this.el.content,2===s){const t=this.el.content,s=t.firstChild;s.remove(),t.append(...s.childNodes)}for(;null!==(o=X.nextNode())&&a.length<r;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const s of o.getAttributeNames())if(s.endsWith(w)||s.startsWith($)){const i=h[n++];if(t.push(s),void 0!==i){const t=o.getAttribute(i.toLowerCase()+w).split($),s=/([.?@])?(.*)/.exec(i);a.push({type:1,index:e,name:s[2],strings:t,ctor:"."===s[1]?W:"?"===s[1]?Z:"@"===s[1]?J:F})}else a.push({type:6,index:e})}for(const s of t)o.removeAttribute(s)}if(R.test(o.tagName)){const t=o.textContent.split($),s=t.length-1;if(s>0){o.textContent=g?g.emptyScript:"";for(let i=0;i<s;i++)o.append(t[i],A()),X.nextNode(),a.push({type:2,index:++e});o.append(t[s],A())}}}else if(8===o.nodeType)if(o.data===x)a.push({type:2,index:e});else{let t=-1;for(;-1!==(t=o.data.indexOf($,t+1));)a.push({type:7,index:e}),t+=$.length-1}e++}}static createElement(t,s){const i=k.createElement("template");return i.innerHTML=t,i}}function K(t,s,i=t,o){var e,n,r,a;if(s===N)return s;let l=void 0!==o?null===(e=i._$Co)||void 0===e?void 0:e[o]:i._$Cl;const h=S(s)?void 0:s._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,o)),void 0!==o?(null!==(r=(a=i)._$Co)&&void 0!==r?r:a._$Co=[])[o]=l:i._$Cl=l),void 0!==l&&(s=K(t,l._$AS(t,s.values),l,o)),s}class V{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var s;const{el:{content:i},parts:o}=this._$AD,e=(null!==(s=null==t?void 0:t.creationScope)&&void 0!==s?s:k).importNode(i,!0);X.currentNode=e;let n=X.nextNode(),r=0,a=0,l=o[0];for(;void 0!==l;){if(r===l.index){let s;2===l.type?s=new B(n,n.nextSibling,this,t):1===l.type?s=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(s=new G(n,this,t)),this._$AV.push(s),l=o[++a]}r!==(null==l?void 0:l.index)&&(n=X.nextNode(),r++)}return X.currentNode=k,e}v(t){let s=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}}class B{constructor(t,s,i,o){var e;this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=o,this._$Cp=null===(e=null==o?void 0:o.isConnected)||void 0===e||e}get _$AU(){var t,s;return null!==(s=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==s?s:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const s=this._$AM;return void 0!==s&&11===(null==t?void 0:t.nodeType)&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=K(this,t,s),S(t)?t===I||null==t||""===t?(this._$AH!==I&&this._$AR(),this._$AH=I):t!==this._$AH&&t!==N&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):E(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&&S(this._$AH)?this._$AA.nextSibling.data=t:this.$(k.createTextNode(t)),this._$AH=t}g(t){var s;const{values:i,_$litType$:o}=t,e="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=H.createElement(L(o.h,o.h[0]),this.options)),o);if((null===(s=this._$AH)||void 0===s?void 0:s._$AD)===e)this._$AH.v(i);else{const t=new V(e,this),s=t.u(this.options);t.v(i),this.$(s),this._$AH=t}}_$AC(t){let s=P.get(t.strings);return void 0===s&&P.set(t.strings,s=new H(t)),s}T(t){C(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,o=0;for(const e of t)o===s.length?s.push(i=new B(this.k(A()),this.k(A()),this,this.options)):i=s[o],i._$AI(e),o++;o<s.length&&(this._$AR(i&&i._$AB.nextSibling,o),s.length=o)}_$AR(t=this._$AA.nextSibling,s){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,s);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var s;void 0===this._$AM&&(this._$Cp=t,null===(s=this._$AP)||void 0===s||s.call(this,t))}}class F{constructor(t,s,i,o,e){this.type=1,this._$AH=I,this._$AN=void 0,this.element=t,this.name=s,this._$AM=o,this.options=e,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,s=this,i,o){const e=this.strings;let n=!1;if(void 0===e)t=K(this,t,s,0),n=!S(t)||t!==this._$AH&&t!==N,n&&(this._$AH=t);else{const o=t;let r,a;for(t=e[0],r=0;r<e.length-1;r++)a=K(this,o[i+r],s,r),a===N&&(a=this._$AH[r]),n||(n=!S(a)||a!==this._$AH[r]),a===I?t=I:t!==I&&(t+=(null!=a?a:"")+e[r+1]),this._$AH[r]=a}n&&!o&&this.j(t)}j(t){t===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class W extends F{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===I?void 0:t}}const Y=g?g.emptyScript:"";class Z extends F{constructor(){super(...arguments),this.type=4}j(t){t&&t!==I?this.element.setAttribute(this.name,Y):this.element.removeAttribute(this.name)}}class J extends F{constructor(t,s,i,o,e){super(t,s,i,o,e),this.type=5}_$AI(t,s=this){var i;if((t=null!==(i=K(this,t,s,0))&&void 0!==i?i:I)===N)return;const o=this._$AH,e=t===I&&o!==I||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==I&&(o===I||e);e&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var s,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(s=this.options)||void 0===s?void 0:s.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class G{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){K(this,t)}}const Q={O:w,P:$,A:x,C:1,M:q,L:V,R:E,D:K,I:B,V:F,H:Z,N:J,U:W,F:G},tt=m.litHtmlPolyfillSupport;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- var st;null==tt||tt(H,B),(null!==(y=m.litHtmlVersions)&&void 0!==y?y:m.litHtmlVersions=[]).push("2.8.0");const it=window,ot=it.trustedTypes,et=ot?ot.createPolicy("lit-html",{createHTML:t=>t}):void 0,nt="$lit$",rt=`lit$${(Math.random()+"").slice(9)}$`,at="?"+rt,lt=`<${at}>`,ht=document,ct=()=>ht.createComment(""),ut=t=>null===t||"object"!=typeof t&&"function"!=typeof t,dt=Array.isArray,vt="[ \t\n\f\r]",ft=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pt=/-->/g,yt=/>/g,mt=RegExp(`>|${vt}(?:([^\\s"'>=/]+)(${vt}*=${vt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),gt=/'/g,bt=/"/g,wt=/^(?:script|style|textarea|title)$/i,$t=(t=>(s,...i)=>({_$litType$:t,strings:s,values:i}))(1),xt=Symbol.for("lit-noChange"),_t=Symbol.for("lit-nothing"),kt=new WeakMap,At=ht.createTreeWalker(ht,129,null,!1);function St(t,s){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==et?et.createHTML(s):s}const Ct=(t,s)=>{const i=t.length-1,o=[];let e,n=2===s?"<svg>":"",r=ft;for(let s=0;s<i;s++){const i=t[s];let a,l,h=-1,c=0;for(;c<i.length&&(r.lastIndex=c,l=r.exec(i),null!==l);)c=r.lastIndex,r===ft?"!--"===l[1]?r=pt:void 0!==l[1]?r=yt:void 0!==l[2]?(wt.test(l[2])&&(e=RegExp("</"+l[2],"g")),r=mt):void 0!==l[3]&&(r=mt):r===mt?">"===l[0]?(r=null!=e?e:ft,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?mt:'"'===l[3]?bt:gt):r===bt||r===gt?r=mt:r===pt||r===yt?r=ft:(r=mt,e=void 0);const u=r===mt&&t[s+1].startsWith("/>")?" ":"";n+=r===ft?i+lt:h>=0?(o.push(a),i.slice(0,h)+nt+i.slice(h)+rt+u):i+rt+(-2===h?(o.push(void 0),s):u)}return[St(t,n+(t[i]||"<?>")+(2===s?"</svg>":"")),o]};class Et{constructor({strings:t,_$litType$:s},i){let o;this.parts=[];let e=0,n=0;const r=t.length-1,a=this.parts,[l,h]=Ct(t,s);if(this.el=Et.createElement(l,i),At.currentNode=this.el.content,2===s){const t=this.el.content,s=t.firstChild;s.remove(),t.append(...s.childNodes)}for(;null!==(o=At.nextNode())&&a.length<r;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const s of o.getAttributeNames())if(s.endsWith(nt)||s.startsWith(rt)){const i=h[n++];if(t.push(s),void 0!==i){const t=o.getAttribute(i.toLowerCase()+nt).split(rt),s=/([.?@])?(.*)/.exec(i);a.push({type:1,index:e,name:s[2],strings:t,ctor:"."===s[1]?Ot:"?"===s[1]?zt:"@"===s[1]?Rt:Mt})}else a.push({type:6,index:e})}for(const s of t)o.removeAttribute(s)}if(wt.test(o.tagName)){const t=o.textContent.split(rt),s=t.length-1;if(s>0){o.textContent=ot?ot.emptyScript:"";for(let i=0;i<s;i++)o.append(t[i],ct()),At.nextNode(),a.push({type:2,index:++e});o.append(t[s],ct())}}}else if(8===o.nodeType)if(o.data===at)a.push({type:2,index:e});else{let t=-1;for(;-1!==(t=o.data.indexOf(rt,t+1));)a.push({type:7,index:e}),t+=rt.length-1}e++}}static createElement(t,s){const i=ht.createElement("template");return i.innerHTML=t,i}}function Tt(t,s,i=t,o){var e,n,r,a;if(s===xt)return s;let l=void 0!==o?null===(e=i._$Co)||void 0===e?void 0:e[o]:i._$Cl;const h=ut(s)?void 0:s._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,o)),void 0!==o?(null!==(r=(a=i)._$Co)&&void 0!==r?r:a._$Co=[])[o]=l:i._$Cl=l),void 0!==l&&(s=Tt(t,l._$AS(t,s.values),l,o)),s}class jt{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var s;const{el:{content:i},parts:o}=this._$AD,e=(null!==(s=null==t?void 0:t.creationScope)&&void 0!==s?s:ht).importNode(i,!0);At.currentNode=e;let n=At.nextNode(),r=0,a=0,l=o[0];for(;void 0!==l;){if(r===l.index){let s;2===l.type?s=new Ut(n,n.nextSibling,this,t):1===l.type?s=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(s=new Nt(n,this,t)),this._$AV.push(s),l=o[++a]}r!==(null==l?void 0:l.index)&&(n=At.nextNode(),r++)}return At.currentNode=ht,e}v(t){let s=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}}class Ut{constructor(t,s,i,o){var e;this.type=2,this._$AH=_t,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=o,this._$Cp=null===(e=null==o?void 0:o.isConnected)||void 0===e||e}get _$AU(){var t,s;return null!==(s=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==s?s:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const s=this._$AM;return void 0!==s&&11===(null==t?void 0:t.nodeType)&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=Tt(this,t,s),ut(t)?t===_t||null==t||""===t?(this._$AH!==_t&&this._$AR(),this._$AH=_t):t!==this._$AH&&t!==xt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>dt(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!==_t&&ut(this._$AH)?this._$AA.nextSibling.data=t:this.$(ht.createTextNode(t)),this._$AH=t}g(t){var s;const{values:i,_$litType$:o}=t,e="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Et.createElement(St(o.h,o.h[0]),this.options)),o);if((null===(s=this._$AH)||void 0===s?void 0:s._$AD)===e)this._$AH.v(i);else{const t=new jt(e,this),s=t.u(this.options);t.v(i),this.$(s),this._$AH=t}}_$AC(t){let s=kt.get(t.strings);return void 0===s&&kt.set(t.strings,s=new Et(t)),s}T(t){dt(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,o=0;for(const e of t)o===s.length?s.push(i=new Ut(this.k(ct()),this.k(ct()),this,this.options)):i=s[o],i._$AI(e),o++;o<s.length&&(this._$AR(i&&i._$AB.nextSibling,o),s.length=o)}_$AR(t=this._$AA.nextSibling,s){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,s);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var s;void 0===this._$AM&&(this._$Cp=t,null===(s=this._$AP)||void 0===s||s.call(this,t))}}class Mt{constructor(t,s,i,o,e){this.type=1,this._$AH=_t,this._$AN=void 0,this.element=t,this.name=s,this._$AM=o,this.options=e,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=_t}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,s=this,i,o){const e=this.strings;let n=!1;if(void 0===e)t=Tt(this,t,s,0),n=!ut(t)||t!==this._$AH&&t!==xt,n&&(this._$AH=t);else{const o=t;let r,a;for(t=e[0],r=0;r<e.length-1;r++)a=Tt(this,o[i+r],s,r),a===xt&&(a=this._$AH[r]),n||(n=!ut(a)||a!==this._$AH[r]),a===_t?t=_t:t!==_t&&(t+=(null!=a?a:"")+e[r+1]),this._$AH[r]=a}n&&!o&&this.j(t)}j(t){t===_t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Ot extends Mt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_t?void 0:t}}const Dt=ot?ot.emptyScript:"";class zt extends Mt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==_t?this.element.setAttribute(this.name,Dt):this.element.removeAttribute(this.name)}}class Rt extends Mt{constructor(t,s,i,o,e){super(t,s,i,o,e),this.type=5}_$AI(t,s=this){var i;if((t=null!==(i=Tt(this,t,s,0))&&void 0!==i?i:_t)===xt)return;const o=this._$AH,e=t===_t&&o!==_t||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==_t&&(o===_t||e);e&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var s,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(s=this.options)||void 0===s?void 0:s.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Nt{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Tt(this,t)}}const It=it.litHtmlPolyfillSupport;null==It||It(Et,Ut),(null!==(st=it.litHtmlVersions)&&void 0!==st?st:it.litHtmlVersions=[]).push("2.8.0");
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- var Pt,Xt;class Lt extends p{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,s;const i=super.createRenderRoot();return null!==(t=(s=this.renderOptions).renderBefore)&&void 0!==t||(s.renderBefore=i.firstChild),i}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,s,i)=>{var o,e;const n=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:s;let r=n._$litPart$;if(void 0===r){const t=null!==(e=null==i?void 0:i.renderBefore)&&void 0!==e?e:null;n._$litPart$=r=new Ut(s.insertBefore(ct(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(s,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 xt}}Lt.finalized=!0,Lt._$litElement$=!0,null===(Pt=globalThis.litElementHydrateSupport)||void 0===Pt||Pt.call(globalThis,{LitElement:Lt});const qt=globalThis.litElementPolyfillSupport;null==qt||qt({LitElement:Lt}),(null!==(Xt=globalThis.litElementVersions)&&void 0!==Xt?Xt: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,s)=>"method"===s.kind&&s.descriptor&&!("value"in s.descriptor)?{...s,finisher(i){i.createProperty(s.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:s.key,initializer(){"function"==typeof s.initializer&&(this[s.key]=s.initializer.call(this))},finisher(i){i.createProperty(s.key,t)}},Kt=(t,s,i)=>{s.constructor.createProperty(i,t)};
36
- /**
37
- * @license
38
- * Copyright 2017 Google LLC
39
- * SPDX-License-Identifier: BSD-3-Clause
40
- */function Vt(t){return(s,i)=>void 0!==i?Kt(t,s,i):Ht(t,s)
41
- /**
42
- * @license
43
- * Copyright 2017 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */}
46
- /**
47
- * @license
48
- * Copyright 2021 Google LLC
49
- * SPDX-License-Identifier: BSD-3-Clause
50
- */
51
- var Bt;null===(Bt=window.HTMLSlotElement)||void 0===Bt||Bt.prototype.assignedElements;
52
- /**
53
- * @license
54
- * Copyright 2017 Google LLC
55
- * SPDX-License-Identifier: BSD-3-Clause
56
- */
57
- const Ft=1,Wt=2,Yt=t=>(...s)=>({_$litDirective$:t,values:s});class Zt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,s,i){this._$Ct=t,this._$AM=s,this._$Ci=i}_$AS(t,s){return this.update(t,s)}update(t,s){return this.render(...s)}}
58
- /**
59
- * @license
60
- * Copyright 2020 Google LLC
61
- * SPDX-License-Identifier: BSD-3-Clause
62
- */const{I:Jt}=Q,Gt=()=>document.createComment(""),Qt=(t,s,i)=>{var o;const e=t._$AA.parentNode,n=void 0===s?t._$AB:s._$AA;if(void 0===i){const s=e.insertBefore(Gt(),n),o=e.insertBefore(Gt(),n);i=new Jt(s,o,t,t.options)}else{const s=i._$AB.nextSibling,r=i._$AM,a=r!==t;if(a){let s;null===(o=i._$AQ)||void 0===o||o.call(i,t),i._$AM=t,void 0!==i._$AP&&(s=t._$AU)!==r._$AU&&i._$AP(s)}if(s!==n||a){let t=i._$AA;for(;t!==s;){const s=t.nextSibling;e.insertBefore(t,n),t=s}}}return i},ts=(t,s,i=t)=>(t._$AI(s,i),t),ss={},is=(t,s=ss)=>t._$AH=s,os=t=>{var s;null===(s=t._$AP)||void 0===s||s.call(t,!1,!0);let i=t._$AA;const o=t._$AB.nextSibling;for(;i!==o;){const t=i.nextSibling;i.remove(),i=t}},es=(t,s,i)=>{const o=new Map;for(let e=s;e<=i;e++)o.set(t[e],e);return o},ns=Yt(class extends Zt{constructor(t){if(super(t),t.type!==Wt)throw Error("repeat() can only be used in text expressions")}ct(t,s,i){let o;void 0===i?i=s:void 0!==s&&(o=s);const e=[],n=[];let r=0;for(const s of t)e[r]=o?o(s,r):r,n[r]=i(s,r),r++;return{values:n,keys:e}}render(t,s,i){return this.ct(t,s,i).values}update(t,[s,i,o]){var e;const n=(t=>t._$AH)(t),{values:r,keys:a}=this.ct(s,i,o);if(!Array.isArray(n))return this.ut=a,r;const l=null!==(e=this.ut)&&void 0!==e?e:this.ut=[],h=[];let c,u,d=0,v=n.length-1,f=0,p=r.length-1;for(;d<=v&&f<=p;)if(null===n[d])d++;else if(null===n[v])v--;else if(l[d]===a[f])h[f]=ts(n[d],r[f]),d++,f++;else if(l[v]===a[p])h[p]=ts(n[v],r[p]),v--,p--;else if(l[d]===a[p])h[p]=ts(n[d],r[p]),Qt(t,h[p+1],n[d]),d++,p--;else if(l[v]===a[f])h[f]=ts(n[v],r[f]),Qt(t,n[d],n[v]),v--,f++;else if(void 0===c&&(c=es(a,f,p),u=es(l,d,v)),c.has(l[d]))if(c.has(l[v])){const s=u.get(a[f]),i=void 0!==s?n[s]:null;if(null===i){const s=Qt(t,n[d]);ts(s,r[f]),h[f]=s}else h[f]=ts(i,r[f]),Qt(t,n[d],i),n[s]=null;f++}else os(n[v]),v--;else os(n[d]),d++;for(;f<=p;){const s=Qt(t,h[p+1]);ts(s,r[f]),h[f++]=s}for(;d<=v;){const t=n[d++];null!==t&&os(t)}return this.ut=a,is(t,h),N}}),rs=Yt(class extends Zt{constructor(t){var s;if(super(t),t.type!==Ft||"class"!==t.name||(null===(s=t.strings)||void 0===s?void 0:s.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((s=>t[s])).join(" ")+" "}update(t,[s]){var i,o;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 s)s[t]&&!(null===(i=this.nt)||void 0===i?void 0:i.has(t))&&this.it.add(t);return this.render(s)}const e=t.element.classList;this.it.forEach((t=>{t in s||(e.remove(t),this.it.delete(t))}));for(const t in s){const i=!!s[t];i===this.it.has(t)||(null===(o=this.nt)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.it.add(t)):(e.remove(t),this.it.delete(t)))}return N}}),as=((t,...s)=>{const o=1===t.length?t[0]:s.reduce(((s,i,o)=>s+(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[o+1]),t[0]);return new e(o,t,i)})`
4
+ * Copyright 2023 Nuraly, Laabidi Aymen
5
+ * SPDX-License-Identifier: MIT
6
+ */const u=t`
63
7
  :host {
64
8
  display: block;
65
9
  position: fixed;
@@ -387,68 +331,63 @@ const Ft=1,Wt=2,Yt=t=>(...s)=>({_$litDirective$:t,values:s});class Zt{constructo
387
331
  * @license
388
332
  * Copyright 2023 Nuraly, Laabidi Aymen
389
333
  * SPDX-License-Identifier: MIT
390
- */,ls=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,s,i;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(s=this.designSystemObserver)||void 0===s||s.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,s;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===(s=window.matchMedia)||void 0===s?void 0:s.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const s=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===s?s:"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))}},hs=()=>{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)},cs=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(hs())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(!hs())return!0;let s=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){s=!1;const o=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,o):console.error(o.message)}return s}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 s=this.requiredComponents.indexOf(t);s>-1&&this.requiredComponents.splice(s,1)}},us=t=>class extends t{dispatchCustomEvent(t,s){this.dispatchEvent(new CustomEvent(t,{detail:s,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,s){var i;const o=Object.assign(Object.assign({},s),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,o)}dispatchInputEvent(t,s){const i=Object.assign({target:s.target||this,value:s.value,originalEvent:s.originalEvent},s);this.dispatchCustomEvent(t,i)}dispatchFocusEvent(t,s){const i=Object.assign({target:s.target||this,value:s.value,focused:s.focused,cursorPosition:s.cursorPosition,selectedText:s.selectedText},s);this.dispatchCustomEvent(t,i)}dispatchValidationEvent(t,s){var i;const o=Object.assign({target:s.target||this,value:s.value,isValid:null!==(i=s.isValid)&&void 0!==i&&i,error:s.error},s);this.dispatchCustomEvent(t,o)}dispatchActionEvent(t,s){const i=Object.assign({target:s.target||this,action:s.action,previousValue:s.previousValue,newValue:s.newValue},s);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}},ds="",vs=5e3,fs=5;
391
- /**
392
- * @license
393
- * Copyright 2017 Google LLC
394
- * SPDX-License-Identifier: BSD-3-Clause
395
- */
334
+ */,d="",h=5e3,p=5;
396
335
  /**
397
336
  * @license
398
337
  * Copyright 2023 Nuraly, Laabidi Aymen
399
338
  * SPDX-License-Identifier: MIT
400
339
  */
401
- var ps=function(t,s,i,o){for(var e,n=arguments.length,r=n<3?s:null===o?o=Object.getOwnPropertyDescriptor(s,i):o,a=t.length-1;a>=0;a--)(e=t[a])&&(r=(n<3?e(r):n>3?e(s,i,r):e(s,i))||r);return n>3&&r&&Object.defineProperty(s,i,r),r};let ys=class extends((t=>cs(ls(us(t))))(Lt)){constructor(){super(...arguments),this.requiredComponents=["nr-icon","nr-button"],this.position="top-right",this.maxToasts=5,this.defaultDuration=5e3,this.animation="fade",this.stack=!0,this.autoDismiss=!0,this.toasts=[],this.timeouts=new Map}show(t){var s,i,o;const e="string"==typeof t?{text:t}:t,n={id:this.generateId(),timestamp:Date.now(),text:e.text,content:e.content,type:e.type||"default",duration:null!==(s=e.duration)&&void 0!==s?s:this.defaultDuration,autoDismiss:null!==(i=e.autoDismiss)&&void 0!==i?i:this.autoDismiss,closable:null===(o=e.closable)||void 0===o||o,icon:e.icon||this.getDefaultIcon(e.type),customClass:e.customClass,button:e.button,onClose:e.onClose,onClick:e.onClick};if(this.stack?this.toasts.length>=this.maxToasts&&this.removeToast(this.toasts[0].id):this.clearAll(),this.toasts=[...this.toasts,n],this.emitToastEvent("nr-toast-show",n,"show"),n.autoDismiss&&n.duration&&n.duration>0){const t=window.setTimeout((()=>{this.removeToast(n.id)}),n.duration);this.timeouts.set(n.id,t)}return n.id}success(t,s){return this.show({text:t,type:"success",duration:s})}error(t,s){return this.show({text:t,type:"error",duration:s})}warning(t,s){return this.show({text:t,type:"warning",duration:s})}info(t,s){return this.show({text:t,type:"info",duration:s})}removeToast(t){const s=this.toasts.find((s=>s.id===t));if(!s)return;s.removing=!0,this.requestUpdate();const i=this.timeouts.get(t);i&&(clearTimeout(i),this.timeouts.delete(t)),setTimeout((()=>{var i;this.toasts=this.toasts.filter((s=>s.id!==t)),this.emitToastEvent("nr-toast-close",s,"close"),null===(i=s.onClose)||void 0===i||i.call(s)}),300)}clearAll(){this.toasts.forEach((t=>{const s=this.timeouts.get(t.id);s&&clearTimeout(s)})),this.timeouts.clear(),this.toasts=[]}handleToastClick(t){var s;this.emitToastEvent("nr-toast-click",t,"click"),null===(s=t.onClick)||void 0===s||s.call(t)}handleCloseClick(t,s){t.stopPropagation(),this.removeToast(s.id)}getDefaultIcon(t){switch(t){case"success":return"check-circle";case"error":return"x-circle";case"warning":return"alert-triangle";case"info":return"info";default:return""}}generateId(){return`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}getAnimationClass(t){const s=t.removing?"out":"in";return`toast--${this.animation}-${s}`}emitToastEvent(t,s,i){this.dispatchEvent(new CustomEvent(t,{detail:{toast:s,action:i},bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.clearAll()}render(){return $t`
340
+ var y=function(t,o,a,r){for(var s,n=arguments.length,i=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,a):r,e=t.length-1;e>=0;e--)(s=t[e])&&(i=(n<3?s(i):n>3?s(o,a,i):s(o,a))||i);return n>3&&i&&Object.defineProperty(o,a,i),i};let f=class extends(c(o)){constructor(){super(...arguments),this.requiredComponents=["nr-icon","nr-button"],this.position="top-right",this.maxToasts=5,this.defaultDuration=5e3,this.animation="fade",this.stack=!0,this.autoDismiss=!0,this.toasts=[],this.timeouts=new Map}show(t){var o,a,r;const s="string"==typeof t?{text:t}:t,n={id:this.generateId(),timestamp:Date.now(),text:s.text,content:s.content,type:s.type||"default",duration:null!==(o=s.duration)&&void 0!==o?o:this.defaultDuration,autoDismiss:null!==(a=s.autoDismiss)&&void 0!==a?a:this.autoDismiss,closable:null===(r=s.closable)||void 0===r||r,icon:s.icon||this.getDefaultIcon(s.type),customClass:s.customClass,button:s.button,onClose:s.onClose,onClick:s.onClick};if(this.stack?this.toasts.length>=this.maxToasts&&this.removeToast(this.toasts[0].id):this.clearAll(),this.toasts=[...this.toasts,n],this.emitToastEvent("nr-toast-show",n,"show"),n.autoDismiss&&n.duration&&n.duration>0){const t=window.setTimeout((()=>{this.removeToast(n.id)}),n.duration);this.timeouts.set(n.id,t)}return n.id}success(t,o){return this.show({text:t,type:"success",duration:o})}error(t,o){return this.show({text:t,type:"error",duration:o})}warning(t,o){return this.show({text:t,type:"warning",duration:o})}info(t,o){return this.show({text:t,type:"info",duration:o})}removeToast(t){const o=this.toasts.find((o=>o.id===t));if(!o)return;o.removing=!0,this.requestUpdate();const a=this.timeouts.get(t);a&&(clearTimeout(a),this.timeouts.delete(t)),setTimeout((()=>{var a;this.toasts=this.toasts.filter((o=>o.id!==t)),this.emitToastEvent("nr-toast-close",o,"close"),null===(a=o.onClose)||void 0===a||a.call(o)}),300)}clearAll(){this.toasts.forEach((t=>{const o=this.timeouts.get(t.id);o&&clearTimeout(o)})),this.timeouts.clear(),this.toasts=[]}handleToastClick(t){var o;this.emitToastEvent("nr-toast-click",t,"click"),null===(o=t.onClick)||void 0===o||o.call(t)}handleCloseClick(t,o){t.stopPropagation(),this.removeToast(o.id)}getDefaultIcon(t){switch(t){case"success":return"check-circle";case"error":return"x-circle";case"warning":return"alert-triangle";case"info":return"info";default:return""}}generateId(){return`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}getAnimationClass(t){const o=t.removing?"out":"in";return`toast--${this.animation}-${o}`}emitToastEvent(t,o,a){this.dispatchEvent(new CustomEvent(t,{detail:{toast:o,action:a},bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.clearAll()}render(){return a`
402
341
  <div class="toast-container">
403
- ${ns(this.toasts,(t=>t.id),(t=>this.renderToast(t)))}
342
+ ${e(this.toasts,(t=>t.id),(t=>this.renderToast(t)))}
404
343
  </div>
405
- `}renderToast(t){const s={toast:!0,[`toast--${t.type}`]:!0,[this.getAnimationClass(t)]:!0,[t.customClass||""]:!!t.customClass};return $t`
344
+ `}renderToast(t){const o={toast:!0,[`toast--${t.type}`]:!0,[this.getAnimationClass(t)]:!0,[t.customClass||""]:!!t.customClass};return a`
406
345
  <div
407
- class=${rs(s)}
346
+ class=${l(o)}
408
347
  @click=${()=>this.handleToastClick(t)}
409
348
  role="alert"
410
349
  aria-live="polite"
411
350
  >
412
- ${t.icon?$t`
351
+ ${t.icon?a`
413
352
  <div class="toast__icon">
414
353
  <nr-icon name=${t.icon} size="medium"></nr-icon>
415
354
  </div>
416
- `:_t}
355
+ `:r}
417
356
 
418
357
  <div class="toast__content">
419
- ${t.content?t.content:$t`
358
+ ${t.content?t.content:a`
420
359
  <div class="toast__text">${t.text}</div>
421
- ${t.button?this.renderButton(t.button):_t}
360
+ ${t.button?this.renderButton(t.button):r}
422
361
  `}
423
362
  </div>
424
363
 
425
- ${t.closable?$t`
364
+ ${t.closable?a`
426
365
  <button
427
366
  class="toast__close"
428
- @click=${s=>this.handleCloseClick(s,t)}
367
+ @click=${o=>this.handleCloseClick(o,t)}
429
368
  aria-label="Close notification"
430
369
  type="button"
431
370
  >
432
371
  <nr-icon name="x" size="small"></nr-icon>
433
372
  </button>
434
- `:_t}
373
+ `:r}
435
374
  </div>
436
- `}renderButton(t){return $t`
375
+ `}renderButton(t){return a`
437
376
  <div class="toast__button">
438
377
  <nr-button
439
378
  type=${t.type||"default"}
440
379
  size=${t.size||"small"}
441
380
  ?disabled=${t.disabled||!1}
442
- @click=${s=>{s.stopPropagation(),t.onClick(s)}}
381
+ @click=${o=>{o.stopPropagation(),t.onClick(o)}}
443
382
  >
444
- ${t.icon?$t`<nr-icon slot="icon-left" name=${t.icon}></nr-icon>`:_t}
383
+ ${t.icon?a`<nr-icon slot="icon-left" name=${t.icon}></nr-icon>`:r}
445
384
  ${t.label}
446
385
  </nr-button>
447
386
  </div>
448
- `}};ys.styles=as,ps([Vt({type:String,reflect:!0})],ys.prototype,"position",void 0),ps([Vt({type:Number})],ys.prototype,"maxToasts",void 0),ps([Vt({type:Number})],ys.prototype,"defaultDuration",void 0),ps([Vt({type:String})],ys.prototype,"animation",void 0),ps([Vt({type:Boolean})],ys.prototype,"stack",void 0),ps([Vt({type:Boolean})],ys.prototype,"autoDismiss",void 0),ps([function(t){return Vt({...t,state:!0})}()],ys.prototype,"toasts",void 0),ys=ps([(t=>s=>"function"==typeof s?((t,s)=>(customElements.define(t,s),s))(t,s):((t,s)=>{const{kind:i,elements:o}=s;return{kind:i,elements:o,finisher(s){customElements.define(t,s)}}})(t,s))("nr-toast")],ys);
387
+ `}};f.styles=u,y([s({type:String,reflect:!0})],f.prototype,"position",void 0),y([s({type:Number})],f.prototype,"maxToasts",void 0),y([s({type:Number})],f.prototype,"defaultDuration",void 0),y([s({type:String})],f.prototype,"animation",void 0),y([s({type:Boolean})],f.prototype,"stack",void 0),y([s({type:Boolean})],f.prototype,"autoDismiss",void 0),y([n()],f.prototype,"toasts",void 0),f=y([i("nr-toast")],f);
449
388
  /**
450
389
  * @license
451
390
  * Copyright 2023 Nuraly, Laabidi Aymen
452
391
  * SPDX-License-Identifier: MIT
453
392
  */
454
- class ms{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,s){console.error(`[ToastController:${this.constructor.name}] Error in ${s}:`,t),this._host.dispatchEvent(new CustomEvent("nr-toast-error",{detail:{error:t.message,context:s,controller:this.constructor.name},bubbles:!0,composed:!0}))}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}}export{ms as BaseToastController,fs as DEFAULT_MAX_TOASTS,vs as DEFAULT_TOAST_DURATION,ds as EMPTY_STRING,ys as NrToastElement};
393
+ class m{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,o){console.error(`[ToastController:${this.constructor.name}] Error in ${o}:`,t),this._host.dispatchEvent(new CustomEvent("nr-toast-error",{detail:{error:t.message,context:o,controller:this.constructor.name},bubbles:!0,composed:!0}))}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}}export{m as BaseToastController,p as DEFAULT_MAX_TOASTS,h as DEFAULT_TOAST_DURATION,d as EMPTY_STRING,f as NrToastElement};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/toast",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Toast notification component for NuralyUI library",
5
5
  "main": "index.js",
6
6
  "type": "module",