From 59e44af2f97fccde89fcc27f745b91a5f844c78d Mon Sep 17 00:00:00 2001 From: clover caruso Date: Thu, 29 Oct 2026 21:00:30 -0700 Subject: [PATCH] feat: seo, meta, etc --- lib/examples/meta-cards.ts | 561 ++++++++++++++++++++++++++++++ lib/incremental/visualization.ts | 460 +++++++++++++++++++++++- lib/meta.test.ts | 260 ++++++++++++++ lib/meta.ts | 275 ++++++++++++++- lib/progress.ts | 8 +- lib/readme.changes.md | 7 + lib/readme.md | 1 + lib/string.ts | 4 +- src/pages/index.marko | 28 +- src/pages/resume.marko | 14 +- src/q+a/backend.ts | 29 +- src/q+a/models/questions.ts | 2 +- src/q+a/views/backend-inbox.marko | 2 +- src/static/sitemap.xml | 17 + 14 files changed, 1631 insertions(+), 37 deletions(-) create mode 100644 lib/examples/meta-cards.ts create mode 100644 src/static/sitemap.xml diff --git a/lib/examples/meta-cards.ts b/lib/examples/meta-cards.ts new file mode 100644 index 0000000000000000000000000000000000000000..b15a55e186106152fa404875a3eb138075f56f71 --- /dev/null +++ b/lib/examples/meta-cards.ts @@ -0,0 +1,561 @@ +// fixture pages for the `meta` tab of the debugger: every card that a link can +// become, so that the tab can be checked against what it should draw. +// +// node --experimental-vm-modules lib/examples/meta-cards.ts serve +// node --experimental-vm-modules lib/examples/meta-cards.ts shots [name...] +// node --experimental-vm-modules lib/examples/meta-cards.ts discord [name...] +// node --experimental-vm-modules lib/examples/meta-cards.ts compare name... +// +// `serve` lists the pages at http://localhost:3456. `shots` drives chrome (the +// repo's playwright) over them and writes the `meta` tab of each to +// `.clover/meta-cards/.png`. `discord` posts the component embeds as +// messages to the webhook in `TEST_DISCORD_WEBHOOK`, to see them in real Discord, +// and captures the chrome window that has Discord open after each (macOS, with +// screen recording). `compare` lays that capture beside the tab, for a +// `shots --width=620 --scale=2` of the same names. +const port = 3456; +const base = new URL(`http://localhost:${port}/`); +const template: meta.Template = { base }; +const outDir = ".clover/meta-cards"; + +// -- images: solid, striped, with a circle that shows how it was cropped -- + +const hues = [[59, 130, 246], [239, 68, 68], [34, 197, 94], [234, 179, 8], [168, 85, 247], [236, 72, 153]] as const; + +function png(width: number, height: number, [r, g, b]: readonly [number, number, number]): Buffer { + const stride = 1 + width * 3; + const raw = Buffer.alloc(stride * height); + const radius = Math.min(width, height) / 3; + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + const inside = Math.hypot(x - width / 2, y - height / 2) < radius; + const shade = inside ? 255 : ((x + y) >> 5) & 1 ? 0.75 : 1; + raw.set(inside ? [255, 255, 255] : [r * shade, g * shade, b * shade], y * stride + 1 + x * 3); + } + } + const chunk = (type: string, data: Buffer) => { + const out = Buffer.alloc(12 + data.length); + out.writeUInt32BE(data.length, 0); + out.write(type, 4, "latin1"); + data.copy(out, 8); + out.writeUInt32BE(zlib.crc32(out.subarray(4, 8 + data.length)), 8 + data.length); + return out; + }; + const header = Buffer.alloc(13); + header.writeUInt32BE(width, 0); + header.writeUInt32BE(height, 4); + header.set([8, 2, 0, 0, 0], 8); + return Buffer.concat([ + Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]), + chunk("IHDR", header), + chunk("IDAT", zlib.deflateSync(raw)), + chunk("IEND", Buffer.alloc(0)), + ]); +} + +/** `/img/1200x630-2.png`: the size, and which color of the six */ +const image = (width: number, height: number, hue = 0) => `/img/${width}x${height}-${hue % hues.length}.png`; + +// -- fixtures -- + +const section = (text: string, accessory: meta.DiscordComponent): meta.DiscordComponent => ({ + type: "section", + components: [{ type: "text", content: text }], + accessory, +}); +const container = (...components: meta.DiscordComponent[]): meta.DiscordComponent => ({ + type: "container", + components, +}); +const text = (content: string): meta.DiscordComponent => ({ type: "text", content }); +const gallery = (count: number, size: readonly [number, number] = [600, 400]): meta.DiscordComponent => ({ + type: "gallery", + items: Array.from( + { length: count }, + (_, i) => ({ media: { url: image(size[0], size[1], i) }, description: `item ${i + 1}` }), + ), +}); +const link = (label: string, extra: object = {}): meta.DiscordComponent => ({ + type: "button", + url: "/somewhere", + label, + ...extra, +}); + +/** a page that has the component embed, and the Open Graph tags that it falls back to */ +const embed = (discord: meta.DiscordComponent): meta.Meta => ({ + title: "Component embed", + description: "falls back to this", + embed: { thumbnail: image(1200, 630), siteTitle: "fixtures" }, + discord, +}); + +/** what `c-linked` links to, rather than holds */ +const linked = container(text("linked json")); + +const cards: Record = { + "c-markdown": embed(container(text([ + "# Heading one", + "## Heading two", + "### Heading three", + "-# subtext", + "**bold** *italic* __underline__ ~~strike~~ ***both*** ||spoiler|| `code`", + "[a masked link](https://example.com) and https://example.com/bare", + "> a quote", + "- one", + "- two", + "1. first", + "```", + "code block", + " indented", + "```", + "the end", + ].join("\n")))), + "c-section-thumbnail": embed(container(section( + "# Patch notes\nTwo lines beside a thumbnail.", + { type: "thumbnail", media: { url: image(400, 400) }, description: "alt text" }, + ))), + "c-section-button": embed(container(section("Text beside a button.", link("Open")))), + "c-section-spoiler": embed(container( + section("The thumbnail is a spoiler.", { type: "thumbnail", media: { url: image(400, 400, 1) }, spoiler: true }), + )), + ...Object.fromEntries( + Array.from( + { length: 10 }, + (_, i) => [`c-gallery-${i + 1}`, embed(container(text(`${i + 1} items`), gallery(i + 1)))], + ), + ), + "c-gallery-tall": embed(container(gallery(3, [400, 800]))), + "c-gallery-wide": embed(container(gallery(2, [1600, 400]))), + "c-separators": embed(container( + text("small"), + { type: "separator" }, + text("large"), + { type: "separator", spacing: 2 }, + text("no divider"), + { type: "separator", divider: false }, + text("end"), + )), + "c-buttons": embed(container( + text("A row of buttons"), + { + type: "row", + components: [ + link("Store"), + link("Community", { emoji: { name: "🎮" } }), + link("", { emoji: { name: "⭐" } }), + link("Disabled", { disabled: true }), + link("A button with a label that is quite long indeed"), + ], + }, + )), + "c-spoiler": embed({ type: "container", spoiler: true, components: [text("a spoiler container"), gallery(2)] }), + "c-accent-none": embed(container(text("no accent"))), + "c-accent-red": embed({ type: "container", accent_color: 0xff0000, components: [text("red")] }), + "c-accent-black": embed({ type: "container", accent_color: 0, components: [text("black")] }), + "c-docs": embed({ + type: "container", + accent_color: 1752220, + components: [ + section("# **[New version out!](https://example.com/v2)**\nThe dungeon is deceptively tougher.", link("Open")), + gallery(3), + text("*Screenshots of new content*"), + { type: "separator", spacing: 1 }, + { type: "row", components: [link("Store"), link("Community"), link("Patch Notes")] }, + { type: "separator" }, + section("## **[??????](https://example.com/me)**\nWho could this be?", { + type: "thumbnail", + media: { url: image(400, 400, 4) }, + spoiler: true, + }), + ], + }), + "c-long": embed(container(text("a long line without any breaks ".repeat(70)))), + "c-linked": { ...embed(linked), discord: "/embeds/linked.json" }, + + // what Discord leaves out, and falls back from + "bad-nested-container": embed(container({ type: "container", components: [text("inner")] })), + "bad-button-key": embed(container({ type: "row", components: [link("x", { custom_id: "nope" })] })), + "bad-forty-one": embed(container(...Array.from({ length: 40 }, () => text("x")))), + "bad-gallery-11": embed(container(gallery(6), gallery(5))), + "bad-section-four": embed(container({ + type: "section", + components: [text("1"), text("2"), text("3"), text("4")], + accessory: link("x"), + })), + "bad-thumbnail-alone": embed(container({ type: "thumbnail", media: { url: image(400, 400) } })), + "bad-linked-missing": { ...embed(container(text("x"))), discord: "/embeds/missing.json" }, + + // open graph and twitter + "og-title-only": { openGraph: { title: "A title and nothing else" } }, + "og-pair": { title: "Title", description: "the title and description tags" }, + "og-pair-lonely": { title: "Title without a description" }, + "og-nothing": {}, + "og-small": { + title: "Small", + description: "A thumbnail beside the text.", + embed: { thumbnail: image(600, 600), thumbnailSize: "icon" }, + }, + "og-large": { + title: "Large", + description: "An image under the text.", + embed: { thumbnail: image(1200, 630) }, + themeColor: "#5865F2", + }, + "og-site-name": { + title: "Site", + description: "With a site name.", + embed: { siteTitle: "Paper Clover", thumbnail: image(1200, 630) }, + }, + "og-gallery-2": { + title: "Gallery", + description: "Two images.", + openGraph: { image: [image(800, 600), image(800, 600, 1)] }, + }, + "og-gallery-3": { + title: "Gallery", + description: "Three images.", + openGraph: { image: [image(800, 600), image(800, 600, 1), image(800, 600, 2)] }, + }, + "og-gallery-4": { + title: "Gallery", + description: "Four images.", + openGraph: { image: [0, 1, 2, 3].map((i) => image(800, 600, i)) }, + }, + "og-photo": { + title: "Photo", + twitter: { card: "photo", image: image(1200, 630) }, + openGraph: { image: image(1200, 630) }, + }, + "og-instapp": { title: "Instapp", openGraph: { type: "instapp:photo", image: image(1200, 630) } }, + "og-video": { + title: "Video", + openGraph: { type: "video.other", video: "/video.mp4", image: image(1280, 720) }, + twitter: { card: "player", title: "Video", image: image(1280, 720) }, + }, + "og-rich": { + title: "Rich", + description: "**bold** and a [link](https://example.com)\n- list", + openGraph: { type: "rich" }, + embed: { thumbnail: image(400, 400), thumbnailSize: "icon" }, + }, + "og-long": { + title: "A title that runs on well past the seventy bytes that Discord leaves of it", + description: "A description that runs on. ".repeat(20), + embed: { thumbnail: image(1200, 630) }, + }, + "og-color-bad": { title: "Color", description: "not a hex color", themeColor: "red" }, + "og-oembed": { title: "oEmbed", embed: {}, oEmbed: "/oembed.json" }, + "og-too-long-url": { + title: "Url", + description: "long image url", + openGraph: { image: "/" + "a".repeat(2100) + ".png" }, + }, + "tw-summary": { + title: "Summary", + description: "A summary card.", + embed: { thumbnail: image(600, 600), thumbnailSize: "icon" }, + }, + "tw-large": { title: "Large image", description: "Not shown on this card.", embed: { thumbnail: image(1200, 630) } }, + "tw-no-image": { title: "No image", description: "A summary card without an image.", embed: {} }, + "tw-no-card": { openGraph: { title: "OG", description: "only Open Graph tags" } }, + "tw-title-only": { twitter: { card: "summary", title: "Only a title" } }, + "tw-app": { title: "App", twitter: { card: "app" }, openGraph: { title: "App" } }, +}; + +/** pages that are not a `Meta`, for what a crawler is refused or finds malformed */ +const raw: Record Response> = { + "http-403": () => new Response("no", { status: 403, headers: { "content-type": "text/html" } }), + "bad-json": () => rawPage(`{nope`), + "bad-oversize": () => + rawPage(JSON.stringify({ component: { type: 17, components: [{ type: 10, content: "x".repeat(3100) }] } })), +}; + +function rawPage(script: string) { + const html = `Raw` + + `` + + ``; + return new Response(html, { headers: { "content-type": "text/html" } }); +} + +const names = [...Object.keys(cards), ...Object.keys(raw)]; + +// -- the server -- + +async function serve() { + const graph = new incremental.Graph({ db: null }); + const debug = new incremental.Debugger(graph); + debug.update({ + ok: true, + value: null, + changed: [], + stats: { duration: 12, ran: 1, reused: 2, written: 3, cacheBytes: 4, outputBytes: 5 }, + watching: { file: 1 }, + statusLine: "Watching 1 file", + } as never); + + return http.serve({ + port, + respond: debug.respond(async (request) => { + const { pathname } = new URL(request.url); + const picture = /^\/img\/(\d+)x(\d+)-(\d)\.png$/.exec(pathname); + if (picture) { + const [, width, height, hue] = picture; + return new Response(new Uint8Array(png(Number(width), Number(height), hues[Number(hue)]!)), { + headers: { "content-type": "image/png" }, + }); + } + if (pathname === "/embeds/linked.json") return Response.json(payloadOf(linked)); + if (pathname === "/oembed.json") { + return Response.json({ + version: "1.0", + type: "link", + author_name: "Anthony Tešija", + provider_name: "Dungeon Delvers", + thumbnail_url: image(1200, 630, 4), + thumbnail_width: 1200, + thumbnail_height: 630, + }); + } + const name = pathname.slice(1); + if (name === "") { + const items = names.map((name) => `
  • ${name}`).join(""); + return new Response(`meta cards
      ${items}
    `, { + headers: { "content-type": "text/html" }, + }); + } + if (raw[name]) return raw[name](); + if (!cards[name]) return new Response("not a fixture", { status: 404 }); + const html = `${ + meta.toHtml(template, cards[name]) + }

    ${name}

    `; + return new Response(html, { headers: { "content-type": "text/html" } }); + }), + upgrade: debug.upgrade, + shouldUpgrade: debug.shouldUpgrade, + }); +} + +/** what discord reads of a component embed, which `toTags` makes of it */ +function payloadOf(discord: meta.DiscordComponent): meta.DiscordPayload { + const children = meta.toTags(template, { discord }).scripts[0]!.children; + return JSON.parse(children as string); +} + +// -- screenshots -- + +/** `--width=560 --scale=2` and the names of fixtures, which is all of them if there are none */ +function parse(args: string[]) { + const flags = Object.fromEntries(args.filter((arg) => arg.startsWith("--")).map((arg) => arg.slice(2).split("="))); + return { flags: flags as Record, only: args.filter((arg) => !arg.startsWith("--")) }; +} + +async function shots(args: string[]) { + const { flags, only } = parse(args); + const { chromium } = await import("playwright"); + const server = await serve(); + // a page that reports itself automated gets no visualization + const browser = await chromium.launch({ channel: "chrome", args: ["--disable-blink-features=AutomationControlled"] }); + fs.mkdirSync(outDir, { recursive: true }); + try { + for (const name of only.length > 0 ? only : names) { + const context = await browser.newContext({ + viewport: { width: 900, height: 1200 }, + deviceScaleFactor: Number(flags.scale ?? 1), + }); + const page = await context.newPage(); + const problems: string[] = []; + page.on("pageerror", (error) => problems.push(error.message)); + await page.goto(`${base.href}${name}`); + await page.locator(".clover").click(); + await page.locator("#tab-meta").click(); + // the panel is as wide as the message that a card is checked against + if (flags.width) { + await page.evaluate( + (width) => + (document.querySelector("clover-debugger") as HTMLElement).style.setProperty("--width", `${width}px`), + flags.width, + ); + } + await page.locator(".cards > .preview").first().waitFor(); + // images that are published somewhere else fall back to this server's, and then they are done + await page.waitForFunction( + () => { + const images = document.querySelector("clover-debugger")!.shadowRoot!.querySelectorAll("img"); + return Array.from(images).every((img) => img.complete); + }, + undefined, + { polling: 100 }, + ); + await page.locator(".cards").screenshot({ path: `${outDir}/${name}.png` }); + const chat = page.locator(".chat").first(); + const box = await page.locator(".chat .d-container, .chat .discord").first().boundingBox().catch(() => null); + if (await chat.count()) await chat.screenshot({ path: `${outDir}/${name}.chat.png` }); + const size = box ? ` ${Math.round(box.width)}x${Math.round(box.height)}` : ""; + console.log(`${name}${size}${problems.length > 0 ? ` errors: ${problems.join("; ")}` : ""}`); + await context.close(); + } + } finally { + await browser.close(); + await server.close(); + } +} + +// -- real discord -- + +/** the window of chrome that has discord open, as an image. macOS only, and it needs screen recording */ +function capture(file: string) { + const find = `ObjC.import("CoreGraphics"); + const windows = ObjC.deepUnwrap(ObjC.castRefToObject($.CGWindowListCopyWindowInfo( + $.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, $.kCGNullWindowID))); + windows.find((w) => w.kCGWindowOwnerName === "Google Chrome" && /Discord/.test(w.kCGWindowName ?? "")).kCGWindowNumber`; + const id = child_process.execFileSync("osascript", ["-l", "JavaScript", "-e", find]).toString().trim(); + child_process.execFileSync("screencapture", ["-x", "-o", `-l${id}`, file]); +} + +/** + * what to post for a fixture: a component embed as a message of components, and + * what a link to the rest would unfurl to as embeds, which Discord draws as it + * draws that unfurl, but for the provider's name + */ +function message(name: string): object | null { + const page = cards[name]!; + if (page.discord && typeof page.discord === "object") { + return { flags: 1 << 15, components: [payloadOf(page.discord).component] }; + } + const { title, description, themeColor, openGraph: og, twitter } = meta.scrape(meta.toTags(template, page)); + const text = { + url: `${base.href}${name}`, + title: og.title?.[0] ?? title ?? undefined, + description: og.description?.[0] ?? description ?? undefined, + color: themeColor && /^#[0-9a-f]{6}$/i.test(themeColor) ? parseInt(themeColor.slice(1), 16) : undefined, + }; + if (!text.title && !text.description) return null; + const images = (og.image ?? []).map((url) => new URL(url, base).href); + // embeds that share a link are one card with a gallery + if (images.length > 1 || (images.length === 1 && twitter.card?.at(-1) === "summary_large_image")) { + return { + embeds: images.slice(0, 4).map((url, i) => ({ ...(i === 0 ? text : { url: text.url }), image: { url } })), + }; + } + return { embeds: [{ ...text, ...(images[0] && { thumbnail: { url: images[0] } }) }] }; +} + +async function discord(only: string[]) { + const webhook = process.env.TEST_DISCORD_WEBHOOK; + if (!webhook) throw new Error("TEST_DISCORD_WEBHOOK is not set"); + const server = await serve(); + try { + for (const name of only.length > 0 ? only : Object.keys(cards).filter((name) => name.startsWith("c-"))) { + const body = message(name); + if (!body) continue; + // media on this machine goes along as attachments, which discord can read + const files = new Map(); + const json = JSON.stringify(body, (key, value) => { + if (key !== "url" || typeof value !== "string" || !value.startsWith(`${base.href}img/`)) return value; + const file = new URL(value).pathname.slice("/img/".length); + const [, width, height, hue] = /^(\d+)x(\d+)-(\d)\.png$/.exec(file)!; + files.set(file, png(Number(width), Number(height), hues[Number(hue)]!)); + return `attachment://${file}`; + }); + const form = new FormData(); + form.set("payload_json", json); + Array.from(files).forEach(([file, bytes], i) => form.set(`files[${i}]`, new Blob([new Uint8Array(bytes)]), file)); + const response = await fetch(`${webhook}?wait=true&with_components=true`, { method: "POST", body: form }); + console.log(`${name} ${response.status}${response.ok ? "" : " " + (await response.text())}`); + // the message is drawn, and its images are fetched, before the window is taken + await async.delay(3000); + fs.mkdirSync(`${outDir}/discord`, { recursive: true }); + capture(`${outDir}/discord/${name}.png`); + } + } finally { + await server.close(); + } +} + +/** + * the capture of discord and the `meta` tab side by side, as high as the card and + * bottom aligned, in `.clover/meta-cards/compare`. `shots --width=620 --scale=2` + * makes the one half, and `discord` the other. The message pane is assumed to + * start at `paneX` device pixels, and the card to be the last thing in it. + */ +async function compare(args: string[]) { + const { only } = parse(args); + const { chromium } = await import("playwright"); + const browser = await chromium.launch({ channel: "chrome" }); + const page = await browser.newPage(); + fs.mkdirSync(`${outDir}/compare`, { recursive: true }); + const read = (file: string) => `data:image/png;base64,${fs.readFileSync(file).toString("base64")}`; + try { + for (const name of only) { + const url = await page.evaluate(async ([real, mine]) => { + const paneX = 760, width = 1040; + const load = async (src: string) => { + const img = new Image(); + img.src = src; + await img.decode(); + return img; + }; + const [capture, ours] = await Promise.all([load(real!), load(mine!)]); + // the bottom border of the last card, which is the last long run of its color + const canvas = document.createElement("canvas"); + canvas.width = capture.width; + canvas.height = capture.height; + const context = canvas.getContext("2d")!; + context.drawImage(capture, 0, 0); + const pixels = context.getImageData(0, 0, capture.width, capture.height).data; + let bottom = 0; + for (let y = 0; y < capture.height; y++) { + let run = 0; + for (let x = paneX; x < capture.width && run < 40; x++) { + const i = (y * capture.width + x) * 4; + run = Math.abs(pixels[i]! - 0x43) + Math.abs(pixels[i + 1]! - 0x45) + Math.abs(pixels[i + 2]! - 0x4c) < 6 + ? run + 1 + : 0; + } + if (run >= 40) bottom = y; + } + // the chat of the tab has 12 pixels of padding below the card, which is 24 device pixels + const height = Math.min(ours.height - 24, 1100); + const out = document.createElement("canvas"); + out.width = 2 * width + 8; + out.height = height + 24; + const draw = out.getContext("2d")!; + draw.fillStyle = "#000"; + draw.fillRect(0, 0, out.width, out.height); + draw.drawImage(capture, paneX, bottom + 2 - height, width, height + 24, 0, 0, width, height + 24); + draw.drawImage(ours, 0, ours.height - 24 - height, width, height + 24, width + 8, 0, width, height + 24); + return out.toDataURL("image/png"); + }, [read(`${outDir}/discord/${name}.png`), read(`${outDir}/${name}.chat.png`)]); + fs.writeFileSync(`${outDir}/compare/${name}.png`, Buffer.from(url.split(",")[1]!, "base64")); + console.log(`${outDir}/compare/${name}.png`); + } + } finally { + await browser.close(); + } +} + +if (existsSync(".env")) process.loadEnvFile(".env"); +const [command, ...rest] = process.argv.slice(2); +if (command === "serve") { + const server = await serve(); + console.log(`up: ${base.href} (${names.length} pages)`); + process.on("SIGINT", () => void server.close().then(() => process.exit(0))); +} else if (command === "shots") { + await shots(rest); +} else if (command === "discord") { + await discord(rest); +} else if (command === "compare") { + await compare(rest); +} else { + console.log("usage: meta-cards.ts serve | shots [name...] | discord [name...] | compare name..."); +} + +import * as child_process from "node:child_process"; +import { existsSync } from "node:fs"; +import * as fs from "node:fs"; +import * as zlib from "node:zlib"; +import * as async from "../async.ts"; +import * as http from "../http.ts"; +import * as incremental from "../incremental.ts"; +import * as meta from "../meta.ts"; diff --git a/lib/incremental/visualization.ts b/lib/incremental/visualization.ts index 7eaadfb776ca4d821057e52bc5e61d80082071ea..b6735820434e8a842c97f66ade0518ecaa2b2f76 100644 --- a/lib/incremental/visualization.ts +++ b/lib/incremental/visualization.ts @@ -38,6 +38,8 @@ let saved = JSON.parse(sessionStorage.getItem(savedKey) ?? "null") as Saved | nu /** the panel stays open */ let open = home || (saved?.open ?? false); let maximized = home || (saved?.maximized ?? false); +/** how wide the panel is dragged to, in pixels */ +let width = saved?.width ?? null; let tab: (typeof tabs)[number] = home ? "graph" : saved?.tab ?? "status"; /** a build changed this page, which still shows what it was */ let stale = false; @@ -53,11 +55,12 @@ let timer: ReturnType | undefined; let ticking: ReturnType | undefined; let retry = 100; -const tabs = ["status", "problems", "graph"] as const; +const tabs = ["status", "problems", "meta", "graph"] as const; interface Saved { /** what the debugger's own page shows is not carried to the page after it */ open?: boolean; maximized?: boolean; + width?: number; tab?: (typeof tabs)[number]; folded: boolean; view: typeof view; @@ -137,6 +140,7 @@ shadow.innerHTML = ` aria-controls=panel>${clover()}