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
feat(x402-studio): grow the studio flow and marketplace entry points across the funnel pages
nirholase96b78db08e4
diff --git a/pages/create.html b/pages/create.htmlindex 3f9350fc2..12da447e8 100644--- a/pages/create.html+++ b/pages/create.html@@ -1137,6 +1137,10 @@}}</style>+ <!-- Deferred, and placed BEFORE the model-viewer module: defer scripts and+ module scripts execute in document order, so the meshopt shim still+ registers its decoder before model-viewer's define runs. -->+ <script src="/model-viewer-meshopt.js" defer></script><scripttype="module"src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"@@ -1175,7 +1179,6 @@<meta property="og:locale" content="en_US"><meta property="og:image:alt" content="Create — three.ws"><meta name="twitter:site" content="@trythreews">- <script src="/model-viewer-meshopt.js"></script></head><body><div id="page-loading" aria-hidden="true">@@ -1186,7 +1189,7 @@<header><div id="nav-container"></div></header>- <script src="/nav.js"></script>+ <script src="/nav.js" defer></script><!-- Bundled source module (src/shared/crypto-optional.js); self-mounts onthe [data-crypto-optional] element below. --><script type="module" src="/src/shared/crypto-optional.js"></script>@@ -1771,7 +1774,7 @@</script><script src="/brand.js" defer></script><div id="footer-container"></div>- <script src="/footer.js"></script>+ <script src="/footer.js" defer></script><!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. --><script type="module" src="/i18n.js"></script></body>diff --git a/pages/forge.html b/pages/forge.htmlindex a58712d6b..a41179e56 100644--- a/pages/forge.html+++ b/pages/forge.html@@ -37,6 +37,10 @@<link rel="manifest" href="/manifest.webmanifest" /><link rel="stylesheet" href="/style.css" /><link rel="preconnect" href="https://ajax.googleapis.com" />+ <!-- Deferred, and placed BEFORE the model-viewer module: defer scripts and+ module scripts execute in document order, so the meshopt shim still+ registers its decoder before model-viewer's define runs. -->+ <script src="/model-viewer-meshopt.js" defer></script><scripttype="module"src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"@@ -3335,7 +3339,6 @@<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1"><meta property="og:locale" content="en_US"><meta property="og:image:alt" content="Forge — Text & Image to 3D — three.ws">- <script src="/model-viewer-meshopt.js"></script></head><body class="forge-page"><div id="nav-container"></div>@@ -4208,7 +4211,7 @@<script type="module" src="/src/forge-more-like-this.js"></script><script type="module" src="/src/forge-wait.js"></script><div id="footer-container"></div>- <script src="/footer.js"></script>+ <script src="/footer.js" defer></script><!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. --><script type="module" src="/i18n.js"></script></body>diff --git a/pages/home.html b/pages/home.htmlindex 9c23f5f1c..b213c573b 100644--- a/pages/home.html+++ b/pages/home.html@@ -50,13 +50,16 @@<link rel="stylesheet" href="/economy-ticker.css" /><link rel="stylesheet" href="/home.css" /><noscript><style>.reveal{opacity:1!important;transform:none!important}.hero-text>*{opacity:1!important;transform:none!important}</style></noscript>+ <!-- Deferred, and placed BEFORE the agent-3d module: defer scripts and module+ scripts execute in document order, so the meshopt shim still registers its+ decoder before any model-viewer/agent-3d define runs. -->+ <script src="/model-viewer-meshopt.js" defer></script><script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://three.ws/#organization","name":"three.ws","url":"https://three.ws","logo":"https://three.ws/og-image.png","description":"three.ws is the AI-agent layer for the open web: build, embed, monetize, and trade autonomous agents with real 3D avatars, on-chain identity (ERC-8004), pay-per-call (x402), and pump.fun token launches.","sameAs":["https://x.com/trythreews","https://github.com/nirholas/three.ws","https://www.coingecko.com/en/coins/three-ws","https://www.npmjs.com/package/three.ws","https://registry.modelcontextprotocol.io/?q=threews","https://coinmarketcap.com/community/profile/three_ws","https://hackernoon.com/u/three-ws","https://t.me/three_ws"]},{"@type":"WebSite","@id":"https://three.ws/#website","name":"three.ws","url":"https://three.ws","description":"Give your AI a body.","publisher":{"@id":"https://three.ws/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://three.ws/discover?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}</script><meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1"><meta property="og:locale" content="en_US">- <script src="/model-viewer-meshopt.js"></script></head><body>diff --git a/pages/marketplace.html b/pages/marketplace.htmlindex a506de40a..7e7bcb46c 100644--- a/pages/marketplace.html+++ b/pages/marketplace.html@@ -3096,13 +3096,16 @@data-i18n-attr="content:marketplace.meta_twitter_description"/><meta name="twitter:image" content="https://three.ws/api/page-og?s=main&t=Marketplace&d=Buy+access+to+agents%2C+skills%2C+and+avatars+from+other+creators.&p=%2Fmarketplace" />+ <!-- Deferred, and placed BEFORE the model-viewer module: defer scripts and+ module scripts execute in document order, so the meshopt shim still+ registers its decoder before model-viewer's define runs. -->+ <script src="/model-viewer-meshopt.js" defer></script><scripttype="module"src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"integrity="sha384-sr9b4Ux0WhAUGclJ0ym0FSY2zSOMmNSn0bP/SA0e6bNCrpn/5W3QL8mm+LdlQMKw"crossorigin="anonymous"></script>- <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script><link rel="stylesheet" href="/nav.css" /><link rel="stylesheet" href="/footer.css" /><link rel="stylesheet" href="/mobile.css" />@@ -3124,12 +3127,11 @@<meta property="og:locale" content="en_US"><meta property="og:image:alt" content="Marketplace — three.ws"><meta name="twitter:site" content="@trythreews">- <script src="/model-viewer-meshopt.js"></script></head><body class="market-page"><a class="skip-link" href="#main-content" data-i18n="marketplace.skip_to_content">Skip to content</a><div id="nav-container"></div>- <script src="/nav.js"></script>+ <script src="/nav.js" defer></script><aside class="market-sidebar" id="market-sidebar"><a href="/" class="market-logo">@@ -5052,7 +5054,7 @@</div><div id="footer-container"></div>- <script src="/footer.js"></script>+ <script src="/footer.js" defer></script><script src="/brand.js" defer></script><!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. --><script type="module" src="/i18n.js"></script>diff --git a/public/discover/index.html b/public/discover/index.htmlindex 05886dc0b..cd1af37c3 100644--- a/public/discover/index.html+++ b/public/discover/index.html@@ -31,6 +31,10 @@<link rel="stylesheet" href="/style.css" /><link rel="stylesheet" href="/nav.css" /><link rel="stylesheet" href="/fonts/fonts.css" />+ <!-- Deferred, and placed BEFORE the model-viewer module: defer scripts and+ module scripts execute in document order, so the meshopt shim still+ registers its decoder before model-viewer's define runs. -->+ <script src="/model-viewer-meshopt.js" defer></script><scripttype="module"src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js" integrity="sha384-sr9b4Ux0WhAUGclJ0ym0FSY2zSOMmNSn0bP/SA0e6bNCrpn/5W3QL8mm+LdlQMKw" crossorigin="anonymous"@@ -56,13 +60,12 @@<meta property="og:locale" content="en_US"><meta property="og:image:alt" content="Discover — three.ws"><meta name="twitter:site" content="@trythreews">- <script src="/model-viewer-meshopt.js"></script></head><body class="features-page explore-page"><header><div id="nav-container"></div></header>- <script src="/nav.js"></script>+ <script src="/nav.js" defer></script><main class="features-main explore-main"><section class="explore-hero">diff --git a/public/x402-stripe.html b/public/x402-stripe.htmlindex aa1a69aa7..044bf48a1 100644--- a/public/x402-stripe.html+++ b/public/x402-stripe.html@@ -158,7 +158,11 @@background: var(--border); border: 1px solid var(--border); border-radius: 14px;overflow: hidden; margin-top: 40px;}- @media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }+ @media (max-width: 720px) {+ .stats { grid-template-columns: repeat(2, 1fr); }+ /* Five stats in two columns leave a dead cell; let the last one fill it. */+ .stats .stat:last-child { grid-column: 1 / -1; }+ }.stat { background: var(--panel); padding: 16px 18px; }.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); margin-bottom: 7px; }.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }@@ -380,6 +384,11 @@.tabs button:hover { color: var(--text); }.tabs button.active { color: var(--text); border-bottom-color: var(--accent-blue); }.codeblock { background: var(--code-bg); border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: #c8ccd4; white-space: pre; overflow-x: auto; position: relative; }+ /* The floating Copy button would sit on top of the first line of code, and+ the drawer is never wide enough for that line to clear it. Reserve a row+ for the button rather than letting code scroll underneath it. */+ .codeblock { padding-top: 42px; }+ @media (max-width: 640px) { .snippet { padding-top: 42px; } }.result { margin-top: 16px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; font-size: 12.5px; display: none; }.result.show { display: block; animation: rise 0.3s var(--ease); }@@ -565,7 +574,7 @@<!-- Detail drawer --><div class="overlay" id="drawerOverlay"></div>-<aside class="drawer" id="drawer" role="dialog" aria-modal="true" aria-labelledby="drawerTitle"></aside>+<aside class="drawer" id="drawer" role="dialog" aria-modal="true" aria-labelledby="drawerTitle" inert></aside><div class="toast" id="toast">copied</div>@@ -784,6 +793,7 @@}function skeletonGrid() {+ $('#grid').style.display = 'grid';$('#grid').innerHTML = Array.from({ length: 8 }).map(() =>`<div class="card sk-card"><div class="top"><div class="l" style="width:60px"></div><div class="l" style="width:44px"></div></div><div class="l" style="width:70%;height:16px"></div><div class="l" style="width:100%"></div><div class="l" style="width:90%"></div><div class="l" style="width:40%"></div></div>`).join('');@@ -820,7 +830,10 @@const url = 'https://three.ws' + item.path;const fields = item.method === 'GET' ? item.params : item.bodyProps;const sample = {};- fields.forEach((f) => { if (f.required || f.default != null) sample[f.name] = f.default != null ? f.default : (f.example != null ? f.example : (f.enum ? f.enum[0] : (f.type === 'string' ? '…' : 0))); });+ // An ASCII placeholder, not a typographic ellipsis: the sample values get+ // URL-encoded into the query string and "%E2%80%A6" tells a reader nothing.+ const placeholder = (f) => (f.type === 'string' ? 'YOUR_' + String(f.name).replace(/[^A-Za-z0-9]+/g, '_').toUpperCase() : 0);+ fields.forEach((f) => { if (f.required || f.default != null) sample[f.name] = f.default != null ? f.default : (f.example != null ? f.example : (f.enum ? f.enum[0] : placeholder(f))); });if (lang === 'js') {return `// Load once: <script type="module" src="https://three.ws/x402.js">\nconst { result, payment } = await window.X402.pay({\n endpoint: '${item.path}',\n method: '${item.method}',${item.method === 'POST' ? `\n body: ${JSON.stringify(sample, null, 2).split('\n').join('\n ')},` : Object.keys(sample).length ? `\n // query: ${new URLSearchParams(sample).toString()}` : ''}\n});\nconsole.log(result, payment.transaction);`;}@@ -1023,12 +1036,36 @@}// ── Copy + toast ─────────────────────────────────────────────────────────+ // navigator.clipboard is unavailable on insecure origins and can be denied by+ // permission policy, so fall back to a selection copy before giving up. The+ // button label is always restored, whichever branch ran.+ function legacyCopy(text) {+ const ta = document.createElement('textarea');+ ta.value = text || '';+ ta.setAttribute('readonly', '');+ ta.style.cssText = 'position:fixed;top:0;left:-9999px;opacity:0';+ document.body.appendChild(ta);+ ta.select();+ let ok = false;+ try { ok = document.execCommand('copy'); } catch (e) { ok = false; }+ ta.remove();+ return ok;+ }async function copyText(text, btn) {+ let ok = false;try {- await navigator.clipboard.writeText(text || '');- if (btn) { const o = btn.textContent; btn.textContent = '✓ Copied'; btn.classList.add('copied'); setTimeout(() => { btn.textContent = o; btn.classList.remove('copied'); }, 1600); }- toast('Copied to clipboard');- } catch (e) { if (btn) btn.textContent = 'copy failed'; }+ if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(text || ''); ok = true; }+ } catch (e) { ok = false; }+ if (!ok) ok = legacyCopy(text);+ if (btn) {+ const label = btn.dataset.label || btn.textContent;+ btn.dataset.label = label;+ btn.textContent = ok ? '✓ Copied' : 'Copy failed';+ btn.classList.toggle('copied', ok);+ clearTimeout(btn._copyT);+ btn._copyT = setTimeout(() => { btn.textContent = label; btn.classList.remove('copied'); }, 1600);+ }+ toast(ok ? 'Copied to clipboard' : 'Copy blocked by the browser, select the text and copy it manually');}let toastT;function toast(msg) { const t = $('#toast'); t.textContent = msg; t.classList.add('show'); clearTimeout(toastT); toastT = setTimeout(() => t.classList.remove('show'), 1700); }@@ -1046,8 +1083,12 @@$('#sortSelect').addEventListener('change', (e) => { state.sort = e.target.value; renderGrid(); });$$('.copy-btn[data-copy]').forEach((btn) => btn.addEventListener('click', () => copyText($('#' + btn.dataset.copy).textContent, btn)));const nav = $('#nav'); const onScroll = () => nav.classList.toggle('scrolled', window.scrollY > 8); onScroll(); window.addEventListener('scroll', onScroll, { passive: true });+ window.addEventListener('hashchange', openFromHash);document.addEventListener('keydown', (e) => {+ // The x402 checkout modal owns the keyboard while it is up: Escape must+ // dismiss the payment, not the drawer holding its result behind it.+ if ($('.x402-overlay.x402-open')) return;const palOpen = $('#palette').classList.contains('show');const drawerOpen = $('#drawer').classList.contains('show');if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') { e.preventDefault(); palOpen ? closePalette() : openPalette(); return; }@@ -1061,10 +1102,13 @@});}+ // `#run=<path>` deep links open the drawer. Also fires on hashchange so a+ // shared link clicked from inside the page works, not just a cold load.function openFromHash() {const m = /#run=([^&]+)/.exec(location.hash);if (!m) return;- const path = decodeURIComponent(m[1]);+ let path;+ try { path = decodeURIComponent(m[1]); } catch (e) { return; }const item = CATALOG.find((c) => c.path === path);if (item) openDrawer(item.id);}@@ -1076,6 +1120,7 @@STATS = stats.status === 'fulfilled' ? stats.value : null;if (cat.status !== 'fulfilled' || !cat.value.length) { renderStats(); catalogError(); return; }CATALOG = cat.value;+ indexCalls();renderStats(); renderChips(); renderGrid(); openFromHash();}diff --git a/public/x402/studio.html b/public/x402/studio.htmlindex 4852a64fa..e69ab0e0e 100644--- a/public/x402/studio.html+++ b/public/x402/studio.html@@ -1,12 +1,12 @@<!doctype html><html lang="en"><head>-<script>/* three.ws theme boot — no-flash */(function(){try{var t=localStorage.getItem('theme');if(t==='light')document.documentElement.dataset.theme='light';}catch(e){}})();</script>+<script>/* three.ws theme boot: no-flash */(function(){try{var t=localStorage.getItem('theme');if(t==='light')document.documentElement.dataset.theme='light';}catch(e){}})();</script><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title data-i18n="x402_studio.meta_title">x402 Studio · three.ws</title>-<meta name="description" content="The Stripe of x402. Configure prices, payout and agent wallets, products, security, CORS, charity and round-up giving — and publish a drag-and-drop storefront. All settled on-chain in USDC." data-i18n-attr="content:x402_studio.meta_description"/>-<meta property="og:title" content="x402 Studio — the Stripe of x402" data-i18n-attr="content:x402_studio.meta_og_title"/>+<meta name="description" content="The Stripe of x402. Configure prices, payout and agent wallets, products, security, CORS, charity and round-up giving, and publish a drag-and-drop storefront. All settled on-chain in USDC." data-i18n-attr="content:x402_studio.meta_description"/>+<meta property="og:title" content="x402 Studio: the Stripe of x402" data-i18n-attr="content:x402_studio.meta_og_title"/><meta property="og:description" content="Run a paid x402 business: agent wallets, products, a drag-and-drop storefront, charity + round-up giving. On-chain USDC settlement." data-i18n-attr="content:x402_studio.meta_og_description"/><meta property="og:type" content="website" /><link rel="icon" href="/favicon.ico" />@@ -28,6 +28,13 @@ body {a { color: inherit; text-decoration: none; }h1,h2,h3,h4 { font-family: var(--font-display); margin: 0; color: var(--ink-bright); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }button { font-family: inherit; }+/* One explicit keyboard focus ring for every control, so the indicator never+ depends on a UA default that a background or border rule can swallow. */+:where(a, button, input, select, textarea, [tabindex]):focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ border-radius: var(--radius-sm, 6px);+}::-webkit-scrollbar { width: 10px; height: 10px; }::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 99px; }@@ -88,7 +95,8 @@ button { font-family: inherit; }.row { display: flex; gap: var(--space-3); flex-wrap: wrap; }.grid { display: grid; gap: var(--space-3); }.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-3); }-.field label { font-size: var(--text-sm); color: var(--ink-dim); font-weight: 500; }+.field > .flab { font-size: var(--text-sm); color: var(--ink-dim); font-weight: 500; }+.field > label.flab { cursor: pointer; }.field .hint { font-size: var(--text-2xs); color: var(--ink-faint); }input, select, textarea {width: 100%; padding: 9px 11px; background: var(--bg-1); color: var(--ink-bright);@@ -134,10 +142,16 @@ tr:last-child td { border-bottom: 0; }.empty { text-align: center; padding: var(--space-7) var(--space-4); color: var(--ink-dim); }.empty .ico { font-size: 30px; opacity: .5; margin-bottom: 10px; }-.empty h3 { color: var(--ink); margin-bottom: 6px; }+.empty h1, .empty h3 { color: var(--ink); margin-bottom: 6px; }+.empty .row { justify-content: center; }.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--stroke); border-radius: var(--radius-md); background: var(--surface-1); }.list-item + .list-item { margin-top: 8px; }+/* The setup checklist rows are <button>s, so they need the element reset a div+ never did: full width, inherited type, left-aligned text. */+.list-item.step { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }+.list-item.step:hover { background: var(--surface-2); border-color: var(--stroke-strong); }+.list-item .meta .t, .list-item .meta .s { display: block; }.list-item .avatar { width: 38px; height: 38px; border-radius: var(--radius-md); display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; overflow: hidden; }.list-item .avatar img { width: 100%; height: 100%; object-fit: cover; }.list-item .meta { min-width: 0; flex: 1; }@@ -200,16 +214,33 @@ tr:last-child td { border-bottom: 0; }.banner { display: flex; gap: 10px; align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--stroke); background: var(--surface-1); font-size: var(--text-md); color: var(--ink-dim); margin-bottom: var(--space-4); }.banner.warn { border-color: color-mix(in oklab, var(--warn) 40%, transparent); background: color-mix(in oklab, var(--warn) 10%, transparent); }.banner .ic { flex: none; }-.section-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }+/* Wraps rather than crushing the description into a one-word column when the+ header and its action button cannot share a line (phone widths). */+.section-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }+.section-head > div:first-child { flex: 1 1 260px; min-width: 0; }.section-head .spacer { margin-left: auto; }+@media (max-width: 560px) {+ .section-head .spacer { display: none; }+ .section-head > .btn { flex: 1 1 100%; justify-content: center; }+}@media (max-width: 860px) {.app { grid-template-columns: 1fr; }- .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px; }- .side .brand, .side .foot { display: none; }- .nav { flex-direction: row; gap: 4px; }+ /* min-width:0 is load-bearing: a grid item defaults to min-width:auto, so the+ tab strip's intrinsic width would stretch the whole shell past the+ viewport and clip every card to its right. */+ .side { position: static; height: auto; align-items: stretch; padding: 8px; min-width: 0; }+ .side .brand { display: none; }+ /* The rail collapses to a scrolling tab strip, but its two outbound links+ stay on the page: hiding them made /x402 and the classic dashboard+ unreachable from a phone. */+ .side .foot { margin-top: 6px; padding: 0 8px 2px; }+ .nav { flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }+ .nav::-webkit-scrollbar { display: none; }.nav .sep { display: none; }- .nav button { white-space: nowrap; }+ .nav button { white-space: nowrap; width: auto; }+ .topbar { padding: 12px var(--space-4); }+ .content { padding: var(--space-4); }}</style>@@ -222,19 +253,19 @@ tr:last-child td { border-bottom: 0; }<meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta property="og:image:type" content="image/png">- <meta property="og:image:alt" content="x402 Studio — the Stripe of x402 — three.ws">+ <meta property="og:image:alt" content="x402 Studio: the Stripe of x402 - three.ws"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:site" content="@trythreews">- <meta name="twitter:title" content="x402 Studio — the Stripe of x402 · three.ws" data-i18n-attr="content:x402_studio.meta_twitter_title">+ <meta name="twitter:title" content="x402 Studio: the Stripe of x402 · three.ws" data-i18n-attr="content:x402_studio.meta_twitter_title"><meta name="twitter:description" content="Merchant console to run a paid x402 business: products and pricing, payout and agent wallets, a real USDC send/receive with SNS .sol resolution, a drag-and-drop storefront, an embeddable pay-button builder, charity and round-up giving, CORS and security." data-i18n-attr="content:x402_studio.meta_twitter_description"><meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&t=x402+Studio%3A+the+Stripe+of+x402&d=Merchant+console+to+run+a+paid+x402+business%3A+products+and+pricing%2C+payout+and+agent+wallets%2C+a+real+USDC+send%2Freceive+with+SNS+.sol+resolution%2C+a&p=%2Fx402%2Fstudio">- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"x402 Studio — the Stripe of x402","description":"Merchant console to run a paid x402 business: products and pricing, payout and agent wallets, a real USDC send/receive with SNS .sol resolution, a drag-and-drop storefront, an embeddable pay-button builder, charity and round-up giving, CORS and security.","url":"https://three.ws/x402/studio","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=crypto&t=x402+Studio+%E2%80%94+the+Stripe+of+x402&d=Merchant+console+to+run+a+paid+x402+business%3A+products+and+pricing%2C+payout+and+agent+wallets%2C+a+real+USDC+send%2Freceive+with+SNS+.sol+resolution%2C+a+drag-and-drop&p=%2Fx402%2Fstudio"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"X402","item":"https://three.ws/x402"},{"@type":"ListItem","position":3,"name":"Studio","item":"https://three.ws/x402/studio"}]}]}</script>+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"x402 Studio: the Stripe of x402","description":"Merchant console to run a paid x402 business: products and pricing, payout and agent wallets, a real USDC send/receive with SNS .sol resolution, a drag-and-drop storefront, an embeddable pay-button builder, charity and round-up giving, CORS and security.","url":"https://three.ws/x402/studio","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=crypto&t=x402+Studio%3A+the+Stripe+of+x402&d=Merchant+console+to+run+a+paid+x402+business%3A+products+and+pricing%2C+payout+and+agent+wallets%2C+a+real+USDC+send%2Freceive+with+SNS+.sol+resolution%2C+a+drag-and-drop&p=%2Fx402%2Fstudio"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"X402","item":"https://three.ws/x402"},{"@type":"ListItem","position":3,"name":"Studio","item":"https://three.ws/x402/studio"}]}]}</script></head><body><div id="root"><div class="empty" style="min-height:100dvh;display:grid;place-content:center;"><div class="skeleton" style="width:220px;height:24px;margin:0 auto 12px"></div>- <div class="sub">Loading x402 Studio…</div>+ <h1 class="sub" style="font-size:var(--text-md);font-weight:500">Loading x402 Studio…</h1></div></div><div class="toasts" id="toasts"></div>diff --git a/public/x402/studio.js b/public/x402/studio.jsindex 47bced7bc..545a6cd2f 100644--- a/public/x402/studio.js+++ b/public/x402/studio.js@@ -277,7 +277,8 @@ function renderOverview(host) {),);- // Checklist of setup steps — each links to the relevant tab.+ // Checklist of setup steps. Each row is a real <button> so the keyboard can+ // reach it, not a click-handling <div>.const steps = [{ done: payoutSet, label: 'Add a payout wallet', tab: 'wallets', hint: 'Where settled USDC lands' },{ done: S.skus.length > 0, label: 'Create your first product', tab: 'products', hint: 'A paid endpoint or checkout link' },@@ -287,10 +288,10 @@ function renderOverview(host) {const checklist = el('div', { class: 'card' }, el('h2', {}, 'Get set up'), el('p', { class: 'sub' }, 'Four steps to a live x402 business.'));for (const st of steps) {checklist.append(- el('div', { class: 'list-item', style: 'cursor:pointer', onclick: () => go(st.tab) },- el('div', { class: 'avatar', style: `background:${st.done ? 'color-mix(in oklab,var(--success) 30%,transparent)' : 'var(--surface-3)'};color:${st.done ? 'var(--success)' : 'var(--ink-faint)'}` }, st.done ? '✓' : '○'),- el('div', { class: 'meta' }, el('div', { class: 't' }, st.label), el('div', { class: 's' }, st.hint)),- el('div', { class: 'acts' }, el('span', { class: `pill ${st.done ? 'ok' : ''}` }, st.done ? 'Done' : 'To do')),+ el('button', { class: 'list-item step', type: 'button', onclick: () => go(st.tab) },+ el('span', { class: 'avatar', 'aria-hidden': 'true', style: `background:${st.done ? 'color-mix(in oklab,var(--success) 30%,transparent)' : 'var(--surface-3)'};color:${st.done ? 'var(--success)' : 'var(--ink-faint)'}` }, st.done ? '✓' : '○'),+ el('span', { class: 'meta' }, el('span', { class: 't' }, st.label), el('span', { class: 's' }, st.hint)),+ el('span', { class: 'acts' }, el('span', { class: `pill ${st.done ? 'ok' : ''}` }, st.done ? 'Done' : 'To do')),),);}@@ -306,10 +307,12 @@ function renderOverview(host) {for (const s of [...S.skus].sort((a, b) => Number(b.gross_atomics || 0) - Number(a.gross_atomics || 0))) {tb.append(el('tr', {},el('td', {}, el('b', { style: 'color:var(--ink-bright)' }, s.merchant_name || s.slug), el('div', { class: 's', style: 'color:var(--ink-dim);font-size:var(--text-sm)' }, s.action_name || '')),- el('td', {}, el('span', { class: 'pill' }, s.price_network || '—')),+ el('td', {}, el('span', { class: 'pill' }, s.price_network || 'not set')),el('td', {}, String(s.paid_calls || 0)),el('td', {}, `$${fmtUsdc(s.gross_atomics)}`),- el('td', { style: 'text-align:right' }, el('a', { class: 'btn ghost sm', href: `/pay/c/${esc(s.slug)}`, target: '_blank' }, 'Open ↗')),+ // setAttribute already handles HTML escaping; esc() here would put a+ // literal & into the URL, so the slug is encoded, not escaped.+ el('td', { style: 'text-align:right' }, el('a', { class: 'btn ghost sm', href: `/pay/c/${encodeURIComponent(s.slug)}`, target: '_blank', rel: 'noopener' }, 'Open ↗')),));}table.append(tb);@@ -370,7 +373,7 @@ function productModal(sku = null) {const v = sku || { target_method: 'GET', accent_color: '#0a84ff', active: true };const body = el('div', {},field('Display name', input({ id: 'p_merchant', value: v.merchant_name || '', placeholder: 'Acme Summaries', maxlength: 80 }), 'Shown on the checkout header'),- field('Action label', input({ id: 'p_action', value: v.action_name || '', placeholder: 'Summarize article', maxlength: 80 }), 'The button text — what the buyer gets'),+ field('Action label', input({ id: 'p_action', value: v.action_name || '', placeholder: 'Summarize article', maxlength: 80 }), 'The button text: what the buyer gets'),field('URL slug', input({ id: 'p_slug', value: v.slug || '', placeholder: 'acme-summarize', maxlength: 64, ...(editing ? { disabled: true } : {}) }), editing ? 'Slug is permanent' : 'Lowercase, hyphenated. Becomes /pay/c/<slug>'),el('div', { class: 'cols-2' },field('Paid endpoint (returns 402)', input({ id: 'p_endpoint', value: v.target_endpoint || '', placeholder: 'https://api.acme.com/paid/x', type: 'url' })),@@ -424,7 +427,7 @@ async function saveProduct(editing, sku, close) {await api(`/api/x402-skus?id=${sku.id}`, { method: 'PATCH', body: patch });} else {patch.slug = $('#p_slug').value.trim();- if (!/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/.test(patch.slug)) throw new Error('Slug must be lowercase, hyphenated, 3–64 chars');+ if (!/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/.test(patch.slug)) throw new Error('Slug must be lowercase, hyphenated, 3 to 64 chars');await api('/api/x402-skus', { method: 'POST', body: patch });}const { skus } = await api('/api/x402-skus');@@ -455,7 +458,7 @@ function renderWallets(host) {const m = S.settings || {};host.innerHTML = '';- // Payout wallets — where settled funds land.+ // Payout wallets: where settled funds land.const payout = el('div', { class: 'card' },el('h2', {}, 'Payout wallets'),el('p', { class: 'sub' }, 'The most important setting on the platform: where settled USDC arrives. A wrong address sends real money to the wrong place.'),@@ -468,10 +471,10 @@ function renderWallets(host) {);host.append(payout);- // Agent wallets — the fleet that auto-pays / receives with per-wallet caps.+ // Agent wallets: the fleet that auto-pays / receives with per-wallet caps.const agentCard = el('div', { class: 'card' },el('div', { class: 'section-head' },- el('div', {}, el('h2', {}, 'Agent wallets'), el('p', { class: 'sub', style: 'margin:0' }, 'Named on-chain identities authorized to auto-pay (buyer) or receive (seller) on your behalf — each capped independently. The heart of an autonomous x402 business.')),+ el('div', {}, el('h2', {}, 'Agent wallets'), el('p', { class: 'sub', style: 'margin:0' }, 'Named on-chain identities authorized to auto-pay (buyer) or receive (seller) on your behalf, each capped independently. The heart of an autonomous x402 business.')),el('span', { class: 'spacer' }),el('button', { class: 'btn primary sm', onclick: () => agentWalletModal() }, '+ Add agent wallet'),),@@ -483,9 +486,11 @@ function renderWallets(host) {for (const w of wallets) {agentCard.append(el('div', { class: 'list-item' },- el('div', { class: 'avatar', style: `background:${w.role === 'payer' ? 'linear-gradient(135deg,#6366f1,#0a84ff)' : 'linear-gradient(135deg,#10b981,#059669)'}` }, w.role === 'payer' ? '↑' : '↓'),+ el('div', { class: 'avatar', 'aria-hidden': 'true', style: `background:${w.role === 'payer' ? 'linear-gradient(135deg,#6366f1,#0a84ff)' : 'linear-gradient(135deg,#10b981,#059669)'}` }, w.role === 'payer' ? '↑' : '↓'),el('div', { class: 'meta' },- el('div', { class: 't' }, esc(w.label), el('span', { class: `pill ${w.enabled ? 'ok' : 'warn'}`, style: 'margin-left:8px' }, w.enabled ? 'enabled' : 'paused')),+ // A text node escapes itself; esc() here would surface a literal+ // & in a label the merchant typed.+ el('div', { class: 't' }, w.label, el('span', { class: `pill ${w.enabled ? 'ok' : 'warn'}`, style: 'margin-left:8px' }, w.enabled ? 'enabled' : 'paused')),el('div', { class: 's mono' }, `${w.chain} · ${w.role} · ${shortAddr(w.address)}${w.per_call_cap_atomics ? ` · ≤$${fmtUsdc(w.per_call_cap_atomics)}/call` : ''}${w.daily_cap_atomics ? ` · ≤$${fmtUsdc(w.daily_cap_atomics)}/day` : ''}`),),el('div', { class: 'acts' },@@ -498,7 +503,7 @@ function renderWallets(host) {}host.append(agentCard);- // Move money — deposit (receive) + send USDC by name/address via Phantom.+ // Move money: deposit (receive) + send USDC by name/address via Phantom.host.append(renderMoneyTools(m));}@@ -609,14 +614,14 @@ function agentWalletModal(w = null) {field('Label', input({ id: 'aw_label', value: v.label || '', placeholder: 'Research autopay', maxlength: 60 })),el('div', { class: 'cols-2' },field('Chain', select('aw_chain', ['solana', 'base'], v.chain || 'solana')),- field('Role', select('aw_role', ['payer', 'payout'], v.role || 'payer', { payer: 'payer — auto-pays for services', payout: 'payout — receives funds' })),+ field('Role', select('aw_role', ['payer', 'payout'], v.role || 'payer', { payer: 'payer (auto-pays for services)', payout: 'payout (receives funds)' })),),field('Address', input({ id: 'aw_addr', value: v.address || '', placeholder: 'wallet address', class: 'mono' }), 'Must match the chain above'),el('div', { class: 'cols-2' },field('Per-call cap (USDC)', input({ id: 'aw_call', value: v.per_call_cap_atomics ? fmtUsdc(v.per_call_cap_atomics) : '', type: 'number', min: '0', step: '0.01', placeholder: 'no cap' }), 'Max a single payment may move'),field('Daily cap (USDC)', input({ id: 'aw_day', value: v.daily_cap_atomics ? fmtUsdc(v.daily_cap_atomics) : '', type: 'number', min: '0', step: '0.01', placeholder: 'no cap' }), 'Max in a rolling 24h'),),- field('', switchEl('aw_enabled', v.enabled !== false, 'Enabled — may transact')),+ field('', switchEl('aw_enabled', v.enabled !== false, 'Enabled (may transact)')),);const close = openModal(editing ? 'Edit agent wallet' : 'Add agent wallet', body, [el('span', { class: 'spacer', style: 'margin-left:auto' }),@@ -783,7 +788,7 @@ function renderSettings(host) {el('button', { class: 'btn primary', id: 's_cors_save', onclick: saveCors }, 'Save origins'),));- // Developer — facilitator, webhook, API key+ // Developer: facilitator, webhook, API keyconst keyState = m.api_key_prefix? el('div', { class: 'list-item' },el('div', { class: 'meta' }, el('div', { class: 't mono' }, `${m.api_key_prefix}……`), el('div', { class: 's' }, m.api_key_created_at ? `created ${new Date(m.api_key_created_at).toLocaleDateString()}` : 'active')),@@ -797,7 +802,7 @@ function renderSettings(host) {field('Settlement webhook (optional)', input({ id: 's_hook', value: m.webhook_url || '', placeholder: 'https://acme.com/webhooks/x402', type: 'url' })),),el('button', { class: 'btn primary', id: 's_dev_save', onclick: saveDeveloper, style: 'margin-bottom:16px' }, 'Save developer'),- el('label', { class: 'field', style: 'margin:0' }, el('span', { style: 'font-size:var(--text-sm);color:var(--ink-dim);font-weight:500' }, 'API key')),+ el('div', { class: 'field', style: 'margin:0' }, el('span', { class: 'flab' }, 'API key')),keyState,));}@@ -861,7 +866,7 @@ async function rotateKey() {const { settings } = await api('/api/x402-merchant');S.settings = settings;const close = openModal('Your new API key', el('div', {},- el('p', { class: 'sub' }, 'Copy it now — it is shown once and stored only as a hash.'),+ el('p', { class: 'sub' }, 'Copy it now. It is shown once and stored only as a hash.'),el('div', { class: 'code' }, api_key, el('button', { class: 'btn primary sm copy', onclick: () => copy(api_key, 'API key copied') }, 'Copy')),), [el('span', { class: 'spacer', style: 'margin-left:auto' }), el('button', { class: 'btn primary', onclick: () => { close(); renderSettings($('#sec-settings')); } }, 'Done')]);} catch (e) { toast(e.message, 'err'); }@@ -875,19 +880,22 @@ const BLOCK_TYPES = [{ type: 'text', ic: '¶', label: 'Text' },{ type: 'image', ic: '▣', label: 'Image' },{ type: 'button', ic: '⬢', label: 'Button' },- { type: 'divider', ic: '—', label: 'Divider' },+ { type: 'divider', ic: '─', label: 'Divider' },{ type: 'footer', ic: '▭', label: 'Footer' },];function renderStore(host) {const m = S.settings || {};- S.layout = JSON.parse(JSON.stringify(m.store_layout || []));+ // Unsaved blocks survive a trip to another tab; only a clean canvas is+ // re-cloned from the saved settings.+ if (!S.layoutDirty || !S.layout) S.layout = JSON.parse(JSON.stringify(m.store_layout || []));host.innerHTML = '';host.append(el('div', { class: 'card' },el('div', { class: 'section-head' },- el('div', {}, el('h2', {}, 'Storefront builder'), el('p', { class: 'sub', style: 'margin:0' }, 'Drag blocks onto the canvas, reorder, and publish a shareable storefront — like a Shopify page for your x402 products.')),+ el('div', {}, el('h2', {}, 'Storefront builder'), el('p', { class: 'sub', style: 'margin:0' }, 'Drag blocks onto the canvas, reorder, and publish a shareable storefront, like a Shopify page for your x402 products.')),el('span', { class: 'spacer' }),+ S.layoutDirty ? el('span', { class: 'pill warn' }, 'Unsaved changes') : null,el('span', { class: `pill ${m.store_published ? 'ok' : ''}` }, m.store_published ? 'Published' : 'Draft'),),el('div', { class: 'cols-2' },@@ -919,14 +927,23 @@ function renderStore(host) {function addBlock(type) {const block = { id: uid('b'), type };- if (type === 'hero') { block.heading = S.settings.business_name || 'Welcome'; block.subheading = 'Pay with USDC — settled on-chain.'; block.align = 'center'; }+ if (type === 'hero') { block.heading = S.settings.business_name || 'Welcome'; block.subheading = 'Pay with USDC, settled on-chain.'; block.align = 'center'; }if (type === 'text') block.body = 'Tell buyers what you offer.';if (type === 'button') { block.label = 'Get started'; block.href = location.origin; }if (type === 'products') block.sku_ids = S.skus.filter((s) => s.active).slice(0, 12).map((s) => s.id);if (type === 'product') block.sku_id = S.skus.find((s) => s.active)?.id;if (type === 'footer') block.body = `© ${S.settings.business_name || 'your store'}`;S.layout.push(block);- drawCanvas();+ markLayoutDirty();+}++// Every canvas mutation routes through here so the "Unsaved changes" pill and+// the keep-across-tabs behaviour can never drift from the actual edits.+function markLayoutDirty() {+ const wasDirty = S.layoutDirty;+ S.layoutDirty = true;+ if (wasDirty) drawCanvas();+ else renderStore($('#sec-store'));}function drawCanvas() {@@ -946,10 +963,10 @@ function drawCanvas() {el('div', { class: 'bhead' },el('span', { class: 'type' }, b.type),el('div', { class: 'acts' },- el('button', { title: 'Move up', onclick: () => moveBlock(i, Math.max(0, i - 1)) }, '↑'),- el('button', { title: 'Move down', onclick: () => moveBlock(i, Math.min(S.layout.length - 1, i + 1)) }, '↓'),- el('button', { title: 'Edit', onclick: () => blockModal(b) }, '✎'),- el('button', { title: 'Remove', onclick: () => { S.layout.splice(i, 1); drawCanvas(); } }, '✕'),+ el('button', { title: 'Move up', 'aria-label': `Move ${b.type} block up`, disabled: i === 0 || undefined, onclick: () => moveBlock(i, Math.max(0, i - 1)) }, '↑'),+ el('button', { title: 'Move down', 'aria-label': `Move ${b.type} block down`, disabled: i === S.layout.length - 1 || undefined, onclick: () => moveBlock(i, Math.min(S.layout.length - 1, i + 1)) }, '↓'),+ el('button', { title: 'Edit', 'aria-label': `Edit ${b.type} block`, onclick: () => blockModal(b) }, '✎'),+ el('button', { title: 'Remove', 'aria-label': `Remove ${b.type} block`, onclick: () => { S.layout.splice(i, 1); markLayoutDirty(); } }, '✕'),)),el('div', { class: 'bprev' }, blockPreview(b)),);@@ -960,16 +977,16 @@ function moveBlock(from, to) {if (from === to) return;const [m] = S.layout.splice(from, 1);S.layout.splice(to, 0, m);- drawCanvas();+ markLayoutDirty();}function blockPreview(b) {- if (b.type === 'hero') return `${b.heading || ''} — ${b.subheading || ''}`;+ if (b.type === 'hero') return `${b.heading || ''} / ${b.subheading || ''}`;if (b.type === 'text' || b.type === 'footer') return (b.body || '').slice(0, 120);if (b.type === 'button') return `[ ${b.label || 'Button'} ] → ${b.href || ''}`;if (b.type === 'image') return b.image_url ? b.image_url : '(no image set)';if (b.type === 'products') return `${(b.sku_ids || []).length} product${(b.sku_ids || []).length === 1 ? '' : 's'}`;if (b.type === 'product') { const s = S.skus.find((x) => x.id === b.sku_id); return s ? `${s.merchant_name} · ${s.action_name}` : '(pick a product)'; }- if (b.type === 'divider') return '———';+ if (b.type === 'divider') return '───';return '';}@@ -1002,7 +1019,7 @@ function blockModal(b) {const close = openModal(`Edit ${b.type}`, el('div', {}, ...fields), [el('span', { class: 'spacer', style: 'margin-left:auto' }),el('button', { class: 'btn ghost', onclick: () => close() }, 'Cancel'),- el('button', { class: 'btn primary', onclick: () => { applyBlock(b); close(); drawCanvas(); } }, 'Apply'),+ el('button', { class: 'btn primary', onclick: () => { applyBlock(b); close(); markLayoutDirty(); } }, 'Apply'),]);}function applyBlock(b) {@@ -1011,14 +1028,16 @@ function applyBlock(b) {else if (b.type === 'button') { b.label = $('#bk_label').value; b.href = $('#bk_href').value; }else if (b.type === 'image') b.image_url = $('#bk_img').value;else if (b.type === 'product') b.sku_id = $('#bk_sku').value;- else if (b.type === 'products') b.sku_ids = $$('#root input[data-sku]:checked').map((i) => i.dataset.sku);+ // The checkboxes live in the modal, which is appended to <body> next to+ // #root, not inside it. Scoping this to #root silently saved an empty grid.+ else if (b.type === 'products') b.sku_ids = $$('.scrim input[data-sku]:checked').map((i) => i.dataset.sku);}async function saveStore(publish) {try {const handle = $('#st_handle').value.trim().toLowerCase();if (publish && !handle) throw new Error('Set a store handle before publishing');- if (handle && !/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/.test(handle)) throw new Error('Handle must be lowercase, hyphenated, 3–40 chars');+ if (handle && !/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/.test(handle)) throw new Error('Handle must be lowercase, hyphenated, 3 to 40 chars');// Strip empty image/button blocks the API would reject (httpsUrl required).const layout = S.layout.filter((b) => {if (b.type === 'image') return !!b.image_url;@@ -1037,6 +1056,7 @@ async function saveStore(publish) {if (handle) patch.store_handle = handle;if (publish) patch.store_published = true;await saveSettings(patch, publish ? 'Storefront published' : 'Draft saved');+ S.layoutDirty = false;renderStore($('#sec-store'));} catch (e) {toast(e.message, 'err');@@ -1057,7 +1077,7 @@ function renderEmbed(host) {host.append(el('div', { class: 'card' },el('h2', {}, 'Embed builder'),- el('p', { class: 'sub' }, 'Configure a pay button and drop it onto any website — Wix, Shopify, a landing page, anywhere. It opens the x402 modal and settles in USDC.'),+ el('p', { class: 'sub' }, 'Configure a pay button and drop it onto any website: Wix, Shopify, a landing page, anywhere. It opens the x402 modal and settles in USDC.'),el('div', { class: 'cols-2' },field('Product', selectFromSkus('em_sku', EMBED.sku)),field('Button label', input({ id: 'em_label', placeholder: 'auto from product', value: EMBED.label })),@@ -1144,11 +1164,19 @@ function drawEmbed() {}// ---------------------------------------------------------------- ui kit ------+// A labelled control. The wrapper is a <div>, never a <label>: half the controls+// here (the switches, the network checkboxes) are labels themselves, and a label+// nested in a label is invalid markup that screen readers announce twice. The+// caption points at the control with `for` when the control has an id, which is+// the association an implicit wrapper was standing in for.function field(label, control, hint) {- return el('label', { class: 'field' },- label ? el('span', {}, label) : null,+ const target = control.matches?.('input, select, textarea') ? control : control.querySelector?.('input, select, textarea');+ const hintId = hint ? uid('h') : null;+ if (hint && target?.id) target.setAttribute('aria-describedby', hintId);+ return el('div', { class: 'field' },+ label ? el(target?.id ? 'label' : 'span', { class: 'flab', ...(target?.id ? { for: target.id } : {}) }, label) : null,control,- hint ? el('span', { class: 'hint' }, hint) : null);+ hint ? el('span', { class: 'hint', id: hintId }, hint) : null);}function input(attrs) { return el('input', attrs); }function textarea(attrs) { const t = el('textarea', { ...attrs }); if (attrs.value) t.value = attrs.value; return t; }@@ -1164,19 +1192,61 @@ function switchEl(id, checked, label) {}let scrim;+let openDialog = null;++// One dialog is open at a time. It is a real ARIA dialog: Escape closes it, Tab+// stays inside it, focus lands on the first control and returns to whatever+// opened it, so a keyboard user is never stranded behind the scrim.function openModal(title, bodyNode, actions) {- if (!scrim) { scrim = el('div', { class: 'scrim', onclick: (e) => { if (e.target === scrim) close(); } }); document.body.append(scrim); }- const modal = el('div', { class: 'modal' },- el('header', {}, el('h3', {}, title), el('button', { class: 'x', onclick: () => close() }, '×')),+ if (!scrim) {+ scrim = el('div', { class: 'scrim', onclick: (e) => { if (e.target === scrim) openDialog?.close(); } });+ document.body.append(scrim);+ document.addEventListener('keydown', onModalKey);+ }+ const titleId = uid('mt');+ const modal = el('div', { class: 'modal', role: 'dialog', 'aria-modal': 'true', 'aria-labelledby': titleId },+ el('header', {}, el('h3', { id: titleId }, title), el('button', { class: 'x', type: 'button', 'aria-label': 'Close dialog', onclick: () => close() }, '×')),el('div', { class: 'body' }, bodyNode),el('div', { class: 'actions' }, ...actions.filter(Boolean)));++ const returnFocus = document.activeElement;+ openDialog?.close();scrim.innerHTML = '';scrim.append(modal);scrim.classList.add('show');- function close() { scrim.classList.remove('show'); scrim.innerHTML = ''; }++ function close() {+ if (openDialog?.close !== close) return;+ openDialog = null;+ scrim.classList.remove('show');+ scrim.innerHTML = '';+ if (returnFocus?.isConnected) returnFocus.focus();+ }+ openDialog = { modal, close };++ const first = focusables(modal)[0];+ (first || modal).focus?.();return close;}+function focusables(root) {+ return $$('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', root)+ .filter((n) => n.offsetParent !== null || n === document.activeElement);+}++function onModalKey(e) {+ if (!openDialog) return;+ if (e.key === 'Escape') { e.preventDefault(); openDialog.close(); return; }+ if (e.key !== 'Tab') return;+ const items = focusables(openDialog.modal);+ if (!items.length) return;+ const first = items[0];+ const last = items[items.length - 1];+ if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }+ else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }+ else if (!openDialog.modal.contains(document.activeElement)) { e.preventDefault(); first.focus(); }+}+// Load the x402 modal script once so the embed preview button is live.// type="module" is required, not cosmetic: /x402.js resolves its sibling// risk-ack module via import.meta.url, which is a syntax error in a classicdiff --git a/src/marketplace.js b/src/marketplace.jsindex a27409060..3e1da3442 100644--- a/src/marketplace.js+++ b/src/marketplace.js@@ -3864,6 +3864,20 @@ function triggerDownload(url, filename) {// animation-carrier rig (idle_female_jan25.glb is meshless: skeleton only).const PREVIEW_AVATAR_GLB = '/avatars/cz.glb';+// The <agent-3d> loader ships a full Three.js bundle, and this modal stage is+// the only place on the marketplace that renders the element. Loading it here,+// on first modal open, keeps it off the page's critical path entirely (same+// on-demand pattern as ensureModelViewer in src/agent-picker.js).+let _agent3dLoaded = false;+function ensureAgent3d() {+ if (_agent3dLoaded || customElements.get('agent-3d')) return;+ _agent3dLoaded = true;+ const s = document.createElement('script');+ s.type = 'module';+ s.src = 'https://three.ws/agent-3d/latest/agent-3d.js';+ document.head.appendChild(s);+}+let _animDetailId = null;let _animDetailEl = null;@@ -3914,6 +3928,7 @@ async function loadAnimDetail(name) {function playAnimOnStage(anim) {const stage = $('anim-detail-stage');if (!stage) return;+ ensureAgent3d();teardownAnimDetailStage();const load = $('anim-detail-stage-load');stage.querySelectorAll('agent-3d').forEach((el) => el.remove());