{"version":3,"file":"ImageMaskText.CbZJWsMH.mjs","names":["useId","useMemo"],"sources":["https:/framerusercontent.com/modules/GS8sbPtNL3MvfNnZO82D/ybDeBEHuaB7iFSk2rNzG/ImageMaskText.js"],"sourcesContent":["// Customizable text component with image mask, adjustable image fit (cover, contain, percent), and font controls\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useId,useMemo}from\"react\";/**\n * ImageMaskText\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ImageMaskText(props){const{text,maskType,image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},imageFit,imagePercent,gradientAngle,gradientDuration,font,style}=props;const gradientId=useId().replace(/:/g,\"\");const computedLineHeight=useMemo(()=>{const lh=font?.lineHeight;if(typeof lh===\"number\")return Math.max(1.2,lh);if(typeof lh===\"string\"){const parsed=parseFloat(lh);if(Number.isFinite(parsed))return Math.max(1.2,parsed);}return 1.2;},[font?.lineHeight]);// Calculate background size and position\nconst bgSize=useMemo(()=>{if(imageFit===\"cover\")return\"cover\";if(imageFit===\"contain\")return\"contain\";// percent\nreturn`${imagePercent}%`;},[imageFit,imagePercent]);const bgPosition=useMemo(()=>{if(imageFit===\"percent\")return\"center\";return\"center\";},[imageFit]);// Map text alignment to flex justifyContent\nconst justifyContent=useMemo(()=>{const textAlign=font?.textAlign||\"center\";switch(textAlign){case\"left\":return\"flex-start\";case\"right\":return\"flex-end\";case\"center\":default:return\"center\";}},[font?.textAlign]);const useImageMask=maskType===\"image\"&&image&&image.src&&imageFit!==undefined&&image.src!==\"\";const useGradientMask=maskType===\"gradient\";return /*#__PURE__*/_jsxs(\"div\",{style:{...style,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:justifyContent,position:\"relative\",overflow:\"visible\"},children:[useGradientMask&&/*#__PURE__*/_jsx(\"style\",{children:`\n                    @keyframes gradientShift-${gradientId} {\n                        0% { background-position: 0% 50%; }\n                        50% { background-position: 100% 50%; }\n                        100% { background-position: 0% 50%; }\n                    }\n                `}),/*#__PURE__*/_jsx(\"span\",{style:{...font,width:\"max-content\",minWidth:0,paddingBottom:\"0.12em\",...useImageMask?{backgroundImage:`url(${image.src})`,backgroundSize:bgSize,backgroundPosition:bgPosition,backgroundRepeat:\"no-repeat\",WebkitBackgroundClip:\"text\",WebkitTextFillColor:\"transparent\",backgroundClip:\"text\",color:\"transparent\"}:useGradientMask?{backgroundImage:`linear-gradient(${gradientAngle}deg, #D4183D, #9743B7, #0440C2)`,backgroundSize:\"500% 500%\",backgroundPosition:\"0% 50%\",backgroundRepeat:\"no-repeat\",animation:`gradientShift-${gradientId} ${Math.max(.2,gradientDuration)}s ease-in-out infinite`,WebkitBackgroundClip:\"text\",WebkitTextFillColor:\"transparent\",backgroundClip:\"text\",color:\"transparent\"}:{color:props.textColor},display:\"inline-block\",textAlign:font?.textAlign||\"center\",lineHeight:computedLineHeight,fontSize:font?.fontSize||40,fontWeight:font?.fontWeight,fontStyle:font?.fontStyle},\"aria-label\":text,children:text})]});}addPropertyControls(ImageMaskText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"DONAzioni\"},maskType:{type:ControlType.Enum,title:\"Mask\",options:[\"gradient\",\"image\"],optionTitles:[\"Gradient\",\"Image\"],defaultValue:\"gradient\",displaySegmentedControl:true},image:{type:ControlType.ResponsiveImage,title:\"Image\",hidden:({maskType})=>maskType!==\"image\"},imageFit:{type:ControlType.Enum,title:\"Image Fit\",options:[\"cover\",\"contain\",\"percent\"],optionTitles:[\"Cover\",\"Contain\",\"Percent\"],defaultValue:\"cover\",displaySegmentedControl:true,hidden:({maskType})=>maskType!==\"image\"},imagePercent:{type:ControlType.Number,title:\"Image %\",defaultValue:100,min:10,max:200,step:1,unit:\"%\",hidden:({imageFit,maskType})=>maskType!==\"image\"||imageFit!==\"percent\"},gradientAngle:{type:ControlType.Number,title:\"Angle\",defaultValue:90,min:0,max:360,step:1,unit:\"deg\",hidden:({maskType})=>maskType!==\"gradient\"},gradientDuration:{type:ControlType.Number,title:\"Speed\",defaultValue:6,min:.2,max:30,step:.1,unit:\"s\",hidden:({maskType})=>maskType!==\"gradient\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:64,variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\",textAlign:\"center\"}},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\",description:\"Component by [Joseph Alexander](https://framer.link/0iVitu4)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageMaskText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageMaskText.map"],"mappings":"wLAMG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,QAAM,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,WAAS,eAAa,gBAAc,mBAAiB,OAAK,SAAO,EAAY,EAAWA,GAAO,CAAC,QAAQ,KAAK,GAAG,CAAO,EAAmBC,MAAY,CAAC,IAAM,EAAG,GAAM,WAAW,GAAG,OAAO,GAAK,SAAS,OAAO,KAAK,IAAI,IAAI,EAAG,CAAC,GAAG,OAAO,GAAK,SAAS,CAAC,IAAM,EAAO,WAAW,EAAG,CAAC,GAAG,OAAO,SAAS,EAAO,CAAC,OAAO,KAAK,IAAI,IAAI,EAAO,CAAE,MAAO,MAAM,CAAC,GAAM,WAAW,CAAC,CACthB,EAAOA,MAAgB,IAAW,QAAc,QAAW,IAAW,UAAgB,UACtF,GAAG,EAAa,GAAK,CAAC,EAAS,EAAa,CAAC,CAAO,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