{"version":3,"file":"Drop_Cap.BsRWN2cd.mjs","names":["p","_Fragment"],"sources":["https:/framerusercontent.com/modules/lvlf09BgGDxWR0H9z1vN/Ybf2JxvWHi87jW7XDMtt/Drop_Cap.js"],"sourcesContent":["/**\n * DropCapParagraph.tsx (Framer Code Component)\n *\n * CMS blog at scale: bind your CMS \"Body\" (plain text) field into the `text` prop.\n *\n * Tips:\n * - If your CMS content includes line breaks, this component preserves them.\n * - You can choose to drop-cap the first alphabetic character (skipping quotes/spaces).\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";function stripHtml(input){// Very simple HTML stripping for safety and CMS quirks.\n// If your CMS is pure text, this does nothing.\nreturn input.replace(/<[^>]*>/g,\"\");}function splitForDropCap(raw,mode){const text=raw??\"\";if(!text)return{lead:\"\",cap:\"\",rest:\"\"};// Keep leading whitespace and punctuation so layout feels natural\n// but choose the drop-cap character based on mode.\nlet i=0;if(mode===\"firstChar\"){// Drop-cap the first non-newline char (keeps leading spaces out of cap)\nwhile(i<text.length&&(text[i]===\"\\n\"||text[i]===\"\\r\"))i++;// If still empty or only newlines\nif(i>=text.length)return{lead:text,cap:\"\",rest:\"\"};// If next is a space, treat it as lead and find first visible char\nwhile(i<text.length&&text[i]===\" \")i++;if(i>=text.length)return{lead:text,cap:\"\",rest:\"\"};const lead=text.slice(0,i);const cap=text[i];const rest=text.slice(i+1);return{lead,cap,rest};}// firstAlpha: skip common leading punctuation and spaces until alphabetic char\nconst isAlpha=ch=>/[A-Za-zÀ-ÖØ-öø-ÿ]/.test(ch);while(i<text.length&&!isAlpha(text[i]))i++;if(i>=text.length){// No alphabetic character found, fall back to firstChar-like behaviour\nreturn splitForDropCap(text,\"firstChar\");}const lead=text.slice(0,i);const cap=text[i];const rest=text.slice(i+1);return{lead,cap,rest};}export default function DropCapParagraph(props){const{text,dropCapMode,maxWidth,fontFamily,fontSize,lineHeight,fontWeight,textColor,paragraphGap,capEnabled,capColor,capFontFamily,capFontWeight,capFontSize,capLineHeight,capPaddingRight,capPaddingTop,capMarginBottom,capFloat,onlyFirstParagraph,align}=props;const cleaned=stripHtml(String(text??\"\"));const paragraphs=cleaned.split(/\\n\\s*\\n/g)// blank line indicates new paragraph\n.map(p=>p.replace(/\\r/g,\"\").trim()).filter(Boolean);const renderParagraph=(pText,idx)=>{const applyCap=capEnabled&&(!onlyFirstParagraph||idx===0);const{lead,cap,rest}=splitForDropCap(pText,dropCapMode);const containerStyle={maxWidth:maxWidth===0?\"100%\":maxWidth,color:textColor,fontFamily,fontSize,lineHeight,fontWeight,textAlign:align,whiteSpace:\"pre-wrap\"};const capStyle=applyCap?{float:capFloat?\"left\":undefined,fontFamily:capFontFamily||fontFamily,fontWeight:capFontWeight,fontSize:capFontSize,lineHeight:capLineHeight,color:capColor,paddingRight:capPaddingRight,paddingTop:capPaddingTop,marginBottom:capMarginBottom,display:capFloat?\"block\":\"inline-block\"}:{};return /*#__PURE__*/_jsx(\"p\",{style:{...containerStyle,margin:0,marginTop:idx===0?0:paragraphGap},children:applyCap?/*#__PURE__*/_jsxs(_Fragment,{children:[lead,/*#__PURE__*/_jsx(\"span\",{style:capStyle,\"aria-hidden\":\"true\",children:cap}),rest]}):pText},idx);};// Wrapper ensures float is contained\nconst wrapperStyle={width:\"100%\",height:\"100%\",overflow:\"hidden\"};return /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:paragraphs.map(renderParagraph)});}DropCapParagraph.defaultProps={text:\"Once upon a time, your blog post starts with a drop cap. Second paragraph continues normally. Once upon a time, your blog post starts with a drop cap.\\n\\nSecond paragraph continues normally. Once upon a time, your blog post starts with a drop cap. Third paragraph continues normally.\",dropCapMode:\"firstAlpha\",maxWidth:0,fontFamily:\"Inter\",fontSize:12,lineHeight:1.3,fontWeight:400,textColor:\"#111111\",paragraphGap:16,capEnabled:true,capColor:\"#111111\",capFontFamily:\"\",capFontWeight:400,capFontSize:64,capLineHeight:.8,capPaddingRight:4,capPaddingTop:4,capMarginBottom:0,capFloat:true,onlyFirstParagraph:true,align:\"left\"};addPropertyControls(DropCapParagraph,{text:{type:ControlType.String,title:\"Text\",displayTextArea:true,defaultValue:DropCapParagraph.defaultProps.text},dropCapMode:{type:ControlType.Enum,title:\"Drop-cap\",options:[\"firstAlpha\",\"firstChar\"],optionTitles:[\"First letter (skip quotes)\",\"First character\"],defaultValue:DropCapParagraph.defaultProps.dropCapMode},onlyFirstParagraph:{type:ControlType.Boolean,title:\"Only first para\",defaultValue:DropCapParagraph.defaultProps.onlyFirstParagraph},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\",\"justify\"],defaultValue:DropCapParagraph.defaultProps.align},maxWidth:{type:ControlType.Number,title:\"Max width\",min:0,max:1400,step:10,defaultValue:DropCapParagraph.defaultProps.maxWidth,description:\"0 = full width\"},fontFamily:{type:ControlType.String,title:\"Font\",defaultValue:\"Inter\"},fontSize:{type:ControlType.Number,title:\"Size\",min:10,max:40,step:1,defaultValue:18},lineHeight:{type:ControlType.Number,title:\"Line height\",min:1,max:2.2,step:.05,defaultValue:1.6},fontWeight:{type:ControlType.Number,title:\"Weight\",min:100,max:900,step:100,defaultValue:400},textColor:{type:ControlType.Color,title:\"Text colour\",defaultValue:\"#000000\"},paragraphGap:{type:ControlType.Number,title:\"Para gap\",min:0,max:60,step:1,defaultValue:16},capEnabled:{type:ControlType.Boolean,title:\"Cap enabled\",defaultValue:true},capColor:{type:ControlType.Color,title:\"Cap colour\",defaultValue:\"#111111\"},capFontFamily:{type:ControlType.String,title:\"Cap font\",defaultValue:\"\",description:\"Leave blank to use main font\"},capFontWeight:{type:ControlType.Number,title:\"Cap weight\",min:100,max:900,step:100,defaultValue:600},capFontSize:{type:ControlType.Number,title:\"Cap size\",min:24,max:140,step:1,defaultValue:64},capLineHeight:{type:ControlType.Number,title:\"Cap line\",min:.6,max:1.4,step:.05,defaultValue:.9},capPaddingRight:{type:ControlType.Number,title:\"Cap pad R\",min:0,max:40,step:1,defaultValue:10},capPaddingTop:{type:ControlType.Number,title:\"Cap pad T\",min:-10,max:40,step:1,defaultValue:4},capMarginBottom:{type:ControlType.Number,title:\"Cap margin B\",min:-20,max:40,step:1,defaultValue:0},capFloat:{type:ControlType.Boolean,title:\"Float left\",defaultValue:true,description:\"Turn off if you want inline cap, not true drop-cap flow\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DropCapParagraph\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Drop_Cap.map"],"mappings":"2KAWsI,SAAS,EAAU,EAAM,CAE/J,OAAO,EAAM,QAAQ,WAAW,GAAG,CAAE,SAAS,EAAgB,EAAI,EAAK,CAAC,IAAM,EAAK,GAAK,GAAG,GAAG,CAAC,EAAK,MAAM,CAAC,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,CAElI,IAAI,EAAE,EAAE,GAAG,IAAO,YAAY,CAC9B,KAAM,EAAE,EAAK,SAAS,EAAK,KAAK;GAAM,EAAK,KAAK,OAAM,IACtD,GAAG,GAAG,EAAK,OAAO,MAAM,CAAC,KAAK,EAAK,IAAI,GAAG,KAAK,GAAG,CAClD,KAAM,EAAE,EAAK,QAAQ,EAAK,KAAK,KAAI,IAA+H,OAAxH,GAAG,EAAK,OAAa,CAAC,KAAK,EAAK,IAAI,GAAG,KAAK,GAAG,CAA+E,CAAC,KAApE,EAAK,MAAM,EAAE,EAAE,CAA0D,IAA/C,EAAK,GAA8C,KAAhC,EAAK,MAAM,EAAE,EAAE,CAAsB,CACvL,IAAM,EAAQ,GAAI,oBAAoB,KAAK,EAAG,CAAC,KAAM,EAAE,EAAK,QAAQ,CAAC,EAAQ,EAAK,GAAG,EAAC,IAC4B,OADrB,GAAG,EAAK,OAC9F,EAAgB,EAAK,YAAY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