PageSourceSearch

https://kadelio.com/assets/useMarqueeAutoScroll-B70svg_Q.js

js kadelio.com collected 2026-09-24 14:46:29 UTC 2,363 bytes, 2 lines download raw bytes

1import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{T as t}from"./radix-DuU_8sUg.js";var n=e(t(),1);function r(e=24){let t=(0,n.useRef)(null),r=(0,n.useRef)(!1),i=(0,n.useRef)(void 0),a=(0,n.useRef)(()=>{});return(0,n.useEffect)(()=>{let n=t.current;if(!n)return;let o=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,s=n.scrollLeft,c=n.scrollLeft,l=0,u=performance.now(),d=()=>{s=n.scrollLeft,c=n.scrollLeft},f=t=>{let i=Math.min(t-u,50);if(u=t,Math.abs(n.scrollLeft-c)>1.5&&(s=n.scrollLeft),!r.current&&n.scrollWidth>n.clientWidth){s+=e*i/1e3;let t=n.scrollWidth/2;t>0&&s>=t&&(s-=t),n.scrollLeft=s,c=n.scrollLeft}else c=n.scrollLeft;l=requestAnimationFrame(f)};o||(l=requestAnimationFrame(f));let p=(e=3e3)=>{r.current=!0,i.current&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{r.current=!1},e)};a.current=p;let m=e=>{Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(e.preventDefault(),n.scrollLeft+=e.deltaY,d()),p()};n.addEventListener(`wheel`,m,{passive:!1});let h=0,g=0,_=!1,v=!1,y=e=>{p(),e.pointerType===`mouse`&&e.button===0&&(_=!0,v=!1,h=e.clientX,g=n.scrollLeft)},b=e=>{if(!_||e.pointerType!==`mouse`)return;let t=e.clientX-h;if(!v&&Math.abs(t)>5){v=!0;try{n.setPointerCapture(e.pointerId)}catch{}n.style.cursor=`grabbing`}v&&(e.preventDefault(),n.scrollLeft=g-t,d())},x=()=>{_=!1,n.style.cursor=``},S=()=>x(),C=()=>x(),w=e=>{v&&=(e.preventDefault(),e.stopPropagation(),!1)};return n.addEventListener(`pointerdown`,y),n.addEventListener(`pointermove`,b),n.addEventListener(`pointerup`,S),n.addEventListener(`pointercancel`,C),n.addEventListener(`click`,w,!0),()=>{cancelAnimationFrame(l),n.removeEventListener(`wheel`,m),n.removeEventListener(`pointerdown`,y),n.removeEventListener(`pointermove`,b),n.removeEventListener(`pointerup`,S),n.removeEventListener(`pointercancel`,C),n.removeEventListener(`click`,w,!0),i.current&&window.clearTimeout(i.current)}},[e]),{containerRef:t,scrollByAmount:e=>{let n=t.current;if(!n)return;let r=n.scrollWidth/2;e<0&&r>0&&n.scrollLeft+e<0&&(n.scrollLeft+=r),n.scrollBy({left:e,behavior:`smooth`}),a.current(3e3)},handlers:{onMouseEnter:()=>{r.current=!0,i.current&&=(window.clearTimeout(i.current),void 0)},onMouseLeave:()=>{r.current=!1,i.current&&=(window.clearTimeout(i.current),void 0)}}}}export{r as t};
2//# sourceMappingURL=useMarqueeAutoScroll-B70svg_Q.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.