@merittdev/horus-lens 0.1.0 → 0.1.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 +83 -2
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -2
- package/dist/{chunk-A6SNBIRS.js → chunk-CRV65EEY.js} +40 -2
- package/dist/chunk-CRV65EEY.js.map +1 -0
- package/dist/{chunk-MTQ3IO4U.js → chunk-UB7YYHI4.js} +46 -3
- package/dist/{chunk-MTQ3IO4U.js.map → chunk-UB7YYHI4.js.map} +1 -1
- package/dist/index.cjs +45 -2
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-BA540Fae.d.ts → index.d-DeLYS02n.d.ts} +13 -0
- package/dist/{index.d-DOCLVJGS.d.cts → index.d-sNoEEgRg.d.cts} +13 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +1 -1
- package/dist/lens.min.js +6 -6
- package/dist/lens.min.js.map +1 -1
- package/dist/react.cjs +83 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-A6SNBIRS.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -29381,6 +29381,11 @@ var ReplayRecorder = class {
|
|
|
29381
29381
|
emit: (event, isCheckout) => this.onEmit(event, isCheckout),
|
|
29382
29382
|
checkoutEveryNms: this.windowMs,
|
|
29383
29383
|
recordCanvas: false,
|
|
29384
|
+
// Inline same-origin + CORS images as data URIs at snapshot time so the
|
|
29385
|
+
// dashboard replay paints on a different origin (tainted cross-origin
|
|
29386
|
+
// images fall back to their URL, which is fine for public CDNs).
|
|
29387
|
+
inlineImages: true,
|
|
29388
|
+
collectFonts: true,
|
|
29384
29389
|
// Keep the Lens overlay itself out of every recording.
|
|
29385
29390
|
blockSelector: `#${LENS_OVERLAY_HOST_ID}`
|
|
29386
29391
|
});
|
|
@@ -29487,7 +29492,7 @@ var ReplayRecorder = class {
|
|
|
29487
29492
|
console.warn("[lens] rrweb recording unavailable; replay disabled", err);
|
|
29488
29493
|
}
|
|
29489
29494
|
};
|
|
29490
|
-
async function captureScreenshot(excludeHost) {
|
|
29495
|
+
async function captureScreenshot(excludeHost, crop) {
|
|
29491
29496
|
if (typeof document === "undefined" || typeof window === "undefined") return null;
|
|
29492
29497
|
try {
|
|
29493
29498
|
const viewportPixels = window.innerWidth * window.innerHeight || 1;
|
|
@@ -29521,12 +29526,50 @@ async function captureScreenshot(excludeHost) {
|
|
|
29521
29526
|
);
|
|
29522
29527
|
return null;
|
|
29523
29528
|
}
|
|
29529
|
+
if (crop) {
|
|
29530
|
+
const cropped = await cropBlob(blob2, crop, scale);
|
|
29531
|
+
return cropped ?? blob2;
|
|
29532
|
+
}
|
|
29524
29533
|
return blob2;
|
|
29525
29534
|
} catch (err) {
|
|
29526
29535
|
console.warn("[lens] screenshot capture failed:", err);
|
|
29527
29536
|
return null;
|
|
29528
29537
|
}
|
|
29529
29538
|
}
|
|
29539
|
+
async function cropBlob(blob2, crop, scale) {
|
|
29540
|
+
try {
|
|
29541
|
+
if (typeof createImageBitmap !== "function" || typeof document === "undefined") return null;
|
|
29542
|
+
const bitmap = await createImageBitmap(blob2);
|
|
29543
|
+
let sx = Math.round(crop.x * scale);
|
|
29544
|
+
let sy = Math.round(crop.y * scale);
|
|
29545
|
+
let sw = Math.round(crop.width * scale);
|
|
29546
|
+
let sh = Math.round(crop.height * scale);
|
|
29547
|
+
sx = Math.max(0, Math.min(sx, bitmap.width));
|
|
29548
|
+
sy = Math.max(0, Math.min(sy, bitmap.height));
|
|
29549
|
+
sw = Math.min(sw, bitmap.width - sx);
|
|
29550
|
+
sh = Math.min(sh, bitmap.height - sy);
|
|
29551
|
+
if (sw <= 0 || sh <= 0) {
|
|
29552
|
+
bitmap.close?.();
|
|
29553
|
+
return null;
|
|
29554
|
+
}
|
|
29555
|
+
const canvas = document.createElement("canvas");
|
|
29556
|
+
canvas.width = sw;
|
|
29557
|
+
canvas.height = sh;
|
|
29558
|
+
const ctx = canvas.getContext("2d");
|
|
29559
|
+
if (!ctx) {
|
|
29560
|
+
bitmap.close?.();
|
|
29561
|
+
return null;
|
|
29562
|
+
}
|
|
29563
|
+
ctx.drawImage(bitmap, sx, sy, sw, sh, 0, 0, sw, sh);
|
|
29564
|
+
bitmap.close?.();
|
|
29565
|
+
return await new Promise((resolve) => {
|
|
29566
|
+
canvas.toBlob((out) => resolve(out), "image/jpeg", 0.82);
|
|
29567
|
+
});
|
|
29568
|
+
} catch (err) {
|
|
29569
|
+
console.warn("[lens] screenshot crop failed:", err);
|
|
29570
|
+
return null;
|
|
29571
|
+
}
|
|
29572
|
+
}
|
|
29530
29573
|
function parseBrowser(ua) {
|
|
29531
29574
|
if (!ua) return void 0;
|
|
29532
29575
|
const checks = [
|
|
@@ -29791,7 +29834,7 @@ var LensClient = class {
|
|
|
29791
29834
|
const wantErrors = include.errors !== false;
|
|
29792
29835
|
const wantScreenshot = include.screenshot !== false;
|
|
29793
29836
|
const wantDom = include.dom !== false;
|
|
29794
|
-
const screenshotPromise = this.screenshotEnabled && wantScreenshot ? captureScreenshot(input2.excludeFromScreenshot) : Promise.resolve(null);
|
|
29837
|
+
const screenshotPromise = this.screenshotEnabled && wantScreenshot ? captureScreenshot(input2.excludeFromScreenshot, input2.screenshotCrop) : Promise.resolve(null);
|
|
29795
29838
|
const replayEvents = wantReplay ? this.replay?.snapshot() ?? [] : [];
|
|
29796
29839
|
const errorEntries = this.errorBuffer.drain();
|
|
29797
29840
|
const consoleTail = this.consoleBuffer.tail(CONSOLE_TAIL_SIZE);
|