From 2dcc2b4d216ad1f19597d261b54f84bf96783396 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 14 Jul 2026 12:12:01 -0700 Subject: [PATCH] fix(site-builder): entrance-animation reveal script survives Preview + well-formed void-tag attrs + no-JS fallback Co-Authored-By: Claude Opus 4.8 (1M context) --- craft/src/panels/topbar/TopBar.tsx | 16 +++- craft/src/utils/html-export.test.ts | 142 +++++++++++++++++++++++++++- craft/src/utils/html-export.ts | 44 ++++++++- 3 files changed, 195 insertions(+), 7 deletions(-) diff --git a/craft/src/panels/topbar/TopBar.tsx b/craft/src/panels/topbar/TopBar.tsx index 5a01082..ceac12f 100644 --- a/craft/src/panels/topbar/TopBar.tsx +++ b/craft/src/panels/topbar/TopBar.tsx @@ -133,7 +133,7 @@ export const TopBar: React.FC = ({ device, onDeviceChange, showGuid const handlePreview = useCallback(() => { try { const serialized = query.serialize(); - import('../../utils/html-export').then(({ exportToHtml, exportBodyHtml }) => { + import('../../utils/html-export').then(({ exportToHtml, exportBodyHtml, buildAnimationScript }) => { // Get header HTML let headerHtml = ''; try { @@ -154,8 +154,18 @@ export const TopBar: React.FC = ({ device, onDeviceChange, showGuid } } catch (e) { console.warn('Footer export failed:', e); } - // Compose full page: header + body + footer - const composedBody = headerHtml + bodyHtml + footerHtml; + // Compose full page: header + body + footer. `handlePreview` below + // replaces the ENTIRE wrapped-doc `` inner (including the + // in-body reveal ``; +// No-JS safety net (contract "No-JS safety"): un-hides animated elements +// when JS is disabled, so `[data-animation]{opacity:0}` never permanently +// hides content that the reveal script would otherwise never run for. +const ANIMATION_NOSCRIPT = ``; + +/** + * Returns the reveal `