From 7b28b902d556799c8edc8ee31541a3f9ae3410c0 Mon Sep 17 00:00:00 2001
From: Kevin Longe <273747162+kvlonge@users.noreply.github.com>
Date: Wed, 2 Dec 2026 15:01:02 +0000
Subject: [PATCH 1/2] Show the tools as the hero's dotted discs, opened up
The tool section's tilted panes become a stack of dotted discs like the
hero, each faintly in its tool's colour with its name beside it. Pointing
at a disc or its name lights it, opens the stack around it and shows its
card; the lit disc is always the one drawn under the pointer. A click on
the stack ripples through the dots, and each name links to its site.
---
index.html | 2 +-
styles.css | 40 ++---
tests/website.spec.mjs | 30 +++-
tools.js | 321 +++++++++++++++++++++++++++++++++++------
4 files changed, 314 insertions(+), 79 deletions(-)
diff --git a/index.html b/index.html
index a811246..d1b1c48 100644
--- a/index.html
+++ b/index.html
@@ -28,7 +28,7 @@
-
+
diff --git a/styles.css b/styles.css
index d80a500..1544871 100644
--- a/styles.css
+++ b/styles.css
@@ -258,25 +258,21 @@ h1 { margin: 0; max-width: 11ch; font-size: clamp(44px, 5.4vw, 80px); line-heigh
}
-/* The exploded tool stack (tools.js): tilted panes beside the picked tool's card. */
+/* The tool stack (tools.js): the hero's dotted discs, each named beside it, next to the picked tool's card. */
.tool-x { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); align-items: center; gap: 48px; }
-.tool-x-stack { display: grid; justify-items: center; gap: 8px; }
-.tool-x-tower { position: relative; width: 340px; height: 220px; margin: 170px 0 90px; transform-style: preserve-3d; transform: perspective(2000px) rotateX(58deg) rotateZ(-38deg); }
-.tool-x-pane { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--line)); border-radius: 2px; background: color-mix(in srgb, var(--background) 82%, transparent); color: var(--muted); pointer-events: none; transform: translateZ(calc(var(--i) * 58px)); transition: transform .45s cubic-bezier(.2, .7, .2, 1), background-color .3s ease, box-shadow .3s ease, color .3s ease; box-shadow: 0 30px 50px -30px rgb(0 0 0 / .25); }
-/* The panes' fixed twins (tools.js): transparent, never lifted, and the only part that takes the pointer. */
-.tool-x-hit { position: absolute; inset: 0; cursor: pointer; transform: translateZ(calc(var(--i) * 58px)); }
-.tool-x-pane::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 45%, transparent) 1px, transparent 1.6px) 0 0 / 9px 9px; opacity: .35; pointer-events: none; transition: opacity .3s ease; }
-.tool-x-pane.is-active { color: var(--ink); background: color-mix(in srgb, var(--accent) 10%, var(--background)); transform: translateZ(calc(var(--i) * 58px + 34px)); box-shadow: 0 0 0 1px var(--accent), 0 40px 60px -30px color-mix(in srgb, var(--accent) 60%, transparent); }
-.tool-x-pane.is-active::after { opacity: .7; }
-.tool-x-name { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; font: 700 16px "Space Grotesk", sans-serif; }
-.tool-x-name img, .tool-x-chip img { width: 20px; height: 20px; }
-.tool-x-name img.wide, .tool-x-chip img.wide { width: 24px; }
-.tool-x-mini { position: relative; z-index: 1; margin: 0; overflow: hidden; color: inherit; font-family: var(--mono); font-size: 6.5px; line-height: 1.5; opacity: .75; }
-.tool-x-mini .ln { display: block; white-space: pre; }
-.tool-x-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
-.tool-x-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 2px; background: var(--background); color: var(--muted); font: 500 14px Inter, sans-serif; cursor: pointer; }
-.tool-x-chip:hover { color: var(--ink); border-color: var(--muted); }
-.tool-x-chip[aria-pressed="true"] { color: var(--ink); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
+.tool-x-stack { display: grid; }
+/* Clipped, so names placed for the previous width can't widen the page in the frame before tools.js moves them. */
+.tool-x-discs { position: relative; width: 100%; max-width: 520px; justify-self: center; overflow: clip; overflow-clip-margin: 8px; }
+.tool-x-discs canvas { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-tap-highlight-color: transparent; }
+.tool-x-chips { position: absolute; inset: 0; pointer-events: none; }
+/* Names in the stack's order; tools.js sets each one's height to its disc's. */
+.tool-x-chip { position: absolute; left: var(--label-x); display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 2px; color: var(--muted); font: 700 16px "Space Grotesk", sans-serif; text-decoration: none; white-space: nowrap; pointer-events: auto; transform: translateY(-50%); transition: color .2s ease; }
+.tool-x-chip::before { content: ""; position: absolute; right: calc(100% + 6px); top: 50%; width: 10px; border-top: 1px dotted var(--line); }
+.tool-x-chip:hover { color: var(--ink); }
+.tool-x-chip.is-on { color: var(--accent); }
+.tool-x-chip.is-on::before { width: 14px; border-top-color: var(--accent); }
+.tool-x-chip img { width: 20px; height: 20px; }
+.tool-x-chip img.wide { width: 24px; }
/* Every card sits in the same cell, so the section is as tall as the longest card and nothing below
jumps; each card keeps its own height and starts at the top, so a short one has no empty terminal. */
.is-exploded .tool-grid { grid-template-columns: minmax(0, 1fr); border: 0; }
@@ -285,17 +281,11 @@ h1 { margin: 0; max-width: 11ch; font-size: clamp(44px, 5.4vw, 80px); line-heigh
@media (max-width: 900px) {
.tool-x { grid-template-columns: minmax(0, 1fr); gap: 32px; }
- .tool-x-tower { margin: 220px 0 70px; transform: perspective(2000px) rotateX(58deg) rotateZ(-38deg) scale(.8); }
}
@media (max-width: 620px) {
- .tool-x-tower { margin: 170px 0 30px; transform: perspective(2000px) rotateX(58deg) rotateZ(-38deg) scale(.6); }
- .tool-x-chip { padding: 0 10px; gap: 6px; font-size: 13px; }
/* On a phone each card takes its own height, so a short one has no empty terminal under it. */
.is-exploded .tool:not(.is-active) { display: none; }
}
-@media (max-width: 380px) {
- .tool-x-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
-}
@media (prefers-reduced-motion: reduce) {
- .tool-x-pane, .is-exploded .tool, .is-exploded .tool.is-active { transition: none; }
+ .tool-x-chip, .is-exploded .tool, .is-exploded .tool.is-active { transition: none; }
}
diff --git a/tests/website.spec.mjs b/tests/website.spec.mjs
index 919241e..62d3491 100644
--- a/tests/website.spec.mjs
+++ b/tests/website.spec.mjs
@@ -63,13 +63,15 @@ test('tools, stack layers, sharing assets and responsive layout work in both the
await expect(page.getByRole('link', { name: 'SQLStack on GitHub', exact: true })).toHaveAttribute('href', 'https://github.com/sqlstack-io');
const grid = page.locator('.tool-grid');
- const chips = page.getByRole('group', { name: 'Show a tool' });
+ const names = page.getByRole('navigation', { name: 'All tools' });
const batch = page.getByRole('navigation', { name: 'Batch tools' });
const streaming = page.getByRole('navigation', { name: 'Streaming tools' });
for (const [name, website] of tools) {
- // One card shows at a time; its chip picks it.
- await chips.getByRole('button', { name, exact: true }).click();
- await expect(chips.getByRole('button', { name, exact: true })).toHaveAttribute('aria-pressed', 'true');
+ // One card shows at a time; focusing a tool's name beside the discs picks it, and the name links to its site.
+ const label = names.getByRole('link', { name, exact: true });
+ await expect(label).toHaveAttribute('href', website);
+ await label.focus();
+ await expect(label).toHaveClass(/is-on/);
await expect(grid.getByRole('link', { name: /website$/ })).toHaveCount(1);
await expect(grid.getByRole('link', { name: `${name} website`, exact: true })).toHaveAttribute('href', website);
await expect(grid.getByRole('link', { name: new RegExp(`^${name} docs: `) })).toHaveAttribute('href', new RegExp(`^${website.replace(/\/$/, '')}/docs/`));
@@ -94,7 +96,7 @@ test('tools, stack layers, sharing assets and responsive layout work in both the
await expect(caption).toHaveCSS('opacity', '0');
await page.mouse.move(5, 5);
await expect(tide.locator('.label')).toHaveCSS('opacity', '0');
- await chips.getByRole('button', { name: 'SQLBuild', exact: true }).click();
+ await names.getByRole('link', { name: 'SQLBuild', exact: true }).focus();
await expect(page.getByRole('article', { name: 'SQLBuild', exact: true })).toHaveAccessibleDescription(/^SQL and Python transformations and orchestration\. /);
for (const width of [320, 390, 700, 768, 1101, 1536]) {
@@ -109,7 +111,7 @@ test('tools, stack layers, sharing assets and responsive layout work in both the
await page.keyboard.press('Enter');
await expect(page).toHaveURL(/#tools$/);
await page.keyboard.press('Tab');
- await expect(chips.getByRole('button', { name: 'SQLBuild', exact: true })).toBeFocused();
+ await expect(names.getByRole('link', { name: 'SQLClean', exact: true })).toBeFocused();
}
await expect(page.locator('link[rel="canonical"]')).toHaveAttribute('href', 'https://sqlstack.io/');
@@ -205,3 +207,19 @@ for (const input of ['touch', 'mouse']) {
await context.close();
});
}
+
+test('a tool name beside the discs shows its card when pointed at and opens its site on a click', async ({ browser }) => {
+ const context = await browser.newContext({ viewport: { width: 1280, height: 800 } });
+ await context.route('https://sqltide.io/**', (route) => route.fulfill({ body: 'SQLTide' }));
+ const page = await context.newPage();
+ await page.goto('/#tools');
+ const name = page.getByRole('navigation', { name: 'All tools' }).getByRole('link', { name: 'SQLTide', exact: true });
+ const box = await name.boundingBox();
+ await page.mouse.move(box.x + box.width / 2, box.y - 40);
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, { steps: 4 });
+ await expect(name).toHaveClass(/is-on/);
+ await expect(page.locator('article.tool.sqltide')).toHaveClass(/is-active/);
+ await name.click();
+ await page.waitForURL('https://sqltide.io/');
+ await context.close();
+});
diff --git a/tools.js b/tools.js
index aef5dee..186d8b6 100644
--- a/tools.js
+++ b/tools.js
@@ -1,10 +1,11 @@
-// The tool section as an exploded stack: one tilted pane per tool, stacked as in
-// the hero, beside the card for the tool that is picked. Without this script the
-// cards show as a plain grid.
+// The tool section as the hero's dotted discs, opened up: one disc per tool, with its name beside
+// it, next to the card for the tool that is picked. The picked disc lights in its tool's colour
+// and the stack opens around it; a click on the stack ripples through the dots. Each name links to
+// its tool's site. Without this script the cards show as a plain grid.
(() => {
const TOWER = ['sqlload', 'sqltide', 'sqlbuild', 'sqlbabel', 'fensu', 'sqlclean']; // bottom to top
const CYCLE_MS = 4500;
- const DWELL_MS = 120; // how long the pointer stays on a pane before it takes over
+ const DWELL_MS = 50; // how long the pointer stays on a disc before it takes over
function init(section) {
const grid = section.querySelector('.tool-grid');
@@ -38,50 +39,275 @@
const stack = document.createElement('div');
stack.className = 'tool-x-stack';
const tower = document.createElement('div');
- tower.className = 'tool-x-tower';
- tower.setAttribute('aria-hidden', 'true');
- // Each pane has an invisible twin that never lifts and takes the pointer, so lifting a pane
- // can't change which one is under it; otherwise the edge between two panes flickers.
- const hits = [];
- const panes = TOWER.map((key, i) => {
- const tool = byKey(key);
- const pane = document.createElement('div');
- pane.className = `tool-x-pane ${key}`;
- pane.style.setProperty('--i', i);
- const hit = document.createElement('div');
- hit.className = 'tool-x-hit';
- hit.dataset.pane = key;
- hit.style.setProperty('--i', i);
- hit.addEventListener('pointermove', (event) => {
- if (event.pointerType === 'mouse' && moved) aim(key, event);
- });
- hit.addEventListener('click', () => pick(key, true));
- hits.push(hit);
- const name = document.createElement('span');
- name.className = 'tool-x-name';
- name.append(...logos(tool), tool.name);
- const mini = tool.article.querySelector('.terminal').cloneNode(true);
- mini.className = 'tool-x-mini';
- pane.append(name, mini);
- tower.append(pane);
- return pane;
- });
- tower.append(...hits);
- const chips = document.createElement('div');
+ tower.className = 'tool-x-discs';
+ const canvas = document.createElement('canvas');
+ canvas.setAttribute('aria-hidden', 'true');
+ tower.append(canvas);
+ const ctx = canvas.getContext('2d');
+ const TILT = 0.5;
+ const SIN = Math.sin(TILT);
+ const COS = Math.cos(TILT);
+ const H = 0.12; // disc thickness
+ const G = 0.3; // gap between discs at rest
+ const OPEN = 0.14; // extra room above and below the picked disc
+ const SPOKES = 96;
+ const ROWS = 3;
+ const RINGS = 5;
+ const TURN_SECONDS = 48;
+ const LIGHT = [-0.62, -0.55, 0.56].map((c, _, v) => c / Math.hypot(...v));
+ const n = TOWER.length;
+ const total = n * H + (n - 1) * G;
+ // Top to bottom, as drawn; a column of discs on a wider base, like the hero.
+ const discs = [...TOWER].reverse().map((key, t) => ({
+ key,
+ t,
+ radius: t === n - 1 ? 1 : 0.8 + (0.06 * t) / (n - 2),
+ top: -total / 2 + t * (H + G),
+ glow: 0,
+ target: 0,
+ shift: 0,
+ }));
+ let width = 0;
+ let height = 0;
+ let scale = 0;
+ let cx = 0;
+ let cy = 0;
+ let dpr = 1;
+ let ink = [23, 26, 31];
+ let bg = [255, 255, 255];
+ let angle = 0.6;
+ let last = 0;
+ let now = 0;
+ let frame = 0;
+ let onScreen = true;
+ const ripples = [];
+ const rgb = (value) => {
+ let hex = value.trim().replace('#', '');
+ if (hex.length === 3) hex = hex.replace(/./g, '$&$&');
+ const v = parseInt(hex, 16);
+ return [(v >> 16) & 255, (v >> 8) & 255, v & 255];
+ };
+ const mix = (a, b, k) => a.map((c, i) => Math.round(c + (b[i] - c) * k));
+
+ // Each tool's name beside its disc, top to bottom, links to its site. Pointing at it or
+ // focusing it lights the disc and shows the card; clicking it opens the site.
+ const chips = document.createElement('nav');
chips.className = 'tool-x-chips';
- chips.setAttribute('role', 'group');
- chips.setAttribute('aria-label', 'Show a tool');
- for (const tool of tools) {
- const chip = document.createElement('button');
- chip.type = 'button';
+ chips.setAttribute('aria-label', 'All tools');
+ for (const disc of discs) {
+ const tool = byKey(disc.key);
+ const chip = document.createElement('a');
+ chip.href = tool.article.querySelector('.tool-head').getAttribute('href');
chip.className = `tool-x-chip ${tool.key}`;
chip.dataset.tool = tool.key;
- chip.setAttribute('aria-controls', tool.article.id);
chip.append(...logos(tool), tool.name);
- chip.addEventListener('click', () => pick(tool.key, true));
+ chip.addEventListener('focus', () => pick(tool.key, true));
+ chip.addEventListener('pointermove', (event) => {
+ if (event.pointerType === 'mouse' && moved) aim(tool.key, event);
+ });
chips.append(chip);
}
- stack.append(tower, chips);
+ tower.append(chips);
+ stack.append(tower);
+
+ function colours() {
+ const style = getComputedStyle(document.documentElement);
+ ink = rgb(style.getPropertyValue('--ink'));
+ bg = rgb(style.getPropertyValue('--background'));
+ for (const disc of discs) disc.accent = rgb(getComputedStyle(chips.querySelector(`[data-tool="${disc.key}"]`)).getPropertyValue('--accent'));
+ }
+ function sizeDiscs() {
+ width = tower.clientWidth;
+ if (!width) return;
+ // Centre the discs and their names together, and shrink the discs when the names need room.
+ const names = Math.max(...[...chips.children].map((chip) => chip.offsetWidth));
+ scale = Math.max(40, Math.min(170, width * 0.3, (width - names - 38) / 2.06));
+ cx = Math.max(0, (width - (scale * 2.06 + 30 + names)) / 2) + scale * 1.03;
+ height = Math.ceil(scale * ((total + 2 * OPEN) * COS + 2 * SIN) + 24);
+ cy = height / 2;
+ tower.style.height = `${height}px`;
+ dpr = Math.min(devicePixelRatio || 1, 2);
+ canvas.width = Math.round(width * dpr);
+ canvas.height = Math.round(height * dpr);
+ // Far enough out that even the lit leader stays clear of the widest disc's dots.
+ tower.style.setProperty('--label-x', `${cx + scale * 1.03 + 30}px`);
+ }
+ function placeLabels() {
+ for (const disc of discs) {
+ const chip = chips.querySelector(`[data-tool="${disc.key}"]`);
+ chip.style.top = `${cy + scale * (disc.top + disc.shift + H / 2) * COS}px`;
+ }
+ }
+ // Dots on a passing ripple swell and are pushed outwards from where the click landed.
+ function dots(points, size, colour, alpha) {
+ const band = scale * 0.22;
+ const live = [];
+ for (const q of ripples) {
+ const age = (now - q.t) / 1000;
+ if (age < 1.6) live.push({ x: q.x, y: q.y, r: age * scale * 2.6, fade: 1 - age / 1.6 });
+ }
+ ctx.beginPath();
+ for (let p = 0; p < points.length; p += 2) {
+ let x = points[p];
+ let y = points[p + 1];
+ let k = 0;
+ for (const q of live) {
+ const dx = x - q.x;
+ const dy = y - q.y;
+ const d = Math.hypot(dx, dy) || 1;
+ const push = Math.exp(-(((d - q.r) / band) ** 2)) * q.fade;
+ if (push < 0.01) continue;
+ x += (dx / d) * push * scale * 0.07;
+ y += (dy / d) * push * scale * 0.07;
+ k += push;
+ }
+ const r = size * (1 + 1.3 * Math.min(1, k));
+ ctx.moveTo(x + r, y);
+ ctx.arc(x, y, r, 0, Math.PI * 2);
+ }
+ ctx.globalAlpha = alpha;
+ ctx.fillStyle = `rgb(${colour})`;
+ ctx.fill();
+ ctx.globalAlpha = 1;
+ }
+ function draw() {
+ if (!width) return;
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
+ ctx.clearRect(0, 0, width, height);
+ const dot = scale / 150;
+ const lit = Math.max(...discs.map((d) => d.glow));
+ for (let t = n - 1; t >= 0; t -= 1) {
+ const d = discs[t];
+ const r = d.radius * scale;
+ const top = d.top + d.shift;
+ const topY = cy + scale * top * COS;
+ const botY = cy + scale * (top + H) * COS;
+ ctx.beginPath();
+ ctx.ellipse(cx, topY, r, r * SIN, 0, Math.PI, Math.PI * 2);
+ ctx.lineTo(cx + r, botY);
+ ctx.ellipse(cx, botY, r, r * SIN, 0, 0, Math.PI);
+ ctx.closePath();
+ ctx.fillStyle = `rgb(${bg})`;
+ ctx.fill();
+ const base = mix(ink, d.accent, 0.35); // each disc faintly in its tool's colour
+ const colour = mix(base, d.accent, d.glow);
+ const fade = 1 - 0.5 * (lit - d.glow);
+ const buckets = [[], [], [], [], []];
+ const add = (x, y, light) => buckets[Math.min(4, Math.floor(light * 5))].push(x, y);
+ for (let s = 0; s < SPOKES; s += 1) {
+ const th = (s / SPOKES) * Math.PI * 2 + angle;
+ const nx = Math.cos(th);
+ const nz = Math.sin(th);
+ if (nz < -0.05) continue;
+ const light = 0.2 + 0.8 * Math.max(0, nx * LIGHT[0] + nz * LIGHT[2]);
+ for (let row = 0; row < ROWS; row += 1) add(cx + r * nx, cy + scale * (top + ((row + 0.5) / ROWS) * H) * COS + r * nz * SIN, light);
+ }
+ const cap = 0.25 + 0.75 * Math.max(0, -LIGHT[1]);
+ for (let ring = 1; ring <= RINGS; ring += 1) {
+ const rho = ring / RINGS;
+ const m = Math.round(SPOKES * rho);
+ for (let s = 0; s < m; s += 1) {
+ const th = (s / m) * Math.PI * 2 + angle;
+ const nx = Math.cos(th);
+ const nz = Math.sin(th);
+ add(cx + r * rho * nx, topY + r * rho * nz * SIN, cap * (0.75 + (0.25 * rho * (nx * LIGHT[0] + nz * LIGHT[2] + 1)) / 2));
+ }
+ }
+ buckets.forEach((pts, b) => {
+ if (!pts.length) return;
+ const l = (b + 0.5) / 5;
+ dots(pts, dot * (0.45 + 1.1 * l) * (1 + 0.25 * d.glow), colour, Math.min(1, (0.3 + 0.7 * l) * fade));
+ });
+ }
+ }
+ // Which disc a point is on, as drawn: the upper discs are drawn last, so they win where two
+ // overlap. The picked disc never moves and its neighbours move away from it, so this can't flicker.
+ function discAt(x, y) {
+ for (let t = 0; t < n; t += 1) {
+ const d = discs[t];
+ const r = d.radius * scale;
+ const dx = x - cx;
+ if (Math.abs(dx) > r) continue;
+ const e = r * SIN * Math.sqrt(1 - (dx / r) ** 2);
+ const top = d.top + d.shift;
+ if (y >= cy + scale * top * COS - e && y <= cy + scale * (top + H) * COS + e) return d.key;
+ }
+ return null;
+ }
+ function tick(t) {
+ frame = 0;
+ const dt = last ? Math.min(t - last, 100) : 0;
+ if (last && dt < 15) {
+ frame = requestAnimationFrame(tick);
+ return;
+ }
+ last = now = t;
+ const moving = !reduced.matches && onScreen && !document.hidden;
+ if (moving) angle += (dt / 1000) * ((Math.PI * 2) / TURN_SECONDS);
+ const step = reduced.matches ? 1 : Math.min(1, dt / 90) || 0.3;
+ for (const d of discs) d.glow += (d.target - d.glow) * step;
+ // Discs above the picked one rise and the ones below it sink, by how lit it is.
+ for (const d of discs) {
+ d.shift = discs.reduce((sum, o) => sum + (o.t === d.t ? 0 : (o.t > d.t ? -1 : 1) * OPEN * o.glow), 0);
+ }
+ while (ripples.length && t - ripples[0].t > 1600) ripples.shift();
+ placeLabels();
+ draw();
+ const settling = discs.some((d) => Math.abs(d.glow - d.target) > 0.005);
+ if (moving || settling || ripples.length) frame = requestAnimationFrame(tick);
+ else last = 0;
+ }
+ const wake = () => {
+ if (!frame) frame = requestAnimationFrame(tick);
+ };
+ const point = (event) => {
+ const box = canvas.getBoundingClientRect();
+ return [event.clientX - box.left, event.clientY - box.top];
+ };
+ canvas.addEventListener('pointermove', (event) => {
+ const key = discAt(...point(event));
+ canvas.style.cursor = key ? 'pointer' : '';
+ if (key && event.pointerType === 'mouse' && moved) aim(key, event);
+ });
+ canvas.addEventListener('click', (event) => {
+ const [x, y] = point(event);
+ const key = discAt(x, y);
+ if (key) pick(key, true);
+ if (reduced.matches) return;
+ ripples.push({ x, y, t: performance.now() });
+ if (ripples.length > 4) ripples.shift();
+ wake();
+ });
+ const discUnder = (x, y) => {
+ const box = canvas.getBoundingClientRect();
+ return discAt(x - box.left, y - box.top);
+ };
+ // Colours are read once the stack is on the page; a detached element has no styles.
+ new ResizeObserver(() => {
+ colours();
+ sizeDiscs();
+ placeLabels();
+ draw();
+ }).observe(tower);
+ // The names' font can arrive after the first layout and change how much room they need.
+ document.fonts?.ready.then(() => {
+ sizeDiscs();
+ placeLabels();
+ draw();
+ });
+ new IntersectionObserver(([entry]) => {
+ onScreen = entry.isIntersecting;
+ wake();
+ }).observe(tower);
+ new MutationObserver(() => {
+ colours();
+ draw();
+ }).observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
+ document.addEventListener('visibilitychange', wake);
+ const lightUp = (key) => {
+ for (const d of discs) d.target = d.key === key ? 1 : 0;
+ wake();
+ };
grid.before(layout);
layout.append(stack, grid);
section.classList.add('is-exploded');
@@ -90,7 +316,7 @@
let timer = null;
let visible = false;
- // Hover picks a pane once the pointer has stayed on it for DWELL_MS, and not while the pointer
+ // Hover picks a disc once the pointer has stayed on it for DWELL_MS, and not while the pointer
// is heading for the card, so moving across to the card doesn't switch tools on the way.
let candidate = null;
let since = 0;
@@ -135,10 +361,11 @@
// Check again shortly: by then the pointer has either stopped here or moved on.
dwell = setTimeout(() => {
from = null;
- if (candidate && document.elementFromPoint(lastX, lastY)?.dataset.pane === candidate) pick(candidate, true);
+ const under = discUnder(lastX, lastY) || document.elementFromPoint(lastX, lastY)?.closest('.tool-x-chip')?.dataset.tool;
+ if (candidate && under === candidate) pick(candidate, true);
}, heading ? DWELL_MS * 2 : due);
}
- tower.addEventListener('pointerleave', () => {
+ canvas.addEventListener('pointerleave', () => {
clearTimeout(dwell);
candidate = null;
from = null;
@@ -147,8 +374,8 @@
if (byPerson) stopCycle();
if (key === current) return;
current = key;
- for (const pane of panes) pane.classList.toggle('is-active', pane.classList.contains(key));
- for (const chip of chips.children) chip.setAttribute('aria-pressed', String(chip.dataset.tool === key));
+ lightUp(key);
+ for (const chip of chips.children) chip.classList.toggle('is-on', chip.dataset.tool === key);
for (const tool of tools) tool.article.classList.toggle('is-active', tool.key === key);
}
function stopCycle() {
From e482b2e147dcbe96681821cb0711dcc8ebf56e3d Mon Sep 17 00:00:00 2001
From: Kevin Longe <273747162+kvlonge@users.noreply.github.com>
Date: Wed, 2 Dec 2026 15:13:05 +0000
Subject: [PATCH 2/2] Keep keyboard focus and taps on the right tool in the
disc stack
A card that is fading out is now inert, so tabbing quickly past the names
lands in the card that is shown. On narrow phones each name is no taller
than the gap between discs, so a tap can't hit the neighbouring name, and
switching reduced motion off starts the stack turning again.
---
styles.css | 2 +-
tests/website.spec.mjs | 5 +++++
tools.js | 10 +++++++++-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/styles.css b/styles.css
index 1544871..0db8007 100644
--- a/styles.css
+++ b/styles.css
@@ -265,7 +265,7 @@ h1 { margin: 0; max-width: 11ch; font-size: clamp(44px, 5.4vw, 80px); line-heigh
.tool-x-discs { position: relative; width: 100%; max-width: 520px; justify-self: center; overflow: clip; overflow-clip-margin: 8px; }
.tool-x-discs canvas { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-tap-highlight-color: transparent; }
.tool-x-chips { position: absolute; inset: 0; pointer-events: none; }
-/* Names in the stack's order; tools.js sets each one's height to its disc's. */
+/* Names in the stack's order; tools.js places each beside its disc and keeps it within the gap between discs. */
.tool-x-chip { position: absolute; left: var(--label-x); display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 2px; color: var(--muted); font: 700 16px "Space Grotesk", sans-serif; text-decoration: none; white-space: nowrap; pointer-events: auto; transform: translateY(-50%); transition: color .2s ease; }
.tool-x-chip::before { content: ""; position: absolute; right: calc(100% + 6px); top: 50%; width: 10px; border-top: 1px dotted var(--line); }
.tool-x-chip:hover { color: var(--ink); }
diff --git a/tests/website.spec.mjs b/tests/website.spec.mjs
index 62d3491..912e8ac 100644
--- a/tests/website.spec.mjs
+++ b/tests/website.spec.mjs
@@ -219,6 +219,11 @@ test('a tool name beside the discs shows its card when pointed at and opens its
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, { steps: 4 });
await expect(name).toHaveClass(/is-on/);
await expect(page.locator('article.tool.sqltide')).toHaveClass(/is-active/);
+ // Tabbing quickly past the last name lands in its card, not in the card that is fading out.
+ const names = page.getByRole('navigation', { name: 'All tools' }).getByRole('link');
+ await names.first().focus();
+ for (let i = 0; i < 6; i += 1) await page.keyboard.press('Tab', { delay: 20 });
+ await expect(page.getByRole('link', { name: 'SQLLoad website', exact: true })).toBeFocused();
await name.click();
await page.waitForURL('https://sqltide.io/');
await context.close();
diff --git a/tools.js b/tools.js
index 186d8b6..8da3946 100644
--- a/tools.js
+++ b/tools.js
@@ -133,8 +133,11 @@
tower.style.setProperty('--label-x', `${cx + scale * 1.03 + 30}px`);
}
function placeLabels() {
+ // Each name is no taller than the gap between discs, so neighbouring names never overlap.
+ const room = `${Math.min(32, scale * (H + G) * COS - 2)}px`;
for (const disc of discs) {
const chip = chips.querySelector(`[data-tool="${disc.key}"]`);
+ chip.style.minHeight = room;
chip.style.top = `${cy + scale * (disc.top + disc.shift + H / 2) * COS}px`;
}
}
@@ -304,6 +307,7 @@
draw();
}).observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
document.addEventListener('visibilitychange', wake);
+ reduced.addEventListener('change', wake);
const lightUp = (key) => {
for (const d of discs) d.target = d.key === key ? 1 : 0;
wake();
@@ -376,7 +380,11 @@
current = key;
lightUp(key);
for (const chip of chips.children) chip.classList.toggle('is-on', chip.dataset.tool === key);
- for (const tool of tools) tool.article.classList.toggle('is-active', tool.key === key);
+ for (const tool of tools) {
+ tool.article.classList.toggle('is-active', tool.key === key);
+ // A card fading out stays visible for a moment; inert keeps Tab from landing in it.
+ tool.article.inert = tool.key !== key;
+ }
}
function stopCycle() {
clearInterval(timer);