tuffgal 0.1.0-alpha.13 → 0.1.0-alpha.14

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/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ this project uses [Pride Versioning](https://pridever.org) → `PROUD.DEFAULT.SH
8
8
 
9
9
  _Nothing just yet_
10
10
 
11
+ ## [0.1.0-alpha.14] — 2026-07-04
12
+
13
+ ### Fixed
14
+
15
+ A `viewport` capture no longer resets the page's scroll offset before shooting.
16
+
11
17
  ## [0.1.0-alpha.13] — 2026-06-30
12
18
 
13
19
  ### Changed
@@ -187,7 +193,8 @@ styling or interactivity.
187
193
  Initial public alpha. Tuffgal extracted from [Linklater](https://github.com/nschneble/linklater)'s
188
194
  in-tree visual testing workspace.
189
195
 
190
- [Unreleased]: https://github.com/nschneble/tuffgal/compare/v0.1.0-alpha.13...HEAD
196
+ [Unreleased]: https://github.com/nschneble/tuffgal/compare/v0.1.0-alpha.14...HEAD
197
+ [0.1.0-alpha.14]: https://github.com/nschneble/tuffgal/releases/tag/v0.1.0-alpha.14
191
198
  [0.1.0-alpha.13]: https://github.com/nschneble/tuffgal/releases/tag/v0.1.0-alpha.13
192
199
  [0.1.0-alpha.12]: https://github.com/nschneble/tuffgal/releases/tag/v0.1.0-alpha.12
193
200
  [0.1.0-alpha.11]: https://github.com/nschneble/tuffgal/releases/tag/v0.1.0-alpha.11
@@ -1 +1 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/screenshots/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,KAAK,GAAE,OAAO,EAAO,EACrB,IAAI,GAAE,WAAwB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAsBjB"}
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/screenshots/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,KAAK,GAAE,OAAO,EAAO,EACrB,IAAI,GAAE,WAAwB,GAC7B,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
@@ -9,19 +9,27 @@
9
9
  * composites the entire scrollable document however tall.
10
10
  */
11
11
  export async function capturePage(page, masks = [], mode = 'viewport') {
12
- // Both capture modes shoot at the page's current scroll offset.
13
- // `position: sticky` / `fixed` elements resolve their offset against that
14
- // scroll position, so a page captured mid-scroll renders its sticky chrome
15
- // (sidebars, headers) shifted down by `scrollY` — the same UI produces a
16
- // different image purely because an earlier step left the viewport scrolled.
17
- // (`fullPage` composites the whole document but inherits the same offset.)
18
- // Resetting to the origin first
19
- // pins those elements to their static-baseline position so the capture is
20
- // deterministic. `instant` defeats any `scroll-behavior: smooth` the page
21
- // sets, which would otherwise animate and reintroduce a timing race.
22
- // String form so the snippet runs in the page (DOM) context without
23
- // pulling the DOM lib into this Node-side module's type environment.
24
- await page.evaluate(`window.scrollTo({ top: 0, left: 0, behavior: 'instant' })`);
12
+ // `fullPage` composites the whole scrollable document into one image. When
13
+ // the document is captured at a non-zero offset, `position: sticky` / `fixed`
14
+ // chrome (sidebars, headers) resolves against that scroll position and lands
15
+ // shifted down by `scrollY` in the stitch — the same UI produces a different
16
+ // image purely because an earlier step left the viewport scrolled. Resetting
17
+ // to the origin first pins those elements to their static-baseline position
18
+ // so the capture is deterministic. `instant` defeats any `scroll-behavior:
19
+ // smooth` the page sets, which would otherwise animate and reintroduce a
20
+ // timing race.
21
+ //
22
+ // A `viewport` shot captures exactly the box the flow scrolled to, so it must
23
+ // NOT reset — a story that scrolls to a below-the-fold section (a Settings
24
+ // panel, a success banner) would otherwise capture the top of the page
25
+ // instead of the region it navigated to. The flow lands at a deterministic
26
+ // offset, so the viewport shot is deterministic without any reset.
27
+ //
28
+ // String form so the snippet runs in the page (DOM) context without pulling
29
+ // the DOM lib into this Node-side module's type environment.
30
+ if (mode === 'fullPage') {
31
+ await page.evaluate(`window.scrollTo({ top: 0, left: 0, behavior: 'instant' })`);
32
+ }
25
33
  return page.screenshot({
26
34
  fullPage: mode === 'fullPage',
27
35
  animations: 'disabled',
@@ -1 +1 @@
1
- {"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/screenshots/capture.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAU,EACV,QAAmB,EAAE,EACrB,OAAoB,UAAU;IAE9B,gEAAgE;IAChE,0EAA0E;IAC1E,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,2EAA2E;IAC3E,gCAAgC;IAChC,0EAA0E;IAC1E,0EAA0E;IAC1E,qEAAqE;IACrE,oEAAoE;IACpE,qEAAqE;IACrE,MAAM,IAAI,CAAC,QAAQ,CACjB,2DAA2D,CAC5D,CAAC;IACF,OAAO,IAAI,CAAC,UAAU,CAAC;QACrB,QAAQ,EAAE,IAAI,KAAK,UAAU;QAC7B,UAAU,EAAE,UAAU;QACtB,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/screenshots/capture.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAU,EACV,QAAmB,EAAE,EACrB,OAAoB,UAAU;IAE9B,2EAA2E;IAC3E,8EAA8E;IAC9E,6EAA6E;IAC7E,6EAA6E;IAC7E,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,yEAAyE;IACzE,eAAe;IACf,EAAE;IACF,8EAA8E;IAC9E,2EAA2E;IAC3E,uEAAuE;IACvE,2EAA2E;IAC3E,mEAAmE;IACnE,EAAE;IACF,4EAA4E;IAC5E,6DAA6D;IAC7D,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,MAAM,IAAI,CAAC,QAAQ,CACjB,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC;QACrB,QAAQ,EAAE,IAAI,KAAK,UAAU;QAC7B,UAAU,EAAE,UAAU;QACtB,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuffgal",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.14",
4
4
  "description": "JSON-driven visual regression for web apps.",
5
5
  "license": "MIT",
6
6
  "author": "Nick Schneble",