{"version":3,"file":"WaveHighlight.DFK8joCT.mjs","names":["p","useMemo"],"sources":["https:/framerusercontent.com/modules/7pSKU9hsgayLm3RgcofY/khTkT6z44Twm1yP8cemG/WaveHighlight.js"],"sourcesContent":["// Wave Highlight - Framer Code Component\n// Assets > Code > New Component\n// Drop onto canvas, type your text, set highlight words.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function generateWaveDataUri(color,strokeWidth,amplitude,wavelength){const height=Math.ceil(amplitude*2+strokeWidth+2);const midY=height/2;const quarter=wavelength/4;const half=wavelength/2;const d=`M0 ${midY} Q${quarter} ${midY-amplitude} ${half} ${midY} Q${half+quarter} ${midY+amplitude} ${wavelength} ${midY}`;const svg=`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 ${wavelength} ${height}\"><path d=\"${d}\" stroke=\"${color}\" stroke-width=\"${strokeWidth}\" fill=\"none\" stroke-linecap=\"round\"/></svg>`;return`data:image/svg+xml,${encodeURIComponent(svg)}`;}function splitTextByPhrases(text,phrases,caseSensitive,wholeWord){const trimmed=phrases.map(p=>p.trim()).filter(Boolean);if(!trimmed.length)return[{text,highlighted:false}];const escaped=trimmed.map(p=>p.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\"));const joined=escaped.join(\"|\");const pattern=wholeWord?`\\\\b(${joined})\\\\b`:`(${joined})`;const flags=caseSensitive?\"g\":\"gi\";const regex=new RegExp(pattern,flags);const segments=[];let lastIndex=0;let match;while((match=regex.exec(text))!==null){if(match.index>lastIndex){segments.push({text:text.slice(lastIndex,match.index),highlighted:false});}segments.push({text:match[0],highlighted:true});lastIndex=regex.lastIndex;}if(lastIndex<text.length){segments.push({text:text.slice(lastIndex),highlighted:false});}return segments;}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function WaveHighlight(props){const{text=\"We build incredible digital experiences.\",highlightWords=\"incredible\",font={},textColor=\"#1a1a1a\",highlightTextColor=\"\",waveColor=\"#dc7956\",waveThickness=2.5,waveAmplitude=3,waveWavelength=30,waveOffsetY=0,caseSensitive=false,wholeWord=false,animated=false,animationSpeed=1.5,style}=props;const phrases=highlightWords.split(\",\").map(s=>s.trim());const segments=useMemo(()=>splitTextByPhrases(text,phrases,caseSensitive,wholeWord),[text,highlightWords,caseSensitive,wholeWord]);const waveUri=useMemo(()=>generateWaveDataUri(waveColor,waveThickness,waveAmplitude,waveWavelength),[waveColor,waveThickness,waveAmplitude,waveWavelength]);const waveHeight=Math.ceil(waveAmplitude*2+waveThickness+2);const keyframesCSS=`@keyframes waveScroll { from { background-position-x: 0; } to { background-position-x: ${waveWavelength}px; } }`;const totalPad=Math.max(0,waveHeight+waveOffsetY);const highlightStyle={backgroundColor:\"transparent\",color:highlightTextColor||\"inherit\",backgroundImage:`url(\"${waveUri}\")`,backgroundRepeat:\"repeat-x\",backgroundPositionY:\"100%\",backgroundSize:`${waveWavelength}px ${waveHeight}px`,paddingBottom:totalPad,marginBottom:-totalPad,WebkitBoxDecorationBreak:\"clone\",boxDecorationBreak:\"clone\",...animated&&{animation:`waveScroll ${animationSpeed}s linear infinite`}};return /*#__PURE__*/_jsxs(\"div\",{style:{...style,...font,color:textColor},children:[animated&&/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:keyframesCSS}}),segments.map((seg,i)=>seg.highlighted?/*#__PURE__*/_jsx(\"span\",{style:highlightStyle,children:seg.text},i):/*#__PURE__*/_jsx(\"span\",{children:seg.text},i))]});}WaveHighlight.defaultProps={text:\"We build incredible digital experiences.\",highlightWords:\"incredible\",textColor:\"#1a1a1a\",highlightTextColor:\"\",waveColor:\"#dc7956\",waveThickness:2.5,waveAmplitude:3,waveWavelength:30,waveOffsetY:0,caseSensitive:false,wholeWord:false,animated:false,animationSpeed:1.5};addPropertyControls(WaveHighlight,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"We build incredible digital experiences.\",displayTextArea:true},highlightWords:{type:ControlType.String,title:\"Highlight\",defaultValue:\"incredible\",placeholder:\"word1, a phrase, word2\",description:\"Comma-separated words or phrases.\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",displayFontSize:true,displayTextAlignment:true,defaultValue:{fontSize:32,lineHeight:\"1.4em\"}},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#1a1a1a\"},highlightTextColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#1a1a1a\",optional:true,description:\"Override text color for highlighted words. Leave empty to inherit.\"},waveColor:{type:ControlType.Color,title:\"Wave Color\",defaultValue:\"#dc7956\"},waveThickness:{type:ControlType.Number,title:\"Thickness\",defaultValue:2.5,min:.5,max:8,step:.5},waveAmplitude:{type:ControlType.Number,title:\"Amplitude\",defaultValue:3,min:1,max:10,step:.5},waveWavelength:{type:ControlType.Number,title:\"Wavelength\",defaultValue:30,min:10,max:80,step:5},waveOffsetY:{type:ControlType.Number,title:\"Offset Y\",defaultValue:0,min:-10,max:10,step:1,description:\"Shift wave up (negative) or down (positive).\"},caseSensitive:{type:ControlType.Boolean,title:\"Case Sensitive\",defaultValue:false},wholeWord:{type:ControlType.Boolean,title:\"Whole Word\",defaultValue:false,description:\"Only match complete words.\"},animated:{type:ControlType.Boolean,title:\"Animated\",defaultValue:false},animationSpeed:{type:ControlType.Number,title:\"Anim. Speed\",defaultValue:1.5,min:.3,max:5,step:.1,hidden(props){return!props.animated;},description:\"Seconds per loop (lower = faster).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WaveHighlight\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WaveHighlight.map"],"mappings":"iLAGwI,SAAS,EAAoB,EAAM,EAAY,EAAU,EAAW,CAAC,IAAM,EAAO,KAAK,KA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