{"version":3,"file":"TextReveal.CwoDiVTd.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/dxuLso7WQtYPirmW5iT0/0ORgGAh0cuJtE89jmism/TextReveal.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useInView}from\"framer-motion\";import{useRef}from\"react\";/**\n * Text Reveal with Delayed Highlight\n *\n * A text component where specific letters get highlighted with a staggered delay animation.\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 80\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TextReveal(props){const{text=\"Hello World this is an amazing text reveal effect\",highlightColor=\"#FF5588\",textColor=\"#000000\",backgroundColor=\"#F5F5F5\",initialDelay=.5,revealDelay=.3,wordsPerReveal=3,font,borderRadius=12,padding=24}=props;const containerRef=useRef(null);const isInView=useInView(containerRef,{once:true,margin:\"-50px\"});const[highlightedWords,setHighlightedWords]=useState(new Set);const words=useMemo(()=>text.split(/\\s+/).filter(w=>w.length>0),[text]);useEffect(()=>{if(!isInView){setHighlightedWords(new Set);return;}let timeouts=[];const totalBatches=Math.ceil(words.length/wordsPerReveal);for(let batch=0;batch<totalBatches;batch++){const timeout=window.setTimeout(()=>{const wordsToHighlight=[];const startIndex=batch*wordsPerReveal;const endIndex=Math.min(startIndex+wordsPerReveal,words.length);for(let i=startIndex;i<endIndex;i++){wordsToHighlight.push(i);}setHighlightedWords(prev=>new Set([...prev,...wordsToHighlight]));},(initialDelay+batch*revealDelay)*1e3);timeouts.push(timeout);}return()=>{timeouts.forEach(t=>clearTimeout(t));};},[isInView,initialDelay,revealDelay,wordsPerReveal,words.length]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,backgroundColor,borderRadius,padding,display:\"inline-flex\",flexWrap:\"wrap\",gap:\"0.3em\"},children:words.map((word,index)=>{const isHighlighted=highlightedWords.has(index);return /*#__PURE__*/_jsx(motion.span,{initial:{color:textColor},animate:{color:isHighlighted?highlightColor:textColor},transition:{duration:.3,ease:\"easeOut\"},style:{...font,whiteSpace:\"nowrap\"},children:word},index);})});}addPropertyControls(TextReveal,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hello World this is an amazing text reveal effect\",placeholder:\"Enter your text...\"},highlightColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#FF5588\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},initialDelay:{type:ControlType.Number,title:\"Initial Delay\",defaultValue:.5,min:0,max:5,step:.1,unit:\"s\"},revealDelay:{type:ControlType.Number,title:\"Reveal Delay\",defaultValue:.3,min:.01,max:2,step:.01,unit:\"s\"},wordsPerReveal:{type:ControlType.Number,title:\"Words Per Reveal\",defaultValue:3,min:1,max:20,step:1},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:12,min:0,max:50,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:24,min:0,max:100,step:4,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextReveal\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"80\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextReveal.map"],"mappings":"qQAUG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,oDAAoD,iBAAe,UAAU,YAAU,UAA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