{"version":3,"file":"ViewportText_1.CT_OFkAV.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/Gv8lDUIq9P0lfkA5Fqbt/iw0HatqehKwRrn0zm0LU/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\",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