stitch2 0.15.0 → 0.15.1
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.
- package/dist/canvas.html +5 -1
- package/dist/check.js +3 -1
- package/package.json +1 -1
package/dist/canvas.html
CHANGED
|
@@ -483,11 +483,15 @@ function zoomTo(f) {
|
|
|
483
483
|
apply()
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
+
/** The tallest a frame is drawn, in CSS px (the same limit as check's renders). */
|
|
487
|
+
const MAX_FRAME_HEIGHT = 20000
|
|
488
|
+
|
|
486
489
|
function measure(f) {
|
|
487
490
|
try {
|
|
488
491
|
const doc = f.iframe.contentDocument
|
|
489
492
|
const min = bigFrame(f.screen) ? 800 : 844
|
|
490
|
-
|
|
493
|
+
// As tall as the page, up to MAX_FRAME_HEIGHT: long landing pages are drawn whole.
|
|
494
|
+
const h = Math.min(MAX_FRAME_HEIGHT, Math.max(min, doc.documentElement.scrollHeight, doc.body?.scrollHeight ?? 0))
|
|
491
495
|
if (Math.abs(h - f.height) > 2) {
|
|
492
496
|
f.height = h
|
|
493
497
|
f.iframe.style.height = `${h}px`
|
package/dist/check.js
CHANGED
|
@@ -36,6 +36,8 @@ const levels = typeLevels();
|
|
|
36
36
|
const themes = designThemes();
|
|
37
37
|
const collect = collectOptions();
|
|
38
38
|
const server = await startServer(0);
|
|
39
|
+
/** The tallest render, in CSS px: a long landing page is shot whole (the canvas draws frames up to the same height). */
|
|
40
|
+
const MAX_RENDER_HEIGHT = 20000;
|
|
39
41
|
const browser = await chromium.launch();
|
|
40
42
|
const page = await browser.newPage({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2 });
|
|
41
43
|
const results = {};
|
|
@@ -150,7 +152,7 @@ async function setTheme(theme) {
|
|
|
150
152
|
/** A page-tall render; renders in another theme or language than the screen's own get a --<theme> suffix. */
|
|
151
153
|
async function shoot(s, theme, locale, at) {
|
|
152
154
|
const height = await page.evaluate(() => document.documentElement.scrollHeight);
|
|
153
|
-
await page.setViewportSize({ width: s.width, height: Math.max(844, Math.min(height,
|
|
155
|
+
await page.setViewportSize({ width: s.width, height: Math.max(844, Math.min(height, MAX_RENDER_HEIGHT)) });
|
|
154
156
|
mkdirSync(join(ROOT, 'renders'), { recursive: true });
|
|
155
157
|
const suffix = theme ?? locale ?? at;
|
|
156
158
|
const name = s.path.replaceAll('/', '__').replace(/\.html$/, suffix ? `--${suffix}.png` : '.png');
|
package/package.json
CHANGED