geekin-devtoys 0.2.15 → 0.2.17
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/lib/GPie3D/index.js +1 -1
- package/lib/GPie3D/index.mjs +159 -161
- package/lib/GPie3D/style.css +1 -1
- package/lib/GProgress/index.js +1 -1
- package/lib/GProgress/index.mjs +72 -27
- package/lib/GProgress/style.css +1 -1
- package/lib/GRing/index.js +1 -0
- package/lib/GRing/index.mjs +116 -0
- package/lib/GRing/style.css +1 -0
- package/lib/GRing.d.ts +1 -0
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +314 -108
- package/lib/GTable/style.css +1 -1
- package/lib/components/GProgress/index.d.ts +27 -5
- package/lib/components/GRing/index.d.ts +78 -0
- package/lib/components/GTable/index.d.ts +3 -4
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +27 -24
- package/lib/index.d.ts +2 -1
- package/package.json +9 -1
package/lib/GPie3D/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("vue"),pt=require("../_plugin-vue_export-helper-BHFhmbuH.js"),vt={class:"g-pie3d-tooltip__default"},gt={class:"g-pie3d-tooltip__name"},yt={class:"g-pie3d-tooltip__value"},mt=260,xt=h.defineComponent({__name:"index",props:{data:{default:()=>[]},config:{default:()=>({})},animation:{type:Boolean,default:!0}},emits:["slice-click"],setup(V,{emit:at}){const S=V,lt=at,N={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},a={...N,...S.config},E=h.ref(null),C=h.ref(null);let L=null,_=0,k=0,Y=1,p=0,u=0,g=0,M=0,A=[],B=S.animation?0:1,F=null,q=S.animation,I=null,X=0;const D=h.ref(-1),H=h.ref(!1),J=h.ref(0),K=h.ref(0),R=h.ref(null),O=h.ref(0),Q=t=>t*Math.PI/180,j=(t,l=0,n=0)=>({x:p+l+g*Math.cos(t),y:u+n+M*Math.sin(t)}),G=(t,l=0,n=0)=>({x:p+l+g*Math.cos(t),y:u+n+M*Math.sin(t)+a.depth}),W=()=>{if(!C.value||!E.value)return;const t=E.value,l=C.value;Y=window.devicePixelRatio||1,_=t.clientWidth,k=t.clientHeight,l.width=_*Y,l.height=k*Y,l.style.width=_+"px",l.style.height=k+"px",L=l.getContext("2d"),L&&L.setTransform(Y,0,0,Y,0,0),p=_/2,u=k/2-a.depth/2;const n=a.showLabel?60:10,s=Math.min(_,k-a.depth-n)/2*a.radiusRatio*1.6;g=Math.max(20,s),M=g*Math.cos(Q(a.alpha)),it(),q?st():U()},it=()=>{A=[];const t=S.data.reduce((n,s)=>n+(s.value||0),0);if(t<=0)return;let l=-Math.PI/2+Q(a.startAngle);S.data.forEach((n,s)=>{const i=n.value/t,d=i*Math.PI*2;A.push({data:n,index:s,color:n.color||a.colors[s%a.colors.length],startA:l,endA:l+d,midA:l+d/2,percent:i,hover:!1,hoverProgress:0}),l+=d})},st=()=>{B=0;const t=800,l=performance.now(),n=s=>{const i=Math.min(1,(s-l)/t);B=1-Math.pow(1-i,3),U(),i<1?F=requestAnimationFrame(n):(q=!1,F=null)};F=requestAnimationFrame(n)},rt=t=>1-Math.pow(1-t,3),Z=t=>{const l=X===0?16:t-X;X=t;const n=l/mt;let s=!1;for(const i of A){const d=i.hover?1:0;if(i.hoverProgress===d)continue;const v=d>i.hoverProgress?1:-1;i.hoverProgress+=v*n,(v>0&&i.hoverProgress>=d||v<0&&i.hoverProgress<=d)&&(i.hoverProgress=d),i.hoverProgress!==d&&(s=!0)}U(),s?I=requestAnimationFrame(Z):(I=null,X=0)},tt=()=>{I==null&&(X=0,I=requestAnimationFrame(Z))},T=(t,l)=>{let n=t.replace("#","");n.length===3&&(n=n.split("").map(v=>v+v).join(""));const s=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),d=parseInt(n.slice(4,6),16);return`rgba(${s},${i},${d},${l})`},U=()=>{if(!L)return;const t=L;if(t.clearRect(0,0,_,k),!A.length)return;const l=A[0]?.startA??0,n=Math.PI*2*B,s=l+n,i=A.map(e=>{const c=e.startA,f=Math.min(e.endA,s),y=f>c,x=rt(Math.max(0,Math.min(1,e.hoverProgress))),b=Math.cos(e.midA)*a.hoverDistance*x,P=Math.sin(e.midA)*a.hoverDistance*x;return{...e,startA:c,endA:f,valid:y,ox:b,oy:P,hp:x}});if(a.showAura){const e=t.createRadialGradient(p,u+a.depth,g*.1,p,u+a.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(p,u+a.depth,g*1.5,M*.9,0,0,Math.PI*2),t.fillStyle=e,t.fill(),t.strokeStyle="rgba(56,189,248,0.08)",t.lineWidth=1;for(let c=3;c>=1;c--){const f=g*(.3+c*.25);t.beginPath(),t.ellipse(p,u+a.depth,f,f*(M/g),0,0,Math.PI*2),t.stroke()}}const d=(e,c)=>{const f=a.glowColor||e.color,y={x:p+e.ox,y:u+e.oy},x={x:y.x,y:y.y+a.depth},b=j(c,e.ox,e.oy),P=G(c,e.ox,e.oy);t.fillStyle=T(f,a.opacity*.5),t.beginPath(),t.moveTo(y.x,y.y),t.lineTo(b.x,b.y),t.lineTo(P.x,P.y),t.lineTo(x.x,x.y),t.closePath(),t.fill(),t.strokeStyle=T(f,.8),t.lineWidth=.8,t.beginPath(),t.moveTo(b.x,b.y),t.lineTo(P.x,P.y),t.stroke()};for(const e of i)e.valid&&(Math.sin(e.startA)<=.001&&d(e,e.startA),Math.sin(e.endA)<=.001&&d(e,e.endA));const v=Math.PI/120;for(const e of i){if(!e.valid)continue;let c=e.startA;const f=a.glowColor||e.color;for(;c<e.endA;){const y=Math.min(c+v,e.endA),x=(c+y)/2;if(Math.sin(x)>0){const b=j(c,e.ox,e.oy),P=j(y,e.ox,e.oy),o=G(y,e.ox,e.oy),m=G(c,e.ox,e.oy);t.fillStyle=T(f,a.opacity*.4),t.beginPath(),t.moveTo(b.x,b.y),t.lineTo(P.x,P.y),t.lineTo(o.x,o.y),t.lineTo(m.x,m.y),t.closePath(),t.fill(),t.strokeStyle=T(f,.7),t.lineWidth=.8,t.beginPath(),t.moveTo(m.x,m.y),t.lineTo(o.x,o.y),t.stroke()}c=y}}for(const e of i)e.valid&&(Math.sin(e.startA)>.001&&d(e,e.startA),Math.sin(e.endA)>.001&&d(e,e.endA));for(const e of i){if(!e.valid)continue;const c=a.glowColor||e.color;e.hp>.01&&(t.save(),t.shadowColor=c,t.shadowBlur=12*e.hp,t.beginPath(),t.moveTo(p+e.ox,u+e.oy),t.ellipse(p+e.ox,u+e.oy,g,M,0,e.startA,e.endA),t.closePath(),t.fillStyle=T(c,.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,g,M,0,e.startA,e.endA),t.closePath();const f=t.createRadialGradient(p+e.ox-g*.2,u+e.oy-M*.2,0,p+e.ox,u+e.oy,g*1.05);f.addColorStop(0,T(c,a.opacity*.95)),f.addColorStop(.6,T(c,a.opacity*.8)),f.addColorStop(1,T(c,a.opacity*.6)),t.fillStyle=f,t.fill(),t.strokeStyle=T(c,.95),t.lineWidth=.8+.6*e.hp,t.stroke()}if(a.showLabel&&B>=.999){t.font=`${a.labelFontSize}px Arial, sans-serif`,t.textBaseline="middle";const e=[],c=[],f=a.labelFontSize+6,y=14,x=4;for(const o of i){if(!o.valid)continue;const m=Math.cos(o.midA)>=0,w=p+o.ox+g*1.02*Math.cos(o.midA),r=u+o.oy+M*1.02*Math.sin(o.midA),z=u+o.oy+M*1.18*Math.sin(o.midA),dt=a.showPercent?`${o.data.name} ${(o.percent*100).toFixed(1)}%`:`${o.data.name}`,ft=!a.labelLineColor||a.labelLineColor==="auto"?a.glowColor||o.color:a.labelLineColor,ut={slice:o,text:dt,isRight:m,anchorX:w,anchorY:r,targetY:z,y:z,color:ft};(m?c:e).push(ut)}const b=o=>{if(!o.length)return;o.sort((r,z)=>r.targetY-z.targetY);const m=x+a.labelFontSize/2,w=k-x-a.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+f);if(o[o.length-1].y>w){o[o.length-1].y=w;for(let r=o.length-2;r>=0;r--)o[r].y>o[r+1].y-f&&(o[r].y=o[r+1].y-f)}for(let r=0;r<o.length;r++)o[r].y<m&&(o[r].y=m)};b(e),b(c),t.lineWidth=a.labelLineWidth;const P=[...e,...c];for(const o of P){const m=t.measureText(o.text).width;let w;if(o.isRight){const r=Math.min(Math.max(o.anchorX+6,o.anchorX+Math.abs(o.targetY-o.y)*.2+6),_-x-m-y);w=r+y,t.strokeStyle=o.color,t.beginPath(),t.moveTo(o.anchorX,o.anchorY),t.lineTo(r,o.y),t.lineTo(w,o.y),t.stroke(),t.fillStyle=a.textColor,t.textAlign="left",t.fillText(o.text,w+2,o.y)}else{const r=Math.max(Math.min(o.anchorX-6,o.anchorX-Math.abs(o.targetY-o.y)*.2-6),x+m+y);w=r-y,t.strokeStyle=o.color,t.beginPath(),t.moveTo(o.anchorX,o.anchorY),t.lineTo(r,o.y),t.lineTo(w,o.y),t.stroke(),t.fillStyle=a.textColor,t.textAlign="right",t.fillText(o.text,w-2,o.y)}}}},et=(t,l)=>{for(let n=0;n<A.length;n++){const s=A[n],i=(t-p)/g,d=(l-u)/M;if(i*i+d*d>1)continue;let v=Math.atan2((l-u)/M,(t-p)/g);for(;v<s.startA;)v+=Math.PI*2;for(;v>s.startA+Math.PI*2;)v-=Math.PI*2;if(v>=s.startA&&v<=s.endA)return n}return-1},ot=t=>{const l=C.value,n=l.getBoundingClientRect(),s=n.width/(l.clientWidth||n.width)||1,i=n.height/(l.clientHeight||n.height)||1;return{mx:(t.clientX-n.left)/s,my:(t.clientY-n.top)/i}},ct=t=>{if(!C.value)return;const{mx:l,my:n}=ot(t),s=et(l,n);if(s!==D.value&&(D.value=s,A.forEach((i,d)=>i.hover=d===s),tt()),s>=0){const i=A[s];H.value=!0,R.value=i.data,O.value=i.percent;const d=E.value?.clientWidth||0,v=E.value?.clientHeight||0,e=Math.min(l+12,d-140),c=Math.min(n+12,v-60);J.value=Math.max(0,e),K.value=Math.max(0,c)}else H.value=!1,R.value=null},ht=()=>{D.value!==-1&&(D.value=-1,A.forEach(t=>t.hover=!1),tt()),H.value=!1,R.value=null},nt=t=>{if(!C.value)return;const{mx:l,my:n}=ot(t),s=et(l,n);s>=0&<("slice-click",A[s].data,s)};return h.watch(()=>S.data,()=>{Object.assign(a,N,S.config),q=S.animation,W()},{deep:!0}),h.watch(()=>S.config,()=>{Object.assign(a,N,S.config),W()},{deep:!0}),h.onMounted(()=>{W(),window.addEventListener("resize",W),C.value?.addEventListener("click",nt)}),h.onUnmounted(()=>{window.removeEventListener("resize",W),C.value?.removeEventListener("click",nt),F&&cancelAnimationFrame(F),I&&cancelAnimationFrame(I)}),(t,l)=>(h.openBlock(),h.createElementBlock("div",{class:"g-pie3d-container",ref_key:"containerRef",ref:E},[h.createElementVNode("canvas",{ref_key:"canvasRef",ref:C,onMousemove:ct,onMouseleave:ht},null,544),H.value?(h.openBlock(),h.createElementBlock("div",{key:0,class:"g-pie3d-tooltip",style:h.normalizeStyle({left:`${J.value}px`,top:`${K.value}px`})},[h.renderSlot(t.$slots,"tooltip",{data:R.value,percent:O.value},()=>[h.createElementVNode("div",vt,[h.createElementVNode("p",gt,h.toDisplayString(R.value?.name),1),h.createElementVNode("p",yt,h.toDisplayString(R.value?.value)+" ("+h.toDisplayString((O.value*100).toFixed(1))+"%) ",1)])],!0)],4)):h.createCommentVNode("",!0)],512))}}),$=pt._export_sfc(xt,[["__scopeId","data-v-023ff455"]]);$.install=V=>{V.component($.name,$)};exports.GPie3D=$;exports.default=$;
|
package/lib/GPie3D/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as xt, ref as C, watch as it, onMounted as Mt, onUnmounted as At, createElementBlock as st, openBlock as rt, createElementVNode as D, createCommentVNode as bt, normalizeStyle as Pt, renderSlot as wt, toDisplayString as J } from "vue";
|
|
2
|
+
import { _ as St } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
3
|
+
const Tt = { class: "g-pie3d-tooltip__default" }, Ct = { class: "g-pie3d-tooltip__name" }, _t = { class: "g-pie3d-tooltip__value" }, kt = 260, It = /* @__PURE__ */ xt({
|
|
4
4
|
__name: "index",
|
|
5
5
|
props: {
|
|
6
6
|
data: { default: () => [] },
|
|
@@ -8,8 +8,8 @@ const St = { class: "g-pie3d-tooltip__default" }, Tt = { class: "g-pie3d-tooltip
|
|
|
8
8
|
animation: { type: Boolean, default: !0 }
|
|
9
9
|
},
|
|
10
10
|
emits: ["slice-click"],
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
11
|
+
setup(O, { emit: ct }) {
|
|
12
|
+
const w = O, ht = ct, q = {
|
|
13
13
|
alpha: 55,
|
|
14
14
|
depth: 26,
|
|
15
15
|
startAngle: 0,
|
|
@@ -25,28 +25,28 @@ const St = { class: "g-pie3d-tooltip__default" }, Tt = { class: "g-pie3d-tooltip
|
|
|
25
25
|
glowColor: "",
|
|
26
26
|
labelLineColor: "auto",
|
|
27
27
|
labelLineWidth: 1
|
|
28
|
-
}, a = { ...
|
|
29
|
-
let
|
|
30
|
-
const
|
|
31
|
-
x: u + l +
|
|
32
|
-
y: f + n +
|
|
33
|
-
}),
|
|
34
|
-
x: u + l +
|
|
35
|
-
y: f + n +
|
|
36
|
-
}),
|
|
37
|
-
if (!
|
|
38
|
-
const t =
|
|
39
|
-
|
|
40
|
-
const n = a.showLabel ? 60 : 10, s = Math.min(
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
const t =
|
|
28
|
+
}, a = { ...q, ...w.config }, L = C(null), T = C(null);
|
|
29
|
+
let Y = null, _ = 0, k = 0, F = 1, u = 0, f = 0, v = 0, x = 0, M = [], $ = w.animation ? 0 : 1, X = null, N = w.animation, I = null, E = 0;
|
|
30
|
+
const z = C(-1), B = C(!1), Q = C(0), Z = C(0), R = C(null), V = C(0), tt = (t) => t * Math.PI / 180, j = (t, l = 0, n = 0) => ({
|
|
31
|
+
x: u + l + v * Math.cos(t),
|
|
32
|
+
y: f + n + x * Math.sin(t)
|
|
33
|
+
}), G = (t, l = 0, n = 0) => ({
|
|
34
|
+
x: u + l + v * Math.cos(t),
|
|
35
|
+
y: f + n + x * Math.sin(t) + a.depth
|
|
36
|
+
}), W = () => {
|
|
37
|
+
if (!T.value || !L.value) return;
|
|
38
|
+
const t = L.value, l = T.value;
|
|
39
|
+
F = window.devicePixelRatio || 1, _ = t.clientWidth, k = t.clientHeight, l.width = _ * F, l.height = k * F, l.style.width = _ + "px", l.style.height = k + "px", Y = l.getContext("2d"), Y && Y.setTransform(F, 0, 0, F, 0, 0), u = _ / 2, f = k / 2 - a.depth / 2;
|
|
40
|
+
const n = a.showLabel ? 60 : 10, s = Math.min(_, k - a.depth - n) / 2 * a.radiusRatio * 1.6;
|
|
41
|
+
v = Math.max(20, s), x = v * Math.cos(tt(a.alpha)), dt(), N ? ft() : U();
|
|
42
|
+
}, dt = () => {
|
|
43
|
+
M = [];
|
|
44
|
+
const t = w.data.reduce((n, s) => n + (s.value || 0), 0);
|
|
45
45
|
if (t <= 0) return;
|
|
46
|
-
let l = -Math.PI / 2 +
|
|
47
|
-
|
|
46
|
+
let l = -Math.PI / 2 + tt(a.startAngle);
|
|
47
|
+
w.data.forEach((n, s) => {
|
|
48
48
|
const i = n.value / t, h = i * Math.PI * 2;
|
|
49
|
-
|
|
49
|
+
M.push({
|
|
50
50
|
data: n,
|
|
51
51
|
index: s,
|
|
52
52
|
color: n.color || a.colors[s % a.colors.length],
|
|
@@ -58,226 +58,224 @@ const St = { class: "g-pie3d-tooltip__default" }, Tt = { class: "g-pie3d-tooltip
|
|
|
58
58
|
hoverProgress: 0
|
|
59
59
|
}), l += h;
|
|
60
60
|
});
|
|
61
|
-
},
|
|
62
|
-
|
|
61
|
+
}, ft = () => {
|
|
62
|
+
$ = 0;
|
|
63
63
|
const t = 800, l = performance.now(), n = (s) => {
|
|
64
64
|
const i = Math.min(1, (s - l) / t);
|
|
65
|
-
|
|
65
|
+
$ = 1 - Math.pow(1 - i, 3), U(), i < 1 ? X = requestAnimationFrame(n) : (N = !1, X = null);
|
|
66
66
|
};
|
|
67
67
|
X = requestAnimationFrame(n);
|
|
68
|
-
},
|
|
69
|
-
const l =
|
|
70
|
-
|
|
71
|
-
const n = l /
|
|
68
|
+
}, ut = (t) => 1 - Math.pow(1 - t, 3), et = (t) => {
|
|
69
|
+
const l = E === 0 ? 16 : t - E;
|
|
70
|
+
E = t;
|
|
71
|
+
const n = l / kt;
|
|
72
72
|
let s = !1;
|
|
73
|
-
for (const i of
|
|
73
|
+
for (const i of M) {
|
|
74
74
|
const h = i.hover ? 1 : 0;
|
|
75
75
|
if (i.hoverProgress === h) continue;
|
|
76
|
-
const
|
|
77
|
-
i.hoverProgress +=
|
|
76
|
+
const p = h > i.hoverProgress ? 1 : -1;
|
|
77
|
+
i.hoverProgress += p * n, (p > 0 && i.hoverProgress >= h || p < 0 && i.hoverProgress <= h) && (i.hoverProgress = h), i.hoverProgress !== h && (s = !0);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
},
|
|
79
|
+
U(), s ? I = requestAnimationFrame(et) : (I = null, E = 0);
|
|
80
|
+
}, ot = () => {
|
|
81
|
+
I == null && (E = 0, I = requestAnimationFrame(et));
|
|
82
|
+
}, S = (t, l) => {
|
|
83
83
|
let n = t.replace("#", "");
|
|
84
|
-
n.length === 3 && (n = n.split("").map((
|
|
84
|
+
n.length === 3 && (n = n.split("").map((p) => p + p).join(""));
|
|
85
85
|
const s = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), h = parseInt(n.slice(4, 6), 16);
|
|
86
86
|
return `rgba(${s},${i},${h},${l})`;
|
|
87
|
-
},
|
|
88
|
-
if (!
|
|
89
|
-
const t =
|
|
90
|
-
if (t.clearRect(0, 0,
|
|
91
|
-
const l =
|
|
92
|
-
const
|
|
93
|
-
return { ...e, startA:
|
|
87
|
+
}, U = () => {
|
|
88
|
+
if (!Y) return;
|
|
89
|
+
const t = Y;
|
|
90
|
+
if (t.clearRect(0, 0, _, k), !M.length) return;
|
|
91
|
+
const l = M[0]?.startA ?? 0, n = Math.PI * 2 * $, s = l + n, i = M.map((e) => {
|
|
92
|
+
const c = e.startA, d = Math.min(e.endA, s), g = d > c, m = ut(Math.max(0, Math.min(1, e.hoverProgress))), A = Math.cos(e.midA) * a.hoverDistance * m, b = Math.sin(e.midA) * a.hoverDistance * m;
|
|
93
|
+
return { ...e, startA: c, endA: d, valid: g, ox: A, oy: b, hp: m };
|
|
94
94
|
});
|
|
95
95
|
if (a.showAura) {
|
|
96
96
|
const e = t.createRadialGradient(
|
|
97
97
|
u,
|
|
98
98
|
f + a.depth,
|
|
99
|
-
|
|
99
|
+
v * 0.1,
|
|
100
100
|
u,
|
|
101
101
|
f + a.depth,
|
|
102
|
-
|
|
102
|
+
v * 1.5
|
|
103
103
|
);
|
|
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(u, f + a.depth,
|
|
105
|
-
for (let
|
|
106
|
-
const d =
|
|
107
|
-
t.beginPath(), t.ellipse(u, f + a.depth, d, d * (
|
|
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(u, f + a.depth, v * 1.5, x * 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 c = 3; c >= 1; c--) {
|
|
106
|
+
const d = v * (0.3 + c * 0.25);
|
|
107
|
+
t.beginPath(), t.ellipse(u, f + a.depth, d, d * (x / v), 0, 0, Math.PI * 2), t.stroke();
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const h =
|
|
110
|
+
const h = (e, c) => {
|
|
111
|
+
const d = a.glowColor || e.color, g = { x: u + e.ox, y: f + e.oy }, m = { x: g.x, y: g.y + a.depth }, A = j(c, e.ox, e.oy), b = G(c, e.ox, e.oy);
|
|
112
|
+
t.fillStyle = S(d, a.opacity * 0.5), t.beginPath(), t.moveTo(g.x, g.y), t.lineTo(A.x, A.y), t.lineTo(b.x, b.y), t.lineTo(m.x, m.y), t.closePath(), t.fill(), t.strokeStyle = S(d, 0.8), t.lineWidth = 0.8, t.beginPath(), t.moveTo(A.x, A.y), t.lineTo(b.x, b.y), t.stroke();
|
|
113
|
+
};
|
|
114
|
+
for (const e of i)
|
|
115
|
+
e.valid && (Math.sin(e.startA) <= 1e-3 && h(e, e.startA), Math.sin(e.endA) <= 1e-3 && h(e, e.endA));
|
|
116
|
+
const p = Math.PI / 120;
|
|
111
117
|
for (const e of i) {
|
|
112
118
|
if (!e.valid) continue;
|
|
113
|
-
let
|
|
119
|
+
let c = e.startA;
|
|
114
120
|
const d = a.glowColor || e.color;
|
|
115
|
-
for (;
|
|
116
|
-
const g = Math.min(
|
|
117
|
-
if (Math.sin(
|
|
118
|
-
const
|
|
119
|
-
t.fillStyle =
|
|
121
|
+
for (; c < e.endA; ) {
|
|
122
|
+
const g = Math.min(c + p, e.endA), m = (c + g) / 2;
|
|
123
|
+
if (Math.sin(m) > 0) {
|
|
124
|
+
const A = j(c, e.ox, e.oy), b = j(g, e.ox, e.oy), o = G(g, e.ox, e.oy), y = G(c, e.ox, e.oy);
|
|
125
|
+
t.fillStyle = S(d, a.opacity * 0.4), t.beginPath(), t.moveTo(A.x, A.y), t.lineTo(b.x, b.y), t.lineTo(o.x, o.y), t.lineTo(y.x, y.y), t.closePath(), t.fill(), t.strokeStyle = S(d, 0.7), t.lineWidth = 0.8, t.beginPath(), t.moveTo(y.x, y.y), t.lineTo(o.x, o.y), t.stroke();
|
|
120
126
|
}
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
for (const e of i) {
|
|
125
|
-
if (!e.valid) continue;
|
|
126
|
-
const r = [];
|
|
127
|
-
Math.sin(e.startA) > 1e-3 && r.push({ a: e.startA }), Math.sin(e.endA) > 1e-3 && r.push({ a: e.endA });
|
|
128
|
-
const d = a.glowColor || e.color;
|
|
129
|
-
for (const g of r) {
|
|
130
|
-
const v = { x: u + e.ox, y: f + e.oy }, P = { x: v.x, y: v.y + a.depth }, M = V(g.a, e.ox, e.oy), o = j(g.a, e.ox, e.oy);
|
|
131
|
-
t.fillStyle = w(d, a.opacity * 0.5), t.beginPath(), t.moveTo(v.x, v.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 = w(d, 0.8), t.lineWidth = 0.8, t.beginPath(), t.moveTo(M.x, M.y), t.lineTo(o.x, o.y), t.stroke();
|
|
127
|
+
c = g;
|
|
132
128
|
}
|
|
133
129
|
}
|
|
130
|
+
for (const e of i)
|
|
131
|
+
e.valid && (Math.sin(e.startA) > 1e-3 && h(e, e.startA), Math.sin(e.endA) > 1e-3 && h(e, e.endA));
|
|
134
132
|
for (const e of i) {
|
|
135
133
|
if (!e.valid) continue;
|
|
136
|
-
const
|
|
137
|
-
e.hp > 0.01 && (t.save(), t.shadowColor =
|
|
134
|
+
const c = a.glowColor || e.color;
|
|
135
|
+
e.hp > 0.01 && (t.save(), t.shadowColor = c, t.shadowBlur = 12 * e.hp, t.beginPath(), t.moveTo(u + e.ox, f + e.oy), t.ellipse(u + e.ox, f + e.oy, v, x, 0, e.startA, e.endA), t.closePath(), t.fillStyle = S(c, 0.08 * e.hp), t.fill(), t.restore()), t.beginPath(), t.moveTo(u + e.ox, f + e.oy), t.ellipse(u + e.ox, f + e.oy, v, x, 0, e.startA, e.endA), t.closePath();
|
|
138
136
|
const d = t.createRadialGradient(
|
|
139
|
-
u + e.ox -
|
|
140
|
-
f + e.oy -
|
|
137
|
+
u + e.ox - v * 0.2,
|
|
138
|
+
f + e.oy - x * 0.2,
|
|
141
139
|
0,
|
|
142
140
|
u + e.ox,
|
|
143
141
|
f + e.oy,
|
|
144
|
-
|
|
142
|
+
v * 1.05
|
|
145
143
|
);
|
|
146
|
-
d.addColorStop(0,
|
|
144
|
+
d.addColorStop(0, S(c, a.opacity * 0.95)), d.addColorStop(0.6, S(c, a.opacity * 0.8)), d.addColorStop(1, S(c, a.opacity * 0.6)), t.fillStyle = d, t.fill(), t.strokeStyle = S(c, 0.95), t.lineWidth = 0.8 + 0.6 * e.hp, t.stroke();
|
|
147
145
|
}
|
|
148
|
-
if (a.showLabel &&
|
|
146
|
+
if (a.showLabel && $ >= 0.999) {
|
|
149
147
|
t.font = `${a.labelFontSize}px Arial, sans-serif`, t.textBaseline = "middle";
|
|
150
|
-
const e = [],
|
|
148
|
+
const e = [], c = [], d = a.labelFontSize + 6, g = 14, m = 4;
|
|
151
149
|
for (const o of i) {
|
|
152
150
|
if (!o.valid) continue;
|
|
153
|
-
const y = Math.cos(o.midA) >= 0,
|
|
151
|
+
const y = Math.cos(o.midA) >= 0, P = u + o.ox + v * 1.02 * Math.cos(o.midA), r = f + o.oy + x * 1.02 * Math.sin(o.midA), H = f + o.oy + x * 1.18 * Math.sin(o.midA), gt = a.showPercent ? `${o.data.name} ${(o.percent * 100).toFixed(1)}%` : `${o.data.name}`, yt = !a.labelLineColor || a.labelLineColor === "auto" ? a.glowColor || o.color : a.labelLineColor, mt = {
|
|
154
152
|
slice: o,
|
|
155
|
-
text:
|
|
153
|
+
text: gt,
|
|
156
154
|
isRight: y,
|
|
157
|
-
anchorX:
|
|
158
|
-
anchorY:
|
|
159
|
-
targetY:
|
|
160
|
-
y:
|
|
161
|
-
color:
|
|
155
|
+
anchorX: P,
|
|
156
|
+
anchorY: r,
|
|
157
|
+
targetY: H,
|
|
158
|
+
y: H,
|
|
159
|
+
color: yt
|
|
162
160
|
};
|
|
163
|
-
(y ?
|
|
161
|
+
(y ? c : e).push(mt);
|
|
164
162
|
}
|
|
165
|
-
const
|
|
163
|
+
const A = (o) => {
|
|
166
164
|
if (!o.length) return;
|
|
167
|
-
o.sort((
|
|
168
|
-
const y =
|
|
169
|
-
for (let
|
|
170
|
-
|
|
171
|
-
if (o[o.length - 1].y >
|
|
172
|
-
o[o.length - 1].y =
|
|
173
|
-
for (let
|
|
174
|
-
o[
|
|
165
|
+
o.sort((r, H) => r.targetY - H.targetY);
|
|
166
|
+
const y = m + a.labelFontSize / 2, P = k - m - a.labelFontSize / 2;
|
|
167
|
+
for (let r = 0; r < o.length; r++)
|
|
168
|
+
r === 0 ? o[r].y = Math.max(y, o[r].targetY) : o[r].y = Math.max(o[r].targetY, o[r - 1].y + d);
|
|
169
|
+
if (o[o.length - 1].y > P) {
|
|
170
|
+
o[o.length - 1].y = P;
|
|
171
|
+
for (let r = o.length - 2; r >= 0; r--)
|
|
172
|
+
o[r].y > o[r + 1].y - d && (o[r].y = o[r + 1].y - d);
|
|
175
173
|
}
|
|
176
|
-
for (let
|
|
177
|
-
o[
|
|
174
|
+
for (let r = 0; r < o.length; r++)
|
|
175
|
+
o[r].y < y && (o[r].y = y);
|
|
178
176
|
};
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
for (const o of
|
|
177
|
+
A(e), A(c), t.lineWidth = a.labelLineWidth;
|
|
178
|
+
const b = [...e, ...c];
|
|
179
|
+
for (const o of b) {
|
|
182
180
|
const y = t.measureText(o.text).width;
|
|
183
|
-
let
|
|
181
|
+
let P;
|
|
184
182
|
if (o.isRight) {
|
|
185
|
-
const
|
|
183
|
+
const r = Math.min(
|
|
186
184
|
Math.max(o.anchorX + 6, o.anchorX + Math.abs(o.targetY - o.y) * 0.2 + 6),
|
|
187
|
-
|
|
185
|
+
_ - m - y - g
|
|
188
186
|
);
|
|
189
|
-
|
|
187
|
+
P = r + g, t.strokeStyle = o.color, t.beginPath(), t.moveTo(o.anchorX, o.anchorY), t.lineTo(r, o.y), t.lineTo(P, o.y), t.stroke(), t.fillStyle = a.textColor, t.textAlign = "left", t.fillText(o.text, P + 2, o.y);
|
|
190
188
|
} else {
|
|
191
|
-
const
|
|
189
|
+
const r = Math.max(
|
|
192
190
|
Math.min(o.anchorX - 6, o.anchorX - Math.abs(o.targetY - o.y) * 0.2 - 6),
|
|
193
|
-
|
|
191
|
+
m + y + g
|
|
194
192
|
);
|
|
195
|
-
|
|
193
|
+
P = r - g, t.strokeStyle = o.color, t.beginPath(), t.moveTo(o.anchorX, o.anchorY), t.lineTo(r, o.y), t.lineTo(P, o.y), t.stroke(), t.fillStyle = a.textColor, t.textAlign = "right", t.fillText(o.text, P - 2, o.y);
|
|
196
194
|
}
|
|
197
195
|
}
|
|
198
196
|
}
|
|
199
|
-
},
|
|
200
|
-
for (let n = 0; n <
|
|
201
|
-
const s =
|
|
197
|
+
}, nt = (t, l) => {
|
|
198
|
+
for (let n = 0; n < M.length; n++) {
|
|
199
|
+
const s = M[n], i = (t - u) / v, h = (l - f) / x;
|
|
202
200
|
if (i * i + h * h > 1) continue;
|
|
203
|
-
let
|
|
204
|
-
for (;
|
|
205
|
-
for (;
|
|
206
|
-
if (
|
|
201
|
+
let p = Math.atan2((l - f) / x, (t - u) / v);
|
|
202
|
+
for (; p < s.startA; ) p += Math.PI * 2;
|
|
203
|
+
for (; p > s.startA + Math.PI * 2; ) p -= Math.PI * 2;
|
|
204
|
+
if (p >= s.startA && p <= s.endA) return n;
|
|
207
205
|
}
|
|
208
206
|
return -1;
|
|
209
|
-
},
|
|
210
|
-
const l =
|
|
207
|
+
}, at = (t) => {
|
|
208
|
+
const l = T.value, n = l.getBoundingClientRect(), s = n.width / (l.clientWidth || n.width) || 1, i = n.height / (l.clientHeight || n.height) || 1;
|
|
211
209
|
return {
|
|
212
210
|
mx: (t.clientX - n.left) / s,
|
|
213
211
|
my: (t.clientY - n.top) / i
|
|
214
212
|
};
|
|
215
|
-
},
|
|
216
|
-
if (!
|
|
217
|
-
const { mx: l, my: n } =
|
|
218
|
-
if (s !==
|
|
219
|
-
const i =
|
|
220
|
-
|
|
221
|
-
const h =
|
|
222
|
-
|
|
213
|
+
}, pt = (t) => {
|
|
214
|
+
if (!T.value) return;
|
|
215
|
+
const { mx: l, my: n } = at(t), s = nt(l, n);
|
|
216
|
+
if (s !== z.value && (z.value = s, M.forEach((i, h) => i.hover = h === s), ot()), s >= 0) {
|
|
217
|
+
const i = M[s];
|
|
218
|
+
B.value = !0, R.value = i.data, V.value = i.percent;
|
|
219
|
+
const h = L.value?.clientWidth || 0, p = L.value?.clientHeight || 0, e = Math.min(l + 12, h - 140), c = Math.min(n + 12, p - 60);
|
|
220
|
+
Q.value = Math.max(0, e), Z.value = Math.max(0, c);
|
|
223
221
|
} else
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
},
|
|
228
|
-
if (!
|
|
229
|
-
const { mx: l, my: n } =
|
|
230
|
-
s >= 0 &&
|
|
222
|
+
B.value = !1, R.value = null;
|
|
223
|
+
}, vt = () => {
|
|
224
|
+
z.value !== -1 && (z.value = -1, M.forEach((t) => t.hover = !1), ot()), B.value = !1, R.value = null;
|
|
225
|
+
}, lt = (t) => {
|
|
226
|
+
if (!T.value) return;
|
|
227
|
+
const { mx: l, my: n } = at(t), s = nt(l, n);
|
|
228
|
+
s >= 0 && ht("slice-click", M[s].data, s);
|
|
231
229
|
};
|
|
232
|
-
return
|
|
233
|
-
() =>
|
|
230
|
+
return it(
|
|
231
|
+
() => w.data,
|
|
234
232
|
() => {
|
|
235
|
-
Object.assign(a,
|
|
233
|
+
Object.assign(a, q, w.config), N = w.animation, W();
|
|
236
234
|
},
|
|
237
235
|
{ deep: !0 }
|
|
238
|
-
),
|
|
239
|
-
() =>
|
|
236
|
+
), it(
|
|
237
|
+
() => w.config,
|
|
240
238
|
() => {
|
|
241
|
-
Object.assign(a,
|
|
239
|
+
Object.assign(a, q, w.config), W();
|
|
242
240
|
},
|
|
243
241
|
{ deep: !0 }
|
|
244
|
-
),
|
|
245
|
-
|
|
246
|
-
}),
|
|
247
|
-
window.removeEventListener("resize",
|
|
248
|
-
}), (t, l) => (
|
|
242
|
+
), Mt(() => {
|
|
243
|
+
W(), window.addEventListener("resize", W), T.value?.addEventListener("click", lt);
|
|
244
|
+
}), At(() => {
|
|
245
|
+
window.removeEventListener("resize", W), T.value?.removeEventListener("click", lt), X && cancelAnimationFrame(X), I && cancelAnimationFrame(I);
|
|
246
|
+
}), (t, l) => (rt(), st("div", {
|
|
249
247
|
class: "g-pie3d-container",
|
|
250
248
|
ref_key: "containerRef",
|
|
251
|
-
ref:
|
|
249
|
+
ref: L
|
|
252
250
|
}, [
|
|
253
|
-
|
|
251
|
+
D("canvas", {
|
|
254
252
|
ref_key: "canvasRef",
|
|
255
|
-
ref:
|
|
256
|
-
onMousemove:
|
|
257
|
-
onMouseleave:
|
|
253
|
+
ref: T,
|
|
254
|
+
onMousemove: pt,
|
|
255
|
+
onMouseleave: vt
|
|
258
256
|
}, null, 544),
|
|
259
|
-
|
|
257
|
+
B.value ? (rt(), st("div", {
|
|
260
258
|
key: 0,
|
|
261
259
|
class: "g-pie3d-tooltip",
|
|
262
|
-
style:
|
|
260
|
+
style: Pt({ left: `${Q.value}px`, top: `${Z.value}px` })
|
|
263
261
|
}, [
|
|
264
|
-
|
|
265
|
-
data:
|
|
266
|
-
percent:
|
|
262
|
+
wt(t.$slots, "tooltip", {
|
|
263
|
+
data: R.value,
|
|
264
|
+
percent: V.value
|
|
267
265
|
}, () => [
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
266
|
+
D("div", Tt, [
|
|
267
|
+
D("p", Ct, J(R.value?.name), 1),
|
|
268
|
+
D("p", _t, J(R.value?.value) + " (" + J((V.value * 100).toFixed(1)) + "%) ", 1)
|
|
271
269
|
])
|
|
272
270
|
], !0)
|
|
273
271
|
], 4)) : bt("", !0)
|
|
274
272
|
], 512));
|
|
275
273
|
}
|
|
276
|
-
}),
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
}), K = /* @__PURE__ */ St(It, [["__scopeId", "data-v-023ff455"]]);
|
|
275
|
+
K.install = (O) => {
|
|
276
|
+
O.component(K.name, K);
|
|
279
277
|
};
|
|
280
278
|
export {
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
K as GPie3D,
|
|
280
|
+
K as default
|
|
283
281
|
};
|
package/lib/GPie3D/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.g-pie3d-container[data-v-
|
|
1
|
+
.g-pie3d-container[data-v-023ff455]{position:relative;width:100%;height:100%;overflow:hidden}canvas[data-v-023ff455]{display:block;width:100%;height:100%}.g-pie3d-tooltip[data-v-023ff455]{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-023ff455]{margin:0;line-height:1.5}.g-pie3d-tooltip__name[data-v-023ff455]{font-weight:600}
|
package/lib/GProgress/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../_plugin-vue_export-helper-BHFhmbuH.js"),c={class:"g-progress-bar-container"},p={class:"g-progress-info"},m=["aria-valuenow"],g={class:"g-progress-splash","aria-hidden":"true"},v=e.defineComponent({name:"GProgress",inheritAttrs:!1,__name:"index",props:{count:{default:0},height:{default:10},gradient:{default:()=>["#3b82f6","#f97316"]},textColor:{default:"#fff"},wave:{type:Boolean,default:!1},waveSpeed:{default:3},forceAnimation:{type:Boolean,default:!1}},setup(l){const r=l,s=e.computed(()=>{const t=Number(r.count);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}),i=e.computed(()=>typeof r.height=="number"?`${r.height}px`:r.height),n=e.computed(()=>{const[t="#3b82f6",o="#f97316"]=r.gradient??[];return`linear-gradient(90deg, ${t} 0%, ${o} 100%)`});return(t,o)=>(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("div",p,[e.renderSlot(t.$slots,"title",{},void 0,!0)]),e.createElementVNode("div",{class:"g-progress-wrapper",style:e.normalizeStyle({height:i.value}),role:"progressbar","aria-valuenow":s.value,"aria-valuemin":"0","aria-valuemax":"100"},[e.createElementVNode("div",{class:"g-progress-bg",style:e.normalizeStyle({background:n.value})},null,4),e.createElementVNode("div",{class:e.normalizeClass(["g-progress-fill",{"is-wave":t.wave,"is-force-animation":t.forceAnimation}]),style:e.normalizeStyle({width:`${s.value}%`,background:n.value})},[t.wave?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"g-progress-sweep g-progress-sweep--front",style:e.normalizeStyle({animationDuration:`${t.waveSpeed}s`}),"aria-hidden":"true"},null,4),e.createElementVNode("div",{class:"g-progress-sweep g-progress-sweep--back",style:e.normalizeStyle({animationDuration:`${t.waveSpeed*1.6}s`}),"aria-hidden":"true"},null,4),o[0]||(o[0]=e.createElementVNode("div",{class:"g-progress-grid","aria-hidden":"true"},null,-1)),e.createElementVNode("div",{class:"g-progress-impact",style:e.normalizeStyle({animationDuration:`${t.waveSpeed}s`}),"aria-hidden":"true"},null,4),e.createElementVNode("div",g,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(6,d=>e.createElementVNode("span",{key:d,class:"g-progress-splash__particle",style:e.normalizeStyle({animationDuration:`${t.waveSpeed}s`})},null,4)),64))])],64)):e.createCommentVNode("",!0)],6)],12,m),e.createElementVNode("div",{class:"g-progress-count",style:e.normalizeStyle({color:t.textColor})},[e.renderSlot(t.$slots,"count",{},()=>[e.createTextVNode(e.toDisplayString(s.value)+"%",1)],!0)],4)]))}}),a=u._export_sfc(v,[["__scopeId","data-v-324fae85"]]);a.install=l=>{l.component(a.name,a)};exports.GProgress=a;exports.default=a;
|