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: enhance clash page with ui-juice integration for improved live updates and animations
qbdzd0e6efeeb180
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0a59c34f6..306a9c2de 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,12 +16,14 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Fixed several pages returning a 404** — A handful of pages were built and shipping but had no clean-URL route, so they fell through to the not-found page: the agent wallet (/agent-wallet), the viability report (/viability), and the gallery picker. All now load correctly. The agent wallet, when opened without a specific agent, also shows a clear prompt to pick or create one. (`/viability`) `[fix]`- **Marketplace & trading viability get a dedicated page** — The two "honest signal" panels — marketplace viability (real $THREE skill GMV, take-rate, repeat buyers, trading pairs) and trading viability (real guarded coin-trade flow, cost and realized P&L on closed positions) — now live on their own page at /viability. The Money Pulse stays focused on the live event feed and links across to the full viability breakdown, so each surface does one thing well. Same real on-chain numbers, just easier to read and share. (`/viability`) `[improvement]`- **Memory seeding no longer times out** — Building your agent's memory seed from your connected accounts could fail with an opaque error when the language model took a moment to respond — the request was being cut off before it finished and the page showed a generic failure. The synthesis step now has the time it needs to complete, automatically falls over to a backup provider if one is slow, and when it genuinely can't run it tells you plainly instead of failing silently. `[fix]`+- **One shared motion library now powers live game-feel across the platform** — The interaction polish proven on the Swarms page — numbers that count up between real values, directional green/red flashes, live-feed rows that slide in, sparklines, ring gauges, connection dots, and a single restrained it-shipped ripple — now lives in one shared, token-driven, reduced-motion-safe library instead of being re-rolled per page. Every surface that adopts it speaks the same visual vocabulary, and because it's built entirely on the platform's motion tokens, it goes perfectly still the instant you ask your system for reduced motion. The Swarms page is its first consumer; the launch, deploy, markets and AI surfaces follow. It's a foundation, not a faked effect — every animation rides a real value. `[improvement, sdk]`- **Oracle now has full documentation** — Everything behind the conviction score, in one place. The new Oracle docs explain — in plain English and, where you want it, full mathematical detail — how Oracle reads every pump.fun launch: the four pillars (who's buying, how it's structured, what story it rides, how it's moving), exactly how they fuse into a 0–100 score, where the hard caps come from, how the engine is calibrated and backtested against real outcomes, how to arm an agent on it, the full public API, and where it's headed. Real screenshots throughout, a quickstart for traders, builders, and skeptics, and a researcher-level appendix. (`/oracle/docs`) `[docs, feature]`- **Swarm dashboards now show consensus building and firing live** — When you watch a trading swarm, you can now see the moment it decides. Every consensus vote animates in and fills a meter toward the swarm's firing threshold in real time. When member consensus clears the line and the treasury actually fires a buy, the meter visibly crosses the threshold with a hot success glow, the vote stamps a pulsing “fire” badge, and a single accent ripple sweeps the panel — so the most important event on the page lands instead of slipping by as a quiet log line. Skips fill toward the line and stop short. Respects reduced-motion preferences. (`/swarms`) `[improvement]`- **Swarm treasury figures now count up and flash when money moves** — On a live swarm dashboard, the treasury tiles — balance, realized P&L, open positions and win rate — no longer hard-swap to a new number. When a live update lands, each figure smoothly counts from its current value to the new one and the tile flashes in the direction of the change: green when it rises, red when it drops. A confirmed payout pulses the balance and P&L tiles the instant the money lands. It animates only between two real values, never from zero, and respects reduced-motion preferences (those users get an instant, exact update). (`/swarms`) `[improvement]`- **The AI surfaces now make the agent's thinking feel alive — the AGI, Alpha Co-pilot and Reasoning Ledger** — The three pages where you watch an agent reason just got the same game-feel polish as the Swarms page, all driven by real data. On The AGI, only genuinely new decisions slide into the live feed (the rest stay put instead of flickering on every refresh), a live dot tells you when the stream is connected or reconnecting, and the reputation ring sweeps and counts up only when the real score actually moves. On the Alpha Co-pilot, the launch feed lands card-by-card, each launch's score bars grow from zero, and when a read comes back the conviction bar fills and counts up, the signals the agent cited reveal in sequence, and the verdict gets a single accent pulse. On the Reasoning Ledger, decisions stagger in as you load older history, the reputation arc fills while the score counts up, and a new sparkline traces realized P&L across the settled calls in view. Nothing is faked — every number, bar and trend comes from the live model output or on-chain outcome, and all of it collapses to a clean static state when you've asked your system for reduced motion. (`/agi`) `[improvement]`- **The autonomous sniper is now an MCP server and an x402 paid API** — Our autonomous pump.fun trading and sniping engine now speaks three languages at once. As an MCP server, any AI agent — Claude, Cursor, your own — can arm snipe strategies, fire manual buys, and watch positions through plain tool calls. As an x402 paid HTTP API, other agents can pay per call in USDC to arm a strategy or trigger a snipe, with free reads for health, status and positions. And it stays a clean library and CLI you can embed anywhere. It runs against your own wallet and RPC — self-custodial by default — with a mandatory stop-loss on every strategy and simulate mode on unless you explicitly go live. Install it with one command: npx -y @three-ws/agent-sniper. (`/docs/mcp`) `[feature, sdk]`- **The homepage now shows the autonomous sniper trading, live** — There's a new "Autonomous trading" section on three.ws that puts the sniper engine front and center. An interactive diagram walks the full trade loop — Watch, Score, Guard, Buy, Exit — and you can click or hover any stage to read exactly what the agent does there, from the pump.fun new-launch feed through the risk guards to the take-profit and stop-loss exits. Beside it, a live tape streams real buys, sells and open positions as they happen, each linking to its Solscan signature, and a status pill shows whether the engine is live along with how many strategies are armed and positions are open. The win rate, best ROI and open-position counts underneath are the platform's real numbers — nothing on the panel is simulated. Honors reduced-motion preferences. (`/`) `[feature]`+- **The launch & deploy flow now makes shipping feel like shipping** — Every place where you create and ship a coin or agent got the same game-feel polish as the Swarms page, all driven by real data. On /launches, freshly-landed launches slide in at the top of the live feed, the hero market-cap and launch counters count up between real values, and a live-feed dot tells you the registry is syncing, live, or offline. On a coin's detail page, the live trade tape now tints each new trade in the direction money moved — green when SOL comes back, red when it's spent — the market cap ticks as it refreshes, and a coin ripples once the moment it graduates. The Launch Copilot streams its market-maker action log in row-by-row with the same directional tint, lights a live dot when the stream is connected, and gives a single warm beat the moment the maker goes live. The personal and admin Memetic Launchers count their tallies up between polls, and the admin's launched-today tile ripples each time the live firehose actually mints a coin. The deployments registry counts its headline numbers up as new on-chain agents stream in under a live dot. And Instant Agent Genesis gives one restrained beat when your agent is born, and again when its ERC-8004 identity verifies on-chain. Nothing is faked — every number and beat comes from a real request lifecycle, never a timer, and all of it collapses to a clean static state under reduced motion. (`/launches`) `[improvement]`- **The Sniper dashboard now carries the full Money Studio — wallet, Trading Brain, pricing and earnings** — The Sniper Strategies dashboard used to stop at strategy config and live positions. Now every strategy card has a second tab — Money Studio — that opens the exact same control surface as your agent's Money tab in Agent Studio, without leaving the dashboard. Fund the agent's wallet (live SOL and USDC balances, deposit address, withdraw with a one-tap Max, real SPL holdings and on-chain activity), open the full Trading Brain to draw a snipe rule and either scan live launches for one-tap assisted snipes or arm it to run autonomously, backtest a rule over the last 30 days, set per-call prices on the agent's skills, and watch what other agents pay it — all per agent, all real. No more bouncing between Agent Studio and the dashboard to top up a wallet before arming. The original Money tab in Agent Studio is untouched. (`/dashboard/sniper`) `[feature, improvement]`- **The swarm members panel is now a live standings board** — A swarm is a competition between its members, and the members list now reads like one. Members are ranked by stake — #1, #2, #3 — with the lead member marked by a token accent, and each member's reputation shows as a vote-weight chip: the chip carries the reputation score with the exact share of the swarm's vote that score commands beneath it, so you can see your track record become voting power (computed the same way the consensus engine does). The moment the treasury fires a trade, the members who were on the winning side of that consensus pulse green — pulled straight from the real recorded vote breakdown, so you can see exactly who carried it. When someone contributes or exits, the share bars animate and the standings re-sort smoothly instead of snapping. Respects reduced-motion preferences. (`/swarms`) `[improvement]`- **The Trading Brain now tracks open snipes and today's budget burn live** — The sniping panel in Agent Studio's Money tab no longer goes stale the moment it loads. Open positions now mark to live price on their own — each one shows its unrealized P&L (in SOL and percent) and refreshes every few seconds, so a snipe climbing or bleeding updates in front of you instead of waiting for a reload. When your agent is armed, new fills and exits appear on the same live tick. The Guardrails card now shows real spend: how much SOL the agent has traded today against your daily budget, as a number and a progress bar that turns amber past 60% and red past 90% — so you can see the leash tightening before it stops you. Polling pauses when the tab is hidden to spare your rate limit, and resumes the moment you come back. (`/agent-studio`) `[improvement]`diff --git a/data/changelog.json b/data/changelog.jsonindex 2c52ffb3c..9f5f9d30f 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,24 @@{"$comment": "Curated changelog entries for three.ws \u2014 the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-30",+ "title": "The launch & deploy flow now makes shipping feel like shipping",+ "summary": "Every place where you create and ship a coin or agent got the same game-feel polish as the Swarms page, all driven by real data. On /launches, freshly-landed launches slide in at the top of the live feed, the hero market-cap and launch counters count up between real values, and a live-feed dot tells you the registry is syncing, live, or offline. On a coin's detail page, the live trade tape now tints each new trade in the direction money moved — green when SOL comes back, red when it's spent — the market cap ticks as it refreshes, and a coin ripples once the moment it graduates. The Launch Copilot streams its market-maker action log in row-by-row with the same directional tint, lights a live dot when the stream is connected, and gives a single warm beat the moment the maker goes live. The personal and admin Memetic Launchers count their tallies up between polls, and the admin's launched-today tile ripples each time the live firehose actually mints a coin. The deployments registry counts its headline numbers up as new on-chain agents stream in under a live dot. And Instant Agent Genesis gives one restrained beat when your agent is born, and again when its ERC-8004 identity verifies on-chain. Nothing is faked — every number and beat comes from a real request lifecycle, never a timer, and all of it collapses to a clean static state under reduced motion.",+ "tags": [+ "improvement"+ ],+ "link": "/launches"+ },+ {+ "date": "2026-06-30",+ "title": "One shared motion library now powers live game-feel across the platform",+ "summary": "The interaction polish proven on the Swarms page — numbers that count up between real values, directional green/red flashes, live-feed rows that slide in, sparklines, ring gauges, connection dots, and a single restrained it-shipped ripple — now lives in one shared, token-driven, reduced-motion-safe library instead of being re-rolled per page. Every surface that adopts it speaks the same visual vocabulary, and because it's built entirely on the platform's motion tokens, it goes perfectly still the instant you ask your system for reduced motion. The Swarms page is its first consumer; the launch, deploy, markets and AI surfaces follow. It's a foundation, not a faked effect — every animation rides a real value.",+ "tags": [+ "improvement",+ "sdk"+ ]+ },{"date": "2026-06-30","title": "x402 payment-modal SDK now installs cleanly outside the monorepo",diff --git a/pages/clash.html b/pages/clash.htmlindex 180cefa03..70a751348 100644--- a/pages/clash.html+++ b/pages/clash.html@@ -35,6 +35,7 @@<link rel="manifest" href="/site.webmanifest" /><link rel="stylesheet" href="/fonts/fonts.css" /><link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/src/ui-juice.css" /><link rel="stylesheet" href="/src/clash.css" /><link rel="stylesheet" href="/footer.css" /><script defer src="/footer-newsletter.js"></script>@@ -54,7 +55,7 @@<main class="cl-shell" aria-labelledby="cl-title"><section class="cl-hero"><p class="cl-kicker">- <span class="cl-live-dot" aria-hidden="true"></span>+ <span id="cl-live" class="juice-live" data-state="connecting"><span class="juice-live-dot" aria-hidden="true"></span><span class="juice-live-txt">connecting</span></span>Live community warfare<span class="cl-demo-badge" title="A playable demo — the real product is far bigger">Demo</span></p>diff --git a/pages/vaults.html b/pages/vaults.htmlindex d6612e300..f2d38db90 100644--- a/pages/vaults.html+++ b/pages/vaults.html@@ -32,6 +32,7 @@<link rel="manifest" href="/site.webmanifest" /><link rel="stylesheet" href="/fonts/fonts.css" /><link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/src/ui-juice.css" /><link rel="stylesheet" href="/src/vaults.css" /><link rel="stylesheet" href="/footer.css" /><link rel="canonical" href="https://three.ws/vaults" />diff --git a/public/changelog.json b/public/changelog.jsonindex 52b9da588..7c29a5e11 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-30T19:41:47.070Z",+ "generated_at": "2026-06-30T19:47:14.643Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -107,6 +107,17 @@"fix"]},+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "One shared motion library now powers live game-feel across the platform",+ "summary": "The interaction polish proven on the Swarms page — numbers that count up between real values, directional green/red flashes, live-feed rows that slide in, sparklines, ring gauges, connection dots, and a single restrained it-shipped ripple — now lives in one shared, token-driven, reduced-motion-safe library instead of being re-rolled per page. Every surface that adopts it speaks the same visual vocabulary, and because it's built entirely on the platform's motion tokens, it goes perfectly still the instant you ask your system for reduced motion. The Swarms page is its first consumer; the launch, deploy, markets and AI surfaces follow. It's a foundation, not a faked effect — every animation rides a real value.",+ "link": null,+ "tags": [+ "improvement",+ "sdk"+ ]+ },{"date": "2026-06-30","type": "update",@@ -169,6 +180,16 @@"feature"]},+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "The launch & deploy flow now makes shipping feel like shipping",+ "summary": "Every place where you create and ship a coin or agent got the same game-feel polish as the Swarms page, all driven by real data. On /launches, freshly-landed launches slide in at the top of the live feed, the hero market-cap and launch counters count up between real values, and a live-feed dot tells you the registry is syncing, live, or offline. On a coin's detail page, the live trade tape now tints each new trade in the direction money moved — green when SOL comes back, red when it's spent — the market cap ticks as it refreshes, and a coin ripples once the moment it graduates. The Launch Copilot streams its market-maker action log in row-by-row with the same directional tint, lights a live dot when the stream is connected, and gives a single warm beat the moment the maker goes live. The personal and admin Memetic Launchers count their tallies up between polls, and the admin's launched-today tile ripples each time the live firehose actually mints a coin. The deployments registry counts its headline numbers up as new on-chain agents stream in under a live dot. And Instant Agent Genesis gives one restrained beat when your agent is born, and again when its ERC-8004 identity verifies on-chain. Nothing is faked — every number and beat comes from a real request lifecycle, never a timer, and all of it collapses to a clean static state under reduced motion.",+ "link": "/launches",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-30","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex dbea94755..f9fd80ad1 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -86,6 +86,14 @@<category>fix</category><description>Building your agent's memory seed from your connected accounts could fail with an opaque error when the language model took a moment to respond — the request was being cut off before it finished and the page showed a generic failure. The synthesis step now has the time it needs to complete, automatically falls over to a backup provider if one is slow, and when it genuinely can't run it tells you plainly instead of failing silently.</description></item>+ <item>+ <title>One shared motion library now powers live game-feel across the platform</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-30:One shared motion library now powers live game-feel across the platform</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The interaction polish proven on the Swarms page — numbers that count up between real values, directional green/red flashes, live-feed rows that slide in, sparklines, ring gauges, connection dots, and a single restrained it-shipped ripple — now lives in one shared, token-driven, reduced-motion-safe library instead of being re-rolled per page. Every surface that adopts it speaks the same visual vocabulary, and because it's built entirely on the platform's motion tokens, it goes perfectly still the instant you ask your system for reduced motion. The Swarms page is its first consumer; the launch, deploy, markets and AI surfaces follow. It's a foundation, not a faked effect — every animation rides a real value.</description>+ </item><item><title>Oracle now has full documentation</title><link>https://three.ws/oracle/docs</link>@@ -134,6 +142,14 @@<category>feature</category><description>There's a new "Autonomous trading" section on three.ws that puts the sniper engine front and center. An interactive diagram walks the full trade loop — Watch, Score, Guard, Buy, Exit — and you can click or hover any stage to read exactly what the agent does there, from the pump.fun new-launch feed through the risk guards to the take-profit and stop-loss exits. Beside it, a live tape streams real buys, sells and open positions as they happen, each linking to its Solscan signature, and a status pill shows whether the engine is live along with how many strategies are armed and positions are open. The win rate, best ROI and open-position counts underneath are the platform's real numbers — nothing on the panel is simulated. Honors reduced-motion preferences.</description></item>+ <item>+ <title>The launch & deploy flow now makes shipping feel like shipping</title>+ <link>https://three.ws/launches</link>+ <guid isPermaLink="false">2026-06-30:The launch & deploy flow now makes shipping feel like shipping</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>Every place where you create and ship a coin or agent got the same game-feel polish as the Swarms page, all driven by real data. On /launches, freshly-landed launches slide in at the top of the live feed, the hero market-cap and launch counters count up between real values, and a live-feed dot tells you the registry is syncing, live, or offline. On a coin's detail page, the live trade tape now tints each new trade in the direction money moved — green when SOL comes back, red when it's spent — the market cap ticks as it refreshes, and a coin ripples once the moment it graduates. The Launch Copilot streams its market-maker action log in row-by-row with the same directional tint, lights a live dot when the stream is connected, and gives a single warm beat the moment the maker goes live. The personal and admin Memetic Launchers count their tallies up between polls, and the admin's launched-today tile ripples each time the live firehose actually mints a coin. The deployments registry counts its headline numbers up as new on-chain agents stream in under a live dot. And Instant Agent Genesis gives one restrained beat when your agent is born, and again when its ERC-8004 identity verifies on-chain. Nothing is faked — every number and beat comes from a real request lifecycle, never a timer, and all of it collapses to a clean static state under reduced motion.</description>+ </item><item><title>The Sniper dashboard now carries the full Money Studio — wallet, Trading Brain, pricing and earnings</title><link>https://three.ws/dashboard/sniper</link>diff --git a/public/features.json b/public/features.jsonindex dd3e7e29c..b310bf71e 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-30T19:41:47.046Z",+ "generated_at": "2026-06-30T19:47:14.623Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/clash.css b/src/clash.cssindex 650eb9e22..b9508b841 100644--- a/src/clash.css+++ b/src/clash.css@@ -331,6 +331,8 @@.cl-wl b { color: var(--success); }.cl-wl i { color: var(--danger); font-style: normal; }.cl-wr { font: 600 var(--text-sm) var(--font-mono); color: var(--ink-dim); text-align: right; min-width: 56px; }+/* Win-rate ring gauge (src/ui-juice.js) sits flush-right in the standings cell. */+.cl-wr .juice-ring { margin-left: auto; }/* ── Rally dock ─────────────────────────────────────────────────────────── */.cl-rally {diff --git a/src/clash.js b/src/clash.jsindex 0fee4ffe4..09985c412 100644--- a/src/clash.js+++ b/src/clash.js@@ -12,6 +12,7 @@import { initWalletButton, getConnectedWallet, getConnectedWalletAddress } from './wallet.js';import { log } from './shared/log.js';+import { updateValue, ring, playRings, setLiveDot } from './ui-juice.js';const $ = (id) => document.getElementById(id);const API = '/api/clash';@@ -207,6 +208,11 @@ async function renderStandings() {}const frag = document.createDocumentFragment();board.forEach((f, i) => {+ // Win rate reads as a "level", so it gets the shared ring gauge (swept by+ // playRings below). Factions with no settled battles show a plain dash.+ const wr = el('span', { class: 'cl-wr' });+ if (f.winRate == null) wr.textContent = '—';+ else wr.innerHTML = ring(f.winRate, { size: 40, stroke: 4 });frag.appendChild(el('div', { class: 'cl-row' }, [el('span', { class: 'cl-rank', text: i === 0 ? '🥇' : i === 1 ? '🥈' : i === 2 ? '🥉' : String(i + 1) }),@@ -218,11 +224,12 @@ async function renderStandings() {]),]),el('span', { class: 'cl-wl', html: `<b>${f.w}W</b> · <i>${f.l}L</i>${f.d ? ` · ${f.d}D` : ''}` }),- el('span', { class: 'cl-wr', text: f.winRate == null ? '—' : `${f.winRate}%` }),+ wr,]),);});root.replaceChildren(frag);+ playRings(root);}// ── State polling + round timer ──────────────────────────────────────────────@@ -231,14 +238,17 @@ async function poll() {const data = await apiGet('state');game.state = data;$('cl-round-no').textContent = `#${data.epoch}`;- $('cl-round-armies').textContent = String(data.factionCount || 0);+ // Count the army tally to its new value and flash the change as the bracket polls.+ updateValue($('cl-round-armies'), data.factionCount || 0, (n) => String(Math.round(n)));if (game.tab === 'arena') renderArena(data);// Keep the rally dock's army number in sync with the broader poll.if (game.enlist) {const side = findSide(data, game.enlist.token);- if (side) $('cl-army-power').textContent = fmtNum(side.power);+ if (side) updateValue($('cl-army-power'), side.power, fmtNum);}+ setLiveDot($('cl-live'), 'live', 'live');} catch (err) {+ setLiveDot($('cl-live'), game.state ? 'connecting' : 'error', game.state ? 'reconnecting' : 'offline');if (game.tab === 'arena' && !game.state) {$('cl-arena').replaceChildren(errorState(@@ -386,7 +396,7 @@ function updateRallyStats() {fill.style.width = `${pct}%`;fill.classList.toggle('is-full', pct >= 100);const side = game.state && findSide(game.state, e.token);- if (side) $('cl-army-power').textContent = fmtNum(side.power);+ if (side) updateValue($('cl-army-power'), side.power, fmtNum);}// Tap handling — accumulate locally, flush on a cadence.diff --git a/src/vaults.js b/src/vaults.jsindex 76bf41abc..06a7ae29c 100644--- a/src/vaults.js+++ b/src/vaults.js@@ -4,6 +4,7 @@// Every number here traces to a real /api/vaults endpoint; nothing is faked.import { apiFetch } from './api.js';+import { updateValue, flipReorder } from './ui-juice.js';const $ = (sel, root = document) => root.querySelector(sel);const $$ = (sel, root = document) => Array.from(root.querySelectorAll(sel));@@ -57,20 +58,16 @@ async function readErr(res, fallback) {}// ── visual helpers ───────────────────────────────────────────────────────────-const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;// Animated count-up for headline stats. fmt maps a raw number to display text.-function countUp(el, to, fmt, dur = 700) {+// Count a stat tile from its PREVIOUSLY-shown real value to the new one and flash+// the direction of change. Delegates to the shared game-feel library so the whole+// platform shares one count-up — and, unlike a from-zero animation, this never+// fakes activity on a refresh (it counts the real delta or, with no prior value,+// settles instantly).+function countUp(el, to, fmt) {if (!el) return;- if (reduceMotion || !(to > 0)) { el.textContent = fmt(to); return; }- const start = performance.now();- const step = (now) => {- const t = Math.min(1, (now - start) / dur);- const eased = 1 - Math.pow(1 - t, 3);- el.textContent = fmt(to * eased);- if (t < 1) requestAnimationFrame(step);- };- requestAnimationFrame(step);+ updateValue(el, to, fmt);}function sumBig(items, key) {@@ -233,11 +230,25 @@ function renderStats() {}function paintStats(host, tiles) {- host.innerHTML = tiles.map((t) => `<div class="vx-stat-tile${t.pos ? ' is-pos' : ''}">- <span class="vx-stat-tile-l">${t.l}</span>- <span class="vx-stat-tile-v">${esc(t.fmt(0))}</span>- ${t.sub ? `<span class="vx-stat-tile-s">${esc(t.sub)}</span>` : ''}- </div>`).join('');+ // Reuse the tile DOM across refreshes (keyed by the label set) so countUp can+ // animate from the previously-shown real value. Only rebuild when the tile set+ // changes (e.g. switching the all/mine tab), and render the real value up front+ // — never a placeholder zero that would fake a count on every refresh.+ const sig = tiles.map((t) => t.l).join('|');+ if (host.dataset.sig !== sig) {+ host.innerHTML = tiles.map((t) => `<div class="vx-stat-tile${t.pos ? ' is-pos' : ''}">+ <span class="vx-stat-tile-l">${t.l}</span>+ <span class="vx-stat-tile-v">${esc(t.fmt(t.to))}</span>+ ${t.sub ? `<span class="vx-stat-tile-s">${esc(t.sub)}</span>` : ''}+ </div>`).join('');+ host.dataset.sig = sig;+ } else {+ $$('.vx-stat-tile', host).forEach((tile, i) => {+ tile.classList.toggle('is-pos', !!tiles[i].pos);+ const s = $('.vx-stat-tile-s', tile);+ if (s && tiles[i].sub != null) s.textContent = tiles[i].sub;+ });+ }$$('.vx-stat-tile-v', host).forEach((el, i) => countUp(el, tiles[i].to, tiles[i].fmt));}@@ -259,8 +270,13 @@ function renderFeed() {const items = sortFeed(state.feed);const maxNav = items.reduce((m, v) => Math.max(m, navNum(v)), 0);const topIds = [...state.feed].filter((v) => (v.roi_bps || 0) > 0).sort((a, b) => (b.roi_bps || 0) - (a.roi_bps || 0)).slice(0, 3).map((v) => v.id);+ // FLIP cards to their new rank when the sort changes, so the board glides into+ // order instead of snapping (same data-id keys map old → new positions).+ const flip = flipReorder(grid, (el) => el.dataset.id || '');+ flip.capture();grid.innerHTML = items.map((v) => cardHtml(v, maxNav, topIds.indexOf(v.id))).join('');$$('.vx-card[data-id]', grid).forEach((c) => c.addEventListener('click', () => openDetail(c.dataset.id)));+ flip.play();}function renderMine() {