// app.jsx
// Top-level wiring: TweaksPanel + DesignCanvas with desktop + mobile artboards.
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"headline": 0,
"heroLayout": "mockup",
"ctaColor": "cyan",
"density": "regular",
"sectionOrder": "explain-first",
"dosStyle": "light"
}/*EDITMODE-END*/;
const HEADLINE_LABELS = [
"De pequeña a empresa sólida.",
"Ordena tu negocio. Crece sin miedo.",
"Tu empresa, lista para crecer en serio.",
"Profesionaliza sin perder tu esencia.",
];
function App() {
const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
// DCSection filters children by `c.type === DCArtboard`, so DCArtboard
// MUST be a direct child — we can't wrap it in a custom component.
// Heights are measured live via AutoSize (inside the artboard) so density
// / section-order / hero-layout changes never crop the footer.
const [desktopH, setDesktopH] = React.useState(4400);
const [mobileH, setMobileH] = React.useState(5600);
return (
<>
({ value: i, label: l }))}
onChange={(v) => setTweak("headline", Number(v))}
/>
setTweak("heroLayout", v)}
/>
setTweak("ctaColor", v)}
/>
setTweak("density", v)}
/>
setTweak("sectionOrder", v)}
/>
setTweak("dosStyle", v)}
/>
>
);
}
// ── Auto-sizing helper ───────────────────────────────────────────
// Renders children at a fixed width and reports back the measured height,
// so the wrapping can grow with density / section-order tweaks
// (the artboard card has overflow:hidden, so undersizing crops the footer).
function AutoSize({ width, children, onHeight }) {
const ref = React.useRef(null);
const lastH = React.useRef(0);
React.useLayoutEffect(() => {
if (!ref.current) return;
const ro = new ResizeObserver((entries) => {
for (const e of entries) {
const next = Math.ceil(e.contentRect.height);
if (next > 0 && Math.abs(next - lastH.current) > 1) {
lastH.current = next;
onHeight(next);
}
}
});
ro.observe(ref.current);
return () => ro.disconnect();
}, [onHeight]);
return (
{children}
);
}
// ── Boot ─────────────────────────────────────────────────────────
ReactDOM.createRoot(document.getElementById("root")).render();