{"version":3,"file":"CodeEditor.KbkiUOYG.mjs","names":["useContext","useState","useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/zMHJrDtyeKzWGXwCSXr6/2PM4Mmvqr8Qf5pc9PBru/CardHover.js","https:/framerusercontent.com/modules/S10zlHAEV6dKcbv8oi0c/RPXKDHyIb9eYB6U7BcqX/CodeEditor.js"],"sourcesContent":["// CardHover.tsx — hover-triggered animations for bento cards.\n// Apply the `withCardHover` override to a card frame; any code component inside it\n// that calls `useCardHover()` only animates while that card is hovered.\n// On touch devices (no hover) components fall back to playing when in view.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{createContext,forwardRef,useContext,useEffect,useState}from\"react\";export const CardHoverContext=/*#__PURE__*/createContext(null);/** Returns null when the component is not inside a `withCardHover` card. */export function useCardHover(){return useContext(CardHoverContext);}export function withCardHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[hovered,setHovered]=useState(false);const[canHover,setCanHover]=useState(true);useEffect(()=>{if(typeof window===\"undefined\"||!window.matchMedia)return;const mq=window.matchMedia(\"(hover: hover) and (pointer: fine)\");const update=()=>setCanHover(mq.matches);update();mq.addEventListener?.(\"change\",update);return()=>mq.removeEventListener?.(\"change\",update);},[]);return /*#__PURE__*/_jsx(CardHoverContext.Provider,{value:{hovered,canHover},children:/*#__PURE__*/_jsx(Component,{ref:ref,...props,onMouseEnter:e=>{props.onMouseEnter?.(e);setHovered(true);},onMouseLeave:e=>{props.onMouseLeave?.(e);setHovered(false);}})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"CardHoverState\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CardHoverContext\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCardHover\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCardHover\":{\"type\":\"reactHoc\",\"name\":\"withCardHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CardHover.map","// Animated code editor to visualize code in a simple window with 3:4 aspect ratio\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,startTransition,useMemo}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{useRef}from\"react\";import{useCardHover}from\"https://framerusercontent.com/modules/zMHJrDtyeKzWGXwCSXr6/2PM4Mmvqr8Qf5pc9PBru/CardHover.js\";/**\n * Animated Code Editor\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 800\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CodeEditor(props){const{code=`function greet(name) {\n  console.log(\\`Hello, \\${name}!\\`);\n  return true;\n}\n\ngreet(\"World\");`,language=\"javascript\",theme=\"dark\",animationSpeed=50,showLineNumbers=true,windowTitle=\"code.js\",backgroundColor,textColor,accentColor,font}=props;const[displayedCode,setDisplayedCode]=useState(\"\");const[currentIndex,setCurrentIndex]=useState(0);const isStatic=useIsStaticRenderer();const containerRef=useRef(null);const isInView=useInView(containerRef,{once:false});// Inside a `withCardHover` card: type only while the card is hovered\n// (touch devices fall back to in-view). Elsewhere: unchanged in-view behaviour.\nconst cardHover=useCardHover();const hoverMode=!!cardHover&&cardHover.canHover;const playing=hoverMode?cardHover.hovered:isInView;const themeColors=useMemo(()=>{if(theme===\"dark\"){return{window:backgroundColor||\"#1e1e1e\",titleBar:\"#2d2d2d\",text:textColor||\"#d4d4d4\",lineNumber:\"#858585\",keyword:accentColor||\"#569cd6\",string:\"#ce9178\",comment:\"#6a9955\",function:\"#dcdcaa\"};}return{window:backgroundColor||\"#ffffff\",titleBar:\"#f3f3f3\",text:textColor||\"#000000\",lineNumber:\"#999999\",keyword:accentColor||\"#0000ff\",string:\"#a31515\",comment:\"#008000\",function:\"#795e26\"};},[theme,backgroundColor,textColor,accentColor]);useEffect(()=>{if(isStatic||!playing){setDisplayedCode(code);if(hoverMode)setCurrentIndex(code.length);return;}setCurrentIndex(0);setDisplayedCode(\"\");const interval=setInterval(()=>{setCurrentIndex(prev=>{if(prev>=code.length){clearInterval(interval);return prev;}const next=prev+1;startTransition(()=>{setDisplayedCode(code.slice(0,next));});return next;});},animationSpeed);return()=>clearInterval(interval);},[code,animationSpeed,isStatic,playing,hoverMode]);const highlightCode=text=>{const keywords=/\\b(function|const|let|var|return|if|else|for|while|class|import|export|from|async|await|try|catch)\\b/g;const strings=/([\"'`])(?:(?=(\\\\?))\\2.)*?\\1/g;const comments=/(\\/\\/.*$|\\/\\*[\\s\\S]*?\\*\\/)/gm;const functions=/\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*\\(/g;let highlighted=text;highlighted=highlighted.replace(comments,match=>`<span style=\"color: ${themeColors.comment}\">${match}</span>`);highlighted=highlighted.replace(strings,match=>`<span style=\"color: ${themeColors.string}\">${match}</span>`);highlighted=highlighted.replace(keywords,match=>`<span style=\"color: ${themeColors.keyword}\">${match}</span>`);highlighted=highlighted.replace(functions,(match,funcName)=>`<span style=\"color: ${themeColors.function}\">${funcName}</span>(`);return highlighted;};const lines=displayedCode.split(\"\\n\");return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",backgroundColor:themeColors.window,borderRadius:8,overflow:\"hidden\",boxShadow:\"0 4px 20px rgba(0, 0, 0, 0.15)\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",padding:\"8px 12px\",backgroundColor:themeColors.titleBar,borderBottom:`1px solid ${theme===\"dark\"?\"#3e3e3e\":\"#e0e0e0\"}`},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:6,marginRight:12},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:10,height:10,borderRadius:\"50%\",backgroundColor:\"#ff5f56\"}}),/*#__PURE__*/_jsx(\"div\",{style:{width:10,height:10,borderRadius:\"50%\",backgroundColor:\"#ffbd2e\"}}),/*#__PURE__*/_jsx(\"div\",{style:{width:10,height:10,borderRadius:\"50%\",backgroundColor:\"#27c93f\"}})]}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontSize:11,color:themeColors.text,opacity:.8},children:windowTitle})]}),/*#__PURE__*/_jsx(\"div\",{style:{flex:1,padding:12,overflow:\"auto\",...font,fontSize:11,lineHeight:\"1.6\",fontFamily:\"monospace\"},children:lines.map((line,index)=>/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",minHeight:\"1.6em\"},children:[showLineNumbers&&/*#__PURE__*/_jsx(\"span\",{style:{color:themeColors.lineNumber,marginRight:12,userSelect:\"none\",minWidth:24,textAlign:\"right\"},children:index+1}),/*#__PURE__*/_jsx(\"span\",{style:{color:themeColors.text,whiteSpace:\"pre\"},dangerouslySetInnerHTML:{__html:highlightCode(line)}}),index===lines.length-1&&currentIndex<code.length&&/*#__PURE__*/_jsx(motion.span,{animate:{opacity:[1,0]},transition:{duration:.5,repeat:Infinity},style:{display:\"inline-block\",width:2,height:\"1.2em\",backgroundColor:themeColors.text,marginLeft:2}})]},index))})]});}addPropertyControls(CodeEditor,{code:{type:ControlType.String,title:\"Code\",displayTextArea:true,defaultValue:`function greet(name) {\n  console.log(\\`Hello, \\${name}!\\`);\n  return true;\n}\n\ngreet(\"World\");`},language:{type:ControlType.String,title:\"Language\",defaultValue:\"javascript\"},theme:{type:ControlType.Enum,title:\"Theme\",options:[\"dark\",\"light\"],optionTitles:[\"Dark\",\"Light\"],defaultValue:\"dark\",displaySegmentedControl:true},animationSpeed:{type:ControlType.Number,title:\"Speed\",defaultValue:50,min:10,max:200,step:10,unit:\"ms\"},showLineNumbers:{type:ControlType.Boolean,title:\"Line Numbers\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},windowTitle:{type:ControlType.String,title:\"Window Title\",defaultValue:\"code.js\"},backgroundColor:{type:ControlType.Color,title:\"Background\",optional:true},textColor:{type:ControlType.Color,title:\"Text Color\",optional:true},accentColor:{type:ControlType.Color,title:\"Accent Color\",optional:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"monospace\",defaultValue:{fontSize:\"11px\",letterSpacing:\"0em\",lineHeight:\"1.6em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CodeEditor\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"600\",\"framerIntrinsicHeight\":\"800\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CodeEditor.map"],"mappings":"iTAIgQ,SAAgB,GAAc,CAAC,OAAOA,EAAW,CAAgB,CAAE,CAAC,SAAgB,EAAc,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAQ,GAAYC,EAAS,EAAK,EAAO,CAAC,EAAS,GAAaA,EAAS,EAAI,EAA+R,OAA7R,MAAc,CAAC,GAAU,IAAS,QAAa,CAAC,EAAO,WAAW,OAAO,IAAM,EAAG,EAAO,WAAW,oCAAoC,EAAQ,MAAW,EAAY,EAAG,OAAO,EAAkD,OAAhD,EAAO,EAAE,EAAG,mBAAmB,SAAS,CAAM,MAAY,EAAG,sBAAsB,SAAS,CAAM,CAAE,EAAE,CAAC,CAAC,EAAsB,EAAK,EAAiB,SAAS,CAAC,MAAM,CAAC,UAAQ,UAAQ,EAAE,SAAsB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,aAAa,GAAG,CAAC,EAAM,eAAe,CAAC,EAAE,EAAW,EAAI,CAAE,EAAE,aAAa,GAAG,CAAC,EAAM,eAAe,CAAC,EAAE,EAAW,EAAK,CAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAE,uBAAt+B,IAA0E,EAAc,EAA8B,EAAc,IAAI,KCK/K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