Files
FastD e352335822 Filter bar with hover layer, icon-only project links, design reports
Filters: the panel is a bar (status segment, always visible) plus a body that lives as a layer
under it - collapsed by default, expands on hover/focus/tap and never moves the case grid; the
reset control appears only when a facet is limited; width capped at 720px (measured 45px slack
against 477px before). Facet research report is included.

Links: project links in the mini card and in the project window are icon-only buttons with a
uniform slot (16px card / 18px window) and the accessible name in aria-label; studio contacts
(mail, VK, RuStore) live outside the cards.

Team and page: real photos from the public TITANS team page go to the member window while the
card keeps the mascot; the portfolio gains the First Step Radio card and genre values, the
process block became an individual-approach section, plus a cookie bar and a removable ticker.

Design folders under design/ keep reports, measurements, scripts and the .pen; probe and
before/after screenshot dumps, editor backups and caches are removed. Background-variant and
palette previews stay until the client picks one.
2026-10-15 05:50:52 +03:00

383 lines
22 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* Live verification of the project-link buttons with resource marks (§10.28, 2026-10-14).
*
* Answers the five acceptance points of kanban t_2533ea75 with measurements, not prose:
* 1. both points (mini-card + quick-view) look identical and readable -> label/href/icon parity table
* 2. icons are inline, no new network request -> request-set diff vs src-baseline/
* 3. aria-hidden on icons, label by purpose, hit area >= 24x24,
* focus-visible present, WCAG AA in both themes -> DOM + contrast assertions
* 4. projectLinksHTML() stays the single source of button composition -> card == window, checked live
* 5. (5 is the .pen, checked by its own script)
* Screenshots both points x {1440,390} x {light,dark} into shots/.
*
* Run: NODE_PATH="$LOCALAPPDATA/hermes/hermes-agent/node_modules" \
* node design/project-links-2026-10-14/verify-project-links.cjs
* Exit: 0 = all checks pass, 1 = at least one failure.
*/
const { chromium } = require("playwright");
const fs = require("fs");
const path = require("path");
const EXE = process.env.CHROME_EXE ||
"C:/Users/deeen/AppData/Local/ms-playwright/chromium-1223/chrome-win64/chrome.exe";
const BASE = process.env.PAGE_URL || "http://127.0.0.1:8765";
const SHOTS = path.join(__dirname, "shots");
if (!fs.existsSync(SHOTS)) fs.mkdirSync(SHOTS, { recursive: true });
const FAILS = [];
const L = [];
const w = (s = "") => { L.push(s); console.log(s); };
/* expected composition per project — derived from content/projects/*.md */
const EXPECT = [
{ slug: "bukvika", title: "Буквика", links: [["rustore", "В RuStore", "https://www.rustore.ru/catalog/app/ru.hmt.bukvika"], ["vk", "Играть во VK", "https://vk.ru/app53786153"]] },
{ slug: "associations", title: "Ассоциации", links: [["vk", "Играть во VK", "https://vk.ru/app54769031"]] },
{ slug: "first-step-radio", title: "First Step Radio", links: [["site", "Сайт проекта", "https://fsr.uzuron.com/"], ["rustore", "В RuStore", "https://www.rustore.ru/catalog/app/ru.hmt.fsr"]] },
];
const VIEWBOX = {
rustore: "14.65 15.95 58.835 55.99",
vk: "3.9 7.15 16.31 10.29",
site: "0 0 24 24",
video: "0 0 24 24",
};
/* ---------- WCAG 2.x contrast, recomputed here (not read from the page) ---------- */
function lum(css) {
const m = (css.match(/[\d.]+/g) || [0, 0, 0]).slice(0, 3).map(Number);
return m.map((v) => { v /= 255; return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4); })
.reduce((s, v, i) => s + v * [0.2126, 0.7152, 0.0722][i], 0);
}
function ratio(a, b) { const l1 = lum(a), l2 = lum(b); return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05); }
const PROBE_LINKS = (sel) => {
const out = [];
document.querySelectorAll(sel).forEach((a) => {
const svg = a.querySelector("svg.btn__icon");
const r = a.getBoundingClientRect();
const cs = getComputedStyle(a);
// effective background: first ancestor with a non-transparent background-color
let bgEl = a, bg = "rgba(0, 0, 0, 0)";
while (bgEl && (bg === "rgba(0, 0, 0, 0)" || bg === "transparent")) {
bg = getComputedStyle(bgEl).backgroundColor;
bgEl = bgEl.parentElement;
}
out.push({
label: a.textContent.trim(),
href: a.getAttribute("href"),
cls: a.className,
svg: !!svg,
viewBox: svg ? svg.getAttribute("viewBox") : null,
ariaHidden: svg ? svg.getAttribute("aria-hidden") : null,
focusable: svg ? svg.getAttribute("focusable") : null,
pathCount: svg ? svg.querySelectorAll("path, circle, ellipse, rect").length : 0,
imgInside: a.querySelectorAll("img").length,
useExternal: svg ? svg.querySelectorAll("use, image").length : 0,
iconH: svg ? +svg.getBoundingClientRect().height.toFixed(2) : 0,
iconW: svg ? +svg.getBoundingClientRect().width.toFixed(2) : 0,
w: +r.width.toFixed(2), h: +r.height.toFixed(2),
color: cs.color,
bg,
borderColor: cs.borderTopColor,
borderW: cs.borderTopWidth,
outlineW: cs.outlineWidth,
outlineStyle: cs.outlineStyle,
transition: cs.transitionProperty,
});
});
return out;
};
/* WCAG 2.x relative luminance + contrast ratio, computed in-page */
const CONTRAST_SNIPPET = `
(function pairs() {
function rgb(s) { const m = s.match(/[\\d.]+/g) || [0, 0, 0]; return m.slice(0, 3).map(Number); }
function lum(c) { return c.map((v) => { v = v / 255; return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4); })
.reduce((s, v, i) => s + v * [0.2126, 0.7152, 0.0722][i], 0); }
function ratio(a, b) { const l1 = lum(rgb(a)), l2 = lum(rgb(b)); return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05); }
return { rgb: rgb, ratio: ratio };
})()`;
/* Build the pre-change baseline for the network diff from git HEAD, so the check
* is reproducible without keeping a copy of src/ in the working tree.
* Removed again at the end unless KEEP_BASELINE=1. */
function ensureBaseline() {
const dir = path.join(__dirname, "..", "..", "src-baseline");
if (fs.existsSync(path.join(dir, "index.html"))) return dir;
fs.mkdirSync(path.join(dir, "js"), { recursive: true });
fs.mkdirSync(path.join(dir, "data"), { recursive: true });
const git = (spec, out) => {
const r = require("child_process").execSync("git show " + spec, { cwd: path.join(__dirname, "..", ".."), encoding: "buffer" });
fs.writeFileSync(out, r);
};
git("HEAD:src/index.html", path.join(dir, "index.html"));
git("HEAD:src/js/main.js", path.join(dir, "js", "main.js"));
for (const f of ["form.js", "planet.js"]) {
git("HEAD:src/js/" + f, path.join(dir, "js", f));
}
for (const f of ["projects.js", "team.js"]) {
git("HEAD:src/data/" + f, path.join(dir, "data", f));
}
return dir;
}
function dropBaseline(dir) {
if (process.env.KEEP_BASELINE === "1") return;
fs.rmSync(dir, { recursive: true, force: true });
}
async function collectRequests(url) {
const browser = await chromium.launch({ executablePath: EXE });
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
const page = await ctx.newPage();
const reqs = [];
page.on("request", (r) => reqs.push(r.url()));
await page.goto(url, { waitUntil: "load" });
await page.waitForTimeout(1200);
await browser.close();
return reqs;
}
(async () => {
w("# Проверка: ссылки-кнопки проектов со знаками ресурсов (§10.28)");
w();
w("Проект: `G:\\Project\\Haevey_Monster_Team_Page` · канбан `t_2533ea75` · 2026-10-14");
w("Живая страница `" + BASE + "/src/` (dev-server без кэша) + Playwright/Chromium 1223.");
w();
/* ---------- 2. network: current page vs the pre-change baseline (git HEAD src) ---------- */
w("## 2. Сетевые запросы");
w();
const baseDir = ensureBaseline();
const nowReqs = await collectRequests(BASE + "/src/");
const baseReqs = await collectRequests(BASE + "/src-baseline/");
dropBaseline(baseDir); // копия src/ нужна только на время снятия запросов
const uniq = (a) => Array.from(new Set(a));
/* сравниваем пути без origin и без имени каталога: /src/ против /src-baseline/ */
const nowU = uniq(nowReqs).map((u) => u.replace(/^https?:\/\/[^/]+/, ""));
const baseU = uniq(baseReqs).map((u) => u.replace(/^https?:\/\/[^/]+/, "").replace(/^\/src-baseline/, "/src"));
const added = nowU.filter((u) => !baseU.includes(u));
const removed = baseU.filter((u) => !nowU.includes(u));
const hosts = uniq(nowReqs.map((u) => { try { return new URL(u).host; } catch (e) { return "?"; } }));
const iconish = uniq(nowReqs).filter((u) => /\.svg(\?|$)/i.test(u) || /icon|awesome|feather|lucide|icomoon|material-icons/i.test(u));
w("База сравнения — копия `git show HEAD:src/*`, поднимается на время замера и удаляется (`src-baseline/`):");
w();
w("| Что | значение |");
w("|---|---|");
w("| запросов всего (текущая) | " + uniq(nowReqs).length + " |");
w("| запросов всего (базовая) | " + uniq(baseReqs).length + " |");
w("| добавлено правкой | " + (added.length ? added.join(", ") : "**нет**") + " |");
w("| исчезло | " + (removed.length ? removed.join(", ") : "нет") + " |");
w();
w("Хосты, к которым обращается текущая страница: " + hosts.join(", "));
w();
if (added.length) FAILS.push("новые сетевые запросы: " + added.join(", "));
if (iconish.length && added.some((u) => iconish.includes(u))) FAILS.push("иконки тянутся по сети: " + iconish.join(", "));
w("Иконки-запросы (svg/шрифты/иконочные имена) среди запросов страницы: " +
(iconish.length ? "**" + iconish.join(", ") + "**" : "нет — знаки нарисованы инлайново (геометрия в DOM)") + ".");
w();
/* ---------- DOM / a11y / contrast over both points × both themes × both widths ---------- */
const browser = await chromium.launch({ executablePath: EXE });
const parity = [];
w("## 1 и 3. Живые замеры: мини-карточка и большое окно, светлая/тёмная, 1440/390");
w();
for (const vp of [{ w: 1440, h: 900 }, { w: 390, h: 844 }]) {
for (const theme of ["light", "dark"]) {
const ctx = await browser.newContext({ viewport: { width: vp.w, height: vp.h } });
const page = await ctx.newPage();
const jsErrors = [];
const badResp = [];
page.on("pageerror", (e) => jsErrors.push(String(e)));
page.on("console", (m) => {
if (m.type() === "error" && !/Failed to load resource/i.test(m.text())) jsErrors.push(m.text());
});
page.on("response", (r) => { if (r.status() >= 400) badResp.push(r.status() + " " + r.url()); });
await page.goto(BASE + "/src/", { waitUntil: "load" });
await page.waitForTimeout(400);
if (theme === "dark") {
if (vp.w > 767) {
await page.click("#theme-toggle");
} else {
await page.click(".nav-toggle");
await page.waitForTimeout(250);
await page.click("#theme-toggle-panel");
await page.waitForTimeout(250);
await page.click(".nav-toggle"); // закрыть мобильное меню — иначе оно попадает в кадр
}
await page.waitForTimeout(400);
}
const got = await page.evaluate(() => document.documentElement.getAttribute("data-theme") || "light");
if (got !== theme) FAILS.push(`${vp.w}/${theme}: тема не переключилась (data-theme=${got})`);
const cv = { ratio: ratio };
const tag = `${vp.w}-${theme}`;
w(`### ${vp.w}px · ${theme}`);
w();
/* --- mini-card point --- */
for (const exp of EXPECT) {
const sel = `.case-card[data-slug="${exp.slug}"]`;
await page.locator(sel).scrollIntoViewIfNeeded();
await page.waitForTimeout(350);
const links = await page.evaluate(
([s, fn]) => new Function("return (" + fn + ")")().call(null, s),
[sel + " .case-card__links a", PROBE_LINKS.toString()]);
if (links.length !== exp.links.length) {
FAILS.push(`${tag}/${exp.slug}: в карточке ${links.length} ссылок, ожидалось ${exp.links.length}`);
return;
}
links.forEach((l, i) => {
const [kind, label, href] = exp.links[i];
if (l.label !== label) FAILS.push(`${tag}/${exp.slug}[${i}]: подпись «${l.label}», ожидалось «${label}»`);
if (l.href !== href) FAILS.push(`${tag}/${exp.slug}[${i}]: href ${l.href} != ${href}`);
if (l.viewBox !== VIEWBOX[kind]) FAILS.push(`${tag}/${exp.slug}[${i}]: viewBox ${l.viewBox} != знаку ${kind}`);
if (!l.svg) FAILS.push(`${tag}/${exp.slug}[${i}]: нет инлайнового svg.btn__icon`);
if (l.ariaHidden !== "true") FAILS.push(`${tag}/${exp.slug}[${i}]: aria-hidden=${l.ariaHidden}`);
if (l.focusable !== "false") FAILS.push(`${tag}/${exp.slug}[${i}]: focusable=${l.focusable}`);
if (l.imgInside || l.useExternal) FAILS.push(`${tag}/${exp.slug}[${i}]: внутри ссылки img/use/image — иконка не инлайновая`);
if (Math.abs(l.iconH - 16) > 0.5) FAILS.push(`${tag}/${exp.slug}[${i}]: иконка ${l.iconH}px, ожидалось 16px`);
if (l.w < 24 || l.h < 24) FAILS.push(`${tag}/${exp.slug}[${i}]: hit-area ${l.w}x${l.h} < 24x24`);
const cr = cv.ratio(l.color, l.bg);
if (cr < 4.5) FAILS.push(`${tag}/${exp.slug}[${i}]: контраст подписи ${cr.toFixed(2)}:1 (${l.color} на ${l.bg}) < 4.5`);
});
w(`- карточка **${exp.title}**: ` + links.map((l) => `«${l.label}» [${l.viewBox}] ${l.w}×${l.h}px, иконка ${l.iconH}×${l.iconW}px, ${cv.ratio(l.color, l.bg).toFixed(2)}:1`).join(" · "));
}
w();
/* --- 3 buttons in one row (the component must survive 1..3) --- */
const row = await page.evaluate((sel) => {
const box = document.querySelector(sel);
if (!box) return null;
const clone = box.querySelector("a").cloneNode(true);
clone.querySelector("span") && clone.querySelector("span").remove();
clone.lastChild.nodeValue = "Видео";
box.appendChild(clone);
const kids = Array.from(box.children).map((k) => k.getBoundingClientRect());
const bb = box.getBoundingClientRect();
const oneLine = kids.every((k) => Math.abs(k.top - kids[0].top) < 1);
const overflow = Math.max(...kids.map((k) => k.right)) - bb.right;
const res = { n: kids.length, oneLine, overflow: +overflow.toFixed(2), rowW: +bb.width.toFixed(2), first: +kids[0].width.toFixed(2) };
box.removeChild(box.lastElementChild);
return res;
}, `.case-card[data-slug="first-step-radio"] .case-card__links`);
if (row) {
w(`- ряд из 3 кнопок (проверка клонированием, в макет не пишется): ${row.n} шт., в одну строку: ${row.oneLine ? "да" : "нет"}, выход за ряд: ${row.overflow}px, ширина ряда ${row.rowW}px`);
if (row.overflow > 0.5) FAILS.push(`${tag}: 3 кнопки выходят за ряд на ${row.overflow}px`);
w();
}
/* --- focus-visible + screenshot of the card point --- */
await page.keyboard.press("Tab"); // клавиатурная модальность: после клика по тумблеру темы :focus-visible иначе не выставится
const foc = await page.evaluate((sel) => {
const a = document.querySelector(sel);
if (!a) return null;
a.focus();
const cs = getComputedStyle(a);
return { fv: a.matches(":focus-visible"), w: cs.outlineWidth, s: cs.outlineStyle, c: cs.outlineColor, o: cs.outlineOffset };
}, `.case-card[data-slug="bukvika"] .case-card__links a`);
w(`- :focus-visible на ссылке карточки — ${foc.fv ? "да" : "НЕТ"}, кольцо ${foc.w} ${foc.s} ${foc.c} (offset ${foc.o})`);
if (!foc.fv || parseFloat(foc.w) < 2 || foc.s === "none") FAILS.push(`${tag}: нет видимого фокус-кольца на ссылке карточки`);
w();
await page.locator(`.case-card[data-slug="bukvika"]`).screenshot({ path: path.join(SHOTS, `card-${tag}.png`) });
await page.locator(`.case-card[data-slug="bukvika"] .case-card__links`).screenshot({ path: path.join(SHOTS, `links-${tag}.png`) });
/* --- quick-view point --- */
const opened = await page.evaluate(() => {
const card = document.querySelector('.case-card[data-slug="first-step-radio"]');
if (!card) return false;
card.querySelector(".case-card__more").click();
return true;
});
if (!opened) { FAILS.push(`${tag}: карточка First Step Radio не найдена`); }
await page.waitForTimeout(450);
const qvOpen = await page.evaluate(() => !!document.querySelector("#quickview[open]"));
if (!qvOpen) FAILS.push(`${tag}: окно проекта не открылось`);
const win = await page.evaluate(
([sel, fn]) => new Function("return (" + fn + ")")().call(null, sel),
["#quickview .quickview__links a", PROBE_LINKS.toString()]);
win.forEach((l, i) => {
const exp = EXPECT.find((e) => e.slug === "first-step-radio").links[i];
if (!exp) { FAILS.push(`${tag}/окно[${i}]: лишняя ссылка «${l.label}»`); return; }
const [kind, label, href] = exp;
if (l.label !== label) FAILS.push(`${tag}/окно[${i}]: подпись «${l.label}» != «${label}»`);
if (l.href !== href) FAILS.push(`${tag}/окно[${i}]: href ${l.href} != ${href}`);
if (l.viewBox !== VIEWBOX[kind]) FAILS.push(`${tag}/окно[${i}]: viewBox ${l.viewBox} != знаку ${kind}`);
if (l.ariaHidden !== "true" || l.focusable !== "false") FAILS.push(`${tag}/окно[${i}]: aria-hidden/focusable не выставлены`);
if (l.imgInside || l.useExternal) FAILS.push(`${tag}/окно[${i}]: иконка не инлайновая`);
if (Math.abs(l.iconH - 18) > 0.5) FAILS.push(`${tag}/окно[${i}]: иконка ${l.iconH}px, ожидалось 18px`);
if (l.w < 24 || l.h < 24) FAILS.push(`${tag}/окно[${i}]: hit-area ${l.w}x${l.h} < 24x24`);
const cr = cv.ratio(l.color, l.bg);
if (cr < 4.5) FAILS.push(`${tag}/окно[${i}]: контраст ${cr.toFixed(2)}:1 (${l.color} на ${l.bg}) < 4.5`);
});
const expF = EXPECT.find((e) => e.slug === "first-step-radio").links;
if (win.length !== expF.length) FAILS.push(`${tag}/окно: ссылок ${win.length}, ожидалось ${expF.length}`);
if (win.length && !/btn--primary/.test(win[0].cls)) FAILS.push(`${tag}/окно[0]: первая ссылка не основной CTA (${win[0].cls})`);
const rowW3 = await page.evaluate((sel) => {
const box = document.querySelector(sel);
if (!box) return null;
const clone = box.querySelector("a").cloneNode(true);
clone.lastChild.nodeValue = "Видео";
box.appendChild(clone);
const kids = Array.from(box.children).map((k) => k.getBoundingClientRect());
const bb = box.getBoundingClientRect();
const res = {
n: kids.length,
oneLine: kids.every((k) => Math.abs(k.top - kids[0].top) < 1),
overflow: +(Math.max.apply(null, kids.map((k) => k.right)) - bb.right).toFixed(2),
rowW: +bb.width.toFixed(2),
};
box.removeChild(box.lastElementChild);
return res;
}, "#quickview .quickview__links");
if (rowW3) w(`- ряд из 3 знаков в окне (клонирование): ${rowW3.oneLine ? "**в одну строку**" : "перенос на 2 строки"}, выход за ряд ${rowW3.overflow}px, ширина ряда ${rowW3.rowW}px`);
w(`- окно **First Step Radio**: ` + win.map((l, i) => `«${l.label}» ${i === 0 ? "[primary]" : "[ghost]"} ${l.viewBox}, иконка ${l.iconH}px, ${cv.ratio(l.color, l.bg).toFixed(2)}:1`).join(" · "));
w();
parity.push({ tag, slug: "first-step-radio", card: (await page.evaluate(() => {
const c = document.querySelector('.case-card[data-slug="first-step-radio"]');
return c ? Array.from(c.querySelectorAll(".case-card__links a")).map((a) => a.textContent.trim() + "|" + a.getAttribute("href")) : [];
})), window: win.map((l) => l.label + "|" + l.href) });
await page.locator("#quickview .quickview__links").screenshot({ path: path.join(SHOTS, `winlinks-${tag}.png`) });
await page.locator("#quickview .quickview__panel").screenshot({ path: path.join(SHOTS, `window-${tag}.png`) });
await page.evaluate(() => document.querySelector("#qv-close").click());
await page.waitForTimeout(250);
/* консоль и сеть: JS-ошибки и неожиданные 4xx — провал; 404 на ещё не присланные кадры ожидаемы (R5) */
const expected404 = badResp.filter((r) => /Work_files|src\/assets|\.webp|\.png|\.jpg/i.test(r));
const realBad = badResp.filter((r) => !expected404.includes(r));
w(`- консоль/сеть: JS-ошибок ${jsErrors.length}, неожиданных 4xx ${realBad.length}, ` +
`ожидаемых 404 на неприсланные кадры ${expected404.length}`);
jsErrors.forEach((e) => FAILS.push(`${tag}: console — ${e.slice(0, 160)}`));
realBad.forEach((e) => FAILS.push(`${tag}: сеть — ${e.slice(0, 160)}`));
w();
await ctx.close();
}
}
w("## 4. Карточка == окно (единственный источник состава — projectLinksHTML)");
w();
w("| точка | карточка | окно | совпадает |");
w("|---|---|---|---|");
for (const p of parity) {
const same = JSON.stringify(p.card) === JSON.stringify(p.window);
w(`| ${p.tag} | ${p.card.join(", ")} | ${p.window.join(", ")} | ${same ? "да" : "**НЕТ**"} |`);
if (!same) FAILS.push(`${p.tag}: состав карточки и окна разошёлся`);
}
w();
await browser.close();
w("## Итог");
w();
w("- Провалено проверок: " + FAILS.length);
FAILS.forEach((f) => w(" - FAIL: " + f));
w();
w("Скриншоты (превью обеих точек) в `" + SHOTS + "`: " +
fs.readdirSync(SHOTS).filter((f) => /\.png$/.test(f)).sort().join(", "));
fs.writeFileSync(path.join(__dirname, "verify-2026-10-14.md"), L.join("\n") + "\n", "utf8");
console.log("\nwritten:", path.join(__dirname, "verify-2026-10-14.md"));
process.exit(FAILS.length ? 1 : 0);
})();