{"version":3,"file":"GridPattern.DLJ4sK_p.mjs","names":["useRef","useState","p"],"sources":["https:/framerusercontent.com/modules/OWsiRgVKN6EJK8pMPJ1f/78TKosQG5OSn5kilbFDW/GridPattern.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useLayoutEffect,useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const TILE=20;/**\n * Made by Stylokit\n * 20×20 grid + random fills (fill color == stroke color)\n *\n * @framerDisableUnlink\n */export default function GridPattern({strokeColor=\"#000000\",strokeWidth=2,randomDensity=8,seed}){const rootRef=useRef(null);const[size,setSize]=useState({w:0,h:0});const[cells,setCells]=useState([]);// Measure\nuseLayoutEffect(()=>{const el=rootRef.current;if(!el)return;const read=()=>setSize({w:el.clientWidth||0,h:el.clientHeight||0});read();const RO=window.ResizeObserver;const ro=RO?new RO(()=>read()):null;ro?.observe(el);window.addEventListener(\"resize\",read);return()=>{ro?.disconnect?.();window.removeEventListener(\"resize\",read);};},[]);// Seeded RNG (optional)\nconst makeRNG=s=>()=>{s=(s*1664525+1013904223)%4294967296;return s/4294967296;};// Pick random cells\nuseEffect(()=>{const{w,h}=size;if(!w||!h)return;const cols=Math.ceil(w/TILE);const rows=Math.ceil(h/TILE);const p=Math.min(1,Math.max(0,randomDensity/100));const rnd=typeof seed===\"number\"?makeRNG(seed|0):Math.random;const list=[];for(let y=0;y<rows;y++){for(let x=0;x<cols;x++){if(rnd()<p)list.push({x,y});}}setCells(list);},[size,randomDensity,seed]);const sw=Math.min(TILE-1,Math.max(1,strokeWidth));// ✅ Fill = strokeColor (exactly)\nconst fillImgs=cells.map(()=>`linear-gradient(${strokeColor} 0 0)`);const fillPos=cells.map(c=>`${c.x*TILE}px ${c.y*TILE}px`);const fillSize=cells.map(()=>`${TILE}px ${TILE}px`);const fillRep=cells.map(()=>`no-repeat`);// Grid lines on top\nconst gridImgs=[`linear-gradient(to right, ${strokeColor} ${sw}px, transparent ${sw}px)`,`linear-gradient(to bottom, ${strokeColor} ${sw}px, transparent ${sw}px)`];const gridPos=[\"0 0\",\"0 0\"];const gridSize=[`${TILE}px ${TILE}px`,`${TILE}px ${TILE}px`];const gridRepeat=[\"repeat\",\"repeat\"];const style={width:\"100%\",height:\"100%\",backgroundImage:[...fillImgs,...gridImgs].join(\", \"),backgroundPosition:[...fillPos,...gridPos].join(\", \"),backgroundSize:[...fillSize,...gridSize].join(\", \"),backgroundRepeat:[...fillRep,...gridRepeat].join(\", \")};return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:style});}addPropertyControls(GridPattern,{strokeColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#000000\"},strokeWidth:{type:ControlType.Number,title:\"Line Width\",min:1,max:10,step:1,defaultValue:2},randomDensity:{type:ControlType.Number,title:\"Random Density (%)\",min:0,max:100,step:1,defaultValue:8},seed:{type:ControlType.Number,title:\"Seed (optional)\",min:0,max:999999,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GridPattern\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GridPattern.map"],"mappings":"6MAKG,SAAwB,EAAY,CAAC,cAAY,UAAU,cAAY,EAAE,gBAAc,EAAE,QAAM,CAAC,IAAM,EAAQA,EAAO,KAAK,CAAM,CAAC,EAAK,GAASC,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAM,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAC,CACxM,MAAoB,CAAC,IAAM,EAAG,EAAQ,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAM,MAAS,EAAQ,CAAC,EAAE,EAAG,aAAa,EAAE,EAAE,EAAG,cAAc,EAAE,CAAC,CAAC,GAAM,CAAC,IAAM,EAAG,EAAO,eAAqB,EAAG,EAAG,IAAI,MAAO,GAAM,CAAC,CAAC,KAA4D,O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