Files
Harvey_Team_Page/design/glyph-slot-2026-10-14/probe-compact-fit.cjs
T
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

130 lines
6.0 KiB
JavaScript
Raw 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.
/*
* Подбор компактного кегля/отступов кнопок-ссылок (§10.28 п.2, kanban t_d3adf730).
*
* Мерит ШИРИНЫ КНОПОК реальным шрифтом страницы (Montserrat 700 + uppercase + letter-spacing)
* для набора кандидатов и считает, что влезает в ЗАМЕРЕННЫЕ контейнеры
* (карточка 262.97 px на 1440 и 270 px на 390; окно 494.3 и 324 — containers.json).
* Ничего в проект не пишет.
*
* Запуск: node design/glyph-slot-2026-10-14/probe-compact-fit.cjs
*/
const fs = require('fs');
const path = require('path');
const { launch } = require('./pw.cjs');
const CONTAINERS = JSON.parse(fs.readFileSync(path.join(__dirname, 'containers.json'), 'utf8'));
const BOX = {
card: { 1440: 262.97, 390: 270 },
win: { 1440: 494.3, 390: 324 }
};
const LABELS = ['В RUSTORE', 'ИГРАТЬ', 'САЙТ ПРОЕКТА', 'ВИДЕО'];
const CARD = {
C0: { fs: 12, ls: 1, pad: '8px 14px', gap: 8, icon: 16 }, // отгружено
C3: { fs: 11, ls: .5, pad: '8px 10px', gap: 6, icon: 16 },
C5: { fs: 11, ls: .5, pad: '8px 8px', gap: 6, icon: 16 }, // кандидат
C6: { fs: 11, ls: 0, pad: '8px 10px', gap: 6, icon: 16 },
C7: { fs: 12, ls: 0, pad: '8px 8px', gap: 6, icon: 16 }
};
const WIN = {
W0: { fs: 14, ls: 1, pad: '12px 26px', gap: 12, icon: 18 }, // отгружено
W1: { fs: 13, ls: .5, pad: '12px 20px', gap: 8, icon: 18 },
W3: { fs: 12, ls: .5, pad: '12px 16px', gap: 8, icon: 18 }, // кандидат
W4: { fs: 13, ls: .5, pad: '12px 18px', gap: 8, icon: 18 }
};
const html = (set, cls, minH, icon) => '<!doctype html><meta charset="utf-8">' +
'<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&display=swap" rel="stylesheet">' +
'<style>body{margin:0;font-family:Montserrat,sans-serif}' +
'.btn{display:inline-flex;align-items:center;justify-content:center;border:2px solid transparent;border-radius:12px;' +
'font-family:Montserrat,sans-serif;font-weight:700;line-height:1;text-transform:uppercase;white-space:nowrap}' +
'.ic{display:block;flex:none;width:' + icon + 'px;height:' + icon + 'px;background:#000;border-radius:2px}' +
'</style><body>' + Object.entries(set).map(([k, v]) =>
'<div class="' + k + '">' + LABELS.map(l => '<a class="btn" style="min-height:' + minH + 'px;padding:' + v.pad +
';font-size:' + v.fs + 'px;letter-spacing:' + v.ls + 'px;gap:' + v.gap + 'px"><span class="ic"></span>' + l + '</a>').join('') +
'</div>').join('') + '</body>';
(async () => {
const browser = await launch();
const measure = async (blockFonts) => {
const ctx = await browser.newContext({ viewport: { width: 1400, height: 400 } });
if (blockFonts) await ctx.route('**fonts.googleapis.com**', (r) => r.abort());
const p = await ctx.newPage();
await p.setContent(html(CARD, 'c', 36, 16), { waitUntil: 'networkidle' });
await p.waitForTimeout(300);
const card = await p.evaluate(() => {
const res = {};
document.querySelectorAll('body > div').forEach(d => {
res[d.className] = Array.from(d.querySelectorAll('a')).map(a => +a.getBoundingClientRect().width.toFixed(2));
});
return res;
});
await p.setContent(html(WIN, 'w', 48, 18), { waitUntil: 'networkidle' });
await p.waitForTimeout(300);
const win = await p.evaluate(() => {
const res = {};
document.querySelectorAll('body > div').forEach(d => {
res[d.className] = Array.from(d.querySelectorAll('a')).map(a => +a.getBoundingClientRect().width.toFixed(2));
});
return res;
});
await ctx.close();
return { card, win };
};
const real = await measure(false);
const fallback = await measure(true);
const card = real.card, win = real.win;
const report = { labels: LABELS, card, win, fallback, containers: BOX, fit: {} };
const build = (src) => {
const res = {};
for (const [scope, setA, setB] of [['card', CARD, src.card], ['win', WIN, src.win]]) {
res[scope] = {};
for (const name of Object.keys(setA)) {
const gap = setA[name].gap;
const w = setB[name];
const line = (idx) => idx.reduce((s, i, n) => s + w[i], 0) + gap * (idx.length - 1);
const row = {
widths: { rustore: w[0], vk: w[1], site: w[2], video: w[3] },
pair_bukvika: +line([0, 1]).toFixed(2),
pair_fsr: +line([2, 0]).toFixed(2),
three_fsr_video: +line([2, 0, 3]).toFixed(2),
three_site_rustore_vk: +line([2, 0, 1]).toFixed(2)
};
const C = BOX[scope];
row.fits = {
'1440 Буквика': row.pair_bukvika <= C[1440],
'390 Буквика': row.pair_bukvika <= C[390],
'1440 FSR': row.pair_fsr <= C[1440],
'390 FSR': row.pair_fsr <= C[390]
};
res[scope][name] = row;
}
}
return res;
};
report.fit = build(real);
report.fit_fallback = build(fallback);
fs.writeFileSync(path.join(__dirname, 'compact-fit.json'), JSON.stringify(report, null, 2) + '\n');
await browser.close();
const table = (fitSet, title) => {
console.log('=== ' + title + ' ===');
for (const scope of ['card', 'win']) {
console.log('--- ' + scope + ' (контейнер 1440 = ' + BOX[scope][1440] + ', 390 = ' + BOX[scope][390] + ') ---');
console.table(Object.entries(fitSet[scope]).map(([k, v]) => {
const o = {
вариант: k,
RuStore: v.widths.rustore, VK: v.widths.vk, 'Сайт': v.widths.site, 'Видео': v.widths.video,
'Буквика(RS+VK)': v.pair_bukvika, 'FSR(Сайт+RS)': v.pair_fsr, '3 ссылки': v.three_site_rustore_vk
};
for (const [f, ok] of Object.entries(v.fits)) o[f] = ok ? 'ok' : 'НЕТ';
return o;
}));
}
};
table(report.fit, 'Шрифт страницы (Montserrat загружен)');
table(report.fit_fallback, 'ХУДШИЙ СЛУЧАЙ: запасной шрифт (Montserrat не загрузился)');
})();