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.
521 lines
38 KiB
JavaScript
521 lines
38 KiB
JavaScript
/* Живая проверка ссылок проекта в ОТГРУЖЕННОМ состоянии (design/spec.md §10.28, канбан t_a33fce2f).
|
||
*
|
||
* ⚠️ ОБНОВЛЕНО 2026-10-15 (волна `t_15835792`): заказчик убрал рамку и у штриховых глифов темы
|
||
* («убери окантовку зелёную и увеличь иконки до тех же размеров» — второй шаг, `src/` правил
|
||
* frontend-web-profile). Прежние ожидания п. 3 (рамка 2 px у глифа, чернила 15 px) больше не
|
||
* описывают прод, и прогон 2026-10-14 лежит как история в `verify-2026-10-14.md`. Этот скрипт
|
||
* теперь пишет `verify-2026-10-15.md` и снимки в `shots-2026-10-15/`.
|
||
*
|
||
* Проверяется замером живого DOM, а не описанием:
|
||
* 1. СЛОТ И ЧЕРНИЛА: кнопка-ссылка 48×48 в карточке И в окне; знак заполняет слот
|
||
* (`svg.btn__icon` = 48×48, `width:100%`), чернила = 24×24 px = 12 ед. viewBox (50 % слота)
|
||
* — у ВСЕХ ЧЕТЫРЁХ знаков: и у официальных знаков площадок, и у штриховых глифов темы.
|
||
* 2. РАМКИ НЕТ НИ У КОГО, КРОМЕ CTA: у любой ссылки-иконки `border 0px none` и
|
||
* `background rgba(0,0,0,0)`; hover — только `box-shadow` (без заливки `--ghost-hover`).
|
||
* Рамку и заливку несёт только `.btn--primary` (первая ссылка без официального знака) —
|
||
* она проверяется отдельно, чтобы «CTA не тронули» было замером, а не обещанием.
|
||
* 3. ШТРИХОВЫЕ ГЛИФЫ ТЕМЫ (сайт/видео): тот же слот 48×48, тот же знак 24×24 (`L = 12` ед.) и
|
||
* та же рамка «нет», что у знаков площадок. Камеры на живой странице нет: во всех
|
||
* `content/projects/*.md` поле `video:` пустое, поэтому узел камеры не отрисовывается.
|
||
* 4. ОХРАННОЕ ПОЛЕ RuStore (брендбук с. 5: ≥ половины высоты знака): (48−24)/2 = 12 px ≥ 12.
|
||
* 5. ГЕОМЕТРИЯ: официальные пути VK/RuStore лежат в `src/js/main.js` дословно (знак не обрезан,
|
||
* цвета родные) -- сверка с файлами медиакита в `design/brand-marks-2026-10-14/assets/`.
|
||
* 6. a11y: icon-only (текста нет), имя в `aria-label` + `title`, знак `aria-hidden`/`focusable=false`,
|
||
* hit-area ≥ 48×48, фокус-кольцо 2 px `--brand-deep` offset 2, контраст знака к подложке ≥ 3:1
|
||
* (SC 1.4.11), белого символа к синему квадрату ≥ 3:1.
|
||
* 7. РЯД: карточка (2 ссылки) влезает в колонку фактов одной строкой на 1440 и 390 -- замер ширины
|
||
* ряда и высоты (переноса нет).
|
||
* 8. ГИГИЕНА: ноль новых сетевых запросов против копии `git show HEAD:src/*`, ноль JS-ошибок,
|
||
* знаки инлайновые (нет img/use/image).
|
||
* Матрица: 1440/390 × светлая/тёмная.
|
||
*
|
||
* Запуск: node design/link-slot-2026-10-14/verify-link-slot.cjs (dev-server 127.0.0.1:8765)
|
||
* Exit 0 = все проверки прошли. Протокол — verify-2026-10-15.md, снимки — shots-2026-10-15/.
|
||
*/
|
||
const fs = require('fs');
|
||
const path = require('path');
|
||
const { execSync } = require('child_process');
|
||
const { launch } = require('./pw.cjs');
|
||
|
||
const BASE = process.env.PAGE_URL || 'http://127.0.0.1:8765';
|
||
const ROOT = path.resolve(__dirname, '..', '..');
|
||
const SHOTS = path.join(__dirname, 'shots-2026-10-15');
|
||
fs.mkdirSync(SHOTS, { recursive: true });
|
||
const REPORT = path.join(__dirname, 'verify-2026-10-15.md');
|
||
const MARKS = path.join(ROOT, 'design', 'brand-marks-2026-10-14');
|
||
|
||
const FAILS = [], WARNS = [], L = [];
|
||
const w = (s = '') => { L.push(s); console.log(s); };
|
||
|
||
/* ---------- эталоны отгруженного состояния ---------- */
|
||
const SLOT = 48; // кнопка-ссылка в обеих точках
|
||
const ICON_BOX = 48; // знак заполняет слот (width:100%) -- и площадка, и глиф темы
|
||
const INK_PX = 24; // чернила знака = 12 ед. viewBox (50 % слота) -- у всех четырёх
|
||
const L_UNITS = 12; // одна константа на все четыре знака
|
||
const FRAME_W = 0; // рамки у ссылок-иконок нет (её несут только .btn--primary)
|
||
const CTA_BORDER = 2; // базовая рамка .btn (2 px; цвет прозрачный -- заливка CTA сквозь неё)
|
||
const AA = 0.15; // допуск анти-алиасинга растеризации (чернила VK дают +0.08 px)
|
||
|
||
const mainSrc = fs.readFileSync(path.join(ROOT, 'src', 'js', 'main.js'), 'utf8');
|
||
const cssSrc = fs.readFileSync(path.join(ROOT, 'src', 'index.html'), 'utf8');
|
||
function officialPaths(rel) {
|
||
const s = fs.readFileSync(path.join(MARKS, 'assets', rel), 'utf8');
|
||
return (s.match(/<path[^>]*>/g) || []).map((p) => ({
|
||
d: p.match(/ d="([^"]+)"/)[1], fill: p.match(/ fill="([^"]+)"/)[1]
|
||
}));
|
||
}
|
||
const OFFICIAL = { vk: officialPaths('vk/VK Logo.svg'), rustore: officialPaths('rustore/RuStore_Icon (2).svg') };
|
||
|
||
/* ---------- цвет ---------- */
|
||
const rgbOf = (s) => { const m = (s.match(/[\d.]+/g) || [0, 0, 0]).map(Number); return m.slice(0, 3); };
|
||
const alphaOf = (s) => { const m = (s.match(/[\d.]+/g) || []); return m.length > 3 ? Number(m[3]) : 1; };
|
||
const lum = (c) => c.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);
|
||
const cr = (a, b) => { const l1 = lum(a), l2 = lum(b); return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05); };
|
||
const over = (fg, alpha, bg) => fg.map((v, i) => v * alpha + bg[i] * (1 - alpha));
|
||
const BLUE = [0, 119, 255], WHITE = [255, 255, 255];
|
||
|
||
/* ---------- страничные замеры ---------- */
|
||
const LINKS = `function (sel) {
|
||
const out = [];
|
||
document.querySelectorAll(sel).forEach(function (a) {
|
||
const svg = a.querySelector('svg.btn__icon');
|
||
const r = a.getBoundingClientRect(), sr = svg.getBoundingClientRect();
|
||
const cs = getComputedStyle(a);
|
||
let bgEl = a, bg = 'rgba(0, 0, 0, 0)', bgChain = [];
|
||
while (bgEl && bgEl !== document.documentElement) {
|
||
const c = getComputedStyle(bgEl).backgroundColor;
|
||
bgChain.push({ el: bgEl.tagName + '.' + String(bgEl.className).split(' ')[0], bg: c });
|
||
if (bg === 'rgba(0, 0, 0, 0)' && c !== 'rgba(0, 0, 0, 0)') bg = c;
|
||
bgEl = bgEl.parentElement;
|
||
}
|
||
if (bg === 'rgba(0, 0, 0, 0)') bg = getComputedStyle(document.body).backgroundColor;
|
||
const g = svg.querySelector('g');
|
||
out.push({
|
||
href: a.getAttribute('href'), ariaLabel: a.getAttribute('aria-label'), title: a.getAttribute('title'),
|
||
cls: a.className, text: a.textContent.trim(),
|
||
w: +r.width.toFixed(2), h: +r.height.toFixed(2), slotW: +sr.width.toFixed(2), slotH: +sr.height.toFixed(2),
|
||
borderW: cs.borderTopWidth, borderStyle: cs.borderTopStyle, borderColor: cs.borderTopColor,
|
||
background: cs.backgroundColor, boxShadow: cs.boxShadow,
|
||
viewBox: svg.getAttribute('viewBox'), ariaHidden: svg.getAttribute('aria-hidden'), focusable: svg.getAttribute('focusable'),
|
||
transform: g ? g.getAttribute('transform') : null,
|
||
paths: Array.from(svg.querySelectorAll('path')).map(function (p) { return { d: p.getAttribute('d'), fill: p.getAttribute('fill') }; }),
|
||
hasImg: a.querySelectorAll('img, use, image').length,
|
||
bg: bg, bgChain: bgChain, color: cs.color,
|
||
outlineW: cs.outlineWidth, outlineStyle: cs.outlineStyle, outlineOffset: cs.outlineOffset
|
||
});
|
||
});
|
||
return out;
|
||
}`;
|
||
|
||
const INK = `async function (o) {
|
||
const { sel, S } = o;
|
||
const svg = document.querySelector(sel).cloneNode(true);
|
||
svg.setAttribute('style', 'display:block;width:' + S + 'px;height:' + S + 'px');
|
||
const url = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(svg))));
|
||
const SCALE = 24, px = Math.round(S * SCALE);
|
||
const img = new Image();
|
||
await new Promise(function (res, rej) { img.onload = res; img.onerror = rej; img.src = url; });
|
||
const c = document.createElement('canvas'); c.width = c.height = px;
|
||
const ctx = c.getContext('2d'); ctx.drawImage(img, 0, 0, px, px);
|
||
const d = ctx.getImageData(0, 0, px, px).data;
|
||
let sum = 0, minX = 1e9, minY = 1e9, maxX = -1, maxY = -1;
|
||
for (let y = 0; y < px; y++) for (let x = 0; x < px; x++) {
|
||
const i = (y * px + x) * 4, al = d[i + 3];
|
||
if (al === 0) continue;
|
||
sum += al / 255;
|
||
if (x < minX) minX = x; if (x > maxX) maxX = x;
|
||
if (y < minY) minY = y; if (y > maxY) maxY = y;
|
||
}
|
||
/* canvas = S*24 px на квадрат S px: 1 px слота = 24 canvas px. u переводит canvas px в px слота,
|
||
k = S/24 -- сколько px слота в одной единице viewBox. Масса печатается в ед² (как в
|
||
design/brand-marks-2026-10-14/official-marks.json): px² / k². */
|
||
const u = 1 / SCALE, k = S / SCALE;
|
||
return { mass: +(sum * u * u / (k * k)).toFixed(2), massPx: +(sum * u * u).toFixed(2),
|
||
inkW: +((maxX - minX + 1) * u).toFixed(2), inkh: +((maxY - minY + 1) * u).toFixed(2),
|
||
air: { l: +(minX * u).toFixed(2), t: +(minY * u).toFixed(2) } };
|
||
}`;
|
||
|
||
/* ---------- сетевой дифф против отгруженной копии ---------- */
|
||
function ensureBaseline() {
|
||
const dir = path.join(ROOT, 'src-baseline-linkslot');
|
||
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) => fs.writeFileSync(out, execSync('git show ' + spec, { cwd: ROOT, encoding: 'buffer' }));
|
||
git('HEAD:src/index.html', path.join(dir, 'index.html'));
|
||
for (const f of ['main.js', '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;
|
||
}
|
||
async function requests(url) {
|
||
const b = await launch();
|
||
const p = await (await b.newContext({ viewport: { width: 1440, height: 900 } })).newPage();
|
||
const reqs = [];
|
||
p.on('request', (r) => reqs.push(r.url().replace(/^https?:\/\/[^/]+/, '')));
|
||
p.setDefaultNavigationTimeout(60000);
|
||
await p.goto(url, { waitUntil: 'domcontentloaded' });
|
||
await p.waitForTimeout(1200);
|
||
await b.close();
|
||
return Array.from(new Set(reqs));
|
||
}
|
||
|
||
const EXPECT_LINKS = { bukvika: ['rustore', 'vk'], associations: ['vk'], 'first-step-radio': ['site', 'rustore'] };
|
||
const isBrand = (k) => k === 'rustore' || k === 'vk';
|
||
|
||
(async () => {
|
||
w('# Проверка: ссылки проектов — рамки нет ни у кого, кроме CTA; слот 48, чернила 24 (§10.28)');
|
||
w();
|
||
w('Проект: `G:\\Project\\Haevey_Monster_Team_Page` · канбан `t_15835792` · 2026-10-15');
|
||
w('Предыдущий прогон этой же проверки (волна `t_a33fce2f`, рамка у глифа 2 px, чернила 15 px) — `verify-2026-10-14.md`.');
|
||
w('Живая страница `' + BASE + '/src/` · Playwright/Chromium (Chrome 148), замер живого DOM (raster).');
|
||
w();
|
||
|
||
/* ---------- 1. Исходник: правила слота и официальная геометрия ---------- */
|
||
w('## 1. Исходник: слот, рамка, официальная геометрия');
|
||
w();
|
||
const rules = [
|
||
['`.btn--mark{border:0;background:none;padding:0}`', /\.btn--mark\{border:0;background:none;padding:0\}/],
|
||
['`.btn--mark:hover{…box-shadow:var(--shadow-btn)}`', /\.btn--mark:hover\{background:none;border:0;box-shadow:var\(--shadow-btn\)\}/],
|
||
['`.btn--mark .btn__icon{width:100%;height:100%}`', /\.btn--mark \.btn__icon\{width:100%;height:100%\}/],
|
||
['`.btn__icon{…width:24px;height:24px}` (базовый бокс знака; у ссылок-иконок его перебивает `.btn--mark .btn__icon` = 48, у CTA он и остаётся)', /\.btn__icon\{display:block;flex:none;width:24px;height:24px\}/],
|
||
['`.case-card__link{width:48px;min-height:48px;padding:0}`', /\.case-card__link\{width:48px;min-height:48px;padding:0;/],
|
||
['`.quickview__links .btn{width:48px;min-height:48px;padding:0}`', /\.quickview__links \.btn\{width:48px;min-height:48px;padding:0;/]
|
||
];
|
||
w('| Правило в `src/index.html` | Найдено |');
|
||
w('|---|---|');
|
||
for (const [label, re] of rules) {
|
||
const ok = re.test(cssSrc);
|
||
w('| ' + label + ' | ' + (ok ? 'да' : '**НЕТ**') + ' |');
|
||
if (!ok) FAILS.push('в index.html нет правила: ' + label);
|
||
}
|
||
w();
|
||
w('| Знак | Файл медиакита | Пути | Цвета | Пути дословно в `main.js` |');
|
||
w('|---|---|---|---|---|');
|
||
for (const k of ['vk', 'rustore']) {
|
||
const allIn = OFFICIAL[k].every((p) => mainSrc.includes(p.d));
|
||
w('| `LINK_ICONS.' + k + '` | `' + (k === 'vk' ? 'VK Logo.svg' : 'RuStore_Icon (2).svg') + '` | ' + OFFICIAL[k].length + ' | ' +
|
||
OFFICIAL[k].map((p) => p.fill).join(' + ') + ' | ' + (allIn ? 'да' : '**НЕТ**') + ' |');
|
||
if (!allIn) FAILS.push(k + ': официальные пути не найдены в main.js дословно');
|
||
}
|
||
const scales = {};
|
||
for (const k of ['vk', 'rustore']) {
|
||
const m = mainSrc.match(new RegExp('\\b' + k + ':\\s*\'<svg[\\s\\S]*?translate\\(([-\\d.]+) ([-\\d.]+)\\) scale\\(([-\\d.]+)\\)'));
|
||
if (!m) FAILS.push(k + ': не найдена группа translate/scale в LINK_ICONS');
|
||
scales[k] = m ? { tx: +m[1], ty: +m[2], s: +m[3] } : null;
|
||
}
|
||
w();
|
||
w('- группы вписывания: `rustore` ' + JSON.stringify(scales.rustore) + ' · `vk` ' + JSON.stringify(scales.vk));
|
||
w('- одна константа L = ' + L_UNITS + ' ед. (50 % слота) на оба бренда — подтверждается замером чернил ниже.');
|
||
w();
|
||
|
||
/* ---------- 2. Сеть ---------- */
|
||
w('## 2. Сетевые запросы (знаки инлайновые, CDN нет)');
|
||
w();
|
||
const baseDir = ensureBaseline();
|
||
const nowReq = await requests(BASE + '/src/');
|
||
const baseReq = await requests(BASE + '/src-baseline-linkslot/');
|
||
if (process.env.KEEP_BASELINE !== '1') fs.rmSync(baseDir, { recursive: true, force: true });
|
||
const nowU = nowReq.map((u) => u.replace(/^\/src(?=\/)/, ''));
|
||
const baseU = baseReq.map((u) => u.replace(/^\/src-baseline-linkslot(?=\/)/, ''));
|
||
const added = nowU.filter((u) => !baseU.includes(u));
|
||
const iconish = nowReq.filter((u) => /\.svg(\?|$)/i.test(u) || /icon|awesome|lucide|feather|icomoon/i.test(u));
|
||
w('| Что | Значение |');
|
||
w('|---|---|');
|
||
w('| запросов (отгружено) | ' + nowReq.length + ' |');
|
||
w('| запросов (копия `git show HEAD:src/*`) | ' + baseReq.length + ' |');
|
||
w('| добавлено правкой | ' + (added.length ? '**' + added.join(', ') + '**' : 'нет') + ' |');
|
||
w('| иконочных запросов | ' + (iconish.length ? '**' + iconish.join(', ') + '**' : 'нет — знаки инлайновые') + ' |');
|
||
w();
|
||
if (added.length) FAILS.push('новые сетевые запросы: ' + added.slice(0, 5).join(', '));
|
||
if (iconish.length) FAILS.push('иконочный сетевой запрос: ' + iconish.join(', '));
|
||
|
||
/* ---------- 3. Живой DOM: обе темы × две точки × 1440/390 ---------- */
|
||
const browser = await launch();
|
||
w('## 3. Живой DOM: слот, чернила, рамка, контраст, a11y');
|
||
w();
|
||
const glyphRow = [];
|
||
|
||
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 }, deviceScaleFactor: 4 });
|
||
const page = await ctx.newPage();
|
||
const errs = [];
|
||
page.on('pageerror', (e) => errs.push(String(e)));
|
||
page.on('console', (m) => { if (m.type() === 'error' && !/Failed to load resource/i.test(m.text())) errs.push(m.text()); });
|
||
page.setDefaultNavigationTimeout(60000);
|
||
await page.goto(BASE + '/src/', { waitUntil: 'domcontentloaded' });
|
||
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 + ': тема не переключилась');
|
||
await page.addStyleTag({ content: '.reveal{opacity:1!important;translate:none!important;transition:none!important} *{transition:none!important;animation:none!important}' });
|
||
await page.evaluate(() => document.querySelectorAll('.reveal').forEach((e) => e.classList.add('is-visible')));
|
||
await page.waitForTimeout(150);
|
||
|
||
const tag = vp.w + 'px · ' + theme;
|
||
w('### ' + tag);
|
||
w();
|
||
w('| Точка | Ссылка | Кнопка | Слот `.btn__icon` | Рамка | Подложка | Чернила (px) | L (ед.) | Масса, ед² | Контраст знака | Охранное поле |');
|
||
w('|---|---|---|---|---|---|---|---|---|---|---|');
|
||
|
||
for (const [slug, kinds] of Object.entries(EXPECT_LINKS)) {
|
||
const sel = '.case-card[data-slug="' + slug + '"] .case-card__links a';
|
||
await page.locator('.case-card[data-slug="' + slug + '"]').scrollIntoViewIfNeeded();
|
||
await page.waitForTimeout(200);
|
||
const links = await page.evaluate('(' + LINKS + ')(' + JSON.stringify(sel) + ')');
|
||
if (links.length !== kinds.length) { FAILS.push(tag + '/' + slug + ': ссылок ' + links.length + ', ожидалось ' + kinds.length); continue; }
|
||
for (let i = 0; i < links.length; i++) {
|
||
const l = links[i], kind = kinds[i], p = tag + '/карточка:' + slug + '[' + i + ']';
|
||
const brand = isBrand(kind);
|
||
const isCta = /btn--primary/.test(l.cls);
|
||
const box = Math.round(l.slotW); // растр — по ФАКТИЧЕСКОМУ боксу знака
|
||
if (l.text !== '') FAILS.push(p + ': в ссылке текст «' + l.text + '» — должен быть только знак');
|
||
if (!l.ariaLabel || !l.title) FAILS.push(p + ': нет aria-label/title у icon-only ссылки');
|
||
if (l.viewBox !== '0 0 24 24') FAILS.push(p + ': viewBox ' + l.viewBox + ' ≠ «0 0 24 24»');
|
||
if (l.ariaHidden !== 'true' || l.focusable !== 'false') FAILS.push(p + ': знак не aria-hidden/focusable=false');
|
||
if (l.hasImg) FAILS.push(p + ': знак не инлайновый (img/use/image)');
|
||
if (!/translate\(/.test(l.transform || '') || !/scale\(/.test(l.transform || '')) FAILS.push(p + ': знак не вписан группой translate/scale');
|
||
if (Math.abs(l.w - SLOT) > 1) FAILS.push(p + ': кнопка ' + l.w + '×' + l.h + ', ожидался квадрат ' + SLOT);
|
||
if (Math.abs(l.h - SLOT) > 1) FAILS.push(p + ': высота кнопки ' + l.h + ', ожидалась ' + SLOT);
|
||
if (l.w < 24 || l.h < 24) FAILS.push(p + ': hit-area ' + l.w + '×' + l.h + ' < 24×24');
|
||
if (!isCta && Math.abs(l.slotW - ICON_BOX) > 0.5) {
|
||
FAILS.push(p + ': слот знака ' + l.slotW + '×' + l.slotH + ', ожидался ' + ICON_BOX + '×' + ICON_BOX);
|
||
}
|
||
if (isCta) {
|
||
/* CTA правкой глифов не трогали: его анатомия — предмет отдельного решения */
|
||
if (parseFloat(l.borderW) !== CTA_BORDER || l.borderStyle !== 'solid') FAILS.push(p + ': у зелёного CTA пропала базовая рамка (' + l.borderW + ' ' + l.borderStyle + ')');
|
||
if (alphaOf(l.background) === 0) FAILS.push(p + ': у зелёного CTA нет заливки');
|
||
} else {
|
||
/* Рамки нет ни у знака площадки, ни у штрихового глифа темы (t_15835792, 2026-10-15):
|
||
у ссылки-иконки её не несёт никто, кроме зелёного CTA. */
|
||
if (parseFloat(l.borderW) !== FRAME_W || l.borderStyle !== 'none') FAILS.push(p + ': рамка не снята (' + l.borderW + ' ' + l.borderStyle + ')');
|
||
if (alphaOf(l.background) !== 0) FAILS.push(p + ': подложка не прозрачна (' + l.background + ')');
|
||
}
|
||
|
||
const ink = await page.evaluate('(async function(o){return (' + INK + ')(o);})(' + JSON.stringify({ sel: sel + ':nth-child(' + (i + 1) + ') svg.btn__icon', S: box }) + ')');
|
||
const bg = rgbOf(l.bg);
|
||
const markC = brand ? cr(BLUE, bg) : cr(rgbOf(l.color), bg);
|
||
const innerC = brand ? cr(WHITE, BLUE) : null;
|
||
const inkPx = ink.inkW, units = +(inkPx / (box / 24)).toFixed(2);
|
||
const free = (SLOT - inkPx) / 2, clearOk = free >= inkPx / 2 - AA;
|
||
w('| карточка | `' + kind + '`' + (isCta ? ' **primary**' : '') + ' | ' + l.w + '×' + l.h + ' | ' + l.slotW + '×' + l.slotH + ' | ' +
|
||
(isCta ? l.borderW + ' ' + l.borderStyle : (parseFloat(l.borderW) === 0 ? 'нет' : l.borderW + ' ' + l.borderStyle)) + ' | ' +
|
||
(alphaOf(l.background) === 0 ? 'прозрачна' : l.background) + ' | ' +
|
||
ink.inkW + '×' + ink.inkh + ' | ' + units + ' | ' + ink.mass.toFixed(1) + ' | ' + markC.toFixed(2) + ':1' +
|
||
(markC >= 3 ? '' : ' **<3**') + ' | ' +
|
||
(brand ? free.toFixed(2) + ' px ≥ ' + (inkPx / 2).toFixed(2) + (clearOk ? ' ✓' : ' **✗**') : '— (не бренд)') + ' |');
|
||
|
||
if (isCta) { if (Math.abs(inkPx - INK_PX) > 0.6) WARNS.push(p + ': знак CTA ' + inkPx + ' px против ' + INK_PX + ' px у ссылок-иконок (' + (INK_PX / inkPx).toFixed(2) + '× мельче, слот ' + l.slotW + ')'); }
|
||
else {
|
||
if (Math.abs(inkPx - INK_PX) > 0.6 || Math.abs(ink.inkh - INK_PX) > 0.6) {
|
||
FAILS.push(p + ': чернила ' + ink.inkW + '×' + ink.inkh + ' px, ожидались ' + INK_PX + '×' + INK_PX);
|
||
}
|
||
if (Math.abs(units - L_UNITS) > 0.05) FAILS.push(p + ': L = ' + units + ' ед., ожидалось ' + L_UNITS);
|
||
}
|
||
if (markC < 3) FAILS.push(p + ': контраст знака к подложке ' + markC.toFixed(2) + ':1 < 3:1');
|
||
if (brand) {
|
||
if (innerC < 3) FAILS.push(p + ': контраст белого символа к синему квадрату ' + innerC.toFixed(2) + ':1 < 3:1');
|
||
if (!clearOk) FAILS.push(p + ': охранное поле RuStore нарушено (' + free.toFixed(2) + ' < ' + (inkPx / 2).toFixed(2) + ')');
|
||
OFFICIAL[kind].forEach((op) => {
|
||
if (!l.paths.some((pp) => pp.d === op.d)) FAILS.push(p + ': в DOM нет официального пути ' + kind);
|
||
if (!l.paths.some((pp) => pp.fill === op.fill)) FAILS.push(p + ': в DOM нет официального цвета ' + op.fill + ' (' + kind + ')');
|
||
});
|
||
} else if (!isCta) {
|
||
glyphRow.push({ tag, kind, box, inkW: ink.inkW, inkh: ink.inkh, borderW: l.borderW });
|
||
}
|
||
}
|
||
}
|
||
w();
|
||
|
||
/* окно проекта: Буквика (RuStore+VK) и First Step Radio (сайт+RuStore) */
|
||
for (const slug of ['first-step-radio', 'bukvika']) {
|
||
await page.evaluate((sl) => {
|
||
document.querySelector('.case-card[data-slug="' + sl + '"] .case-card__more').click();
|
||
}, slug);
|
||
await page.waitForTimeout(420);
|
||
const win = await page.evaluate('(' + LINKS + ')("#quickview .quickview__links a")');
|
||
for (let i = 0; i < win.length; i++) {
|
||
const l = win[i], p = tag + '/окно:' + slug + '[' + i + ']';
|
||
const kind = /rustore/i.test(l.href) ? 'rustore' : (/vk\./i.test(l.href) ? 'vk' : 'site');
|
||
const brand = isBrand(kind);
|
||
const isCta = /btn--primary/.test(l.cls);
|
||
const box = Math.round(l.slotW); // растр — по ФАКТИЧЕСКОМУ боксу знака
|
||
if (Math.abs(l.w - SLOT) > 1) FAILS.push(p + ': кнопка ' + l.w + '×' + l.h + ', ожидался квадрат ' + SLOT);
|
||
if (!isCta && Math.abs(l.slotW - ICON_BOX) > 0.5) FAILS.push(p + ': слот знака ' + l.slotW + ', ожидался ' + ICON_BOX);
|
||
if (l.w < 24 || l.h < 24) FAILS.push(p + ': hit-area ' + l.w + '×' + l.h);
|
||
if (isCta) {
|
||
/* CTA правкой глифов не трогали: рамка и заливка обязаны быть на месте */
|
||
if (parseFloat(l.borderW) !== CTA_BORDER || l.borderStyle !== 'solid') FAILS.push(p + ': у зелёного CTA пропала базовая рамка (' + l.borderW + ' ' + l.borderStyle + ')');
|
||
if (alphaOf(l.background) === 0) FAILS.push(p + ': у зелёного CTA нет заливки');
|
||
w('- зелёный CTA (`' + kind + '`, окно): рамка `' + l.borderW + ' ' + l.borderStyle + ' ' + l.borderColor + '`, заливка `' + l.background + '` — рамка и заливка на месте');
|
||
} else {
|
||
if (parseFloat(l.borderW) !== FRAME_W || l.borderStyle !== 'none') FAILS.push(p + ': рамка не снята в окне (' + l.borderW + ' ' + l.borderStyle + ')');
|
||
if (alphaOf(l.background) !== 0) FAILS.push(p + ': подложка не прозрачна в окне (' + l.background + ')');
|
||
}
|
||
const ink = await page.evaluate('(async function(o){return (' + INK + ')(o);})(' + JSON.stringify({ sel: '#quickview .quickview__links a:nth-child(' + (i + 1) + ') svg.btn__icon', S: box }) + ')');
|
||
const bg = rgbOf(l.bg);
|
||
const markC = brand ? cr(BLUE, bg) : cr(rgbOf(l.color), bg);
|
||
const inkPx = ink.inkW, units = +(inkPx / (box / 24)).toFixed(2);
|
||
const free = (SLOT - inkPx) / 2;
|
||
w('| окно | `' + kind + '`' + (isCta ? ' **primary**' : '') + ' | ' + l.w + '×' + l.h + ' | ' +
|
||
l.slotW + '×' + l.slotH + ' | ' + (isCta ? l.borderW + ' ' + l.borderStyle : (parseFloat(l.borderW) === 0 ? 'нет' : l.borderW)) + ' | ' +
|
||
(alphaOf(l.background) === 0 ? 'прозрачна' : l.background) + ' | ' +
|
||
ink.inkW + '×' + ink.inkh + ' | ' + units + ' | ' + ink.mass.toFixed(1) + ' | ' + markC.toFixed(2) + ':1 | ' + free.toFixed(2) + ' px |');
|
||
if (isCta) { if (Math.abs(inkPx - INK_PX) > 0.6) WARNS.push(p + ': знак CTA ' + inkPx + ' px против ' + INK_PX + ' px у ссылок-иконок (' + (INK_PX / inkPx).toFixed(2) + '× мельче, слот ' + l.slotW + ')'); }
|
||
else {
|
||
if (Math.abs(inkPx - INK_PX) > 0.6) FAILS.push(p + ': чернила ' + inkPx + ' px, ожидались ' + INK_PX);
|
||
if (Math.abs(units - L_UNITS) > 0.05) FAILS.push(p + ': L = ' + units + ' ед., ожидалось ' + L_UNITS);
|
||
}
|
||
if (markC < 3) FAILS.push(p + ': контраст знака к подложке ' + markC.toFixed(2) + ':1 < 3:1');
|
||
if (brand && free < inkPx / 2 - AA) FAILS.push(p + ': охранное поле RuStore нарушено в окне');
|
||
}
|
||
await page.evaluate(() => document.querySelector('#qv-close').click());
|
||
await page.waitForTimeout(220);
|
||
}
|
||
w();
|
||
|
||
/* hover: заливки нет, только тень -- обе точки */
|
||
for (const [point, sel] of [['карточка', '.case-card[data-slug="bukvika"] .case-card__links a'],
|
||
['окно', null]]) {
|
||
if (!sel) continue;
|
||
await page.hover(sel);
|
||
await page.waitForTimeout(260);
|
||
const hov = (await page.evaluate('(' + LINKS + ')(' + JSON.stringify(sel) + ')'))[0];
|
||
const flat = over(rgbOf(hov.background), alphaOf(hov.background), rgbOf(hov.bg));
|
||
const hc = cr(BLUE, flat);
|
||
w('- `' + point + '`, hover на знаке площадки: подложка `' + hov.background + '` (заливки нет), `box-shadow: ' + hov.boxShadow +
|
||
'`, рамка `' + hov.borderW + ' ' + hov.borderStyle + '`, контраст знака к подложке ' + hc.toFixed(2) + ':1');
|
||
if (alphaOf(hov.background) !== 0) FAILS.push(tag + '/' + point + ': hover вернул заливку (' + hov.background + ')');
|
||
if (!hov.boxShadow || hov.boxShadow === 'none') FAILS.push(tag + '/' + point + ': hover без тени');
|
||
if (parseFloat(hov.borderW) !== 0) FAILS.push(tag + '/' + point + ': hover вернул рамку');
|
||
if (hc < 3) FAILS.push(tag + '/' + point + ': контраст знака на hover ' + hc.toFixed(2) + ':1 < 3:1');
|
||
}
|
||
w();
|
||
|
||
/* ряд: 2 ссылки в одну строку без переноса */
|
||
const rowFit = await page.evaluate(function (o) {
|
||
const sl = o.sl, SLOT_ = o.slot;
|
||
const wrap = document.querySelector('.case-card[data-slug="' + sl + '"] .case-card__links');
|
||
const col = wrap.parentElement;
|
||
const kids = Array.from(wrap.children);
|
||
const gaps = kids.length > 1 ? (kids.length - 1) * parseFloat(getComputedStyle(wrap).columnGap || 0) : 0;
|
||
const content = kids.reduce(function (s, k) { return s + k.getBoundingClientRect().width; }, 0) + gaps;
|
||
return { row: +content.toFixed(2), height: +wrap.getBoundingClientRect().height.toFixed(2),
|
||
col: +col.getBoundingClientRect().width.toFixed(2), lines: kids.length ? Math.round(wrap.getBoundingClientRect().height / SLOT_) : 0 };
|
||
}, { sl: 'first-step-radio', slot: SLOT });
|
||
w('- ряд ссылок First Step Radio (сайт + RuStore): содержимое ' + rowFit.row + ' px при колонке ' + rowFit.col +
|
||
' px, высота ряда ' + rowFit.height + ' px ' + (rowFit.height <= SLOT + 1 ? '(одна строка)' : '(ПЕРЕНОС)'));
|
||
if (rowFit.row > rowFit.col + 0.5) FAILS.push(tag + ': ряд ссылок шире колонки (' + rowFit.row + ' > ' + rowFit.col + ')');
|
||
if (rowFit.height > SLOT + 1) FAILS.push(tag + ': ряд ссылок переносится (' + rowFit.height + ' px)');
|
||
w();
|
||
|
||
/* полка знаков в одном кадре (синтетическая сборка ТОЛЬКО для снимка: узлы клонируются,
|
||
страница не меняется) + ряд из трёх ссылок — закрывает открытый вопрос R-b12 замера */
|
||
const shelfInfo = [];
|
||
if (vp.w === 1440) {
|
||
await page.evaluate(function () {
|
||
const buy = document.querySelector('.case-card[data-slug="bukvika"] .case-card__links');
|
||
const fsr = document.querySelector('.case-card[data-slug="first-step-radio"] .case-card__links');
|
||
const host = document.createElement('div');
|
||
host.id = 'link-shelf';
|
||
host.style.cssText = 'position:fixed;left:0;top:0;z-index:9999;display:flex;gap:6px;align-items:center;padding:12px;background:' +
|
||
getComputedStyle(document.querySelector('.case-card')).backgroundColor;
|
||
[buy.children[0], buy.children[1], fsr.children[0], fsr.children[1]].forEach(function (n) {
|
||
if (n) host.appendChild(n.cloneNode(true));
|
||
});
|
||
document.body.appendChild(host);
|
||
});
|
||
await page.locator('#link-shelf').screenshot({ path: path.join(SHOTS, 'shelf-' + vp.w + '-' + theme + '.png') });
|
||
shelfInfo.push('полка знаков (RuStore · VK · сайт) — shots/shelf-' + vp.w + '-' + theme + '.png');
|
||
await page.evaluate(function () { document.querySelector('#link-shelf').remove(); });
|
||
}
|
||
const three = await page.evaluate(function (o) {
|
||
const wrap = document.querySelector('.case-card[data-slug="' + o.sl + '"] .case-card__links');
|
||
const col = wrap.parentElement;
|
||
const clone = wrap.children[0].cloneNode(true);
|
||
wrap.appendChild(clone);
|
||
const kids = Array.from(wrap.children);
|
||
const gaps = (kids.length - 1) * parseFloat(getComputedStyle(wrap).columnGap || 0);
|
||
const content = kids.reduce(function (s, k) { return s + k.getBoundingClientRect().width; }, 0) + gaps;
|
||
const out = { row: +content.toFixed(2), height: +wrap.getBoundingClientRect().height.toFixed(2),
|
||
col: +col.getBoundingClientRect().width.toFixed(2), n: kids.length };
|
||
clone.remove();
|
||
return out;
|
||
}, { sl: 'first-step-radio' });
|
||
w('- ряд из ТРЁХ ссылок (синтетика, клон третьего узла для замера): ' + three.row + ' px при колонке ' +
|
||
three.col + ' px, высота ряда ' + three.height + ' px ' + (three.height <= SLOT + 1 ? '(одна строка)' : '(ПЕРЕНОС)'));
|
||
if (three.height > SLOT + 1 || three.row > three.col + 0.5) {
|
||
FAILS.push(tag + '/ряд из трёх: ' + three.row + ' px, высота ' + three.height + ' — не влезает в ' + three.col);
|
||
}
|
||
w();
|
||
|
||
/* фокус-кольцо: ставится после клавиатурного ввода (:focus-visible) */
|
||
await page.keyboard.press('Tab');
|
||
await page.waitForTimeout(80);
|
||
const foc = await page.evaluate(function (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, o: cs.outlineOffset, c: cs.outlineColor };
|
||
}, '.case-card[data-slug="bukvika"] .case-card__links a');
|
||
w('- :focus-visible на ссылке: ' + (foc && foc.fv ? 'да' : 'НЕТ') + ', кольцо ' + (foc ? foc.w + ' ' + foc.s + ' offset ' + foc.o + ' ' + foc.c : '—'));
|
||
if (!foc || !foc.fv || parseFloat(foc.w) < 2 || foc.s === 'none') FAILS.push(tag + ': нет видимого фокус-кольца');
|
||
w();
|
||
|
||
await page.locator('.case-card[data-slug="bukvika"] .case-card__links').screenshot({ path: path.join(SHOTS, 'card-links-' + vp.w + '-' + theme + '.png') });
|
||
await page.locator('.case-card[data-slug="first-step-radio"] .case-card__links').screenshot({ path: path.join(SHOTS, 'card-glyph-' + vp.w + '-' + theme + '.png') });
|
||
errs.forEach((e) => FAILS.push(tag + ': console — ' + e.slice(0, 160)));
|
||
w('- JS-ошибок: ' + errs.length);
|
||
w();
|
||
await ctx.close();
|
||
}
|
||
}
|
||
await browser.close();
|
||
|
||
/* ---------- 4. Полка: бренд против штрихового глифа ---------- */
|
||
w('## 4. Полка: все четыре знака — один слот, одна мера, рамки нет (замер, не вывод)');
|
||
w();
|
||
w('| Точка | Знак | Слот знака | Чернила, px | Чернила / чернила площадки | Рамка |');
|
||
w('|---|---|---|---|---|---|');
|
||
for (const g of glyphRow) {
|
||
const ratio = g.inkW / INK_PX;
|
||
w('| ' + g.tag + ' | `' + g.kind + '` (штриховой) | ' + g.box + '×' + g.box + ' | ' + g.inkW + '×' + g.inkh + ' | ' +
|
||
ratio.toFixed(2) + '× | ' + (parseFloat(g.borderW) === 0 ? 'нет' : g.borderW + ' solid') + ' |');
|
||
if (Math.abs(ratio - 1) > 0.05) FAILS.push('полка/' + g.tag + '/' + g.kind + ': чернила ' + g.inkW + ' px против ' + INK_PX + ' px у знака площадки (' + ratio.toFixed(2) + '×)');
|
||
if (parseFloat(g.borderW) !== FRAME_W) FAILS.push('полка/' + g.tag + '/' + g.kind + ': у глифа осталась рамка ' + g.borderW);
|
||
}
|
||
w('| — | знак площадки (RuStore/VK) | ' + ICON_BOX + '×' + ICON_BOX + ' | ' + INK_PX + '×' + INK_PX + ' | 1.00× | нет |');
|
||
w();
|
||
w('Знак заполняет слот целиком (`width:100%` → бокс 48×48), чернила всех четырёх знаков — 24 px (12 ед.,');
|
||
w('50 % слота): штриховые глифы темы больше не мельче знаков площадок и не предъявляются рамкой.');
|
||
w('Асимметрия полки 1.59× (глобус 15.08 px против 24 px), зафиксированная волной `t_a33fce2f`, закрыта');
|
||
w('правкой заказчика 2026-10-14/15 — открытый вопрос R-b13 в `design/spec.md` §10.28 снят.');
|
||
w();
|
||
|
||
w('## 5. Итог');
|
||
w();
|
||
w('- Провалено проверок: **' + FAILS.length + '**');
|
||
FAILS.forEach((f) => w(' - FAIL: ' + f));
|
||
w();
|
||
const uniq = Array.from(new Set(WARNS));
|
||
w('- Замечаний (не провал, записано фактом): **' + uniq.length + '**');
|
||
uniq.forEach((f) => w(' - WARN: ' + f));
|
||
if (uniq.length) {
|
||
w();
|
||
w('Замечание про CTA — не дефект этой волны: заказчик просил «убрать зелёную окантовку и увеличить');
|
||
w('иконки до одного размера», правка увеличила знаки ссылок-иконок (24 px). Знак зелёного CTA');
|
||
w('остался в прежнем боксе `.btn__icon` 24 px (чернила 12 px) — вдвое мельче; CTA в границы правки');
|
||
w('не входил (решение за заказчиком, один селектор `.btn--primary .btn__icon`).');
|
||
}
|
||
w();
|
||
fs.writeFileSync(REPORT, L.join('\n') + '\n', 'utf8');
|
||
console.log('\nпротокол:', path.relative(ROOT, REPORT));
|
||
process.exit(FAILS.length ? 1 : 0);
|
||
})();
|