geekin-devtoys 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),te=require("../_plugin-vue_export-helper-BHFhmbuH.js"),oe={class:"g-pie3d-tooltip__default"},ne={class:"g-pie3d-tooltip__name"},ae={class:"g-pie3d-tooltip__value"},le=s.defineComponent({__name:"index",props:{data:{default:()=>[]},config:{default:()=>({})},animation:{type:Boolean,default:!0}},emits:["slice-click"],setup(F,{emit:U}){const x=F,J=U,V={alpha:55,depth:26,startAngle:0,colors:["#22d3ee","#3b82f6","#8b5cf6","#06b6d4","#0ea5e9","#a855f7","#14b8a6"],textColor:"#cbd5e1",radiusRatio:.55,hoverDistance:14,showLabel:!0,showPercent:!0,labelFontSize:12,opacity:.7,showAura:!0,glowColor:""},n={...V,...x.config},T=s.ref(null),g=s.ref(null);let k=null,w=0,S=0,C=1,d=0,h=0,u=0,v=0,m=[],B=x.animation?0:1,E=null,z=x.animation;const D=s.ref(-1),$=s.ref(!1),G=s.ref(0),H=s.ref(0),_=s.ref(null),N=s.ref(0),O=e=>e*Math.PI/180,j=(e,i=0,o=0)=>({x:d+i+u*Math.cos(e),y:h+o+v*Math.sin(e)}),q=(e,i=0,o=0)=>({x:d+i+u*Math.cos(e),y:h+o+v*Math.sin(e)+n.depth}),I=()=>{if(!g.value||!T.value)return;const e=T.value,i=g.value;C=window.devicePixelRatio||1,w=e.clientWidth,S=e.clientHeight,i.width=w*C,i.height=S*C,i.style.width=w+"px",i.style.height=S+"px",k=i.getContext("2d"),k&&k.setTransform(C,0,0,C,0,0),d=w/2,h=S/2-n.depth/2;const o=n.showLabel?60:10,c=Math.min(w,S-n.depth-o)/2*n.radiusRatio*1.6;u=Math.max(20,c),v=u*Math.cos(O(n.alpha)),K(),z?Q():L()},K=()=>{m=[];const e=x.data.reduce((o,c)=>o+(c.value||0),0);if(e<=0)return;let i=-Math.PI/2+O(n.startAngle);x.data.forEach((o,c)=>{const r=o.value/e,f=r*Math.PI*2;m.push({data:o,index:c,color:o.color||n.colors[c%n.colors.length],startA:i,endA:i+f,midA:i+f/2,percent:r,hover:!1}),i+=f})},Q=()=>{B=0;const e=800,i=performance.now(),o=c=>{const r=Math.min(1,(c-i)/e);B=1-Math.pow(1-r,3),L(),r<1?E=requestAnimationFrame(o):(z=!1,E=null)};E=requestAnimationFrame(o)},M=(e,i)=>{let o=e.replace("#","");o.length===3&&(o=o.split("").map(t=>t+t).join(""));const c=parseInt(o.slice(0,2),16),r=parseInt(o.slice(2,4),16),f=parseInt(o.slice(4,6),16);return`rgba(${c},${r},${f},${i})`},L=()=>{if(!k)return;const e=k;if(e.clearRect(0,0,w,S),!m.length)return;const i=m[0]?.startA??0,o=Math.PI*2*B,c=i+o,r=m.map(t=>{const a=t.startA,l=Math.min(t.endA,c),p=l>a,y=t.hover?Math.cos(t.midA)*n.hoverDistance:0,A=t.hover?Math.sin(t.midA)*n.hoverDistance:0;return{...t,startA:a,endA:l,valid:p,ox:y,oy:A}});if(n.showAura){const t=e.createRadialGradient(d,h+n.depth,u*.1,d,h+n.depth,u*1.5);t.addColorStop(0,"rgba(6,182,212,0.15)"),t.addColorStop(.4,"rgba(59,130,246,0.08)"),t.addColorStop(.8,"rgba(139,92,246,0.03)"),t.addColorStop(1,"rgba(0,0,0,0)"),e.beginPath(),e.ellipse(d,h+n.depth,u*1.5,v*.9,0,0,Math.PI*2),e.fillStyle=t,e.fill(),e.strokeStyle="rgba(56,189,248,0.08)",e.lineWidth=1;for(let a=3;a>=1;a--){const l=u*(.3+a*.25);e.beginPath(),e.ellipse(d,h+n.depth,l,l*(v/u),0,0,Math.PI*2),e.stroke()}}const f=Math.PI/120;for(const t of r){if(!t.valid)continue;let a=t.startA;const l=n.glowColor||t.color;for(;a<t.endA;){const p=Math.min(a+f,t.endA),y=(a+p)/2;if(Math.sin(y)>0){const A=j(a,t.ox,t.oy),P=j(p,t.ox,t.oy),b=q(p,t.ox,t.oy),W=q(a,t.ox,t.oy);e.fillStyle=M(l,n.opacity*.4),e.beginPath(),e.moveTo(A.x,A.y),e.lineTo(P.x,P.y),e.lineTo(b.x,b.y),e.lineTo(W.x,W.y),e.closePath(),e.fill(),e.strokeStyle=M(l,.7),e.lineWidth=.8,e.beginPath(),e.moveTo(W.x,W.y),e.lineTo(b.x,b.y),e.stroke()}a=p}}for(const t of r){if(!t.valid)continue;const a=[];Math.sin(t.startA)>.001&&a.push({a:t.startA}),Math.sin(t.endA)>.001&&a.push({a:t.endA});const l=n.glowColor||t.color;for(const p of a){const y={x:d+t.ox,y:h+t.oy},A={x:y.x,y:y.y+n.depth},P=j(p.a,t.ox,t.oy),b=q(p.a,t.ox,t.oy);e.fillStyle=M(l,n.opacity*.5),e.beginPath(),e.moveTo(y.x,y.y),e.lineTo(P.x,P.y),e.lineTo(b.x,b.y),e.lineTo(A.x,A.y),e.closePath(),e.fill(),e.strokeStyle=M(l,.8),e.lineWidth=.8,e.beginPath(),e.moveTo(P.x,P.y),e.lineTo(b.x,b.y),e.stroke()}}for(const t of r){if(!t.valid)continue;const a=n.glowColor||t.color;t.hover&&(e.save(),e.shadowColor=a,e.shadowBlur=12,e.beginPath(),e.moveTo(d+t.ox,h+t.oy),e.ellipse(d+t.ox,h+t.oy,u,v,0,t.startA,t.endA),e.closePath(),e.fillStyle=M(a,.08),e.fill(),e.restore()),e.beginPath(),e.moveTo(d+t.ox,h+t.oy),e.ellipse(d+t.ox,h+t.oy,u,v,0,t.startA,t.endA),e.closePath();const l=e.createRadialGradient(d+t.ox-u*.2,h+t.oy-v*.2,0,d+t.ox,h+t.oy,u*1.05);l.addColorStop(0,M(a,n.opacity*.95)),l.addColorStop(.6,M(a,n.opacity*.8)),l.addColorStop(1,M(a,n.opacity*.6)),e.fillStyle=l,e.fill(),e.strokeStyle=M(a,.95),e.lineWidth=t.hover?1.4:.8,e.stroke()}if(n.showLabel&&B>=.999){e.font=`${n.labelFontSize}px Arial, sans-serif`,e.fillStyle=n.textColor,e.strokeStyle="rgba(0,0,0,0.25)",e.lineWidth=1;for(const t of r){if(!t.valid)continue;const a={x:d+t.ox+u*1.02*Math.cos(t.midA),y:h+t.oy+v*1.02*Math.sin(t.midA)},l={x:d+t.ox+u*1.18*Math.cos(t.midA),y:h+t.oy+v*1.18*Math.sin(t.midA)},p=Math.cos(t.midA)>=0,y={x:l.x+(p?14:-14)};e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.lineTo(y.x,l.y),e.stroke(),e.textAlign=p?"left":"right",e.textBaseline="middle";const A=n.showPercent?`${t.data.name} ${(t.percent*100).toFixed(1)}%`:`${t.data.name}`;e.fillText(A,y.x+(p?2:-2),l.y)}}},X=(e,i)=>{for(let o=0;o<m.length;o++){const c=m[o],r=c.hover?Math.cos(c.midA)*n.hoverDistance:0,f=c.hover?Math.sin(c.midA)*n.hoverDistance:0,t=(e-(d+r))/u,a=(i-(h+f))/v;if(t*t+a*a>1)continue;let l=Math.atan2((i-(h+f))/v,(e-(d+r))/u);for(;l<c.startA;)l+=Math.PI*2;for(;l>c.startA+Math.PI*2;)l-=Math.PI*2;if(l>=c.startA&&l<=c.endA)return o}return-1},Z=e=>{if(!g.value)return;const i=g.value.getBoundingClientRect(),o=e.clientX-i.left,c=e.clientY-i.top,r=X(o,c);if(r!==D.value&&(D.value=r,m.forEach((f,t)=>f.hover=t===r),L()),r>=0){const f=m[r];$.value=!0,_.value=f.data,N.value=f.percent;const t=T.value?.clientWidth||0,a=T.value?.clientHeight||0,l=Math.min(o+12,t-140),p=Math.min(c+12,a-60);G.value=Math.max(0,l),H.value=Math.max(0,p)}else $.value=!1,_.value=null},ee=()=>{D.value!==-1&&(D.value=-1,m.forEach(e=>e.hover=!1),L()),$.value=!1,_.value=null},Y=e=>{if(!g.value)return;const i=g.value.getBoundingClientRect(),o=X(e.clientX-i.left,e.clientY-i.top);o>=0&&J("slice-click",m[o].data,o)};return s.watch(()=>x.data,()=>{Object.assign(n,V,x.config),z=x.animation,I()},{deep:!0}),s.watch(()=>x.config,()=>{Object.assign(n,V,x.config),I()},{deep:!0}),s.onMounted(()=>{I(),window.addEventListener("resize",I),g.value?.addEventListener("click",Y)}),s.onUnmounted(()=>{window.removeEventListener("resize",I),g.value?.removeEventListener("click",Y),E&&cancelAnimationFrame(E)}),(e,i)=>(s.openBlock(),s.createElementBlock("div",{class:"g-pie3d-container",ref_key:"containerRef",ref:T},[s.createElementVNode("canvas",{ref_key:"canvasRef",ref:g,onMousemove:Z,onMouseleave:ee},null,544),$.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"g-pie3d-tooltip",style:s.normalizeStyle({left:`${G.value}px`,top:`${H.value}px`})},[s.renderSlot(e.$slots,"tooltip",{data:_.value,percent:N.value},()=>[s.createElementVNode("div",oe,[s.createElementVNode("p",ne,s.toDisplayString(_.value?.name),1),s.createElementVNode("p",ae,s.toDisplayString(_.value?.value)+" ("+s.toDisplayString((N.value*100).toFixed(1))+"%) ",1)])],!0)],4)):s.createCommentVNode("",!0)],512))}}),R=te._export_sfc(le,[["__scopeId","data-v-f18ddc7e"]]);R.install=F=>{F.component(R.name,R)};exports.GPie3D=R;exports.default=R;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),ft=require("../_plugin-vue_export-helper-BHFhmbuH.js"),ut={class:"g-pie3d-tooltip__default"},pt={class:"g-pie3d-tooltip__name"},vt={class:"g-pie3d-tooltip__value"},gt=260,yt=c.defineComponent({__name:"index",props:{data:{default:()=>[]},config:{default:()=>({})},animation:{type:Boolean,default:!0}},emits:["slice-click"],setup(H,{emit:nt}){const P=H,at=nt,V={alpha:55,depth:26,startAngle:0,colors:["#22d3ee","#3b82f6","#8b5cf6","#06b6d4","#0ea5e9","#a855f7","#14b8a6"],textColor:"#cbd5e1",radiusRatio:.55,hoverDistance:14,showLabel:!0,showPercent:!0,labelFontSize:12,opacity:.7,showAura:!0,glowColor:"",labelLineColor:"auto",labelLineWidth:1},n={...V,...P.config},R=c.ref(null),S=c.ref(null);let E=null,C=0,_=0,L=1,v=0,p=0,g=0,x=0,M=[],B=P.animation?0:1,Y=null,N=P.animation,k=null,X=0;const W=c.ref(-1),$=c.ref(!1),U=c.ref(0),J=c.ref(0),I=c.ref(null),q=c.ref(0),K=t=>t*Math.PI/180,O=(t,s=0,a=0)=>({x:v+s+g*Math.cos(t),y:p+a+x*Math.sin(t)}),j=(t,s=0,a=0)=>({x:v+s+g*Math.cos(t),y:p+a+x*Math.sin(t)+n.depth}),F=()=>{if(!S.value||!R.value)return;const t=R.value,s=S.value;L=window.devicePixelRatio||1,C=t.clientWidth,_=t.clientHeight,s.width=C*L,s.height=_*L,s.style.width=C+"px",s.style.height=_+"px",E=s.getContext("2d"),E&&E.setTransform(L,0,0,L,0,0),v=C/2,p=_/2-n.depth/2;const a=n.showLabel?60:10,h=Math.min(C,_-n.depth-a)/2*n.radiusRatio*1.6;g=Math.max(20,h),x=g*Math.cos(K(n.alpha)),lt(),N?st():G()},lt=()=>{M=[];const t=P.data.reduce((a,h)=>a+(h.value||0),0);if(t<=0)return;let s=-Math.PI/2+K(n.startAngle);P.data.forEach((a,h)=>{const i=a.value/t,f=i*Math.PI*2;M.push({data:a,index:h,color:a.color||n.colors[h%n.colors.length],startA:s,endA:s+f,midA:s+f/2,percent:i,hover:!1,hoverProgress:0}),s+=f})},st=()=>{B=0;const t=800,s=performance.now(),a=h=>{const i=Math.min(1,(h-s)/t);B=1-Math.pow(1-i,3),G(),i<1?Y=requestAnimationFrame(a):(N=!1,Y=null)};Y=requestAnimationFrame(a)},Q=t=>1-Math.pow(1-t,3),Z=t=>{const s=X===0?16:t-X;X=t;const a=s/gt;let h=!1;for(const i of M){const f=i.hover?1:0;if(i.hoverProgress===f)continue;const e=f>i.hoverProgress?1:-1;i.hoverProgress+=e*a,(e>0&&i.hoverProgress>=f||e<0&&i.hoverProgress<=f)&&(i.hoverProgress=f),i.hoverProgress!==f&&(h=!0)}G(),h?k=requestAnimationFrame(Z):(k=null,X=0)},tt=()=>{k==null&&(X=0,k=requestAnimationFrame(Z))},T=(t,s)=>{let a=t.replace("#","");a.length===3&&(a=a.split("").map(e=>e+e).join(""));const h=parseInt(a.slice(0,2),16),i=parseInt(a.slice(2,4),16),f=parseInt(a.slice(4,6),16);return`rgba(${h},${i},${f},${s})`},G=()=>{if(!E)return;const t=E;if(t.clearRect(0,0,C,_),!M.length)return;const s=M[0]?.startA??0,a=Math.PI*2*B,h=s+a,i=M.map(e=>{const l=e.startA,d=Math.min(e.endA,h),u=d>l,y=Q(Math.max(0,Math.min(1,e.hoverProgress))),w=Math.cos(e.midA)*n.hoverDistance*y,b=Math.sin(e.midA)*n.hoverDistance*y;return{...e,startA:l,endA:d,valid:u,ox:w,oy:b,hp:y}});if(n.showAura){const e=t.createRadialGradient(v,p+n.depth,g*.1,v,p+n.depth,g*1.5);e.addColorStop(0,"rgba(6,182,212,0.15)"),e.addColorStop(.4,"rgba(59,130,246,0.08)"),e.addColorStop(.8,"rgba(139,92,246,0.03)"),e.addColorStop(1,"rgba(0,0,0,0)"),t.beginPath(),t.ellipse(v,p+n.depth,g*1.5,x*.9,0,0,Math.PI*2),t.fillStyle=e,t.fill(),t.strokeStyle="rgba(56,189,248,0.08)",t.lineWidth=1;for(let l=3;l>=1;l--){const d=g*(.3+l*.25);t.beginPath(),t.ellipse(v,p+n.depth,d,d*(x/g),0,0,Math.PI*2),t.stroke()}}const f=Math.PI/120;for(const e of i){if(!e.valid)continue;let l=e.startA;const d=n.glowColor||e.color;for(;l<e.endA;){const u=Math.min(l+f,e.endA),y=(l+u)/2;if(Math.sin(y)>0){const w=O(l,e.ox,e.oy),b=O(u,e.ox,e.oy),o=j(u,e.ox,e.oy),m=j(l,e.ox,e.oy);t.fillStyle=T(d,n.opacity*.4),t.beginPath(),t.moveTo(w.x,w.y),t.lineTo(b.x,b.y),t.lineTo(o.x,o.y),t.lineTo(m.x,m.y),t.closePath(),t.fill(),t.strokeStyle=T(d,.7),t.lineWidth=.8,t.beginPath(),t.moveTo(m.x,m.y),t.lineTo(o.x,o.y),t.stroke()}l=u}}for(const e of i){if(!e.valid)continue;const l=[];Math.sin(e.startA)>.001&&l.push({a:e.startA}),Math.sin(e.endA)>.001&&l.push({a:e.endA});const d=n.glowColor||e.color;for(const u of l){const y={x:v+e.ox,y:p+e.oy},w={x:y.x,y:y.y+n.depth},b=O(u.a,e.ox,e.oy),o=j(u.a,e.ox,e.oy);t.fillStyle=T(d,n.opacity*.5),t.beginPath(),t.moveTo(y.x,y.y),t.lineTo(b.x,b.y),t.lineTo(o.x,o.y),t.lineTo(w.x,w.y),t.closePath(),t.fill(),t.strokeStyle=T(d,.8),t.lineWidth=.8,t.beginPath(),t.moveTo(b.x,b.y),t.lineTo(o.x,o.y),t.stroke()}}for(const e of i){if(!e.valid)continue;const l=n.glowColor||e.color;e.hp>.01&&(t.save(),t.shadowColor=l,t.shadowBlur=12*e.hp,t.beginPath(),t.moveTo(v+e.ox,p+e.oy),t.ellipse(v+e.ox,p+e.oy,g,x,0,e.startA,e.endA),t.closePath(),t.fillStyle=T(l,.08*e.hp),t.fill(),t.restore()),t.beginPath(),t.moveTo(v+e.ox,p+e.oy),t.ellipse(v+e.ox,p+e.oy,g,x,0,e.startA,e.endA),t.closePath();const d=t.createRadialGradient(v+e.ox-g*.2,p+e.oy-x*.2,0,v+e.ox,p+e.oy,g*1.05);d.addColorStop(0,T(l,n.opacity*.95)),d.addColorStop(.6,T(l,n.opacity*.8)),d.addColorStop(1,T(l,n.opacity*.6)),t.fillStyle=d,t.fill(),t.strokeStyle=T(l,.95),t.lineWidth=.8+.6*e.hp,t.stroke()}if(n.showLabel&&B>=.999){t.font=`${n.labelFontSize}px Arial, sans-serif`,t.textBaseline="middle";const e=[],l=[],d=n.labelFontSize+6,u=14,y=4;for(const o of i){if(!o.valid)continue;const m=Math.cos(o.midA)>=0,A=v+o.ox+g*1.02*Math.cos(o.midA),r=p+o.oy+x*1.02*Math.sin(o.midA),z=p+o.oy+x*1.18*Math.sin(o.midA),ct=n.showPercent?`${o.data.name} ${(o.percent*100).toFixed(1)}%`:`${o.data.name}`,ht=!n.labelLineColor||n.labelLineColor==="auto"?n.glowColor||o.color:n.labelLineColor,dt={slice:o,text:ct,isRight:m,anchorX:A,anchorY:r,targetY:z,y:z,color:ht};(m?l:e).push(dt)}const w=o=>{if(!o.length)return;o.sort((r,z)=>r.targetY-z.targetY);const m=y+n.labelFontSize/2,A=_-y-n.labelFontSize/2;for(let r=0;r<o.length;r++)r===0?o[r].y=Math.max(m,o[r].targetY):o[r].y=Math.max(o[r].targetY,o[r-1].y+d);if(o[o.length-1].y>A){o[o.length-1].y=A;for(let r=o.length-2;r>=0;r--)o[r].y>o[r+1].y-d&&(o[r].y=o[r+1].y-d)}for(let r=0;r<o.length;r++)o[r].y<m&&(o[r].y=m)};w(e),w(l),t.lineWidth=n.labelLineWidth;const b=[...e,...l];for(const o of b){const m=t.measureText(o.text).width;let A;if(o.isRight){const r=Math.min(Math.max(o.anchorX+6,o.anchorX+Math.abs(o.targetY-o.y)*.2+6),C-y-m-u);A=r+u,t.strokeStyle=o.color,t.beginPath(),t.moveTo(o.anchorX,o.anchorY),t.lineTo(r,o.y),t.lineTo(A,o.y),t.stroke(),t.fillStyle=n.textColor,t.textAlign="left",t.fillText(o.text,A+2,o.y)}else{const r=Math.max(Math.min(o.anchorX-6,o.anchorX-Math.abs(o.targetY-o.y)*.2-6),y+m+u);A=r-u,t.strokeStyle=o.color,t.beginPath(),t.moveTo(o.anchorX,o.anchorY),t.lineTo(r,o.y),t.lineTo(A,o.y),t.stroke(),t.fillStyle=n.textColor,t.textAlign="right",t.fillText(o.text,A-2,o.y)}}}},et=(t,s)=>{for(let a=0;a<M.length;a++){const h=M[a],i=Q(Math.max(0,Math.min(1,h.hoverProgress))),f=Math.cos(h.midA)*n.hoverDistance*i,e=Math.sin(h.midA)*n.hoverDistance*i,l=(t-(v+f))/g,d=(s-(p+e))/x;if(l*l+d*d>1)continue;let u=Math.atan2((s-(p+e))/x,(t-(v+f))/g);for(;u<h.startA;)u+=Math.PI*2;for(;u>h.startA+Math.PI*2;)u-=Math.PI*2;if(u>=h.startA&&u<=h.endA)return a}return-1},it=t=>{if(!S.value)return;const s=S.value.getBoundingClientRect(),a=t.clientX-s.left,h=t.clientY-s.top,i=et(a,h);if(i!==W.value&&(W.value=i,M.forEach((f,e)=>f.hover=e===i),tt()),i>=0){const f=M[i];$.value=!0,I.value=f.data,q.value=f.percent;const e=R.value?.clientWidth||0,l=R.value?.clientHeight||0,d=Math.min(a+12,e-140),u=Math.min(h+12,l-60);U.value=Math.max(0,d),J.value=Math.max(0,u)}else $.value=!1,I.value=null},rt=()=>{W.value!==-1&&(W.value=-1,M.forEach(t=>t.hover=!1),tt()),$.value=!1,I.value=null},ot=t=>{if(!S.value)return;const s=S.value.getBoundingClientRect(),a=et(t.clientX-s.left,t.clientY-s.top);a>=0&&at("slice-click",M[a].data,a)};return c.watch(()=>P.data,()=>{Object.assign(n,V,P.config),N=P.animation,F()},{deep:!0}),c.watch(()=>P.config,()=>{Object.assign(n,V,P.config),F()},{deep:!0}),c.onMounted(()=>{F(),window.addEventListener("resize",F),S.value?.addEventListener("click",ot)}),c.onUnmounted(()=>{window.removeEventListener("resize",F),S.value?.removeEventListener("click",ot),Y&&cancelAnimationFrame(Y),k&&cancelAnimationFrame(k)}),(t,s)=>(c.openBlock(),c.createElementBlock("div",{class:"g-pie3d-container",ref_key:"containerRef",ref:R},[c.createElementVNode("canvas",{ref_key:"canvasRef",ref:S,onMousemove:it,onMouseleave:rt},null,544),$.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"g-pie3d-tooltip",style:c.normalizeStyle({left:`${U.value}px`,top:`${J.value}px`})},[c.renderSlot(t.$slots,"tooltip",{data:I.value,percent:q.value},()=>[c.createElementVNode("div",ut,[c.createElementVNode("p",pt,c.toDisplayString(I.value?.name),1),c.createElementVNode("p",vt,c.toDisplayString(I.value?.value)+" ("+c.toDisplayString((q.value*100).toFixed(1))+"%) ",1)])],!0)],4)):c.createCommentVNode("",!0)],512))}}),D=ft._export_sfc(yt,[["__scopeId","data-v-bf418cec"]]);D.install=H=>{H.component(D.name,D)};exports.GPie3D=D;exports.default=D;
@@ -1,6 +1,6 @@
1
- import { defineComponent as it, ref as b, watch as K, onMounted as st, onUnmounted as ct, createElementBlock as Q, openBlock as Z, createElementVNode as W, createCommentVNode as rt, normalizeStyle as dt, renderSlot as ht, toDisplayString as X } from "vue";
2
- import { _ as ut } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
3
- const pt = { class: "g-pie3d-tooltip__default" }, ft = { class: "g-pie3d-tooltip__name" }, vt = { class: "g-pie3d-tooltip__value" }, mt = /* @__PURE__ */ it({
1
+ import { defineComponent as yt, ref as T, watch as lt, onMounted as mt, onUnmounted as xt, createElementBlock as st, openBlock as it, createElementVNode as z, createCommentVNode as Mt, normalizeStyle as bt, renderSlot as At, toDisplayString as U } from "vue";
2
+ import { _ as Pt } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ const wt = { class: "g-pie3d-tooltip__default" }, St = { class: "g-pie3d-tooltip__name" }, Tt = { class: "g-pie3d-tooltip__value" }, Ct = 260, _t = /* @__PURE__ */ yt({
4
4
  __name: "index",
5
5
  props: {
6
6
  data: { default: () => [] },
@@ -8,8 +8,8 @@ const pt = { class: "g-pie3d-tooltip__default" }, ft = { class: "g-pie3d-tooltip
8
8
  animation: { type: Boolean, default: !0 }
9
9
  },
10
10
  emits: ["slice-click"],
11
- setup(F, { emit: tt }) {
12
- const x = F, et = tt, z = {
11
+ setup(H, { emit: rt }) {
12
+ const A = H, ct = rt, O = {
13
13
  alpha: 55,
14
14
  depth: 26,
15
15
  startAngle: 0,
@@ -22,206 +22,256 @@ const pt = { class: "g-pie3d-tooltip__default" }, ft = { class: "g-pie3d-tooltip
22
22
  labelFontSize: 12,
23
23
  opacity: 0.7,
24
24
  showAura: !0,
25
- glowColor: ""
26
- }, n = { ...z, ...x.config }, T = b(null), y = b(null);
27
- let C = null, P = 0, S = 0, k = 1, r = 0, d = 0, h = 0, f = 0, v = [], E = x.animation ? 0 : 1, I = null, j = x.animation;
28
- const $ = b(-1), B = b(!1), q = b(0), N = b(0), _ = b(null), G = b(0), O = (t) => t * Math.PI / 180, H = (t, i = 0, o = 0) => ({
29
- x: r + i + h * Math.cos(t),
30
- y: d + o + f * Math.sin(t)
31
- }), V = (t, i = 0, o = 0) => ({
32
- x: r + i + h * Math.cos(t),
33
- y: d + o + f * Math.sin(t) + n.depth
34
- }), R = () => {
35
- if (!y.value || !T.value) return;
36
- const t = T.value, i = y.value;
37
- k = window.devicePixelRatio || 1, P = t.clientWidth, S = t.clientHeight, i.width = P * k, i.height = S * k, i.style.width = P + "px", i.style.height = S + "px", C = i.getContext("2d"), C && C.setTransform(k, 0, 0, k, 0, 0), r = P / 2, d = S / 2 - n.depth / 2;
38
- const o = n.showLabel ? 60 : 10, s = Math.min(P, S - n.depth - o) / 2 * n.radiusRatio * 1.6;
39
- h = Math.max(20, s), f = h * Math.cos(O(n.alpha)), ot(), j ? nt() : D();
40
- }, ot = () => {
41
- v = [];
42
- const t = x.data.reduce((o, s) => o + (s.value || 0), 0);
25
+ glowColor: "",
26
+ labelLineColor: "auto",
27
+ labelLineWidth: 1
28
+ }, n = { ...O, ...A.config }, R = T(null), w = T(null);
29
+ let L = null, C = 0, _ = 0, Y = 1, p = 0, u = 0, v = 0, m = 0, x = [], W = A.animation ? 0 : 1, X = null, q = A.animation, k = null, F = 0;
30
+ const $ = T(-1), B = T(!1), K = T(0), Q = T(0), I = T(null), N = T(0), Z = (t) => t * Math.PI / 180, V = (t, s = 0, a = 0) => ({
31
+ x: p + s + v * Math.cos(t),
32
+ y: u + a + m * Math.sin(t)
33
+ }), j = (t, s = 0, a = 0) => ({
34
+ x: p + s + v * Math.cos(t),
35
+ y: u + a + m * Math.sin(t) + n.depth
36
+ }), E = () => {
37
+ if (!w.value || !R.value) return;
38
+ const t = R.value, s = w.value;
39
+ Y = window.devicePixelRatio || 1, C = t.clientWidth, _ = t.clientHeight, s.width = C * Y, s.height = _ * Y, s.style.width = C + "px", s.style.height = _ + "px", L = s.getContext("2d"), L && L.setTransform(Y, 0, 0, Y, 0, 0), p = C / 2, u = _ / 2 - n.depth / 2;
40
+ const a = n.showLabel ? 60 : 10, c = Math.min(C, _ - n.depth - a) / 2 * n.radiusRatio * 1.6;
41
+ v = Math.max(20, c), m = v * Math.cos(Z(n.alpha)), ht(), q ? dt() : G();
42
+ }, ht = () => {
43
+ x = [];
44
+ const t = A.data.reduce((a, c) => a + (c.value || 0), 0);
43
45
  if (t <= 0) return;
44
- let i = -Math.PI / 2 + O(n.startAngle);
45
- x.data.forEach((o, s) => {
46
- const c = o.value / t, u = c * Math.PI * 2;
47
- v.push({
48
- data: o,
49
- index: s,
50
- color: o.color || n.colors[s % n.colors.length],
51
- startA: i,
52
- endA: i + u,
53
- midA: i + u / 2,
54
- percent: c,
55
- hover: !1
56
- }), i += u;
46
+ let s = -Math.PI / 2 + Z(n.startAngle);
47
+ A.data.forEach((a, c) => {
48
+ const i = a.value / t, d = i * Math.PI * 2;
49
+ x.push({
50
+ data: a,
51
+ index: c,
52
+ color: a.color || n.colors[c % n.colors.length],
53
+ startA: s,
54
+ endA: s + d,
55
+ midA: s + d / 2,
56
+ percent: i,
57
+ hover: !1,
58
+ hoverProgress: 0
59
+ }), s += d;
57
60
  });
58
- }, nt = () => {
59
- E = 0;
60
- const t = 800, i = performance.now(), o = (s) => {
61
- const c = Math.min(1, (s - i) / t);
62
- E = 1 - Math.pow(1 - c, 3), D(), c < 1 ? I = requestAnimationFrame(o) : (j = !1, I = null);
61
+ }, dt = () => {
62
+ W = 0;
63
+ const t = 800, s = performance.now(), a = (c) => {
64
+ const i = Math.min(1, (c - s) / t);
65
+ W = 1 - Math.pow(1 - i, 3), G(), i < 1 ? X = requestAnimationFrame(a) : (q = !1, X = null);
63
66
  };
64
- I = requestAnimationFrame(o);
65
- }, g = (t, i) => {
66
- let o = t.replace("#", "");
67
- o.length === 3 && (o = o.split("").map((e) => e + e).join(""));
68
- const s = parseInt(o.slice(0, 2), 16), c = parseInt(o.slice(2, 4), 16), u = parseInt(o.slice(4, 6), 16);
69
- return `rgba(${s},${c},${u},${i})`;
70
- }, D = () => {
71
- if (!C) return;
72
- const t = C;
73
- if (t.clearRect(0, 0, P, S), !v.length) return;
74
- const i = v[0]?.startA ?? 0, o = Math.PI * 2 * E, s = i + o, c = v.map((e) => {
75
- const a = e.startA, l = Math.min(e.endA, s), p = l > a, m = e.hover ? Math.cos(e.midA) * n.hoverDistance : 0, M = e.hover ? Math.sin(e.midA) * n.hoverDistance : 0;
76
- return { ...e, startA: a, endA: l, valid: p, ox: m, oy: M };
67
+ X = requestAnimationFrame(a);
68
+ }, tt = (t) => 1 - Math.pow(1 - t, 3), et = (t) => {
69
+ const s = F === 0 ? 16 : t - F;
70
+ F = t;
71
+ const a = s / Ct;
72
+ let c = !1;
73
+ for (const i of x) {
74
+ const d = i.hover ? 1 : 0;
75
+ if (i.hoverProgress === d) continue;
76
+ const e = d > i.hoverProgress ? 1 : -1;
77
+ i.hoverProgress += e * a, (e > 0 && i.hoverProgress >= d || e < 0 && i.hoverProgress <= d) && (i.hoverProgress = d), i.hoverProgress !== d && (c = !0);
78
+ }
79
+ G(), c ? k = requestAnimationFrame(et) : (k = null, F = 0);
80
+ }, ot = () => {
81
+ k == null && (F = 0, k = requestAnimationFrame(et));
82
+ }, S = (t, s) => {
83
+ let a = t.replace("#", "");
84
+ a.length === 3 && (a = a.split("").map((e) => e + e).join(""));
85
+ const c = parseInt(a.slice(0, 2), 16), i = parseInt(a.slice(2, 4), 16), d = parseInt(a.slice(4, 6), 16);
86
+ return `rgba(${c},${i},${d},${s})`;
87
+ }, G = () => {
88
+ if (!L) return;
89
+ const t = L;
90
+ if (t.clearRect(0, 0, C, _), !x.length) return;
91
+ const s = x[0]?.startA ?? 0, a = Math.PI * 2 * W, c = s + a, i = x.map((e) => {
92
+ const l = e.startA, h = Math.min(e.endA, c), f = h > l, g = tt(Math.max(0, Math.min(1, e.hoverProgress))), P = Math.cos(e.midA) * n.hoverDistance * g, M = Math.sin(e.midA) * n.hoverDistance * g;
93
+ return { ...e, startA: l, endA: h, valid: f, ox: P, oy: M, hp: g };
77
94
  });
78
95
  if (n.showAura) {
79
96
  const e = t.createRadialGradient(
80
- r,
81
- d + n.depth,
82
- h * 0.1,
83
- r,
84
- d + n.depth,
85
- h * 1.5
97
+ p,
98
+ u + n.depth,
99
+ v * 0.1,
100
+ p,
101
+ u + n.depth,
102
+ v * 1.5
86
103
  );
87
- e.addColorStop(0, "rgba(6,182,212,0.15)"), e.addColorStop(0.4, "rgba(59,130,246,0.08)"), e.addColorStop(0.8, "rgba(139,92,246,0.03)"), e.addColorStop(1, "rgba(0,0,0,0)"), t.beginPath(), t.ellipse(r, d + n.depth, h * 1.5, f * 0.9, 0, 0, Math.PI * 2), t.fillStyle = e, t.fill(), t.strokeStyle = "rgba(56,189,248,0.08)", t.lineWidth = 1;
88
- for (let a = 3; a >= 1; a--) {
89
- const l = h * (0.3 + a * 0.25);
90
- t.beginPath(), t.ellipse(r, d + n.depth, l, l * (f / h), 0, 0, Math.PI * 2), t.stroke();
104
+ e.addColorStop(0, "rgba(6,182,212,0.15)"), e.addColorStop(0.4, "rgba(59,130,246,0.08)"), e.addColorStop(0.8, "rgba(139,92,246,0.03)"), e.addColorStop(1, "rgba(0,0,0,0)"), t.beginPath(), t.ellipse(p, u + n.depth, v * 1.5, m * 0.9, 0, 0, Math.PI * 2), t.fillStyle = e, t.fill(), t.strokeStyle = "rgba(56,189,248,0.08)", t.lineWidth = 1;
105
+ for (let l = 3; l >= 1; l--) {
106
+ const h = v * (0.3 + l * 0.25);
107
+ t.beginPath(), t.ellipse(p, u + n.depth, h, h * (m / v), 0, 0, Math.PI * 2), t.stroke();
91
108
  }
92
109
  }
93
- const u = Math.PI / 120;
94
- for (const e of c) {
110
+ const d = Math.PI / 120;
111
+ for (const e of i) {
95
112
  if (!e.valid) continue;
96
- let a = e.startA;
97
- const l = n.glowColor || e.color;
98
- for (; a < e.endA; ) {
99
- const p = Math.min(a + u, e.endA), m = (a + p) / 2;
100
- if (Math.sin(m) > 0) {
101
- const M = H(a, e.ox, e.oy), w = H(p, e.ox, e.oy), A = V(p, e.ox, e.oy), L = V(a, e.ox, e.oy);
102
- t.fillStyle = g(l, n.opacity * 0.4), t.beginPath(), t.moveTo(M.x, M.y), t.lineTo(w.x, w.y), t.lineTo(A.x, A.y), t.lineTo(L.x, L.y), t.closePath(), t.fill(), t.strokeStyle = g(l, 0.7), t.lineWidth = 0.8, t.beginPath(), t.moveTo(L.x, L.y), t.lineTo(A.x, A.y), t.stroke();
113
+ let l = e.startA;
114
+ const h = n.glowColor || e.color;
115
+ for (; l < e.endA; ) {
116
+ const f = Math.min(l + d, e.endA), g = (l + f) / 2;
117
+ if (Math.sin(g) > 0) {
118
+ const P = V(l, e.ox, e.oy), M = V(f, e.ox, e.oy), o = j(f, e.ox, e.oy), y = j(l, e.ox, e.oy);
119
+ t.fillStyle = S(h, n.opacity * 0.4), t.beginPath(), t.moveTo(P.x, P.y), t.lineTo(M.x, M.y), t.lineTo(o.x, o.y), t.lineTo(y.x, y.y), t.closePath(), t.fill(), t.strokeStyle = S(h, 0.7), t.lineWidth = 0.8, t.beginPath(), t.moveTo(y.x, y.y), t.lineTo(o.x, o.y), t.stroke();
103
120
  }
104
- a = p;
121
+ l = f;
105
122
  }
106
123
  }
107
- for (const e of c) {
124
+ for (const e of i) {
108
125
  if (!e.valid) continue;
109
- const a = [];
110
- Math.sin(e.startA) > 1e-3 && a.push({ a: e.startA }), Math.sin(e.endA) > 1e-3 && a.push({ a: e.endA });
111
- const l = n.glowColor || e.color;
112
- for (const p of a) {
113
- const m = { x: r + e.ox, y: d + e.oy }, M = { x: m.x, y: m.y + n.depth }, w = H(p.a, e.ox, e.oy), A = V(p.a, e.ox, e.oy);
114
- t.fillStyle = g(l, n.opacity * 0.5), t.beginPath(), t.moveTo(m.x, m.y), t.lineTo(w.x, w.y), t.lineTo(A.x, A.y), t.lineTo(M.x, M.y), t.closePath(), t.fill(), t.strokeStyle = g(l, 0.8), t.lineWidth = 0.8, t.beginPath(), t.moveTo(w.x, w.y), t.lineTo(A.x, A.y), t.stroke();
126
+ const l = [];
127
+ Math.sin(e.startA) > 1e-3 && l.push({ a: e.startA }), Math.sin(e.endA) > 1e-3 && l.push({ a: e.endA });
128
+ const h = n.glowColor || e.color;
129
+ for (const f of l) {
130
+ const g = { x: p + e.ox, y: u + e.oy }, P = { x: g.x, y: g.y + n.depth }, M = V(f.a, e.ox, e.oy), o = j(f.a, e.ox, e.oy);
131
+ t.fillStyle = S(h, n.opacity * 0.5), t.beginPath(), t.moveTo(g.x, g.y), t.lineTo(M.x, M.y), t.lineTo(o.x, o.y), t.lineTo(P.x, P.y), t.closePath(), t.fill(), t.strokeStyle = S(h, 0.8), t.lineWidth = 0.8, t.beginPath(), t.moveTo(M.x, M.y), t.lineTo(o.x, o.y), t.stroke();
115
132
  }
116
133
  }
117
- for (const e of c) {
134
+ for (const e of i) {
118
135
  if (!e.valid) continue;
119
- const a = n.glowColor || e.color;
120
- e.hover && (t.save(), t.shadowColor = a, t.shadowBlur = 12, t.beginPath(), t.moveTo(r + e.ox, d + e.oy), t.ellipse(r + e.ox, d + e.oy, h, f, 0, e.startA, e.endA), t.closePath(), t.fillStyle = g(a, 0.08), t.fill(), t.restore()), t.beginPath(), t.moveTo(r + e.ox, d + e.oy), t.ellipse(r + e.ox, d + e.oy, h, f, 0, e.startA, e.endA), t.closePath();
121
- const l = t.createRadialGradient(
122
- r + e.ox - h * 0.2,
123
- d + e.oy - f * 0.2,
136
+ const l = n.glowColor || e.color;
137
+ e.hp > 0.01 && (t.save(), t.shadowColor = l, t.shadowBlur = 12 * e.hp, t.beginPath(), t.moveTo(p + e.ox, u + e.oy), t.ellipse(p + e.ox, u + e.oy, v, m, 0, e.startA, e.endA), t.closePath(), t.fillStyle = S(l, 0.08 * e.hp), t.fill(), t.restore()), t.beginPath(), t.moveTo(p + e.ox, u + e.oy), t.ellipse(p + e.ox, u + e.oy, v, m, 0, e.startA, e.endA), t.closePath();
138
+ const h = t.createRadialGradient(
139
+ p + e.ox - v * 0.2,
140
+ u + e.oy - m * 0.2,
124
141
  0,
125
- r + e.ox,
126
- d + e.oy,
127
- h * 1.05
142
+ p + e.ox,
143
+ u + e.oy,
144
+ v * 1.05
128
145
  );
129
- l.addColorStop(0, g(a, n.opacity * 0.95)), l.addColorStop(0.6, g(a, n.opacity * 0.8)), l.addColorStop(1, g(a, n.opacity * 0.6)), t.fillStyle = l, t.fill(), t.strokeStyle = g(a, 0.95), t.lineWidth = e.hover ? 1.4 : 0.8, t.stroke();
146
+ h.addColorStop(0, S(l, n.opacity * 0.95)), h.addColorStop(0.6, S(l, n.opacity * 0.8)), h.addColorStop(1, S(l, n.opacity * 0.6)), t.fillStyle = h, t.fill(), t.strokeStyle = S(l, 0.95), t.lineWidth = 0.8 + 0.6 * e.hp, t.stroke();
130
147
  }
131
- if (n.showLabel && E >= 0.999) {
132
- t.font = `${n.labelFontSize}px Arial, sans-serif`, t.fillStyle = n.textColor, t.strokeStyle = "rgba(0,0,0,0.25)", t.lineWidth = 1;
133
- for (const e of c) {
134
- if (!e.valid) continue;
135
- const a = {
136
- x: r + e.ox + h * 1.02 * Math.cos(e.midA),
137
- y: d + e.oy + f * 1.02 * Math.sin(e.midA)
138
- }, l = {
139
- x: r + e.ox + h * 1.18 * Math.cos(e.midA),
140
- y: d + e.oy + f * 1.18 * Math.sin(e.midA)
141
- }, p = Math.cos(e.midA) >= 0, m = {
142
- x: l.x + (p ? 14 : -14)
148
+ if (n.showLabel && W >= 0.999) {
149
+ t.font = `${n.labelFontSize}px Arial, sans-serif`, t.textBaseline = "middle";
150
+ const e = [], l = [], h = n.labelFontSize + 6, f = 14, g = 4;
151
+ for (const o of i) {
152
+ if (!o.valid) continue;
153
+ const y = Math.cos(o.midA) >= 0, b = p + o.ox + v * 1.02 * Math.cos(o.midA), r = u + o.oy + m * 1.02 * Math.sin(o.midA), D = u + o.oy + m * 1.18 * Math.sin(o.midA), pt = n.showPercent ? `${o.data.name} ${(o.percent * 100).toFixed(1)}%` : `${o.data.name}`, vt = !n.labelLineColor || n.labelLineColor === "auto" ? n.glowColor || o.color : n.labelLineColor, gt = {
154
+ slice: o,
155
+ text: pt,
156
+ isRight: y,
157
+ anchorX: b,
158
+ anchorY: r,
159
+ targetY: D,
160
+ y: D,
161
+ color: vt
143
162
  };
144
- t.beginPath(), t.moveTo(a.x, a.y), t.lineTo(l.x, l.y), t.lineTo(m.x, l.y), t.stroke(), t.textAlign = p ? "left" : "right", t.textBaseline = "middle";
145
- const M = n.showPercent ? `${e.data.name} ${(e.percent * 100).toFixed(1)}%` : `${e.data.name}`;
146
- t.fillText(M, m.x + (p ? 2 : -2), l.y);
163
+ (y ? l : e).push(gt);
164
+ }
165
+ const P = (o) => {
166
+ if (!o.length) return;
167
+ o.sort((r, D) => r.targetY - D.targetY);
168
+ const y = g + n.labelFontSize / 2, b = _ - g - n.labelFontSize / 2;
169
+ for (let r = 0; r < o.length; r++)
170
+ r === 0 ? o[r].y = Math.max(y, o[r].targetY) : o[r].y = Math.max(o[r].targetY, o[r - 1].y + h);
171
+ if (o[o.length - 1].y > b) {
172
+ o[o.length - 1].y = b;
173
+ for (let r = o.length - 2; r >= 0; r--)
174
+ o[r].y > o[r + 1].y - h && (o[r].y = o[r + 1].y - h);
175
+ }
176
+ for (let r = 0; r < o.length; r++)
177
+ o[r].y < y && (o[r].y = y);
178
+ };
179
+ P(e), P(l), t.lineWidth = n.labelLineWidth;
180
+ const M = [...e, ...l];
181
+ for (const o of M) {
182
+ const y = t.measureText(o.text).width;
183
+ let b;
184
+ if (o.isRight) {
185
+ const r = Math.min(
186
+ Math.max(o.anchorX + 6, o.anchorX + Math.abs(o.targetY - o.y) * 0.2 + 6),
187
+ C - g - y - f
188
+ );
189
+ b = r + f, t.strokeStyle = o.color, t.beginPath(), t.moveTo(o.anchorX, o.anchorY), t.lineTo(r, o.y), t.lineTo(b, o.y), t.stroke(), t.fillStyle = n.textColor, t.textAlign = "left", t.fillText(o.text, b + 2, o.y);
190
+ } else {
191
+ const r = Math.max(
192
+ Math.min(o.anchorX - 6, o.anchorX - Math.abs(o.targetY - o.y) * 0.2 - 6),
193
+ g + y + f
194
+ );
195
+ b = r - f, t.strokeStyle = o.color, t.beginPath(), t.moveTo(o.anchorX, o.anchorY), t.lineTo(r, o.y), t.lineTo(b, o.y), t.stroke(), t.fillStyle = n.textColor, t.textAlign = "right", t.fillText(o.text, b - 2, o.y);
196
+ }
147
197
  }
148
198
  }
149
- }, U = (t, i) => {
150
- for (let o = 0; o < v.length; o++) {
151
- const s = v[o], c = s.hover ? Math.cos(s.midA) * n.hoverDistance : 0, u = s.hover ? Math.sin(s.midA) * n.hoverDistance : 0, e = (t - (r + c)) / h, a = (i - (d + u)) / f;
152
- if (e * e + a * a > 1) continue;
153
- let l = Math.atan2((i - (d + u)) / f, (t - (r + c)) / h);
154
- for (; l < s.startA; ) l += Math.PI * 2;
155
- for (; l > s.startA + Math.PI * 2; ) l -= Math.PI * 2;
156
- if (l >= s.startA && l <= s.endA) return o;
199
+ }, nt = (t, s) => {
200
+ for (let a = 0; a < x.length; a++) {
201
+ const c = x[a], i = tt(Math.max(0, Math.min(1, c.hoverProgress))), d = Math.cos(c.midA) * n.hoverDistance * i, e = Math.sin(c.midA) * n.hoverDistance * i, l = (t - (p + d)) / v, h = (s - (u + e)) / m;
202
+ if (l * l + h * h > 1) continue;
203
+ let f = Math.atan2((s - (u + e)) / m, (t - (p + d)) / v);
204
+ for (; f < c.startA; ) f += Math.PI * 2;
205
+ for (; f > c.startA + Math.PI * 2; ) f -= Math.PI * 2;
206
+ if (f >= c.startA && f <= c.endA) return a;
157
207
  }
158
208
  return -1;
159
- }, at = (t) => {
160
- if (!y.value) return;
161
- const i = y.value.getBoundingClientRect(), o = t.clientX - i.left, s = t.clientY - i.top, c = U(o, s);
162
- if (c !== $.value && ($.value = c, v.forEach((u, e) => u.hover = e === c), D()), c >= 0) {
163
- const u = v[c];
164
- B.value = !0, _.value = u.data, G.value = u.percent;
165
- const e = T.value?.clientWidth || 0, a = T.value?.clientHeight || 0, l = Math.min(o + 12, e - 140), p = Math.min(s + 12, a - 60);
166
- q.value = Math.max(0, l), N.value = Math.max(0, p);
209
+ }, ft = (t) => {
210
+ if (!w.value) return;
211
+ const s = w.value.getBoundingClientRect(), a = t.clientX - s.left, c = t.clientY - s.top, i = nt(a, c);
212
+ if (i !== $.value && ($.value = i, x.forEach((d, e) => d.hover = e === i), ot()), i >= 0) {
213
+ const d = x[i];
214
+ B.value = !0, I.value = d.data, N.value = d.percent;
215
+ const e = R.value?.clientWidth || 0, l = R.value?.clientHeight || 0, h = Math.min(a + 12, e - 140), f = Math.min(c + 12, l - 60);
216
+ K.value = Math.max(0, h), Q.value = Math.max(0, f);
167
217
  } else
168
- B.value = !1, _.value = null;
169
- }, lt = () => {
170
- $.value !== -1 && ($.value = -1, v.forEach((t) => t.hover = !1), D()), B.value = !1, _.value = null;
171
- }, J = (t) => {
172
- if (!y.value) return;
173
- const i = y.value.getBoundingClientRect(), o = U(t.clientX - i.left, t.clientY - i.top);
174
- o >= 0 && et("slice-click", v[o].data, o);
218
+ B.value = !1, I.value = null;
219
+ }, ut = () => {
220
+ $.value !== -1 && ($.value = -1, x.forEach((t) => t.hover = !1), ot()), B.value = !1, I.value = null;
221
+ }, at = (t) => {
222
+ if (!w.value) return;
223
+ const s = w.value.getBoundingClientRect(), a = nt(t.clientX - s.left, t.clientY - s.top);
224
+ a >= 0 && ct("slice-click", x[a].data, a);
175
225
  };
176
- return K(
177
- () => x.data,
226
+ return lt(
227
+ () => A.data,
178
228
  () => {
179
- Object.assign(n, z, x.config), j = x.animation, R();
229
+ Object.assign(n, O, A.config), q = A.animation, E();
180
230
  },
181
231
  { deep: !0 }
182
- ), K(
183
- () => x.config,
232
+ ), lt(
233
+ () => A.config,
184
234
  () => {
185
- Object.assign(n, z, x.config), R();
235
+ Object.assign(n, O, A.config), E();
186
236
  },
187
237
  { deep: !0 }
188
- ), st(() => {
189
- R(), window.addEventListener("resize", R), y.value?.addEventListener("click", J);
190
- }), ct(() => {
191
- window.removeEventListener("resize", R), y.value?.removeEventListener("click", J), I && cancelAnimationFrame(I);
192
- }), (t, i) => (Z(), Q("div", {
238
+ ), mt(() => {
239
+ E(), window.addEventListener("resize", E), w.value?.addEventListener("click", at);
240
+ }), xt(() => {
241
+ window.removeEventListener("resize", E), w.value?.removeEventListener("click", at), X && cancelAnimationFrame(X), k && cancelAnimationFrame(k);
242
+ }), (t, s) => (it(), st("div", {
193
243
  class: "g-pie3d-container",
194
244
  ref_key: "containerRef",
195
- ref: T
245
+ ref: R
196
246
  }, [
197
- W("canvas", {
247
+ z("canvas", {
198
248
  ref_key: "canvasRef",
199
- ref: y,
200
- onMousemove: at,
201
- onMouseleave: lt
249
+ ref: w,
250
+ onMousemove: ft,
251
+ onMouseleave: ut
202
252
  }, null, 544),
203
- B.value ? (Z(), Q("div", {
253
+ B.value ? (it(), st("div", {
204
254
  key: 0,
205
255
  class: "g-pie3d-tooltip",
206
- style: dt({ left: `${q.value}px`, top: `${N.value}px` })
256
+ style: bt({ left: `${K.value}px`, top: `${Q.value}px` })
207
257
  }, [
208
- ht(t.$slots, "tooltip", {
209
- data: _.value,
210
- percent: G.value
258
+ At(t.$slots, "tooltip", {
259
+ data: I.value,
260
+ percent: N.value
211
261
  }, () => [
212
- W("div", pt, [
213
- W("p", ft, X(_.value?.name), 1),
214
- W("p", vt, X(_.value?.value) + " (" + X((G.value * 100).toFixed(1)) + "%) ", 1)
262
+ z("div", wt, [
263
+ z("p", St, U(I.value?.name), 1),
264
+ z("p", Tt, U(I.value?.value) + " (" + U((N.value * 100).toFixed(1)) + "%) ", 1)
215
265
  ])
216
266
  ], !0)
217
- ], 4)) : rt("", !0)
267
+ ], 4)) : Mt("", !0)
218
268
  ], 512));
219
269
  }
220
- }), Y = /* @__PURE__ */ ut(mt, [["__scopeId", "data-v-f18ddc7e"]]);
221
- Y.install = (F) => {
222
- F.component(Y.name, Y);
270
+ }), J = /* @__PURE__ */ Pt(_t, [["__scopeId", "data-v-bf418cec"]]);
271
+ J.install = (H) => {
272
+ H.component(J.name, J);
223
273
  };
224
274
  export {
225
- Y as GPie3D,
226
- Y as default
275
+ J as GPie3D,
276
+ J as default
227
277
  };
@@ -0,0 +1 @@
1
+ .g-pie3d-container[data-v-bf418cec]{position:relative;width:100%;height:100%;overflow:hidden}canvas[data-v-bf418cec]{display:block;width:100%;height:100%}.g-pie3d-tooltip[data-v-bf418cec]{position:absolute;pointer-events:none;z-index:10;background:#0a121ed9;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);color:#e2e8f0;padding:8px 12px;border-radius:4px;font-size:12px;min-width:100px;box-shadow:0 4px 20px #22d3ee40;border:1px solid rgba(34,211,238,.5)}.g-pie3d-tooltip__default p[data-v-bf418cec]{margin:0;line-height:1.5}.g-pie3d-tooltip__name[data-v-bf418cec]{font-weight:600}
@@ -42,6 +42,14 @@ interface Props {
42
42
  showAura?: boolean;
43
43
  /** 描边/发光主色 (默认与扇区色一致, 留空则用扇区色高亮) */
44
44
  glowColor?: string;
45
+ /**
46
+ * 标签折线颜色
47
+ * - 留空 / 'auto': 使用扇区颜色
48
+ * - 字符串: 统一颜色, 例如 '#94a3b8' / 'rgba(0,0,0,0.4)'
49
+ */
50
+ labelLineColor?: string;
51
+ /** 标签折线宽度 (px), 默认 1 */
52
+ labelLineWidth?: number;
45
53
  };
46
54
  /**
47
55
  * @description 是否启用进入动画
@@ -103,6 +111,14 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
103
111
  showAura?: boolean;
104
112
  /** 描边/发光主色 (默认与扇区色一致, 留空则用扇区色高亮) */
105
113
  glowColor?: string;
114
+ /**
115
+ * 标签折线颜色
116
+ * - 留空 / 'auto': 使用扇区颜色
117
+ * - 字符串: 统一颜色, 例如 '#94a3b8' / 'rgba(0,0,0,0.4)'
118
+ */
119
+ labelLineColor?: string;
120
+ /** 标签折线宽度 (px), 默认 1 */
121
+ labelLineWidth?: number;
106
122
  };
107
123
  animation: boolean;
108
124
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
@@ -1,7 +1,8 @@
1
- import { default as GProgress } from './index';
2
- export default GProgress;
3
- export { GProgress };
4
- 0
1
+ interface Props {
2
+ /**
3
+ * @description 数量
4
+ * @version 0.1.7
5
+ * @default 0
5
6
  */
6
7
  count?: number | string;
7
8
  /**
@@ -1,7 +1,7 @@
1
- import { default as GScreen } from './index';
2
- export default GScreen;
3
- export { GScreen };
4
-
1
+ import { Ref } from 'vue';
2
+ interface Props {
3
+ /**
4
+ * @description 设计稿宽度
5
5
  * @version 0.1.8
6
6
  * @default 1920
7
7
  */
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../GCount/index.js"),o=require("../GDialog/index.js"),l=require("../GTable/index.js"),n=require("../GVideo/index.js"),r=require("../GBubble/index.js"),a=require("../GProgress/index.js"),d=require("../GScreen/index.js"),i=require("../GPluginVideo/index.js"),t={GCount:u.default,GDialog:o.default,GTable:l.default,GVideo:n.default,GBubble:r.default,GProgress:a.default,GScreen:d.default,GPluginVideo:i.default},c=s=>{Object.keys(t).forEach(G=>{const e=t[G];s.component(e.name,e)})},f={install:c};exports.GCount=u.default;exports.GDialog=o.default;exports.GTable=l.default;exports.GVideo=n.default;exports.GBubble=r.default;exports.GProgress=a.default;exports.GScreen=d.default;exports.GPluginVideo=i.default;exports.default=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../GCount/index.js"),o=require("../GDialog/index.js"),l=require("../GTable/index.js"),n=require("../GVideo/index.js"),r=require("../GBubble/index.js"),a=require("../GProgress/index.js"),i=require("../GScreen/index.js"),d=require("../GPluginVideo/index.js"),G=require("../GPie3D/index.js"),t={GCount:u.default,GDialog:o.default,GTable:l.default,GVideo:n.default,GBubble:r.default,GProgress:a.default,GScreen:i.default,GPluginVideo:d.default,GPie3D:G.default},f=s=>{Object.keys(t).forEach(c=>{const e=t[c];s.component(e.name,e)})},b={install:f};exports.GCount=u.default;exports.GDialog=o.default;exports.GTable=l.default;exports.GVideo=n.default;exports.GBubble=r.default;exports.GProgress=a.default;exports.GScreen=i.default;exports.GPluginVideo=d.default;exports.GPie3D=G.default;exports.default=b;
@@ -1,34 +1,37 @@
1
1
  import t from "../GCount/index.mjs";
2
- import e from "../GDialog/index.mjs";
3
- import i from "../GTable/index.mjs";
2
+ import i from "../GDialog/index.mjs";
3
+ import e from "../GTable/index.mjs";
4
4
  import s from "../GVideo/index.mjs";
5
5
  import c from "../GBubble/index.mjs";
6
- import a from "../GProgress/index.mjs";
7
- import f from "../GScreen/index.mjs";
6
+ import f from "../GProgress/index.mjs";
7
+ import a from "../GScreen/index.mjs";
8
8
  import p from "../GPluginVideo/index.mjs";
9
+ import G from "../GPie3D/index.mjs";
9
10
  const m = {
10
11
  GCount: t,
11
- GDialog: e,
12
- GTable: i,
12
+ GDialog: i,
13
+ GTable: e,
13
14
  GVideo: s,
14
15
  GBubble: c,
15
- GProgress: a,
16
- GScreen: f,
17
- GPluginVideo: p
18
- }, G = (n) => {
19
- Object.keys(m).forEach((r) => {
20
- const o = m[r];
21
- n.component(o.name, o);
16
+ GProgress: f,
17
+ GScreen: a,
18
+ GPluginVideo: p,
19
+ GPie3D: G
20
+ }, l = (r) => {
21
+ Object.keys(m).forEach((n) => {
22
+ const o = m[n];
23
+ r.component(o.name, o);
22
24
  });
23
- }, x = { install: G };
25
+ }, D = { install: l };
24
26
  export {
25
27
  c as GBubble,
26
28
  t as GCount,
27
- e as GDialog,
29
+ i as GDialog,
30
+ G as GPie3D,
28
31
  p as GPluginVideo,
29
- a as GProgress,
30
- f as GScreen,
31
- i as GTable,
32
+ f as GProgress,
33
+ a as GScreen,
34
+ e as GTable,
32
35
  s as GVideo,
33
- x as default
36
+ D as default
34
37
  };
package/lib/index.d.ts CHANGED
@@ -6,8 +6,9 @@ import { GBubble } from './components/GBubble';
6
6
  import { GProgress } from './components/GProgress';
7
7
  import { GScreen } from './components/GScreen';
8
8
  import { GPluginVideo } from './components/GPluginVideo';
9
+ import { GPie3D } from './components/GPie3D';
9
10
  declare const _default: {
10
11
  install: (app: any) => void;
11
12
  };
12
13
  export default _default;
13
- export { GCount, GDialog, GTable, GVideo, GBubble, GProgress, GScreen, GPluginVideo };
14
+ export { GCount, GDialog, GTable, GVideo, GBubble, GProgress, GScreen, GPluginVideo, GPie3D };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekin-devtoys",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "author": "leon",
5
5
  "license": "MIT",
6
6
  "description": "geekin-devtoys组件库",
@@ -1 +0,0 @@
1
- .g-pie3d-container[data-v-f18ddc7e]{position:relative;width:100%;height:100%;overflow:hidden}canvas[data-v-f18ddc7e]{display:block;width:100%;height:100%}.g-pie3d-tooltip[data-v-f18ddc7e]{position:absolute;pointer-events:none;z-index:10;background:#0a121ed9;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);color:#e2e8f0;padding:8px 12px;border-radius:4px;font-size:12px;min-width:100px;box-shadow:0 4px 20px #22d3ee40;border:1px solid rgba(34,211,238,.5)}.g-pie3d-tooltip__default p[data-v-f18ddc7e]{margin:0;line-height:1.5}.g-pie3d-tooltip__name[data-v-f18ddc7e]{font-weight:600}