{"version":3,"file":"ScrollBlurEssential.BXCdAGrQ.mjs","names":["useRef","useLayoutEffect","useEffect"],"sources":["https:/framerusercontent.com/modules/7h893CFUQDQiyaDDnTzN/ngsXVtBuYXJxX6gUqXKG/ScrollBlurEssential.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useLayoutEffect,useRef}from\"react\";import{animate,useMotionValue}from\"framer-motion\";// Locked default settings (the paid controls in the full version).\nconst BLUR=12;const FADE_IN={type:\"spring\",stiffness:300,damping:30};const FADE_OUT={type:\"spring\",stiffness:80,damping:26};const LAYERS=6;// Where the \"full version\" link points.\nconst FULL_VERSION_URL=\"https://buy.polar.sh/polar_cl_7CwEW1iCPM4xJVpmRbzgcZkgUnbbNd14Zc2Gl4VIj2M\";// Avoids the SSR warning for useLayoutEffect on Framer's published export.\nconst useIsoLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;/**\n * SCROLL BLUR ESSENTIAL\n *\n * The free version of Scroll Blur. Direction is adjustable; Blur strength and\n * the Fade In/Out transitions are locked to the defaults (those are the paid\n * controls in the full version).\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 200\n */export default function ScrollBlurEssential(props){const{direction=\"bottom\"}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const containerRef=useRef(null);const sb=useMotionValue(0)// 0..1 blur strength\n;const active=useRef(false)// currently scrolling?\n;const idle=useRef(null);const controls=useRef(null);// Mirror the motion value onto a CSS variable (clamped >= 0 so a spring\n// undershoot can't produce an invalid negative blur radius). On the canvas\n// we hold it at full strength so the blur is visible while editing.\nuseIsoLayoutEffect(()=>{const node=containerRef.current;if(!node)return;const write=v=>node.style.setProperty(\"--sb\",String(Math.max(0,v)));write(sb.get());const unsub=sb.on(\"change\",write);if(isCanvas)sb.set(1);return unsub;},[isCanvas,sb]);useEffect(()=>{if(isCanvas)return;const HOLD_MS=180;const clearIdle=()=>{if(idle.current){clearTimeout(idle.current);idle.current=null;}};const onScroll=()=>{if(!active.current){active.current=true;controls.current=animate(sb,1,FADE_IN);}clearIdle();idle.current=setTimeout(()=>{active.current=false;controls.current=animate(sb,0,FADE_OUT);},HOLD_MS);};const opts={passive:true,capture:true};window.addEventListener(\"scroll\",onScroll,opts);return()=>{window.removeEventListener(\"scroll\",onScroll,opts);clearIdle();if(controls.current)controls.current.stop();};},[isCanvas,sb]);const gradientDir=direction===\"top\"?\"to bottom\":\"to top\";const layers=[];const step=100/LAYERS;for(let i=0;i<LAYERS;i++){const b=BLUR*(i+1)/LAYERS;const coverTop=100-i*step;const fadeStart=Math.max(0,coverTop-step);const mask=`linear-gradient(${gradientDir}, rgba(255,255,255,1) 0%, rgba(255,255,255,1) ${fadeStart}%, rgba(255,255,255,0) ${coverTop}%)`;const filter=`blur(calc(var(--sb, 0) * ${b}px))`;layers.push(/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,backdropFilter:filter,WebkitBackdropFilter:filter,WebkitMaskImage:mask,maskImage:mask}},i));}const containerStyle={position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",pointerEvents:\"none\"};// Canvas-only faint fill so the (otherwise transparent) component is visible\n// and grabbable when dropped. Never shown in preview or on the published site.\nconst placeholderStyle={position:\"absolute\",inset:0,background:\"rgba(138,138,155,0.12)\",borderRadius:6,pointerEvents:\"none\"};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:containerStyle,children:[layers,isCanvas?/*#__PURE__*/_jsx(\"div\",{style:placeholderStyle}):null]});}ScrollBlurEssential.defaultProps={direction:\"bottom\"};// The Direction arrows are the one free control. Its description carries the\n// upgrade link, so the text sits directly below the arrows in the panel.\naddPropertyControls(ScrollBlurEssential,{direction:{type:ControlType.Enum,title:\"Direction\",options:[\"bottom\",\"top\"],optionTitles:[\"↑\",\"↓\"],displaySegmentedControl:true,defaultValue:\"bottom\",description:`Unlock Blur and Fade In / Out controls — [get the full version →](${FULL_VERSION_URL})`}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollBlurEssential\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"200\",\"framerIntrinsicWidth\":\"1200\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollBlurEssential.map"],"mappings":"8QAcG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,YAAU,UAAU,EAAY,EAAS,EAAa,QAAQ,IAAI,EAAa,OAAa,EAAaA,EAAO,IAAI,EAAQ,EAAG,EAAe,CAAC,EACpM,EAAOA,EAAO,EAAK,EACnB,EAAKA,EAAO,IAAI,EAAQ,EAASA,EAAO,IAAI,EAGnD,MAAuB,CAAC,IAAM,EAAK,EAAa,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,EAAM,GAAG,EAAK,MAAM,YAAY,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAM,EAAG,IAAI,CAAC,EAAE,IAAM,EAAM,EAAG,GAAG,SAAS,CAAK,EAAwB,OAAnB,GAAS,EAAG,IAAI,CAAC,EAAS,CAAM,EAAE,CAAC,EAAS,CAAE,CAAC,EAAE,MAAc,CAAC,GAAG,EAAS,OAAO,IAAwB,MAAc,CAAC,AAA4C,EAAK,WAAhC,aAAa,EAAK,OAAO,EAAe,KAAM,EAAQ,MAAa,CAAK,EAAO,UAAS,EAAO,QAAQ,GAAK,EAAS,QAAQ,EAAQ,EAAG,EAAE,CAAO,GAAG,EAAU,EAAE,EAAK,QAAQ,eAAe,CAAC,EAAO,QAAQ,GAAM,EAAS,QAAQ,EAAQ,EAAG,EAAE,CAAQ,CAAE,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