{"version":3,"file":"ScrollColorText.CLo-cPzi.mjs","names":["useState","useRef","useCallback","useRef","useState"],"sources":["https:/framerusercontent.com/modules/gzlOp32jiotI41qoKAWR/ywWcjLixWUOKtCQdWR5F/Modal_Trigger.js","https:/framerusercontent.com/modules/k4MZtCX0FIPjFzmthqbO/WJ2cvvoam53ZHWli2TP2/ScrollColorText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useCallback,useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicHeight 0\n * @framerIntrinsicWidth 0\n */export default function ModalTrigger({showOnMouseLeave,delayConfig,scrollConfig}){const[hasBeenTriggered,setHasBeenTriggered]=useState(false);const triggerRef=useRef(null);// Event listeners added in the effect call don't have access to state\n// updates, so we'll use a ref and set both ref.current and state\n// in _setHasBeenTriggered.\nconst stateRef=useRef(hasBeenTriggered);const _setHasBeenTriggered=newState=>{stateRef.current=newState;setHasBeenTriggered(newState);};const showModal=useCallback(node=>{if(stateRef.current)return;simulateClick(node);_setHasBeenTriggered(true);},[]);const triggerOnMouseOut=useCallback(node=>e=>{// You can remove conditions if you'd prefer that the pop-up isn't\n    // triggered by the mouse leaving certain edges of the viewport.\n    if(// Top\n    e.clientY<=0||// Left\n    e.clientX<=0||// Right\n    e.clientX>=window.innerWidth||// Bottom\n    e.clientY>=window.innerHeight){showModal(node);}},[showModal]);// Listen for mouse leaving the viewport if showOnMouseLeave is true\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){if(showOnMouseLeave){window.addEventListener(\"mouseout\",triggerOnMouseOut(triggerNode));return()=>window.removeEventListener(\"mouseout\",triggerOnMouseOut(triggerNode));}}return;},[triggerOnMouseOut,showOnMouseLeave,showModal]);// Initialize a timer if showOnDelay is true\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){if(delayConfig.showOnDelay){const delay=setTimeout(()=>showModal(triggerNode),delayConfig.delaySeconds*1e3);return()=>clearTimeout(delay);}}return;},[delayConfig.showOnDelay,delayConfig.delaySeconds,showModal]);// Listen for clicks on the button and disable our triggers\n// if the button has been clicked\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){var _triggerNode_parentElement;const preventTriggers=()=>_setHasBeenTriggered(true);const button=(_triggerNode_parentElement=triggerNode.parentElement)===null||_triggerNode_parentElement===void 0?void 0:_triggerNode_parentElement.parentElement;if(button){button.addEventListener(\"keyup\",preventTriggers);button.addEventListener(\"mouseup\",preventTriggers);return()=>{window.removeEventListener(\"keyup\",preventTriggers);window.removeEventListener(\"mouseup\",preventTriggers);};}}return;},[]);// Listen for scroll if showOnScrollToPercentage is true\nuseEffect(()=>{if(scrollConfig.showOnScrollToPercentage){const initialYCoordBottomOfViewport=window.scrollY+window.innerHeight;const triggerNode=triggerRef.current;const body=document.querySelector(\"body\");if(triggerNode&&body){const scrollListener=()=>{const scrollPositionOfBottomOfViewport=window.scrollY+window.innerHeight;const triggerPoint=body.scrollHeight*scrollConfig.scrollPercentage/100;if(scrollPositionOfBottomOfViewport>=triggerPoint&&// Don't trigger if the user started below the trigger point\n// (this could happen after a refresh)\ninitialYCoordBottomOfViewport<triggerPoint){showModal(triggerNode);}};window.addEventListener(\"scroll\",scrollListener);return()=>window.removeEventListener(\"scroll\",scrollListener);}}return;},[scrollConfig.showOnScrollToPercentage,scrollConfig.scrollPercentage,showModal]);// It would be nice to aria-hide the container that Framer\n// wraps this in, but that would only be possible on the canvas\n// and it's not!\nreturn /*#__PURE__*/_jsx(\"div\",{ref:triggerRef,\"aria-hidden\":\"true\"});}// If this component breaks, it could be because Framer has decided to not wrap\n// code components in containers anymore. If that's the case, access\n// node.parentElement instead of node.parentElement.parentElement\nconst simulateClick=node=>{var _node_parentElement;if((_node_parentElement=node.parentElement)===null||_node_parentElement===void 0?void 0:_node_parentElement.parentElement){const button=node.parentElement.parentElement;button.dispatchEvent(new FocusEvent(\"focus\"));button.dispatchEvent(new KeyboardEvent(\"keydown\",{key:\"Enter\"}));button.dispatchEvent(new KeyboardEvent(\"keyup\",{key:\"Enter\"}));}};addPropertyControls(ModalTrigger,{showOnMouseLeave:{type:ControlType.Boolean,title:\"MouseLeave\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},delayConfig:{type:ControlType.Object,title:\"Delay\",buttonTitle:\"Configure\",controls:{showOnDelay:{type:ControlType.Boolean,title:\"Trigger\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},delaySeconds:{type:ControlType.Number,title:\"Seconds\",defaultValue:10,min:0,max:300,step:5,displayStepper:true,unit:\" s\"}}},scrollConfig:{type:ControlType.Object,title:\"Scroll\",buttonTitle:\"Configure\",controls:{showOnScrollToPercentage:{type:ControlType.Boolean,title:\"Trigger\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},scrollPercentage:{type:ControlType.Number,title:\"Scroll %\",defaultValue:50,min:0,max:100,step:1,displayStepper:true,unit:\" %\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ModalTrigger\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"0\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"0\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Modal_Trigger.map","/** @framerDisableUnlink */import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ScrollColorText(props){const{text=\"Scroll Fill Text\",startColor=\"#999999\",fillColor=\"#000000\",font,triggerStart=\"top 90%\",triggerEnd=\"top 10%\",scrubAnimation=true,backgroundColor,padding,borderRadius,border,shadow,textTransform=\"none\",textDecoration=\"none\",opacity=1,zIndex=1,overflow=\"visible\",cursor,userSelect=true}=props;const containerRef=useRef(null);const[scrollProgress,setScrollProgress]=useState(0);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic||typeof window===\"undefined\"||!containerRef.current)return;let gsap,ScrollTrigger;const loadGSAP=async()=>{try{const gsapModule=await import(\"https://esm.sh/gsap@3.12.2\");const scrollTriggerModule=await import(\"https://esm.sh/gsap@3.12.2/ScrollTrigger\");gsap=gsapModule.gsap||gsapModule.default;ScrollTrigger=scrollTriggerModule.ScrollTrigger||scrollTriggerModule.default;gsap.registerPlugin(ScrollTrigger);ScrollTrigger.create({trigger:containerRef.current,start:triggerStart,end:triggerEnd,scrub:scrubAnimation?.3:false,onUpdate:self=>{setScrollProgress(self.progress);}});}catch(err){console.warn(\"GSAP Load Failed:\",err);}};loadGSAP();},[isStatic,triggerStart,triggerEnd,scrubAnimation]);const renderWords=()=>{const words=text.split(\" \");const total=words.length;const filledWords=Math.floor(scrollProgress*total);return words.map((word,i)=>{const color=i<=filledWords?fillColor:startColor;return /*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",color,textTransform:textTransform,textDecoration:textDecoration,transition:\"color 0.3s linear\",willChange:\"color\",marginRight:\"0.25em\"},children:word},i);});};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",display:\"block\",width:\"100%\",backgroundColor,padding,borderRadius,...border,boxShadow:shadow,opacity,zIndex,overflow,cursor,userSelect:userSelect?\"text\":\"none\",...font},children:renderWords()});}addPropertyControls(ScrollColorText,{/** @framerDisableUnlink */text:{type:ControlType.String,title:\"Text\",defaultValue:\"Scroll Fill Text\",displayTextArea:true},/** @framerDisableUnlink */startColor:{type:ControlType.Color,title:\"Start Color\",defaultValue:\"#999999\"},/** @framerDisableUnlink */fillColor:{type:ControlType.Color,title:\"Fill Color\",defaultValue:\"#000000\"},/** @framerDisableUnlink */font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\",textAlign:\"left\"},controls:\"extended\",displayTextAlignment:true,displayFontSize:true},triggerStart:{type:ControlType.String,title:\"Trigger Start\",defaultValue:\"top 90%\"},triggerEnd:{type:ControlType.String,title:\"Trigger End\",defaultValue:\"top 10%\"},scrubAnimation:{type:ControlType.Boolean,title:\"Scrub\",defaultValue:true,enabledTitle:\"Smooth\",disabledTitle:\"Instant\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#ffffff\",optional:true},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"16px\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"8px\"},border:{type:ControlType.Border,title:\"Border\",optional:true},shadow:{type:ControlType.BoxShadow,title:\"Shadow\"},textTransform:{type:ControlType.Enum,title:\"Text Transform\",options:[\"none\",\"uppercase\",\"lowercase\",\"capitalize\"],defaultValue:\"none\"},textDecoration:{type:ControlType.Enum,title:\"Decoration\",options:[\"none\",\"underline\",\"overline\",\"line-through\"],defaultValue:\"none\"},opacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:1,min:0,max:1,step:.1},zIndex:{type:ControlType.Number,title:\"Z Index\",defaultValue:1},overflow:{type:ControlType.Enum,title:\"Overflow\",options:[\"visible\",\"hidden\",\"scroll\",\"auto\"],defaultValue:\"visible\"},cursor:{type:ControlType.Cursor,title:\"Cursor\"},userSelect:{type:ControlType.Boolean,title:\"User Select\",defaultValue:true,enabledTitle:\"Enabled\",disabledTitle:\"Disabled\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollColorText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollColorText.map"],"mappings":"2MAGG,SAAwB,EAAa,CAAC,mBAAiB,cAAY,gBAAc,CAAC,GAAK,CAAC,EA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