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