@microblink/camera-manager 7.2.2 → 7.2.3

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.
@@ -48,28 +48,6 @@ if (typeof HTMLVideoElement !== "undefined" && !("requestVideoFrameCallback" in
48
48
  delete this._rvfcpolyfillmap[handle];
49
49
  };
50
50
  }
51
- const initialState$1 = {
52
- cameras: [],
53
- facingFilter: void 0,
54
- videoElement: void 0,
55
- playbackState: "idle",
56
- selectedCamera: void 0,
57
- isSwappingCamera: false,
58
- isQueryingCameras: false,
59
- mirrorX: false,
60
- errorState: void 0
61
- };
62
- const cameraManagerStore = createStore()(
63
- // this is important! Otherwise solid-zustand will start mutating the initial state
64
- subscribeWithSelector(() => structuredClone(initialState$1))
65
- );
66
- const resetCameraManagerStore = () => {
67
- console.debug("Stopping all cameras and resetting the `cameraManagerStore`.");
68
- cameraManagerStore.getState().cameras.forEach((camera) => {
69
- camera.stopStream();
70
- });
71
- cameraManagerStore.setState(structuredClone(initialState$1));
72
- };
73
51
  const backCameraKeywords = [
74
52
  // English
75
53
  "back",
@@ -973,6 +951,28 @@ class Camera {
973
951
  return this.activeStream.getVideoTracks()[0];
974
952
  }
975
953
  }
954
+ const initialState$1 = {
955
+ cameras: [],
956
+ facingFilter: void 0,
957
+ videoElement: void 0,
958
+ playbackState: "idle",
959
+ selectedCamera: void 0,
960
+ isSwappingCamera: false,
961
+ isQueryingCameras: false,
962
+ mirrorX: false,
963
+ errorState: void 0
964
+ };
965
+ const cameraManagerStore = createStore()(
966
+ // this is important! Otherwise solid-zustand will start mutating the initial state
967
+ subscribeWithSelector(() => structuredClone(initialState$1))
968
+ );
969
+ const resetCameraManagerStore = () => {
970
+ console.debug("Stopping all cameras and resetting the `cameraManagerStore`.");
971
+ cameraManagerStore.getState().cameras.forEach((camera) => {
972
+ camera.stopStream();
973
+ });
974
+ cameraManagerStore.setState(structuredClone(initialState$1));
975
+ };
976
976
  const ORIGINAL_ATTACH_SHADOW = Element.prototype.attachShadow;
977
977
  function isShady() {
978
978
  return typeof window.ShadyDOM !== "undefined" && typeof ShadowRoot !== "undefined";
@@ -2238,7 +2238,9 @@ const CameraUiStoreProvider = (props) => {
2238
2238
  // eslint-disable-next-line solid/reactivity
2239
2239
  showTorchButton: props.showTorchButton,
2240
2240
  // eslint-disable-next-line solid/reactivity
2241
- showCloseButton: props.showCloseButton
2241
+ showCloseButton: props.showCloseButton,
2242
+ // eslint-disable-next-line solid/reactivity
2243
+ showCameraErrorModal: props.showCameraErrorModal
2242
2244
  };
2243
2245
  onCleanup(() => {
2244
2246
  console.debug("CameraUiStoreProvider cleanup");
@@ -3065,7 +3067,8 @@ const CAPTURE_SCREEN_SHADOW_ROOT_HOST_ID = "capture-screen-host";
3065
3067
  const CaptureScreen = () => {
3066
3068
  const {
3067
3069
  cameraManager,
3068
- mountTarget
3070
+ mountTarget,
3071
+ showCameraErrorModal
3069
3072
  } = useCameraUiStore();
3070
3073
  const [videoRef, setVideoRef] = createSignal();
3071
3074
  const [feedbackRef, setFeedbackRef] = createSignal();
@@ -3172,7 +3175,12 @@ const CaptureScreen = () => {
3172
3175
  use(setVideoRef, _el$6);
3173
3176
  use(setFeedbackRef, _el$7);
3174
3177
  use(setOverlayLayerRef, _el$8);
3175
- insert(_el$5, createComponent(CameraErrorModal, {}), null);
3178
+ insert(_el$5, createComponent(Show, {
3179
+ when: showCameraErrorModal,
3180
+ get children() {
3181
+ return createComponent(CameraErrorModal, {});
3182
+ }
3183
+ }), null);
3176
3184
  effect((_$p) => (_$p = fitMode()) != null ? _el$6.style.setProperty("object-fit", _$p) : _el$6.style.removeProperty("object-fit"));
3177
3185
  return _el$5;
3178
3186
  })()];
@@ -3258,7 +3266,8 @@ function createCameraManagerUi(cameraManager, target, {
3258
3266
  localizationStrings,
3259
3267
  showMirrorCameraButton = false,
3260
3268
  showTorchButton = true,
3261
- showCloseButton = true
3269
+ showCloseButton = true,
3270
+ showCameraErrorModal = true
3262
3271
  } = {}) {
3263
3272
  let mountTarget;
3264
3273
  const dismountCallbacks = /* @__PURE__ */ new Set();
@@ -3316,6 +3325,7 @@ function createCameraManagerUi(cameraManager, target, {
3316
3325
  showMirrorCameraButton,
3317
3326
  showTorchButton,
3318
3327
  showCloseButton,
3328
+ showCameraErrorModal,
3319
3329
  mountTarget,
3320
3330
  get children() {
3321
3331
  return createComponent(RootComponent, {});
@@ -3400,6 +3410,7 @@ if (globalThis.__CAMERA_MANAGER__ !== testSymbol) {
3400
3410
  }
3401
3411
  export {
3402
3412
  Camera,
3413
+ CameraError,
3403
3414
  CameraManager,
3404
3415
  MOUNT_POINT_ID,
3405
3416
  VideoFrameProcessor,