@merittdev/horus-lens 0.5.1 → 0.5.2

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LENS_OVERLAY_HOST_ID,
3
3
  LensClient
4
- } from "./chunk-GVULQ2IF.js";
4
+ } from "./chunk-25CZMYQK.js";
5
5
 
6
6
  // ../browser/dist/index.js
7
7
  var DEFAULT_PARAM_NAME = "lens";
@@ -2724,4 +2724,4 @@ export {
2724
2724
  boot,
2725
2725
  autoBoot
2726
2726
  };
2727
- //# sourceMappingURL=chunk-MN44USB4.js.map
2727
+ //# sourceMappingURL=chunk-4E427AKG.js.map
package/dist/index.cjs CHANGED
@@ -29111,7 +29111,7 @@ async function domToBlob(node2, options) {
29111
29111
 
29112
29112
  // ../core/dist/index.js
29113
29113
  var SDK_NAME = "@merittdev/horus-lens";
29114
- var SDK_VERSION = true ? "0.5.1" : "0.0.0-dev";
29114
+ var SDK_VERSION = true ? "0.5.2" : "0.0.0-dev";
29115
29115
  var DEFAULT_ENDPOINT = "https://api.horus.sh";
29116
29116
  var DEFAULT_REPLAY_WINDOW_MS = 15e3;
29117
29117
  var DEFAULT_MAX_CONSOLE_ENTRIES = 200;
@@ -29123,6 +29123,7 @@ var MAX_SERIALIZED_ARG_CHARS = 2e3;
29123
29123
  var MAX_DOM_BYTES = 2 * 1024 * 1024;
29124
29124
  var MAX_TARGET_TEXT_CHARS = 200;
29125
29125
  var SCREENSHOT_TIMEOUT_MS = 2e4;
29126
+ var SCREENSHOT_RESOURCE_TIMEOUT_MS = 3500;
29126
29127
  var SCREENSHOT_MAX_SCALE = 2;
29127
29128
  var SCREENSHOT_MAX_PIXELS = 25e5;
29128
29129
  var AUTO_CAPTURE_COOLDOWN_MS = 10 * 60 * 1e3;
@@ -29677,6 +29678,14 @@ var ReplayRecorder = class {
29677
29678
  }
29678
29679
  };
29679
29680
  var SVG_RASTERIZE_TIMEOUT_MS = 3e3;
29681
+ function isOffscreenMedia(node2) {
29682
+ if (!(node2 instanceof HTMLImageElement) && !(node2 instanceof HTMLIFrameElement) && !(typeof HTMLVideoElement !== "undefined" && node2 instanceof HTMLVideoElement)) {
29683
+ return false;
29684
+ }
29685
+ const r = node2.getBoundingClientRect();
29686
+ if (r.width === 0 && r.height === 0) return false;
29687
+ return r.bottom < 0 || r.top > window.innerHeight || r.right < 0 || r.left > window.innerWidth;
29688
+ }
29680
29689
  function computeCropRect(crop, scale, rasterWidth, rasterHeight) {
29681
29690
  let sx = Math.round(crop.x * scale);
29682
29691
  let sy = Math.round(crop.y * scale);
@@ -29718,12 +29727,22 @@ async function captureScreenshot(excludeHost, crop, composite) {
29718
29727
  transformOrigin: "top left"
29719
29728
  }
29720
29729
  } : {},
29721
- // Exclude the overlay from the capture CLONE — never hide the live node.
29722
- filter: (node2) => node2 !== excludeHost,
29723
- // Per-resource fetch budget: a single slow cross-origin image must not
29724
- // consume the whole capture window.
29730
+ // Exclude the overlay from the capture CLONE (never hide the live node),
29731
+ // and — for a plain viewport report — drop images/iframes entirely outside
29732
+ // the viewport so we don't fetch dozens of off-screen cross-origin assets.
29733
+ filter: (node2) => {
29734
+ if (node2 === excludeHost) return false;
29735
+ if (viewportOnly && isOffscreenMedia(node2)) return false;
29736
+ return true;
29737
+ },
29738
+ // Skip web-font download/embed. On font-heavy pages (multiple custom
29739
+ // families) this is a dominant, flaky cost; fallback fonts are fine for a
29740
+ // bug-report screenshot and capture becomes far more reliable.
29741
+ font: false,
29725
29742
  fetch: { requestInit: { cache: "force-cache" }, bypassingCache: false },
29726
- timeout: SCREENSHOT_TIMEOUT_MS - 1e3
29743
+ // PER-RESOURCE cap (NOT the overall budget): a hanging asset fails fast to
29744
+ // a placeholder instead of stalling the whole capture.
29745
+ timeout: SCREENSHOT_RESOURCE_TIMEOUT_MS
29727
29746
  });
29728
29747
  const started = Date.now();
29729
29748
  const timeout = new Promise((resolve) => {