@absolutejs/beacon 0.6.55 → 0.6.56

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
@@ -146,7 +146,8 @@ beacon.captureMessage("checkout started", "info");
146
146
  stalled `EventSource` streams, WebSocket connect/close flapping, request
147
147
  storms (one endpoint hammered in seconds), reload loops, stale releases (a
148
148
  service worker serving a build older than one this browser already ran),
149
- font-face load failures, focus dropped to `<body>` when a dialog unmounts,
149
+ required font-face load failures (excluding intentional optional fallback),
150
+ focus dropped to `<body>` when a dialog unmounts,
150
151
  focus escaping or never entering an explicit modal, browser interventions,
151
152
  enforced CSP violations, repeated visible-page main-thread stalls, and form
152
153
  frustration (identical resubmits / repeated native-validation failures).
package/dist/index.js CHANGED
@@ -4137,7 +4137,8 @@ var createBeacon = (options) => {
4137
4137
  const reportedFonts = new Set;
4138
4138
  const checkingFonts = new Set;
4139
4139
  const confirmationMs = Math.max(0, signals.fontFailureConfirmMs ?? FONT_FAILURE_CONFIRM_DEFAULT_MS);
4140
- const normalizedFamily = (family) => family.trim().replace(/^(['"])(.*)\1$/u, "$2").toLowerCase();
4140
+ const canonicalFontFamily = (family) => family.trim().replace(/^(['"])(.*)\1$/u, "$2");
4141
+ const normalizedFamily = (family) => canonicalFontFamily(family).toLowerCase();
4141
4142
  const isRendered = (element) => {
4142
4143
  for (let current = element;current !== null; current = current.parentElement) {
4143
4144
  const style = window.getComputedStyle(current);
@@ -4161,9 +4162,10 @@ var createBeacon = (options) => {
4161
4162
  return null;
4162
4163
  };
4163
4164
  const reportFontFailure = (face, element, key) => {
4165
+ const family = canonicalFontFamily(face.family);
4164
4166
  reportedFonts.add(key);
4165
- emitSignal(`Font failure — ${face.family} failed to load — ${shortUrl(location.href)}`, {
4166
- fontFamily: face.family,
4167
+ emitSignal(`Font failure — ${family} failed to load — ${shortUrl(location.href)}`, {
4168
+ fontFamily: family,
4167
4169
  fontStretch: face.stretch,
4168
4170
  fontStyle: face.style,
4169
4171
  fontWeight: face.weight,
@@ -4172,16 +4174,19 @@ var createBeacon = (options) => {
4172
4174
  });
4173
4175
  };
4174
4176
  const verifyFontFailure = async (face) => {
4175
- const key = [face.family, face.style, face.weight, face.stretch].join("|");
4177
+ if (face.display === "optional")
4178
+ return;
4179
+ const family = canonicalFontFamily(face.family);
4180
+ const key = [family, face.style, face.weight, face.stretch].join("|");
4176
4181
  if (reportedFonts.has(key) || checkingFonts.has(key))
4177
4182
  return;
4178
- const element = affectedElement(face.family);
4183
+ const element = affectedElement(family);
4179
4184
  if (element === null)
4180
4185
  return;
4181
4186
  checkingFonts.add(key);
4182
4187
  const fontAvailable = async (consumer) => {
4183
4188
  const sample = consumer.textContent?.trim().slice(0, 64) || "BESbswy";
4184
- const font = `${face.style} ${face.weight} ${face.stretch} 16px ${JSON.stringify(face.family)}`;
4189
+ const font = `${face.style} ${face.weight} ${face.stretch} 16px ${JSON.stringify(family)}`;
4185
4190
  try {
4186
4191
  await document.fonts.load(font, sample);
4187
4192
  return document.fonts.check(font, sample);
@@ -4199,7 +4204,7 @@ var createBeacon = (options) => {
4199
4204
  });
4200
4205
  if (document.visibilityState === "hidden")
4201
4206
  return;
4202
- const confirmedElement = affectedElement(face.family);
4207
+ const confirmedElement = affectedElement(family);
4203
4208
  if (confirmedElement === null)
4204
4209
  return;
4205
4210
  if (await fontAvailable(confirmedElement))
@@ -4517,5 +4522,5 @@ export {
4517
4522
  BEACON_ATTRIBUTE
4518
4523
  };
4519
4524
 
4520
- //# debugId=11D74B10F3D1902364756E2164756E21
4525
+ //# debugId=536F3C8DC6F6492764756E2164756E21
4521
4526
  //# sourceMappingURL=index.js.map