{"version":3,"file":"CubicalGridBackground.lGRF0a4d.mjs","names":["useRef","useState","useMemo","useCallback","startTransition","useLayoutEffect","_jsx","__esmMin","ne","init_npm_react_18_3_1","te","pe","le","window","_e","de","c","init_jsx_runtime","init_ssg_sandbox_shims","addPropertyControls","ControlType","init_framer_BWzg2IRg","CubicalGridBackground","props","columns","lineColor","lineThickness","backgroundColor","rootRef","measuredWidth","setMeasuredWidth","safeColumns","updateMeasuredWidth","nextWidth","previousWidth","element","observer","entries","entry","cellSize","thickness","init_CubicalGridBackground"],"sources":["https:/framerusercontent.com/modules/V2v2MaH05rKnuMvahOjC/EAVd67W3IVDO0u5ZlsrK/CubicalGridBackground.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useCallback,useLayoutEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CubicalGridBackground(props){const{columns=24,lineColor=\"#222\",lineThickness=.5,backgroundColor=\"rgba(0, 0, 0, 0)\"}=props;const rootRef=useRef(null);const[measuredWidth,setMeasuredWidth]=useState(null);const safeColumns=useMemo(()=>Math.max(1,Math.round(columns)),[columns]);const updateMeasuredWidth=useCallback(nextWidth=>{startTransition(()=>{setMeasuredWidth(previousWidth=>previousWidth===nextWidth?previousWidth:nextWidth);});},[]);useLayoutEffect(()=>{if(typeof window===\"undefined\"||typeof ResizeObserver===\"undefined\")return;const element=rootRef.current;if(!element)return;updateMeasuredWidth(element.getBoundingClientRect().width);const observer=new ResizeObserver(entries=>{const entry=entries[0];if(!entry)return;updateMeasuredWidth(entry.contentRect.width);});observer.observe(element);return()=>observer.disconnect();},[updateMeasuredWidth]);const cellSize=useMemo(()=>{if(measuredWidth!==null){return`${measuredWidth/safeColumns}px`;}return`calc(100vw / ${safeColumns})`;},[measuredWidth,safeColumns]);const thickness=`${lineThickness}px`;return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,backgroundImage:`\n                    repeating-linear-gradient(\n                        to right,\n                        ${lineColor} 0,\n                        ${lineColor} ${thickness},\n                        transparent ${thickness},\n                        transparent ${cellSize}\n                    ),\n                    repeating-linear-gradient(\n                        to bottom,\n                        ${lineColor} 0,\n                        ${lineColor} ${thickness},\n                        transparent ${thickness},\n                        transparent ${cellSize}\n                    )\n                `,backgroundSize:`${cellSize} ${cellSize}`,backgroundRepeat:\"repeat\"}});}addPropertyControls(CubicalGridBackground,{columns:{type:ControlType.Number,title:\"Columns\",defaultValue:24,min:1,max:100,step:1},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#222\"},lineThickness:{type:ControlType.Number,title:\"Thickness\",defaultValue:.5,min:.25,max:4,step:.25},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgba(0, 0, 0, 0)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CubicalGridBackground\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CubicalGridBackground.map"],"mappings":"A,4NAGG,SAAwBsB,EAAsBC,EAAM,CAAC,GAAK,CAACC,UAAQ,GAAGC,YAAU,OAAOC,gBAAc,GAAGC,kBAAgB,oBAAoBJ,EAAYK,EAAQ5B,EAAO,IAAI,EAAO,CAAC6B,EAAcC,GAAkB7B,EAAS,IAAI,EAAQ8B,EAAY7B,MAAY,KAAK,IAAI,EAAE,KAAK,MAAMsB,CAAO,CAAC,EAAE,CAACA,CAAO,CAAC,EAAQQ,EAAoB7B,EAAY8B,GAAW,CAAC7B,MAAoB,CAAC0B,EAAiBI,GAAeA,IAAgBD,EAAUC,EAAcD,CAAS,CAAE,CAAC,CAA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