@nuralyui/tabs 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +28 -83
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1,59 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
const t=window,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),s=new WeakMap;class r{constructor(t,i,s){if(this._$cssResult$=!0,s!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}}const n=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const e of t.cssRules)i+=e.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,e))(i)})(t):t
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2017 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/;var o;const a=window,l=a.trustedTypes,h=l?l.emptyScript:"",d=a.reactiveElementPolyfillSupport,c={toAttribute(t,i){switch(i){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let e=t;switch(i){case Boolean:e=null!==t;break;case Number:e=null===t?null:Number(t);break;case Object:case Array:try{e=JSON.parse(t)}catch(t){e=null}}return e}},u=(t,i)=>i!==t&&(i==i||t==t),v={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u},b="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 i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,e)=>{const s=this._$Ep(e,i);void 0!==s&&(this._$Ev.set(s,e),t.push(s))})),t}static createProperty(t,i=v){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const e="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,e,i);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,i,e){return{get(){return this[i]},set(s){const r=this[t];this[i]=s,this.requestUpdate(t,r,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(b))return!1;this[b]=!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,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const e of i)this.createProperty(e,t[e])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const e=new Set(t.flat(1/0).reverse());for(const t of e)i.unshift(n(t))}else void 0!==t&&i.push(n(t));return i}static _$Ep(t,i){const e=i.attribute;return!1===e?void 0:"string"==typeof e?e:"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 i,e;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(e=t.hostConnected)||void 0===e||e.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var e;const s=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,s)=>{i?e.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((i=>{const s=document.createElement("style"),r=t.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=i.cssText,e.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 i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,e){this._$AK(t,e)}_$EO(t,i,e=v){var s;const r=this.constructor._$Ep(t,e);if(void 0!==r&&!0===e.reflect){const n=(void 0!==(null===(s=e.converter)||void 0===s?void 0:s.toAttribute)?e.converter:c).toAttribute(i,e.type);this._$El=t,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$El=null}}_$AK(t,i){var e;const s=this.constructor,r=s._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=s.getPropertyOptions(r),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(e=t.converter)||void 0===e?void 0:e.fromAttribute)?t.converter:c;this._$El=r,this[r]=n.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,e){let s=!0;void 0!==t&&(((e=e||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===e.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,e))):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,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const e=this._$AL;try{i=this.shouldUpdate(e),i?(this.willUpdate(e),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(e)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(e)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.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,i)=>this._$EO(i,this[i],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;p[b]=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==d||d({ReactiveElement:p}),(null!==(o=a.reactiveElementVersions)&&void 0!==o?o:a.reactiveElementVersions=[]).push("1.6.3");const y=window,f=y.trustedTypes,m=f?f.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",T=`lit$${(Math.random()+"").slice(9)}$`,x="?"+T,$=`<${x}>`,E=document,k=()=>E.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,S="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,_=/>/g,z=RegExp(`>|${S}(?:([^\\s"'>=/]+)(${S}*=${S}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),O=/'/g,j=/"/g,M=/^(?:script|style|textarea|title)$/i,R=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),L=new WeakMap,N=E.createTreeWalker(E,129,null,!1);function K(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==m?m.createHTML(i):i}class P{constructor({strings:t,_$litType$:i},e){let s;this.parts=[];let r=0,n=0;const o=t.length-1,a=this.parts,[l,h]=((t,i)=>{const e=t.length-1,s=[];let r,n=2===i?"<svg>":"",o=D;for(let i=0;i<e;i++){const e=t[i];let a,l,h=-1,d=0;for(;d<e.length&&(o.lastIndex=d,l=o.exec(e),null!==l);)d=o.lastIndex,o===D?"!--"===l[1]?o=I:void 0!==l[1]?o=_:void 0!==l[2]?(M.test(l[2])&&(r=RegExp("</"+l[2],"g")),o=z):void 0!==l[3]&&(o=z):o===z?">"===l[0]?(o=null!=r?r:D,h=-1):void 0===l[1]?h=-2:(h=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?z:'"'===l[3]?j:O):o===j||o===O?o=z:o===I||o===_?o=D:(o=z,r=void 0);const c=o===z&&t[i+1].startsWith("/>")?" ":"";n+=o===D?e+$:h>=0?(s.push(a),e.slice(0,h)+w+e.slice(h)+T+c):e+T+(-2===h?(s.push(void 0),i):c)}return[K(t,n+(t[e]||"<?>")+(2===i?"</svg>":"")),s]})(t,i);if(this.el=P.createElement(l,e),N.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(s=N.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const i of s.getAttributeNames())if(i.endsWith(w)||i.startsWith(T)){const e=h[n++];if(t.push(i),void 0!==e){const t=s.getAttribute(e.toLowerCase()+w).split(T),i=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?q:"?"===i[1]?Z:"@"===i[1]?J:V})}else a.push({type:6,index:r})}for(const i of t)s.removeAttribute(i)}if(M.test(s.tagName)){const t=s.textContent.split(T),i=t.length-1;if(i>0){s.textContent=f?f.emptyScript:"";for(let e=0;e<i;e++)s.append(t[e],k()),N.nextNode(),a.push({type:2,index:++r});s.append(t[i],k())}}}else if(8===s.nodeType)if(s.data===x)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(T,t+1));)a.push({type:7,index:r}),t+=T.length-1}r++}}static createElement(t,i){const e=E.createElement("template");return e.innerHTML=t,e}}function F(t,i,e=t,s){var r,n,o,a;if(i===R)return i;let l=void 0!==s?null===(r=e._$Co)||void 0===r?void 0:r[s]:e._$Cl;const h=A(i)?void 0:i._$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,e,s)),void 0!==s?(null!==(o=(a=e)._$Co)&&void 0!==o?o:a._$Co=[])[s]=l:e._$Cl=l),void 0!==l&&(i=F(t,l._$AS(t,i.values),l,s)),i}class B{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:e},parts:s}=this._$AD,r=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:E).importNode(e,!0);N.currentNode=r;let n=N.nextNode(),o=0,a=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new H(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new Y(n,this,t)),this._$AV.push(i),l=s[++a]}o!==(null==l?void 0:l.index)&&(n=N.nextNode(),o++)}return N.currentNode=E,r}v(t){let i=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class H{constructor(t,i,e,s){var r;this.type=2,this._$AH=U,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=s,this._$Cp=null===(r=null==s?void 0:s.isConnected)||void 0===r||r}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=F(this,t,i),A(t)?t===U||null==t||""===t?(this._$AH!==U&&this._$AR(),this._$AH=U):t!==this._$AH&&t!==R&&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!==U&&A(this._$AH)?this._$AA.nextSibling.data=t:this.$(E.createTextNode(t)),this._$AH=t}g(t){var i;const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=P.createElement(K(s.h,s.h[0]),this.options)),s);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===r)this._$AH.v(e);else{const t=new B(r,this),i=t.u(this.options);t.v(e),this.$(i),this._$AH=t}}_$AC(t){let i=L.get(t.strings);return void 0===i&&L.set(t.strings,i=new P(t)),i}T(t){C(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,s=0;for(const r of t)s===i.length?i.push(e=new H(this.k(k()),this.k(k()),this,this.options)):e=i[s],e._$AI(r),s++;s<i.length&&(this._$AR(e&&e._$AB.nextSibling,s),i.length=s)}_$AR(t=this._$AA.nextSibling,i){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class V{constructor(t,i,e,s,r){this.type=1,this._$AH=U,this._$AN=void 0,this.element=t,this.name=i,this._$AM=s,this.options=r,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=U}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,e,s){const r=this.strings;let n=!1;if(void 0===r)t=F(this,t,i,0),n=!A(t)||t!==this._$AH&&t!==R,n&&(this._$AH=t);else{const s=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=F(this,s[e+o],i,o),a===R&&(a=this._$AH[o]),n||(n=!A(a)||a!==this._$AH[o]),a===U?t=U:t!==U&&(t+=(null!=a?a:"")+r[o+1]),this._$AH[o]=a}n&&!s&&this.j(t)}j(t){t===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class q extends V{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===U?void 0:t}}const W=f?f.emptyScript:"";class Z extends V{constructor(){super(...arguments),this.type=4}j(t){t&&t!==U?this.element.setAttribute(this.name,W):this.element.removeAttribute(this.name)}}class J extends V{constructor(t,i,e,s,r){super(t,i,e,s,r),this.type=5}_$AI(t,i=this){var e;if((t=null!==(e=F(this,t,i,0))&&void 0!==e?e:U)===R)return;const s=this._$AH,r=t===U&&s!==U||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==U&&(s===U||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class Y{constructor(t,i,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const G=y.litHtmlPolyfillSupport;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2017 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/
|
|
23
|
-
var Q;null==G||G(P,H),(null!==(g=y.litHtmlVersions)&&void 0!==g?g:y.litHtmlVersions=[]).push("2.8.0");const X=window,tt=X.trustedTypes,it=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,et="$lit$",st=`lit$${(Math.random()+"").slice(9)}$`,rt="?"+st,nt=`<${rt}>`,ot=document,at=()=>ot.createComment(""),lt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ht=Array.isArray,dt="[ \t\n\f\r]",ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,vt=/>/g,bt=RegExp(`>|${dt}(?:([^\\s"'>=/]+)(${dt}*=${dt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),pt=/'/g,gt=/"/g,yt=/^(?:script|style|textarea|title)$/i,ft=(t=>(i,...e)=>({_$litType$:t,strings:i,values:e}))(1),mt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),Tt=new WeakMap,xt=ot.createTreeWalker(ot,129,null,!1);function $t(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==it?it.createHTML(i):i}const Et=(t,i)=>{const e=t.length-1,s=[];let r,n=2===i?"<svg>":"",o=ct;for(let i=0;i<e;i++){const e=t[i];let a,l,h=-1,d=0;for(;d<e.length&&(o.lastIndex=d,l=o.exec(e),null!==l);)d=o.lastIndex,o===ct?"!--"===l[1]?o=ut:void 0!==l[1]?o=vt:void 0!==l[2]?(yt.test(l[2])&&(r=RegExp("</"+l[2],"g")),o=bt):void 0!==l[3]&&(o=bt):o===bt?">"===l[0]?(o=null!=r?r:ct,h=-1):void 0===l[1]?h=-2:(h=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?bt:'"'===l[3]?gt:pt):o===gt||o===pt?o=bt:o===ut||o===vt?o=ct:(o=bt,r=void 0);const c=o===bt&&t[i+1].startsWith("/>")?" ":"";n+=o===ct?e+nt:h>=0?(s.push(a),e.slice(0,h)+et+e.slice(h)+st+c):e+st+(-2===h?(s.push(void 0),i):c)}return[$t(t,n+(t[e]||"<?>")+(2===i?"</svg>":"")),s]};class kt{constructor({strings:t,_$litType$:i},e){let s;this.parts=[];let r=0,n=0;const o=t.length-1,a=this.parts,[l,h]=Et(t,i);if(this.el=kt.createElement(l,e),xt.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(s=xt.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const i of s.getAttributeNames())if(i.endsWith(et)||i.startsWith(st)){const e=h[n++];if(t.push(i),void 0!==e){const t=s.getAttribute(e.toLowerCase()+et).split(st),i=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?It:"?"===i[1]?zt:"@"===i[1]?Ot:Dt})}else a.push({type:6,index:r})}for(const i of t)s.removeAttribute(i)}if(yt.test(s.tagName)){const t=s.textContent.split(st),i=t.length-1;if(i>0){s.textContent=tt?tt.emptyScript:"";for(let e=0;e<i;e++)s.append(t[e],at()),xt.nextNode(),a.push({type:2,index:++r});s.append(t[i],at())}}}else if(8===s.nodeType)if(s.data===rt)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(st,t+1));)a.push({type:7,index:r}),t+=st.length-1}r++}}static createElement(t,i){const e=ot.createElement("template");return e.innerHTML=t,e}}function At(t,i,e=t,s){var r,n,o,a;if(i===mt)return i;let l=void 0!==s?null===(r=e._$Co)||void 0===r?void 0:r[s]:e._$Cl;const h=lt(i)?void 0:i._$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,e,s)),void 0!==s?(null!==(o=(a=e)._$Co)&&void 0!==o?o:a._$Co=[])[s]=l:e._$Cl=l),void 0!==l&&(i=At(t,l._$AS(t,i.values),l,s)),i}class Ct{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:e},parts:s}=this._$AD,r=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:ot).importNode(e,!0);xt.currentNode=r;let n=xt.nextNode(),o=0,a=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new St(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new jt(n,this,t)),this._$AV.push(i),l=s[++a]}o!==(null==l?void 0:l.index)&&(n=xt.nextNode(),o++)}return xt.currentNode=ot,r}v(t){let i=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class St{constructor(t,i,e,s){var r;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=s,this._$Cp=null===(r=null==s?void 0:s.isConnected)||void 0===r||r}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=At(this,t,i),lt(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=>ht(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&<(this._$AH)?this._$AA.nextSibling.data=t:this.$(ot.createTextNode(t)),this._$AH=t}g(t){var i;const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=kt.createElement($t(s.h,s.h[0]),this.options)),s);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===r)this._$AH.v(e);else{const t=new Ct(r,this),i=t.u(this.options);t.v(e),this.$(i),this._$AH=t}}_$AC(t){let i=Tt.get(t.strings);return void 0===i&&Tt.set(t.strings,i=new kt(t)),i}T(t){ht(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,s=0;for(const r of t)s===i.length?i.push(e=new St(this.k(at()),this.k(at()),this,this.options)):e=i[s],e._$AI(r),s++;s<i.length&&(this._$AR(e&&e._$AB.nextSibling,s),i.length=s)}_$AR(t=this._$AA.nextSibling,i){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Dt{constructor(t,i,e,s,r){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=s,this.options=r,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,e,s){const r=this.strings;let n=!1;if(void 0===r)t=At(this,t,i,0),n=!lt(t)||t!==this._$AH&&t!==mt,n&&(this._$AH=t);else{const s=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=At(this,s[e+o],i,o),a===mt&&(a=this._$AH[o]),n||(n=!lt(a)||a!==this._$AH[o]),a===wt?t=wt:t!==wt&&(t+=(null!=a?a:"")+r[o+1]),this._$AH[o]=a}n&&!s&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class It extends Dt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const _t=tt?tt.emptyScript:"";class zt extends Dt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,_t):this.element.removeAttribute(this.name)}}class Ot extends Dt{constructor(t,i,e,s,r){super(t,i,e,s,r),this.type=5}_$AI(t,i=this){var e;if((t=null!==(e=At(this,t,i,0))&&void 0!==e?e:wt)===mt)return;const s=this._$AH,r=t===wt&&s!==wt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==wt&&(s===wt||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class jt{constructor(t,i,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){At(this,t)}}const Mt=X.litHtmlPolyfillSupport;null==Mt||Mt(kt,St),(null!==(Q=X.litHtmlVersions)&&void 0!==Q?Q:X.litHtmlVersions=[]).push("2.8.0");
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2017 Google LLC
|
|
27
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
-
*/
|
|
29
|
-
var Rt,Ut;class Lt extends p{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;const e=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=e.firstChild),e}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,e)=>{var s,r;const n=null!==(s=null==e?void 0:e.renderBefore)&&void 0!==s?s:i;let o=n._$litPart$;if(void 0===o){const t=null!==(r=null==e?void 0:e.renderBefore)&&void 0!==r?r:null;n._$litPart$=o=new St(i.insertBefore(at(),t),t,void 0,null!=e?e:{})}return o._$AI(t),o})(i,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}}Lt.finalized=!0,Lt._$litElement$=!0,null===(Rt=globalThis.litElementHydrateSupport)||void 0===Rt||Rt.call(globalThis,{LitElement:Lt});const Nt=globalThis.litElementPolyfillSupport;null==Nt||Nt({LitElement:Lt}),(null!==(Ut=globalThis.litElementVersions)&&void 0!==Ut?Ut:globalThis.litElementVersions=[]).push("3.3.3");
|
|
30
|
-
/**
|
|
31
|
-
* @license
|
|
32
|
-
* Copyright 2017 Google LLC
|
|
33
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/
|
|
35
|
-
const Kt=(t,i)=>"method"===i.kind&&i.descriptor&&!("value"in i.descriptor)?{...i,finisher(e){e.createProperty(i.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:i.key,initializer(){"function"==typeof i.initializer&&(this[i.key]=i.initializer.call(this))},finisher(e){e.createProperty(i.key,t)}};
|
|
36
|
-
/**
|
|
37
|
-
* @license
|
|
38
|
-
* Copyright 2017 Google LLC
|
|
39
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/function Pt(t){return(i,e)=>void 0!==e?((t,i,e)=>{i.constructor.createProperty(e,t)})(t,i,e):Kt(t,i)
|
|
41
|
-
/**
|
|
42
|
-
* @license
|
|
43
|
-
* Copyright 2021 Google LLC
|
|
44
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
-
*/}var Ft;null===(Ft=window.HTMLSlotElement)||void 0===Ft||Ft.prototype.assignedElements;
|
|
46
|
-
/**
|
|
47
|
-
* @license
|
|
48
|
-
* Copyright 2017 Google LLC
|
|
49
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
-
*/
|
|
51
|
-
const Bt=1;class Ht{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,e){this._$Ct=t,this._$AM=i,this._$Ci=e}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}
|
|
52
|
-
/**
|
|
53
|
-
* @license
|
|
54
|
-
* Copyright 2018 Google LLC
|
|
55
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
56
|
-
*/const Vt=(t=>(...i)=>({_$litDirective$:t,values:i}))(class extends Ht{constructor(t){var i;if(super(t),t.type!==Bt||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.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((i=>t[i])).join(" ")+" "}update(t,[i]){var e,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 i)i[t]&&!(null===(e=this.nt)||void 0===e?void 0:e.has(t))&&this.it.add(t);return this.render(i)}const r=t.element.classList;this.it.forEach((t=>{t in i||(r.remove(t),this.it.delete(t))}));for(const t in i){const e=!!i[t];e===this.it.has(t)||(null===(s=this.nt)||void 0===s?void 0:s.has(t))||(e?(r.add(t),this.it.add(t)):(r.remove(t),this.it.delete(t)))}return R}}),qt=((t,...i)=>{const s=1===t.length?t[0]:i.reduce(((i,e,s)=>i+(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.")})(e)+t[s+1]),t[0]);return new r(s,t,e)})`
|
|
1
|
+
import{css as t,LitElement as a,html as r,nothing as e}from"lit";import{property as i,customElement as o}from"lit/decorators.js";import{classMap as n}from"lit/directives/class-map.js";import{NuralyUIBaseMixin as s}from"@nuralyui/common/mixins";const l=t`
|
|
57
2
|
:host {
|
|
58
3
|
display: block;
|
|
59
4
|
height: 100%;
|
|
@@ -380,42 +325,42 @@ const Bt=1;class Ht{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,e)
|
|
|
380
325
|
* @license
|
|
381
326
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
382
327
|
* SPDX-License-Identifier: MIT
|
|
383
|
-
*/,
|
|
328
|
+
*/,d="",c="",b=0,h="label";
|
|
384
329
|
/**
|
|
385
330
|
* @license
|
|
386
331
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
387
332
|
* SPDX-License-Identifier: MIT
|
|
388
333
|
*/
|
|
389
|
-
class
|
|
334
|
+
class u{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,a){console.error(`[TabsController] Error in ${a}:`,t),this.dispatchEvent(new CustomEvent("tabs-error",{detail:{error:t,context:a,timestamp:Date.now(),controller:this.constructor.name},bubbles:!0,composed:!0}))}dispatchEvent(t){try{this._host.dispatchEvent(t)}catch(t){console.error("[TabsController] Failed to dispatch event:",t)}}isValidTabIndex(t){return t>=0&&t<this.host.tabs.length}getTabElement(t){var a;return(null===(a=this.host.shadowRoot)||void 0===a?void 0:a.querySelector(`[data-index="${t}"]`))||null}}
|
|
390
335
|
/**
|
|
391
336
|
* @license
|
|
392
337
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
393
338
|
* SPDX-License-Identifier: MIT
|
|
394
|
-
*/class
|
|
339
|
+
*/class v extends u{constructor(t){super(t),this._host=t,this.keyboardHandler=t=>this.handleKeyDown(t)}get host(){return this._host}hostConnected(){super.hostConnected(),this._host.addEventListener("keydown",this.keyboardHandler)}hostDisconnected(){super.hostDisconnected(),this._host.removeEventListener("keydown",this.keyboardHandler)}handleKeyDown(t){try{if(this.host.disabled)return;const a=t.target.closest(".tab-label");if(!a)return;const r=parseInt(a.getAttribute("data-index")||"0");if(!this.isValidTabIndex(r))return;this.handleTabKeyDown(t,r)}catch(t){this.handleError(t,"handleKeyDown")}}handleTabKeyDown(t,a){try{const r="vertical"!==this.host.orientation;switch(t.key){case"Enter":case" ":t.preventDefault(),this.activateTab(a,t);break;case"ArrowLeft":r&&(t.preventDefault(),this.navigateToPreviousTab(a));break;case"ArrowRight":r&&(t.preventDefault(),this.navigateToNextTab(a));break;case"ArrowUp":r||(t.preventDefault(),this.navigateToPreviousTab(a));break;case"ArrowDown":r||(t.preventDefault(),this.navigateToNextTab(a));break;case"Home":t.preventDefault(),this.navigateToFirstTab();break;case"End":t.preventDefault(),this.navigateToLastTab()}}catch(t){this.handleError(t,"handleTabKeyDown")}}isActivationKey(t){return"Enter"===t.key||" "===t.key}isArrowKey(t){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)}activateTab(t,a){try{this.host.setActiveTab(t,a),this.dispatchEvent(new CustomEvent("tabs-keyboard-activation",{detail:{tabIndex:t,tab:this.host.tabs[t],key:a.key,timestamp:Date.now()},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"activateTab")}}navigateToPreviousTab(t){try{const a=this.getEnabledTabIndices(),r=a.indexOf(t);if(r>0){const t=a[r-1];this.focusTab(t)}else if(a.length>0){const t=a[a.length-1];this.focusTab(t)}}catch(t){this.handleError(t,"navigateToPreviousTab")}}navigateToNextTab(t){try{const a=this.getEnabledTabIndices(),r=a.indexOf(t);if(r<a.length-1){const t=a[r+1];this.focusTab(t)}else if(a.length>0){const t=a[0];this.focusTab(t)}}catch(t){this.handleError(t,"navigateToNextTab")}}navigateToFirstTab(){try{const t=this.getEnabledTabIndices();t.length>0&&this.focusTab(t[0])}catch(t){this.handleError(t,"navigateToFirstTab")}}navigateToLastTab(){try{const t=this.getEnabledTabIndices();t.length>0&&this.focusTab(t[t.length-1])}catch(t){this.handleError(t,"navigateToLastTab")}}focusTab(t){try{const a=this.getTabElement(t);a&&a.focus()}catch(t){this.handleError(t,"focusTab")}}getEnabledTabIndices(){return this.host.tabs.map(((t,a)=>({tab:t,index:a}))).filter((({tab:t})=>!t.disabled)).map((({index:t})=>t))}}
|
|
395
340
|
/**
|
|
396
341
|
* @license
|
|
397
342
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
398
343
|
* SPDX-License-Identifier: MIT
|
|
399
|
-
*/class
|
|
344
|
+
*/class g extends u{constructor(t){super(t),this._host=t,this.dragOverHandler=t=>this.handleDragOver(t)}get host(){return this._host}hostConnected(){super.hostConnected(),this._host.addEventListener("dragover",this.dragOverHandler)}hostDisconnected(){super.hostDisconnected(),this._host.removeEventListener("dragover",this.dragOverHandler)}handleDragStart(t){try{if(!t.dataTransfer)return;const a=t.currentTarget,r=a.dataset.index||"";if(!this.isValidTabIndex(parseInt(r)))return;t.dataTransfer.setData("text/plain",r),t.dataTransfer.effectAllowed="move",a.classList.add("dragging-start"),this.dispatchEvent(new CustomEvent("tabs-drag-start",{detail:{tabIndex:parseInt(r),tab:this.host.tabs[parseInt(r)],timestamp:Date.now()},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"handleDragStart")}}handleDragOver(t){try{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}catch(t){this.handleError(t,"handleDragOver")}}handleDragEnter(t){try{t.preventDefault();const a=t.currentTarget;if(a.contains(t.relatedTarget))return;a.classList.add("dragging")}catch(t){this.handleError(t,"handleDragEnter")}}handleDragLeave(t){try{t.preventDefault();const a=t.currentTarget;if(a.contains(t.relatedTarget))return;a.classList.contains("dragging")&&a.classList.remove("dragging")}catch(t){this.handleError(t,"handleDragLeave")}}handleDrop(t){try{if(t.preventDefault(),!t.dataTransfer)return;const a=t.currentTarget,r=parseInt(t.dataTransfer.getData("text/plain")),e=parseInt(a.dataset.index||"0");this.isValidTabReorder(r,e)&&this.performTabReorder(r,e),this.cleanupDragClasses()}catch(t){this.handleError(t,"handleDrop")}}canMoveTab(){var t,a;return null!==(a=null===(t=this.host.editable)||void 0===t?void 0:t.canMove)&&void 0!==a&&a}isValidTabReorder(t,a){return t!==a&&this.isValidTabIndex(t)&&this.isValidTabIndex(a)&&this.canMoveTab()}performTabReorder(t,a){try{const r=this.host.tabs[t],e=this.host.tabs[a];this.host.dispatchEventWithMetadata("nr-tab-order-change",{sourceIndex:t,targetIndex:a,sourceTab:r,targetTab:e}),this.dispatchEvent(new CustomEvent("tabs-drag-complete",{detail:{sourceIndex:t,targetIndex:a,sourceTab:r,targetTab:e,timestamp:Date.now()},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"performTabReorder")}}cleanupDragClasses(){var t,a;try{const r=this.host.shadowRoot;r&&(null===(t=r.querySelector(".dragging"))||void 0===t||t.classList.remove("dragging"),null===(a=r.querySelector(".dragging-start"))||void 0===a||a.classList.remove("dragging-start"))}catch(t){this.handleError(t,"cleanupDragClasses")}}getDraggableState(){return this.canMoveTab()}}
|
|
400
345
|
/**
|
|
401
346
|
* @license
|
|
402
347
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
403
348
|
* SPDX-License-Identifier: MIT
|
|
404
|
-
*/class
|
|
349
|
+
*/class y extends u{constructor(t){super(t),this._host=t}get host(){return this._host}handleAddTab(){try{if(!this.canAddTab())return void console.warn("[TabsEditableController] Cannot add tab - permission denied");this.host.dispatchEventWithMetadata("nr-tab-add",{}),this.dispatchEvent(new CustomEvent("tabs-add-tab",{detail:{timestamp:Date.now(),totalTabs:this.host.tabs.length},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"handleAddTab")}}handleRemoveTab(t){try{if(!this.isValidTabIndex(t))return void console.warn(`[TabsEditableController] Invalid tab index: ${t}`);const a=this.host.tabs[t];if(!this.canDeleteTab(a))return void console.warn("[TabsEditableController] Cannot delete tab - permission denied");this.host.dispatchEventWithMetadata("nr-tab-remove",{index:t,tab:a}),this.dispatchEvent(new CustomEvent("tabs-remove-tab",{detail:{tabIndex:t,tab:a,timestamp:Date.now(),remainingTabs:this.host.tabs.length-1},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"handleRemoveTab")}}handleEditTab(t,a){try{if(!this.isValidTabIndex(t))return void console.warn(`[TabsEditableController] Invalid tab index: ${t}`);const r=this.host.tabs[t],e=r.label;if(!this.canEditTabTitle(r))return void console.warn("[TabsEditableController] Cannot edit tab title - permission denied");if(a.trim()===e.trim())return;if(!this.isValidTabLabel(a))return void console.warn("[TabsEditableController] Invalid tab label provided");this.host.dispatchEventWithMetadata("nr-tab-edit",{index:t,tab:Object.assign(Object.assign({},r),{label:a.trim()}),oldLabel:e,newLabel:a.trim()}),this.dispatchEvent(new CustomEvent("tabs-edit-tab",{detail:{tabIndex:t,tab:r,oldLabel:e,newLabel:a.trim(),timestamp:Date.now()},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"handleEditTab")}}canAddTab(){var t,a;return null!==(a=null===(t=this.host.editable)||void 0===t?void 0:t.canAddTab)&&void 0!==a&&a}canDeleteTab(t){var a,r,e,i,o,n,s;return t?null!==(o=null!==(e=null!==(a=t.closable)&&void 0!==a?a:null===(r=t.editable)||void 0===r?void 0:r.canDeleteTab)&&void 0!==e?e:null===(i=this.host.editable)||void 0===i?void 0:i.canDeleteTab)&&void 0!==o&&o:null!==(s=null===(n=this.host.editable)||void 0===n?void 0:n.canDeleteTab)&&void 0!==s&&s}canEditTabTitle(t){var a,r,e,i,o,n;return t?null!==(i=null!==(r=null===(a=t.editable)||void 0===a?void 0:a.canEditTabTitle)&&void 0!==r?r:null===(e=this.host.editable)||void 0===e?void 0:e.canEditTabTitle)&&void 0!==i&&i:null!==(n=null===(o=this.host.editable)||void 0===o?void 0:o.canEditTabTitle)&&void 0!==n&&n}canMoveTab(){var t,a;return null!==(a=null===(t=this.host.editable)||void 0===t?void 0:t.canMove)&&void 0!==a&&a}getTabEditableState(t){return{canDelete:this.canDeleteTab(t),canEdit:this.canEditTabTitle(t),canMove:this.canMoveTab()}}isValidTabLabel(t){return"string"==typeof t&&t.trim().length>0&&t.trim().length<=100}getContentEditableAttribute(t){return this.canEditTabTitle(t)?"true":void 0}handleTabTitleBlur(t,a){var r;try{const e=t.target,i=(null===(r=e.textContent)||void 0===r?void 0:r.trim())||"";if(i)this.handleEditTab(a,i);else{const t=this.host.tabs[a];e.textContent=t.label}}catch(t){this.handleError(t,"handleTabTitleBlur")}}handleTabTitleKeyDown(t,a){try{if("Enter"===t.key){t.preventDefault();t.target.blur()}else if("Escape"===t.key){t.preventDefault();const r=this.host.tabs[a],e=t.target;e.textContent=r.label,e.blur()}}catch(t){this.handleError(t,"handleTabTitleKeyDown")}}}
|
|
405
350
|
/**
|
|
406
351
|
* @license
|
|
407
352
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
408
353
|
* SPDX-License-Identifier: MIT
|
|
409
|
-
*/class
|
|
354
|
+
*/class p extends u{constructor(t){super(t),this._host=t}get host(){return this._host}handleTabClick(t,a){try{if(!this.isValidTabIndex(t))return void console.warn(`[TabsEventController] Invalid tab index: ${t}`);const r=this.host.tabs[t];if(r.disabled)return void a.preventDefault();a.preventDefault(),this.host.setActiveTab(t,a),this.host.dispatchEventWithMetadata("nr-tab-click",{index:t,tab:r,originalEvent:a}),this.dispatchTabEvent("tabs-interaction",{type:"click",tabIndex:t,tab:r,timestamp:Date.now(),modifierKeys:{ctrl:a.ctrlKey,shift:a.shiftKey,alt:a.altKey,meta:a.metaKey}})}catch(t){this.handleError(t,"handleTabClick")}}handleTabFocus(t,a){try{if(!this.isValidTabIndex(t))return;const r=this.host.tabs[t];this.dispatchTabEvent("tabs-focus",{tabIndex:t,tab:r,timestamp:Date.now(),originalEvent:a})}catch(t){this.handleError(t,"handleTabFocus")}}handleTabBlur(t,a){try{if(!this.isValidTabIndex(t))return;const r=this.host.tabs[t];this.dispatchTabEvent("tabs-blur",{tabIndex:t,tab:r,timestamp:Date.now(),originalEvent:a})}catch(t){this.handleError(t,"handleTabBlur")}}dispatchTabEvent(t,a){try{this.dispatchEvent(new CustomEvent(t,{detail:a,bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"dispatchTabEvent")}}handleTabChange(t,a,r){try{if(!this.isValidTabIndex(t))return void console.warn(`[TabsEventController] Invalid new tab index: ${t}`);const e=this.host.tabs[t],i=this.isValidTabIndex(a)?this.host.tabs[a]:null;this.dispatchTabEvent("tabs-change",{newTabIndex:t,previousTabIndex:a,newTab:e,previousTab:i,timestamp:Date.now(),originalEvent:r})}catch(t){this.handleError(t,"handleTabChange")}}handleTabActivation(t,a,r){try{if(!this.isValidTabIndex(t))return;const e=this.host.tabs[t];this.dispatchTabEvent("tabs-activation",{tabIndex:t,tab:e,activationType:a,timestamp:Date.now(),originalEvent:r})}catch(t){this.handleError(t,"handleTabActivation")}}handleTabHover(t,a,r){try{if(!this.isValidTabIndex(t))return;const e=this.host.tabs[t];this.dispatchTabEvent(r?"tabs-hover-enter":"tabs-hover-leave",{tabIndex:t,tab:e,timestamp:Date.now(),originalEvent:a})}catch(t){this.handleError(t,"handleTabHover")}}getTabEventListeners(t){return{click:a=>this.handleTabClick(t,a),focus:a=>this.handleTabFocus(t,a),blur:a=>this.handleTabBlur(t,a),mouseenter:a=>this.handleTabHover(t,a,!0),mouseleave:a=>this.handleTabHover(t,a,!1)}}canActivateTab(t){return!t.disabled}getTabInteractionState(t){var a;const r=this.host.tabs[t];return{isActive:t===this.host.activeTab,isDisabled:null!==(a=r.disabled)&&void 0!==a&&a,canActivate:this.canActivateTab(r)}}}
|
|
410
355
|
/**
|
|
411
356
|
* @license
|
|
412
357
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
413
358
|
* SPDX-License-Identifier: MIT
|
|
414
|
-
*/var
|
|
359
|
+
*/var m=function(t,a,r,e){for(var i,o=arguments.length,n=o<3?a:null===e?e=Object.getOwnPropertyDescriptor(a,r):e,s=t.length-1;s>=0;s--)(i=t[s])&&(n=(o<3?i(n):o>3?i(a,r,n):i(a,r))||n);return o>3&&n&&Object.defineProperty(a,r,n),n};let f=class extends(s(a)){constructor(){super(...arguments),this.activeTab=0,this.orientation="horizontal",this.align="left",this.tabSize="medium",this.variant="default",this.tabs=[],this.animated=!0,this.destroyInactiveTabPane=!1,this.tabsAriaLabel="",this.requiredComponents=["nr-icon"],this.keyboardController=new v(this),this.dragDropController=new g(this),this.editableController=new y(this),this.eventController=new p(this)}connectedCallback(){super.connectedCallback(),this.validateDependencies(),this.observeChildrenChanges(),this.keyboardController,this.dragDropController,this.editableController,this.eventController}render(){return r`
|
|
415
360
|
<div
|
|
416
|
-
class=${
|
|
361
|
+
class=${n({"tabs-container":!0,"vertical-align":"vertical"===this.orientation,"horizontal-align":"horizontal"===this.orientation,"right-align":"right"===this.align,"left-align":"left"===this.align,"center-align":"center"===this.align})}
|
|
417
362
|
role="tablist"
|
|
418
|
-
aria-label="${this.tabsAriaLabel||
|
|
363
|
+
aria-label="${this.tabsAriaLabel||e}"
|
|
419
364
|
data-theme="${this.currentTheme}"
|
|
420
365
|
data-size="${this.tabSize}"
|
|
421
366
|
data-type="${this.variant}"
|
|
@@ -432,38 +377,38 @@ class ii{constructor(t){this._host=t,this._host.addController(this)}get host(){r
|
|
|
432
377
|
${this.renderActiveTab()}
|
|
433
378
|
</div>
|
|
434
379
|
</div>
|
|
435
|
-
`}observeChildrenChanges(){new MutationObserver((()=>{this.requestUpdate()})).observe(this,{childList:!0})}renderDeleteIcon(t,
|
|
380
|
+
`}observeChildrenChanges(){new MutationObserver((()=>{this.requestUpdate()})).observe(this,{childList:!0})}renderDeleteIcon(t,a){return this.editableController.canDeleteTab(t)?this.isComponentAvailable("nr-icon")?r`
|
|
436
381
|
<nr-icon
|
|
437
382
|
name="window-close"
|
|
438
383
|
class="close-icon"
|
|
439
|
-
@mousedown=${t=>{t.stopPropagation(),this.editableController.handleRemoveTab(
|
|
384
|
+
@mousedown=${t=>{t.stopPropagation(),this.editableController.handleRemoveTab(a)}}
|
|
440
385
|
></nr-icon>
|
|
441
|
-
`:(console.warn("[nr-tabs] Icon component not available. Delete icon will not render."),
|
|
386
|
+
`:(console.warn("[nr-tabs] Icon component not available. Delete icon will not render."),e):e}renderTabs(){const t=[];for(let a=0;a<this.tabs.length;a++){const i=this.tabs[a],o=a===this.activeTab,s=0===a,l=a===this.tabs.length-1,d=1===this.tabs.length,c=!s&&!l&&!d,b=r`
|
|
442
387
|
<div
|
|
443
|
-
data-index=${
|
|
388
|
+
data-index=${a}
|
|
444
389
|
draggable=${this.dragDropController.getDraggableState()?"true":"false"}
|
|
445
390
|
@dragenter=${t=>this.dragDropController.handleDragEnter(t)}
|
|
446
391
|
@dragleave=${t=>this.dragDropController.handleDragLeave(t)}
|
|
447
392
|
@dragstart=${t=>this.dragDropController.handleDragStart(t)}
|
|
448
393
|
@drop=${t=>this.dragDropController.handleDrop(t)}
|
|
449
|
-
class=${
|
|
394
|
+
class=${n({"tab-label":!0,active:o,disabled:!!i.disabled,"first-tab":s&&"horizontal"===this.orientation,"middle-tab":c&&"horizontal"===this.orientation,"last-tab":l&&"horizontal"===this.orientation,"single-tab":d&&"horizontal"===this.orientation})}
|
|
450
395
|
role="tab"
|
|
451
|
-
aria-selected=${
|
|
452
|
-
aria-disabled=${
|
|
453
|
-
tabindex=${
|
|
454
|
-
@click=${t=>this.eventController.handleTabClick(
|
|
396
|
+
aria-selected=${o?"true":"false"}
|
|
397
|
+
aria-disabled=${i.disabled?"true":"false"}
|
|
398
|
+
tabindex=${o?"0":"-1"}
|
|
399
|
+
@click=${t=>this.eventController.handleTabClick(a,t)}
|
|
455
400
|
>
|
|
456
|
-
${
|
|
401
|
+
${i.icon&&this.isComponentAvailable("nr-icon")?r`<nr-icon name=${i.icon} class="tab-icon"></nr-icon>`:e}
|
|
457
402
|
|
|
458
403
|
<span class="tab-text"
|
|
459
|
-
contenteditable=${this.editableController.getContentEditableAttribute(
|
|
460
|
-
@blur=${t=>this.editableController.handleTabTitleBlur(t,
|
|
461
|
-
@keydown=${t=>this.editableController.handleTabTitleKeyDown(t,
|
|
462
|
-
>${
|
|
404
|
+
contenteditable=${this.editableController.getContentEditableAttribute(i)||e}
|
|
405
|
+
@blur=${t=>this.editableController.handleTabTitleBlur(t,a)}
|
|
406
|
+
@keydown=${t=>this.editableController.handleTabTitleKeyDown(t,a)}
|
|
407
|
+
>${i.label}</span>
|
|
463
408
|
|
|
464
|
-
${this.renderDeleteIcon(
|
|
409
|
+
${this.renderDeleteIcon(i,a)}
|
|
465
410
|
</div>
|
|
466
|
-
`;t.push(
|
|
411
|
+
`;t.push(b)}if(this.editableController.canAddTab()){const a=r`
|
|
467
412
|
<div
|
|
468
413
|
class="tab-label add-tab-label"
|
|
469
414
|
role="button"
|
|
@@ -472,6 +417,6 @@ class ii{constructor(t){this._host=t,this._host.addController(this)}get host(){r
|
|
|
472
417
|
@mousedown=${()=>{this.editableController.handleAddTab()}}
|
|
473
418
|
@keydown=${t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.editableController.handleAddTab())}}
|
|
474
419
|
>
|
|
475
|
-
${this.isComponentAvailable("nr-icon")?
|
|
420
|
+
${this.isComponentAvailable("nr-icon")?r`<nr-icon name="plus" class="add-tab-icon"></nr-icon>`:r`<span>+</span>`}
|
|
476
421
|
</div>
|
|
477
|
-
`;t.push(
|
|
422
|
+
`;t.push(a)}return t}updated(t){super.updated(t),this.activeTab>=this.tabs.length?this.activeTab=Math.max(0,this.tabs.length-1):this.activeTab<0&&(this.activeTab=0)}renderActiveTab(){if(0===this.tabs.length||this.activeTab<0||this.activeTab>=this.tabs.length)return e;const t=this.tabs[this.activeTab];return r`${t.content||e}`}setActiveTab(t,a){var r,e;if(a instanceof MouseEvent){null!==(e=null===(r=this.editable)||void 0===r?void 0:r.canMove)&&void 0!==e&&e||a.preventDefault()}if(t<0||t>=this.tabs.length||this.tabs[t].disabled)return;const i=this.activeTab,o=this.tabs[t];this.activeTab=t,this.dispatchEventWithMetadata("nr-tab-click",{index:t,tab:o,previousIndex:i}),i!==t&&this.dispatchEventWithMetadata("nr-tab-change",{index:t,tab:o,previousIndex:i})}};f.styles=l,m([i({type:Number})],f.prototype,"activeTab",void 0),m([i({type:String})],f.prototype,"orientation",void 0),m([i({type:String})],f.prototype,"align",void 0),m([i({type:String,attribute:"size"})],f.prototype,"tabSize",void 0),m([i({type:String,attribute:"type"})],f.prototype,"variant",void 0),m([i({type:Object})],f.prototype,"editable",void 0),m([i({type:Array})],f.prototype,"tabs",void 0),m([i({type:Boolean})],f.prototype,"animated",void 0),m([i({type:Boolean})],f.prototype,"destroyInactiveTabPane",void 0),m([i({type:String})],f.prototype,"tabsAriaLabel",void 0),f=m([o("nr-tabs")],f);export{b as DEFAULT_ACTIVE_TAB,d as EMPTY_STRING,h as LABEL_ATTRIBUTES,c as NOTHING_STRING,f as NrTabsElement,f as TabsComponent};
|
package/package.json
CHANGED