Isometric line figures that answer the pointer. For React and for anything with a DOM.
Site: the top bar drops its llms.txt button, which the footer already links, and CopyButton goes with it
Lucas Marquesbd55b56b1954
diff --git a/apps/site/app/globals.css b/apps/site/app/globals.cssindex a9ba237..be41a10 100644--- a/apps/site/app/globals.css+++ b/apps/site/app/globals.css@@ -49,7 +49,7 @@ em { font-style: italic; }/* the top bar's items, alike: muted 13px text, or a 16px icon, each 10px clear of its neighbours */.topbar-link { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 8px; font-size: 13px; line-height: 1; color: var(--color-muted); }-:is(a, button).topbar-link:hover { color: var(--color-ink); }+a.topbar-link:hover { color: var(--color-ink); }.btn {display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;diff --git a/apps/site/components/chrome.tsx b/apps/site/components/chrome.tsxindex 310df10..b1d228f 100644--- a/apps/site/components/chrome.tsx+++ b/apps/site/components/chrome.tsx@@ -1,8 +1,5 @@import pkg from "@lucasmarkes/hairline/package.json";import { LINKS } from "@/lib/figures";-import { CopyButton } from "./copy";--const SITE = process.env.NEXT_PUBLIC_SITE_URL!;export function GitHub() {return (@@ -12,7 +9,7 @@ export function GitHub() {);}-/** The bar on every page: the name home, the docs, the version, GitHub, llms.txt. */+/** The bar on every page: the name home, the docs, the version, GitHub. */export function Topbar() {return (<header className="topbar">@@ -21,7 +18,6 @@ export function Topbar() {<a className="topbar-link" href="/docs">Docs</a><span className="topbar-link tabular-nums" data-version>v{pkg.version}</span><a className="topbar-link" href={LINKS.github} aria-label="GitHub"><GitHub /></a>- <CopyButton text={`${SITE}/llms.txt`} open="/llms.txt" label="llms.txt" className="topbar-link" /></nav></header>);diff --git a/apps/site/components/copy.tsx b/apps/site/components/copy.tsxindex bbe757d..b84fa4b 100644--- a/apps/site/components/copy.tsx+++ b/apps/site/components/copy.tsx@@ -36,23 +36,6 @@ export function useCopy(): [copied: boolean, copy: (text: string, fallback?: Elereturn [copied, copy];}-/**- * A button that copies `text`, or when it cannot, selects what `select` points- * at, or opens `open` for a button with no text of its own on the page. `text`- * can be a function, read at the click, for text the button does not own.- */-export function CopyButton({ text, select, open, label = "Copy", className = "btn" }: { text: string | (() => string); select?: RefObject<Element | null>; open?: string; label?: string; className?: string }) {- const [copied, copy] = useCopy();- const click = async () => {- if (!(await copy(typeof text === "function" ? text() : text, select?.current)) && open) window.location.assign(open);- };- return (- <button type="button" className={className} onClick={click} aria-live="polite">- {copied ? "Copied" : label}- </button>- );-}-/*** Copy as an icon: the clipboard gives way to a check through scale, opacity* and blur, and back. Both icons stay in the DOM so the swap is a transitiondiff --git a/apps/site/test/site.spec.ts b/apps/site/test/site.spec.tsindex 3212e56..6c98a84 100644--- a/apps/site/test/site.spec.ts+++ b/apps/site/test/site.spec.ts@@ -39,6 +39,12 @@ test("the home prerenders an empty box, then draws the inspector's figure with aexpect(noise).toEqual([]);});+test("the top bar holds the docs, the version and GitHub, and no llms.txt button", async ({ page }) => {+ await page.goto("/");+ await expect(page.locator(".topbar nav > *")).toHaveCount(3);+ await expect(page.locator(".topbar")).not.toContainText("llms.txt");+});+test("the top bar's links sit as one row: one height, one centre line, one type, even spaces between them", async ({ page }) => {await page.goto("/");const items = await page.locator(".topbar nav > *").evaluateAll((els) => els.map((el) => {@@ -50,7 +56,7 @@ test("the top bar's links sit as one row: one height, one centre line, one type,const style = getComputedStyle(el);return { height: box.height, middle: box.top + box.height / 2, left: ink.left, right: ink.right, type: [style.fontSize, style.fontWeight, style.color, style.backgroundColor].join(" ") };}));- expect(items).toHaveLength(4);+ expect(items).toHaveLength(3);expect(new Set(items.map((i) => i.height)).size).toBe(1);for (const i of items) expect(Math.abs(i.middle - items[0].middle)).toBeLessThan(0.5);expect(new Set(items.map((i) => i.type)).size).toBe(1);@@ -228,18 +234,6 @@ test("the page fits a phone, with the longest install command and every control"expect(await width()).toBeLessThanOrEqual(390);});-test("without a clipboard at all, the top bar's llms.txt button opens the file", async ({ page }) => {- await page.addInitScript(() => {- Object.defineProperty(navigator, "clipboard", { value: undefined });- });- const noise = watch(page);- await page.goto("/");- await page.locator(".topbar").getByRole("button", { name: "llms.txt" }).click();- await expect(page).toHaveURL(/\/llms\.txt$/);- // the text file has no icon, so Chrome's own request for /favicon.ico 404s there- expect(noise.filter((line) => line.startsWith("pageerror"))).toEqual([]);-});-/** Every element that holds text of its own, outside code, the hero's serif word and the figures, with its family. */const families = (page: Page) =>page.evaluate(() =>