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(radar): keep the corner stack off modal controls and show the fork button working
nirholas642e92881286
diff --git a/public/corner-stack.js b/public/corner-stack.jsindex 66311900c..4b5bd01e5 100644--- a/public/corner-stack.js+++ b/public/corner-stack.js@@ -41,6 +41,12 @@* pass { height, width } to declare both* release(key) — drop that reservation* reserved() — current reserved height in px+ * MODAL_CLASS - the <body> class a modal sets to hide the stack+ *+ * Modals: a dialog that covers the screen should add `tws-modal-open` to+ * <body> while it is open and remove it on close. The stack lives above every+ * page layer, so without that flag its widgets stay clickable on top of the+ * dialog and eat whatever control they cover.*/(function () {'use strict';@@ -49,6 +55,8 @@var STACK_ID = 'tws-corner-stack';var STYLE_ID = 'tws-corner-stack-css';var ITEM_CLASS = 'tws-corner-item';+ /* Set on <body> by a modal that owns the screen; see the CSS rule below. */+ var MODAL_CLASS = 'tws-modal-open';var DEFAULT_PRIORITY = 50;var stack = null;@@ -83,6 +91,13 @@'transition:transform .35s cubic-bezier(.22,1,.36,1);','}','@media (prefers-reduced-motion:reduce){#' + STACK_ID + '{transition:none;}}',+ /* A modal dialog owns the whole screen while it is up, but the stack sits+ two billion layers above every page, so its widgets stayed clickable on+ top of the modal and swallowed whatever control landed under them (the+ language switcher over the /radar drawer\'s Copy button). Any modal can+ opt in by putting MODAL_CLASS on <body> while it is open; the stack+ fades out and stops taking pointer events until the class is removed. */+ 'body.' + MODAL_CLASS + ' #' + STACK_ID + '{opacity:0;pointer-events:none;visibility:hidden;}','#' + STACK_ID + ':empty{display:none;}',/* relative (not static) keeps members in the flex flow while preserving acontaining block for their position:absolute children (e.g. the@@ -413,6 +428,7 @@reserve: reserve,release: release,reserved: reservedHeight,+ MODAL_CLASS: MODAL_CLASS,remeasure: applyDocks};diff --git a/src/fork-trade.js b/src/fork-trade.jsindex 9c8bb60bb..a58958761 100644--- a/src/fork-trade.js+++ b/src/fork-trade.js@@ -101,13 +101,42 @@ export async function forkShareUrl(trade, { base } = {}) {return url.toString();}+/**+ * Put a fork trigger into its loading state and hand back the undo.+ *+ * The trade panel is a lazy chunk carrying the Solana and pump SDKs, so the+ * gap between the click and the modal is a real network fetch, not a frame.+ * Without this the button sat inert and unchanged for the whole fetch, which+ * reads as a dead control and earns a second and third click.+ * @param {Element|null|undefined} el+ * @returns {() => void} restores the trigger to exactly how it was.+ */+function markForkPending(el) {+ if (!(el instanceof HTMLElement)) return () => {};+ const wasBusy = el.getAttribute('aria-busy');+ const wasDisabled = el instanceof HTMLButtonElement ? el.disabled : null;+ const wasLabel = el.textContent;+ el.setAttribute('aria-busy', 'true');+ if (el instanceof HTMLButtonElement) el.disabled = true;+ el.textContent = 'Opening';+ return () => {+ if (wasBusy == null) el.removeAttribute('aria-busy');+ else el.setAttribute('aria-busy', wasBusy);+ if (wasDisabled != null && el instanceof HTMLButtonElement) el.disabled = wasDisabled;+ el.textContent = wasLabel;+ };+}+/*** Open the real trade panel for a coin, pre-filled with the forked size.* @param {{mint:string, symbol?:string, name?:string, image?:string, size?:number|string}} trade+ * @param {{trigger?: Element}} [opts] the control that was clicked, so it can+ * show a loading state while the trade-panel chunk downloads.* @returns {Promise<boolean>} false when the panel could not be loaded.*/-export async function openFork(trade) {+export async function openFork(trade, { trigger } = {}) {if (!isMint(trade?.mint)) return false;+ const restore = markForkPending(trigger);try {const { openBuyModal } = await import('./game/coin-buy.js');openBuyModal(@@ -120,6 +149,8 @@ export async function openFork(trade) {} catch {toast('Could not open the trade panel. Trade this coin on pump.fun instead.', { variant: 'error' });return false;+ } finally {+ restore();}}@@ -198,7 +229,7 @@ export function mountForkLinks(root = document) {}, el);return;}- await openFork(trade);+ await openFork(trade, { trigger: el });});}diff --git a/src/game/coin-buy.js b/src/game/coin-buy.jsindex aa5beeb54..16146a681 100644--- a/src/game/coin-buy.js+++ b/src/game/coin-buy.js@@ -46,6 +46,9 @@ function usdcDenom(network = NETWORK) {const SELL_PRESETS = [['25%', 0.25], ['50%', 0.5], ['Max', 1]];let _open = null; // the live modal controller, so a second click reuses it+// Mirrors corner-stack.js's MODAL_CLASS, which that script also publishes on+// window.twsCornerStack; the literal covers the moment before it has mounted.+const CORNER_MODAL_CLASS = 'tws-modal-open';function el(tag, props = {}, kids = []) {const n = document.createElement(tag);@@ -295,6 +298,10 @@ class TradeModal {e.stopPropagation();});document.body.appendChild(this.overlay);+ // Tell the shared corner stack (public/corner-stack.js) to step aside:+ // it renders above every page layer, so its widgets would otherwise stay+ // clickable on top of this dialog.+ document.body.classList.add(CORNER_MODAL_CLASS);requestAnimationFrame(() => this.overlay.classList.add('cc-on'));this._syncMode();this.smartMoney?.loadForMint({ mint: this.coin.mint, network: NETWORK });@@ -306,6 +313,7 @@ class TradeModal {close() {this.overlay.classList.remove('cc-on');setTimeout(() => this.overlay.remove(), 180);+ document.body.classList.remove(CORNER_MODAL_CLASS);this.safety?.destroy();this.smartMoney?.destroy();if (_open === this) _open = null;diff --git a/src/radar.css b/src/radar.cssindex 7062fd32c..7dff5ce11 100644--- a/src/radar.css+++ b/src/radar.css@@ -137,6 +137,14 @@transition: border-color var(--duration-fast) var(--ease-standard);}.radar-search:focus-within { border-color: var(--accent); }+/* The input clears its own outline so the pill reads as one control, which+ left the search box as the only keyboard target on the page with no ring.+ Put the page's standard ring on the wrapper, and only for keyboard focus,+ so a mouse click still just tints the border. */+.radar-search:has(.radar-search-input:focus-visible) {+ outline: var(--focus-ring-width) solid var(--focus-ring-color);+ outline-offset: 2px;+}.radar-search-icon { color: var(--ink-faint); display: flex; flex-shrink: 0; }.radar-search-input {flex: 1; min-width: 0; background: none; border: none; outline: none;@@ -395,6 +403,15 @@.rc-fork:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); border-color: var(--accent); }.rc-fork:active { transform: translateY(1px); }.rc-fork:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 2px; }+/* The trade panel is a lazy chunk carrying the Solana SDKs, so the click is+ followed by a real fetch. The button says so and refuses further clicks+ while it runs; the min-width keeps the card footer from reflowing when the+ label swaps to the longer word. */+.rc-fork { min-width: 7ch; text-align: center; }+.rc-fork[aria-busy='true'] {+ cursor: progress; color: var(--ink-dim);+ animation: radar-pulse 1.1s var(--ease-standard) infinite;+}.rc-watch {font-size: var(--text-md); line-height: 1; padding: var(--space-2xs) var(--space-xs);@@ -695,6 +712,6 @@}@media (prefers-reduced-motion: reduce) {- .radar-card, .rc-ring-arc, .rc-ob-fill, .radar-glyph-sweep, .radar-pill-dot, .radar-live-dot { animation: none !important; transition: none !important; }+ .radar-card, .rc-ring-arc, .rc-ob-fill, .radar-glyph-sweep, .radar-pill-dot, .radar-live-dot, .rc-fork[aria-busy='true'] { animation: none !important; transition: none !important; }.radar-card.is-enter { opacity: 1; transform: none; }}diff --git a/src/radar.js b/src/radar.jsindex 9274df0be..cc8ac1070 100644--- a/src/radar.js+++ b/src/radar.js@@ -938,7 +938,7 @@ function renderCard(coin) {// the event at the button, which a document-level delegate never sees.forkBtn.addEventListener('click', (e) => {e.stopPropagation();- openFork({ mint: coin.mint, symbol: coin.symbol, name: coin.name, image: coin.image_uri });+ openFork({ mint: coin.mint, symbol: coin.symbol, name: coin.name, image: coin.image_uri }, { trigger: forkBtn });});}@@ -1205,6 +1205,10 @@ function radarGlyph() {let drawer = null;let drawerAbort = null;let lastFocused = null;+// Kept in sync with corner-stack.js's MODAL_CLASS, which that script also+// publishes on window.twsCornerStack once it has run. The literal is the+// fallback for the moment before the deferred script mounts.+const CORNER_MODAL_CLASS = 'tws-modal-open';function ensureDrawer() {if (drawer) return drawer;@@ -1244,6 +1248,11 @@ async function openDrawer(mint) {lastFocused = document.activeElement;scrim.hidden = false;document.body.classList.add('radar-no-scroll');+ // The shared corner stack (public/corner-stack.js) renders above every page+ // layer, so its widgets stayed clickable on top of this drawer and swallowed+ // whatever control they covered (the language switcher sat on the mint row's+ // Copy button). This is the flag that stack watches for.+ document.body.classList.add(CORNER_MODAL_CLASS);requestAnimationFrame(() => scrim.classList.add('is-open'));panel.innerHTML = '';@@ -1276,6 +1285,7 @@ function closeDrawer() {if (!drawer) return;drawer.scrim.classList.remove('is-open');document.body.classList.remove('radar-no-scroll');+ document.body.classList.remove(CORNER_MODAL_CLASS);if (drawerAbort) { drawerAbort.abort(); drawerAbort = null; }const scrim = drawer.scrim;const onEnd = () => { scrim.hidden = true; scrim.removeEventListener('transitionend', onEnd); };