{"version":3,"file":"WritingWord.CokDMbHD.mjs","names":[],"sources":["https:/framerusercontent.com/modules/WfR9KGlhSTikmjV9xrqS/Rfibs4N4vPVYkpATnwav/WritingWord.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function TypingEffect(props){const words=props.words||[\"UX design\",\"artificial intelligence\",\"data analysis\",\"digital marketing\",\"business innovation\"];const textColor=props.textColor||\"#000000\";const fontSize=props.fontSize||24;const fontFamily=props.fontFamily||\"sans-serif\";const cursorFontFamily=props.cursorFontFamily||props.fontFamily||\"monospace\";const typeSpeed=props.typeSpeed||150;const deleteSpeed=props.deleteSpeed||100;const delayBetweenWords=props.delayBetweenWords||1e3;const initialDelay=props.initialDelay||2e3;const cursorColor=props.cursorColor||\"#000000\";const cursorCharacter=props.cursorCharacter||\"|\";const backgroundColor=props.backgroundColor||\"transparent\";// Padding & border\nconst paddingTop=props.paddingTop||0;const paddingRight=props.paddingRight||0;const paddingBottom=props.paddingBottom||0;const paddingLeft=props.paddingLeft||0;const borderRadius=props.borderRadius||0;const lineHeightMultiplier=props.lineHeightMultiplier||1.2;const lineHeight=fontSize*lineHeightMultiplier;// For sizing reference if needed\nconst longestWord=words.reduce((longest,word)=>word.length>longest.length?word:longest,\"\");const[displayText,setDisplayText]=React.useState(\"\");const[wordIndex,setWordIndex]=React.useState(0);const[isTyping,setIsTyping]=React.useState(true);const[showCursor,setShowCursor]=React.useState(true);const[initialDelayComplete,setInitialDelayComplete]=React.useState(false);// Cursor blink effect\nReact.useEffect(()=>{let isMounted=true;const interval=window.setInterval(()=>{if(isMounted){setShowCursor(prev=>!prev);}},500);return()=>{isMounted=false;window.clearInterval(interval);};},[]);// Initial delay effect\nReact.useEffect(()=>{let isMounted=true;let timeoutId=null;if(!initialDelayComplete){// Show first word right away\nsetDisplayText(words[0]||\"\");timeoutId=window.setTimeout(()=>{if(isMounted){setInitialDelayComplete(true);}},initialDelay);}return()=>{isMounted=false;if(timeoutId!==null){window.clearTimeout(timeoutId);}};},[initialDelay,words,initialDelayComplete]);// Typing/deleting effect\nReact.useEffect(()=>{if(!initialDelayComplete)return;let isMounted=true;let timeoutId=null;const currentWordIndex=wordIndex%words.length;const currentWord=words[currentWordIndex]||\"\";const handleTyping=()=>{if(!isMounted)return;if(isTyping){// Type forward\nif(displayText.length<currentWord.length){timeoutId=window.setTimeout(()=>{if(isMounted){setDisplayText(currentWord.substring(0,displayText.length+1));}},typeSpeed);}else{// Pause, then start deleting\ntimeoutId=window.setTimeout(()=>{if(isMounted){setIsTyping(false);}},delayBetweenWords);}}else{// Delete backward\nif(displayText.length>0){timeoutId=window.setTimeout(()=>{if(isMounted){setDisplayText(prev=>prev.substring(0,prev.length-1));}},deleteSpeed);}else{// Move to next word\ntimeoutId=window.setTimeout(()=>{if(isMounted){setWordIndex(prev=>(prev+1)%words.length);setIsTyping(true);}},typeSpeed);}}};handleTyping();return()=>{isMounted=false;if(timeoutId!==null){window.clearTimeout(timeoutId);}};},[displayText,wordIndex,isTyping,words,typeSpeed,deleteSpeed,delayBetweenWords,initialDelayComplete]);return /*#__PURE__*/_jsxs(\"div\",{style:{backgroundColor,paddingTop:`${paddingTop}px`,paddingRight:`${paddingRight}px`,paddingBottom:`${paddingBottom}px`,paddingLeft:`${paddingLeft}px`,borderRadius,width:\"100%\",height:\"auto\",textAlign:\"center\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontFamily,fontSize:`${fontSize}px`,lineHeight:`${lineHeight}px`,color:textColor,background:textColor.includes(\"gradient\")?textColor:\"transparent\",backgroundClip:textColor.includes(\"gradient\")?\"text\":\"initial\",WebkitBackgroundClip:textColor.includes(\"gradient\")?\"text\":\"initial\",color:textColor.includes(\"gradient\")?\"transparent\":textColor},children:displayText}),/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:cursorFontFamily,fontSize:`${fontSize}px`,lineHeight:`${lineHeight}px`,color:showCursor?cursorColor:\"transparent\",marginLeft:2},children:cursorCharacter}),/*#__PURE__*/_jsx(\"div\",{style:{visibility:\"hidden\",position:\"absolute\",height:0,overflow:\"hidden\",whiteSpace:\"nowrap\",pointerEvents:\"none\",fontFamily,fontSize:`${fontSize}px`},children:longestWord})]});}// Property controls\naddPropertyControls(TypingEffect,{words:{type:ControlType.Array,title:\"Words\",propertyControl:{type:ControlType.String,displayTextKey:true},defaultValue:[\"UX design\",\"artificial intelligence\",\"data analysis\",\"digital marketing\",\"business innovation\"]},initialDelay:{type:ControlType.Number,title:\"Initial Delay (ms)\",defaultValue:2e3,min:0,max:1e4,step:100},textColor:{type:ControlType.String,title:\"Text Color (Gradient)\",defaultValue:\"linear-gradient(to right, red, yellow)\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:24,min:8,max:100,step:1},fontFamily:{type:ControlType.String,title:\"Words Font\",defaultValue:\"sans-serif\"},cursorFontFamily:{type:ControlType.String,title:\"Cursor Font\",defaultValue:\"monospace\"},cursorCharacter:{type:ControlType.String,title:\"Cursor Character\",defaultValue:\"|\"},lineHeightMultiplier:{type:ControlType.Number,title:\"Line Height Multiplier\",defaultValue:1.2,min:.8,max:3,step:.1},typeSpeed:{type:ControlType.Number,title:\"Type Speed (ms)\",defaultValue:150,min:10,max:500,step:10},deleteSpeed:{type:ControlType.Number,title:\"Delete Speed (ms)\",defaultValue:100,min:10,max:500,step:10},delayBetweenWords:{type:ControlType.Number,title:\"Delay Between Words (ms)\",defaultValue:1e3,min:0,max:5e3,step:100},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"transparent\"},paddingTop:{type:ControlType.Number,title:\"Padding Top\",defaultValue:0,min:0,max:100,step:1},paddingRight:{type:ControlType.Number,title:\"Padding Right\",defaultValue:0,min:0,max:100,step:1},paddingBottom:{type:ControlType.Number,title:\"Padding Bottom\",defaultValue:0,min:0,max:100,step:1},paddingLeft:{type:ControlType.Number,title:\"Padding Left\",defaultValue:0,min:0,max:100,step:1},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:100,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypingEffect\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WritingWord.map"],"mappings":"yJAAyI,SAAwB,EAAa,EAAM,CAAC,IAAM,EAAM,EAAM,OAAO,CAAC,YAAY,0BAA0B,gBAAgB,oBAAoB,sBAAsB,CAAO,EAAU,EAAM,WAAW,UAAgB,EAAS,EAAM,UAAU,GAAS,EAAW,EAAM,YAAY,aAAmB,EAAiB,EAAM,kBAAkB,EAAM,YAAY,YAAkB,EAAU,EAAM,WAAW,IAAU,EAAY,EAAM,aAAa,IAAU,EAAkB,EAAM,mBAAmB,IAAU,EAAa,EAAM,cAAc,IAAU,EAAY,EAAM,aAAa,UAAgB,EAAgB,EAAM,iBAAiB,IAAU,EAAgB,EAAM,iBAAiB,cAC/yB,EAAW,EAAM,YAAY,EAAQ,EAAa,EAAM,cAAc,EAAQ,EAAc,EAAM,eAAe,EAAQ,EAAY,EAAM,aAAa,EAAQ,EAAa,EAAM,cAAc,EAAQ,EAAqB,EAAM,sBAAsB,IAAU,EAAW,EAAS,EACxR,EAAY,EAAM,QAAQ,EAAQ,IAAO,EAAK,OAAO,EAAQ,OAAO,EAAK,EAAQ,IAAS,CAAC,EAAY,EAAe,CAAA,EAAgB,IAAS,CAAC,EAAU,EAAa,CAAA,EAAgB,GAAQ,CAAC,EAAS,EAAY,CAAA,EAAgB,IAAW,CAAC,EAAW,EAAc,CAAA,EAAgB,IAAW,CAAC,EAAqB,EAAwB,CAAA,EAAgB,IAQpC,OAPrU,MAAoB,CAAC,IAAI,EAAU,GAAW,EAAS,EAAO,gBAAgB,CAAI,GAAW,EAAc,GAAM,CAAC,EAAQ,EA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