@decocms/parity 0.33.35 → 0.33.36

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.
Files changed (2) hide show
  1. package/dist/cli.js +46 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -38429,7 +38429,7 @@ var CAROUSEL_STABILIZER_INIT_SCRIPT = `
38429
38429
  * so the harness can log how many were stabilized.
38430
38430
  */
38431
38431
  window.__parityStabilizeCarousels = function () {
38432
- var counts = { swiper: 0, splide: 0, slick: 0, keenSlider: 0, generic: 0 };
38432
+ var counts = { swiper: 0, splide: 0, slick: 0, keenSlider: 0, generic: 0, animations: 0, media: 0 };
38433
38433
 
38434
38434
  // 1. Swiper — most common in Deco sites. Two ways to find instances:
38435
38435
  // - element.swiper (newer versions)
@@ -38506,7 +38506,46 @@ var CAROUSEL_STABILIZER_INIT_SCRIPT = `
38506
38506
  }
38507
38507
  } catch (_) {}
38508
38508
 
38509
- // 6. Set the freeze flag so future auto-advance ticks bail out (libs
38509
+ // 6. Web Animations API — everything above is library-specific or
38510
+ // setInterval-driven, and neither reaches an animation started with
38511
+ // element.animate() or a CSS animation whose currentTime the page
38512
+ // drives. That is most modern scroll effects and a good share of
38513
+ // hand-rolled carousels: they slip through 1-5 entirely and land in a
38514
+ // different frame on each capture.
38515
+ //
38516
+ // Pinning to 0 rather than just pausing, so two captures of the same
38517
+ // page agree on WHICH frame, not merely that it stopped moving.
38518
+ // Infinite animations report a null/Infinity duration, so currentTime
38519
+ // is set before the pause and failures are per-animation.
38520
+ try {
38521
+ if (typeof document.getAnimations === 'function') {
38522
+ var anims = document.getAnimations();
38523
+ for (var a = 0; a < anims.length; a++) {
38524
+ try {
38525
+ anims[a].currentTime = 0;
38526
+ anims[a].pause();
38527
+ counts.animations++;
38528
+ } catch (_) {}
38529
+ }
38530
+ }
38531
+ } catch (_) {}
38532
+
38533
+ // 7. Media elements. A <video> with autoplay is a slideshow by another
38534
+ // name, and the screenshot's animations:disabled does not touch it.
38535
+ // Seek to 0 for the same reason as above.
38536
+ try {
38537
+ var media = document.querySelectorAll('video, audio');
38538
+ for (var m = 0; m < media.length; m++) {
38539
+ try {
38540
+ media[m].pause();
38541
+ if (media[m].currentTime > 0) media[m].currentTime = 0;
38542
+ media[m].autoplay = false;
38543
+ counts.media++;
38544
+ } catch (_) {}
38545
+ }
38546
+ } catch (_) {}
38547
+
38548
+ // 8. Set the freeze flag so future auto-advance ticks bail out (libs
38510
38549
  // that check this flag before mutating slide index).
38511
38550
  window.__parityCarouselStop = true;
38512
38551
  return counts;
@@ -38520,6 +38559,8 @@ async function stabilizeCarousels(page) {
38520
38559
  slick: 0,
38521
38560
  keenSlider: 0,
38522
38561
  generic: 0,
38562
+ animations: 0,
38563
+ media: 0,
38523
38564
  total: 0
38524
38565
  };
38525
38566
  try {
@@ -38529,7 +38570,7 @@ async function stabilizeCarousels(page) {
38529
38570
  });
38530
38571
  if (!counts)
38531
38572
  return empty;
38532
- const total = (counts.swiper ?? 0) + (counts.splide ?? 0) + (counts.slick ?? 0) + (counts.keenSlider ?? 0) + (counts.generic ?? 0);
38573
+ const total = (counts.swiper ?? 0) + (counts.splide ?? 0) + (counts.slick ?? 0) + (counts.keenSlider ?? 0) + (counts.generic ?? 0) + (counts.animations ?? 0) + (counts.media ?? 0);
38533
38574
  if (total > 0) {
38534
38575
  await page.waitForTimeout(150);
38535
38576
  }
@@ -38539,6 +38580,8 @@ async function stabilizeCarousels(page) {
38539
38580
  slick: counts.slick ?? 0,
38540
38581
  keenSlider: counts.keenSlider ?? 0,
38541
38582
  generic: counts.generic ?? 0,
38583
+ animations: counts.animations ?? 0,
38584
+ media: counts.media ?? 0,
38542
38585
  total
38543
38586
  };
38544
38587
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.33.35",
3
+ "version": "0.33.36",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",