{"version":3,"file":"LoopTypeFX.B8MDebwK.mjs","names":["useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/iPHDp7oeFJD3zHSh2KaK/IlGMm5rGcZshdV1kuPp2/LoopTypeFX.js"],"sourcesContent":["// Text typing effect component with customizable speed, cursor, and animation options\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,useMemo,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Text Typing Effect\n *\n * A component that creates a typewriter effect with customizable typing speed, cursor, and animation options.\n *\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 50\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TypewriterEffect(props){const{text=[\"Text typing effect\",\"for your websites\",\"Happy coding!\"],typingSpeed=75,pauseDuration=1500,deletingSpeed=30,initialDelay=0,loop=true,showCursor=true,cursorCharacter=\"|\",cursorBlinkDuration=500,hideCursorWhileTyping=false,startOnVisible=false,reverseMode=false,textColor=\"#000000\",backgroundColor=\"#FFFFFF\",font,cursorColor=\"#000000\"}=props;const[displayedText,setDisplayedText]=useState(\"\");const[currentCharIndex,setCurrentCharIndex]=useState(0);const[isDeleting,setIsDeleting]=useState(false);const[currentTextIndex,setCurrentTextIndex]=useState(0);const[isVisible,setIsVisible]=useState(!startOnVisible);const[cursorVisible,setCursorVisible]=useState(true);const containerRef=useRef(null);const cursorIntervalRef=useRef(null);const typingTimeoutRef=useRef(null);const isStatic=useIsStaticRenderer();const textArray=useMemo(()=>Array.isArray(text)?text:[text],[text]);// Cursor blinking effect\nuseEffect(()=>{if(!showCursor||isStatic)return;if(cursorIntervalRef.current){clearInterval(cursorIntervalRef.current);}cursorIntervalRef.current=window.setInterval(()=>{startTransition(()=>{setCursorVisible(prev=>!prev);});},cursorBlinkDuration);return()=>{if(cursorIntervalRef.current){clearInterval(cursorIntervalRef.current);}};},[showCursor,cursorBlinkDuration,isStatic]);// Intersection observer for start on visible\nuseEffect(()=>{if(!startOnVisible||!containerRef.current||isStatic)return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting){startTransition(()=>{setIsVisible(true);});}});},{threshold:.1});observer.observe(containerRef.current);return()=>observer.disconnect();},[startOnVisible,isStatic]);// Main typing effect\nuseEffect(()=>{if(!isVisible||isStatic){// Show complete first text in static mode\nif(isStatic&&textArray.length>0){setDisplayedText(textArray[0]);}return;}if(typingTimeoutRef.current){clearTimeout(typingTimeoutRef.current);}const currentText=textArray[currentTextIndex];const processedText=reverseMode?currentText.split(\"\").reverse().join(\"\"):currentText;const executeTypingAnimation=()=>{if(isDeleting){if(displayedText===\"\"){startTransition(()=>{setIsDeleting(false);if(currentTextIndex===textArray.length-1&&!loop){return;}setCurrentTextIndex(prev=>(prev+1)%textArray.length);setCurrentCharIndex(0);});typingTimeoutRef.current=window.setTimeout(()=>{},pauseDuration);}else{typingTimeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setDisplayedText(prev=>prev.slice(0,-1));});},deletingSpeed);}}else{if(currentCharIndex<processedText.length){typingTimeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setDisplayedText(prev=>prev+processedText[currentCharIndex]);setCurrentCharIndex(prev=>prev+1);});},typingSpeed);}else if(textArray.length>1){typingTimeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setIsDeleting(true);});},pauseDuration);}}};if(currentCharIndex===0&&!isDeleting&&displayedText===\"\"){typingTimeoutRef.current=window.setTimeout(executeTypingAnimation,initialDelay);}else{executeTypingAnimation();}return()=>{if(typingTimeoutRef.current){clearTimeout(typingTimeoutRef.current);}};},[currentCharIndex,displayedText,isDeleting,typingSpeed,deletingSpeed,pauseDuration,textArray,currentTextIndex,loop,initialDelay,isVisible,reverseMode,isStatic]);const shouldHideCursor=hideCursorWhileTyping&&(currentCharIndex<textArray[currentTextIndex]?.length||isDeleting);const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",display:\"inline-block\",whiteSpace:\"pre-wrap\",backgroundColor,...isFixedWidth?{...props?.style}:{minWidth:\"max-content\"},...font},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:textColor},children:displayedText}),showCursor&&!shouldHideCursor&&/*#__PURE__*/_jsx(\"span\",{style:{marginLeft:\"0.25rem\",display:\"inline-block\",opacity:cursorVisible?1:0,color:cursorColor},children:cursorCharacter})]});}addPropertyControls(TypewriterEffect,{text:{type:ControlType.Array,title:\"Text Array\",control:{type:ControlType.String,placeholder:\"Enter text...\"},defaultValue:[\"Text typing effect\",\"for your websites\",\"Happy coding!\"],maxCount:10},typingSpeed:{type:ControlType.Number,title:\"Typing Speed\",defaultValue:75,min:10,max:500,step:5,unit:\"ms\"},pauseDuration:{type:ControlType.Number,title:\"Pause Duration\",defaultValue:1500,min:100,max:5e3,step:100,unit:\"ms\"},deletingSpeed:{type:ControlType.Number,title:\"Deleting Speed\",defaultValue:30,min:10,max:200,step:5,unit:\"ms\"},initialDelay:{type:ControlType.Number,title:\"Initial Delay\",defaultValue:0,min:0,max:3e3,step:100,unit:\"ms\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},showCursor:{type:ControlType.Boolean,title:\"Show Cursor\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},cursorCharacter:{type:ControlType.String,title:\"Cursor Character\",defaultValue:\"|\",hidden:({showCursor})=>!showCursor},cursorBlinkDuration:{type:ControlType.Number,title:\"Cursor Blink Speed\",defaultValue:500,min:100,max:2e3,step:100,unit:\"ms\",hidden:({showCursor})=>!showCursor},hideCursorWhileTyping:{type:ControlType.Boolean,title:\"Hide Cursor While Typing\",defaultValue:false,enabledTitle:\"Hide\",disabledTitle:\"Show\",hidden:({showCursor})=>!showCursor},startOnVisible:{type:ControlType.Boolean,title:\"Start On Visible\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},reverseMode:{type:ControlType.Boolean,title:\"Reverse Mode\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#FFFFFF\"},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#000000\",hidden:({showCursor})=>!showCursor},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\",description:\"More Components at [DiverseKit](https://framer.link/se2heI4)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypewriterEffect\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"300\",\"framerIntrinsicHeight\":\"50\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LoopTypeFX.map"],"mappings":"+NAWG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,OAAK,CAAC,qBAAqB,oBAAoB,gBAAgB,CAAC,cAAY,GAAG,gBAAc,KAAK,gBAAc,GAAG,eAAa,EAAE,OAAK,GAAK,aAAW,GAAK,kBAAgB,IAAI,sBAAoB,IAAI,wBAAsB,GAAM,iBAAe,GAAM,cAAY,GAAM,YAAU,UAAU,kBAAgB,UAAU,OAAK,cAAY,WAAW,EAAW,CAAC,EAAc,GAAkBA,EAAS,GAAG,CAAM,CAAC,EAAiB,GAAqBA,EAAS,EAAE,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAM,CAAC,EAAiB,GAAqBA,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,CAAC,EAAe,CAAM,CAAC,EAAc,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