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