instruckt 0.4.23 → 0.4.25
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 +31 -15
- package/dist/instruckt.cjs.js.map +1 -1
- package/dist/instruckt.d.mts +1 -0
- package/dist/instruckt.d.ts +1 -0
- package/dist/instruckt.esm.js +31 -15
- 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
|
@@ -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();
|
|
@@ -3176,6 +3184,7 @@ var _Instruckt = class _Instruckt {
|
|
|
3176
3184
|
this.pendingMouseTarget = null;
|
|
3177
3185
|
this.highlightLocked = false;
|
|
3178
3186
|
this.pollTimer = null;
|
|
3187
|
+
this.initialLoadDone = false;
|
|
3179
3188
|
this.boundReposition = () => {
|
|
3180
3189
|
var _a2;
|
|
3181
3190
|
(_a2 = this.markers) == null ? void 0 : _a2.reposition(this.annotations);
|
|
@@ -3274,7 +3283,12 @@ var _Instruckt = class _Instruckt {
|
|
|
3274
3283
|
this.init();
|
|
3275
3284
|
}
|
|
3276
3285
|
init() {
|
|
3286
|
+
var _a2;
|
|
3277
3287
|
injectGlobalStyles(this.config.colors);
|
|
3288
|
+
const adapters = (_a2 = this.config.adapters) != null ? _a2 : [];
|
|
3289
|
+
if (adapters.includes("livewire") && isAvailable()) {
|
|
3290
|
+
setPreferScreenCapture(true);
|
|
3291
|
+
}
|
|
3278
3292
|
if (this.config.theme !== "auto") {
|
|
3279
3293
|
document.documentElement.setAttribute("data-instruckt-theme", this.config.theme);
|
|
3280
3294
|
}
|
|
@@ -3364,6 +3378,7 @@ var _Instruckt = class _Instruckt {
|
|
|
3364
3378
|
this.saveToStorage();
|
|
3365
3379
|
} catch (e) {
|
|
3366
3380
|
}
|
|
3381
|
+
this.initialLoadDone = true;
|
|
3367
3382
|
this.syncMarkers();
|
|
3368
3383
|
}
|
|
3369
3384
|
saveToStorage() {
|
|
@@ -3381,6 +3396,7 @@ var _Instruckt = class _Instruckt {
|
|
|
3381
3396
|
}
|
|
3382
3397
|
/** Start or stop polling based on whether there are active annotations */
|
|
3383
3398
|
updatePolling() {
|
|
3399
|
+
if (!this.initialLoadDone) return;
|
|
3384
3400
|
const hasActive = this.totalActiveCount() > 0;
|
|
3385
3401
|
if (hasActive && !this.pollTimer) {
|
|
3386
3402
|
this.pollTimer = setInterval(() => this.pollForChanges(), 3e3);
|
|
@@ -3882,7 +3898,7 @@ No open annotations.`;
|
|
|
3882
3898
|
}
|
|
3883
3899
|
};
|
|
3884
3900
|
// ── Persistence ─────────────────────────────────────────────────
|
|
3885
|
-
_Instruckt.STORAGE_KEY =
|
|
3901
|
+
_Instruckt.STORAGE_KEY = `instruckt:${window.location.origin}:annotations`;
|
|
3886
3902
|
var Instruckt = _Instruckt;
|
|
3887
3903
|
|
|
3888
3904
|
// src/index.ts
|