{"version":3,"file":"Text_indent.b89A85CK.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/adF3F65HyafW0wYl2RnI/quCfGvopNR5or1BG36Gq/Text_indent.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useLayoutEffect,useState,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TextIndentBlock(props){const{layout={column:12,gap:8,indentColumns_4:0,indentColumns_6:0,indentColumns_8:0,indentColumns_12:0},textSettings={text:\"We believe coffee is more than just a daily ritual. It's a moment of pause in our busy lives, a bridge between cultures, and a catalyst for conversation. Every cup tells a story of the hands that grew, harvested, and roasted the beans.\",font:{fontSize:\"15px\",fontWeight:500,letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},textColor:\"#000000\",tag:\"p\"},wordBreak=\"break-word\",style={},animate=true}=props;const{column,gap,indentColumns_4,indentColumns_6,indentColumns_8,indentColumns_12}=layout;const{text,font,textColor,tag}=textSettings;// Pick indent value based on column choice\nconst indentColumns=column===4?indentColumns_4??0:column===6?indentColumns_6??0:column===8?indentColumns_8??0:column===12?indentColumns_12??0:0;const containerRef=useRef(null);const[containerWidth,setContainerWidth]=useState(0);const hasAnimated=useRef(false);const[scriptsLoaded,setScriptsLoaded]=useState(false);// Load GSAP + SplitType\nuseEffect(()=>{if(typeof window===\"undefined\")return;if(window.gsap&&window.SplitType){setScriptsLoaded(true);return;}const gsapScript=document.createElement(\"script\");gsapScript.src=\"https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js\";gsapScript.async=true;const splitTextScript=document.createElement(\"script\");splitTextScript.src=\"https://cdn.jsdelivr.net/npm/split-type@0.3.4/umd/index.min.js\";splitTextScript.async=true;let gsapLoaded=false;let splitLoaded=false;const checkLoaded=()=>{if(gsapLoaded&&splitLoaded)setScriptsLoaded(true);};gsapScript.onload=()=>{gsapLoaded=true;checkLoaded();};splitTextScript.onload=()=>{splitLoaded=true;checkLoaded();};document.head.appendChild(gsapScript);document.head.appendChild(splitTextScript);return()=>{if(document.head.contains(gsapScript))document.head.removeChild(gsapScript);if(document.head.contains(splitTextScript))document.head.removeChild(splitTextScript);};},[]);// Measure container width\nuseLayoutEffect(()=>{const el=containerRef.current;if(!el)return;const measure=node=>node.offsetWidth||node.getBoundingClientRect().width;setContainerWidth(measure(el));let ro=null;if(typeof ResizeObserver!==\"undefined\"){ro=new ResizeObserver(()=>{if(el)setContainerWidth(measure(el));});ro.observe(el);}else{const handleResize=()=>{if(el)setContainerWidth(measure(el));};window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);}return()=>{if(ro&&el)ro.unobserve(el);};},[]);// Animate lines\nuseEffect(()=>{if(!animate||!scriptsLoaded)return;const isEditor=RenderTarget.current()===RenderTarget.canvas;if(isEditor)return;const element=containerRef.current;if(!element)return;hasAnimated.current=false;// Inject styles (only once)\nif(!document.getElementById(\"splittext-styles\")){const styleEl=document.createElement(\"style\");styleEl.id=\"splittext-styles\";styleEl.textContent=`\n                .split-parent { overflow: hidden; display: inline-block; }\n                .split-child { display: inline-block; }\n            `;document.head.appendChild(styleEl);}const gsap=window.gsap;const SplitType=window.SplitType?.default||window.SplitType;if(!gsap||!SplitType)return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting&&!hasAnimated.current){hasAnimated.current=true;const textContent=element.querySelector(\".text-content\");if(!textContent)return;const split=new SplitType(textContent,{types:\"lines\",lineClass:\"split-line\"});const lines=split.lines||[];lines.forEach(line=>{const wrapper=document.createElement(\"span\");wrapper.className=\"split-parent\";line.parentNode?.insertBefore(wrapper,line);wrapper.appendChild(line);line.className=\"split-child\";});const childLines=element.querySelectorAll(\".split-child\");gsap.from(childLines,{duration:1.5,yPercent:100,ease:\"power4\",stagger:.1});observer.unobserve(element);}});},{threshold:.1});observer.observe(element);return()=>observer.disconnect();},[animate,scriptsLoaded,text]);// Column width & indent\nconst columnWidth=containerWidth?(containerWidth-(column-1)*gap)/column:0;const indentSize=indentColumns*(columnWidth+gap);const isFixedWidth=style?.width===\"100%\";const isFixedHeight=style?.height===\"100%\";const Tag=tag||\"p\";const isEditor=RenderTarget.current()===RenderTarget.canvas;const RenderTag=isEditor?\"span\":Tag;return /*#__PURE__*/_jsxs(RenderTag,{ref:containerRef,style:{margin:0,padding:0,color:textColor,wordBreak,wordWrap:\"break-word\",overflowWrap:\"break-word\",visibility:containerWidth>0?\"visible\":\"hidden\",...isFixedWidth?{width:\"100%\"}:{},...isFixedHeight?{height:\"100%\"}:{},...font,...style},children:[/*#__PURE__*/_jsx(\"span\",{className:\"spacer\",style:{display:\"inline-block\",width:indentSize?`${indentSize}px`:undefined,height:1,verticalAlign:\"baseline\"}}),/*#__PURE__*/_jsx(\"span\",{className:\"text-content\",children:text})]});}addPropertyControls(TextIndentBlock,{animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:true},layout:{type:ControlType.Object,title:\"Layout\",controls:{column:{type:ControlType.Enum,title:\"Column\",options:[4,6,8,12],defaultValue:12},indentColumns_4:{type:ControlType.Enum,title:\"Indent Columns\",options:[0,1,2,3,4],defaultValue:0,hidden:props=>props.column!==4},indentColumns_6:{type:ControlType.Enum,title:\"Indent Columns\",options:[0,1,2,3,4,5,6],defaultValue:0,hidden:props=>props.column!==6},indentColumns_8:{type:ControlType.Enum,title:\"Indent Columns\",options:[0,1,2,3,4,5,6,7,8],defaultValue:0,hidden:props=>props.column!==8},indentColumns_12:{type:ControlType.Enum,title:\"Indent Columns\",options:[0,1,2,3,4,5,6,7,8,9,10,11,12],defaultValue:0,hidden:props=>props.column!==12},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:100,step:1,unit:\"px\"}}},textSettings:{type:ControlType.Object,title:\"Text\",controls:{text:{type:ControlType.String,title:\"Text\",defaultValue:\"We believe coffee is more than just a daily ritual. It's a moment of pause in our busy lives, a bridge between cultures, and a catalyst for conversation.\",displayTextArea:true},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},textColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},tag:{type:ControlType.Enum,title:\"Tag\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"span\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Paragraph\",\"Span\"],defaultValue:\"p\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextIndentBlock\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_indent.map"],"mappings":"2VAGG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,OAAO,GAAG,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC,eAAa,CAAC,KAAK,8OAA8O,KAAK,CAAC,SAAS,OAAO,WAAW,IAAI,cAAc,UAAU,WAAW,QAAQ,CAAC,UAAU,UAAU,IAAI,IAAI,CAAC,YAAU,aAAa,QAAM,EAAE,CAAC,UAAQ,IAAM,EAAW,CAAC,SAAO,MAAI,kBAAgB,kBAAgB,kBAAgB,oBAAkB,EAAY,CAAC,OAAK,OAAK,YAAU,OAAK,EAChrB,EAAc,IAAS,EAAE,GAAiB,EAAE,IAAS,EAAE,GAAiB,EAAE,IAAS,EAAE,GAAiB,EAAE,IAAS,GAAG,GAAkB,EAAE,EAAQ,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAe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