{"version":3,"file":"TrueFocus.Ce_xcAzJ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/ldUR4tl6oSnVwmy0DbpB/OhceBKz2c5pifz7zxjYZ/TrueFocus.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TrueFocus(props){const{text,manualMode,blurAmount,borderColor,glowColor,animationDuration,pauseBetweenAnimations,textColor,textAlign,font}=props;const words=text.split(\" \");const[currentIndex,setCurrentIndex]=useState(0);const[lastActiveIndex,setLastActiveIndex]=useState(null);const containerRef=useRef(null);const wordRefs=useRef([]);const[focusRect,setFocusRect]=useState({x:0,y:0,width:0,height:0});useEffect(()=>{if(!manualMode){const interval=setInterval(()=>setCurrentIndex(prev=>(prev+1)%words.length),(animationDuration+pauseBetweenAnimations)*1e3);return()=>clearInterval(interval);}},[manualMode,animationDuration,pauseBetweenAnimations,words.length]);useEffect(()=>{if(!containerRef.current||!wordRefs.current[currentIndex])return;const parent=containerRef.current.getBoundingClientRect();const active=wordRefs.current[currentIndex].getBoundingClientRect();setFocusRect({x:active.left-parent.left,y:active.top-parent.top,width:active.width,height:active.height});},[currentIndex,words.length]);const handleMouseEnter=index=>{if(manualMode){setLastActiveIndex(index);setCurrentIndex(index);}};const handleMouseLeave=()=>{if(manualMode){setCurrentIndex(lastActiveIndex??0);}};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",display:\"flex\",gap:\"0.5em\",justifyContent:textAlign===\"left\"?\"flex-start\":textAlign===\"right\"?\"flex-end\":\"center\",alignItems:\"center\",flexWrap:\"wrap\",width:\"100%\",height:\"100%\",color:textColor,...font},children:[words.map((word,index)=>{const isActive=index===currentIndex;return /*#__PURE__*/_jsx(\"span\",{ref:el=>wordRefs.current[index]=el,onMouseEnter:()=>handleMouseEnter(index),onMouseLeave:handleMouseLeave,style:{position:\"relative\",cursor:manualMode?\"pointer\":\"default\",filter:`blur(${isActive?0:blurAmount}px)`,transition:`filter ${animationDuration}s ease`},children:word},index);}),/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",top:0,left:0,pointerEvents:\"none\",boxSizing:\"content-box\",border:\"none\"},animate:{x:focusRect.x,y:focusRect.y,width:focusRect.width,height:focusRect.height,opacity:currentIndex>=0?1:0},transition:{duration:animationDuration},children:[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"].map((corner,i)=>{const baseStyle={position:\"absolute\",width:\"1rem\",height:\"1rem\",border:`3px solid ${borderColor}`,filter:`drop-shadow(0px 0px 4px ${glowColor})`,borderRadius:3,transition:\"none\"};const cornerStyles={\"top-left\":{top:\"-10px\",left:\"-10px\",borderRight:\"none\",borderBottom:\"none\"},\"top-right\":{top:\"-10px\",right:\"-10px\",borderLeft:\"none\",borderBottom:\"none\"},\"bottom-left\":{bottom:\"-10px\",left:\"-10px\",borderRight:\"none\",borderTop:\"none\"},\"bottom-right\":{bottom:\"-10px\",right:\"-10px\",borderLeft:\"none\",borderTop:\"none\"}};return /*#__PURE__*/_jsx(\"span\",{style:{...baseStyle,...cornerStyles[corner]}},i);})})]});}addPropertyControls(TrueFocus,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"True Focus\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},manualMode:{type:ControlType.Boolean,title:\"Manual Mode\",defaultValue:false},blurAmount:{type:ControlType.Number,title:\"Blur Amount\",defaultValue:5,min:0,max:20},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#00ff00\"},glowColor:{type:ControlType.Color,title:\"Glow Color\",defaultValue:\"rgba(0, 255, 0, 0.6)\"},animationDuration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:.5,min:.1,max:3,step:.1},pauseBetweenAnimations:{type:ControlType.Number,title:\"Pause (sec)\",defaultValue:1,min:0,max:10,step:.1},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TrueFocus\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrueFocus.map"],"mappings":"2OAGG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,OAAK,aAAW,aAAW,cAAY,YAAU,oBAAkB,yBAAuB,YAAU,YAAU,QAAM,EAAY,EAAM,EAAK,MAAM,IAAI,CAAM,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAM,CAAC,EAAgB,GAAoBA,EAAS,KAAK,CAAO,EAAaC,EAAO,KAAK,CAAO,EAASA,EAAO,EAAE,CAAC,CAAM,CAAC,EAAU,GAAcD,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,MAAc,CAAC,GAAG,CAAC,EAAW,CAAC,IAAM,EAAS,gBAAgB,EAAgB,IAAO,EAAK,GAAG,EAAM,OAAO,EAAE,EAAkB,GAAwB,IAAI,CAAC,UAAU,cAAc,EAAS,GAAI,CAAC,EAAW,EAAkB,EAAuB,EAAM,OAAO,CAAC,CAAC,MAAc,CAAC,GAAG,CAAC,EAAa,SAAS,CAAC,EAAS,QAAQ,GAAc,OAAO,IAAM,EAAO,EAAa,QAAQ,uBAAuB,CAAO,EAAO,EAAS,QAAQ,GAAc,uBAA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