index-legacy.10d8486a.js 2.1 KB

1
  1. System.register(["./index-legacy.eb062188.js"],(function(e){"use strict";var t,o,i,n,r,s,a,l,u,f,d,c,h,v,p,x,m,g,w,b,y,$,I,z,O,T;return{setters:[function(e){t=e.aa,o=e.b1,i=e.ab,n=e.aH,r=e.t,s=e.z,a=e.u,l=e.w,u=e.d,f=e.R,d=e.ap,c=e.r,h=e.y,v=e.aM,p=e.N,x=e.ax,m=e.Z,g=e.a0,w=e.aA,b=e._,y=e.an,$=e.aN,I=e.at,z=e.c,O=e.ar,T=e.D}],execute:function(){function j(e,r){if(!t||!window.IntersectionObserver)return;const s=new IntersectionObserver((e=>{r(e[0].intersectionRatio>0)}),{root:document.body}),a=()=>{e.value&&s.unobserve(e.value)};o(a),i(a),n((()=>{e.value&&s.observe(e.value)}))}e("u",j);const[B,H]=r("sticky"),N={zIndex:s,position:a("top"),container:Object,offsetTop:l(0),offsetBottom:l(0)};var R=u({name:B,props:N,emits:["scroll","change"],setup(e,{emit:t,slots:o}){const i=f(),n=d(i),r=c({fixed:!1,width:0,height:0,transform:0}),s=f(!1),a=h((()=>v("top"===e.position?e.offsetTop:e.offsetBottom))),l=h((()=>{if(s.value)return;const{fixed:e,height:t,width:o}=r;return e?{width:`${o}px`,height:`${t}px`}:void 0})),u=h((()=>{if(!r.fixed||s.value)return;const t=p(x(e.zIndex),{width:`${r.width}px`,height:`${r.height}px`,[e.position]:`${a.value}px`});return r.transform&&(t.transform=`translate3d(0, ${r.transform}px, 0)`),t})),T=()=>{if(!i.value||w(i))return;const{container:o,position:n}=e,s=y(i),l=O(window);if(r.width=s.width,r.height=s.height,"top"===n)if(o){const e=y(o),t=e.bottom-a.value-r.height;r.fixed=a.value>s.top&&e.bottom>0,r.transform=t<0?t:0}else r.fixed=a.value>s.top;else{const{clientHeight:e}=document.documentElement;if(o){const t=y(o),i=e-t.top-a.value-r.height;r.fixed=e-a.value<s.bottom&&e>t.top,r.transform=i<0?-i:0}else r.fixed=e-a.value<s.bottom}(e=>{t("scroll",{scrollTop:e,isFixed:r.fixed})})(l)};return m((()=>r.fixed),(e=>t("change",e))),g("scroll",T,{target:n,passive:!0}),j(i,T),m([$,I],(()=>{i.value&&!w(i)&&r.fixed&&(s.value=!0,b((()=>{const e=y(i);r.width=e.width,r.height=e.height,s.value=!1})))})),()=>{var e;return z("div",{ref:i,style:l.value},[z("div",{class:H({fixed:r.fixed&&!s.value}),style:u.value},[null==(e=o.default)?void 0:e.call(o)])])}}});e("S",T(R))}}}));