pandorga 2.3.16 → 2.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/_includes/content-runtime/43-blocks.html +12 -14
- data/assets/css/ledger/home.css +284 -51
- data/lib/pandorga/commands/new.rb +1 -1
- data/lib/pandorga/version.rb +1 -1
- data/scripts/test/render-parity/blocks/project-inventory-row.json +7 -6
- data/scripts/test/render-parity/run-absent-field-checks.mjs +3 -0
- data/scripts/test/test-css-structure.rb +63 -5
- data/scripts/test/test-hero-16x9.rb +2 -2
- data/scripts/test/test-hero-name.rb +6 -6
- data/scripts/test/test-home-desk-layout.mjs +568 -0
- data/scripts/test/test-home-desk-layout.rb +21 -0
- data/scripts/test/test-home-hero-c4.rb +79 -7
- data/scripts/test/test-home-hero-overlay-monotonic.mjs +444 -0
- data/scripts/test/test-home-hero-overlay-monotonic.rb +21 -0
- data/scripts/test/test-home-hero-overlay-split.rb +33 -13
- data/scripts/test/test-home-hero-scale.rb +5 -5
- data/scripts/test/test-regression-gate.mjs +58 -5
- data/scripts/validate.sh +2 -0
- metadata +5 -1
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// PLT-AC-88 / PLT-AC-98/99 / PLT-AC-104/105/106 — desk contents, hero +4pt, icon/name center, pad balance.
|
|
3
|
+
// Fixture links live base.css + home.css; no Jekyll build required.
|
|
4
|
+
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { mkdtemp, writeFile, rm, mkdir, copyFile, readFile } from 'node:fs/promises';
|
|
8
|
+
import { createServer as createNetServer } from 'node:net';
|
|
9
|
+
import { createServer as createHttpServer } from 'node:http';
|
|
10
|
+
import { tmpdir } from 'node:os';
|
|
11
|
+
import { join, resolve, extname } from 'node:path';
|
|
12
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
16
|
+
const ROOT = resolve(__dirname, '../..');
|
|
17
|
+
const ASSETS = join(ROOT, 'assets/css');
|
|
18
|
+
|
|
19
|
+
const VIEWPORTS = [
|
|
20
|
+
{ name: '390', width: 390, height: 844 },
|
|
21
|
+
{ name: '1024', width: 1024, height: 768 },
|
|
22
|
+
{ name: '1280', width: 1280, height: 800 },
|
|
23
|
+
{ name: '1440', width: 1440, height: 900 },
|
|
24
|
+
{ name: '1920', width: 1920, height: 1080 },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
function freePort() {
|
|
28
|
+
return new Promise((resolveP, reject) => {
|
|
29
|
+
const server = createNetServer();
|
|
30
|
+
server.once('error', reject);
|
|
31
|
+
server.listen(0, '127.0.0.1', () => {
|
|
32
|
+
const { port } = server.address();
|
|
33
|
+
server.close(() => resolveP(port));
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function findChrome() {
|
|
39
|
+
const candidates = [
|
|
40
|
+
process.env.CHROME_PATH,
|
|
41
|
+
'/usr/bin/google-chrome-stable',
|
|
42
|
+
'/usr/bin/google-chrome',
|
|
43
|
+
'/usr/bin/chromium',
|
|
44
|
+
'/usr/bin/chromium-browser',
|
|
45
|
+
].filter(Boolean);
|
|
46
|
+
for (const c of candidates) {
|
|
47
|
+
if (c && existsSync(c)) return c;
|
|
48
|
+
}
|
|
49
|
+
return 'google-chrome';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class Cdp {
|
|
53
|
+
constructor(ws) {
|
|
54
|
+
this.ws = ws;
|
|
55
|
+
this.next = 1;
|
|
56
|
+
this.pending = new Map();
|
|
57
|
+
ws.addEventListener('message', (event) => {
|
|
58
|
+
const message = JSON.parse(event.data);
|
|
59
|
+
if (message.id && this.pending.has(message.id)) {
|
|
60
|
+
const { resolve: res, reject: rej } = this.pending.get(message.id);
|
|
61
|
+
this.pending.delete(message.id);
|
|
62
|
+
if (message.error) rej(new Error(message.error.message || JSON.stringify(message.error)));
|
|
63
|
+
else res(message.result || {});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
send(method, params = {}, sessionId) {
|
|
68
|
+
const id = this.next++;
|
|
69
|
+
const payload = { id, method, params };
|
|
70
|
+
if (sessionId) payload.sessionId = sessionId;
|
|
71
|
+
this.ws.send(JSON.stringify(payload));
|
|
72
|
+
return new Promise((res, rej) => this.pending.set(id, { resolve: res, reject: rej }));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function openSocket(url) {
|
|
77
|
+
const ws = new WebSocket(url);
|
|
78
|
+
await new Promise((resolveP, reject) => {
|
|
79
|
+
ws.addEventListener('open', resolveP, { once: true });
|
|
80
|
+
ws.addEventListener('error', () => reject(new Error('DevTools socket failed')), { once: true });
|
|
81
|
+
});
|
|
82
|
+
return ws;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function waitForDevtools(port, chrome) {
|
|
86
|
+
let stderr = '';
|
|
87
|
+
if (chrome.stderr) chrome.stderr.on('data', (c) => { stderr += c; });
|
|
88
|
+
for (let i = 0; i < 100; i++) {
|
|
89
|
+
if (chrome.exitCode !== null) throw new Error(`Chrome exited ${chrome.exitCode}: ${stderr.slice(-500)}`);
|
|
90
|
+
try {
|
|
91
|
+
const response = await fetch(`http://127.0.0.1:${port}/json/version`);
|
|
92
|
+
if (response.ok) return response.json();
|
|
93
|
+
} catch (_e) { /* starting */ }
|
|
94
|
+
await delay(100);
|
|
95
|
+
}
|
|
96
|
+
throw new Error(`Chrome DevTools did not answer on ${port}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function rowHtml(name, selected) {
|
|
100
|
+
const initial = name.charAt(0).toUpperCase();
|
|
101
|
+
const blurb = 'A short presentation blurb that should clamp beside the picture when the row is wide enough for both.';
|
|
102
|
+
return `<button type="button" class="home-project-inventory-row group${selected ? ' is-selected' : ''}" aria-pressed="${selected ? 'true' : 'false'}" aria-label="${name}" title="${name}">
|
|
103
|
+
<div class="home-project-inventory-media"><div class="ledger-poster projects-plate"><img alt="" width="1600" height="900" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="/></div><div class="home-project-inventory-mark home-project-inventory-mark--initial">${initial}</div></div>
|
|
104
|
+
<div class="home-project-inventory-body">
|
|
105
|
+
<div class="home-project-inventory-code"><div class="ledger-meta"><span class="code-technical home-project-inventory-index">01</span><span class="ledger-meta-sep" aria-hidden="true">/</span>Label that must not show</div></div>
|
|
106
|
+
<h3 class="home-project-inventory-title card-title">${name}</h3>
|
|
107
|
+
<span class="home-project-inventory-year">2026</span>
|
|
108
|
+
<span class="home-project-inventory-tags">Robotics · Python</span>
|
|
109
|
+
<p class="home-project-inventory-excerpt">${blurb}</p>
|
|
110
|
+
</div>
|
|
111
|
+
<span class="home-project-inventory-glyph material-symbols-outlined" aria-hidden="true">recycling</span>
|
|
112
|
+
</button>`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function buildHtml() {
|
|
116
|
+
const names = ['Fond de Terrasse', 'Guidelines', 'Full-stack Robotic Effector Trajectories', 'Coleta de Lixo Auxiliada por Visão Embarcada', 'Base Operating System for Sensors and Actuators'];
|
|
117
|
+
const rows = names.map((n, i) => rowHtml(n, i === 0)).join('\n');
|
|
118
|
+
return `<!doctype html>
|
|
119
|
+
<html lang="en" data-theme="light">
|
|
120
|
+
<head>
|
|
121
|
+
<meta charset="utf-8"/>
|
|
122
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
123
|
+
<link rel="stylesheet" href="/css/base.css"/>
|
|
124
|
+
<link rel="stylesheet" href="/css/ledger/home.css"/>
|
|
125
|
+
<style>
|
|
126
|
+
/* Fixture shell: match live rem (~17.6px) used in desktop sim.
|
|
127
|
+
Distinct title vs label stacks so the rendered gate can assert equality. */
|
|
128
|
+
:root {
|
|
129
|
+
--font-title: "TitleSerifFixture", Georgia, serif;
|
|
130
|
+
--font-label: "LabelCapsFixture", Arial, sans-serif;
|
|
131
|
+
--font-content-title: var(--font-title);
|
|
132
|
+
--font-body: "BodySansFixture", Helvetica, sans-serif;
|
|
133
|
+
--type-label: 0.8125rem;
|
|
134
|
+
--type-body: 1.075rem;
|
|
135
|
+
--type-section: 1.5rem;
|
|
136
|
+
--type-section-lg: 1.75rem;
|
|
137
|
+
--weight-title: 600;
|
|
138
|
+
--weight-body: 300;
|
|
139
|
+
--weight-display: 400;
|
|
140
|
+
--color-on-surface: #111;
|
|
141
|
+
--color-primary: #1c5a7a;
|
|
142
|
+
--color-surface-high: rgba(0, 0, 0, 0.08);
|
|
143
|
+
--color-on-surface-variant: #444;
|
|
144
|
+
--border-gentle: rgba(0, 0, 0, 0.08);
|
|
145
|
+
--space-xs: 0.25rem;
|
|
146
|
+
--space-md: 1rem;
|
|
147
|
+
}
|
|
148
|
+
html { font-size: 17.6px; }
|
|
149
|
+
body { margin: 0; background: #f5f5f5; color: #111; }
|
|
150
|
+
/* Mirror live .theme-choice (font-body utility) for PLT-AC-88 equality gate. */
|
|
151
|
+
.theme-choice {
|
|
152
|
+
font-family: var(--font-body);
|
|
153
|
+
font-size: var(--type-body);
|
|
154
|
+
font-weight: var(--weight-body);
|
|
155
|
+
letter-spacing: 0.01em;
|
|
156
|
+
text-transform: none;
|
|
157
|
+
line-height: 1;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
160
|
+
</head>
|
|
161
|
+
<body>
|
|
162
|
+
<button type="button" class="theme-choice" id="fixture-theme-choice">Light</button>
|
|
163
|
+
<main class="home-ledger">
|
|
164
|
+
<section class="home-band home-band--hero">
|
|
165
|
+
<div class="home-band-inner">
|
|
166
|
+
<div class="home-hero">
|
|
167
|
+
<div class="home-hero-portrait">
|
|
168
|
+
<div class="home-hero-plate-wrap"><div class="home-hero-plate"><img alt="" width="1600" height="900" class="is-shown" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="/></div></div>
|
|
169
|
+
<div class="home-hero-copy">
|
|
170
|
+
<h1 class="home-hero-title"><span class="home-hero-given">Alexandre</span> <span class="home-hero-family">Loeblein Heinen</span></h1>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</section>
|
|
176
|
+
<section class="home-band" data-home-kind="portfolio" id="home-projects">
|
|
177
|
+
<div class="home-band-inner">
|
|
178
|
+
<header class="ledger-section-banner">
|
|
179
|
+
<div class="ledger-section-lead">
|
|
180
|
+
<h2 class="section-title">Projects</h2>
|
|
181
|
+
</div>
|
|
182
|
+
</header>
|
|
183
|
+
<div class="home-projects-bench">
|
|
184
|
+
<div class="home-projects-inventory-wrap">
|
|
185
|
+
<div class="home-project-inventory" role="region" aria-label="Explore projects">
|
|
186
|
+
${rows}
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
<aside class="home-project-specimen ledger-system-card">
|
|
190
|
+
<figure class="home-specimen-figure">
|
|
191
|
+
<div class="ledger-poster projects-plate">
|
|
192
|
+
<img alt="" width="1600" height="900" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="/>
|
|
193
|
+
</div>
|
|
194
|
+
</figure>
|
|
195
|
+
</aside>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
</section>
|
|
199
|
+
</main>
|
|
200
|
+
</body>
|
|
201
|
+
</html>`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function measure(cdp, sessionId) {
|
|
205
|
+
const { result } = await cdp.send('Runtime.evaluate', {
|
|
206
|
+
expression: `(() => {
|
|
207
|
+
const q = (s) => document.querySelector(s);
|
|
208
|
+
const qa = (s) => [...document.querySelectorAll(s)];
|
|
209
|
+
const rect = (el) => {
|
|
210
|
+
if (!el) return null;
|
|
211
|
+
const r = el.getBoundingClientRect();
|
|
212
|
+
return { x: r.x, y: r.y, w: r.width, h: r.height };
|
|
213
|
+
};
|
|
214
|
+
const fs = (el) => el ? parseFloat(getComputedStyle(el).fontSize) : null;
|
|
215
|
+
const bench = q('.home-projects-bench');
|
|
216
|
+
const inner = q('.home-band[data-home-kind="portfolio"] .home-band-inner');
|
|
217
|
+
const plate = q('.home-specimen-figure > .ledger-poster, .home-specimen-figure > .projects-plate');
|
|
218
|
+
const frame = q('.home-project-inventory-row.is-selected .home-project-inventory-media');
|
|
219
|
+
const rows = qa('.home-project-inventory-row');
|
|
220
|
+
const hero = q('.home-hero-title');
|
|
221
|
+
const band = q('.home-band[data-home-kind="portfolio"] .section-title');
|
|
222
|
+
const body = q('.home-project-inventory-body');
|
|
223
|
+
const benchR = rect(bench);
|
|
224
|
+
const innerR = rect(inner);
|
|
225
|
+
const plateR = rect(plate);
|
|
226
|
+
const frameR = rect(frame);
|
|
227
|
+
const gapLeft = benchR && innerR ? benchR.x - innerR.x : null;
|
|
228
|
+
const gapRight = benchR && innerR ? (innerR.x + innerR.w) - (benchR.x + benchR.w) : null;
|
|
229
|
+
const rowHeights = rows.map((r) => r.getBoundingClientRect().height);
|
|
230
|
+
const titleCs = body ? getComputedStyle(body).display : null;
|
|
231
|
+
const invTitle = q('.home-project-inventory-title');
|
|
232
|
+
const drop = q('.theme-choice');
|
|
233
|
+
const invCs = invTitle ? getComputedStyle(invTitle) : null;
|
|
234
|
+
const dropCs = drop ? getComputedStyle(drop) : null;
|
|
235
|
+
const invTitleFf = invCs ? invCs.fontFamily : null;
|
|
236
|
+
const invTitleFs = invCs ? invCs.fontSize : null;
|
|
237
|
+
const invTitleFw = invCs ? invCs.fontWeight : null;
|
|
238
|
+
const titleWhiteSpace = invCs ? invCs.whiteSpace : null;
|
|
239
|
+
const titleOverflow = invCs ? invCs.textOverflow : null;
|
|
240
|
+
const dropFf = dropCs ? dropCs.fontFamily : null;
|
|
241
|
+
const dropFs = dropCs ? dropCs.fontSize : null;
|
|
242
|
+
const dropFw = dropCs ? dropCs.fontWeight : null;
|
|
243
|
+
const bandFf = band ? getComputedStyle(band).fontFamily : null;
|
|
244
|
+
const titles = qa('.home-project-inventory-title');
|
|
245
|
+
const titleTrunc = titles.map((t) => ({
|
|
246
|
+
text: (t.textContent || '').trim(),
|
|
247
|
+
scroll: t.scrollWidth,
|
|
248
|
+
client: t.clientWidth,
|
|
249
|
+
truncated: t.scrollWidth > t.clientWidth + 1,
|
|
250
|
+
}));
|
|
251
|
+
const listWrap = q('.home-projects-inventory-wrap');
|
|
252
|
+
const listR = rect(listWrap);
|
|
253
|
+
const glyph = q('.home-project-inventory-row .home-project-inventory-glyph');
|
|
254
|
+
const code = q('.home-project-inventory-row .home-project-inventory-code');
|
|
255
|
+
const year = q('.home-project-inventory-row .home-project-inventory-year');
|
|
256
|
+
const tags = q('.home-project-inventory-row .home-project-inventory-tags');
|
|
257
|
+
const excerpt = q('.home-project-inventory-row.is-selected .home-project-inventory-excerpt');
|
|
258
|
+
const glyphCs = glyph ? getComputedStyle(glyph) : null;
|
|
259
|
+
const glyphR = glyph ? glyph.getBoundingClientRect() : null;
|
|
260
|
+
const codeCs = code ? getComputedStyle(code) : null;
|
|
261
|
+
const yearCs = year ? getComputedStyle(year) : null;
|
|
262
|
+
const tagsCs = tags ? getComputedStyle(tags) : null;
|
|
263
|
+
const excerptCs = excerpt ? getComputedStyle(excerpt) : null;
|
|
264
|
+
const excerptR = excerpt ? excerpt.getBoundingClientRect() : null;
|
|
265
|
+
const glyphOverflowCss = glyphCs ? (glyphCs.overflowX || glyphCs.overflow) : null;
|
|
266
|
+
const glyphText = glyph ? (glyph.textContent || '').trim() : '';
|
|
267
|
+
const codeLeaks = !!(code && codeCs && codeCs.display !== 'none' && codeCs.visibility !== 'hidden' && code.getBoundingClientRect().width > 0.5);
|
|
268
|
+
const iconHasMetaText = /\\d{2}\\s*\\//.test(glyphText) || glyphText.indexOf('/') !== -1;
|
|
269
|
+
const iconOverflow = codeLeaks || iconHasMetaText ||
|
|
270
|
+
(glyphOverflowCss !== 'hidden' && glyphOverflowCss !== 'clip');
|
|
271
|
+
const codeVisible = !!(code && codeCs && codeCs.display !== 'none' && codeCs.visibility !== 'hidden' && code.getBoundingClientRect().width > 0.5);
|
|
272
|
+
const yearVisible = !!(year && yearCs && yearCs.display !== 'none' && yearCs.visibility !== 'hidden' && year.getBoundingClientRect().width > 0.5);
|
|
273
|
+
const tagsVisible = !!(tags && tagsCs && tagsCs.display !== 'none' && tagsCs.visibility !== 'hidden' && tags.getBoundingClientRect().width > 0.5);
|
|
274
|
+
let excerptLines = null;
|
|
275
|
+
if (excerpt && excerptR && excerptR.height > 0 && excerptCs) {
|
|
276
|
+
const lh = parseFloat(excerptCs.lineHeight) || parseFloat(excerptCs.fontSize) || 16;
|
|
277
|
+
excerptLines = excerptR.height / lh;
|
|
278
|
+
}
|
|
279
|
+
const rowAlign = rows.map((row) => {
|
|
280
|
+
const g = row.querySelector('.home-project-inventory-glyph');
|
|
281
|
+
const t = row.querySelector('.home-project-inventory-title');
|
|
282
|
+
if (!g || !t) return null;
|
|
283
|
+
const gr = g.getBoundingClientRect();
|
|
284
|
+
const tr = t.getBoundingClientRect();
|
|
285
|
+
const gCy = gr.top + gr.height / 2;
|
|
286
|
+
const tCy = tr.top + tr.height / 2;
|
|
287
|
+
return {
|
|
288
|
+
selected: row.classList.contains('is-selected'),
|
|
289
|
+
name: (t.textContent || '').trim(),
|
|
290
|
+
glyphCy: gCy,
|
|
291
|
+
titleCy: tCy,
|
|
292
|
+
delta: Math.abs(gCy - tCy),
|
|
293
|
+
};
|
|
294
|
+
}).filter(Boolean);
|
|
295
|
+
const maxAlignDelta = rowAlign.reduce((m, r) => Math.max(m, r.delta), 0);
|
|
296
|
+
const selTitle = q('.home-project-inventory-row.is-selected .home-project-inventory-title');
|
|
297
|
+
const selTitleCs = selTitle ? getComputedStyle(selTitle) : null;
|
|
298
|
+
const selTitleBg = selTitleCs ? selTitleCs.backgroundImage : null;
|
|
299
|
+
const selRow = q('.home-project-inventory-row.is-selected');
|
|
300
|
+
const selRowCs = selRow ? getComputedStyle(selRow) : null;
|
|
301
|
+
const selRowBg = selRowCs ? selRowCs.backgroundColor : null;
|
|
302
|
+
let padTop = null;
|
|
303
|
+
let padBottom = null;
|
|
304
|
+
let padDelta = null;
|
|
305
|
+
let excerptPlateTopDelta = null;
|
|
306
|
+
if (selRow && selTitle) {
|
|
307
|
+
const rr = selRow.getBoundingClientRect();
|
|
308
|
+
const glyph = selRow.querySelector('.home-project-inventory-glyph');
|
|
309
|
+
const tr = selTitle.getBoundingClientRect();
|
|
310
|
+
const gr = glyph ? glyph.getBoundingClientRect() : tr;
|
|
311
|
+
const contentTop = Math.min(tr.top, gr.top);
|
|
312
|
+
const media = selRow.querySelector('.home-project-inventory-media');
|
|
313
|
+
const mediaCs = media ? getComputedStyle(media) : null;
|
|
314
|
+
const mediaShown = !!(media && mediaCs && mediaCs.display !== 'none' && media.getBoundingClientRect().height > 8);
|
|
315
|
+
const excerpt = selRow.querySelector('.home-project-inventory-excerpt');
|
|
316
|
+
const excerptCs = excerpt ? getComputedStyle(excerpt) : null;
|
|
317
|
+
const excerptShown = !!(excerpt && excerptCs && excerptCs.display !== 'none' && excerpt.getBoundingClientRect().height > 4);
|
|
318
|
+
let contentBottom = Math.max(tr.bottom, gr.bottom);
|
|
319
|
+
if (mediaShown) contentBottom = Math.max(contentBottom, media.getBoundingClientRect().bottom);
|
|
320
|
+
if (excerptShown) contentBottom = Math.max(contentBottom, excerpt.getBoundingClientRect().bottom);
|
|
321
|
+
padTop = contentTop - rr.top;
|
|
322
|
+
padBottom = rr.bottom - contentBottom;
|
|
323
|
+
padDelta = Math.abs(padTop - padBottom);
|
|
324
|
+
if (mediaShown && excerptShown) {
|
|
325
|
+
excerptPlateTopDelta = Math.abs(excerpt.getBoundingClientRect().top - media.getBoundingClientRect().top);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
gapLeft, gapRight,
|
|
330
|
+
plate: plateR,
|
|
331
|
+
frame: frameR,
|
|
332
|
+
plateVarH: bench ? getComputedStyle(bench).getPropertyValue('--home-specimen-plate-height').trim() : null,
|
|
333
|
+
rowHeights,
|
|
334
|
+
iconBtn: bench ? getComputedStyle(bench).getPropertyValue('--home-icon-btn-size').trim() : null,
|
|
335
|
+
bodyDisplay: titleCs,
|
|
336
|
+
heroFs: fs(hero),
|
|
337
|
+
bandFs: fs(band),
|
|
338
|
+
deltaPx: (hero && band) ? fs(hero) - fs(band) : null,
|
|
339
|
+
invTitleFf,
|
|
340
|
+
invTitleFs,
|
|
341
|
+
invTitleFw,
|
|
342
|
+
titleWhiteSpace,
|
|
343
|
+
titleOverflow,
|
|
344
|
+
dropFf,
|
|
345
|
+
dropFs,
|
|
346
|
+
dropFw,
|
|
347
|
+
bandFf,
|
|
348
|
+
titleTrunc,
|
|
349
|
+
list: listR,
|
|
350
|
+
bench: benchR,
|
|
351
|
+
vw: window.innerWidth,
|
|
352
|
+
glyphDisplay: glyphCs ? glyphCs.display : null,
|
|
353
|
+
glyphVisible: !!(glyphR && glyphR.width > 0 && glyphCs && glyphCs.display !== 'none'),
|
|
354
|
+
iconOverflow,
|
|
355
|
+
codeVisible,
|
|
356
|
+
yearVisible,
|
|
357
|
+
tagsVisible,
|
|
358
|
+
excerptDisplay: excerptCs ? excerptCs.display : null,
|
|
359
|
+
excerptVisible: !!(excerptR && excerptR.width > 0 && excerptR.height > 0 && excerptCs && excerptCs.display !== 'none'),
|
|
360
|
+
excerptLines,
|
|
361
|
+
excerptClamp: excerptCs ? excerptCs.webkitLineClamp : null,
|
|
362
|
+
rowAlign,
|
|
363
|
+
maxAlignDelta,
|
|
364
|
+
selTitleBg,
|
|
365
|
+
selRowBg,
|
|
366
|
+
padTop,
|
|
367
|
+
padBottom,
|
|
368
|
+
padDelta,
|
|
369
|
+
excerptPlateTopDelta,
|
|
370
|
+
};
|
|
371
|
+
})()`,
|
|
372
|
+
returnByValue: true,
|
|
373
|
+
awaitPromise: false,
|
|
374
|
+
}, sessionId);
|
|
375
|
+
return result.value;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function approx(a, b, tol) {
|
|
379
|
+
return Math.abs(a - b) <= tol;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
async function main() {
|
|
383
|
+
const work = await mkdtemp(join(tmpdir(), 'pandorga-desk-'));
|
|
384
|
+
const cssDir = join(work, 'css');
|
|
385
|
+
const ledgerDir = join(cssDir, 'ledger');
|
|
386
|
+
await mkdir(ledgerDir, { recursive: true });
|
|
387
|
+
await copyFile(join(ASSETS, 'base.css'), join(cssDir, 'base.css'));
|
|
388
|
+
await copyFile(join(ASSETS, 'ledger/home.css'), join(ledgerDir, 'home.css'));
|
|
389
|
+
await writeFile(join(work, 'index.html'), buildHtml());
|
|
390
|
+
|
|
391
|
+
const port = await freePort();
|
|
392
|
+
const mime = {
|
|
393
|
+
'.html': 'text/html; charset=utf-8',
|
|
394
|
+
'.css': 'text/css; charset=utf-8',
|
|
395
|
+
};
|
|
396
|
+
const server = createHttpServer(async (req, res) => {
|
|
397
|
+
const url = decodeURIComponent((req.url || '/').split('?')[0]);
|
|
398
|
+
const path = url === '/' ? '/index.html' : url;
|
|
399
|
+
const file = join(work, path.replace(/^\//, ''));
|
|
400
|
+
if (!file.startsWith(work) || !existsSync(file)) {
|
|
401
|
+
res.writeHead(404); res.end('missing'); return;
|
|
402
|
+
}
|
|
403
|
+
const body = await readFile(file);
|
|
404
|
+
res.writeHead(200, { 'Content-Type': mime[extname(file)] || 'application/octet-stream' });
|
|
405
|
+
res.end(body);
|
|
406
|
+
});
|
|
407
|
+
await new Promise((r) => server.listen(port, '127.0.0.1', r));
|
|
408
|
+
|
|
409
|
+
const dbgPort = await freePort();
|
|
410
|
+
const chromePath = findChrome();
|
|
411
|
+
const chrome = spawn(chromePath, [
|
|
412
|
+
`--remote-debugging-port=${dbgPort}`,
|
|
413
|
+
'--headless=new',
|
|
414
|
+
'--disable-gpu',
|
|
415
|
+
'--no-sandbox',
|
|
416
|
+
'--disable-dev-shm-usage',
|
|
417
|
+
'about:blank',
|
|
418
|
+
], { stdio: ['ignore', 'ignore', 'pipe'] });
|
|
419
|
+
|
|
420
|
+
const errors = [];
|
|
421
|
+
try {
|
|
422
|
+
const version = await waitForDevtools(dbgPort, chrome);
|
|
423
|
+
const ws = await openSocket(version.webSocketDebuggerUrl);
|
|
424
|
+
const cdp = new Cdp(ws);
|
|
425
|
+
const { targetId } = await cdp.send('Target.createTarget', { url: 'about:blank' });
|
|
426
|
+
const { sessionId } = await cdp.send('Target.attachToTarget', { targetId, flatten: true });
|
|
427
|
+
await cdp.send('Page.enable', {}, sessionId);
|
|
428
|
+
await cdp.send('Runtime.enable', {}, sessionId);
|
|
429
|
+
await cdp.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: 'light' }] }, sessionId);
|
|
430
|
+
|
|
431
|
+
const baselinePlateH = 12.25 * 17.6; // rem × root
|
|
432
|
+
|
|
433
|
+
for (const vp of VIEWPORTS) {
|
|
434
|
+
await cdp.send('Emulation.setDeviceMetricsOverride', {
|
|
435
|
+
width: vp.width, height: vp.height, deviceScaleFactor: 1, mobile: vp.width < 768,
|
|
436
|
+
}, sessionId);
|
|
437
|
+
await cdp.send('Page.navigate', { url: `http://127.0.0.1:${port}/` }, sessionId);
|
|
438
|
+
await cdp.send('Page.loadEventFired', {}, sessionId).catch(() => {});
|
|
439
|
+
await delay(350);
|
|
440
|
+
const m = await measure(cdp, sessionId);
|
|
441
|
+
if (!m) { errors.push(`${vp.name}: no metrics`); continue; }
|
|
442
|
+
|
|
443
|
+
// Hero +4pt at 390 and 1440 (and all desks)
|
|
444
|
+
if (m.deltaPx == null || m.deltaPx < 5.0 || m.deltaPx > 5.7) {
|
|
445
|
+
errors.push(`${vp.name}: hero−band Δpx=${m.deltaPx} not in [5.0, 5.7] (PLT-AC-99)`);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (vp.width >= 1024) {
|
|
449
|
+
if (Math.abs(m.gapLeft) > 2 || Math.abs(m.gapRight) > 2) {
|
|
450
|
+
errors.push(`${vp.name}: gaps L/R=${m.gapLeft?.toFixed?.(1)}/${m.gapRight?.toFixed?.(1)} not ~0 (PLT-AC-88)`);
|
|
451
|
+
}
|
|
452
|
+
if (m.bodyDisplay !== 'contents') {
|
|
453
|
+
errors.push(`${vp.name}: inventory body display=${m.bodyDisplay} want contents`);
|
|
454
|
+
}
|
|
455
|
+
// PLT-AC-88 (2.3.20): row name face/size/weight = theme dropdown .theme-choice
|
|
456
|
+
if (!m.invTitleFf || !m.dropFf || m.invTitleFf !== m.dropFf) {
|
|
457
|
+
errors.push(`${vp.name}: inventory title font-family="${m.invTitleFf}" ≠ dropdown "${m.dropFf}"`);
|
|
458
|
+
}
|
|
459
|
+
if (!m.invTitleFw || !m.dropFw || String(m.invTitleFw) !== String(m.dropFw)) {
|
|
460
|
+
errors.push(`${vp.name}: inventory title font-weight="${m.invTitleFw}" ≠ dropdown "${m.dropFw}"`);
|
|
461
|
+
}
|
|
462
|
+
if (m.invTitleFf && /TitleSerifFixture|LabelCapsFixture/i.test(m.invTitleFf)) {
|
|
463
|
+
errors.push(`${vp.name}: inventory title is not the body face (${m.invTitleFf})`);
|
|
464
|
+
}
|
|
465
|
+
const fluid = vp.width * 0.022;
|
|
466
|
+
const nameFs = Math.min(2.05 * 17.6, Math.max(1.45 * 17.6, fluid));
|
|
467
|
+
const gotFs = parseFloat(m.invTitleFs);
|
|
468
|
+
if (!Number.isFinite(gotFs) || Math.abs(gotFs - nameFs) > 1.5) {
|
|
469
|
+
errors.push(`${vp.name}: name size ${m.invTitleFs} want ~${nameFs.toFixed(2)}`);
|
|
470
|
+
}
|
|
471
|
+
if (m.titleWhiteSpace && m.titleWhiteSpace !== 'normal') {
|
|
472
|
+
errors.push(`${vp.name}: name white-space=${m.titleWhiteSpace} want normal`);
|
|
473
|
+
}
|
|
474
|
+
if (m.titleOverflow === 'ellipsis') {
|
|
475
|
+
errors.push(`${vp.name}: name text-overflow is ellipsis`);
|
|
476
|
+
}
|
|
477
|
+
if (!m.rowHeights.length) {
|
|
478
|
+
errors.push(`${vp.name}: no inventory rows`);
|
|
479
|
+
}
|
|
480
|
+
const truncated = (m.titleTrunc || []).filter((t) => t.truncated);
|
|
481
|
+
if (truncated.length) {
|
|
482
|
+
errors.push(`${vp.name}: truncated names ${truncated.map((t) => t.text + '(' + t.scroll + '>' + t.client + ')').join(', ')}`);
|
|
483
|
+
}
|
|
484
|
+
if (!m.glyphVisible) {
|
|
485
|
+
errors.push(`${vp.name}: project icon glyph is not visible (PLT-AC-88)`);
|
|
486
|
+
}
|
|
487
|
+
if (m.iconOverflow) {
|
|
488
|
+
errors.push(`${vp.name}: icon cell overflows text (PLT-AC-88)`);
|
|
489
|
+
}
|
|
490
|
+
if (m.codeVisible) {
|
|
491
|
+
errors.push(`${vp.name}: folio/meta code is still visible (PLT-AC-88)`);
|
|
492
|
+
}
|
|
493
|
+
if (m.yearVisible) {
|
|
494
|
+
errors.push(`${vp.name}: year is visible on contents row (PLT-AC-88)`);
|
|
495
|
+
}
|
|
496
|
+
if (m.tagsVisible) {
|
|
497
|
+
errors.push(`${vp.name}: tags are visible on contents row (PLT-AC-88)`);
|
|
498
|
+
}
|
|
499
|
+
// PLT-AC-104: icon and name vertical centers within 1px on every row
|
|
500
|
+
if (typeof m.maxAlignDelta !== 'number' || !m.rowAlign || !m.rowAlign.length) {
|
|
501
|
+
errors.push(`${vp.name}: missing icon/name align metrics (PLT-AC-104)`);
|
|
502
|
+
} else if (m.maxAlignDelta > 1) {
|
|
503
|
+
const bad = m.rowAlign.filter((r) => r.delta > 1).map((r) => `${r.name}(Δ=${r.delta.toFixed(2)})`).join(', ');
|
|
504
|
+
errors.push(`${vp.name}: icon/name center Δ max=${m.maxAlignDelta.toFixed(2)} > 1px (PLT-AC-104): ${bad}`);
|
|
505
|
+
}
|
|
506
|
+
// PLT-AC-105: gray wash on selected row; title has no mark gradient
|
|
507
|
+
if (m.selTitleBg && m.selTitleBg !== 'none') {
|
|
508
|
+
errors.push(`${vp.name}: selected title still has background mark (${m.selTitleBg}) (PLT-AC-105)`);
|
|
509
|
+
}
|
|
510
|
+
const bg = (m.selRowBg || '').replace(/\s+/g, '');
|
|
511
|
+
const transparent = !bg || bg === 'transparent' || bg === 'rgba(0,0,0,0)' || bg === 'rgba(0,0,0,0.0)';
|
|
512
|
+
if (transparent) {
|
|
513
|
+
errors.push(`${vp.name}: selected row missing gray wash bg=${m.selRowBg} (PLT-AC-105)`);
|
|
514
|
+
}
|
|
515
|
+
// PLT-AC-106: top/bottom pad within 1px
|
|
516
|
+
if (typeof m.padDelta !== 'number') {
|
|
517
|
+
errors.push(`${vp.name}: missing selected-row pad metrics (PLT-AC-106)`);
|
|
518
|
+
} else if (m.padDelta > 1) {
|
|
519
|
+
errors.push(`${vp.name}: selected pad top=${m.padTop?.toFixed?.(2)} bottom=${m.padBottom?.toFixed?.(2)} Δ=${m.padDelta.toFixed(2)} > 1px (PLT-AC-106)`);
|
|
520
|
+
}
|
|
521
|
+
if (m.excerptVisible && typeof m.excerptPlateTopDelta === 'number' && m.excerptPlateTopDelta > 1) {
|
|
522
|
+
errors.push(`${vp.name}: excerpt/plate top Δ=${m.excerptPlateTopDelta.toFixed(2)} > 1px (PLT-AC-106)`);
|
|
523
|
+
}
|
|
524
|
+
const frameW = 11 * 17.6;
|
|
525
|
+
const frameH = frameW * 9 / 16;
|
|
526
|
+
if (!m.frame || m.frame.w < 8) {
|
|
527
|
+
errors.push(`${vp.name}: selected line did not open its picture`);
|
|
528
|
+
} else {
|
|
529
|
+
if (Math.abs(m.frame.w - frameW) > 2) {
|
|
530
|
+
errors.push(`${vp.name}: picture W ${m.frame.w.toFixed(1)} want ${frameW.toFixed(1)}`);
|
|
531
|
+
}
|
|
532
|
+
if (Math.abs(m.frame.h - frameH) > 3) {
|
|
533
|
+
errors.push(`${vp.name}: picture H ${m.frame.h.toFixed(1)} want ${frameH.toFixed(1)}`);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
console.log(
|
|
537
|
+
` ${vp.name}: listW=${m.list?.w?.toFixed?.(1)} rowH=${m.rowHeights?.[0]?.toFixed?.(1)} frame=${m.frame?.w?.toFixed?.(1)}×${m.frame?.h?.toFixed?.(1)} ` +
|
|
538
|
+
`fs=${m.invTitleFs} truncated=${truncated.length} excerpt=${m.excerptVisible} lines=${m.excerptLines?.toFixed?.(2)} ` +
|
|
539
|
+
`alignΔ=${m.maxAlignDelta?.toFixed?.(2)} padΔ=${m.padDelta?.toFixed?.(2)}`
|
|
540
|
+
);
|
|
541
|
+
} else {
|
|
542
|
+
// Mobile: body stays hidden (icon strip), plate not +25% desk rule
|
|
543
|
+
if (m.bodyDisplay && m.bodyDisplay !== 'none') {
|
|
544
|
+
// On very narrow the stacked layout may still hide body — OK if none
|
|
545
|
+
errors.push(`${vp.name}: expected inventory body display none on phone, got ${m.bodyDisplay}`);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
await cdp.send('Target.closeTarget', { targetId });
|
|
551
|
+
ws.close();
|
|
552
|
+
} finally {
|
|
553
|
+
chrome.kill('SIGKILL');
|
|
554
|
+
server.close();
|
|
555
|
+
await rm(work, { recursive: true, force: true });
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (errors.length) {
|
|
559
|
+
console.error('FAIL test-home-desk-layout:\n' + errors.map((e) => ' - ' + e).join('\n'));
|
|
560
|
+
process.exit(1);
|
|
561
|
+
}
|
|
562
|
+
console.log('PASS test-home-desk-layout (PLT-AC-88/98/99/104/105/106 rendered)');
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
main().catch((err) => {
|
|
566
|
+
console.error('FAIL test-home-desk-layout:', err);
|
|
567
|
+
process.exit(1);
|
|
568
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# PLT-AC-88 / PLT-AC-98/99 / PLT-AC-104/105/106 — desk contents + icon/name center + gray wash + pad balance.
|
|
4
|
+
require "pathname"
|
|
5
|
+
require "open3"
|
|
6
|
+
|
|
7
|
+
ROOT = Pathname.new(__dir__).join("../..").expand_path
|
|
8
|
+
MJS = ROOT.join("scripts/test/test-home-desk-layout.mjs")
|
|
9
|
+
|
|
10
|
+
unless MJS.file?
|
|
11
|
+
warn "FAIL test-home-desk-layout: missing #{MJS}"
|
|
12
|
+
exit 1
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
stdout, stderr, status = Open3.capture3("node", MJS.to_s, chdir: ROOT.to_s)
|
|
16
|
+
if status.success?
|
|
17
|
+
puts stdout
|
|
18
|
+
else
|
|
19
|
+
warn "FAIL test-home-desk-layout:\n#{stdout}\n#{stderr}"
|
|
20
|
+
exit 1
|
|
21
|
+
end
|