@merittdev/horus-lens 0.5.0 → 0.5.1

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/dist/browser.js CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  isGateActive,
8
8
  loaderSnippet,
9
9
  processQueue
10
- } from "./chunk-M3QMIY4Y.js";
11
- import "./chunk-2G5FEWPU.js";
10
+ } from "./chunk-MN44USB4.js";
11
+ import "./chunk-GVULQ2IF.js";
12
12
  export {
13
13
  DEFAULT_CDN_URL,
14
14
  LOADER_SNIPPET,
@@ -29063,7 +29063,7 @@ async function domToBlob(node2, options) {
29063
29063
 
29064
29064
  // ../core/dist/index.js
29065
29065
  var SDK_NAME = "@merittdev/horus-lens";
29066
- var SDK_VERSION = true ? "0.5.0" : "0.0.0-dev";
29066
+ var SDK_VERSION = true ? "0.5.1" : "0.0.0-dev";
29067
29067
  var DEFAULT_ENDPOINT = "https://api.horus.sh";
29068
29068
  var DEFAULT_REPLAY_WINDOW_MS = 15e3;
29069
29069
  var DEFAULT_MAX_CONSOLE_ENTRIES = 200;
@@ -29644,8 +29644,11 @@ function computeCropRect(crop, scale, rasterWidth, rasterHeight) {
29644
29644
  async function captureScreenshot(excludeHost, crop, composite) {
29645
29645
  if (typeof document === "undefined" || typeof window === "undefined") return null;
29646
29646
  try {
29647
- const viewportPixels = window.innerWidth * window.innerHeight || 1;
29648
- const pixelCap = Math.sqrt(SCREENSHOT_MAX_PIXELS / viewportPixels);
29647
+ const viewportOnly = !composite && !crop;
29648
+ const captureW = composite ? composite.docWidth : window.innerWidth;
29649
+ const captureH = composite ? composite.docHeight : window.innerHeight;
29650
+ const capturePixels = captureW * captureH || 1;
29651
+ const pixelCap = Math.sqrt(SCREENSHOT_MAX_PIXELS / capturePixels);
29649
29652
  const scale = Math.max(1, Math.min(window.devicePixelRatio || 1, SCREENSHOT_MAX_SCALE, pixelCap));
29650
29653
  const capture = domToBlob(document.documentElement, {
29651
29654
  scale,
@@ -29654,12 +29657,19 @@ async function captureScreenshot(excludeHost, crop, composite) {
29654
29657
  // JPEG has no alpha — transparent page regions (and any capture box
29655
29658
  // extending past short content) would otherwise encode as BLACK.
29656
29659
  backgroundColor: "#ffffff",
29657
- // When compositing annotations, force the capture box to the editor's
29658
- // document measurement (scrollHeight-based). modern-screenshot otherwise
29659
- // sizes from documentElement's bounding box, which on pages SHORTER than
29660
- // the viewport is the content height only — marks drawn in the lower
29661
- // viewport band would fall off the raster and the crop would clamp short.
29660
+ // Composite (annotations): force the capture box to the editor's document
29661
+ // measurement so marks in the lower viewport band aren't clipped.
29662
29662
  ...composite ? { width: composite.docWidth, height: composite.docHeight } : {},
29663
+ // Plain report: clip the render to the viewport and shift the scrolled
29664
+ // content into it, so only the visible region is rasterized/fetched.
29665
+ ...viewportOnly ? {
29666
+ width: window.innerWidth,
29667
+ height: window.innerHeight,
29668
+ style: {
29669
+ transform: `translate(${-window.scrollX}px, ${-window.scrollY}px)`,
29670
+ transformOrigin: "top left"
29671
+ }
29672
+ } : {},
29663
29673
  // Exclude the overlay from the capture CLONE — never hide the live node.
29664
29674
  filter: (node2) => node2 !== excludeHost,
29665
29675
  // Per-resource fetch budget: a single slow cross-origin image must not
@@ -29694,14 +29704,8 @@ async function captureScreenshot(excludeHost, crop, composite) {
29694
29704
  return null;
29695
29705
  }
29696
29706
  }
29697
- const effectiveCrop = crop ?? (composite ? void 0 : {
29698
- x: window.scrollX,
29699
- y: window.scrollY,
29700
- width: window.innerWidth,
29701
- height: window.innerHeight
29702
- });
29703
- if (effectiveCrop) {
29704
- const cropped = await cropBlob(blob2, effectiveCrop, scale);
29707
+ if (crop) {
29708
+ const cropped = await cropBlob(blob2, crop, scale);
29705
29709
  return cropped ?? blob2;
29706
29710
  }
29707
29711
  return blob2;
@@ -30301,4 +30305,4 @@ rrweb/dist/rrweb.js:
30301
30305
  PERFORMANCE OF THIS SOFTWARE.
30302
30306
  ***************************************************************************** *)
30303
30307
  */
30304
- //# sourceMappingURL=chunk-2G5FEWPU.js.map
30308
+ //# sourceMappingURL=chunk-GVULQ2IF.js.map