geekin-devtoys 0.3.7 → 0.3.9
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/GBubble/index.js +1 -2
- package/lib/GBubble/index.mjs +3 -210
- package/lib/GBubble-C3cM9Put.mjs +216 -0
- package/lib/GBubble-Dph0YDkU.js +2 -0
- package/lib/GButton/index.js +1 -0
- package/lib/GButton/index.mjs +84 -0
- package/lib/GButton/style.css +1 -0
- package/lib/GButton.d.ts +1 -0
- package/lib/GCard/index.js +1 -1
- package/lib/GCard/index.mjs +1 -1
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +271 -342
- package/lib/GDialog/style.css +1 -1
- package/lib/GInput/index.js +1 -0
- package/lib/GInput/index.mjs +145 -0
- package/lib/GInput/style.css +1 -0
- package/lib/GInput.d.ts +1 -0
- package/lib/GInputTreeTag/index.js +1 -1
- package/lib/GInputTreeTag/index.mjs +77 -75
- package/lib/GInputTreeTag/style.css +1 -1
- package/lib/GPie3D/index.js +1 -1
- package/lib/GPie3D/index.mjs +1 -1
- package/lib/GProgress/index.js +1 -1
- package/lib/GProgress/index.mjs +1 -1
- package/lib/GRing/index.js +1 -1
- package/lib/GRing/index.mjs +1 -1
- package/lib/GScroller/index.js +1 -1
- package/lib/GScroller/index.mjs +135 -152
- package/lib/GShinyText/index.js +1 -1
- package/lib/GShinyText/index.mjs +45 -119
- package/lib/GSteps/index.js +1 -1
- package/lib/GSteps/index.mjs +89 -43
- package/lib/GSteps/style.css +1 -1
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +1 -1
- package/lib/GTag/index.js +1 -0
- package/lib/GTag/index.mjs +73 -0
- package/lib/GTag.d.ts +1 -0
- package/lib/GVideo/index.js +2 -2
- package/lib/GVideo/index.mjs +159 -158
- package/lib/GVideo/style.css +1 -1
- package/lib/assets/GTag.css +1 -0
- package/lib/components/GButton/index.d.ts +38 -0
- package/lib/components/GDialog/const.d.ts +4 -4
- package/lib/components/GDialog/icons.d.ts +4 -4
- package/lib/components/GInput/index.d.ts +64 -0
- package/lib/components/GInputTreeTag/index.d.ts +16 -16
- package/lib/components/GProgress/index.d.ts +1 -1
- package/lib/components/GRing/index.d.ts +1 -1
- package/lib/components/GScreen/index.d.ts +1 -1
- package/lib/components/GTag/index.d.ts +38 -0
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +42 -33
- package/lib/index/style.css +25 -0
- package/lib/index.d.ts +4 -1
- package/package.json +20 -20
- package/lib/AnimatePresence-26Wy0TGN.js +0 -9
- package/lib/AnimatePresence-nl0c23TZ.mjs +0 -136
- package/lib/_plugin-vue_export-helper-BHFhmbuH.js +0 -1
- package/lib/_plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
- package/lib/components/GDialog/GButton.d.ts +0 -42
- package/lib/index-B8Ap0044.js +0 -1
- package/lib/index-Bbr5fWvI.mjs +0 -5158
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-input-tree-tag[data-v-
|
|
1
|
+
@charset "UTF-8";.g-input-tree-tag[data-v-e10d8b6e]{width:100%}.g-input-tree-tag__wrap[data-v-e10d8b6e]{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.g-input-tree-tag__tags[data-v-e10d8b6e]{display:flex;flex-wrap:wrap;gap:8px;width:100%}.g-input-tree-tag__tag-motion[data-v-e10d8b6e]{display:inline-flex}.g-input-tree-tag__tag[data-v-e10d8b6e]{margin:0}.g-input-tree-tag.is-disabled[data-v-e10d8b6e]{cursor:not-allowed}.g-input-tree-tag__popover{box-sizing:border-box;background:var(--el-bg-color-overlay, #fff);border:1px solid var(--el-border-color-light);border-radius:4px;box-shadow:var(--el-box-shadow-light);padding:8px 0}.g-input-tree-tag__popover .g-input-tree-tag__tree-wrap{overflow:auto}.g-input-tree-tag__popover .g-input-tree-tag__node{display:inline-flex;align-items:center;gap:4px;font-size:13px}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selectable{cursor:pointer;color:var(--el-text-color-primary)}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selected{color:var(--el-color-primary)}
|
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"),pt=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("vue"),pt=require("../GBubble-Dph0YDkU.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(N,{emit:at}){const S=N,lt=at,V={alpha:55,depth:26,startAngle:0,colors:["#22d3ee","#3b82f6","#8b5cf6","#06b6d4","#0ea5e9","#a855f7","#14b8a6"],textColor:"#cbd5e1",radiusRatio:.55,hoverDistance:14,showLabel:!0,showPercent:!0,labelFontSize:12,opacity:.7,showAura:!0,glowColor:"",labelLineColor:"auto",labelLineWidth:1},a={...V,...S.config},E=h.ref(null),C=h.ref(null);let L=null,k=0,_=0,Y=1,p=0,u=0,g=0,M=0,b=[],$=S.animation?0:1,F=null,q=S.animation,I=null,X=0;const D=h.ref(-1),z=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,G=(t,l=0,n=0)=>({x:p+l+g*Math.cos(t),y:u+n+M*Math.sin(t)}),j=(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,k=t.clientWidth,_=t.clientHeight,l.width=k*Y,l.height=_*Y,l.style.width=k+"px",l.style.height=_+"px",L=l.getContext("2d"),L&&L.setTransform(Y,0,0,Y,0,0),p=k/2,u=_/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=()=>{b=[];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;b.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=()=>{$=0;const t=800,l=performance.now(),n=s=>{const i=Math.min(1,(s-l)/t);$=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 b){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,_),!b.length)return;const l=b[0]?.startA??0,n=Math.PI*2*$,s=l+n,i=b.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))),A=Math.cos(e.midA)*a.hoverDistance*x,P=Math.sin(e.midA)*a.hoverDistance*x;return{...e,startA:c,endA:f,valid:y,ox:A,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},A=G(c,e.ox,e.oy),P=j(c,e.ox,e.oy);t.fillStyle=T(f,a.opacity*.5),t.beginPath(),t.moveTo(y.x,y.y),t.lineTo(A.x,A.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(A.x,A.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 A=G(c,e.ox,e.oy),P=G(y,e.ox,e.oy),o=j(y,e.ox,e.oy),m=j(c,e.ox,e.oy);t.fillStyle=T(f,a.opacity*.4),t.beginPath(),t.moveTo(A.x,A.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&&$>=.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),H=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:H,y:H,color:ft};(m?c:e).push(ut)}const A=o=>{if(!o.length)return;o.sort((r,H)=>r.targetY-H.targetY);const m=x+a.labelFontSize/2,w=_-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)};A(e),A(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),k-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<b.length;n++){const s=b[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,b.forEach((i,d)=>i.hover=d===s),tt()),s>=0){const i=b[s];z.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 z.value=!1,R.value=null},ht=()=>{D.value!==-1&&(D.value=-1,b.forEach(t=>t.hover=!1),tt()),z.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",b[s].data,s)};return h.watch(()=>S.data,()=>{Object.assign(a,V,S.config),q=S.animation,W()},{deep:!0}),h.watch(()=>S.config,()=>{Object.assign(a,V,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),z.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))}}),B=pt._export_sfc(xt,[["__scopeId","data-v-d37c2ffe"]]);B.install=N=>{N.component(B.name,B)};exports.GPie3D=B;exports.default=B;
|
package/lib/GPie3D/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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 "../
|
|
2
|
+
import { _ as St } from "../GBubble-C3cM9Put.mjs";
|
|
3
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: {
|
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"),u=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../GBubble-Dph0YDkU.js"),c={class:"g-progress-bar-container"},m={class:"g-progress-info"},p=["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(s){const r=s,l=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",m,[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":l.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:`${l.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,p),e.createElementVNode("div",{class:"g-progress-count",style:e.normalizeStyle({color:t.textColor})},[e.renderSlot(t.$slots,"count",{},()=>[e.createTextVNode(e.toDisplayString(l.value)+"%",1)],!0)],4)]))}}),a=u._export_sfc(v,[["__scopeId","data-v-324fae85"]]);a.install=s=>{s.component(a.name,a)};exports.GProgress=a;exports.default=a;
|
package/lib/GProgress/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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 "../
|
|
2
|
+
import { _ as S } from "../GBubble-C3cM9Put.mjs";
|
|
3
3
|
const _ = { class: "g-progress-bar-container" }, k = { class: "g-progress-info" }, C = ["aria-valuenow"], D = {
|
|
4
4
|
class: "g-progress-splash",
|
|
5
5
|
"aria-hidden": "true"
|
package/lib/GRing/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"),b=require("../GBubble-Dph0YDkU.js"),V=["aria-valuenow"],B=["viewBox"],z=["stop-color"],x=["stop-color"],C=["r","stroke","stroke-width"],T=["r","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","transform"],M={class:"g-ring-title"},A={class:"g-ring-count"},G={key:1,class:"g-ring-endpoint g-ring-endpoint--head",style:{"--g-ring-endpoint-angle":"0deg"},"aria-hidden":"true"},P={class:"g-ring-endpoint__inner"},R={class:"g-ring-endpoint__inner"},f=100,I=2e3,W=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(d){const o=d,c=e.computed(()=>{const t=Number(o.count);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}),p=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size),n=f/2,r=e.computed(()=>o.strokeWidth),u=e.computed(()=>n-r.value/2),v=e.computed(()=>2*Math.PI*u.value),w=e.computed(()=>v.value*(1-c.value/100)),l=e.computed(()=>c.value/100*360),y=e.computed(()=>o.gradient?.[0]??"#3b82f6"),S=e.computed(()=>o.gradient?.[1]??"#f97316"),E=e.computed(()=>"rgba(255, 255, 255, 0)"),N=e.computed(()=>"rgba(255, 255, 255, 0.2)"),g=`g-ring-gradient-${e.getCurrentInstance()?.uid??0}`,h=e.useSlots(),_=e.ref(null);let a=null,s=null;const m=()=>{s&&(clearTimeout(s),s=null),a&&(a.cancel(),a=null)},k=()=>{const t=_.value;t&&(l.value<=0||(a=t.animate([{transform:"rotate(-340deg)"},{transform:`rotate(${l.value-340}deg)`}],{duration:Math.max(200,o.waveSpeed*1e3),easing:"ease",fill:"forwards"}),a.onfinish=()=>{s=setTimeout(()=>{s=null,k()},I)}))},$=()=>{m(),e.nextTick(k)};return e.watch(()=>[o.wave,l.value,o.waveSpeed],([t])=>{if(!t){m();return}$()},{immediate:!0}),e.onBeforeUnmount(m),(t,O)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["g-ring-container",{"is-force-animation":t.forceAnimation}]),style:e.normalizeStyle({width:p.value,height:p.value,"--g-ring-stroke":`${r.value}%`}),role:"progressbar","aria-valuenow":c.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":`${r.value}%`,"--g-ring-fill-angle":`${l.value}deg`}),"aria-hidden":"true"},[e.createElementVNode("div",{ref_key:"beamRef",ref:_,class:"g-ring-sweep__beam",style:e.normalizeStyle({"--g-ring-sweep-from":E.value,"--g-ring-sweep-to":N.value})},null,4)],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createElementBlock("svg",{class:"g-ring-svg",viewBox:`0 0 ${f} ${f}`,"aria-hidden":"true"},[e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{id:g,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},[e.createElementVNode("stop",{offset:"0%","stop-color":y.value},null,8,z),e.createElementVNode("stop",{offset:"100%","stop-color":S.value},null,8,x)])]),e.createElementVNode("circle",{class:"g-ring-track",cx:n,cy:n,r:u.value,fill:"none",stroke:`url(#${g})`,"stroke-width":r.value},null,8,C),e.createElementVNode("circle",{class:"g-ring-fill",cx:n,cy:n,r:u.value,fill:"none",stroke:`url(#${g})`,"stroke-width":r.value,"stroke-linecap":"butt","stroke-dasharray":v.value,"stroke-dashoffset":w.value,transform:`rotate(-90 ${n} ${n})`},null,8,T)],8,B)),e.createElementVNode("div",{class:"g-ring-content",style:e.normalizeStyle({color:t.textColor})},[e.createElementVNode("div",M,[e.renderSlot(t.$slots,"title",{},void 0,!0)]),e.createElementVNode("div",A,[e.renderSlot(t.$slots,"count",{},()=>[e.createTextVNode(e.toDisplayString(c.value)+"%",1)],!0)])],4),e.unref(h).head?(e.openBlock(),e.createElementBlock("div",G,[e.createElementVNode("div",P,[e.renderSlot(t.$slots,"head",{},void 0,!0)])])):e.createCommentVNode("",!0),e.unref(h).tail?(e.openBlock(),e.createElementBlock("div",{key:2,class:"g-ring-endpoint g-ring-endpoint--tail",style:e.normalizeStyle({"--g-ring-endpoint-angle":`${l.value}deg`}),"aria-hidden":"true"},[e.createElementVNode("div",R,[e.renderSlot(t.$slots,"tail",{},void 0,!0)])],4)):e.createCommentVNode("",!0)],14,V))}}),i=b._export_sfc(W,[["__scopeId","data-v-1505555b"]]);i.install=d=>{d.component(i.name,i)};exports.GRing=i;exports.default=i;
|
package/lib/GRing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as N, computed as n, getCurrentInstance as I, useSlots as P, ref as R, watch as V, onBeforeUnmount as W, createElementBlock as d, openBlock as u, normalizeStyle as c, normalizeClass as F, createCommentVNode as _, createElementVNode as t, renderSlot as f, createTextVNode as G, toDisplayString as O, unref as z, nextTick as U } from "vue";
|
|
2
|
-
import { _ as D } from "../
|
|
2
|
+
import { _ as D } from "../GBubble-C3cM9Put.mjs";
|
|
3
3
|
const j = ["aria-valuenow"], q = ["viewBox"], H = ["stop-color"], J = ["stop-color"], K = ["r", "stroke", "stroke-width"], L = ["r", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"], Q = { class: "g-ring-title" }, X = { class: "g-ring-count" }, Y = {
|
|
4
4
|
key: 1,
|
|
5
5
|
class: "g-ring-endpoint g-ring-endpoint--head",
|
package/lib/GScroller/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"),R=require("motion-v"),x=require("../GBubble-Dph0YDkU.js"),ee=["onMouseenter","onClick"],le={class:"g-scroller__item-text"},te={class:"g-scroller__item-text"},G=80,se=10,ae=e.defineComponent({__name:"index",props:{items:{default:()=>[]},showGradients:{type:Boolean,default:!0},className:{default:""},itemClassName:{default:""},displayScrollbar:{type:Boolean,default:!0},initialSelectedIndex:{default:-1},height:{},stagger:{default:.05},loading:{type:Boolean,default:!1},skeletonCount:{default:5},seamless:{type:Boolean,default:!1},seamlessSpeed:{default:40},seamlessDirection:{default:"up"},seamlessPauseOnHover:{type:Boolean,default:!0}},emits:["itemSelected"],setup(S,{emit:A}){const P=e.defineComponent({name:"AnimatedItem",props:{index:{type:Number,required:!0},stagger:{type:Number,default:.05},instant:{type:Boolean,default:!1}},emits:["mouseenter","click"],setup(l,{slots:n,emit:s}){const a=e.ref(null),i=R.useInView(a,{amount:.5,once:!1});return()=>e.h(R.motion.div,{ref:a,"data-index":l.index,style:{marginBottom:"1rem",cursor:"pointer"},initial:{x:-24,opacity:0},animate:i.value?{x:0,opacity:1}:{x:-24,opacity:0},transition:l.instant?{duration:0}:{duration:.3,delay:Math.min(l.index*l.stagger,.3),ease:"easeOut"},onMouseenter:m=>s("mouseenter",m),onClick:m=>s("click",m)},n.default?.())}}),t=S,q=A,Y=e.useSlots(),N=e.computed(()=>!!Y.default),w=e.ref(null),g=e.ref(t.initialSelectedIndex),b=e.ref(0),V=e.ref(1),H=e.ref(0),v=e.ref(0),h=e.ref(!1);let c=null;const k=e.ref(!1);let $=0,B=0,u=null;const F=e.ref(null),I=e.ref(null),W=e.computed(()=>t.seamless&&t.items.length>0?[...t.items,...t.items]:t.items),o=e.ref(0),_=e.ref(!1),r=e.ref(0),E=e.ref(!1);let d=null,f=0;const U=e.computed(()=>{const l={};return t.height!=null&&t.height!==""&&(l.height=typeof t.height=="number"?`${t.height}px`:String(t.height)),l}),j=e.computed(()=>({transform:`translateY(${o.value}px)`}));function K(l,n,s){return Math.min(Math.max(l,n),s)}const O=l=>{g.value=l},z=(l,n)=>{g.value=n,q("itemSelected",l,n)},X=l=>{const n=l.target,{scrollTop:s,scrollHeight:a,clientHeight:i}=n,m=performance.now();B>0&&Math.abs(s-$)/(m-B)>se&&(k.value=!0),$=s,B=m,u&&clearTimeout(u),u=setTimeout(()=>{k.value=!1},150),b.value=Math.min(s/50,1);const M=a-(s+i);V.value=a<=i?0:Math.min(M/50,1)};function J(l){const n=w.value;if(!n)return;const{scrollTop:s,scrollHeight:a,clientHeight:i}=n;if(a<=i)return;const m=s<=0,M=s+i>=a-1;if(m&&l.deltaY<0||M&&l.deltaY>0){const D=K(v.value-l.deltaY*.3,-G,G);v.value=D,h.value=!0,c&&clearTimeout(c),c=setTimeout(()=>{v.value=0,h.value=!1},150)}}function y(){const l=I.value;if(!l||t.items.length===0){r.value=0,E.value=!1;return}const n=t.items.length,s=l.children[n];r.value=s?s.offsetTop:l.scrollHeight/2;const a=F.value;E.value=a?r.value>a.clientHeight:!0}function L(l){f===0&&(f=l);const n=l-f;if(f=l,!_.value&&r.value>0&&t.items.length>0){const s=t.seamlessSpeed*n/1e3;t.seamlessDirection==="down"?(o.value+=s,o.value>=0&&(o.value-=r.value)):(o.value-=s,o.value<=-r.value&&(o.value+=r.value))}d=requestAnimationFrame(L)}function T(){d==null&&(f=0,d=requestAnimationFrame(L))}function C(){d!=null&&(cancelAnimationFrame(d),d=null),f=0}function Q(){t.seamlessPauseOnHover&&(_.value=!0)}function Z(){t.seamlessPauseOnHover&&(_.value=!1)}return e.onMounted(()=>{t.seamless&&!t.loading&&(y(),o.value=t.seamlessDirection==="down"?-r.value:0,T())}),e.onUnmounted(()=>{C(),c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null)}),e.watch(()=>t.items,()=>{t.seamless&&e.nextTick(()=>{y(),o.value=t.seamlessDirection==="down"?-r.value:0}),H.value++,g.value=-1}),e.watch(()=>t.seamless,l=>{l&&!t.loading?e.nextTick(()=>{y(),o.value=t.seamlessDirection==="down"?-r.value:0,T()}):(C(),o.value=0,_.value=!1)}),e.watch(()=>t.loading,l=>{l?(v.value=0,h.value=!1,k.value=!1,C(),c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null)):t.seamless&&e.nextTick(()=>{y(),o.value=t.seamlessDirection==="down"?-r.value:0,T()})}),(l,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["g-scroller",l.className]),style:e.normalizeStyle(U.value)},[l.seamless&&!l.loading?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"seamlessWrapRef",ref:F,class:"g-scroller__seamless",onMouseenter:Q,onMouseleave:Z},[e.createElementVNode("div",{ref_key:"seamlessTrackRef",ref:I,class:"g-scroller__seamless-track",style:e.normalizeStyle(j.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,(s,a)=>(e.openBlock(),e.createElementBlock("div",{key:`seamless-${a}`,class:e.normalizeClass(["g-scroller__item","g-scroller__item--seamless",!N.value&&"g-scroller__item--default",g.value===a%l.items.length&&"g-scroller__item--active",l.itemClassName]),onMouseenter:i=>O(a%l.items.length),onClick:i=>z(s,a%l.items.length)},[e.renderSlot(l.$slots,"default",{item:s,index:a%l.items.length},()=>[e.createElementVNode("p",le,e.toDisplayString(s),1)],!0)],42,ee))),128))],4),l.showGradients&&E.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[0]||(n[0]=e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--top"},null,-1)),n[1]||(n[1]=e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--bottom"},null,-1))],64)):e.createCommentVNode("",!0)],544)):l.loading?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["g-scroller__list",!l.displayScrollbar&&"g-scroller__list--hidden-scrollbar"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.skeletonCount,s=>(e.openBlock(),e.createElementBlock("div",{key:`skeleton-${s}`,class:"g-scroller__skeleton"},n[2]||(n[2]=[e.createElementVNode("div",{class:"g-scroller__skeleton-line"},null,-1)])))),128))],2)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",{ref_key:"listRef",ref:w,class:e.normalizeClass(["g-scroller__list",!l.displayScrollbar&&"g-scroller__list--hidden-scrollbar"]),onScroll:X,onWheel:J},[e.createElementVNode("div",{class:e.normalizeClass(["g-scroller__content",{"g-scroller__content--pulling":h.value}]),style:e.normalizeStyle({transform:`translateY(${v.value}px)`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,(s,a)=>(e.openBlock(),e.createBlock(e.unref(P),{key:`${H.value}-${a}`,index:a,stagger:l.stagger,instant:k.value,onMouseenter:i=>O(a),onClick:i=>z(s,a)},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["g-scroller__item",!N.value&&"g-scroller__item--default",g.value===a&&"g-scroller__item--active",l.itemClassName])},[e.renderSlot(l.$slots,"default",{item:s,index:a},()=>[e.createElementVNode("p",te,e.toDisplayString(s),1)],!0)],2)]),_:2},1032,["index","stagger","instant","onMouseenter","onClick"]))),128))],6)],34),l.showGradients?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--top",style:e.normalizeStyle({opacity:b.value})},null,4),e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--bottom",style:e.normalizeStyle({opacity:V.value})},null,4)],64)):e.createCommentVNode("",!0)],64))],6))}}),p=x._export_sfc(ae,[["__scopeId","data-v-972060e6"]]);p.install=S=>{S.component(p.name,p)};exports.GScroller=p;exports.default=p;
|
package/lib/GScroller/index.mjs
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
function Me(S, E) {
|
|
6
|
-
const p = n(!1);
|
|
7
|
-
return de((l) => {
|
|
8
|
-
const T = W(E) || {}, { once: H } = T, w = ke(S);
|
|
9
|
-
if (!w || H && p.value) return;
|
|
10
|
-
const g = Se(w, () => (p.value = !0, H ? void 0 : () => {
|
|
11
|
-
p.value = !1;
|
|
12
|
-
}), {
|
|
13
|
-
...T,
|
|
14
|
-
root: W(T.root)
|
|
15
|
-
});
|
|
16
|
-
l(() => {
|
|
17
|
-
g();
|
|
18
|
-
});
|
|
19
|
-
}, { flush: "post" }), p;
|
|
20
|
-
}
|
|
21
|
-
const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" }, be = { class: "g-scroller__item-text" }, ae = 80, Ie = 10, $e = /* @__PURE__ */ ee({
|
|
1
|
+
import { defineComponent as j, ref as n, h as de, useSlots as fe, computed as H, onMounted as ve, onUnmounted as ge, watch as D, nextTick as L, createElementBlock as c, openBlock as r, normalizeStyle as S, normalizeClass as h, createElementVNode as m, createCommentVNode as J, Fragment as _, renderList as N, renderSlot as Q, toDisplayString as Z, createBlock as pe, unref as he, withCtx as _e } from "vue";
|
|
2
|
+
import { useInView as ye, motion as ke } from "motion-v";
|
|
3
|
+
import { _ as Se } from "../GBubble-C3cM9Put.mjs";
|
|
4
|
+
const Te = ["onMouseenter", "onClick"], Me = { class: "g-scroller__item-text" }, we = { class: "g-scroller__item-text" }, x = 80, Ce = 10, He = /* @__PURE__ */ j({
|
|
22
5
|
__name: "index",
|
|
23
6
|
props: {
|
|
24
7
|
items: { default: () => [] },
|
|
@@ -37,8 +20,8 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
|
|
|
37
20
|
seamlessPauseOnHover: { type: Boolean, default: !0 }
|
|
38
21
|
},
|
|
39
22
|
emits: ["itemSelected"],
|
|
40
|
-
setup(
|
|
41
|
-
const
|
|
23
|
+
setup(b, { emit: ee }) {
|
|
24
|
+
const le = j({
|
|
42
25
|
name: "AnimatedItem",
|
|
43
26
|
props: {
|
|
44
27
|
index: { type: Number, required: !0 },
|
|
@@ -47,12 +30,12 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
|
|
|
47
30
|
instant: { type: Boolean, default: !1 }
|
|
48
31
|
},
|
|
49
32
|
emits: ["mouseenter", "click"],
|
|
50
|
-
setup(e, { slots: a, emit:
|
|
51
|
-
const
|
|
52
|
-
return () =>
|
|
53
|
-
|
|
33
|
+
setup(e, { slots: a, emit: s }) {
|
|
34
|
+
const t = n(null), u = ye(t, { amount: 0.5, once: !1 });
|
|
35
|
+
return () => de(
|
|
36
|
+
ke.div,
|
|
54
37
|
{
|
|
55
|
-
ref:
|
|
38
|
+
ref: t,
|
|
56
39
|
"data-index": e.index,
|
|
57
40
|
style: { marginBottom: "1rem", cursor: "pointer" },
|
|
58
41
|
initial: { x: -24, opacity: 0 },
|
|
@@ -62,197 +45,197 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
|
|
|
62
45
|
delay: Math.min(e.index * e.stagger, 0.3),
|
|
63
46
|
ease: "easeOut"
|
|
64
47
|
},
|
|
65
|
-
onMouseenter: (v) =>
|
|
66
|
-
onClick: (v) =>
|
|
48
|
+
onMouseenter: (v) => s("mouseenter", v),
|
|
49
|
+
onClick: (v) => s("click", v)
|
|
67
50
|
},
|
|
68
51
|
a.default?.()
|
|
69
52
|
);
|
|
70
53
|
}
|
|
71
|
-
}), l =
|
|
72
|
-
let
|
|
73
|
-
const
|
|
74
|
-
let
|
|
75
|
-
const
|
|
54
|
+
}), l = b, se = ee, te = fe(), F = H(() => !!te.default), E = n(null), y = n(l.initialSelectedIndex), G = n(0), P = n(1), Y = n(0), k = n(0), T = n(!1);
|
|
55
|
+
let d = null;
|
|
56
|
+
const M = n(!1);
|
|
57
|
+
let V = 0, $ = 0, f = null;
|
|
58
|
+
const W = n(null), q = n(null), ae = H(
|
|
76
59
|
() => l.seamless && l.items.length > 0 ? [...l.items, ...l.items] : l.items
|
|
77
|
-
), o = n(0),
|
|
78
|
-
let
|
|
79
|
-
const
|
|
60
|
+
), o = n(0), w = n(!1), i = n(0), I = n(!1);
|
|
61
|
+
let g = null, p = 0;
|
|
62
|
+
const ne = H(() => {
|
|
80
63
|
const e = {};
|
|
81
64
|
return l.height != null && l.height !== "" && (e.height = typeof l.height == "number" ? `${l.height}px` : String(l.height)), e;
|
|
82
|
-
}),
|
|
65
|
+
}), oe = H(() => ({
|
|
83
66
|
transform: `translateY(${o.value}px)`
|
|
84
67
|
}));
|
|
85
|
-
function
|
|
86
|
-
return Math.min(Math.max(e, a),
|
|
68
|
+
function re(e, a, s) {
|
|
69
|
+
return Math.min(Math.max(e, a), s);
|
|
87
70
|
}
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
const a = e.target, { scrollTop:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, 150),
|
|
97
|
-
const
|
|
98
|
-
|
|
71
|
+
const z = (e) => {
|
|
72
|
+
y.value = e;
|
|
73
|
+
}, U = (e, a) => {
|
|
74
|
+
y.value = a, se("itemSelected", e, a);
|
|
75
|
+
}, ie = (e) => {
|
|
76
|
+
const a = e.target, { scrollTop: s, scrollHeight: t, clientHeight: u } = a, v = performance.now();
|
|
77
|
+
$ > 0 && Math.abs(s - V) / (v - $) > Ce && (M.value = !0), V = s, $ = v, f && clearTimeout(f), f = setTimeout(() => {
|
|
78
|
+
M.value = !1;
|
|
79
|
+
}, 150), G.value = Math.min(s / 50, 1);
|
|
80
|
+
const R = t - (s + u);
|
|
81
|
+
P.value = t <= u ? 0 : Math.min(R / 50, 1);
|
|
99
82
|
};
|
|
100
|
-
function
|
|
101
|
-
const a =
|
|
83
|
+
function ue(e) {
|
|
84
|
+
const a = E.value;
|
|
102
85
|
if (!a) return;
|
|
103
|
-
const { scrollTop:
|
|
104
|
-
if (
|
|
105
|
-
const v =
|
|
106
|
-
if (v && e.deltaY < 0 ||
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
86
|
+
const { scrollTop: s, scrollHeight: t, clientHeight: u } = a;
|
|
87
|
+
if (t <= u) return;
|
|
88
|
+
const v = s <= 0, R = s + u >= t - 1;
|
|
89
|
+
if (v && e.deltaY < 0 || R && e.deltaY > 0) {
|
|
90
|
+
const X = re(k.value - e.deltaY * 0.3, -x, x);
|
|
91
|
+
k.value = X, T.value = !0, d && clearTimeout(d), d = setTimeout(() => {
|
|
92
|
+
k.value = 0, T.value = !1;
|
|
110
93
|
}, 150);
|
|
111
94
|
}
|
|
112
95
|
}
|
|
113
|
-
function
|
|
114
|
-
const e =
|
|
96
|
+
function C() {
|
|
97
|
+
const e = q.value;
|
|
115
98
|
if (!e || l.items.length === 0) {
|
|
116
|
-
i.value = 0,
|
|
99
|
+
i.value = 0, I.value = !1;
|
|
117
100
|
return;
|
|
118
101
|
}
|
|
119
|
-
const a = l.items.length,
|
|
120
|
-
i.value =
|
|
121
|
-
const
|
|
122
|
-
|
|
102
|
+
const a = l.items.length, s = e.children[a];
|
|
103
|
+
i.value = s ? s.offsetTop : e.scrollHeight / 2;
|
|
104
|
+
const t = W.value;
|
|
105
|
+
I.value = t ? i.value > t.clientHeight : !0;
|
|
123
106
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
const a = e -
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
l.seamlessDirection === "down" ? (o.value +=
|
|
107
|
+
function K(e) {
|
|
108
|
+
p === 0 && (p = e);
|
|
109
|
+
const a = e - p;
|
|
110
|
+
if (p = e, !w.value && i.value > 0 && l.items.length > 0) {
|
|
111
|
+
const s = l.seamlessSpeed * a / 1e3;
|
|
112
|
+
l.seamlessDirection === "down" ? (o.value += s, o.value >= 0 && (o.value -= i.value)) : (o.value -= s, o.value <= -i.value && (o.value += i.value));
|
|
130
113
|
}
|
|
131
|
-
|
|
114
|
+
g = requestAnimationFrame(K);
|
|
115
|
+
}
|
|
116
|
+
function B() {
|
|
117
|
+
g == null && (p = 0, g = requestAnimationFrame(K));
|
|
132
118
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
119
|
+
function O() {
|
|
120
|
+
g != null && (cancelAnimationFrame(g), g = null), p = 0;
|
|
135
121
|
}
|
|
136
|
-
function
|
|
137
|
-
|
|
122
|
+
function ce() {
|
|
123
|
+
l.seamlessPauseOnHover && (w.value = !0);
|
|
138
124
|
}
|
|
139
125
|
function me() {
|
|
140
|
-
l.seamlessPauseOnHover && (
|
|
141
|
-
}
|
|
142
|
-
function fe() {
|
|
143
|
-
l.seamlessPauseOnHover && ($.value = !1);
|
|
126
|
+
l.seamlessPauseOnHover && (w.value = !1);
|
|
144
127
|
}
|
|
145
|
-
return
|
|
146
|
-
l.seamless && !l.loading && (
|
|
147
|
-
}),
|
|
148
|
-
|
|
149
|
-
}),
|
|
128
|
+
return ve(() => {
|
|
129
|
+
l.seamless && !l.loading && (C(), o.value = l.seamlessDirection === "down" ? -i.value : 0, B());
|
|
130
|
+
}), ge(() => {
|
|
131
|
+
O(), d && (clearTimeout(d), d = null), f && (clearTimeout(f), f = null);
|
|
132
|
+
}), D(
|
|
150
133
|
() => l.items,
|
|
151
134
|
() => {
|
|
152
|
-
l.seamless &&
|
|
153
|
-
|
|
154
|
-
}),
|
|
135
|
+
l.seamless && L(() => {
|
|
136
|
+
C(), o.value = l.seamlessDirection === "down" ? -i.value : 0;
|
|
137
|
+
}), Y.value++, y.value = -1;
|
|
155
138
|
}
|
|
156
|
-
),
|
|
139
|
+
), D(
|
|
157
140
|
() => l.seamless,
|
|
158
141
|
(e) => {
|
|
159
|
-
e && !l.loading ?
|
|
160
|
-
|
|
161
|
-
}) : (
|
|
142
|
+
e && !l.loading ? L(() => {
|
|
143
|
+
C(), o.value = l.seamlessDirection === "down" ? -i.value : 0, B();
|
|
144
|
+
}) : (O(), o.value = 0, w.value = !1);
|
|
162
145
|
}
|
|
163
|
-
),
|
|
146
|
+
), D(
|
|
164
147
|
() => l.loading,
|
|
165
148
|
(e) => {
|
|
166
|
-
e ? (
|
|
167
|
-
|
|
149
|
+
e ? (k.value = 0, T.value = !1, M.value = !1, O(), d && (clearTimeout(d), d = null), f && (clearTimeout(f), f = null)) : l.seamless && L(() => {
|
|
150
|
+
C(), o.value = l.seamlessDirection === "down" ? -i.value : 0, B();
|
|
168
151
|
});
|
|
169
152
|
}
|
|
170
153
|
), (e, a) => (r(), c("div", {
|
|
171
|
-
class:
|
|
172
|
-
style:
|
|
154
|
+
class: h(["g-scroller", e.className]),
|
|
155
|
+
style: S(ne.value)
|
|
173
156
|
}, [
|
|
174
157
|
e.seamless && !e.loading ? (r(), c("div", {
|
|
175
158
|
key: 0,
|
|
176
159
|
ref_key: "seamlessWrapRef",
|
|
177
|
-
ref:
|
|
160
|
+
ref: W,
|
|
178
161
|
class: "g-scroller__seamless",
|
|
179
|
-
onMouseenter:
|
|
180
|
-
onMouseleave:
|
|
162
|
+
onMouseenter: ce,
|
|
163
|
+
onMouseleave: me
|
|
181
164
|
}, [
|
|
182
165
|
m("div", {
|
|
183
166
|
ref_key: "seamlessTrackRef",
|
|
184
|
-
ref:
|
|
167
|
+
ref: q,
|
|
185
168
|
class: "g-scroller__seamless-track",
|
|
186
|
-
style:
|
|
169
|
+
style: S(oe.value)
|
|
187
170
|
}, [
|
|
188
|
-
(r(!0), c(
|
|
189
|
-
key: `seamless-${
|
|
190
|
-
class:
|
|
171
|
+
(r(!0), c(_, null, N(ae.value, (s, t) => (r(), c("div", {
|
|
172
|
+
key: `seamless-${t}`,
|
|
173
|
+
class: h([
|
|
191
174
|
"g-scroller__item",
|
|
192
175
|
"g-scroller__item--seamless",
|
|
193
|
-
!
|
|
194
|
-
|
|
176
|
+
!F.value && "g-scroller__item--default",
|
|
177
|
+
y.value === t % e.items.length && "g-scroller__item--active",
|
|
195
178
|
e.itemClassName
|
|
196
179
|
]),
|
|
197
|
-
onMouseenter: (u) =>
|
|
198
|
-
onClick: (u) =>
|
|
180
|
+
onMouseenter: (u) => z(t % e.items.length),
|
|
181
|
+
onClick: (u) => U(s, t % e.items.length)
|
|
199
182
|
}, [
|
|
200
|
-
|
|
201
|
-
item:
|
|
202
|
-
index:
|
|
183
|
+
Q(e.$slots, "default", {
|
|
184
|
+
item: s,
|
|
185
|
+
index: t % e.items.length
|
|
203
186
|
}, () => [
|
|
204
|
-
m("p",
|
|
187
|
+
m("p", Me, Z(s), 1)
|
|
205
188
|
], !0)
|
|
206
|
-
], 42,
|
|
189
|
+
], 42, Te))), 128))
|
|
207
190
|
], 4),
|
|
208
|
-
e.showGradients &&
|
|
191
|
+
e.showGradients && I.value ? (r(), c(_, { key: 0 }, [
|
|
209
192
|
a[0] || (a[0] = m("div", { class: "g-scroller__gradient g-scroller__gradient--top" }, null, -1)),
|
|
210
193
|
a[1] || (a[1] = m("div", { class: "g-scroller__gradient g-scroller__gradient--bottom" }, null, -1))
|
|
211
|
-
], 64)) :
|
|
194
|
+
], 64)) : J("", !0)
|
|
212
195
|
], 544)) : e.loading ? (r(), c("div", {
|
|
213
196
|
key: 1,
|
|
214
|
-
class:
|
|
197
|
+
class: h(["g-scroller__list", !e.displayScrollbar && "g-scroller__list--hidden-scrollbar"])
|
|
215
198
|
}, [
|
|
216
|
-
(r(!0), c(
|
|
217
|
-
key: `skeleton-${
|
|
199
|
+
(r(!0), c(_, null, N(e.skeletonCount, (s) => (r(), c("div", {
|
|
200
|
+
key: `skeleton-${s}`,
|
|
218
201
|
class: "g-scroller__skeleton"
|
|
219
202
|
}, a[2] || (a[2] = [
|
|
220
203
|
m("div", { class: "g-scroller__skeleton-line" }, null, -1)
|
|
221
204
|
])))), 128))
|
|
222
|
-
], 2)) : (r(), c(
|
|
205
|
+
], 2)) : (r(), c(_, { key: 2 }, [
|
|
223
206
|
m("div", {
|
|
224
207
|
ref_key: "listRef",
|
|
225
|
-
ref:
|
|
226
|
-
class:
|
|
227
|
-
onScroll:
|
|
228
|
-
onWheel:
|
|
208
|
+
ref: E,
|
|
209
|
+
class: h(["g-scroller__list", !e.displayScrollbar && "g-scroller__list--hidden-scrollbar"]),
|
|
210
|
+
onScroll: ie,
|
|
211
|
+
onWheel: ue
|
|
229
212
|
}, [
|
|
230
213
|
m("div", {
|
|
231
|
-
class:
|
|
232
|
-
style:
|
|
214
|
+
class: h(["g-scroller__content", { "g-scroller__content--pulling": T.value }]),
|
|
215
|
+
style: S({ transform: `translateY(${k.value}px)` })
|
|
233
216
|
}, [
|
|
234
|
-
(r(!0), c(
|
|
235
|
-
key: `${
|
|
236
|
-
index:
|
|
217
|
+
(r(!0), c(_, null, N(e.items, (s, t) => (r(), pe(he(le), {
|
|
218
|
+
key: `${Y.value}-${t}`,
|
|
219
|
+
index: t,
|
|
237
220
|
stagger: e.stagger,
|
|
238
|
-
instant:
|
|
239
|
-
onMouseenter: (u) =>
|
|
240
|
-
onClick: (u) =>
|
|
221
|
+
instant: M.value,
|
|
222
|
+
onMouseenter: (u) => z(t),
|
|
223
|
+
onClick: (u) => U(s, t)
|
|
241
224
|
}, {
|
|
242
|
-
default:
|
|
225
|
+
default: _e(() => [
|
|
243
226
|
m("div", {
|
|
244
|
-
class:
|
|
227
|
+
class: h([
|
|
245
228
|
"g-scroller__item",
|
|
246
|
-
!
|
|
247
|
-
|
|
229
|
+
!F.value && "g-scroller__item--default",
|
|
230
|
+
y.value === t && "g-scroller__item--active",
|
|
248
231
|
e.itemClassName
|
|
249
232
|
])
|
|
250
233
|
}, [
|
|
251
|
-
|
|
252
|
-
item:
|
|
253
|
-
index:
|
|
234
|
+
Q(e.$slots, "default", {
|
|
235
|
+
item: s,
|
|
236
|
+
index: t
|
|
254
237
|
}, () => [
|
|
255
|
-
m("p",
|
|
238
|
+
m("p", we, Z(s), 1)
|
|
256
239
|
], !0)
|
|
257
240
|
], 2)
|
|
258
241
|
]),
|
|
@@ -260,24 +243,24 @@ const Ce = ["onMouseenter", "onClick"], He = { class: "g-scroller__item-text" },
|
|
|
260
243
|
}, 1032, ["index", "stagger", "instant", "onMouseenter", "onClick"]))), 128))
|
|
261
244
|
], 6)
|
|
262
245
|
], 34),
|
|
263
|
-
e.showGradients ? (r(), c(
|
|
246
|
+
e.showGradients ? (r(), c(_, { key: 0 }, [
|
|
264
247
|
m("div", {
|
|
265
248
|
class: "g-scroller__gradient g-scroller__gradient--top",
|
|
266
|
-
style:
|
|
249
|
+
style: S({ opacity: G.value })
|
|
267
250
|
}, null, 4),
|
|
268
251
|
m("div", {
|
|
269
252
|
class: "g-scroller__gradient g-scroller__gradient--bottom",
|
|
270
|
-
style:
|
|
253
|
+
style: S({ opacity: P.value })
|
|
271
254
|
}, null, 4)
|
|
272
|
-
], 64)) :
|
|
255
|
+
], 64)) : J("", !0)
|
|
273
256
|
], 64))
|
|
274
257
|
], 6));
|
|
275
258
|
}
|
|
276
|
-
}),
|
|
277
|
-
|
|
278
|
-
|
|
259
|
+
}), A = /* @__PURE__ */ Se(He, [["__scopeId", "data-v-972060e6"]]);
|
|
260
|
+
A.install = (b) => {
|
|
261
|
+
b.component(A.name, A);
|
|
279
262
|
};
|
|
280
263
|
export {
|
|
281
|
-
|
|
282
|
-
|
|
264
|
+
A as GScroller,
|
|
265
|
+
A as default
|
|
283
266
|
};
|
package/lib/GShinyText/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 e=require("vue"),f=require("motion-v"),i=e.defineComponent({__name:"index",props:{text:{},disabled:{type:Boolean,default:!1},speed:{default:2},className:{default:""},color:{default:"#b5b5b5"},shineColor:{default:"#ffffff"},spread:{default:120},yoyo:{type:Boolean,default:!1},pauseOnHover:{type:Boolean,default:!1},direction:{default:"left"},delay:{default:0}},setup(v){const l=v,p=e.ref(!1),t=f.useMotionValue(0),c=e.ref(0),r=e.ref(null),s=e.ref(l.direction==="left"?1:-1),a=e.computed(()=>l.speed*1e3),y=e.computed(()=>l.delay*1e3);f.useAnimationFrame(o=>{if(l.disabled||p.value){r.value=null;return}if(r.value===null){r.value=o;return}const b=o-r.value;if(r.value=o,c.value+=b,l.yoyo){const u=a.value+y.value,d=u*2,n=c.value%d;if(n<a.value){const m=n/a.value*100;t.set(s.value===1?m:100-m)}else if(n<u)t.set(s.value===1?100:0);else if(n<u+a.value){const g=100-(n-u)/a.value*100;t.set(s.value===1?g:100-g)}else t.set(s.value===1?0:100)}else{const u=a.value+y.value,d=c.value%u;if(d<a.value){const n=d/a.value*100;t.set(s.value===1?n:100-n)}else t.set(s.value===1?100:0)}}),e.watch(()=>l.direction,()=>{s.value=l.direction==="left"?1:-1,c.value=0,t.set(0)},{immediate:!0});const k=f.useTransform(t,o=>`${150-o*2}% center`),T=()=>{l.pauseOnHover&&(p.value=!0)},C=()=>{l.pauseOnHover&&(p.value=!1)},h=e.computed(()=>({backgroundImage:`linear-gradient(${l.spread}deg, ${l.color} 0%, ${l.color} 35%, ${l.shineColor} 50%, ${l.color} 65%, ${l.color} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"}));return(o,b)=>(e.openBlock(),e.createBlock(e.unref(f.Motion),{tag:"span",class:e.normalizeClass(["inline-block",o.className]),style:e.normalizeStyle({...h.value,backgroundPosition:e.unref(k)}),onMouseenter:T,onMouseleave:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.text),1)]),_:1},8,["class","style"]))}});i.install=v=>{v.component(i.name,i)};exports.GShinyText=i;exports.default=i;
|