diff --git a/index.html b/index.html
index c8fd062..9ba7044 100644
--- a/index.html
+++ b/index.html
@@ -28,8 +28,8 @@
-
-
+
+
@@ -75,8 +75,8 @@ The Data Stack for Engineers of the Future
SQLClean SQL linter and formatter
Fensu Architecture rules for your codebase
SQLBabel Evidence-backed SQL translation
- SQLBuild SQL and Python orchestration
- SQLLoad Load data into your warehouse
+ SQLBuild SQL and Python orchestration
+ SQLLoad Load data into your warehouse
diff --git a/stack.js b/stack.js
index e52f9f8..a29d60a 100644
--- a/stack.js
+++ b/stack.js
@@ -1,22 +1,42 @@
-// The hero stacks: dot-shaded discs turning slowly, one per tool.
-// Each layer has a real link laid over it, so hover, click and keyboard focus
-// all come from the links; the canvas only draws. A tool in both stacks lights
-// up in both.
+// The hero stacks, drawn like the SQLStack mark: a column of dot-shaded discs on the mark's swoosh
+// brim. The discs turn slowly; the swoosh keeps its shape, and its dots flow along it at the same
+// speed. Each layer has a real link laid over it, clipped to the shapes it draws, so hover, click
+// and keyboard focus all come from the links; the canvas only draws. A tool in both stacks lights
+// up in both. Links marked data-brim are the brim's strips, top first; the rest are discs, top first.
(() => {
- const TILT = 0.42; // camera elevation in radians
+ const TILT = 0.47; // camera elevation in radians
const SIN = Math.sin(TILT);
const COS = Math.cos(TILT);
- const HEIGHT = 0.12; // disc thickness, in units of the base radius
- const GAP = 0.105;
+ const TAU = Math.PI * 2;
+ // In units of the column's radius. Heights are measured up from the column's base.
+ const COLUMN_HEIGHT = 0.95;
+ const LAYER_GAP = 0.09;
+ const BRIM_INNER = 1.1;
+ const BRIM_WIDTH = 0.62;
+ const BRIM_THICK = 0.09;
+ const STRIP_GAP = 0.1;
+ const STRIP_GROWTH = 0.28; // a lower strip reaches further out, so its lip shows
+ const T0 = (-100 * Math.PI) / 180; // the swoosh's left tip; 0 is the front
+ const T1 = (118 * Math.PI) / 180; // its back-right tip
+ const BRIM_LIFT = 0.02;
+ // The brim dips at the front and rises on the right, like the mark; the whole hat turns a little left.
+ const ROTATE_Z = [Math.cos(0.34), Math.sin(0.34)];
+ const ROTATE_X = [Math.cos(0.1), Math.sin(0.1)];
+ const ROTATE_Y = [Math.cos(-0.15), Math.sin(-0.15)];
const TURN_SECONDS = 48;
const SPOKES = 96;
const ROWS = 3;
const RINGS = 5;
+ const FLOW_STEPS = 72;
+ const LANE_SPACING = 0.15;
+ const SEGMENTS = 96;
const LIGHT = (() => {
- const v = [-0.62, -0.55, 0.56];
+ const v = [-0.62, 0.55, 0.56];
const n = Math.hypot(...v);
return v.map((c) => c / n);
})();
+ const CAP_LIGHT = 0.25 + 0.75 * Math.max(0, LIGHT[1]);
+ const wallLight = (nx, nz) => 0.2 + 0.8 * Math.max(0, nx * LIGHT[0] + nz * LIGHT[2]);
function hexToRgb(value) {
const hex = value.trim().replace('#', '');
@@ -29,24 +49,97 @@
return a.map((c, i) => Math.round(c + (b[i] - c) * t));
}
+ // The swoosh: tapers to a point at both tips, widest at the front left.
+ const tAt = (u) => T0 + (T1 - T0) * u;
+ const widthAt = (u, strip) => (1 + STRIP_GROWTH * strip) * BRIM_WIDTH * Math.sin(Math.PI * u ** 0.7) ** 0.85;
+
+ function rotate([x, y, z]) {
+ [x, y] = [x * ROTATE_Z[0] - y * ROTATE_Z[1], x * ROTATE_Z[1] + y * ROTATE_Z[0]];
+ [y, z] = [y * ROTATE_X[0] - z * ROTATE_X[1], y * ROTATE_X[1] + z * ROTATE_X[0]];
+ [x, z] = [x * ROTATE_Y[0] + z * ROTATE_Y[1], -x * ROTATE_Y[1] + z * ROTATE_Y[0]];
+ return [x, y, z];
+ }
+
+ // A point on brim strip `strip` (0 is the top one), at distance r from the axis and height y on it.
+ function brimPoint(strip, u, r, y) {
+ const t = tAt(u);
+ const p = rotate([Math.sin(t) * r, y - strip * (BRIM_THICK + STRIP_GAP), Math.cos(t) * r]);
+ p[1] += BRIM_LIFT;
+ return p;
+ }
+
+ // Where each strip is in front of the column and where behind it, as runs of segments.
+ function brimRuns(strip) {
+ const runs = [];
+ for (let i = 0; i < SEGMENTS; i += 1) {
+ const u = (i + 0.5) / SEGMENTS;
+ const front = brimPoint(strip, u, BRIM_INNER + widthAt(u, strip) / 2, 0)[2] >= 0;
+ const last = runs[runs.length - 1];
+ if (last && last.front === front) last.to = i + 1;
+ else runs.push({ front, from: i, to: i + 1 });
+ }
+ return runs;
+ }
+
+ // Projected extent of a stack with this many strips, at scale 1 around the origin.
+ function extent(strips) {
+ const box = [Infinity, -Infinity, Infinity, -Infinity];
+ const add = ([x, y, z]) => {
+ const sx = x;
+ const sy = z * SIN - y * COS;
+ box[0] = Math.min(box[0], sx); box[1] = Math.max(box[1], sx);
+ box[2] = Math.min(box[2], sy); box[3] = Math.max(box[3], sy);
+ };
+ for (let s = 0; s < 64; s += 1) {
+ const t = (s / 64) * TAU;
+ add([Math.sin(t), COLUMN_HEIGHT, Math.cos(t)]);
+ add([Math.sin(t), 0, Math.cos(t)]);
+ }
+ for (let strip = 0; strip < strips; strip += 1) {
+ for (let i = 0; i <= SEGMENTS; i += 1) {
+ const u = i / SEGMENTS;
+ for (const r of [BRIM_INNER, BRIM_INNER + widthAt(u, strip)]) {
+ add(brimPoint(strip, u, r, 0));
+ add(brimPoint(strip, u, r, -BRIM_THICK));
+ }
+ }
+ }
+ return box;
+ }
+ // Every stack is fitted as if it had two strips, so the columns match in size and place.
+ const REFERENCE = extent(2);
+
function init(root) {
const canvas = root.querySelector('canvas');
const links = [...root.querySelectorAll('[data-layer]')];
const ctx = canvas.getContext('2d');
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)');
- const count = links.length;
- const total = count * HEIGHT + (count - 1) * GAP;
- const layers = links.map((link, i) => ({
- link,
- // Like the mark: a column of discs on a wider base.
- radius: i === count - 1 ? 1 : 0.8 + (0.06 * i) / Math.max(1, count - 2),
- top: -total / 2 + i * (HEIGHT + GAP),
- glow: 0,
- target: 0,
+ const discs = links.filter((link) => !link.hasAttribute('data-brim'));
+ const strips = links.filter((link) => link.hasAttribute('data-brim'));
+ const own = extent(strips.length);
+ const height = (COLUMN_HEIGHT - (discs.length - 1) * LAYER_GAP) / discs.length;
+
+ const hit = (link) => {
+ const span = document.createElement('span');
+ span.className = 'hit';
+ link.prepend(span);
+ return span;
+ };
+ const layers = links.map((link) => ({ link, glow: 0, target: 0 }));
+ const layerOf = new Map(layers.map((layer) => [layer.link, layer]));
+ const discParts = discs.map((link, i) => ({
+ layer: layerOf.get(link),
+ top: COLUMN_HEIGHT - i * (height + LAYER_GAP),
+ span: hit(link),
+ }));
+ const stripParts = strips.map((link, strip) => ({
+ layer: layerOf.get(link),
+ strip,
+ runs: brimRuns(strip).map((run) => ({ ...run, span: hit(link) })),
+ dots: flowDots(strip),
}));
let width = 0;
- let height = 0;
let scale = 0;
let cx = 0;
let cy = 0;
@@ -58,6 +151,8 @@
let frame = 0;
let onScreen = true;
+ const project = ([x, y, z]) => [cx + scale * x, cy + scale * (z * SIN - y * COS)];
+
function readColours() {
const style = getComputedStyle(document.documentElement);
ink = hexToRgb(style.getPropertyValue('--ink'));
@@ -67,107 +162,184 @@
}
}
+ // Quads with the same winding, so their union fills under the nonzero rule.
+ function quad(points) {
+ let area = 0;
+ points.forEach(([x1, y1], i) => {
+ const [x2, y2] = points[(i + 1) % points.length];
+ area += x1 * y2 - x2 * y1;
+ });
+ if (area < 0) points.reverse();
+ return `M${points.map(([x, y]) => `${x.toFixed(1)} ${y.toFixed(1)}`).join('L')}Z`;
+ }
+
+ function discOutline(part) {
+ const r = scale;
+ const ry = r * SIN;
+ const topY = cy - scale * part.top * COS;
+ const bottomY = cy - scale * (part.top - height) * COS;
+ const f = (n) => n.toFixed(1);
+ return `M${f(cx - r)} ${f(topY)}A${f(r)} ${f(ry)} 0 0 1 ${f(cx + r)} ${f(topY)}L${f(cx + r)} ${f(bottomY)}`
+ + `A${f(r)} ${f(ry)} 0 0 1 ${f(cx - r)} ${f(bottomY)}Z`;
+ }
+
+ function runOutline(strip, run) {
+ let d = '';
+ for (let i = run.from; i < run.to; i += 1) {
+ const ua = i / SEGMENTS;
+ const ub = (i + 1) / SEGMENTS;
+ const ra = BRIM_INNER + widthAt(ua, strip);
+ const rb = BRIM_INNER + widthAt(ub, strip);
+ const p = (u, r, y) => project(brimPoint(strip, u, r, y));
+ const [iA, iB, oA, oB] = [p(ua, BRIM_INNER, 0), p(ub, BRIM_INNER, 0), p(ua, ra, 0), p(ub, rb, 0)];
+ const [jA, jB, qA, qB] = [p(ua, BRIM_INNER, -BRIM_THICK), p(ub, BRIM_INNER, -BRIM_THICK), p(ua, ra, -BRIM_THICK), p(ub, rb, -BRIM_THICK)];
+ d += quad([iA, oA, oB, iB]) + quad([oA, qA, qB, oB]) + quad([iA, jA, jB, iB]);
+ }
+ return d;
+ }
+
function layout() {
width = root.clientWidth;
- height = root.clientHeight;
if (!width) return;
dpr = Math.min(window.devicePixelRatio || 1, 2);
canvas.width = Math.round(width * dpr);
- canvas.height = Math.round(height * dpr);
- scale = width * 0.4;
- cx = width / 2;
- // Stand every stack on the same floor, whatever its height.
+ canvas.height = Math.round(root.clientHeight * dpr);
const floor = width * 0.86;
- cy = floor - scale * ((total / 2) * COS + SIN);
+ scale = Math.min((width * 0.94) / (REFERENCE[1] - REFERENCE[0]), (width * 0.8) / (REFERENCE[3] - REFERENCE[2]));
+ cx = width / 2 - (scale * (REFERENCE[0] + REFERENCE[1])) / 2;
+ // Stand every stack on the same floor, whatever its height.
+ cy = floor - scale * own[3];
const caption = floor + 14;
root.style.setProperty('--caption-y', `${caption}px`);
- // Each link spans its layer, from where the layer above hides it to its own front edge.
- let edge = cy + scale * (layers[0].top * COS - layers[0].radius * SIN);
- for (const layer of layers) {
- const bottom = cy + scale * ((layer.top + HEIGHT) * COS + layer.radius * SIN);
- const half = layer.radius * scale;
- Object.assign(layer.link.style, {
- left: `${cx - half}px`,
- width: `${half * 2}px`,
- top: `${edge}px`,
- height: `${bottom - edge}px`,
- });
- layer.link.style.setProperty('--label-x', `${half}px`);
- layer.link.style.setProperty('--label-y', `${caption - edge}px`);
- edge = bottom;
+ for (const link of links) {
+ link.style.setProperty('--label-x', `${width / 2}px`);
+ link.style.setProperty('--label-y', `${caption}px`);
}
- }
- function draw() {
- if (!width) return;
- ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
- ctx.clearRect(0, 0, width, height);
- const lit = Math.max(...layers.map((layer) => layer.glow));
- const dot = scale / 165;
+ // Each shape gets a hit area in the order it is painted, so the one on top takes the pointer.
+ let order = 0;
+ const place = (span, d) => {
+ span.style.clipPath = `path('${d}')`;
+ span.style.zIndex = String((order += 1));
+ return new Path2D(d);
+ };
+ const runs = (front) => [...stripParts].reverse().flatMap((part) => part.runs.filter((run) => run.front === front).map((run) => [part, run]));
+ for (const [part, run] of runs(false)) run.path = place(run.span, runOutline(part.strip, run));
+ for (const part of [...discParts].reverse()) part.path = place(part.span, discOutline(part));
+ for (const [part, run] of runs(true)) run.path = place(run.span, runOutline(part.strip, run));
+ }
- for (let i = count - 1; i >= 0; i -= 1) {
- const layer = layers[i];
- const r = layer.radius * scale;
- const topY = cy + scale * layer.top * COS;
- const bottomY = cy + scale * (layer.top + HEIGHT) * COS;
+ // Dots on one strip. The swoosh holds still; each dot slides along it by `phase`, a fraction of
+ // its length, so the brim seems to turn with the discs. Lanes thin out where the swoosh narrows.
+ function flowDots(strip) {
+ const lanes = Math.ceil(((1 + STRIP_GROWTH * strip) * BRIM_WIDTH) / LANE_SPACING);
+ const items = [];
+ for (let i = 0; i < FLOW_STEPS; i += 1) {
+ const u = i / FLOW_STEPS;
+ for (let lane = 0; lane < lanes; lane += 1) items.push({ u, lane });
+ items.push({ u, edge: true });
+ for (let row = 0; row < 2; row += 1) items.push({ u, row });
+ }
+ const clamp = (x) => Math.max(0, Math.min(1, x));
+ return (phase) => items.map((item) => {
+ const u = (((item.u + phase) % 1) + 1) % 1;
+ const w = widthAt(u, strip);
+ if (item.lane !== undefined) {
+ const visible = clamp((w - (item.lane + 0.5) * LANE_SPACING) / 0.015);
+ const point = brimPoint(strip, u, BRIM_INNER + item.lane * LANE_SPACING, 0);
+ return { point, light: CAP_LIGHT * (0.85 + (0.15 * item.lane) / lanes), visible };
+ }
+ if (item.edge) return { point: brimPoint(strip, u, BRIM_INNER + w, 0), light: CAP_LIGHT, visible: clamp(w / 0.02) };
+ const t = tAt(u);
+ const [nx, ny, nz] = rotate([Math.sin(t), 0, Math.cos(t)]);
+ // The outer wall shows only where it faces the camera.
+ const facing = ny * SIN + nz * COS > -0.05;
+ const point = brimPoint(strip, u, BRIM_INNER + w, -((item.row + 0.5) / 2) * BRIM_THICK);
+ return { point, light: wallLight(nx, nz), visible: facing ? clamp(w / 0.05) : 0 };
+ });
+ }
- // Hide whatever this layer covers before drawing its dots.
+ function paintDots(layer, points, lit) {
+ const colour = mix(ink, layer.accent, layer.glow);
+ const fade = 1 - 0.55 * (lit - layer.glow);
+ const dot = (width * 0.4) / 165;
+ const buckets = [[], [], [], [], []];
+ for (const { at, light, visible } of points) {
+ if (visible > 0.01) buckets[Math.min(4, Math.floor(light * 5))].push(at, visible);
+ }
+ buckets.forEach((items, b) => {
+ if (!items.length) return;
+ const light = (b + 0.5) / 5;
+ const radius = dot * (0.45 + 1.1 * light) * (1 + 0.25 * layer.glow);
ctx.beginPath();
- ctx.ellipse(cx, topY, r, r * SIN, 0, Math.PI, Math.PI * 2);
- ctx.lineTo(cx + r, bottomY);
- ctx.ellipse(cx, bottomY, r, r * SIN, 0, 0, Math.PI);
- ctx.closePath();
- ctx.fillStyle = `rgb(${background})`;
+ for (let i = 0; i < items.length; i += 2) {
+ const [x, y] = items[i];
+ const r = radius * items[i + 1];
+ ctx.moveTo(x + r, y);
+ ctx.arc(x, y, r, 0, TAU);
+ }
+ ctx.globalAlpha = Math.min(1, (0.3 + 0.7 * light) * fade);
+ ctx.fillStyle = `rgb(${colour})`;
ctx.fill();
+ });
+ ctx.globalAlpha = 1;
+ }
- const colour = mix(ink, layer.accent, layer.glow);
- const fade = 1 - 0.55 * (lit - layer.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 theta = (s / SPOKES) * Math.PI * 2 + angle;
- const nx = Math.cos(theta);
- const nz = Math.sin(theta);
- 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) {
- const y = layer.top + ((row + 0.5) / ROWS) * HEIGHT;
- add(cx + r * nx, cy + scale * (y * COS + layer.radius * nz * SIN), light);
- }
+ function paintDisc(part, lit) {
+ const points = [];
+ for (let s = 0; s < SPOKES; s += 1) {
+ const theta = (s / SPOKES) * TAU + angle;
+ const nx = Math.sin(theta);
+ const nz = Math.cos(theta);
+ if (nz < -0.05) continue;
+ const light = wallLight(nx, nz);
+ for (let row = 0; row < ROWS; row += 1) {
+ const y = part.top - ((row + 0.5) / ROWS) * height;
+ points.push({ at: project([nx, y, nz]), light, visible: 1 });
}
-
- const capLight = 0.25 + 0.75 * Math.max(0, -LIGHT[1]);
- for (let ring = 1; ring <= RINGS; ring += 1) {
- const rho = ring / RINGS;
- const spokes = Math.round(SPOKES * rho);
- for (let s = 0; s < spokes; s += 1) {
- const theta = (s / spokes) * Math.PI * 2 + angle;
- const nx = Math.cos(theta);
- const nz = Math.sin(theta);
- // A little shading towards the light keeps the cap from reading flat.
- const light = capLight * (0.75 + 0.25 * rho * (nx * LIGHT[0] + nz * LIGHT[2] + 1) / 2);
- add(cx + r * rho * nx, topY + r * rho * nz * SIN, light);
- }
+ }
+ for (let ring = 1; ring <= RINGS; ring += 1) {
+ const rho = ring / RINGS;
+ const spokes = Math.round(SPOKES * rho);
+ for (let s = 0; s < spokes; s += 1) {
+ const theta = (s / spokes) * TAU + angle;
+ const nx = Math.sin(theta);
+ const nz = Math.cos(theta);
+ // A little shading towards the light keeps the cap from reading flat.
+ const light = CAP_LIGHT * (0.75 + (0.25 * rho * (nx * LIGHT[0] + nz * LIGHT[2] + 1)) / 2);
+ points.push({ at: project([rho * nx, part.top, rho * nz]), light, visible: 1 });
}
+ }
+ paintDots(part.layer, points, lit);
+ }
- buckets.forEach((points, b) => {
- if (!points.length) return;
- const light = (b + 0.5) / 5;
- const radius = dot * (0.45 + 1.1 * light) * (1 + 0.25 * layer.glow);
- ctx.beginPath();
- for (let p = 0; p < points.length; p += 2) {
- ctx.moveTo(points[p] + radius, points[p + 1]);
- ctx.arc(points[p], points[p + 1], radius, 0, Math.PI * 2);
- }
- ctx.globalAlpha = Math.min(1, (0.3 + 0.7 * light) * fade);
- 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, canvas.height);
+ const lit = Math.max(...layers.map((layer) => layer.glow));
+ const phase = angle / (T1 - T0);
+ const flows = stripParts.map((part) => part.dots(phase));
+ // Back to front: the brim behind the column, the column from its base up, then the brim in front.
+ // Each shape first hides whatever it covers.
+ const paintStrips = (front) => {
+ for (let k = stripParts.length - 1; k >= 0; k -= 1) {
+ const part = stripParts[k];
+ ctx.fillStyle = `rgb(${background})`;
+ for (const run of part.runs) if (run.front === front) ctx.fill(run.path);
+ const points = flows[k]
+ .filter(({ point }) => (point[2] >= 0) === front)
+ .map(({ point, light, visible }) => ({ at: project(point), light, visible }));
+ paintDots(part.layer, points, lit);
+ }
+ };
+ paintStrips(false);
+ for (let i = discParts.length - 1; i >= 0; i -= 1) {
+ ctx.fillStyle = `rgb(${background})`;
+ ctx.fill(discParts[i].path);
+ paintDisc(discParts[i], lit);
}
+ paintStrips(true);
}
function moving() {
@@ -187,7 +359,7 @@
return;
}
last = now;
- if (moving()) angle += (elapsed / 1000) * ((Math.PI * 2) / TURN_SECONDS);
+ if (moving()) angle += (elapsed / 1000) * (TAU / TURN_SECONDS);
const step = reduced.matches ? 1 : Math.min(1, elapsed / 160) || 0.2;
for (const layer of layers) layer.glow += (layer.target - layer.glow) * step;
draw();
diff --git a/styles.css b/styles.css
index bb3cc23..60cc377 100644
--- a/styles.css
+++ b/styles.css
@@ -148,7 +148,9 @@ h1 { margin: 0; max-width: 11ch; font-size: clamp(44px, 5.4vw, 80px); line-heigh
.stack-caption { position: absolute; top: var(--caption-y, 86%); left: 0; right: 0; margin: 0; color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-align: center; text-transform: uppercase; transition: opacity .2s ease; }
.stack-visual:has(a.is-active) .stack-caption { opacity: 0; }
.stack-visual canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
-.stack-labels a { position: absolute; display: block; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
+.stack-labels a { position: absolute; inset: 0; display: block; pointer-events: none; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
+/* Each link covers the stack; only its hit areas, clipped to the shapes it draws, take the pointer. */
+.stack-labels .hit { position: absolute; inset: 0; pointer-events: auto; }
.stack-labels a:focus-visible { outline: none; }
/* A layer's name shows under its stack, in place of the caption, while it is pointed at. */
.stack-labels .label { position: absolute; top: var(--label-y, 100%); left: var(--label-x, 50%); display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.25; white-space: nowrap; transform: translate(-50%, -4px); opacity: 0; transition: opacity .2s ease; pointer-events: none; }
diff --git a/tests/website.spec.mjs b/tests/website.spec.mjs
index bb91e92..a6c4342 100644
--- a/tests/website.spec.mjs
+++ b/tests/website.spec.mjs
@@ -1,5 +1,20 @@
import { test, expect } from '@playwright/test';
+// A point on screen where this hero layer is the one on top. Each layer's link covers its whole
+// stack and takes the pointer only over the shapes it draws, so the link's centre may be another layer.
+function pointOn(layer) {
+ return layer.evaluate((link) => {
+ link.scrollIntoView({ block: 'center' });
+ const box = link.getBoundingClientRect();
+ for (let y = box.bottom - 1; y > box.top; y -= 3) {
+ for (let x = box.left + 1; x < box.right; x += 3) {
+ if (document.elementFromPoint(x, y)?.closest('a') === link) return [x, y];
+ }
+ }
+ throw new Error(`no visible point on ${link.dataset.layer}`);
+ });
+}
+
for (const system of ['light', 'dark']) {
test(`theme follows ${system} system preference until an explicit keyboard choice`, async ({ page }) => {
const other = system === 'light' ? 'dark' : 'light';
@@ -90,7 +105,7 @@ test('tools, stack layers, sharing assets and responsive layout work in both the
await expect(tide).toHaveAccessibleName('SQLTide Streaming pipelines for ClickHouse');
await expect(tide.locator('.label')).toHaveCSS('opacity', '0');
await expect(caption).toHaveText('Streaming');
- await tide.hover();
+ await page.mouse.move(...await pointOn(tide));
await expect(tide.locator('.label')).toHaveCSS('opacity', '1');
// Pointing at a hero layer shows that tool's card below.
await expect(grid.getByRole('link', { name: 'SQLTide website', exact: true })).toBeVisible();
@@ -188,11 +203,10 @@ for (const input of ['touch', 'mouse']) {
const page = await context.newPage();
await page.goto('/');
const layer = page.locator('.stack-labels a[data-layer="sqlload"]').first();
- const box = await layer.boundingBox();
- const at = [box.x + box.width / 2, box.y + box.height / 2];
+ const at = await pointOn(layer);
if (input === 'mouse') {
- await page.locator('.stack-labels a[data-layer="sqlbuild"]').first().click();
+ await page.mouse.click(...await pointOn(page.locator('.stack-labels a[data-layer="sqlbuild"]').first()));
await page.waitForURL('https://sqlbuild.com/');
} else {
for (let tap = 0; tap < 2; tap += 1) {