{"version":3,"file":"WaveHighlight.V-JaQDqs.mjs","names":["useMemo","_Fragment"],"sources":["https:/framerusercontent.com/modules/7pSKU9hsgayLm3RgcofY/FWLCg9s2xCUrNk46Tbm8/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,Fragment as _Fragment}from\"react/jsx-runtime\";import{useMemo,createElement}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\",tag=\"div\",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`}};const children=/*#__PURE__*/_jsxs(_Fragment,{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))]});// createElement lets the tag be dynamic; margin:0 strips UA heading/p margins\nreturn /*#__PURE__*/createElement(tag,{style:{margin:0,...style,...font,color:textColor}},children);}WaveHighlight.defaultProps={text:\"We build incredible digital experiences.\",highlightWords:\"incredible\",tag:\"div\",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.\"},tag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"h2\",options:[\"div\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"span\"],optionTitles:[\"Div\",\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"P\",\"Span\"],displaySegmentedControl:false,description:\"Use one H1 per page; don't skip heading levels.\"},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\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WaveHighlight.map"],"mappings":"gMAG4K,SAAS,EAAoB,EAAM,EAAY,EAAU,EAAW,CAAC,IAAM,EAAO,KAAK,KAAK,EAAU,EAAE,EAAY,CAAC,EAAQ,EAAK,EAAO,EAAQ,EAAQ,EAAW,EAAQ,EAAK,EAAW,EAAoI,EAAI,wDAAwD,EAAW,GAAG,EAAO,aAAa,MAAlN,EAAK,IAAI,EAAQ,GAAG,EAAK,EAAU,GAAG,EAAK,GAAG,EAAK,IAAI,EAAK,EAAQ,GAAG,EAAK,EAAU,GAAG,EAAW,GAAG,IAA6G,YAAY,EAAM,kBAAkB,EAAY,8CAA8C,MAAM,sBAAsB,mBAAmB,CAAG,GAAI,CAAC,SAAS,EAAmB,EAAK,EAAQ,EAAc,EAAU,CAAC,IAAM,EAAQ,EAAQ,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAAE,GAAG,CAAC,EAAQ,OAAO,MAAM,CAAC,CAAC,OAAK,YAAY,EAAK,CAAC,EAAwE,IAAM,EAA9D,EAAQ,IAAI,GAAG,EAAE,QAAQ,sBAAsB,MAAM,CAAsB,CAAC,CAAC,KAAK,GAAG,EAAQ,EAAQ,EAAU,OAAO,EAAO,MAAM,IAAI,EAAO,GAA4C,EAAM,IAAI,OAAO,EAA9C,EAAc,IAAI,IAAyC,EAAQ,EAAS,CAAC,EAAM,EAAU,EAAM,EAAM,MAAO,EAAM,EAAM,KAAK,CAAI,KAAK,MAAS,EAAM,MAAM,GAAW,EAAS,KAAK,CAAC,KAAK,EAAK,MAAM,EAAU,EA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