@insitue/sdk 0.1.12 → 0.1.14
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/capture-only.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
setCaptureSettings,
|
|
12
12
|
stopDisplayMedia,
|
|
13
13
|
y
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HECY6THB.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.
|
|
366
|
-
`InSitue \xB7 v${"0.1.
|
|
365
|
+
{ title: `@insitue/sdk@${"0.1.14"}` },
|
|
366
|
+
`InSitue \xB7 v${"0.1.14"}`
|
|
367
367
|
)
|
|
368
368
|
]
|
|
369
369
|
)
|
|
@@ -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";
|
|
@@ -1670,7 +1671,7 @@ async function renderViewportCrop(cropRect, pixelRatio) {
|
|
|
1670
1671
|
out.width = Math.max(1, Math.round(cropRect.width * pixelRatio));
|
|
1671
1672
|
out.height = Math.max(1, Math.round(cropRect.height * pixelRatio));
|
|
1672
1673
|
const ctx = out.getContext("2d");
|
|
1673
|
-
if (!ctx) return { dataUrl: null, failedImages };
|
|
1674
|
+
if (!ctx) return { dataUrl: null, looksBlank: false, failedImages };
|
|
1674
1675
|
const fullCanvas = await toCanvas(document.documentElement, {
|
|
1675
1676
|
pixelRatio,
|
|
1676
1677
|
cacheBust: true,
|
|
@@ -1698,11 +1699,9 @@ async function renderViewportCrop(cropRect, pixelRatio) {
|
|
|
1698
1699
|
failedImages
|
|
1699
1700
|
);
|
|
1700
1701
|
void drawnImgs;
|
|
1701
|
-
|
|
1702
|
-
return { dataUrl: null, failedImages };
|
|
1703
|
-
}
|
|
1702
|
+
const looksBlank = looksBlankUniform(ctx, out.width, out.height);
|
|
1704
1703
|
detectUnrenderedImages(ctx, cropRect, out, pixelRatio, failedImages);
|
|
1705
|
-
return { dataUrl: out.toDataURL("image/png"), failedImages };
|
|
1704
|
+
return { dataUrl: out.toDataURL("image/png"), looksBlank, failedImages };
|
|
1706
1705
|
}
|
|
1707
1706
|
async function drawAbsoluteImagesOnto(ctx, cropRect, pixelRatio, failedImages) {
|
|
1708
1707
|
const drawn = /* @__PURE__ */ new Set();
|
|
@@ -2132,14 +2131,17 @@ async function buildBundle(sel) {
|
|
|
2132
2131
|
try {
|
|
2133
2132
|
const skipLayer1 = settings.alwaysPixelPerfect;
|
|
2134
2133
|
let layer1Result = null;
|
|
2134
|
+
let layer1LooksBlank = false;
|
|
2135
2135
|
let quality = null;
|
|
2136
2136
|
if (!skipLayer1) {
|
|
2137
2137
|
const r3 = await renderViewportCrop(cropRect, Math.min(dpr, 1.5));
|
|
2138
2138
|
layer1Result = r3.dataUrl;
|
|
2139
|
+
layer1LooksBlank = r3.looksBlank;
|
|
2139
2140
|
quality = assessCaptureQuality(cropRect, r3.failedImages);
|
|
2140
2141
|
}
|
|
2141
|
-
const imperfect = !layer1Result || quality != null && (quality.unembeddableImages > 0 || quality.hasVideo || quality.hasCanvas);
|
|
2142
|
-
|
|
2142
|
+
const imperfect = !layer1Result || layer1LooksBlank || quality != null && (quality.unembeddableImages > 0 || quality.hasVideo || quality.hasCanvas);
|
|
2143
|
+
const allowLayer2 = !settings.disableLayer2;
|
|
2144
|
+
if ((imperfect || skipLayer1) && allowLayer2) {
|
|
2143
2145
|
const grab = await tryGrabViaDisplayMedia(
|
|
2144
2146
|
cropRect,
|
|
2145
2147
|
Math.min(dpr, 2)
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
setCaptureSettings,
|
|
16
16
|
stopDisplayMedia,
|
|
17
17
|
y
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HECY6THB.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-
|
|
3
|
+
} from "./chunk-7EQRP6O4.js";
|
|
4
4
|
import {
|
|
5
5
|
mountInSitue
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-QTG3I7DC.js";
|
|
7
|
+
import "./chunk-HECY6THB.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.
|
|
55
|
+
var SDK_VERSION = "0.1.14";
|
|
56
56
|
export {
|
|
57
57
|
InSitue,
|
|
58
58
|
InSitueCapture,
|
package/dist/overlay.js
CHANGED
package/package.json
CHANGED