{"version":3,"file":"Highlight_Typewriter.B2CkHpcq.mjs","names":["useMemo","useState"],"sources":["https:/framerusercontent.com/modules/XbCK7ufIPoFSTAMQvhpx/m9fIv6M2EHvbA15XLWWR/Highlight_Typewriter.js"],"sourcesContent":["// Highlight Typewriter\n// @framerSupportedLayoutWidth any-prefer-fixed\n// @framerSupportedLayoutHeight any\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useMemo,useState}from\"react\";function normalizeFont(font){const f={...font};if(f.family&&!f.fontFamily)f.fontFamily=f.family;delete f.family;return f;}export default function HighlightTypewriter(raw){const texts=raw.texts?.length?raw.texts:[\"Build\",\"Launch\",\"Scale\"];const autoPlay=raw.autoPlay??true;const loop=raw.loop??true;const deleteBeforeNext=raw.deleteBeforeNext??true;const typingSpeed=Math.max(10,raw.typingSpeed??65);const deletingSpeed=Math.max(10,raw.deletingSpeed??40);const holdTime=Math.max(0,raw.holdTime??900);const boxFont=useMemo(()=>normalizeFont(raw.boxFont??{}),[raw.boxFont]);const labelFont=useMemo(()=>normalizeFont(raw.labelFont??{}),[raw.labelFont]);const textColor=raw.textColor??\"#111111\";const boxColor=raw.boxColor??\"#C6FF00\";const boxRadius=raw.boxRadius??12;const paddingX=raw.paddingX??12;const paddingY=raw.paddingY??6;const minBoxCh=Math.max(1,raw.minBoxCh??1);const prefixText=raw.prefixText??\"\";const suffixText=raw.suffixText??\"\";const prefixColor=raw.prefixColor??\"#111111\";const suffixColor=raw.suffixColor??\"#111111\";const[wordIndex,setWordIndex]=useState(0);const[count,setCount]=useState(autoPlay?0:(texts[0]??\"\").length);const[deleting,setDeleting]=useState(false);const currentWord=texts[wordIndex]??\"\";const visible=currentWord.slice(0,count);// The longest word — used for the ghost row so frame size never changes\nconst longestWord=texts.reduce((a,b)=>b.length>a.length?b:a,texts[0]??\"\");useEffect(()=>{if(!autoPlay||texts.length<=0)return;const atLast=wordIndex===texts.length-1;const full=count>=currentWord.length;const empty=count<=0;let delay=typingSpeed;let next=null;if(!deleteBeforeNext){if(!full){delay=typingSpeed;next=()=>setCount(v=>v+1);}else{delay=holdTime;next=()=>{if(atLast&&!loop)return;setWordIndex(i=>(i+1)%texts.length);setCount(0);};}}else{if(!deleting&&!full){delay=typingSpeed;next=()=>setCount(v=>v+1);}else if(!deleting&&full){delay=holdTime;next=()=>setDeleting(true);}else if(deleting&&!empty){delay=deletingSpeed;next=()=>setCount(v=>v-1);}else if(deleting&&empty){if(atLast&&!loop)return;delay=typingSpeed;next=()=>{setDeleting(false);setWordIndex(i=>(i+1)%texts.length);};}}if(!next)return;const id=window.setTimeout(next,delay);return()=>window.clearTimeout(id);},[autoPlay,count,currentWord.length,deleteBeforeNext,deleting,deletingSpeed,holdTime,loop,texts.length,typingSpeed,wordIndex]);const boxTextStyle={...boxFont,whiteSpace:\"pre\",lineHeight:boxFont.lineHeight??1.2};const labelTextStyle={...labelFont,whiteSpace:\"pre\",lineHeight:labelFont.lineHeight??1.2};const boxShell={borderRadius:boxRadius,paddingLeft:paddingX,paddingRight:paddingX,paddingTop:paddingY,paddingBottom:paddingY,display:\"inline-block\",minWidth:`${minBoxCh}ch`,textAlign:\"left\"};// Shared row layout — used by both ghost and live layers\nconst rowStyle={display:\"flex\",flexDirection:\"row\",alignItems:\"center\",whiteSpace:\"nowrap\"};return /*#__PURE__*/_jsxs(\"div\",{style:{...raw.style,width:\"100%\",// height:auto so Framer frame boundary never clips text\nheight:\"auto\",position:\"relative\",overflow:\"visible\",background:\"transparent\",paddingBottom:4},children:[/*#__PURE__*/_jsxs(\"div\",{style:{...rowStyle,visibility:\"hidden\",pointerEvents:\"none\",height:\"auto\",alignItems:\"center\"},\"aria-hidden\":\"true\",children:[prefixText?/*#__PURE__*/_jsx(\"span\",{style:{...labelTextStyle,color:prefixColor},children:prefixText}):null,/*#__PURE__*/_jsx(\"span\",{style:{...boxTextStyle,...boxShell,background:boxColor},children:longestWord}),suffixText?/*#__PURE__*/_jsx(\"span\",{style:{...labelTextStyle,color:suffixColor},children:suffixText}):null]}),/*#__PURE__*/_jsxs(\"div\",{style:{...rowStyle,position:\"absolute\",top:0,left:0,pointerEvents:\"none\"},children:[prefixText?/*#__PURE__*/_jsx(\"span\",{style:{...labelTextStyle,color:prefixColor},children:prefixText}):null,/*#__PURE__*/_jsx(\"span\",{style:{...boxTextStyle,...boxShell,color:textColor,background:boxColor},children:visible||\"\\xa0\"}),suffixText?/*#__PURE__*/_jsx(\"span\",{style:{...labelTextStyle,color:suffixColor},children:suffixText}):null]})]});}addPropertyControls(HighlightTypewriter,{texts:{type:ControlType.Array,title:\"Texts\",control:{type:ControlType.String,placeholder:\"Add word or phrase\"},defaultValue:[\"Build\",\"Launch\",\"Scale\"],maxCount:30},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:true},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true},deleteBeforeNext:{type:ControlType.Boolean,title:\"Delete Cycle\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},typingSpeed:{type:ControlType.Number,title:\"Type ms\",min:10,max:400,step:5,defaultValue:65},deletingSpeed:{type:ControlType.Number,title:\"Delete ms\",min:10,max:400,step:5,defaultValue:40,hidden:v=>!v.deleteBeforeNext},holdTime:{type:ControlType.Number,title:\"Hold ms\",min:0,max:5e3,step:50,defaultValue:900},// ── Box (typed text) font ────────────────────────────────\nboxFont:{type:ControlType.Font,title:\"Box Font\",controls:\"extended\",defaultValue:{fontFamily:\"Inter Display\",fontSize:48,variant:\"Regular\",lineHeight:1.2,letterSpacing:\"-0.03em\"}},textColor:{type:ControlType.Color,title:\"Box Text Color\",defaultValue:\"#111111\"},boxColor:{type:ControlType.Color,title:\"Box Color\",defaultValue:\"#C6FF00\"},boxRadius:{type:ControlType.Number,title:\"Box Radius\",min:0,max:64,step:1,defaultValue:12},paddingX:{type:ControlType.Number,title:\"Pad X\",min:0,max:64,step:1,defaultValue:12},paddingY:{type:ControlType.Number,title:\"Pad Y\",min:0,max:40,step:1,defaultValue:6},minBoxCh:{type:ControlType.Number,title:\"Min Width (ch)\",min:1,max:20,step:1,defaultValue:1},// ── Prefix / Suffix font ─────────────────────────────────\nlabelFont:{type:ControlType.Font,title:\"Label Font\",controls:\"extended\",defaultValue:{fontFamily:\"Inter Display\",fontSize:48,variant:\"Regular\",lineHeight:1.2,letterSpacing:\"-0.03em\"}},prefixText:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},prefixColor:{type:ControlType.Color,title:\"Prefix Color\",defaultValue:\"#111111\"},suffixText:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},suffixColor:{type:ControlType.Color,title:\"Suffix Color\",defaultValue:\"#111111\"}});HighlightTypewriter.displayName=\"Highlight Typewriter\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HighlightTypewriter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Highlight_Typewriter.map"],"mappings":"wMAG2J,SAAS,EAAc,EAAK,CAAC,IAAM,EAAE,CAAC,GAAG,CAAI,EAAmE,OAA9D,EAAE,QAAQ,CAAC,EAAE,aAAW,EAAE,WAAW,EAAE,QAAO,OAAO,EAAE,OAAc,CAAE,CAAC,SAAwB,EAAoB,EAAI,CAAC,IAAM,EAAM,EAAI,OAAO,OAAO,EAAI,MAAM,CAAC,QAAQ,SAAS,OAAO,EAAQ,EAAS,EAAI,UAAU,GAAW,EAAK,EAAI,MAAM,GAAW,EAAiB,EAAI,kBAAkB,GAAW,EAAY,KAAK,IAAI,GAAG,EAAI,aAAa,EAAE,EAAQ,EAAc,KAAK,IAAI,GAAG,EAAI,eAAe,EAAE,EAAQ,EAAS,KAAK,IAAI,EAAE,EAAI,UAAU,GAAG,EAAQ,EAAQA,MAAY,EAAc,EAAI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAI,OAAO,CAAC,EAAQ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