geekin-devtoys 0.2.14 → 0.2.16
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 +181 -177
- 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/components/GCount/index.d.ts +4 -4
- package/lib/components/GProgress/index.d.ts +27 -5
- package/lib/components/GRing/index.d.ts +78 -0
- 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
|
|
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 wt = { class: "g-pie3d-tooltip__default" }, St = { 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,253 +25,257 @@ const wt = { class: "g-pie3d-tooltip__default" }, St = { class: "g-pie3d-tooltip
|
|
|
25
25
|
glowColor: "",
|
|
26
26
|
labelLineColor: "auto",
|
|
27
27
|
labelLineWidth: 1
|
|
28
|
-
},
|
|
29
|
-
let
|
|
30
|
-
const
|
|
31
|
-
x:
|
|
32
|
-
y:
|
|
33
|
-
}),
|
|
34
|
-
x:
|
|
35
|
-
y:
|
|
36
|
-
}),
|
|
37
|
-
if (!
|
|
38
|
-
const t =
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
v = Math.max(20,
|
|
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
|
|
47
|
-
|
|
48
|
-
const i =
|
|
49
|
-
|
|
50
|
-
data:
|
|
51
|
-
index:
|
|
52
|
-
color:
|
|
53
|
-
startA:
|
|
54
|
-
endA:
|
|
55
|
-
midA:
|
|
46
|
+
let l = -Math.PI / 2 + tt(a.startAngle);
|
|
47
|
+
w.data.forEach((n, s) => {
|
|
48
|
+
const i = n.value / t, h = i * Math.PI * 2;
|
|
49
|
+
M.push({
|
|
50
|
+
data: n,
|
|
51
|
+
index: s,
|
|
52
|
+
color: n.color || a.colors[s % a.colors.length],
|
|
53
|
+
startA: l,
|
|
54
|
+
endA: l + h,
|
|
55
|
+
midA: l + h / 2,
|
|
56
56
|
percent: i,
|
|
57
57
|
hover: !1,
|
|
58
58
|
hoverProgress: 0
|
|
59
|
-
}),
|
|
59
|
+
}), l += h;
|
|
60
60
|
});
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
const t = 800,
|
|
64
|
-
const i = Math.min(1, (
|
|
65
|
-
|
|
61
|
+
}, ft = () => {
|
|
62
|
+
$ = 0;
|
|
63
|
+
const t = 800, l = performance.now(), n = (s) => {
|
|
64
|
+
const i = Math.min(1, (s - l) / t);
|
|
65
|
+
$ = 1 - Math.pow(1 - i, 3), U(), i < 1 ? X = requestAnimationFrame(n) : (N = !1, X = null);
|
|
66
66
|
};
|
|
67
|
-
X = requestAnimationFrame(
|
|
68
|
-
},
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
let
|
|
73
|
-
for (const i of
|
|
74
|
-
const
|
|
75
|
-
if (i.hoverProgress ===
|
|
76
|
-
const
|
|
77
|
-
i.hoverProgress +=
|
|
67
|
+
X = requestAnimationFrame(n);
|
|
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
|
+
let s = !1;
|
|
73
|
+
for (const i of M) {
|
|
74
|
+
const h = i.hover ? 1 : 0;
|
|
75
|
+
if (i.hoverProgress === h) continue;
|
|
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
|
-
|
|
79
|
+
U(), s ? I = requestAnimationFrame(et) : (I = null, E = 0);
|
|
80
80
|
}, ot = () => {
|
|
81
|
-
|
|
82
|
-
}, S = (t,
|
|
83
|
-
let
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
return `rgba(${
|
|
87
|
-
},
|
|
88
|
-
if (!
|
|
89
|
-
const t =
|
|
90
|
-
if (t.clearRect(0, 0,
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
return { ...e, startA:
|
|
81
|
+
I == null && (E = 0, I = requestAnimationFrame(et));
|
|
82
|
+
}, S = (t, l) => {
|
|
83
|
+
let n = t.replace("#", "");
|
|
84
|
+
n.length === 3 && (n = n.split("").map((p) => p + p).join(""));
|
|
85
|
+
const s = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), h = parseInt(n.slice(4, 6), 16);
|
|
86
|
+
return `rgba(${s},${i},${h},${l})`;
|
|
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
|
-
if (
|
|
95
|
+
if (a.showAura) {
|
|
96
96
|
const e = t.createRadialGradient(
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
u,
|
|
98
|
+
f + a.depth,
|
|
99
99
|
v * 0.1,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
u,
|
|
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(
|
|
105
|
-
for (let
|
|
106
|
-
const
|
|
107
|
-
t.beginPath(), t.ellipse(
|
|
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
|
|
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
|
|
114
|
-
const
|
|
115
|
-
for (;
|
|
116
|
-
const
|
|
117
|
-
if (Math.sin(
|
|
118
|
-
const
|
|
119
|
-
t.fillStyle = S(
|
|
119
|
+
let c = e.startA;
|
|
120
|
+
const d = a.glowColor || e.color;
|
|
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 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();
|
|
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 =
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
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();
|
|
136
|
+
const d = t.createRadialGradient(
|
|
137
|
+
u + e.ox - v * 0.2,
|
|
138
|
+
f + e.oy - x * 0.2,
|
|
141
139
|
0,
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
u + e.ox,
|
|
141
|
+
f + e.oy,
|
|
144
142
|
v * 1.05
|
|
145
143
|
);
|
|
146
|
-
|
|
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 (
|
|
149
|
-
t.font = `${
|
|
150
|
-
const e = [],
|
|
146
|
+
if (a.showLabel && $ >= 0.999) {
|
|
147
|
+
t.font = `${a.labelFontSize}px Arial, sans-serif`, t.textBaseline = "middle";
|
|
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:
|
|
155
|
+
anchorX: P,
|
|
158
156
|
anchorY: r,
|
|
159
|
-
targetY:
|
|
160
|
-
y:
|
|
161
|
-
color:
|
|
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((r,
|
|
168
|
-
const y =
|
|
165
|
+
o.sort((r, H) => r.targetY - H.targetY);
|
|
166
|
+
const y = m + a.labelFontSize / 2, P = k - m - a.labelFontSize / 2;
|
|
169
167
|
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 +
|
|
171
|
-
if (o[o.length - 1].y >
|
|
172
|
-
o[o.length - 1].y =
|
|
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;
|
|
173
171
|
for (let r = o.length - 2; r >= 0; r--)
|
|
174
|
-
o[r].y > o[r + 1].y -
|
|
172
|
+
o[r].y > o[r + 1].y - d && (o[r].y = o[r + 1].y - d);
|
|
175
173
|
}
|
|
176
174
|
for (let r = 0; r < o.length; r++)
|
|
177
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
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
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
|
-
}, nt = (t,
|
|
200
|
-
for (let
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
203
|
-
let
|
|
204
|
-
for (;
|
|
205
|
-
for (;
|
|
206
|
-
if (
|
|
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;
|
|
200
|
+
if (i * i + h * h > 1) continue;
|
|
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
|
-
}, 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);
|
|
217
|
-
} else
|
|
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
207
|
}, at = (t) => {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
208
|
+
const l = T.value, n = l.getBoundingClientRect(), s = n.width / (l.clientWidth || n.width) || 1, i = n.height / (l.clientHeight || n.height) || 1;
|
|
209
|
+
return {
|
|
210
|
+
mx: (t.clientX - n.left) / s,
|
|
211
|
+
my: (t.clientY - n.top) / i
|
|
212
|
+
};
|
|
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);
|
|
221
|
+
} else
|
|
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);
|
|
225
229
|
};
|
|
226
|
-
return
|
|
227
|
-
() =>
|
|
230
|
+
return it(
|
|
231
|
+
() => w.data,
|
|
228
232
|
() => {
|
|
229
|
-
Object.assign(
|
|
233
|
+
Object.assign(a, q, w.config), N = w.animation, W();
|
|
230
234
|
},
|
|
231
235
|
{ deep: !0 }
|
|
232
|
-
),
|
|
233
|
-
() =>
|
|
236
|
+
), it(
|
|
237
|
+
() => w.config,
|
|
234
238
|
() => {
|
|
235
|
-
Object.assign(
|
|
239
|
+
Object.assign(a, q, w.config), W();
|
|
236
240
|
},
|
|
237
241
|
{ deep: !0 }
|
|
238
|
-
),
|
|
239
|
-
|
|
240
|
-
}),
|
|
241
|
-
window.removeEventListener("resize",
|
|
242
|
-
}), (t,
|
|
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", {
|
|
243
247
|
class: "g-pie3d-container",
|
|
244
248
|
ref_key: "containerRef",
|
|
245
|
-
ref:
|
|
249
|
+
ref: L
|
|
246
250
|
}, [
|
|
247
|
-
|
|
251
|
+
D("canvas", {
|
|
248
252
|
ref_key: "canvasRef",
|
|
249
|
-
ref:
|
|
250
|
-
onMousemove:
|
|
251
|
-
onMouseleave:
|
|
253
|
+
ref: T,
|
|
254
|
+
onMousemove: pt,
|
|
255
|
+
onMouseleave: vt
|
|
252
256
|
}, null, 544),
|
|
253
|
-
B.value ? (
|
|
257
|
+
B.value ? (rt(), st("div", {
|
|
254
258
|
key: 0,
|
|
255
259
|
class: "g-pie3d-tooltip",
|
|
256
|
-
style:
|
|
260
|
+
style: Pt({ left: `${Q.value}px`, top: `${Z.value}px` })
|
|
257
261
|
}, [
|
|
258
|
-
|
|
259
|
-
data:
|
|
260
|
-
percent:
|
|
262
|
+
wt(t.$slots, "tooltip", {
|
|
263
|
+
data: R.value,
|
|
264
|
+
percent: V.value
|
|
261
265
|
}, () => [
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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)
|
|
265
269
|
])
|
|
266
270
|
], !0)
|
|
267
|
-
], 4)) :
|
|
271
|
+
], 4)) : bt("", !0)
|
|
268
272
|
], 512));
|
|
269
273
|
}
|
|
270
|
-
}),
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
}), K = /* @__PURE__ */ St(It, [["__scopeId", "data-v-023ff455"]]);
|
|
275
|
+
K.install = (O) => {
|
|
276
|
+
O.component(K.name, K);
|
|
273
277
|
};
|
|
274
278
|
export {
|
|
275
|
-
|
|
276
|
-
|
|
279
|
+
K as GPie3D,
|
|
280
|
+
K as default
|
|
277
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;
|
package/lib/GProgress/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as v, computed as i, createElementBlock as l, openBlock as d, createElementVNode as s, renderSlot as g, normalizeStyle as a, normalizeClass as h, createCommentVNode as w, Fragment as c, renderList as y, createTextVNode as b, toDisplayString as $ } from "vue";
|
|
2
|
+
import { _ as S } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
3
|
+
const _ = { class: "g-progress-bar-container" }, k = { class: "g-progress-info" }, C = ["aria-valuenow"], D = {
|
|
4
|
+
class: "g-progress-splash",
|
|
5
|
+
"aria-hidden": "true"
|
|
6
|
+
}, N = /* @__PURE__ */ v({
|
|
4
7
|
name: "GProgress",
|
|
5
8
|
inheritAttrs: !1,
|
|
6
9
|
__name: "index",
|
|
@@ -8,42 +11,84 @@ const m = { class: "g-progress-bar-container" }, h = { class: "g-progress-info"
|
|
|
8
11
|
count: { default: 0 },
|
|
9
12
|
height: { default: 10 },
|
|
10
13
|
gradient: { default: () => ["#3b82f6", "#f97316"] },
|
|
11
|
-
textColor: { default: "#fff" }
|
|
14
|
+
textColor: { default: "#fff" },
|
|
15
|
+
wave: { type: Boolean, default: !1 },
|
|
16
|
+
waveSpeed: { default: 3 },
|
|
17
|
+
forceAnimation: { type: Boolean, default: !1 }
|
|
12
18
|
},
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
setup(o) {
|
|
20
|
+
const r = o, n = i(() => {
|
|
21
|
+
const e = Number(r.count);
|
|
22
|
+
return Number.isFinite(e) ? Math.min(100, Math.max(0, e)) : 0;
|
|
23
|
+
}), f = i(() => typeof r.height == "number" ? `${r.height}px` : r.height), p = i(() => {
|
|
24
|
+
const [e = "#3b82f6", t = "#f97316"] = r.gradient ?? [];
|
|
25
|
+
return `linear-gradient(90deg, ${e} 0%, ${t} 100%)`;
|
|
26
|
+
});
|
|
27
|
+
return (e, t) => (d(), l("div", _, [
|
|
28
|
+
s("div", k, [
|
|
29
|
+
g(e.$slots, "title", {}, void 0, !0)
|
|
18
30
|
]),
|
|
19
|
-
|
|
31
|
+
s("div", {
|
|
20
32
|
class: "g-progress-wrapper",
|
|
21
|
-
style:
|
|
33
|
+
style: a({ height: f.value }),
|
|
34
|
+
role: "progressbar",
|
|
35
|
+
"aria-valuenow": n.value,
|
|
36
|
+
"aria-valuemin": "0",
|
|
37
|
+
"aria-valuemax": "100"
|
|
22
38
|
}, [
|
|
23
|
-
|
|
39
|
+
s("div", {
|
|
24
40
|
class: "g-progress-bg",
|
|
25
|
-
style:
|
|
41
|
+
style: a({ background: p.value })
|
|
26
42
|
}, null, 4),
|
|
27
|
-
|
|
28
|
-
class: "g-progress-fill",
|
|
29
|
-
style:
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
s("div", {
|
|
44
|
+
class: h(["g-progress-fill", { "is-wave": e.wave, "is-force-animation": e.forceAnimation }]),
|
|
45
|
+
style: a({ width: `${n.value}%`, background: p.value })
|
|
46
|
+
}, [
|
|
47
|
+
e.wave ? (d(), l(c, { key: 0 }, [
|
|
48
|
+
s("div", {
|
|
49
|
+
class: "g-progress-sweep g-progress-sweep--front",
|
|
50
|
+
style: a({ animationDuration: `${e.waveSpeed}s` }),
|
|
51
|
+
"aria-hidden": "true"
|
|
52
|
+
}, null, 4),
|
|
53
|
+
s("div", {
|
|
54
|
+
class: "g-progress-sweep g-progress-sweep--back",
|
|
55
|
+
style: a({ animationDuration: `${e.waveSpeed * 1.6}s` }),
|
|
56
|
+
"aria-hidden": "true"
|
|
57
|
+
}, null, 4),
|
|
58
|
+
t[0] || (t[0] = s("div", {
|
|
59
|
+
class: "g-progress-grid",
|
|
60
|
+
"aria-hidden": "true"
|
|
61
|
+
}, null, -1)),
|
|
62
|
+
s("div", {
|
|
63
|
+
class: "g-progress-impact",
|
|
64
|
+
style: a({ animationDuration: `${e.waveSpeed}s` }),
|
|
65
|
+
"aria-hidden": "true"
|
|
66
|
+
}, null, 4),
|
|
67
|
+
s("div", D, [
|
|
68
|
+
(d(), l(c, null, y(6, (m) => s("span", {
|
|
69
|
+
key: m,
|
|
70
|
+
class: "g-progress-splash__particle",
|
|
71
|
+
style: a({ animationDuration: `${e.waveSpeed}s` })
|
|
72
|
+
}, null, 4)), 64))
|
|
73
|
+
])
|
|
74
|
+
], 64)) : w("", !0)
|
|
75
|
+
], 6)
|
|
76
|
+
], 12, C),
|
|
77
|
+
s("div", {
|
|
33
78
|
class: "g-progress-count",
|
|
34
|
-
style:
|
|
79
|
+
style: a({ color: e.textColor })
|
|
35
80
|
}, [
|
|
36
|
-
|
|
37
|
-
|
|
81
|
+
g(e.$slots, "count", {}, () => [
|
|
82
|
+
b($(n.value) + "%", 1)
|
|
38
83
|
], !0)
|
|
39
84
|
], 4)
|
|
40
85
|
]));
|
|
41
86
|
}
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
|
|
87
|
+
}), u = /* @__PURE__ */ S(N, [["__scopeId", "data-v-324fae85"]]);
|
|
88
|
+
u.install = (o) => {
|
|
89
|
+
o.component(u.name, u);
|
|
45
90
|
};
|
|
46
91
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
92
|
+
u as GProgress,
|
|
93
|
+
u as default
|
|
49
94
|
};
|
package/lib/GProgress/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.g-progress-bar-container[data-v-
|
|
1
|
+
.g-progress-bar-container[data-v-324fae85]{display:flex;align-items:center;width:100%;font-size:14px;line-height:1.4}.g-progress-bar-container .g-progress-info[data-v-324fae85]{flex:0 0 auto;color:#fff;margin-right:12px;font-size:inherit;line-height:inherit;white-space:nowrap}.g-progress-bar-container .g-progress-wrapper[data-v-324fae85]{flex:1;background:#ffffff1a;border-radius:4px;overflow:hidden;margin:0 auto;position:relative}.g-progress-bar-container .g-progress-wrapper .g-progress-bg[data-v-324fae85]{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.2;border-radius:4px}.g-progress-bar-container .g-progress-wrapper .g-progress-fill[data-v-324fae85]{position:absolute;top:0;left:0;height:100%;border-radius:4px;transition:width .5s ease;box-shadow:0 0 10px #3b82f680;overflow:hidden;isolation:isolate}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-sweep[data-v-324fae85]{position:absolute;top:0;left:0;height:100%;pointer-events:none;will-change:transform,opacity;animation-name:g-progress-sweep-move-324fae85;animation-timing-function:cubic-bezier(.45,0,.55,1);animation-iteration-count:infinite;mix-blend-mode:screen}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-sweep--front[data-v-324fae85]{width:70%;background:linear-gradient(90deg,#fff0,#ffffff14,#ffffff4d,#ffffff14,#fff0);filter:blur(.5px)}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-sweep--back[data-v-324fae85]{width:110%;background:linear-gradient(90deg,#fff0,#ffffff1f,#fff0);filter:blur(1px)}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-grid[data-v-324fae85]{position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(90deg,rgba(255,255,255,.08) 1px,transparent 1px),linear-gradient(0deg,rgba(255,255,255,.05) 1px,transparent 1px);background-size:14px 100%,100% 7px;opacity:.35;mix-blend-mode:overlay}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-impact[data-v-324fae85]{position:absolute;top:0;right:0;width:18px;height:100%;pointer-events:none;background:linear-gradient(270deg,#ffffff8c,#fff3 45%,#fff0);box-shadow:0 0 12px #ffffff59;filter:blur(1px);opacity:0;will-change:opacity,transform;transform-origin:right center;animation-name:g-progress-impact-flash-324fae85;animation-timing-function:cubic-bezier(.45,0,.55,1);animation-iteration-count:infinite;mix-blend-mode:screen}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash[data-v-324fae85]{position:absolute;top:0;right:0;width:0;height:100%;pointer-events:none}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash .g-progress-splash__particle[data-v-324fae85]{position:absolute;top:50%;left:0;width:2px;height:2px;border-radius:50%;background:#ffffff8c;box-shadow:0 0 4px #ffffff59;opacity:0;will-change:transform,opacity;animation:g-progress-splash-burst-324fae85 cubic-bezier(.4,0,.6,1) infinite;mix-blend-mode:screen}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash .g-progress-splash__particle[data-v-324fae85]:nth-child(1){--splash-x: 7px;--splash-y: -8px}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash .g-progress-splash__particle[data-v-324fae85]:nth-child(2){--splash-x: 9px;--splash-y: -2px;width:1.5px;height:1.5px}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash .g-progress-splash__particle[data-v-324fae85]:nth-child(3){--splash-x: 5px;--splash-y: -10px;width:2.5px;height:2.5px}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash .g-progress-splash__particle[data-v-324fae85]:nth-child(4){--splash-x: 8px;--splash-y: 6px}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash .g-progress-splash__particle[data-v-324fae85]:nth-child(5){--splash-x: 4px;--splash-y: 9px;width:1.5px;height:1.5px}.g-progress-bar-container .g-progress-wrapper .g-progress-fill .g-progress-splash .g-progress-splash__particle[data-v-324fae85]:nth-child(6){--splash-x: 10px;--splash-y: 1px}.g-progress-bar-container .g-progress-count[data-v-324fae85]{flex:0 0 auto;margin-left:12px;font-size:inherit;line-height:inherit;font-weight:500;min-width:3em;white-space:nowrap;text-align:left;font-variant-numeric:tabular-nums}@keyframes g-progress-sweep-move-324fae85{0%{transform:translate3d(-110%,0,0);opacity:0}25%{opacity:1}75%{opacity:1}to{transform:translate3d(220%,0,0);opacity:0}}@keyframes g-progress-impact-flash-324fae85{0%,55%{opacity:0;transform:scaleX(.8)}72%{opacity:.55;transform:scaleX(1.05)}88%{opacity:.25;transform:scaleX(1)}to{opacity:0;transform:scaleX(.9)}}@keyframes g-progress-splash-burst-324fae85{0%,62%{transform:translate(0) scale(.6);opacity:0}74%{opacity:.6;transform:translate(calc(var(--splash-x, 8px) * .35),calc(var(--splash-y, -8px) * .35)) scale(1)}to{transform:translate(var(--splash-x, 8px),var(--splash-y, -8px)) scale(.4);opacity:0}}@media(prefers-reduced-motion:reduce){.g-progress-bar-container .g-progress-wrapper .g-progress-fill:not(.is-force-animation) .g-progress-sweep--front[data-v-324fae85]{animation-duration:6s!important;opacity:.6}.g-progress-bar-container .g-progress-wrapper .g-progress-fill:not(.is-force-animation) .g-progress-sweep--back[data-v-324fae85],.g-progress-bar-container .g-progress-wrapper .g-progress-fill:not(.is-force-animation) .g-progress-impact[data-v-324fae85],.g-progress-bar-container .g-progress-wrapper .g-progress-fill:not(.is-force-animation) .g-progress-splash__particle[data-v-324fae85]{animation:none!important;opacity:0}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("../_plugin-vue_export-helper-BHFhmbuH.js"),y=["aria-valuenow"],w=["viewBox"],N=["stop-color"],V=["stop-color"],E=["r","stroke","stroke-width"],S=["r","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","transform"],$={class:"g-ring-title"},b={class:"g-ring-count"},d=100,z=e.defineComponent({name:"GRing",inheritAttrs:!1,__name:"index",props:{count:{default:0},size:{default:120},strokeWidth:{default:10},gradient:{default:()=>["#3b82f6","#f97316"]},textColor:{default:"#fff"},wave:{type:Boolean,default:!1},waveSpeed:{default:3},forceAnimation:{type:Boolean,default:!1}},setup(s){const o=s,a=e.computed(()=>{const t=Number(o.count);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}),u=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size),r=d/2,l=e.computed(()=>o.strokeWidth),i=e.computed(()=>r-l.value/2),m=e.computed(()=>2*Math.PI*i.value),g=e.computed(()=>m.value*(1-a.value/100)),f=e.computed(()=>a.value/100*360),p=e.computed(()=>o.gradient?.[0]??"#3b82f6"),v=e.computed(()=>o.gradient?.[1]??"#f97316"),h=e.computed(()=>"rgba(255, 255, 255, 0)"),_=e.computed(()=>"rgba(255, 255, 255, 0.2)"),c=`g-ring-gradient-${e.getCurrentInstance()?.uid??0}`;return(t,B)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["g-ring-container",{"is-force-animation":t.forceAnimation}]),style:e.normalizeStyle({width:u.value,height:u.value}),role:"progressbar","aria-valuenow":a.value,"aria-valuemin":"0","aria-valuemax":"100"},[t.wave?(e.openBlock(),e.createElementBlock("div",{key:0,class:"g-ring-sweep",style:e.normalizeStyle({"--g-ring-stroke":`${l.value}%`,"--g-ring-fill-angle":`${f.value}deg`}),"aria-hidden":"true"},[e.createElementVNode("div",{class:"g-ring-sweep__beam",style:e.normalizeStyle({animationDuration:`${t.waveSpeed}s`,"--g-ring-sweep-from":h.value,"--g-ring-sweep-to":_.value})},null,4)],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createElementBlock("svg",{class:"g-ring-svg",viewBox:`0 0 ${d} ${d}`,"aria-hidden":"true"},[e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},[e.createElementVNode("stop",{offset:"0%","stop-color":p.value},null,8,N),e.createElementVNode("stop",{offset:"100%","stop-color":v.value},null,8,V)])]),e.createElementVNode("circle",{class:"g-ring-track",cx:r,cy:r,r:i.value,fill:"none",stroke:`url(#${c})`,"stroke-width":l.value},null,8,E),e.createElementVNode("circle",{class:"g-ring-fill",cx:r,cy:r,r:i.value,fill:"none",stroke:`url(#${c})`,"stroke-width":l.value,"stroke-linecap":"butt","stroke-dasharray":m.value,"stroke-dashoffset":g.value,transform:`rotate(-90 ${r} ${r})`},null,8,S)],8,w)),e.createElementVNode("div",{class:"g-ring-content",style:e.normalizeStyle({color:t.textColor})},[e.createElementVNode("div",$,[e.renderSlot(t.$slots,"title",{},void 0,!0)]),e.createElementVNode("div",b,[e.renderSlot(t.$slots,"count",{},()=>[e.createTextVNode(e.toDisplayString(a.value)+"%",1)],!0)])],4)],14,y))}}),n=k._export_sfc(z,[["__scopeId","data-v-63242fd9"]]);n.install=s=>{s.component(n.name,n)};exports.GRing=n;exports.default=n;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { defineComponent as x, computed as e, getCurrentInstance as z, createElementBlock as u, openBlock as f, normalizeStyle as i, normalizeClass as S, createCommentVNode as B, createElementVNode as t, renderSlot as h, createTextVNode as C, toDisplayString as N } from "vue";
|
|
2
|
+
import { _ as A } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
3
|
+
const I = ["aria-valuenow"], V = ["viewBox"], F = ["stop-color"], G = ["stop-color"], M = ["r", "stroke", "stroke-width"], T = ["r", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"], W = { class: "g-ring-title" }, D = { class: "g-ring-count" }, g = 100, E = /* @__PURE__ */ x({
|
|
4
|
+
name: "GRing",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
count: { default: 0 },
|
|
9
|
+
size: { default: 120 },
|
|
10
|
+
strokeWidth: { default: 10 },
|
|
11
|
+
gradient: { default: () => ["#3b82f6", "#f97316"] },
|
|
12
|
+
textColor: { default: "#fff" },
|
|
13
|
+
wave: { type: Boolean, default: !1 },
|
|
14
|
+
waveSpeed: { default: 3 },
|
|
15
|
+
forceAnimation: { type: Boolean, default: !1 }
|
|
16
|
+
},
|
|
17
|
+
setup(l) {
|
|
18
|
+
const s = l, a = e(() => {
|
|
19
|
+
const o = Number(s.count);
|
|
20
|
+
return Number.isFinite(o) ? Math.min(100, Math.max(0, o)) : 0;
|
|
21
|
+
}), m = e(() => typeof s.size == "number" ? `${s.size}px` : s.size), r = g / 2, n = e(() => s.strokeWidth), c = e(() => r - n.value / 2), p = e(() => 2 * Math.PI * c.value), _ = e(() => p.value * (1 - a.value / 100)), k = e(() => a.value / 100 * 360), w = e(() => s.gradient?.[0] ?? "#3b82f6"), y = e(() => s.gradient?.[1] ?? "#f97316"), $ = e(() => "rgba(255, 255, 255, 0)"), b = e(() => "rgba(255, 255, 255, 0.2)"), d = `g-ring-gradient-${z()?.uid ?? 0}`;
|
|
22
|
+
return (o, R) => (f(), u("div", {
|
|
23
|
+
class: S(["g-ring-container", { "is-force-animation": o.forceAnimation }]),
|
|
24
|
+
style: i({ width: m.value, height: m.value }),
|
|
25
|
+
role: "progressbar",
|
|
26
|
+
"aria-valuenow": a.value,
|
|
27
|
+
"aria-valuemin": "0",
|
|
28
|
+
"aria-valuemax": "100"
|
|
29
|
+
}, [
|
|
30
|
+
o.wave ? (f(), u("div", {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "g-ring-sweep",
|
|
33
|
+
style: i({
|
|
34
|
+
"--g-ring-stroke": `${n.value}%`,
|
|
35
|
+
"--g-ring-fill-angle": `${k.value}deg`
|
|
36
|
+
}),
|
|
37
|
+
"aria-hidden": "true"
|
|
38
|
+
}, [
|
|
39
|
+
t("div", {
|
|
40
|
+
class: "g-ring-sweep__beam",
|
|
41
|
+
style: i({
|
|
42
|
+
animationDuration: `${o.waveSpeed}s`,
|
|
43
|
+
"--g-ring-sweep-from": $.value,
|
|
44
|
+
"--g-ring-sweep-to": b.value
|
|
45
|
+
})
|
|
46
|
+
}, null, 4)
|
|
47
|
+
], 4)) : B("", !0),
|
|
48
|
+
(f(), u("svg", {
|
|
49
|
+
class: "g-ring-svg",
|
|
50
|
+
viewBox: `0 0 ${g} ${g}`,
|
|
51
|
+
"aria-hidden": "true"
|
|
52
|
+
}, [
|
|
53
|
+
t("defs", null, [
|
|
54
|
+
t("linearGradient", {
|
|
55
|
+
id: d,
|
|
56
|
+
x1: "0%",
|
|
57
|
+
y1: "0%",
|
|
58
|
+
x2: "100%",
|
|
59
|
+
y2: "0%"
|
|
60
|
+
}, [
|
|
61
|
+
t("stop", {
|
|
62
|
+
offset: "0%",
|
|
63
|
+
"stop-color": w.value
|
|
64
|
+
}, null, 8, F),
|
|
65
|
+
t("stop", {
|
|
66
|
+
offset: "100%",
|
|
67
|
+
"stop-color": y.value
|
|
68
|
+
}, null, 8, G)
|
|
69
|
+
])
|
|
70
|
+
]),
|
|
71
|
+
t("circle", {
|
|
72
|
+
class: "g-ring-track",
|
|
73
|
+
cx: r,
|
|
74
|
+
cy: r,
|
|
75
|
+
r: c.value,
|
|
76
|
+
fill: "none",
|
|
77
|
+
stroke: `url(#${d})`,
|
|
78
|
+
"stroke-width": n.value
|
|
79
|
+
}, null, 8, M),
|
|
80
|
+
t("circle", {
|
|
81
|
+
class: "g-ring-fill",
|
|
82
|
+
cx: r,
|
|
83
|
+
cy: r,
|
|
84
|
+
r: c.value,
|
|
85
|
+
fill: "none",
|
|
86
|
+
stroke: `url(#${d})`,
|
|
87
|
+
"stroke-width": n.value,
|
|
88
|
+
"stroke-linecap": "butt",
|
|
89
|
+
"stroke-dasharray": p.value,
|
|
90
|
+
"stroke-dashoffset": _.value,
|
|
91
|
+
transform: `rotate(-90 ${r} ${r})`
|
|
92
|
+
}, null, 8, T)
|
|
93
|
+
], 8, V)),
|
|
94
|
+
t("div", {
|
|
95
|
+
class: "g-ring-content",
|
|
96
|
+
style: i({ color: o.textColor })
|
|
97
|
+
}, [
|
|
98
|
+
t("div", W, [
|
|
99
|
+
h(o.$slots, "title", {}, void 0, !0)
|
|
100
|
+
]),
|
|
101
|
+
t("div", D, [
|
|
102
|
+
h(o.$slots, "count", {}, () => [
|
|
103
|
+
C(N(a.value) + "%", 1)
|
|
104
|
+
], !0)
|
|
105
|
+
])
|
|
106
|
+
], 4)
|
|
107
|
+
], 14, I));
|
|
108
|
+
}
|
|
109
|
+
}), v = /* @__PURE__ */ A(E, [["__scopeId", "data-v-63242fd9"]]);
|
|
110
|
+
v.install = (l) => {
|
|
111
|
+
l.component(v.name, v);
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
v as GRing,
|
|
115
|
+
v as default
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.g-ring-container[data-v-63242fd9]{position:relative;display:inline-flex;align-items:center;justify-content:center;font-size:14px;line-height:1.4;isolation:isolate}.g-ring-container .g-ring-svg[data-v-63242fd9]{width:100%;height:100%;display:block}.g-ring-container .g-ring-svg .g-ring-track[data-v-63242fd9]{opacity:.15}.g-ring-container .g-ring-svg .g-ring-fill[data-v-63242fd9]{transition:stroke-dashoffset .5s ease;filter:drop-shadow(0 0 6px rgba(59,130,246,.4))}.g-ring-container .g-ring-sweep[data-v-63242fd9]{position:absolute;inset:0;border-radius:50%;pointer-events:none;overflow:hidden;mask:radial-gradient(circle closest-side,transparent calc(100% - 2 * var(--g-ring-stroke, 10%) - 1%),#000 calc(100% - 2 * var(--g-ring-stroke, 10%)),#000 100%),conic-gradient(from 0deg,#000 0deg,#000 var(--g-ring-fill-angle, 0deg),transparent var(--g-ring-fill-angle, 0deg),transparent 360deg);mask-composite:intersect;-webkit-mask:radial-gradient(circle closest-side,transparent calc(100% - 2 * var(--g-ring-stroke, 10%) - 1%),#000 calc(100% - 2 * var(--g-ring-stroke, 10%)),#000 100%),conic-gradient(from 0deg,#000 0deg,#000 var(--g-ring-fill-angle, 0deg),transparent var(--g-ring-fill-angle, 0deg),transparent 360deg);-webkit-mask-composite:source-in;mix-blend-mode:screen;transition:--g-ring-fill-angle .5s ease}.g-ring-container .g-ring-sweep .g-ring-sweep__beam[data-v-63242fd9]{position:absolute;inset:0;border-radius:50%;background:conic-gradient(from 0deg,var(--g-ring-sweep-from) 0deg,var(--g-ring-sweep-from) 200deg,var(--g-ring-sweep-to) 340deg,var(--g-ring-sweep-from) 360deg);animation:g-ring-sweep-rotate-63242fd9 linear infinite;will-change:transform;filter:blur(.5px)}.g-ring-container .g-ring-content[data-v-63242fd9]{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:0 12%;pointer-events:none;font-variant-numeric:tabular-nums}.g-ring-container .g-ring-content .g-ring-title[data-v-63242fd9]{font-size:inherit;line-height:1.2;opacity:.9}.g-ring-container .g-ring-content .g-ring-title[data-v-63242fd9]:empty{display:none}.g-ring-container .g-ring-content .g-ring-count[data-v-63242fd9]{font-size:1.4em;font-weight:600;line-height:1.2;margin-top:2px}@keyframes g-ring-sweep-rotate-63242fd9{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.g-ring-container:not(.is-force-animation) .g-ring-sweep__beam[data-v-63242fd9]{animation-duration:6s!important;opacity:.6}.g-ring-container:not(.is-force-animation) .g-ring-fill[data-v-63242fd9]{transition:none}}
|
package/lib/GRing.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
3
|
+
* @description 进度数值,范围 0 ~ 100,超出会被自动 clamp
|
|
4
4
|
* @version 0.1.7
|
|
5
5
|
* @default 0
|
|
6
6
|
*/
|
|
7
7
|
count?: number | string;
|
|
8
8
|
/**
|
|
9
|
-
* @description
|
|
9
|
+
* @description 进度条高度,数字按 px 处理,字符串原样输出(支持 rem / % 等)
|
|
10
10
|
* @version 0.1.7
|
|
11
11
|
* @default 10
|
|
12
12
|
*/
|
|
13
|
-
height?: number;
|
|
13
|
+
height?: number | string;
|
|
14
14
|
/**
|
|
15
|
-
* @description
|
|
15
|
+
* @description 渐变颜色,至少需要两个色值
|
|
16
16
|
* @version 0.1.7
|
|
17
17
|
* @default () => ['#3b82f6', '#f97316']
|
|
18
18
|
*/
|
|
@@ -23,6 +23,25 @@ interface Props {
|
|
|
23
23
|
* @default () => '#fff'
|
|
24
24
|
*/
|
|
25
25
|
textColor?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description 是否启用水波 wave 动效(建议 height ≥ 16 时观感更佳)
|
|
28
|
+
* @version 0.2.13
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
wave?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description 水波动效周期(秒),数值越小波动越快
|
|
34
|
+
* @version 0.2.13
|
|
35
|
+
* @default 3
|
|
36
|
+
*/
|
|
37
|
+
waveSpeed?: number;
|
|
38
|
+
/**
|
|
39
|
+
* @description 强制开启动效,忽略系统的 prefers-reduced-motion 偏好。
|
|
40
|
+
* 适用于数据大屏等需要常态动效的场景;常规业务页建议保持默认以尊重无障碍设置。
|
|
41
|
+
* @version 0.2.14
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
forceAnimation?: boolean;
|
|
26
45
|
}
|
|
27
46
|
declare function __VLS_template(): {
|
|
28
47
|
attrs: Partial<{}>;
|
|
@@ -36,9 +55,12 @@ declare function __VLS_template(): {
|
|
|
36
55
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
37
56
|
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
38
57
|
count: number | string;
|
|
39
|
-
height: number;
|
|
58
|
+
height: number | string;
|
|
40
59
|
gradient: string[];
|
|
41
60
|
textColor: string;
|
|
61
|
+
wave: boolean;
|
|
62
|
+
waveSpeed: number;
|
|
63
|
+
forceAnimation: boolean;
|
|
42
64
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
43
65
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
44
66
|
export default _default;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/**
|
|
3
|
+
* @description 进度数值,范围 0 ~ 100,超出会被自动 clamp
|
|
4
|
+
* @version 0.2.16
|
|
5
|
+
* @default 0
|
|
6
|
+
*/
|
|
7
|
+
count?: number | string;
|
|
8
|
+
/**
|
|
9
|
+
* @description 圆环外径,数字按 px 处理,字符串原样输出(支持 rem / % 等)
|
|
10
|
+
* @version 0.2.16
|
|
11
|
+
* @default 120
|
|
12
|
+
*/
|
|
13
|
+
size?: number | string;
|
|
14
|
+
/**
|
|
15
|
+
* @description 圆环线宽(px)
|
|
16
|
+
* @version 0.2.16
|
|
17
|
+
* @default 10
|
|
18
|
+
*/
|
|
19
|
+
strokeWidth?: number;
|
|
20
|
+
/**
|
|
21
|
+
* @description 渐变颜色,至少需要两个色值
|
|
22
|
+
* @version 0.2.16
|
|
23
|
+
* @default () => ['#3b82f6', '#f97316']
|
|
24
|
+
*/
|
|
25
|
+
gradient?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* @description 文字颜色
|
|
28
|
+
* @version 0.2.16
|
|
29
|
+
* @default '#fff'
|
|
30
|
+
*/
|
|
31
|
+
textColor?: string;
|
|
32
|
+
/**
|
|
33
|
+
* @description 是否启用扫光动效
|
|
34
|
+
* @version 0.2.16
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
wave?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @description 扫光动效周期(秒),数值越小转动越快
|
|
40
|
+
* @version 0.2.16
|
|
41
|
+
* @default 3
|
|
42
|
+
*/
|
|
43
|
+
waveSpeed?: number;
|
|
44
|
+
/**
|
|
45
|
+
* @description 强制开启动效,忽略系统的 prefers-reduced-motion 偏好。
|
|
46
|
+
* 适用于数据大屏等需要常态动效的场景;常规业务页建议保持默认以尊重无障碍设置。
|
|
47
|
+
* @version 0.2.16
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
forceAnimation?: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare function __VLS_template(): {
|
|
53
|
+
attrs: Partial<{}>;
|
|
54
|
+
slots: {
|
|
55
|
+
title?(_: {}): any;
|
|
56
|
+
count?(_: {}): any;
|
|
57
|
+
};
|
|
58
|
+
refs: {};
|
|
59
|
+
rootEl: any;
|
|
60
|
+
};
|
|
61
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
62
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
63
|
+
size: number | string;
|
|
64
|
+
count: number | string;
|
|
65
|
+
gradient: string[];
|
|
66
|
+
textColor: string;
|
|
67
|
+
wave: boolean;
|
|
68
|
+
waveSpeed: number;
|
|
69
|
+
forceAnimation: boolean;
|
|
70
|
+
strokeWidth: number;
|
|
71
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
72
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
73
|
+
export default _default;
|
|
74
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
75
|
+
new (): {
|
|
76
|
+
$slots: S;
|
|
77
|
+
};
|
|
78
|
+
};
|
package/lib/index/index.js
CHANGED
|
@@ -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"),
|
|
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"),i=require("../GProgress/index.js"),a=require("../GScreen/index.js"),d=require("../GPluginVideo/index.js"),G=require("../GPie3D/index.js"),s=require("../GRing/index.js"),t={GCount:u.default,GDialog:o.default,GTable:l.default,GVideo:n.default,GBubble:r.default,GProgress:i.default,GScreen:a.default,GPluginVideo:d.default,GPie3D:G.default,GRing:s.default},g=c=>{Object.keys(t).forEach(f=>{const e=t[f];c.component(e.name,e)})},b={install:g};exports.GCount=u.default;exports.GDialog=o.default;exports.GTable=l.default;exports.GVideo=n.default;exports.GBubble=r.default;exports.GProgress=i.default;exports.GScreen=a.default;exports.GPluginVideo=d.default;exports.GPie3D=G.default;exports.GRing=s.default;exports.default=b;
|
package/lib/index/index.mjs
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import n from "../GCount/index.mjs";
|
|
2
|
+
import t from "../GDialog/index.mjs";
|
|
3
3
|
import e from "../GTable/index.mjs";
|
|
4
4
|
import s from "../GVideo/index.mjs";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import f from "../GBubble/index.mjs";
|
|
6
|
+
import c from "../GProgress/index.mjs";
|
|
7
|
+
import p from "../GScreen/index.mjs";
|
|
8
|
+
import a from "../GPluginVideo/index.mjs";
|
|
9
9
|
import G from "../GPie3D/index.mjs";
|
|
10
|
+
import l from "../GRing/index.mjs";
|
|
10
11
|
const m = {
|
|
11
|
-
GCount:
|
|
12
|
-
GDialog:
|
|
12
|
+
GCount: n,
|
|
13
|
+
GDialog: t,
|
|
13
14
|
GTable: e,
|
|
14
15
|
GVideo: s,
|
|
15
|
-
GBubble:
|
|
16
|
-
GProgress:
|
|
17
|
-
GScreen:
|
|
18
|
-
GPluginVideo:
|
|
19
|
-
GPie3D: G
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
GBubble: f,
|
|
17
|
+
GProgress: c,
|
|
18
|
+
GScreen: p,
|
|
19
|
+
GPluginVideo: a,
|
|
20
|
+
GPie3D: G,
|
|
21
|
+
GRing: l
|
|
22
|
+
}, u = (r) => {
|
|
23
|
+
Object.keys(m).forEach((i) => {
|
|
24
|
+
const o = m[i];
|
|
23
25
|
r.component(o.name, o);
|
|
24
26
|
});
|
|
25
|
-
},
|
|
27
|
+
}, $ = { install: u };
|
|
26
28
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
f as GBubble,
|
|
30
|
+
n as GCount,
|
|
31
|
+
t as GDialog,
|
|
30
32
|
G as GPie3D,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
a as GPluginVideo,
|
|
34
|
+
c as GProgress,
|
|
35
|
+
l as GRing,
|
|
36
|
+
p as GScreen,
|
|
34
37
|
e as GTable,
|
|
35
38
|
s as GVideo,
|
|
36
|
-
|
|
39
|
+
$ as default
|
|
37
40
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -7,8 +7,9 @@ import { GProgress } from './components/GProgress';
|
|
|
7
7
|
import { GScreen } from './components/GScreen';
|
|
8
8
|
import { GPluginVideo } from './components/GPluginVideo';
|
|
9
9
|
import { GPie3D } from './components/GPie3D';
|
|
10
|
+
import { GRing } from './components/GRing';
|
|
10
11
|
declare const _default: {
|
|
11
12
|
install: (app: any) => void;
|
|
12
13
|
};
|
|
13
14
|
export default _default;
|
|
14
|
-
export { GCount, GDialog, GTable, GVideo, GBubble, GProgress, GScreen, GPluginVideo, GPie3D };
|
|
15
|
+
export { GCount, GDialog, GTable, GVideo, GBubble, GProgress, GScreen, GPluginVideo, GPie3D, GRing };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geekin-devtoys",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"author": "leon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "geekin-devtoys组件库",
|
|
@@ -112,6 +112,14 @@
|
|
|
112
112
|
"import": "./lib/GProgress/style.css",
|
|
113
113
|
"require": "./lib/GProgress/style.css"
|
|
114
114
|
},
|
|
115
|
+
"./GRing": {
|
|
116
|
+
"import": "./lib/GRing/index.mjs",
|
|
117
|
+
"require": "./lib/GRing/index.js"
|
|
118
|
+
},
|
|
119
|
+
"./GRing/style": {
|
|
120
|
+
"import": "./lib/GRing/style.css",
|
|
121
|
+
"require": "./lib/GRing/style.css"
|
|
122
|
+
},
|
|
115
123
|
"./GScreen": {
|
|
116
124
|
"import": "./lib/GScreen/index.mjs",
|
|
117
125
|
"require": "./lib/GScreen/index.js"
|