@absolutejs/beacon 0.6.52 → 0.6.54

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/README.md CHANGED
@@ -125,13 +125,19 @@ beacon.captureMessage("checkout started", "info");
125
125
  scroll containers, and absolutely positioned escapees (badges, popovers,
126
126
  drawers) are skipped by design; mark deliberate
127
127
  bleeds with `data-beacon-overflow="allow"`.
128
+ Geometry scans pause while the mobile visual viewport is horizontally
129
+ shifted or zoomed, so iOS keyboard/pan coordinates are not mistaken for
130
+ document overflow.
128
131
  - **Control-collision signals** — the same settled scan reports interactive
129
132
  controls from separate layout groups whose border boxes overlap or render
130
133
  with effectively no spacing. Same-parent rows, semantic control groups,
131
134
  navigation, and positioned controls that merely touch are excluded so tabs,
132
135
  segmented controls, and floating actions remain quiet. Tune the near-touch
133
- threshold with `signals.controlCollisionGapPx`; intentional exceptions can
134
- use `data-beacon-scan="allow"`.
136
+ threshold with `signals.controlCollisionGapPx`. Mark nested controls that
137
+ intentionally meet with `data-beacon-control-group`; this suppresses only
138
+ near-touch reports, while true overlaps remain visible. Use
139
+ `data-beacon-scan="allow"` only when the whole subtree must be exempt from
140
+ every visual scan.
135
141
  - **Ambient watchdogs** — silent failures users abandon instead of reporting
136
142
  become warning issues: scroll jail (a leaked modal scroll lock), stuck
137
143
  loading (`aria-busy`/`role="progressbar"` that never resolves), occluded
@@ -196,7 +202,10 @@ beacon.captureMessage("checkout started", "info");
196
202
  interactions and separates input delay, handler time, and presentation delay.
197
203
  Overlapping long animation frames include their worst script when the browser
198
204
  exposes it; missing browser attribution is labeled explicitly. Layout
199
- Instability names shifted elements. Successful HTTP responses can be
205
+ Instability names shifted elements. When the browser supplies no shifted
206
+ node, Beacon retains startup/runtime phase plus recent interaction type,
207
+ target, and age; stable provenance separates issue grouping while volatile
208
+ age remains diagnostic-only. Successful HTTP responses can be
200
209
  classified through the host-owned `instrument.classifyResponse` callback for
201
210
  GraphQL-style errors. Selected HTTP 4xx/5xx responses can be promoted through
202
211
  the opt-in `instrument.classifyErrorResponse` callback when application context
