{"version":3,"file":"ThemeImageSync.CmPqb3fk.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/hAlTr2TtUoOLgi6x5cm2/JcipjYpU5YnDGU0ZzkAo/ThemeImageSync.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";/**\n * Componente de imagem que alterna entre duas imagens diferentes\n * baseado no tema selecionado pelo ThemeToggle (light/dark mode).\n *\n * Sincroniza automaticamente com o componente ThemeToggle.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 200\n */export default function ThemeImageSync(props){const{lightImage=\"https://via.placeholder.com/600x400/ffffff/000000?text=Light+Mode\",darkImage=\"https://via.placeholder.com/600x400/000000/ffffff?text=Dark+Mode\",alt=\"Theme-aware image\",objectFit=\"cover\",objectPosition=\"center\",borderRadius=0,opacity=1,border,shadow,width=\"100%\",height=\"100%\",transition=0,storageKey=\"theme-preference\",enableBorder=true}=props;const[isDarkMode,setIsDarkMode]=useState(false);useEffect(()=>{// Função para detectar o tema atual\nconst checkTheme=()=>{// Verifica localStorage (prioridade 1)\nconst stored=localStorage.getItem(storageKey);if(stored){setIsDarkMode(stored===\"dark\");return;}// Verifica atributo data-theme no HTML (prioridade 2)\nconst dataTheme=document.documentElement.getAttribute(\"data-theme\");if(dataTheme){setIsDarkMode(dataTheme===\"dark\");return;}// Verifica classe \"dark\" no HTML (prioridade 3)\nconst hasDarkClass=document.documentElement.classList.contains(\"dark\");if(hasDarkClass){setIsDarkMode(true);return;}// Fallback: usa preferência do sistema\nconst systemPrefersDark=window.matchMedia(\"(prefers-color-scheme: dark)\").matches;setIsDarkMode(systemPrefersDark);};// Verifica tema inicial\ncheckTheme();// Listener para evento customizado do ThemeToggle\nconst handleThemeChange=()=>{checkTheme();};// Listener para mudanças no localStorage (sync entre abas)\nconst handleStorageChange=e=>{if(e.key===storageKey){setIsDarkMode(e.newValue===\"dark\");}};// Registra listeners\nwindow.addEventListener(\"themeChange\",handleThemeChange);window.addEventListener(\"storage\",handleStorageChange);// Observa mudanças no atributo data-theme do document\nconst observer=new MutationObserver(mutations=>{mutations.forEach(mutation=>{if(mutation.type===\"attributes\"&&(mutation.attributeName===\"data-theme\"||mutation.attributeName===\"class\")){checkTheme();}});});observer.observe(document.documentElement,{attributes:true,attributeFilter:[\"data-theme\",\"class\"]});// Cleanup\nreturn()=>{window.removeEventListener(\"themeChange\",handleThemeChange);window.removeEventListener(\"storage\",handleStorageChange);observer.disconnect();};},[storageKey]);const currentImage=isDarkMode?darkImage:lightImage;const imageStyle={width,height,objectFit,objectPosition,borderRadius,opacity,transition:`opacity ${transition}s ease-in-out`,display:\"block\",...enableBorder&&border&&{borderTopWidth:border.borderTopWidth,borderRightWidth:border.borderRightWidth,borderBottomWidth:border.borderBottomWidth,borderLeftWidth:border.borderLeftWidth,borderStyle:border.borderStyle,borderColor:border.borderColor},...shadow&&{boxShadow:shadow}};return /*#__PURE__*/_jsx(\"img\",{src:currentImage,alt:alt,style:imageStyle,loading:\"lazy\"});}ThemeImageSync.defaultProps={lightImage:\"https://via.placeholder.com/600x400/ffffff/000000?text=Light+Mode\",darkImage:\"https://via.placeholder.com/600x400/000000/ffffff?text=Dark+Mode\",alt:\"Theme-aware image\",objectFit:\"cover\",objectPosition:\"center\",borderRadius:0,opacity:1,width:\"100%\",height:\"100%\",transition:0,storageKey:\"theme-preference\",enableBorder:true};addPropertyControls(ThemeImageSync,{lightImage:{type:ControlType.Image,title:\"Light Mode\",description:\"Imagem exibida quando o tema est\\xe1 em light mode\"},darkImage:{type:ControlType.Image,title:\"Dark Mode\",description:\"Imagem exibida quando o tema est\\xe1 em dark mode\"},alt:{type:ControlType.String,title:\"Alt Text\",description:\"Texto alternativo para acessibilidade\",defaultValue:\"Theme-aware image\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"cover\",\"contain\",\"fill\",\"none\",\"scale-down\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"None\",\"Scale Down\"],defaultValue:\"cover\",description:\"Como a imagem deve ser redimensionada\"},objectPosition:{type:ControlType.Enum,title:\"Position\",options:[\"center\",\"top\",\"bottom\",\"left\",\"right\",\"top left\",\"top right\",\"bottom left\",\"bottom right\"],optionTitles:[\"Center\",\"Top\",\"Bottom\",\"Left\",\"Right\",\"Top Left\",\"Top Right\",\"Bottom Left\",\"Bottom Right\"],defaultValue:\"center\",description:\"Ponto de \\xe2ncora da imagem (anchor point)\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",min:0,max:500,step:1,unit:\"px\",defaultValue:0,description:\"Arredondamento dos cantos\"},opacity:{type:ControlType.Number,title:\"Opacity\",min:0,max:1,step:.1,defaultValue:1,description:\"Transpar\\xeancia da imagem\"},enableBorder:{type:ControlType.Boolean,title:\"Enable Border\",description:\"Ativar/desativar borda\",defaultValue:true},border:{type:ControlType.Border,title:\"Border\",description:\"Borda da imagem\"},shadow:{type:ControlType.BoxShadow,title:\"Shadow\",description:\"Sombra da imagem\"},transition:{type:ControlType.Number,title:\"Transition\",min:0,max:2,step:.1,unit:\"s\",defaultValue:.3,description:\"Dura\\xe7\\xe3o da transi\\xe7\\xe3o entre imagens\"},storageKey:{type:ControlType.String,title:\"Storage Key\",description:\"Chave do localStorage (deve ser igual ao ThemeToggle)\",defaultValue:\"theme-preference\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ThemeImageSync\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicHeight\":\"200\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThemeImageSync.map"],"mappings":"0LAUG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,aAAW,oEAAoE,YAAU,mEA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