{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"smooth-scroll","type":"registry:component","title":"Smooth Scroll","description":"Smooth scrolling for the whole page.","meta":{"pro":false},"docs":"Usage: https://atelier-ui.com/r/smooth-scroll.md\nDocs: https://atelier-ui.com/docs/foundation/primitive/smooth-scroll","dependencies":["lenis","motion"],"registryDependencies":["https://atelier-ui.com/r/agent-rules.json"],"files":[{"path":"registry/smooth-scroll/smooth-scroll.tsx","type":"registry:component","target":"components/smooth-scroll/smooth-scroll.tsx","content":"\"use client\"\n\nimport type { LenisOptions } from \"lenis\"\nimport { type LenisRef, ReactLenis } from \"lenis/react\"\nimport { cancelFrame, type FrameData, frame } from \"motion\"\nimport { type ReactNode, useEffect, useRef } from \"react\"\n\ntype SmoothScrollProps = {\n    children: ReactNode\n    options?: LenisOptions\n}\n\n/**\n * Smooth scroll for the whole page (for now).\n *\n * Motion is the clock: scroll, animations, and WebGL usually each run on\n * their own loop, and can fall out of sync. This provider runs them on a\n * single loop, in a fixed order, so they always move together.\n */\nexport function SmoothScroll({ children, options }: SmoothScrollProps) {\n    const lenisRef = useRef<LenisRef>(null)\n\n    useEffect(() => {\n        function update(data: FrameData) {\n            lenisRef.current?.lenis?.raf(data.timestamp)\n        }\n        frame.update(update, true)\n        return () => cancelFrame(update)\n    }, [])\n\n    return (\n        <ReactLenis root ref={lenisRef} options={{ syncTouch: true, ...options, autoRaf: false }}>\n            {children}\n        </ReactLenis>\n    )\n}\n"}]}