{"version":3,"file":"TypewriterEffect.DNkawHIa.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/yFX1pwtywZZRBXpppoKo/sEtRt3vG51Q6Hk0jgD4H/TypewriterEffect.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Text Reveal with Strike-Through (Blur Removed)\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function BlurReveal(props){const{words=[{word:\"Hello\"},{word:\"World\"},{word:\"Framer\"}],displayDuration,animationDuration,initialDelay,stopOnLast,loopAfterWait,loopWaitDuration,alignment,strikeColor,strikeHeight,strikeDelayFactor,strikeDuration,font,fontSize,textColor,yOffset,style}=props;const[index,setIndex]=useState(0);const[hasStarted,setHasStarted]=useState(false);// 1. Handle Initial Delay\nuseEffect(()=>{const delayTimer=setTimeout(()=>{setHasStarted(true);},initialDelay*1e3);return()=>clearTimeout(delayTimer);},[initialDelay]);// 2. Handle Cycle Timer\nuseEffect(()=>{if(!hasStarted)return;let timer;if(stopOnLast&&index===words.length-1){if(loopAfterWait){// Wait for the specified duration on the last word, then restart\ntimer=setTimeout(()=>{setIndex(0);},loopWaitDuration*1e3);}else{// Stop completely\nreturn;}}else{// Normal display cycle\ntimer=setTimeout(()=>{setIndex(prev=>(prev+1)%words.length);},displayDuration);}return()=>clearTimeout(timer);},[index,displayDuration,hasStarted,stopOnLast,loopAfterWait,loopWaitDuration,words.length]);const currentWord=words[index%words.length]?.word||\"\";const isLastWord=index===words.length-1;// Determine if we should strike through\nconst shouldStrike=stopOnLast&&isLastWord?false:true;// Map alignment\nconst alignMap={left:\"start\",center:\"center\",right:\"end\"};const textAlign=alignMap[alignment]||\"start\";return /*#__PURE__*/_jsxs(\"div\",{style:{...style,...font,// We override the font object's size with our specific control\nfontSize:fontSize,color:textColor,display:\"inline-grid\",gridTemplateColumns:\"1fr\",justifyItems:textAlign,alignItems:\"center\",width:\"max-content\",height:\"max-content\",whiteSpace:\"pre\",position:\"relative\"},children:[words.map((w,i)=>/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{gridArea:\"1 / 1\",visibility:\"hidden\",opacity:0,whiteSpace:\"pre\",pointerEvents:\"none\"},children:w.word},i)),hasStarted&&/*#__PURE__*/_jsx(AnimatePresence,{mode:\"popLayout\",children:/*#__PURE__*/_jsxs(motion.span,{initial:{opacity:0,y:yOffset},animate:{opacity:1,y:0},exit:{opacity:0,y:-yOffset},transition:{duration:animationDuration,ease:\"easeInOut\"},style:{gridArea:\"1 / 1\",display:\"inline-block\",willChange:\"transform, opacity\",zIndex:2,whiteSpace:\"pre\",width:\"max-content\",position:\"relative\"},children:[currentWord,shouldStrike&&/*#__PURE__*/_jsx(motion.span,{initial:{width:\"0%\"},animate:{width:\"100%\"},transition:{// Delay based on a percentage of the display duration\ndelay:animationDuration+displayDuration/1e3*strikeDelayFactor,duration:strikeDuration,ease:\"easeInOut\"},style:{position:\"absolute\",top:\"55%\",left:0,height:strikeHeight,backgroundColor:strikeColor,display:\"block\",zIndex:3,pointerEvents:\"none\"}})]},index)})]});}addPropertyControls(BlurReveal,{words:{type:ControlType.Array,title:\"Words\",control:{type:ControlType.Object,controls:{word:{type:ControlType.String,defaultValue:\"Hello\"}}},defaultValue:[{word:\"Design\"},{word:\"Publish\"},{word:\"Framer\"}]},// --- Typography Controls ---\nfont:{type:ControlType.Font,title:\"Font Family\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"60px\",variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},fontSize:{type:ControlType.String,title:\"Font Size\",defaultValue:\"5rem\",placeholder:\"e.g. 60px, 2rem\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},alignment:{type:ControlType.Enum,title:\"Alignment\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\"},// --- Animation Physics ---\nyOffset:{type:ControlType.Number,title:\"Y Offset\",defaultValue:15,min:0,max:100,unit:\"px\"},// --- Animation Timing ---\ndisplayDuration:{type:ControlType.Number,title:\"Display Time\",defaultValue:2e3,min:500,max:1e4,unit:\"ms\",step:100},animationDuration:{type:ControlType.Number,title:\"Anim Duration\",defaultValue:.5,min:.1,max:2,unit:\"s\",step:.1},initialDelay:{type:ControlType.Number,title:\"Start Delay\",defaultValue:0,min:0,max:10,unit:\"s\",step:.5},stopOnLast:{type:ControlType.Boolean,title:\"Stop on Last\",defaultValue:true},loopAfterWait:{type:ControlType.Boolean,title:\"Restart Loop\",defaultValue:false,hidden(props){return!props.stopOnLast;}},loopWaitDuration:{type:ControlType.Number,title:\"Wait Before Loop\",defaultValue:2,min:.5,max:20,unit:\"s\",step:.5,hidden(props){return!props.stopOnLast||!props.loopAfterWait;}},// --- Strike Controls ---\nstrikeColor:{type:ControlType.Color,title:\"Strike Color\",defaultValue:\"#FF0000\"},strikeHeight:{type:ControlType.Number,title:\"Strike Height\",defaultValue:3,min:1,max:10,unit:\"px\"},strikeDelayFactor:{type:ControlType.Number,title:\"Strike Delay\",defaultValue:.4,min:0,max:1,step:.1,displayStepper:true,unit:\"%\"},strikeDuration:{type:ControlType.Number,title:\"Strike Time\",defaultValue:.3,min:.1,max:2,unit:\"s\",step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BlurReveal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypewriterEffect.map"],"mappings":"gPAKG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK,QAAQ,CAAC,CAA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