@microblink/camera-manager 7.3.0 → 7.3.1
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/camera-manager.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { subscribeWithSelector as ue } from "zustand/middleware";
|
|
3
3
|
import { shallow as ge } from "zustand/shallow";
|
|
4
4
|
import { createStore as de } from "zustand/vanilla";
|
|
5
|
-
import { createComponent as c, use as V, template as w, spread as A, mergeProps as
|
|
5
|
+
import { createComponent as c, use as V, template as w, spread as A, mergeProps as W, insert as y, memo as Ee, isServer as he, Portal as ke, effect as Te, Dynamic as Ye, render as Je } from "solid-js/web";
|
|
6
6
|
import { createContext as xe, onCleanup as J, useContext as Me, onMount as K, createSignal as I, Show as x, Index as Ze, splitProps as Y, createRoot as oe, getOwner as Re, createEffect as _e, createMemo as et, $TRACK as tt, untrack as rt } from "solid-js";
|
|
7
7
|
import { createWithSignal as Ae } from "solid-zustand";
|
|
8
8
|
import { createStore as at } from "solid-js/store";
|
|
9
9
|
import { EnvironmentProvider as nt } from "@ark-ui/solid/environment";
|
|
10
10
|
import { Dialog as D } from "@ark-ui/solid/dialog";
|
|
11
11
|
import { Select as _, createListCollection as ot } from "@ark-ui/solid/select";
|
|
12
|
-
import { Tooltip as
|
|
12
|
+
import { Tooltip as Q } from "@ark-ui/solid/tooltip";
|
|
13
13
|
import { Dialog as be } from "@ark-ui/solid";
|
|
14
14
|
typeof HTMLVideoElement < "u" && !("requestVideoFrameCallback" in HTMLVideoElement.prototype) && "getVideoPlaybackQuality" in HTMLVideoElement.prototype && (HTMLVideoElement.prototype._rvfcpolyfillmap = {}, HTMLVideoElement.prototype.requestVideoFrameCallback = function(t) {
|
|
15
15
|
const e = performance.now(), r = this.getVideoPlaybackQuality(), a = this.mozPresentedFrames || this.mozPaintedFrames || r.totalVideoFrames - r.droppedVideoFrames, n = (i, o) => {
|
|
@@ -431,7 +431,7 @@ const gt = [
|
|
|
431
431
|
"Cámara trasera dual con gran angular",
|
|
432
432
|
"背面デュアル広角カメラ",
|
|
433
433
|
"Stražnja dvostruka široka kamera"
|
|
434
|
-
],
|
|
434
|
+
], j = (t) => {
|
|
435
435
|
if (t instanceof Error) return t;
|
|
436
436
|
try {
|
|
437
437
|
return new Error(JSON.stringify(t));
|
|
@@ -453,7 +453,7 @@ const ze = async () => {
|
|
|
453
453
|
throw new B(
|
|
454
454
|
"Camera permission not given",
|
|
455
455
|
"PERMISSION_DENIED",
|
|
456
|
-
|
|
456
|
+
j(t)
|
|
457
457
|
);
|
|
458
458
|
}
|
|
459
459
|
}, pt = async () => {
|
|
@@ -878,7 +878,7 @@ function Ve(t = document.documentElement) {
|
|
|
878
878
|
function Pt(t) {
|
|
879
879
|
return "isConnected" in Node.prototype ? t.isConnected : t.ownerDocument == null || !(t.ownerDocument.compareDocumentPosition(t) & t.DOCUMENT_POSITION_DISCONNECTED);
|
|
880
880
|
}
|
|
881
|
-
const
|
|
881
|
+
const H = /* @__PURE__ */ new Map();
|
|
882
882
|
function $t(t, e) {
|
|
883
883
|
const r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new WeakMap();
|
|
884
884
|
let o = !1, s = !1, l = !1;
|
|
@@ -897,8 +897,8 @@ function $t(t, e) {
|
|
|
897
897
|
a.clear();
|
|
898
898
|
}, m = (v, C) => {
|
|
899
899
|
let M = n.get(v);
|
|
900
|
-
const L = Lt(v, C),
|
|
901
|
-
g(
|
|
900
|
+
const L = Lt(v, C), G = M?.get(C), X = Nt(L, G);
|
|
901
|
+
g(X), M == null && (M = /* @__PURE__ */ new Map(), n.set(v, M)), M.set(C, L);
|
|
902
902
|
}, g = (v) => {
|
|
903
903
|
for (const C of v) {
|
|
904
904
|
const M = i.get(C), L = Pt(C);
|
|
@@ -921,12 +921,12 @@ function $t(t, e) {
|
|
|
921
921
|
clearObservedTargets: h,
|
|
922
922
|
clearQueue: p
|
|
923
923
|
};
|
|
924
|
-
|
|
924
|
+
H.set(t, T);
|
|
925
925
|
}
|
|
926
926
|
const Ot = (t) => {
|
|
927
927
|
for (const e of t)
|
|
928
928
|
if (e.type === "childList")
|
|
929
|
-
for (const r of
|
|
929
|
+
for (const r of H.values())
|
|
930
930
|
for (const a of r.observedTargets)
|
|
931
931
|
typeof a == "string" ? r.queryRootAndHandleMutationChanges(e.target, a) : r.handleMutationChange([a]);
|
|
932
932
|
}, ie = /* @__PURE__ */ new Set(), Be = /* @__PURE__ */ (() => {
|
|
@@ -962,21 +962,21 @@ class z {
|
|
|
962
962
|
throw new ReferenceError(`Failed to execute '${this.observe.name}' on '${z.name}': 1 argument required, but only 0 present.`);
|
|
963
963
|
if (typeof e != "string" && !(e instanceof Node))
|
|
964
964
|
throw new TypeError(`Failed to execute '${this.observe.name}' on '${z.name}': parameter 1 is not of type 'Node' or a DOMString.`);
|
|
965
|
-
const r =
|
|
965
|
+
const r = H.get(this);
|
|
966
966
|
r?.addObservedTarget(e);
|
|
967
967
|
}
|
|
968
968
|
/**
|
|
969
969
|
* Takes the records immediately (instead of waiting for the next flush)
|
|
970
970
|
*/
|
|
971
971
|
takeRecords() {
|
|
972
|
-
const e =
|
|
972
|
+
const e = H.get(this);
|
|
973
973
|
return e == null ? [] : e.clearQueue();
|
|
974
974
|
}
|
|
975
975
|
/**
|
|
976
976
|
* Disconnects the ConnectionObserver such that none of its callbacks will be invoked any longer
|
|
977
977
|
*/
|
|
978
978
|
disconnect() {
|
|
979
|
-
const e =
|
|
979
|
+
const e = H.get(this);
|
|
980
980
|
e?.clearObservedTargets();
|
|
981
981
|
}
|
|
982
982
|
}
|
|
@@ -1018,7 +1018,7 @@ class Vt {
|
|
|
1018
1018
|
this.#s();
|
|
1019
1019
|
else if (r === "webgl2")
|
|
1020
1020
|
try {
|
|
1021
|
-
this.#
|
|
1021
|
+
this.#d();
|
|
1022
1022
|
} catch (n) {
|
|
1023
1023
|
if (a)
|
|
1024
1024
|
console.warn(
|
|
@@ -1046,7 +1046,7 @@ class Vt {
|
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Initializes the WebGL2 context and resources.
|
|
1048
1048
|
*/
|
|
1049
|
-
#
|
|
1049
|
+
#d() {
|
|
1050
1050
|
const e = this.#e.getContext("webgl2", {
|
|
1051
1051
|
alpha: !1,
|
|
1052
1052
|
depth: !1,
|
|
@@ -1135,7 +1135,7 @@ class Vt {
|
|
|
1135
1135
|
if (!this.#o)
|
|
1136
1136
|
throw new Error("CanvasRenderingContext2D is missing!");
|
|
1137
1137
|
const a = "videoWidth" in e ? e.videoWidth : e.width, n = "videoHeight" in e ? e.videoHeight : e.height, i = r?.x ?? 0, o = r?.y ?? 0, s = r?.width ?? a, l = r?.height ?? n;
|
|
1138
|
-
return this.#
|
|
1138
|
+
return this.#h(s, l), this.#o.drawImage(e, i, o, s, l), this.#o.getImageData(0, 0, s, l);
|
|
1139
1139
|
}
|
|
1140
1140
|
/**
|
|
1141
1141
|
* Extract image data using WebGL2.
|
|
@@ -1148,7 +1148,7 @@ class Vt {
|
|
|
1148
1148
|
if (!this.#r || !this.#a || !this.#n)
|
|
1149
1149
|
throw new Error("WebGL2 context or resources are missing!");
|
|
1150
1150
|
const a = "videoWidth" in e ? e.videoWidth : e.width, n = "videoHeight" in e ? e.videoHeight : e.height, i = r?.x ?? 0, o = r?.y ?? 0, s = r?.width ?? a, l = r?.height ?? n, d = s * l * 4;
|
|
1151
|
-
if (this.#
|
|
1151
|
+
if (this.#h(s, l), this.isBufferDetached())
|
|
1152
1152
|
throw new Error("Buffer is detached!");
|
|
1153
1153
|
(!this.#t || this.#t.length !== d) && (this.#t = new Uint8ClampedArray(d));
|
|
1154
1154
|
const u = this.#r;
|
|
@@ -1173,7 +1173,7 @@ class Vt {
|
|
|
1173
1173
|
* @param width - The width of the canvas.
|
|
1174
1174
|
* @param height - The height of the canvas.
|
|
1175
1175
|
*/
|
|
1176
|
-
#
|
|
1176
|
+
#h(e, r) {
|
|
1177
1177
|
if (this.#l !== e || this.#i !== r) {
|
|
1178
1178
|
this.#e.width = e, this.#e.height = r, this.#l = e, this.#i = r;
|
|
1179
1179
|
const a = e * r * 4;
|
|
@@ -1248,6 +1248,7 @@ class aa {
|
|
|
1248
1248
|
* "capturing".
|
|
1249
1249
|
*/
|
|
1250
1250
|
#s = /* @__PURE__ */ new Set();
|
|
1251
|
+
#d = /* @__PURE__ */ new Set();
|
|
1251
1252
|
/**
|
|
1252
1253
|
* Creates a new CameraManager instance.
|
|
1253
1254
|
*
|
|
@@ -1325,7 +1326,7 @@ class aa {
|
|
|
1325
1326
|
*
|
|
1326
1327
|
* @param videoElement - The video element to initialize.
|
|
1327
1328
|
*/
|
|
1328
|
-
#
|
|
1329
|
+
#f(e) {
|
|
1329
1330
|
if (!(e instanceof HTMLVideoElement))
|
|
1330
1331
|
throw new Error(
|
|
1331
1332
|
`Expected an HTMLVideoElement, got ${typeof e}`,
|
|
@@ -1383,7 +1384,7 @@ class aa {
|
|
|
1383
1384
|
*/
|
|
1384
1385
|
initVideoElement(e) {
|
|
1385
1386
|
try {
|
|
1386
|
-
this.#
|
|
1387
|
+
this.#f(e);
|
|
1387
1388
|
} catch (r) {
|
|
1388
1389
|
if (this.userInitiatedAbort)
|
|
1389
1390
|
this.reset();
|
|
@@ -1401,6 +1402,9 @@ class aa {
|
|
|
1401
1402
|
addFrameCaptureCallback(e) {
|
|
1402
1403
|
return this.#s.add(e), () => this.#s.delete(e);
|
|
1403
1404
|
}
|
|
1405
|
+
addErrorCallback(e) {
|
|
1406
|
+
return this.#d.add(e), () => this.#d.delete(e);
|
|
1407
|
+
}
|
|
1404
1408
|
/**
|
|
1405
1409
|
* Cleans up the video element, and stops the stream.
|
|
1406
1410
|
*/
|
|
@@ -1460,7 +1464,7 @@ class aa {
|
|
|
1460
1464
|
}, 100);
|
|
1461
1465
|
const e = await pt().catch((a) => {
|
|
1462
1466
|
throw a instanceof B && a.code === "PERMISSION_DENIED" && f.setState({
|
|
1463
|
-
errorState:
|
|
1467
|
+
errorState: j(a),
|
|
1464
1468
|
cameraPermission: "denied",
|
|
1465
1469
|
isQueryingCameras: !1
|
|
1466
1470
|
}), a;
|
|
@@ -1539,12 +1543,12 @@ class aa {
|
|
|
1539
1543
|
e.videoElement.srcObject = r;
|
|
1540
1544
|
}
|
|
1541
1545
|
try {
|
|
1542
|
-
this.#
|
|
1546
|
+
this.#w(), await e.videoElement.play(), f.setState({
|
|
1543
1547
|
playbackState: "playback"
|
|
1544
1548
|
});
|
|
1545
1549
|
} catch (r) {
|
|
1546
1550
|
throw console.error("Failed to start playback", r), f.setState({
|
|
1547
|
-
errorState:
|
|
1551
|
+
errorState: j(r)
|
|
1548
1552
|
}), r;
|
|
1549
1553
|
}
|
|
1550
1554
|
}
|
|
@@ -1554,7 +1558,7 @@ class aa {
|
|
|
1554
1558
|
*
|
|
1555
1559
|
* @returns resolves when frame capture starts
|
|
1556
1560
|
*/
|
|
1557
|
-
async #
|
|
1561
|
+
async #m() {
|
|
1558
1562
|
const e = f.getState();
|
|
1559
1563
|
if (!this.userInitiatedAbort) {
|
|
1560
1564
|
if (this.#i()) {
|
|
@@ -1587,7 +1591,7 @@ class aa {
|
|
|
1587
1591
|
*/
|
|
1588
1592
|
startFrameCapture = async () => {
|
|
1589
1593
|
try {
|
|
1590
|
-
await this.#
|
|
1594
|
+
await this.#m();
|
|
1591
1595
|
} catch (e) {
|
|
1592
1596
|
if (this.userInitiatedAbort)
|
|
1593
1597
|
this.reset();
|
|
@@ -1601,7 +1605,7 @@ class aa {
|
|
|
1601
1605
|
* @param params - The parameters for the camera stream.
|
|
1602
1606
|
* @returns resolves when the camera stream starts
|
|
1603
1607
|
*/
|
|
1604
|
-
async #
|
|
1608
|
+
async #h({
|
|
1605
1609
|
autoplay: e = !0,
|
|
1606
1610
|
preferredCamera: r,
|
|
1607
1611
|
preferredFacing: a = "back"
|
|
@@ -1637,12 +1641,12 @@ class aa {
|
|
|
1637
1641
|
throw new Error(
|
|
1638
1642
|
`No cameras found matching the filter ${a}`
|
|
1639
1643
|
);
|
|
1640
|
-
await this.selectCamera(l), this.#
|
|
1644
|
+
await this.selectCamera(l), this.#p() && f.setState({
|
|
1641
1645
|
errorState: void 0
|
|
1642
1646
|
});
|
|
1643
1647
|
} catch (s) {
|
|
1644
1648
|
throw f.setState({
|
|
1645
|
-
errorState:
|
|
1649
|
+
errorState: j(s)
|
|
1646
1650
|
}), s;
|
|
1647
1651
|
}
|
|
1648
1652
|
const i = f.getState().selectedCamera;
|
|
@@ -1668,7 +1672,7 @@ class aa {
|
|
|
1668
1672
|
*/
|
|
1669
1673
|
async startCameraStream(e = {}) {
|
|
1670
1674
|
try {
|
|
1671
|
-
await this.#
|
|
1675
|
+
await this.#h(e);
|
|
1672
1676
|
} catch (r) {
|
|
1673
1677
|
if (this.userInitiatedAbort)
|
|
1674
1678
|
this.reset();
|
|
@@ -1681,7 +1685,7 @@ class aa {
|
|
|
1681
1685
|
*
|
|
1682
1686
|
* @returns true if the error state is a permission error
|
|
1683
1687
|
*/
|
|
1684
|
-
#
|
|
1688
|
+
#p = () => {
|
|
1685
1689
|
const e = f.getState().errorState;
|
|
1686
1690
|
return e instanceof B && e.code === "PERMISSION_DENIED";
|
|
1687
1691
|
};
|
|
@@ -1714,44 +1718,51 @@ class aa {
|
|
|
1714
1718
|
/**
|
|
1715
1719
|
* The main recognition loop. Do not call this method directly, use `#queueFrame` instead.
|
|
1716
1720
|
*/
|
|
1717
|
-
async #
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
const
|
|
1742
|
-
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1721
|
+
async #v() {
|
|
1722
|
+
try {
|
|
1723
|
+
const e = f.getState();
|
|
1724
|
+
if (this.#a === void 0) {
|
|
1725
|
+
console.error("Missing request ID");
|
|
1726
|
+
return;
|
|
1727
|
+
}
|
|
1728
|
+
if (!e.videoElement) {
|
|
1729
|
+
console.warn("Missing video element, should not happen");
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
if (!e.extractionArea) {
|
|
1733
|
+
console.warn(
|
|
1734
|
+
"Stream started before extraction area was set, skipping frame."
|
|
1735
|
+
);
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
if (!(e.videoElement.videoHeight >= e.videoElement.videoWidth == e.extractionArea.height >= e.extractionArea.width))
|
|
1739
|
+
return this.#g();
|
|
1740
|
+
if (this.#s.size !== 0) {
|
|
1741
|
+
const a = this.#n.getImageData(
|
|
1742
|
+
e.videoElement,
|
|
1743
|
+
e.extractionArea
|
|
1744
|
+
);
|
|
1745
|
+
for (const n of this.#s) {
|
|
1746
|
+
const i = le(a.data.buffer) ? this.#n.getCurrentImageData() : a, o = await n(i);
|
|
1747
|
+
if (o) {
|
|
1748
|
+
if (!(o instanceof ArrayBuffer))
|
|
1749
|
+
throw ArrayBuffer.isView(o) && this.#n.reattachArrayBuffer(
|
|
1750
|
+
o.buffer
|
|
1751
|
+
), new Error(
|
|
1752
|
+
Ne`
|
|
1753
|
+
Frame capture callback did not return an ArrayBuffer.
|
|
1754
|
+
Make sure to return the underlying buffer, not the view.
|
|
1755
|
+
`
|
|
1756
|
+
);
|
|
1757
|
+
this.#n.reattachArrayBuffer(o);
|
|
1758
|
+
}
|
|
1751
1759
|
}
|
|
1752
1760
|
}
|
|
1761
|
+
this.#g();
|
|
1762
|
+
} catch (e) {
|
|
1763
|
+
const r = j(e);
|
|
1764
|
+
throw this.#y(r), r;
|
|
1753
1765
|
}
|
|
1754
|
-
this.#g();
|
|
1755
1766
|
}
|
|
1756
1767
|
/**
|
|
1757
1768
|
* Queues the next frame to be processed.
|
|
@@ -1764,7 +1775,7 @@ class aa {
|
|
|
1764
1775
|
return;
|
|
1765
1776
|
}
|
|
1766
1777
|
this.#b(), this.#a = e.videoElement.requestVideoFrameCallback(
|
|
1767
|
-
() => void this.#
|
|
1778
|
+
() => void this.#v()
|
|
1768
1779
|
);
|
|
1769
1780
|
}
|
|
1770
1781
|
}
|
|
@@ -1772,7 +1783,7 @@ class aa {
|
|
|
1772
1783
|
* Applies a mirror effect to the video if the camera is front-facing.
|
|
1773
1784
|
* Assumes that desktop devices don't return a facing mode and that they are front-facing.
|
|
1774
1785
|
*/
|
|
1775
|
-
#
|
|
1786
|
+
#w() {
|
|
1776
1787
|
const e = f.getState().selectedCamera;
|
|
1777
1788
|
if (!e) {
|
|
1778
1789
|
console.warn("No camera selected");
|
|
@@ -1821,7 +1832,15 @@ class aa {
|
|
|
1821
1832
|
* Resets the CameraManager and stops all streams.
|
|
1822
1833
|
*/
|
|
1823
1834
|
reset() {
|
|
1824
|
-
console.debug("Resetting camera manager"), this.#s.clear(), this.userInitiatedAbort = !1, this.stopStream(), Rt();
|
|
1835
|
+
console.debug("Resetting camera manager"), this.#s.clear(), this.#d.clear(), this.userInitiatedAbort = !1, this.stopStream(), Rt();
|
|
1836
|
+
}
|
|
1837
|
+
#y(e) {
|
|
1838
|
+
for (const r of this.#d)
|
|
1839
|
+
try {
|
|
1840
|
+
r(e);
|
|
1841
|
+
} catch (a) {
|
|
1842
|
+
console.error("Error in error callback", a);
|
|
1843
|
+
}
|
|
1825
1844
|
}
|
|
1826
1845
|
}
|
|
1827
1846
|
const Bt = {
|
|
@@ -2043,7 +2062,7 @@ const lr = () => {
|
|
|
2043
2062
|
}), c(_.Trigger, {
|
|
2044
2063
|
asChild: (m) => (() => {
|
|
2045
2064
|
var g = sr();
|
|
2046
|
-
return A(g,
|
|
2065
|
+
return A(g, W(() => He(m()), {
|
|
2047
2066
|
class: "flex px-4 py-2 items-center gap-2 rounded-full bg-gray-550/90 backdrop-blur-xl whitespace-nowrap text-base color-white font-500 cursor-pointer appearance-none border-none disabled:opacity-50 disabled:cursor-not-allowed max-w-[100%] btn-focus"
|
|
2048
2067
|
}), !1, !0), y(g, c(rr, {
|
|
2049
2068
|
class: "size-6 shrink-0",
|
|
@@ -2225,14 +2244,14 @@ const hr = () => {
|
|
|
2225
2244
|
});
|
|
2226
2245
|
}, re = (t) => {
|
|
2227
2246
|
const [e, r] = Y(t, ["tooltipLabel", "children"]);
|
|
2228
|
-
return c(
|
|
2247
|
+
return c(Q.Root, {
|
|
2229
2248
|
get children() {
|
|
2230
|
-
return [c(
|
|
2249
|
+
return [c(Q.Trigger, {
|
|
2231
2250
|
asChild: (a) => {
|
|
2232
2251
|
const [, n] = Y(a(), ["aria-describedby"]);
|
|
2233
2252
|
return (() => {
|
|
2234
2253
|
var i = dr();
|
|
2235
|
-
return A(i,
|
|
2254
|
+
return A(i, W({
|
|
2236
2255
|
get "aria-label"() {
|
|
2237
2256
|
return e.tooltipLabel;
|
|
2238
2257
|
}
|
|
@@ -2241,9 +2260,9 @@ const hr = () => {
|
|
|
2241
2260
|
}), !1, !0), y(i, () => e.children), i;
|
|
2242
2261
|
})();
|
|
2243
2262
|
}
|
|
2244
|
-
}), c(
|
|
2263
|
+
}), c(Q.Positioner, {
|
|
2245
2264
|
get children() {
|
|
2246
|
-
return c(
|
|
2265
|
+
return c(Q.Content, {
|
|
2247
2266
|
class: "bg-gray-550/70 backdrop-blur color-white text-align-center p-2 rounded-md text-sm drop-shadow-md",
|
|
2248
2267
|
"aria-hidden": "true",
|
|
2249
2268
|
get children() {
|
|
@@ -2416,7 +2435,7 @@ const Ir = (t) => {
|
|
|
2416
2435
|
const s = t.initialFocusEl ? {
|
|
2417
2436
|
initialFocusEl: () => t.initialFocusEl(o)
|
|
2418
2437
|
} : {};
|
|
2419
|
-
return c(D.Root,
|
|
2438
|
+
return c(D.Root, W({
|
|
2420
2439
|
onFocusOutside: (l) => l.preventDefault(),
|
|
2421
2440
|
onInteractOutside: (l) => l.preventDefault()
|
|
2422
2441
|
}, s, r, {
|
|
@@ -2489,7 +2508,7 @@ const Ir = (t) => {
|
|
|
2489
2508
|
} = d().action;
|
|
2490
2509
|
return h;
|
|
2491
2510
|
}, b = d().type === "primary" ? "btn-primary" : "btn-secondary";
|
|
2492
|
-
return c(D.CloseTrigger,
|
|
2511
|
+
return c(D.CloseTrigger, W({
|
|
2493
2512
|
class: `btn ${b} max-w-[30ch] flex-1 min-w-0`
|
|
2494
2513
|
}, u, {
|
|
2495
2514
|
get children() {
|
|
@@ -2512,7 +2531,7 @@ const Ir = (t) => {
|
|
|
2512
2531
|
}));
|
|
2513
2532
|
}
|
|
2514
2533
|
});
|
|
2515
|
-
}, Fr = (t) => c(Ir,
|
|
2534
|
+
}, Fr = (t) => c(Ir, W({
|
|
2516
2535
|
role: "alertdialog"
|
|
2517
2536
|
}, t));
|
|
2518
2537
|
var Lr = /* @__PURE__ */ w("<p>");
|
|
@@ -2838,18 +2857,18 @@ function na(t, e, {
|
|
|
2838
2857
|
dismount: m
|
|
2839
2858
|
};
|
|
2840
2859
|
return new Promise((v) => {
|
|
2841
|
-
let C = !1, M = !1, L = !1,
|
|
2842
|
-
},
|
|
2860
|
+
let C = !1, M = !1, L = !1, G = () => {
|
|
2861
|
+
}, X = () => {
|
|
2843
2862
|
}, me = () => {
|
|
2844
2863
|
};
|
|
2845
2864
|
const te = () => {
|
|
2846
|
-
C && M && L && (
|
|
2865
|
+
C && M && L && (G(), X(), me(), v(T));
|
|
2847
2866
|
};
|
|
2848
|
-
|
|
2867
|
+
G = O.subscribe((R) => R.feedbackLayer, (R) => {
|
|
2849
2868
|
R && (M = !0), te();
|
|
2850
2869
|
}, {
|
|
2851
2870
|
fireImmediately: !0
|
|
2852
|
-
}),
|
|
2871
|
+
}), X = O.subscribe((R) => R.overlayLayer, (R) => {
|
|
2853
2872
|
R && (L = !0), te();
|
|
2854
2873
|
}, {
|
|
2855
2874
|
fireImmediately: !0
|
package/package.json
CHANGED
|
@@ -88,6 +88,7 @@ export declare class CameraManager {
|
|
|
88
88
|
* @returns a cleanup function to remove the callback
|
|
89
89
|
*/
|
|
90
90
|
addFrameCaptureCallback(frameCaptureCallback: FrameCaptureCallback): () => boolean;
|
|
91
|
+
addErrorCallback(errorCallback: ErrorCallback): () => boolean;
|
|
91
92
|
/**
|
|
92
93
|
* Cleans up the video element, and stops the stream.
|
|
93
94
|
*/
|
|
@@ -169,6 +170,7 @@ export declare class CameraManager {
|
|
|
169
170
|
* @returns The frame.
|
|
170
171
|
*/
|
|
171
172
|
export type FrameCaptureCallback = (frame: ImageData) => Promisable<ArrayBufferLike | void>;
|
|
173
|
+
export type ErrorCallback = (error: Error) => void;
|
|
172
174
|
/**
|
|
173
175
|
* A camera getter.
|
|
174
176
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraManager.d.ts","sourceRoot":"","sources":["../../src/core/CameraManager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AASnE,OAAO,EAGL,kBAAkB,IAAI,KAAK,EAC5B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EACL,cAAc,EAGd,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AACH,qBAAa,aAAa;;IA4CxB;;;OAGG;IACH,IAAI,kBAAkB,IAIQ,OAAO,CAFpC;IAED,IAAI,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAEpC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,cAAc,EAAE,cAAc;IAkBhD;;;;OAIG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AAC;AAErB;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,6EAA6E;IAC7E,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,oBAGhC,CAAC"}
|
package/types/index.rollup.d.ts
CHANGED
|
@@ -221,6 +221,7 @@ export declare class CameraManager {
|
|
|
221
221
|
* @returns a cleanup function to remove the callback
|
|
222
222
|
*/
|
|
223
223
|
addFrameCaptureCallback(frameCaptureCallback: FrameCaptureCallback): () => boolean;
|
|
224
|
+
addErrorCallback(errorCallback: ErrorCallback_2): () => boolean;
|
|
224
225
|
/**
|
|
225
226
|
* Cleans up the video element, and stops the stream.
|
|
226
227
|
*/
|
|
@@ -581,6 +582,9 @@ export declare const defaultCameraManagerOptions: CameraManagerOptions;
|
|
|
581
582
|
*/
|
|
582
583
|
export declare type DismountCallback = () => void;
|
|
583
584
|
|
|
585
|
+
declare type ErrorCallback_2 = (error: Error) => void;
|
|
586
|
+
export { ErrorCallback_2 as ErrorCallback }
|
|
587
|
+
|
|
584
588
|
/**
|
|
585
589
|
* The extraction area.
|
|
586
590
|
*/
|