Keep approved Dock and add row feedback with stable themed scrollbars

This commit is contained in:
SantaSpeen committed 2026-11-30 19:46:34 +03:00
1 parent c41a5e4276
commit 645afe3ebf
101 files changed
+580 -1348

No files matched your search

+32 -4
View File
@@ -1,8 +1,11 @@
import assert from "node:assert/strict";
import { readFile, mkdir, writeFile } from "node:fs/promises";
import { concepts, tokensFor, cssVars } from "../concepts/registry.js";
assert.equal(concepts.length, 6);
assert.equal(new Set(concepts.map((c) => c.layout)).size, 6);
assert.deepEqual(
concepts.map((c) => c.id),
["dock"],
);
assert.equal(concepts[0].layout, "rail");
const luminance = (hex) =>
hex
.match(/\w\w/g)
@@ -18,7 +21,12 @@ for (const c of concepts)
for (const theme of ["light", "dark"])
for (const density of ["compact", "normal", "relaxed"]) {
const t = tokensFor(c.id, theme, undefined, density);
for (const bg of ["color.bg", "color.surface"])
for (const bg of [
"color.bg",
"color.surface",
"color.row-hover",
"color.row-active",
])
for (const fg of [
"color.text",
"color.muted",
@@ -32,6 +40,26 @@ for (const c of concepts)
);
assert.ok(contrast(t["color.accent"], t["color.on-accent"]) >= 4.5);
}
for (const theme of ["light", "dark"])
for (const accent of [
"#ffcc00",
"#000000",
"#ffffff",
"#27634c",
"#ff0055",
]) {
const tokens = tokensFor("dock", theme, accent);
for (const bg of [
"color.bg",
"color.surface",
"color.row-hover",
"color.row-active",
])
assert.ok(
contrast(tokens["color.accent"], tokens[bg]) >= 4.5,
`${theme}/${accent}/${bg} custom accent`,
);
}
for (const c of concepts)
for (const theme of ["light", "dark"]) {
const tokens = tokensFor(c.id, theme);
@@ -54,5 +82,5 @@ for (const file of [
])
assert.ok((await readFile(file, "utf8")).length > 100);
console.log(
"PASS: six layout grammars, 36 token sets, default text contrast, generated CSS/JSON.",
"PASS: approved Dock, 6 token configurations, default text contrast, generated CSS/JSON.",
);
+14 -21
View File
@@ -1,4 +1,5 @@
import { chromium } from "playwright";
import { mkdir } from "node:fs/promises";
const base = process.env.BASE_URL || "http://127.0.0.1:4173";
const browser = await chromium.launch({
executablePath:
@@ -9,27 +10,19 @@ const browser = await chromium.launch({
headless: true,
});
try {
const page = await browser.newPage();
for (const device of ["desktop", "mobile"])
for (const theme of ["light", "dark"]) {
const width = device === "desktop" ? 640 : 300,
height = device === "desktop" ? 570 : 780;
await page.setViewportSize({
width: width * 3,
height: (height + 35) * 2,
});
await page.setContent(
`<style>*{box-sizing:border-box}body{margin:0;background:#303335;color:white;display:grid;grid-template-columns:repeat(3,${width}px);font:14px Arial}section{width:${width}px;height:${height + 35}px;padding:0 8px 8px}header{height:35px;padding:10px}img{width:100%;height:${height - 8}px;object-fit:contain;object-position:top;background:#202224}</style>${["relay", "ledger", "signal", "axis", "dock", "grid"].map((c) => `<section><header>${c.toUpperCase()} / ${theme} / ${device}</header><img src="${base}/test-results/screenshots/${c}-${theme}-${device}-dashboard.png"></section>`).join("")}`,
);
await page
.locator("img")
.evaluateAll((imgs) => Promise.all(imgs.map((i) => i.decode())));
await page.screenshot({
path: `references/concepts-${theme}-${device}.jpg`,
type: "jpeg",
quality: 90,
});
}
await mkdir("references/approved-dock", { recursive: true });
const page = await browser.newPage({
viewport: { width: 1440, height: 390 },
});
await page.setContent(
`<style>*{box-sizing:border-box}body{margin:0;display:flex;background:#18272d;color:white;font:14px Arial}section{width:720px}header{height:40px;padding:12px}img{display:block;width:720px;height:350px;object-fit:contain}</style>${["light", "dark"].map((theme) => `<section><header>ANIDEV DOCK / ${theme.toUpperCase()} / ROW HOVER</header><img src="${base}/references/approved-dock/rows-${theme}-desktop.png"></section>`).join("")}`,
);
await page
.locator("img")
.evaluateAll((images) =>
Promise.all(images.map((image) => image.decode())),
);
await page.screenshot({ path: "references/approved-dock/preview.png" });
} finally {
await browser.close();
}