@insitue/sdk 0.1.11 → 0.1.13

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mountCaptureOnly
3
- } from "./chunk-PAKDACTF.js";
4
- import "./chunk-SMR4AYKA.js";
3
+ } from "./chunk-RTIWK5P2.js";
4
+ import "./chunk-MGEIT55T.js";
5
5
  export {
6
6
  mountCaptureOnly
7
7
  };
@@ -804,7 +804,8 @@ function beginPick(mode = "element") {
804
804
 
805
805
  // src/capture-settings.ts
806
806
  var DEFAULT_SETTINGS = {
807
- alwaysPixelPerfect: false
807
+ alwaysPixelPerfect: false,
808
+ disableLayer2: false
808
809
  };
809
810
  function storageKey() {
810
811
  if (typeof location === "undefined") return "insitu:capture-settings";
@@ -1671,26 +1672,12 @@ async function renderViewportCrop(cropRect, pixelRatio) {
1671
1672
  out.height = Math.max(1, Math.round(cropRect.height * pixelRatio));
1672
1673
  const ctx = out.getContext("2d");
1673
1674
  if (!ctx) return { dataUrl: null, failedImages };
1674
- const drawnImgs = await drawAbsoluteImagesOnto(
1675
- ctx,
1676
- cropRect,
1677
- pixelRatio,
1678
- failedImages
1679
- );
1680
1675
  const fullCanvas = await toCanvas(document.documentElement, {
1681
1676
  pixelRatio,
1682
1677
  cacheBust: true,
1683
1678
  backgroundColor,
1684
1679
  imagePlaceholder: IMAGE_PLACEHOLDER,
1685
- filter: (n2) => {
1686
- if (n2 instanceof Element && n2.closest?.("#insitu-root, [data-insitu-layer]")) {
1687
- return false;
1688
- }
1689
- if (n2 instanceof HTMLImageElement && drawnImgs.has(n2)) {
1690
- return false;
1691
- }
1692
- return true;
1693
- }
1680
+ filter: (n2) => !(n2 instanceof Element && n2.closest?.("#insitu-root, [data-insitu-layer]"))
1694
1681
  });
1695
1682
  const sx = window.scrollX;
1696
1683
  const sy = window.scrollY;
@@ -1705,6 +1692,13 @@ async function renderViewportCrop(cropRect, pixelRatio) {
1705
1692
  out.width,
1706
1693
  out.height
1707
1694
  );
1695
+ const drawnImgs = await drawAbsoluteImagesOnto(
1696
+ ctx,
1697
+ cropRect,
1698
+ pixelRatio,
1699
+ failedImages
1700
+ );
1701
+ void drawnImgs;
1708
1702
  if (looksBlankUniform(ctx, out.width, out.height)) {
1709
1703
  return { dataUrl: null, failedImages };
1710
1704
  }
@@ -2146,7 +2140,8 @@ async function buildBundle(sel) {
2146
2140
  quality = assessCaptureQuality(cropRect, r3.failedImages);
2147
2141
  }
2148
2142
  const imperfect = !layer1Result || quality != null && (quality.unembeddableImages > 0 || quality.hasVideo || quality.hasCanvas);
2149
- if (imperfect || skipLayer1) {
2143
+ const allowLayer2 = !settings.disableLayer2;
2144
+ if ((imperfect || skipLayer1) && allowLayer2) {
2150
2145
  const grab = await tryGrabViaDisplayMedia(
2151
2146
  cropRect,
2152
2147
  Math.min(dpr, 2)
@@ -11,7 +11,7 @@ import {
11
11
  setCaptureSettings,
12
12
  stopDisplayMedia,
13
13
  y
14
- } from "./chunk-SMR4AYKA.js";
14
+ } from "./chunk-MGEIT55T.js";
15
15
 
16
16
  // src/capture-only.ts
17
17
  var DEFAULT_INGEST = "https://www.insitue.com/api/v1/capture";
@@ -362,8 +362,8 @@ function CaptureOnlyApp(props) {
362
362
  k("span", {}, ""),
363
363
  k(
364
364
  "span",
365
- { title: `@insitue/sdk@${"0.1.11"}` },
366
- `InSitue \xB7 v${"0.1.11"}`
365
+ { title: `@insitue/sdk@${"0.1.13"}` },
366
+ `InSitue \xB7 v${"0.1.13"}`
367
367
  )
368
368
  ]
369
369
  )
@@ -15,7 +15,7 @@ import {
15
15
  setCaptureSettings,
16
16
  stopDisplayMedia,
17
17
  y
18
- } from "./chunk-SMR4AYKA.js";
18
+ } from "./chunk-MGEIT55T.js";
19
19
 
20
20
  // src/client.ts
21
21
  var CompanionClient = class {
@@ -1168,6 +1168,7 @@ ${resolved.snippet}`
1168
1168
  ]);
1169
1169
  }
1170
1170
  function mountInSitue(opts = {}) {
1171
+ setCaptureSettings({ disableLayer2: true });
1171
1172
  const host = document.createElement("div");
1172
1173
  host.id = "insitu-root";
1173
1174
  host.setAttribute("data-insitu", "");
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  mountCaptureOnly
3
- } from "./chunk-PAKDACTF.js";
3
+ } from "./chunk-RTIWK5P2.js";
4
4
  import {
5
5
  mountInSitue
6
- } from "./chunk-DJN4LPOV.js";
7
- import "./chunk-SMR4AYKA.js";
6
+ } from "./chunk-SXX75N6T.js";
7
+ import "./chunk-MGEIT55T.js";
8
8
 
9
9
  // src/InSitue.tsx
10
10
  import { useEffect } from "react";
@@ -52,7 +52,7 @@ function InSitueCapture({
52
52
  }
53
53
 
54
54
  // src/index.ts
55
- var SDK_VERSION = "0.1.11";
55
+ var SDK_VERSION = "0.1.13";
56
56
  export {
57
57
  InSitue,
58
58
  InSitueCapture,
package/dist/overlay.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mountInSitue
3
- } from "./chunk-DJN4LPOV.js";
4
- import "./chunk-SMR4AYKA.js";
3
+ } from "./chunk-SXX75N6T.js";
4
+ import "./chunk-MGEIT55T.js";
5
5
  export {
6
6
  mountInSitue
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insitue/sdk",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "InSitue capture SDK — drop one snippet into your deployed app; your users point at a bug, InSitue opens a verified pull request.",
5
5
  "license": "MIT",
6
6
  "type": "module",