@absolutejs/beacon 0.7.0-beta.21 → 0.7.0-beta.23

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
@@ -6,6 +6,18 @@ This file is generated by `absolute-changelog` from the entries in
6
6
  `changelog/`. Edit an entry, not this file — and add new ones under
7
7
  `changelog/unreleased/`.
8
8
 
9
+ ## 0.7.0-beta.23 — 2026-10-28
10
+
11
+ ### Fixed
12
+
13
+ - **Require meaningful accumulated pixel scroll intent before reporting scroll jail, avoiding fractional trackpad inertia false positives while retaining blocked-scroll detection.** (`BEACON_SDK_VERSION`)
14
+
15
+ ## 0.7.0-beta.22 — 2026-10-27
16
+
17
+ ### Fixed
18
+
19
+ - **Reuse geometry and computed styles within each layout scan, reducing repeated DOM reads while preserving fresh measurements on subsequent scans.** (`createBeacon`, `BEACON_SDK_VERSION`)
20
+
9
21
  ## 0.7.0-beta.21 — 2026-10-27
10
22
 
11
23
  ### Fixed
package/changelog.json CHANGED
@@ -2,6 +2,33 @@
2
2
  "contract": 1,
3
3
  "name": "@absolutejs/beacon",
4
4
  "releases": [
5
+ {
6
+ "changes": [
7
+ {
8
+ "kind": "fixed",
9
+ "summary": "Require meaningful accumulated pixel scroll intent before reporting scroll jail, avoiding fractional trackpad inertia false positives while retaining blocked-scroll detection.",
10
+ "symbols": [
11
+ "BEACON_SDK_VERSION"
12
+ ]
13
+ }
14
+ ],
15
+ "date": "2026-10-28",
16
+ "version": "0.7.0-beta.23"
17
+ },
18
+ {
19
+ "changes": [
20
+ {
21
+ "kind": "fixed",
22
+ "summary": "Reuse geometry and computed styles within each layout scan, reducing repeated DOM reads while preserving fresh measurements on subsequent scans.",
23
+ "symbols": [
24
+ "createBeacon",
25
+ "BEACON_SDK_VERSION"
26
+ ]
27
+ }
28
+ ],
29
+ "date": "2026-10-27",
30
+ "version": "0.7.0-beta.22"
31
+ },
5
32
  {
6
33
  "changes": [
7
34
  {
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export type BeaconLevel = "fatal" | "error" | "warning" | "info";
25
25
  /** Response header used to correlate a browser signal with its server request. */
26
26
  export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
27
27
  /** Beacon package version retained with every captured event. */
28
- export declare const BEACON_SDK_VERSION = "0.7.0-beta.21";
28
+ export declare const BEACON_SDK_VERSION = "0.7.0-beta.23";
29
29
  /** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
30
30
  export type BeaconTags = Record<string, string> & {
31
31
  signal?: BeaconSignal;
package/dist/index.js CHANGED
@@ -192,7 +192,7 @@ var consumeEarlyLayoutShiftBuffer = () => {
192
192
 
193
193
  // src/index.ts
194
194
  var BEACON_TRACE_HEADER = "x-absolute-trace-id";
195
- var BEACON_SDK_VERSION = "0.7.0-beta.21";
195
+ var BEACON_SDK_VERSION = "0.7.0-beta.23";
196
196
  var inBrowser = () => typeof window !== "undefined";
197
197
  var newId = () => {
198
198
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -971,6 +971,7 @@ var createBeacon = (options) => {
971
971
  const FONT_FAILURE_CONFIRM_DEFAULT_MS = 5000;
972
972
  const KEYBOARD_VIEWPORT_HEIGHT_RATIO_MAX = 0.8;
973
973
  const SCROLL_JAIL_EVENT_COUNT = 8;
974
+ const SCROLL_JAIL_MIN_PIXEL_INTENT = 16;
974
975
  const SCROLL_JAIL_WINDOW_MS = 2000;
975
976
  const SCROLL_JAIL_SETTLE_MS = 500;
976
977
  const SCROLL_JAIL_BOUNDARY_TOLERANCE_PX = 2;
@@ -2255,6 +2256,23 @@ var createBeacon = (options) => {
2255
2256
  });
2256
2257
  }
2257
2258
  if (signals !== null && typeof document !== "undefined" && typeof window.getComputedStyle === "function") {
2259
+ let scanReads = null;
2260
+ const scanStyle = (element) => {
2261
+ const cached = scanReads?.styles.get(element);
2262
+ if (cached)
2263
+ return cached;
2264
+ const style = window.getComputedStyle(element);
2265
+ scanReads?.styles.set(element, style);
2266
+ return style;
2267
+ };
2268
+ const scanRect = (element) => {
2269
+ const cached = scanReads?.rects.get(element);
2270
+ if (cached)
2271
+ return cached;
2272
+ const rect = element.getBoundingClientRect();
2273
+ scanReads?.rects.set(element, rect);
2274
+ return rect;
2275
+ };
2258
2276
  const detectOverflow = signals.layoutOverflows !== false;
2259
2277
  const detectOcclusion = signals.occludedControls !== false;
2260
2278
  const detectControlCollision = signals.controlCollisions !== false;
@@ -2293,7 +2311,7 @@ var createBeacon = (options) => {
2293
2311
  if (current.hasAttribute("hidden") || current.hasAttribute("inert") || current.getAttribute("aria-hidden") === "true") {
2294
2312
  return true;
2295
2313
  }
2296
- const style = window.getComputedStyle(current);
2314
+ const style = scanStyle(current);
2297
2315
  if (style.display === "none" || style.visibility === "hidden" || style.visibility === "collapse" || Number.parseFloat(style.opacity || "1") <= 0.01 || requirePointerEvents && style.pointerEvents === "none") {
2298
2316
  return true;
2299
2317
  }
@@ -2329,7 +2347,7 @@ var createBeacon = (options) => {
2329
2347
  return;
2330
2348
  seenOverflows.add(key);
2331
2349
  overflowReports += 1;
2332
- const rect = element.getBoundingClientRect();
2350
+ const rect = scanRect(element);
2333
2351
  const resourceUrl = RESOURCE_ERROR_TAGS.has(element.tagName.toLowerCase()) ? resourceUrlOf(element) : undefined;
2334
2352
  const injectionMarkers = injectionMarkersOf(element);
2335
2353
  emitSignal(`Layout overflow — ${describeElement(element)} ${detail} — ${shortUrl(location.href)} [${bucket}]`, {
@@ -2341,7 +2359,7 @@ var createBeacon = (options) => {
2341
2359
  targetBottomPx: String(Math.round(rect.bottom)),
2342
2360
  targetHeightPx: String(Math.round(rect.height)),
2343
2361
  targetLeftPx: String(Math.round(rect.left)),
2344
- targetPosition: window.getComputedStyle(element).position,
2362
+ targetPosition: scanStyle(element).position,
2345
2363
  targetRightPx: String(Math.round(rect.right)),
2346
2364
  targetTopPx: String(Math.round(rect.top)),
2347
2365
  targetWidthPx: String(Math.round(rect.width)),
@@ -2364,10 +2382,10 @@ var createBeacon = (options) => {
2364
2382
  if (RESOURCE_ERROR_TAGS.has(element.tagName.toLowerCase()) && isExtensionResourceUrl(resourceUrlOf(element))) {
2365
2383
  return;
2366
2384
  }
2367
- const style = window.getComputedStyle(element);
2385
+ const style = scanStyle(element);
2368
2386
  if (hasHiddenAncestor(element))
2369
2387
  return;
2370
- const rect = element.getBoundingClientRect();
2388
+ const rect = scanRect(element);
2371
2389
  if (rect.width === 0 && rect.height === 0)
2372
2390
  return;
2373
2391
  if (rect.width <= 2 && rect.height <= 2 && (style.overflowX === "hidden" || style.overflowX === "clip" || style.overflowY === "hidden" || style.overflowY === "clip")) {
@@ -2421,12 +2439,12 @@ var createBeacon = (options) => {
2421
2439
  top: Math.max(rect.top, 0)
2422
2440
  };
2423
2441
  for (let ancestor = control.parentElement;ancestor; ancestor = ancestor.parentElement) {
2424
- const style = window.getComputedStyle(ancestor);
2442
+ const style = scanStyle(ancestor);
2425
2443
  const clipX = clipsAxis(style.overflowX);
2426
2444
  const clipY = clipsAxis(style.overflowY);
2427
2445
  if (!clipX && !clipY)
2428
2446
  continue;
2429
- const ancestorRect = ancestor.getBoundingClientRect();
2447
+ const ancestorRect = scanRect(ancestor);
2430
2448
  if (clipX) {
2431
2449
  visible.left = Math.max(visible.left, ancestorRect.left);
2432
2450
  visible.right = Math.min(visible.right, ancestorRect.right);
@@ -2469,9 +2487,9 @@ var createBeacon = (options) => {
2469
2487
  };
2470
2488
  const scanLayoutContext = (target, other) => {
2471
2489
  const geometry = (element) => {
2472
- const rect = element.getBoundingClientRect();
2490
+ const rect = scanRect(element);
2473
2491
  let positionedAncestor = element;
2474
- while (positionedAncestor !== null && !["fixed", "sticky"].includes(window.getComputedStyle(positionedAncestor).position)) {
2492
+ while (positionedAncestor !== null && !["fixed", "sticky"].includes(scanStyle(positionedAncestor).position)) {
2475
2493
  positionedAncestor = positionedAncestor.parentElement;
2476
2494
  }
2477
2495
  return {
@@ -2483,10 +2501,10 @@ var createBeacon = (options) => {
2483
2501
  width: rect.width,
2484
2502
  height: rect.height
2485
2503
  },
2486
- position: window.getComputedStyle(element).position,
2504
+ position: scanStyle(element).position,
2487
2505
  ...positionedAncestor ? {
2488
2506
  positionedAncestor: describeElement(positionedAncestor),
2489
- ancestorPosition: window.getComputedStyle(positionedAncestor).position
2507
+ ancestorPosition: scanStyle(positionedAncestor).position
2490
2508
  } : {}
2491
2509
  };
2492
2510
  };
@@ -2508,13 +2526,13 @@ var createBeacon = (options) => {
2508
2526
  break;
2509
2527
  if (isScanExempt(element) || hasHiddenAncestor(element, true))
2510
2528
  continue;
2511
- const rect = element.getBoundingClientRect();
2529
+ const rect = scanRect(element);
2512
2530
  if (rect.width === 0 || rect.height === 0)
2513
2531
  continue;
2514
2532
  const visible = visibleControlRect(element, rect, viewportWidth, viewportHeight);
2515
2533
  if (visible === null)
2516
2534
  continue;
2517
- const position = window.getComputedStyle(element).position;
2535
+ const position = scanStyle(element).position;
2518
2536
  controls.push({
2519
2537
  element,
2520
2538
  positioned: position === "absolute" || position === "fixed",
@@ -2587,7 +2605,7 @@ var createBeacon = (options) => {
2587
2605
  return;
2588
2606
  if (isScanExempt(control) || hasHiddenAncestor(control, true))
2589
2607
  continue;
2590
- const rect = control.getBoundingClientRect();
2608
+ const rect = scanRect(control);
2591
2609
  if (rect.width === 0 || rect.height === 0)
2592
2610
  continue;
2593
2611
  const visibleRect = visibleControlRect(control, rect, viewportWidth, viewportHeight);
@@ -2598,7 +2616,7 @@ var createBeacon = (options) => {
2598
2616
  if (top === null || top === control || control.contains(top) || top.contains(control) || crossesDialogBoundary(control, top) || isExtensionOwnedCover(top)) {
2599
2617
  continue;
2600
2618
  }
2601
- const topRect = top.getBoundingClientRect();
2619
+ const topRect = scanRect(top);
2602
2620
  const overlapX = Math.min(visibleRect.right, topRect.right) - Math.max(visibleRect.left, topRect.left);
2603
2621
  const overlapY = Math.min(visibleRect.bottom, topRect.bottom) - Math.max(visibleRect.top, topRect.top);
2604
2622
  const coverage = Math.max(overlapX, 0) * Math.max(overlapY, 0) / ((visibleRect.right - visibleRect.left) * (visibleRect.bottom - visibleRect.top));
@@ -2712,7 +2730,7 @@ var createBeacon = (options) => {
2712
2730
  let accumulated = null;
2713
2731
  let node = element;
2714
2732
  while (node !== null) {
2715
- const style = window.getComputedStyle(node);
2733
+ const style = scanStyle(node);
2716
2734
  if (style.backgroundImage !== "none" && style.backgroundImage !== "") {
2717
2735
  return null;
2718
2736
  }
@@ -2745,13 +2763,13 @@ var createBeacon = (options) => {
2745
2763
  continue;
2746
2764
  if ((element.textContent ?? "").trim() === "")
2747
2765
  continue;
2748
- const rect = element.getBoundingClientRect();
2766
+ const rect = scanRect(element);
2749
2767
  if (rect.width === 0 || rect.height === 0)
2750
2768
  continue;
2751
2769
  if (rect.bottom < 0 || rect.top > viewportHeight || rect.right < 0 || rect.left > viewportWidth) {
2752
2770
  continue;
2753
2771
  }
2754
- const style = window.getComputedStyle(element);
2772
+ const style = scanStyle(element);
2755
2773
  if (Number(style.opacity || "1") < 0.1)
2756
2774
  continue;
2757
2775
  const foreground = parseColor(style.color);
@@ -2781,7 +2799,7 @@ var createBeacon = (options) => {
2781
2799
  };
2782
2800
  const activeTheme = () => {
2783
2801
  const root = document.documentElement;
2784
- const declared = window.getComputedStyle(root).colorScheme.trim();
2802
+ const declared = scanStyle(root).colorScheme.trim();
2785
2803
  if (declared === "dark")
2786
2804
  return "dark";
2787
2805
  if (declared === "light")
@@ -2809,7 +2827,7 @@ var createBeacon = (options) => {
2809
2827
  if (element.closest(`[${BEACON_ATTRIBUTE.THEME}="allow"]`) !== null || isScanExempt(element) || element.matches("canvas, iframe, img, picture, svg, video")) {
2810
2828
  continue;
2811
2829
  }
2812
- const rect = element.getBoundingClientRect();
2830
+ const rect = scanRect(element);
2813
2831
  const minimumArea = element.matches(CONTROL_SELECTOR) ? themeMismatchControlMinArea : themeMismatchMinArea;
2814
2832
  if (rect.width * rect.height < minimumArea)
2815
2833
  continue;
@@ -2819,7 +2837,7 @@ var createBeacon = (options) => {
2819
2837
  const hasContent = (element.textContent ?? "").trim() !== "" || element.querySelector("button, input, select, textarea, [role=button]") !== null;
2820
2838
  if (!hasContent)
2821
2839
  continue;
2822
- const style = window.getComputedStyle(element);
2840
+ const style = scanStyle(element);
2823
2841
  if (style.display === "none" || style.visibility === "hidden" || style.backgroundImage !== "none" && style.backgroundImage !== "") {
2824
2842
  continue;
2825
2843
  }
@@ -2903,7 +2921,7 @@ var createBeacon = (options) => {
2903
2921
  resetLoadingIndicator(indicator);
2904
2922
  continue;
2905
2923
  }
2906
- const rect = indicator.getBoundingClientRect();
2924
+ const rect = scanRect(indicator);
2907
2925
  if (rect.width === 0 && rect.height === 0) {
2908
2926
  resetLoadingIndicator(indicator);
2909
2927
  continue;
@@ -2935,7 +2953,7 @@ var createBeacon = (options) => {
2935
2953
  for (const root of Array.from(roots)) {
2936
2954
  if (isScanExempt(root))
2937
2955
  continue;
2938
- const rect = root.getBoundingClientRect();
2956
+ const rect = scanRect(root);
2939
2957
  if (rect.width === 0 || rect.height === 0)
2940
2958
  continue;
2941
2959
  const text = (root.textContent ?? "").trim();
@@ -2967,23 +2985,28 @@ var createBeacon = (options) => {
2967
2985
  ];
2968
2986
  return utilityExpectations.every(([selector, property, expected]) => {
2969
2987
  const sample = document.querySelector(selector);
2970
- return sample === null || window.getComputedStyle(sample)[property] === expected;
2988
+ return sample === null || scanStyle(sample)[property] === expected;
2971
2989
  });
2972
2990
  };
2973
2991
  const runSettledScan = () => {
2974
- const geometryReady = documentStylesAreReady() && !mobileKeyboardViewportActive() && !visualViewportHorizontallyShifted();
2975
- if (detectOverflow && geometryReady)
2976
- scanForOverflow();
2977
- if (detectControlCollision && geometryReady)
2978
- scanForControlCollisions();
2979
- if (detectOcclusion && geometryReady)
2980
- scanForOcclusion();
2981
- if (detectInvisibleText && geometryReady)
2982
- scanForInvisibleText();
2983
- if (detectThemeMismatch && geometryReady)
2984
- scanForThemeMismatch();
2985
- if (detectStuckLoading)
2986
- checkStuckLoading();
2992
+ scanReads = { styles: new WeakMap, rects: new WeakMap };
2993
+ try {
2994
+ const geometryReady = documentStylesAreReady() && !mobileKeyboardViewportActive() && !visualViewportHorizontallyShifted();
2995
+ if (detectOverflow && geometryReady)
2996
+ scanForOverflow();
2997
+ if (detectControlCollision && geometryReady)
2998
+ scanForControlCollisions();
2999
+ if (detectOcclusion && geometryReady)
3000
+ scanForOcclusion();
3001
+ if (detectInvisibleText && geometryReady)
3002
+ scanForInvisibleText();
3003
+ if (detectThemeMismatch && geometryReady)
3004
+ scanForThemeMismatch();
3005
+ if (detectStuckLoading)
3006
+ checkStuckLoading();
3007
+ } finally {
3008
+ scanReads = null;
3009
+ }
2987
3010
  };
2988
3011
  const scheduleOverflowScan = () => {
2989
3012
  if (overflowTimer !== undefined)
@@ -3714,6 +3737,10 @@ var createBeacon = (options) => {
3714
3737
  jailBurst = [];
3715
3738
  if (confirmedBurst.length < SCROLL_JAIL_EVENT_COUNT)
3716
3739
  return;
3740
+ const pixelBurst = confirmedBurst.every(({ event }) => event.deltaMode === undefined || event.deltaMode === 0);
3741
+ const requestedPixels = confirmedBurst.reduce((sum, { event }) => sum + event.deltaY, 0);
3742
+ if (pixelBurst && Math.abs(requestedPixels) < SCROLL_JAIL_MIN_PIXEL_INTENT)
3743
+ return;
3717
3744
  if (scrollActivityGeneration !== jailStartingScrollGeneration)
3718
3745
  return;
3719
3746
  if (!scroller.isConnected || scroller.scrollTop !== startingPosition)
@@ -3733,6 +3760,7 @@ var createBeacon = (options) => {
3733
3760
  scroller: descriptor,
3734
3761
  direction: scrollingDown ? "down" : "up",
3735
3762
  wheelCount: confirmedBurst.length,
3763
+ requestedPixels: pixelBurst ? requestedPixels : undefined,
3736
3764
  deltaX: event.deltaX,
3737
3765
  deltaY: event.deltaY,
3738
3766
  deltaMode: event.deltaMode,
@@ -5044,5 +5072,5 @@ export {
5044
5072
  redactBeaconEvent
5045
5073
  };
5046
5074
 
5047
- //# debugId=046F53651A60FDAB64756E2164756E21
5075
+ //# debugId=B14B49B1244463DE64756E2164756E21
5048
5076
  //# sourceMappingURL=index.js.map