{"version":3,"file":"CursorLine.sCfrZWS2.mjs","names":["useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/HHFONASoYEDZstVaigYH/X0wFaLDptGmWQtWjWOqH/CursorLine.js"],"sourcesContent":["// Instructions: create a cursor component with a vertical line (100% height) that follows the mouse, while still allowing clicking and hover effects on underlying objects.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,useIsStaticRenderer}from\"framer\";import{useEffect,useMemo,useRef}from\"react\";/**\n * @framerIntrinsicWidth 10\n * @framerIntrinsicHeight 100\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CursorLine(props){const{enabled=true,followMode=\"window\",lineColor=\"#000000\",lineWidth=2,triangleSize=8,opacity=1,blur=0,blendMode=\"normal\",align=\"center\",offsetX=0,showInCanvas=false,style}=props;// Ensure the component always has a visible/selectable minimum size on the canvas.\n// If we render only a fixed overlay (100vw/100vh), Framer can still report a 0-size root.\n// So we keep the root sized (min 5x5), and render the viewport-following overlay inside it.\nconst{width:providedWidth,height:providedHeight,...restStyle}=style??{};const normalizeCanvasSize=(value,fallback)=>{if(value==null)return fallback;if(typeof value===\"number\")return Math.max(5,value);if(typeof value===\"string\"){const trimmed=value.trim();if(trimmed===\"0\"||trimmed===\"0px\")return\"5px\";const pxMatch=trimmed.match(/^(-?\\d+(?:\\.\\d+)?)px$/i);if(pxMatch){const n=Number(pxMatch[1]);if(!Number.isFinite(n))return`${fallback}px`;return`${Math.max(5,n)}px`;}// Keep %/vw/vh/etc. untouched\nreturn value;}return fallback;};// Root size is only for canvas selection. The overlay handles the real visual area.\nconst rootWidth=normalizeCanvasSize(providedWidth,10);const rootHeight=normalizeCanvasSize(providedHeight,100);const isStatic=useIsStaticRenderer();const isCanvasLike=RenderTarget.current()===RenderTarget.canvas||RenderTarget.current()===RenderTarget.thumbnail;const containerRef=useRef(null);const overlayRef=useRef(null);const lineRef=useRef(null);const shouldRenderDynamic=useMemo(()=>{if(!enabled)return false;if(isStatic)return false;if(isCanvasLike&&!showInCanvas)return false;return true;},[enabled,isStatic,isCanvasLike,showInCanvas]);const leftAdjustPx=useMemo(()=>{return align===\"center\"?-lineWidth/2:0;},[align,lineWidth]);useEffect(()=>{if(!shouldRenderDynamic)return;if(typeof window===\"undefined\")return;const targetEl=lineRef.current;if(!targetEl)return;let rafId=0;let latestClientX=0;let pending=false;const apply=()=>{pending=false;const lineEl=lineRef.current;const overlayEl=overlayRef.current;if(!lineEl)return;let x=latestClientX;if(followMode===\"component\"){if(!overlayEl)return;const rect=overlayEl.getBoundingClientRect();x=latestClientX-rect.left;}const translateX=x+offsetX+leftAdjustPx;lineEl.style.transform=`translate3d(${translateX}px, 0, 0)`;};const schedule=()=>{if(pending)return;pending=true;rafId=window.requestAnimationFrame(apply);};const onMove=e=>{latestClientX=e.clientX;schedule();};window.addEventListener(\"mousemove\",onMove,{passive:true});targetEl.style.transform=`translate3d(-9999px, 0, 0)`;return()=>{window.removeEventListener(\"mousemove\",onMove);if(rafId)window.cancelAnimationFrame(rafId);};},[shouldRenderDynamic,followMode,offsetX,leftAdjustPx]);const lineStyle=useMemo(()=>({position:\"absolute\",top:0,bottom:0,left:0,width:`${Math.max(1,lineWidth)}px`,background:lineColor,opacity:Math.max(0,Math.min(1,opacity)),filter:blur>0?`blur(${blur}px)`:undefined,mixBlendMode:blendMode,pointerEvents:\"none\"}),[blendMode,blur,lineColor,lineWidth,opacity]);const triangleCommon=useMemo(()=>({position:\"absolute\",left:\"50%\",transform:\"translateX(-50%) rotate(180deg)\",width:0,height:0,pointerEvents:\"none\"}),[]);const topTriangleStyle=useMemo(()=>({...triangleCommon,top:0,borderLeft:`${triangleSize}px solid transparent`,borderRight:`${triangleSize}px solid transparent`,borderBottom:`${triangleSize}px solid ${lineColor}`,zIndex:2}),[triangleCommon,triangleSize,lineColor]);const bottomTriangleStyle=useMemo(()=>({...triangleCommon,bottom:0,borderLeft:`${triangleSize}px solid transparent`,borderRight:`${triangleSize}px solid transparent`,borderTop:`${triangleSize}px solid ${lineColor}`,zIndex:2}),[triangleCommon,triangleSize,lineColor]);// Key requirement: do not block hover/click on underlying objects.\n// Achieved via pointerEvents: \"none\" on the overlay container and the line.\nreturn /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:rootWidth,height:rootHeight,minWidth:5,minHeight:5,pointerEvents:\"none\",overflow:\"visible\",...restStyle},\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"div\",{ref:overlayRef,style:{position:followMode===\"window\"?\"fixed\":\"absolute\",top:0,left:0,width:followMode===\"window\"?\"100vw\":\"100%\",height:followMode===\"window\"?\"100vh\":\"100%\",pointerEvents:\"none\",overflow:\"visible\",zIndex:followMode===\"window\"?2147483647:undefined},children:/*#__PURE__*/_jsxs(\"div\",{ref:lineRef,style:{position:\"absolute\",top:0,bottom:0,left:0,width:`${Math.max(1,lineWidth)}px`,pointerEvents:\"none\",willChange:\"transform\",zIndex:2147483647},children:[/*#__PURE__*/_jsx(\"div\",{style:topTriangleStyle}),/*#__PURE__*/_jsx(\"div\",{style:lineStyle}),/*#__PURE__*/_jsx(\"div\",{style:bottomTriangleStyle})]})})});}CursorLine.displayName=\"CursorLine\";addPropertyControls(CursorLine,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},followMode:{type:ControlType.Enum,title:\"Follow\",options:[\"window\",\"component\"],optionTitles:[\"Window\",\"Component\"],defaultValue:\"window\",displaySegmentedControl:true},lineColor:{type:ControlType.Color,title:\"Line\",defaultValue:\"#000000\"},lineWidth:{type:ControlType.Number,title:\"Width\",defaultValue:2,min:1,max:24,step:1,unit:\"px\"},triangleSize:{type:ControlType.Number,title:\"Triangle\",defaultValue:8,min:0,max:40,step:1,unit:\"px\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"center\",\"left\"],optionTitles:[\"Center\",\"Left\"],defaultValue:\"center\",displaySegmentedControl:true},offsetX:{type:ControlType.Number,title:\"Offset X\",defaultValue:0,min:-500,max:500,step:1,unit:\"px\"},opacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:1,min:0,max:1,step:.01},blur:{type:ControlType.Number,title:\"Blur\",defaultValue:0,min:0,max:20,step:.5,unit:\"px\"},blendMode:{type:ControlType.Enum,title:\"Blend\",options:[\"normal\",\"multiply\",\"screen\",\"overlay\",\"darken\",\"lighten\",\"color-dodge\",\"color-burn\",\"hard-light\",\"soft-light\",\"difference\",\"exclusion\",\"hue\",\"saturation\",\"color\",\"luminosity\"],optionTitles:[\"Normal\",\"Multiply\",\"Screen\",\"Overlay\",\"Darken\",\"Lighten\",\"Color Dodge\",\"Color Burn\",\"Hard Light\",\"Soft Light\",\"Difference\",\"Exclusion\",\"Hue\",\"Saturation\",\"Color\",\"Luminosity\"],defaultValue:\"normal\"},showInCanvas:{type:ControlType.Boolean,title:\"In Canvas\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CursorLine\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"10\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"100\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CursorLine.map"],"mappings":"4NAOG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,UAAQ,GAAK,aAAW,SAAS,YAAU,UAAU,YAAU,EAAE,eAAa,EAAE,UAAQ,EAAE,OAAK,EAAE,YAAU,SAAS,QAAM,SAAS,UAAQ,EAAE,eAAa,GAAM,SAAO,EAGrN,CAAC,MAAM,EAAc,OAAO,EAAe,GAAG,GAAW,GAAO,CAAC,EAAQ,GAAqB,EAAM,IAAW,CAAC,GAAG,GA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