Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(layout): reserve the injected header and the marketplace hero so the page below them stops jumping
nirholasadb63bc66ed2
diff --git a/pages/marketplace.html b/pages/marketplace.htmlindex 61f197107..f61c0c05e 100644--- a/pages/marketplace.html+++ b/pages/marketplace.html@@ -3211,7 +3211,12 @@anchor for the page identity. --><h1 class="market-visually-hidden" data-i18n="marketplace.agent_marketplace">Agent Marketplace</h1><!-- Weekly curated theme strip (loads from /api/marketplace/theme) -->- <aside class="market-theme-strip" id="market-theme-strip" hidden>+ <!-- Also not `hidden`: renderThemeSkeleton() in src/marketplace.js+ exists to keep this strip from popping in late, but it cannot run+ until the bundle does. Shipping the same shimmer in the markup is+ what actually holds the box from the first frame; hideThemeStrip()+ collapses it on an empty week. -->+ <aside class="market-theme-strip" id="market-theme-strip" aria-busy="true"><div class="market-theme-head"><span class="market-theme-eyebrow" data-i18n="marketplace.this_week">This week</span><strong class="market-theme-title" id="market-theme-title">—</strong>@@ -3225,14 +3230,29 @@id="market-theme-picks"role="list"aria-label="Top picks this week"- hidden- ></div>+ >+ <div class="market-theme-pick is-skeleton" aria-hidden="true"><div class="market-theme-pick-stage"></div><div class="market-theme-pick-meta"><span class="market-theme-pick-name"> </span><span class="market-theme-pick-cat"> </span></div></div>+ <div class="market-theme-pick is-skeleton" aria-hidden="true"><div class="market-theme-pick-stage"></div><div class="market-theme-pick-meta"><span class="market-theme-pick-name"> </span><span class="market-theme-pick-cat"> </span></div></div>+ <div class="market-theme-pick is-skeleton" aria-hidden="true"><div class="market-theme-pick-stage"></div><div class="market-theme-pick-meta"><span class="market-theme-pick-name"> </span><span class="market-theme-pick-cat"> </span></div></div>+ <div class="market-theme-pick is-skeleton" aria-hidden="true"><div class="market-theme-pick-stage"></div><div class="market-theme-pick-meta"><span class="market-theme-pick-name"> </span><span class="market-theme-pick-cat"> </span></div></div>+ <div class="market-theme-pick is-skeleton" aria-hidden="true"><div class="market-theme-pick-stage"></div><div class="market-theme-pick-meta"><span class="market-theme-pick-name"> </span><span class="market-theme-pick-cat"> </span></div></div>+ <div class="market-theme-pick is-skeleton" aria-hidden="true"><div class="market-theme-pick-stage"></div><div class="market-theme-pick-meta"><span class="market-theme-pick-name"> </span><span class="market-theme-pick-cat"> </span></div></div>+ </div></aside><!-- Live 3D hero carousel -->+ <!-- Not `hidden`. The hero used to appear only once the bundle had+ fetched the featured avatars, which dropped everything below it+ (Top Performers, the whole grid) by the hero's height: the+ largest of the five layout shifts that made up this page's 0.60+ CLS. The stage carries its own designed backdrop and a 240px+ min-height, so an un-filled hero reads as loading and occupies+ exactly the box the filled one will. renderHero() still hides+ the section outright on the genuinely-empty case. Same+ reasoning as the podium skeleton further down. --><sectionclass="market-hero"id="market-hero"- hidden+ aria-busy="true"aria-label="Featured 3D avatars"><div class="market-hero-stage" id="market-hero-stage"></div>diff --git a/public/nav.css b/public/nav.cssindex 01da7a3d4..82ffbfe4f 100644--- a/public/nav.css+++ b/public/nav.css@@ -11,12 +11,11 @@palette when a host page doesn't define them.───────────────────────────────────────────────────────────────────────── */-/* Reserve the header's height before nav.js injects it so pages (notably the- homepage hero) don't shift down when the nav arrives. */-#nav-container:empty { min-height: 69px; }-@media (max-width: 880px) {- #nav-container:empty { min-height: 65px; }-}+/* The header-height reservation that keeps a page from shifting when nav.js+ injects the header lives in tokens.css, not here: nav.css is injected by+ nav.js itself, so it always arrives too late to reserve anything on a page+ that does not also link it in <head>. See "Injected-nav height reservation"+ in public/tokens.css. */.nav,.nav-drawer {diff --git a/public/tokens.css b/public/tokens.cssindex f2e556087..89a6e0a01 100644--- a/public/tokens.css+++ b/public/tokens.css@@ -269,6 +269,22 @@before first paint so there is no flash. See [data-theme='light'] below. */color-scheme: dark;}+/* ── Injected-nav height reservation ──────────────────────────────────────+ nav.js renders the shared header into an empty `<div id="nav-container">`+ after the page has already painted, and it injects nav.css at the same+ time. A page whose only render-blocking stylesheet is style.css therefore+ painted with a zero-height container and then dropped its whole <main> by+ the header's height the moment the nav landed: one 0.83 layout shift, which+ was the entire measured CLS on /forge. tokens.css is imported by BOTH+ style.css and nav.css, so putting the reservation here reaches every+ surface, render-blocking, before the first paint. `:empty` stops matching as+ soon as the header is in, so the real header owns its height from then on.+ Keep these two heights equal to the rendered `.nav` height in nav.css. */+#nav-container:empty { min-height: 69px; }+@media (max-width: 880px) {+ #nav-container:empty { min-height: 65px; }+}+/* ════════════════════════════════════════════════════════════════════════════* INTERACTIVE-STATE FLOOR (B14)diff --git a/src/marketplace.js b/src/marketplace.jsindex 9bf1bf919..d884e73b3 100644--- a/src/marketplace.js+++ b/src/marketplace.js@@ -7,6 +7,7 @@*/+import { attendRotation } from './shared/attended-rotation.js';import {renderDetailAvatar,renderDetailModelStage,@@ -741,7 +742,10 @@ function hideThemeStrip() {picks.innerHTML = '';picks.hidden = true;}- if (strip) strip.hidden = true;+ if (strip) {+ strip.hidden = true;+ strip.removeAttribute('aria-busy');+ }}// Show the strip with a shimmer immediately so the top of the page never pops@@ -786,6 +790,9 @@ function renderTheme() {}renderThemePicks();strip.hidden = false;+ // Real lineup in place: the markup's shimmer, which held this box from the+ // first frame, is done.+ strip.removeAttribute('aria-busy');}// Render the randomized 3D lineup. Every agent here is guaranteed (by the API)@@ -1019,9 +1026,13 @@ function renderHero() {if (!hero) return;if (!state.featured.length) {hero.hidden = true;+ hero.removeAttribute('aria-busy');return;}hero.hidden = false;+ // The markup ships the hero in place and busy so the page below it never+ // shifts; it stops being busy the moment it holds real slides.+ hero.removeAttribute('aria-busy');const stage = $('market-hero-stage');const dots = $('market-hero-dots');stage.innerHTML = state.featured@@ -1541,7 +1552,18 @@ function observeCardModelViewers() {mv.setAttribute('src', mv.dataset.src);delete mv.dataset.src;}- if (mv.dataset.shouldRotate !== '0') mv.setAttribute('auto-rotate', '');+ if (mv.dataset.shouldRotate !== '0') {+ mv.setAttribute('auto-rotate', '');+ // Stopping off-screen was not enough. A grid of on-screen cards+ // all rotating at once never stops, and model-viewer blits every+ // element's pixels every frame: 27 s of scripting in a 40 s+ // desktop run, and the page never became interactive. Each card+ // now turns when it arrives, settles, and turns again on hover+ // or focus. attendRotation takes over this element's rotation+ // from here (its own observer), so the branch below only has to+ // handle a card that never qualified.+ attendRotation(mv);+ }} else {// Suspend rotation off-screen so model-viewer halts its raf loop.mv.removeAttribute('auto-rotate');