instruckt 0.4.19 → 0.4.20
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 +14 -32
- package/dist/instruckt.cjs.js.map +1 -1
- package/dist/instruckt.esm.js +14 -32
- 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
|
@@ -2372,20 +2372,6 @@ function nodeFilter(node) {
|
|
|
2372
2372
|
if ((_a2 = node.getAttribute) == null ? void 0 : _a2.call(node, "data-instruckt")) return false;
|
|
2373
2373
|
return true;
|
|
2374
2374
|
}
|
|
2375
|
-
function hasShadowDOM() {
|
|
2376
|
-
if (document.querySelector("[data-flux], flux\\:button, flux\\:input")) return true;
|
|
2377
|
-
for (const child of document.body.querySelectorAll("*")) {
|
|
2378
|
-
if (child.shadowRoot && !child.hasAttribute("data-instruckt")) return true;
|
|
2379
|
-
}
|
|
2380
|
-
return false;
|
|
2381
|
-
}
|
|
2382
|
-
var _useScreenCapture = null;
|
|
2383
|
-
function shouldUseScreenCapture() {
|
|
2384
|
-
if (_useScreenCapture === null) {
|
|
2385
|
-
_useScreenCapture = hasShadowDOM();
|
|
2386
|
-
}
|
|
2387
|
-
return _useScreenCapture;
|
|
2388
|
-
}
|
|
2389
2375
|
var activeStream = null;
|
|
2390
2376
|
async function getStream() {
|
|
2391
2377
|
if (activeStream && activeStream.active) return activeStream;
|
|
@@ -2432,15 +2418,13 @@ function captureRectFromStream(stream, rect) {
|
|
|
2432
2418
|
});
|
|
2433
2419
|
}
|
|
2434
2420
|
async function captureElement(el) {
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
} catch (e) {
|
|
2443
|
-
}
|
|
2421
|
+
try {
|
|
2422
|
+
const dataUrl = await domToPng(el, {
|
|
2423
|
+
scale: 2,
|
|
2424
|
+
filter: nodeFilter
|
|
2425
|
+
});
|
|
2426
|
+
if (dataUrl) return dataUrl;
|
|
2427
|
+
} catch (e) {
|
|
2444
2428
|
}
|
|
2445
2429
|
try {
|
|
2446
2430
|
const stream = await getStream();
|
|
@@ -2451,15 +2435,13 @@ async function captureElement(el) {
|
|
|
2451
2435
|
}
|
|
2452
2436
|
}
|
|
2453
2437
|
async function captureRegion(rect) {
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
} catch (e) {
|
|
2462
|
-
}
|
|
2438
|
+
try {
|
|
2439
|
+
const full = await domToPng(document.body, {
|
|
2440
|
+
scale: 2,
|
|
2441
|
+
filter: nodeFilter
|
|
2442
|
+
});
|
|
2443
|
+
if (full) return await cropImage(full, rect);
|
|
2444
|
+
} catch (e) {
|
|
2463
2445
|
}
|
|
2464
2446
|
try {
|
|
2465
2447
|
const stream = await getStream();
|