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(ui): corner stack, shared tooltip, and nav updates
nirholas73d80c615f69
diff --git a/public/corner-stack.js b/public/corner-stack.jsindex 56af4c315..87b37fd7f 100644--- a/public/corner-stack.js+++ b/public/corner-stack.js@@ -18,10 +18,21 @@* Priority: HIGHER number = closer to the corner (bottom). Members are ordered* ascending top→bottom, so the highest-priority member is the bottom-most.*+ * Reservations solve the other half of the problem. Some corner widgets cannot+ * join the flex flow: the Walk Companion is a fixed-size WebGL canvas that the+ * visitor clicks to detach into Playground mode, so it owns the literal corner+ * and lives at a higher z-index. Before reservations it simply sat on top of+ * the stack's cards. A reservation lets such a widget declare "I occupy this+ * many pixels of corner height", and the stack lifts itself clear of it. Keys+ * are independent and the tallest wins, so two reservations never fight.+ ** API (window.twsCornerStack):* mount(el, { priority }) — move `el` into the stack (sets priority if given)* unmount(el) — remove `el` from the stack* ensure() — create/return the container element+ * reserve(key, px) — keep `px` of corner height clear for `key`+ * release(key) — drop that reservation+ * reserved() — current reserved height in px*/(function () {'use strict';@@ -43,14 +54,16 @@'--z-overlay-modal:2147483600;','}','#' + STACK_ID + '{',- 'position:fixed;right:18px;bottom:18px;',+ 'position:fixed;right:18px;bottom:calc(18px + var(--tws-corner-reserve,0px));','z-index:var(--z-corner-stack,2147482500);','display:flex;flex-direction:column;align-items:flex-end;','gap:12px;max-width:min(380px,calc(100vw - 24px));',- 'max-height:calc(100dvh - 36px);overflow:visible;',+ 'max-height:calc(100dvh - 36px - var(--tws-corner-reserve,0px));overflow:visible;',/* Clicks fall through the gaps; members re-enable pointer events. */'pointer-events:none;',+ 'transition:bottom .35s cubic-bezier(.22,1,.36,1);','}',+ '@media (prefers-reduced-motion:reduce){#' + STACK_ID + '{transition:none;}}','#' + 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@@ -59,7 +72,9 @@'position:relative;inset:auto;margin:0;pointer-events:auto;','}','@media (max-width:640px){',- '#' + STACK_ID + '{right:12px;bottom:12px;left:12px;align-items:stretch;gap:10px;max-width:none;}',+ '#' ++ STACK_ID ++ '{right:12px;bottom:calc(12px + var(--tws-corner-reserve,0px));left:12px;align-items:stretch;gap:10px;max-width:none;}','}'].join('');@@ -115,6 +130,43 @@if (el && stack && el.parentNode === stack) stack.removeChild(el);}+ /* ── Reservations ────────────────────────────────────────────────────────+ Corner height claimed by widgets that cannot join the flex flow. Written+ to a custom property on <html> rather than on the stack element, so a+ reservation made before the stack exists still applies the moment it+ does — order independence is the whole point of this module. */+ var reservations = Object.create(null);++ function applyReserve() {+ var max = 0;+ for (var key in reservations) {+ if (reservations[key] > max) max = reservations[key];+ }+ var root = document.documentElement;+ if (max > 0) root.style.setProperty('--tws-corner-reserve', max + 'px');+ else root.style.removeProperty('--tws-corner-reserve');+ return max;+ }++ function reserve(key, px) {+ if (!key) return reservedHeight();+ var n = Number(px);+ /* Guard against a mid-transition measurement of 0 (the companion mounts+ at opacity 0 and animates in) collapsing the stack back onto it. */+ if (!Number.isFinite(n) || n <= 0) return release(key);+ reservations[key] = Math.round(n);+ return applyReserve();+ }++ function release(key) {+ delete reservations[key];+ return applyReserve();+ }++ function reservedHeight() {+ return applyReserve();+ }+/* Adopt widgets that mounted to <body> before this script executed. */function adoptOrphans() {if (!document.body) return;@@ -122,8 +174,25 @@for (var i = 0; i < orphans.length; i++) place(orphans[i]);}- window.twsCornerStack = { mount: mount, unmount: unmount, ensure: ensureStack };+ window.twsCornerStack = {+ mount: mount,+ unmount: unmount,+ ensure: ensureStack,+ reserve: reserve,+ release: release,+ reserved: reservedHeight+ };if (document.body) adoptOrphans();else document.addEventListener('DOMContentLoaded', adoptOrphans);++ /* Announce ourselves so a widget that mounted first can (re)claim its+ reservation. Orphan adoption already covers stack MEMBERS; this covers+ non-members like the Walk Companion, whose module is loaded separately+ and could otherwise win the race and find no stack to reserve against. */+ try {+ window.dispatchEvent(new CustomEvent('tws-corner-stack:ready'));+ } catch (e) {+ /* CustomEvent unavailable: reservations still work for later mounts. */+ }})();diff --git a/public/nav-data.js b/public/nav-data.jsindex 8be34644f..17c45a80d 100644--- a/public/nav-data.js+++ b/public/nav-data.js@@ -379,6 +379,13 @@ export const NAV_GROUPS = [badgeTone: 'live',desc: 'Start here: live fleet vitals, the agent scoreboard, and every trading surface in one map',},+ {+ title: 'Exit Lab',+ href: '/exit-lab',+ badge: 'New',+ badgeTone: 'new',+ desc: "Replay the fleet's real closed trades under a different exit policy and see what the SOL it already spent would have returned",+ },{title: 'Mission Control',href: '/terminal',diff --git a/public/nav.css b/public/nav.cssindex 4b08a9590..9c1f3371e 100644--- a/public/nav.css+++ b/public/nav.css@@ -483,6 +483,12 @@background: rgba(88,214,141,0.12); color: #6fdf9d;box-shadow: inset 0 0 0 1px rgba(88,214,141,0.22);}+/* "new" tone — recently shipped. Distinct from "live" on purpose: a new+ surface is worth a look, a live one is worth watching. */+.nav-pill-new {+ background: rgba(139,92,246,0.16); color: #c4b5fd;+ box-shadow: inset 0 0 0 1px rgba(139,92,246,0.3);+}/* ── "Hot" top-level link — the one feature the nav spotlights ──────────── *//* Iridescent thread shared with the Forge brand (home #home-forge --hf-iris). */@@ -574,6 +580,10 @@background: rgba(46, 160, 90, 0.12); color: #1e8e4e;box-shadow: inset 0 0 0 1px rgba(46, 160, 90, 0.3);}+:root[data-theme='light'] .nav-pill-new {+ background: rgba(109, 40, 217, 0.1); color: #5b21b6;+ box-shadow: inset 0 0 0 1px rgba(109, 40, 217, 0.28);+}.nav-pop-note {padding: 6px 12px 8px; font-size: var(--text-2xs); color: var(--nv-text-4);line-height: 1.45; grid-column: 1 / -1;diff --git a/public/nav.js b/public/nav.jsindex 51f143b0e..f00fd8555 100644--- a/public/nav.js+++ b/public/nav.js@@ -371,7 +371,7 @@ function advancedCount(group) {}function renderMenuItem(item) {- const tone = item.badgeTone === 'live' ? ' nav-pill-live' : '';+ const tone = item.badgeTone === 'live' ? ' nav-pill-live' : item.badgeTone === 'new' ? ' nav-pill-new' : '';const badge = item.badge? ` <span class="nav-pill-sm${tone}"${i18nAttr(item.badge)}>${escHtml(item.badge)}</span>`: '';diff --git a/src/shared/tooltip.js b/src/shared/tooltip.jsnew file mode 100644index 000000000..7d5faa1f5--- /dev/null+++ b/src/shared/tooltip.js@@ -0,0 +1,277 @@+// three.ws tooltips: one accessible primitive, driven by a `data-tip` attribute.+//+// Every surface that wanted a hint had been reaching for the native `title`+// attribute, which no touch device shows, screen readers announce+// inconsistently, and no stylesheet can reach. This replaces it with one+// delegated implementation:+//+// <button data-tip="Cycle the camera">C</button>+// import { initTooltips } from '/src/shared/tooltip.js';+// initTooltips();+//+// Delegation (not per-element listeners) is deliberate: elements added after+// init, re-rendered lists, and anything inside a dialog all get tooltips with+// no re-scan and no MutationObserver.+//+// Behaviour:+// - Pointer hover opens after a short delay, closes immediately on leave.+// - Keyboard focus opens with no delay: a keyboard user has already committed.+// - Touch long-press opens; the next tap anywhere closes.+// - Escape closes; scrolling or resizing closes rather than leaving a+// tooltip stranded away from its anchor.+// - The bubble flips above/below and clamps horizontally so it is never+// partly off-screen.+// - `prefers-reduced-motion` drops the fade.+//+// Accessibility: the bubble carries role="tooltip" and the anchor gets+// aria-describedby while it is open, so the text is announced as a description+// of the control rather than as a separate stray node.++const BUBBLE_ID = 'tw-tooltip';+const STYLE_ID = 'tw-tooltip-css';+const OPEN_DELAY = 380;+const TOUCH_DELAY = 420;+const EDGE = 10;+const GAP = 9;++let bubble = null;+let anchor = null;+let openTimer = 0;+let touchTimer = 0;+let installed = false;++function injectStyles() {+ if (document.getElementById(STYLE_ID)) return;+ const style = document.createElement('style');+ style.id = STYLE_ID;+ style.textContent = `+#${BUBBLE_ID} {+ position: fixed;+ z-index: 2147483000;+ max-width: min(280px, calc(100vw - 24px));+ padding: 7px 10px;+ border-radius: 8px;+ background: var(--tw-tip-bg, #16161f);+ color: var(--tw-tip-ink, #f2f0ff);+ border: 1px solid var(--tw-tip-border, rgba(255, 255, 255, 0.14));+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);+ font: 500 12.5px/1.45 Inter, system-ui, -apple-system, sans-serif;+ letter-spacing: 0.005em;+ pointer-events: none;+ opacity: 0;+ transform: translateY(3px);+ transition: opacity .13s ease, transform .13s ease;+ white-space: normal;+ overflow-wrap: anywhere;+}+#${BUBBLE_ID}[data-open="1"] { opacity: 1; transform: none; }+#${BUBBLE_ID} kbd {+ font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;+ padding: 2px 5px;+ margin: 0 1px;+ border-radius: 4px;+ background: rgba(255, 255, 255, 0.1);+ border: 1px solid rgba(255, 255, 255, 0.16);+}+:root[data-theme="light"] #${BUBBLE_ID} {+ --tw-tip-bg: #1c1c24;+ --tw-tip-ink: #f7f6ff;+}+@media (prefers-reduced-motion: reduce) {+ #${BUBBLE_ID} { transition: none; transform: none; }+}+`;+ document.head.appendChild(style);+}++function ensureBubble() {+ if (bubble && bubble.isConnected) return bubble;+ injectStyles();+ bubble = document.createElement('div');+ bubble.id = BUBBLE_ID;+ bubble.setAttribute('role', 'tooltip');+ document.body.appendChild(bubble);+ return bubble;+}++/** Nearest ancestor (inclusive) carrying a non-empty data-tip. */+function tipTarget(node) {+ let el = node instanceof Element ? node : null;+ while (el) {+ if (el.dataset && el.dataset.tip) return el;+ el = el.parentElement;+ }+ return null;+}++function place(el) {+ const b = ensureBubble();+ const r = el.getBoundingClientRect();+ const bw = b.offsetWidth;+ const bh = b.offsetHeight;+ const vw = window.innerWidth;+ const vh = window.innerHeight;++ // Prefer below when the anchor sits in the top third (a header chip's tooltip+ // belongs under it, not clipped off the top of the viewport), above otherwise.+ const wantsBelow = r.top < vh * 0.34;+ const fitsBelow = r.bottom + GAP + bh <= vh - EDGE;+ const fitsAbove = r.top - GAP - bh >= EDGE;+ const below = wantsBelow ? fitsBelow || !fitsAbove : !fitsAbove && fitsBelow;++ const top = below ? r.bottom + GAP : r.top - GAP - bh;+ const left = r.left + r.width / 2 - bw / 2;++ b.style.top = Math.max(EDGE, Math.min(top, vh - bh - EDGE)) + 'px';+ b.style.left = Math.max(EDGE, Math.min(left, vw - bw - EDGE)) + 'px';+}++/**+ * Show the tooltip for `el` immediately.+ * @param {Element} el an element carrying data-tip+ */+export function showTooltip(el) {+ const text = el?.dataset?.tip;+ if (!text) return;+ const b = ensureBubble();+ hideTooltip();++ // <kbd> is the one tag worth honouring here (key hints are most of what+ // tooltips say on this platform); everything else is escaped as text.+ b.innerHTML = escapeHtml(text).replace(/\[\[(.+?)\]\]/g, '<kbd>$1</kbd>');++ // The anchor keeps its own id if it has one, so we never rewrite page state.+ b.dataset.open = '1';+ anchor = el;+ el.setAttribute('aria-describedby', BUBBLE_ID);+ // Measure after content is in, before positioning.+ place(el);+}++/** Hide the tooltip and release the anchor. */+export function hideTooltip() {+ clearTimeout(openTimer);+ clearTimeout(touchTimer);+ if (anchor) {+ anchor.removeAttribute('aria-describedby');+ anchor = null;+ }+ if (bubble) bubble.dataset.open = '0';+}++function scheduleShow(el, delay) {+ clearTimeout(openTimer);+ openTimer = setTimeout(() => showTooltip(el), delay);+}++/**+ * Give `el` a tooltip. Equivalent to setting data-tip in markup; use this for+ * elements built in JS. Wrap a key name in [[…]] to render it as a <kbd>.+ *+ * @param {Element} el+ * @param {string} text+ */+export function attachTooltip(el, text) {+ if (!el) return;+ if (text) el.dataset.tip = text;+ else delete el.dataset.tip;+ // A native title would double up with the bubble on desktop, showing both.+ if (el.hasAttribute('title')) el.removeAttribute('title');+}++/**+ * Install the delegated listeners. Safe to call more than once; only the first+ * call does anything, so every module on a page can call it defensively.+ */+export function initTooltips() {+ if (installed) return;+ installed = true;+ injectStyles();++ document.addEventListener(+ 'pointerover',+ (e) => {+ if (e.pointerType === 'touch') return; // touch is handled by long-press+ const el = tipTarget(e.target);+ if (!el || el === anchor) return;+ hideTooltip();+ scheduleShow(el, OPEN_DELAY);+ },+ true,+ );++ document.addEventListener(+ 'pointerout',+ (e) => {+ const el = tipTarget(e.target);+ if (!el) return;+ // Moving within the same anchor (over a child) is not a leave.+ if (tipTarget(e.relatedTarget) === el) return;+ hideTooltip();+ },+ true,+ );++ document.addEventListener(+ 'focusin',+ (e) => {+ const el = tipTarget(e.target);+ if (!el) return;+ hideTooltip();+ showTooltip(el);+ },+ true,+ );++ document.addEventListener('focusout', hideTooltip, true);++ document.addEventListener(+ 'pointerdown',+ (e) => {+ if (e.pointerType !== 'touch') {+ // A click means the user acted; the hint has served its purpose.+ hideTooltip();+ return;+ }+ const el = tipTarget(e.target);+ hideTooltip();+ if (el) {+ touchTimer = setTimeout(() => showTooltip(el), TOUCH_DELAY);+ }+ },+ true,+ );++ document.addEventListener('pointerup', () => clearTimeout(touchTimer), true);+ document.addEventListener('pointercancel', hideTooltip, true);++ document.addEventListener('keydown', (e) => {+ if (e.key === 'Escape') hideTooltip();+ });++ // A tooltip is positioned against a rect that scrolling or resizing+ // invalidates; reposition rather than leaving it floating in the wrong place.+ addEventListener(+ 'scroll',+ () => {+ if (anchor) place(anchor);+ },+ { passive: true, capture: true },+ );+ addEventListener(+ 'resize',+ () => {+ if (anchor) place(anchor);+ },+ { passive: true },+ );+ // A tab switch leaves a tooltip pinned over the page on return.+ document.addEventListener('visibilitychange', () => {+ if (document.hidden) hideTooltip();+ });+}++const ESC = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' };+function escapeHtml(s) {+ return String(s ?? '').replace(/[&<>"']/g, (c) => ESC[c]);+}diff --git a/tests/corner-stack.test.js b/tests/corner-stack.test.jsnew file mode 100644index 000000000..44c61627f--- /dev/null+++ b/tests/corner-stack.test.js@@ -0,0 +1,207 @@+/**+ * The shared bottom-right corner stack (public/corner-stack.js).+ *+ * Two distinct collision classes live here, and both were real regressions:+ *+ * 1. Stack MEMBERS ("Getting started", feature discovery, the language FAB)+ * each used to hard-code `position:fixed; right; bottom` and piled onto+ * the same pixel. The stack flows them vertically by priority instead.+ * 2. Corner NON-MEMBERS. The Walk Companion is a fixed-size WebGL canvas at+ * a higher z-index that the visitor clicks to detach into Playground+ * mode, so it cannot join the flex flow — and it simply covered the+ * stack's cards on any page where both were on. Reservations fix that:+ * the companion declares the corner height it occupies, the stack lifts+ * clear of it.+ *+ * The module is a plain IIFE served straight from public/, so it is exercised+ * here the way a browser does: evaluated inside a JSDOM window.+ */++import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';+import { describe, it, expect, beforeEach } from 'vitest';+import { JSDOM } from 'jsdom';++const root = resolve(__dirname, '..');+const SOURCE = readFileSync(resolve(root, 'public/corner-stack.js'), 'utf8');++/** Boot a fresh window with corner-stack.js evaluated in it. */+function boot() {+ const dom = new JSDOM('<!doctype html><html><body></body></html>', {+ runScripts: 'outside-only',+ });+ dom.window.eval(SOURCE);+ return dom.window;+}++function card(win, priority) {+ const el = win.document.createElement('div');+ if (priority != null) el.setAttribute('data-corner-priority', String(priority));+ return el;+}++/** The custom property the stack's `bottom` calc() reads. */+function reserveVar(win) {+ return win.document.documentElement.style.getPropertyValue('--tws-corner-reserve');+}++describe('corner stack — membership', () => {+ let win;+ beforeEach(() => {+ win = boot();+ });++ it('exposes the full API on the window', () => {+ for (const fn of ['mount', 'unmount', 'ensure', 'reserve', 'release', 'reserved']) {+ expect(typeof win.twsCornerStack[fn], fn).toBe('function');+ }+ });++ it('orders members so the highest priority sits nearest the corner', () => {+ const low = card(win, 10);+ const high = card(win, 90);+ const mid = card(win, 50);+ win.twsCornerStack.mount(high);+ win.twsCornerStack.mount(low);+ win.twsCornerStack.mount(mid);+ const order = [...win.document.getElementById('tws-corner-stack').children].map((el) =>+ Number(el.getAttribute('data-corner-priority')),+ );+ expect(order).toEqual([10, 50, 90]);+ });++ it('adopts widgets that mounted to <body> before the script ran', () => {+ // Order independence is the module's whole premise: a widget that beats+ // it to the page tags itself and appends to <body>.+ const dom = new JSDOM(+ '<!doctype html><html><body><div id="early" data-corner-priority="70"></div></body></html>',+ { runScripts: 'outside-only' },+ );+ dom.window.eval(SOURCE);+ const early = dom.window.document.getElementById('early');+ expect(early.parentNode.id).toBe('tws-corner-stack');+ expect(early.classList.contains('tws-corner-item')).toBe(true);+ });++ it('unmount returns a member to nowhere rather than leaving a ghost', () => {+ const el = card(win, 50);+ win.twsCornerStack.mount(el);+ win.twsCornerStack.unmount(el);+ expect(win.document.getElementById('tws-corner-stack').children.length).toBe(0);+ });+});++describe('corner stack — reservations', () => {+ let win;+ beforeEach(() => {+ win = boot();+ });++ it('starts with nothing reserved', () => {+ expect(reserveVar(win)).toBe('');+ expect(win.twsCornerStack.reserved()).toBe(0);+ });++ it('lifts the stack by the reserved height', () => {+ expect(win.twsCornerStack.reserve('walk-companion', 296)).toBe(296);+ expect(reserveVar(win)).toBe('296px');+ });++ it('keeps reservations independent and lets the tallest win', () => {+ win.twsCornerStack.reserve('walk-companion', 296);+ win.twsCornerStack.reserve('other', 120);+ expect(win.twsCornerStack.reserved()).toBe(296);+ // Dropping the tall one must fall back to the short one, not to zero.+ win.twsCornerStack.release('walk-companion');+ expect(win.twsCornerStack.reserved()).toBe(120);+ win.twsCornerStack.release('other');+ expect(reserveVar(win)).toBe('');+ });++ it('ignores a zero or non-finite measurement instead of collapsing', () => {+ // The companion mounts at opacity 0 mid-transition; a height read at the+ // wrong moment must never drop the stack back on top of it.+ win.twsCornerStack.reserve('walk-companion', 296);+ win.twsCornerStack.reserve('ghost', 0);+ win.twsCornerStack.reserve('ghost2', Number.NaN);+ expect(win.twsCornerStack.reserved()).toBe(296);+ });++ it('survives a release for a key that never reserved', () => {+ expect(() => win.twsCornerStack.release('never-there')).not.toThrow();+ expect(win.twsCornerStack.reserved()).toBe(0);+ });++ it('announces itself so a widget that booted first can claim the corner', () => {+ // The companion module is injected separately by public/nav.js and can win+ // the load race. Without this event it would find no stack and silently+ // keep no reservation for the rest of the session.+ const dom = new JSDOM('<!doctype html><html><body></body></html>', {+ runScripts: 'outside-only',+ });+ let fired = false;+ dom.window.addEventListener('tws-corner-stack:ready', () => {+ fired = true;+ });+ dom.window.eval(SOURCE);+ expect(fired).toBe(true);+ });+});++describe('corner stack — stylesheet contract', () => {+ it('drives both the desktop and the narrow-viewport offset from the reserve', () => {+ // Two rules set `bottom`: the base rule and the <=640px rule that goes+ // full-width. A reservation honoured by only one of them still buries the+ // cards on the other, which is exactly how this shipped broken before.+ const bottoms = SOURCE.match(/bottom:calc\([^)]*var\(--tws-corner-reserve[^)]*\)[^)]*\)/g) || [];+ expect(bottoms.length).toBe(2);+ });++ it('caps its height against the reserve so a tall stack cannot overflow', () => {+ expect(SOURCE).toContain('max-height:calc(100dvh - 36px - var(--tws-corner-reserve,0px))');+ });++ it('honours prefers-reduced-motion for the lift', () => {+ expect(SOURCE).toContain('@media (prefers-reduced-motion:reduce)');+ });+});++describe('walk companion — the reserving widget', () => {+ const companion = readFileSync(resolve(root, 'walk-sdk/src/companion.js'), 'utf8');++ it('claims the corner on mount and gives it back on unmount', () => {+ expect(companion).toContain("const CORNER_RESERVE_KEY = 'walk-companion'");+ expect(companion).toContain('stack.reserve(CORNER_RESERVE_KEY');+ expect(companion).toContain('release?.(CORNER_RESERVE_KEY)');+ });++ it('re-measures on resize and when the stack boots late', () => {+ expect(companion).toContain("window.addEventListener('resize', this._syncCornerReserve)");+ expect(companion).toContain(+ "window.addEventListener('tws-corner-stack:ready', this._syncCornerReserve)",+ );+ // Every listener it adds must come back off, or a re-mounted companion+ // stacks duplicate handlers for the life of the page.+ expect(companion).toContain("window.removeEventListener('resize', this._syncCornerReserve)");+ expect(companion).toContain(+ "window.removeEventListener('tws-corner-stack:ready', this._syncCornerReserve)",+ );+ });++ it('measures from computed style, not a rect caught mid-transition', () => {+ // The host animates in with a translateY, and getBoundingClientRect()+ // reports the transformed box — a reservation measured there would settle+ // short and leave the cards clipped.+ const start = companion.indexOf('_syncCornerReserve() {');+ expect(start).toBeGreaterThan(-1);+ const body = companion.slice(start, companion.indexOf('\n\t}', start));+ expect(body).toContain('getComputedStyle(this.host)');+ expect(body).not.toContain('getBoundingClientRect');+ });++ it('degrades silently on a page with no corner stack', () => {+ // walk-sdk publishes standalone as @three-ws/walk; the integration is+ // opt-in, never a hard dependency.+ expect(companion).toContain("typeof stack.reserve !== 'function'");+ });+});