instruckt 0.4.24 → 0.4.25
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/instruckt.cjs.js +27 -14
- package/dist/instruckt.cjs.js.map +1 -1
- package/dist/instruckt.esm.js +27 -14
- package/dist/instruckt.esm.js.map +1 -1
- package/dist/instruckt.iife.js +15 -15
- package/dist/instruckt.iife.js.map +1 -1
- package/package.json +1 -1
package/dist/instruckt.cjs.js
CHANGED
|
@@ -2417,14 +2417,20 @@ function captureRectFromStream(stream, rect) {
|
|
|
2417
2417
|
return canvas.toDataURL("image/png");
|
|
2418
2418
|
});
|
|
2419
2419
|
}
|
|
2420
|
+
var preferScreenCapture = false;
|
|
2421
|
+
function setPreferScreenCapture(value) {
|
|
2422
|
+
preferScreenCapture = value;
|
|
2423
|
+
}
|
|
2420
2424
|
async function captureElement(el) {
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2425
|
+
if (!preferScreenCapture) {
|
|
2426
|
+
try {
|
|
2427
|
+
const dataUrl = await domToPng(el, {
|
|
2428
|
+
scale: 2,
|
|
2429
|
+
filter: nodeFilter
|
|
2430
|
+
});
|
|
2431
|
+
if (dataUrl) return dataUrl;
|
|
2432
|
+
} catch (e) {
|
|
2433
|
+
}
|
|
2428
2434
|
}
|
|
2429
2435
|
try {
|
|
2430
2436
|
const stream = await getStream();
|
|
@@ -2435,13 +2441,15 @@ async function captureElement(el) {
|
|
|
2435
2441
|
}
|
|
2436
2442
|
}
|
|
2437
2443
|
async function captureRegion(rect) {
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2444
|
+
if (!preferScreenCapture) {
|
|
2445
|
+
try {
|
|
2446
|
+
const full = await domToPng(document.body, {
|
|
2447
|
+
scale: 2,
|
|
2448
|
+
filter: nodeFilter
|
|
2449
|
+
});
|
|
2450
|
+
if (full) return await cropImage(full, rect);
|
|
2451
|
+
} catch (e) {
|
|
2452
|
+
}
|
|
2445
2453
|
}
|
|
2446
2454
|
try {
|
|
2447
2455
|
const stream = await getStream();
|
|
@@ -3275,7 +3283,12 @@ var _Instruckt = class _Instruckt {
|
|
|
3275
3283
|
this.init();
|
|
3276
3284
|
}
|
|
3277
3285
|
init() {
|
|
3286
|
+
var _a2;
|
|
3278
3287
|
injectGlobalStyles(this.config.colors);
|
|
3288
|
+
const adapters = (_a2 = this.config.adapters) != null ? _a2 : [];
|
|
3289
|
+
if (adapters.includes("livewire") && isAvailable()) {
|
|
3290
|
+
setPreferScreenCapture(true);
|
|
3291
|
+
}
|
|
3279
3292
|
if (this.config.theme !== "auto") {
|
|
3280
3293
|
document.documentElement.setAttribute("data-instruckt-theme", this.config.theme);
|
|
3281
3294
|
}
|