Ben Lin
2024-04-25 e404c076586d9682c3d782a4ecb0dc254f0bfd48
1
var j=(i,u,p)=>new Promise((v,g)=>{var _=e=>{try{m(p.next(e))}catch(t){g(t)}},x=e=>{try{m(p.throw(e))}catch(t){g(t)}},m=e=>e.done?v(e.value):Promise.resolve(e.value).then(_,x);m((p=p.apply(i,u)).next())});import{P as q,__tla as H}from"./index-e26b3a3c.js";import{d as D,a7 as F,v as G,_ as I,a8 as V,a9 as J,t as K,$ as Q,E as U}from"./vue-1631514e.js";import{_ as Z,__tla as ee}from"./index-f0df2f76.js";import{__tla as te}from"./useContentViewHeight-c315421e.js";import{__tla as oe}from"./useWindowSizeFn-53b82e7c.js";import"./onMountedOrActivated-5690e97c.js";import"./antd-057b41b1.js";let O,re=Promise.all([(()=>{try{return H}catch(i){}})(),(()=>{try{return ee}catch(i){}})(),(()=>{try{return te}catch(i){}})(),(()=>{try{return oe}catch(i){}})()]).then(()=>j(void 0,null,function*(){const i={event:"mousedown",transition:400},u={beforeMount:(e,t)=>{if(t.value===!1)return;const o=e.getAttribute("ripple-background");v(Object.keys(t.modifiers),i);const n=o||u.background,s=u.zIndex;e.addEventListener(i.event,h=>{p({event:h,el:e,background:n,zIndex:s})})},updated(e,t){var n,s;if(!t.value){(n=e==null?void 0:e.clearRipple)==null||n.call(e);return}const o=e.getAttribute("ripple-background");(s=e==null?void 0:e.setBackground)==null||s.call(e,o)}};function p({event:e,el:t,zIndex:o,background:n}){var N,B;const s=parseInt(getComputedStyle(t).borderWidth.replace("px","")),h=e.clientX||e.touches[0].clientX,y=e.clientY||e.touches[0].clientY,R=t.getBoundingClientRect(),{left:z,top:M}=R,{offsetWidth:k,offsetHeight:T}=t,{transition:P}=i,b=h-z,f=y-M,$=Math.max(b,k-b),C=Math.max(f,T-f),W=window.getComputedStyle(t),L=Math.sqrt($*$+C*C),w=s>0?s:0,d=document.createElement("div"),a=document.createElement("div");d.className="ripple",Object.assign((N=d.style)!=null?N:{},{marginTop:"0px",marginLeft:"0px",width:"1px",height:"1px",transition:`all ${P}ms cubic-bezier(0.4, 0, 0.2, 1)`,borderRadius:"50%",pointerEvents:"none",position:"relative",zIndex:o!=null?o:"9999",backgroundColor:n!=null?n:"rgba(0, 0, 0, 0.12)"}),a.className="ripple-container",Object.assign((B=a.style)!=null?B:{},{position:"absolute",left:`${0-w}px`,top:`${0-w}px`,height:"0",width:"0",pointerEvents:"none",overflow:"hidden"});const E=t.style.position.length>0?t.style.position:getComputedStyle(t).position;E!=="relative"&&(t.style.position="relative"),a.appendChild(d),t.appendChild(a),Object.assign(d.style,{marginTop:`${f}px`,marginLeft:`${b}px`});const{borderTopLeftRadius:S,borderTopRightRadius:A,borderBottomLeftRadius:X,borderBottomRightRadius:Y}=W;Object.assign(a.style,{width:`${k}px`,height:`${T}px`,direction:"ltr",borderTopLeftRadius:S,borderTopRightRadius:A,borderBottomLeftRadius:X,borderBottomRightRadius:Y}),setTimeout(()=>{var c;const r=`${L*2}px`;Object.assign((c=d.style)!=null?c:{},{width:r,height:r,marginLeft:`${b-L}px`,marginTop:`${f-L}px`})},0);function l(){setTimeout(()=>{d.style.backgroundColor="rgba(0, 0, 0, 0)"},250),setTimeout(()=>{var r;(r=a==null?void 0:a.parentNode)==null||r.removeChild(a)},850),t.removeEventListener("mouseup",l,!1),t.removeEventListener("mouseleave",l,!1),t.removeEventListener("dragstart",l,!1),setTimeout(()=>{let r=!0;for(let c=0;c<t.childNodes.length;c++)t.childNodes[c].className==="ripple-container"&&(r=!1);r&&(t.style.position=E!=="static"?E:"")},i.transition+260)}e.type==="mousedown"?(t.addEventListener("mouseup",l,!1),t.addEventListener("mouseleave",l,!1),t.addEventListener("dragstart",l,!1)):l(),t.setBackground=r=>{r&&(d.style.backgroundColor=r)}}function v(e,t){e.forEach(o=>{isNaN(Number(o))?t.event=o:t.transition=o})}const g=u,_=D({components:{PageWrapper:q},directives:{Ripple:g}}),x={class:"demo-box"};function m(e,t,o,n,s,h){const y=F("PageWrapper"),R=G("ripple");return I(),V(y,{title:"Ripple\u793A\u4F8B"},{default:J(()=>[K((I(),Q("div",x,[U("content")])),[[R]])]),_:1})}O=Z(_,[["render",m],["__scopeId","data-v-24fa6bd6"]])}));export{re as __tla,O as default};