@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.cjs +20 -16
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +2 -2
- package/dist/{chunk-2G5FEWPU.js → chunk-GVULQ2IF.js} +21 -17
- package/dist/{chunk-2G5FEWPU.js.map → chunk-GVULQ2IF.js.map} +1 -1
- package/dist/{chunk-M3QMIY4Y.js → chunk-MN44USB4.js} +2 -2
- package/dist/index.cjs +20 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lens.min.js +2 -2
- package/dist/react.cjs +20 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-M3QMIY4Y.js.map → chunk-MN44USB4.js.map} +0 -0
package/dist/react.cjs
CHANGED
|
@@ -29083,7 +29083,7 @@ var ApiErrorSchema = external_exports.object({
|
|
|
29083
29083
|
|
|
29084
29084
|
// ../core/dist/index.js
|
|
29085
29085
|
var SDK_NAME = "@merittdev/horus-lens";
|
|
29086
|
-
var SDK_VERSION = true ? "0.5.
|
|
29086
|
+
var SDK_VERSION = true ? "0.5.1" : "0.0.0-dev";
|
|
29087
29087
|
var DEFAULT_ENDPOINT = "https://api.horus.sh";
|
|
29088
29088
|
var DEFAULT_REPLAY_WINDOW_MS = 15e3;
|
|
29089
29089
|
var DEFAULT_MAX_CONSOLE_ENTRIES = 200;
|
|
@@ -29664,8 +29664,11 @@ function computeCropRect(crop, scale, rasterWidth, rasterHeight) {
|
|
|
29664
29664
|
async function captureScreenshot(excludeHost, crop, composite) {
|
|
29665
29665
|
if (typeof document === "undefined" || typeof window === "undefined") return null;
|
|
29666
29666
|
try {
|
|
29667
|
-
const
|
|
29668
|
-
const
|
|
29667
|
+
const viewportOnly = !composite && !crop;
|
|
29668
|
+
const captureW = composite ? composite.docWidth : window.innerWidth;
|
|
29669
|
+
const captureH = composite ? composite.docHeight : window.innerHeight;
|
|
29670
|
+
const capturePixels = captureW * captureH || 1;
|
|
29671
|
+
const pixelCap = Math.sqrt(SCREENSHOT_MAX_PIXELS / capturePixels);
|
|
29669
29672
|
const scale = Math.max(1, Math.min(window.devicePixelRatio || 1, SCREENSHOT_MAX_SCALE, pixelCap));
|
|
29670
29673
|
const capture = domToBlob(document.documentElement, {
|
|
29671
29674
|
scale,
|
|
@@ -29674,12 +29677,19 @@ async function captureScreenshot(excludeHost, crop, composite) {
|
|
|
29674
29677
|
// JPEG has no alpha — transparent page regions (and any capture box
|
|
29675
29678
|
// extending past short content) would otherwise encode as BLACK.
|
|
29676
29679
|
backgroundColor: "#ffffff",
|
|
29677
|
-
//
|
|
29678
|
-
//
|
|
29679
|
-
// sizes from documentElement's bounding box, which on pages SHORTER than
|
|
29680
|
-
// the viewport is the content height only — marks drawn in the lower
|
|
29681
|
-
// viewport band would fall off the raster and the crop would clamp short.
|
|
29680
|
+
// Composite (annotations): force the capture box to the editor's document
|
|
29681
|
+
// measurement so marks in the lower viewport band aren't clipped.
|
|
29682
29682
|
...composite ? { width: composite.docWidth, height: composite.docHeight } : {},
|
|
29683
|
+
// Plain report: clip the render to the viewport and shift the scrolled
|
|
29684
|
+
// content into it, so only the visible region is rasterized/fetched.
|
|
29685
|
+
...viewportOnly ? {
|
|
29686
|
+
width: window.innerWidth,
|
|
29687
|
+
height: window.innerHeight,
|
|
29688
|
+
style: {
|
|
29689
|
+
transform: `translate(${-window.scrollX}px, ${-window.scrollY}px)`,
|
|
29690
|
+
transformOrigin: "top left"
|
|
29691
|
+
}
|
|
29692
|
+
} : {},
|
|
29683
29693
|
// Exclude the overlay from the capture CLONE — never hide the live node.
|
|
29684
29694
|
filter: (node2) => node2 !== excludeHost,
|
|
29685
29695
|
// Per-resource fetch budget: a single slow cross-origin image must not
|
|
@@ -29714,14 +29724,8 @@ async function captureScreenshot(excludeHost, crop, composite) {
|
|
|
29714
29724
|
return null;
|
|
29715
29725
|
}
|
|
29716
29726
|
}
|
|
29717
|
-
|
|
29718
|
-
|
|
29719
|
-
y: window.scrollY,
|
|
29720
|
-
width: window.innerWidth,
|
|
29721
|
-
height: window.innerHeight
|
|
29722
|
-
});
|
|
29723
|
-
if (effectiveCrop) {
|
|
29724
|
-
const cropped = await cropBlob(blob2, effectiveCrop, scale);
|
|
29727
|
+
if (crop) {
|
|
29728
|
+
const cropped = await cropBlob(blob2, crop, scale);
|
|
29725
29729
|
return cropped ?? blob2;
|
|
29726
29730
|
}
|
|
29727
29731
|
return blob2;
|