{"version":3,"file":"PreloaderConnector.BRpdw2h-.mjs","names":["useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/KPVln8butGcLDoBa58xm/pVL8VVjhhnjpu2y7hog8/Text_Opacity_Words.js","https:/framerusercontent.com/modules/xZtXDYAWYpetRWB8mUPU/gbGWfGdBauoIrTpzLxdd/PreloaderConnector.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform}from\"framer-motion\";import{useRef}from\"react\";// Component to handle letter color changes\nconst EachLetter=({letter,starting,ending,progress,isHighlighted,primaryColor,defaultColor,scrollColor,useScrollColor})=>{// Determine the color transition range based on scroll color\nconst interpolatedColor=useTransform(progress,[starting,ending],useScrollColor?[scrollColor,isHighlighted?primaryColor:defaultColor]:[isHighlighted?primaryColor:defaultColor,isHighlighted?primaryColor:defaultColor]);return /*#__PURE__*/_jsx(motion.span,{style:{color:interpolatedColor},children:letter});};// Main component to handle text splitting and scroll color effect\nexport default function Text_Color_Change_Letters(props){const text=props.text;const totalLetters=text.length;const ref=useRef(null);// Scroll progress hook\nconst{scrollYProgress}=useScroll({target:ref,offset:[props.startOffset,props.endOffset]});return /*#__PURE__*/_jsx(\"p\",{ref:ref,style:{...props.font,margin:0,padding:0,height:\"auto\",display:\"inline-block\",whiteSpace:\"pre-wrap\",overflow:\"visible\"},children:text.split(\"\").map((letter,idx)=>{const starting=idx/totalLetters// Start progress per letter\n;const ending=(idx+1)/totalLetters// End progress per letter\n;const isHighlighted=idx>=props.startIndex&&idx<=props.endIndex;return /*#__PURE__*/_jsx(EachLetter,{letter:letter,starting:starting,ending:ending,progress:scrollYProgress,isHighlighted:isHighlighted,primaryColor:props.primaryColor,defaultColor:props.defaultColor,scrollColor:props.scrollColor,useScrollColor:props.useScrollColor},idx);})});}// Property Controls for Framer Studio\naddPropertyControls(Text_Color_Change_Letters,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Hello World, this is a sample sentence\"},font:{type:\"font\",controls:\"extended\"},defaultColor:{type:ControlType.Color,defaultValue:\"#000000\",title:\"Default Color\"},primaryColor:{title:\"Primary Color\",type:ControlType.Color,defaultValue:\"#ff0000\"},scrollColor:{title:\"Scroll Color\",type:ControlType.Color,defaultValue:\"#0000ff\"},useScrollColor:{title:\"Enable Scroll Color\",type:ControlType.Boolean,defaultValue:true},startIndex:{title:\"Highlight Start Index\",type:ControlType.Number,defaultValue:0,min:0},endIndex:{title:\"Highlight End Index\",type:ControlType.Number,defaultValue:11,min:0},startOffset:{title:\"Start Offset\",type:ControlType.String,defaultValue:\"start 0.75\"},endOffset:{title:\"End Offset\",type:ControlType.String,defaultValue:\"start 0.35\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text_Color_Change_Letters\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Opacity_Words.map","import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";export function PreLoaderConnector(props){const{duration=3,connectedFrame}=props;const[isVisible,setIsVisible]=React.useState(true);React.useEffect(()=>{// Валидация duration\nconst safeDuration=Math.max(.1,Math.min(10,Number(duration)||3));const timer=setTimeout(()=>{setIsVisible(false);},safeDuration*1e3);return()=>clearTimeout(timer);},[duration]);const containerStyle={position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",zIndex:9999,background:\"transparent\"};const frameWrapperStyle={position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\"};const frameStyle={width:\"100%\",height:\"100%\",objectFit:\"cover\"};const safeFrames=Array.isArray(connectedFrame)?connectedFrame:[];const hasFrames=safeFrames.length>0;return /*#__PURE__*/_jsx(AnimatePresence,{children:isVisible&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:1},exit:{opacity:0,transition:{duration:0}},style:containerStyle,children:hasFrames&&safeFrames.map((frame,index)=>{if(!/*#__PURE__*/React.isValidElement(frame)){console.warn(`PreLoaderConnector: Invalid frame at index ${index}`);return null;}return /*#__PURE__*/_jsx(\"div\",{style:frameWrapperStyle,children:/*#__PURE__*/React.cloneElement(frame,{style:frameStyle})},`frame-${index}`);})})});}addPropertyControls(PreLoaderConnector,{duration:{type:ControlType.Number,title:\"Duration\",defaultValue:3,min:1,max:10,unit:\"s\",step:.1,displayStepper:true},connectedFrame:{type:ControlType.Array,title:\"Connect Frame\",propertyControl:{type:ControlType.ComponentInstance}}});\nexport const __FramerMetadata__ = {\"exports\":{\"PreLoaderConnector\":{\"type\":\"reactComponent\",\"name\":\"PreLoaderConnector\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PreloaderConnector.map"],"mappings":"saAGA,SAAwB,EAA0B,EAAM,CAAC,IAAM,EAAK,EAAM,KAAW,EAAa,EAAK,OAAa,EAAIA,EAAO,KAAK,CAC/H,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAI,OAAO,CAAC,EAAM,YAAY,EAAM,UAAU,CAAC,CAAC,CAAC,OAAoB,EAAK,IAAI,CAAK,MAAI,MAAM,CAAC,GAAG,EAAM,KAAK,OAAO,EAAE,QAAQ,EAAE,OAAO,OAAO,QAAQ,eAAe,WAAW,WAAW,SAAS,UAAU,CAAC,SAAS,EAAK,MAAM,GAAG,CAAC,KAAK,EAAO,IAAM,CAAC,IAAM,EAAS,EAAI,EAC9S,GAAQ,EAAI,GAAG,EACf,EAAc,GAAK,EAAM,YAAY,GAAK,EAAM,SAAS,OAAoB,EAAK,EAAW,CAAQ,SAAgB,WAAgB,SAAO,SAAS,EAA8B,gBAAc,aAAa,EAAM,aAAa,aAAa,EAAM,aAAa,YAAY,EAAM,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