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.
@@ -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
- try {
2422
- const dataUrl = await domToPng(el, {
2423
- scale: 2,
2424
- filter: nodeFilter
2425
- });
2426
- if (dataUrl) return dataUrl;
2427
- } catch (e) {
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
- 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) {
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
- lines.push(`- Screenshot: \`storage/app/_instruckt/${a.screenshot}\``);
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
  }