instruckt 0.4.24 → 0.4.26
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 +30 -16
- package/dist/instruckt.cjs.js.map +1 -1
- package/dist/instruckt.d.mts +2 -0
- package/dist/instruckt.d.ts +2 -0
- package/dist/instruckt.esm.js +30 -16
- package/dist/instruckt.esm.js.map +1 -1
- package/dist/instruckt.iife.js +16 -16
- 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
|
}
|
|
@@ -3826,7 +3839,7 @@ No open annotations.`;
|
|
|
3826
3839
|
lines.push("");
|
|
3827
3840
|
const hPrefix = multiPage ? "###" : "##";
|
|
3828
3841
|
annotations.forEach((a, i) => {
|
|
3829
|
-
var _a2, _b, _c, _d;
|
|
3842
|
+
var _a2, _b, _c, _d, _e;
|
|
3830
3843
|
const componentSuffix = ((_a2 = a.framework) == null ? void 0 : _a2.component) ? ` in \`${a.framework.component}\`` : "";
|
|
3831
3844
|
lines.push(`${hPrefix} ${i + 1}. ${a.comment}`);
|
|
3832
3845
|
lines.push(`- ID: \`${a.id}\``);
|
|
@@ -3847,7 +3860,8 @@ No open annotations.`;
|
|
|
3847
3860
|
}
|
|
3848
3861
|
if (a.screenshot) {
|
|
3849
3862
|
if (!a.screenshot.startsWith("data:")) {
|
|
3850
|
-
|
|
3863
|
+
const screenshotPath = (_e = this.config.screenshotPath) != null ? _e : "storage/app/_instruckt/";
|
|
3864
|
+
lines.push(`- Screenshot: \`${screenshotPath}${a.screenshot}\``);
|
|
3851
3865
|
} else {
|
|
3852
3866
|
lines.push(`- Screenshot: attached`);
|
|
3853
3867
|
}
|