@oiij/chrome-tabs 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tabs.vue.d.ts +30 -10
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +16 -10
- package/dist/index.js +385 -378
- package/dist/index.umd.cjs +6 -6
- package/package.json +3 -3
package/dist/Tabs.vue.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { TabsProps } from '.';
|
|
2
1
|
import { TabItemKey } from './index';
|
|
3
|
-
type __VLS_Props = TabsProps;
|
|
4
|
-
type __VLS_PublicProps = {
|
|
5
|
-
'value'?: string | number;
|
|
6
|
-
} & __VLS_Props;
|
|
7
2
|
declare function __VLS_template(): {
|
|
8
3
|
attrs: Partial<{}>;
|
|
9
4
|
slots: {
|
|
@@ -16,19 +11,44 @@ declare function __VLS_template(): {
|
|
|
16
11
|
rootEl: HTMLDivElement;
|
|
17
12
|
};
|
|
18
13
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
19
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
declare const __VLS_component: import('vue').DefineComponent<{
|
|
15
|
+
value?: TabItemKey;
|
|
16
|
+
colors?: {
|
|
17
|
+
active?: string;
|
|
18
|
+
primary?: string;
|
|
19
|
+
background?: string;
|
|
20
|
+
};
|
|
21
|
+
dropdown?: boolean;
|
|
22
|
+
addable?: boolean;
|
|
23
|
+
options?: import('.').TabsOption[];
|
|
24
|
+
loadingValue?: TabItemKey;
|
|
25
|
+
contentClass?: string;
|
|
26
|
+
contentStyle?: import('vue').CSSProperties | string;
|
|
27
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
22
28
|
close: (v: TabItemKey, index: number) => any;
|
|
23
29
|
click: (v: TabItemKey, index: number) => any;
|
|
24
30
|
contextmenu: (v: TabItemKey, index: number) => any;
|
|
25
31
|
add: () => any;
|
|
26
|
-
|
|
32
|
+
"update:value": (v?: TabItemKey | null | undefined) => any;
|
|
33
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
34
|
+
value?: TabItemKey;
|
|
35
|
+
colors?: {
|
|
36
|
+
active?: string;
|
|
37
|
+
primary?: string;
|
|
38
|
+
background?: string;
|
|
39
|
+
};
|
|
40
|
+
dropdown?: boolean;
|
|
41
|
+
addable?: boolean;
|
|
42
|
+
options?: import('.').TabsOption[];
|
|
43
|
+
loadingValue?: TabItemKey;
|
|
44
|
+
contentClass?: string;
|
|
45
|
+
contentStyle?: import('vue').CSSProperties | string;
|
|
46
|
+
}> & Readonly<{
|
|
27
47
|
onClose?: ((v: TabItemKey, index: number) => any) | undefined;
|
|
28
48
|
onClick?: ((v: TabItemKey, index: number) => any) | undefined;
|
|
29
49
|
onContextmenu?: ((v: TabItemKey, index: number) => any) | undefined;
|
|
30
50
|
onAdd?: (() => any) | undefined;
|
|
31
|
-
"onUpdate:value"?: ((
|
|
51
|
+
"onUpdate:value"?: ((v?: TabItemKey | null | undefined) => any) | undefined;
|
|
32
52
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
33
53
|
scrollRef: HTMLDivElement;
|
|
34
54
|
}, HTMLDivElement>;
|
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue");function he(e){let t=".",n="__",o="--",i;if(e){let a=e.blockPrefix;a&&(t=a),a=e.elementPrefix,a&&(n=a),a=e.modifierPrefix,a&&(o=a)}const l={install(a){i=a.c;const
|
|
2
|
-
`+Object.entries(e).map(n=>t+` ${
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue");function he(e){let t=".",n="__",o="--",i;if(e){let a=e.blockPrefix;a&&(t=a),a=e.elementPrefix,a&&(n=a),a=e.modifierPrefix,a&&(o=a)}const l={install(a){i=a.c;const h=a.context;h.bem={},h.bem.b=null,h.bem.els=null}};function u(a){let h,v;return{before(p){h=p.bem.b,v=p.bem.els,p.bem.els=null},after(p){p.bem.b=h,p.bem.els=v},$({context:p,props:k}){return a=typeof a=="string"?a:a({context:p,props:k}),p.bem.b=a,`${k?.bPrefix||t}${p.bem.b}`}}}function s(a){let h;return{before(v){h=v.bem.els},after(v){v.bem.els=h},$({context:v,props:p}){return a=typeof a=="string"?a:a({context:v,props:p}),v.bem.els=a.split(",").map(k=>k.trim()),v.bem.els.map(k=>`${p?.bPrefix||t}${v.bem.b}${n}${k}`).join(", ")}}}function m(a){return{$({context:h,props:v}){a=typeof a=="string"?a:a({context:h,props:v});const p=a.split(",").map(B=>B.trim());function k(B){return p.map(me=>`&${v?.bPrefix||t}${h.bem.b}${B!==void 0?`${n}${B}`:""}${o}${me}`).join(", ")}const I=h.bem.els;if(I!==null){if(process.env.NODE_ENV!=="production"&&I.length>=2)throw Error(`[css-render/plugin-bem]: m(${a}) is invalid, using modifier inside multiple elements is not allowed`);return k(I[0])}else return k()}}}function f(a){return{$({context:h,props:v}){a=typeof a=="string"?a:a({context:h,props:v});const p=h.bem.els;if(process.env.NODE_ENV!=="production"&&p!==null&&p.length>=2)throw Error(`[css-render/plugin-bem]: notM(${a}) is invalid, using modifier inside multiple elements is not allowed`);return`&:not(${v?.bPrefix||t}${h.bem.b}${p!==null&&p.length>0?`${n}${p[0]}`:""}${o}${a})`}}}return Object.assign(l,{cB:((...a)=>i(u(a[0]),a[1],a[2])),cE:((...a)=>i(s(a[0]),a[1],a[2])),cM:((...a)=>i(m(a[0]),a[1],a[2])),cNotM:((...a)=>i(f(a[0]),a[1],a[2]))}),l}function pe(e){let t=0;for(let n=0;n<e.length;++n)e[n]==="&"&&++t;return t}const ie=/\s*,(?![^(]*\))\s*/g,ve=/\s+/g;function be(e,t){const n=[];return t.split(ie).forEach(o=>{let i=pe(o);if(i){if(i===1){e.forEach(u=>{n.push(o.replace("&",u))});return}}else{e.forEach(u=>{n.push((u&&u+" ")+o)});return}let l=[o];for(;i--;){const u=[];l.forEach(s=>{e.forEach(m=>{u.push(s.replace("&",m))})}),l=u}l.forEach(u=>n.push(u))}),n}function ge(e,t){const n=[];return t.split(ie).forEach(o=>{e.forEach(i=>{n.push((i&&i+" ")+o)})}),n}function ye(e){let t=[""];return e.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?t=be(t,n):t=ge(t,n))}),t.join(", ").replace(ve," ")}function G(e){if(!e)return;const t=e.parentElement;t&&t.removeChild(e)}function K(e,t){return(t??document.head).querySelector(`style[cssr-id="${e}"]`)}function xe(e){const t=document.createElement("style");return t.setAttribute("cssr-id",e),t}function R(e){return e?/^\s*@(s|m)/.test(e):!1}const ke=/[A-Z]/g;function le(e){return e.replace(ke,t=>"-"+t.toLowerCase())}function $e(e,t=" "){return typeof e=="object"&&e!==null?` {
|
|
2
|
+
`+Object.entries(e).map(n=>t+` ${le(n[0])}: ${n[1]};`).join(`
|
|
3
3
|
`)+`
|
|
4
4
|
`+t+"}":`: ${e};`}function Ce(e,t,n){return typeof e=="function"?e({context:t.context,props:n}):e}function Z(e,t,n,o){if(!t)return"";const i=Ce(t,n,o);if(!i)return"";if(typeof i=="string")return`${e} {
|
|
5
5
|
${i}
|
|
6
6
|
}`;const l=Object.keys(i);if(l.length===0)return n.config.keepEmptyBlock?e+` {
|
|
7
|
-
}`:"";const
|
|
7
|
+
}`:"";const u=e?[e+" {"]:[];return l.forEach(s=>{const m=i[s];if(s==="raw"){u.push(`
|
|
8
8
|
`+m+`
|
|
9
|
-
`);return}
|
|
10
|
-
`)}function
|
|
9
|
+
`);return}s=le(s),m!=null&&u.push(` ${s}${$e(m)}`)}),e&&u.push("}"),u.join(`
|
|
10
|
+
`)}function W(e,t,n){e&&e.forEach(o=>{if(Array.isArray(o))W(o,t,n);else if(typeof o=="function"){const i=o(t);Array.isArray(i)?W(i,t,n):i&&n(i)}else o&&n(o)})}function ue(e,t,n,o,i){const l=e.$;let u="";if(!l||typeof l=="string")R(l)?u=l:t.push(l);else if(typeof l=="function"){const f=l({context:o.context,props:i});R(f)?u=f:t.push(f)}else if(l.before&&l.before(o.context),!l.$||typeof l.$=="string")R(l.$)?u=l.$:t.push(l.$);else if(l.$){const f=l.$({context:o.context,props:i});R(f)?u=f:t.push(f)}const s=ye(t),m=Z(s,e.props,o,i);u?n.push(`${u} {`):m.length&&n.push(m),e.children&&W(e.children,{context:o.context,props:i},f=>{if(typeof f=="string"){const c=Z(s,{raw:f},o,i);n.push(c)}else ue(f,t,n,o,i)}),t.pop(),u&&n.push("}"),l&&l.after&&l.after(o.context)}function we(e,t,n){const o=[];return ue(e,[],o,t,n),o.join(`
|
|
11
11
|
|
|
12
|
-
`)}function Ee(e){for(var t=0,n,o=0,i=e.length;i>=4;++o,i-=4)n=e.charCodeAt(o)&255|(e.charCodeAt(++o)&255)<<8|(e.charCodeAt(++o)&255)<<16|(e.charCodeAt(++o)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(o+2)&255)<<16;case 2:t^=(e.charCodeAt(o+1)&255)<<8;case 1:t^=e.charCodeAt(o)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}typeof window<"u"&&(window.__cssrContext={});function Ne(e,t,n,o){const{els:i}=t;if(n===void 0)i.forEach(G),t.els=[];else{const l=
|
|
12
|
+
`)}function Ee(e){for(var t=0,n,o=0,i=e.length;i>=4;++o,i-=4)n=e.charCodeAt(o)&255|(e.charCodeAt(++o)&255)<<8|(e.charCodeAt(++o)&255)<<16|(e.charCodeAt(++o)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(o+2)&255)<<16;case 2:t^=(e.charCodeAt(o+1)&255)<<8;case 1:t^=e.charCodeAt(o)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}typeof window<"u"&&(window.__cssrContext={});function Ne(e,t,n,o){const{els:i}=t;if(n===void 0)i.forEach(G),t.els=[];else{const l=K(n,o);l&&i.includes(l)&&(G(l),t.els=i.filter(u=>u!==l))}}function U(e,t){e.push(t)}function Ie(e,t,n,o,i,l,u,s,m){let f;if(n===void 0&&(f=t.render(o),n=Ee(f)),m){m.adapter(n,f??t.render(o));return}s===void 0&&(s=document.head);const c=K(n,s);if(c!==null&&!l)return c;const d=c??xe(n);if(f===void 0&&(f=t.render(o)),d.textContent=f,c!==null)return c;if(u){const b=s.querySelector(`meta[name="${u}"]`);if(b)return s.insertBefore(d,b),U(t.els,d),d}return i?s.insertBefore(d,s.querySelector("style, link")):s.appendChild(d),U(t.els,d),d}function Be(e){return we(this,this.instance,e)}function Se(e={}){const{id:t,ssr:n,props:o,head:i=!1,force:l=!1,anchorMetaName:u,parent:s}=e;return Ie(this.instance,this,t,o,i,l,u,s,n)}function Ve(e={}){const{id:t,parent:n}=e;Ne(this.instance,this,t,n)}const z=function(e,t,n,o){return{instance:e,$:t,props:n,children:o,els:[],render:Be,mount:Se,unmount:Ve}},Me=function(e,t,n,o){return Array.isArray(t)?z(e,{$:null},null,t):Array.isArray(n)?z(e,t,null,n):Array.isArray(o)?z(e,t,n,o):z(e,t,n,null)};function Ae(e={}){const t={c:((...n)=>Me(t,...n)),use:(n,...o)=>n.install(t,...o),find:K,context:{},config:e};return t}function Re(e){const{namespace:t="n",blockPrefix:n=`.${t}-`,elementPrefix:o="__",modifierPrefix:i="--"}=e??{},l=Ae(),u=he({blockPrefix:n,elementPrefix:o,modifierPrefix:i});return l.use(u),{namespace:t,blockPrefix:n,elementPrefix:o,modifierPrefix:i,cssr:l,plugin:u}}const ze="@css-render/vue3-ssr";function Le(e,t){return`<style cssr-id="${e}">
|
|
13
13
|
${t}
|
|
14
|
-
</style>`}function je(e,t,n){const{styles:o,ids:i}=n;i.has(e)||o!==null&&(i.add(e),o.push(Le(e,t)))}const Te=typeof document<"u";function Pe(){if(Te)return;const e=r.inject(ze,null);if(e!==null)return{adapter:(t,n)=>je(t,n,e),context:e}}function Oe(e,t){const n=Pe();function o(){t.mount({id:e,head:!0,ssr:n})}n?o():r.onBeforeMount(()=>{o()})}function ae(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}const De=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const _e=Object.prototype.toString,He=e=>_e.call(e)==="[object Object]",Y=()=>{};function We(e,t){function n(...o){return new Promise((i,l)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(l)})}return n}function Fe(e,t={}){let n,o,i=Y;const l=m=>{clearTimeout(m),i(),i=Y};let s;return m=>{const d=r.toValue(e),f=r.toValue(t.maxWait);return n&&l(n),d<=0||f!==void 0&&f<=0?(o&&(l(o),o=void 0),Promise.resolve(m())):new Promise((c,b)=>{i=t.rejectOnCancel?b:c,s=m,f&&!o&&(o=setTimeout(()=>{n&&l(n),o=void 0,c(s())},f)),n=setTimeout(()=>{o&&l(o),o=void 0,c(m())},d)})}}function P(e){return Array.isArray(e)?e:[e]}function qe(e){return r.getCurrentInstance()}function Ke(e,t=200,n={}){return We(Fe(t,n),e)}function Ge(e,t=!0,n){qe()?r.onMounted(e,n):t?e():r.nextTick(e)}function Ze(e,t,n){return r.watch(e,t,{...n,immediate:!0})}const K=De?window:void 0;function I(e){var t;const n=r.toValue(e);return(t=n?.$el)!=null?t:n}function Ue(...e){const t=[],n=()=>{t.forEach(u=>u()),t.length=0},o=(u,m,d,f)=>(u.addEventListener(m,d,f),()=>u.removeEventListener(m,d,f)),i=r.computed(()=>{const u=P(r.toValue(e[0])).filter(m=>m!=null);return u.every(m=>typeof m!="string")?u:void 0}),l=Ze(()=>{var u,m;return[(m=(u=i.value)==null?void 0:u.map(d=>I(d)))!=null?m:[K].filter(d=>d!=null),P(r.toValue(i.value?e[1]:e[0])),P(r.unref(i.value?e[2]:e[1])),r.toValue(i.value?e[3]:e[2])]},([u,m,d,f])=>{if(n(),!u?.length||!m?.length||!d?.length)return;const c=He(f)?{...f}:f;t.push(...u.flatMap(b=>m.flatMap(E=>d.map(a=>o(b,E,a,c)))))},{flush:"post"}),s=()=>{l(),n()};return ae(n),s}function Ye(){const e=r.shallowRef(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function Je(e){const t=Ye();return r.computed(()=>(t.value,!!e()))}function Qe(e,t,n={}){const{window:o=K,...i}=n;let l;const s=Je(()=>o&&"ResizeObserver"in o),u=()=>{l&&(l.disconnect(),l=void 0)},m=r.computed(()=>{const c=r.toValue(e);return Array.isArray(c)?c.map(b=>I(b)):[I(c)]}),d=r.watch(m,c=>{if(u(),s.value&&o){l=new ResizeObserver(t);for(const b of c)b&&l.observe(b,i)}},{immediate:!0,flush:"post"}),f=()=>{u(),d()};return ae(f),{isSupported:s,stop:f}}function Xe(e,t={width:0,height:0},n={}){const{window:o=K,box:i="content-box"}=n,l=r.computed(()=>{var c,b;return(b=(c=I(e))==null?void 0:c.namespaceURI)==null?void 0:b.includes("svg")}),s=r.shallowRef(t.width),u=r.shallowRef(t.height),{stop:m}=Qe(e,([c])=>{const b=i==="border-box"?c.borderBoxSize:i==="content-box"?c.contentBoxSize:c.devicePixelContentBoxSize;if(o&&l.value){const E=I(e);if(E){const a=E.getBoundingClientRect();s.value=a.width,u.value=a.height}}else if(b){const E=P(b);s.value=E.reduce((a,{inlineSize:v})=>a+v,0),u.value=E.reduce((a,{blockSize:v})=>a+v,0)}else s.value=c.contentRect.width,u.value=c.contentRect.height},n);Ge(()=>{const c=I(e);c&&(s.value="offsetWidth"in c?c.offsetWidth:t.width,u.value="offsetHeight"in c?c.offsetHeight:t.height)});const d=r.watch(()=>I(e),c=>{s.value=c?t.width:0,u.value=c?t.height:0});function f(){m(),d()}return{width:s,height:u,stop:f}}function et(e){const{activeClassName:t=".active",enableWheel:n=!0,direction:o="vertical"}=e??{},i=r.ref(),{width:l,height:s}=Xe(i);async function u(f){await r.nextTick();const c=i.value?.querySelector(t);c&&c.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest",...f})}function m(f){if(!n)return;f.preventDefault();const{deltaY:c}=f;switch(o){case"vertical":i.value?.scrollBy({top:c>0?s.value:-s.value,behavior:"smooth"});break;case"horizontal":i.value?.scrollBy({left:c>0?l.value:-l.value,behavior:"smooth"});break}}Ue(i,"wheel",m);const d=Ke(u,500);return r.watch([l,s],()=>{d()}),{scrollRef:i,scrollToView:u}}var tt={grad:.9,turn:360,rad:360/(2*Math.PI)},B=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},k=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},w=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},ce=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},J=function(e){return{r:w(e.r,0,255),g:w(e.g,0,255),b:w(e.b,0,255),a:w(e.a)}},D=function(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}},nt=/^#([0-9a-f]{3,8})$/i,j=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},de=function(e){var t=e.r,n=e.g,o=e.b,i=e.a,l=Math.max(t,n,o),s=l-Math.min(t,n,o),u=s?l===t?(n-o)/s:l===n?2+(o-t)/s:4+(t-n)/s:0;return{h:60*(u<0?u+6:u),s:l?s/l*100:0,v:l/255*100,a:i}},fe=function(e){var t=e.h,n=e.s,o=e.v,i=e.a;t=t/360*6,n/=100,o/=100;var l=Math.floor(t),s=o*(1-n),u=o*(1-(t-l)*n),m=o*(1-(1-t+l)*n),d=l%6;return{r:255*[o,u,s,s,m,o][d],g:255*[m,o,o,u,s,s][d],b:255*[s,s,m,o,o,u][d],a:i}},Q=function(e){return{h:ce(e.h),s:w(e.s,0,100),l:w(e.l,0,100),a:w(e.a)}},X=function(e){return{h:k(e.h),s:k(e.s),l:k(e.l),a:k(e.a,3)}},ee=function(e){return fe((n=(t=e).s,{h:t.h,s:(n*=((o=t.l)<50?o:100-o)/100)>0?2*n/(o+n)*100:0,v:o+n,a:t.a}));var t,n,o},A=function(e){return{h:(t=de(e)).h,s:(i=(200-(n=t.s))*(o=t.v)/100)>0&&i<200?n*o/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,o,i},ot=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,it=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,te={string:[[function(e){var t=nt.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?k(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?k(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=it.exec(e)||lt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:J({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ot.exec(e)||rt.exec(e);if(!t)return null;var n,o,i=Q({h:(n=t[1],o=t[2],o===void 0&&(o="deg"),Number(n)*(tt[o]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ee(i)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,o=e.b,i=e.a,l=i===void 0?1:i;return B(t)&&B(n)&&B(o)?J({r:Number(t),g:Number(n),b:Number(o),a:Number(l)}):null},"rgb"],[function(e){var t=e.h,n=e.s,o=e.l,i=e.a,l=i===void 0?1:i;if(!B(t)||!B(n)||!B(o))return null;var s=Q({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return ee(s)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,i=e.a,l=i===void 0?1:i;if(!B(t)||!B(n)||!B(o))return null;var s=(function(u){return{h:ce(u.h),s:w(u.s,0,100),v:w(u.v,0,100),a:w(u.a)}})({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return fe(s)},"hsv"]]},ne=function(e,t){for(var n=0;n<t.length;n++){var o=t[n][0](e);if(o)return[o,t[n][1]]}return[null,void 0]},st=function(e){return typeof e=="string"?ne(e.trim(),te.string):typeof e=="object"&&e!==null?ne(e,te.object):[null,void 0]},_=function(e,t){var n=A(e);return{h:n.h,s:w(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},oe=function(e,t){var n=A(e);return{h:n.h,s:n.s,l:w(n.l+100*t,0,100),a:n.a}},re=(function(){function e(t){this.parsed=st(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return k(H(this.rgba),2)},e.prototype.isDark=function(){return H(this.rgba)<.5},e.prototype.isLight=function(){return H(this.rgba)>=.5},e.prototype.toHex=function(){return t=D(this.rgba),n=t.r,o=t.g,i=t.b,s=(l=t.a)<1?j(k(255*l)):"","#"+j(n)+j(o)+j(i)+s;var t,n,o,i,l,s},e.prototype.toRgb=function(){return D(this.rgba)},e.prototype.toRgbString=function(){return t=D(this.rgba),n=t.r,o=t.g,i=t.b,(l=t.a)<1?"rgba("+n+", "+o+", "+i+", "+l+")":"rgb("+n+", "+o+", "+i+")";var t,n,o,i,l},e.prototype.toHsl=function(){return X(A(this.rgba))},e.prototype.toHslString=function(){return t=X(A(this.rgba)),n=t.h,o=t.s,i=t.l,(l=t.a)<1?"hsla("+n+", "+o+"%, "+i+"%, "+l+")":"hsl("+n+", "+o+"%, "+i+"%)";var t,n,o,i,l},e.prototype.toHsv=function(){return t=de(this.rgba),{h:k(t.h),s:k(t.s),v:k(t.v),a:k(t.a,3)};var t},e.prototype.invert=function(){return C({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),C(_(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),C(_(this.rgba,-t))},e.prototype.grayscale=function(){return C(_(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),C(oe(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),C(oe(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?C({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):k(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=A(this.rgba);return typeof t=="number"?C({h:t,s:n.s,l:n.l,a:n.a}):k(n.h)},e.prototype.isEqual=function(t){return this.toHex()===C(t).toHex()},e})(),C=function(e){return e instanceof re?e:new re(e)};const{cssr:ut,plugin:at,namespace:me}=Re(),{c:g,cB:T,cE:x,cM:W,cNotM:ie}={...ut,...at},V=`${me}-chrome-tabs`,$=`${me}-chrome-tabs-item`,M="all .2s cubic-bezier(.4, 0, .2, 1)";function ct(){return g([T("chrome-tabs",{display:"flex",width:"100%",height:"40px",padding:"0 10px",alignItems:"center",backgroundColor:"var(--background-color)",color:"var(--background-color-dark)"},[g("div",{boxSizing:"border-box"}),g(".group-move, .group-enter-active, .group-leave-active",{transition:M}),g(".group-enter-from, .group-leave-to",{opacity:0}),g(".group-leave-active",{}),x("prefix",{}),x("icon",{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",padding:"5px",borderRadius:"10px",backgroundColor:"var(--active-background-color)",transition:M},[g("svg",{width:"100%",height:"100%",fill:"currentColor"}),g("&:hover",{backgroundColor:"var(--primary-color)"})]),x("content",{flex:"1",height:"100%",minWidth:0,overflow:"hidden",marginLeft:"-6px",padding:"0 10px"}),x("scroll",{position:"relative",display:"flex",alignItems:"center",height:"100%"},[x("icon",{marginLeft:"5px",borderRadius:"50%",backgroundColor:"transparent",flexShrink:0},[g("&:hover",{backgroundColor:"var(--primary-color)"})])]),x("suffix",{})]),T("chrome-tabs-item",{position:"relative",margin:"0 -5px",height:"100%",flexShrink:0,cursor:"default",userSelect:"none",padding:"6px 10px 0px 10px"},[W("disabled",{cursor:"not-allowed",pointerEvents:"none",opacity:.5,filter:"grayscale(0.5)"}),W("active",[x("background",{opacity:1})]),ie("active",[g("&:hover",{},[x("content",{backgroundColor:"var(--primary-color)"})])]),g("&::first-child",{marginLeft:"0 !important"}),g("&::last-child",{marginRight:"0 !important"}),x("content",{position:"relative",zIndex:1,height:"28px",display:"flex",alignItems:"center",gap:"5px",borderRadius:"10px",padding:"0 10px",transition:M}),x("slot",{}),x("icon",{lineHeight:1},[g("svg",{width:"1.2em",height:"1.2em",fill:"currentColor"})]),x("close",{width:"16px",height:"16px",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",transition:M},[g("&:hover",{backgroundColor:"rgba(0,0,0,0.1)"}),g("svg",{width:"100%",height:"100%",fill:"currentColor"})]),x("background",{position:"absolute",opacity:0,left:0,bottom:0,zIndex:0,height:"34px",width:"100%",display:"flex",alignItems:"flex-end",transition:M},[x("block",{height:"100%",flex:1,minWidth:0,borderRadius:"10px 10px 0 0",backgroundColor:"var(--active-background-color)"}),g("svg",{fill:"var(--active-background-color)"})]),x("line",{position:"absolute",bottom:"12px",right:"4px",height:"16px",width:"2px",borderRadius:"1px",transition:M,backgroundColor:"var(--primary-color)",opacity:0},[W("show",{opacity:1})])]),g(".dark",[T("chrome-tabs",{backgroundColor:"var(--background-color-dark)",color:"var(--background-color)"},[x("icon",{backgroundColor:"var(--active-background-color-dark)"},[g("&:hover",{backgroundColor:"var(--primary-color-dark)"})])]),T("chrome-tabs-item",{},[ie("active",[g("&:hover",{},[x("content",{backgroundColor:"var(--primary-color-dark)"})])]),x("background",{},[x("block",{backgroundColor:"var(--active-background-color-dark)"}),g("svg",{fill:"var(--active-background-color-dark)"})])])])])}const O=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},dt={name:"RiAddLine"},ft={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function mt(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",ft,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)]))}const ht=O(dt,[["render",mt]]),pt={name:"RiArrowDropDownLine"},vt={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function bt(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",vt,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"m12 15l-4.243-4.242l1.415-1.414L12 12.172l2.828-2.828l1.415 1.414z"},null,-1)]))}const gt=O(pt,[["render",bt]]),xt={name:"LineMdLoadingTwotoneLoop"},yt={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function kt(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",yt,t[0]||(t[0]=[r.createStaticVNode('<g fill="none" stroke="#757575" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="16" stroke-dashoffset="16" d="M12 3c4.97 0 9 4.03 9 9"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="16;0"></animate><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"></animateTransform></path><path stroke-dasharray="64" stroke-dashoffset="64" stroke-opacity=".3" d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.2s" values="64;0"></animate></path></g>',1)]))}const $t=O(xt,[["render",kt]]),Ct={name:"RiCloseLine"},wt={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Et(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",wt,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z"},null,-1)]))}const Nt=O(Ct,[["render",Et]]),Bt=r.defineComponent({__name:"TabItem",props:{label:{type:[String,Function]},icon:{type:Function},closable:{type:Boolean},disabled:{type:Boolean},loading:{type:Boolean},loadingIcon:{type:Function},onClick:{type:Function},onContextMenu:{type:Function},onClose:{type:Function},activeIndex:{default:0},itemIndex:{},itemKey:{}},emits:["itemClick","itemContextmenu","itemClose"],setup(e,{emit:t}){const n=t,o=r.computed(()=>e.activeIndex!==e.itemIndex&&e.activeIndex!==e.itemIndex-1),i=r.computed(()=>e.activeIndex===e.itemIndex),l=r.computed(()=>typeof e.label=="string"?r.h("span",{class:`${$}__label`},e.label):e.label(e.itemKey,e.itemIndex)),s=r.computed(()=>e.loadingIcon?.(e.itemKey,e.itemIndex)??r.h($t));function u(f){f.stopPropagation(),n("itemClick",f),e.onClick?.(e.itemKey,e.itemIndex,f)}function m(f){n("itemContextmenu",f),e.onContextMenu?.(e.itemKey,e.itemIndex,f)}function d(f){n("itemClose"),e.onClose?.(e.itemKey,e.itemIndex,f)}return(f,c)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref($),{[`${r.unref($)}--active`]:i.value,[`${r.unref($)}--disabled`]:f.disabled}]),onClick:u,onContextmenu:m},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__content`])},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__icon`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f.loading?s.value:f.icon?.(f.itemKey,f.itemIndex)??void 0)))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__slot`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(l.value)))],2),f.closable?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref($)}__close`]),onClick:r.withModifiers(d,["stop"])},[r.createVNode(Nt)],2)):r.createCommentVNode("",!0)],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__background`])},[c[0]||(c[0]=r.createElementVNode("svg",{width:"10",height:"10"},[r.createElementVNode("path",{d:"M 0 10 A 10 10 0 0 0 10 0 L 10 10 Z"})],-1)),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__block`])},null,2),c[1]||(c[1]=r.createElementVNode("svg",{width:"10",height:"10"},[r.createElementVNode("path",{d:"M 0 0 A 10 10 0 0 0 10 10 L 0 10 Z"})],-1))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__line`,o.value?`${r.unref($)}__line--show`:""])},null,2)],34))}}),It=r.defineComponent({__name:"Tabs",props:r.mergeModels({colors:{},dropdown:{type:Boolean},addable:{type:Boolean},options:{}},{value:{},valueModifiers:{}}),emits:r.mergeModels(["click","contextmenu","close","add"],["update:value"]),setup(e,{emit:t}){const n=t;Oe("n-chrome-tabs",ct());const{background:o="#E5E7EB",active:i="#fff",primary:l="rgba(251,191,36,1)"}=e.colors??{},s=r.useModel(e,"value"),u=r.computed(()=>e.options?.findIndex(h=>h.key===s.value)),{scrollRef:m,scrollToView:d}=et({activeClassName:`.${$}--active`,direction:"horizontal"});r.watch(s,()=>{d()},{immediate:!0});const f=r.computed(()=>C(o).darken(.9).toHex()),c=r.computed(()=>C(i).darken(.8).toHex()),b=r.computed(()=>C(l).darken(.3).toHex());function E(h,p){n("click",h,p)}function a(h,p){n("contextmenu",h,p)}function v(h,p){n("close",h,p)}return(h,p)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref(V)]),style:r.normalizeStyle({"--background-color":`${r.unref(o)}`,"--background-color-dark":`${f.value}`,"--active-background-color":`${r.unref(i)}`,"--active-background-color-dark":`${c.value}`,"--primary-color":`${r.unref(l)}`,"--primary-color-dark":`${b.value}`})},[h.dropdown?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref(V)}__icon`])},[r.createVNode(gt)],2)):r.createCommentVNode("",!0),r.renderSlot(h.$slots,"prefix"),r.createElementVNode("div",{ref_key:"scrollRef",ref:m,class:r.normalizeClass([`${r.unref(V)}__content`])},[r.createVNode(r.TransitionGroup,{name:"group",tag:"div",class:r.normalizeClass([`${r.unref(V)}__scroll`])},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(h.options,({key:y,...S},N)=>(r.openBlock(),r.createBlock(Bt,r.mergeProps({key:y},{ref_for:!0},S,{"item-key":y,"item-index":N,"active-index":u.value,onItemClick:R=>E(y,N),onItemContextmenu:R=>a(y,N),onItemClose:R=>v(y,N)}),null,16,["item-key","item-index","active-index","onItemClick","onItemContextmenu","onItemClose"]))),128))]),_:1},8,["class"])],2),r.renderSlot(h.$slots,"suffix"),h.addable?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass([`${r.unref(V)}__icon`]),onClick:p[0]||(p[0]=y=>n("add"))},[r.createVNode(ht)],2)):r.createCommentVNode("",!0)],6))}});exports.CTabs=It;
|
|
14
|
+
</style>`}function je(e,t,n){const{styles:o,ids:i}=n;i.has(e)||o!==null&&(i.add(e),o.push(Le(e,t)))}const Te=typeof document<"u";function Pe(){if(Te)return;const e=r.inject(ze,null);if(e!==null)return{adapter:(t,n)=>je(t,n,e),context:e}}function Oe(e,t){const n=Pe();function o(){t.mount({id:e,head:!0,ssr:n})}n?o():r.onBeforeMount(()=>{o()})}function se(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}const De=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Fe=Object.prototype.toString,He=e=>Fe.call(e)==="[object Object]",Y=()=>{};function We(e,t){function n(...o){return new Promise((i,l)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(l)})}return n}function Ke(e,t={}){let n,o,i=Y;const l=m=>{clearTimeout(m),i(),i=Y};let u;return m=>{const f=r.toValue(e),c=r.toValue(t.maxWait);return n&&l(n),f<=0||c!==void 0&&c<=0?(o&&(l(o),o=void 0),Promise.resolve(m())):new Promise((d,b)=>{i=t.rejectOnCancel?b:d,u=m,c&&!o&&(o=setTimeout(()=>{n&&l(n),o=void 0,d(u())},c)),n=setTimeout(()=>{o&&l(o),o=void 0,d(m())},f)})}}function T(e){return Array.isArray(e)?e:[e]}function qe(e){return r.getCurrentInstance()}function Ge(e,t=200,n={}){return We(Ke(t,n),e)}function Ze(e,t=!0,n){qe()?r.onMounted(e,n):t?e():r.nextTick(e)}function Ue(e,t,n){return r.watch(e,t,{...n,immediate:!0})}const q=De?window:void 0;function S(e){var t;const n=r.toValue(e);return(t=n?.$el)!=null?t:n}function Ye(...e){const t=[],n=()=>{t.forEach(s=>s()),t.length=0},o=(s,m,f,c)=>(s.addEventListener(m,f,c),()=>s.removeEventListener(m,f,c)),i=r.computed(()=>{const s=T(r.toValue(e[0])).filter(m=>m!=null);return s.every(m=>typeof m!="string")?s:void 0}),l=Ue(()=>{var s,m;return[(m=(s=i.value)==null?void 0:s.map(f=>S(f)))!=null?m:[q].filter(f=>f!=null),T(r.toValue(i.value?e[1]:e[0])),T(r.unref(i.value?e[2]:e[1])),r.toValue(i.value?e[3]:e[2])]},([s,m,f,c])=>{if(n(),!s?.length||!m?.length||!f?.length)return;const d=He(c)?{...c}:c;t.push(...s.flatMap(b=>m.flatMap(E=>f.map(a=>o(b,E,a,d)))))},{flush:"post"}),u=()=>{l(),n()};return se(n),u}function Je(){const e=r.shallowRef(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function Qe(e){const t=Je();return r.computed(()=>(t.value,!!e()))}function Xe(e,t,n={}){const{window:o=q,...i}=n;let l;const u=Qe(()=>o&&"ResizeObserver"in o),s=()=>{l&&(l.disconnect(),l=void 0)},m=r.computed(()=>{const d=r.toValue(e);return Array.isArray(d)?d.map(b=>S(b)):[S(d)]}),f=r.watch(m,d=>{if(s(),u.value&&o){l=new ResizeObserver(t);for(const b of d)b&&l.observe(b,i)}},{immediate:!0,flush:"post"}),c=()=>{s(),f()};return se(c),{isSupported:u,stop:c}}function _e(e,t={width:0,height:0},n={}){const{window:o=q,box:i="content-box"}=n,l=r.computed(()=>{var d,b;return(b=(d=S(e))==null?void 0:d.namespaceURI)==null?void 0:b.includes("svg")}),u=r.shallowRef(t.width),s=r.shallowRef(t.height),{stop:m}=Xe(e,([d])=>{const b=i==="border-box"?d.borderBoxSize:i==="content-box"?d.contentBoxSize:d.devicePixelContentBoxSize;if(o&&l.value){const E=S(e);if(E){const a=E.getBoundingClientRect();u.value=a.width,s.value=a.height}}else if(b){const E=T(b);u.value=E.reduce((a,{inlineSize:h})=>a+h,0),s.value=E.reduce((a,{blockSize:h})=>a+h,0)}else u.value=d.contentRect.width,s.value=d.contentRect.height},n);Ze(()=>{const d=S(e);d&&(u.value="offsetWidth"in d?d.offsetWidth:t.width,s.value="offsetHeight"in d?d.offsetHeight:t.height)});const f=r.watch(()=>S(e),d=>{u.value=d?t.width:0,s.value=d?t.height:0});function c(){m(),f()}return{width:u,height:s,stop:c}}function et(e){const{activeClassName:t=".active",enableWheel:n=!0,direction:o="vertical"}=e??{},i=r.ref(),{width:l,height:u}=_e(i);async function s(c){await r.nextTick();const d=i.value?.querySelector(t);d&&d.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest",...c})}function m(c){if(!n)return;c.preventDefault();const{deltaY:d}=c;switch(o){case"vertical":i.value?.scrollBy({top:d>0?u.value:-u.value,behavior:"smooth"});break;case"horizontal":i.value?.scrollBy({left:d>0?l.value:-l.value,behavior:"smooth"});break}}Ye(i,"wheel",m);const f=Ge(s,500);return r.watch([l,u],()=>{f()}),{scrollRef:i,scrollToView:s}}var tt={grad:.9,turn:360,rad:360/(2*Math.PI)},N=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},x=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},w=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},ae=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},J=function(e){return{r:w(e.r,0,255),g:w(e.g,0,255),b:w(e.b,0,255),a:w(e.a)}},O=function(e){return{r:x(e.r),g:x(e.g),b:x(e.b),a:x(e.a,3)}},nt=/^#([0-9a-f]{3,8})$/i,L=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},ce=function(e){var t=e.r,n=e.g,o=e.b,i=e.a,l=Math.max(t,n,o),u=l-Math.min(t,n,o),s=u?l===t?(n-o)/u:l===n?2+(o-t)/u:4+(t-n)/u:0;return{h:60*(s<0?s+6:s),s:l?u/l*100:0,v:l/255*100,a:i}},de=function(e){var t=e.h,n=e.s,o=e.v,i=e.a;t=t/360*6,n/=100,o/=100;var l=Math.floor(t),u=o*(1-n),s=o*(1-(t-l)*n),m=o*(1-(1-t+l)*n),f=l%6;return{r:255*[o,s,u,u,m,o][f],g:255*[m,o,o,s,u,u][f],b:255*[u,u,m,o,o,s][f],a:i}},Q=function(e){return{h:ae(e.h),s:w(e.s,0,100),l:w(e.l,0,100),a:w(e.a)}},X=function(e){return{h:x(e.h),s:x(e.s),l:x(e.l),a:x(e.a,3)}},_=function(e){return de((n=(t=e).s,{h:t.h,s:(n*=((o=t.l)<50?o:100-o)/100)>0?2*n/(o+n)*100:0,v:o+n,a:t.a}));var t,n,o},A=function(e){return{h:(t=ce(e)).h,s:(i=(200-(n=t.s))*(o=t.v)/100)>0&&i<200?n*o/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,o,i},ot=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,it=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ee={string:[[function(e){var t=nt.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?x(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?x(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=it.exec(e)||lt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:J({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ot.exec(e)||rt.exec(e);if(!t)return null;var n,o,i=Q({h:(n=t[1],o=t[2],o===void 0&&(o="deg"),Number(n)*(tt[o]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return _(i)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,o=e.b,i=e.a,l=i===void 0?1:i;return N(t)&&N(n)&&N(o)?J({r:Number(t),g:Number(n),b:Number(o),a:Number(l)}):null},"rgb"],[function(e){var t=e.h,n=e.s,o=e.l,i=e.a,l=i===void 0?1:i;if(!N(t)||!N(n)||!N(o))return null;var u=Q({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return _(u)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,i=e.a,l=i===void 0?1:i;if(!N(t)||!N(n)||!N(o))return null;var u=(function(s){return{h:ae(s.h),s:w(s.s,0,100),v:w(s.v,0,100),a:w(s.a)}})({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return de(u)},"hsv"]]},te=function(e,t){for(var n=0;n<t.length;n++){var o=t[n][0](e);if(o)return[o,t[n][1]]}return[null,void 0]},ut=function(e){return typeof e=="string"?te(e.trim(),ee.string):typeof e=="object"&&e!==null?te(e,ee.object):[null,void 0]},D=function(e,t){var n=A(e);return{h:n.h,s:w(n.s+100*t,0,100),l:n.l,a:n.a}},F=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},ne=function(e,t){var n=A(e);return{h:n.h,s:n.s,l:w(n.l+100*t,0,100),a:n.a}},oe=(function(){function e(t){this.parsed=ut(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return x(F(this.rgba),2)},e.prototype.isDark=function(){return F(this.rgba)<.5},e.prototype.isLight=function(){return F(this.rgba)>=.5},e.prototype.toHex=function(){return t=O(this.rgba),n=t.r,o=t.g,i=t.b,u=(l=t.a)<1?L(x(255*l)):"","#"+L(n)+L(o)+L(i)+u;var t,n,o,i,l,u},e.prototype.toRgb=function(){return O(this.rgba)},e.prototype.toRgbString=function(){return t=O(this.rgba),n=t.r,o=t.g,i=t.b,(l=t.a)<1?"rgba("+n+", "+o+", "+i+", "+l+")":"rgb("+n+", "+o+", "+i+")";var t,n,o,i,l},e.prototype.toHsl=function(){return X(A(this.rgba))},e.prototype.toHslString=function(){return t=X(A(this.rgba)),n=t.h,o=t.s,i=t.l,(l=t.a)<1?"hsla("+n+", "+o+"%, "+i+"%, "+l+")":"hsl("+n+", "+o+"%, "+i+"%)";var t,n,o,i,l},e.prototype.toHsv=function(){return t=ce(this.rgba),{h:x(t.h),s:x(t.s),v:x(t.v),a:x(t.a,3)};var t},e.prototype.invert=function(){return C({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),C(D(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),C(D(this.rgba,-t))},e.prototype.grayscale=function(){return C(D(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),C(ne(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),C(ne(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?C({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):x(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=A(this.rgba);return typeof t=="number"?C({h:t,s:n.s,l:n.l,a:n.a}):x(n.h)},e.prototype.isEqual=function(t){return this.toHex()===C(t).toHex()},e})(),C=function(e){return e instanceof oe?e:new oe(e)};const{cssr:st,plugin:at,namespace:fe}=Re(),{c:g,cB:j,cE:y,cM:H,cNotM:re}={...st,...at},M=`${fe}-chrome-tabs`,$=`${fe}-chrome-tabs-item`,V="all .2s cubic-bezier(.4, 0, .2, 1)";function ct(){return g([j("chrome-tabs",{display:"flex",width:"100%",height:"40px",padding:"0 10px",alignItems:"center",backgroundColor:"var(--background-color)",color:"var(--background-color-dark)"},[g("div",{boxSizing:"border-box"}),g(".group-move, .group-enter-active, .group-leave-active",{transition:V}),g(".group-enter-from, .group-leave-to",{opacity:0}),g(".group-leave-active",{}),y("prefix",{}),y("icon",{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",padding:"5px",borderRadius:"10px",backgroundColor:"var(--active-background-color)",transition:V},[g("svg",{width:"100%",height:"100%",fill:"currentColor"}),g("&:hover",{backgroundColor:"var(--primary-color)"})]),y("content",{flex:"1",height:"100%",minWidth:0,overflow:"hidden",marginLeft:"-6px",padding:"0 10px"}),y("scroll",{position:"relative",display:"flex",alignItems:"center",height:"100%"},[y("icon",{marginLeft:"5px",borderRadius:"50%",backgroundColor:"transparent",flexShrink:0},[g("&:hover",{backgroundColor:"var(--primary-color)"})])]),y("suffix",{})]),j("chrome-tabs-item",{position:"relative",margin:"0 -5px",height:"100%",flexShrink:0,cursor:"default",userSelect:"none",padding:"6px 15px 0px 15px"},[H("disabled",{cursor:"not-allowed",pointerEvents:"none",opacity:.5,filter:"grayscale(0.5)"}),H("active",[y("background",{opacity:1})]),re("active",[g("&:hover",{},[y("content",{backgroundColor:"var(--primary-color)"})])]),g("&::first-child",{marginLeft:"0 !important"}),g("&::last-child",{marginRight:"0 !important"}),y("content",{position:"relative",zIndex:1,height:"28px",display:"flex",alignItems:"center",gap:"5px",borderRadius:"10px",padding:"0 10px",transition:V}),y("slot",{}),y("icon",{lineHeight:1},[g("svg",{width:"1.2em",height:"1.2em",fill:"currentColor"})]),y("close",{width:"16px",height:"16px",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",transition:V},[g("&:hover",{backgroundColor:"rgba(0,0,0,0.1)"}),g("svg",{width:"100%",height:"100%",fill:"currentColor"})]),y("background",{position:"absolute",opacity:0,left:0,bottom:0,zIndex:0,height:"34px",width:"100%",display:"flex",alignItems:"flex-end",transition:V},[y("block",{height:"100%",flex:1,minWidth:0,borderRadius:"10px 10px 0 0",backgroundColor:"var(--active-background-color)"}),g("svg",{fill:"var(--active-background-color)"})]),y("line",{position:"absolute",bottom:"12px",right:"4px",height:"16px",width:"2px",borderRadius:"1px",transition:V,backgroundColor:"var(--primary-color)",opacity:0},[H("show",{opacity:1})])]),g(".dark",[j("chrome-tabs",{backgroundColor:"var(--background-color-dark)",color:"var(--background-color)"},[y("icon",{backgroundColor:"var(--active-background-color-dark)"},[g("&:hover",{backgroundColor:"var(--primary-color-dark)"})])]),j("chrome-tabs-item",{},[re("active",[g("&:hover",{},[y("content",{backgroundColor:"var(--primary-color-dark)"})])]),y("background",{},[y("block",{backgroundColor:"var(--active-background-color-dark)"}),g("svg",{fill:"var(--active-background-color-dark)"})])])])])}const P=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},dt={name:"RiAddLine"},ft={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function mt(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",ft,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)]))}const ht=P(dt,[["render",mt]]),pt={name:"RiArrowDropDownLine"},vt={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function bt(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",vt,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"m12 15l-4.243-4.242l1.415-1.414L12 12.172l2.828-2.828l1.415 1.414z"},null,-1)]))}const gt=P(pt,[["render",bt]]),yt={name:"LineMdLoadingTwotoneLoop"},xt={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function kt(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",xt,t[0]||(t[0]=[r.createStaticVNode('<g fill="none" stroke="#757575" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="16" stroke-dashoffset="16" d="M12 3c4.97 0 9 4.03 9 9"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="16;0"></animate><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"></animateTransform></path><path stroke-dasharray="64" stroke-dashoffset="64" stroke-opacity=".3" d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.2s" values="64;0"></animate></path></g>',1)]))}const $t=P(yt,[["render",kt]]),Ct={name:"RiCloseLine"},wt={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Et(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",wt,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z"},null,-1)]))}const Nt=P(Ct,[["render",Et]]),It=r.defineComponent({__name:"TabItem",props:{label:{type:[String,Function]},icon:{type:Function},closable:{type:[Boolean,Function]},disabled:{type:[Boolean,Function]},loading:{type:[Boolean,Function]},loadingIcon:{type:Function},onClick:{type:Function},onContextMenu:{type:Function},onClose:{type:Function},class:{},style:{},activeIndex:{default:0},itemIndex:{},itemKey:{}},emits:["itemClick","itemContextmenu","itemClose"],setup(e,{emit:t}){const n=t,o=r.computed(()=>e.activeIndex!==e.itemIndex&&e.activeIndex-1!==e.itemIndex),i=r.computed(()=>e.activeIndex===e.itemIndex),l=r.computed(()=>typeof e.label=="string"?r.h("span",{class:`${$}__label`},e.label):e.label(e.itemKey,e.itemIndex)),u=r.computed(()=>e.loadingIcon?.(e.itemKey,e.itemIndex)??r.h($t));function s(c){c.stopPropagation(),n("itemClick",c),e.onClick?.(e.itemKey,e.itemIndex,c)}function m(c){n("itemContextmenu",c),e.onContextMenu?.(e.itemKey,e.itemIndex,c)}function f(c){n("itemClose"),e.onClose?.(e.itemKey,e.itemIndex,c)}return(c,d)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref($),{[`${r.unref($)}--active`]:i.value,[`${r.unref($)}--disabled`]:typeof c.disabled=="function"?c.disabled(c.itemKey,c.itemIndex):c.disabled}]),onClick:s,onContextmenu:m},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__content`])},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__icon`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(typeof c.loading=="function"?c.loading(c.itemKey,c.itemIndex):c.loading?u.value:c.icon?.(c.itemKey,c.itemIndex)??void 0)))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__slot`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(l.value)))],2),(typeof c.closable=="function"?c.closable(c.itemKey,c.itemIndex):c.closable)?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref($)}__close`]),onClick:r.withModifiers(f,["stop"])},[r.createVNode(Nt)],2)):r.createCommentVNode("",!0)],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__background`])},[d[0]||(d[0]=r.createElementVNode("svg",{width:"10",height:"10"},[r.createElementVNode("path",{d:"M 0 10 A 10 10 0 0 0 10 0 L 10 10 Z"})],-1)),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__block`])},null,2),d[1]||(d[1]=r.createElementVNode("svg",{width:"10",height:"10"},[r.createElementVNode("path",{d:"M 0 0 A 10 10 0 0 0 10 10 L 0 10 Z"})],-1))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__line`,o.value?`${r.unref($)}__line--show`:""])},null,2)],34))}}),Bt=r.defineComponent({__name:"Tabs",props:{value:{},colors:{},dropdown:{type:Boolean},addable:{type:Boolean},options:{},loadingValue:{},contentClass:{},contentStyle:{}},emits:["update:value","click","contextmenu","close","add"],setup(e,{emit:t}){const n=t;Oe("n-chrome-tabs",ct());const{background:o="#F1F1F1",active:i="#fff",primary:l="rgba(0,0,0,.1)"}=e.colors??{},u=r.computed(()=>e.value?e.options?.findIndex(h=>h.key===e.value):0),{scrollRef:s,scrollToView:m}=et({activeClassName:`.${$}--active`,direction:"horizontal"});r.watch(()=>e.value,()=>{m()},{immediate:!0});const f=r.computed(()=>C(o).darken(.9).toHex()),c=r.computed(()=>C(i).darken(.8).toHex()),d=r.computed(()=>C(l).darken(.3).toHex());function b(h,v){n("update:value",h),n("click",h,v)}function E(h,v){n("contextmenu",h,v)}function a(h,v){n("close",h,v)}return(h,v)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref(M)]),style:r.normalizeStyle({"--background-color":`${r.unref(o)}`,"--background-color-dark":`${f.value}`,"--active-background-color":`${r.unref(i)}`,"--active-background-color-dark":`${c.value}`,"--primary-color":`${r.unref(l)}`,"--primary-color-dark":`${d.value}`})},[h.dropdown?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref(M)}__icon`])},[r.createVNode(gt)],2)):r.createCommentVNode("",!0),r.renderSlot(h.$slots,"prefix"),r.createElementVNode("div",{ref_key:"scrollRef",ref:s,class:r.normalizeClass([`${r.unref(M)}__content`,h.contentClass]),style:r.normalizeStyle(h.contentStyle)},[r.createVNode(r.TransitionGroup,{name:"group",tag:"div",class:r.normalizeClass([`${r.unref(M)}__scroll`])},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(h.options,({key:p,...k},I)=>(r.openBlock(),r.createBlock(It,r.mergeProps({key:p,loading:h.loadingValue===p},{ref_for:!0},k,{"item-key":p,"item-index":I,"active-index":u.value,onItemClick:B=>b(p,I),onItemContextmenu:B=>E(p,I),onItemClose:B=>a(p,I)}),null,16,["loading","item-key","item-index","active-index","onItemClick","onItemContextmenu","onItemClose"]))),128))]),_:1},8,["class"])],6),r.renderSlot(h.$slots,"suffix"),h.addable?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass([`${r.unref(M)}__icon`]),onClick:v[0]||(v[0]=p=>n("add"))},[r.createVNode(ht)],2)):r.createCommentVNode("",!0)],6))}});exports.CTabs=Bt;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { VNode } from 'vue';
|
|
1
|
+
import { CSSProperties, VNode } from 'vue';
|
|
2
2
|
type VNodeChild = VNode | string | number | undefined | void | null | boolean;
|
|
3
3
|
export type TabItemKey = string | number;
|
|
4
4
|
export { default as CTabs } from './Tabs.vue';
|
|
5
|
-
export
|
|
5
|
+
export type TabsOption = {
|
|
6
6
|
key: TabItemKey;
|
|
7
7
|
label: string | ((key: TabItemKey, index: number) => VNodeChild);
|
|
8
8
|
icon?: (key: TabItemKey, index: number) => VNodeChild;
|
|
9
|
-
closable?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
loading?: boolean;
|
|
9
|
+
closable?: boolean | ((key: TabItemKey, index: number) => boolean);
|
|
10
|
+
disabled?: boolean | ((key: TabItemKey, index: number) => boolean);
|
|
11
|
+
loading?: boolean | ((key: TabItemKey, index: number) => boolean);
|
|
12
12
|
loadingIcon?: (key: TabItemKey, index: number) => VNodeChild;
|
|
13
13
|
onClick?: (key: TabItemKey, index: number, ev: MouseEvent) => void;
|
|
14
14
|
onContextMenu?: (key: TabItemKey, index: number, ev: MouseEvent) => void;
|
|
15
15
|
onClose?: (key: TabItemKey, index: number, ev: MouseEvent) => void;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
class?: string;
|
|
17
|
+
style?: CSSProperties | string;
|
|
18
|
+
};
|
|
19
|
+
export type TabsItemProps = Omit<TabsOption, 'key'> & {
|
|
18
20
|
activeIndex?: number;
|
|
19
21
|
itemIndex: number;
|
|
20
22
|
itemKey: TabItemKey;
|
|
21
23
|
};
|
|
22
|
-
export
|
|
24
|
+
export type TabsProps = {
|
|
25
|
+
value?: TabItemKey;
|
|
23
26
|
colors?: {
|
|
24
27
|
active?: string;
|
|
25
28
|
primary?: string;
|
|
@@ -27,5 +30,8 @@ export interface TabsProps {
|
|
|
27
30
|
};
|
|
28
31
|
dropdown?: boolean;
|
|
29
32
|
addable?: boolean;
|
|
30
|
-
options?:
|
|
31
|
-
|
|
33
|
+
options?: TabsOption[];
|
|
34
|
+
loadingValue?: TabItemKey;
|
|
35
|
+
contentClass?: string;
|
|
36
|
+
contentStyle?: CSSProperties | string;
|
|
37
|
+
};
|