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. |
| 2 | import { open } from './harness.mjs'; |
| 3 | |
| 4 | const s = await open({ name: 'stageprobe', connect: false }); |
| 5 | const p = s.page; |
| 6 | |
| 7 | const 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 | |
| 20 | for (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. |
| 28 | await p.setViewportSize({ width: 2400, height: 950 }); |
| 29 | await p.waitForTimeout(400); |
| 30 | await p.evaluate(() => { ['web', 'doc', 'msg'].forEach((x) => DaimondPanels.show(x)); }); |
| 31 | await p.waitForTimeout(500); |
| 32 | console.log('wide again', JSON.stringify(await geom())); |
| 33 | for (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 | } |
| 38 | await p.setViewportSize({ width: 2400, height: 950 }); |
| 39 | await p.waitForTimeout(600); |
| 40 | console.log('widened back', JSON.stringify(await geom())); |
| 41 | |
| 42 | console.log('errors:', s.errs.slice(0, 5)); |
| 43 | await s.close(); |