{"version":3,"file":"TextShimmer_Prod.DVCv1i2Q.mjs","names":["useState","useRef","useRef"],"sources":["https:/framerusercontent.com/modules/1oMTLy48mQlkHUIQamxl/LQz0SsKx4UpdYoEs5F0b/TextGlitch.js","https:/framerusercontent.com/modules/TS5bPiMUGtjrWMUlvKp9/AciUHRnNOn8057WveTGJ/TextShimmer_Prod.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const DEFAULT_SCRAMBLE_CHARS=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TextGlitch(props){const{text,font,color,scrambleColor,duration,style,glitch}=props;const[display,setDisplay]=useState(text);const[scrambling,setScrambling]=useState(false);const intervalRef=useRef(null);const timeoutRef=useRef(null);// Use prop or default\nconst chars=(props.scrambleChars||DEFAULT_SCRAMBLE_CHARS).split(\"\");useEffect(()=>{if(!glitch){setDisplay(text);setScrambling(false);return;}if(RenderTarget.current()!==RenderTarget.preview){setDisplay(text);setScrambling(false);return;}if(RenderTarget.current()===RenderTarget.thumbnail){setDisplay(text);setScrambling(false);return;}setDisplay(text);setScrambling(true);let frame=0;const scramble=()=>{const percent=Math.max(0,Math.min(100,props.scramblePercent??100));let scrambled=text.split(\"\").map((c,i)=>{if(c===\" \")return c;if(Math.random()*100>percent)return c;return`<span data-scramble=\"1\">${chars[Math.floor(Math.random()*chars.length)]}</span>`;}).join(\"\");setDisplay(scrambled);frame++;};intervalRef.current=window.setInterval(scramble,props.speed||40);timeoutRef.current=window.setTimeout(()=>{if(intervalRef.current)clearInterval(intervalRef.current);setDisplay(text);setScrambling(false);},duration);return()=>{if(intervalRef.current)clearInterval(intervalRef.current);if(timeoutRef.current)clearTimeout(timeoutRef.current);};},[text,duration,glitch,props.scrambleChars])// Add scrambleChars as dependency\n;function renderText(){const{weight,optical}=props.variable||{weight:400,optical:22};const fontVariation={fontWeight:weight,fontVariationSettings:`'wght' ${weight}, 'opsz' ${optical}`};const styleBase={...font,color,...fontVariation};if(!scrambling)return /*#__PURE__*/_jsx(\"span\",{style:styleBase,children:text});const parts=display.split(/(<span data-scramble=\"1\">.*?<\\/span>)/g);return /*#__PURE__*/_jsx(\"span\",{style:styleBase,children:parts.map((part,i)=>{if(part.startsWith('<span data-scramble=\"1\">')){const letter=part.replace(/<.*?>/g,\"\");return /*#__PURE__*/_jsx(\"span\",{style:{color:scrambleColor},children:letter},i);}return /*#__PURE__*/_jsx(\"span\",{children:part},i);})});}const isFixedWidth=style&&style.width===\"100%\";const isFixedHeight=style&&style.height===\"100%\";return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:isFixedWidth?\"100%\":\"max-content\",minWidth:isFixedWidth?undefined:\"max-content\",height:isFixedHeight?\"100%\":undefined},children:renderText()});}TextGlitch.displayName=\"Text Glitch\";addPropertyControls(TextGlitch,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Scramble Me!\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:22,variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},variable:{type:ControlType.Object,title:\"Variable\",controls:{optical:{type:ControlType.Number,title:\"Optical\",defaultValue:22,min:14,max:32,step:1},weight:{type:ControlType.Number,title:\"Weight\",defaultValue:400,min:100,max:900,step:1}},defaultValue:{optical:22,weight:400}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},scrambleColor:{type:ControlType.Color,title:\"Scrambled\",defaultValue:\"#8855FF\"},scrambleChars:{// <-- Add the control\ntype:ControlType.String,title:\"Chars\",defaultValue:DEFAULT_SCRAMBLE_CHARS,displayTextArea:true},scramblePercent:{type:ControlType.Number,title:\"Scramble %\",defaultValue:100,min:0,max:100,unit:\"%\",step:1},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:40,min:10,max:200,unit:\"ms\",step:1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1200,min:200,max:5e3,unit:\"ms\",step:50},glitch:{type:ControlType.Boolean,title:\"Glitch\",enabledTitle:\"Yes\",disabledTitle:\"No\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextGlitch\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextGlitch.map","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function getUniqueClassName(){return\"text-shimmer-\"+Math.random().toString(36).substr(2,9);}/**\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 200\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function TextShimmer({font,content,color,shimmer,size,speed,userSelect,rotation,delay,tag,direction}){const classNameRef=useRef(getUniqueClassName());const Tag=tag;const backgroundSize=`200% 200%`;const speedFormatted=11-speed;const gradientFirst=50-size*(50-20)/100;const gradientLast=50+size*(80-50)/100;const animationDuration=speedFormatted+delay;// Calculate keyframes\nconst startPos=direction===\"left\"?\"-100%\":\"200%\";const endPos=direction===\"left\"?\"200%\":\"-100%\";const keyframes=`\n        @keyframes shimmer-${classNameRef.current} {\n            0%, ${delay/animationDuration*100}% {\n                background-position: ${startPos};\n            }\n            100% {\n                background-position: ${endPos};\n            }\n        }\n    `;// Inject style tag once per instance\nuseEffect(()=>{const styleId=`shimmer-style-${classNameRef.current}`;let styleEl=document.getElementById(styleId);if(!styleEl){styleEl=document.createElement(\"style\");styleEl.id=styleId;document.head.appendChild(styleEl);}styleEl.innerHTML=`\n            ${keyframes}\n            .${classNameRef.current} {\n                background: linear-gradient(\n                    ${rotation}deg,\n                    transparent 0%,\n                    transparent ${gradientFirst}%,\n                    ${shimmer} 50%,\n                    transparent ${gradientLast}%,\n                    transparent 100%\n                );\n                -webkit-background-size: ${backgroundSize};\n                -moz-background-size: ${backgroundSize};\n                background-size: ${backgroundSize};\n                -webkit-background-clip: text;\n                -moz-background-clip: text;\n                background-clip: text;\n                background-repeat: no-repeat;\n                animation: shimmer-${classNameRef.current} ${animationDuration}s linear infinite;\n            }\n        `;return()=>{if(styleEl&&styleEl.parentNode){styleEl.parentNode.removeChild(styleEl);}};},[shimmer,rotation,gradientFirst,gradientLast,backgroundSize,animationDuration,delay,direction,keyframes]);return /*#__PURE__*/_jsxs(\"div\",{style:{userSelect:userSelect?\"auto\":\"none\",position:\"relative\"},children:[/*#__PURE__*/_jsx(Tag,{style:{...font,color,marginBlockStart:\"0px\",marginBlockEnd:\"0px\"},children:content}),/*#__PURE__*/_jsx(Tag,{\"aria-hidden\":\"true\",className:classNameRef.current,style:{...font,color:\"transparent\",position:\"absolute\",top:0,left:0,right:0,bottom:0,zIndex:1,marginBlockStart:\"0px\",marginBlockEnd:\"0px\",pointerEvents:\"none\"},children:content})]});}TextShimmer.displayName=\"Text Shimmer\";addPropertyControls(TextShimmer,{font:{type:ControlType.Font,title:\"Font\",defaultValue:\"Inter\",controls:\"extended\"},content:{type:ControlType.String,title:\"Content\",defaultValue:\"Learn Framer With Framer University\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#FFFFFF1A\"},shimmer:{type:ControlType.Color,title:\"Shimmer\",defaultValue:\"#ffffff\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:30,step:1,max:100,min:1},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:5,max:10,min:1,step:1},direction:{type:ControlType.Enum,title:\"Direction\",defaultValue:\"left\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],displaySegmentedControl:true,segmentedControlDirection:\"horizontal\",optionIcons:[\"direction-left\",\"direction-right\"]},userSelect:{title:\"User Select\",type:ControlType.Boolean,defaultValue:false},rotation:{type:ControlType.Number,title:\"Rotation\",defaultValue:90,min:45,unit:\"\\xb0\",max:135,step:1},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:10,step:.1},tag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"p\",displaySegmentedControl:true,segmentedControlDirection:\"horizontal\",options:[\"h1\",\"h2\",\"h3\",\"p\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"P\"],description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextShimmer\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextShimmer_Prod.map"],"mappings":"mVAIG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,QAAM,gBAAc,WAAS,QAAM,UAAQ,EAAW,CAAC,EAAQ,GAAYA,EAAS,EAAK,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAO,EAAYE,EAAO,KAAK,CAAO,EAAWA,EAAO,KAAK,CAC7P,GAAO,EAAM,eAAe,GAAwB,MAAM,GAAG,CAAC,MAAc,CAAC,GAAG,CAAC,EAAO,CAAC,EAAW,EAAK,CAAC,EAAc,GAAM,CAAC,OAAQ,GAAG,EAAa,SAAS,GAAG,EAAa,QAAQ,CAAC,EAAW,EAAK,CAAC,EAAc,GAAM,CAAC,OAAQ,GAAG,EAAa,SAAS,GAAG,EAAa,UAAU,CAAC,EAAW,EAAK,CAAC,EAAc,GAAM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