index-e520716f.js 3.8 KB

1
  1. var j=(r,u,p)=>new Promise((v,g)=>{var _=e=>{try{m(p.next(e))}catch(t){g(t)}},y=e=>{try{m(p.throw(e))}catch(t){g(t)}},m=e=>e.done?v(e.value):Promise.resolve(e.value).then(_,y);m((p=p.apply(r,u)).next())});import{P as q,__tla as H}from"./index-3705f1a8.js";import{d as D,_ as F,y as G,M as V,o as I,c as J,w as K,m as Q,l as U,b as Z,__tla as ee}from"./index-b5895273.js";import{__tla as te}from"./onMountedOrActivated-6125a24a.js";import{__tla as oe}from"./useWindowSizeFn-a59bee15.js";import{__tla as re}from"./useContentViewHeight-cd147d02.js";let O,ne=Promise.all([(()=>{try{return H}catch(r){}})(),(()=>{try{return ee}catch(r){}})(),(()=>{try{return te}catch(r){}})(),(()=>{try{return oe}catch(r){}})(),(()=>{try{return re}catch(r){}})()]).then(()=>j(void 0,null,function*(){const r={event:"mousedown",transition:400},u={beforeMount:(e,t)=>{if(t.value===!1)return;const o=e.getAttribute("ripple-background");v(Object.keys(t.modifiers),r);const i=o||u.background,s=u.zIndex;e.addEventListener(r.event,h=>{p({event:h,el:e,background:i,zIndex:s})})},updated(e,t){var i,s;if(!t.value){(i=e==null?void 0:e.clearRipple)==null||i.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:i}){var N,B;const s=parseInt(getComputedStyle(t).borderWidth.replace("px","")),h=e.clientX||e.touches[0].clientX,x=e.clientY||e.touches[0].clientY,R=t.getBoundingClientRect(),{left:z,top:M}=R,{offsetWidth:k,offsetHeight:T}=t,{transition:P}=r,b=h-z,f=x-M,w=Math.max(b,k-b),C=Math.max(f,T-f),W=window.getComputedStyle(t),L=Math.sqrt(w*w+C*C),$=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:i!=null?i:"rgba(0, 0, 0, 0.12)"}),a.className="ripple-container",Object.assign((B=a.style)!=null?B:{},{position:"absolute",left:`${0-$}px`,top:`${0-$}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 n=`${L*2}px`;Object.assign((c=d.style)!=null?c:{},{width:n,height:n,marginLeft:`${b-L}px`,marginTop:`${f-L}px`})},0);function l(){setTimeout(()=>{d.style.backgroundColor="rgba(0, 0, 0, 0)"},250),setTimeout(()=>{var n;(n=a==null?void 0:a.parentNode)==null||n.removeChild(a)},850),t.removeEventListener("mouseup",l,!1),t.removeEventListener("mouseleave",l,!1),t.removeEventListener("dragstart",l,!1),setTimeout(()=>{let n=!0;for(let c=0;c<t.childNodes.length;c++)t.childNodes[c].className==="ripple-container"&&(n=!1);n&&(t.style.position=E!=="static"?E:"")},r.transition+260)}e.type==="mousedown"?(t.addEventListener("mouseup",l,!1),t.addEventListener("mouseleave",l,!1),t.addEventListener("dragstart",l,!1)):l(),t.setBackground=n=>{n&&(d.style.backgroundColor=n)}}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}}),y={class:"demo-box"};function m(e,t,o,i,s,h){const x=G("PageWrapper"),R=V("ripple");return I(),J(x,{title:"Ripple\u793A\u4F8B"},{default:K(()=>[Q((I(),U("div",y,[Z("content")])),[[R]])]),_:1})}O=F(_,[["render",m],["__scopeId","data-v-35e5fafd"]])}));export{ne as __tla,O as default};