{"version":3,"file":"HoverButton.CHrcrfLL.mjs","names":["useState","useRef","useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/0fiK10ds9aOljcyukYA7/PLUaWRbJNqWoLBxFbmz0/HoverButton.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Create a shared store to manage state for mouse position and background position\nconst useStore=createStore({mousePos:{x:0,y:0},backgroundPos:{x:0,y:0}});/**\n * Override to add a hover-fill effect to a component.\n * The effect tracks the mouse position and animates a background shape\n * (e.g., a circular fill) to follow the mouse and appear on hover.\n *\n * @param Component The component to enhance with the hover-fill effect.\n * @returns The enhanced component with hover-fill behavior.\n */export function withFillFollowCursor(Component){return props=>{// Ref to the container element to track its size and position\nconst ref=useRef(null);// Use the shared store for managing state\nconst[store,setStore]=useStore();// Local state to track hover status\nconst[isHover,setIsHover]=useState(null);/**\n         * Handles the mouse entering or moving within the component area.\n         * Updates the mouse position in the store and sets hover state.\n         */const handleMouseOver=event=>{const rect=event.target.getBoundingClientRect();const x=event.clientX-rect.left;const y=event.clientY-rect.top;if(!isHover){setIsHover(true);}setStore({mousePos:{x:x,y:y}});};/**\n         * Handles the mouse leaving the component area.\n         * Updates the mouse position in the store and unsets hover state.\n         */const handleMouseLeave=event=>{const rect=event.target.getBoundingClientRect();const x=event.clientX-rect.left;const y=event.clientY-rect.top;setStore({mousePos:{x:x,y:y}});if(isHover){setIsHover(false);}};/**\n         * Reacts to hover state changes to update the background's position.\n         * Background position is synchronized with the current mouse position.\n         */useEffect(()=>{const x=store.mousePos.x;const y=store.mousePos.y;setStore({backgroundPos:{x:x,y:y}});},[isHover]);// Styles for the container to occupy full area\nconst containerStyle={width:\"100%\",height:\"100%\",position:\"absolute\"};// Render the wrapped component with hover-fill behavior\nreturn /*#__PURE__*/_jsx(\"div\",{ref:ref,style:containerStyle,onMouseOver:handleMouseOver,onMouseLeave:handleMouseLeave,children:/*#__PURE__*/_jsx(Component,{...props,style:{...props.style,position:\"absolute\",minWidth:\"225%\",aspectRatio:1,pointerEvents:\"none\",borderRadius:\"50%\",visibility:isHover?\"visible\":\"hidden\",transformOrigin:\"center center\",top:store.backgroundPos.y,left:store.backgroundPos.x},animate:{scale:isHover?1:0},/* ADJUST THE ANIMATION BEHAVIOUR HERE */transition:{default:{type:\"tween\",duration:.4,ease:\"easeOut\"}}})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withFillFollowCursor\":{\"type\":\"reactHoc\",\"name\":\"withFillFollowCursor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HoverButton.map"],"mappings":"yLAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,CAAC,CAAC,EACjD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,KAAK,GAAG,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,CAAQ,CAAC,CAAE,EACjI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,EAAE,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,CAAU,GAAG,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,CAAQ,CAAC,EAAE,EACjJ,EAAa,QAAQ,GAAQ,EAAO,CAAU,CAAC,CAAE,EACjD,SAAS,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUA,EAAS,CAAU,EAKzC,OAHA,OACA,EAAa,IAAI,CAAQ,MAAY,EAAa,OAAO,CAAQ,GAAI,CAAC,CAAC,EACpE,EAAe,IAAI,IAAM,EAAe,EAAQ,CAAC,EAAU,MAAM,CAAY,GAC1E,CAAC,EAAM,CAAa,CAAG,CAAC,OAAO,CAAS,iBAfT,IAAwC,sBEQ1E,SAAg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