{"version":3,"file":"Text_1.CUsCIcBf.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/0V41GppdYoUlrXfUbFQM/4ExuJk69CPj9NLUG5E6g/Text_1.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform}from\"framer-motion\";import{useRef,useEffect}from\"react\";// Cada letra\nconst EachCharacter=({char,start,end,progress,duration,easing,index,transitionStartIndex,accentColor,revealColor,fontWeight})=>{const colorProgress=useTransform(progress,[start,end],[accentColor,revealColor]);const initialColor=index<transitionStartIndex?revealColor:accentColor;return /*#__PURE__*/_jsx(motion.span,{style:{color:index<transitionStartIndex?initialColor:colorProgress,fontWeight:fontWeight||\"normal\"},transition:{duration,ease:easing},children:char});};// Cada palabra\nconst EachWord=({word,progress,starting,ending,duration,easing,transitionStartIndex,currentCharacterIndex,accentColor,revealColor,fontWeight})=>{const characters=word.split(\"\");const step=(ending-starting)/characters.length;return /*#__PURE__*/_jsxs(motion.span,{children:[characters.map((char,idx)=>{const charStart=starting+step*idx;const charEnd=starting+step*(idx+1);return /*#__PURE__*/_jsx(EachCharacter,{char:char,start:charStart,end:charEnd,progress:progress,duration:duration,easing:easing,index:currentCharacterIndex+idx,transitionStartIndex:transitionStartIndex,accentColor:accentColor,revealColor:revealColor,fontWeight:fontWeight},idx);}),\"\\xa0\"]});};// Imagen inline\nconst InlineImage=({src,height})=>/*#__PURE__*/_jsx(\"img\",{src:src,alt:\"\",style:{height:`${height}px`,margin:\"0 8px\",verticalAlign:\"middle\"}});export default function Text_Color_Letters(props){const{content,duration,easing,fontSize,lineHeight,letterSpacing,paragraphAlign,transitionStartIndex,fontFamily,accentColor,revealColor}=props;const ref=useRef(null);const{scrollYProgress}=useScroll({target:ref,offset:[\"start 0.75\",\"start 0.15\"]});useEffect(()=>{const style=document.createElement(\"style\");style.appendChild(document.createTextNode(`\n        @import url('https://fonts.googleapis.com/css2?family=${fontFamily.replace(/ /g,\"+\")}:wght@100;200;300;400;500;600;700;800;900&display=swap');\n      `));document.head.appendChild(style);return()=>{document.head.removeChild(style);};},[fontFamily]);let currentCharacterIndex=0;const totalWords=content.filter(item=>item.type===\"word\").length;return /*#__PURE__*/_jsx(\"p\",{ref:ref,style:{fontFamily:`${fontFamily}, sans-serif`,fontSize:`${fontSize}px`,color:\"#666666\",display:\"flex\",flexWrap:\"wrap\",lineHeight:`${lineHeight}px`,letterSpacing:`${letterSpacing}px`,justifyContent:paragraphAlign,margin:0},children:content.map((item,idx)=>{if(item.type===\"word\"){const wordLength=item.value.length;const starting=currentCharacterIndex/(totalWords*(wordLength+1));const ending=(currentCharacterIndex+wordLength)/(totalWords*(wordLength+1));const startIdx=currentCharacterIndex;currentCharacterIndex+=wordLength+1;return /*#__PURE__*/_jsx(EachWord,{word:item.value,progress:scrollYProgress,starting:starting,ending:ending,duration:duration,easing:easing,transitionStartIndex:transitionStartIndex,currentCharacterIndex:startIdx,accentColor:accentColor,revealColor:revealColor,fontWeight:item.fontWeight},`word-${idx}`);}else if(item.type===\"image\"){return /*#__PURE__*/_jsx(InlineImage,{src:item.src,height:fontSize},`img-${idx}`);}return null;})});}addPropertyControls(Text_Color_Letters,{content:{title:\"Content\",type:ControlType.Array,propertyControl:{type:ControlType.Object,controls:{type:{type:ControlType.Enum,options:[\"word\",\"image\"],optionTitles:[\"Word\",\"Image\"],defaultValue:\"word\"},value:{type:ControlType.String,title:\"Word\",defaultValue:\"Hola\"},src:{type:ControlType.Image,title:\"Image\"},fontWeight:{type:ControlType.Enum,options:[\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\",\"normal\",\"bold\"],optionTitles:[\"Thin\",\"Extra Light\",\"Light\",\"Normal\",\"Medium\",\"Semi Bold\",\"Bold\",\"Extra Bold\",\"Black\",\"Normal\",\"Bold\"],defaultValue:\"normal\"}}},defaultValue:[{type:\"word\",value:\"Hola\",fontWeight:\"bold\"},{type:\"image\",src:\"https://via.placeholder.com/40\"},{type:\"word\",value:\"mundo\",fontWeight:\"300\"}]},fontFamily:{title:\"Font Family\",type:ControlType.String,defaultValue:\"Urbanist\"},fontSize:{title:\"Font Size\",type:ControlType.Number,defaultValue:48,min:10,max:100},lineHeight:{title:\"Line Height\",type:ControlType.Number,defaultValue:60,min:10,max:100},letterSpacing:{title:\"Letter Spacing\",type:ControlType.Number,defaultValue:-3,min:-10,max:10},paragraphAlign:{title:\"Paragraph Align\",type:ControlType.Enum,options:[\"flex-start\",\"center\",\"flex-end\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\"},duration:{title:\"Duration\",type:ControlType.Number,defaultValue:.3,min:.1,max:3,step:.1},easing:{title:\"Easing\",type:ControlType.Enum,options:[\"easeInOut\",\"easeIn\",\"easeOut\",\"linear\"],optionTitles:[\"Ease In Out\",\"Ease In\",\"Ease Out\",\"Linear\"],defaultValue:\"easeInOut\"},transitionStartIndex:{title:\"Transition Start Index\",type:ControlType.Number,defaultValue:22,min:0,max:1e3},accentColor:{title:\"Accent Color\",type:ControlType.Color,defaultValue:\"#272A2C\"},revealColor:{title:\"Reveal Color\",type:ControlType.Color,defaultValue:\"#ffffff\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text_Color_Letters\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_1.map"],"mappings":"kYAG+I,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,UAAQ,WAAS,SAAO,WAAS,aAAW,gBAAc,iBAAe,uBAAqB,aAAW,cAAY,eAAa,EAAY,EAAIA,EAAO,KAAK,CAAM,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAI,OAAO,CAAC,aAAa,aAAa,CAAC,CAAC,CAAC,MAAc,CAAC,IAAM,EAAM,SAAS,cAAc,QAAQ,CAEvc,OAFwc,EAAM,Y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