{"version":3,"file":"Typescript.o2adavBS.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/2o0eqTBbfN8wtn0THoPk/PuX1eIM5Sfns3BMdqgMO/Typescript.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 80\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function Typescript(props){const{prefix,texts,speed,deleteSpeed,waitTime,loop,showCursor,cursorChar,prefixColor,typedColor,cursorColor,font,alignment,style}=props;const isOnCanvas=RenderTarget.current()===RenderTarget.canvas;const[isClient,setIsClient]=useState(false);const[displayText,setDisplayText]=useState(\"\");const[currentIndex,setCurrentIndex]=useState(0);const[isDeleting,setIsDeleting]=useState(false);const[currentTextIndex,setCurrentTextIndex]=useState(0);const timeoutRef=useRef(null);useEffect(()=>{startTransition(()=>{setIsClient(true);});},[]);// Reset when texts change\nuseEffect(()=>{if(!isClient)return;startTransition(()=>{setDisplayText(\"\");setCurrentIndex(0);setIsDeleting(false);setCurrentTextIndex(0);});},[isClient,texts]);// Typescript logic — disabled on canvas for performance\nuseEffect(()=>{if(!isClient||isOnCanvas)return;if(!texts||texts.length===0)return;const currentFullText=texts[currentTextIndex]||\"\";const isSingleText=texts.length===1;if(!isDeleting){if(currentIndex<currentFullText.length){timeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setDisplayText(currentFullText.slice(0,currentIndex+1));setCurrentIndex(prev=>prev+1);});},speed);}else{if(isSingleText&&!loop)return;timeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setIsDeleting(true);});},waitTime);}}else{if(currentIndex>0){timeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setDisplayText(currentFullText.slice(0,currentIndex-1));setCurrentIndex(prev=>prev-1);});},deleteSpeed);}else{const nextIndex=(currentTextIndex+1)%texts.length;if(!loop&&nextIndex===0)return;startTransition(()=>{setIsDeleting(false);setCurrentTextIndex(nextIndex);setCurrentIndex(0);setDisplayText(\"\");});}}return()=>{if(timeoutRef.current!==null){window.clearTimeout(timeoutRef.current);}};},[isClient,isOnCanvas,currentIndex,isDeleting,currentTextIndex,texts,speed,deleteSpeed,waitTime,loop]);const alignMap={left:\"flex-start\",center:\"center\",right:\"flex-end\"};const containerStyle={...style,display:\"flex\",flexWrap:\"wrap\",justifyContent:alignMap[alignment]||\"flex-start\",alignItems:\"baseline\",width:\"100%\",minHeight:\"1em\",overflow:\"hidden\",wordBreak:\"break-word\",overflowWrap:\"break-word\"};const textLineStyle={...font,display:\"inline\",whiteSpace:\"pre-wrap\",textAlign:alignment,minWidth:\"max-content\"};const hasContent=prefix&&prefix.length>0||texts&&texts.length>0;// Canvas preview — show static full text\nif(isOnCanvas||!isClient){return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:/*#__PURE__*/_jsxs(\"span\",{style:textLineStyle,children:[prefix&&/*#__PURE__*/_jsxs(\"span\",{style:{color:prefixColor},children:[prefix,\" \"]}),/*#__PURE__*/_jsx(\"span\",{style:{color:typedColor},children:hasContent?texts?.[0]||\"\":\"Add texts to get started\"}),showCursor&&/*#__PURE__*/_jsx(\"span\",{style:{color:cursorColor},children:cursorChar})]})});}return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:/*#__PURE__*/_jsxs(\"span\",{style:textLineStyle,children:[prefix&&/*#__PURE__*/_jsxs(\"span\",{style:{color:prefixColor},children:[prefix,\" \"]}),/*#__PURE__*/_jsx(\"span\",{style:{color:typedColor},children:displayText}),showCursor&&/*#__PURE__*/_jsx(motion.span,{animate:{opacity:[1,0]},transition:{duration:.6,repeat:Infinity,repeatType:\"reverse\",ease:\"easeInOut\"},style:{display:\"inline\",color:cursorColor},children:cursorChar})]})});}Typescript.displayName=\"Typescript\";Typescript.defaultProps={prefix:\"We're born 🌞 to\",texts:[\"create things that matter.\",\"build the future.\",\"design with purpose.\"],speed:50,deleteSpeed:30,waitTime:2e3,loop:true,showCursor:true,cursorChar:\"_\",prefixColor:\"#000000\",typedColor:\"#D4A843\",cursorColor:\"#D4A843\",font:{fontFamily:\"Inter\",fontWeight:500,fontSize:42,lineHeight:\"1.3em\"},alignment:\"left\"};addPropertyControls(Typescript,{prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"We're born 🌞 to\",displayTextArea:false,description:\"Static text displayed before the animated portion. Leave empty to show only the typed text.\"},texts:{type:ControlType.Array,title:\"Typed Texts\",defaultValue:[\"create things that matter.\",\"build the future.\",\"design with purpose.\"],control:{type:ControlType.String},description:\"List of texts that will be typed and cycled through. Add multiple entries for a looping effect.\"},speed:{type:ControlType.Number,title:\"Type Speed\",defaultValue:50,min:10,max:200,step:5,unit:\"ms\",description:\"Delay in ms between each character typed. Lower = faster.\"},deleteSpeed:{type:ControlType.Number,title:\"Delete Speed\",defaultValue:30,min:10,max:200,step:5,unit:\"ms\",description:\"Delay in ms between each character deleted. Lower = faster.\"},waitTime:{type:ControlType.Number,title:\"Wait Time\",defaultValue:2e3,min:200,max:1e4,step:100,unit:\"ms\",description:\"How long the full text stays visible before deleting.\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"When on, cycles through all texts endlessly. When off, stops after the last text.\"},showCursor:{type:ControlType.Boolean,title:\"Cursor\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\",description:\"Toggle the blinking cursor after the typed text.\"},cursorChar:{type:ControlType.String,title:\"Cursor Char\",defaultValue:\"_\",hidden:props=>!props.showCursor,description:'Character used as cursor. Common choices: \"_\", \"|\", \"▌\"'},prefixColor:{type:ControlType.Color,title:\"Prefix Color\",defaultValue:\"#000000\",description:\"Color of the static prefix text.\"},typedColor:{type:ControlType.Color,title:\"Typed Color\",defaultValue:\"#D4A843\",description:\"Color of the animated typed text.\"},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#D4A843\",hidden:props=>!props.showCursor,description:\"Color of the blinking cursor.\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:{fontSize:42,lineHeight:\"1.3em\"},description:\"Applies to both prefix and typed text. Adjust size, weight, and line height here.\"},alignment:{type:ControlType.Enum,title:\"Alignment\",defaultValue:\"left\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true,description:\"Horizontal text alignment within the component.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Typescript\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"* @framerIntrinsicWidth 600\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"80\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Typescript.map"],"mappings":"uQAMG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,SAAO,QAAM,QAAM,cAAY,WAAS,OAAK,aAAW,aAAW,cAAY,aAAW,cAAY,OAAK,YAAU,SAAO,EAAY,EAAW,EAAa,QAAQ,IAAI,EAAa,OAAY,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAE,EAAO,CAAC,EAAa,GAAiBA,EAAS,CAAC,EAAO,CAAC,EAAW,GAAeA,EAAS,EAAK,EAAO,CAAC,EAAiB,GAAqBA,EAAS,CAAC,EAAQ,EAAWC,EAAO,IAAI,EAAE,MAAc,CAAC,MAAoB,CAAC,EAAY,EAAI,CAAE,CAAC,CAAE,EAAE,CAAC,CAAC,EACjkB,MAAc,CAAK,GAAgB,MAAoB,CAAC,EAAe,EAAE,EAAE,EAAgB,CAAC,EAAE,EAAc,EAAK,EAAE,EAAoB,CAAC,CAAE,CAAC,CAAE,EA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