@oiij/chrome-tabs 0.0.2 → 0.0.4
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/TabItem.vue.d.ts +1 -1
- package/dist/Tabs.vue.d.ts +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.js +243 -246
- package/dist/index.umd.cjs +7 -7
- package/package.json +9 -6
package/dist/index.umd.cjs
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
(function(B,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(B=typeof globalThis<"u"?globalThis:B||self,r(B["@oiij/chrome-tabs"]={},B.Vue))})(this,function(B,r){"use strict";function be(e){let t=".",n="__",o="--",i;if(e){let c=e.blockPrefix;c&&(t=c),c=e.elementPrefix,c&&(n=c),c=e.modifierPrefix,c&&(o=c)}const l={install(c){i=c.c;const
|
1
|
+
(function(B,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(B=typeof globalThis<"u"?globalThis:B||self,r(B["@oiij/chrome-tabs"]={},B.Vue))})(this,function(B,r){"use strict";function be(e){let t=".",n="__",o="--",i;if(e){let c=e.blockPrefix;c&&(t=c),c=e.elementPrefix,c&&(n=c),c=e.modifierPrefix,c&&(o=c)}const l={install(c){i=c.c;const b=c.context;b.bem={},b.bem.b=null,b.bem.els=null}};function s(c){let b,h;return{before(p){b=p.bem.b,h=p.bem.els,p.bem.els=null},after(p){p.bem.b=b,p.bem.els=h},$({context:p,props:v}){return c=typeof c=="string"?c:c({context:p,props:v}),p.bem.b=c,`${v?.bPrefix||t}${p.bem.b}`}}}function a(c){let b;return{before(h){b=h.bem.els},after(h){h.bem.els=b},$({context:h,props:p}){return c=typeof c=="string"?c:c({context:h,props:p}),h.bem.els=c.split(",").map(v=>v.trim()),h.bem.els.map(v=>`${p?.bPrefix||t}${h.bem.b}${n}${v}`).join(", ")}}}function f(c){return{$({context:b,props:h}){c=typeof c=="string"?c:c({context:b,props:h});const p=c.split(",").map(S=>S.trim());function v(S){return p.map(O=>`&${h?.bPrefix||t}${b.bem.b}${S!==void 0?`${n}${S}`:""}${o}${O}`).join(", ")}const A=b.bem.els;if(A!==null){if(process.env.NODE_ENV!=="production"&&A.length>=2)throw Error(`[css-render/plugin-bem]: m(${c}) is invalid, using modifier inside multiple elements is not allowed`);return v(A[0])}else return v()}}}function d(c){return{$({context:b,props:h}){c=typeof c=="string"?c:c({context:b,props:h});const p=b.bem.els;if(process.env.NODE_ENV!=="production"&&p!==null&&p.length>=2)throw Error(`[css-render/plugin-bem]: notM(${c}) is invalid, using modifier inside multiple elements is not allowed`);return`&:not(${h?.bPrefix||t}${b.bem.b}${p!==null&&p.length>0?`${n}${p[0]}`:""}${o}${c})`}}}return Object.assign(l,{cB:(...c)=>i(s(c[0]),c[1],c[2]),cE:(...c)=>i(a(c[0]),c[1],c[2]),cM:(...c)=>i(f(c[0]),c[1],c[2]),cNotM:(...c)=>i(d(c[0]),c[1],c[2])}),l}function ge(e){let t=0;for(let n=0;n<e.length;++n)e[n]==="&"&&++t;return t}const U=/\s*,(?![^(]*\))\s*/g,xe=/\s+/g;function ye(e,t){const n=[];return t.split(U).forEach(o=>{let i=ge(o);if(i){if(i===1){e.forEach(s=>{n.push(o.replace("&",s))});return}}else{e.forEach(s=>{n.push((s&&s+" ")+o)});return}let l=[o];for(;i--;){const s=[];l.forEach(a=>{e.forEach(f=>{s.push(a.replace("&",f))})}),l=s}l.forEach(s=>n.push(s))}),n}function ke(e,t){const n=[];return t.split(U).forEach(o=>{e.forEach(i=>{n.push((i&&i+" ")+o)})}),n}function ve(e){let t=[""];return e.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?t=ye(t,n):t=ke(t,n))}),t.join(", ").replace(xe," ")}function K(e){if(!e)return;const t=e.parentElement;t&&t.removeChild(e)}function D(e,t){return(t??document.head).querySelector(`style[cssr-id="${e}"]`)}function $e(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 Ce=/[A-Z]/g;function Y(e){return e.replace(Ce,t=>"-"+t.toLowerCase())}function we(e,t=" "){return typeof e=="object"&&e!==null?` {
|
2
2
|
`+Object.entries(e).map(n=>t+` ${Y(n[0])}: ${n[1]};`).join(`
|
3
3
|
`)+`
|
4
4
|
`+t+"}":`: ${e};`}function Ee(e,t,n){return typeof e=="function"?e({context:t.context,props:n}):e}function J(e,t,n,o){if(!t)return"";const i=Ee(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 s=e?[e+" {"]:[];return l.forEach(a=>{const
|
8
|
-
`+
|
9
|
-
`);return}a=Y(a),
|
10
|
-
`)}function
|
7
|
+
}`:"";const s=e?[e+" {"]:[];return l.forEach(a=>{const f=i[a];if(a==="raw"){s.push(`
|
8
|
+
`+f+`
|
9
|
+
`);return}a=Y(a),f!=null&&s.push(` ${a}${we(f)}`)}),e&&s.push("}"),s.join(`
|
10
|
+
`)}function H(e,t,n){e&&e.forEach(o=>{if(Array.isArray(o))H(o,t,n);else if(typeof o=="function"){const i=o(t);Array.isArray(i)?H(i,t,n):i&&n(i)}else o&&n(o)})}function Q(e,t,n,o,i){const l=e.$;let s="";if(!l||typeof l=="string")R(l)?s=l:t.push(l);else if(typeof l=="function"){const d=l({context:o.context,props:i});R(d)?s=d:t.push(d)}else if(l.before&&l.before(o.context),!l.$||typeof l.$=="string")R(l.$)?s=l.$:t.push(l.$);else if(l.$){const d=l.$({context:o.context,props:i});R(d)?s=d:t.push(d)}const a=ve(t),f=J(a,e.props,o,i);s?n.push(`${s} {`):f.length&&n.push(f),e.children&&H(e.children,{context:o.context,props:i},d=>{if(typeof d=="string"){const m=J(a,{raw:d},o,i);n.push(m)}else Q(d,t,n,o,i)}),t.pop(),s&&n.push("}"),l&&l.after&&l.after(o.context)}function Ne(e,t,n){const o=[];return Q(e,[],o,t,n),o.join(`
|
11
11
|
|
12
|
-
`)}function Be(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 Ie(e,t,n,o){const{els:i}=t;if(n===void 0)i.forEach(K),t.els=[];else{const l=
|
12
|
+
`)}function Be(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 Ie(e,t,n,o){const{els:i}=t;if(n===void 0)i.forEach(K),t.els=[];else{const l=D(n,o);l&&i.includes(l)&&(K(l),t.els=i.filter(s=>s!==l))}}function X(e,t){e.push(t)}function Me(e,t,n,o,i,l,s,a,f){let d;if(n===void 0&&(d=t.render(o),n=Be(d)),f){f.adapter(n,d??t.render(o));return}a===void 0&&(a=document.head);const m=D(n,a);if(m!==null&&!l)return m;const u=m??$e(n);if(d===void 0&&(d=t.render(o)),u.textContent=d,m!==null)return m;if(s){const g=a.querySelector(`meta[name="${s}"]`);if(g)return a.insertBefore(u,g),X(t.els,u),u}return i?a.insertBefore(u,a.querySelector("style, link")):a.appendChild(u),X(t.els,u),u}function Se(e){return Ne(this,this.instance,e)}function Ve(e={}){const{id:t,ssr:n,props:o,head:i=!1,force:l=!1,anchorMetaName:s,parent:a}=e;return Me(this.instance,this,t,o,i,l,s,a,n)}function _e(e={}){const{id:t,parent:n}=e;Ie(this.instance,this,t,n)}const z=function(e,t,n,o){return{instance:e,$:t,props:n,children:o,els:[],render:Se,mount:Ve,unmount:_e}},Ae=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 Re(e={}){const t={c:(...n)=>Ae(t,...n),use:(n,...o)=>n.install(t,...o),find:D,context:{},config:e};return t}function ze(e){const{namespace:t="n",blockPrefix:n=`.${t}-`,elementPrefix:o="__",modifierPrefix:i="--"}=e??{},l=Re(),s=be({blockPrefix:n,elementPrefix:o,modifierPrefix:i});return l.use(s),{namespace:t,blockPrefix:n,elementPrefix:o,modifierPrefix:i,cssr:l,plugin:s}}const Le="@css-render/vue3-ssr";function Te(e,t){return`<style cssr-id="${e}">
|
13
13
|
${t}
|
14
|
-
</style>`}function Pe(e,t,n){const{styles:o,ids:i}=n;i.has(e)||o!==null&&(i.add(e),o.push(je(e,t)))}const Oe=typeof document<"u";function De(){if(Oe)return;const e=r.inject(Te,null);if(e!==null)return{adapter:(t,n)=>Pe(t,n,e),context:e}}function We(e,t){const n=De();function o(){t.mount({id:e,head:!0,ssr:n})}n?o():r.onBeforeMount(()=>{o()})}const{cssr:_e,plugin:He,namespace:ee}=Le(),{c:y,cB:T,cE:x,cM:H,cNotM:te}={..._e,...He},V=`${ee}-chrome-tabs`,$=`${ee}-chrome-tabs-item`,M="all .2s cubic-bezier(.4, 0, .2, 1)";function Fe(){return y([T("chrome-tabs",{display:"flex",width:"100%",height:"40px",padding:"0 10px",alignItems:"center",backgroundColor:"var(--background-color)",color:"var(--background-color-dark)"},[y(".group-move, .group-enter-active, .group-leave-active",{transition:M}),y(".group-enter-from, .group-leave-to",{opacity:0}),y(".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},[y("svg",{width:"100%",height:"100%",fill:"currentColor"}),y("&: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},[y("&: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"},[H("disabled",{cursor:"not-allowed",pointerEvents:"none",opacity:.5,filter:"grayscale(0.5)"}),H("active",[x("background",{opacity:1})]),te("active",[y("&:hover",{},[x("content",{backgroundColor:"var(--primary-color)"})])]),y("&::first-child",{marginLeft:"0 !important"}),y("&::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",{},[y("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},[y("&:hover",{backgroundColor:"rgba(0,0,0,0.1)"}),y("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)"}),y("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},[H("show",{opacity:1})])]),y(".dark",[T("chrome-tabs",{backgroundColor:"var(--background-color-dark)",color:"var(--background-color)"},[x("icon",{backgroundColor:"var(--active-background-color-dark)"},[y("&:hover",{backgroundColor:"var(--primary-color-dark)"})])]),T("chrome-tabs-item",{},[te("active",[y("&:hover",{},[x("content",{backgroundColor:"var(--primary-color-dark)"})])]),x("background",{},[x("block",{backgroundColor:"var(--active-background-color-dark)"}),y("svg",{fill:"var(--active-background-color-dark)"})])])])])}const j=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},qe={name:"LineMdLoadingTwotoneLoop"},Ge={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Ze(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",Ge,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 Ue=j(qe,[["render",Ze]]),Ke={name:"RiCloseLine"},Ye={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Je(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",Ye,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 Qe=j(Ke,[["render",Je]]),ne=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},index:{}},emits:["itemClick","itemContextmenu","itemClose"],setup(e,{emit:t}){const n=t,o=r.computed(()=>e.activeIndex!==e.index&&e.activeIndex!==e.index-1),i=r.computed(()=>e.activeIndex===e.index),l=r.computed(()=>typeof e.label=="string"?r.h("span",{class:`${$}__label`},e.label):e.label),s=r.computed(()=>e.loadingIcon??r.h(Ue));function a(m){var u;m.stopPropagation(),n("itemClick",m),(u=e.onClick)==null||u.call(e,m)}function d(m){var u;n("itemContextmenu",m),(u=e.onContextMenu)==null||u.call(e,m)}function f(){var m;n("itemClose"),(m=e.onClose)==null||m.call(e)}return(m,u)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref($),{[`${r.unref($)}--active`]:i.value,[`${r.unref($)}--disabled`]:m.disabled}]),onClick:a,onContextmenu:d},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__content`])},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__icon`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.loading?s.value:m.icon)))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__slot`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(l.value)))],2),m.closable?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref($)}__close`]),onClick:r.withModifiers(f,["stop"])},[r.createVNode(Qe)],2)):r.createCommentVNode("",!0)],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__background`])},[u[0]||(u[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),u[1]||(u[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))}});function oe(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}const Xe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const et=Object.prototype.toString,tt=e=>et.call(e)==="[object Object]",re=()=>{};function nt(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 ot(e,t={}){let n,o,i=re;const l=d=>{clearTimeout(d),i(),i=re};let s;return d=>{const f=r.toValue(e),m=r.toValue(t.maxWait);return n&&l(n),f<=0||m!==void 0&&m<=0?(o&&(l(o),o=null),Promise.resolve(d())):new Promise((u,b)=>{i=t.rejectOnCancel?b:u,s=d,m&&!o&&(o=setTimeout(()=>{n&&l(n),o=null,u(s())},m)),n=setTimeout(()=>{o&&l(o),o=null,u(d())},f)})}}function P(e){return Array.isArray(e)?e:[e]}function rt(e){return r.getCurrentInstance()}function it(e,t=200,n={}){return nt(ot(t,n),e)}function lt(e,t=!0,n){rt()?r.onMounted(e,n):t?e():r.nextTick(e)}function st(e,t,n){return r.watch(e,t,{...n,immediate:!0})}const F=Xe?window:void 0;function I(e){var t;const n=r.toValue(e);return(t=n==null?void 0:n.$el)!=null?t:n}function at(...e){const t=[],n=()=>{t.forEach(a=>a()),t.length=0},o=(a,d,f,m)=>(a.addEventListener(d,f,m),()=>a.removeEventListener(d,f,m)),i=r.computed(()=>{const a=P(r.toValue(e[0])).filter(d=>d!=null);return a.every(d=>typeof d!="string")?a:void 0}),l=st(()=>{var a,d;return[(d=(a=i.value)==null?void 0:a.map(f=>I(f)))!=null?d:[F].filter(f=>f!=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])]},([a,d,f,m])=>{if(n(),!(a!=null&&a.length)||!(d!=null&&d.length)||!(f!=null&&f.length))return;const u=tt(m)?{...m}:m;t.push(...a.flatMap(b=>d.flatMap(C=>f.map(c=>o(b,C,c,u)))))},{flush:"post"}),s=()=>{l(),n()};return oe(n),s}function ct(){const e=r.shallowRef(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function ut(e){const t=ct();return r.computed(()=>(t.value,!!e()))}function ft(e,t,n={}){const{window:o=F,...i}=n;let l;const s=ut(()=>o&&"ResizeObserver"in o),a=()=>{l&&(l.disconnect(),l=void 0)},d=r.computed(()=>{const u=r.toValue(e);return Array.isArray(u)?u.map(b=>I(b)):[I(u)]}),f=r.watch(d,u=>{if(a(),s.value&&o){l=new ResizeObserver(t);for(const b of u)b&&l.observe(b,i)}},{immediate:!0,flush:"post"}),m=()=>{a(),f()};return oe(m),{isSupported:s,stop:m}}function dt(e,t={width:0,height:0},n={}){const{window:o=F,box:i="content-box"}=n,l=r.computed(()=>{var u,b;return(b=(u=I(e))==null?void 0:u.namespaceURI)==null?void 0:b.includes("svg")}),s=r.shallowRef(t.width),a=r.shallowRef(t.height),{stop:d}=ft(e,([u])=>{const b=i==="border-box"?u.borderBoxSize:i==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(o&&l.value){const C=I(e);if(C){const c=C.getBoundingClientRect();s.value=c.width,a.value=c.height}}else if(b){const C=P(b);s.value=C.reduce((c,{inlineSize:g})=>c+g,0),a.value=C.reduce((c,{blockSize:g})=>c+g,0)}else s.value=u.contentRect.width,a.value=u.contentRect.height},n);lt(()=>{const u=I(e);u&&(s.value="offsetWidth"in u?u.offsetWidth:t.width,a.value="offsetHeight"in u?u.offsetHeight:t.height)});const f=r.watch(()=>I(e),u=>{s.value=u?t.width:0,a.value=u?t.height:0});function m(){d(),f()}return{width:s,height:a,stop:m}}function mt(e){const{activeClassName:t=".active",enableWheel:n=!0,direction:o="vertical"}=e??{},i=r.ref(),{width:l,height:s}=dt(i);async function a(m){var b;await r.nextTick();const u=(b=i.value)==null?void 0:b.querySelector(t);u&&u.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest",...m})}function d(m){var b,C;if(!n)return;m.preventDefault();const{deltaY:u}=m;switch(o){case"vertical":(b=i.value)==null||b.scrollBy({top:u>0?s.value:-s.value,behavior:"smooth"});break;case"horizontal":(C=i.value)==null||C.scrollBy({left:u>0?l.value:-l.value,behavior:"smooth"});break}}at(i,"wheel",d);const f=it(a,500);return r.watch([l,s],()=>{f()}),{scrollRef:i,scrollToView:a}}var ht={grad:.9,turn:360,rad:360/(2*Math.PI)},N=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},ie=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},le=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)}},q=function(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}},pt=/^#([0-9a-f]{3,8})$/i,O=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},se=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),a=s?l===t?(n-o)/s:l===n?2+(o-t)/s:4+(t-n)/s:0;return{h:60*(a<0?a+6:a),s:l?s/l*100:0,v:l/255*100,a:i}},ae=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),a=o*(1-(t-l)*n),d=o*(1-(1-t+l)*n),f=l%6;return{r:255*[o,a,s,s,d,o][f],g:255*[d,o,o,a,s,s][f],b:255*[s,s,d,o,o,a][f],a:i}},ce=function(e){return{h:ie(e.h),s:w(e.s,0,100),l:w(e.l,0,100),a:w(e.a)}},ue=function(e){return{h:k(e.h),s:k(e.s),l:k(e.l),a:k(e.a,3)}},fe=function(e){return ae((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=se(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},bt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,de={string:[[function(e){var t=pt.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=xt.exec(e)||yt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:le({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=bt.exec(e)||gt.exec(e);if(!t)return null;var n,o,i=ce({h:(n=t[1],o=t[2],o===void 0&&(o="deg"),Number(n)*(ht[o]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return fe(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)?le({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 s=ce({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return fe(s)},"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 s=function(a){return{h:ie(a.h),s:w(a.s,0,100),v:w(a.v,0,100),a:w(a.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return ae(s)},"hsv"]]},me=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]},kt=function(e){return typeof e=="string"?me(e.trim(),de.string):typeof e=="object"&&e!==null?me(e,de.object):[null,void 0]},G=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}},Z=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},he=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}},pe=function(){function e(t){this.parsed=kt(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(Z(this.rgba),2)},e.prototype.isDark=function(){return Z(this.rgba)<.5},e.prototype.isLight=function(){return Z(this.rgba)>=.5},e.prototype.toHex=function(){return t=q(this.rgba),n=t.r,o=t.g,i=t.b,s=(l=t.a)<1?O(k(255*l)):"","#"+O(n)+O(o)+O(i)+s;var t,n,o,i,l,s},e.prototype.toRgb=function(){return q(this.rgba)},e.prototype.toRgbString=function(){return t=q(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 ue(A(this.rgba))},e.prototype.toHslString=function(){return t=ue(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=se(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 E({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),E(G(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),E(G(this.rgba,-t))},e.prototype.grayscale=function(){return E(G(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),E(he(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),E(he(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"?E({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"?E({h:t,s:n.s,l:n.l,a:n.a}):k(n.h)},e.prototype.isEqual=function(t){return this.toHex()===E(t).toHex()},e}(),E=function(e){return e instanceof pe?e:new pe(e)};const vt={name:"RiAddLine"},$t={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Ct(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",$t,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)]))}const wt=j(vt,[["render",Ct]]),Et={name:"RiArrowDropDownLine"},Nt={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",Nt,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 It=j(Et,[["render",Bt]]),Mt=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;We("n-chrome-tabs",Fe());const{background:o="#E5E7EB",active:i="#fff",primary:l="rgba(251,191,36,1)"}=e.colors??{},s=r.useModel(e,"value"),a=r.computed(()=>{var h;return(h=e.options)==null?void 0:h.findIndex(p=>p.key===s.value)}),{scrollRef:d,scrollToView:f}=mt({activeClassName:`.${$}--active`,direction:"horizontal"});r.watch(s,()=>{f()},{immediate:!0});const m=r.computed(()=>E(o).darken(.9).toHex()),u=r.computed(()=>E(i).darken(.8).toHex()),b=r.computed(()=>E(l).darken(.3).toHex());function C(h){n("click",h)}function c(h){n("contextmenu",h)}function g(h){n("close",h)}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":`${m.value}`,"--active-background-color":`${r.unref(i)}`,"--active-background-color-dark":`${u.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(It)],2)):r.createCommentVNode("",!0),r.renderSlot(h.$slots,"prefix"),r.createElementVNode("div",{ref_key:"scrollRef",ref:d,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:v,...R},S)=>(r.openBlock(),r.createBlock(ne,r.mergeProps({key:v},{ref_for:!0},R,{index:S,"active-index":a.value,onItemClick:D=>C(v),onItemContextmenu:D=>c(v),onItemClose:D=>g(v)}),null,16,["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]=v=>n("add"))},[r.createVNode(wt)],2)):r.createCommentVNode("",!0)],6))}});B.CTabItem=ne,B.CTabs=Mt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
14
|
+
</style>`}function je(e,t,n){const{styles:o,ids:i}=n;i.has(e)||o!==null&&(i.add(e),o.push(Te(e,t)))}const Pe=typeof document<"u";function Oe(){if(Pe)return;const e=r.inject(Le,null);if(e!==null)return{adapter:(t,n)=>je(t,n,e),context:e}}function De(e,t){const n=Oe();function o(){t.mount({id:e,head:!0,ssr:n})}n?o():r.onBeforeMount(()=>{o()})}const{cssr:He,plugin:We,namespace:ee}=ze(),{c:x,cB:L,cE:y,cM:W,cNotM:te}={...He,...We},V=`${ee}-chrome-tabs`,$=`${ee}-chrome-tabs-item`,M="all .2s cubic-bezier(.4, 0, .2, 1)";function Fe(){return x([L("chrome-tabs",{display:"flex",width:"100%",height:"40px",padding:"0 10px",alignItems:"center",backgroundColor:"var(--background-color)",color:"var(--background-color-dark)"},[x("div",{boxSizing:"border-box"}),x(".group-move, .group-enter-active, .group-leave-active",{transition:M}),x(".group-enter-from, .group-leave-to",{opacity:0}),x(".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:M},[x("svg",{width:"100%",height:"100%",fill:"currentColor"}),x("&: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},[x("&:hover",{backgroundColor:"var(--primary-color)"})])]),y("suffix",{})]),L("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",[y("background",{opacity:1})]),te("active",[x("&:hover",{},[y("content",{backgroundColor:"var(--primary-color)"})])]),x("&::first-child",{marginLeft:"0 !important"}),x("&::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:M}),y("slot",{}),y("icon",{lineHeight:1},[x("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:M},[x("&:hover",{backgroundColor:"rgba(0,0,0,0.1)"}),x("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:M},[y("block",{height:"100%",flex:1,minWidth:0,borderRadius:"10px 10px 0 0",backgroundColor:"var(--active-background-color)"}),x("svg",{fill:"var(--active-background-color)"})]),y("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})])]),x(".dark",[L("chrome-tabs",{backgroundColor:"var(--background-color-dark)",color:"var(--background-color)"},[y("icon",{backgroundColor:"var(--active-background-color-dark)"},[x("&:hover",{backgroundColor:"var(--primary-color-dark)"})])]),L("chrome-tabs-item",{},[te("active",[x("&:hover",{},[y("content",{backgroundColor:"var(--primary-color-dark)"})])]),y("background",{},[y("block",{backgroundColor:"var(--active-background-color-dark)"}),x("svg",{fill:"var(--active-background-color-dark)"})])])])])}const T=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},qe={name:"LineMdLoadingTwotoneLoop"},Ge={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Ze(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",Ge,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 Ue=T(qe,[["render",Ze]]),Ke={name:"RiCloseLine"},Ye={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Je(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",Ye,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 Qe=T(Ke,[["render",Je]]),ne=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},index:{}},emits:["itemClick","itemContextmenu","itemClose"],setup(e,{emit:t}){const n=t,o=r.computed(()=>e.activeIndex!==e.index&&e.activeIndex!==e.index-1),i=r.computed(()=>e.activeIndex===e.index),l=r.computed(()=>typeof e.label=="string"?r.h("span",{class:`${$}__label`},e.label):e.label),s=r.computed(()=>e.loadingIcon??r.h(Ue));function a(m){m.stopPropagation(),n("itemClick",m),e.onClick?.(m)}function f(m){n("itemContextmenu",m),e.onContextMenu?.(m)}function d(){n("itemClose"),e.onClose?.()}return(m,u)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([r.unref($),{[`${r.unref($)}--active`]:i.value,[`${r.unref($)}--disabled`]:m.disabled}]),onClick:a,onContextmenu:f},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__content`])},[r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__icon`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.loading?s.value:m.icon)))],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__slot`])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(l.value)))],2),m.closable?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref($)}__close`]),onClick:r.withModifiers(d,["stop"])},[r.createVNode(Qe)],2)):r.createCommentVNode("",!0)],2),r.createElementVNode("div",{class:r.normalizeClass([`${r.unref($)}__background`])},[u[0]||(u[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),u[1]||(u[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))}});function oe(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}const Xe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const et=Object.prototype.toString,tt=e=>et.call(e)==="[object Object]",re=()=>{};function nt(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 ot(e,t={}){let n,o,i=re;const l=f=>{clearTimeout(f),i(),i=re};let s;return f=>{const d=r.toValue(e),m=r.toValue(t.maxWait);return n&&l(n),d<=0||m!==void 0&&m<=0?(o&&(l(o),o=void 0),Promise.resolve(f())):new Promise((u,g)=>{i=t.rejectOnCancel?g:u,s=f,m&&!o&&(o=setTimeout(()=>{n&&l(n),o=void 0,u(s())},m)),n=setTimeout(()=>{o&&l(o),o=void 0,u(f())},d)})}}function j(e){return Array.isArray(e)?e:[e]}function rt(e){return r.getCurrentInstance()}function it(e,t=200,n={}){return nt(ot(t,n),e)}function lt(e,t=!0,n){rt()?r.onMounted(e,n):t?e():r.nextTick(e)}function st(e,t,n){return r.watch(e,t,{...n,immediate:!0})}const F=Xe?window:void 0;function I(e){var t;const n=r.toValue(e);return(t=n?.$el)!=null?t:n}function at(...e){const t=[],n=()=>{t.forEach(a=>a()),t.length=0},o=(a,f,d,m)=>(a.addEventListener(f,d,m),()=>a.removeEventListener(f,d,m)),i=r.computed(()=>{const a=j(r.toValue(e[0])).filter(f=>f!=null);return a.every(f=>typeof f!="string")?a:void 0}),l=st(()=>{var a,f;return[(f=(a=i.value)==null?void 0:a.map(d=>I(d)))!=null?f:[F].filter(d=>d!=null),j(r.toValue(i.value?e[1]:e[0])),j(r.unref(i.value?e[2]:e[1])),r.toValue(i.value?e[3]:e[2])]},([a,f,d,m])=>{if(n(),!a?.length||!f?.length||!d?.length)return;const u=tt(m)?{...m}:m;t.push(...a.flatMap(g=>f.flatMap(E=>d.map(c=>o(g,E,c,u)))))},{flush:"post"}),s=()=>{l(),n()};return oe(n),s}function ct(){const e=r.shallowRef(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function ut(e){const t=ct();return r.computed(()=>(t.value,!!e()))}function dt(e,t,n={}){const{window:o=F,...i}=n;let l;const s=ut(()=>o&&"ResizeObserver"in o),a=()=>{l&&(l.disconnect(),l=void 0)},f=r.computed(()=>{const u=r.toValue(e);return Array.isArray(u)?u.map(g=>I(g)):[I(u)]}),d=r.watch(f,u=>{if(a(),s.value&&o){l=new ResizeObserver(t);for(const g of u)g&&l.observe(g,i)}},{immediate:!0,flush:"post"}),m=()=>{a(),d()};return oe(m),{isSupported:s,stop:m}}function ft(e,t={width:0,height:0},n={}){const{window:o=F,box:i="content-box"}=n,l=r.computed(()=>{var u,g;return(g=(u=I(e))==null?void 0:u.namespaceURI)==null?void 0:g.includes("svg")}),s=r.shallowRef(t.width),a=r.shallowRef(t.height),{stop:f}=dt(e,([u])=>{const g=i==="border-box"?u.borderBoxSize:i==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(o&&l.value){const E=I(e);if(E){const c=E.getBoundingClientRect();s.value=c.width,a.value=c.height}}else if(g){const E=j(g);s.value=E.reduce((c,{inlineSize:b})=>c+b,0),a.value=E.reduce((c,{blockSize:b})=>c+b,0)}else s.value=u.contentRect.width,a.value=u.contentRect.height},n);lt(()=>{const u=I(e);u&&(s.value="offsetWidth"in u?u.offsetWidth:t.width,a.value="offsetHeight"in u?u.offsetHeight:t.height)});const d=r.watch(()=>I(e),u=>{s.value=u?t.width:0,a.value=u?t.height:0});function m(){f(),d()}return{width:s,height:a,stop:m}}function mt(e){const{activeClassName:t=".active",enableWheel:n=!0,direction:o="vertical"}=e??{},i=r.ref(),{width:l,height:s}=ft(i);async function a(m){await r.nextTick();const u=i.value?.querySelector(t);u&&u.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest",...m})}function f(m){if(!n)return;m.preventDefault();const{deltaY:u}=m;switch(o){case"vertical":i.value?.scrollBy({top:u>0?s.value:-s.value,behavior:"smooth"});break;case"horizontal":i.value?.scrollBy({left:u>0?l.value:-l.value,behavior:"smooth"});break}}at(i,"wheel",f);const d=it(a,500);return r.watch([l,s],()=>{d()}),{scrollRef:i,scrollToView:a}}var ht={grad:.9,turn:360,rad:360/(2*Math.PI)},N=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},C=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},ie=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},le=function(e){return{r:C(e.r,0,255),g:C(e.g,0,255),b:C(e.b,0,255),a:C(e.a)}},q=function(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}},pt=/^#([0-9a-f]{3,8})$/i,P=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},se=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),a=s?l===t?(n-o)/s:l===n?2+(o-t)/s:4+(t-n)/s:0;return{h:60*(a<0?a+6:a),s:l?s/l*100:0,v:l/255*100,a:i}},ae=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),a=o*(1-(t-l)*n),f=o*(1-(1-t+l)*n),d=l%6;return{r:255*[o,a,s,s,f,o][d],g:255*[f,o,o,a,s,s][d],b:255*[s,s,f,o,o,a][d],a:i}},ce=function(e){return{h:ie(e.h),s:C(e.s,0,100),l:C(e.l,0,100),a:C(e.a)}},ue=function(e){return{h:k(e.h),s:k(e.s),l:k(e.l),a:k(e.a,3)}},de=function(e){return ae((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},_=function(e){return{h:(t=se(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},bt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,fe={string:[[function(e){var t=pt.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=xt.exec(e)||yt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:le({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=bt.exec(e)||gt.exec(e);if(!t)return null;var n,o,i=ce({h:(n=t[1],o=t[2],o===void 0&&(o="deg"),Number(n)*(ht[o]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return de(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)?le({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 s=ce({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return de(s)},"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 s=function(a){return{h:ie(a.h),s:C(a.s,0,100),v:C(a.v,0,100),a:C(a.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return ae(s)},"hsv"]]},me=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]},kt=function(e){return typeof e=="string"?me(e.trim(),fe.string):typeof e=="object"&&e!==null?me(e,fe.object):[null,void 0]},G=function(e,t){var n=_(e);return{h:n.h,s:C(n.s+100*t,0,100),l:n.l,a:n.a}},Z=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},he=function(e,t){var n=_(e);return{h:n.h,s:n.s,l:C(n.l+100*t,0,100),a:n.a}},pe=function(){function e(t){this.parsed=kt(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(Z(this.rgba),2)},e.prototype.isDark=function(){return Z(this.rgba)<.5},e.prototype.isLight=function(){return Z(this.rgba)>=.5},e.prototype.toHex=function(){return t=q(this.rgba),n=t.r,o=t.g,i=t.b,s=(l=t.a)<1?P(k(255*l)):"","#"+P(n)+P(o)+P(i)+s;var t,n,o,i,l,s},e.prototype.toRgb=function(){return q(this.rgba)},e.prototype.toRgbString=function(){return t=q(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 ue(_(this.rgba))},e.prototype.toHslString=function(){return t=ue(_(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=se(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 w({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),w(G(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),w(G(this.rgba,-t))},e.prototype.grayscale=function(){return w(G(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),w(he(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),w(he(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"?w({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=_(this.rgba);return typeof t=="number"?w({h:t,s:n.s,l:n.l,a:n.a}):k(n.h)},e.prototype.isEqual=function(t){return this.toHex()===w(t).toHex()},e}(),w=function(e){return e instanceof pe?e:new pe(e)};const vt={name:"RiAddLine"},$t={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24"};function Ct(e,t,n,o,i,l){return r.openBlock(),r.createElementBlock("svg",$t,t[0]||(t[0]=[r.createElementVNode("path",{fill:"#757575",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)]))}const wt=T(vt,[["render",Ct]]),Et={name:"RiArrowDropDownLine"},Nt={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",Nt,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 It=T(Et,[["render",Bt]]),Mt=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;De("n-chrome-tabs",Fe());const{background:o="#E5E7EB",active:i="#fff",primary:l="rgba(251,191,36,1)"}=e.colors??{},s=r.useModel(e,"value"),a=r.computed(()=>e.options?.findIndex(h=>h.key===s.value)),{scrollRef:f,scrollToView:d}=mt({activeClassName:`.${$}--active`,direction:"horizontal"});r.watch(s,()=>{d()},{immediate:!0});const m=r.computed(()=>w(o).darken(.9).toHex()),u=r.computed(()=>w(i).darken(.8).toHex()),g=r.computed(()=>w(l).darken(.3).toHex());function E(h){n("click",h)}function c(h){n("contextmenu",h)}function b(h){n("close",h)}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":`${m.value}`,"--active-background-color":`${r.unref(i)}`,"--active-background-color-dark":`${u.value}`,"--primary-color":`${r.unref(l)}`,"--primary-color-dark":`${g.value}`})},[h.dropdown?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([`${r.unref(V)}__icon`])},[r.createVNode(It)],2)):r.createCommentVNode("",!0),r.renderSlot(h.$slots,"prefix"),r.createElementVNode("div",{ref_key:"scrollRef",ref:f,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:v,...A},S)=>(r.openBlock(),r.createBlock(ne,r.mergeProps({key:v},{ref_for:!0},A,{index:S,"active-index":a.value,onItemClick:O=>E(v),onItemContextmenu:O=>c(v),onItemClose:O=>b(v)}),null,16,["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]=v=>n("add"))},[r.createVNode(wt)],2)):r.createCommentVNode("",!0)],6))}});B.CTabItem=ne,B.CTabs=Mt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oiij/chrome-tabs",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.4",
|
5
5
|
"description": "A Vue Component Likes Chrome Tabs Style.",
|
6
6
|
"author": "oiij",
|
7
7
|
"license": "MIT",
|
@@ -35,14 +35,17 @@
|
|
35
35
|
"peerDependencies": {
|
36
36
|
"colord": "^2.9.3",
|
37
37
|
"vue": "^3.5.13",
|
38
|
-
"@oiij/css-render": "0.0.
|
39
|
-
"@oiij/use": "0.0.
|
38
|
+
"@oiij/css-render": "0.0.2",
|
39
|
+
"@oiij/use": "0.0.17"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"colord": "^2.9.3",
|
43
|
-
"vue": "^3.5.
|
44
|
-
"@oiij/css-render": "0.0.
|
45
|
-
"@oiij/use": "0.0.
|
43
|
+
"vue": "^3.5.17",
|
44
|
+
"@oiij/css-render": "0.0.2",
|
45
|
+
"@oiij/use": "0.0.17"
|
46
|
+
},
|
47
|
+
"publishConfig": {
|
48
|
+
"access": "public"
|
46
49
|
},
|
47
50
|
"scripts": {
|
48
51
|
"dev": "vite build --watch",
|