ablok-components 0.3.136 → 0.3.137

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.
@@ -2,6 +2,6 @@ import e from "../../../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./base-camera.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region src/components/molecules/base-camera/base-camera.vue
5
- var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-67efb17e"]]);
5
+ var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-bdd9593d"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -123,6 +123,10 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
123
123
  type: BooleanConstructor;
124
124
  default: boolean;
125
125
  };
126
+ enableTorch: {
127
+ type: BooleanConstructor;
128
+ default: boolean;
129
+ };
126
130
  enableShutterAnimation: {
127
131
  type: BooleanConstructor;
128
132
  default: boolean;
@@ -141,6 +145,9 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
141
145
  permission: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../../../utilities/camera/types').CameraPermission>;
142
146
  zoom: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<number>;
143
147
  zoomCapability: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../../../utilities/camera/types').ZoomCapability | null>;
148
+ torch: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
149
+ torchCapability: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
150
+ canLockExposure: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
144
151
  isLive: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
145
152
  isPaused: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
146
153
  isStarting: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
@@ -155,6 +162,8 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
155
162
  selectDevice: (deviceId: string) => Promise<boolean>;
156
163
  setResolution: (r: Resolution) => Promise<boolean>;
157
164
  setZoom: (z: number) => Promise<boolean>;
165
+ setTorch: (on: boolean) => Promise<boolean>;
166
+ setExposureLocked: (locked: boolean) => Promise<boolean>;
158
167
  refreshDevices: () => Promise<void>;
159
168
  bindVideo: (el: HTMLVideoElement | null) => void;
160
169
  };
@@ -287,6 +296,10 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
287
296
  type: BooleanConstructor;
288
297
  default: boolean;
289
298
  };
299
+ enableTorch: {
300
+ type: BooleanConstructor;
301
+ default: boolean;
302
+ };
290
303
  enableShutterAnimation: {
291
304
  type: BooleanConstructor;
292
305
  default: boolean;
@@ -318,6 +331,7 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
318
331
  enableScreenFlash: boolean;
319
332
  screenFlashColor: string;
320
333
  screenFlashFullscreen: boolean;
334
+ enableTorch: boolean;
321
335
  enableShutterAnimation: boolean;
322
336
  }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, any>;
323
337
  declare const _default: typeof __VLS_export;
@@ -5,12 +5,12 @@ import { useCamera as i } from "../../../composables/useCamera.js";
5
5
  import a from "../camera-preview/camera-preview.js";
6
6
  import o from "../../atoms/zoom-slider/zoom-slider.js";
7
7
  import s from "../../../assets/img/guide.js";
8
- import { Teleport as ee, Transition as te, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, normalizeStyle as g, onMounted as _, onScopeDispose as ne, openBlock as v, ref as y, toDisplayString as b, unref as x, watch as S, withCtx as C } from "vue";
8
+ import { Teleport as c, Transition as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, normalizeClass as ee, normalizeStyle as te, onMounted as ne, onScopeDispose as re, openBlock as _, ref as v, toDisplayString as y, unref as b, watch as x, withCtx as S } from "vue";
9
9
  //#region src/components/molecules/base-camera/base-camera.vue?vue&type=script&setup=true&lang.ts
