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.
127 lines
8.5 KiB
JavaScript
127 lines
8.5 KiB
JavaScript
/*
|
||
* Лист сравнения политик размера знака (§10.28, kanban t_d3adf730).
|
||
*
|
||
* Геометрия знака берётся из glyph-mass.json (замер рендером), не задаётся руками.
|
||
* Рендерит на живой странице-стенде (Montserrat + Montserrat 700, реальные классы .btn):
|
||
* - «ДО» — отгруженный CSS: height 16 px (карточка) / 18 px (окно), width:auto;
|
||
* - P1 — единый слот, масса выровнена (L_MIN 13);
|
||
* - P2 — единый слот, масса выровнена (L_MIN 14 — RuStore чуть тяжелее);
|
||
* - P3 — единый слот, равный габарит (все L = 17.5) — контроль: масса не сходится.
|
||
* Плюс сетка «знак в слоте» с увеличением 4x, чтобы разницу массы было видно глазом.
|
||
*
|
||
* Запуск: node design/glyph-slot-2026-10-14/probe-glyph-policies.cjs
|
||
* Выход: shots/glyph-policies-light.png, shots/glyph-policies-dark.png
|
||
*/
|
||
const fs = require('fs');
|
||
const path = require('path');
|
||
const { launch } = require('./pw.cjs');
|
||
|
||
const OUT = path.join(__dirname, 'shots');
|
||
fs.mkdirSync(OUT, { recursive: true });
|
||
const mass = JSON.parse(fs.readFileSync(path.join(__dirname, 'glyph-mass.json'), 'utf8'));
|
||
const GEO = mass.geometry;
|
||
const ORDER = ['rustore', 'vk', 'site', 'video'];
|
||
|
||
const PATHS = {
|
||
rustore: (require('fs').readFileSync(path.resolve(__dirname, '..', '..', 'src', 'js', 'main.js'), 'utf8')
|
||
.match(/var LINK_ICONS = \{[\s\S]*?\n \};/)[0]).match(/rustore:[^']*'<svg[^>]*>\s*' \+\s*'(<path[^']*)'/)[1],
|
||
vk: '<path d="M6.79 7.3H4.05c.13 6.24 3.25 9.99 8.72 9.99h.31v-3.57c2.01.2 3.53 1.67 4.14 3.57h2.84c-.78-2.84-2.83-4.41-4.11-5.01 1.28-.74 3.08-2.54 3.51-4.98h-2.58c-.56 1.98-2.22 3.78-3.8 3.95V7.3H10.5v6.92c-1.6-.4-3.62-2.34-3.71-6.92Z" fill="currentColor"/>',
|
||
site: '<circle cx="12" cy="12" r="9"/><path d="M3 12h18"/><ellipse cx="12" cy="12" rx="4" ry="9"/>',
|
||
video: '<rect x="2" y="5" width="14" height="14" rx="2.5"/><path d="M16 10.5 22 7v10l-6-3.5z"/>'
|
||
};
|
||
const STROKE = { site: 2, video: 2 };
|
||
const LABEL = { rustore: 'В RUSTORE', vk: 'ИГРАТЬ', site: 'САЙТ ПРОЕКТА', video: 'ВИДЕО' };
|
||
|
||
const POLICIES = {
|
||
P1: { rustore: 13.21, vk: 18.39, site: 15.04, video: 19.5 },
|
||
P2: { rustore: 14.0, vk: 18.39, site: 15.04, video: 19.5 },
|
||
P3: { rustore: 17.5, vk: 17.5, site: 17.5, video: 17.5 }
|
||
};
|
||
|
||
// обёртка «единый слот»: viewBox 0 0 24 24, знак центрирован по чернильному bbox, большая сторона = L
|
||
const tf = (k, L) => {
|
||
const b = GEO[k].ink, s = L / Math.max(b.w, b.h);
|
||
return { s: +s.toFixed(5), tx: +(12 - (b.x + b.w / 2) * s).toFixed(5), ty: +(12 - (b.y + b.h / 2) * s).toFixed(5) };
|
||
};
|
||
const slot = (k, L, S) => {
|
||
const t = tf(k, L), sw = STROKE[k];
|
||
return '<svg class="btn__icon" style="width:' + S + 'px;height:' + S + 'px" viewBox="0 0 24 24" aria-hidden="true" focusable="false">' +
|
||
'<g transform="translate(' + t.tx + ' ' + t.ty + ') scale(' + t.s + ')"' +
|
||
(sw ? ' fill="none" stroke="currentColor" stroke-width="' + sw + '" stroke-linecap="round" stroke-linejoin="round"' : '') +
|
||
'>' + PATHS[k] + '</g></svg>';
|
||
};
|
||
// «ДО»: отгруженная разметка
|
||
const beforeSvg = (k, S) => {
|
||
const svg = { rustore: ['14.65 15.95 58.835 55.99', PATHS.rustore], vk: ['3.9 7.15 16.31 10.29', PATHS.vk] }[k];
|
||
const sw = STROKE[k];
|
||
const body = svg ? svg[1] : PATHS[k];
|
||
const vb = svg ? svg[0] : '0 0 24 24';
|
||
return '<svg class="btn__icon" style="height:' + S + 'px;width:auto" viewBox="' + vb + '"' +
|
||
(sw ? ' fill="none" stroke="currentColor" stroke-width="' + sw + '" stroke-linecap="round" stroke-linejoin="round"' : '') +
|
||
' aria-hidden="true" focusable="false">' + body + '</svg>';
|
||
};
|
||
|
||
const button = (k, inner, compact) => '<a class="btn btn--ghost ' + (compact ? 'case-card__link' : '') + '" href="#">' + inner + LABEL[k] + '</a>';
|
||
|
||
const row = (label, inner, cls) => '<div class="blk"><div class="cap">' + label + '</div><div class="' + (cls || 'lnkrow') + '">' + inner + '</div></div>';
|
||
|
||
const sheet = () => {
|
||
const cmp = (name, svgFn) => row(name + ' — карточка 36 px, знак 16 px',
|
||
ORDER.map(k => button(k, svgFn(k, 16), true)).join('')) +
|
||
row(name + ' — окно 48 px, знак 18 px',
|
||
ORDER.map(k => button(k, svgFn(k, 18), false)).join(''));
|
||
const grid = (name, svgFn) => '<div class="gridblk"><div class="cap">' + name + ' — знаки в слоте, увеличение 4x</div><div class="grid">' +
|
||
ORDER.map(k => '<div class="cell"><div class="cbox">' + svgFn(k, 16).replace('class="btn__icon"', 'class="btn__icon magnify"') + '</div><span>' + k + '</span></div>').join('') + '</div></div>';
|
||
|
||
return '<!doctype html><html lang="ru"><meta charset="utf-8">' +
|
||
'<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Roboto:wght@400;500&display=swap" rel="stylesheet">' +
|
||
'<style>' +
|
||
'*{box-sizing:border-box}' +
|
||
'body{margin:0;padding:28px 32px;font-family:Montserrat,sans-serif;background:var(--bg);color:var(--text-1)}' +
|
||
':root{--bg:#F5EEE2;--card:#FFFCF7;--hairline:#E6DCCE;--line-strong:#847863;--text-1:#211E18;--text-2:#5A5344;--text-3:#6A6453;--brand:#00CC66;--brand-deep:#007A3F;--brand-ink:#006B37;--on-brand:#04180C;--radius-md:12px;--ghost-hover:rgba(0,122,63,.09)}' +
|
||
'body.dark{--bg:#181109;--card:#1F160D;--hairline:#332719;--line-strong:#A28B6E;--text-1:#F8F2E7;--text-2:#D5C4AC;--text-3:#AA9679;--brand:#22B46B;--brand-deep:#49CA85;--brand-ink:#49CA85;--ghost-hover:rgba(73,202,133,.12)}' +
|
||
'.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:12px 26px;border-radius:var(--radius-md);font-family:Montserrat,sans-serif;font-weight:700;font-size:14px;letter-spacing:1px;text-transform:uppercase;line-height:1;cursor:pointer;border:2px solid transparent}' +
|
||
'.btn--ghost{background:transparent;color:var(--brand-deep);border-color:var(--brand-deep)}' +
|
||
'.case-card__link{min-height:36px;padding:8px 14px;font-size:12px}' +
|
||
'.btn__icon{display:block;flex:none}' +
|
||
'.lnkrow{display:flex;gap:8px;flex-wrap:wrap;align-items:center}' +
|
||
'.blk{margin:0 0 18px}.cap{font-size:11px;letter-spacing:1px;text-transform:uppercase;color:var(--text-3);font-weight:700;margin-bottom:8px}' +
|
||
'.gridblk{margin-top:6px}.grid{display:flex;gap:26px;align-items:flex-end}' +
|
||
'.cell{display:flex;flex-direction:column;align-items:center;gap:6px;font-size:10px;color:var(--text-3);text-transform:uppercase;letter-spacing:1px}' +
|
||
'.cbox{width:64px;height:64px;display:flex;align-items:center;justify-content:center;background:var(--card);border:1px dashed var(--line-strong);border-radius:8px;overflow:hidden}' +
|
||
'.magnify{transform:scale(4)}' +
|
||
'h1{font-size:15px;letter-spacing:1px;text-transform:uppercase;margin:0 0 20px}' +
|
||
'</style><body><h1>Знаки ресурсов: политики размера (16/18 px, светлая тема)</h1>' +
|
||
cmp('ДО', beforeSvg) +
|
||
Object.keys(POLICIES).map(n => cmp(n, (k, S) => slot(k, POLICIES[n][k], S))).join('') +
|
||
'<hr style="border:none;border-top:1px solid var(--hairline);margin:22px 0">' +
|
||
grid('ДО', beforeSvg) +
|
||
Object.keys(POLICIES).map(n => grid(n, (k) => slot(k, POLICIES[n][k], 16))).join('') +
|
||
'</body></html>';
|
||
};
|
||
|
||
(async () => {
|
||
const browser = await launch();
|
||
const p = await browser.newPage({ viewport: { width: 1240, height: 1100 }, deviceScaleFactor: 2 });
|
||
await p.setContent(sheet(), { waitUntil: 'networkidle' });
|
||
await p.waitForTimeout(400);
|
||
for (const theme of ['light', 'dark']) {
|
||
if (theme === 'dark') await p.evaluate(() => document.body.classList.add('dark'));
|
||
await p.screenshot({ path: path.join(OUT, 'glyph-policies-' + theme + '.png'), fullPage: true });
|
||
}
|
||
|
||
// Ширины: сколько занимает ряд из 1–3 ссылок в обеих точках (материал для §10.28 п.5)
|
||
const widths = await p.evaluate(() => {
|
||
const res = {};
|
||
document.querySelectorAll('.blk').forEach(blk => {
|
||
const cap = blk.querySelector('.cap').textContent;
|
||
if (cap.indexOf('ДО') !== 0 && cap.indexOf('P1') !== 0) return;
|
||
const btns = [...blk.querySelectorAll('.btn')];
|
||
res[cap] = btns.map(b => +b.getBoundingClientRect().width.toFixed(2));
|
||
});
|
||
return res;
|
||
});
|
||
console.log(JSON.stringify(widths, null, 1));
|
||
await browser.close();
|
||
})();
|