{"version":3,"file":"Text_Reveal.IIEMCTls.mjs","names":["React.useRef"],"sources":["https:/framerusercontent.com/modules/08bb1wyKzWAEBJUwjMhn/m83r3Zfi1mjbA1nnxNAh/Text_Reveal.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform,useSpring}from\"framer-motion\";export default function SEOConnectedReveal(props){const{textContent,triggerWord,connectedComponents,font,colorInitial,colorFinal,wordSpacing,lineHeight,alignment,tag,startPosition,transition,imageScale,imageOffset}=props;const ref=React.useRef(null);// Setup Scroll & Spring\nconst startVal=startPosition/100;const endVal=startVal-.4;const{scrollYProgress}=useScroll({target:ref,offset:[`start ${startVal}`,`start ${endVal}`]});const smoothProgress=useSpring(scrollYProgress,{stiffness:transition.stiffness||100,damping:transition.damping||30,mass:transition.mass||1,restDelta:.001});const words=textContent.split(\" \");let imageIndex=0;const cleanText=textContent.split(triggerWord).join(\"\").replace(/\\s+/g,\" \").trim();const Tag=motion[tag]||motion.div;return /*#__PURE__*/_jsxs(Tag,{ref:ref,style:{...font,lineHeight:lineHeight,textAlign:alignment,width:\"100%\",display:\"block\",wordWrap:\"break-word\",margin:0,padding:0,position:\"relative\"},children:[/*#__PURE__*/_jsx(\"span\",{style:srOnlyStyle,children:cleanText}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",children:words.map((word,i)=>{const start=i/words.length;const end=start+1/words.length;if(word===triggerWord){const currentImage=connectedComponents[imageIndex];imageIndex++;if(currentImage){return /*#__PURE__*/_jsx(AnimatedElement,{progress:smoothProgress,range:[start,end],margin:wordSpacing,scale:imageScale,offset:imageOffset,children:/*#__PURE__*/React.cloneElement(currentImage,{style:{width:\"100%\",height:\"100%\",...currentImage.props.style}})},i);}else{return null;}}return /*#__PURE__*/_jsx(AnimatedWord,{word:word,progress:smoothProgress,range:[start,end],colorFrom:colorInitial,colorTo:colorFinal,margin:wordSpacing},i);})})]});}const srOnlyStyle={position:\"absolute\",width:\"1px\",height:\"1px\",padding:\"0\",margin:\"-1px\",overflow:\"hidden\",clip:\"rect(0, 0, 0, 0)\",whiteSpace:\"nowrap\",border:\"0\"};const AnimatedWord=({word,progress,range,colorFrom,colorTo,margin})=>{const opacity=useTransform(progress,range,[.3,1]);const color=useTransform(progress,range,[colorFrom,colorTo]);return /*#__PURE__*/_jsx(motion.span,{style:{display:\"inline-block\",marginRight:margin,opacity:opacity,color:color,whiteSpace:\"pre\"},children:word});};const AnimatedElement=({children,progress,range,margin,scale,offset})=>{const opacity=useTransform(progress,range,[.2,1]);const scaleAnim=useTransform(progress,range,[.95,1]);const filter=useTransform(progress,range,[\"grayscale(100%)\",\"grayscale(0%)\"]);return /*#__PURE__*/_jsx(motion.span,{style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",height:`${scale}em`,width:\"auto\",marginRight:margin,marginLeft:margin/2,verticalAlign:\"middle\",y:`${offset}%`,opacity:opacity,scale:scaleAnim,filter:filter},children:/*#__PURE__*/_jsx(\"span\",{style:{height:\"100%\",display:\"block\",aspectRatio:\"inherit\"},children:children})});};addPropertyControls(SEOConnectedReveal,{textContent:{type:ControlType.String,title:\"Content\",defaultValue:\"I create [img] this website using [img] Framer.\",displayTextArea:true,description:\"Always put a space before and after the [trigger] bracket\"},imageScale:{type:ControlType.Number,title:\"Img Scale\",min:.5,max:3,step:.1,defaultValue:1.1,description:\"Image relative size to text\"},imageOffset:{type:ControlType.Number,title:\"Img Y-Axis\",min:-50,max:50,step:1,defaultValue:-10,description:\"Move image vertical position (%)\"},tag:{type:ControlType.Enum,title:\"HTML Tag\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"div\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Paragraph\",\"Div\"],defaultValue:\"h2\"},transition:{type:ControlType.Transition,title:\"Smoothing\",defaultValue:{type:\"spring\",stiffness:200,damping:40}},startPosition:{type:ControlType.Number,title:\"Start At\",min:0,max:100,unit:\"%\",step:5,defaultValue:90},triggerWord:{type:ControlType.String,title:\"Trigger\",defaultValue:\"[img]\"},connectedComponents:{type:ControlType.Array,title:\"Attachments\",control:{type:ControlType.ComponentInstance},maxCount:10},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:40,fontWeight:600,fontFamily:\"Inter\"},controls:\"extended\"},wordSpacing:{type:ControlType.Number,title:\"Word Spacing\",defaultValue:8,min:0,max:50,step:1},lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.2,min:.8,max:3,step:.1},alignment:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\",\"justify\"],defaultValue:\"left\"},colorInitial:{type:ControlType.Color,title:\"Start Color\",defaultValue:\"#cccccc\"},colorFinal:{type:ControlType.Color,title:\"End Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SEOConnectedReveal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Reveal.map"],"mappings":"+PAA4M,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,cAAY,cAAY,sBAAoB,OAAK,eAAa,aAAW,cAAY,aAAW,YAAU,MAAI,gBAAc,aAAW,aAAW,eAAa,EAAY,EAAIA,EAAa,KAAK,CAC/b,EAAS,EAAc,IAAU,EAAO,EAAS,GAAQ,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAI,OAAO,CAAC,SAAS,IAAW,SAAS,IAAS,CAAC,CAAC,CAAO,EAAe,EAAU,EAAgB,CAAC,UAAU,EAAW,WAAW,IAAI,QAAQ,EAAW,SAAS,GAAG,KAAK,EAAW,MAAM,EAAE,UAAU,KAAK,CAAC,CAAO,EAAM,EAAY,MAAM,IAAI,CAAK,EAAW,EAAQ,EAAU,EAAY,MAAM,E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