10
- var re = {
10
+ var ie = {
11
11
  class: "base-camera position-relative w-100 user-select-none",
12
12
  "data-bs-theme": "dark"
13
- }, ie = ["src"], ae = { class: "position-absolute top-0 start-0 end-0 d-flex align-items-start p-2 gap-2 base-camera__top-bar" }, oe = { class: "base-camera__select-col" }, se = { key: 1 }, ce = { class: "d-flex align-items-center ms-auto gap-2" }, le = ["aria-label"], ue = ["disabled"], de = {
13
+ }, C = ["src"], ae = { class: "position-absolute top-0 start-0 end-0 d-flex align-items-start p-2 gap-2 base-camera__top-bar" }, oe = { class: "base-camera__select-col" }, se = { key: 1 }, ce = { class: "d-flex align-items-center ms-auto gap-2" }, le = ["aria-label"], ue = ["disabled"], de = {
14
14
  key: 1,
15
15
  class: "position-absolute top-0 start-0 w-100 h-100 d-flex flex-column align-items-center justify-content-center text-center p-3 bg-black bg-opacity-50"
16
16
  }, fe = {
@@ -23,30 +23,30 @@ var re = {
23
23
  }, me = { class: "mb-2" }, he = { class: "position-absolute bottom-0 start-0 end-0 p-3 d-flex flex-column gap-2 align-items-center" }, ge = {
24
24
  key: 0,
25
25
  class: "d-flex align-items-center justify-content-center gap-4 w-100"
26
- }, w = ["disabled", "aria-label"], _e = {
26
+ }, _e = ["disabled", "aria-label"], ve = {
27
27
  key: 0,
28
28
  viewBox: "0 0 24 24",
29
29
  width: "22",
30
30
  height: "22",
31
31
  fill: "currentColor",
32
32
  "aria-hidden": "true"
33
- }, ve = {
33
+ }, ye = {
34
34
  key: 1,
35
35
  viewBox: "0 0 24 24",
36
36
  width: "22",
37
37
  height: "22",
38
38
  fill: "currentColor",
39
39
  "aria-hidden": "true"
40
- }, ye = ["disabled"], be = {
40
+ }, be = ["disabled"], xe = {
41
41
  key: 2,
42
42
  class: "base-camera__countdown-overlay",
43
43
  role: "status",
44
44
  "aria-live": "polite",
45
45
  "aria-atomic": "true"
46
- }, xe = ["data-countdown"], Se = {
46
+ }, Se = ["data-countdown"], Ce = {
47
47
  key: 0,
48
48
  class: "base-camera__zoom"
49
- }, T = /*@__PURE__*/ m({
49
+ }, we = 200, w = /*@__PURE__*/ g({
50
50
  __name: "base-camera",
51
51
  props: {
52
52
  modelValue: { type: null },
@@ -172,6 +172,10 @@ var re = {
172
172
  type: Boolean,
173
173
  default: !1
174
174
  },
175
+ enableTorch: {
176
+ type: Boolean,
177
+ default: !0
178
+ },
175
179
  enableShutterAnimation: {
176
180
  type: Boolean,
177
181
  default: !0
@@ -184,238 +188,243 @@ var re = {
184
188
  "error",
185
189
  "state"
186
190
  ],
187
- setup(s, { expose: m, emit: T }) {
188
- let E = s, D = T, O = y(null), k = c(() => O.value?.videoEl ?? null), A = c(() => E.resolutions[E.ratio] ?? {
191
+ setup(s, { expose: g, emit: w }) {
192
+ let T = s, E = w, D = v(null), O = u(() => D.value?.videoEl ?? null), k = u(() => T.resolutions[T.ratio] ?? {
189
193
  width: 720,
190
194
  height: 960
191
- }), j = i({
192
- preferredFacing: E.defaultRearCamera ? "environment" : "user",
193
- resolution: A.value,
194
- videoRef: k,
195
- onWarning: (e) => D("error", e)
196
- }), M = c(() => E.enableMirrorCamera && j.activeFacing.value !== "environment"), Ce = c(() => E.enableSelectDevice && j.devices.value.length > 1), we = c(() => E.enableSwitchCamera && j.canSwitch.value), Te = c(() => E.enableZoomSlider && j.zoomCapability.value !== null), N = c(() => j.isLive.value || j.isPaused.value), P = y(!1), F = y(0), I = y(!1), L = y(0), R = y(!1), z = y(0), B = y(E.enableScreenFlash);
197
- S(() => E.enableScreenFlash, (e) => {
198
- B.value = e;
195
+ }), A = i({
196
+ preferredFacing: T.defaultRearCamera ? "environment" : "user",
197
+ resolution: k.value,
198
+ videoRef: O,
199
+ onWarning: (e) => E("error", e)
200
+ }), j = u(() => T.enableMirrorCamera && A.activeFacing.value !== "environment"), Te = u(() => T.enableSelectDevice && A.devices.value.length > 1), Ee = u(() => T.enableSwitchCamera && A.canSwitch.value), De = u(() => T.enableZoomSlider && A.zoomCapability.value !== null), M = u(() => A.isLive.value || A.isPaused.value), N = v(!1), P = v(0), F = v(!1), I = v(0), L = v(!1), R = v(0), z = v(T.enableScreenFlash);
201
+ x(() => T.enableScreenFlash, (e) => {
202
+ z.value = e;
199
203
  });
200
- let V = null, H = null, U = null, W = null, G = null, K = null, q = null, J = null, Y = !1, X = y(E.zoom);
201
- S(() => E.zoom, (e) => {
202
- X.value = e;
203
- }), S(X, (e) => {
204
- j.setZoom(e), e !== E.zoom && D("update:zoom", e);
205
- }), S(j.zoom, (e) => {
206
- j.zoomCapability.value && e !== X.value && (X.value = e);
207
- }), S(j.zoomCapability, (e) => {
208
- e && j.setZoom(X.value);
209
- }), S(j.state, (e) => D("state", e)), S(j.error, (e) => {
210
- e && D("error", e);
211
- }), S(A, (e) => void j.setResolution(e)), _(() => {
212
- E.autoStart && j.start();
213
- }), ne(() => {
214
- Y = !0, H && clearTimeout(H), U && clearTimeout(U), G && clearTimeout(G), H = null, U = null, G = null, J?.(!1), J = null, Z(), Q(), F.value = 0, I.value = !1, R.value = !1;
204
+ let B = null, V = null, H = null, U = null, W = null, G = null, K = null, q = null, J = !1, Y = v(T.zoom);
205
+ x(() => T.zoom, (e) => {
206
+ Y.value = e;
207
+ }), x(Y, (e) => {
208
+ A.setZoom(e), e !== T.zoom && E("update:zoom", e);
209
+ }), x(A.zoom, (e) => {
210
+ A.zoomCapability.value && e !== Y.value && (Y.value = e);
211
+ }), x(A.zoomCapability, (e) => {
212
+ e && A.setZoom(Y.value);
213
+ }), x(A.state, (e) => E("state", e)), x(A.error, (e) => {
214
+ e && E("error", e);
215
+ }), x(k, (e) => void A.setResolution(e)), ne(() => {
216
+ T.autoStart && A.start();
217
+ }), re(() => {
218
+ J = !0, V && clearTimeout(V), H && clearTimeout(H), W && clearTimeout(W), V = null, H = null, W = null, q?.(!1), q = null, X(), Z(), P.value = 0, F.value = !1, L.value = !1;
215
219
  });
216
- function Z() {
217
- U && clearTimeout(U), U = null, I.value = !1, W?.(), W = null;
220
+ function X() {
221
+ H && clearTimeout(H), H = null, F.value = !1, U?.(), U = null;
218
222
  }
219
- function Ee() {
220
- if (!E.enableShutterAnimation) return Promise.resolve();
221
- Z(), L.value++, I.value = !0;
223
+ function Oe() {
224
+ if (!T.enableShutterAnimation) return Promise.resolve();
225
+ X(), I.value++, F.value = !0;
222
226
  let e = new Promise((e) => {
223
- W = e;
227
+ U = e;
224
228
  });
225
- return U = setTimeout(Z, 650), e;
229
+ return H = setTimeout(X, 650), e;
226
230
  }
227
- function Q() {
228
- K && clearTimeout(K), K = null, q?.(), q = null;
231
+ function Z() {
232
+ G && clearTimeout(G), G = null, K?.(), K = null;
229
233
  }
230
- function De() {
231
- if (!B.value) return {
234
+ function ke() {
235
+ if (!z.value) return {
232
236
  peak: Promise.resolve(),
233
237
  faded: Promise.resolve()
234
238
  };
235
- G && clearTimeout(G), Q(), z.value++, R.value = !0;
239
+ W && clearTimeout(W), Z(), R.value++, L.value = !0;
236
240
  let e = new Promise((e) => {
237
- q = e;
241
+ K = e;
238
242
  });
239
- return G = setTimeout(() => {
240
- G = null, R.value = !1, K = setTimeout(Q, 400);
243
+ return W = setTimeout(() => {
244
+ W = null, L.value = !1, G = setTimeout(Z, 400);
241
245
  }, 350), {
242
246
  peak: new Promise((e) => setTimeout(e, 120)),
243
247
  faded: e
244
248
  };
245
249
  }
246
- async function Oe() {
247
- let e = k.value;
248
- if (!e || !N.value || P.value) return null;
249
- P.value = !0;
250
+ function Ae(e) {
251
+ return new Promise((t) => setTimeout(t, e));
252
+ }
253
+ async function je() {
254
+ let e = O.value;
255
+ if (!e || !M.value || N.value) return null;
256
+ N.value = !0;
257
+ let t = T.enableTorch && A.torchCapability.value, i = !1, a = !1;
250
258
  try {
251
- let t = De();
252
- if (await t.peak, Y || !N.value) return null;
253
- let i = n(e, {
254
- width: A.value.width,
255
- height: A.value.height,
256
- mirror: M.value,
257
- filter: E.filter,
258
- tintColor: E.tintColor,
259
- tintIntensity: E.tintIntensity
260
- }), a = Ee(), o = await r(i, { asBlob: E.emitBlob });
261
- return await Promise.all([t.faded, a]), Y ? null : (D("update:modelValue", o), D("capture", o, i), o);
259
+ t ? (i = await A.setTorch(!0), i && await Ae(we)) : z.value && (a = await A.setExposureLocked(!0));
260
+ let o = ke();
261
+ if (await o.peak, J || !M.value) return null;
262
+ let s = n(e, {
263
+ width: k.value.width,
264
+ height: k.value.height,
265
+ mirror: j.value,
266
+ filter: T.filter,
267
+ tintColor: T.tintColor,
268
+ tintIntensity: T.tintIntensity
269
+ }), c = Oe(), l = await r(s, { asBlob: T.emitBlob });
270
+ return await Promise.all([o.faded, c]), J ? null : (E("update:modelValue", l), E("capture", l, s), l);
262
271
  } finally {
263
- P.value = !1;
272
+ i && A.setTorch(!1), a && A.setExposureLocked(!1), N.value = !1;
264
273
  }
265
274
  }
266
- function ke() {
275
+ function Q() {
267
276
  return new Promise((e) => {
268
- J = e, H = setTimeout(() => {
269
- H = null, J = null, e(!0);
277
+ q = e, V = setTimeout(() => {
278
+ V = null, q = null, e(!0);
270
279
  }, 1e3);
271
280
  });
272
281
  }
273
- async function Ae() {
274
- let e = Number.isFinite(E.countdown) ? Math.max(0, Math.floor(E.countdown)) : 0;
275
- for (let t = e; t > 0; t--) if (F.value = t, !await ke()) return null;
276
- return F.value = 0, Y ? null : Oe();
282
+ async function Me() {
283
+ let e = Number.isFinite(T.countdown) ? Math.max(0, Math.floor(T.countdown)) : 0;
284
+ for (let t = e; t > 0; t--) if (P.value = t, !await Q()) return null;
285
+ return P.value = 0, J ? null : je();
277
286
  }
278
287
  function $() {
279
- return V || (!k.value || !N.value ? Promise.resolve(null) : (V = Ae().finally(() => {
280
- F.value = 0, V = null;
281
- }), V));
288
+ return B || (!O.value || !M.value ? Promise.resolve(null) : (B = Me().finally(() => {
289
+ P.value = 0, B = null;
290
+ }), B));
282
291
  }
283
- function je(e) {
292
+ function Ne(e) {
284
293
  let t = e.target.value;
285
- t && j.selectDevice(t);
294
+ t && A.selectDevice(t);
286
295
  }
287
- function Me(e, t) {
296
+ function Pe(e, t) {
288
297
  if (e.label) return e.label;
289
298
  let n = e.facing === "user" ? "Front" : e.facing === "environment" ? "Back" : "";
290
299
  return n ? `${n} camera` : `Camera ${t + 1}`;
291
300
  }
292
- return m({
301
+ return g({
293
302
  onCapture: $,
294
- camera: j,
295
- zoom: X
296
- }), (n, r) => (v(), d("div", re, [p(a, {
303
+ camera: A,
304
+ zoom: Y
305
+ }), (n, r) => (_(), p("div", ie, [h(a, {
297
306
  ref_key: "previewRef",
298
- ref: O,
307
+ ref: D,
299
308
  ratio: s.ratio,
300
309
  resolutions: s.resolutions,
301
- mirror: M.value,
310
+ mirror: j.value,
302
311
  filter: s.filter,
303
312
  "tint-color": s.tintColor,
304
313
  "tint-intensity": s.tintIntensity
305
314
  }, {
306
- default: C(() => [
307
- s.enableGuide && s.guideSrc ? (v(), d("img", {
315
+ default: S(() => [
316
+ s.enableGuide && s.guideSrc ? (_(), p("img", {
308
317
  key: 0,
309
318
  src: s.guideSrc,
310
319
  class: "position-absolute top-0 start-0 w-100 h-100 base-camera__guide",
311
320
  alt: "",
312
321
  "aria-hidden": "true"
313
- }, null, 8, ie)) : u("", !0),
314
- f("div", ae, [f("div", oe, [Ce.value && x(j).activeDeviceId ? (v(), l(t, {
322
+ }, null, 8, C)) : f("", !0),
323
+ m("div", ae, [m("div", oe, [Te.value && b(A).activeDeviceId ? (_(), d(t, {
315
324
  key: 0,
316
325
  class: "base-camera__select",
317
- modelValue: x(j).activeDeviceId.value,
318
- "onUpdate:modelValue": r[0] ||= (e) => x(j).activeDeviceId.value = e,
319
- disabled: x(j).isStarting.value,
326
+ modelValue: b(A).activeDeviceId.value,
327
+ "onUpdate:modelValue": r[0] ||= (e) => b(A).activeDeviceId.value = e,
328
+ disabled: b(A).isStarting.value,
320
329
  "aria-label": "Select camera",
321
- onChange: je,
322
- options: x(j).devices.value.map((e, t) => ({
330
+ onChange: Ne,
331
+ options: b(A).devices.value.map((e, t) => ({
323
332
  value: e.deviceId,
324
- text: Me(e, t)
333
+ text: Pe(e, t)
325
334
  })),
326
335
  variant: "dark"
327
336
  }, null, 8, [
328
337
  "modelValue",
329
338
  "disabled",
330
339
  "options"
331
- ])) : (v(), d("span", se))]), f("div", ce, [s.enableScreenFlash ? (v(), d("button", {
340
+ ])) : (_(), p("span", se))]), m("div", ce, [s.enableScreenFlash ? (_(), p("button", {
332
341
  key: 0,
333
342
  type: "button",
334
343
  class: "btn btn-dark bg-opacity-50 base-camera__icon-btn",
335
- "aria-label": B.value ? "Flash On" : "Flash Off",
336
- onClick: r[1] ||= (e) => B.value = !B.value
337
- }, [B.value ? (v(), l(e, {
344
+ "aria-label": z.value ? "Flash On" : "Flash Off",
345
+ onClick: r[1] ||= (e) => z.value = !z.value
346
+ }, [z.value ? (_(), d(e, {
338
347
  key: 0,
339
348
  symbol: "zap"
340
- })) : (v(), l(e, {
349
+ })) : (_(), d(e, {
341
350
  key: 1,
342
351
  symbol: "zap-off"
343
- }))], 8, le)) : u("", !0), we.value ? (v(), d("button", {
352
+ }))], 8, le)) : f("", !0), Ee.value ? (_(), p("button", {
344
353
  key: 1,
345
354
  type: "button",
346
355
  class: "btn btn-dark bg-opacity-50 base-camera__icon-btn",
347
- disabled: x(j).isStarting.value,
356
+ disabled: b(A).isStarting.value,
348
357
  "aria-label": "Switch camera",
349
- onClick: r[2] ||= (e) => x(j).switchCamera()
350
- }, [p(e, { symbol: "switch-camera" })], 8, ue)) : u("", !0)])]),
351
- x(j).isStarting.value || x(j).state.value === "error" || x(j).state.value === "idle" && !s.autoStart ? (v(), d("div", de, [x(j).isStarting.value ? (v(), d("div", fe, [...r[9] ||= [f("span", { class: "visually-hidden" }, "Starting camera…", -1)]])) : x(j).state.value === "error" ? (v(), d("div", pe, [f("div", me, b(x(j).error.value?.message ?? "Camera error"), 1), x(j).error.value?.code !== "not-allowed" && x(j).error.value?.code !== "unsupported" ? (v(), d("button", {
358
+ onClick: r[2] ||= (e) => b(A).switchCamera()
359
+ }, [h(e, { symbol: "switch-camera" })], 8, ue)) : f("", !0)])]),
360
+ b(A).isStarting.value || b(A).state.value === "error" || b(A).state.value === "idle" && !s.autoStart ? (_(), p("div", de, [b(A).isStarting.value ? (_(), p("div", fe, [...r[9] ||= [m("span", { class: "visually-hidden" }, "Starting camera…", -1)]])) : b(A).state.value === "error" ? (_(), p("div", pe, [m("div", me, y(b(A).error.value?.message ?? "Camera error"), 1), b(A).error.value?.code !== "not-allowed" && b(A).error.value?.code !== "unsupported" ? (_(), p("button", {
352
361
  key: 0,
353
362
  type: "button",
354
363
  class: "btn btn-sm btn-outline-light",
355
- onClick: r[3] ||= (e) => x(j).start()
356
- }, " Retry ")) : u("", !0)])) : (v(), d("button", {
364
+ onClick: r[3] ||= (e) => b(A).start()
365
+ }, " Retry ")) : f("", !0)])) : (_(), p("button", {
357
366
  key: 2,
358
367
  type: "button",
359
368
  class: "btn btn-light",
360
- onClick: r[4] ||= (e) => x(j).start()
361
- }, "Start camera"))])) : u("", !0),
362
- f("div", he, [s.enableControls ? (v(), d("div", ge, [
363
- f("button", {
369
+ onClick: r[4] ||= (e) => b(A).start()
370
+ }, "Start camera"))])) : f("", !0),
371
+ m("div", he, [s.enableControls ? (_(), p("div", ge, [
372
+ m("button", {
364
373
  type: "button",
365
374
  class: "btn btn-dark bg-opacity-50 rounded-circle base-camera__icon-btn",
366
- disabled: x(j).isStarting.value,
367
- "aria-label": x(j).isLive.value ? "Pause" : "Start",
368
- onClick: r[5] ||= (e) => x(j).toggle()
369
- }, [x(j).isLive.value ? (v(), d("svg", _e, [...r[10] ||= [f("rect", {
375
+ disabled: b(A).isStarting.value,
376
+ "aria-label": b(A).isLive.value ? "Pause" : "Start",
377
+ onClick: r[5] ||= (e) => b(A).toggle()
378
+ }, [b(A).isLive.value ? (_(), p("svg", ve, [...r[10] ||= [m("rect", {
370
379
  x: "6",
371
380
  y: "5",
372
381
  width: "4",
373
382
  height: "14",
374
383
  rx: "1"
375
- }, null, -1), f("rect", {
384
+ }, null, -1), m("rect", {
376
385
  x: "14",
377
386
  y: "5",
378
387
  width: "4",
379
388
  height: "14",
380
389
  rx: "1"
381
- }, null, -1)]])) : (v(), d("svg", ve, [...r[11] ||= [f("path", { d: "M8 5v14l11-7z" }, null, -1)]]))], 8, w),
382
- f("button", {
390
+ }, null, -1)]])) : (_(), p("svg", ye, [...r[11] ||= [m("path", { d: "M8 5v14l11-7z" }, null, -1)]]))], 8, _e),
391
+ m("button", {
383
392
  type: "button",
384
393
  class: "btn btn-light rounded-circle base-camera__shutter",
385
- disabled: !N.value || P.value || F.value > 0,
394
+ disabled: !M.value || N.value || P.value > 0,
386
395
  "aria-label": "Capture photo",
387
396
  onClick: r[6] ||= (e) => $()
388
- }, [...r[12] ||= [f("span", { class: "base-camera__shutter-inner" }, null, -1)]], 8, ye),
389
- f("button", {
397
+ }, [...r[12] ||= [m("span", { class: "base-camera__shutter-inner" }, null, -1)]], 8, be),
398
+ m("button", {
390
399
  type: "button",
391
400
  class: "btn btn-dark bg-opacity-50 rounded-circle base-camera__icon-btn",
392
401
  "aria-label": "Stop camera",
393
- onClick: r[7] ||= (e) => x(j).stop()
394
- }, [p(e, { symbol: "x" })])
395
- ])) : u("", !0)]),
396
- F.value ? (v(), d("div", be, [(v(), d("p", {
397
- key: F.value,
402
+ onClick: r[7] ||= (e) => b(A).stop()
403
+ }, [h(e, { symbol: "x" })])
404
+ ])) : f("", !0)]),
405
+ P.value ? (_(), p("div", xe, [(_(), p("p", {
406
+ key: P.value,
398
407
  class: "base-camera__countdown",
399
- "data-countdown": F.value
400
- }, b(F.value), 9, xe))])) : u("", !0),
401
- I.value ? (v(), d("div", {
402
- key: L.value,
408
+ "data-countdown": P.value
409
+ }, y(P.value), 9, Se))])) : f("", !0),
410
+ F.value ? (_(), p("div", {
411
+ key: I.value,
403
412
  class: "base-camera__shutter-effect",
404
413
  "aria-hidden": "true"
405
- }, [...r[13] ||= [f("span", { class: "base-camera__shutter-aperture" }, null, -1)]])) : u("", !0),
406
- (v(), l(ee, {
414
+ }, [...r[13] ||= [m("span", { class: "base-camera__shutter-aperture" }, null, -1)]])) : f("", !0),
415
+ (_(), d(c, {
407
416
  to: "body",
408
417
  disabled: !s.screenFlashFullscreen
409
- }, [p(te, {
418
+ }, [h(l, {
410
419
  name: "base-camera-flash",
411
- onAfterLeave: Q
420
+ onAfterLeave: Z
412
421
  }, {
413
- default: C(() => [R.value ? (v(), d("div", {
414
- key: z.value,
415
- class: h(["base-camera__screen-flash", { "base-camera__screen-flash--fullscreen": s.screenFlashFullscreen }]),
416
- style: g({ background: s.screenFlashColor }),
422
+ default: S(() => [L.value ? (_(), p("div", {
423
+ key: R.value,
424
+ class: ee(["base-camera__screen-flash", { "base-camera__screen-flash--fullscreen": s.screenFlashFullscreen }]),
425
+ style: te({ background: s.screenFlashColor }),
417
426
  "aria-hidden": "true"
418
- }, null, 6)) : u("", !0)]),
427
+ }, null, 6)) : f("", !0)]),
419
428
  _: 1
420
429
  })], 8, ["disabled"]))
421
430
  ]),
@@ -427,19 +436,19 @@ var re = {
427
436
  "filter",
428
437
  "tint-color",
429
438
  "tint-intensity"
430
- ]), Te.value ? (v(), d("div", Se, [p(o, {
431
- modelValue: X.value,
432
- "onUpdate:modelValue": r[8] ||= (e) => X.value = e,
433
- min: x(j).zoomCapability.value.min,
434
- max: x(j).zoomCapability.value.max,
435
- step: x(j).zoomCapability.value.step
439
+ ]), De.value ? (_(), p("div", Ce, [h(o, {
440
+ modelValue: Y.value,
441
+ "onUpdate:modelValue": r[8] ||= (e) => Y.value = e,
442
+ min: b(A).zoomCapability.value.min,
443
+ max: b(A).zoomCapability.value.max,
444
+ step: b(A).zoomCapability.value.step
436
445
  }, null, 8, [
437
446
  "modelValue",
438
447
  "min",
439
448
  "max",
440
449
  "step"
441
- ])])) : u("", !0)]));
450
+ ])])) : f("", !0)]));
442
451
  }
443
452
  });
444
453
  //#endregion
445
- export { T as default };
454
+ export { w as default };
@@ -17,6 +17,9 @@ export declare function useCamera(options?: UseCameraOptions): {
17
17
  permission: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').CameraPermission>;
18
18
  zoom: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<number>;
19
19
  zoomCapability: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').ZoomCapability | null>;
20
+ torch: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
21
+ torchCapability: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
22
+ canLockExposure: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
20
23
  isLive: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
21
24
  isPaused: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
22
25
  isStarting: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
@@ -31,6 +34,8 @@ export declare function useCamera(options?: UseCameraOptions): {
31
34
  selectDevice: (deviceId: string) => Promise<boolean>;
32
35
  setResolution: (r: Resolution) => Promise<boolean>;
33
36
  setZoom: (z: number) => Promise<boolean>;
37
+ setTorch: (on: boolean) => Promise<boolean>;
38
+ setExposureLocked: (locked: boolean) => Promise<boolean>;
34
39
  refreshDevices: () => Promise<void>;
35
40
  bindVideo: (el: HTMLVideoElement | null) => void;
36
41
  };
@@ -22,6 +22,9 @@ function a(a = {}) {
22
22
  permission: t(() => l.value.permission),
23
23
  zoom: t(() => l.value.zoom),
24
24
  zoomCapability: t(() => l.value.zoomCapability),
25
+ torch: t(() => l.value.torch),
26
+ torchCapability: t(() => l.value.torchCapability),
27
+ canLockExposure: t(() => l.value.canLockExposure),
25
28
  isLive: t(() => l.value.state === "live"),
26
29
  isPaused: t(() => l.value.state === "paused"),
27
30
  isStarting: t(() => l.value.state === "starting"),
@@ -36,6 +39,8 @@ function a(a = {}) {
36
39
  selectDevice: (e) => c.selectDevice(e),
37
40
  setResolution: (e) => c.setResolution(e),
38
41
  setZoom: (e) => c.setZoom(e),
42
+ setTorch: (e) => c.setTorch(e),
43
+ setExposureLocked: (e) => c.setExposureLocked(e),
39
44
  refreshDevices: () => c.refreshDevices(),
40
45
  bindVideo: (e) => c.attachVideo(e)
41
46
  };
@@ -10,6 +10,9 @@ export interface CameraSnapshot {
10
10
  permission: CameraPermission;
11
11
  zoom: number;
12
12
  zoomCapability: ZoomCapability | null;
13
+ torch: boolean;
14
+ torchCapability: boolean;
15
+ canLockExposure: boolean;
13
16
  }
14
17
  export interface CameraManagerOptions {
15
18
  preferredFacing?: Facing;
@@ -31,6 +34,9 @@ export declare class CameraManager {
31
34
  private zoom;
32
35
  private zoomCapability;
33
36
  private desiredZoom;
37
+ private torch;
38
+ private torchCapability;
39
+ private canLockExposure;
34
40
  private video;
35
41
  private seq;
36
42
  private tearingDown;
@@ -66,6 +72,9 @@ export declare class CameraManager {
66
72
  /** Restart at a new resolution, keeping the active device. */
67
73
  setResolution(resolution: Resolution): Promise<boolean>;
68
74
  setZoom(value: number): Promise<boolean>;
75
+ setTorch(on: boolean): Promise<boolean>;
76
+ /** Freeze auto-exposure so a screen flash brightens the frame instead of being metered away. */
77
+ setExposureLocked(locked: boolean): Promise<boolean>;
69
78
  refreshDevices(): Promise<void>;
70
79
  dispose(): void;
71
80
  private teardown;
@@ -88,4 +97,5 @@ export declare class CameraManager {
88
97
  private probeDevice;
89
98
  private initPermission;
90
99
  private readZoomCapability;
100
+ private readTorchCapability;
91
101
  }