{"version":3,"file":"TextReveal.hWBvZHmf.mjs","names":["React.forwardRef","useRef","useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/gGXLFANbZFKf2qU8bbVL/uQjjbN7Yn6nBRqTZdwzU/HoKrrnQcM.js","https:/framerusercontent.com/modules/zKUlJwNU0vVHbae9Y6ac/ns6UtFn4dBkLoyUYZH3G/TextReveal.js"],"sourcesContent":["// Generated by Framer (6ca5d98)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,cx,motion,useSVGTemplate,withCSS}from\"framer\";import*as React from\"react\";import{forwardRef}from\"react\";const mask=\"var(--framer-icon-mask)\";const Base=/*#__PURE__*/forwardRef(function(props,ref){return /*#__PURE__*/_jsx(\"svg\",{...props,ref:ref,children:props.children});});const MotionSVG=motion.create(Base);const SVG=/*#__PURE__*/forwardRef((props,ref)=>{const{animated,layoutId,children,...rest}=props;return animated?/*#__PURE__*/_jsx(MotionSVG,{...rest,layoutId:layoutId,ref:ref,children:children}):/*#__PURE__*/_jsx(\"svg\",{...rest,ref:ref,children:children});});const svg='<svg display=\"block\" role=\"presentation\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 0 0 L 5.5 5.25 L 0 10.5\" fill=\"transparent\" height=\"10.5px\" id=\"pTO_zwTXv\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--1335ju, 1.5)\" stroke=\"var(--18mrqx2, rgb(0, 0, 0))\" transform=\"translate(13.75 6.75)\" width=\"5.5px\"/><path d=\"M 14.25 0 L 0 0\" fill=\"transparent\" height=\"1px\" id=\"Jh7NTfV71\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--1335ju, 1.5)\" stroke=\"var(--18mrqx2, rgb(0, 0, 0))\" transform=\"translate(4.75 12)\" width=\"14.25px\"/></svg>';const getProps=({dots,height,id,stroke,width,width1,...props})=>{return{...props,BKVe8Pgvw:dots??props.BKVe8Pgvw??1,fICyAUQY1:stroke??props.fICyAUQY1??\"rgb(0, 0, 0)\",lKf_CQTz5:width1??props.lKf_CQTz5??1.5};};const Component=/*#__PURE__*/React.forwardRef(function(props,ref){const{style,className,layoutId,variant,fICyAUQY1,lKf_CQTz5,BKVe8Pgvw,...restProps}=getProps(props);const href=useSVGTemplate(\"1173457374\",svg);return /*#__PURE__*/_jsx(SVG,{...restProps,className:cx(\"framer-EcgqK\",className),layoutId:layoutId,ref:ref,role:\"presentation\",style:{\"--1335ju\":lKf_CQTz5,\"--18mrqx2\":fICyAUQY1,...style},viewBox:\"0 0 24 24\",children:/*#__PURE__*/_jsx(\"use\",{href:href})});});const css=[`.framer-EcgqK { -webkit-mask: ${mask}; aspect-ratio: 1; display: block; mask: ${mask}; width: 24px; }`];/**\n * This is a generated Framer component.\n * @framerIntrinsicWidth 24\n * @framerIntrinsicHeight 24\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerVariables {\"fICyAUQY1\":\"stroke\",\"lKf_CQTz5\":\"width1\",\"BKVe8Pgvw\":\"dots\"}\n * @framerImmutableVariables true\n * @framerVector {\"name\":\"Arrow Right\",\"color\":{\"type\":\"variable\",\"value\":\"18mrqx2\"},\"set\":{\"localId\":\"vectorSet/SuYHhKUZG\",\"id\":\"SuYHhKUZG\",\"moduleId\":\"EqX8thWQjdZcOB1c6p5N\"}}\n * @framerDisableUnlink true\n */const Icon=withCSS(Component,css,\"framer-EcgqK\");Icon.displayName=\"Arrow Right\";export default Icon;addPropertyControls(Icon,{fICyAUQY1:{defaultValue:\"rgb(0, 0, 0)\",hidden:false,title:\"Stroke\",type:ControlType.Color},lKf_CQTz5:{defaultValue:1.5,displayStepper:true,hidden:false,max:4,min:0,step:.5,title:\"Width\",type:ControlType.Number},BKVe8Pgvw:{defaultValue:1,displayStepper:true,hidden:true,max:4,min:1,title:\"Dots\",type:ControlType.Number}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Icon\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"24\",\"framerIntrinsicHeight\":\"24\",\"framerVariables\":\"{\\\"fICyAUQY1\\\":\\\"stroke\\\",\\\"lKf_CQTz5\\\":\\\"width1\\\",\\\"BKVe8Pgvw\\\":\\\"dots\\\"}\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerVector\":\"{\\\"name\\\":\\\"Arrow Right\\\",\\\"color\\\":{\\\"type\\\":\\\"variable\\\",\\\"value\\\":\\\"18mrqx2\\\"},\\\"set\\\":{\\\"localId\\\":\\\"vectorSet/SuYHhKUZG\\\",\\\"id\\\":\\\"SuYHhKUZG\\\",\\\"moduleId\\\":\\\"EqX8thWQjdZcOB1c6p5N\\\"}}\",\"framerContractVersion\":\"1\",\"framerImmutableVariables\":\"true\",\"framerDisableUnlink\":\"true\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// User request: Create a Framer code component named “Text Reveal” that matches the helper behavior with scroll-based progressive reveal, controls for reveal mode/start/end/dim opacity/canvas preview, editable text, typography and color styling, canvas partial preview support, SSR-safe behavior, and natural multiline wrapping.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{startTransition,useCallback,useMemo,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView,useMotionValueEvent,useScroll}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TextReveal(props){const{text=\"Scroll to reveal this sentence with a smooth, progressive text effect.\",revealBy=\"words\",start=90,end=30,dimOpacity=.2,canvasPreview=true,revealedColor=\"#000000\",dimColor=\"#000000\",typography,widthBehavior=\"fill\",style}=props;const elementRef=useRef(null);const isStaticRenderer=useIsStaticRenderer();const isInView=useInView(elementRef,{amount:.05});const[progress,setProgress]=useState(0);const startOffset=Math.min(1,Math.max(0,start/100));const endOffset=Math.min(1,Math.max(0,end/100));const{scrollYProgress}=useScroll({target:elementRef,offset:[`start ${startOffset}`,`end ${endOffset}`]});useMotionValueEvent(scrollYProgress,\"change\",latest=>{if(!isStaticRenderer&&isInView){startTransition(()=>setProgress(latest));}});const segments=useMemo(()=>{if(revealBy===\"characters\")return Array.from(text);if(revealBy===\"lines\")return text.split(/\\r?\\n/);return text.trim().split(/\\s+/);},[text,revealBy]);const effectiveProgress=useMemo(()=>{if(isStaticRenderer&&canvasPreview)return .45;if(!isInView)return 0;return Math.min(1,Math.max(0,progress));},[isStaticRenderer,canvasPreview,isInView,progress]);const revealRatioForIndex=useCallback(index=>{if(segments.length<=1)return effectiveProgress;const startPoint=index/segments.length;const endPoint=(index+1)/segments.length;const raw=(effectiveProgress-startPoint)/Math.max(1e-4,endPoint-startPoint);return Math.min(1,Math.max(0,raw));},[effectiveProgress,segments.length]);const textStyle=useMemo(()=>({margin:0,color:revealedColor,textAlign:typography?.textAlign??\"center\",fontSize:typography?.fontSize??28,fontWeight:typography?.fontWeight??600,fontStyle:typography?.fontStyle??\"normal\",lineHeight:typography?.lineHeight??\"1.15em\",letterSpacing:typography?.letterSpacing??\"-0.03em\",fontFamily:typography?.fontFamily||'\"Neue Kaine\", \"Inter\", \"SF Pro Display\", \"Helvetica Neue\", Arial, sans-serif',width:widthBehavior===\"fill\"?\"100%\":\"max-content\",minWidth:widthBehavior===\"fill\"?undefined:\"max-content\",whiteSpace:revealBy===\"lines\"?\"pre-wrap\":\"normal\",overflowWrap:\"anywhere\"}),[revealedColor,typography,widthBehavior,revealBy]);return /*#__PURE__*/_jsx(\"div\",{ref:elementRef,style:{position:\"relative\",width:\"100%\",display:\"block\",...style},children:/*#__PURE__*/_jsx(\"p\",{style:textStyle,children:segments.map((segment,index)=>{const ratio=revealRatioForIndex(index);const segmentColor=ratio>=1?revealedColor:dimColor;const segmentOpacity=dimOpacity+(1-dimOpacity)*ratio;if(revealBy===\"lines\"){return /*#__PURE__*/_jsx(\"span\",{style:{display:\"block\",color:segmentColor,opacity:segmentOpacity},children:segment||\" \"},`${segment}-${index}`);}const trailingSpace=revealBy===\"words\"?\" \":\"\";return /*#__PURE__*/_jsxs(\"span\",{style:{color:segmentColor,opacity:segmentOpacity,whiteSpace:revealBy===\"characters\"?\"pre\":\"normal\"},children:[segment,trailingSpace]},`${segment}-${index}`);})})});}addPropertyControls(TextReveal,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Scroll to reveal this sentence with a smooth, progressive text effect.\",displayTextArea:true},revealBy:{type:ControlType.Enum,title:\"Reveal By\",options:[\"characters\",\"words\",\"lines\"],optionTitles:[\"Characters\",\"Words\",\"Lines\"],defaultValue:\"words\"},start:{type:ControlType.Number,title:\"Start\",defaultValue:90,min:0,max:100,unit:\"%\",step:1},end:{type:ControlType.Number,title:\"End\",defaultValue:30,min:0,max:100,unit:\"%\",step:1},dimOpacity:{type:ControlType.Number,title:\"Dim Opacity\",defaultValue:.2,min:0,max:1,step:.01},canvasPreview:{type:ControlType.Boolean,title:\"Canvas Preview\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},revealedColor:{type:ControlType.Color,title:\"Revealed\",defaultValue:\"#000000\"},dimColor:{type:ControlType.Color,title:\"Dim\",defaultValue:\"#000000\"},typography:{type:ControlType.Font,title:\"Text Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:28,variant:\"Semibold\",lineHeight:\"1.15em\",letterSpacing:\"-0.03em\",textAlign:\"center\"}},widthBehavior:{type:ControlType.Enum,title:\"Width\",options:[\"fill\",\"hug\"],optionTitles:[\"Fill\",\"Hug\"],defaultValue:\"fill\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextReveal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\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