Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/probe_stage.mjs

1.7 KiB, 1 run

created by r2519314175:85, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1// probe_stage.mjs — a look at the stage while it is being built. Not a verifier.
2import { open } from './harness.mjs';
3
4const s = await open({ name: 'stageprobe', connect: false });
5const p = s.page;
6
7const geom = () => p.evaluate(() => {
8 const st = document.getElementById('stage');
9 const kids = [...st.children].filter((k) => k.getClientRects().length);
10 return {
11 stage: Math.round(st.getBoundingClientRect().width),
12 max: DaimondPanels.model().stageMax,
13 order: kids.map((k) => (k.dataset.panel || k.className) + ':'
14 + Math.round(k.getBoundingClientRect().width)),
15 open: DaimondPanels.panels().filter((x) => x.zone === 'stage')
16 .filter((x) => DaimondPanels.isOpen(x.id)).map((x) => x.id),
17 };
18});
19
20for (const w of [2400, 1900, 1500, 1100]) {
21 await p.setViewportSize({ width: w, height: 950 });
22 await p.waitForTimeout(500);
23 await p.evaluate(() => { ['web', 'doc', 'msg'].forEach((x) => DaimondPanels.show(x)); });
24 await p.waitForTimeout(600);
25 console.log(w, JSON.stringify(await geom()));
26}
27// Now narrow with everything open.
28await p.setViewportSize({ width: 2400, height: 950 });
29await p.waitForTimeout(400);
30await p.evaluate(() => { ['web', 'doc', 'msg'].forEach((x) => DaimondPanels.show(x)); });
31await p.waitForTimeout(500);
32console.log('wide again', JSON.stringify(await geom()));
33for (const w of [1800, 1400, 1000]) {
34 await p.setViewportSize({ width: w, height: 950 });
35 await p.waitForTimeout(600);
36 console.log('narrowed to', w, JSON.stringify(await geom()));
37}
38await p.setViewportSize({ width: 2400, height: 950 });
39await p.waitForTimeout(600);
40console.log('widened back', JSON.stringify(await geom()));
41
42console.log('errors:', s.errs.slice(0, 5));
43await s.close();