package/dist/index.d.ts CHANGED
@@ -79,6 +79,9 @@ export type BeaconSignal = (typeof BEACON_SIGNAL)[keyof typeof BEACON_SIGNAL];
79
79
  export declare const BEACON_ATTRIBUTE: {
80
80
  /** Names an application root whose settled empty state is a failure. */
81
81
  readonly APP_ROOT: "data-beacon-app-root";
82
+ /** Groups controls whose intentional near-touching layout should not be
83
+ * reported as a collision. True border-box overlaps remain reportable. */
84
+ readonly CONTROL_GROUP: "data-beacon-control-group";
82
85
  readonly DEAD_CLICK: "data-beacon-dead-click";
83
86
  readonly NAME: "data-beacon-name";
84
87
  /** Names an iframe whose initial load should be watched for a stall. */
@@ -104,7 +107,7 @@ export declare const BEACON_ATTRIBUTE: {
104
107
  /** Response header used to correlate a browser signal with its server request. */
105
108
  export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
106
109
  /** Beacon package version retained with every captured event. */
107
- export declare const BEACON_SDK_VERSION = "0.6.52";
110
+ export declare const BEACON_SDK_VERSION = "0.6.54";
108
111
  /** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
109
112
  export type BeaconTags = Record<string, string> & {
110
113
  signal?: BeaconSignal;
package/dist/index.js CHANGED
@@ -63,6 +63,7 @@ var BEACON_SIGNAL = {
63
63
  };
64
64
  var BEACON_ATTRIBUTE = {
65
65
  APP_ROOT: "data-beacon-app-root",
66
+ CONTROL_GROUP: "data-beacon-control-group",
66
67
  DEAD_CLICK: "data-beacon-dead-click",
67
68
  NAME: "data-beacon-name",
68
69
  EMBED: "data-beacon-embed",
@@ -75,7 +76,7 @@ var BEACON_ATTRIBUTE = {
75
76
  THEME: "data-beacon-theme"
76
77
  };
77
78
  var BEACON_TRACE_HEADER = "x-absolute-trace-id";
78
- var BEACON_SDK_VERSION = "0.6.52";
79
+ var BEACON_SDK_VERSION = "0.6.54";
79
80
  var inBrowser = () => typeof window !== "undefined";
80
81
  var newId = () => {
81
82
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -493,6 +494,7 @@ var VOLATILE_SIGNAL_TAGS = new Set([
493
494
  "errorCount",
494
495
  "inputDelayMs",
495
496
  "interactionId",
497
+ "interactionAgeMs",
496
498
  "loadCount",
497
499
  "newestRelease",
498
500
  "obscuredPx",
@@ -798,6 +800,7 @@ var createBeacon = (options) => {
798
800
  const FORM_FRUSTRATION_THRESHOLD = 3;
799
801
  const FORM_FRUSTRATION_WINDOW_MS = 60000;
800
802
  const LAYOUT_SHIFT_RECENT_INTERACTION_MS = 500;
803
+ const LAYOUT_SHIFT_INTERACTION_PROVENANCE_MS = 1e4;
801
804
  const LAYOUT_SHIFT_VIEWPORT_RESIZE_SETTLE_MS = 500;
802
805
  const VIEWPORT_RESIZE_HISTORY_LIMIT = 8;
803
806
  const FORM_INVALID_BURST_GAP_MS = 100;
@@ -854,6 +857,14 @@ var createBeacon = (options) => {
854
857
  const visualViewport = window.visualViewport;
855
858
  return visualViewport !== undefined && visualViewport !== null && visualViewport.height > 0 && window.innerHeight > 0 && visualViewport.height < window.innerHeight * KEYBOARD_VIEWPORT_HEIGHT_RATIO_MAX && focusedEditable() !== null;
856
859
  };
860
+ const visualViewportHorizontallyShifted = () => {
861
+ const visualViewport = window.visualViewport;
862
+ if (visualViewport === undefined || visualViewport === null)
863
+ return false;
864
+ const layoutWidth = document.documentElement.clientWidth;
865
+ const tolerancePx = 2;
866
+ return Math.abs(visualViewport.offsetLeft) > tolerancePx || visualViewport.width > 0 && visualViewport.width < layoutWidth - tolerancePx || visualViewport.scale !== undefined && Math.abs(visualViewport.scale - 1) > 0.01;
867
+ };
857
868
  let overflowScanOnNavigation = null;
858
869
  let recordRequestForStorm = null;
859
870
  const OVERLAY_VIEWPORT_COVERAGE_MIN = 0.9;
@@ -2166,7 +2177,7 @@ var createBeacon = (options) => {
2166
2177
  visit(body, null);
2167
2178
  };
2168
2179
  const CONTROL_SELECTOR = 'a[href], button, input, select, textarea, [role="button"]';
2169
- const INTENTIONAL_CONTROL_GROUP_SELECTOR = 'nav, [role="group"], [role="menu"], [role="radiogroup"], [role="tablist"], [role="toolbar"]';
2180
+ const INTENTIONAL_CONTROL_GROUP_SELECTOR = `nav, [role="group"], [role="menu"], [role="radiogroup"], [role="tablist"], [role="toolbar"], [${BEACON_ATTRIBUTE.CONTROL_GROUP}]`;
2170
2181
  const clipsAxis = (overflow) => overflow === "auto" || overflow === "scroll" || overflow === "hidden" || overflow === "clip";
2171
2182
  const visibleControlRect = (control, rect, viewportWidth, viewportHeight) => {
2172
2183
  const visible = {
@@ -2683,7 +2694,7 @@ var createBeacon = (options) => {
2683
2694
  });
2684
2695
  };
2685
2696
  const runSettledScan = () => {
2686
- const geometryReady = documentStylesAreReady() && !mobileKeyboardViewportActive();
2697
+ const geometryReady = documentStylesAreReady() && !mobileKeyboardViewportActive() && !visualViewportHorizontallyShifted();
2687
2698
  if (detectOverflow && geometryReady)
2688
2699
  scanForOverflow();
2689
2700
  if (detectControlCollision && geometryReady)
@@ -2762,10 +2773,26 @@ var createBeacon = (options) => {
2762
2773
  continue;
2763
2774
  const targets = (entry.sources ?? []).map(({ node }) => node instanceof Element ? describeElement(node) : undefined).filter((target) => target !== undefined).slice(0, 5);
2764
2775
  const key = targets.join(",") || "unknown";
2765
- if (reported.has(key))
2776
+ const framePhase = entry.startTime < MAIN_THREAD_STALL_DEFAULT_WINDOW_MS ? "startup" : "runtime";
2777
+ const interactionProvenance = key === "unknown" && recentInteraction !== undefined && interactionAgeMs !== undefined && interactionAgeMs >= 0 && interactionAgeMs <= LAYOUT_SHIFT_INTERACTION_PROVENANCE_MS ? recentInteraction : undefined;
2778
+ const reportKey = key === "unknown" ? [
2779
+ key,
2780
+ framePhase,
2781
+ interactionProvenance?.type ?? "no-interaction",
2782
+ interactionProvenance?.target ?? "unknown"
2783
+ ].join("|") : key;
2784
+ if (reported.has(reportKey))
2766
2785
  continue;
2767
- reported.add(key);
2786
+ reported.add(reportKey);
2768
2787
  emitSignal(`Disruptive layout shift — ${key} — ${shortUrl(location.href)}`, {
2788
+ ...key === "unknown" ? {
2789
+ framePhase,
2790
+ ...interactionProvenance === undefined ? {} : {
2791
+ interactionAgeMs: String(Math.round(interactionAgeMs ?? 0)),
2792
+ interactionTarget: interactionProvenance.target,
2793
+ interactionType: interactionProvenance.type
2794
+ }
2795
+ } : {},
2769
2796
  shiftValue: String(entry.value ?? 0),
2770
2797
  signal: BEACON_SIGNAL.DISRUPTIVE_LAYOUT_SHIFT,
2771
2798
  target: key
@@ -4488,5 +4515,5 @@ export {
4488
4515
  BEACON_ATTRIBUTE
4489
4516
  };
4490
4517
 
4491
- //# debugId=33AAE862F88D371564756E2164756E21
4518
+ //# debugId=AF2331F2AE3F654164756E2164756E21
4492
4519
  //# sourceMappingURL=index.js.map