/* global React, ReactDOM, TweaksPanel, useTweaks, TweakSection, TweakSlider, TweakButton */ const { useEffect, useState } = React; // Defaults — bloco persistente para o host gravar const TWEAK_DEFAULS = /*EDITMODE-BEGIN*/{ // ── DESKTOP ── "d_section_pad_y": 56, "d_hero_pad_top": 96, "d_hero_pad_bottom": 48, "d_hero_grid_gap": 56, "d_hero_media_gap": 14, "d_hero_buy_gap": 22, "d_bene_gap": 20, "d_aut_gap": 64, "d_r10_gap": 32, "d_r10_head_mb": 44, "d_founder_grid_gap": 14, "d_founder_head_mb": 32, "d_reviews_pad_y": 64, "d_reviews_head_mb": 36, "d_footer_pad_top": 56, "d_footer_pad_bottom": 32, // ── MOBILE ── "m_section_pad_y": 48, "m_hero_pad_top": 72, "m_hero_pad_bottom": 24, "m_hero_grid_gap": 18, "m_hero_media_gap": 6, "m_hero_buy_gap": 18, "m_bene_gap": 14, "m_aut_gap": 36, "m_r10_gap": 20, "m_r10_head_mb": 32, "m_founder_grid_gap": 14, "m_founder_head_mb": 24, "m_reviews_pad_y": 48, "m_reviews_head_mb": 24, "m_footer_pad_top": 40, "m_footer_pad_bottom": 24 }/*EDITMODE-END*/; // ───────────────────────────────────────────── // Mobile Preview Frame — abre a própria página dentro // de um iframe de 390px de largura, sobreposto à página // ───────────────────────────────────────────── function MobilePreviewFrame({ open, onClose, cssText }){ const iframeRef = React.useRef(null); // Sempre que cssText muda, manda pro iframe useEffect(() => { if (!open) return; const iframe = iframeRef.current; if (!iframe) return; function injectCss(){ try { const doc = iframe.contentDocument; if (!doc) return; let s = doc.getElementById('spacing-tweaks-style'); if (!s){ s = doc.createElement('style'); s.id = 'spacing-tweaks-style'; doc.head.appendChild(s); } s.textContent = cssText; // marca o iframe como mobile-preview pra esconder o gate de senha doc.documentElement.classList.add('mobile-preview-iframe'); } catch(_){} } if (iframe.contentDocument && iframe.contentDocument.readyState === 'complete'){ injectCss(); } iframe.addEventListener('load', injectCss); return () => iframe.removeEventListener('load', injectCss); }, [open, cssText]); if (!open) return null; return (
e.stopPropagation()}>