@bivy/bivy 0.19.1 → 0.19.2-staging.2

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.
@@ -181,9 +181,12 @@ export async function takeShots(views, request, outDir, chrome = findChrome()) {
181
181
  }
182
182
  let scroll;
183
183
  if (request.scroll) {
184
- const { result } = await cdp.send("Runtime.evaluate", { expression: `scrollTo(${Number(request.scroll.x) || 0}, ${Number(request.scroll.y) || 0}); [scrollX, scrollY]`, returnByValue: true }, sessionId);
185
- scroll = { x: Number(result?.value?.[0]) || 0, y: Number(result?.value?.[1]) || 0 };
184
+ // Instant: a page's `scroll-behavior: smooth` would otherwise animate,
185
+ // so the position read (and the picture) would be mid-scroll.
186
+ await cdp.send("Runtime.evaluate", { expression: `scrollTo({left:${Number(request.scroll.x) || 0},top:${Number(request.scroll.y) || 0},behavior:'instant'})` }, sessionId);
186
187
  await new Promise((r) => setTimeout(r, 150));
188
+ const { result } = await cdp.send("Runtime.evaluate", { expression: "[scrollX, scrollY]", returnByValue: true }, sessionId);
189
+ scroll = { x: Number(result?.value?.[0]) || 0, y: Number(result?.value?.[1]) || 0 };
187
190
  }
188
191
  const { data } = await cdp.send("Page.captureScreenshot", { format: "png" }, sessionId);
189
192
  const file = path.join(outDir, `${entry.view.id.slice(0, 8)}-${width}-${theme}.png`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.19.1",
3
+ "version": "0.19.2-staging.2",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "Run coding agents on machines you own. Open-source, self-hostable agent workspace.",