{"version":3,"file":"ViewportText_1.DCKwtwe5.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/sGSE8QovOyYLgOnb23wU/X0HLrWeyUQ6akkDoFAPh/ViewportText_1.js"],"sourcesContent":["// Text component with vw-based font size control\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useMemo}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */function ViewportText(props){const{text,fontSize,minFontSize,maxFontSize,textColor,font,keywords,highlightColor,htmlTag=\"p\",textAlign=\"left\",canvasPreviewFontSize,truncate,style}=props;const isFixedWidth=style?.width===\"100%\";const isCanvas=RenderTarget.current()===RenderTarget.canvas;const highlightedText=useMemo(()=>{if(!keywords||keywords.trim()===\"\"){return text;}const keywordList=keywords.split(\",\").map(k=>k.trim()).filter(k=>k.length>0);if(keywordList.length===0){return text;}// Create regex pattern for exact matches\nconst pattern=keywordList.map(k=>k.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")).join(\"|\");const regex=new RegExp(`(${pattern})`,\"g\");const parts=text.split(regex);return parts.map((part,index)=>{if(keywordList.includes(part)){return /*#__PURE__*/_jsx(\"span\",{style:{color:highlightColor},children:part},index);}return part;});},[text,keywords,highlightColor]);const Tag=htmlTag;return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:textAlign===\"center\"?\"center\":textAlign===\"right\"?\"flex-end\":\"flex-start\"},children:/*#__PURE__*/_jsx(Tag,{style:{margin:0,fontSize:isCanvas?`${canvasPreviewFontSize}px`:`clamp(${minFontSize}px, ${fontSize}vw, ${maxFontSize}px)`,color:textColor,width:isFixedWidth?\"100%\":\"max-content\",wordBreak:\"break-word\",overflowWrap:\"break-word\",whiteSpace:truncate?\"normal\":\"pre-wrap\",textAlign:textAlign,...truncate&&{display:\"-webkit-box\",WebkitLineClamp:3,WebkitBoxOrient:\"vertical\",overflow:\"hidden\",textOverflow:\"ellipsis\"},...font},children:highlightedText})});}export default ViewportText;addPropertyControls(ViewportText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hello World\",displayTextArea:true},truncate:{type:ControlType.Boolean,title:\"Truncate\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},textAlign:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},htmlTag:{type:ControlType.Enum,title:\"HTML Tag\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"span\",\"div\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Paragraph\",\"Span\",\"Div\"],defaultValue:\"p\"},canvasPreviewFontSize:{type:ControlType.Number,title:\"Canvas Font Size\",defaultValue:16,min:8,max:100,step:1,unit:\"px\",description:\"Font size for canvas preview only (not published site)\"},minFontSize:{type:ControlType.Number,title:\"Min Font Size\",defaultValue:14,min:8,max:100,step:1,unit:\"px\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:1.5,min:.5,max:20,step:.1,unit:\"vw\"},maxFontSize:{type:ControlType.Number,title:\"Max Font Size\",defaultValue:48,min:8,max:200,step:1,unit:\"px\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},keywords:{type:ControlType.String,title:\"Keywords\",defaultValue:\"\",placeholder:\"keyword1, keyword2, keyword3\",description:\"Comma-separated keywords for exact match highlighting\"},highlightColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#FF0000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",displayFontSize:false,displayTextAlignment:false,defaultValue:{variant:\"Regular\",letterSpacing:\"0em\",lineHeight:\"1.2em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ViewportText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ViewportText_1.map"],"mappings":"kLAIG,SAAS,EAAa,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,cAAY,cAAY,YAAU,OAAK,WAAS,iBAAe,UAAQ,IAAI,YAAU,OAAO,wBAAsB,WAAS,SAAO,EAAY,EAAa,GAAO,QAAQ,OAAa,EAAS,EAAa,SAAS,GAAG,EAAa,OAAa,EAAgBA,MAAY,CAAC,GAAG,CAAC,GAAU,EAAS,MAAM,GAAG,GAAI,OAAO,EAAM,IAAM,EAAY,EAAS,MAAM,IAAI,CAAC,IAAI,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,EAAY,SAAS,EAAG,OAAO,EACpe,IAAM,EAAQ,EAAY,IAAI,GAAG,EAAE,QAAQ,sBAAsB,OAAO,CAAC,CAAC,KAAK,IAAI,CAAO,EAAU,OAAO,IAAI,EAAQ,GAAG,IAAI,CAA+B,OAAlB,EAAK,MAAM,EAAM,CAAc,KAAK,EAAK,IAAY,EAAY,SAAS,EAAK,CAAsB,EAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAe,CAAC,SAAS,EAAK,CAAC,EAAM,CAAS,EAAO,EAAG,CAAC,EAAK,EAAS,EAAe,CAAC,CAAO,EAAI,EAAQ,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,SAAS,WAAW,QAAQ,OAAO,WAAW,SAAS,eAAe,IAAY,SAAS,SAAS,IAAY,QAAQ,WAAW,aAAa,CAAC,SAAsB,EAAK,EAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAS,GAAG,EAAsB,IAAI,SAAS,EAAY,MAAM,EAAS,MAAM,EAAY,KAAK,MAAM,EAAU,MAAM,EAAa,OAAO,c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